http://stackoverflow.com/a/21152973
answers question: http://stackoverflow.com/q/21127164
has comment: http://stackoverflow.com/comment/32005824
has comment: http://stackoverflow.com/comment/31860351
has comment: http://stackoverflow.com/comment/32008289
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31884745
has comment: http://stackoverflow.com/comment/31860686
score: 0
has body: WebContent \ WEB-INF \ lib Try fetching your applet back from there, using a direct fetch in the browser address bar, to discover a 'not permitted' error (I think they are response codes in the 500 range). If you cannot retrieve it by direct fetch, the Java Plug-In also cannot access it. The applet needs to be moved to a place outside the WEB-INF directory structure that is accessible to the browser/plug-in. Output of Jar command .. 190418 Tue Jan 14 00:37:22 BRST 2014 WebContent/WEB-INF/lib/gson-2.2.4.jar The standard class-loaders are not designed to work with a 'Jar within a Jar'. It will be necessary to do either of: Extract the Jar and add the content to the main Jar. Separately list the gson-2.2.4.jar Jar in the archive attribute of the applet element (and not have it inside another Jar).
type: Answer
has comment: http://stackoverflow.com/comment/32038172
has comment: http://stackoverflow.com/comment/32080150
has comment: http://stackoverflow.com/comment/31863488
has comment: http://stackoverflow.com/comment/31877012
has comment: http://stackoverflow.com/comment/32078783
has comment: http://stackoverflow.com/comment/31998116
accepted answer of: http://stackoverflow.com/q/21127164
has comment: http://stackoverflow.com/comment/31860886
has comment: http://stackoverflow.com/comment/32038114

http://stackoverflow.com/comment/31852756
type: AnswerComment
comment on: http://stackoverflow.com/a/21160537
has text: Agree @kostja, but was thinking of quick and easy solution, considering O.P.
score: 0
type: Comment

http://stackoverflow.com/q/21064732
favorite count: 0
possible better answer: http://stackoverflow.com/a/21064806
tagged with: android
has answer: http://stackoverflow.com/a/21064806
type: AnsweredQuestion
downvote count: 0
has body: I'm creating a home automation android application with my arduino uno and HC-05 Bluetooth Module. Everything works fine already. It can scan, connect, on/off bluetooth, control the bulb on and off using buttons and switch control but with a bad and plain design of the application. So I decided to use a Tab Widget. The problem is the tab only works when I use a textview in each tab. Everytime I run the app in my phone with my codes that can already control bulbs it will immediately stop and crash. I debug it already for a lot of times since yesterday but still a NullPointerException always exist in the LogCat. Here are the list in the LogCat: 01-12 01:10:35.298: E/AndroidRuntime(27771): FATAL EXCEPTION: main 01-12 01:10:35.298: E/AndroidRuntime(27771): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.javac101/com.example.javac101.MainActivity}: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.javac101/com.example.javac101.ControllerTab}: java.lang.NullPointerException 01-12 01:10:35.298: E/AndroidRuntime(27771): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2343) 01-12 01:10:35.298: E/AndroidRuntime(27771): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395) 01-12 01:10:35.298: E/AndroidRuntime(27771): at android.app.ActivityThread.access$600(ActivityThread.java:162) 01-12 01:10:35.298: E/AndroidRuntime(27771): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364) 01-12 01:10:35.298: E/AndroidRuntime(27771): at android.os.Handler.dispatchMessage(Handler.java:107) 01-12 01:10:35.298: E/AndroidRuntime(27771): at android.os.Looper.loop(Looper.java:194) 01-12 01:10:35.298: E/AndroidRuntime(27771): at android.app.ActivityThread.main(ActivityThread.java:5371) 01-12 01:10:35.298: E/AndroidRuntime(27771): at java.lang.reflect.Method.invokeNative(Native Method) 01-12 01:10:35.298: E/AndroidRuntime(27771): at java.lang.reflect.Method.invoke(Method.j…
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31676549
has answer: http://stackoverflow.com/a/21064825
accepted answer: http://stackoverflow.com/a/21064825
answer count: 2
has comment: http://stackoverflow.com/comment/31676834
upvote count: 1
has title: Null Pointer Exception error after adding a Tab Widget feature

http://stackoverflow.com/a/32479952
type: Answer
answers question: http://stackoverflow.com/q/21043128
has body: The solution is to create the elastcisearch client like this : Settings settings = ImmutableSettings.settingsBuilder() .put(“path.plugins”, “fakeDirectory:\\”) .build(); TransportClient client = new TransportClient(settings); I put a fake directory because ElasticSearch use it when it start to load all eclipse plugins but i d’ont know why !! (see org.elasticsearch.plugins.PluginsService class).
score: 0

http://stackoverflow.com/a/33022204
upvote count: 1
has body: If you have already set JAVA_HOME path in ~/.bashrc file and still Hbase is giving the same error of "JAVA_HOME not found", set JAVA_HOME in /etc/environment file. I face this issue and it worked for me when i set JAVA_HOME in '/etc/environment'
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21116916

http://stackoverflow.com/q/21068120
accepted answer: http://stackoverflow.com/a/21068186
has title: Cannot find symbol IOUtils
tagged with: java
has comment: http://stackoverflow.com/comment/31683075
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31683266
has comment: http://stackoverflow.com/comment/31683421
favorite count: 0
score: -1
has answer: http://stackoverflow.com/a/21068186
linked to: http://stackoverflow.com/q/4716503
has comment: http://stackoverflow.com/comment/31683230
has comment: http://stackoverflow.com/comment/31683413
downvote count: 2
has body: Basically I am trying to take information from a text file and turn it into a string. The code I have is: FileInputStream inputStream = new FileInputStream("filename.txt"); try { String everything = IOUtils.toString(inputStream); } finally { inputStream.close(); } the error message I get is --> java:53: cannot find symbol symbol : class IOUtils location: class CheckSystem I assumed this was because of my imports, but I have io and util and even text imported (just as below) import java.util.*; import java.text.*; import java.io.*; Why can't I access the IOUtils class and its methods? If that cannot be answered, an alternative but very simple means of reading a text file into a string would be fine.
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/31687147
type: Comment
type: AnswerComment
has text: Ha, you got me) Just at the moment I got my reinvented wheel tuned and polished. The only advantage my implementation still have is a more self-explanatory name: 'ImmutableProperty' probably is more obvious to the reader, than 'AtomicMarkableReference'. Take my +1 anyway.
comment on: http://stackoverflow.com/a/21069421
score: 0

http://stackoverflow.com/q/21035498
score: 1
tagged with: java
type: Question
upvote count: 1
tagged with: java-7
has body: I am attempting to upgrade to JDK1.7 but keep getting the following error: me$ sh java_ee_sdk-7-jdk7-macosx-x64-ml.sh Extracting the installer archive... Extracting the installer runtime... Extracting the installer resources... Extracting the installer metadata... Welcome to GlassFish installer Using the user defined JAVA_HOME : /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home Entering setup... SwixML 1.5 (#144) # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x0000000122d9a3f9, pid=1338, tid=50951 # # JRE version: Java(TM) SE Runtime Environment (7.0_45-b18) (build 1.7.0_45-b18) # Java VM: Java HotSpot(TM) 64-Bit Server VM (24.45-b08 mixed mode bsd-amd64 compressed oops) # Problematic frame: # C 0x0000000122d9a3f9 # # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # # An error report file with more information is saved as: # /var/folders/g6/prk7w23x19542y4p1p95phg00000gq/T//hs_err_pid1338.log # # If you would like to submit a bug report, please visit: # http://bugreport.sun.com/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # /tmp/install.010914202419/install/bin/engine-wrapper: line 139: 1338 Abort trap: 6 ${JAVA_HOME}/bin/java ${JAVA_OPTIONS} -Dinstall.engine=${theInstallEngine} -Dinstaller.resources.url=${MEDIALOC}/ -Ddefault.resources.url=file:${INSTALL_HOME}/lib/resources/ -classpath ${theCP} -Dsims.native-file-dir=${INSTALL_HOME}/lib org.openinstaller.core.EngineBootstrap ${INSTALLPROPS} I have checked the answer to a previous question: Java EE installer crashing on Mac OS X Mavericks Please note that that question has been closed, so I cannot comment in order to get more info, so I am having to post a duplicate. However, the solution suggested by @Alexander Zeitler does not work and the post he references is not availa…
linked to: http://stackoverflow.com/q/20009990
answer count: 1
has comment: http://stackoverflow.com/comment/31625453
has answer: http://stackoverflow.com/a/25708632
tagged with: macos
favorite count: 0
type: UnansweredQuestion
tagged with: jakarta-ee
has title: java ee install failing on OSX
downvote count: 0

http://stackoverflow.com/q/21123558
tagged with: java
has comment: http://stackoverflow.com/comment/31785236
type: Question
possible better answer: http://stackoverflow.com/a/21123650
has body: I'm creating a simple window with a background image by Swing java library. The problem is :background image appear only when you resize window. import java.awt.Container; import java.awt.Graphics; import java.awt.Image; import java.awt.LayoutManager; import java.awt.MediaTracker; import java.awt.event.ActionListener; import javax.swing.*; import java.awt.Toolkit; public class StartWindow { JFrame frame; private JButton button; private JButton button2; public void CreateStartWindow() { frame = Window.createwindow(); Container container = frame.getContentPane(); JpanelStart panel = new JpanelStart(); container.add(panel); this.button = new JButton("Start"); this.button2 = new JButton("Classifica"); panel.add(button); panel.add(button2); } public void addActionListener(ActionListener al) { this.button.addActionListener(al); this.button2.addActionListener(al); } public void chiudi() { frame.dispose(); } } class JpanelStart extends JPanel { private Image img; private String path_img="img/sfondo.jpg"; public JpanelStart(){ img = Toolkit.getDefaultToolkit().createImage(path_img); loadImage(img); } private void loadImage(Image img) { try { MediaTracker track = new MediaTracker(this); track.addImage(img, 0); track.waitForID(0); } catch (InterruptedException e) { e.printStackTrace(); } } @Override protected void paintComponent(Graphics g){ setOpaque(false); g.drawImage(img,0, 0, null); super.paintComponent(g); } } Window public class Window extends JFrame { public static JFrame createwindow() {//fare singleton JFrame frame = new JFrame("Battaglia navale"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(640, 640); frame.setVisible(true); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); frame.setLocation(((int)dim.getWidth()-(int)frame.getWidth())/2, ((int)dim.getHeight()-(int)frame.getHeight())/2); return frame; } ; }
has comment: http://stackoverflow.com/comment/31785632
tagged with: image
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21123650
accepted answer: http://stackoverflow.com/a/21123626
tagged with: swing
has comment: http://stackoverflow.com/comment/31785296
type: AnsweredQuestion
has title: Why does the background image only appear after the window is resized?
has answer: http://stackoverflow.com/a/21123626

http://stackoverflow.com/q/21126812
type: Question
score: 5
upvote count: 5
has answer: http://stackoverflow.com/a/21139459
accepted answer: http://stackoverflow.com/a/21139459
downvote count: 0
has title: Bootstrapping JAX-RS (RESTEasy)
tagged with: jax-rs
has answer: http://stackoverflow.com/a/29044814
linked to: http://stackoverflow.com/q/16093875
favorite count: 0
tagged with: resteasy
has body: I am running RESTEasy in an embedded web server (Jetty). My resources need access to a backing data store, configuration of which is passed in on the command line that is used to start our application. Ideally, I'd inject the backing data store resource in the constructor of the resource: @Path("/") public class MappingService{ private final RecordManager recman; public MappingService(RecordManager recman) { this.recman = recman; } @PUT @Path("/mapping/{key}") @Produces({MediaType.APPLICATION_JSON, "application/*+json"}) public Response createMapping(@PathParam("key") String key, @QueryParam("val") String val) { // do stuff with recman ... } } Ideally, I'd configure the RecordManager object elsewhere in the application, then make it available to the MappingService constructor. I see that I can use an Application object to return specific singleton instances. But it looks like RESTEasy constructs the Application object itself - so I'm not seeing any way to pass configuration objects into the Application singleton. So: How do I pass an externally instantiated object into my resource handler? I found this article ( Share variables between JAX-RS requests ) that describes how to use a context listener to add an object to the context and pull it inside the resource handler - but this is horrible - I have to take what should be a POJO and suddenly I've made it highly dependent on it's container. Please tell me there is a better way!
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21127048
tagged with: java
has answer: http://stackoverflow.com/a/21132101
has answer: http://stackoverflow.com/a/21127048

http://stackoverflow.com/comment/31760195
type: Comment
has text: Are you sure Tomcat is using different sessions for your POST and GET requests? Have you tried a debug statement outputting the session id in your server code (for the POST and GET)? There may be other reasons for SessionData=null. For example, what is populating oauthCredentials in your POST code? Could this be throwing an exception? Safari's cross-site security might be affecting this.
type: QuestionComment
comment on: http://stackoverflow.com/q/21100364
score: 0

http://stackoverflow.com/comment/31926107
comment on: http://stackoverflow.com/q/21183941
score: 0
type: Comment
has text: Yes, I already have code to insert rows, I'm just looking for code to create the empty table. Thanks
type: QuestionComment

http://stackoverflow.com/comment/31794979
type: Comment
type: QuestionComment
has text: Who "points to" (or references) B? If *nobody* does then B is *trivially* non-reachable. B might not be strongly reachable in any case, but if it's not trivially reachable that's the end of the story. See [Reachability of an object](http://en.wikipedia.org/wiki/Garbage_collection_(computer_science)#Reachability_of_an_object).
comment on: http://stackoverflow.com/q/21128802
score: 0

http://stackoverflow.com/a/21019040
type: Answer
answers question: http://stackoverflow.com/q/21018709
score: 0
has body: change STRING to TEXT in below arg0.execSQL("CREATE TABLE " + DATABASE_TABLE + " ("+ KEY_ROWID + " INTEGER PRIMARY KEY AUTOINCREMENT, "+ KEY_LEVEL + " STRING NOT NULL, " + KEY_LOCKED + " INTEGER NOT NULL, " + KEY_SEQUENCE + " INTEGER NOT NULL, "+ KEY_TRIES + " INTEGER NOT NULL);"); NOTE :After change please add one to your database version

http://stackoverflow.com/comment/31686071
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21069585
has text: You should try to make the answering of your question easy as possible. You should try to post the simplest piece of code that reproduces your error. Otherwise no one would read all the code you have posted and you won't get an answer quickly.

http://stackoverflow.com/a/21201347
type: AcceptedAnswer
has body: OK - creation of my own Valve was a proper and easy approach, sharing below. Apache did rework AccessLogValve multiple times, but all revisions follow same concept: invoke(...) method just uses getNext().invoke(request,response) to invoke a chain of remaining valves and the actual handler/executor log(...) method is invoked after above is complete So we only need to: also invoke log(...) before the getNext().invoke(request,response) modify log(...) to distinguish "before" and "after" invocations Easiest way would've been: @Override public void invoke(Request request, Response response) throws IOException, ServletException { log(request, response, -1); // negative time indicates "before" super.invoke(request, response); } But tomcat_6.0.16 code wasn't well-extendable, so I prefixed log-messages (in a hard-coded manner) with Thread.getName() and "before"/"after" indicator. Also I preferred to use reflection to access private AccessLogValve.getDate() : package org.apache.catalina.valves; import java.io.IOException; import java.lang.reflect.Method; import java.util.Date; import javax.servlet.ServletException; import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response; public class PreAccessLogValve extends AccessLogValve { @Override public void invoke(Request request, Response response) throws IOException, ServletException { long timeStart = System.currentTimeMillis(); log(request, response, -timeStart); // negative time indicates "before" request getNext().invoke(request, response); log(request, response, System.currentTimeMillis() - timeStart); // actual (positive) - "after" } public void log(Request request, Response response, long time) { if (started &amp;&amp; getEnabled() &amp;&amp; null != logElements &amp;&amp; (null == condition || null == request.getRequest().getAttribute(condition))) { StringBuffer result = new StringBuffer(); try { Date date = (Date) methodGetDate.invoke(this); for (int i = 0; i &lt; logElements.length; i++) …
type: Answer
accepted answer of: http://stackoverflow.com/q/21103382
downvote count: 0
answers question: http://stackoverflow.com/q/21103382
score: 2
upvote count: 2

http://stackoverflow.com/a/21089211
has comment: http://stackoverflow.com/comment/31752991
has body: You can try it: String[] dayArray = {"2 JAN", "3 jan", "4 jan", "5 jan", "6 jan", "7 jan", "8 jan"}; WheelView day; day = (WheelView) findViewById(R.id.day); day.setViewAdapter(new DayArrayAdapter(MainActivity.this, dayArray, weekDay)); day.addChangingListener(new OnWheelChangedListener() { @Override public void onChanged(WheelView wheel, int oldValue, int newValue) { Log.e("onChanged hours", dayArray[newValue]); mCustomDate = dayArray[newValue]; mFinalTime = mCustomDate+" "+mCustomHour+mCustomMinute+" "+mAMORPM; mSeletedDateTextView.setText(mFinalTime); } });
type: Answer
answers question: http://stackoverflow.com/q/21088272
has comment: http://stackoverflow.com/comment/31754154
score: 0

http://stackoverflow.com/q/21111070
answer count: 5
has answer: http://stackoverflow.com/a/40484050
has comment: http://stackoverflow.com/comment/31762149
upvote count: 1
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/40484050
has title: Implementation of k-means clustering algorithm
tagged with: algorithm
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21111362
has answer: http://stackoverflow.com/a/77074451
has answer: http://stackoverflow.com/a/21111871
tagged with: k-means
downvote count: 0
tagged with: data-mining
tagged with: cluster-analysis
has answer: http://stackoverflow.com/a/45345420
has body: In my program, i'm taking k=2 for k-mean algorithm i.e i want only 2 clusters. I have implemented in a very simple and straightforward way, still i'm unable to understand why my program is getting into infinite loop. can anyone please guide me where i'm making a mistake..? for simplicity, i hav taken the input in the program code itself. here is my code : import java.io.*; import java.lang.*; class Kmean { public static void main(String args[]) { int N=9; int arr[]={2,4,10,12,3,20,30,11,25}; // initial data int i,m1,m2,a,b,n=0; boolean flag=true; float sum1=0,sum2=0; a=arr[0];b=arr[1]; m1=a; m2=b; int cluster1[]=new int[9],cluster2[]=new int[9]; for(i=0;i&lt;9;i++) System.out.print(arr[i]+ "\t"); System.out.println(); do { n++; int k=0,j=0; for(i=0;i&lt;9;i++) { if(Math.abs(arr[i]-m1)&lt;=Math.abs(arr[i]-m2)) { cluster1[k]=arr[i]; k++; } else { cluster2[j]=arr[i]; j++; } } System.out.println(); for(i=0;i&lt;9;i++) sum1=sum1+cluster1[i]; for(i=0;i&lt;9;i++) sum2=sum1+cluster2[i]; a=m1; b=m2; m1=Math.round(sum1/k); m2=Math.round(sum2/j); if(m1==a &amp;&amp; m2==b) flag=false; else flag=true; System.out.println("After iteration "+ n +" , cluster 1 :\n"); //printing the clusters of each iteration for(i=0;i&lt;9;i++) System.out.print(cluster1[i]+ "\t"); System.out.println("\n"); System.out.println("After iteration "+ n +" , cluster 2 :\n"); for(i=0;i&lt;9;i++) System.out.print(cluster2[i]+ "\t"); }while(flag); System.out.println("Final cluster 1 :\n"); // final clusters for(i=0;i&lt;9;i++) System.out.print(cluster1[i]+ "\t"); System.out.println(); System.out.println("Final cluster 2 :\n"); for(i=0;i&lt;9;i++) System.out.print(cluster2[i]+ "\t"); } }
favorite count: 0
accepted answer: http://stackoverflow.com/a/21111871

http://stackoverflow.com/q/21030109
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21030524
has comment: http://stackoverflow.com/comment/31613898
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31614116
favorite count: 0
has answer: http://stackoverflow.com/a/21030209
has comment: http://stackoverflow.com/comment/31613850
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21030200
tagged with: regex
score: 1
tagged with: java
has title: Does this regex allow white spaces?
has body: What the following regex mean in java context? [a-zA-Z\\s][a-zA-Z0-9\\s]+$ It should allow white spaces (\t\n...)? but seems only non-space strings pass. Thanks

http://stackoverflow.com/comment/31700682
has text: CAn you check the return value of in.ready() when the data is not available.
comment on: http://stackoverflow.com/a/21077724
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31752457
comment on: http://stackoverflow.com/q/21105377
has text: Well, you have to catch (or list as thrown) all "checked" exceptions or your program won't even compile. (Thank you Mr Goodenough!)
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/21150924
has title: Why is haskell performing worse than java
tagged with: java
accepted answer: http://stackoverflow.com/a/21206042
has comment: http://stackoverflow.com/comment/31838221
tagged with: haskell
has comment: http://stackoverflow.com/comment/31835334
possible better answer: http://stackoverflow.com/a/21151921
downvote count: 2
has comment: http://stackoverflow.com/comment/31835705
score: 5
upvote count: 7
has answer: http://stackoverflow.com/a/21206042
favorite count: 0
has comment: http://stackoverflow.com/comment/31835447
has comment: http://stackoverflow.com/comment/31835764
has comment: http://stackoverflow.com/comment/31840650
has comment: http://stackoverflow.com/comment/31835651
answer count: 3
has body: I wanted to fool a bit around with random numbers, if the random generator in haskell is distributed uniformly or not, thus I wrote the following program after a few tries (with lists being generated leading to stack overflow). module Main where import System.Environment (getArgs) import Control.Applicative ((&lt;$&gt;)) import System.Random (randomRIO) main :: IO () main = do nn &lt;- map read &lt;$&gt; getArgs :: IO [Int] let n = if null nn then 10000 else head nn m &lt;- loop n 0 (randomRIO (0,1)) putStrLn $ "True: "++show (m//n::Double) ++", False "++show ((n-m)//n :: Double) return () loop :: Int -&gt; Int -&gt; IO Double -&gt; IO Int loop n acc x | n&lt;0 = return acc | otherwise = do x' &lt;- round &lt;$&gt; x let x'' = (x' + acc) in x'' `seq` loop (n-1) x'' x (//) :: (Integral a, Fractional b) =&gt; a -&gt; a -&gt; b x // y = fromIntegral x / fromIntegral y as I got it to work ok-ish I decided to write another version - in java (which I am not very good in), and expected haskell to beat it, but the java program ran about half the time compared to the haskell version import java.util.Random; public class MonteCarlo { public static void main(String[] args) { int n = Integer.parseInt(args[0]); Random r = new Random(); int acc = 0; for (int i=0; i&lt;=n; i++) { acc += Math.round(r.nextDouble()); } System.out.println("True: "+(double) acc/n+", False: "+(double)(n-acc)/n); } } I tried to look at the profile of the haskell version - which told me that most of the work was done in the loop - no wonder! I tried to look at the core, but I really don't know enough to understand that. I figure that the java version, may be using more than one core - as the system used more than 100%, when I timed it. I guess one could improve the code using unboxed Doubles/Ints, but again my knowledge of hakell is not up to that.
has comment: http://stackoverflow.com/comment/31835631
has comment: http://stackoverflow.com/comment/31835317
has answer: http://stackoverflow.com/a/21151921
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31933873
has answer: http://stackoverflow.com/a/21152457
type: Question
tagged with: performance
has comment: http://stackoverflow.com/comment/31835503

http://stackoverflow.com/comment/31681354
has text: @Gracchus It wasn't obvious. Some JSON parser/generators use the fields themselves to serialize an object. `flexjson` decided to use mutators/accessors (like `jackson`). You just have to know what to look for.
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21067207

http://stackoverflow.com/comment/31930311
type: QuestionComment
has text: Hi @noloader, how to check whether it's PEM or not PEM?
score: 0
comment on: http://stackoverflow.com/q/21183043
type: Comment

http://stackoverflow.com/q/21168110
has title: NPE caused by Modena.class.getResource("TestApp.css")
tagged with: javafx-8
accepted answer: http://stackoverflow.com/a/21174724
downvote count: 1
tagged with: netbeans
upvote count: 0
has body: I'm trying to run the java-fx sample Modena that can be found here. I use Netbeans 8.0 Beta, JDK8 last release on Windows 8. I wonder why I can't even compile it. In fact the first exception that happens is this. I note to be a newbie in JavaFX. The line of exception in the program is: private static final String testAppCssUrl = Modena.class.getResource("TestApp.css").toExternalForm(); I assert that I verified and the file existed. And the example jar file can be run on my computer with my Java default configuration which is explained above. Exception in thread "JavaFX Application Thread" Exception in thread "main" java.lang.ExceptionInInitializerError at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:340) at com.sun.javafx.application.LauncherImpl$2.run(LauncherImpl.java:330) at com.sun.javafx.application.LauncherImpl$2.run(LauncherImpl.java:330) at com.sun.javafx.application.PlatformImpl$7.run(PlatformImpl.java:331) at com.sun.javafx.application.PlatformImpl$7.run(PlatformImpl.java:331) at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:297) at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:294) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl$6.run(PlatformImpl.java:294) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39) at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112) at java.lang.Thread.run(Thread.java:744) Caused by: java.lang.NullPointerException at modena.Modena.&lt;clinit&gt;(Modena.java:100) ... 13 more java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Delegat…
has answer: http://stackoverflow.com/a/21174724
has comment: http://stackoverflow.com/comment/31866729
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31878188
tagged with: java
tagged with: javafx
score: -1
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/31636919
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21043326
has text: My AdMob account says "Identyfikator jednostki reklamowej: ca-app-pub-3231742841852835/8488524303" i know that ca-app-pub-3231742841852835 is my publisher number, so should i cut it down to 8488524303 only?
score: 0

http://stackoverflow.com/a/21103989
score: 1
answers question: http://stackoverflow.com/q/21103617
downvote count: 0
has body: One solution could be to find the address by looking into Bottom Of home page (some sites put their address at footer) Find address from following pages linked to the main page Contact Us, About Us None of the above approach is guaranteed to retrieve an address ...but is one step closer. Next option could be to lookup the whois to find the registered address. If you are a paid user of lookup service you may be able to lookup address for a particular registrar. But then, there are registries that keeps the address hidden (my own website has the address hidden, it shows the address of service provider).... so not always a success. You can also lookup other services like Crunchbase, and any other directory service as a fallback. So , let's say we assume you are able to get address of 60-70% websites with all techniques mentioned above. There are situation, where you will end up getting multiple address. You should have a logic to resolve to a particular address. Just think of getting address of Pizza Hut from pizzahut.com :-) You can add more intelligence...but hope this is good enough to get you started on right direction.
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31759912

http://stackoverflow.com/q/21034677
downvote count: 0
has answer: http://stackoverflow.com/a/21056903
favorite count: 0
accepted answer: http://stackoverflow.com/a/21056903
type: AnsweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
has title: How to select cipher suites in Jersey 2 using ApacheConnector?
tagged with: ssl
tagged with: jersey
has body: I am using Jersey 2 as client to access a web service using TLS. I would like to select ciphers that are used by TLS, and I don't know how. My code: ClientConfig clientConfig = new ClientConfig(); clientConfig.connectorProvider(new ApacheConnectorProvider()); SslConfigurator sslConfig = SslConfigurator.newInstance() .trustStoreFile("truststore.jks") .trustStorePassword("asdfgh") .keyStoreFile("keystore.jks") .keyPassword("asdfgh") .securityProtocol("TLS"); // there is no method to select cipher suites for SslConfigurator clientConfig.property(ApacheClientProperties.SSL_CONFIG, sslContext); Client client = ClientBuilder.newBuilder() .withConfig(clientConfig) .build();
tagged with: apache
answer count: 1

http://stackoverflow.com/a/34213506
answers question: http://stackoverflow.com/q/21073123
upvote count: 2
has body: This worked for me: mvn clean install tomcat7:run
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/21041391
upvote count: 0
score: -2
type: Answer
has comment: http://stackoverflow.com/comment/32078204
downvote count: 2
has body: you can use while loop i think i don't know too much about server connection but if you can pass boolean or specific string from the and inside the service class of your app create a while true like this: while(true){ if(ServerString.contentEquals("") || boolean == true{ //coding } try{ Tread.sleep(60)} catch(Exception e){e.printStackTrace } } the fastest way of learning a service in here video made by a girl
answers question: http://stackoverflow.com/q/21041259

http://stackoverflow.com/comment/31810740
comment on: http://stackoverflow.com/a/21136731
score: 0
type: AnswerComment
type: Comment
has text: It is just a bad practice for single threaded env. because u will always be able to find the cause after the changed value. but sometimes that can be difficult :p

http://stackoverflow.com/q/21139510
tagged with: android
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/21141182
type: Question
tagged with: accelerometer
has body: I'm quite new to android so forgive me if I am asking a dead simple question. Basically What I want to do is Display a number. when the value of Y, event.value[1] is between 1 and 7. I can display values of X Y Z position. but as soon as I add if statement to check my app stops working (See code below) I really need someones help please. Thanks you for your help. public void onSensorChanged(SensorEvent event) { // TODO Auto-generated method stub float x = event.values[0]; float y = event.values[1]; float z = event.values[2]; int YValueMin = 1; int YValueMax = 7; accelero.setText("X: "+event.values[0]+ "\nY: "+event.values[1]+ "\nZ: "+event.values[2]); if (y &gt;= YValueMin &amp;&amp; y &lt;= YValueMax ){ RepCounter.setText("1"); } else { RepCounter.setText(" "); } }
downvote count: 0
has title: How to display a number using Accelerometer value
has comment: http://stackoverflow.com/comment/31813616
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21141182

http://stackoverflow.com/a/21050667
downvote count: 1
type: AcceptedAnswer
type: Answer
has body: Add a and b to the System.out.println() statement: System.out.println("Element[" + a + "][" + b + "] is faulty");
answers question: http://stackoverflow.com/q/21050626
score: 1
has comment: http://stackoverflow.com/comment/31650501
has comment: http://stackoverflow.com/comment/31651178
accepted answer of: http://stackoverflow.com/q/21050626
upvote count: 2

http://stackoverflow.com/a/21171795
score: 2
answers question: http://stackoverflow.com/q/21171737
downvote count: 0
upvote count: 2
has body: Think about what happens if an InputMismatchException occurs. Your code will catch it, print "Error: Insert a number.". And then what? Your function is declared to return an int and it has a path in which it does not return anything. You should either return a value that cannot be returned otherwise, and indicates an error, or rethrow the exception.
type: Answer

http://stackoverflow.com/a/21085580
answers question: http://stackoverflow.com/q/21085459
type: Answer
has comment: http://stackoverflow.com/comment/31724397
score: 0
has body: use following way to achieve public String getIpAddr() { WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE); WifiInfo wifiInfo = wifiManager.getConnectionInfo(); int ip = wifiInfo.getIpAddress(); String ipString = String.format( "%d.%d.%d.%d", (ip &amp; 0xff), (ip &gt;&gt; 8 &amp; 0xff), (ip &gt;&gt; 16 &amp; 0xff), (ip &gt;&gt; 24 &amp; 0xff)); return ipString; } Please Note: You need to add android.permission.INTERNET and android.permission.ACCESS_WIFI_STATE in your AndroidManifest.xml as to access the code. &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt; for google play similar type of app look at https://play.google.com/store/apps/details?id=com.roamingsoft.manager&amp;hl=en
has comment: http://stackoverflow.com/comment/31720370

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/21178674
tags question: http://stackoverflow.com/q/21112217
tags question: http://stackoverflow.com/q/21103990
tags question: http://stackoverflow.com/q/21037717
tags question: http://stackoverflow.com/q/21160297
tags question: http://stackoverflow.com/q/21099562
tags question: http://stackoverflow.com/q/21072958
tags question: http://stackoverflow.com/q/21119999
tags question: http://stackoverflow.com/q/21172794
tags question: http://stackoverflow.com/q/21161649
tags question: http://stackoverflow.com/q/21040117
tags question: http://stackoverflow.com/q/21046898
tags question: http://stackoverflow.com/q/21149005
tags question: http://stackoverflow.com/q/21115509
tags question: http://stackoverflow.com/q/21103801
tags question: http://stackoverflow.com/q/21049136
tag name: jfreechart
tags question: http://stackoverflow.com/q/21039397

http://stackoverflow.com/comment/31741893
type: Comment
has text: Static, always X number of rows. Any advice you have is appreciated!
comment on: http://stackoverflow.com/q/21092638
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31802056
has text: Actually I know about abstract classes and their use but I could not understand why an abstract method was called from within an abstract class.
score: 0
comment on: http://stackoverflow.com/q/21131482
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31870676
comment on: http://stackoverflow.com/q/21170743
has text: Does it even compile ? AFAIK 1 and 2 are not legal identifiers in java
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/31822794
type: Comment
comment on: http://stackoverflow.com/a/21104429
has text: @user3192253: No need to apologize. Re: "I am taking `list` and I am splitting it into `firHalf` and `secHalf`. I don't need `list` anymore": Yeah, I find that weird. There's no reason for `split` to destroy `list`.
score: 0
type: AnswerComment

http://stackoverflow.com/a/21068515
type: Answer
accepted answer of: http://stackoverflow.com/q/21068389
has comment: http://stackoverflow.com/comment/31684629
has comment: http://stackoverflow.com/comment/31684438
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31683969
upvote count: 2
has comment: http://stackoverflow.com/comment/31684546
has body: In your first.jsp file, try using $.post instead (more appropriate). $.post("second.jsp", {'name': name}, function(data) { alert("Result from second.jsp: " + data.name + " " + data.type); } ); In your second.jsp file, you can now get "name" variable like this request.getParameter("name") Then, do your query and return the result &lt;%@page import="org.json.simple.JSONObject"%&gt; &lt;% if (request.getParameter("name") != null) { response.setContentType("application/json"); ... your select query ... JSONObject json = new JSONObject(); ... put your sql data like this ... json.put("name", "hello"); json.put("type", "world"); response.getWriter().write(json.toString()); } %&gt;
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31684034
answers question: http://stackoverflow.com/q/21068389
has comment: http://stackoverflow.com/comment/31684052

http://stackoverflow.com/q/21061840
has comment: http://stackoverflow.com/comment/31671371
tagged with: subclass
answer count: 4
has answer: http://stackoverflow.com/a/21061914
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21061905
has title: Override a class' method by iterating over a subclass
has answer: http://stackoverflow.com/a/21061916
tagged with: java
tagged with: methods
type: Question
tagged with: superclass
has answer: http://stackoverflow.com/a/21061906
tagged with: inheritance
has body: This is a complicated problem to explain so I did a crappy MSPaint diagram. Say I have a list of Subclass objects. Some of them contain a method called onEvent();. Inside my onEvent(); from a completely unrelated class I want to iterate through my list of objects and call their onEvent();s if they exist. Obviously if I try to iterate through a list of type Superclass it must be an abstract method to work. I only want a certain few subclasses to have this onEvent() method. I might have made it hard to understand but I hope you get it, any ideas would be appreciated.
possible better answer: http://stackoverflow.com/a/21061906
score: 0
has answer: http://stackoverflow.com/a/21061905

http://stackoverflow.com/q/21024224
tagged with: sql
score: 3
has answer: http://stackoverflow.com/a/21024502
downvote count: 0
has comment: http://stackoverflow.com/comment/31637422
favorite count: 0
has body: I need to fetch data from multiple tables and export into excel sheet for each table. I don't want to use the getXXX() method as there are large number of columns and I don’t know the data type of each column. I need to fetch an entire row and store in the result in List. I fetched each column using getObject() and also the class type using MetaData.getColumnClassName(). For example Object val = resultSet.getObject(i); I try to cast this val to its actual type using getColumnClassName() but it gives me an error while casting. Can anyone please help me. public class Row { public Map&lt;Object, Class&gt; row; public static Map&lt;String, Class&gt; TYPE; static { TYPE = new HashMap&lt;String, Class&gt;(); TYPE.put("INTEGER", Integer.class); TYPE.put("NUMERIC", BigDecimal.class); TYPE.put("DOUBLE", Double.class); TYPE.put("VARCHAR2", String.class); } public Row() { row = new HashMap&lt;Object, Class&gt;(); } public &lt;t&gt; void add(t data) { row.put(data, data.getClass()); } public void add(Object data, String sqlType) { add((Row.TYPE.get(sqlType)) data); } public static void formTable(ResultSet rs, List&lt;Row&gt; table) throws SQLException { if(rs == null) return; ResultSetMetaData rsmd = rs.getMetaData(); int colCt = rsmd.getColumnCount(); while(rs.next()) { Row row = new Row(); for(int i = 0; i &lt; colCt; i++) { row.add(rs.getObject(i), rsmd.getColumnTypeName(i)); } table.add(row); } } public static void main(String[] args) { } }
type: Question
tagged with: jdbc
has comment: http://stackoverflow.com/comment/31603167
has comment: http://stackoverflow.com/comment/31603333
has answer: http://stackoverflow.com/a/21024433
upvote count: 3
has comment: http://stackoverflow.com/comment/31602802
answer count: 3
has comment: http://stackoverflow.com/comment/31602857
has comment: http://stackoverflow.com/comment/31602790
tagged with: excel
tagged with: java
has title: Fetch an entire row with jdbc as a List
accepted answer: http://stackoverflow.com/a/21024433
has answer: http://stackoverflow.com/a/45231400
possible better answer: http://stackoverflow.com/a/21024502
has comment: http://stackoverflow.com/comment/31693649
type: AnsweredQuestion

http://stackoverflow.com/comment/31743650
comment on: http://stackoverflow.com/q/21100694
type: Comment
type: QuestionComment
has text: The issue is that it the Solution.Binary.Route.Payload object contains methods for the attributes but not the inner element data (I would expect a method to retrieve the CDATA string data).
score: 0

http://stackoverflow.com/comment/55817869
has text: result is a long, not an int.
type: Comment
comment on: http://stackoverflow.com/a/29014111
score: 0
type: AnswerComment

http://stackoverflow.com/q/21128408
has comment: http://stackoverflow.com/comment/31794897
possible better answer: http://stackoverflow.com/a/21129058
has comment: http://stackoverflow.com/comment/31794611
has comment: http://stackoverflow.com/comment/31794829
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31794210
has answer: http://stackoverflow.com/a/21129058
has comment: http://stackoverflow.com/comment/31794343
has comment: http://stackoverflow.com/comment/31794885
tagged with: java
has answer: http://stackoverflow.com/a/21128650
type: Question
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/31794834
favorite count: 0
has title: How to call a method from another method
accepted answer: http://stackoverflow.com/a/21128650
tagged with: android
has comment: http://stackoverflow.com/comment/31794953
has body: I am trying to call a method outwith onCreate inside of the onCreate thread. It however says the method cannot be resolved. I know the method cannot be inside of the onCreate thread so how do you call a method from it. Here is my code for the class. package com.alarm.mobilegame; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class startGames extends MainActivity { public void additionCalc() { int Min = 1; int Max = 99; int a = Min + (int)Math.random()*(Max-Min); int b = Min + (int)Math.random()*(Max-Min); int c = (int) a + b; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.start_game1); Button buttonMathStart = (Button) findViewById(R.id.button1); buttonMathStart.setOnClickListener(new OnClickListener() { public void onClick(View v) { TextView addquestion; TextView subquestion; TextView divquestion; TextView mulquestion; addition.calc(); addquestion = (TextView) findViewById(R.id.textView1); addquestion.setText("" + a, b); subquestion = (TextView) findViewById(R.id.textView2); subquestion.setText("sub"); divquestion = (TextView) findViewById(R.id.textView3); divquestion.setText("div"); mulquestion = (TextView) findViewById(R.id.textView4); mulquestion.setText("mul"); }}); } }
downvote count: 3
score: -3

java
tags question: http://stackoverflow.com/q/21068291
tags question: http://stackoverflow.com/q/21147506
tags question: http://stackoverflow.com/q/21167200
tags question: http://stackoverflow.com/q/21177533
tags question: http://stackoverflow.com/q/21070551
tags question: http://stackoverflow.com/q/21060992
tags question: http://stackoverflow.com/q/21078522
tags question: http://stackoverflow.com/q/21118370
tags question: http://stackoverflow.com/q/21166633
tags question: http://stackoverflow.com/q/21139071
tags question: http://stackoverflow.com/q/21094049
tags question: http://stackoverflow.com/q/21175019
tags question: http://stackoverflow.com/q/21073514
tags question: http://stackoverflow.com/q/21100834
tags question: http://stackoverflow.com/q/21022995
tags question: http://stackoverflow.com/q/21149149
tags question: http://stackoverflow.com/q/21062325
tags question: http://stackoverflow.com/q/21097489
tags question: http://stackoverflow.com/q/21119667
tags question: http://stackoverflow.com/q/21178646
tags question: http://stackoverflow.com/q/21094431
tags question: http://stackoverflow.com/q/21045771
tags question: http://stackoverflow.com/q/21067624
tags question: http://stackoverflow.com/q/21107520
tags question: http://stackoverflow.com/q/21154400
tags question: http://stackoverflow.com/q/21153110
tags question: http://stackoverflow.com/q/21099562
tags question: http://stackoverflow.com/q/21102166
tags question: http://stackoverflow.com/q/21072958
tags question: http://stackoverflow.com/q/21040316
tags question: http://stackoverflow.com/q/21108953
tags question: http://stackoverflow.com/q/21119456
tags question: http://stackoverflow.com/q/21061272
tags question: http://stackoverflow.com/q/21058211
tags question: http://stackoverflow.com/q/21026052
tags question: http://stackoverflow.com/q/21049863
tags question: http://stackoverflow.com/q/21139839
tags question: http://stackoverflow.com/q/21112217
tags question: http://stackoverflow.com/q/21120756
tags question: http://stackoverflow.com/q/21075879
tags question: http://stackoverflow.com/q/21130561
tags question: http://stackoverflow.com/q/21063286
tags question: http://stackoverflow.com/q/21096212
tags question: http://stackoverflow.com/q/21146973
tags question: http://stackoverflow.com/q/21062116
tags question: http://stackoverflow.com/q/21151270
tags question: http://stackoverflow.com/q/21167859
tags question: http://stackoverflow.com/q/21095959
tags question: http://stackoverflow.com/q/21180434
tags question: http://stackoverflow.com/q/21174238
tags question: http://stackoverflow.com/q/21062484
tags question: http://stackoverflow.com/q/21025803
tags question: http://stackoverflow.com/q/21173935
tags question: http://stackoverflow.com/q/21048306
tags question: http://stackoverflow.com/q/21125806
tags question: http://stackoverflow.com/q/21109871
tags question: http://stackoverflow.com/q/21158165
tags question: http://stackoverflow.com/q/21123319
tags question: http://stackoverflow.com/q/21110537
tags question: http://stackoverflow.com/q/21048473
tags question: http://stackoverflow.com/q/21182037
tags question: http://stackoverflow.com/q/21093034
tags question: http://stackoverflow.com/q/21110178
tags question: http://stackoverflow.com/q/21088138
tags question: http://stackoverflow.com/q/21046646
tags question: http://stackoverflow.com/q/21047446
tags question: http://stackoverflow.com/q/21098618
tags question: http://stackoverflow.com/q/21025322
tags question: http://stackoverflow.com/q/21177513
tags question: http://stackoverflow.com/q/21172354
tags question: http://stackoverflow.com/q/21080804
tags question: http://stackoverflow.com/q/21170732
tags question: http://stackoverflow.com/q/21089057
tags question: http://stackoverflow.com/q/21123972
tags question: http://stackoverflow.com/q/21138350
tags question: http://stackoverflow.com/q/21068345
tags question: http://stackoverflow.com/q/21076633
tags question: http://stackoverflow.com/q/21056437
tags question: http://stackoverflow.com/q/21064355
tags question: http://stackoverflow.com/q/21080162

http://stackoverflow.com/comment/31897666
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/21171398
type: Comment
has text: @A4L I fixed the regex regarding the leading space: I changed the order of the alternation in the first regex to *first* match spaces at start of lines, then if they are not found to match other multiple spaces (regex will find alternate matches in the order they are coded). To explain the regex would take a while. I don't have time now - maybe later (I'll let you know)

http://stackoverflow.com/a/21033040
score: 1
upvote count: 1
has body: Running your code I am not sure if that's exactly what you're looking for. But if it is - here is the Java port of the code in the links I provided above. public class Test0010 { public static void main(String[] a) { brackets(5); } public static void brackets(int n) { for (int i = 1; i &lt;= n; i++) { brackets("", 0, 0, i); } } private static void brackets(String output, int open, int close, int pairs) { if ((open == pairs) &amp;&amp; (close == pairs)) { System.out.println(output); } else { if (open &lt; pairs) brackets(output + "(", open + 1, close, pairs); if (close &lt; open) brackets(output + ")", open, close + 1, pairs); } } }
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21032867

http://stackoverflow.com/a/62087335
has comment: http://stackoverflow.com/comment/132009944
upvote count: 61
has body: You can also use @ElementCollection: @ElementCollection private List&lt;String&gt; tags;
score: 60
downvote count: 1
has comment: http://stackoverflow.com/comment/121475807
answers question: http://stackoverflow.com/q/21059451
type: Answer

http://stackoverflow.com/comment/31779628
has text: I don't understand your question/problem. It seems like you are comparing two different things.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21120689
type: QuestionComment

http://stackoverflow.com/comment/31678170
type: Comment
has text: @SpaceGhost: "would I have to actually learn it to properly build something like what I want?" -- yes. "Or are there built in methods I can use that would aid with this" -- the built-in methods are JavaScript, within the browser.
comment on: http://stackoverflow.com/a/21065227
type: AnswerComment
score: 0

http://stackoverflow.com/q/21046712
tagged with: java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21046799
accepted answer: http://stackoverflow.com/a/21046799
tagged with: persistence
tagged with: one-to-one
has body: I have two entities Travel and Assurance with @OneToOne relationship. Both entities must be created via the same interface with a Save botton. I use this method: ManagedBean.java: public String add(){ newTravel = manager.createTravel(arrivalDate, returnDate, lengthToStay, addToStay, visitPurpose); newAssurance = manager.createAssurance(company, assuranceStart, assuranceEnd, newTravel); return "Travellers"; } In the database, I found the Travel_Id associated to the Assurance but The Assurance_Id is null in the Travels Table.
type: AnsweredQuestion
tagged with: managed-bean
type: Question
has title: How to persist two entities at the same time with @OneToOne relationship?

http://stackoverflow.com/q/21144132
has title: Letters having the same equivalence
accepted answer: http://stackoverflow.com/a/21144803
has comment: http://stackoverflow.com/comment/31822472
answer count: 1
has comment: http://stackoverflow.com/comment/31822312
favorite count: 0
has comment: http://stackoverflow.com/comment/31822347
has comment: http://stackoverflow.com/comment/31822376
upvote count: 2
has body: Looking ideas on how to go about accomplishing this. Basically I want certain characters to have equivalence. For example: M = N So: Mum = Nun However: Mum can also equal Num. I was advised to try a map of replacements and this worked until the third example where not all M's are to be changed to N's. Thanks This is the code for the map of replacements: HashMap&lt;String,String&gt; replacements = new HashMap&lt;&gt;(); replacements.put("n","m"); replacements.put("m","n"); String ignoreFirstChar = names[j].charAt(0) + (names[j].substring(1,names[j].length()).replaceAll("[^a-zA-Z]+", "").toLowerCase()); String result = ""; for(int i1 = 0; i1 &lt; ignoreFirstChar.length(); i1++) { String rpl = replacements.get(ignoreFirstChar.charAt(i1)+""); result += rpl==null?ignoreFirstChar.charAt(i1):rpl; } System.out.println(ignoreFirstChar); System.out.println(result);
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21144803
has comment: http://stackoverflow.com/comment/31822077
has comment: http://stackoverflow.com/comment/31822097
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31822802
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31822277

http://stackoverflow.com/comment/31641381
type: QuestionComment
comment on: http://stackoverflow.com/q/21045536
type: Comment
has text: I have no product. I am running under Eclipse.
score: 0

http://stackoverflow.com/comment/31721475
type: QuestionComment
comment on: http://stackoverflow.com/q/21087339
score: 0
type: Comment
has text: Make a Screenshot, better create new Question.

http://stackoverflow.com/q/21021179
possible better answer: http://stackoverflow.com/a/21023837
favorite count: 0
type: Question
has title: Regex for allowed characters in string returns false
has body: I have a requirement which states as below The following special characters are allowed with restrictions in the input string: . ""(),:;&lt;&gt;@[\] The restrictions for the special characters are that they must only be used when contained between quotation marks. For a simple test for ":" within input string, I wrote code as below: private static void testEmailPattern() { String email = "Test\":\"mail"; String PATTERN = "[\":\"]*"; boolean isValidEmail = email.matches(PATTERN); System.out.println("Status: " + isValidEmail); } but this code returns false as opposed to true. Edit: After reading comments, I modified that code to this, but it is still showing false. I modified my code and made it as below: public class TestFeatures { private Pattern pattern; private Matcher matcher; private static final String PATTERN = "[.*\":\".*]*"; public TestFeatures() { initEmailPattern(); } private void initEmailPattern() { pattern = Pattern.compile(PATTERN); } public boolean validate(final String hex) { matcher = pattern.matcher(hex); return matcher.matches(); } /** * @param args */ public static void main(String[] args) { testEmailPattern(); } private static void testEmailPattern() { String email = "Test\":\"mail@mail.com"; TestFeatures thisClazz = new TestFeatures(); boolean isValidEmail = thisClazz.validate(email); System.out.println("Status: " + isValidEmail); } }
tagged with: regex
tagged with: java
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/31597192
has answer: http://stackoverflow.com/a/21021474
has comment: http://stackoverflow.com/comment/31596975
has comment: http://stackoverflow.com/comment/31596916
has answer: http://stackoverflow.com/a/21023837
type: AnsweredQuestion
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/21021474

http://stackoverflow.com/comment/66877988
type: AnswerComment
has text: I'm getting this `java.io.IOException: Hostname someHostName was not verified` any idea?
type: Comment
comment on: http://stackoverflow.com/a/21225713
score: 0

http://stackoverflow.com/a/21088334
has comment: http://stackoverflow.com/comment/90494566
has comment: http://stackoverflow.com/comment/51061883
has body: This is certainly possible with the recursive bound, but the subtype builders need to also be generic, and you need a few interim abstract classes. It's a little bit cumbersome, but it's still easier than the non-generic version. /** * Extend this for Mammal subtype builders. */ abstract class GenericMammalBuilder&lt;B extends GenericMammalBuilder&lt;B&gt;&gt; { String sex; String name; B sex(String sex) { this.sex = sex; return self(); } B name(String name) { this.name = name; return self(); } abstract Mammal build(); @SuppressWarnings("unchecked") final B self() { return (B) this; } } /** * Use this to actually build new Mammal instances. */ final class MammalBuilder extends GenericMammalBuilder&lt;MammalBuilder&gt; { @Override Mammal build() { return new Mammal(this); } } /** * Extend this for Rabbit subtype builders, e.g. LopBuilder. */ abstract class GenericRabbitBuilder&lt;B extends GenericRabbitBuilder&lt;B&gt;&gt; extends GenericMammalBuilder&lt;B&gt; { Color furColor; B furColor(Color furColor) { this.furColor = furColor; return self(); } @Override abstract Rabbit build(); } /** * Use this to actually build new Rabbit instances. */ final class RabbitBuilder extends GenericRabbitBuilder&lt;RabbitBuilder&gt; { @Override Rabbit build() { return new Rabbit(this); } } There's a way to avoid having the "concrete" leaf classes, where if we had this: class MammalBuilder&lt;B extends MammalBuilder&lt;B&gt;&gt; { ... } class RabbitBuilder&lt;B extends RabbitBuilder&lt;B&gt;&gt; extends MammalBuilder&lt;B&gt; { ... } Then you need to create new instances with a diamond, and use wildcards in the reference type: static RabbitBuilder&lt;?&gt; builder() { return new RabbitBuilder&lt;&gt;(); } That works because the bound on the type variable ensures that all the methods of e.g. RabbitBuilder have a return type with RabbitBuilder, even when the type argument is just a wildcard. I'm not much of a fan of that, though, because you need to use wildcards everywhere, and you can…
has comment: http://stackoverflow.com/comment/31728037
type: Answer
has comment: http://stackoverflow.com/comment/31724964
has comment: http://stackoverflow.com/comment/98047258
has comment: http://stackoverflow.com/comment/98036350
score: 69
has comment: http://stackoverflow.com/comment/31731408
downvote count: 1
has comment: http://stackoverflow.com/comment/51064210
has comment: http://stackoverflow.com/comment/51061819
upvote count: 70
answers question: http://stackoverflow.com/q/21086417
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21086417

http://stackoverflow.com/q/21171862
has comment: http://stackoverflow.com/comment/31872816
has comment: http://stackoverflow.com/comment/31872781
answer count: 1
type: UnansweredQuestion
tagged with: sql-injection
tagged with: java
type: Question
tagged with: c#
has answer: http://stackoverflow.com/a/21171889
has title: prevent the sql injection through url
has body: Does validating the URL against special characters prevent sql injections? Somehing like this: validateRequest(req.getUri()); In which I validate for special characters.
score: 0
has comment: http://stackoverflow.com/comment/31873621

http://stackoverflow.com/comment/31818193
type: Comment
has text: @Wei, It should already do that. Just not on a single line (because of the `println` call).
comment on: http://stackoverflow.com/a/21141913
type: AnswerComment
score: 0

junit-runner
tag name: junit-runner
type: Tag
tags question: http://stackoverflow.com/q/21098072

http://stackoverflow.com/q/21076729
has answer: http://stackoverflow.com/a/21076781
score: 0
has comment: http://stackoverflow.com/comment/31708976
possible better answer: http://stackoverflow.com/a/21076781
has comment: http://stackoverflow.com/comment/31699459
tagged with: regex
accepted answer: http://stackoverflow.com/a/21076835
has comment: http://stackoverflow.com/comment/31700915
has body: I have this code for Identifying the comments and print them in java import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Solution { public static void main(String[] args) { Pattern pattern = Pattern.compile("(\\/\\*((.|\n)*)\\*\\/)|\\/\\/.*"); String code = ""; Scanner scan = new Scanner(System.in); while(scan.hasNext()) { code+=(scan.nextLine()+"\n"); } Matcher matcher = pattern.matcher(code); int nxtBrk=code.indexOf("\n"); while(matcher.find()) { int i=matcher.start(),j=matcher.end(); if(nxtBrk&lt;i) { System.out.print("\n"); } System.out.print(code.substring(i,j)); nxtBrk = code.indexOf("\n",j); } scan.close(); } } Now when I try the code against this input /*This is a program to calculate area of a circle after getting the radius as input from the user*/ \#include&lt;stdio.h&gt; int main() { //something It outputs right and only the comments. But when I give the input /*This is a program to calculate area of a circle after getting the radius as input from the user*/ \#include&lt;stdio.h&gt; int main() {//ok } /*A test run for the program was carried out and following output was observed If 50 is the radius of the circle whose area is to be calculated The area of the circle is 7857.1429*/ The program outputs the whole code instead of just the comments. I don't know what wrong is doing the addition of that last lines. EDIT: parser is not an option because I am solving problems and I have to use programming language . link https://www.hackerrank.com/challenges/ide-identifying-comments
has title: regex comment matching code in java not working properly
has comment: http://stackoverflow.com/comment/31698926
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21076835
answer count: 2

audio
tags question: http://stackoverflow.com/q/21080710
tags question: http://stackoverflow.com/q/21077052
tags question: http://stackoverflow.com/q/21095293
tags question: http://stackoverflow.com/q/21170955
type: Tag
tag name: audio
tags question: http://stackoverflow.com/q/21169610
tags question: http://stackoverflow.com/q/21021637
tags question: http://stackoverflow.com/q/21146973
tags question: http://stackoverflow.com/q/21174238
tags question: http://stackoverflow.com/q/21022554
tags question: http://stackoverflow.com/q/21143903
tags question: http://stackoverflow.com/q/21056057
tags question: http://stackoverflow.com/q/21128797
tags question: http://stackoverflow.com/q/21087458
tags question: http://stackoverflow.com/q/21124676
tags question: http://stackoverflow.com/q/21056992

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

http://stackoverflow.com/a/21161792
score: 0
has body: use this I hope this would work for you: java -cp &lt;your jar file location&gt; package.mainclass
type: Answer
answers question: http://stackoverflow.com/q/21161679

http://stackoverflow.com/q/21169884
has answer: http://stackoverflow.com/a/21195207
has title: Servlet filter wrapper - trouble changing content type
favorite count: 0
score: 5
tagged with: servlet-filters
answer count: 1
accepted answer: http://stackoverflow.com/a/21195207
upvote count: 5
tagged with: java
has body: I have RESTful web service which is consumed by javascript. This service returns a content type of "application/json". However, for IE the content type must be "text/html". So I written a filter and wrapper to change the content type when IE is detected as the client. My logic seems to have no effect on the content type. What am I doing wrong? The filter: public class IE8Filter implements Filter { private Logger logger = LoggerHelper.getLogger(); @Override public void destroy() {} @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) res; String userAgent = request.getHeader("User-Agent"); logger.debugf("User Agent = '%s'", userAgent); IE8FilterResponseWrapper wrapper = new IE8FilterResponseWrapper(response); chain.doFilter(req, wrapper); if (userAgent.contains("MSIE 8") || userAgent.contains("MSIE 7")) { wrapper.setContentType("text/html"); logger.debugf("Content Type = '%s'", wrapper.getContentType()); } } @Override public void init(FilterConfig arg0) throws ServletException {} } The wrapper: public class IE8FilterResponseWrapper extends HttpServletResponseWrapper { private String contentType; public IE8FilterResponseWrapper(HttpServletResponse response) { super(response); } public void setContentType(String type) { this.contentType = type; super.setContentType(type); } public String getContentType() { return contentType; } }
has comment: http://stackoverflow.com/comment/119320994
downvote count: 0
has comment: http://stackoverflow.com/comment/31880624
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/31826659
has text: Is anything else in your EmptyFrame2 class?
type: Comment
comment on: http://stackoverflow.com/q/21146397
score: 0
type: QuestionComment

http://stackoverflow.com/q/21156503
tagged with: jung
tagged with: jung2
linked to: http://stackoverflow.com/q/10470213
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has body: the title pretty much sums it all - I'm using Jung as my graph model and I want to clone my graphs. is there a best-practice for this? thanks
has comment: http://stackoverflow.com/comment/31845099
has title: what's the best way to clone a graph in Jung?
upvote count: 1
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21156653
accepted answer: http://stackoverflow.com/a/21156653

twitter
tags question: http://stackoverflow.com/q/21084222
type: Tag
tag name: twitter
tags question: http://stackoverflow.com/q/21122979

libgdx
tags question: http://stackoverflow.com/q/21161129
tags question: http://stackoverflow.com/q/21134546
tags question: http://stackoverflow.com/q/21071732
tags question: http://stackoverflow.com/q/21045049
tags question: http://stackoverflow.com/q/21079122
tags question: http://stackoverflow.com/q/21143768
tag name: libgdx
tags question: http://stackoverflow.com/q/21026083
tags question: http://stackoverflow.com/q/21047701
tags question: http://stackoverflow.com/q/21072691
tags question: http://stackoverflow.com/q/21139801
tags question: http://stackoverflow.com/q/21062423
tags question: http://stackoverflow.com/q/21164348
tags question: http://stackoverflow.com/q/21066017
tags question: http://stackoverflow.com/q/21148631
tags question: http://stackoverflow.com/q/21118133
type: Tag
tags question: http://stackoverflow.com/q/21109340
tags question: http://stackoverflow.com/q/21139800
tags question: http://stackoverflow.com/q/21142434
tags question: http://stackoverflow.com/q/21062928
tags question: http://stackoverflow.com/q/21025322
tags question: http://stackoverflow.com/q/21089057
tags question: http://stackoverflow.com/q/21068345
tags question: http://stackoverflow.com/q/21028507
tags question: http://stackoverflow.com/q/21132816
tags question: http://stackoverflow.com/q/21062942
tags question: http://stackoverflow.com/q/21068027
tags question: http://stackoverflow.com/q/21064578
tags question: http://stackoverflow.com/q/21064907
tags question: http://stackoverflow.com/q/21158321
tags question: http://stackoverflow.com/q/21026630
tags question: http://stackoverflow.com/q/21075543
tags question: http://stackoverflow.com/q/21062572
tags question: http://stackoverflow.com/q/21034448
tags question: http://stackoverflow.com/q/21074512
tags question: http://stackoverflow.com/q/21167596
tags question: http://stackoverflow.com/q/21180691
tags question: http://stackoverflow.com/q/21137433

http://stackoverflow.com/a/21036759
upvote count: 2
has body: Using something like Restlet doesn't necessary exclude JavaEE (you can use RestLet within JavaEE platforms). Traditionally, JavaEE containers provide standardized services to applications. If you wanted to have a way to store your data transactionally, you'd write some EJBs because you didn't have to come up with the transactional model. The container provided that. You just focused on the entity and session beans that are specific to your domain. Spring came along and provided a lot of the same capabilities in its own implementations (sharing some specifications and coming up with their own). But at the end of the day, you're using a common model for doing stuff. JavaEE (or Spring) aren't limited to transactional models. JavaEE incorporates Servlets which in turns supports a raft of Web application frameworks. But, then again, many applications like tomcat support servlets without supporting the full JavaEE umbrella of specifications. JavaEE containers can supply JMS servers if your application requires asynchronous messaging, as well as standard means to define JDBC DataSources. You'd typically use a JavaEE container like Glassfish/JBoss, if you want to have a lot of enterprise-level features without having to set them all up yourself. You can do all the same things in Spring/etc, which is just a JVM, but you're also setting up all those services yourself (kicking off your own JMS servers, for example). Historically, JavaEE containers were seen as large, resource-intensive applications which drove a lot of the Springs of the world to piece together just what you want/need. More modern releases of JavaEE containers are starting to buck that trend, though. You really need to know what your application wants to do and look at what tools out there will provide you with what you want. Barring that, just grab Glassfish or something similar and have a play. Hope this helps.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21035902

http://stackoverflow.com/q/21075354
upvote count: 2
has comment: http://stackoverflow.com/comment/31697458
has comment: http://stackoverflow.com/comment/31696317
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31697305
has title: How can I simulate keypress in junit test?
has answer: http://stackoverflow.com/a/21096376
type: Question
has body: I have this in my main class Board (extends JPanel): public class TAdapter extends KeyAdapter { public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if ((key == KeyEvent.VK_LEFT) &amp;&amp; (!right)) { left = true; up = false; down = false; } } I am trying to test if left becomes true when I press the left key: @Test public void testKeyPressed() throws AWTException { Board instance = new Board(); Robot rob = new Robot(); instance.setFocusable(true); instance.requestFocus(); rob.keyPress(KeyEvent.VK_LEFT); System.out.println(instance.up); } Thanks!
tagged with: keypress
accepted answer: http://stackoverflow.com/a/21096376
downvote count: 0
tagged with: awtrobot
has comment: http://stackoverflow.com/comment/31696163
answer count: 1
tagged with: junit
favorite count: 0

http://stackoverflow.com/q/21115354
has comment: http://stackoverflow.com/comment/31769957
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31769631
accepted answer: http://stackoverflow.com/a/21116804
has comment: http://stackoverflow.com/comment/31770318
score: 0
has comment: http://stackoverflow.com/comment/31769561
has comment: http://stackoverflow.com/comment/31769710
has comment: http://stackoverflow.com/comment/31769664
tagged with: spring
possible better answer: http://stackoverflow.com/a/39971575
has title: Error in creation of bean while using @Required and @Autowired
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31769839
has answer: http://stackoverflow.com/a/21116804
has answer: http://stackoverflow.com/a/39971575
has comment: http://stackoverflow.com/comment/31769605
tagged with: java
has body: I am new to spring.I am trying to make use @Required and @Autowired in my code but its giving me org.springframework.beans.factory.BeanCreationException.Below is my code. 1) StudentAuto.java public class StudentAuto { @Autowired private String name; @Autowired private String city; public String getCity() { return city; } @Required public void setCity(String city) { this.city = city; } public String getName() { return name; } public void setName(String name) { this.name = name; } } 2)spring.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:annotation-config></context:annotation-config> </beans> 3)TestApp.java public class TestApp { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub ApplicationContext context=new ClassPathXmlApplicationContext("spring.xml"); StudentAuto auto=context.getBean("stu", StudentAuto.class); System.out.println(auto.getCity()); System.out.println(auto.getName()); } } and error stack trace is below. Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stu' defined in class path resource [spring.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanInitializationException: Property 'city' is required for bean 'stu' at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) …

http://stackoverflow.com/a/21179573
score: 2
answers question: http://stackoverflow.com/q/21178981
upvote count: 2
has body: If you have a direct access to iText's PdfWriter, you can use PdfPageEvent interface. An example of how to create headers and footers via PdfPageEvent can be found here: http://itextpdf.com/examples/iia.php?id=103 But if you want to add something like 'page X of Y' to your header or footer - you should use PdfStamper instead. An example for it can be found here: http://itextpdf.com/examples/iia.php?id=118
has comment: http://stackoverflow.com/comment/31888420
downvote count: 0
has comment: http://stackoverflow.com/comment/31888423
has comment: http://stackoverflow.com/comment/31888351
type: Answer
has comment: http://stackoverflow.com/comment/31888456

http://stackoverflow.com/q/21042131
has title: Verifying two invocations of the same method with another method invocation in between, when order is important, in Mockito
has answer: http://stackoverflow.com/a/21043076
accepted answer: http://stackoverflow.com/a/21043076
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/31636466
tagged with: java
has comment: http://stackoverflow.com/comment/31637226
score: 9
type: Question
tagged with: mockito
answer count: 1
has body: I thought this would work: InOrder inOrder = new InOrder(mock); inOrder.verify(mock).method1(); inOrder.verify(mock).method2(); inOrder.verify(mock).method1(); … but Mockito says undesired invocation of mock.method1(). Wanted 1 time, but was 2 times. I changed my code to this: inOrder.verify(times(2), mock).method1(); inOrder.verify(mock).method2(); It should work, but now I do not test what I wanted to test in the first place. Could someone please point out what I am doing wrong, or if Mockito is too limited for these kind of test?
favorite count: 0
upvote count: 9
has comment: http://stackoverflow.com/comment/95281216

http://stackoverflow.com/comment/31820834
has text: Leading is first, sorry
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21126015

http://stackoverflow.com/comment/32191880
type: AnswerComment
comment on: http://stackoverflow.com/a/21350134
has text: not entirely sure what you are exactly after, but I would try (didn't though :-) a sizegroup on the component constraints in the first row
type: Comment
score: 0

android
tags question: http://stackoverflow.com/q/21164878
tags question: http://stackoverflow.com/q/21067186
tags question: http://stackoverflow.com/q/21150174
tags question: http://stackoverflow.com/q/21165746
tags question: http://stackoverflow.com/q/21069470
tags question: http://stackoverflow.com/q/21150846
tags question: http://stackoverflow.com/q/21060002
tags question: http://stackoverflow.com/q/21156704
tags question: http://stackoverflow.com/q/21147793
tags question: http://stackoverflow.com/q/21100542
tags question: http://stackoverflow.com/q/21131149
tags question: http://stackoverflow.com/q/21085077
tags question: http://stackoverflow.com/q/21138198
tags question: http://stackoverflow.com/q/21116001
tags question: http://stackoverflow.com/q/21144775
tags question: http://stackoverflow.com/q/21068040
tags question: http://stackoverflow.com/q/21160212
tags question: http://stackoverflow.com/q/21056887
tags question: http://stackoverflow.com/q/21174229
tags question: http://stackoverflow.com/q/21080173
tags question: http://stackoverflow.com/q/21084222
tags question: http://stackoverflow.com/q/21141269
tags question: http://stackoverflow.com/q/21176008
tags question: http://stackoverflow.com/q/21144784
tags question: http://stackoverflow.com/q/21081700
tags question: http://stackoverflow.com/q/21070052
tags question: http://stackoverflow.com/q/21077753
tags question: http://stackoverflow.com/q/21038779
tags question: http://stackoverflow.com/q/21062356
tags question: http://stackoverflow.com/q/21120689
tags question: http://stackoverflow.com/q/21092545
tags question: http://stackoverflow.com/q/21040492
tags question: http://stackoverflow.com/q/21090027
tags question: http://stackoverflow.com/q/21061991
tags question: http://stackoverflow.com/q/21071652
tags question: http://stackoverflow.com/q/21131015
tags question: http://stackoverflow.com/q/21120567
tags question: http://stackoverflow.com/q/21038384
tags question: http://stackoverflow.com/q/21101482
tags question: http://stackoverflow.com/q/21036428
tags question: http://stackoverflow.com/q/21072763
tags question: http://stackoverflow.com/q/21021334
tags question: http://stackoverflow.com/q/21076029
tags question: http://stackoverflow.com/q/21120719
tags question: http://stackoverflow.com/q/21147518
tags question: http://stackoverflow.com/q/21154480
tags question: http://stackoverflow.com/q/21064914
tags question: http://stackoverflow.com/q/21153249
tags question: http://stackoverflow.com/q/21020239
tags question: http://stackoverflow.com/q/21059675
tags question: http://stackoverflow.com/q/21064295
tags question: http://stackoverflow.com/q/21076000
tags question: http://stackoverflow.com/q/21089129
tags question: http://stackoverflow.com/q/21117948
tags question: http://stackoverflow.com/q/21097108
tags question: http://stackoverflow.com/q/21131033
tags question: http://stackoverflow.com/q/21178755
tags question: http://stackoverflow.com/q/21035932
tags question: http://stackoverflow.com/q/21058959
tags question: http://stackoverflow.com/q/21129082
tags question: http://stackoverflow.com/q/21074763
tags question: http://stackoverflow.com/q/21170535
tags question: http://stackoverflow.com/q/21161169
tags question: http://stackoverflow.com/q/21074395
tags question: http://stackoverflow.com/q/21024421
tags question: http://stackoverflow.com/q/21146475
tags question: http://stackoverflow.com/q/21086859
tags question: http://stackoverflow.com/q/21064913
tags question: http://stackoverflow.com/q/21157357
tags question: http://stackoverflow.com/q/21183043
tags question: http://stackoverflow.com/q/21171106
tags question: http://stackoverflow.com/q/21109341
tags question: http://stackoverflow.com/q/21052299
tags question: http://stackoverflow.com/q/21057203
tags question: http://stackoverflow.com/q/21056179
tags question: http://stackoverflow.com/q/21092701
tags question: http://stackoverflow.com/q/21062689
tags question: http://stackoverflow.com/q/21088815
tags question: http://stackoverflow.com/q/21069191
tags question: http://stackoverflow.com/q/21059220

http://stackoverflow.com/comment/31890834
type: AnswerComment
comment on: http://stackoverflow.com/a/21173117
has text: That sounds nice in theory, but when you execute a query and process the result set in autocommit then you need exclusive access, otherwise the execution of another query on another thread on the same connection will cause the result set to be closed (as mandated by the JDBC spec for autocommit). It is simply easier, less complex and less buggy to use a connection on one thread at a time.
type: Comment
score: 0

http://stackoverflow.com/comment/31764418
score: 0
type: AnswerComment
type: Comment
has text: _jbyte_ is _signed char_; _(mytype*)(void*)myPointer_ if gcc reports an error for _(mytype*)myPointer_ (at least that used to work a while ago)
comment on: http://stackoverflow.com/a/21109940

http://stackoverflow.com/q/21161845
type: Question
has comment: http://stackoverflow.com/comment/31854585
has comment: http://stackoverflow.com/comment/31855457
has comment: http://stackoverflow.com/comment/31854947
downvote count: 0
linked to: http://stackoverflow.com/q/11581419
has comment: http://stackoverflow.com/comment/31854259
has title: Gradle: custom source set as dependency for the main and test ones
tagged with: source-sets
answer count: 1
has answer: http://stackoverflow.com/a/21162141
favorite count: 0
has comment: http://stackoverflow.com/comment/31854998
has comment: http://stackoverflow.com/comment/31855557
type: AnsweredQuestion
upvote count: 19
accepted answer: http://stackoverflow.com/a/21162141
tagged with: java
has body: I've created custom source set in Gradle project to keep all generated code: sourceSets { generated { java { srcDir 'src/generated/java' } resources { srcDir 'src/generated/resources' } } } I want to make the result of this source set's code compilation available at compile and run time for main and test source sets. What's the right semantic way to do it in Gradle? UPDATE: As suggested here: How do I add a new sourceset to Gradle? doesn't work for me, I still get java.lang.ClassNotFoundException when I launch my app (though compilation and unit tests run fine). Here is what I tried: sourceSets { main { compileClasspath += sourceSets.generated.output runtimeClasspath += sourceSets.generated.output } test { compileClasspath += sourceSets.generated.output runtimeClasspath += sourceSets.generated.output } }
has comment: http://stackoverflow.com/comment/31854776
tagged with: gradle
score: 19
tagged with: classpath

jakarta-ee
tags question: http://stackoverflow.com/q/21064035
tags question: http://stackoverflow.com/q/21069687
tags question: http://stackoverflow.com/q/21153281
tags question: http://stackoverflow.com/q/21124781
tags question: http://stackoverflow.com/q/21038706
tags question: http://stackoverflow.com/q/21143707
tags question: http://stackoverflow.com/q/21152793
tags question: http://stackoverflow.com/q/21075413
tags question: http://stackoverflow.com/q/21112816
type: Tag
tags question: http://stackoverflow.com/q/21153234
tags question: http://stackoverflow.com/q/21144054
tags question: http://stackoverflow.com/q/21040948
tags question: http://stackoverflow.com/q/21038355
tags question: http://stackoverflow.com/q/21064787
tags question: http://stackoverflow.com/q/21104097
tags question: http://stackoverflow.com/q/21121294
tags question: http://stackoverflow.com/q/21183002
tags question: http://stackoverflow.com/q/21167348
tags question: http://stackoverflow.com/q/21048473
tags question: http://stackoverflow.com/q/21168848
tags question: http://stackoverflow.com/q/21159580
tags question: http://stackoverflow.com/q/21051224
tags question: http://stackoverflow.com/q/21047448
tags question: http://stackoverflow.com/q/21045330
tags question: http://stackoverflow.com/q/21178364
tags question: http://stackoverflow.com/q/21123222
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/21181399
tags question: http://stackoverflow.com/q/21043542
tags question: http://stackoverflow.com/q/21167307
tags question: http://stackoverflow.com/q/21103382
tags question: http://stackoverflow.com/q/21137719
tags question: http://stackoverflow.com/q/21175450
tags question: http://stackoverflow.com/q/21161563
tags question: http://stackoverflow.com/q/21169958
tags question: http://stackoverflow.com/q/21089662
tags question: http://stackoverflow.com/q/21135384
tags question: http://stackoverflow.com/q/21059614
tags question: http://stackoverflow.com/q/21117073
tags question: http://stackoverflow.com/q/21066182
tags question: http://stackoverflow.com/q/21137049
tags question: http://stackoverflow.com/q/21184258
tags question: http://stackoverflow.com/q/21023759
tags question: http://stackoverflow.com/q/21108070
tags question: http://stackoverflow.com/q/21091414
tags question: http://stackoverflow.com/q/21168943
tags question: http://stackoverflow.com/q/21119457
tags question: http://stackoverflow.com/q/21123852
tags question: http://stackoverflow.com/q/21024637
tags question: http://stackoverflow.com/q/21060881
tags question: http://stackoverflow.com/q/21176715
tags question: http://stackoverflow.com/q/21177218
tags question: http://stackoverflow.com/q/21120590
tags question: http://stackoverflow.com/q/21134376
tags question: http://stackoverflow.com/q/21131746
tags question: http://stackoverflow.com/q/21163176
tags question: http://stackoverflow.com/q/21147083
tags question: http://stackoverflow.com/q/21027578
tags question: http://stackoverflow.com/q/21108111
tags question: http://stackoverflow.com/q/21170414
tags question: http://stackoverflow.com/q/21035498

http://stackoverflow.com/q/21034448
has comment: http://stackoverflow.com/comment/31621831
has comment: http://stackoverflow.com/comment/31622595
has title: How to tell where the texture is drawn in OpenGL / libgdx?
type: AnsweredQuestion
has body: How do we know which texture is related to which mesh in OpenGL? In this example, we tell the mesh we use texture coordinates, but we don't say which texture (if we have more than one), and we don't tell the texture where to be drawn. How does it work? (I know the concept of UVs, but I don't know the concept of "where" the texture is drawn) : mesh = new Mesh(true, 4, 6, new VertexAttribute(VertexAttributes.Usage.Position, 3,"attr_Position"), new VertexAttribute(Usage.TextureCoordinates, 2, "attr_texCoords")); texture = new Texture(Gdx.files.internal("data/img.png")); mesh.setVertices(new float[] { -1024f, -1024f, 0, 0, 1, 1024f, -1024f, 0, 1, 1, 1024f, 1024f, 0, 1, 0, -1024f, 1024f, 0, 0, 0 }); @Override public void render() { // Texturing --------------------- / gl.glActiveTexture(GL10.GL_TEXTURE0); gl.glEnable(GL10.GL_TEXTURE_2D); texture.bind(); mesh.render(GL10.GL_TRIANGLES); }
has comment: http://stackoverflow.com/comment/31621921
type: Question
has comment: http://stackoverflow.com/comment/31622213
has comment: http://stackoverflow.com/comment/31622495
has answer: http://stackoverflow.com/a/21046999
has comment: http://stackoverflow.com/comment/31622001
answer count: 1
tagged with: textures
accepted answer: http://stackoverflow.com/a/21046999
tagged with: opengl
has comment: http://stackoverflow.com/comment/31623185
score: 0
tagged with: java
tagged with: render
tagged with: libgdx

http://stackoverflow.com/comment/31639540
has text: Thats what I am talking about.You must be doing some heavy task in `DeleteWithID()` method.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21044894

http://stackoverflow.com/a/21097575
has comment: http://stackoverflow.com/comment/31741961
has body: Your checks are incorrect at: if (!player_status_list.contains(checkName)) { player_status_list.add(temp); } else if (player_status_list.contains(checkName)) { for (int i = 0; i &lt; player_status_list.size(); i++) { player_status_list.set(i, temp); } } Here is a breakdown with embedded comments: //temp = "4711 PLAYER joseph HUMAN 30.1 30.1"; //checkName = "joseph" //This is checking if the list contains: "joseph" if (!player_status_list.contains(checkName)) { //If it doesn't have it we are adding: "4711 PLAYER joseph HUMAN 30.1 30.1"; //This doesn't seem right!!! player_status_list.add(temp); //This will never happen because list is always adding the temp variable not the name } else if (player_status_list.contains(checkName)) { for (int i = 0; i &lt; player_status_list.size(); i++) { player_status_list.set(i, temp); } } Try the following: while ((checkIfPlayer = bReader.readLine()) != null) { // Arraylist String temp = checkIfPlayer.trim(); System.out.println(temp); if (temp.contains("ZOMBIE") || temp.contains("HUMAN")) { String[] getName = temp.split(" "); String checkName = getName[2]; boolean added = false; for(int i = 0; i &lt; player_status_list.size(); i++) { if(player_status_list.get(i).contains(checkName)) { player_status_list.set(i, temp); added = true; } } if(!added) { player_status_list.add(temp); } DrawTheMap(); } } The inputs I tested (Obviously I commented out the DrawTheMap() part) ASYNC PLAYER joseph HUMAN 30.0 30.0 ASYNC PLAYER joseph HUMAN 50.0 80.0 ASYNC PLAYER BOB ZOMBIE 30.0 30.0 ASYNC PLAYER GIL ZOMBIE 30.0 30.0 This is the resulting player_status_list I get: ASYNC PLAYER joseph HUMAN 50.0 80.0 ASYNC PLAYER BOB ZOMBIE 30.0 30.0 ASYNC PLAYER GIL ZOMBIE 30.0 30.0
has comment: http://stackoverflow.com/comment/31740748
has comment: http://stackoverflow.com/comment/31742832
accepted answer of: http://stackoverflow.com/q/21097326
has comment: http://stackoverflow.com/comment/31741821
answers question: http://stackoverflow.com/q/21097326
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31740811
has comment: http://stackoverflow.com/comment/31741719
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31742849

http://stackoverflow.com/a/27255969
has body: It is not your code fault. It is server fault. just try to hit URL address from Browser.
answers question: http://stackoverflow.com/q/21087229
score: 0
type: Answer

http://stackoverflow.com/comment/96997608
type: Comment
has text: Yes, it should be fillRect. Awt and swing use the same event queue and dispatching thread
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21106409

http://stackoverflow.com/a/21166705
has comment: http://stackoverflow.com/comment/31864659
has body: its not guava or apache commons, and it is a loop, but aside from instantiating the string builder, it is a one liner: for (Entry&lt;String,String&gt; entry : myMap.entrySet()) { sb.append(entry.getKey() + separator + entry.getValue() + "\n"); }
has comment: http://stackoverflow.com/comment/31863637
has comment: http://stackoverflow.com/comment/31864231
type: Answer
has comment: http://stackoverflow.com/comment/31863175
has comment: http://stackoverflow.com/comment/31863524
downvote count: 0
has comment: http://stackoverflow.com/comment/31863364
score: 1
answers question: http://stackoverflow.com/q/21166573
has comment: http://stackoverflow.com/comment/31865043
has comment: http://stackoverflow.com/comment/31864813
has comment: http://stackoverflow.com/comment/31864115
has comment: http://stackoverflow.com/comment/31864650
upvote count: 1

http://stackoverflow.com/a/29608138
score: 104
downvote count: 0
upvote count: 104
type: Answer
has body: The above answers are correct. But you can go even further and define your own variables - such as User, Company, Email etc.: #set ($USER = "Name name") #set ($COMPANY = "company Ltd") #set ($EMAIL = "example@gmail.com") /** * Created by ${USER} on ${DATE}. * ${COMPANY} * ${EMAIL} */
answers question: http://stackoverflow.com/q/21160288

http://stackoverflow.com/q/21112722
has comment: http://stackoverflow.com/comment/31764806
score: 2
tagged with: tycho
tagged with: java
has comment: http://stackoverflow.com/comment/31773360
tagged with: eclipse
has answer: http://stackoverflow.com/a/21114373
type: Question
answer count: 2
downvote count: 0
tagged with: eclipse-plugin
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: I am trying to package a new eclipse plugin project to a legacy project that generate the zip and updatesite to install on eclipse. But when I install the plugin on a newly-fresh eclipse, I get the error "Plugin com.example was unable to load classes". I looked inside the jar in zip file, and the jar does not contains any .class file. Just src with .java. I am using the tycho maven plugin, to deal eclipse plugin dependencies with maven. added to pom.xml: eclipse-plugin added to parent's pom.xml: com.example Here is my build.properties source.. = src/main/java/,\ src/main/resources output.. = target/ bin.includes = META-INF/,\ .,\ plugin.xml,\ icons/,\ META-INF/lib/commons-codec.jar,\ META-INF/lib/commons-io.jar,\ META-INF/lib/commons-logging.jar,\ META-INF/lib/fluent-hc.jar,\ META-INF/lib/httpclient-cache.jar,\ META-INF/lib/httpclient.jar,\ META-INF/lib/httpmime.jar,\ META-INF/lib/resteasy-jaxb-provider.jar,\ META-INF/lib/resteasy-jaxrs.jar,\ META-INF/lib/resteasy-multipart-provider.jar,\ META-INF/lib/scannotation.jar,\ OSGI-INF/l10n/bundle.properties,\ OSGI-INF/,\ OSGI-INF/l10n/
tagged with: maven
has title: eclipse plugin maven generated jar does not contain classes
has answer: http://stackoverflow.com/a/21112864

http://stackoverflow.com/comment/31800037
score: 0
type: Comment
has text: <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </activity> </application>
type: AnswerComment
comment on: http://stackoverflow.com/a/21131535

http://stackoverflow.com/q/21025017
has body: I am using Netbeans for developing two separate application. I need to communicate between two jar what is the best IPC Communication.
type: Question
score: 18
tagged with: java
linked to: http://stackoverflow.com/q/51452
upvote count: 18
has comment: http://stackoverflow.com/comment/31604518
downvote count: 0
has answer: http://stackoverflow.com/a/21025408
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31604338
answer count: 1
accepted answer: http://stackoverflow.com/a/21025408
favorite count: 0
has title: What is the best way for IPC in java?

http://stackoverflow.com/comment/31777022
type: AnswerComment
type: Comment
has text: @patterned The whole point about interfaces is that *you don't need to know the concrete implementation* when you're using an implementing object. That's what polymorphism is all about! Your class can use whatever `Map` implementation it likes: `HashMap`, `LinkedHashMap`, `TreeMap`,... and just return it in `getMap()` as a `Map`. Whenever someone calls a `Map` method (e.g. `getMap().put(5, "foo")`), it will be *dispatched* to the actual implementation. Seriously, [read a tutorial](http://docs.oracle.com/javase/tutorial/java/IandI/polymorphism.html)!
score: 1
comment on: http://stackoverflow.com/a/21117930

http://stackoverflow.com/comment/41958900
type: AnswerComment
score: 0
has text: did it work for you? I was unable to run these examples
type: Comment
comment on: http://stackoverflow.com/a/21087655

http://stackoverflow.com/comment/31756657
type: Comment
comment on: http://stackoverflow.com/a/21107947
type: AnswerComment
score: 0
has text: If your array is visible to many other classes and you don't want them dependent on MyDouble, you could make MyDouble a subclass of `java.lang.Number` and specify an array of `Number` instead.

http://stackoverflow.com/comment/31839698
type: Comment
type: QuestionComment
has text: At best, you can try `window.onbeforeunload` to notify the server somehow that, your browser window is being closed.
comment on: http://stackoverflow.com/q/21153234
score: 0

http://stackoverflow.com/q/21061332
answer count: 2
has body: I am trying to create a post webservice using jersey. Following is my PostMethod; @POST @Path("getEncodedURL") @Produces(MediaType.TEXT_XML) public String getEncodedURL(@FormParam(value = "url") String url, @FormParam(value = "eventId") int eventId) { //mylogic here to get encoded url. return "&lt;data&gt;&lt;eventId&gt;"+eventId+"&lt;/eventId&gt;&lt;url&gt;"+url+"&lt;/url&gt;&lt;/data&gt;"; } Following is my index.jsp code. &lt;form id="form10" method="post"&gt; Enter URL to Encode: (String) &lt;input type="text" name="testName" id="testName"&gt; Event id: (int) &lt;input type="text" name="testEventId" id="testEventId"&gt; &lt;input type="button" Value="Invoke Web Service" onclick="getEncodedURLAgainstURL();"&gt; &lt;/form&gt; function getEncodedURLAgainstURL(){ var testName = $("#testName").val(); var testEventId = $("#testEventId").val(); url = loc+"services/SnapEvent/getEncodedURL"; $.ajax({ type: "post", url: url, data:{'eventId': testEventId, 'url': testName}, /* dataType:"text", contentType: "text/html",*/ success: function(resp){window.location = url}, error: function(e){ alert("An error has occured");} }); } when i enter data in form and hit invoke it gives me HTTP Status 405 - Method Not Allowed error. i have debugged it on clicking invoke it goes to the post method and gives error on return.
has comment: http://stackoverflow.com/comment/31672075
possible better answer: http://stackoverflow.com/a/21061671
linked to: http://stackoverflow.com/q/6052092
downvote count: 0
tagged with: jax-rs
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31671687
has answer: http://stackoverflow.com/a/21062215
has comment: http://stackoverflow.com/comment/31671794
has comment: http://stackoverflow.com/comment/31671165
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31671763
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21062215
has answer: http://stackoverflow.com/a/21061671
has comment: http://stackoverflow.com/comment/31671146
has comment: http://stackoverflow.com/comment/31671086
has title: JERSEY-RS showing 405 in POST

http://stackoverflow.com/a/21083779
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31751857
score: 0
has body: You could check the modified date, between the cached compiled template, and the source file. $cacheFileAge = @filemtime($this-&gt;cacheFile); //Get Time foreach(array_merge(array($template),$this-&gt;snipFiles) as $f) if($cacheFileAge &lt; filemtime($f)) //Compare every template to cache file return $this-&gt;parse(file_get_contents($template)); //If cache file older than one, re-compile it debugLog("Using Cached file ({$this-&gt;cacheFile})"); include($this-&gt;cacheFile); //use cached file This example was taken from another php template project HAMLE
has comment: http://stackoverflow.com/comment/31713549
has comment: http://stackoverflow.com/comment/31713021
type: Answer
has comment: http://stackoverflow.com/comment/32370408
accepted answer of: http://stackoverflow.com/q/21083700
answers question: http://stackoverflow.com/q/21083700

http://stackoverflow.com/a/21056092
upvote count: 12
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21056063
has body: If you're just starting then I'll recommend you using https://github.com/spring-projects/spring-boot It has great autoconfiguration feature and saves writing boilerplate code. It even can release you from using application server due to embedded Tomcat. For example implementing simple MVC controller (which can be used as REST endpoints) looks like that: @Controller @EnableAutoConfiguration public class SampleController { @RequestMapping("/") @ResponseBody String home() { return "Hello World!"; } public static void main(String[] args) throws Exception { SpringApplication.run(SampleController.class, args); } } Now you can execute java -jar your_package.jar and thats all. You will also get transaction management, database integration, etc. More examples can be found in mentioned link, especially in https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples directory
score: 12

http://stackoverflow.com/comment/31778772
has text: What line do I have to add to set the selection in the single choice?
type: Comment
comment on: http://stackoverflow.com/q/21119626
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31597056
score: 1
has text: +1, Great explanation. this is so much clear and easy.
type: AnswerComment
comment on: http://stackoverflow.com/a/21021013
type: Comment

http://stackoverflow.com/q/21076399
possible better answer: http://stackoverflow.com/a/21076546
type: Question
has comment: http://stackoverflow.com/comment/31698416
has body: First, this sounds like the problem here: How to convert a byte array to its numeric value (Java)? But the origin of my Byte-Array is a String, something like this: byte[] foo = new byte[8]; foo = "12345678".getBytes(); Is there a faster way (yes its really about doing this quick) than Integer.parseInt(new String(foo))? The String contains only digits which represent a Integer.
linked to: http://stackoverflow.com/q/1030479
has comment: http://stackoverflow.com/comment/31698123
has comment: http://stackoverflow.com/comment/31698280
has title: Fast way converting a byte array to corresponding Integer
has comment: http://stackoverflow.com/comment/31698090
has comment: http://stackoverflow.com/comment/31697980
accepted answer: http://stackoverflow.com/a/21076535
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/21076546
tagged with: arrays
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/21076535
linked to: http://stackoverflow.com/q/1026761
tagged with: integer
has comment: http://stackoverflow.com/comment/31698143
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java

jsf
tags question: http://stackoverflow.com/q/21117073
tags question: http://stackoverflow.com/q/21130033
type: Tag
tags question: http://stackoverflow.com/q/21091414
tags question: http://stackoverflow.com/q/21044873
tags question: http://stackoverflow.com/q/21122516
tags question: http://stackoverflow.com/q/21025080
tags question: http://stackoverflow.com/q/21113639
tags question: http://stackoverflow.com/q/21102702
tags question: http://stackoverflow.com/q/21032315
tags question: http://stackoverflow.com/q/21163667
tags question: http://stackoverflow.com/q/21074000
tags question: http://stackoverflow.com/q/21165162
tags question: http://stackoverflow.com/q/21170418
tags question: http://stackoverflow.com/q/21035283
tags question: http://stackoverflow.com/q/21075413
tags question: http://stackoverflow.com/q/21079482
tags question: http://stackoverflow.com/q/21056895
tag name: jsf
tags question: http://stackoverflow.com/q/21108239
tags question: http://stackoverflow.com/q/21047859
tags question: http://stackoverflow.com/q/21164172
tags question: http://stackoverflow.com/q/21051224
tags question: http://stackoverflow.com/q/21159174
tags question: http://stackoverflow.com/q/21184036
tags question: http://stackoverflow.com/q/21045397
tags question: http://stackoverflow.com/q/21069669
tags question: http://stackoverflow.com/q/21137561
tags question: http://stackoverflow.com/q/21131329
tags question: http://stackoverflow.com/q/21116683
tags question: http://stackoverflow.com/q/21088029

http://stackoverflow.com/comment/31751654
score: 0
has text: you may send the whole code here? i may changed something which i shouldnt and thats why it doesnt work for me?
type: AnswerComment
comment on: http://stackoverflow.com/a/21104553
type: Comment

http://stackoverflow.com/comment/31636220
score: 0
type: Comment
type: QuestionComment
has text: what is that AddItem.java:73 line
comment on: http://stackoverflow.com/q/21043079

http://stackoverflow.com/a/21138617
type: Answer
accepted answer of: http://stackoverflow.com/q/21136703
answers question: http://stackoverflow.com/q/21136703
has comment: http://stackoverflow.com/comment/31890320
has body: Recent versions of Eclipse (I used Juno [4.2]) will show a warning on those lines: You can enable this warning in the Eclipse preferences: Even for larger size code bases, you can filter the problems view for this warning in order to find these places in the code.
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31812117

http://stackoverflow.com/q/21040771
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21041929
possible better answer: http://stackoverflow.com/a/21041450
has answer: http://stackoverflow.com/a/21041450
answer count: 4
type: AnsweredQuestion
tagged with: builder
tagged with: constructor
has answer: http://stackoverflow.com/a/21051075
score: 1
tagged with: java
has body: I am trying to use Builder Pattern for my below class.. Initially I was using constructor of my class to set all the parameters but accidentally I came across Builder pattern and it is looking good for my use case. Below is my class in which people will mostly pass userId, clientId and parameterMap always but other fields are optional and they may or may not pass it. And also if they are not passing any timeout value, I need to have default timeout value set as 500 always but if they are passing any timeout value then it should override my default timeout value. Here Preference is an ENUM having four fields. public final class ModelInput { private long userid; private long clientid; private long timeout = 500L; private Preference pref; private boolean debug; private Map&lt;String, String&gt; parameterMap; public ModelInput(long userid, long clientid, Preference pref, Map&lt;String, String&gt; parameterMap, long timeout, boolean debug) { this.userid = userid; this.clientid = clientid; this.pref = pref; this.parameterMap = parameterMap; this.timeout = timeout; this.debug = debug; } ... //getters here } Below is an example how I was using initially to construct ModelInput object by passing parameters to constructor. Initially I was passing all the parameters but clients will mostly pass userId, clientId and parameterMap always and other fields are optional.. Map&lt;String, String&gt; paramMap = new HashMap&lt;String, String&gt;(); paramMap.put("attribute", "segmentation"); ModelInput input = new ModelInput(109739281L, 20L, Preference.SECONDARY, paramMap, 1000L, true); How do I convert my above code to start using Builder pattern as told by Bloch's in Effective Java which is also thread safe and immutable as well? And how can I do the validation check as well on this using Builder pattern? It might be possible people can pass userId zero or negative numbers same with client id and timeout and same with map as well..
upvote count: 1
has answer: http://stackoverflow.com/a/21041449
type: Question
has title: How to use Builder pattern as described by Joshua Bloch's version in my ModelInput class?
tagged with: setter
has answer: http://stackoverflow.com/a/21041929
tagged with: builder-pattern

http://stackoverflow.com/q/21180969
has comment: http://stackoverflow.com/comment/31889042
favorite count: 0
has comment: http://stackoverflow.com/comment/31904049
has comment: http://stackoverflow.com/comment/31893605
has comment: http://stackoverflow.com/comment/31892362
has body: public class Student { String name; int id; float grade;} public class UndergraduateStudent extends Student{ float grade2;} public class GraduateStudent extends Student{ float grade2,grade3; String supervizor;} So I have the basic class Student which is extended to 2 more types.All the Student objects are stored in a SLL and now I have to store them into a file.How can I store them in the file if when extracted from the list,a cast to (Student) is done? I will need to get them back from the file so how will I know what type of student is each of the lines in the file?(I'm not interested for now in serialization)
has title: Objects to file:how to?
has comment: http://stackoverflow.com/comment/31889604
type: UnansweredQuestion
answer count: 4
has comment: http://stackoverflow.com/comment/31888917
has answer: http://stackoverflow.com/a/21181490
tagged with: java
has comment: http://stackoverflow.com/comment/31888900
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21183355
has comment: http://stackoverflow.com/comment/31900241
upvote count: 0
has comment: http://stackoverflow.com/comment/31888852
score: -1
has comment: http://stackoverflow.com/comment/31888960
has answer: http://stackoverflow.com/a/21181202
has answer: http://stackoverflow.com/a/21181232

http://stackoverflow.com/comment/42381884
comment on: http://stackoverflow.com/a/26916543
score: 1
type: AnswerComment
has text: I don't have rep to comment on the actual question so: The example with Person and Color: Person has the Entity ID, so it is "What is being modified", the Colors table is related, not primary (you marked it as Foreign Key), so additions to it would never collide. Apparently you cannot delete rows from it even if a Person changes their Color? You can meaningfully only update one Entity at a time, otherwise you are getting in to the area of Cascaded Updates, etc. I think your model is strained. Make Color a Unique attribute of Person instead?
type: Comment

http://stackoverflow.com/comment/31778097
type: Comment
has text: couldn't read the card file java.util.NoSuchElementException at java.util.StringTokenizer.nextToken(Unknown Source) at chap14.QuizCardReader.makeCard(QuizCardReader.java:145) at chap14.QuizCardReader.loadFile(QuizCardReader.java:109) at chap14.QuizCardReader.access$8(QuizCardReader.java:101) at chap14.QuizCardReader$OpenMenuListener.actionPerformed(QuizCardReader.java:97) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
type: AnswerComment
comment on: http://stackoverflow.com/a/21119444
score: 0

http://stackoverflow.com/comment/31826291
score: 0
type: AnswerComment
has text: this is why i wrote to declare all int variables in Activity not in on create.
comment on: http://stackoverflow.com/a/21146003
type: Comment

http://stackoverflow.com/q/21183014
tagged with: jsp
tagged with: tomcat
tagged with: sql-server
has comment: http://stackoverflow.com/comment/31892905
tagged with: jdbc
answer count: 0
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31893101
type: Question
has body: I have a Web Application with tomcat, JSP , Java and MS SQL Database. I have written a Connection Pool for the JDBC Connections. The user in our web application are higher since one month. Now we have the problem that sometimes, a request, which need also database values , slow down or delay. In the Code I have seen a Connection pool_size. The value of the pool_size is 10. So I think it could be maximum 10 Database connection in the pool, but i'm not sure. So my question is, if its possible that the delay and slow down could happen because the pool_size is to low ?
tagged with: java
has title: Is the JDBC Connection Pool Size to low in web Application?

http://stackoverflow.com/a/21023376
downvote count: 0
has comment: http://stackoverflow.com/comment/31606947
has comment: http://stackoverflow.com/comment/31606505
score: 1
has comment: http://stackoverflow.com/comment/31605066
answers question: http://stackoverflow.com/q/21022022
upvote count: 1
has body: You'll need to make the login page reachable. I would drop your login.html page and create the login.jsp view (in the usual place where your other jsps live). You're going to need this so it'd be easiest just to create it now. Once created, add a &lt;mvc:view-controller&gt; to your MVC configuration. &lt;mvc:view-controller path="/login" view-name="login"/&gt; That will ensure that requests going to /login will resolve to the view login.jsp.
has comment: http://stackoverflow.com/comment/31603545
type: Answer
has comment: http://stackoverflow.com/comment/31603097
has comment: http://stackoverflow.com/comment/31603799

http://stackoverflow.com/comment/31692809
has text: You should post this question as a comment to the question, or ad an `@Necator` to the comment if you want the OP to receive this question.
comment on: http://stackoverflow.com/a/21073351
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31784715
has text: I have passed the panel as an argument because I thought I had to repaint and revalidate it?
comment on: http://stackoverflow.com/a/21122057
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21102555
has comment: http://stackoverflow.com/comment/31759638
answers question: http://stackoverflow.com/q/21094726
type: Answer
has comment: http://stackoverflow.com/comment/31762980
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31783164
has body: Your REST resource is the ticket. Use GETs to read the ticket, PUT to modify the ticket state, and DELETE to do a logical delete (cancellation). For any other operation, use the wildcard operation POST. Have a look at this blog post Brief Introduction to REST, where the author goes through the core REST principles.
has comment: http://stackoverflow.com/comment/31764633
has comment: http://stackoverflow.com/comment/31761207
has comment: http://stackoverflow.com/comment/31762244
has comment: http://stackoverflow.com/comment/31761155
has comment: http://stackoverflow.com/comment/31761278
upvote count: 3

http://stackoverflow.com/comment/31605354
has text: The code works if you just put the filename without the randomness? Because there is nothing obviously wrong with what you have here.
comment on: http://stackoverflow.com/q/21025595
score: 0
type: QuestionComment
type: Comment

swing
tags question: http://stackoverflow.com/q/21051707
tags question: http://stackoverflow.com/q/21119456
tags question: http://stackoverflow.com/q/21062484
tags question: http://stackoverflow.com/q/21047446
tags question: http://stackoverflow.com/q/21078049
tags question: http://stackoverflow.com/q/21119999
tags question: http://stackoverflow.com/q/21130345
tags question: http://stackoverflow.com/q/21066596
tags question: http://stackoverflow.com/q/21061438
tags question: http://stackoverflow.com/q/21090323
tags question: http://stackoverflow.com/q/21049360
tags question: http://stackoverflow.com/q/21123217
tags question: http://stackoverflow.com/q/21040593
tags question: http://stackoverflow.com/q/21091397
tags question: http://stackoverflow.com/q/21137984
tags question: http://stackoverflow.com/q/21121002
tags question: http://stackoverflow.com/q/21150908
tags question: http://stackoverflow.com/q/21176671
tags question: http://stackoverflow.com/q/21176425
tags question: http://stackoverflow.com/q/21136661
tags question: http://stackoverflow.com/q/21083783
tags question: http://stackoverflow.com/q/21150306
tags question: http://stackoverflow.com/q/21082933
tags question: http://stackoverflow.com/q/21105701
tags question: http://stackoverflow.com/q/21023063
tags question: http://stackoverflow.com/q/21052894
tags question: http://stackoverflow.com/q/21019458
tags question: http://stackoverflow.com/q/21159151
tags question: http://stackoverflow.com/q/21025712
tags question: http://stackoverflow.com/q/21100635
tags question: http://stackoverflow.com/q/21026376
tags question: http://stackoverflow.com/q/21104949
tags question: http://stackoverflow.com/q/21125182
tags question: http://stackoverflow.com/q/21140940
tags question: http://stackoverflow.com/q/21106370
tags question: http://stackoverflow.com/q/21084543
tags question: http://stackoverflow.com/q/21032140
tags question: http://stackoverflow.com/q/21081972
tags question: http://stackoverflow.com/q/21028551
tags question: http://stackoverflow.com/q/21104940
tags question: http://stackoverflow.com/q/21074259
tags question: http://stackoverflow.com/q/21150419
tags question: http://stackoverflow.com/q/21068320
tags question: http://stackoverflow.com/q/21045119
tags question: http://stackoverflow.com/q/21121888
tags question: http://stackoverflow.com/q/21126216
tags question: http://stackoverflow.com/q/21075307
tags question: http://stackoverflow.com/q/21177139
tags question: http://stackoverflow.com/q/21179117
tags question: http://stackoverflow.com/q/21158508
tags question: http://stackoverflow.com/q/21148149
tags question: http://stackoverflow.com/q/21073826
tags question: http://stackoverflow.com/q/21101444
tags question: http://stackoverflow.com/q/21063982
tags question: http://stackoverflow.com/q/21156333
tags question: http://stackoverflow.com/q/21081128
tags question: http://stackoverflow.com/q/21110158
tags question: http://stackoverflow.com/q/21150928
tags question: http://stackoverflow.com/q/21120813
tags question: http://stackoverflow.com/q/21054108
tags question: http://stackoverflow.com/q/21175147
tags question: http://stackoverflow.com/q/21081456
tags question: http://stackoverflow.com/q/21092714
tags question: http://stackoverflow.com/q/21069050
tags question: http://stackoverflow.com/q/21111419
tags question: http://stackoverflow.com/q/21065624
tags question: http://stackoverflow.com/q/21111671
tags question: http://stackoverflow.com/q/21128452
tags question: http://stackoverflow.com/q/21078466
tags question: http://stackoverflow.com/q/21116513
tags question: http://stackoverflow.com/q/21050003
tags question: http://stackoverflow.com/q/21177764
tags question: http://stackoverflow.com/q/21027537
tags question: http://stackoverflow.com/q/21049945
tags question: http://stackoverflow.com/q/21054330
tags question: http://stackoverflow.com/q/21145911
tags question: http://stackoverflow.com/q/21065049
tags question: http://stackoverflow.com/q/21149005
tags question: http://stackoverflow.com/q/21052579
tags question: http://stackoverflow.com/q/21029653

http://stackoverflow.com/q/21029022
has comment: http://stackoverflow.com/comment/31611709
tagged with: static-methods
score: 0
has comment: http://stackoverflow.com/comment/31613529
has comment: http://stackoverflow.com/comment/31612972
has comment: http://stackoverflow.com/comment/31614139
answer count: 1
has body: Whenever I do, no matter where I call it from, the app crashes with IllegalStateException: could not execute method of the activity. I only have a few classes at the moment, and they're all in the same package, including the class with the static methods causing the crash. Is there some issue or special consideration that should be taken into account when calling static methods in an Android app? public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); ImageManager.initImageManager(this); // crash } EDIT Apologies, the error is actually a VerifyError. There seems to be some conflict with the Dropbox API, which I'm using in one of the static methods, but which is not called prior to the app crashing. The following is error output after I changed the ImageManager to be an entirely static class, which I think it should be. ImageManager code follows: 01-09 19:23:51.356: W/dalvikvm(32032): VFY: unable to find class referenced in signature (Lcom/dropbox/client2/DropboxAPI;) 01-09 19:23:51.357: I/dalvikvm(32032): Could not find method com.dropbox.client2.DropboxAPI.getFile, referenced from method rfynes.moviebrowser.ImageManager.downloadImage 01-09 19:23:51.357: W/dalvikvm(32032): VFY: unable to resolve virtual method 5140: Lcom/dropbox/client2/DropboxAPI;.getFile (Ljava/lang/String;Ljava/lang/String;Ljava/io/OutputStream;Lcom/dropbox/client2/ProgressListener;)Lcom/dropbox/client2/DropboxAPI$DropboxFileInfo; 01-09 19:23:51.357: D/dalvikvm(32032): VFY: replacing opcode 0x6e at 0x0063 01-09 19:23:51.358: W/dalvikvm(32032): VFY: unable to resolve exception class 735 (Lcom/dropbox/client2/exception/DropboxServerException;) 01-09 19:23:51.358: W/dalvikvm(32032): VFY: unable to find exception handler at addr 0x8b 01-09 19:23:51.358: W/dalvikvm(32032): VFY: rejected Lrfynes/moviebrowser/ImageManager;.downloadImage (Ljava/lang/String;Ljava/io/File;Ljava/la…
has comment: http://stackoverflow.com/comment/31615426
favorite count: 0
has comment: http://stackoverflow.com/comment/31611809
has comment: http://stackoverflow.com/comment/31615061
has comment: http://stackoverflow.com/comment/31613304
has comment: http://stackoverflow.com/comment/31613290
tagged with: android
has comment: http://stackoverflow.com/comment/31611867
has comment: http://stackoverflow.com/comment/31613260
has comment: http://stackoverflow.com/comment/31613651
has comment: http://stackoverflow.com/comment/31613576
has answer: http://stackoverflow.com/a/21030512
has comment: http://stackoverflow.com/comment/31613395
type: UnansweredQuestion
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31612702
downvote count: 1
has comment: http://stackoverflow.com/comment/31613522
type: Question
has title: Why can't I call static methods anywhere in my Android app
has comment: http://stackoverflow.com/comment/31611725
has comment: http://stackoverflow.com/comment/31614372

http://stackoverflow.com/q/21118680
linked to: http://stackoverflow.com/q/2745265
possible better answer: http://stackoverflow.com/a/21118730
answer count: 5
has answer: http://stackoverflow.com/a/21118730
has comment: http://stackoverflow.com/comment/31776147
has answer: http://stackoverflow.com/a/21118841
has answer: http://stackoverflow.com/a/21119825
type: AnsweredQuestion
score: 2
tagged with: list
upvote count: 2
tagged with: java
has body: Say I have the following class structure public abstract class MyClass{} public class MyClassA extends MyClass{} public class MyClassB extends MyClass{} How do I create a list of MyClass elements that contains both MyClassA and MyClassB elements without objections? e.g. List&lt;MyClass&gt; myList = new LinkedList&lt;MyClassA&gt;();
has comment: http://stackoverflow.com/comment/31777106
type: Question
has comment: http://stackoverflow.com/comment/31775995
has comment: http://stackoverflow.com/comment/31775926
has comment: http://stackoverflow.com/comment/31776288
accepted answer: http://stackoverflow.com/a/21119825
has answer: http://stackoverflow.com/a/21118829
downvote count: 0
tagged with: polymorphism
has comment: http://stackoverflow.com/comment/31776006
favorite count: 0
has title: Java polymorphism and lists
has answer: http://stackoverflow.com/a/76348221
tagged with: extends

http://stackoverflow.com/q/21063873
type: AnsweredQuestion
upvote count: 14
has body: I have a problem with passing Map parameters or object to Retrofit POST request. I follow square, kdubb labs tutorials and this thread and I couldn't figure it out. My current code which works: public interface FacebookUser { @FormUrlEncoded @POST("/user/login-facebook") void login( @Field("fb_access_token") String fbAccessToken, @Field("os") String os, @Field("device") String device, @Field("os_version") String osVersion, @Field("app_version") String appVersion, @Field("online") String online, Callback&lt;FacebookLoginUserResponse&gt; callback ); } and code: RestAdapter restAdapter = new RestAdapter.Builder() .setServer(requestMaker.getUrl()) .build(); FacebookUser facebookUser = restAdapter.create(FacebookUser.class); facebookUser.login(getFbAccessToken(), getString(R.string.config_os), Info.getAndroidId(getBaseContext()), Build.VERSION.RELEASE, Info.getAppVersionName(getBaseContext()), "" + 1, new Callback&lt;FacebookLoginUserResponse&gt;() { @Override public void success(FacebookLoginUserResponse facebookLoginUserResponse, Response response) { } @Override public void failure(RetrofitError retrofitError) { } }); When I try to use this interface I receive from server that parameters are missing: public interface FacebookUser { @POST("/user/login-facebook") void login( @Body Map&lt;String, String&gt; map, Callback&lt;FacebookLoginUserResponse&gt; callback ); } and map: HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); map.put("fb_access_token", getFbAccessToken()); map.put("os", "android"); map.put("device", Info.getAndroidId(getBaseContext())); map.put("os_version", Build.VERSION.RELEASE); map.put("app_version", Info.getAppVersionName(getBaseContext())); map.put("online", "" + 1); Questions: What is it wrong? How can I pass object to request?
tagged with: java
type: Question
score: 14
has title: How to pass Map<String, String> parameters or object to POST request via Retrofit?
has answer: http://stackoverflow.com/a/22945987
possible better answer: http://stackoverflow.com/a/33428445
has answer: http://stackoverflow.com/a/22230892
answer count: 3
has answer: http://stackoverflow.com/a/33428445
tagged with: api
downvote count: 0
favorite count: 0
tagged with: retrofit
tagged with: android
accepted answer: http://stackoverflow.com/a/22945987

http://stackoverflow.com/q/21175448
has comment: http://stackoverflow.com/comment/31880267
has comment: http://stackoverflow.com/comment/31879683
has comment: http://stackoverflow.com/comment/31880766
has comment: http://stackoverflow.com/comment/31880382
tagged with: jpanel
has comment: http://stackoverflow.com/comment/31880108
has comment: http://stackoverflow.com/comment/31879984
has comment: http://stackoverflow.com/comment/31879941
tagged with: image
has comment: http://stackoverflow.com/comment/31880612
has answer: http://stackoverflow.com/a/21175624
answer count: 2
has comment: http://stackoverflow.com/comment/31880327
upvote count: 1
has comment: http://stackoverflow.com/comment/31880188
has comment: http://stackoverflow.com/comment/31879623
has comment: http://stackoverflow.com/comment/31880682
has body: I'm having trouble painting an image in my GraphicsPanel (extension of JPanel). I tried loading from a file with the pathname, using getCodeBase(), getDocumentBase(), getResource(), and using BufferedImage. Is there any way to draw the image without having to make it an ImageIcon inside a JLabel? package rpg; import java.awt.Color; import java.awt.Graphics; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import javax.swing.JPanel; import java.awt.Image; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JLabel; import java.awt.image.BufferedImage; public class GraphicsPanel extends JPanel implements MouseListener, MouseMotionListener { private WorldBuilder wb; public int currentTileType = 0;//tile types. 0=bgtile, 1=object, 2=NPC public String currentTileName = ""; public Image currentTile; public GraphicsPanel() { super(); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.red); g.fillRect(0, 0, 720, 528); g.drawImage(currentTile, 100, 100, this);//Nothing gets drawn here } public void getParameters(WorldBuilder wb) { this.wb = wb; this.currentTileType = wb.currentTileType; this.currentTileName = wb.currentTileName; /* try { currentTile = ImageIO.read(new File("SpriteSheet.png")); } catch (IOException e) { System.out.println("failed"); } */ currentTile = new ImageIcon("SpriteSheet.png").getImage(); repaint(); } @Override public void mouseClicked(MouseEvent e) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mousePressed(MouseEvent e) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void mouseReleased(MouseEvent e) { throw new UnsupportedOperationException("Not supported yet."); //…
favorite count: 0
has answer: http://stackoverflow.com/a/21176188
has comment: http://stackoverflow.com/comment/31880223
type: UnansweredQuestion
has title: Can not paint an image in my JPanel
has comment: http://stackoverflow.com/comment/31880042
has comment: http://stackoverflow.com/comment/31880152
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31879755
tagged with: java
has comment: http://stackoverflow.com/comment/31880580
tagged with: swing
has comment: http://stackoverflow.com/comment/31879884
type: Question
has comment: http://stackoverflow.com/comment/31880355

http://stackoverflow.com/comment/31827871
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21146956
type: QuestionComment
has text: @Aquillo learn English :)

http://stackoverflow.com/comment/31803753
type: AnswerComment
comment on: http://stackoverflow.com/a/21115431
type: Comment
score: 1
has text: I did not use double \. It is in the sql script which i get it from developer company and i'm not allowed to change it. just i should know where is the correct location of file on my computer.

http://stackoverflow.com/comment/31598264
has text: Which OS are you using ?
comment on: http://stackoverflow.com/q/21021136
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21343157
type: AcceptedAnswer
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/41913832
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/40966599
accepted answer of: http://stackoverflow.com/q/21116314
has body: I had a similar problem and solved it by setting LOCAL_APP_ENGINE_SERVER_URL = "http://[myLocalIp]:8888" where myLocalIp is your ipv4-address which you can find by opening cmd.exe from your start menu and writing ipconfig. Make sure to edit the correct SERVER_URL string in CloudEndpointUtils.java. I think it uses LOCAL_APP_ENGINE_SERVER_URL_FOR_ANDROID by default. For this to work i also had to change the run configurations for the backend project. In Eclipse: select the server project -> right click -> Run as -> Run Configurations. Select the Arguments pane and in Program Arguments, add --address=0.0.0.0 in front of the --port=8888.
has comment: http://stackoverflow.com/comment/36941534
answers question: http://stackoverflow.com/q/21116314

http://stackoverflow.com/comment/31741126
has text: I put keywords in my comment specifically so that you could look them up yourself.
type: Comment
comment on: http://stackoverflow.com/q/21099526
type: QuestionComment
score: 1

http://stackoverflow.com/q/21019656
favorite count: 0
accepted answer: http://stackoverflow.com/a/21019794
tagged with: multithreading
tagged with: android
has answer: http://stackoverflow.com/a/21019719
has answer: http://stackoverflow.com/a/21019794
type: AnsweredQuestion
score: 3
downvote count: 0
has title: Is it safe to use Java Threads in the same way as desktop applications?
tagged with: java
has body: The Android must manage the thread or can be used a code like this: public class GameThread implements Runnable { public void run() { while (!finished) { //game work try { Thread.sleep(fps); } catch (InterruptedException e) { // Interruptions here are no big deal. } } } }
type: Question
possible better answer: http://stackoverflow.com/a/21019719
upvote count: 3
has comment: http://stackoverflow.com/comment/31594886
answer count: 2

http://stackoverflow.com/comment/31767786
has text: I expect it was neither of those, but the vagueness of the question. Those of us here attempting to help you don't really have enough information, and this is confirmed by the fact that my guess at the problem wasn't really the problem. After a while we stop answering such questions altogether, because it often turns out to be a waste of time.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21113956

http://stackoverflow.com/a/21026111
has comment: http://stackoverflow.com/comment/31606213
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21026052
score: 3
upvote count: 3
has body: If you want to check whether list is intiialized or not then use the null check as mentioned here: if( list != null) To check whether list is non null and does not contains any element then add isEmpty method check also if( list != null &amp;&amp; !list.isEmpty())

http://stackoverflow.com/q/21031425
tagged with: java
linked to: http://stackoverflow.com/q/3949260
type: Question
has answer: http://stackoverflow.com/a/21031469
accepted answer: http://stackoverflow.com/a/21031469
possible better answer: http://stackoverflow.com/a/21031459
has answer: http://stackoverflow.com/a/21032301
has title: Pass classname to method
upvote count: 3
has body: My programs tend to use a lot of wrapped exceptions (SwingWorker, for instance, wraps all its exceptions in ExecutionException). So, I am trying to write a method that will allow me to check if an exception or any of its causes is an instanceof an exception type, but I don't know how (if it is even possible) to pass JUST a class name as an argument to a method. So far, I have this: public static boolean errorOrCausesInstanceOfClass(Throwable e, Class c) { return e != null &amp;&amp; (e.getClass().equals(c) || (e.getCause() != null &amp;&amp; errorOrCausesInstanceOfClass(e.getCause(), c))); } But this will only work if e.getClass() is exactly equal to c.getClass(). But I'd like to check using instanceof to catch subclasses as well. Is there a way to accomplish this?
answer count: 3
favorite count: 0
tagged with: instanceof
has answer: http://stackoverflow.com/a/21031459
has comment: http://stackoverflow.com/comment/31616486
type: AnsweredQuestion
score: 3
downvote count: 0

hibernate
tags question: http://stackoverflow.com/q/21030385
tags question: http://stackoverflow.com/q/21075905
tags question: http://stackoverflow.com/q/21110506
tags question: http://stackoverflow.com/q/21089963
tags question: http://stackoverflow.com/q/21171088
tags question: http://stackoverflow.com/q/21020216
tags question: http://stackoverflow.com/q/21042843
tags question: http://stackoverflow.com/q/21180607
tags question: http://stackoverflow.com/q/21110512
tags question: http://stackoverflow.com/q/21069687
tags question: http://stackoverflow.com/q/21069497
tags question: http://stackoverflow.com/q/21129672
tags question: http://stackoverflow.com/q/21018923
tags question: http://stackoverflow.com/q/21131964
tags question: http://stackoverflow.com/q/21143707
tags question: http://stackoverflow.com/q/21143099
tags question: http://stackoverflow.com/q/21094249
tags question: http://stackoverflow.com/q/21142604
tags question: http://stackoverflow.com/q/21070592
tags question: http://stackoverflow.com/q/21079259
tags question: http://stackoverflow.com/q/21031262
tags question: http://stackoverflow.com/q/21075549
tags question: http://stackoverflow.com/q/21182502
tags question: http://stackoverflow.com/q/21051165
tags question: http://stackoverflow.com/q/21029276
tags question: http://stackoverflow.com/q/21167489
tags question: http://stackoverflow.com/q/21101876
tags question: http://stackoverflow.com/q/21067307
tags question: http://stackoverflow.com/q/21141459
tags question: http://stackoverflow.com/q/21175959
tags question: http://stackoverflow.com/q/21148241
tags question: http://stackoverflow.com/q/21097857
tags question: http://stackoverflow.com/q/21180675
tags question: http://stackoverflow.com/q/21030740
tags question: http://stackoverflow.com/q/21084487
tags question: http://stackoverflow.com/q/21157980
tags question: http://stackoverflow.com/q/21081406
tags question: http://stackoverflow.com/q/21161063
tags question: http://stackoverflow.com/q/21168092
tag name: hibernate
tags question: http://stackoverflow.com/q/21063286
tags question: http://stackoverflow.com/q/21144790
tags question: http://stackoverflow.com/q/21109700
tags question: http://stackoverflow.com/q/21053438
tags question: http://stackoverflow.com/q/21159580
tags question: http://stackoverflow.com/q/21043777
tags question: http://stackoverflow.com/q/21041663
tags question: http://stackoverflow.com/q/21111188
tags question: http://stackoverflow.com/q/21087407
tags question: http://stackoverflow.com/q/21162491
tags question: http://stackoverflow.com/q/21064138
tags question: http://stackoverflow.com/q/21125628
tags question: http://stackoverflow.com/q/21143245
tags question: http://stackoverflow.com/q/21137312
tags question: http://stackoverflow.com/q/21130209
tags question: http://stackoverflow.com/q/21059451
tags question: http://stackoverflow.com/q/21168556
tags question: http://stackoverflow.com/q/21131185
tags question: http://stackoverflow.com/q/21049375
tags question: http://stackoverflow.com/q/21019309
tags question: http://stackoverflow.com/q/21018969
tags question: http://stackoverflow.com/q/21168866
tags question: http://stackoverflow.com/q/21114474
tags question: http://stackoverflow.com/q/21051259
tags question: http://stackoverflow.com/q/21180401
tags question: http://stackoverflow.com/q/21168335
tags question: http://stackoverflow.com/q/21181093
tags question: http://stackoverflow.com/q/21169770
tags question: http://stackoverflow.com/q/21024889
tags question: http://stackoverflow.com/q/21177838
tags question: http://stackoverflow.com/q/21057292
tags question: http://stackoverflow.com/q/21076023
tags question: http://stackoverflow.com/q/21066818
type: Tag
tags question: http://stackoverflow.com/q/21137049
tags question: http://stackoverflow.com/q/21073254
tags question: http://stackoverflow.com/q/21113979
tags question: http://stackoverflow.com/q/21027680
tags question: http://stackoverflow.com/q/21030110
tags question: http://stackoverflow.com/q/21124361

http://stackoverflow.com/a/55313146
has body: Try out this..... Input.replace("-&amp;+$?.@"," ").split(" ");
score: 2
answers question: http://stackoverflow.com/q/21054524
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/comment/31717635
comment on: http://stackoverflow.com/a/21086175
type: AnswerComment
type: Comment
has text: Bear in mind if you do: `X a(0);` where X is a class, the constructor will be called at the beginning of each iteration, and the destructor on the end of each iteration. Unless the compiler can determine that "calling the constructor & destructor doesn't do anything".
score: 2

http://stackoverflow.com/a/21144765
has comment: http://stackoverflow.com/comment/32218884
has comment: http://stackoverflow.com/comment/31824348
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/31836450
upvote count: 15
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21144598
has comment: http://stackoverflow.com/comment/31989174
answers question: http://stackoverflow.com/q/21144598
has comment: http://stackoverflow.com/comment/32218946
has body: This is actually an interview question I have heard a few times. While I have never tried to implement any sort of loop detection, the answer that most of the interviewers seemed to like is iterating through the list and storing the visited nodes in a hashtable. If you get a collision while storing into the table, then you have a loop in your list. Edit: In an attempt to offer some code for the example, here is what I would probably try to do (assuming you have some sort of LinkedList&lt;EntityNode&gt; object). I updated this to use a HashSet instead of a HashMap so it was more straightforward (as pointed out by PM 77-1). public bool detectLoop(LinkedList&lt;EntityNode&gt; list) { Set&lt;EntityNode&gt; nodeSet = new HashSet&lt;EntityNode&gt;(); EntityNode curNode = list.getHead(); boolean loopDetected = false; if(curNode != null) { while(curNode.getNextNode() != null &amp;&amp; !loopDetected) { cureNode = curNode.getNextNode(); loopDetected = !nodeSet.add(curNode); } } return loopDetected; } I haven't had the opportunity to test this, but this should work. The reason being that the add() method for a HashSet returns true if this set did not already contain the specified element. So if there is a EntityNode already exists in the set, it will return false, meaning that there was a loop detected. Since my answer has sort of taken off, I want to say that there are other solutions to this as well. The other one that has been pointed out in this thread is the tortoise and the hare algorithm. You can find more information on that in this thread or at this wiki page.
has comment: http://stackoverflow.com/comment/32006950
has comment: http://stackoverflow.com/comment/31865109
has comment: http://stackoverflow.com/comment/31833274
score: 15
has comment: http://stackoverflow.com/comment/32249763

http://stackoverflow.com/comment/31636831
score: 0
type: Comment
type: QuestionComment
has text: @PeterNiederwieser I removed the usage of all plugins but the java plugins and now there is just basic stuff (repository and dependency declarations and some basic other tasks left, details see update above) left. Still the sourceCompatibility is set to 1.7. Any other ideas what could lead to it being set wrongly? Next, I'll try setting the sourceCompatibility on the JavaCompile tasks directly.
comment on: http://stackoverflow.com/q/21028438

http://stackoverflow.com/comment/31665396
type: Comment
comment on: http://stackoverflow.com/q/21058482
has text: Well, the whole point is to return the user from a RESTful service to display the permission details.
score: 0
type: QuestionComment

http://stackoverflow.com/a/67985729
score: 0
type: Answer
has body: This solution worked for me while using tomcat runtime. Create a jar disabling hostname verification and passing it as a javaagent to your runtime container. https://stackoverflow.com/a/13032654/2815984
answers question: http://stackoverflow.com/q/21120264

http://stackoverflow.com/q/21052708
linked to: http://stackoverflow.com/q/21015991
has comment: http://stackoverflow.com/comment/31654958
tagged with: java
has comment: http://stackoverflow.com/comment/31657394
has title: JDBC using Tomcat-DBCP requires JDBC driver in Tomcat's own /lib
has comment: http://stackoverflow.com/comment/31661079
has answer: http://stackoverflow.com/a/21053320
type: Question
has body: I have a simple servlet that uses Tomcat-DBCP to fetch connections. protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ... Connection conn = null; try { conn = createConnection(); .... } public Connection createConnection() throws SQLException { Connection conn = null; DataSource datasource = new DataSource(); PoolProperties p = new PoolProperties(); p.setUrl("jdbc:oracle:thin:@localhost:1521:XE"); p.setDriverClassName("oracle.jdbc.OracleDriver"); p.setUsername("SYSTEM"); p.setPassword("password"); datasource.setPoolProperties(p); try { conn = datasource.getConnection(); } catch (SQLException e) { e.printStackTrace(); } return conn; } It needs ojdbc6.jar in tomcat's /lib folder and not in WEB-INF/lib. Why doesn't the web-apps own lib folder work? Based on a answer here, binding driver code with the common class loader causes memory leaks. If true, what is the workaround?
linked to: http://stackoverflow.com/q/6981564
has comment: http://stackoverflow.com/comment/31654846
has comment: http://stackoverflow.com/comment/31656356
duplicate of: http://stackoverflow.com/q/6981564
has comment: http://stackoverflow.com/comment/31656214
answer count: 1
accepted answer: http://stackoverflow.com/a/21053320
downvote count: 0
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/31699455
tagged with: jdbc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31729819
score: 2
upvote count: 2

http://stackoverflow.com/q/21093202
has comment: http://stackoverflow.com/comment/31728972
has answer: http://stackoverflow.com/a/21096567
has comment: http://stackoverflow.com/comment/31729036
has title: in eclipse,i tried to open "window" in the tool bar and it is not working. what do i do?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31729092
has comment: http://stackoverflow.com/comment/31729754
has comment: http://stackoverflow.com/comment/31729622
tagged with: java
tagged with: eclipse
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/31730523
has comment: http://stackoverflow.com/comment/31729259
tagged with: eclipse-plugin
has body: in eclipse ,i accidentally minimized the console . so tried to open the "window" option which is next to the run option in the tool bar. "window" option is not getting opened.none of those options are working !not able to figure out the problem !
has comment: http://stackoverflow.com/comment/31729029
score: 0

http://stackoverflow.com/q/21071412
type: Question
tagged with: jframe
tagged with: swing
answer count: 1
has answer: http://stackoverflow.com/a/21071587
has body: I've got a JFrame with no decoration (no title bar, close button, etc) that I can drag around the screen using setLocation() and mouse position. Unfortunately, the mouseExited event is called upon first move of the window... Move mouse into window and mouseEntered event is fired Click mouse and mousePressed event is fired. Drag mouse and mouseDragged event is fired, and setLocation is called. mouseExited event is fired, even though the mouse is still in the window! Moving mouse out of the window at this point will not fire mouseExited. Moving mouse out and back in will reset back to step 1. How do I fix this problem, other than just manually testing mouse position on screen? Edit: Here's a distilled version of the code import java.awt.*; import javax.swing.*; import java.awt.Event; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import javax.swing.JComponent; import javax.swing.JFrame; class DragNDropper implements MouseMotionListener, MouseListener { private int x, y; private int dx, dy; private boolean clicked; private JFrame frame; public DragNDropper(JFrame frame) { dx = dy = 0; this.frame = frame; } public void mouseDragged(MouseEvent e) { x = e.getXOnScreen(); y = e.getYOnScreen(); frame.setLocation(x-dx, y-dy); } public void mouseMoved(MouseEvent e) { x = e.getXOnScreen(); y = e.getYOnScreen(); } public void mouseClicked(MouseEvent e) { } public void mousePressed(MouseEvent e) { clicked = true; dx = e.getX(); dy = e.getY(); } public void mouseReleased(MouseEvent e) { clicked = false; } public void mouseEntered(MouseEvent e) { System.out.println("Mouse entered"); } public void mouseExited(MouseEvent e) { System.out.println("Mouse exited"); } } public class Program { public static void main(String[] argv) { JFrame jf = new JFrame(); DragNDropper dnd = new DragNDropper(jf); jf.setSize(new Dimension(512, 512)); jf.addMouseListener(dnd); jf.addMouseMotionListener(dnd); jf.show(); } }
has comment: http://stackoverflow.com/comment/31689244
has comment: http://stackoverflow.com/comment/31689137
has comment: http://stackoverflow.com/comment/31689385
has comment: http://stackoverflow.com/comment/31689228
tagged with: java
linked to: http://stackoverflow.com/q/7143287
has comment: http://stackoverflow.com/comment/31689421
upvote count: 1
has comment: http://stackoverflow.com/comment/31689234
accepted answer: http://stackoverflow.com/a/21071587
downvote count: 0
has comment: http://stackoverflow.com/comment/31689287
has title: Java mouseExited event is firing when frame.setLocation() is called
tagged with: mouseevent
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/31689330
favorite count: 0
tagged with: mouseenter
has comment: http://stackoverflow.com/comment/31689373

http://stackoverflow.com/comment/31774851
comment on: http://stackoverflow.com/a/21113097
has text: Sure, I didn't think it was just about numbers---but whenever you have such an ordering constraint on threads, then it makes no sense to have the threads in the first place. You need one thread which executes the tasks in order. Whether or not you need even that one thread in addition to some "main" thread is still open---if you really do, then Jakub's solution is the right choice. If not, then you don't even need an executor service involved.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31684828
score: 0
type: QuestionComment
has text: It works finally! Thanks JB Nizet!
type: Comment
comment on: http://stackoverflow.com/q/21068668

http://stackoverflow.com/q/21061393
type: Question
has comment: http://stackoverflow.com/comment/106672281
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/59254540
favorite count: 0
has title: Communication link failure
has body: i'm getting this error when i'm trying to connect to mysql database SQLException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. please help me solve this error This is my code to connect to database. try { Class.forName("com.mysql.jdbc.Driver").newInstance(); } catch (Exception ex) { System.out.println("Unable to load Driver"); } Connection con = null; try { con = DriverManager.getConnection("jdbc:mysql://fdb7.biz.nf:3306/1593661_test", "1593661_test", "thisispass"); System.out.println("connection done."); } catch (SQLException ex) { System.out.println("SQLException: " + ex.getMessage()); System.out.println("SQLState: " + ex.getSQLState()); System.out.println("VendorError: " + ex.getErrorCode()); } help me please.
type: UnansweredQuestion
tagged with: jdbc
answer count: 0
has comment: http://stackoverflow.com/comment/31670474
has comment: http://stackoverflow.com/comment/31729542
tagged with: java
tagged with: mysql
upvote count: 1

web-applications
tags question: http://stackoverflow.com/q/21168041
tags question: http://stackoverflow.com/q/21159580
tags question: http://stackoverflow.com/q/21136911
tags question: http://stackoverflow.com/q/21115619
tags question: http://stackoverflow.com/q/21034437
tags question: http://stackoverflow.com/q/21034928
tag name: web-applications
tags question: http://stackoverflow.com/q/21120590
type: Tag
tags question: http://stackoverflow.com/q/21052695

http://stackoverflow.com/comment/119405467
comment on: http://stackoverflow.com/a/37934102
type: AnswerComment
has text: @Atihska this really resolved my issue. Thank you and really appreciated
type: Comment
score: 1

http://stackoverflow.com/comment/31599815
score: 0
type: Comment
has text: Read his question again and notice its two questions, and notice I answered the first question which makes his second question relevant.
comment on: http://stackoverflow.com/a/21022518
type: AnswerComment

http://stackoverflow.com/comment/31679152
type: AnswerComment
has text: you want the keys not to be reversed?
type: Comment
comment on: http://stackoverflow.com/a/21065860
score: 0

http://stackoverflow.com/comment/31883274
has text: I got the error for myToList, it say cannot be converted to address by method ?!???
comment on: http://stackoverflow.com/a/21177537
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31720497
type: Comment
comment on: http://stackoverflow.com/a/21088106
type: AnswerComment
has text: public class PNRStatusCheck { public static void main(String args[]) { try { String pnr1 = "1154177041"; String reqStr = "lccp_pnrno1=" + pnr1 + "&submitpnr=Get+Status"; PNRStatusCheck check = new PNRStatusCheck(); StringBuffer data = check.getPNRResponse(reqStr, "http://www.indianrail.gov.in/cgi_bin/inet_pnrstat_cgi.cgi"); if(data != null) { @SuppressWarnings("unused") PNRStatus pnr = check.parseHtml(data); } } catch(Exception e) { e.printStackTrace(); } }
score: 0

http://stackoverflow.com/q/21043028
has comment: http://stackoverflow.com/comment/31637771
score: 4
has body: I've got a big problem with AES Cryptography between Java and C++ (CryptoPP to be specific), that I was expecting to be way easier than asymetric cryptography, that I managed to solve earlier. When I'm decrypting 48 bytes and the result is byte[] array of 38 bytes (size + code + hashOfCode), the last 22 bytes are decrypted properly and the first 16 are wrong. try { cipher = Cipher.getInstance("AES/CBC/PKCS5Padding", "BC"); byte[] key = { 107, -39, 87, -65, -1, -28, -85, -94, 105, 76, -94, 110, 48, 116, -115, 86 }; byte[] vector = { -94, 112, -23, 93, -112, -58, 18, 78, 1, 69, -92, 102, 33, -96, -94, 59 }; SecretKey aesKey = new SecretKeySpec(key, "AES"); byte[] message = { 32, -26, -72, 25, 63, 114, -58, -5, 4, 90, 54, 88, -28, 3, -72, 25, -54, -60, 17, -53, -27, -91, 34, -101, -93, -3, -47, 47, -12, -35, -118, -122, -77, -7, -9, -123, 7, -66, 10, -93, -29, 4, -60, -102, 16, -57, -118, 94 }; IvParameterSpec aesVector = new IvParameterSpec(vector); cipher.init(Cipher.DECRYPT_MODE, aesKey, aesVector); byte[] wynik = cipher.doFinal(message); Log.d("Solution here", "Solution"); for (byte i : wynik) Log.d("Solution", "" + i); } catch (Exception e) { Log.d("ERROR", "TU"); e.printStackTrace(); } Decrypted message, that I'm expecting to get is: 0 0 0 32 10 0 16 43 81 -71 118 90 86 -93 -24 -103 -9 -49 14 -29 -114 82 81 -7 -59 3 -77 87 -77 48 -92 -111 -125 -21 123 21 86 4 But what I'm getting is 28 127 -111 92 -75 26 18 103 79 13 -51 -60 -60 -44 18 126 -9 49 14 -29 -114 82 81 -7 -59 3 -77 87 -77 48 -92 -111 -125 -21 123 21 86 4 As you can see only last 22 bytes are the same. I know that AES works with blocks and so I was thinking that maybe something with initialization vector is wrong (because only the first block is broken), but as you can see I'm setting vector in the way I think is OK. And I have no idea why is it working that way. Any help will be really appreciated, cause I'm running out of time. [EDIT] I add the Cipher initialization. As you wrote, it is AES/CBC/PKCS5P…
answer count: 1
has title: Java AES CBC Decryption First Block
has answer: http://stackoverflow.com/a/31766343
has comment: http://stackoverflow.com/comment/31637666
favorite count: 0
has comment: http://stackoverflow.com/comment/50897063
tagged with: cryptography
upvote count: 4
has comment: http://stackoverflow.com/comment/31642402
tagged with: aes
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31641494
type: Question
tagged with: java

http://stackoverflow.com/q/21047497
has comment: http://stackoverflow.com/comment/31645050
tagged with: google-maps
has title: NullPointerException on back press in fragment with nested google map fragment
favorite count: 0
tagged with: nullpointerexception
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37762933
answer count: 4
has body: I have an activity which displays content using several fragments. One of these fragments needs to display a google map fragment inside it. I have got the map fragment displaying correctly with the code below and the app works fine transitioning between different fragments, however, every time I exit the app by pressing the back button from the fragment with the map, I get an android error alert message and the following nullpointerexception error in logcat. The log response does not point to anywhere in my code where i can handle the exception. I think the problem lies with the ondestroyView() method but i dont know enough about fragments at the moment to fix it. Any ideas? Logcat error: 01-10 14:15:42.888: E/AndroidRuntime(15039): FATAL EXCEPTION: main 01-10 14:15:42.888: E/AndroidRuntime(15039): java.lang.NullPointerException 01-10 14:15:42.888: E/AndroidRuntime(15039): at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1410) 01-10 14:15:42.888: E/AndroidRuntime(15039): at android.app.FragmentManagerImpl$1.run(FragmentManager.java:441) 01-10 14:15:42.888: E/AndroidRuntime(15039): at android.os.Handler.handleCallback(Handler.java:725) 01-10 14:15:42.888: E/AndroidRuntime(15039): at android.os.Handler.dispatchMessage(Handler.java:92) 01-10 14:15:42.888: E/AndroidRuntime(15039): at android.os.Looper.loop(Looper.java:137) 01-10 14:15:42.888: E/AndroidRuntime(15039): at android.app.ActivityThread.main(ActivityThread.java:5041) 01-10 14:15:42.888: E/AndroidRuntime(15039): at java.lang.reflect.Method.invokeNative(Native Method) 01-10 14:15:42.888: E/AndroidRuntime(15039): at java.lang.reflect.Method.invoke(Method.java:511) 01-10 14:15:42.888: E/AndroidRuntime(15039): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 01-10 14:15:42.888: E/AndroidRuntime(15039): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 01-10 14:15:42.888: E/AndroidRuntime(15039): at dalvik.system.NativeStart.main(Native Method…
score: 2
has comment: http://stackoverflow.com/comment/31644765
has answer: http://stackoverflow.com/a/24430269
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21048049
downvote count: 1
type: Question
tagged with: android-fragments
has answer: http://stackoverflow.com/a/21048965
has answer: http://stackoverflow.com/a/23118174

http://stackoverflow.com/comment/31741199
has text: You haven't breath deep, didn't you?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21099526
score: 0

http://stackoverflow.com/comment/31681329
score: 0
type: Comment
has text: Genius! Thank you so much! Sorry for polluting the site with noob questions, but I'm still too new to Java to limp fully through these problems myself. One day I'll have a good grasp on this awesome language!
comment on: http://stackoverflow.com/a/21067207
type: AnswerComment

http://stackoverflow.com/comment/31617962
comment on: http://stackoverflow.com/a/21031266
has text: He doesn't. Read the question before you comment further. Do you even know what JAAS is? Kerberos?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31738112
type: QuestionComment
comment on: http://stackoverflow.com/q/21096276
score: 5
type: Comment
has text: I would say the question as stated does not have an answer because the code in the given state can't be analyzed as a solution. It isn't correct code. Whether the solution is "good practice" or not depends on how it looks by the time you actually *have* a working solution.

http://stackoverflow.com/q/21098065
tagged with: rest
has title: Unable to query using Neo4j Rest API - Error reading as JSON ''
type: UnansweredQuestion
type: Question
score: 1
tagged with: java
has body: Not sure what I am doing wrong, but with my set up even a basic cypher query using the neo4j Rest API is not working. I get a java.lang.RuntimeException: Error reading as JSON '' My set up org.neo4j neo4j-rest-graphdb 2.0.0-M06 org.neo4j neo4j 2.0.0 org.neo4j.app neo4j-server 2.0.0 <Code> private GraphDatabaseService graphDb; private RestCypherQueryEngine queryEngine; System.setProperty("org.neo4j.rest.batch_transaction", "true"); graphDb = new RestGraphDatabase( "http://localhost:7474/db/data/" ); queryEngine = new RestCypherQueryEngine(((RestGraphDatabase)graphDb).getRestAPI()); StringBuilder query = new StringBuilder(); query.append("match (u { id:'").append(id).append("' }) return u"); QueryResult<Map<String,Object>> result = engine.query(query.toString(), null); //the above statement throws the runtime exception with message "Error reading as JSON '' "
has answer: http://stackoverflow.com/a/21127640
upvote count: 1
answer count: 1
downvote count: 0
tagged with: neo4j
favorite count: 0
has comment: http://stackoverflow.com/comment/31760239

http://stackoverflow.com/q/21041303
accepted answer: http://stackoverflow.com/a/21043007
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has body: I am looking for a way to stream series of images (jpegs) from java application into FFMpeg STDIN pipe. FFMpeg should process these images and create a video file as an output. FFMpeg is executed as sub process of java application with the following command "ffmpeg.exe -i pipe:0 out.avi" When i run "ffmpeg -i input.jpg out.avi" command in the console, i get the "out.avi" file as expected But when i use the following tester code in my java application, i got an error. Code in Java application: File ffmpeg_output_msg = new File("ffmpeg_output_msg.txt"); ProcessBuilder pb = new ProcessBuilder( "ffmpeg.exe","-i","pipe:0","out.avi"); pb.redirectErrorStream(true); pb.redirectOutput(ffmpeg_output_msg); pb.redirectInput(ProcessBuilder.Redirect.PIPE); Process p = pb.start(); OutputStream ffmpegInput = p.getOutputStream(); byte[] image; File file = new File("input.jpg"); image = new byte[(int)file.length()]; FileInputStream fileInputStream = new FileInputStream(file); fileInputStream.read(image); ImageInputStream iis = ImageIO.createImageInputStream( new ByteArrayInputStream(image)); BufferedImage img = ImageIO.read(iis); ImageIO.write(img, "JPEG", ffmpegInput); FFMpeg output: ffmpeg version N-59664-g94cf4f8 Copyright (c) 2000-2014 the FFmpeg developers built on Jan 7 2014 22:07:02 with gcc 4.8.2 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libxavs --enable-l…
type: Question
tagged with: ffmpeg
answer count: 2
upvote count: 6
tagged with: java
has answer: http://stackoverflow.com/a/21043007
tagged with: bufferedimage
has answer: http://stackoverflow.com/a/21041548
has title: Pipe series of images from java application to ffmpeg subprocess
tagged with: pipe
possible better answer: http://stackoverflow.com/a/21041548
score: 6

http://stackoverflow.com/comment/31826928
comment on: http://stackoverflow.com/a/21146292
score: 0
type: AnswerComment
type: Comment
has text: Thanks for the input, I'll have to think more about this Metric object type model (I believe its very similar to what I'm already doing). Because I believe you to be right about resource needs being roughly equal between the JMX Agent and Client side polling mechanisms, and there being no way around it, I'll accept this answer as well. Appreciate it Gray.

http://stackoverflow.com/q/21156599
linked to: http://stackoverflow.com/q/31582548
answer count: 6
tagged with: concurrency
has answer: http://stackoverflow.com/a/45507219
has title: Java's Fork/Join vs ExecutorService - when to use which?
possible better answer: http://stackoverflow.com/a/21157675
has body: I just finished reading this post: What&#39;s the advantage of a Java-5 ThreadPoolExecutor over a Java-7 ForkJoinPool? and felt that the answer is not straight enough. Can you explain in simple language and examples, what are the trade-offs between Java 7's Fork-Join framework and the older solutions? I also read the Google's #1 hit on the topic Java Tip: When to use ForkJoinPool vs ExecutorService from javaworld.com but the article doesn't answer the title question when, it talks about api differences mostly ...
linked to: http://stackoverflow.com/q/9276807
upvote count: 94
downvote count: 0
favorite count: 0
score: 94
has answer: http://stackoverflow.com/a/21156677
accepted answer: http://stackoverflow.com/a/21156677
tagged with: executorservice
has answer: http://stackoverflow.com/a/21157675
tagged with: multithreading
has answer: http://stackoverflow.com/a/34922218
tagged with: fork-join
has answer: http://stackoverflow.com/a/50545425
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/29405730
tagged with: java

http://stackoverflow.com/q/21095157
has title: Submit Website Button using Java
has comment: http://stackoverflow.com/comment/31733250
score: 1
tagged with: java
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/31732736
has comment: http://stackoverflow.com/comment/31732726
has body: I want to submit a button on a website using Java. The websites button code is as follows: &lt;button type="submit" class="button-class button-class-name"&gt; BUTTON NAME &lt;/button&gt; I have a problem though, I can't seem to send a POST request to submit the button. My goal is to "press" multiple buttons simulating a browser, but to do it very quickly. Here is my code for sending a post request. PostMethod addToCart = new PostMethod(url); NameValuePair data[] = { new NameValuePair("button-class button-class-name", "submit"), }; addToCart.setRequestBody(data); InputStream in = addToCart.getResponseBodyAsStream(); //Handles Response I don't know if my way is the incorrect way to go about this, but my overall goal is to press a button on one page have it bring me to the next page fill out a couple of forms and finally submit. I am pretty positive that I am doing this totally wrong and I have searched for a while, and I can't find anywhere to start.
has comment: http://stackoverflow.com/comment/31736955
tagged with: http://stackoverflow.com/tag/html
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1

signal-processing
tags question: http://stackoverflow.com/q/21037171
type: Tag
tag name: signal-processing

http://stackoverflow.com/q/21019509
has comment: http://stackoverflow.com/comment/31594917
linked to: http://stackoverflow.com/q/7521803
favorite count: 0
tagged with: stax
has answer: http://stackoverflow.com/a/21020045
has comment: http://stackoverflow.com/comment/31594515
upvote count: 6
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
downvote count: 3
has body: I'm developing a RSS feed aggregator with Apache Tomcat. I was wondering which parser to use in order to read RSS feeds. Should I use DOM, SAX or StAX? I know that there are libraries specific to read RSS feeds with java but since this is a university project I am not supposed to use those. Thank you.
tagged with: sax
type: Question
linked to: http://stackoverflow.com/q/373833
score: 3
has title: What are the differences between DOM, SAX and StAX XML parsers?
tagged with: java
has answer: http://stackoverflow.com/a/21019863
tagged with: dom
answer count: 2

http://stackoverflow.com/a/21139424
accepted answer of: http://stackoverflow.com/q/21135930
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21135930
score: 0
type: Answer
has body: Probably containers do not like moving UI parts so you have to "render" it yourself. You have to overwrite the paint method and clear the background and do what the container does, you issue a paint request to every component. For me this worked without problems. public void paint(Graphics g) { g.clearRect(0, 0, getWidth(), getHeight()); for(Component c: getContentPane().getComponents()) { c.repaint(); } }

http://stackoverflow.com/q/21158006
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21158218
has title: Mock spring MessageContext
tagged with: junit
has comment: http://stackoverflow.com/comment/31847507
upvote count: 1
tagged with: spring
tagged with: unit-testing
accepted answer: http://stackoverflow.com/a/21158218
type: AnsweredQuestion
tagged with: java
has body: i would like to mock these methods: SaajSoapMessage saajSoapMessage = (SaajSoapMessage) messageContext.getRequest(); SoapBody requestBody = saajSoapMessage.getSoapBody(); I tried it with this messageContextMock = mock(MessageContext.class); saajSoapMessageMock = mock(SaajSoapMessage.class); when(messageContextMock.getRequest()).thenReturn((SaajSoapMessage) saajSoapMessageMock); when(saajSoapMessageMock.getSoapBody()).thenReturn(soapBodyMock); But I have problem with mocking getSoapBody() because Junit wrote me: at org.springframework.ws.soap.AbstractSoapMessage.getSoapBody(AbstractSoapMessage.java:36) How to mock this operation correctly? EDIT (full stack): java.lang.NullPointerException at org.springframework.ws.soap.AbstractSoapMessage.getSoapBody(AbstractSoapMessage.java:36) at com.project.my.WebMessageTest.setUp(WebMessageTest.java:33) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners…
type: Question
tagged with: mockito
answer count: 1
downvote count: 0

http://stackoverflow.com/q/21076697
answer count: 3
linked to: http://stackoverflow.com/q/13279509
has body: //Generates a random number but doesn't allow the same number be repeated for (int i = 0; i &lt; questions1.length; i++) { //random number int r = (int)(Math.random() * i); temp = index[r]; index[r] = index[i]; index[i] = temp; } How do I make it favour 1 number in particular?
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/31698593
has comment: http://stackoverflow.com/comment/31698553
type: UnansweredQuestion
has title: How do you generate a random number in Java but favouring 1 specific number
tagged with: java
duplicate of: http://stackoverflow.com/q/13279509
type: Question
has answer: http://stackoverflow.com/a/21076826
has comment: http://stackoverflow.com/comment/31698551
score: -2
has answer: http://stackoverflow.com/a/21076749
has answer: http://stackoverflow.com/a/21076792
downvote count: 4

http://stackoverflow.com/comment/31675556
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21064097
has text: And your question is ... ?

http://stackoverflow.com/comment/31735430
has text: I am trying to use that component directly as I will to dynamically create different Messages from different Strings, and then based on the Message Payload, route those messages to different channels.
comment on: http://stackoverflow.com/a/21089184
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/36152654
answers question: http://stackoverflow.com/q/21042356
type: Answer
upvote count: 1
score: 1
has body: It is very easy to build one using Java and Spring Boot. Just checkout this project https://github.com/alessiop86/dummy-server and extend MyRestController accordingly to your test.. adding one method for each request you need to handle (you could also define dynamic methods with parameters, look for @PathVariable documentation). @RestController public class MyRestController { @RequestMapping(value = "/users/1") public @ResponseBody String method1() throws IOException { return " 1 "; } @RequestMapping(value = "/hello/2") public @ResponseBody String method2() throws IOException { return "{'hi':'alessio'}"; } }
downvote count: 0

http://stackoverflow.com/a/21143298
type: Answer
accepted answer of: http://stackoverflow.com/q/21142408
answers question: http://stackoverflow.com/q/21142408
upvote count: 3
score: 3
has body: There are many other things Spring Framework handle and take away from your code, including: IoC And AOP, Configuring Application JNDI Transaction management abstraction Handling single transaction/connection using different technologies (such as JDBC and JPA) Ensuring resource releasing (using Templates) Unified event dispatcher Provides common Aspects, such as async method call and transaction Integration with JMS, JPA, Hibernate, ... Transparent remoting (with different technologies) MVC Servlet and Portlet Frameworks Easily implementing and consuming web services (including REST) Caching Easy integration with many tools such as CXF, Apache Camel, ... Other than that there are other projects in Spring Portfolio, which handle other things, just name important ones: Spring Security Spring Integration Spring Batch Spring Data More Information: - Transaction Management Abstraction is what Spring provides to uniform access to different transaction APIs such as JTA, JDBC Transaction, Hibernate Transaction, .... So you can start coding with Hibernate Transaction and change the transaction manager to container managed by an application server without changing any code (just by changing configurations). When working with JDBC based APIs (and which are depended on JDBC) such as Hibernate, JPA, and MyBatis. Spring can handle uniqueness of connection/transaction per thread, so if you do some query using JDBC, some with HQL and some with JPQL in a single transaction all would be executed using a single connection/transaction. When comes to resource management things go ugly, for example when dealing with a JDBC work you shall do something like: Connection connection = null; PreparedStatement statement = null; try { connection = dataSouce.getConnection(); statement = connection.prepareStatement('some query'); statement.executeUpdate(); } catch(SQLException e) { throw new SomeWrapperException(e); } finally { try { // if (statement != null) { // statement.close(); // } if (conne…
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31825773

http://stackoverflow.com/a/21170045
score: 0
answers question: http://stackoverflow.com/q/21146290
has body: Try three options... Take a backup of config.xml and edit it by placing the ssl port make sure ssl port enabled tag is true Goto admin console there also change the ssl port as per your requirement what you put in the config.xml 3.Make sure you opened that port in firewall Goto Run -> wf.msc -> inbound connection -> new rule -> port -> finish Restart all the nodes (Both admin and managed)
type: Answer

http://stackoverflow.com/q/21063975
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21078165
score: 0
tagged with: java
type: Question
tagged with: gwt
possible better answer: http://stackoverflow.com/a/21075328
has answer: http://stackoverflow.com/a/21075328
has title: Loading HTML templates via Ajax from Google Web Toolkit?
linked to: http://stackoverflow.com/q/20639998
answer count: 2
has answer: http://stackoverflow.com/a/21078165
has body: For my gwt app, I have certain html templates that are stored as static .html files on my website. e.g example.com/views/signup.html , example.com/views/foo.html , etc. I want this to be a single page app like Twitter, so the user would navigate through all the pages without the page being refreshed. I will have a HTMlPanel as the root element of my app on the host page. Whenever the user navigates to a different page, e.g by clicking a link in the navigation menu, I want to load the .html template for that page via ajax, and set the returned html into the HTMLPanel. Is this a plausible solution? If so, how can I load the html templates via ajax from GWT? Thanks.
linked to: http://stackoverflow.com/q/12993095

http://stackoverflow.com/a/21885863
has body: I had the same problem! Found out, that the service.bat didn't configure the service the right way. If you enable the logging from your service starter: Then you'll see in your loggs something like: [2014-02-19 16:40:35] [error] ( javajni.c:863 ) [ 2636] FindClass org/apache/catalina/startup/Bootstrap failed [2014-02-19 16:40:35] [debug] ( javajni.c:964 ) [ 2636] Java Worker thread finished org/apache/catalina/startup/Bootstrap:main with status=3 [2014-02-19 16:40:35] [error] ( prunsrv.c:1183) [ 5000] Failed to start Java [2014-02-19 16:40:35] [error] ( prunsrv.c:1536) [ 5000] ServiceStart returned 4 You'll notice that there is some classpath problem with the starter. In fact that's the problem! Your service.bat didn't configure the service the right way: Note: You can also choose "Use default" above "Java Virtual Machine" to use whatever JVM is defined in JAVA_HOME You'll need to set the classpath correctly: c:\webclient\apache-tomcat\bin\tomcat-juli.jar;c:\webclient\apache-tomcat\bin\tomcat-juli.jar;c:\webclient\apache-tomcat\bin\bootstrap.jar In my case i "installed" tomcat at: c:\webclient\apache-tomcat replace that part with yours. In my case not even the Java VM was set.. I'm not shure whether this is a problem with the current versions of tomcat (and it's service.bat), or with some sort of permission problem on the windows server itself..
has comment: http://stackoverflow.com/comment/42770651
type: AcceptedAnswer
upvote count: 14
has comment: http://stackoverflow.com/comment/42975667
type: Answer
has comment: http://stackoverflow.com/comment/52400399
accepted answer of: http://stackoverflow.com/q/21100451
score: 14
answers question: http://stackoverflow.com/q/21100451
downvote count: 0

http://stackoverflow.com/a/21093233
answers question: http://stackoverflow.com/q/21093170
upvote count: 2
has body: Did you actually create the table? It seems like the DATABASE_CREATE script is never executed. If you have created it once and then changed the statement, make sure it is executed again by incrementing the database version. DATABASE_VERSION=1, did you have a prior version without the NAME column? Try incrementing the DATABASE_VERSION (maybe add some logging/breakpoints) and see if the DB gets recreated.
downvote count: 0
has comment: http://stackoverflow.com/comment/31729301
type: Answer
score: 2

http://stackoverflow.com/comment/31684295
comment on: http://stackoverflow.com/q/21068698
type: Comment
type: QuestionComment
score: 1
has text: google Java memory model

servlets
tags question: http://stackoverflow.com/q/21101454
tags question: http://stackoverflow.com/q/21135264
tags question: http://stackoverflow.com/q/21161563
tags question: http://stackoverflow.com/q/21139954
tags question: http://stackoverflow.com/q/21043313
tags question: http://stackoverflow.com/q/21062586
tags question: http://stackoverflow.com/q/21079868
tags question: http://stackoverflow.com/q/21067075
tags question: http://stackoverflow.com/q/21043873
tags question: http://stackoverflow.com/q/21037735
tags question: http://stackoverflow.com/q/21157483
tags question: http://stackoverflow.com/q/21133134
tags question: http://stackoverflow.com/q/21060856
tags question: http://stackoverflow.com/q/21082850
tags question: http://stackoverflow.com/q/21177062
tags question: http://stackoverflow.com/q/21055641
tags question: http://stackoverflow.com/q/21088383
tags question: http://stackoverflow.com/q/21116658
tags question: http://stackoverflow.com/q/21093416
tags question: http://stackoverflow.com/q/21067484
tags question: http://stackoverflow.com/q/21132508
tags question: http://stackoverflow.com/q/21115206
tags question: http://stackoverflow.com/q/21080519
tags question: http://stackoverflow.com/q/21028447
tags question: http://stackoverflow.com/q/21065121
tags question: http://stackoverflow.com/q/21182660
tags question: http://stackoverflow.com/q/21178983
tags question: http://stackoverflow.com/q/21033852
tags question: http://stackoverflow.com/q/21137208
tags question: http://stackoverflow.com/q/21163176
tags question: http://stackoverflow.com/q/21060130
tags question: http://stackoverflow.com/q/21175861
tags question: http://stackoverflow.com/q/21029595
tags question: http://stackoverflow.com/q/21137184
tags question: http://stackoverflow.com/q/21114354
tags question: http://stackoverflow.com/q/21145409
tags question: http://stackoverflow.com/q/21121294
tags question: http://stackoverflow.com/q/21105432
tags question: http://stackoverflow.com/q/21125892
tags question: http://stackoverflow.com/q/21155094
tags question: http://stackoverflow.com/q/21164605
tags question: http://stackoverflow.com/q/21068291
tags question: http://stackoverflow.com/q/21062057
tags question: http://stackoverflow.com/q/21111779
tags question: http://stackoverflow.com/q/21084065
tags question: http://stackoverflow.com/q/21109586
tags question: http://stackoverflow.com/q/21080598
tags question: http://stackoverflow.com/q/21088976
tags question: http://stackoverflow.com/q/21103958
tags question: http://stackoverflow.com/q/21108301
tags question: http://stackoverflow.com/q/21037514
tags question: http://stackoverflow.com/q/21127606
tags question: http://stackoverflow.com/q/21133270
tags question: http://stackoverflow.com/q/21055204
tags question: http://stackoverflow.com/q/21116799
tags question: http://stackoverflow.com/q/21097065
tags question: http://stackoverflow.com/q/21137561
tags question: http://stackoverflow.com/q/21157919
tag name: servlets
tags question: http://stackoverflow.com/q/21084755
tags question: http://stackoverflow.com/q/21060759
tags question: http://stackoverflow.com/q/21183002
tags question: http://stackoverflow.com/q/21156481
tags question: http://stackoverflow.com/q/21151068
tags question: http://stackoverflow.com/q/21058511
tags question: http://stackoverflow.com/q/21061283
tags question: http://stackoverflow.com/q/21130950
type: Tag
tags question: http://stackoverflow.com/q/21054013
tags question: http://stackoverflow.com/q/21051991
tags question: http://stackoverflow.com/q/21160697
tags question: http://stackoverflow.com/q/21047448
tags question: http://stackoverflow.com/q/21050295
tags question: http://stackoverflow.com/q/21071666
tags question: http://stackoverflow.com/q/21154938
tags question: http://stackoverflow.com/q/21176883
tags question: http://stackoverflow.com/q/21034674
tags question: http://stackoverflow.com/q/21078626
tags question: http://stackoverflow.com/q/21019136
tags question: http://stackoverflow.com/q/21128415

http://stackoverflow.com/comment/32102313
comment on: http://stackoverflow.com/q/21163223
type: QuestionComment
type: Comment
score: 0
has text: @MichałZiober, it meant that emails of my domain were managed by other server (not Google). It probably was the problem, because when I made test app that invited my other group to calendar, I got an invitation to add it in my personal gmail inbox. So I hope it will work in the future.

http://stackoverflow.com/a/21077215
has body: Note that the exception is thrown during a call of the static initializer (&lt;clinit&gt;) of cglib's Enhancer class. Cglib uses ASM internally and it seems as if you have mismatching versions of cglib and ASM on your classpath. From the error, I assmue that Intuit is using cglib 2.2 which relies on ASM 3.1. In this version, the ClassWriter did not declare its methods as final. This changed in ASM 4 such that cglib cannot be loaded because it overrides these now final methods. What you could do is either Remove ASM 4 from the class path but add ASM 3. See the POM for the fact that cglib 2.2.2 requires ASM 3.1.1. Explictly add cglib 3.1 to the class path which works with ASM 4. This might however break the application using cglib. Usually, libraries using ASM should pack the latter under a different package to avoid zhis problem as documented in ASM's FAQ. It seems as if the authors of Intuit missed that. Finally, note it mentions here that cglib 2.2 is only partially supported by GAE.
answers question: http://stackoverflow.com/q/21059019
downvote count: 0
has comment: http://stackoverflow.com/comment/31705591
score: 5
has comment: http://stackoverflow.com/comment/31705538
type: AcceptedAnswer
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/21059019

http://stackoverflow.com/comment/31691592
has text: no need to reproduce the incorrect manual sizing/locating, is there :-)
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/21072516
type: Comment

http://stackoverflow.com/q/21120813
upvote count: 2
tagged with: swing
answer count: 1
tagged with: java
has body: I am using NetBeans to create a SWING application which should be able to display a graph. In a demo app I was able to display the generated JUNG graph on a JFrame with the following code: UndirectedGraph t = GraphML.CreateGraph("treeAttribute.graphml"); VisualizationViewer&lt;Node, Edge&gt; vv = new VisualizationViewer&lt;Node, Edge&gt;((new FRLayout&lt;Node, Edge&gt;(t))); vv.getRenderContext().setVertexFillPaintTransformer(new VertexPainter()); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller&lt;Node&gt;()); vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller&lt;Edge&gt;()); final JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(vv); frame.pack(); frame.setVisible(true); Now I want to make use of the Palette and the design mode so I have created a JFrame and I have inserted a JPanel into it. I want my graph to be displayed inside the JPanel so I have inserted the code for the graph into the initComponents() method. The code looks like the following: public class Main extends javax.swing.JFrame { public Main() throws ParserConfigurationException, SAXException, IOException { initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 634, Short.MAX_VALUE) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 298, Short.MAX_VALUE) ); jLabel1.setText("Graph A"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getCo…
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: netbeans-7
favorite count: 0
has title: Jung Graph doesn't get displayed on Jpanel
type: Question
tagged with: jung
has answer: http://stackoverflow.com/a/23317808

http://stackoverflow.com/comment/31893084
comment on: http://stackoverflow.com/q/21170418
has text: Hi @VasilLukach, I suppose listener will fire only after upload completes, right? If so, there is a way to check file size before upload (for better user experience)?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31747531
has text: Like any other `static` method `MainFrameCreateMenuCreateNewProject.createNewProjectPath(userPath);`
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21072492
type: AnswerComment

http://stackoverflow.com/a/21050311
downvote count: 0
has body: You're treating your Map like an array. That's not how Maps work. Use the Map.get(key) function instead. For more info, check out the tutorial, which is the first result for googling "java maps".
upvote count: 2
answers question: http://stackoverflow.com/q/21050294
type: Answer
score: 2

http://stackoverflow.com/comment/32020508
has text: Seeing how the bounty still has some days to go, I'm leaving this open for discussion a little while longer. I believe however that your answer has given me all the material needed to make a final decision. Initially we'll try using DI and see what Java EE offers in terms of providing alternatives for default EJB implementations. I might make a follow-up question to ask whether overriding behaviour and extension points should be in facades using standard EJBs, or in the EJBs themselves. But that's another matter. Thank you very much for your great effort!
type: Comment
comment on: http://stackoverflow.com/a/21211612
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31641391
type: Comment
type: QuestionComment
has text: PEP 8 is a style guide for Python code. Python as in the language implemented by Jython among many others. What does C API compatibility have to do with this?
score: 4
comment on: http://stackoverflow.com/q/21045893

http://stackoverflow.com/q/21040871
has comment: http://stackoverflow.com/comment/31633078
accepted answer: http://stackoverflow.com/a/21041721
linked to: http://stackoverflow.com/q/10872112
has body: How to use formula like sum, avg, max and min while generating XLS file using Java. I am using jxl.write.*, i have see so many example for apache-poi. Is it possible to do the same using jxl? Label label; WritableWorkbook workbook = Workbook.createWorkbook(file, wbSettings); WorkbookSettings wbSettings = new WorkbookSettings(); wbSettings.setLocale(new Locale("en", "EN")); workbook.createSheet("Report", 0); WritableSheet excelSheet = workbook.getSheet(0); label = new Label(column, row, "sample"); Number number = new Number(column, row, 60); excelSheet.addCell(label); excelSheet.addCell(number);
tagged with: http://stackoverflow.com/tag/xls
has answer: http://stackoverflow.com/a/21041721
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31632609
has title: Using XLS Formulas (Sum, avg ...) using Java
type: Question
has comment: http://stackoverflow.com/comment/31632632
tagged with: jxl
has comment: http://stackoverflow.com/comment/31633028
linked to: http://stackoverflow.com/q/4490216
score: 0
answer count: 1

http://stackoverflow.com/comment/31692050
comment on: http://stackoverflow.com/a/21073108
score: 0
type: AnswerComment
has text: even when the JRE is correctly set this error might occurs (mistake in the code), that was my point
type: Comment

http://stackoverflow.com/comment/31913168
score: 0
type: AnswerComment
has text: 'B\u00e5t' result is same: Charset is: UTF-8 Bï¿½t Charset is: ISO-8859-1 B†t Charset is: windows-1252 B†t
comment on: http://stackoverflow.com/a/21147115
type: Comment

http://stackoverflow.com/comment/31883588
type: QuestionComment
score: 1
has text: Then why not just use `Map<String, Object>`? or `Map<Object, String>`? I'm not sure what you are storing in your map.
comment on: http://stackoverflow.com/q/21177722
type: Comment

http://stackoverflow.com/q/21132865
has body: I've looked through every entry related to Java reflection I can find and none seem to address the situation I'm dealing with. I have a class A with a static nested class in it, B. Class A also has as one of its fields, an array of type B, called bArray. I need to access this field from outside the class as well as the private members of the elements of bArray. I have been able to get the static nested class using getDeclaredClasses and I would normally get the private field bArray with getDeclaredFields and setAccessible but I can't seem to put it all together to be able to iterate through bArray from outside the class. Here is an example class structure that I'm working with. public class A { private A.B[] bArray = new A.B[16]; private static class B { private int theX; private int theY; B(int x, int y) { this.theX = x; this.theY = y; } // More methods of A.B not included } } I ultimately need to get at bArray and its fields theX and theY from outside of class A. I cannot use the names of the classes like Class.forName("classname") because the code all gets run through an obfuscator and the names all change except the ones in strings of course. I can use the field order (index) but not the name due to obfuscation. I've managed to pick out all of the fields, methods and whatnot that I need except this private static nested array field. This is the direction I've tried. The first 3 lines of this seem to do what I want but the 4th says ABArray cannot be resolved: A myA = new A(); Class AB = stealNamedInnerClass(A.class); Class ABArray = Array.newInstance(AB, 0).getClass(); ABArray myABArray = (ABArray)stealAndGetField(myA, ABArray); These are the utility functions I'm referencing: public static Field stealField(Class typeOfClass, Class typeOfField) { Field[] fields = typeOfClass.getDeclaredFields(); for (Field f : fields) { if (f.getType().equals(typeOfField)) { try { f.setAccessible(true); return f; } catch (Exception e) { break; // Throw the Exception } } } throw n…
type: AnsweredQuestion
tagged with: reflection
tagged with: java
accepted answer: http://stackoverflow.com/a/21133563
type: Question
answer count: 2
upvote count: 1
has title: Using Java reflection, can I access a private field of type private static nested class?
tagged with: minecraft
has comment: http://stackoverflow.com/comment/31922445
has answer: http://stackoverflow.com/a/21133563
possible better answer: http://stackoverflow.com/a/21199121
score: 0
has comment: http://stackoverflow.com/comment/31801856
has comment: http://stackoverflow.com/comment/31802003
downvote count: 1
has answer: http://stackoverflow.com/a/21199121
favorite count: 0

http://stackoverflow.com/a/21159393
upvote count: 17
has body: So, my final snippet looks like this: Document doc = new Document(PageSize.A4, 0f, 0f, 0f, 0f); float fntSize, lineSpacing; fntSize = 6.7f; lineSpacing = 10f; Paragraph p = new Paragraph(new Phrase(lineSpacing,line, FontFactory.getFont(FontFactory.COURIER, fntSize))); doc.add(p); It gives a perfect format for an A4 size paper with no margins and a good font size. I hope it helps someone!
score: 17
accepted answer of: http://stackoverflow.com/q/21154578
answers question: http://stackoverflow.com/q/21154578
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/21095025
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21147242
type: UnansweredQuestion
has body: I'm having trouble setting a dynamic background for my widget: My preferences return a color selected by the user and I would like to apply it to the widget but with a gradient effect. So here's where I am at this moment: My widget.xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/widget_layout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/style_widget" &gt; ... My Service.java: public void onStart(Intent intent, int startId) { super.onStart(intent, startId); remoteViews = new RemoteViews(this.getPackageName(), R.layout.widget); this.prefs = PreferenceManager.getDefaultSharedPreferences(this); //this is where I get the color preference value, and create another with some transparency int color1 = prefs.getInt("background_color", 00000000); int color2 = Color.argb(22, Color.red(color1), Color.green(color1), Color.blue(color1)); int colors[] = { color1, color2 }; //Create the GradientDrawable: GradientDrawable gradientDrawable = new GradientDrawable( GradientDrawable.Orientation.TOP_BOTTOM, colors); If I do : remoteViews.setInt(R.id.widget_layout, "setBackgroundColor", color1); I get the background color changed, but since gradientDrawable isn't an int, how do I apply it to my background via remoteViews?
tagged with: android
has title: Dynamic GradientDrawable in RemoteView
score: 3
downvote count: 0
tagged with: java
type: Question
upvote count: 3

http://stackoverflow.com/comment/31761801
comment on: http://stackoverflow.com/a/21108596
type: Comment
type: AnswerComment
score: 0
has text: I am using web start to launch jar file from tomcat.

http://stackoverflow.com/comment/40414961
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21052234
has text: Take a look at my response in [this other thread][1] [1]: http://stackoverflow.com/questions/18523508/clientid-not-updated-when-deploying-user-injected-null

http://stackoverflow.com/comment/41314959
comment on: http://stackoverflow.com/a/24077997
type: AnswerComment
has text: Also important: do not sourround the path in quotes "C:/Pro...". That might be obvious for some, but unfortunately not for me.
type: Comment
score: 2

http://stackoverflow.com/q/21040244
tagged with: resolver
score: 0
has comment: http://stackoverflow.com/comment/31644034
answer count: 0
type: UnansweredQuestion
has body: I'm using custom argument resolvers with spring 3.2.4 and everything works fine until now. every now and then I notice that one of my servers is not resolving arguments properly and I was wondering, is there anything I'm doing wrong in the configuration. Couple of things to mentions - I something use several custom arguments in a method e.g @RequestMapping(value = "/edit", method = RequestMethod.GET) public String editMode(@LoggedInUser User user, @UserCompany Company company) throws IOException and the arguments that are not being resolved are always not the first argument.. any chance I'm missing something in terms of ordering? priority to resolvers? -- EDIT My argument resolver is public class MyHRCompanyResolver implements WebArgumentResolver { @Inject private CompanyService companyService; public Object resolveArgument(MethodParameter methodParameter, NativeWebRequest nativeWebRequest) throws Exception { MyHRCompany myHRCompany = methodParameter.getParameterAnnotation(MyHRCompany.class); if (myHRCompany == null){ return UNRESOLVED; } try { Company company = companyService.userCompany(getUser()); if (company == null) return UNRESOLVED; return company; } catch (Exception e) { // log some error return UNRESOLVED; } } }
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/31690837
tagged with: java
has title: Spring WebArgumentResolver not resolving?
type: Question

http://stackoverflow.com/comment/31765327
has text: @Andrew Thompson each of edited question, every day, too hard to be clean-up squad here
comment on: http://stackoverflow.com/a/21112630
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31694651
type: Comment
has text: Reverse the logic in your if. Change it to `if(number>0)`. Also, do handle the case of `factorial(0) = 1`.
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21074601

http://stackoverflow.com/comment/31677538
comment on: http://stackoverflow.com/q/21065092
has text: What's wrong with just inserting a blank line manually? That's what everyone else is doing, I assume (certainly what I do). Eclipse certainly won't rip it out once it's there...
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21070981
tagged with: clock
has answer: http://stackoverflow.com/a/21071213
type: UnansweredQuestion
has title: Why does my clock not work perfectly?
tagged with: turtle-graphics
tagged with: java
type: Question
has body: I am currently working on a clock in java using the StandardPen class. Everything seems to work right except for when i reach about 6-10 minutes while running the program, the clock starts glitching out. The error seems to have come along right after I added the hour hand. The reason the hour hand is code different from the second and minute hand is because of the thread.sleep(20) not being able to work with the hour hand's speed. Somebody please help me fix this fast please import java.awt.Color; import TurtleGraphics.StandardPen; public class Clock_Final { public static void main(String[] args) { StandardPen pen = new StandardPen(); double num=90, num1 = 90, num3 = 90, loop = 1, minute = 90, minuteclear = 90, cont = 0, cont2 = 0, tick1 = 90, hour = 90, hourclear = 90, hourcount = 0, hourcount1 = 0; String three = "3", six = "6", nine = "9", twelve = "12", signature = "Created by: Me"; pen.setColor(Color.black); pen.up(); pen.setDirection(270); pen.move(350); pen.setDirection(180); pen.move(60); pen.drawString(signature); pen.down(); pen.home(); //twelve pen.setColor(Color.black); pen.up(); pen.setDirection(90); pen.move(280); pen.setDirection(180); pen.move(7); pen.down(); pen.drawString(twelve); pen.home(); //three pen.up(); pen.setDirection(0); pen.move(278); pen.setDirection(270); pen.move(5); pen.down(); pen.drawString(three); pen.home(); //six pen.up(); pen.setDirection(270); pen.move(290); pen.setDirection(180); pen.move(3); pen.down(); pen.drawString(six); pen.home(); //nine pen.up(); pen.setDirection(180); pen.move(285); pen.setDirection(270); pen.move(5); pen.down(); pen.drawString(nine); pen.home(); //_-_-_outside of the clock (the circle) for (cont = 0; cont &lt; 360; cont++) { pen.setColor(Color.black); pen.setDirection(num); pen.setWidth(8); pen.up(); pen.move(270); pen.down(); pen.move(2); pen.home(); num--; if (num==0) { num = 360; } } //tick start for (cont2=0;cont2&lt;60;cont2++) { pen.setColor(Color.gray); pen.setDirection(tick1); pen.setWidth(3)…
score: 0
answer count: 1

http://stackoverflow.com/comment/31782244
score: 0
type: Comment
has text: Your symbolMatcher string resolves to this `[[^'][\\(\\);\\{\\}\\[\\]:\\+\\-\\<\\>/\\*=&%\\|\\^@#$~][^']]` when plugged into 'useDelimeter'. Its a single composite Java class, with much bad stuff. Can't determine the intent from that. If you could expand the explanation at the top, you might get some solutions. I have no idea what the answer you've chosen does, or how it helps ...
type: QuestionComment
comment on: http://stackoverflow.com/q/21121213

http://stackoverflow.com/a/21125764
has comment: http://stackoverflow.com/comment/31789423
has comment: http://stackoverflow.com/comment/42564423
has body: Try the following: Field[] fieldArray = Color.class.getDeclaredFields(); for (Field field : fieldArray ) { if (java.lang.reflect.Modifier.isStatic(field.getModifiers())) { System.out.println(field); } } You will also need to import: import java.lang.reflect.Field; import java.awt.Color; Running it, it outputs lengthly strings; however, you could easily just parse the end bit off them. They look like: public static final java.awt.Color java.awt.Color.WHITE
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31789808
has comment: http://stackoverflow.com/comment/31789400
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21125418

http://stackoverflow.com/comment/31837862
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21152187
has text: Elliot, i want to run rsync over ssh. in my mind, i want to run rsync through cmd and put rsync command to copy my private key file to remote server.
score: 0

http://stackoverflow.com/q/21039362
has answer: http://stackoverflow.com/a/21039732
favorite count: 0
has title: How to determine which method is generating the most garbage
tagged with: heap-memory
upvote count: 2
answer count: 5
has answer: http://stackoverflow.com/a/21091190
type: UnansweredQuestion
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/31630245
has comment: http://stackoverflow.com/comment/31630146
score: 2
has comment: http://stackoverflow.com/comment/31630874
has comment: http://stackoverflow.com/comment/31630948
has body: I have three objects: ClassA classA = new ClassA(); ClassA classB = new ClassA(); ClassA classC = new ClassA(); Each of these objects has a public void called run which does something and is called in the following way: classA.run(); classB.run(); classC.run(); Within each loop iteration, a particular amount of garbage is generated by each run call. How do I accurately determine the amount of generated garbage by each run?
tagged with: java
tagged with: memory
type: Question
has comment: http://stackoverflow.com/comment/31631333
has answer: http://stackoverflow.com/a/21039481
has comment: http://stackoverflow.com/comment/31632450
tagged with: benchmarking
has answer: http://stackoverflow.com/a/21055763
downvote count: 0
has answer: http://stackoverflow.com/a/21072596

http://stackoverflow.com/comment/31873393
comment on: http://stackoverflow.com/q/21167348
has text: @vikingsteve see my Edit 1. That is not what I am looking for. Thanks for the input though :-)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21064907
has answer: http://stackoverflow.com/a/21070819
tagged with: libgdx
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21070819
tagged with: opengl-es
type: Question
has body: I have a mesh generated from data in Renderables. Environment is set. Material is a simple new Material(). ... /*init renderable*/ /*set mesh parameters*/ renderable.mesh = new Mesh(false, (int)(meshVertexArray.length/SurfaceBuilder.__ELEMENTSPERVERTEX__), /*!vertices, not cordinates*/ meshIndexArray.length, new VertexAttribute(Usage.Position,3,"a_position"), new VertexAttribute(Usage.Normal,3,"a_normal"), new VertexAttribute(Usage.TextureCoordinates,2,"a_texCoords"), new VertexAttribute(Usage.ColorPacked,4, "a_color") ); ... /*set vertices*/ The mesh is generated properly, but I can't see the textures, only the gray (shaded) triangles. I did try the rtfm method, but so far I saw no way to bind a texture, so it displays properly in libGDX, only with shaders, and I'm not using them (I'm catching up on them after this feature is implemented). Is there a way in libGDX to bind textures to a mesh without shaders?
answer count: 1
has title: Bind texture to mesh in libGDX?
score: 0
tagged with: java

http://stackoverflow.com/comment/31867706
type: Comment
comment on: http://stackoverflow.com/q/21161319
type: QuestionComment
score: 0
has text: @aquaraga Thank you for your response. I have added more details for the ease of understanding of my problem :)

http://stackoverflow.com/comment/31800778
score: 0
comment on: http://stackoverflow.com/a/21132108
type: Comment
has text: I would argue that long method should be broken up so they are simple enough that you don't need `final` This is not always possible of course.
type: AnswerComment

http://stackoverflow.com/comment/31869283
type: QuestionComment
has text: Of course, but that doesn't mean they can't introduce mechanisms for readable tables and other markup.
comment on: http://stackoverflow.com/q/21169844
score: 0
type: Comment

http://stackoverflow.com/q/21082404
has body: I'm running tomcat 8-RC10 and (attempting) geoserver 2.4.3 deployed from .war. Geoserver won't start with the above error, and the catalina.out (which is so long and detailed as to be almost useless) seems to have trouble at the point: ERROR [context.ContextLoader] - context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'geoServerLoader' defined in URL [jar:file:/home/XXX/tomcat/webapps/geoserver/WEB-INF/lib/main-2.2.4.jar!/applicationContext.xml]: Cannot resolve reference to bean 'resourceLoader' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'resourceLoader' defined in URL [jar:file:/home/XXX/tomcat/webapps/geoserver/WEB-INF/lib/main-2.2.4.jar!/applicationContext.xml]: initialization of bean failed; nested exception is java.lang.IllegalArgumentException: The resource path [WEB-INF] is not valid. Appreciate any suggestions, I'm quite clearly in over my head here.
favorite count: 0
has title: Geoserver on Tomcat - FAIL - Application at context path /geoserver could not be started. [WEB-INF] is not Valid
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/31710594
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21175623
tagged with: geoserver
possible better answer: http://stackoverflow.com/a/21082844
type: Question
has comment: http://stackoverflow.com/comment/31709848
answer count: 2
has answer: http://stackoverflow.com/a/21082844
accepted answer: http://stackoverflow.com/a/21175623
downvote count: 0
tagged with: tomcat

http://stackoverflow.com/comment/31713685
has text: Are you saying that an expression like `${someVar}` shows up as `null` in the rendered HTML?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21084634

http://stackoverflow.com/comment/31654008
type: QuestionComment
has text: @HighCore The same can be said about Java WebStart, although I believe it has some aspect of policy such that an app can only do things that are granted to the app through the given policy.
comment on: http://stackoverflow.com/q/21052384
score: 0
type: Comment

http://stackoverflow.com/q/21069433
has comment: http://stackoverflow.com/comment/31685953
has comment: http://stackoverflow.com/comment/31685779
score: 0
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31686154
has answer: http://stackoverflow.com/a/21069620
has comment: http://stackoverflow.com/comment/31685804
has comment: http://stackoverflow.com/comment/31685755
has comment: http://stackoverflow.com/comment/31686002
has comment: http://stackoverflow.com/comment/31685972
answer count: 1
tagged with: arrays
has body: I am making a "Code Decoder" - So there are 3 lines, the first is the reference string, the second is jumbled, and then the third is calculated based on matching the first and second strings. Example: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG UIFARVJDLACSPXOAGPYAKVNQTAPWFSAUIFAMB ZAEPH XFABSFAWFSZACBEAQFPQMFAEPJOHAWFSZACBEAUIJOHTAIBAIB What I'm doing is getting the 3 strings, converting them to char arrays, then looking through the first string, finding where it is in the array of the alphabet, then at that position I enter the letter from the second string on another array at the same place. Therefore, later, I can find a letter in the alphabet and get its corresponding letter in the second array. Problem - nothing is inputting into the second array... It comes up empty. Let me know if any clarification is needed. BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter First String:"); // First String String first_string = br.readLine(); System.out.print("Enter Second String:"); // Second String String second_string = br.readLine(); System.out.print("Enter Third String:"); // Third String String third_string = br.readLine(); char[] first = first_string.toCharArray(); char[] second = second_string.toCharArray(); char[] third = third_string.toCharArray(); char[] compare_a = {'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'}; //length = 26 char[] compare_b = new char[26]; //length = 26 for(int x =0; x &lt; first.length ; x++){// going through first array char first_letter = first[x]; // gets letter from first string for(int z = 0; z &lt; 26; z++){ // looks through alphabet for the position of the letter if(first_letter == compare_a[z]){ // if the letter is found at a certain position // System.out.println(first_letter + " = " + compare_a[z] + " " + compare_b[z] + " " + second[x]); compare_b[z] = second[x]; // insert into the same position on the second array } } } for(in…
has title: Java For loops and char arrays
accepted answer: http://stackoverflow.com/a/21069620
has comment: http://stackoverflow.com/comment/31685828
has comment: http://stackoverflow.com/comment/31685800

http://stackoverflow.com/a/21067535
type: Answer
answers question: http://stackoverflow.com/q/21067473
score: 0
has body: The pseudocode from Wikipedia includes a check to ensure that you don't divide by zero. For completeness, here is a copy: for k = 1 ... m: Find pivot for column k: i_max := argmax (i = k ... m, abs(A[i, k])) if A[i_max, k] = 0 error "Matrix is singular!" swap rows(k, i_max) Do for all rows below pivot: for i = k + 1 ... m: Do for all remaining elements in current row: for j = k ... n: A[i, j] := A[i, j] - A[k, j] * (A[i, k] / A[k, k]) Fill lower triangular matrix with zeros: A[i, k] := 0

http://stackoverflow.com/a/21139670
has body: Here is a way to do it, try it. In this example the file is C:/user.txt and i change the value of George by 1234 public class George { private static List&lt;String&gt; lines; public static void main (String [] args) throws IOException{ File f = new File("C:/user.txt"); lines = Files.readAllLines(f.toPath(),Charset.defaultCharset()); changeValueOf("Georges", 1234); // the name and the value you want to modify Files.write(f.toPath(), changeValueOf("George", 1234), Charset.defaultCharset()); } private static List&lt;String&gt; changeValueOf(String username, int newVal){ List&lt;String&gt; newLines = new ArrayList&lt;String&gt;(); for(String line: lines){ if(line.contains(username)){ String [] vals = line.split(": "); newLines.add(vals[0]+": "+String.valueOf(newVal)); }else{ newLines.add(line); } } return newLines; } } This is a working solution, but i think there is some other way more efficient.
score: 4
type: Answer
answers question: http://stackoverflow.com/q/21138971
accepted answer of: http://stackoverflow.com/q/21138971
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21101379
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31745284
tagged with: java
has comment: http://stackoverflow.com/comment/31745034
type: Question
tagged with: c#
accepted answer: http://stackoverflow.com/a/21101403
score: 0
answer count: 2
has title: Pass binary file or byte[] from c# to java
has comment: http://stackoverflow.com/comment/31745016
upvote count: 1
possible better answer: http://stackoverflow.com/a/21101627
downvote count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/31745059
tagged with: .net
has answer: http://stackoverflow.com/a/21101403
has answer: http://stackoverflow.com/a/21101627
favorite count: 0
tagged with: multiplatform
has body: I have a .net application in c# which receives a byte array and I need to send it to a Java Program as an argument, which is the best way to do it? NOTE: Its all in the same server.
has comment: http://stackoverflow.com/comment/31745099

http://stackoverflow.com/a/21063267
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21063246
type: Answer
accepted answer of: http://stackoverflow.com/q/21063246
score: 5
upvote count: 5
downvote count: 0
has body: You need to initialise the JLabel jlab. Something like the following should do. JLabel jlab = new JLabel();

http://stackoverflow.com/comment/31675165
type: QuestionComment
has text: Sql doesn't matter in terms of threading. You have a service which gets some data from some resource and will take some time. Swap sql for a web service, MSMQ, email response, a printer, an extensive computation routine, makes no difference to the client end. You make a request, you wait for a response. If you make multiple requests, then they need some sort of ID, so you can match a response to it's request. The DBMS already manages multiple requests, well assuming you are using say SQL Server instead of say Access.
comment on: http://stackoverflow.com/q/21062576
score: 0
type: Comment

http://stackoverflow.com/q/21147496
has title: Read content from file and send email
has answer: http://stackoverflow.com/a/21147827
has answer: http://stackoverflow.com/a/21147925
upvote count: 2
answer count: 3
downvote count: 1
favorite count: 0
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/21147731
type: UnansweredQuestion
score: 1
tagged with: java
type: Question
has body: I have trouble in reading content from a file and send it as the body of an email in java. However, if i run the code to send email without reading content from file, it sends the email successfully, but gives problem while reading content from file for body. It would be great if you can help me below is code which I am using Thanks in advance! package com.example.tests; import java.io.BufferedReader; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.InputStreamReader; import java.util.*; import javax.mail.*; import javax.mail.internet.*; public class sendEmail { private static String USER_NAME = "zxxzz@gmail.com"; // GMail user name (just the part before "@gmail.com") private static String PASSWORD = "xxxxxxx"; // GMail password private static String RECIPIENT = "zxxzz@gmail.com"; static String strLine = null; public static void main(String[] args) { String from = USER_NAME; String pass = PASSWORD; String[] to = { RECIPIENT }; // list of recipient email addresses String subject = "Java send mail example"; String body = strLine; readfile(); sendFromGMail(from, pass, to, subject, body); } private static void sendFromGMail(String from, String pass, String[] to, String subject, String body) { Properties props = System.getProperties(); String host = "smtp.gmail.com"; props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", host); props.put("mail.smtp.user", from); props.put("mail.smtp.password", pass); props.put("mail.smtp.port", "587"); props.put("mail.smtp.auth", "true"); Session session = Session.getDefaultInstance(props); MimeMessage message = new MimeMessage(session); try { message.setFrom(new InternetAddress(from)); InternetAddress[] toAddress = new InternetAddress[to.length]; // To get the array of addresses for( int i = 0; i &lt; to.length; i++ ) { toAddress[i] = new InternetAddress(to[i]); } for( int i = 0; i &lt; toAddress.length; i++) { message.addRecipient(Message.RecipientType.TO, toAddress[i]); } message.setS…

http://stackoverflow.com/q/21075552
has comment: http://stackoverflow.com/comment/31696720
tagged with: awt
has title: Detect mouse hover on Graphics2D string
tagged with: user-interface
tagged with: string
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: swing
has body: Is there any way to set color of a Graphics 2D string when the mouse hover on it? Here is my relevant code so far: @Override public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; g2d.setColor(Color.white); g2d.setFont(new Font("Arial", Font.BOLD, 16)); g2d.drawString("EXIT", 650, 50); } MouseListener ml=new MouseListener() { @Override public void mouseClicked(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { //hover //should do something here... } @Override public void mouseExited(MouseEvent e) { } };
has comment: http://stackoverflow.com/comment/31696670
score: 2
has comment: http://stackoverflow.com/comment/31696567
has answer: http://stackoverflow.com/a/21075951
tagged with: java
type: Question
answer count: 1
downvote count: 0

http://stackoverflow.com/q/21021366
has comment: http://stackoverflow.com/comment/31823949
has comment: http://stackoverflow.com/comment/31598417
score: 2
has comment: http://stackoverflow.com/comment/31676251
downvote count: 0
has title: My java launcher crashes when display SplashScreen with JDK7 on MacOSX
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31598081
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/31823885
upvote count: 2
has answer: http://stackoverflow.com/a/21065904
answer count: 1
tagged with: awt
favorite count: 0
has comment: http://stackoverflow.com/comment/31675655
has body: I'm writing a java launcher using JNI on MacOSX, to display a SplashScreen and AWT window. I have almost finished the program, that it runs with JDK6 successfully, but it will crash with JDK7 if SplashScreen shown. The whole program is: #include &lt;dlfcn.h&gt; #include &lt;jni.h&gt; #include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;pthread.h&gt; #include &lt;CoreServices/CoreServices.h&gt; typedef jint (JNICALL * FARPROC_JNI_CreateJavaVM)(JavaVM **pvm, void **penv, void *args); int JavaMain(); void ShowSplashWindow(); #define USEJDK6 0 int main() { ShowSplashWindow(); // start java in a new thread pthread_attr_t thread_attr; pthread_attr_init(&amp;thread_attr); pthread_attr_setscope(&amp;thread_attr, PTHREAD_SCOPE_SYSTEM); pthread_attr_setdetachstate(&amp;thread_attr, PTHREAD_CREATE_JOINABLE); pthread_t vmthread; pthread_create(&amp;vmthread, &amp;thread_attr, (void *(*)(void*))JavaMain, NULL); // start run loop CFRunLoopSourceContext sourceContext = { .version = 0, .info = NULL, .retain = NULL, .release = NULL, .copyDescription = NULL, .equal = NULL, .hash = NULL, .schedule = NULL, .cancel = NULL, .perform = NULL }; CFRunLoopSourceRef sourceRef = CFRunLoopSourceCreate(NULL, 0, &amp;sourceContext); CFRunLoopAddSource(CFRunLoopGetCurrent(), sourceRef, kCFRunLoopCommonModes); CFRunLoopRun(); CFRelease(sourceRef); } // the old main to run java int JavaMain() { #if USEJDK6 // load JDK with MacOSX void * handle = dlopen("/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries/libserver.dylib", RTLD_LAZY); #else // --- or SUN JDK 1.7 --- void * handle = dlopen("/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/server/libjvm.dylib", RTLD_LAZY); #endif // get JNI_CreateJavaVM FARPROC_JNI_CreateJavaVM FN_JNI_CreateJavaVM = (FARPROC_JNI_CreateJavaVM)dlsym(handle, "JNI_CreateJavaVM"); if(FN_JNI_CreateJavaVM == NULL) FN_JNI_CreateJavaVM = (FARPROC_JNI_CreateJavaVM)dlsym(handle, "JNI_CreateJavaVM_Impl"); // Start JVM JavaVMOptio…
tagged with: splash-screen
tagged with: macos

http://stackoverflow.com/a/36708122
has body: Most probably the issue happens because of the incompatability of 32 bit and 64 bit excecutables. Suppose if you have installed 32 bit Android Studio by mistake and you will be downloading a 64 bit JDK. In this case 32 bit Android Studio will not be able to pick up the 64 bit JDK. This was the issue I faced. So I followed the below simple steps to make it working, Downloaded 32 bit JDK(you can also download 64 bit Android Studio if you do not want to change the 64 bit JDK) Right click MyComputer > Advanced System Settings > under 'Advanced tab' > Environment variables > Under System Variables > Add JAVA_HOME as key and your jdk(eg:C:\Program Files (x86)\Java\jdk1.7.0_79) location as value. Save it and launch Android Studio. You are good to go now.
score: 0
answers question: http://stackoverflow.com/q/21119021
type: Answer

http://stackoverflow.com/comment/31700482
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21077695
has text: @barakmanos sample attached

http://stackoverflow.com/comment/54458864
comment on: http://stackoverflow.com/a/21225713
has text: this was done on client side, Android code @IgorGanapolsky
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21124023
tagged with: tablelayout
has body: So I have a TableLayout that I want to put inside a ScrollView. But I have a problem: The TableLayout is initially empty and I programmatically add TableRows to it by tapping a button. This works fine if I put the TableLayout into the ScrollView normally. But I want to put the TableLayout at the BOTTOM of the ScrollView. So every time I add a TableRow, the last cell will always be aligned to the bottom of the parent ScrollView. (kind of like how chat apps work - when you press send, your message is added at the bottom while all the other messages are pushed up). What happens is that if I use android:layout_gravity="bottom" to try to achieve this, I'm unable to see any of the rows that are pushed upwards out of the view of the screen (I can't scroll upwards). However, I'm able to scroll downwards for some reason into emptiness, which shouldn't be possible since the last TableRow should be at the bottom. Basically the problem is that I can scroll downwards where there are no TableRows but I can't scroll upwards where there are. This is the relevant XML code: <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:layout_gravity="bottom"> </RelativeLayout>
linked to: http://stackoverflow.com/q/3606530
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21124424
tagged with: scrollview
tagged with: android
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21124424
type: Question
has title: Putting a TableLayout inside a ScrollView?

http://stackoverflow.com/q/21131342
has comment: http://stackoverflow.com/comment/31799266
downvote count: 4
has answer: http://stackoverflow.com/a/21131382
accepted answer: http://stackoverflow.com/a/21131382
upvote count: 0
score: -4
has comment: http://stackoverflow.com/comment/31799200
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31799342
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31799322
has title: Java use only whole numbers
has body: I am writing a program to find all combinations of addition, subtractions, division, and multiplication of a string of numbers ... Problem is Java is outputting numbers that are "close" to the target. I.e. if the target is 20 ... when I have if(number == target){...} - numbers such as 23, 18, etc are accepted ... Also can you do a check with the Math library for whole numbers ? Code for checking if equals target: if(total1 == target){ System.out.println(a + " = " + total1); }
has comment: http://stackoverflow.com/comment/31799317

recursion
type: Tag
tags question: http://stackoverflow.com/q/21105347
tags question: http://stackoverflow.com/q/21115056
tags question: http://stackoverflow.com/q/21149968
tags question: http://stackoverflow.com/q/21125414
tags question: http://stackoverflow.com/q/21127752
tag name: recursion
tags question: http://stackoverflow.com/q/21078789
tags question: http://stackoverflow.com/q/21098401
tags question: http://stackoverflow.com/q/21110932
tags question: http://stackoverflow.com/q/21144598
tags question: http://stackoverflow.com/q/21102260
tags question: http://stackoverflow.com/q/21081297
tags question: http://stackoverflow.com/q/21129687
tags question: http://stackoverflow.com/q/21139768
tags question: http://stackoverflow.com/q/21128025
tags question: http://stackoverflow.com/q/21137953
tags question: http://stackoverflow.com/q/21144739
tags question: http://stackoverflow.com/q/21163204
tags question: http://stackoverflow.com/q/21171274
tags question: http://stackoverflow.com/q/21100551
tags question: http://stackoverflow.com/q/21037015
tags question: http://stackoverflow.com/q/21083810
tags question: http://stackoverflow.com/q/21080255

http://stackoverflow.com/a/21107463
accepted answer of: http://stackoverflow.com/q/21107433
has body: Try to write: java -jar client.jar %1 or java -jar client.jar %* Anyways, remove ""
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21107433
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/21135391
answer count: 3
has answer: http://stackoverflow.com/a/21135597
has comment: http://stackoverflow.com/comment/31807795
tagged with: android-asynctask
has body: I have a AsyncTask in which I want to test a condition every 3 seconds. When I call the Thread.sleep(int) method in it I get Can't create handler inside thread that has not called Looper.prepare() error. Below is my code: public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { new AsyncTask&lt;Void, Void, Void&gt;() { ProgressDialog progressDialog; @Override protected void onPreExecute() { progressDialog = ProgressDialog.show(getActivity(), null, "Loading Categories..."); super.onPreExecute(); } @Override protected Void doInBackground(Void... voids) { // TODO Auto-generated method stub while(mOnlinCouponCategoriesManager.isDownloading()) { try { Thread.sleep(3000); } catch(Exception e) { Log.e("Categories Section:", e.getMessage()); } } if(categoryAdapter == null) { categoryAdapter = new CategoryAdapter(getActivity(), R.layout.fragment_categorylist, mOnlineCategoriesCursor, new String[] {}, new int[] {}); setListAdapter(categoryAdapter); } else { setListAdapter(categoryAdapter); } return null; } }.execute(); View view = inflater.inflate(R.layout.custom_list, null); return view; } Here is my stack trace 01-15 16:23:38.233: E/AndroidRuntime(31508): FATAL EXCEPTION: AsyncTask #1 01-15 16:23:38.233: E/AndroidRuntime(31508): Process: in.coupondunia.androidapp, PID: 31508 01-15 16:23:38.233: E/AndroidRuntime(31508): java.lang.RuntimeException: An error occured while executing doInBackground() 01-15 16:23:38.233: E/AndroidRuntime(31508): at android.os.AsyncTask$3.done(AsyncTask.java:300) 01-15 16:23:38.233: E/AndroidRuntime(31508): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) 01-15 16:23:38.233: E/AndroidRuntime(31508): at java.util.concurrent.FutureTask.setException(FutureTask.java:222) 01-15 16:23:38.233: E/AndroidRuntime(31508): at java.util.concurrent.FutureTask.run(FutureTask.java:242) 01-15 16:23:38.233: E/AndroidRuntime(31508): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 01-…
has comment: http://stackoverflow.com/comment/31808464
has comment: http://stackoverflow.com/comment/31806150
tagged with: android
has answer: http://stackoverflow.com/a/21136550
accepted answer: http://stackoverflow.com/a/21136550
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31806708
tagged with: java
has comment: http://stackoverflow.com/comment/31807390
has answer: http://stackoverflow.com/a/21135483
type: Question
has comment: http://stackoverflow.com/comment/31807684
has comment: http://stackoverflow.com/comment/31806327
possible better answer: http://stackoverflow.com/a/21135483
has comment: http://stackoverflow.com/comment/31806105
has title: Android: How to make async task sleep , while evaluating some condition
score: 0

http://stackoverflow.com/q/21110926
has title: Put JLabels and JTextField in same frame as JTable
tagged with: jlabel
has answer: http://stackoverflow.com/a/21111042
tagged with: swing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21111239
tagged with: java
tagged with: jtextfield
type: Question
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/5621338
has answer: http://stackoverflow.com/a/21111239
possible better answer: http://stackoverflow.com/a/21111042
tagged with: layout-manager
has comment: http://stackoverflow.com/comment/31763661
has body: I am trying to put some text fields and labels underneath a JTable or a similar GridLayout. When I type data in the fields, I want to pass them on to the table. I now have text fields and labels within a panel, but want to add a table above. I tried using JPanel, JFrame, JTable. But I could not get them working together. What are the experiences with Swing/AWT imports, any suggestions about the best way to get this result?

http://stackoverflow.com/comment/31705957
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21080408
has text: I did and now it runs. How do I modify it so that the program reads a .txt file instead of asking for imput

http://stackoverflow.com/comment/50962899
score: 0
type: Comment
comment on: http://stackoverflow.com/a/31499614
has text: This is same as @Kons answer
type: AnswerComment

http://stackoverflow.com/comment/31756289
type: QuestionComment
comment on: http://stackoverflow.com/q/21107806
type: Comment
has text: Which line now causes the exception?
score: 0

http://stackoverflow.com/q/21149374
answer count: 4
has title: Do while loop changing variables in Java
has comment: http://stackoverflow.com/comment/31832608
score: 1
tagged with: java
has body: I've been trying to make a choose your adventure type of program, but I've run into a problem. I have the whole thing running in a do while loop, and each option is an element in an array is an element. I also have if statements in the do while that can change some elements depending on what the user has already done. Here's an example of what my code looks like: import java.util.Scanner; public class MainClass { public static void main(String[] args) { Scanner input; input=new Scanner(System.in); boolean run; boolean theBoo = false; run = true; int choice; choice = 0; do { String[] theArray; theArray = new String[2]; theArray[0] = "Hello"; if(theBoo){ theArray[1] = "Goodbye"; } else{ theArray[1] = "Hi"; theBoo = true; } System.out.println(theArray[choice]); choice = input.nextInt(); } while(run); } } For some reason though, it prints out "Goodbye" if you input 1, even though it should print "Hi", as theBoo is false. My question is: why is the do while loop changing the value of my variable, and how do I prevent it from doing so? Thanks! Edit: Btw, I am new here, so my apologies if I did something wrong. Edit2: First of all, thanks everyone for the quick answers. I made the changes you recommended, but its still doing the same thing. I updated the code to what it is with the changes.
has answer: http://stackoverflow.com/a/21149409
upvote count: 1
has answer: http://stackoverflow.com/a/21149462
type: Question
tagged with: do-while
tagged with: if-statement
has answer: http://stackoverflow.com/a/21149471
has answer: http://stackoverflow.com/a/21149418
has comment: http://stackoverflow.com/comment/31832566
downvote count: 0
has comment: http://stackoverflow.com/comment/31832492
has comment: http://stackoverflow.com/comment/31832586
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31832551

http://stackoverflow.com/comment/31727861
score: 1
comment on: http://stackoverflow.com/q/21092675
type: Comment
type: QuestionComment
has text: `FileNotFoundException` is a checked exception so needs to be explicitly thrown (or caught)

http://stackoverflow.com/comment/31669469
comment on: http://stackoverflow.com/a/21060802
score: 0
type: AnswerComment
has text: @Mayur wait for 5 minutes, I am busy with my work.i will help you as soon i complete my work
type: Comment

http://stackoverflow.com/comment/31764894
score: 0
type: Comment
type: QuestionComment
has text: @DeeMac sorry i am npot getting your point. So can you please describe the same you mentioned
comment on: http://stackoverflow.com/q/21112733

http://stackoverflow.com/comment/31617165
has text: 'Every user' can only do that if he has the JAR tool installed. Signing the JAR might be the answer.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21030762

http://stackoverflow.com/comment/31891110
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21181614
score: 0
has text: so can u please check my names are corect..

http://stackoverflow.com/q/21035586
type: Question
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/31623847
upvote count: 1
has comment: http://stackoverflow.com/comment/31623809
has comment: http://stackoverflow.com/comment/31623793
answer count: 1
has comment: http://stackoverflow.com/comment/31623803
has comment: http://stackoverflow.com/comment/31623783
tagged with: string
has answer: http://stackoverflow.com/a/21035611
favorite count: 0
has comment: http://stackoverflow.com/comment/31623855
has comment: http://stackoverflow.com/comment/31623821
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31623714
has comment: http://stackoverflow.com/comment/31623973
has comment: http://stackoverflow.com/comment/31623854
has title: String.equals("a string") || String.equalsIgnoreCase("a string")
has comment: http://stackoverflow.com/comment/31623887
has comment: http://stackoverflow.com/comment/31623796
has comment: http://stackoverflow.com/comment/31623678
has comment: http://stackoverflow.com/comment/31623911
downvote count: 3
has body: I have a function.. containsIgnoreCase(searchIn, seachFor) When you use the Java function equals or equalsIgnoreCase you send the searchIn String in front of the function. EXAMPLE 1: searchIn.equals(searchFor) I want to be able to do similar for my function. EXAMPLE 2: searchIn.containsIgnoreCase(searchFor); Q1: Is there a special name that the String at the beginning is called? Q2: Is there any way I can call my function with the String at the beginning?
has comment: http://stackoverflow.com/comment/31623697

http://stackoverflow.com/comment/31649482
type: Comment
has text: @ChrisJamesHancocks there is no reason to create a constructor of activity class. secondly i guess you are confused the way fragmetns and activity work. post your manifest file
type: QuestionComment
comment on: http://stackoverflow.com/q/21050106
score: 1

http://stackoverflow.com/comment/31805226
comment on: http://stackoverflow.com/q/21134488
score: 0
type: QuestionComment
type: Comment
has text: @MadPegrammer. i mentioned behind the window

request
tags question: http://stackoverflow.com/q/21136658
tags question: http://stackoverflow.com/q/21062586
tags question: http://stackoverflow.com/q/21091635
tag name: request
type: Tag

http://stackoverflow.com/comment/52867964
has text: i was trying to use newSingleThreadExecutor() to run threads in parallel. pretty foolish of me
score: 0
comment on: http://stackoverflow.com/q/21102759
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/70604864
score: 0
type: Comment
has text: Is there a way to do this on a per project basis?
comment on: http://stackoverflow.com/a/21161555
type: AnswerComment

http://stackoverflow.com/a/27882675
answers question: http://stackoverflow.com/q/21154400
has body: I found a quick solution to this problem - Start your JavaDB from the command line\terminal like so: &lt;base folder&gt;/db/bin/startNetworkServer -noSecurityManager Then it runs fine without adding new permissions.
type: Answer
score: 0

http://stackoverflow.com/comment/31732539
type: QuestionComment
has text: sorry guys I edited the code again because I copied the wrong error (I tried changing the value of length manually to see if anything changed, it didn't)
comment on: http://stackoverflow.com/q/21094816
score: 0
type: Comment

http://stackoverflow.com/a/36467101
has comment: http://stackoverflow.com/comment/91087217
upvote count: 19
score: 19
has body: This issue arises because of different reasons. It might encountered if you are using Spring boot built war file. As Spring boot web and rest starter projects jars do have embedded Tomcat in it, hence fails with "SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException". You can fix this by exclusion of the embedded tomcat at the time of packaging by using exclusions in case of maven. Maven dependency of "spring-boot-starter-web" will look like org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-tomcat
has comment: http://stackoverflow.com/comment/91088022
has comment: http://stackoverflow.com/comment/117919525
downvote count: 0
has comment: http://stackoverflow.com/comment/90728162
answers question: http://stackoverflow.com/q/21039049
type: Answer

http://stackoverflow.com/comment/31629166
type: Comment
has text: Like for example, There is an employee table with columns:- id,name, salary,address; once I have the id from employee table, i can access another table called "employee_detail" having columns:-designation,manager,team,department; So now, relating to my problem, my #firstTable is like "employee" table where i have GenID, which I need to access - #newTable like "employee_details" in above example, to get further details; and then populate it accordingly in a generated table. Please let me know If I am clear in explaining myself and the problem?
comment on: http://stackoverflow.com/a/21037775
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31697225
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21075934
type: Comment
has text: Thank you so much for your help, I tried that same thing!!Please help me thanks!!

http://stackoverflow.com/q/21036668
tagged with: java
has comment: http://stackoverflow.com/comment/31625815
has answer: http://stackoverflow.com/a/21036728
has answer: http://stackoverflow.com/a/21036842
accepted answer: http://stackoverflow.com/a/21036842
answer count: 2
has body: I am developing an application in which I have gridview but somehow my applicaion is not getting the proper path for images. I want to pick images from drawable folder in gridview. Emulator shows an error like "NAT directory path is not valid" Here is a code for AppConstant.java public class AppConstant { // Number of columns of Grid View public static final int NUM_OF_COLUMNS = 3; // Gridview image padding public static final int GRID_PADDING = 8; // in dp // SD card image directory public static final String PHOTO_ALBUM = "NAT"; // supported file formats public static final List&lt;String&gt; FILE_EXTN = Arrays.asList("jpg", "jpeg", "png"); } Here is a code for Utils.java public class Utils { private Context _context; // constructor public Utils(Context context) { this._context = context; } /* * Reading file paths from SDCard */ public ArrayList&lt;String&gt; getFilePaths() { ArrayList&lt;String&gt; filePaths = new ArrayList&lt;String&gt;(); File directory = new File( android.os.Environment.getExternalStorageDirectory() + File.separator + AppConstant.PHOTO_ALBUM); // check for directory if (directory.isDirectory()) { // getting list of file paths File[] listFiles = directory.listFiles(); // Check for count if (listFiles.length &gt; 0) { // loop through all files for (int i = 0; i &lt; listFiles.length; i++) { // get file path String filePath = listFiles[i].getAbsolutePath(); // check for supported file extension if (IsSupportedFile(filePath)) { // Add image path to array list filePaths.add(filePath); } } } else { // image directory is empty Toast.makeText( _context, AppConstant.PHOTO_ALBUM + " is empty. Please load some images in it !", Toast.LENGTH_LONG).show(); } } else { AlertDialog.Builder alert = new AlertDialog.Builder(_context); alert.setTitle("Error!"); alert.setMessage(AppConstant.PHOTO_ALBUM + " directory path is not valid! Please set the image directory name AppConstant.java class"); alert.setPositiveButton("OK", null); alert.show(); } return filePaths;…
score: 0
has comment: http://stackoverflow.com/comment/31625664
tagged with: android
has comment: http://stackoverflow.com/comment/31625948
type: AnsweredQuestion
tagged with: gridview
has title: Not getting proper path for gridview images
has comment: http://stackoverflow.com/comment/31625965
type: Question
has comment: http://stackoverflow.com/comment/31625848
possible better answer: http://stackoverflow.com/a/21036728

http://stackoverflow.com/a/21116014
has comment: http://stackoverflow.com/comment/97896049
has comment: http://stackoverflow.com/comment/67647951
has comment: http://stackoverflow.com/comment/56757730
type: Answer
answers question: http://stackoverflow.com/q/21105403
has comment: http://stackoverflow.com/comment/80856511
score: 415
has comment: http://stackoverflow.com/comment/98181504
has comment: http://stackoverflow.com/comment/82219264
has comment: http://stackoverflow.com/comment/88034493
accepted answer of: http://stackoverflow.com/q/21105403
has comment: http://stackoverflow.com/comment/60574696
has comment: http://stackoverflow.com/comment/79845389
has comment: http://stackoverflow.com/comment/97891439
has comment: http://stackoverflow.com/comment/118365186
has comment: http://stackoverflow.com/comment/110478912
has comment: http://stackoverflow.com/comment/97896483
downvote count: 9
has comment: http://stackoverflow.com/comment/67694025
has comment: http://stackoverflow.com/comment/31835296
upvote count: 424
has comment: http://stackoverflow.com/comment/42788657
has comment: http://stackoverflow.com/comment/82221379
has body: Use PowerMockito on top of Mockito. Example code: @RunWith(PowerMockRunner.class) @PrepareForTest(DriverManager.class) public class Mocker { @Test public void shouldVerifyParameters() throws Exception { //given PowerMockito.mockStatic(DriverManager.class); BDDMockito.given(DriverManager.getConnection(...)).willReturn(...); //when sut.execute(); // System Under Test (sut) //then PowerMockito.verifyStatic(); DriverManager.getConnection(...); } More information: Why doesn&#39;t Mockito mock static methods?
has comment: http://stackoverflow.com/comment/60474424
has comment: http://stackoverflow.com/comment/97891271
has comment: http://stackoverflow.com/comment/56751638
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/108127266
has comment: http://stackoverflow.com/comment/86091608
has comment: http://stackoverflow.com/comment/139726686

http://stackoverflow.com/comment/31605810
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21025890
has text: Good advice, but this doesn't handle the `e` user input. Not that this answer needs too. The question is more than addressed with this answer.
type: AnswerComment

http://stackoverflow.com/comment/31682295
has text: I don't see where OP said it's a browser game.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21067624

http://stackoverflow.com/a/21050094
has body: import java.awt.Point; import java.io.IOException; import java.util.Scanner; public class Solution { public static void main(final String[] args) throws IOException { int size; Scanner in = new Scanner(System.in); size = Integer.parseInt(in.nextLine()); Point[] points = new Point[size]; for (int i = 0; i &lt; size; i++) { String[] pointInput = in.nextLine().split(" "); points[i] = new Point(); points[i].x = Integer.parseInt(pointInput[0]); points[i].y = Integer.parseInt(pointInput[1]); } in.close(); for (Point point : points) { System.out.println("This is a point: " + point.x + ", " + point.y); } } } This is a working example of what you say you want to do. Judging from your question and the following comments I would strongly advise you to work through a few basic tutorials on Java before continuing on with this. Because unless you actually understand what happens where, giving you this answer will have done nothing useful in the end.
answers question: http://stackoverflow.com/q/21049527
score: 0
type: Answer

http://stackoverflow.com/comment/31770697
type: Comment
type: QuestionComment
has text: Yes I have tried using Android Studio. I do get compilation errors, and it seems Gradle is the culprit. But I honestly think it would not solve the Schema not being registered.
score: 0
comment on: http://stackoverflow.com/q/21081565

http://stackoverflow.com/a/21062155
answers question: http://stackoverflow.com/q/21062057
upvote count: 2
has body: Please check your welcome file list specified in web.xml. I've faced a similar situation before. When I named my welcome file as index.jsp and had many other additional names (like index.html, etc) mentioned in web.xml. When I removed all of them except index.jsp, it worked. I'm not sure if it would work for you. Please give it a try and post your feedback.
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/31827788
comment on: http://stackoverflow.com/q/21146956
score: 0
type: Comment
type: QuestionComment
has text: are you sure t,y and q aren't null? what about using a debugger?

http://stackoverflow.com/comment/31840464
score: 0
type: QuestionComment
type: Comment
has text: `=SUM(C1:C4381)` gives the same result as `=SUM(C:C)`. Good idea, though. By the way, I cannot easily sort the data because Excel saves the data I need in a different format than when it reads the CSV. It basically only saves the date and doesn't save the times that are in the same column as the dates. I need both the dates and times for the program to be able to read the CSV properly.
comment on: http://stackoverflow.com/q/21153533

spring-data-jpa
tags question: http://stackoverflow.com/q/21157123
tags question: http://stackoverflow.com/q/21123780
tags question: http://stackoverflow.com/q/21104504
tags question: http://stackoverflow.com/q/21133950
tags question: http://stackoverflow.com/q/21116539
type: Tag
tag name: spring-data-jpa
tags question: http://stackoverflow.com/q/21104434
tags question: http://stackoverflow.com/q/21150688

http://stackoverflow.com/q/21108328
has comment: http://stackoverflow.com/comment/31757317
possible better answer: http://stackoverflow.com/a/21108520
has title: Create jar file from maven
favorite count: 0
has comment: http://stackoverflow.com/comment/31757105
upvote count: 2
linked to: http://stackoverflow.com/q/9554688
tagged with: maven
has comment: http://stackoverflow.com/comment/31757861
answer count: 4
has comment: http://stackoverflow.com/comment/31758340
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21108811
tagged with: java
has answer: http://stackoverflow.com/a/21109023
type: Question
linked to: http://stackoverflow.com/q/5901378
has answer: http://stackoverflow.com/a/21108726
tagged with: jar
linked to: http://stackoverflow.com/q/21086076
has answer: http://stackoverflow.com/a/21108520
accepted answer: http://stackoverflow.com/a/21108811
linked to: http://stackoverflow.com/q/4238944
has body: I want to create a jar file without SNAPSHOT cause when i used this command mvn -f pom.XML package created two files "file name_SNAPSHOT.jar and file name_SNAPSHOT_WITH_dependencies.jar" I want file name.jar i know that i should edit in pom.XML so i tried to add this org.Apache.maven.plugins maven-source-plugin attach-sources jar but it created file name_SNAPSHOT_source.jar how can i solve it ?! My pom.XML like that <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 MyProject MyProject 0.0.1-SNAPSHOT jar
downvote count: 0

http://stackoverflow.com/q/21144148
accepted answer: http://stackoverflow.com/a/21144637
has body: Good morning to everybody, I have a problem using Mule ESB CE with file order. In the mule flow I have a File Inbound Endpoint that triggers the flow when one or more files come into a specified directory. Let's assume that i have three files (a.txt,b.txt,c.txt), and I'd like to process b.txt first then a.txt and finally, c.txt. How can I do that? I read something about "File Processing Order" comparator that allows to write an own custom comparator but i did not find any example (neither in the Mule documentation). Could anyone explain how to write a simple "file comparator" that order those files as above? Thanks in advance. Best Regards PL
tagged with: java
type: Question
tagged with: mule
score: 0
answer count: 1
has title: Mule 3 CE - File Processing Order
tagged with: esb
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21144637

http://stackoverflow.com/a/21182799
answers question: http://stackoverflow.com/q/21166137
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21166137
has comment: http://stackoverflow.com/comment/31892622
type: Answer
score: 31
downvote count: 0
has comment: http://stackoverflow.com/comment/31897404
has body: I found the answer :) Use JsonPath or XmlPath (in case you have XML) to get data from the response body. In my case: JsonPath jsonPath = new JsonPath(responseBody); int user_id = jsonPath.getInt("user_id");
upvote count: 31

http://stackoverflow.com/a/21064388
type: Answer
has comment: http://stackoverflow.com/comment/31679192
has body: I believe this line causes the issue: lp.addRule(RelativeLayout.RIGHT_OF, view.getId()); You basically say that, the view you're currently adding should be to the right of itself. Instead you need to provide the id of the previous item you added to the jar. To do that you can simply store the id of the item recently added. Sample code to achieve this: //Create a variable that can be accessed and initialize it as -1 int mostRecentlyAddedView = -1; //Then in the method you handle drag event if(mostRecentlyAdddedView == -1){ //This is the very first view, therefore no need to add toRight layout. // update the variable mostRecentlyAdddedView = view.getId(); // ... do other things here } else { // ... other things RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(88, 88); lp.addRule(RelativeLayout.CENTER_HORIZONTAL); lp.addRule(RelativeLayout.RIGHT_OF, mostRecentlyAdddedView); // ... other things }
has comment: http://stackoverflow.com/comment/31678578
answers question: http://stackoverflow.com/q/21064310
has comment: http://stackoverflow.com/comment/31676256
score: 0

http://stackoverflow.com/comment/31680733
comment on: http://stackoverflow.com/q/21066492
has text: The error is self explanatory `No such file`
score: 3
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31740910
type: Comment
type: AnswerComment
has text: With out a runnable example it's impossible to know what's going wrong
score: 0
comment on: http://stackoverflow.com/a/21082030

http://stackoverflow.com/q/21030160
linked to: http://stackoverflow.com/q/18625948
has answer: http://stackoverflow.com/a/21030794
has body: This is the code I have put up in my jsp page just to test if it works or not correctly. The jsp page works fine without any use of opencv classes. But I got this error while using objects of the opencv library. <%@ page import="org.opencv.core.*" %> <%@ page import="org.opencv.highgui.Highgui" %> Title <% System.loadLibrary("opencv_java248"); Mat img = Highgui.imread("F:/project/im2.jpg"); %> Attaching the error page for the details: The error code is : Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:553) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:442) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:722) root cause javax.servlet.ServletException: java.lang.UnsatisfiedLinkError: org.opencv.highgui.Highgui.imread_1(Ljava/lang/String;)J org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:911) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:840) org.apache.jsp.first_jsp._jspService(first_jsp.java:79) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:722) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:722) root cause java.lang.UnsatisfiedLinkError: org.opencv.highgui.Highgui.imread_1(Ljava/lang/String;)J org.opencv.highgui.Highgui.imread_1(Native Method) org.opencv.highgui.Highgui.imread(Highgui.java:359) org.apache.jsp.first_jsp._jspService(first_jsp.java:68) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:72…
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/3177733
has title: Using openCV with jsp leads to an UnsatisfiedLinkError?
score: 0
tagged with: java
type: Question
tagged with: opencv
answer count: 1
tagged with: jsp

http://stackoverflow.com/a/21184054
has body: From Javadoc: When a stack is first created, it contains no items. A more complete and consistent set of LIFO stack operations is provided by the Deque interface and its implementations, which should be used in preference to this class. So it's the same behavior but Deque has more methods to play with
type: Answer
answers question: http://stackoverflow.com/q/21183797
score: 0

http://stackoverflow.com/comment/31600155
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21022678
type: Comment
has text: Thanks, this is really helpful. I don't know if it works yet because the way I've loaded my images into an array isn't working but I'm sure when I fix that it will! ^.^

http://stackoverflow.com/comment/34481807
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21139542
has text: I can't tell from your question, but you don't use the add method to add the JMenuBar to the JFrame. You use the setJMenuBar method to add the JMenuBar to the JFrame.
score: 0

http://stackoverflow.com/q/21036428
has body: I am beginner in android. How to set dynamically created table layout cell height &amp; width fixed. Click here for screenshot The cell height &amp; width was changing based on text size. i need all cell size as fixed. XML code is &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:weightSum="100" &gt; &lt;/LinearLayout&gt; My code is Main = (LinearLayout) findViewById(R.id.main); Main_1 = new LinearLayout(this); LinearLayout.LayoutParams sudoku_1_lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.FILL_PARENT); Main_1.setLayoutParams(sudoku_1_lp); Main_1.setWeightSum(100); Main_1.setOrientation(LinearLayout.VERTICAL); Main_1.setId(100); //Layout for sudoku_board sudokuboard = new LinearLayout(this); LinearLayout.LayoutParams sudokuboard_lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,0,80.0f); sudokuboard_lp.setMargins(1, 1, 1, 1); sudokuboard.setLayoutParams(sudokuboard_lp); sudokuboard.setWeightSum(80); sudokuboard.setOrientation(LinearLayout.VERTICAL); sudokuboard.setBackgroundColor(Color.parseColor("#FF0000")); sudokuboard.setId(102); tblsudoku = new TableLayout(this); TableLayout.LayoutParams sudoku_tbl_lp = new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT,TableLayout.LayoutParams.FILL_PARENT,80.0f); sudoku_tbl_lp.setMargins(2, 2, 2, 2); tblsudoku.setLayoutParams(sudoku_tbl_lp); tblsudoku.setId(103); for(int i=0; i &lt; 9; i++) { TableRow NewRow1 =new TableRow(this); TableLayout.LayoutParams n1 = new TableLayout.LayoutParams(TableLayout.LayoutParams.FILL_PARENT,0,10.0f); if(i==3 || i==6 ) { n1.setMargins(0,2, 0, 0); } else { n1.setMargins(0,1, 0, 0); } NewRow1.setLayoutParams(n1); for(int j=0; j&lt;9; j++) { TextView tv_00 = new TextView(this); int id=10*i; id=id+j; id=id*id*id; String strText=""+id; tv_00.setText(strT…
type: Question
tagged with: android-layout
downvote count: 0
has title: How to set dynamically created tablelayout cell height & width fixed
has answer: http://stackoverflow.com/a/21037108
tagged with: android
answer count: 1
favorite count: 0
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java

http://stackoverflow.com/a/21094414
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31731733
has comment: http://stackoverflow.com/comment/31731639
type: Answer
score: 1
has body: Try to change your code to: Properties properties= new Properties(); properties.setProperty("user", login); properties.setProperty("password", password); properties.setProperty("useUnicode","true"); properties.setProperty("characterEncoding","UTF-8"); conn = DriverManager.getConnection("jdbc:mysql://" + host + "/" + db, properties); String message = "Раунд " + nextRoomId; String encMessage = new String(message.getBytes(), "UTF-8"); Data.db.executeUpdate("INSERT INTO chat(message) VALUES('" + encMessage + "')");
answers question: http://stackoverflow.com/q/21094316
has comment: http://stackoverflow.com/comment/114666389

http://stackoverflow.com/comment/31893783
type: QuestionComment
type: Comment
has text: Ill post a better screenshot in a minute.
score: 0
comment on: http://stackoverflow.com/q/21183858

http://stackoverflow.com/comment/31832915
has text: Find whoever wrote a method with 43 parameters and subject him to some unspeakable torture until he tells you exactly what they all are for!
score: 6
type: Comment
comment on: http://stackoverflow.com/q/21149563
type: QuestionComment

http://stackoverflow.com/q/21073401
upvote count: 2
has title: Adding 2 list element by element
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/21073589
type: AnsweredQuestion
tagged with: performance
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31692570
has answer: http://stackoverflow.com/a/21073624
has body: I am having 2 Lists and want to add them element by element. Like that: Is there an easier way and probably much more well performing way than using a for loop to iterate over the first list and add it to the result list? I appreciate your answer!
favorite count: 0
has answer: http://stackoverflow.com/a/21073589
has answer: http://stackoverflow.com/a/21073428
has answer: http://stackoverflow.com/a/21073524
answer count: 4
linked to: http://stackoverflow.com/q/322715
possible better answer: http://stackoverflow.com/a/21073428

http://stackoverflow.com/a/21138337
has comment: http://stackoverflow.com/comment/31812989
type: Answer
answers question: http://stackoverflow.com/q/21138129
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/31812416
has body: Try using ${basedir} instead. That will point to the parent directory of the buildfile. Also a common way to organize folders is to have your build.xml in the build folder and your output from building in build/output.
has comment: http://stackoverflow.com/comment/31811362
downvote count: 0
has comment: http://stackoverflow.com/comment/31812176

http://stackoverflow.com/comment/31855251
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21161675
has text: You shouldn't have to call `init`. from another class. You should call it from the constructor. In your case it may not work though, since your class in a JPanel that you add to to the frame in `init`, so if you call `init` from the contructor, you'll get an infinite loop. See my answer. I just made some simple fixes. But there is still more you can improve on - in terms of good practice.

http://stackoverflow.com/comment/31700813
comment on: http://stackoverflow.com/a/21077724
has text: Binish, I have solved the problem using this code: if (!in.ready()) break; Thank you very much!!!! :)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21150075
answers question: http://stackoverflow.com/q/21143749
score: 0
has body: Are you sure INFO: This is A is displayed? From above log4j_loglevel=ERROR for root (that would include TestLog4j.A) Since you have given level as ERROR, my understanding is that it would ignore logger.info("This is A"); So there is possibility that its not even finding log4j.properties.
type: Answer

http://stackoverflow.com/a/21044917
has comment: http://stackoverflow.com/comment/31640511
type: Answer
accepted answer of: http://stackoverflow.com/q/21044843
score: 2
upvote count: 2
has body: Since the XML is, in itself broken XML parsing will fail. Assuming that, despite broken, the XML file will always have that layout, you could use regular expressions to extract the data. String str = "<?xml version=\"1.0\" ?>\n" + " \n" + " Jack\n" + " EMP001 <Address> 12 CA, USA \n" + " \n" + " \n" + " "; str = str.replaceAll("\\n", ""); Pattern p = Pattern.compile(" (.+?) (.+?)<Address>(.+?) "); Matcher m = p.matcher(str); while(m.find()) { System.out.println("Name: " + m.group(1) + " EMPID: " + m.group(2) + " Address: " + m.group(3)); } Yields: Name: Jack EMPID: EMP001 Address: 12 CA, USA What does this pattern do: will match the Name tag. (.+?) will match what text follows the tag but will stop matching the moment it finds , since it is not a greedy pattern due to the ? added after the greedy operator + (this will be matched by the next section of the pattern. Also in this section, anything which matches will be placed in a group which can be later accessed. Once that the name is extracted, the engine will attempt to match tag. After that the tag has been matched, a process similar to step 2 will take place and the matched content will be placed in another group. As for the next step, the code will look for the <Address> Lastly, the regex will attempt to extract any characters which are in between the <Address> and tags and once again, anything that matches will be placed in a group. Once that the regular expression parses the string, I am accessing the groups and printing their values. As an extra step, I am removing any new line characters to process the string as a one liner. An introductory tutorial on regular expressions can be found here.
has comment: http://stackoverflow.com/comment/31640350
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31640916
has comment: http://stackoverflow.com/comment/31639945
answers question: http://stackoverflow.com/q/21044843

http://stackoverflow.com/comment/31748361
score: 1
has text: answer accepted especially for the "The solution could be to add the MouseListener directly to the custom component"
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21082925

http://stackoverflow.com/a/21084814
score: 0
has comment: http://stackoverflow.com/comment/31717356
has comment: http://stackoverflow.com/comment/31715113
has body: I used your code ans its working fine.I am able to see the text is getting printed on my console. Which webdriver version you are using? I checked it on version 2.38.
type: Answer
has comment: http://stackoverflow.com/comment/31714371
has comment: http://stackoverflow.com/comment/31714657
has comment: http://stackoverflow.com/comment/31714249
answers question: http://stackoverflow.com/q/21084564

http://stackoverflow.com/comment/31784397
comment on: http://stackoverflow.com/a/21123021
has text: I have included my flattening subroutine, it works with that.
score: 0
type: AnswerComment
type: Comment

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/21048126
tags question: http://stackoverflow.com/q/21129138
tags question: http://stackoverflow.com/q/21064753
tags question: http://stackoverflow.com/q/21104849
tags question: http://stackoverflow.com/q/21148084
type: Tag
tags question: http://stackoverflow.com/q/21178674
tags question: http://stackoverflow.com/q/21024996
tags question: http://stackoverflow.com/q/21055009
tags question: http://stackoverflow.com/q/21056840
tags question: http://stackoverflow.com/q/21128671

http://stackoverflow.com/comment/31867819
type: Comment
type: QuestionComment
has text: I added the configuration to the main message.
score: 0
comment on: http://stackoverflow.com/q/21150670

http://stackoverflow.com/q/21100133
tagged with: date
possible better answer: http://stackoverflow.com/a/21106464
answer count: 2
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31742248
has comment: http://stackoverflow.com/comment/31742273
has answer: http://stackoverflow.com/a/21100419
has body: How can I determine what the week of the year is from a given date in Java; where the start date is January 1. I see a number of examples such as using Calendar.WEEK_OF_YEAR however this is defined by locale resulting in a varying start date. To be clear; by week of year I mean: which of the 52 weeks in a year starting from January 1. There are numerous questions related to the locale specific behavior of Calendar.WEEK_OF_YEAR here on Stack; I didn't see the answer I need in any of them however. The problem that can occur is that for Locale.US, the first week of the year can be the last week of the prior year; so Dec 31 2013 will show as week 1 of 2014. I have seen Locale.GERMAN as acting as I would expect but I would prefer not to use this. A typical recommendation I want to avoid: Calendar aCalendar = new GregorianCalendar(); aCalendar.get(Calendar.WEEK_OF_YEAR);
has title: How to Determine Week of Year From Date?
has comment: http://stackoverflow.com/comment/31742875
tagged with: java
has comment: http://stackoverflow.com/comment/31742395
downvote count: 1
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31742433
has answer: http://stackoverflow.com/a/21106464
accepted answer: http://stackoverflow.com/a/21100419
score: -1
has comment: http://stackoverflow.com/comment/31742608

http://stackoverflow.com/comment/31649112
type: AnswerComment
has text: Only that OP doesn't want `#{group}`, he wants `#{group.name}`, which appears to be a `String`: No conversion necessary
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21039360

http://stackoverflow.com/q/21059085
upvote count: 16
has comment: http://stackoverflow.com/comment/31666423
score: 15
has comment: http://stackoverflow.com/comment/31666397
linked to: http://stackoverflow.com/q/3634853
tagged with: directory
possible better answer: http://stackoverflow.com/a/38795313
favorite count: 0
has body: Hello I was just wondering how to make a custom directory below the current user's home directory. I've tried this already and it doesn't work... (Code below) I want it to go to this directory and create the folder in the documents folder c:/users/"user"/documents/SimpleHTML/ File SimpleHTML = new File("C:/Users/"user"/Documents"); { // if the directory does not exist, create it if (!SimpleHTML.exists()) { System.out.println("createing direcotry: " + SimpleHTML); boolean result = SimpleHTML.mkdir(); if(result) { System.out.println("Direcotry created!"); } } new simplehtmlEditor() { //Calling to Open the Editor }; }
has comment: http://stackoverflow.com/comment/31666321
has comment: http://stackoverflow.com/comment/31666334
has answer: http://stackoverflow.com/a/21059316
accepted answer: http://stackoverflow.com/a/21059316
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31666348
tagged with: java
has comment: http://stackoverflow.com/comment/31666559
has comment: http://stackoverflow.com/comment/31666607
has title: how can I create a file in the current user's home directory using Java?
has answer: http://stackoverflow.com/a/38795313
has comment: http://stackoverflow.com/comment/31666522
type: Question
answer count: 2

spring-boot
tags question: http://stackoverflow.com/q/21083170
type: Tag
tags question: http://stackoverflow.com/q/21113154
tags question: http://stackoverflow.com/q/21041126
tags question: http://stackoverflow.com/q/21039884
tags question: http://stackoverflow.com/q/21115205
tag name: spring-boot

http://stackoverflow.com/comment/36355477
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23660396
has text: Giving bounty debugging info. Still think my issue was a timeout and a closed output stream by amazon.

http://stackoverflow.com/comment/31646985
type: Comment
has text: Thanks, figured it out now. I'll accept this as answering both of my questions. :)
type: AnswerComment
comment on: http://stackoverflow.com/a/21041232
score: 0

http://stackoverflow.com/a/21161795
has comment: http://stackoverflow.com/comment/31854295
has comment: http://stackoverflow.com/comment/31854146
has comment: http://stackoverflow.com/comment/31856074
score: 2
answers question: http://stackoverflow.com/q/21161679
downvote count: 0
has comment: http://stackoverflow.com/comment/31857717
upvote count: 2
has body: You need to add all the jars manually listed in .classpath to your Java command. Another place to find list of jars is Project-&gt;Properties-&gt;BuildPath You can use custom scripts for generating classpath, for example (*NIX): java -cp $(echo lib/*.jar | tr ' ' ':') package.MainClass EDIT: Ok, so to directly use Eclipse .classpath file entries to generate classpath in *NIX, you can use following: java -cp $(echo $(grep ".jar" .classpath | awk -F \" '{print $4}') | tr ' ' ':') package.MainClass This way you don't have to manually generate classpath. For Windows you would require bash script for doing same, I haven't worked that out yet!
type: Answer

http://stackoverflow.com/comment/85241627
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/33932910
has text: I see this pasted on a lot of similar questions, but it results in a crash related to memory. It seems like this may not be a viable solution when you have an image that is larger than the intended Mat output.

http://stackoverflow.com/q/21182234
tagged with: httpurlconnection
answer count: 0
type: UnansweredQuestion
upvote count: 1
has title: FileNotFoundException on working files url
tagged with: filenotfoundexception
tagged with: java
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/32678013
favorite count: 0
has comment: http://stackoverflow.com/comment/31891411
tagged with: android
score: 1
has body: So i get in this random FileNotFoundException, once in a while when i try to download files from Amazon S3 bucket or dropbox generated urls. Even thou the urls of the files work in browser w/o problems, in the app it seems that the download client throws the FileNotFoundException every now and then: Here is the code I use: URL url = new URL(urlString); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setReadTimeout(CONNECTION_TIMEOUT); connection.setRequestProperty("Accept-Encoding", ""); connection.setRequestProperty("Range", "bytes=" + startPos + "-" + dwnInfo.getStopRange()); connection.setRequestProperty("User-Agent","Mozilla/5.0 ( compatible ) "); connection.setRequestProperty("Accept","*/*"); connection.connect(); InputStream input = new BufferedInputStream(connection.getInputStream()); Some of the properties where added by reading other post regarding same issues, but the error still stays. Am I missing something ? Edit: forgot to mention that this doesn't happen instantly, it only happens when i try to download the "X" chunk of the file, stated with the range. I checked the start/end range and its fine. For the first "N" chunks it works fine. (N is random cuz it doesnt happen to the same chunk every time).

http://stackoverflow.com/a/22945987
has body: Well, now we can implement this thing (version 1.5.0). @FormUrlEncoded @POST("/oauth/access_token") void getToken( @FieldMap Map&lt;String, String&gt; params, Callback&lt;FacebookLoginUserResponse&gt; callback );
has comment: http://stackoverflow.com/comment/47826897
type: Answer
has comment: http://stackoverflow.com/comment/35310079
accepted answer of: http://stackoverflow.com/q/21063873
upvote count: 37
has comment: http://stackoverflow.com/comment/85660785
answers question: http://stackoverflow.com/q/21063873
downvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/106174080
score: 36

http://stackoverflow.com/comment/31874434
type: Comment
comment on: http://stackoverflow.com/q/21172582
has text: No @SergiiZagriichuk, they aren't being generated in my project despite the daos flag. I wouldn't ask the question if DAOs were being generated.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31822488
has text: how long the connection last before the reset?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21144193
score: 0

http://stackoverflow.com/q/21124781
tagged with: java
upvote count: 1
downvote count: 1
type: Question
tagged with: jakarta-ee
type: AnsweredQuestion
has title: How to obtain a directory name inside of a directory not knowing the exact name in Java
has answer: http://stackoverflow.com/a/21124888
score: 0
has comment: http://stackoverflow.com/comment/31787765
answer count: 1
favorite count: 0
has body: I have a directory called: example Inside of directory "example" I have 3 subdirectories: blah123-words random123-words stuff123-words The problem is "123" integers in the subdirectories will keep changing to new ones like 124, 125, 126, etc... Is there a way to obtain blah123-words directory inside of example and store it as a string or something? but only searching for "blah" and have Java automatically grab the whole directory name? and store it as a string or whatever. I would like to eventually output this directory name into a .xml file or a .txt file.
accepted answer: http://stackoverflow.com/a/21124888
has comment: http://stackoverflow.com/comment/31787846

http://stackoverflow.com/comment/31686967
comment on: http://stackoverflow.com/a/21070012
score: 1
has text: Thanks! it's right! I throught that setFocusLostBehavior only works when the focus is changed, not when delete the text. Thanks! Accepted ;-)
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31837858
type: Comment
type: QuestionComment
has text: Its listed as one of the jars above. Middle of the list
comment on: http://stackoverflow.com/q/21150091
score: 0

http://stackoverflow.com/q/21125765
downvote count: 0
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/21125795
has answer: http://stackoverflow.com/a/21125842
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21125804
has answer: http://stackoverflow.com/a/21126097
score: 1
tagged with: java
has title: Create and call method that involves multiple System.out.println() and variables
has body: I'm working on a little Java program that outputs a receipt to email students who registered for an AP exam at my school. The code looks like this. // Create email text body for student who registered for an AP exam. import java.util.Scanner; class EmailText { public static void main(String args[]) { Scanner input = new Scanner(System.in); String first_name; String email; int numTests; char ch; char choice; int cost; System.out.print("Enter student first name: "); first_name = input.next(); System.out.print("Enter student email: "); email = input.next(); System.out.print("Enter number of tests ordered (1-9): "); numTests = input.nextInt(); if(numTests &lt; 10) { System.out.print("Did student qualify for fee waiver (y/n)? "); ch = input.next().charAt(0); if(ch == 'y') { cost = 5; int total = numTests * cost; System.out.println("** COPY/PASTE THIS DRAFT **"); System.out.println("To: " + email); System.out.println("Subject: 2014 AP Test Receipt for " + first_name); System.out.println(); System.out.println("Hi " + first_name + ",\n"); System.out.println("Thank you for registering for the 2014 AP Exams!"); System.out.println("According to our records, you ordered " + numTests + " tests.\n"); System.out.println("Because you stated that you qualified for a fee waiver, " + "each test will cost you $" + cost + "."); System.out.println("Your total cost is $" + cost + " * " + numTests + " = $" + total + ".\n"); System.out.println("Please submit your payment to the College Counseling Office ASAP.\nThank you.\n"); } else if(ch == 'n') { cost = 89; int total = numTests * cost; System.out.println("** Copy/Paste this Draft **"); System.out.println("To: " + email); System.out.println("Subject: 2014 AP Test Receipt for " + first_name); System.out.println(); System.out.println("Hi " + first_name + ",\n"); System.out.println("Thank you for registering for the 2014 AP Exams!"); System.out.println("According to our records, you ordered " + numTests + " tests."); System.out.println("Becau…
upvote count: 1
tagged with: methods
type: Question
answer count: 6
has answer: http://stackoverflow.com/a/21125935
possible better answer: http://stackoverflow.com/a/21126097
accepted answer: http://stackoverflow.com/a/21125842
has answer: http://stackoverflow.com/a/21125904

http://stackoverflow.com/comment/31851112
type: AnswerComment
comment on: http://stackoverflow.com/a/21158315
type: Comment
score: 1
has text: @Divers What you say isn't wrong - problem is, its only really true for a very limited type of scenario: purely CPU limited numbercunching. As soon as there is waiting for I/O (or the user) involved, the CPU is utilized much better when there are *more* threads than cores, since not all threads are ready to run at all times. Also a generic "context switches are expensive" statement is meaningless, they are a neccessary evil for multiplexing a single core to multiple tasks. Spending some time for a context switch is still a lot better than busy polling for IO completion.

http://stackoverflow.com/q/21142696
answer count: 2
tagged with: jstl
upvote count: 1
downvote count: 1
tagged with: jsp
possible better answer: http://stackoverflow.com/a/21142786
has title: Convert out.println to c:out
favorite count: 0
has comment: http://stackoverflow.com/comment/31820141
has body: What is the JSTL c:out version of this JSP: &lt;% PersonController personController = new PersonController(); personController.populate(); out.println(personController.getAllPeople().get(0).getName()); %&gt; The code running behind this: In PersonController: List&lt;Person&gt; allPeople = new ArrayList&lt;Person&gt;(); public void populate() { Person person = new Person(); person.setName("Jeff"); allPeople.add(person); } public List&lt;Person&gt; getAllPeople() { return allPeople; } public void setAllPeople(List&lt;Person&gt; allPeople) { this.allPeople = allPeople; } In Person: private String name; public String getName() { return name; } public void setName(String name) { this.name = name; }
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21143164
accepted answer: http://stackoverflow.com/a/21143164
has comment: http://stackoverflow.com/comment/31820059
has comment: http://stackoverflow.com/comment/31820527
has answer: http://stackoverflow.com/a/21142786
has comment: http://stackoverflow.com/comment/31820162
score: 0

http://stackoverflow.com/q/21024282
has answer: http://stackoverflow.com/a/21039387
type: Question
tagged with: java
tagged with: dao
answer count: 1
downvote count: 0
favorite count: 0
tagged with: osgi
type: UnansweredQuestion
has title: OSGi: should I have a Dao bundle?
score: 1
has body: say I have a business application module, like user-management(um). there're 2 ways of bundle design(as I can tell). A.datasource, um-model, um-dao, um-service, um-wab B.datasource, um-api, um-impl B is what I prefer now. some considerations I take: according to "java application architecture: modularity patterns with examples using osgi", I want fine-grained over coarse-grained modules. However, way A is too fine-grained. Dao should be private. If another module room-booking, will query users, it should depend on module(bundle) um-api. It's rare that someone will design modules(bundles) um-dao-api, um-dao-jpa-impl, um-dao-jdbc-impl, um-dao-jdo-impl. Maybe um-api, um-ldap-impl, um-avos-delegate-impl are better design. datasource is a module(bundle) because I want transactions between app-modules. So, I don't think Dao should be bundle. any idea? thx!
upvote count: 1

http://stackoverflow.com/comment/31823211
type: QuestionComment
comment on: http://stackoverflow.com/q/21144598
has text: @PM77-1 yes you are right, but as I said I have faced this situation just logically and not technically as I am not able to code the same
score: 0
type: Comment

http://stackoverflow.com/q/21142434
answer count: 1
tagged with: java
has title: Libgdx show tooltip
has answer: http://stackoverflow.com/a/21142843
tagged with: libgdx
has body: I am developing a game with libgdx. This game contains different Levels, which are rendered by a Stage. All objects in that Level are represented by libgdx Actors. Now I want to have a tutorial Level. In this Level a tooltip should show when the Player reaches a specific Position within the Level. This tooltip should contain informations (like: "Press A to go left!") and dissapear after some time. I thought about using libgdx Label and add a Sequence of Actions to them (•Delay 5s •FadeOut in 1s). The Problem is that for Labels I need to create a LabelStyle for which I have to create a Font file and load it. Is there a way to create a Label with a default font (like ARIAL or others)? It should just be easy to read nothing more. Or is there another easy way to create this kind of tooltips?
downvote count: 0
tagged with: tooltip
tagged with: label
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/21142843
favorite count: 0
type: Question
upvote count: 2

http://stackoverflow.com/comment/31702430
comment on: http://stackoverflow.com/a/21078777
score: 0
type: Comment
has text: wow this was WAY better than expected! Thank you so very much, and thank you for that link as well to fill my free time :) consider this the answer :) i'll accept when i can
type: AnswerComment

http://stackoverflow.com/q/21087613
has comment: http://stackoverflow.com/comment/31721842
type: UnansweredQuestion
has title: How to share data between all users of a portlet instance?
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: liferay
has answer: http://stackoverflow.com/a/21094989
tagged with: session
has comment: http://stackoverflow.com/comment/31845975
has comment: http://stackoverflow.com/comment/31729784
linked to: http://stackoverflow.com/q/21140154
has comment: http://stackoverflow.com/comment/31727780
answer count: 2
upvote count: 1
tagged with: portlet
has body: I would like to share beans between all users of a portlet instance but I don't know how. I am working on a (Liferay) portlet that will have many data useful for every users of an instance of this portlet : after being placed on a page, the portlet will get data from DB that depends on its preferences. I would like this portlet to store this data in RAM and not in preferences to avoid conversion from/to String. I know I can store it in session, but this will create a copy of the data for each user viewing the portlet. Result : I could have a huge amount of data in RAM because of this. I can't use the context (or a local variable in my Portlet class) because the data would be shared between all instances of the portlet, and I want it to be specific for an instance. In facts, I would like to have it working just like the preferences of the portlet, but with other beans than Strings. Here is an example of what I would like (saying my portlet is displaying a list of contents, just like the Asset Publisher) : On a page, I would place 2 times the portlet : one displaying all the events and another displaying all the blogs entries After the preferences being set, each instance of the portlet would get a list of contents and will store it in RAM When a user is visiting the page, the list of contents of each portlet instance would be used When another user is visiting the same page, the same list would be used (by "same list", I mean the same instance of List, for exemple) Here an example of code for Portlet class: package com.test; import com.liferay.portlet.asset.model.AssetEntry; import com.liferay.util.bridges.mvc.MVCPortlet; import java.io.IOException; import java.util.List; import javax.portlet.PortletException; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; /** * Portlet implementation class NewPortlet */ public class NewPortlet extends MVCPortlet { @Override public void doView(RenderRequest renderRequest, RenderResponse renderResponse) throw…
favorite count: 0
has answer: http://stackoverflow.com/a/21159938

http://stackoverflow.com/q/21106044
has body: I have added all these dependencies but still org.apache.poi.POIXMLDocument is not imported. I need it for below code. What is the problem? `POIXMLDocument.hasOOXMLHeader(file.getInputStream())` if I click on the error, it will import it manually and everything is fine but I guess it is wrong org.apache.poi poi 3.7 org.apache.tika tika-app 0.6 org.apache.poi poi-ooxml 3.5-beta4 org.apache.xmlbeans xmlbeans 2.3.0 xmlbeans xbean 2.1.0 xmlbeans xbean_xpath 2.1.0 org.apache.xmlbeans xmlbeans-qname 2.3.0
score: 0
has answer: http://stackoverflow.com/a/23759889
tagged with: dependencies
has answer: http://stackoverflow.com/a/21120493
answer count: 5
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/21106350
has answer: http://stackoverflow.com/a/21106415
has title: Maven dependencies for org.apache.poi.POIXMLDocument
has answer: http://stackoverflow.com/a/21106126
tagged with: java
type: Question

http://stackoverflow.com/q/21054123
tagged with: rmi
tagged with: java
linked to: http://stackoverflow.com/q/4201387
type: Question
tagged with: c#
answer count: 2
has answer: http://stackoverflow.com/a/21054372
linked to: http://stackoverflow.com/q/1664949
score: 0
has answer: http://stackoverflow.com/a/21054175
has body: I'm old school java guy, I've been doing C# WCF, Remoting etc.... for over a decade. When I left the java realm I was very proficient with RMI. What is the current (WCF equiv) of Remoting in the java world?
tagged with: wcf
type: UnansweredQuestion
has title: RMI, What is the modern day Java Equiv to .NET WCF (Windows Communication Foundation)?
has comment: http://stackoverflow.com/comment/31657077

fftpack
tags question: http://stackoverflow.com/q/21064509
tag name: fftpack
type: Tag

http://stackoverflow.com/comment/31817806
type: AnswerComment
has text: @user3198603 Please accept my answer :). The second part of your comment sounds like another question in itself. It could have all kinds of causes, including the default character set of a new file in your text editor. BTW: `\u0374100` is not 1 character, but 4 (U+0374 and 100)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21140562

http://stackoverflow.com/comment/31892997
has text: @VancertStaff Apoorv said to update the count variable in your Adapter class, not connection count... override getCount() method of Adapter like this `@Override public int getCount() { return titles.size(); }`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21182936
type: Comment

http://stackoverflow.com/q/21169539
has comment: http://stackoverflow.com/comment/31868385
type: AnsweredQuestion
tagged with: java
tagged with: certificate
linked to: http://stackoverflow.com/q/9747443
has comment: http://stackoverflow.com/comment/31869856
has title: why am I still getting class has no valid constructor error
type: Question
has comment: http://stackoverflow.com/comment/31868371
has comment: http://stackoverflow.com/comment/31868319
score: 0
has comment: http://stackoverflow.com/comment/31868786
has comment: http://stackoverflow.com/comment/31869104
answer count: 1
has answer: http://stackoverflow.com/a/21169974
accepted answer: http://stackoverflow.com/a/21169974
has comment: http://stackoverflow.com/comment/31869668
tagged with: exception
has body: Please I am quite new to java programming.I am trying to write a class to a bytearrayoutputstream, then pass this data to a simple array. Then I read and reconstruct the class out of the byte array. I am doing this using ObjectOutputStream and ObjectInputStream. but I don't understand why I am still getting java.io.InvalidClassException: that my class has no valid constructor. the best help I could find is at java.io.InvalidClassException: no valid constructor. My code: // this is the class I am writing to the ByteArrayOutputStream public class CrtB extends X509v3CertificateBuilder implements Serializable { private static final long serialVersionUID = 1234509876; public CrtB(X500nEx arg0, BigInteger arg1, Date arg2, Date arg3, X500nEx arg4, SubjectPublicKeyInfo arg5) { super(arg0, arg1, arg2, arg3, arg4, arg5); } } //this how I pass the class to the ByteArrayOutputStream and then reconstruct it public class Testclass implements Serializable { public CrtB getCrt(){ subpubInfo=SubjectPubInfo.getInstance(getPublicKey.getEncoded()); certbld=new CrtB(name1, serialNr, start, end,name2, subpubInfo); return certbld; // certbld is a global variable } //writes to the ByteArrayOutputStream private ByteArrayOutputStream writetoBAS(){ ByteArrayOutputStream bout=null; try{ bout=new ByteArrayOutputStream(); ObjectOutputStream obj=new ObjectOutputStream(bout); obj.writeObject(certbld); obj.close(); }catch(Exception e){ e.printStackTrace(); } return bout; } //read from byte array private CrtB getbui(byte[] ar){ CrtB b=null; try { ByteArrayInputStream bin=new ByteArrayInputStream(ar); ObjectInputStream oin=new ObjectInputStream(bin); b=(CrtB)oin.readObject(); System.out.println("successfully transferred"); }catch (Exception e){ e.printStackTrace(); } return b; } public static void main(String[] args) { Testclass rqR=new Testclass(); rqR.CrtB(); byte[] br=rqR.writeBAS().toByteArray(); CrtB b=rqR.getbui(br); } } Could any one help me or give me a hint.

http://stackoverflow.com/comment/31597677
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21021558
type: Comment
has text: I'm looking to copy from a HDFS directory to another HDFS directory.

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/21077701
tags question: http://stackoverflow.com/q/21143088
tags question: http://stackoverflow.com/q/21045230
tags question: http://stackoverflow.com/q/21042330
tags question: http://stackoverflow.com/q/21022872
tags question: http://stackoverflow.com/q/21115471
tags question: http://stackoverflow.com/q/21117119
tags question: http://stackoverflow.com/q/21115321
tags question: http://stackoverflow.com/q/21158872
tags question: http://stackoverflow.com/q/21170909
tags question: http://stackoverflow.com/q/21040357
tags question: http://stackoverflow.com/q/21036765
tags question: http://stackoverflow.com/q/21158807
tags question: http://stackoverflow.com/q/21096863
tags question: http://stackoverflow.com/q/21108611
tags question: http://stackoverflow.com/q/21130033
tags question: http://stackoverflow.com/q/21043443
type: Tag
tags question: http://stackoverflow.com/q/21087022
tags question: http://stackoverflow.com/q/21106257
tags question: http://stackoverflow.com/q/21121891
tags question: http://stackoverflow.com/q/21027434
tags question: http://stackoverflow.com/q/21090127
tags question: http://stackoverflow.com/q/21131959
tags question: http://stackoverflow.com/q/21078935
tags question: http://stackoverflow.com/q/21033691
tags question: http://stackoverflow.com/q/21040970
tags question: http://stackoverflow.com/q/21128089
tags question: http://stackoverflow.com/q/21027528
tags question: http://stackoverflow.com/q/21052753
tags question: http://stackoverflow.com/q/21062020
tags question: http://stackoverflow.com/q/21183419
tags question: http://stackoverflow.com/q/21128263
tags question: http://stackoverflow.com/q/21133068
tags question: http://stackoverflow.com/q/21068286
tags question: http://stackoverflow.com/q/21108308
tags question: http://stackoverflow.com/q/21165871
tags question: http://stackoverflow.com/q/21121223
tags question: http://stackoverflow.com/q/21117879
tags question: http://stackoverflow.com/q/21044843
tags question: http://stackoverflow.com/q/21161727
tags question: http://stackoverflow.com/q/21066728
tags question: http://stackoverflow.com/q/21118051
tags question: http://stackoverflow.com/q/21086717
tags question: http://stackoverflow.com/q/21053501
tags question: http://stackoverflow.com/q/21100694
tags question: http://stackoverflow.com/q/21052224
tags question: http://stackoverflow.com/q/21121663
tags question: http://stackoverflow.com/q/21067981
tags question: http://stackoverflow.com/q/21110323
tags question: http://stackoverflow.com/q/21067074
tags question: http://stackoverflow.com/q/21147703
tags question: http://stackoverflow.com/q/21039849
tags question: http://stackoverflow.com/q/21049806
tags question: http://stackoverflow.com/q/21138266
tags question: http://stackoverflow.com/q/21162168
tags question: http://stackoverflow.com/q/21043744
tags question: http://stackoverflow.com/q/21142870
tags question: http://stackoverflow.com/q/21059331
tags question: http://stackoverflow.com/q/21115063
tags question: http://stackoverflow.com/q/21106779
tags question: http://stackoverflow.com/q/21042359
tags question: http://stackoverflow.com/q/21138129
tags question: http://stackoverflow.com/q/21136680
tags question: http://stackoverflow.com/q/21179432
tags question: http://stackoverflow.com/q/21019509
tags question: http://stackoverflow.com/q/21125892
tags question: http://stackoverflow.com/q/21170127
tags question: http://stackoverflow.com/q/21081565
tags question: http://stackoverflow.com/q/21083267
tag name: xml
tags question: http://stackoverflow.com/q/21034944
tags question: http://stackoverflow.com/q/21085595
tags question: http://stackoverflow.com/q/21104756
tags question: http://stackoverflow.com/q/21177002
tags question: http://stackoverflow.com/q/21137843
tags question: http://stackoverflow.com/q/21067184
tags question: http://stackoverflow.com/q/21070693
tags question: http://stackoverflow.com/q/21035379
tags question: http://stackoverflow.com/q/21054944

http://stackoverflow.com/comment/31840110
type: Comment
has text: en, this looks like a good solution. Let me try on actual code. Thanks.
comment on: http://stackoverflow.com/a/21153451
score: 0
type: AnswerComment

http://stackoverflow.com/q/21132174
upvote count: 1
has title: Java: Getting ExecutorService to produce repeatable behavior?
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: concurrency
type: Question
tagged with: threadpool
downvote count: 0
has answer: http://stackoverflow.com/a/21132437
has body: I have been trying to parallelize a portion of a method within my code (as shown in the Example class's function_to_parallelize(...) method). I have examined the executor framework and found that Futures &amp; Callables can be used to create several worker threads that will ultimately return values. However, the online examples often shown with the executor framework are very simple and none of them appear to suffer my particular case of requiring methods in the class that contains that bit of code I'm trying to parallelize. As per one Stackoverflow thread, I've managed to write an external class that implements Callable called Solver that implements that method call() and set up the executor framework as shown in the method function_to_parallelize(...). Some of the computation that would occur in each worker thread requires methods *subroutine_A(...)* that operate on the data members of the Example class (and further, some of these subroutines make use of random numbers for various sampling functions). My issue is while my program executes and produces results (sometimes accurate, sometimes not), every time I run it the results of the combined computation of the various worker threads is different. I figured it must be a shared memory problem, so I input into the Solver constructor copies of every data member of the Example class, including the utility that contained the Random rng. Further, I copied the subroutines that I require even directly into the Solver class (even though it's able to call those methods from Example without this). Why would I be getting different values each time? Is there something I need to implement, such as locking mechanisms or synchronization? Alternatively, is there a simpler way to inject some parallelization into that method? Rewriting the "Example" class or drastically changing my class structuring is not an option as I need it in its current form for a variety of other aspects of my software/system. Below is my code vignette (well…
tagged with: worker
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21132437
tagged with: multithreading

http://stackoverflow.com/comment/31812822
comment on: http://stackoverflow.com/q/21138129
has text: Try running with `ant -v clean`. That will show you exactly what Ant is trying to delete. (And ignore the answers which recommend using ${basedir}/build—they apparently aren't aware that relative paths in Ant are already treated as relative to the basedir.)
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/21043745
has body: The reason I found later was, that I used StringInputStream class and didn't realize, that it is org.hsqldb.lib.StringInputStream.StringInputStream(String). When I replaced this one with java.io.StringBufferInputStream.StringBufferInputStream(String) // deprecated or java.io.StringReader.StringReader(String) // sniff accepts reader too or java.io.ByteArrayInputStream.ByteArrayInputStream(byte[]) ...it worked. I didn't investigate why the previous one from hsqldb package is bad in this case...
type: Answer
accepted answer of: http://stackoverflow.com/q/21043744
score: 0
answers question: http://stackoverflow.com/q/21043744
type: AcceptedAnswer

http://stackoverflow.com/q/21087407
favorite count: 0
tagged with: postgresql
tagged with: hibernate-mapping
score: 2
downvote count: 0
has title: Hibernate: childEntity null id on merge parentEntity
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21088087
accepted answer: http://stackoverflow.com/a/21088087
has body: I've the code: modifiedParentEntity.addChild(newChildEntity); session.merge(modifiedParentEntity); newChildEntity.getId(); // == 0!!! Where parent entity has a collection of child entities with CascadeType.ALL: @Entity public class ParentEntity { @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true) @JoinColumn(name = "parent_entity_id") private List&lt;ChildEntity&gt; childEntities; } Question: Why after session.merge(modifiedParentEntity) chidEntity has 0 id? How to save both modifiedParentEntity and chidEntity in a way that Hibernate will set id to chidEntity? P.S.: I use postgres and sequences to generate entities' ids.
tagged with: java
tagged with: hibernate
type: Question
upvote count: 2
answer count: 1

http://stackoverflow.com/q/21156444
score: 0
linked to: http://stackoverflow.com/q/21421916
answer count: 1
has answer: http://stackoverflow.com/a/21158532
tagged with: log4j
has comment: http://stackoverflow.com/comment/31876976
has comment: http://stackoverflow.com/comment/31845250
type: UnansweredQuestion
has body: I have an application using Spring, so I have spring.jar as a 3rd party library. I'm using log4j for logging and I've set the root level as INFO. Here is my log4j.properties: log4j.rootCategory=INFO log4j.logger.org.springframework.context.support.ResourceBundleThemeSource=WARN log4j.logger.org.springframework.ui.context.support.ResourceBundleThemeSource=WARN log4j.appender.Console=org.apache.log4j.ConsoleAppender log4j.appender.Console.layout=org.apache.log4j.PatternLayout log4j.appender.Console.layout.ConversionPattern=%-5p - %m%n As you can see, I've tried to set a specific class' (which is inside spring jar) logging level. However, it keeps logging as: [1/7/14 11:53:35:150 EET] 0000003b ResourceBundl I org.springframework.ui.context.support.ResourceBundleThemeSource getTheme Theme created: name 'theme', basename [theme] so it is creating unnecessary text data and exaggerating my log file. As far as I can see, the log level is INFO inside ResourceBundleMessageSource class. So, why it keeps logging even if I've set the level to WARN? Thanks!
tagged with: spring
tagged with: logging
tagged with: java
type: Question
has title: Log4j disable logging for a class inside Spring.jar

http://stackoverflow.com/a/21115480
type: AcceptedAnswer
has body: Collation utf8_general_ci (_ci stands for Case Insensitive) does not only make e equal to E, but also makes E equal to É. To make a select statement case sensitive, you can use the solution from this answer: SELECT * FROM myTable where BINARY name='CAFÉ'; If you want to make data in column name always case sensitive, use a case sensitive _bin collation as shown in the answers for this question. E.g. when you create a table, use: CREATE TABLE myTable ( ... ) CHARACTER SET utf8 COLLATE utf8_bin ENGINE=MyISAM;
accepted answer of: http://stackoverflow.com/q/21102520
type: Answer
answers question: http://stackoverflow.com/q/21102520
score: 2
downvote count: 0
upvote count: 2

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

http://stackoverflow.com/q/21099953
tagged with: amazon-sqs
upvote count: 12
downvote count: 0
has answer: http://stackoverflow.com/a/21104343
possible better answer: http://stackoverflow.com/a/47449045
tagged with: amazon-web-services
has answer: http://stackoverflow.com/a/21100609
accepted answer: http://stackoverflow.com/a/21104343
has title: Amazon SQS Long Polling not returning all messages
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/71404301
tagged with: long-polling
type: AnsweredQuestion
tagged with: java
has body: I have a requirement to read all messages in my Amazon SQS queue in 1 read and then sort it based on created timestamp and do business logic on it. To make sure all the SQS hosts are checked for messages, I enabled long polling. The way I did that was to set the default wait time for the queue as 10 seconds. (Any value more than 0 will enable long polling). However when I tried to read the queue, it still did not give me all the messages and I had to do multiple reads to get all the messages. I even enabled long polling through code per receive request, still did not work. Below is the code I am using. AmazonSQSClient sqsClient = new AmazonSQSClient(new ClasspathPropertiesFileCredentialsProvider()); sqsClient.setEndpoint("sqs.us-west-1.amazonaws.com"); String queueUrl = "https://sqs.us-west-1.amazonaws.com/12345/queueName"; ReceiveMessageRequest receiveRequest = new ReceiveMessageRequest().withQueueUrl(queueUrl).withMaxNumberOfMessages(10).withWaitTimeSeconds(20); List&lt;Message&gt; messages = sqsClient.receiveMessage(receiveRequest).getMessages(); I have 3 messages in the queue and each time I run the code I get a different result, sometimes I get all 3 messages, sometimes just 1. The visibility timeout I set as 2 seconds, just to eliminate the messages becoming invisible as the reason for not seeing them in the read. This is the expected behavior for short polling. Long polling is supposed to eliminate multiple polls. Is there anything I am doing wrong here? Thanks
tagged with: queue
has answer: http://stackoverflow.com/a/47449045
type: Question
score: 12

arrays
tags question: http://stackoverflow.com/q/21099879
tags question: http://stackoverflow.com/q/21034567
tags question: http://stackoverflow.com/q/21103440
tags question: http://stackoverflow.com/q/21145089
tags question: http://stackoverflow.com/q/21122110
tags question: http://stackoverflow.com/q/21170437
type: Tag
tags question: http://stackoverflow.com/q/21034810
tags question: http://stackoverflow.com/q/21101379
tags question: http://stackoverflow.com/q/21029130
tags question: http://stackoverflow.com/q/21164921
tags question: http://stackoverflow.com/q/21062427
tags question: http://stackoverflow.com/q/21115056
tags question: http://stackoverflow.com/q/21047544
tags question: http://stackoverflow.com/q/21064762
tags question: http://stackoverflow.com/q/21065850
tags question: http://stackoverflow.com/q/21048962
tags question: http://stackoverflow.com/q/21119050
tags question: http://stackoverflow.com/q/21096929
tags question: http://stackoverflow.com/q/21078493
tags question: http://stackoverflow.com/q/21022794
tags question: http://stackoverflow.com/q/21126983
tags question: http://stackoverflow.com/q/21057262
tags question: http://stackoverflow.com/q/21065390
tags question: http://stackoverflow.com/q/21132618
tags question: http://stackoverflow.com/q/21026052
tags question: http://stackoverflow.com/q/21119197
tags question: http://stackoverflow.com/q/21077827
tags question: http://stackoverflow.com/q/21090879
tags question: http://stackoverflow.com/q/21052678
tags question: http://stackoverflow.com/q/21087801
tags question: http://stackoverflow.com/q/21051110
tags question: http://stackoverflow.com/q/21079443
tags question: http://stackoverflow.com/q/21120554
tags question: http://stackoverflow.com/q/21068463
tags question: http://stackoverflow.com/q/21140055
tags question: http://stackoverflow.com/q/21113404
tags question: http://stackoverflow.com/q/21164406
tags question: http://stackoverflow.com/q/21126793
tags question: http://stackoverflow.com/q/21153533
tags question: http://stackoverflow.com/q/21043967
tags question: http://stackoverflow.com/q/21070154
tags question: http://stackoverflow.com/q/21066340
tags question: http://stackoverflow.com/q/21129023
tags question: http://stackoverflow.com/q/21128119
tags question: http://stackoverflow.com/q/21041322
tags question: http://stackoverflow.com/q/21074214
tags question: http://stackoverflow.com/q/21147489
tags question: http://stackoverflow.com/q/21127002
tags question: http://stackoverflow.com/q/21164182
tags question: http://stackoverflow.com/q/21180518
tags question: http://stackoverflow.com/q/21075189
tags question: http://stackoverflow.com/q/21089538
tags question: http://stackoverflow.com/q/21023326
tags question: http://stackoverflow.com/q/21108695
tags question: http://stackoverflow.com/q/21177586
tags question: http://stackoverflow.com/q/21128957
tags question: http://stackoverflow.com/q/21141145
tags question: http://stackoverflow.com/q/21112733
tags question: http://stackoverflow.com/q/21117641
tags question: http://stackoverflow.com/q/21070508
tags question: http://stackoverflow.com/q/21029245
tags question: http://stackoverflow.com/q/21173297
tags question: http://stackoverflow.com/q/21043139
tags question: http://stackoverflow.com/q/21142031
tags question: http://stackoverflow.com/q/21179581
tags question: http://stackoverflow.com/q/21057594
tags question: http://stackoverflow.com/q/21085224
tags question: http://stackoverflow.com/q/21073668
tags question: http://stackoverflow.com/q/21025225
tags question: http://stackoverflow.com/q/21152714
tags question: http://stackoverflow.com/q/21063989
tags question: http://stackoverflow.com/q/21171221
tags question: http://stackoverflow.com/q/21131613
tags question: http://stackoverflow.com/q/21179964
tags question: http://stackoverflow.com/q/21060259
tags question: http://stackoverflow.com/q/21033896
tags question: http://stackoverflow.com/q/21051665
tags question: http://stackoverflow.com/q/21139793
tags question: http://stackoverflow.com/q/21095957

http://stackoverflow.com/a/21108726
has comment: http://stackoverflow.com/comment/31758840
score: 1
has comment: http://stackoverflow.com/comment/31759374
has body: To create just the jar with project-name.jar and all dependencies included, try to use assembly plugin. A configuration could look like this: maven-assembly-plugin 2.4 make-assembly package single true {your.main.class} jar-with-dependencies ${project.basedir} ${project.artifactId} false Make sure to replace {your.main.class} with your fully qualified Main class. The jar will be generated in your project root folder instead of target.
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/31758698
downvote count: 1
answers question: http://stackoverflow.com/q/21108328
has comment: http://stackoverflow.com/comment/31761878

http://stackoverflow.com/a/21158230
upvote count: 0
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/31849230
has body: You need to do a java.io.BufferedWriter#flush() before the close.
downvote count: 1
has comment: http://stackoverflow.com/comment/31847846
answers question: http://stackoverflow.com/q/21158142
has comment: http://stackoverflow.com/comment/31849801

http://stackoverflow.com/comment/31634709
has text: @AndréStannek fair point.
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21039959

http://stackoverflow.com/q/21144002
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: I am using the Google Drive SDK to create spreadsheets with this code: File body = new File(); body.setTitle(title); body.setMimeType("application/vnd.google-apps.spreadsheet"); body.setParents(Arrays.asList(new ParentReference().setId(currentParent))); File file = driveHelper.getDrive().files().insert(body).execute(); Is there a way to get a specific spreadsheet created with the Drive SDK using Googles Spreadsheet API? I have many spreadsheets with the same name in different folders and when I am looping through all spreadsheets I don't want to compare the titles to get a specific spreadsheet.
type: Question
upvote count: 1
accepted answer: http://stackoverflow.com/a/21151422
tagged with: android
answer count: 1
favorite count: 0
tagged with: google-drive-api
has answer: http://stackoverflow.com/a/21151422
has title: Get spreadsheet created with Drive SDK
tagged with: google-sheets-api

http://stackoverflow.com/q/21029595
tagged with: servlets
has answer: http://stackoverflow.com/a/21029733
answer count: 1
tagged with: email
has comment: http://stackoverflow.com/comment/31612758
downvote count: 0
tagged with: jsp
accepted answer: http://stackoverflow.com/a/21029733
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/31612892
has title: How to send email with servlet?
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
has body: I am making a email submit form in html and the email is sent with Microsoft Outlook when user hit "submit". Here is my code: subject: Type your message here: This is a email testing. Send How do I make change so that the email is directory sent from webpage (or JSP to be exact) to my gmail without going through Outlook? I also try to add input field for sender's email address and name in the above form. I know I need to have a servlet for this to work. I use java 7 and tomcat 7.0. I appreciate if someone could help me.
type: Question
linked to: http://stackoverflow.com/q/3757442

http://stackoverflow.com/q/21084755
has comment: http://stackoverflow.com/comment/31713901
type: UnansweredQuestion
score: 0
has title: how to display 3 arraylist's in a jsp?
has answer: http://stackoverflow.com/a/21084827
tagged with: foreach
tagged with: java
has body: i have to display 3 array lists in a table.. the arraylists are forwarded from a servlet. the value s coming to the jsp. as if we display one array list alone the prg is woking but to display 3 array lists is a problem. <c:forEach var="auctionDO" items="${auctionDOListServlet}"> <c:out value="${auctionDO.auctionName}"/> <c:out value="${auctionDO.endDate}"/> <c:out value="${auctionDO.status}"/> <c:out value="${depotDo.depotName}"/> <c:out value="${userAuctionRelDo.bidAmt}"/> </c:forEach> as auctionDOListServlet is provided in foreach its displaying correctly.. the depotDO and userAuctionRelDO is not being displayed.. how do i display the other 2 arraylists?? the arraylists are passed from servlet as follows request.setAttribute("auctionDOListServlet", auctionDOListServlet); request.setAttribute("depotDOListServlet", depotDOListServlet); request.setAttribute("userAuctionRelDOListServlet", userAuctionRelDOListServlet); i have combined the three list into 1 list megaList.addAll(auctionDOListServlet); megaList.addAll(depotDOListServlet); megaList.addAll(userAuctionRelDOListServlet); now how do i display this in for each?? would this work? where mega is the name of the variable?? <c:out value="${mega.endDate}"/> this now hows errors for depot name and bidamt as they are in a totally different DO.. wat to do??
tagged with: servlets
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21084953
tagged with: jsp
tagged with: arraylist

http://stackoverflow.com/comment/31682168
type: QuestionComment
has text: The user running the game on his PC, lets say it's a window application. ofcourse it uses internet network to communicate with the server. @MarcB Is there absolutely no way to any CPU serial number? no MAC address? OS serial?
comment on: http://stackoverflow.com/q/21067624
score: 0
type: Comment

http://stackoverflow.com/comment/31672804
type: Comment
comment on: http://stackoverflow.com/q/21062625
has text: Either you write the code or you find a tool (there must be several, because JSON kits do this) to use reflections to extract the fields. (But, of course, in general there should no need to Mapify your object to pass it to another class -- the class just needs to know what to do with it.)
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31856551
has text: The question was how to check for null, not how to check if it is empty or null. If the latter is required, then your additions are needed. As the question is posed however, my answer does exactly that.
comment on: http://stackoverflow.com/a/21019616
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21150207
type: AnsweredQuestion
tagged with: java
type: Question
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31834324
has answer: http://stackoverflow.com/a/21150546
has body: I have tried hunting down the answer to this question for some days, but it's really not explained anywhere, and it's hard to make an experiment to determine the answer. Look at the documentation for this function: http://developer.android.com/reference/android/opengl/GLES20.html#glUniformMatrix4fv%28int,%20int,%20boolean,%20float[],%20int%29 pretty exhaustive, right? Sarcasm aside, what is offset good for in: glUniformMatrix4fv (int location, int count, boolean transpose, float[] value, int offset) I was thinking that if value[] holds for example 4 matrixes, ie a float[4*4*4] array, the offset determines which following 16 floats that will be uploaded to the GPU. So if value is: { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } and i call the function like so: GLES20.glUniformMatrix4fv(location, 1, false, values, 16); the identity matrix would be uploaded to the GPU on the specified uniform location? I've browsed really much and tried to find source code to determine if this is the case, but alas. I'm sorry for asking a question that SHOULD be covered by an API specification, but it's not.
tagged with: android
score: 1
has comment: http://stackoverflow.com/comment/31841813
tagged with: opengl-es
favorite count: 0
accepted answer: http://stackoverflow.com/a/21150546
has title: What is the final parameter for this function good for?
upvote count: 1

http://stackoverflow.com/comment/31673573
type: Comment
comment on: http://stackoverflow.com/q/21063077
type: QuestionComment
has text: Consider showing more -- how you're creating your entities to be sorted, how you're calling the sort, the stack trace, etc...
score: 0

http://stackoverflow.com/comment/31676790
has text: have a look at these http://stackoverflow.com/questions/995944/ssh-library-for-java
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21064854

http://stackoverflow.com/comment/31681892
comment on: http://stackoverflow.com/a/21067217
type: AnswerComment
has text: I would investigate [Key Bindings](http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html) and understand [Concurrency in Swing](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/) - for [example](http://stackoverflow.com/questions/19374866/yet-another-keylistener-keybinding-issue/19375052#19375052)
type: Comment
score: 2

http://stackoverflow.com/comment/31650402
type: Comment
type: QuestionComment
has text: Do you want o store the 'row' and 'col' positions where his condition happens?
comment on: http://stackoverflow.com/q/21050626
score: 0

http://stackoverflow.com/q/21179556
answer count: 2
upvote count: 0
has title: How to Decode a URL using Java in Android?
linked to: http://stackoverflow.com/q/3286067
favorite count: 0
has body: I am newbie in android, i have this url now i need to encode this url: the url that has to be encoded. With Reference of downloading apk in Mobile using Java how can i pass this url to this Line : updateAppInstance.execute("http://demo.ingresssolutions.com/proposalmanagement/services/user/getApkFile"); Previous post Regarding Apk Download http://demo.ingresssolutions.com/proposalmanagement/services/user/uploadFile
type: UnansweredQuestion
tagged with: android
duplicate of: http://stackoverflow.com/q/3286067
score: -1
tagged with: parsing
has answer: http://stackoverflow.com/a/21179637
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/21159636
tagged with: java
has answer: http://stackoverflow.com/a/21179699

http://stackoverflow.com/comment/31830950
has text: since you are trying to catch it in a subclass object namely Axception a1, it wont be caught.-- meaning it wont execute { System.out.println("D"); throw a1; }
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21146180
type: AnswerComment

http://stackoverflow.com/comment/31762672
comment on: http://stackoverflow.com/q/21111589
has text: So page 1 is correct, but page 2 and 3 (etc.) are just duplicates of page 1?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31867222
has text: I don't understand exactly what you want to do, but I'm not sure you do either.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21168637

http://stackoverflow.com/comment/31746049
comment on: http://stackoverflow.com/a/21101409
type: Comment
score: 1
type: AnswerComment
has text: If i understand your code correctly, you assign stringLine with the value of the buffered reader method inside your while loop. Instead of this, assign this outside (above) the while loop: "stringLine = br.readLine(arguments here);" .... then do "if (stringLine != null) { loop here or other code }". I hope this is clear and suitable to your needs. :)

http://stackoverflow.com/comment/31670730
score: 0
has text: please add more codes about how you show the database records its hard to give you solution.post the exact code.
comment on: http://stackoverflow.com/q/21061283
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21115336
type: UnansweredQuestion
tagged with: filepath
tagged with: mysql-workbench
has answer: http://stackoverflow.com/a/21115431
score: 1
tagged with: java
tagged with: file
tagged with: mysql
upvote count: 1
type: Question
answer count: 2
has title: No such file or directory in MySQL SQL script
has body: I have a SQL script that contains the following LOAD DATA LOCAL INFILE '.\\datafiles\\customers.txt' INTO TABLE Customers` I open and run it in MySQL workbench and I get following error: Error Code: 2. File '.\datafiles\customers.txt' not found (Errcode: 2 - No such file or directory) Where should I put file customers.txt according '.\datafiles\customers.txt'? I use windows 7 and I tried the following placse: C:\datafiles C:\temp\datafiles C:\tem\datafiles C:\Users\michael\datafiles
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21115545

http://stackoverflow.com/comment/31833578
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21149107
has text: Can you post logcat output? It's better to find where is the error :)
type: AnswerComment

http://stackoverflow.com/q/21076087
score: 0
tagged with: android
has body: public class MainActivity extends ActionBarActivity { private Context cx; private int pageNumber=0; private void populateList() { AsyncHttpClient client = new AsyncHttpClient(); RequestParams paras = new RequestParams(); paras.put("page",this.pageNumber+1); ............ } private Button.OnClickListener loadMoreButtonOnClick = new Button.OnClickListener(){ public void onClick(View v){ AsyncHttpClient client = new AsyncHttpClient(); RequestParams paras = new RequestParams(); paras.put("page",this.pageNumber+1); //can't resolve symbol "pageNumnber" client.get("http://APIAddressHere",paras,new AsyncHttpResponseHandler(){ @Override public void onSuccess(int statusCode, org.apache.http.Header[] headers, byte[] responseBody){ //it's ok; } @Override public void onFailure(int statusCode, org.apache.http.Header[] headers, byte[] responseBody, Throwable error) { // Response failed :( } }); } }; } In the second function(loadMoreButtonOnClick), where I have commented, the IDE throws a error which seems that I can't access the variable(private int pageNumber) which I have created there. But I can access pageNumber in the populateList() function, why I can't access it in the loadMoreButtonOnClick(), is that means that I'm already in a different context? The System is: JDK 6, Android Studio 0.4.2, my project is from API 9 to API 18 I'm new to Java. So my Questions are: 1. Why? 2. How to solve it?
has answer: http://stackoverflow.com/a/21076123
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/21076123
tagged with: variables
has title: Why I can't use the variable in a JAVA method?
tagged with: scope

http://stackoverflow.com/q/21080139
has comment: http://stackoverflow.com/comment/31740767
answer count: 0
tagged with: lwjgl
has comment: http://stackoverflow.com/comment/31708310
type: Question
has comment: http://stackoverflow.com/comment/31708562
has title: glPolygonOffset with unexpected lines
tagged with: opengl
tagged with: java
has comment: http://stackoverflow.com/comment/31705389
has comment: http://stackoverflow.com/comment/31708622
score: 0
has comment: http://stackoverflow.com/comment/31709025
has body: I am rendering triangle strips with glpolygonMode(GL_FRONT_AND_BACK, GL_LINE). Then I enable the line offset to this setting glPolygonOffset (-0.8f, -1.0f). No matter what setting I use for the offset I end up getting random lines that flash in and out when moving around. Here is a gif. of what it looks like. If anyone could help give ideas as what they think is wrong here that would be great. Here is my method where I render the lines if anyone needs to look at it. public void lines() { GL11.glColor3f(0.0f, 0.0f, 0.0f); GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); Triangle currentTri = new Triangle(); List&lt;Triangle&gt; triList = new ArrayList&lt;Triangle&gt;(); boolean xSwitch = false; for (int z=0; z&lt;=100; z+=2) { GL11.glEnable(GL11.GL_POLYGON_OFFSET_LINE); GL11.glPolygonOffset (-0.8f, -1.0f); GL11.glBegin(GL11.GL_TRIANGLE_STRIP); int triPointIndex = 0; boolean zSwitch = true; xSwitch = !xSwitch; float zVal; float xVal; for (int x=0; x&lt;100; x+=1) { xVal = x; float randY; zSwitch = !zSwitch; // this is what determines the xSwitch and zSwitch outcomes. // changes the zVal and randY to match what must alternate. if (xSwitch) { if (zSwitch) { zVal = z; randY = randYList[z][x]; } else { zVal = z + 2.0f; randY = randYList[z+2][x]; } } else { if (zSwitch) { zVal = z + 2.0f; randY = randYList[z+2][x]; } else { zVal = z; randY = randYList[z][x]; } } // set up the currentVert within the currentTri so that we can use it for computing normals. Vert currentVert = currentTri.triVerts[triPointIndex]; currentVert.x = xVal; currentVert.y = randY; currentVert.z = zVal; triPointIndex++; if (triPointIndex == 3) { triList.add(currentTri); Triangle nextTri = new Triangle(); Vector3f normal = new Vector3f(); float Ux; float Uy; float Uz; float Vx; float Vy; float Vz; if (xSwitch) { if (triList.indexOf(currentTri) % 2 == 0) { Vx = currentTri.triVerts[1].x - currentTri.triVerts[0].x; Vy = currentTri.triVerts[1].y - currentTri.triVerts[0].y; Vz = currentTri.triVerts[1…
type: UnansweredQuestion

http://stackoverflow.com/q/21110285
accepted answer: http://stackoverflow.com/a/21114041
has comment: http://stackoverflow.com/comment/31761936
linked to: http://stackoverflow.com/q/9718305
tagged with: spring
has title: Spring 3.x and hibernate 4.x transaction management issue using @Transactional
tagged with: spring-mvc
type: AnsweredQuestion
has body: I'm using Spring 3.0 and hibernate 4.x, but I'm facing issue on transaction management. I'm using @Transactional annotation in service layer but it is taking too long time to save large amount of data into Database. here is my transaction manager: &lt;tx:annotation-driven /&gt; &lt;bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt; &lt;property name="sessionFactory" ref="sessionFactory" /&gt; &lt;/bean&gt; And I'm using this line of code to insert data: sessionFactory.getCurrentSession().save(deal); Please if anybody has the solution, help me out.
type: Question
has comment: http://stackoverflow.com/comment/31763701
tagged with: transactions
tagged with: java
tagged with: hibernate
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31760652
has comment: http://stackoverflow.com/comment/31760740
has answer: http://stackoverflow.com/a/21114041

http://stackoverflow.com/q/21040316
has comment: http://stackoverflow.com/comment/31631707
has comment: http://stackoverflow.com/comment/31631681
score: 0
has body: I want to search a text with space and partial matching in elasticsearch. I created the field as non_analysed but its working for full text match only (With term): POST /customertype/_search { "query": { "bool": { "must": [ { "term": { "customerTypeName.untouched": "New customer" } } ] } } } How can I search a text partially (e.g. "New Cust") with space in elasticsearch.
tagged with: elasticsearch
has title: Partial Search text with space in elasticsearch
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31632471
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/31631785

http://stackoverflow.com/q/21043754
has title: Spring AMQP Integration - Consumer Manual Acknowledgement
downvote count: 0
has answer: http://stackoverflow.com/a/21045411
favorite count: 0
has answer: http://stackoverflow.com/a/21045594
accepted answer: http://stackoverflow.com/a/21045594
tagged with: rabbitmq
tagged with: spring-rabbit
type: AnsweredQuestion
tagged with: spring-integration
tagged with: java
possible better answer: http://stackoverflow.com/a/21045411
type: Question
upvote count: 4
tagged with: spring-amqp
has body: I am testing Spring-AMQP with Spring-Integration support, I've following configuration and test: &lt;rabbit:connection-factory id="connectionFactory" /&gt; &lt;rabbit:queue name="durableQ"/&gt; &lt;int:channel id="consumingChannel"&gt; &lt;int:queue capacity="2"/&gt; &lt;!-- Message get Acked as-soon-as filled in Q --&gt; &lt;/int:channel&gt; &lt;int-amqp:inbound-channel-adapter channel="consumingChannel" queue-names="durableQ" connection-factory="connectionFactory" concurrent-consumers="1" acknowledge-mode="AUTO" /&gt; public static void main(String[] args) { System.out.println("Starting consumer with integration.."); AbstractApplicationContext context = new ClassPathXmlApplicationContext( "classpath:META-INF/spring/integration/spring-integration-context-consumer.xml"); PollableChannel consumingChannel = context.getBean("consumingChannel", PollableChannel.class); int count = 0; while (true) { Message&lt;?&gt; msg = consumingChannel.receive(1000); System.out.println((count++) + " \t -&gt; " + msg); try { //sleep to check number of messages in queue Thread.sleep(50000); } catch (InterruptedException e) { e.printStackTrace(); } } } In this configuration it was evident that as soon as message arrives at consumingChannel they are Acked and hence removed from queue. I validated this by placing a high sleep after receive and check queue-size. There are no further control on it. Now if I set acknowledge-mode=MANUAL, there are no ways seems to do manual ack via spring integration. My need is to process message and after processing do a manual-ack so till ack message remains persisted at durableQ. Is there any way to handle MANUAL ack with spring-amqp-integration? I want to avoid passing ChannelAwareMessageListener to inbound-channel-adapter since I want to have control of consumer's receive. Update: It even doesn't seems to be possible when using own listener-container with inbound-channel-adapter: // Below creates a default direct-channel (spring-integration channel) named…
score: 4
answer count: 2

http://stackoverflow.com/comment/31968433
has text: Shandbhag thank you. It seems to have resolved the issue. However, when I've encountered another error, which involves the remote user rights issue when the job has to write/delete files on the HDFS. I've edited the portion of the code which calls the 'runHadoopJob' method with the UserGroupInformation class but can't seem to get it to work. Can you help me identify where i've implemented wrongly? Thank you
type: AnswerComment
comment on: http://stackoverflow.com/a/21180343
score: 0
type: Comment

http://stackoverflow.com/comment/31711857
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21083484
type: AnswerComment
has text: Your point is valid, but I guess he was probably referring to developer as the (API's) user :)

http://stackoverflow.com/comment/31751593
type: AnswerComment
type: Comment
has text: PNG, but shouldn't make a difference as they are abstracted as `BufferedImage`
comment on: http://stackoverflow.com/a/21104553
score: 0

http://stackoverflow.com/comment/39504917
has text: Acknowledging @matiash - I just realised that I did not have that idea re. simple vs. complicated activities myself, but that I'd read it above.
comment on: http://stackoverflow.com/a/24615475
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31639419
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21026610
has text: @Lestat It just seems like additional work, downloading and replacing jars, and they can potentially have more bugs, so I have a habit of using only stable releases. Unless of course there is some significant benefit to using nightlies, and having some non-critical functionality a few month earlier is currently not enough for me :)

port
tags question: http://stackoverflow.com/q/21102073
tags question: http://stackoverflow.com/q/21039228
type: Tag
tags question: http://stackoverflow.com/q/21172927
tags question: http://stackoverflow.com/q/21141485
tags question: http://stackoverflow.com/q/21083170
tag name: port

http://stackoverflow.com/a/21119910
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21119538
score: 1
has body: I'm guessing you use some libraries for your project. If you export a jar from Eclipse, it doesn't package those libraries into that jar automatically. As an easy way out you coul'd use the Fat Jar Plugin. It worked fine for me in the past. Ultimately you want to use a build and dependency management tool like Maven.
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21119538

http://stackoverflow.com/a/21182680
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21182572
upvote count: 1
score: 1
has body: No we should not. It makes the code a lot harder to read and in most cases (for example your example) it does absolutely nothing, as GC will start after the scope anyways. In general we should let Java handle its Garbage Collection and should not try to make it more efficient by writing strange code.

youtube-api
tags question: http://stackoverflow.com/q/21103048
tags question: http://stackoverflow.com/q/21165207
type: Tag
tag name: youtube-api
tags question: http://stackoverflow.com/q/21057358
tags question: http://stackoverflow.com/q/21176432

http://stackoverflow.com/comment/31891013
type: Comment
score: 2
has text: It means two different classes can have same **serialVersionUID** value.
comment on: http://stackoverflow.com/a/21182084
type: AnswerComment

http://stackoverflow.com/q/21153987
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21154204
score: 0
has answer: http://stackoverflow.com/a/21154061
upvote count: 1
tagged with: android
downvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: facebook
has body: I am fetching images from Facebook and writing them to SD card, but the image quality is very low. Following is my code to fetch and write: try { URL url = new URL(murl); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoInput(true); connection.connect(); InputStream input = connection.getInputStream(); Bitmap myBitmap = BitmapFactory.decodeStream(input); data1 = String.valueOf(String.format(getActivity().getApplicationContext().getFilesDir()+"/Rem/%d.jpg",System.currentTimeMillis())); FileOutputStream stream = new FileOutputStream(data1); ByteArrayOutputStream outstream = new ByteArrayOutputStream(); myBitmap.compress(Bitmap.CompressFormat.JPEG, 100, outstream); byte[] byteArray = outstream.toByteArray(); stream.write(byteArray); stream.close(); } catch (Exception e) { e.printStackTrace(); } The following code I use to display the same image: File IMG_FILE = new File(IMAGE_CONTENT); B2.setVisibility(View.INVISIBLE); Options options = new BitmapFactory.Options(); options.inScaled = false; options.inDither = false; options.inPreferredConfig = Bitmap.Config.ARGB_8888; Bitmap bitmap = BitmapFactory.decodeFile(IMG_FILE.getAbsolutePath(),options); iM.setImageBitmap(bitmap); The quality is still low even after using Options. What can be done to improve this?
tagged with: java
has title: Image quality very low when images fetched from Facebook and written to SD.
tagged with: image

http://stackoverflow.com/q/21094973
type: UnansweredQuestion
has title: How to convert HashMap to own type array?
has body: I have my hash map of type: private HashMap&lt;String, HashMapObject&gt; likesYearHashMap; where HashMapObject : public class HashMapObject { private int count; private String id; public HashMapObject(int count, String id) { super(); this.count = count; this.id = id; } } how to convert values into my HashMap to HashMapObject [] array? I get error of cast getting likesYearHashMap.values();
has answer: http://stackoverflow.com/a/21095300
tagged with: java
has comment: http://stackoverflow.com/comment/31732182
has answer: http://stackoverflow.com/a/21095016
has answer: http://stackoverflow.com/a/21095014
type: Question
tagged with: hashmap
score: 0
answer count: 3

http://stackoverflow.com/comment/31858273
type: QuestionComment
has text: Peter Lawrey this is about S3, an object storage service. It has nothing to do with OSes.
comment on: http://stackoverflow.com/q/21159889
score: 0
type: Comment

http://stackoverflow.com/q/21041645
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21134315
tagged with: mule
tagged with: ssl
tagged with: ubuntu
has answer: http://stackoverflow.com/a/21134315
upvote count: 1
answer count: 1
has title: Why does Mule-ESB in an Ubuntu environment not use the default Java key store?
favorite count: 0
has comment: http://stackoverflow.com/comment/31717292
has body: This question may be Java related or it may be Mule related. I just don't know, which is why I'm asking it under both tags. My problem is this: I develop Mule applications using Mule Studio (although I do most of my configuring through XML, it's just more powerful). Until recently, we used a Windows environment to host applications. So whatever worked on my development machine worked on the server. However, we recently switched from a Windows to an Ubuntu server environment. When I started migrating my Mule applications I noticed that it simply refused to connect to any endpoint over the HTTPS protocol. A little research showed that the following exception occured: subject/issuer name chaining check failed (java.security.cert.CertPathValidatorException) So a certificate problem. It shouldn't occur, because the endpoint uses a valid certificate signed by VeriSign. Futhermore, it never occured in the Windows environment. A little trial and error showed that not a single certificate was being accepted by Mule. That would seem to point at Mule or Java since it doesn't seem to be able to use any of the default certificates. I managed to fix it by creating a key store containing all certificates and having my HTTPS connector reference that, but it means changing all my applications and having to scrape together every single certificate. So my question is twofold: Why can't Java/Mule use the default key store? How do I fix it? EDIT + ANSWER: I've fixed it. It seems to have been my own mistake. I installed Java 1.6 after I installed Java 1.7. This seemed to have rolled my cacerts back to some ancient version which the system was unable to update. When I installed Java 1.6 and installed Java 1.7 after that, the most recent version got installed.
has comment: http://stackoverflow.com/comment/31742405
has comment: http://stackoverflow.com/comment/31658746
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/31759234
score: 1

http://stackoverflow.com/q/21045669
has comment: http://stackoverflow.com/comment/31641041
has comment: http://stackoverflow.com/comment/38101899
has answer: http://stackoverflow.com/a/21052923
has comment: http://stackoverflow.com/comment/31678891
has answer: http://stackoverflow.com/a/21052786
has comment: http://stackoverflow.com/comment/31679425
linked to: http://stackoverflow.com/q/5433579
has comment: http://stackoverflow.com/comment/38101576
score: 0
linked to: http://stackoverflow.com/q/17123703
linked to: http://stackoverflow.com/q/9303532
linked to: http://stackoverflow.com/q/13032766
linked to: http://stackoverflow.com/q/10217844
has title: Is setting of copies from immutables safe from thread corruption?
answer count: 4
tagged with: c++
linked to: http://stackoverflow.com/q/3463658
has comment: http://stackoverflow.com/comment/38101884
tagged with: scala
type: UnansweredQuestion
has body: Here is a class field, class someClass { Int someClassField = nil ... (please, please(!) ignore issues of visibility, this question is concerned wih overall design, not language implementation) If I look online at tutorials, I am told this field is safe to use by multiple threads. When the tutorials say safe, they do not mean that one thread can not interfere with the value visible to another. Such interference may be the intention - the field may be a counter. What the tutorials mean is, when one thread changes this field, the field will not be left in an unsafe state. Take this field, class someClass { List&lt;List&gt; someClassField = new List&lt;Int&gt;() ... As I understand, if the field is a simple list, one thread could leave it in an inconsistent state (i.e. partially disconnected). If another thread uses the list it will fail - in a language like C this would be a disaster. Even reading could fail. Well then, the class used on the field could be asked to copy out it's state (the copying could be extended to a full defence of immutability, but I'm keeping the discussion simple). If the class copies out it's state, then modifications are done away from the copy on the field, in a new copy modified for return. This new, modified copy can be reassigned to the field. But is that assignment threadsafe - in the sense that the value of the field can not be in an inconsistent state - because the allocation of the reference of the new object to the field is atomic? I'm ignoring all issues of wether a language engine might reorder, cache etc. See the many posts below (Java especially, it seems), c# question has hints Rule of thumb answers in Scala, but seems to muddle linear synchronisation with outright disaster? Dark information on Java's thread visibility issue. One post suggests, yes, reference writing is atomic Java question related to this. More of the same Java confusion between visibility and objects being unformed immutable-objects-are-thread-safe-but-why Jav…
tagged with: multithreading
has answer: http://stackoverflow.com/a/21046473
has comment: http://stackoverflow.com/comment/31677831
linked to: http://stackoverflow.com/q/10675400
type: Question
tagged with: c#
tagged with: java
linked to: http://stackoverflow.com/q/6723760
has answer: http://stackoverflow.com/a/21045754

http://stackoverflow.com/comment/31886572
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21179145
has text: which one JDateChooser, for AWT, GWT, JavaFX, SWT or Swing, by default there is (J)Spinner

http://stackoverflow.com/a/21039700
answers question: http://stackoverflow.com/q/21038706
upvote count: 49
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/133079547
downvote count: 0
score: 49
has body: I don't know how it works exactly in the Java EE, but in Spring, when you specify @PersistenceContext annotation, it injects EntityManager. Where does it get EntityManager? It is wrong to create one EntityManager for the whole application lifetime by calling EntityManagerFactory.createEntityManager(). So instead a special implementation of EntityManager interface is used and instantiated directly. It has an internal mutable thread-local reference to a real EntityManager. Implementations of methods just redirect calls to this real EntityManager. And there is a servlet listener, that before each request obtain EM by calling EMF.createEntityManager() and assign it to that inner reference of special EM. Also this listener manages transactions by calling getTransaction().begin(), .commit() and .rollback() on the real EM. It is very simplified description of performed work. And I believe, that JEE container does the same thing, as Spring does. In general case it is better to inject EntityManager, because with EntityManagerFactory and @PersistenceUnit you should create/destroy EntityManager every time by hands and manage transactions too.
accepted answer of: http://stackoverflow.com/q/21038706

http://stackoverflow.com/comment/31709783
type: AnswerComment
comment on: http://stackoverflow.com/a/21082170
has text: Had to give a -1 just because of the inaccurate information supplied regarding Java naming conventions.
type: Comment
score: 0

http://stackoverflow.com/a/44581156
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21150688
has body: You could use a global @ExceptionHandler with the @ControllerAdvice annotation. Basically, you define which Exception to handle with @ExceptionHandler within the class with @ControllerAdvice annotation, and then you implement what you want to do when that exception is thrown. Like this: @ControllerAdvice(basePackageClasses = RepositoryRestExceptionHandler.class) public class GlobalExceptionHandler { @ExceptionHandler({QueryException.class}) public ResponseEntity<Map<String, String>> yourExceptionHandler(QueryException e) { Map<String, String> response = new HashMap<String, String>(); response.put("message", "Bad Request"); return new ResponseEntity<Map<String, String>>(response, HttpStatus.BAD_REQUEST); //Bad Request example } } See also: https://web.archive.org/web/20170715202138/http://www.ekiras.com/2016/02/how-to-do-exception-handling-in-springboot-rest-application.html
answers question: http://stackoverflow.com/q/21150688
score: 6
type: Answer
downvote count: 0
upvote count: 6

http://stackoverflow.com/q/21083308
answer count: 1
tagged with: classpath
has comment: http://stackoverflow.com/comment/31711761
type: UnansweredQuestion
tagged with: jar
type: Question
has body: I want to be able to execute arbitrary classes in the /bin directory of a jar file without unjarring. I have been able to do this with a jar for Saxon by doing: java -cp saxon9he.jar net.sf.saxon.Query -s:sax-tmp/courses.xml -o:q1.txt q1.xql I honestly don't know why this works though. I can't find documentation of the cp flag and this command pattern hasn't worked for my project.
has title: Execute classes with no entry point from within jar?
has answer: http://stackoverflow.com/a/21083455
score: 0
tagged with: java

http://stackoverflow.com/comment/31888133
type: Comment
has text: What about forcing to stop?
type: AnswerComment
comment on: http://stackoverflow.com/a/21163926
score: 0

http://stackoverflow.com/comment/31679193
comment on: http://stackoverflow.com/a/21066097
has text: Cheers! Ill go with e.getStackTrace()[0].getClassName()
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21081622
has comment: http://stackoverflow.com/comment/31708260
has body: I'm wondering if it's possible to write this in one-liner form. if (config.getBoolean("storecommands.use-time")) { out.println("[" + (new SimpleDateFormat("MM/dd/yy HH:mm:ss")).format(new Date()) + "]: " + e.getMessage()); else { out.println(e.getMessage()); } out.close(); I thought maybe something like this: (config.getBoolean("storecommands.use-time")) ? first : last; but then I remembered that that only works for setting variables. Does anyone know if something like the first block of code can be written in one line w/o brackets, etc.
has comment: http://stackoverflow.com/comment/31708316
type: AnsweredQuestion
score: 0
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/31708122
has comment: http://stackoverflow.com/comment/31708250
has comment: http://stackoverflow.com/comment/31708354
has comment: http://stackoverflow.com/comment/31708098
has comment: http://stackoverflow.com/comment/31708199
type: Question
has comment: http://stackoverflow.com/comment/31708465
has comment: http://stackoverflow.com/comment/31708448
has answer: http://stackoverflow.com/a/21081652
has comment: http://stackoverflow.com/comment/31708335
accepted answer: http://stackoverflow.com/a/21081662
has answer: http://stackoverflow.com/a/21081655
possible better answer: http://stackoverflow.com/a/21081658
has title: Is there a shorter way to write this?
has comment: http://stackoverflow.com/comment/31708383
has answer: http://stackoverflow.com/a/21081658
has comment: http://stackoverflow.com/comment/31708350
favorite count: 0
has comment: http://stackoverflow.com/comment/31708265
upvote count: 2
has comment: http://stackoverflow.com/comment/31708216
answer count: 5
has comment: http://stackoverflow.com/comment/31708087
has comment: http://stackoverflow.com/comment/31708321
has answer: http://stackoverflow.com/a/21081662
has answer: http://stackoverflow.com/a/21081649

http://stackoverflow.com/comment/31776344
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21118831
type: Comment
has text: It pops up in a separate window. I'm using BlueJ if that has something to say...

http://stackoverflow.com/a/21079565
has body: Your control flow seems needlessly convoluted here. In most cases the better approach is to start with the Identity Transform, add templates for each of the cases you want to process, and recursively call &lt;xsl:apply-templates&gt; to select each of the current node's children and style it (and its contents) in turn. Write rules -- general and exceptions -- rather than procedures, whenever possible. Also, you really should take more advantage of literal result attributes, when you don't need to compute an attribute's value. If I'm reading your code correctly, what you wanted is: &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:template match="@*|node()"&gt; &lt;xsl:copy&gt; &lt;xsl:apply-templates select="@*|node()"/&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; &lt;xsl:template match="TLV1"&gt; &lt;div class="TLV1"&gt; &lt;xsl:apply-templates/&gt; &lt;/div&gt; &lt;/xsl:template&gt; &lt;xsl:template match="P"&gt; &lt;div class="P"&gt; &lt;xsl:apply-templates/&gt; &lt;/div&gt; &lt;/xsl:template&gt; &lt;xsl:template match="LK"&gt; &lt;div class="LK"&gt; &lt;xsl:apply-templates/&gt; &lt;/div&gt; &lt;/xsl:template&gt; &lt;xsl:template match="E"&gt; &lt;span class="emph_I"&gt; &lt;xsl:apply-templates/&gt; &lt;/span&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt;
type: Answer
answers question: http://stackoverflow.com/q/21079142
score: 0

http://stackoverflow.com/a/21019899
has comment: http://stackoverflow.com/comment/31594812
score: 3
downvote count: 0
upvote count: 3
has comment: http://stackoverflow.com/comment/31671628
answers question: http://stackoverflow.com/q/21019770
type: Answer
has body: You can pass your arrayList as below snipts. TestFragment testFragment = new TestFragment(); Bundle args = new Bundle(); args.putSerializable("parsedData", (Serializable)mTestModelList); testFragment.setArguments(args); And Get these parcable data in Model as like below: mTestModelList = (List&lt;TestModel&gt;)getArguments().get("parsedData"); YES, Serialisation is slow bit than Parcelable. And you can implement that using parceler Of course, the ParcelWrapper can be added to an Android Bundle to transfer from Activity to Activity using this: Bundle bundle = new Bundle(); bundle.putParcelable("example", Parcels.wrap(example)); And dereferenced in the onCreate() method: Example example = Parcels.unwrap(getIntent().getParcelableExtra("example")); You can get more detail of performance related to Parcelable vs Serializable here.

http://stackoverflow.com/a/21146874
score: 1
answers question: http://stackoverflow.com/q/21146756
upvote count: 1
downvote count: 0
type: Answer
has body: Your file needs to be in the working dir of your runtime JVM. If you are not sure about that, you can do the following : File file = new File("."); System.out.println(file.getAbsolutePath());

http://stackoverflow.com/comment/31703700
type: QuestionComment
has text: Brute force answers to PE questions, especially the early ones, are just a google search away. I don't think there's much to be gained by deleting your brute force solution here, but if you need to edit a post, the "edit" link is below the tags, which are below the question itself.
comment on: http://stackoverflow.com/q/21077678
score: 0
type: Comment

http://stackoverflow.com/a/21047435
answers question: http://stackoverflow.com/q/21047362
has body: import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.Toast; public class RadioButtonExample extends Activity { private RadioGroup radioSexGroup; private RadioButton radioSexButton; private Button btnDisplay; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_radio_button_example); addListenerOnButton(); } public void addListenerOnButton() { radioSexGroup = (RadioGroup) findViewById(R.id.radioGender); btnDisplay = (Button) findViewById(R.id.btnDisplay); btnDisplay.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // get selected radio button from radioGroup int selectedId = radioSexGroup.getCheckedRadioButtonId(); // find the radiobutton by returned id radioSexButton = (RadioButton) findViewById(selectedId); Toast.makeText(RadioButtonExample.this, radioSexButton.getText(), Toast.LENGTH_SHORT).show(); } }); } }
score: 0
has comment: http://stackoverflow.com/comment/31644260
type: Answer

http://stackoverflow.com/comment/31798625
type: Comment
has text: anish, this we give in phonegap. This works perfectly if the webview is cordova webview. But I forgot to mention that this xmlhttp request is done from child browser plugin for cordova
comment on: http://stackoverflow.com/a/21129467
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31829784
comment on: http://stackoverflow.com/q/21147951
has text: or use `Fragments`...
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/21036049
type: Question
has body: I'm having trouble understanding how to start the first index of array from the bottom to to the top of a multidimensional array. Here's what I've tried to initialize my array from bottom to top (in 2d array table format): for(int row = arrayName.length - 1; row &gt; 0; row--) { for(int col = 0; col &lt; arrayName.length; col++) { arrayName[row][col] = ' '; } } or for(int row = arrayName.length - 1; row &gt; 0; row--) { for(int col = arrayName.length - 1; col &lt; 0; col--) { arrayName[row][col] = ' '; } } i mean..when i run the program, the array always store my values from top to bottom, the opposite of what i wanted it to do. Please help! thanks in advance.
tagged with: arrays
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21036135
favorite count: 0
tagged with: multidimensional-array
possible better answer: http://stackoverflow.com/a/21036130
type: AnsweredQuestion
has title: Decrements a multidimensional array in java
has comment: http://stackoverflow.com/comment/31624771
has answer: http://stackoverflow.com/a/21036130
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/21036135
downvote count: 1

http://stackoverflow.com/a/21100414
has body: If you really want to avoid looping through the entries of the Multiset, you can create a view of it as a Map: public class MultisetMapView&lt;E&gt; implements Map&lt;E, Integer&gt; { private Multiset&lt;E&gt; delegate; public MultisetMapView(Multiset&lt;E&gt; delegate) { this.delegate = delegate; } public int size() { return delegate.size(); } public boolean isEmpty() { return delegate.isEmpty(); } public boolean containsKey(Object key) { return delegate.contains(key); } public boolean containsValue(Object value) { throw new UnsupportedOperationException(); } public Integer get(Object key) { return delegate.count(key); } public Integer put(E key, Integer value) { return delegate.setCount(key, value); } public Integer remove(Object key) { int count = delegate.count(key); delegate.remove(key); return count; } public void putAll(Map&lt;? extends E, ? extends Integer&gt; m) { for (Entry&lt;? extends E, ? extends Integer&gt; entry : m.entrySet()) { delegate.setCount(entry.getKey(), entry.getValue()); } } public void clear() { delegate.clear(); } public Set&lt;E&gt; keySet() { return delegate.elementSet(); } public Collection&lt;Integer&gt; values() { throw new UnsupportedOperationException(); } public Set&lt;java.util.Map.Entry&lt;E, Integer&gt;&gt; entrySet() { Set&lt;java.util.Map.Entry&lt;E, Integer&gt;&gt; entrySet = Sets.newHashSet(); for (E e : delegate) { delegate.count(e); entrySet.add(Maps.immutableEntry(e, delegate.count(e))); } return entrySet; } } In my implementation, I declined to implement the containsValue and values methods, as these are not useful in the context. If desired, these could be implemented by looping through the entries and inspecting the count of the elements encountered. And again, you can see this working in this JUnit case: @Test public void testConvert() { HashMultiset&lt;String&gt; hashMultiset = HashMultiset.create(); hashMultiset.add("a"); hashMultiset.add("a"); hashMultiset.add("a"); hashMultiset.add("b"); hashMultiset.add("c"); Ma…
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21094045
upvote count: 1

http://stackoverflow.com/a/21147868
answers question: http://stackoverflow.com/q/21147813
has body: int exit = 0; String item = null; do { System.out.println("Enter item number: "); item = input.next(); if (ValidateItem(item) == true){ if (Integer.parseInt(item) &lt;=4 &amp;&amp; Integer.parseInt(item) &gt;=1){ exit = 1;} else System.out.println("Enter an item number between 1 and 4"); } if (ValidateItem(item) == false){ System.out.println("Enter an item number between 1 and 4");} } while (exit == 0); int exitQuan = 0; do { System.out.println("Enter quantity (1-99): "); String quant = input.next(); if (ValidateItem(quant) == true){ exitQuan = 1;} else System.out.println("Enter a quantity between 1 and 99"); } while (exitQuan == 0);
score: 0
type: Answer

http://stackoverflow.com/a/21092177
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31727426
has comment: http://stackoverflow.com/comment/31728229
accepted answer of: http://stackoverflow.com/q/21091882
answers question: http://stackoverflow.com/q/21091882
has body: You can do that with replaceEach() from StringUtils: http://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/StringUtils.html#replaceEach(java.lang.String, java.lang.String[], java.lang.String[]) StringUtils.replaceEach("abcde", new String[]{"ab", "d"}, new String[]{"w", "t"}) = "wcte"

http://stackoverflow.com/q/21106574
tagged with: equivalent
favorite count: 0
has answer: http://stackoverflow.com/a/21106698
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31754321
has body: I am converting some C code into Java which includes image processing. However, I am stuck in a situation where I have to convert some lines of codes which include pointer calculations: for(i=xMin[k];i&lt;=xMax[k];i++) { for(j=yMin[k];j&lt;=yMax[k];j++) { if (Bimg[i][j]== k1) { /* accessing single channel for r g b value */ b = data[i*step + j*channels + 0]; g = data[i*step + j*channels + 1]; r = data[i*step + j*channels + 2]; } } } Can anybody please tell me how to convert this "data" pointer into java equivalent? Here, "data" is a pointer variable.
has answer: http://stackoverflow.com/a/21106702
tagged with: java
upvote count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/13716041
type: Question
answer count: 2
tagged with: http://stackoverflow.com/tag/c
tagged with: pointers
score: 0
has title: How to convert C code to Java - Pointer equivalent in Java

http://stackoverflow.com/q/21122275
has body: public class Test { public static abstract class Node { private Node kid; public abstract int getN(); public Node(Node kid) { this.kid = kid; } public final Node copyWithNewChild(Node newKid) { return new Node(newKid) { public int getN() { return Node.this.getN(); //**** } }; } } } As you can see, I have this base class called Node, with a method getN() to be overriden by sub-classes. Suppose I have a class called RedNode extending Node and providing a concrete implementation for getN(), and that I also have another class called SquareRedNode extending RedNodeand also providing an implementation for getN(). (And certainly, something else could also extend SquareRedNode (ie., the family tree could grow infinitely)) Now question, how does the compiler figure out which getN() to call when the copyWithNewChild() is executed? (I'm not asking "what" implementation is being picked, which I can easily figure out by compiling/executing the code. I want to know how it is done.) Thanks,
has comment: http://stackoverflow.com/comment/31782832
duplicate of: http://stackoverflow.com/q/4254424
duplicate of: http://stackoverflow.com/q/21121256
upvote count: 1
has title: How does the compiler pick the right overriden method
type: Question
has comment: http://stackoverflow.com/comment/31782831
tagged with: java
tagged with: overriding
has comment: http://stackoverflow.com/comment/31782873
answer count: 1
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21122390
linked to: http://stackoverflow.com/q/4254424
linked to: http://stackoverflow.com/q/21121256

http://stackoverflow.com/a/21019110
score: 3
accepted answer of: http://stackoverflow.com/q/21018923
has body: &amp;le; is a single symbol that in meaning might be equivalent to &lt;=, however it is not the same (it is &le;). You need to use &amp;lt;= instead.
answers question: http://stackoverflow.com/q/21018923
upvote count: 3
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/q/21071445
has comment: http://stackoverflow.com/comment/31689196
tagged with: java
has comment: http://stackoverflow.com/comment/31689221
tagged with: nodes
type: Question
has answer: http://stackoverflow.com/a/21071669
upvote count: 0
downvote count: 5
has answer: http://stackoverflow.com/a/21071549
has comment: http://stackoverflow.com/comment/31689183
answer count: 2
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/31689292
has comment: http://stackoverflow.com/comment/31689278
has comment: http://stackoverflow.com/comment/31689468
has comment: http://stackoverflow.com/comment/31689212
favorite count: 0
has comment: http://stackoverflow.com/comment/31689274
type: UnansweredQuestion
has body: this is just a silly question, why the hell i get exception when deleting an element... i just saw this code in my classmate and when i run the code and chooses DELETE i get NULLPOINTEREXCEPTION by the way heres the code....(where i get the error) if(!(head.data).equals(del)) { tail=head; Node temp=head.next; while(temp!=null) { if((temp.data).equals(del)) { tail.next=temp.next; size--; break; } tail=temp; temp=temp.next; } } else { head=head.next; } } else { System.out.println("LinkedList is empty"); } break; and i'm very glad if someone can help me with this.... full code. import java.io.*; import java.util.LinkedList; public class Main { public static void main(String[]args) throws Exception { BufferedReader x = new BufferedReader(new InputStreamReader(System.in)); LinkedList&lt;String&gt; list = new LinkedList&lt;&gt;(); list.add("Jarn"); list.add("Zhai"); System.out.println("List:.."); //System.out.println(); System.out.println(list); System.out.println(); String ch,in,fi,del; boolean kita = false; int size=0,data; Node head=null, tail=head; do { System.out.println("Choose Option.\n1-Insert\n2-Delete\n3-Dispay\n4-Find\n5-Quit"); System.out.println(); System.out.println("Choice: "); ch=x.readLine(); System.out.println(); switch (ch) { case "1": System.out.println("Enter Name you Want to Insert.."); in=x.readLine(); list.addLast(in); System.out.println("Name "+in+" was successfully inserted.."); System.out.println(); break; case "2": if(size&gt;=0) { System.out.println("Enter name to del.."); del=x.readLine(); if(!(head.data).equals(del)) { tail=head; Node temp=head.next; while(temp!=null) { if((temp.data).equals(del)) { tail.next=temp.next; size--; break; } tail=temp; temp=temp.next; } } else { head=head.next; } } else { System.out.println("LinkedList is empty"); } break; case "3": System.out.println("List.."); System.out.println(); System.out.println(list); break; case "4": System.out.println("Enter name You Want to Find.."); fi=x.readLine(); while(size!=(list.…
tagged with: singly-linked-list
score: -5
tagged with: linked-list
has title: NullPointer Exception in LinkedList

http://stackoverflow.com/a/21147503
has comment: http://stackoverflow.com/comment/31843019
has body: I would write it to the socket in binary: Assuming a class with one String and one byte[]. The String The length of the String is written with DataOutputStream.writeInt(int) (or methods for smaller integers) and then OutputStream.write(byte[]) on the return value of String.getBytes(String) with the charset explicitly specified. The byte[] The length is written with DataOutputStream.writeInt(int) (or methods for smaller integers) and then OutputStream.write(byte[]) for the byte[] to transfer. On the other side you would do the exact opposite of this procedure. I chose this binary approach over JSON because even though you could transmit the byte[] with JSON almost as efficiently as in binary, it would defeat the very purpose of JSON: being human-readable.
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21145089
type: Answer
has comment: http://stackoverflow.com/comment/31834971
has comment: http://stackoverflow.com/comment/31831654
answers question: http://stackoverflow.com/q/21145089
upvote count: 1
has comment: http://stackoverflow.com/comment/31835318

http://stackoverflow.com/q/21132692
accepted answer: http://stackoverflow.com/a/21150650
has title: Java unchecked: unchecked generic array creation for varargs parameter
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21135562
favorite count: 0
has answer: http://stackoverflow.com/a/21150650
possible better answer: http://stackoverflow.com/a/21135562
score: 151
has comment: http://stackoverflow.com/comment/31801465
tagged with: generics
tagged with: variadic-functions
downvote count: 0
has body: I have set Netbeans to show unchecked warnings in my Java code, but I am failing to understand the error on the following lines: private List&lt;String&gt; cocNumbers; private List&lt;String&gt; vatNumbers; private List&lt;String&gt; ibans; private List&lt;String&gt; banks; ... List&lt;List&lt;String&gt;&gt; combinations = Utils.createCombinations(cocNumbers, vatNumbers, ibans); Gives: [unchecked] unchecked generic array creation for varargs parameter of type List&lt;String&gt;[] Method source: /** * Returns a list of all possible combinations of the entered array of lists. * * Example: [["A", "B"], ["0", "1", "2"]] * Returns: [["A", "0"], ["A", "1"], ["A", "2"], ["B", "0"], ["B", "1"], ["B", "2"]] * * @param &lt;T&gt; The type parameter * @param elements An array of lists * @return All possible combinations of the entered lists */ public static &lt;T&gt; List&lt;List&lt;T&gt;&gt; createCombinations(List&lt;T&gt;... elements) { List&lt;List&lt;T&gt;&gt; returnLists = new ArrayList&lt;&gt;(); int[] indices = new int[elements.length]; for (int i = 0; i &lt; indices.length; i++) { indices[i] = 0; } returnLists.add(generateCombination(indices, elements)); while (returnLists.size() &lt; countCombinations(elements)) { gotoNextIndex(indices, elements); returnLists.add(generateCombination(indices, elements)); } return returnLists; } What is exactly going wrong and how would I fix it, as I suppose leaving unchecked warnings in the code is not a good idea? Forgot to mention, but I am using Java 7. Edit: Also I see now that the method has the following: [unchecked] Possible heap pollution from parameterized vararg type List&lt;T&gt; where T is a type-variable: T extends Object declared in method &lt;T&gt;createCombinations(List&lt;T&gt;...)
has comment: http://stackoverflow.com/comment/31801549
type: AnsweredQuestion
tagged with: java
upvote count: 151

http://stackoverflow.com/q/21049527
type: Question
has answer: http://stackoverflow.com/a/21050085
has comment: http://stackoverflow.com/comment/31648516
has comment: http://stackoverflow.com/comment/31648441
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/31648640
has comment: http://stackoverflow.com/comment/31648255
score: -1
has comment: http://stackoverflow.com/comment/31648528
has body: I wanted to first take an integer N followed by N lines where each line has two coordinates x and y. (separated by space). I tried doing it but it is giving NullPointerException. class solution{ class Point{ int x; int y; } public static void main(String[] args) throws IOException { int N; Scanner in = new Scanner(System.in); BufferedReader inp = new BufferedReader (new InputStreamReader(System.in)); N=Integer.parseInt(in.next()); Point[] P = new Point[N]; for(i=0;i&lt;N;i++){ String[] s1 = inp.readLine().split(" "); P[i].x=Integer.parseInt(s1[0]); P[i].y=Integer.parseInt(s1[1]); } } example of input: 4 2 4 5 7 8 9 1 0
has comment: http://stackoverflow.com/comment/31648195
has comment: http://stackoverflow.com/comment/31648272
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/31648709
has comment: http://stackoverflow.com/comment/31648294
has comment: http://stackoverflow.com/comment/31649063
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21050094
tagged with: java
has comment: http://stackoverflow.com/comment/31648417
has title: Reading input separated by space
has comment: http://stackoverflow.com/comment/31648917
downvote count: 1

http://stackoverflow.com/q/21059526
answer count: 0
has comment: http://stackoverflow.com/comment/31667191
has comment: http://stackoverflow.com/comment/31666964
type: UnansweredQuestion
score: 1
tagged with: multithreading
tagged with: swing
has title: Why does my SwingWorker lag/hang?
type: Question
has comment: http://stackoverflow.com/comment/31667381
tagged with: swingworker
tagged with: java
has comment: http://stackoverflow.com/comment/31667483
has comment: http://stackoverflow.com/comment/31667348
upvote count: 1
downvote count: 0
favorite count: 0
has body: I recently looked into the whole SwingWorker thing and I found it quite useful so I decided to try it out but despite what everyone says - it continues to hang my application. Here is my SwingWorker code: final ArrayList&lt;Farm&gt; farmz = dm.loadAll(item); SwingWorker&lt;Boolean, Farm&gt; worker = new SwingWorker&lt;Boolean, Farm&gt;() { @Override protected Boolean doInBackground() throws Exception { for (int i = 0; i &lt; farmz.size(); i++) { publish(farmz.get(i)); } return true; } @Override protected void done() { try { boolean status = get(); if (status) { log.info("Completed loading!"); allModel.fireTableDataChanged(); } else { log.info("Failed to load..."); } } catch (InterruptedException e) { } catch (ExecutionException e) { } } protected void process(List&lt;Farm&gt; frm) { for (Farm farm : frm) { allModel.addRow(farm); } } }; worker.execute(); I think I have followed everything properly but I'm still scratching my head over this one.
has comment: http://stackoverflow.com/comment/31667510
has comment: http://stackoverflow.com/comment/31667343
has comment: http://stackoverflow.com/comment/31667029
has comment: http://stackoverflow.com/comment/31667038

http://stackoverflow.com/comment/31673297
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21062850
has text: @Malharhak: You can't expect polymorpic behavior with static fileds/mathods in Java

binary-search-tree
tags question: http://stackoverflow.com/q/21142847
tags question: http://stackoverflow.com/q/21110932
tags question: http://stackoverflow.com/q/21049953
tags question: http://stackoverflow.com/q/21122855
tags question: http://stackoverflow.com/q/21139851
type: Tag
tags question: http://stackoverflow.com/q/21173541
tag name: binary-search-tree

http://stackoverflow.com/comment/31861278
comment on: http://stackoverflow.com/a/21152911
type: Comment
has text: This got me a step further but please see my comments. I'm passing the string that's being displayed instead of the object. It's still not saving.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21176103
has comment: http://stackoverflow.com/comment/32038303
has comment: http://stackoverflow.com/comment/31880830
tagged with: c++
has comment: http://stackoverflow.com/comment/31880874
has comment: http://stackoverflow.com/comment/31881570
upvote count: 3
accepted answer: http://stackoverflow.com/a/21176292
has body: In Java, when you assign one object to another, the original object isn't copied, it merely clones the reference. So, for example, I'd like it to behave like this Java code: SomeClass x = new SomeClass(); SomeClass y; y = x; // x is not copied, y is simply a (Java) reference to x What I'd like to do is create a C++ class that behaves the same way. The obvious choice is to overload the assignment operator, like so: SomeClass&amp; operator=(const SomeClass&amp; rhs) { this = &amp;rhs; return *this; } Unfortunately, assigning a new location to this is not allowed; the above code won't even compile. Does anyone know of any other way to do this? Also, before you say anything: yes, I know this is absolutely the wrong way to implement an assignment operator. Please, indulge me anyway. EDIT 2: To clarify, here is the C++ code that should behave as in Java: SomeClass x = SomeClass(); // Created on stack SomeClass y; // In C++, same as above; NOT reference or pointer y = x; // x is not copied, y becomes a (C++) reference to x; // original y is destroyed when stack unwinds I DO NOT want to use pointers at all. EDIT: I'm doing this to see if I can change the base address of a C++ object that was passed by reference to a function. If I simply assign another object to the reference variable, it automatically makes a shallow copy, and I don't want that. I want the reference parameter to reference a completely different object. I'm doing this to see how references are implemented by the compiler. If references are syntactic sugar for dereferenced pointers, then outside the function, the base address of the argument object would NOT change. If they are aliases in the symbol table (as in PHP), then it WILL change. (So any solution using pointers is out, since that's my "control" for the test.) Hope that makes sense.
has comment: http://stackoverflow.com/comment/31881137
type: Question
has comment: http://stackoverflow.com/comment/31948392
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/31880872
has comment: http://stackoverflow.com/comment/31880950
has comment: http://stackoverflow.com/comment/31880878
has comment: http://stackoverflow.com/comment/31881148
tagged with: java
tagged with: assignment-operator
has answer: http://stackoverflow.com/a/21176891
has comment: http://stackoverflow.com/comment/31881270
has comment: http://stackoverflow.com/comment/32038831
answer count: 3
possible better answer: http://stackoverflow.com/a/21176202
has comment: http://stackoverflow.com/comment/31881185
has answer: http://stackoverflow.com/a/21176202
downvote count: 0
has title: Overload a C++ assignment operator to behave like Java
has comment: http://stackoverflow.com/comment/31881487
has answer: http://stackoverflow.com/a/21176292
favorite count: 0
has comment: http://stackoverflow.com/comment/31946418
has comment: http://stackoverflow.com/comment/31880813
has comment: http://stackoverflow.com/comment/31880765

http://stackoverflow.com/comment/31693966
type: AnswerComment
type: Comment
has text: You could do that once the Label is visible. Alternatively, you could maybe use a more appropriate container. For example, can't you use a GridPane and center the labels in the cells of the grids with constraints instead of calculating the positions manually?
comment on: http://stackoverflow.com/a/21074069
score: 0

http://stackoverflow.com/a/21028823
type: AcceptedAnswer
downvote count: 0
score: 6
type: Answer
upvote count: 6
has body: This is on Kepler SR1. Arguments tab.
has comment: http://stackoverflow.com/comment/31611578
accepted answer of: http://stackoverflow.com/q/21028690
answers question: http://stackoverflow.com/q/21028690

http://stackoverflow.com/comment/120353163
has text: How do we acheive the same for local jenkins set up? Because unable to get .cert format and only able to get .p12, .jks and when we bind that it throws error like "keytool error: java.lang.Exception: Input not an X.509 certificate"
type: Comment
comment on: http://stackoverflow.com/a/36427118
score: 0
type: AnswerComment

object
tags question: http://stackoverflow.com/q/21095959
tags question: http://stackoverflow.com/q/21043362
tags question: http://stackoverflow.com/q/21101358
tag name: object
tags question: http://stackoverflow.com/q/21086908
tags question: http://stackoverflow.com/q/21092532
tags question: http://stackoverflow.com/q/21140055
tags question: http://stackoverflow.com/q/21053055
tags question: http://stackoverflow.com/q/21053285
tags question: http://stackoverflow.com/q/21139294
tags question: http://stackoverflow.com/q/21078366
tags question: http://stackoverflow.com/q/21090978
tags question: http://stackoverflow.com/q/21023486
tags question: http://stackoverflow.com/q/21150324
tags question: http://stackoverflow.com/q/21126315
tags question: http://stackoverflow.com/q/21046591
tags question: http://stackoverflow.com/q/21111869
tags question: http://stackoverflow.com/q/21127171
tags question: http://stackoverflow.com/q/21153092
tags question: http://stackoverflow.com/q/21087970
tags question: http://stackoverflow.com/q/21181533
tags question: http://stackoverflow.com/q/21076359
tags question: http://stackoverflow.com/q/21178615
tags question: http://stackoverflow.com/q/21123246
tags question: http://stackoverflow.com/q/21119142
tags question: http://stackoverflow.com/q/21138137
tags question: http://stackoverflow.com/q/21020432
type: Tag
tags question: http://stackoverflow.com/q/21132681
tags question: http://stackoverflow.com/q/21126678

http://stackoverflow.com/comment/121117378
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/36427118
type: Comment
has text: I did all that but still getting the error in STS. https://stackoverflow.com/questions/68531872/suncertpathbuilderexception-unable-to-find-valid-certification-path-to-request - For reference. If someone could help.

http://stackoverflow.com/a/21104455
type: Answer
has comment: http://stackoverflow.com/comment/31751231
has comment: http://stackoverflow.com/comment/31750998
has comment: http://stackoverflow.com/comment/31750921
answers question: http://stackoverflow.com/q/21104380
has body: Parameters are passed "by value" in Java. What that means is that when you call input.range(lowRange, highRange); it gives the current values of those variables to input.range, but it doesn't give input.range a way to modify them. In the range method: public static void range(int lowRange, int highRange) the parameters lowRange and highRange (which have no connection with the variables in GuessNumber, even though the names are the same) are copies of what you pass in. When you assign lowRange = ... in the method, it changes the copy but has no effect at all on the lowRange and highRange in GuessNumber. You need to write a range method that returns two values. This needs a little bit of work, but I'd write a Range class that has low and high members, and then change your method to public static Range range() That method would have to create a new Range object. I think it's OK for low and high to be public members of Range: class Range { public int low; public int high; public Range(int low, int high) { this.low = low; this.high = high; } } Normally, public data in a class is a bad thing, but for a class whose only purpose is to let a method return multiple values, it's OK in my opinion.
score: 0

http://stackoverflow.com/comment/31596783
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21018812
has text: @AndrewThompson Would you mind to elaborate on your comment? What's the "Bug Database" you are referring to? If it's a site, can you post the link so that other readers could make use of it too?

http://stackoverflow.com/comment/31707820
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21076825
has text: I dont see how the link you gave is relevant to my problem. let me explain it again to you. i send a file from the client side. The file compiles on the server side and saves in an out folder. The server has to send the file back but it doesn't because it cannot find the file of that name. Now when I re-run the code, the file already exists in the out folder, so the output file is received successfully on the client side. Get my point?
score: 0

http://stackoverflow.com/a/21089352
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21088856
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31721776
has body: Add a JDesktopPane to the MainFrame. You can add a background to it. Use a JInternalFrame for gameboard frame. When use click new game from the JMenuItem, an actionPerformed should add the JInternalFrame to the JDesktopPane and make the JInternalFrame visible If you don't understand how to create an interface at all, you should take a look at the Swing tutorials Specifically, have a look at How to Make Frames How to Use Internal Frames How to use DesktopPane How to use Menus How to write listeners. If you understand the above fore-mentioned things, an you want a quick solution, look into a GUI Builder tool like Netbeans GUI Builder. If you don't understand the above concepts, I suggest you learn to hand code before working with auto-generated code, as it might overwhelm you.

http://stackoverflow.com/comment/31622279
comment on: http://stackoverflow.com/a/21034611
has text: Good note with the different between `"\\s+"` and just `" "`
score: 1
type: AnswerComment
type: Comment

collections
tags question: http://stackoverflow.com/q/21077193
tags question: http://stackoverflow.com/q/21156921
tags question: http://stackoverflow.com/q/21119457
tags question: http://stackoverflow.com/q/21099645
tags question: http://stackoverflow.com/q/21094045
tags question: http://stackoverflow.com/q/21131005
tags question: http://stackoverflow.com/q/21183797
tags question: http://stackoverflow.com/q/21138920
tags question: http://stackoverflow.com/q/21093731
tags question: http://stackoverflow.com/q/21105413
tags question: http://stackoverflow.com/q/21151732
tags question: http://stackoverflow.com/q/21096512
tags question: http://stackoverflow.com/q/21022888
type: Tag
tags question: http://stackoverflow.com/q/21035711
tags question: http://stackoverflow.com/q/21086307
tags question: http://stackoverflow.com/q/21127642
tags question: http://stackoverflow.com/q/21026997
tag name: collections
tags question: http://stackoverflow.com/q/21063077
tags question: http://stackoverflow.com/q/21035510
tags question: http://stackoverflow.com/q/21068112

http://stackoverflow.com/q/21085884
tagged with: java
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/24540846
favorite count: 0
has answer: http://stackoverflow.com/a/24540846
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/21128404
has body: The datastore sometimes has methods that accepts a transaction as an argument. For example, there is datastore.get(key), and at the same time there is datastore.get(transaction, key). The Documentation here says that the latter version 'executes within the provided transaction'. But if I use a transaction like this, it seems there is no need to pass in the transaction. Transaction tx = datastore.beginTransaction(); Entity tom = datastore.get(key); //no need to pass in a transaction tom.setProperty("age", 40); datastore.put(tom); tx.commit(); How and when am I supposed to use datastore.get(transaction, key)? Thanks in advance!
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21128404
has title: Google App Engine datastore api accepts a transaction as an argument
upvote count: 1
type: Question
score: 1

jsf-2
tags question: http://stackoverflow.com/q/21100736
tags question: http://stackoverflow.com/q/21130033
tags question: http://stackoverflow.com/q/21125309
type: Tag
tags question: http://stackoverflow.com/q/21036730
tags question: http://stackoverflow.com/q/21149978
tags question: http://stackoverflow.com/q/21032315
tag name: jsf-2
tags question: http://stackoverflow.com/q/21111649
tags question: http://stackoverflow.com/q/21038314
tags question: http://stackoverflow.com/q/21169205
tags question: http://stackoverflow.com/q/21036846
tags question: http://stackoverflow.com/q/21035283
tags question: http://stackoverflow.com/q/21056895
tags question: http://stackoverflow.com/q/21137561
tags question: http://stackoverflow.com/q/21101775
tags question: http://stackoverflow.com/q/21162453
tags question: http://stackoverflow.com/q/21164172
tags question: http://stackoverflow.com/q/21051224
tags question: http://stackoverflow.com/q/21098126
tags question: http://stackoverflow.com/q/21172844
tags question: http://stackoverflow.com/q/21162620
tags question: http://stackoverflow.com/q/21025376
tags question: http://stackoverflow.com/q/21059614
tags question: http://stackoverflow.com/q/21088029

http://stackoverflow.com/a/21060875
score: 0
has comment: http://stackoverflow.com/comment/31724773
type: AcceptedAnswer
type: Answer
has body: You need to listen to a special property to wait for WebView to load. Btw, jQuery object is available at this page: webEngine.getLoadWorker().stateProperty().addListener(new ChangeListener&lt;Worker.State&gt;() { @Override public void changed(ObservableValue&lt;? extends Worker.State&gt; ov, Worker.State t, Worker.State t1) { if (t1 == Worker.State.SUCCEEDED) { try { System.out.println("trying to execute script"); // fixed - innerHtml is a property, not a function String content = (String)webEngine.executeScript("document.getElementById('articleHeader').innerHTML"); System.out.println(content); System.out.println("script successful"); } catch (Exception e) { // you can also print the exception to diagnose the error e.printStackTrace(); System.out.println("script failed"); } } } });
accepted answer of: http://stackoverflow.com/q/21039098
answers question: http://stackoverflow.com/q/21039098

http://stackoverflow.com/q/21122128
tagged with: spring-data
tagged with: spring-data-gemfire
has title: Spring-data-gemfire Boolean query only works with PDX serialization?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21148598
has body: I have a simple Boolean field in a pojo which I am storing in a gemfire region. The pojo also includes other fields with different data types (such as String, Long, Short, Date, etc). I have written a region query for each field and they return just fine all except the Boolean field. Example stub from my entity: @Region("poc") public class POCEntity { @Id @javax.persistence.Id private String id; private Boolean active; private String internalUsername; private Long dob; private Date createDate, updateDate; ... And here is the repository stub: //@Query("SELECT * FROM /poc p where p.active = false") List&lt;WellnessOptInEntity&gt; findByActiveIsFalse(); I have tried every possible variation (with the manual query and with query generation) that I can find but querying the boolean field with PDX NOT configured always results in this exception: java.lang.IllegalArgumentException: Unsupported operator TRUE! at org.springframework.data.gemfire.repository.query.Predicates$AtomicPredicate.getOperator(Predicates.java:174) at org.springframework.data.gemfire.repository.query.Predicates$AtomicPredicate.toClause(Predicates.java:137) at org.springframework.data.gemfire.repository.query.Predicates$AtomicPredicate.toString(Predicates.java:126) at org.springframework.data.gemfire.repository.query.Predicates.toString(Predicates.java:90) at org.springframework.data.gemfire.repository.query.QueryBuilder.create(QueryBuilder.java:44) If I enable PDX, the query for the boolean field works fine. If PDX is not enabled (unit testing with a bootstrapped gemfire server for example), then the boolean query does not work. Has anyone run into anything like this? I'm using gemfire 7.0.1 and spring-data-gemfire 1.3.3. I'm thinking this might be a bug in spring-data-gemfire but wanted to put this out there just to be sure.
has comment: http://stackoverflow.com/comment/31815153
type: Question
tagged with: gemfire
accepted answer: http://stackoverflow.com/a/21148598
answer count: 1
score: 0

http://stackoverflow.com/a/21230751
answers question: http://stackoverflow.com/q/21167610
accepted answer of: http://stackoverflow.com/q/21167610
type: Answer
has comment: http://stackoverflow.com/comment/32011980
has body: Yes, the Reflections library (not Reflection, but Reflection*s*) does ignore the visibility of annotations by default. This can be changed using the org.reflections.adapters.JavassistAdapter#includeInvisibleTag flag. Something like: JavassistAdapter mdAdapter = new JavassistAdapter(); mdAdapter.includeInvisibleTag = false; new Reflections(new ConfigurationBuilder() ... .setMetadataAdapter(mdAdapter) ... Another option would be to use the JavaReflectionAdapter instead. HTH
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/21061087
tagged with: java
tagged with: comparison
type: Question
downvote count: 0
answer count: 1
has title: How to compare two list<t> objects?
favorite count: 0
linked to: http://stackoverflow.com/q/1075656
has answer: http://stackoverflow.com/a/21061131
has comment: http://stackoverflow.com/comment/31669838
tagged with: generics
type: UnansweredQuestion
upvote count: 1
has body: I have two lists namely, List&lt;Employee&gt; oldEmplist and List&lt;Employee&gt; newEmplist and i have to compare both the list with only 2 properties of employee class namely empOrigId,empOrigNumberand these two properties will be set only for newEmplist so i have to compare these properties from newEmpList with empId,empNumber in oldEmpList. If this matches i have to replace the whole element in the oldEmpList with the matching item in the newEmplist. Any suggestion how this can be done?
tagged with: list
score: 1

cisco
type: Tag
tag name: cisco
tags question: http://stackoverflow.com/q/21040600

http://stackoverflow.com/q/21107806
has comment: http://stackoverflow.com/comment/31756629
has comment: http://stackoverflow.com/comment/31758812
has comment: http://stackoverflow.com/comment/31756549
has comment: http://stackoverflow.com/comment/31756289
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31758886
has comment: http://stackoverflow.com/comment/31756552
has comment: http://stackoverflow.com/comment/31756286
has comment: http://stackoverflow.com/comment/31756615
has comment: http://stackoverflow.com/comment/31757373
tagged with: arrays
has comment: http://stackoverflow.com/comment/31757152
has body: I have changed the CRC function as taking byte array. The CRC function is as follows: public class CalculateCRCByte { /* Table of CRC values for high–order byte */ static byte auchCRCHi[] = { (byte)0x00,(byte) 0xC1,(byte) 0x81,(byte) 0x40,(byte) 0x01,(byte) 0xC0,(byte) 0x80,(byte) 0x41,(byte) 0x01,(byte) 0xC0,(byte) 0x80,(byte) 0x41,(byte) 0x00,(byte) 0xC1,(byte) 0x81, (byte)0x40,(byte) 0x01,(byte) 0xC0,(byte) 0x80,(byte) 0x41,(byte) 0x00,(byte) 0xC1,(byte) 0x81,(byte) 0x40,(byte) 0x00,(byte) 0xC1,(byte) 0x81,(byte) 0x40,(byte) 0x01,(byte) 0xC0, (byte)0x80,(byte) 0x41,(byte) 0x01,(byte) 0xC0,(byte) 0x80,(byte) 0x41,(byte) 0x00,(byte) 0xC1,(byte) 0x81,(byte) 0x40,(byte) 0x00,(byte) 0xC1,(byte) 0x81,(byte) 0x40,(byte) 0x01, (byte)0xC0,(byte) 0x80,(byte) 0x41,(byte) 0x00,(byte) 0xC1,(byte) 0x81,(byte) 0x40,(byte) 0x01,(byte) 0xC0,(byte) 0x80,(byte) 0x41,(byte) 0x01,(byte) 0xC0,(byte) 0x80,(byte) 0x41, (byte)0x00,(byte) 0xC1,(byte) 0x81,(byte) 0x40,(byte) 0x01,(byte) 0xC0,(byte) 0x80,(byte) 0x41,(byte) 0x00,(byte) 0xC1,(byte) 0x81,(byte) 0x40,(byte) 0x00,(byte) 0xC1,(byte) 0x81, (byte)0x40,(byte) 0x01,(byte) 0xC0,(byte) 0x80,(byte) 0x41,(byte) 0x00,(byte) 0xC1,(byte) 0x81,(byte) 0x40,(byte) 0x01,(byte) 0xC0,(byte) 0x80,(byte) 0x41,(byte) 0x01,(byte) 0xC0, (byte)0x80,(byte) 0x41,(byte) 0x00,(byte) 0xC1,(byte) 0x81,(byte) 0x40,(byte) 0x00,(byte) 0xC1,(byte) 0x81,(byte) 0x40,(byte) 0x01,(byte) 0xC0,(byte) 0x80,(byte) 0x41,(byte) 0x01, (byte)0xC0,(byte) 0x80,(byte) 0x41,(byte) 0x00,(byte) 0xC1,(byte) 0x81,(byte) 0x40,(byte) 0x01,(byte) 0xC0,(byte) 0x80,(byte) 0x41,(byte) 0x00,(byte) 0xC1,(byte) 0x81,(byte) 0x40, (byte)0x00,(byte) 0xC1,(byte) 0x81,(byte) 0x40,(byte) 0x01,(byte) 0xC0,(byte) 0x80,(byte) 0x41,(byte) 0x01,(byte) 0xC0,(byte) 0x80,(byte) 0x41,(byte) 0x00,(byte) 0xC1,(byte) 0x81, (byte)0x40,(byte) 0x00,(byte) 0xC1,(byte) 0x81,(byte) 0x40,(byte) 0x01,(byte) 0xC0,(byte) 0x80,(byte) 0x41,(byte) 0x00,(byte) 0xC1,(byte) 0x81,(byte) 0x40,(byte) 0x01,(byte) 0xC0, (byte)0x…
tagged with: char
tagged with: byte
type: Question
has comment: http://stackoverflow.com/comment/31756309
has comment: http://stackoverflow.com/comment/31756570
tagged with: hex
has answer: http://stackoverflow.com/a/21110581
has title: Calculate CRC in JAVA using byte array
score: 0
answer count: 1

http://stackoverflow.com/comment/31699473
comment on: http://stackoverflow.com/q/21070034
has text: SWT is a native library so, unfortunately, it is machine to machine. It could be a problem with the driver, the implementation, an update or a seldom used call that doesn't manifest easily. File the bug report with SWT, it is an actively maintained project and there's a good chance you can pull down a nightly if they patch it.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21124395
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21118394
answers question: http://stackoverflow.com/q/21118394
has body: Suggested approach For your particular code snippet, perhaps using a Pane instead of a StackPane is the best approach. Why your code doesn't do what you want If you are going to manually set layout values, don't use a layout pane (such as a StackPane) which automatically sets layout values for you. If you use a layout pane, then the layout values you explicitly set will be overridden automatically the next time layout pane performs a layout pass (e.g. it is resized or some its content or location in the scene graph becomes dirty). Options for explicitly laying out nodes If you want to explicitly layout items in JavaFX do one of the following: Subclass Region and override layoutChildren. Place your content in a Pane if you need the container to be styled with CSS or implement resizing functions. Place your content in a Group if you don't need the container to be styled with CSS or implement resizing functions. Related advice on node positioning If you want to have automatically laid out components using the predefined layout managers but you want to adjust or temporarily modify the locations of some of the components from their default positions, you can adjust the translateX/Y values rather than layoutX/Y values. According to the definition of translateX: The node's final translation will be computed as layoutX + translateX, where layoutX establishes the node's stable position and translateX optionally makes dynamic adjustments to that position. This variable can be used to alter the location of a node without disturbing its layoutBounds, which makes it useful for animating a node's location. This means that the layout manager can compute a child's default position using layoutX, and you can adjust the position from the default using translateX.
score: 22
upvote count: 22
type: AcceptedAnswer

http://stackoverflow.com/comment/31836566
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21150908
has text: Thanks. In this article, however, I understand that it can be done despite the fact that the renderer is not a "live" compoment...?
score: 0

http://stackoverflow.com/a/21171974
score: 1
answers question: http://stackoverflow.com/q/21171609
type: Answer
upvote count: 1
has body: Maybe would be that deleteLine() is a method that belongs to simpleTableModel, but you aren't creating any instance of that simpleTableModel on the frame. You are doing directly lista.setModel(new SimpleTableModel(dados, colunas)); Try doing in your frame: SimpleTableModel modelo = new SimpleTableModel(dados, colunas); lista.setModel(modelo); modelo.deleteX(line); And inside your model something like this: public boolean deleteX(int line) throws DAOExcepcion{ //could be void because always returns true this.removeRow(line); this.fireTableRowsDeleted(line, line); return true; }
accepted answer of: http://stackoverflow.com/q/21171609
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21126678
upvote count: 1
has title: Proper way to pass Object to Fragment Activity and write to Object from Fragments
answer count: 1
favorite count: 0
tagged with: android
has body: I want to pass an ArrayList of custom Objects to a FragmentActivity. Each Fragment will have information populated by an individual Object. My question is, when I use the set methods (in the custom Object) in each Fragment, will that correctly update my ArrayList of these custom Objects so that I can pass this updated ArrayList of Objects to another Activity?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31791258
tagged with: android-fragments
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: object
has answer: http://stackoverflow.com/a/21126803
accepted answer: http://stackoverflow.com/a/21126803
tagged with: arraylist

http://stackoverflow.com/comment/31599769
has text: what happens if you do a `props.contains("mail.imap.timeout")` and if it is there a `props. getProperty("mail.imap.timeout")`?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21022426

http://stackoverflow.com/comment/31854297
has text: Are you sure the scanner is returning a single string, and not a string with the carriage return at the end?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21161816

http://stackoverflow.com/comment/31817879
has text: You have been a great help. These regular expressions are a brilliant tool just difficult to get the hang of :)
comment on: http://stackoverflow.com/a/21140132
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/122003420
type: AnswerComment
score: 0
type: Comment
has text: Had this problem related to Maven repository at: https://repo.maven.apache.org/maven2/ Blows my mind because our internal network was generating a self-signed cert that I had to export (using web browser) and then import using these instructions. Couldn't have gotten through it without these instructions & I'm amazed I was even able to work through it considering how cryptic the error info from Maven the internal network error was. Thanks again.
comment on: http://stackoverflow.com/a/36427118

http://stackoverflow.com/comment/79985291
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21053554
type: Comment
has text: perfect and simple

http://stackoverflow.com/q/21126793
tagged with: java
has comment: http://stackoverflow.com/comment/31791434
type: Question
has answer: http://stackoverflow.com/a/21127713
tagged with: arrays
has title: Get strings between " ---- " from the array
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31791679
type: UnansweredQuestion
has body: If I have a string array as follows: String[] name = {"aval", "H ---- ", "Singh", "Sawh", "Gopi", "G ---- ", "parminder", "kaur", "jaspreet", "asneet", " ---- "}; And if the user searches for the string "Sawh". I want to show all the strings that's between "H ---- " and "G ---- ". That is the result should display "SinghSawhGopi". I have tried as following but this appears to be wrong. I am able to get the string that is after the "Sawh" correctly but not before from "H ---- " to "Sawh" Someone here have any ideas on how to approach to this? String keywords = ""; int j = 0, k = 0, m = 0, n = 0; for(int i = 0; i &lt; name.length; i++){ if(name[i].contains("Sawh")){ for(j = i+1; !name[j].contains(" ---- "); j++){ keywords = keywords + name[j]; k = j; } for(j = i+1; !name[j].contains(" ---- "); j++){ keywords = keywords + name[j]; } } } System.out.println(keywords);
has answer: http://stackoverflow.com/a/21127381
has comment: http://stackoverflow.com/comment/31791332

http://stackoverflow.com/comment/31656669
has text: @Sotirios Delimanolis my friend he has debug that class u can read the comments and he was facing an issue in type casting so i have said to hime to create one entity class, I thought so i have done great help of him.
comment on: http://stackoverflow.com/a/21051598
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/31828327
comment on: http://stackoverflow.com/q/21146940
type: QuestionComment
type: Comment
has text: Yes it does work horizontally however trying to get it to connect 4 vertically or diagonally doesn't work and I am not to sure how to do it.
score: 0

http://stackoverflow.com/q/21034437
upvote count: 1
downvote count: 1
type: Question
tagged with: java
has body: I am currently running a VB script file through the command line in Java. The script file converts a video from one format to another. The problem that I am having is that after executing the command line code, Java immediately moves on to the next piece of code, without the VB Script actually completing. For e.g: try { Process p = Runtime.getRuntime().exec("cmd /C C:/Users/dheerajg/Desktop/webex2.vbs"); } catch (IOException e) { e.printStackTrace(); } Immediately below this I have: You have successfully converted the file by the name of: <% out.println(saveFile); %> However, I only want the second block of code to execute in my Web Application after the script has completed. Is there a way in Java where it will automatically detect when the script has completed?
has answer: http://stackoverflow.com/a/21034465
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21034466
tagged with: web
possible better answer: http://stackoverflow.com/a/21034465
favorite count: 0
accepted answer: http://stackoverflow.com/a/21034466
has title: Fully executing Command Line In Java before moving on
tagged with: command-line
type: AnsweredQuestion
tagged with: web-applications

http://stackoverflow.com/a/21171889
answers question: http://stackoverflow.com/q/21171862
has body: As long as you are using parametrized queries against databases you would be saved from SQL Injection. So instead of validating characters in URL, you should send data to the database server through command parameters.
upvote count: 5
score: 5
has comment: http://stackoverflow.com/comment/31873680
downvote count: 0
has comment: http://stackoverflow.com/comment/31873759
type: Answer

http://stackoverflow.com/comment/31741472
type: QuestionComment
comment on: http://stackoverflow.com/q/21099700
type: Comment
has text: Do you have any imports for `BaseContract` in you code?
score: 0

http://stackoverflow.com/a/21102326
has comment: http://stackoverflow.com/comment/31849058
has comment: http://stackoverflow.com/comment/31862121
has comment: http://stackoverflow.com/comment/31858633
has comment: http://stackoverflow.com/comment/31771757
type: Answer
answers question: http://stackoverflow.com/q/21102299
has comment: http://stackoverflow.com/comment/31750594
has body: This is normal behavior for the read() method: you need to keep reading in a loop until read returns -1. (see http://docs.oracle.com/javase/7/docs/api/java/io/BufferedInputStream.html#read(byte[],%20int,%20int)) In general, it happens because the read method is trying to return all the data it can to you before blocking, not all the data you will ever get. There are a couple of utility methods I frequently use for this sort of thing: (snipped out of context - note that I am not the author of the channelCopy method, but the source is attributed) /** * Efficiently copy from an InputStream to an OutputStream; uses channels and * direct buffering for a faster copy than oldCopy. * @param in - non-null readable inputstream * @param out - non-null writeable outputstream * @throws IOException if unable to read or write for some reason. */ public static void streamCopy(InputStream in, OutputStream out) throws IOException { assert (in != null); assert (out != null); ReadableByteChannel inChannel = Channels.newChannel(in); WritableByteChannel outChannel = Channels.newChannel(out); channelCopy(inChannel, outChannel); } /** * Read the *BINARY* data from an InputStream into an array of bytes. Don't * use this for text. * @param is - non-null InputStream * @return a byte array with the all the bytes provided by the InputStream * until it reaches EOF. * @throws IOException */ public static byte[] getBytes(InputStream is) throws IOException{ ByteArrayOutputStream os = new ByteArrayOutputStream(); streamCopy(is, os); return os.toByteArray(); } /** * A fast method to copy bytes from one channel to another; uses direct 16k * buffers to minimize copies and OS overhead. * @author http://thomaswabner.wordpress.com/2007/10/09/fast-stream-copy-using-javanio-channels/ * @param src - a non-null readable bytechannel to read the data from * @param dest - a non-null writeable byte channel to write the data to */ public static void channelCopy(final ReadableByteChannel src, final WritableByteChan…
has comment: http://stackoverflow.com/comment/31856957
score: 0

http://stackoverflow.com/a/21177453
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21177298
has comment: http://stackoverflow.com/comment/31884573
has body: Include the keystore in your JAR file as a resource, as you did for your images. Access it via getResourceAsStream(). Use that InputStream to load a KeyStore. Use the KeyStore to initialize a TrustManager. Use the TrustManager to initialize an SSLContext. Use the SSLContext to create your SSLSocketFactory. Use the SSLSocketFactory to create your SSLSocket.
upvote count: 1
has comment: http://stackoverflow.com/comment/31883821

http://stackoverflow.com/comment/31835142
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21150807
type: Comment
has text: @MadProgrammer Ohhhh... i see.. I got it..!! :)

http://stackoverflow.com/q/21081598
score: 51
has answer: http://stackoverflow.com/a/29816197
has comment: http://stackoverflow.com/comment/31737778
has comment: http://stackoverflow.com/comment/71298614
has answer: http://stackoverflow.com/a/21086904
linked to: http://stackoverflow.com/q/21100688
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/32791295
tagged with: java
has answer: http://stackoverflow.com/a/24522989
tagged with: gradle
has answer: http://stackoverflow.com/a/38713475
tagged with: google-play-services
type: Question
accepted answer: http://stackoverflow.com/a/21086904
downvote count: 0
linked to: http://stackoverflow.com/q/16624827
has comment: http://stackoverflow.com/comment/31738672
linked to: http://stackoverflow.com/q/35397401
has title: Import Google Play Services library in Android Studio
possible better answer: http://stackoverflow.com/a/21392660
has answer: http://stackoverflow.com/a/21392660
upvote count: 51
tagged with: android
has body: I have an Android project that has been developed entirely within Android Studio (currently version 4.2, gradle version 1.9-all). I want to add functionality from Google Play Services. The project is unable to resolve GooglePlayServicesUtil, and when I enter the import manually (shown below), I get Cannot resolve symbol 'common'. import com.google.android.gms.common.GooglePlayServicesUtil; Any idea what I need to do to get GooglePlayServicesUtil to resolve? What I've Tried From the Google Play Services Setup it looks like I just have to add the com.google.android.gms:play-services:4.+ dependency to my build.gradle file (and resync project files with gradle) to make the SDK available to my project. I do get an "exploded bundle" in ProjectName/module/build/exploded-bundles, but that doesn't seem like it does the trick. I have Google Play Services, Android Support Repository and Google Repository installed from the SDK Manager already. I've also deleted and reinstalled them multiple times :) Edit: Might I need to manually add google_play_services as a Project/Global Library? I've attempted with no success. I'm trying to verify that I'm developing against the Platform API with Google Services (if that's even possible), but I'm not sure that's the case. Nothing I change seems to do anything. The External Libraries of my project shows: < Android API 19 Platform > < 1.7 > joda-time-2.3 support-v4-13.0.0 Source Code This is my ProjectName/module/build.gradle file: buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.7.+' } } apply plugin: 'android' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion '19.0.1' defaultConfig { minSdkVersion 17 targetSdkVersion 19 versionCode 1 versionName "1.0" } buildTypes { release { runProguard true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } signingConfigs { } productFlavors { } } dependencies { compile 'com.google.an…
answer count: 7
has answer: http://stackoverflow.com/a/21082150
favorite count: 0
tagged with: android-studio
has comment: http://stackoverflow.com/comment/31744371

http://stackoverflow.com/q/21079142
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21079565
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21079313
has title: Getting redundancy in xslt output and How to get exact sequence of elements in xslt output as Input
has body: I am new to XSLT. I am transforming an XML document to XHTML format. In my XSLT output I am getting Redundancy and not getting exact sequence of elements in output as input. My Input: &lt;TLV1 ID="B01429413.0-7"&gt; &lt;P&gt;All rights reserved.&lt;/P&gt; &lt;P&gt; &lt;E T="I"&gt;Production Services:&lt;/E&gt;Aptara, Inc. &lt;/P&gt; &lt;LK&gt;ABCD !!!!!!&lt;/LK&gt; &lt;P&gt; &lt;E T="I"&gt;ACSM's Publications Committee Chair:&lt;/E&gt;Jeffrey L. Roitman, EdD, FACSM &lt;/P&gt; &lt;P&gt; &lt;E T="I"&gt;ACSM Group Publisher:&lt;/E&gt;D. Mark Robertson &lt;/P&gt; &lt;LK&gt;WXYZ !!!!!!&lt;/LK&gt; &lt;P&gt;&amp;#160;&amp;#160;&amp;#160;p. cm.&lt;/P&gt; &lt;P&gt; To purchase additional copies of this book, call our customer service department at &lt;E T="B"&gt;(301) 223-2320&lt;/E&gt;. International customers should call. &lt;/P&gt; &lt;P&gt; &lt;E T="BIT"&gt; Visit Lippincott Williams &amp;amp; Wilkins on the Internet: http://www.lww.com. &lt;/E&gt;Lippincott Williams &amp;amp; Wilkins customer service representatives are available from 8:30 am to 6:00 pm, EST. &lt;/P&gt; &lt;/TLV1&gt; My Applied XSLT: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;xsl:output method="html" omit-xml-declaration="yes" indent="yes" /&gt; &lt;xsl:strip-space elements="*" /&gt; &lt;xsl:template match="/"&gt; &lt;xsl:apply-templates select="//TLV1"/&gt; &lt;/xsl:template&gt; &lt;xsl:template match="TLV1"&gt; &lt;div&gt; &lt;xsl:attribute name="class"&gt;TLV1&lt;/xsl:attribute&gt; &lt;xsl:if test="P"&gt; &lt;xsl:for-each select="P"&gt; &lt;div&gt; &lt;xsl:attribute name="class"&gt;P&lt;/xsl:attribute&gt; &lt;xsl:apply-templates select="node()[1]" /&gt; &lt;xsl:if test="E"&gt; &lt;xsl:for-each select="E"&gt; &lt;span&gt; &lt;xsl:attribute name="class"&gt;emph_I&lt;/xsl:attribute&gt; &lt;xsl:apply-templates /&gt; &lt;/span&gt; &lt;xsl:apply-templates select="following-siblin…
tagged with: java
tagged with: xslt
type: Question

http://stackoverflow.com/comment/31811895
type: Comment
comment on: http://stackoverflow.com/q/21117965
has text: check http://stackoverflow.com/questions/3583111/regular-expression-find-spaces-tabs-space-but-not-newlines and just turn it around
score: 1
type: QuestionComment

http://stackoverflow.com/a/21576304
score: 0
has body: Use suggestion of @rgettman but normalize values between 0 and c = b - a. Thus, the new value (m) for double input n is: m = n - a Then zero-pad to 64. All inputs are positive.
answers question: http://stackoverflow.com/q/21028942
type: Answer

http://stackoverflow.com/comment/31726528
has text: @MrGuy: I'm not all that pleased with the accepted answer and still feel that there's a better way, that perhaps this question is really an [XY Problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). Consider telling us more about your over all problem, about the details of the problem and constraints. I still feel in my bones that a better approach should be used.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21091343
score: 0

http://stackoverflow.com/comment/31677884
has text: at the risk of sounding stupid.. I don't know any javascript.. would I have to actually learn it to properly build something like what I want? Or are there built in methods I can use that would aid with this..
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21065227
type: Comment

http://stackoverflow.com/q/21109467
tagged with: applet
tagged with: asp.net
type: Question
accepted answer: http://stackoverflow.com/a/21109781
score: 0
answer count: 1
has body: Is there a way to pass data from Java applet to aspx page and vice-versa?
has title: How to transit data between Java applet and ASP.NET web page?
tagged with: java
has comment: http://stackoverflow.com/comment/31759596
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21109781

email
tags question: http://stackoverflow.com/q/21029595
tags question: http://stackoverflow.com/q/21172441
tags question: http://stackoverflow.com/q/21051991
tags question: http://stackoverflow.com/q/21052026
tags question: http://stackoverflow.com/q/21174357
tags question: http://stackoverflow.com/q/21177430
tags question: http://stackoverflow.com/q/21077771
type: Tag
tag name: email

http://stackoverflow.com/a/21080603
has comment: http://stackoverflow.com/comment/31710496
has comment: http://stackoverflow.com/comment/31710523
downvote count: 0
score: 3
accepted answer of: http://stackoverflow.com/q/21080451
has comment: http://stackoverflow.com/comment/31710531
has comment: http://stackoverflow.com/comment/31709248
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21080451
has comment: http://stackoverflow.com/comment/31710747
upvote count: 3
has body: You need a JTextArea to display the the information from Job Also what I would recommend is to override the toString() method in the Job class. Something like public String toString() { return "Job No: " + jobNum + "\nCustomer: " + customer + "\nCredit Limit: " + creditLimit .... } Then in the actionPerformed all you have to do, is check the value in the text field, then get the value from the map and display it in the text area. public void actionPerformed(ActionEvent e) { String customer = textField.getText(); if (map.containsKey(customer)) { jta.append(String.valueOf(map.get(customer))); jta.append("\n***********************\n\n"); } } Run this example. to see what I mean. Just type in one of the names from the map and press the button import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.HashMap; import java.util.Map; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.SwingUtilities; public class TestMap { private JTextArea jta = new JTextArea(15, 30); private JTextField jtf = new JTextField(30); private JButton button = new JButton("Show Job"); private Map&lt;String, Job&gt; map; public TestMap() { map = getMap(); JPanel panel = new JPanel(new BorderLayout()); panel.add(jta, BorderLayout.CENTER); panel.add(jtf, BorderLayout.NORTH); panel.add(button, BorderLayout.SOUTH); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (!"".equals(jtf.getText())) { String customer = jtf.getText(); if (map.containsKey(customer)) { jta.append(String.valueOf(map.get(customer))); jta.append("\n***********************\n\n"); } jtf.setText(""); } } }); JFrame frame = new JFrame(); frame.add(panel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.pack(); frame.setVisible(true); } private Map&lt;String, Job&gt; getMap() …
type: Answer

http://stackoverflow.com/comment/31698070
comment on: http://stackoverflow.com/a/21076123
has text: you can also reffer to : http://docs.oracle.com/javase/tutorial/java/javaOO/nested.html#shadowing
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21128383
has answer: http://stackoverflow.com/a/21128475
possible better answer: http://stackoverflow.com/a/21128476
type: AnsweredQuestion
has title: Multiple inputs from the same line in java
tagged with: java
has body: I am in need of assistance with my Java program assignment. The assignment is to calculate the distance between two points using java. I completed part one as followed: import java.util.Scanner; public class DistanceCalcEasy { public static void main(String[] args) { // Creating a new scanner object System.out.println("Distance Calculator"); Scanner input = new Scanner(System.in); // Getting all of the coordinates System.out.print("Enter the X coordinate of the first point: "); double x1 = input.nextDouble(); System.out.print("Enter the Y coordinate of the first point: "); double y1 = input.nextDouble(); System.out.print("Enter the X coordinate of the second point: "); double x2 = input.nextDouble(); System.out.print("Enter the Y coordinate of the second point: "); double y2 = input.nextDouble(); // Calculating the distance between the points double distance = Math.sqrt( Math.pow((x2-x1),2) + Math.pow((y2-y1),2) ); // Printing the distance to the User System.out.println("The distance between the points is " + distance); } } Now the problem is I need to do this same program again but the "hard way" by allowing the user to input a coordinate like 1,2 instead of each x and y on their own line. This is what I have started to come up with after a little bit of research: import java.util.Scanner; public class DistanceCalcHard { public static void main(String[] args) { // Creating a new Scanner Object System.out.println("Distance Calculator"); Scanner input = new Scanner(System.in); // Getting the data points System.out.print("Enter the first point x,y: "); String firstPoint = input.nextLine(); System.out.print("Enter the second point x,y: "); String secondPoint = input.nextLine(); Scanner scan = new Scanner(firstPoint).useDelimiter("\\s*,\\s*"); while (scan.hasNextDouble() ) { } // Calculating the distance // Displaying the distance to the user } } Does that seem like a good start? I was thinking I could make two array's, one for each point, and then do my distance calcul…
accepted answer: http://stackoverflow.com/a/21128475
type: Question
score: 0
has comment: http://stackoverflow.com/comment/31794172
answer count: 2
has answer: http://stackoverflow.com/a/21128476

http://stackoverflow.com/q/21140032
has comment: http://stackoverflow.com/comment/31819426
upvote count: 1
has answer: http://stackoverflow.com/a/21234667
answer count: 1
has comment: http://stackoverflow.com/comment/31815229
favorite count: 0
has title: BlackBerry - How to reference a image located at the res/img folder of a project in a BrowserField for GoogleMap
type: AnsweredQuestion
has body: I'm showing a google map inside a BrowserField. This is the relevant code: private String setUpHtmlString(Coordinates coordinates){ StringBuffer mapString = new StringBuffer(); mapString.append("" + " " + " " + " " + " " + " Google Maps Multiple Markers " + " " + " " + " " + " " + " " + " " + " "); return mapString.toString(); } As you can see, the icon is pointing to an external url, but how should a write the path to a image file inside the img folder of my app. I tried to reference it in many ways, like these: "icon:'local:///assets/images/marker.png' "icon:'resources/images/marker.png' with no success. Thanks in advance.
downvote count: 0
score: 1
tagged with: java
tagged with: blackberry
type: Question
tagged with: google-maps
accepted answer: http://stackoverflow.com/a/21234667

http://stackoverflow.com/a/21171514
score: 1
has comment: http://stackoverflow.com/comment/31915244
has body: The pool will destroy the invalid connection for you thanks to "testOnBorrow=true" setting (note that the "Abandoned" settings only apply to connections which are not returned to the pool). So this is how it should go: servlet borrows connection, does queries and returns connection to the pool. servlet borrows connection, database crashes, servlet receives all kinds of horrible SQL errors but still returns connection to the pool. database has restarted on next heartbeat, servlet borrows connection. Tomcat's pool will "test on borrow", find that the old connection is broken, removes (and closes) connection, tries another, finds that it is also broken, etc, and THEN the pool decides to create a new connection, test it OK and hands it over to the servlet. servlet receives new valid connection, does queries and returns connection to the pool. I'm not sure how Tomcat's pool behaves when a "test on borrow" indicates a connection is broken (1): it might not create new connections right away or throw an error when it can't get a valid connection from the pool. But I expect the pool to effectively flush itself and re-populate with new (valid) connection. (1) That is, if the "test on borrow" is actually done which this post indicates is not the case ... If the pool does not flush itself, you can try to do this programmatically once you find connections are invalid. I have not tried this before, hopefully you can get it to work. Following method is described here: Reach into the JNDI context, pull-out the DataSource object, cross your fingers, cast it to org.apache.tomcat.jdbc.pool.DataSource, and call the purge() method. Alterntively, use JMX and call the purge method via the MBean. If you experience hanging threads after a database crash, you might have to resort to a work around described in this answer.
has comment: http://stackoverflow.com/comment/31903580
has comment: http://stackoverflow.com/comment/31890076
downvote count: 0
answers question: http://stackoverflow.com/q/21166584
has comment: http://stackoverflow.com/comment/31887372
type: Answer
has comment: http://stackoverflow.com/comment/31899194
upvote count: 1
has comment: http://stackoverflow.com/comment/31900645

http://stackoverflow.com/a/21040665
type: Answer
has body: Use Java Mission Control for checking this.
answers question: http://stackoverflow.com/q/21039959
upvote count: 1
downvote count: 1
score: 0

python
tags question: http://stackoverflow.com/q/21085459
tags question: http://stackoverflow.com/q/21079881
tags question: http://stackoverflow.com/q/21100538
tags question: http://stackoverflow.com/q/21104215
tags question: http://stackoverflow.com/q/21041819
tags question: http://stackoverflow.com/q/21081898
tag name: python
tags question: http://stackoverflow.com/q/21166429
tags question: http://stackoverflow.com/q/21153850
tags question: http://stackoverflow.com/q/21183422
tags question: http://stackoverflow.com/q/21045893
tags question: http://stackoverflow.com/q/21049011
tags question: http://stackoverflow.com/q/21053696
tags question: http://stackoverflow.com/q/21176288
tags question: http://stackoverflow.com/q/21114760
type: Tag
tags question: http://stackoverflow.com/q/21112770
tags question: http://stackoverflow.com/q/21082196
tags question: http://stackoverflow.com/q/21067679
tags question: http://stackoverflow.com/q/21104454
tags question: http://stackoverflow.com/q/21047122
tags question: http://stackoverflow.com/q/21150122
tags question: http://stackoverflow.com/q/21083159
tags question: http://stackoverflow.com/q/21171607

http://stackoverflow.com/a/21140273
has body: One solution that comes to mind is to utilize the Hibernate listeners/callbacks. But do beware that is very low level and quite error-prone. I use it myself to get a certain degree of automated audit logging going; it was not a pretty development cycle to get it to work reliably. unfortunately I can't share code since I don't own it. http://docs.jboss.org/hibernate/entitymanager/3.6/reference/en/html/listeners.html
answers question: http://stackoverflow.com/q/21139192
has comment: http://stackoverflow.com/comment/31848118
has comment: http://stackoverflow.com/comment/31848019
score: 0
has comment: http://stackoverflow.com/comment/31847430
type: Answer

http://stackoverflow.com/q/21108656
tagged with: jdbc
has answer: http://stackoverflow.com/a/21307120
linked to: http://stackoverflow.com/q/2353594
tagged with: ibatis
has comment: http://stackoverflow.com/comment/31768075
upvote count: 1
has title: How to create multiple schema connections at runtime?
type: Question
has answer: http://stackoverflow.com/a/21108942
tagged with: java
has comment: http://stackoverflow.com/comment/31763344
tagged with: jdbc-odbc
answer count: 3
has answer: http://stackoverflow.com/a/21114739
downvote count: 0
has comment: http://stackoverflow.com/comment/31760854
has body: I have a a project name drop-down list, and based on the selected value a schema drop-down list is generated. After the schema list is generated, there is a 'choose file' option where a script name is chosen which is to be run on multiple schemas. Both the project list values and the schema list values are stored in the database. There is another table in the database where the schema credentials are stored. I want to know that how create connections on those multiple schemas, and how to run a script in multiple schemas selected from that schema drop-down list. I have executed the code in one schema using iBatis framework using scriptrunner method. Table 1: ProjectName PROJECT_PK, PROJECT_CODE, PROJECT_NAME Table2: ComponentName COMPONENT_PK, COMPONENT_CODE, COMPONENT_NAME, PROJECT_PK Table 3: SchemaName (This table contains the credentials of Other Schemas) SCHEMA_PK, SCHEMA_NAME, PASSWORD, ORACLE_SID, HOST_NAME, PORT_ID Table 4: PROJECT_DETAIL PROJECT_DETAIL_PK, COMPONENT_PK, SCHEMA_PK Table5: COMPONENT_DETAILS COMPONENT_DETAILS_PK, PROJECT_PK, SCHEMA_PK I am attaching the scenario image.
score: 1
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-database
linked to: http://stackoverflow.com/q/20531747

http://stackoverflow.com/a/21062693
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21062421
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21062421
score: 1
upvote count: 1
has body: I am not familiar with Ant build environment, but according to the stackTrace, this is because you pack jar without the used libs. After a short search I found this docs here. Apply to your project in order to compile jar with lib jar(s). Or this answer also shows how to compile jar with dep. libs.

http://stackoverflow.com/a/21116084
type: Answer
has comment: http://stackoverflow.com/comment/31771812
score: 0
has body: You are casting the data as a Byte, however you have a Byte[]
answers question: http://stackoverflow.com/q/21115575
has comment: http://stackoverflow.com/comment/31771986

http://stackoverflow.com/comment/31886682
has text: i used this its throwing ava.lang.IllegalArgumentException
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21179586

http://stackoverflow.com/comment/31636539
score: 2
has text: +1, very good catch, this can almost count as an exam question :), my eyes just skimmed right over it
comment on: http://stackoverflow.com/a/21043178
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21074718
type: Answer
answers question: http://stackoverflow.com/q/21074395
score: 0
has body: I suggest you follow the setup carefully at https://developers.google.com/maps/documentation/android/start From what I see of your manifest, you are missing &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt; and &lt;meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="API_KEY"/&gt; and in the recommended layout is fragment instead of MapView etc..

http://stackoverflow.com/comment/31769626
comment on: http://stackoverflow.com/q/21115319
has text: I tried to execute it from my IDE and it failed too: java.lang.AssertionError. Don't you expect it to fail? :) - Edit: What's directly with junit?
score: 0
type: Comment
type: QuestionComment

jar
tags question: http://stackoverflow.com/q/21141643
tags question: http://stackoverflow.com/q/21130182
tags question: http://stackoverflow.com/q/21147527
tags question: http://stackoverflow.com/q/21142109
tags question: http://stackoverflow.com/q/21145653
tags question: http://stackoverflow.com/q/21181492
tags question: http://stackoverflow.com/q/21041819
tags question: http://stackoverflow.com/q/21113073
tags question: http://stackoverflow.com/q/21062356
tags question: http://stackoverflow.com/q/21128053
tags question: http://stackoverflow.com/q/21125017
tags question: http://stackoverflow.com/q/21023726
tags question: http://stackoverflow.com/q/21045936
tags question: http://stackoverflow.com/q/21064329
tags question: http://stackoverflow.com/q/21027696
tags question: http://stackoverflow.com/q/21166429
tags question: http://stackoverflow.com/q/21047909
tags question: http://stackoverflow.com/q/21169655
tags question: http://stackoverflow.com/q/21034835
type: Tag
tags question: http://stackoverflow.com/q/21066566
tags question: http://stackoverflow.com/q/21175585
tags question: http://stackoverflow.com/q/21044451
tags question: http://stackoverflow.com/q/21087079
tags question: http://stackoverflow.com/q/21057877
tags question: http://stackoverflow.com/q/21055185
tags question: http://stackoverflow.com/q/21051696
tags question: http://stackoverflow.com/q/21031326
tags question: http://stackoverflow.com/q/21108328
tags question: http://stackoverflow.com/q/21123675
tags question: http://stackoverflow.com/q/21150670
tags question: http://stackoverflow.com/q/21156810
tags question: http://stackoverflow.com/q/21108190
tags question: http://stackoverflow.com/q/21119667
tags question: http://stackoverflow.com/q/21169814
tags question: http://stackoverflow.com/q/21086113
tags question: http://stackoverflow.com/q/21091259
tags question: http://stackoverflow.com/q/21044898
tag name: jar
tags question: http://stackoverflow.com/q/21032551
tags question: http://stackoverflow.com/q/21057420
tags question: http://stackoverflow.com/q/21048654
tags question: http://stackoverflow.com/q/21129692
tags question: http://stackoverflow.com/q/21137039
tags question: http://stackoverflow.com/q/21108398
tags question: http://stackoverflow.com/q/21170462
tags question: http://stackoverflow.com/q/21093129
tags question: http://stackoverflow.com/q/21108953
tags question: http://stackoverflow.com/q/21124676
tags question: http://stackoverflow.com/q/21181810
tags question: http://stackoverflow.com/q/21018902
tags question: http://stackoverflow.com/q/21183463
tags question: http://stackoverflow.com/q/21028619
tags question: http://stackoverflow.com/q/21068483
tags question: http://stackoverflow.com/q/21169008
tags question: http://stackoverflow.com/q/21163419
tags question: http://stackoverflow.com/q/21173835
tags question: http://stackoverflow.com/q/21062421
tags question: http://stackoverflow.com/q/21106370
tags question: http://stackoverflow.com/q/21153167
tags question: http://stackoverflow.com/q/21021368
tags question: http://stackoverflow.com/q/21119514
tags question: http://stackoverflow.com/q/21089278
tags question: http://stackoverflow.com/q/21043989
tags question: http://stackoverflow.com/q/21029364
tags question: http://stackoverflow.com/q/21083308

http://stackoverflow.com/q/21157938
tagged with: jqgrid
type: Question
has title: How to cast element in jqgrid response method?
downvote count: 0
tagged with: jquery
has body: I have an abstract class with some child. I have used the Joined Inheritance strategy. I need to extract data from a child in a global jqGrid, but I have no idea how it can be done. Page&lt;AbstractClass&gt; entryPage = abstractService.findEntriesByCriteria(abstractSearchCriteria, pageRequest); // Construct the grid data that will return as JSON data JqgridResponse&lt;AbstractClass&gt; entryGrid = new JqgridResponse&lt;AbstractClass&gt;(); Any idea?
tagged with: inheritance
accepted answer: http://stackoverflow.com/a/21158868
tagged with: abstract-class
answer count: 1
favorite count: 0
upvote count: 2
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/21158868
tagged with: java

http://stackoverflow.com/q/21050173
score: 0
answer count: 2
tagged with: api
has answer: http://stackoverflow.com/a/21050288
favorite count: 0
tagged with: package
tagged with: interface
has answer: http://stackoverflow.com/a/21050220
has title: How can i find out which Library Package it is?
tagged with: google-api
type: UnansweredQuestion
upvote count: 1
downvote count: 1
type: Question
has body: i want to write a google api interface but i have a very basic problem, i have this imports (below) but i dont know which library-file (.jar) belongs to the import. For information its a java programm import com.google.api.ads.common.lib.conf.ConfigurationLoadException; import com.google.api.ads.common.lib.exception.ValidationException; import com.google.api.ads.dfa.axis.factory.DfaServices; import com.google.api.ads.dfa.axis.v1_20.Advertiser; import com.google.api.ads.dfa.axis.v1_20.AdvertiserRecordSet; import com.google.api.ads.dfa.axis.v1_20.AdvertiserRemote; import com.google.api.ads.dfa.axis.v1_20.AdvertiserSearchCriteria; import com.google.api.ads.dfa.lib.client.DfaSession; import com.google.api.client.auth.oauth2.Credential; import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow; import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest; import com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse; import com.google.api.client.http.javanet.NetHttpTransport; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.util.store.DataStoreFactory; import com.google.api.client.util.store.MemoryDataStoreFactory; import com.google.common.collect.Lists;
tagged with: java

http://stackoverflow.com/comment/31670479
type: Comment
has text: Thank you once again Alex, can you please guide some more how can I use ` ` in terms of ` ` or any link to such examples, as I am not very sure how to plugin that thing into this?
comment on: http://stackoverflow.com/a/21061347
score: 0
type: AnswerComment

http://stackoverflow.com/q/21115575
has answer: http://stackoverflow.com/a/21843837
type: Question
tagged with: wcf
has comment: http://stackoverflow.com/comment/31772074
answer count: 2
tagged with: android
has comment: http://stackoverflow.com/comment/31772331
tagged with: java
has body: I am trying to send images from wcf ksoap2 to android. At wcf side I have converted all images into byte array and stored them in an ArrayList. At android side I trying fill the ArrayList&lt;Byte&gt; arrays; but its not filling, it remains empty. Here is my code wcf: List&lt;byte[]&gt; list; public List&lt;byte[]&gt; loadImages() { DirectoryInfo directoryInfo = new DirectoryInfo(@"C:\Users\User\Desktop\abc"); arr1 = new ArrayList(); foreach (FileInfo fi in directoryInfo.GetFiles()) arr1.Add(fi.FullName); list = new List&lt;byte[]&gt;(); for (int i = 0; i &lt; arr1.Count; i++) { img = Image.FromFile(arr1[i].ToString()); ms = new MemoryStream(); img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); list.Add(ms.ToArray()); // objbyte = (byte[])ms.ToArray(); } return list; } android: SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME); SoapSerializationEnvelope soapEnvelop; soapEnvelop = new SoapSerializationEnvelope(SoapEnvelope.VER11); soapEnvelop.dotNet = true; soapEnvelop.setOutputSoapObject(Request); HttpTransportSE htps = new HttpTransportSE(URL); htps.call(SOAP_ACTION, soapEnvelop); response = (SoapObject) soapEnvelop.getResponse(); ar = new String[response.getPropertyCount()]; arrays = new ArrayList&lt;Byte&gt;(); if (response != null) { if (response.getPropertyCount() &gt; 0) { for (int i = 0; i &lt; response.getPropertyCount(); i++) { arrays.add( (Byte) response.getProperty(i)); } } } for loop executes properly but arrays remains empty I want to send 10-15 images at a time. Thanks in advance
upvote count: 1
accepted answer: http://stackoverflow.com/a/21843837
has comment: http://stackoverflow.com/comment/31772042
tagged with: c#
has answer: http://stackoverflow.com/a/21116084
possible better answer: http://stackoverflow.com/a/21116084
type: AnsweredQuestion
has title: trouble in receiveing byte [] from wcf ksoap2 to android
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/comment/31697684
comment on: http://stackoverflow.com/a/21021587
type: AnswerComment
score: 0
has text: i tried this but in progress its not identifying select left.its showing unable to understand after select.
type: Comment

http://stackoverflow.com/a/21131069
type: AcceptedAnswer
downvote count: 1
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/31921298
has body: That is expected as there is an extra layer of the hub/node between your test and browser. Another factor which adds to execution time is the test machine configuration(Processor, RAM,....) and network latency. One thing which you should make sure on your test machines is to have atleast a dual core processor.
answers question: http://stackoverflow.com/q/21129708
score: -1
accepted answer of: http://stackoverflow.com/q/21129708
has comment: http://stackoverflow.com/comment/31801615

http://stackoverflow.com/comment/31602428
has text: Yes, I've tried this already and `getResourceAsStream` is the best way, I think, to do it.
comment on: http://stackoverflow.com/a/21023592
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/21130033
linked to: http://stackoverflow.com/q/17847951
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: jsf
has comment: http://stackoverflow.com/comment/31800404
accepted answer: http://stackoverflow.com/a/21234473
score: 0
tagged with: sigma.js
type: Question
has comment: http://stackoverflow.com/comment/31800764
tagged with: java
has comment: http://stackoverflow.com/comment/31930438
tagged with: jsf-2
answer count: 1
has answer: http://stackoverflow.com/a/21234473
has title: How access to content of dynamic page in JSF?
has comment: http://stackoverflow.com/comment/31930338
linked to: http://stackoverflow.com/q/12920594
has body: I have a xhtml file that i initialized it with ui:repeat tag in realtime.all tags of this page placed under ui:fragment tag. <ui:repeat value="#{graphInfoBean.edges}" var="edge" varStatus="indexVar"> </ui:repeat> When i access to this page and save it as xml in realtime, the tags in xml file saved are empty while it is initialized and everything is working properly. How can i access to content of this xhtml file and save it on disk? think that we have 2 page (A&B) so we want to download the page B (this page initialized dynamically by ManagedBean)through page A Thanks in advance,

http://stackoverflow.com/a/21099479
upvote count: 54
has comment: http://stackoverflow.com/comment/58697442
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21099386
score: 54
type: Answer
answers question: http://stackoverflow.com/q/21099386
has body: If you mean the three dots, that's called the overflow menu. It exists on devices which do not have a hardware menu button - which your Galaxy S3 has, while the Nexus 7 does not. So on your S3 you press the menu button and get the popup at the bottom, but on the Nexus you press the 3 dots and get the overflow popup dropping down from the action bar. If it wasn't there, how would you be able to access overflow items? If you'd simply like to remove it altogether, just delete the first &lt;item /&gt; entry in the menu.xml you posted.
downvote count: 0

http://stackoverflow.com/comment/31836629
type: Comment
type: QuestionComment
has text: Well, yes, that would almost certainly be a better solution given the code in the question. However, that seems to go beyond the scope of what this question is asking, since the same boolean logic question could apply equally well to something without objects.
comment on: http://stackoverflow.com/q/21151564
score: 1

http://stackoverflow.com/comment/31680236
type: Comment
comment on: http://stackoverflow.com/a/21066260
score: 0
type: AnswerComment
has text: @Niccolò Please don't feel offended nor offend anyone. There is no personal comments here. Comments are merely added for questions and answers.

http://stackoverflow.com/q/21109983
has comment: http://stackoverflow.com/comment/31760019
linked to: http://stackoverflow.com/q/21104940
has answer: http://stackoverflow.com/a/21110133
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31760396
tagged with: java
tagged with: noclassdeffounderror
has answer: http://stackoverflow.com/a/21110258
type: Question
tagged with: raspberry-pi
has title: Unable to run program Exception in thread "main" NoClassDefFoundError: (wrong name: access/control/accessControlUI)
accepted answer: http://stackoverflow.com/a/21110133
has comment: http://stackoverflow.com/comment/31760049
possible better answer: http://stackoverflow.com/a/21110146
score: 0
has answer: http://stackoverflow.com/a/21110146
answer count: 3
has body: This question is the evolution of a previous question which was answered (I wasn't sure if it was convention to start a new question or continue from the previous one at this point - please let me know): Running java program from terminal I'm struggling to get my java program to run from terminal. I'm launch it it from the following location: pi@raspberrypi ~/JBerries/Access control $ Using this command: java -classpath . bin/access/control/accessControlUI It's a swing GUI program and main is located in accessControlUI and it also requires the door class, here's an image so yo can see the files: Here's what I get when I execute the stated command: Exception in thread "main" java.lang.NoClassDefFoundError: bin/access/control/accessControlUI (wrong name: access/control/accessControlUI) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:792) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) I found many similar questions but I struggled to draw anything useful from them and most were labeled as 'too local'.

http://stackoverflow.com/q/21057708
type: Question
has comment: http://stackoverflow.com/comment/31717581
accepted answer: http://stackoverflow.com/a/21087586
upvote count: 23
tagged with: string
tagged with: levenshtein-distance
has answer: http://stackoverflow.com/a/21088993
possible better answer: http://stackoverflow.com/a/21060653
has answer: http://stackoverflow.com/a/21087586
has answer: http://stackoverflow.com/a/21060653
linked to: http://stackoverflow.com/q/2461120
has comment: http://stackoverflow.com/comment/31665046
answer count: 4
has body: I've got a stand-alone CSV data loading process that I coded in Java that has to use some fuzzy string matching. It's definitely not ideal, but I don't have much choice. I am matching using a first and last name and I cache all the possibilities at the start of a run. After finding the match, I then need that person object multiple places during the run. I used guava's Objects.hashCode() to create a hash out of the firstname and lastname. The caching mechanism looks like this: Map&lt;Integer,PersonDO&gt; personCache = Maps.newHashMap(); for(PersonDO p: dao.getPeople()) { personCache.put(Objects.hashCode(p.getFirstName(),p.getLastName()), p); } Most of the time I get hits on firstname+lastname, but when it misses I'm falling back using Apache's StringUtils.getLevenshteinDistance() to try and match it. This is how the matching logic flow goes: person = personCache.get(Objects.hashCode(firstNameFromCSV,lastNameFromCSV)); if(person == null) {//fallback to fuzzy matching person = findClosetMatch(firstNameFromCSV+lastNameFromCSV); } This is the findClosetMatch() method: private PersonDO findClosetMatch(String name) { int min = 15;//initial value int testVal=0; PersonDO matchedPerson = null; for(PersonDO person: personCache.values()) { testVal = StringUtils.getLevenshteinDistance(name,person.getFirstName()+person.getLastName()); if( testVal &lt; min ) { min = testVal; matchedPerson = person; } } if(matchedPerson == null) { throw new Exception("Unable to find person: " + name) } return matchedPerson; } This works fine with simple spelling errors, typos and shortened names(ie Mike->Michael), but when I'm completely missing one of the incoming names in the cache I end up returning a false positive match. To help keep this from happening I set the min value in findClosetMatch() to 15(ie no more than 15 chars off); it works most of the time but I've still had a few mis-matches occur: Mike Thompson hits on Mike Thomas etc. Outside of figuring out a way to get a primary key into …
favorite count: 0
has comment: http://stackoverflow.com/comment/31715850
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21086474
downvote count: 0
has comment: http://stackoverflow.com/comment/31664992
tagged with: java
has comment: http://stackoverflow.com/comment/31666470
score: 23
has title: Java fuzzy String matching with names
has comment: http://stackoverflow.com/comment/31664321

http://stackoverflow.com/a/21112650
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21112438
has body: What about the following two ways: Declare the target method in super class and provide a default implementation(e.g. empty method, do nothing) as well. Subclass will override that behavior if needed. Declare the target method in a Interface, and make SubclassA and SubclassB implementation of the interface. The super class and other subclasses don't need to implement the interface.

http://stackoverflow.com/comment/116360103
has text: @Baranir I went to the trouble of loggin in (didn't remember if my main account was linked through Facebook, Google or SO) just to upvote this answer. At first it wasn't working but turns out I was missing the -keystore parameter. People, please don't omit the -keystore parameter. It won't work and you will pull out some of the few remaining hair on your head. Jokes aside, +1 for a solid answer.
score: 0
comment on: http://stackoverflow.com/a/47548746
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21136650
type: Question
tagged with: actionlistener
tagged with: jtextarea
score: -3
tagged with: settext
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31808787
has answer: http://stackoverflow.com/a/21137093
type: UnansweredQuestion
tagged with: swing
has title: How to show(add) JTextArea after button click?
tagged with: java
downvote count: 3
has body: i want to show my JTextArea after button CONNECT_BUTTON is clicked. What should I do ? Furthermore i'm trying to add some grid in my JTextArea because I want to use it for show some records from databse. Any ideas how to do that ? package DataBase_Hospital; import java.awt.BorderLayout; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class test extends JFrame implements ActionListener { private JButton FIND_BUTTON; private JButton MESSAGE_BUTTON; private JButton CONNECT_BUTTON; private JButton CLEAR_BUTTON; private JButton ADD_BUTTON; private JButton RAPORT_BUTTON; private JButton EDIT_BUTTON; private JButton DOWNLOAD_BUTTON; private JTextArea DATABASE_FIELD; private DatabaseManagement DATABASE; public test(){ setTitle("Hospital Management"); setSize(900,600); setLocationRelativeTo(null); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); JLabel background=new JLabel(new ImageIcon("/Users/Dominik/Desktop/j.jpg")); add(background); DATABASE_FIELD = new JTextArea(); JScrollPane scrollPane = new JScrollPane(DATABASE_FIELD); scrollPane.setBounds(50, 50, 800, 400); background.add(scrollPane); DATABASE_FIELD.setEditable(true); DATABASE_FIELD.setLayout(new GridLayout(3, 3)); //DATABASE_FIELD.setVisible(false); CONNECT_BUTTON = new JButton(); CONNECT_BUTTON.setIcon(new ImageIcon("…

http://stackoverflow.com/comment/31856506
has text: I write it in a text file. This code is part of something of a Report generating software. Reports that are being used elsewhere by other people, including imports into other Databases (which is how the bug has been revealed)
comment on: http://stackoverflow.com/q/21162753
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21051506
has comment: http://stackoverflow.com/comment/100154563
type: Answer
has body: Symptoms indicate that somewhere somebody is overwriting project.sourceCompatibility. But given that there are many ways to customize Gradle, I can't say from a distance who that is. As a workaround, you can set the properties on the task level, which is what ultimately counts: tasks.withType(JavaCompile) { sourceCompatibility = "1.6" targetCompatibility = "1.6" } Add this to allProjects { ... } block.
upvote count: 53
answers question: http://stackoverflow.com/q/21028438
score: 53
has comment: http://stackoverflow.com/comment/38609560
has comment: http://stackoverflow.com/comment/58432639
downvote count: 0

http://stackoverflow.com/comment/31792068
score: 0
has text: Usually you get this error when you have mismatched jar files -- two jars where one depends on the other, but the depended-upon jar is the wrong version. You can also get this when you fail to recompile all of your project, or, in some odd cases, when you're using an abstract class.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21126476

http://stackoverflow.com/a/47563948
downvote count: 0
has body: This isn't a Twitter-specific answer, but this is the question that comes up when you search for this error. If your system is receiving this error when connecting to a website that appears to have a valid certificate when viewed in a web browser, that probably means that website has an incomplete certificate chain. For a brief summary of the problem: Certificate Authorities don't use their Root Certificate to sign just any old certificate. Instead, they (usually) sign intermediate certificates that also have the Certificate Authority flag set (that is, are allowed to sign certificates). Then when you purchase a certificate from a CA, they sign your CSR with one of these intermediate certificates. Your Java trust store most likely only has the Root Cert, not the intermediate ones. A misconfigured site might return just their signed cert. Problem: it was signed with an intermediate cert that's not in your trust store. Browsers will handle this problem by downloading or using a cached intermediate certificate; this maximizes website compatibility. Java and tools like OpenSSL, however, won't. And that will cause the error in the question. You can verify this suspicion by using the Qualys SSL Test. If you run that against a site and it says This server's certificate chain is incomplete. then that confirms it. You can also see this by looking at the certification paths and seeing the text Extra Download. How to fix it: the server administrator needs to configure the web server to return the intermediate certificates as well. For Comodo, for example, this is where the .ca-bundle file comes in handy. For example, in an Apache configuration with mod_ssl, you'd use the SSLCertificateChainFile configuration setting. For nginx, you need to concatenate the intermediate certificates and the signed certificate and use that in the SSL cert configuration. You can find more by searching for "incomplete certificate chain" online.
type: Answer
has comment: http://stackoverflow.com/comment/107375499
upvote count: 23
answers question: http://stackoverflow.com/q/21076179
score: 23

http://stackoverflow.com/q/21037994
has comment: http://stackoverflow.com/comment/31627803
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31627912
favorite count: 0
has comment: http://stackoverflow.com/comment/31628005
has comment: http://stackoverflow.com/comment/31628089
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31627877
has comment: http://stackoverflow.com/comment/31628053
has comment: http://stackoverflow.com/comment/31627809
has comment: http://stackoverflow.com/comment/31627834
has comment: http://stackoverflow.com/comment/31627963
has title: Continuous File reading
has comment: http://stackoverflow.com/comment/31628412
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/31628299
tagged with: java
tagged with: file
has answer: http://stackoverflow.com/a/21038786
tagged with: loops
has comment: http://stackoverflow.com/comment/31627790
type: Question
linked to: http://stackoverflow.com/q/557844
has comment: http://stackoverflow.com/comment/31627839
has body: I have very different scenario in my application. I need to read some text file and do some some work on that. Actually what I want is, when I reach to the end of line, my file reading cursor in Java will stop there and wait until the new line append in the text file. Actually the file which I am reading is a real time logs which are generated by the server, the log will generate after every one second. So I want that my file reading process will never end, it keep on reading file as new data comes in the file. I have written this code, try { Scanner sc = new Scanner(file); while (sc.hasNextLine()) { String i = sc.nextLine(); processLine(i); //a method which do some stuff on the line which i read if(thread==1) { System.out.print("After loop in the file"); //just for printing } while(!(sc.hasNextLine())) //in the loop until new line comes { System.out.println("End of file"); Thread.sleep(100000); System.out.println("Thread is waiting"); thread++; } if(thread==1) { System.out.println("OUt of the thread"); } //System.out.println(i); } sc.close(); System.out.println("Last time stemp is "+TimeStem); System.out.println("Previous Time Stemp is "+Previous_time); } catch (FileNotFoundException e) { e.printStackTrace(); } This is my code, I think my program will remain in the second while loop when end of file reach and when file append it start reading file again. But it's not happening, when end of file is reached, my program wait for some second but never read the next line which is appended in the file.
has comment: http://stackoverflow.com/comment/31628212
has comment: http://stackoverflow.com/comment/31628552
duplicate of: http://stackoverflow.com/q/557844
tagged with: eof

http://stackoverflow.com/comment/38307441
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24646805
type: AnswerComment
has text: But this is an ANE question. PO is able to take a screenshot using Android based code, answer gives another way to take a screenshot on Android, big deal. Question is about wrapping it all up in an ANE, answer is off subject.

http://stackoverflow.com/q/21040854
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31632573
has comment: http://stackoverflow.com/comment/31632591
tagged with: java
has comment: http://stackoverflow.com/comment/31632700
has comment: http://stackoverflow.com/comment/31633649
tagged with: file
has comment: http://stackoverflow.com/comment/31632615
has title: Writing an entire list to a file in java
type: Question
possible better answer: http://stackoverflow.com/a/21040937
has comment: http://stackoverflow.com/comment/31632530
tagged with: java-io
tagged with: arraylist
has answer: http://stackoverflow.com/a/21041249
accepted answer: http://stackoverflow.com/a/21041249
upvote count: 3
has body: I am working on a big project where I have more than 1 million lines of data. Data is divided into various files containing 20,000 lines each. Now the data from each file is read line by line and some variable x is concatenated to each line. I am storing these concatenated string to an array list. Then this array list is saved to output files line by line. This is taking 3-4 minutes on each file. Is there anyway to write the entire ArrayList to a file in one go, so that it won't take that much time. Or is there any faster way to do this? Here is some sample code: List&lt;String&gt; outputData = new ArrayList&lt;String&gt;(); //Output arraylist containing concatenated data writeLines(File outputFile,outputData); //The data is written to file What would be the fastest way to achieve this task?
answer count: 3
tagged with: io
has comment: http://stackoverflow.com/comment/31632638
has comment: http://stackoverflow.com/comment/31632534
favorite count: 0
has answer: http://stackoverflow.com/a/21040937
has answer: http://stackoverflow.com/a/21041209
has comment: http://stackoverflow.com/comment/31632905
type: AnsweredQuestion

http://stackoverflow.com/comment/31763385
type: QuestionComment
type: Comment
has text: Thnx mserioli for trying to help
comment on: http://stackoverflow.com/q/21090889
score: 0

http://stackoverflow.com/comment/31614277
comment on: http://stackoverflow.com/q/21030258
score: 0
type: Comment
type: QuestionComment
has text: "digit" and "number" are synonymous; did you make a typo? Does "L" in your pattern actually mean "letter?"

http://stackoverflow.com/a/21063628
has comment: http://stackoverflow.com/comment/31675428
has comment: http://stackoverflow.com/comment/31675145
has body: I've written some code below. See whether it helps you. Please don't copy-paste, try to learn the logic also. import java.io.*; public class Manager { String[] textData; String path; int numberOfWords; public void loadFile(String path) throws Exception { this.path = path; StringBuffer buffer = new StringBuffer(); BufferedReader reader = new BufferedReader(new FileReader(path)); String line; String[] words; numberOfWords = 0; while((line=reader.readLine()) != null) { buffer.append(line + "\n"); words = line.split(" "); numberOfWords = numberOfWords + words.length; } //deleting the last extra newline character buffer.deleteCharAt(buffer.lastIndexOf("\n")); textData = buffer.toString().split("\n"); } public void printFile() { for(int i=0;i&lt;textData.length;i++) System.out.println(textData[i]); } public int findText(String text) { for(int i=0;i&lt;textData.length;i++) if(textData[i].contains(text)) return i; return -1; } public boolean contains(String text) { for(int i=0;i&lt;textData.length;i++) if(textData[i].contains(text)) return true; return false; } public int getNumberOfWords() { return numberOfWords; } public int getCount() { return textData.length; } }
answers question: http://stackoverflow.com/q/21063045
has comment: http://stackoverflow.com/comment/31675406
score: 0
has comment: http://stackoverflow.com/comment/31675163
type: Answer

http://stackoverflow.com/q/21144257
accepted answer: http://stackoverflow.com/a/21144357
has comment: http://stackoverflow.com/comment/31823108
score: 0
has answer: http://stackoverflow.com/a/21144357
has comment: http://stackoverflow.com/comment/31822297
answer count: 1
favorite count: 0
has body: I am trying to build a basic Arcanoid/Breakout style game in JAVA. I am having trouble with the collision detection between the ball and the bricks. I am using bounding boxes around all entities in the game. When the ball hits the player's paddle, the collision is detected. When the ball hits the bricks coordinates, no collision is detected. Any one have any ideas. Code below. Game.java package com.seadnamcgillycuddy.unipong; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JOptionPane; import javax.swing.JFrame; import javax.swing.JPanel; @SuppressWarnings("serial") public class Game extends JPanel { Ball ball = new Ball(this); Paddle paddle = new Paddle(this); Brick brick = new Brick(this, 50, 20); Brick brick2 = new Brick(this, 75, 20); Brick brick3 = new Brick(this, 100, 20); Brick brick4 = new Brick(this, 125, 20); Brick brick5 = new Brick(this, 150, 20); Brick brick6 = new Brick(this, 175, 20); Brick brick7 = new Brick(this, 200, 20); Brick brick8 = new Brick(this, 225, 20); Brick brick9 = new Brick(this, 250, 20); int speed = 1; private int getScore() { return speed - 1; } public Game() { addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { paddle.keyReleased(e); } @Override public void keyPressed(KeyEvent e) { paddle.keyPressed(e); } }); setFocusable(true); } private void move() { ball.move(); paddle.move(); } @Override public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); ball.paint(g2d); paddle.paint(g2d); brick.paint(g2d); brick2.paint(g2d); brick3.paint(g2d); brick4.paint(g2d); brick5.paint(g2d); brick6.paint(g2d); brick7.paint(g2d); brick8.paint(g2d); brick9.paint(g2d); g2d.setColor(Color.GRAY); g2…
has title: JAVA Bounding Box / Collison Detection
tagged with: bounding-box
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31822469
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31822288
downvote count: 1
type: Question

http://stackoverflow.com/comment/31737242
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21097533
type: AnswerComment
has text: The Element interface is a subinterface of the Node interface. According to Liskov substitution principle(http://en.wikipedia.org/wiki/Liskov_substitution_principle) one can say that they are equivalent.

http://stackoverflow.com/comment/31752425
has text: http://www.oracle.com/technetwork/articles/entarch/effective-exceptions-092345.html and check out items 58 & 59 in Effective Java
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21105377

http://stackoverflow.com/a/21080091
has body: you need to move the line iView.setImageResource(R.drawable.apng); to within the run() method. currently, your run() method is waiting for a second, and then doing nothing. So the method flow goes: setImage &lt;- b.png postDelayed setImage &lt;- a.png 1000ms later run finished
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21080065
type: Answer
answers question: http://stackoverflow.com/q/21080065

http://stackoverflow.com/q/21176671
possible better answer: http://stackoverflow.com/a/21176691
tagged with: java
has answer: http://stackoverflow.com/a/21176691
upvote count: 1
tagged with: swing
downvote count: 1
type: Question
type: AnsweredQuestion
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21176698
favorite count: 0
accepted answer: http://stackoverflow.com/a/21176698
has title: Why is my JList not giving me a value for jlist.getSelectedValue() in java?
has body: I'm making a console panel for a Minecraft Server for a friend. It is generating a list of online players, and putting them in a JList. Here is all of the code concerning everything with the JList: public class Panel extends JPanel{ private static DefaultListModel listModel = new DefaultListModel(); private static JList list; public void demo(){ setLayout(new BorderLayout()); add(buttonCommandPanelInAnotherClass, BorderLayout.CENTER); list = new JList(listModel); list.setPreferredSize(new Dimension(260, this.getHeight())); list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); list.setLayoutOrientation(JList.VERTICAL); add(new JScrollPane(list), BorderLayout.WEST); } public static void generateUsers(){ //called from a button called refreshList String s = ... call for the user list ... (s contains ', ' as well as the usernames) String[] users = s.split(", "); // to seperate only the usernames for(int i = 0; i &lt; users.length; i++){ listModel.addElement(users[i]); } list = new JList(listModel); } public String getSelectedPlayer(){ //called when i push a command button, such as ban. return (String) list.getSelectedValue(); } } so for testing, i'm doing all the generation and everything, and when the generateUsers() is called, the JList is loaded with all of my usernames. but when I click a button to call getSelectedPlayer(); all that is printed in System.out.println(); is null. No matter how many users i have, the result is null. the buttons are in the same window, as shown above. why is my output only ever null? if i call list.getSelectedIndex(), it produces -1. Whats wrong? please help! i'm able to give any more details! Thanks in advance!
tagged with: jlist

http://stackoverflow.com/q/21094795
has title: Best practice on Spring Security for this requirement
tagged with: spring
accepted answer: http://stackoverflow.com/a/21102468
type: AnsweredQuestion
downvote count: 0
tagged with: authentication
type: Question
has answer: http://stackoverflow.com/a/21102468
has comment: http://stackoverflow.com/comment/31783234
has body: Current Spring app requires to add additional authentication checking from a POJO library. The POJO library includes several customized authentication module to choose. Some can be quite simple, like check the username and encrypted password within a URL from database, or from a file, others can be LDAP authentication or Web Service authenticate. The tricky part is current application has its own authentication method within security.xml, and we don't want to compromise either one. My goal is make this work based on minimal change. I think there might be several solutions for this but trying to get a good practice: Customize a Spring authentication provider to handle the pojo authentication for the authentication manager Customize a Spring pre-authentication(or something alike) bean for pojo and let app security do the next. Extends a filter class and register in web.xml, so this can make minimal change to the existing spring security context, but I am not sure how to make this handle the LDAP and WS authentication. and many other options if anyone can give a better hint. Thanks in advance.
score: 1
tagged with: java
upvote count: 1
answer count: 1
tagged with: spring-security
favorite count: 0

http://stackoverflow.com/q/21146651
tagged with: asynchronous
has answer: http://stackoverflow.com/a/29119620
has answer: http://stackoverflow.com/a/33458543
downvote count: 0
score: 13
tagged with: web-services
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21148332
accepted answer: http://stackoverflow.com/a/21148332
possible better answer: http://stackoverflow.com/a/29119620
has title: What is the purpose of asynchronous JAX-RS
tagged with: jax-rs
upvote count: 13
favorite count: 0
has body: I'm reading "RESTful Java with JAX-RS 2.0" book. I'm completely confused with asynchronous JAX-RS, so I ask all questions in one. The book writes asynchronous server like this: @Path("/customers") public class CustomerResource { @GET @Path("{id}") @Produces(MediaType.APPLICATION_XML) public void getCustomer(@Suspended final AsyncResponse asyncResponse, @Context final Request request, @PathParam(value = "id") final int id) { new Thread() { @Override public void run() { asyncResponse.resume(Response.ok(new Customer(id)).build()); } }.start(); } } Netbeans creates asynchronous server like this: @Path("/customers") public class CustomerResource { private final ExecutorService executorService = java.util.concurrent.Executors.newCachedThreadPool(); @GET @Path("{id}") @Produces(MediaType.APPLICATION_XML) public void getCustomer(@Suspended final AsyncResponse asyncResponse, @Context final Request request, @PathParam(value = "id") final int id) { executorService.submit(new Runnable() { @Override public void run() { doGetCustomer(id); asyncResponse.resume(javax.ws.rs.core.Response.ok().build()); } }); } private void doGetCustomer(@PathParam(value = "id") final int id) { } } Those that do not create background threads use some locking methods to store response objects for further processing. This example is for sending stock quotes to clients: @Path("qoute/RHT") public class RHTQuoteResource { protected List&lt;AsyncResponse&gt; responses; @GET @Produces("text/plain") public void getQuote(@Suspended AsyncResponse response) { synchronized (responses) { responses.add(response); } } } responses object will be shared with some background jobs and it will send quote to all clients when it is ready. My questions: In example 1 and 2 web server thread(the one that handle request) dies and we create another background thread. The whole idea behind asynchronous server is to reduce idle threads. These examples are not reducing idle threads. One threads dies and another one born. I though…
tagged with: rest
answer count: 3

http://stackoverflow.com/q/21159039
has comment: http://stackoverflow.com/comment/31850723
type: Question
score: 0
answer count: 2
tagged with: game-engine
tagged with: delay
has title: Set delay on image and then have it removed
has answer: http://stackoverflow.com/a/21159685
has answer: http://stackoverflow.com/a/21159226
type: UnansweredQuestion
tagged with: java
has body: I am programming a game where as one image changes place with another and I want the second image to be removed after 200ms, something I really could use some help with. I'm still a beginner and all help is appreciated! Answer as if you were talking to a five year old! public void setVisible(Boolean visible) { ImageIcon ii = new ImageIcon(this.getClass().getResource(explode)); image = ii.getImage(); //this.visible = visible; /*WITH THIS LINE OF CODE THE EXPLODE DOES NOT SHOW AT ALL, I WANT TO MAKE SURE IT SHOWS BUT ONLY FOR 200MS*/ } Thanks in advance!
linked to: http://stackoverflow.com/q/19209650

http://stackoverflow.com/comment/31779376
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21120437
has text: Are you compiling with Java 7 or 8?
type: Comment

http://stackoverflow.com/comment/31799826
has text: Hi..can u brief your answer with sample code..Thankyou
type: Comment
comment on: http://stackoverflow.com/a/21131300
type: AnswerComment
score: 0

http://stackoverflow.com/a/21102123
score: 3
has body: You're using the wrong LayoutParams. Use LinearLayout.LayoutParams instead of ActionBar.LayoutParams.
has comment: http://stackoverflow.com/comment/31746621
accepted answer of: http://stackoverflow.com/q/21101961
upvote count: 3
answers question: http://stackoverflow.com/q/21101961
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31746580
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/31746519

http://stackoverflow.com/q/21051224
type: Question
tagged with: jakarta-ee
tagged with: primefaces
accepted answer: http://stackoverflow.com/a/21051478
tagged with: jsf-2
answer count: 2
has body: I am quite new in developing website with JSF and PrimeFaces, I spent a lots of hours to research about my problem before post here. Thanks to everyone who spent time to read my question. Well, I'm using this in my menu template page: &lt;h:link value="Manage Examination" outcome="/backend/examination/index" /&gt; ... &lt;h:link value="List Examinations..." outcome="/WEB-INF/include/backend/examination/List.xhtml" /&gt; &lt;h:link value="Add Examination..." outcome="/WEB-INF/include/backend/examination/Create.xhtml" /&gt; My WEB-INF folder has this structure like below: WEB-INF \--include \\-----backend \\------'entity name' \\\-------'create,read,update,delete.xhtml' Outside of WEB-INF is my root web page folder, I have backend folder here, and its structure: webpages \--WEB-INF \--backend \\---'entity name' \\\---index.xhtml Inside each html I put these code: &lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui" template="/WEB-INF/include/templates/backend.xhtml"&gt; &lt;ui:define name="title"&gt; &lt;h:outputText value="#{appBundle.ExaminationTitle}"/&gt; &lt;/ui:define&gt; &lt;ui:define name="body"&gt; &lt;ui:include src="/WEB-INF/include/backend/examination/List.xhtml"/&gt; &lt;/ui:define&gt; &lt;/ui:composition&gt; And my question is: I didn't configure anything in faces-config.xml so could JSF know if I click to the link ? How could I keep the url in address bar always be /backend/examination/index even I click to the 'List Examination' or 'Add Examination' link with the outcome to /WEB-INF/include/backend/examination/* ? NNToan
possible better answer: http://stackoverflow.com/a/21051470
downvote count: 0
has answer: http://stackoverflow.com/a/21051470
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21051478
has title: How to use outcome in JSF 2x and keep same url in address bar?
tagged with: jsf
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/a/21138936
has comment: http://stackoverflow.com/comment/31814144
upvote count: 6
has comment: http://stackoverflow.com/comment/31813355
has comment: http://stackoverflow.com/comment/31812675
has comment: http://stackoverflow.com/comment/31812313
has comment: http://stackoverflow.com/comment/31812659
has comment: http://stackoverflow.com/comment/31813377
has comment: http://stackoverflow.com/comment/31813974
has comment: http://stackoverflow.com/comment/31814827
has comment: http://stackoverflow.com/comment/31814481
has comment: http://stackoverflow.com/comment/31813828
score: 6
has comment: http://stackoverflow.com/comment/31812335
has comment: http://stackoverflow.com/comment/31812613
has comment: http://stackoverflow.com/comment/31813716
has comment: http://stackoverflow.com/comment/31812875
has comment: http://stackoverflow.com/comment/31813821
has comment: http://stackoverflow.com/comment/31813443
has comment: http://stackoverflow.com/comment/31813175
has comment: http://stackoverflow.com/comment/31812913
accepted answer of: http://stackoverflow.com/q/21138920
has comment: http://stackoverflow.com/comment/31814506
has body: Different collections have different performance consequences for this, for ArrayList the saving can be very noticeable. import java.util.*; public class Main{ public static void main(String[] args){ List&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;(5); int max = 1000000; // Warmup for (int i=0;i&lt;max;i++) { numbers.add(i); } long start = System.currentTimeMillis(); numbers = new ArrayList&lt;Integer&gt;(max); for (int i=0;i&lt;max;i++) { numbers.add(i); } System.out.println("Preall: "+(System.currentTimeMillis()-start)); start = System.currentTimeMillis(); numbers = new ArrayList&lt;Integer&gt;(5); for (int i=0;i&lt;max;i++) { numbers.add(i); } System.out.println("Resizing: "+(System.currentTimeMillis()-start)); } } Result: Preall: 26 Resizing: 58 Running with max set to 10 times the value at 10000000 gives: Preall: 510 Resizing: 935 So you can see even at different sizes the ratio stays around the same. This is pretty much a worst-case test but filling an array one element at a time is very common and you can see that there was a roughly 2*speed difference.
has comment: http://stackoverflow.com/comment/31813662
has comment: http://stackoverflow.com/comment/31814261
has comment: http://stackoverflow.com/comment/31814560
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31812595
downvote count: 0
has comment: http://stackoverflow.com/comment/31812562
has comment: http://stackoverflow.com/comment/31814458
type: Answer
answers question: http://stackoverflow.com/q/21138920
has comment: http://stackoverflow.com/comment/31813319
has comment: http://stackoverflow.com/comment/31813640
has comment: http://stackoverflow.com/comment/31812504

http://stackoverflow.com/q/21110138
answer count: 1
downvote count: 1
has body: I need a suggestion to solve the following problem. I have two web applications (let's say WEBAPP-A and WEBAPP-B) running under the same application server. Each login page in each application page activates a specific applet (let's call them JAPP-A and JAPP-B, respectively). These two applets need to use the same DLL. Each applet (JAPP-A or JAPP-B) works OK when accessing the application separately (in our case the browser used is Internet Explorer 8.0 and the JRE version of the client is 1.7.0_45). However, when redirecting from WEBAPP-A to WEBAPP-B, the applet JAPP-B crashes. I get the error: UnsatisfiedLinkError: 'DLL already loaded in another classloader' So I have tried to use the same classloader for JAPP-A and JAPP-B by setting the same CODEBASE value inside the applet tag and deploying the JAR containing the JAPP-B code under the CODEBASE path, but we got the same error message. Can anyone suggest an alternative approach in order to get the applet JAPP-B working correctly?
tagged with: applet
favorite count: 0
tagged with: classloader
type: UnansweredQuestion
has title: Same DLL accessed by two applets in 2 web applications
tagged with: java
type: Question
tagged with: dll
tagged with: unsatisfiedlinkerror
has answer: http://stackoverflow.com/a/21110401
score: 0
upvote count: 1

http://stackoverflow.com/a/21046982
answers question: http://stackoverflow.com/q/21046765
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31644072
has comment: http://stackoverflow.com/comment/31644592
type: Answer
score: 2
upvote count: 2
has body: but after restarting console with PC I keep having the same java version after checking: It seems that you used set in order to set the environment variable. Saying set FOO bar would set the variable FOO to bar only for the current terminal. If you open another terminal window, you wouldn't see the change. In order to make the change permanent, use setx: setx JAVA_HOME "C:\Program Files\Java\jdk1.6.0_45" setx Path "%JAVA_HOME%\bin;%Path%"
has comment: http://stackoverflow.com/comment/31644133
has comment: http://stackoverflow.com/comment/31644414
accepted answer of: http://stackoverflow.com/q/21046765

http://stackoverflow.com/comment/31789105
has text: I'm not sure which line is getting it - I just know it's reaching the line: } catch (InvalidKeyException exception) { (I dont see anything useful in my stacktrace for some reason)
type: Comment
comment on: http://stackoverflow.com/q/21124475
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31819998
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21143045
has text: You're setting the static 40dp width on rankView, it won't fill its parent as you explicitly set it. All the content inside it will be fit to that 40dp width.
score: 0

http://stackoverflow.com/q/21072930
has comment: http://stackoverflow.com/comment/31691724
tagged with: threadpoolexecutor
favorite count: 0
possible better answer: http://stackoverflow.com/a/21072968
has answer: http://stackoverflow.com/a/21073464
score: 2
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/21072966
tagged with: multithreading
has answer: http://stackoverflow.com/a/21072968
type: Question
has body: I have a ThreadPoolExecutor: ThreadPoolExecutor service = new ThreadPoolExecutor(N_THREADS, N_THREADS, 0L, TimeUnit.MILLISECONDS, blockingQueue, rejectedExecutionHandler); The service executes threads implementing the Runnable interface. Each thread processes a file on disk. I found that after several hours, two threads (or cores depending on what htop shows in Linux) were running and had been running for 13 hours. What's even worse is that the remaining cores showed no activity as if they were waiting for the two threads to complete. Questions: 1 - I have read a lot on how this problem may be resolved but nothing conclusive. As far as I can work out, you CANNOT stop a Runnable using the ThreadPoolExecutor because it is an independent thread that just runs. Using the Future framework: Future&lt;?&gt; f = f.get(submittedtask,XX) allows you to set a timeout and fetch the future result, but get blocks all the threads effectively making the implementation serial. Is it possible to interrupt a Runnable after a given time using the threadpoolexecutor, get the thread back to the pool so it can pickup a new task and carry on. 2 - My big concern is why, using htop, I see two threads/cores running and no other core/thread are running despite many tasks are still waiting to execute (i.e. there are many files left to process). Any insight?
has title: Interrupt Runnable that takes hours
has answer: http://stackoverflow.com/a/21072966
tagged with: java
has comment: http://stackoverflow.com/comment/31722060
upvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/31694785
tagged with: runnable

http://stackoverflow.com/comment/31823293
score: 0
has text: you only ever have two objects in memory
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21144713

http://stackoverflow.com/comment/31633986
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21041673
has text: I hope you have a versioning system in which you have tags/snapshots of all those versions you are talking about. Maven is not a magic hammer which solves all your problems, only your brain is such a tool.
score: 0

http://stackoverflow.com/comment/31711567
has text: Got an example of what you are currently doing?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21083386
score: 0

http://stackoverflow.com/a/21160736
has body: You shouldn't store so much data an ArrayList. For such reasons where databases invented. If you want to get a specific data you should execute a query and then store the result as an object, and put these objects into an a List if you need them any more. If you need to Aggregate Data you could also make a Wrapper objects for tha data.
score: 0
answers question: http://stackoverflow.com/q/21159988
type: Answer

http://stackoverflow.com/comment/31606962
has text: http://stackoverflow.com/q/2927391/738746
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21026380

http://stackoverflow.com/a/21034617
type: Answer
has body: You must escape the regex with an additional \ since \ denotes the escape character: public static void main(String[] args) { String numbers = "5 1 5 1"; String[] tokens = numbers.split("\\s+"); for(String token:tokens){ System.out.println(token); } } So the additional \ escapes the next \ which is then treated as the literal \. When using \\s+ the String will be split on multiple whitespace characters (space, tab, etc).
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21034584
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21034584

http://stackoverflow.com/comment/31677547
has text: Please post your complete code, the error is not in what you posted, but somewhere else in the syntax.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21065215
score: 1

http://stackoverflow.com/a/21121424
answers question: http://stackoverflow.com/q/21118368
type: Answer
has body: You need to set up something known as Port Forwarding through your route (where the server is hosted): Look here: http://www.wikihow.com/Set-Up-Port-Forwarding-on-a-Router Be careful because you will be making your computer accessible through the internet. Also your home ip address in most cases is dynamic (changes from time to time) so make sure you are using the correct ip to access the server. Check out http://www.noip.com/ for a manager ip address.s
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21118368
score: 1

http://stackoverflow.com/a/21146846
answers question: http://stackoverflow.com/q/21146783
type: Answer
score: 2
upvote count: 2
has body: Your getActivity returns null you should initialize wifiMgr inside onCreate WifiManager wifiMgr =null; WifiInfo wifiInfo = null; String WifiName = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); wifiMgr= (WifiManager) this.getSystemService(Context.WIFI_SERVICE); wifiInfo = wifiMgr.getConnectionInfo(); WifiName = wifiInfo.getSSID(); TextView outputWifiName = (TextView) findViewById(R.id.sysInf); outputWifiName.setText(WifiName); }
accepted answer of: http://stackoverflow.com/q/21146783
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31831675
type: Comment
type: QuestionComment
has text: Month count is 0. Check the condition below, it must be returning false `if (clientDate.equalsIgnoreCase(chosenMonth)) ` }
score: 0
comment on: http://stackoverflow.com/q/21148621

http://stackoverflow.com/a/21054501
has comment: http://stackoverflow.com/comment/31659108
has comment: http://stackoverflow.com/comment/31658324
has comment: http://stackoverflow.com/comment/31658845
score: 16
has comment: http://stackoverflow.com/comment/31658655
downvote count: 0
has comment: http://stackoverflow.com/comment/31658160
has comment: http://stackoverflow.com/comment/31658475
has comment: http://stackoverflow.com/comment/31658872
has comment: http://stackoverflow.com/comment/31658260
has body: You're mixing up two concepts: Servlets and Spring's ApplicationContext. Servlets are managed by your Servlet container, let's take Tomcat for example. The ApplicationContext is managed by Spring. When you declare a Servlet in your deployment descriptor as servletOne mypackage.servletOne servletOne /servletOne The Servlet container will create an instance of your mypackage.servletOne class, register it, and use it to handle requests. This is what it does with the DispatcherServlet which is the basis of Spring MVC. Spring is an IoC container that uses ApplicationContext to manage a number of beans. The ContextLoaderListener loads the root ApplicationContext (from whatever location you tell it to). The DispatcherServlet uses that root context and must also load its own. The context must have the appropriate configuration for the DispatcherServlet to work. Declaring a bean in the Spring context, like <property name="message" ref="classObject" /> regardless of the fact that it is of the same type as the declared in web.xml, is completely unrelated. The bean above has nothing to do with the declaration in the web.xml. As in my answer here, because the ContextLoaderListener puts the ApplicationContext it creates into the ServletContext as an attribute, that ApplicationContext is available to any Servlet container managed object. As such, you can override the HttpServlet#init(ServletConfig) in your custom HttpServlet classes, like so @Override public void init(ServletConfig config) throws ServletException { super.init(config); ApplicationContext ac = (ApplicationContext) config.getServletContext().getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); this.someObject = (SomeBean)ac.getBean("someBeanRef"); } assuming that your root ApplicationContext contains a bean called someBeanRef. There are other alternatives to this. This, for example.
type: AcceptedAnswer
upvote count: 16
has comment: http://stackoverflow.com/comment/31658605
has comment: http://stackoverflow.com/comment/31659029
has comment: http://stackoverflow.com/comment/31658108
has comment: http://stackoverflow.com/comment/31659209
type: Answer
accepted answer of: http://stackoverflow.com/q/21054013
has comment: http://stackoverflow.com/comment/31658407
answers question: http://stackoverflow.com/q/21054013

http://stackoverflow.com/q/21137162
favorite count: 0
type: UnansweredQuestion
tagged with: garbage-collection
downvote count: 0
tagged with: java
has body: my application is deployed on a weblogic running on Solaris, on a dual SPARC T4 8-core 3.0 GHz. This weblogic instance is using g1 gc and I think it's possible to improve the current configuration: GC_OPTIONS=" -server -XX:ConcGCThreads=4 -XX:+UseG1GC -XX:+DisableExplicitGC -XX:MaxGCPauseMillis=300 -XX:GCPauseIntervalMillis=1000 -XX:+UseNUMA -XX:+UseCompressedOops -XX:ReservedCodeCacheSize=128m -Dweblogic.ThreadPoolPercentSocketReader=50 -Dweblogic.ThreadPoolSize=100 -Dweblogic.SelfTunningThreadPoolSizeMin=100 " It strikes me that ConcGCThreads has been set without also establishing a value for ParallelGCThreads. I think it would make a good start to make these two values display a sensible proportion. Oracle's doc says: -XX:ParallelGCThreads=n Sets the value of the STW worker threads. Sets the value of n to the number of logical processors. The value of n is the same as the number of logical processors up to a value of 8. If there are more than eight logical processors, sets the value of n to approximately 5/8 of the logical processors. This works in most cases except for larger SPARC systems where the value of n can be approximately 5/16 of the logical processors. There is no clear statement as to what a "logical processor" is. I've searched the web and it looks like it can be understood as a thread running in a physical processor or core. The amount of "logical processors" in the rack this wl is running on would thus amount to 128 (2 8-core processors "with the ability to switch between 8 threads", according to http://www.oracle.com/technetwork/server-storage/sun-sparc-enterprise/documentation/o11-090-sparc-t4-arch-496245.pdf). But I'm told that 64 out of these 128 "logical processors" are reserved for the database, the remaining ones being shared for running Tuxedo and weblogic servers. Assuming that there are two weblogic instances and that it's safe to consider that the tuxedo and the wl instances consume the same number of threds, it could be argued that (64/…
has answer: http://stackoverflow.com/a/21148061
has title: Proper G1 GC tuning for sparc T4 8-core
type: Question
score: 4
tagged with: sparc
tagged with: weblogic11g
tagged with: g1gc
answer count: 1
upvote count: 4

http://stackoverflow.com/q/21066910
favorite count: 0
type: Question
has title: Java Multithreading and Reading from Serial: How to Properly Suspend and Resume?
has body: I am trying to write a basic Java Swing application that works as such: an Arduino writes two CSV strings to the COM port every second, I read that data and parse it, and then display the data in a GUI. With some help from the official Arduino tutorials, I am at the point where I can read and parse the data coming in from the serial port, and display it. However, I would be able to pause and resume the GUI (while still reading from serial) using a key on the keyboard. I was able to pause the program, but cannot figure out how to resume it. I've been looking around online for a while now to no avail. If someone could point me in the right direction, I'd sincerely appreciate it. I'm rather new to threads and the Arduino, but have some basic Java experience. Here is the code below, which is broken up into three classes (one to read from serial, one for the GUI, and a main class to run everything. Thanks! Here is the "Display" class: //Imports import java.awt.*; import javax.swing.*; import java.util.Random; import java.lang.Thread; import java.awt.event.*; import java.util.ArrayList; import java.awt.Toolkit.*; //Class Definition public class Display extends JPanel implements Runnable { //Variables private volatile Thread t; private volatile boolean threadSuspended; //Data Strings private String data; private String carData; private String gpsData; //Car Data private int event; private int engineRPM; private int cvtRPM; private double kph; private int brake; private double accel_x; private double accel_y; private double accel_z; private double gyro_x; private double gyro_y; private double gyro_z; //GPS Data private String sentence; private int time; private String status; private double latitude; private String latitudeDir; private double longitude; private String longitudeDir; private double knots; private double angle; private int date; private double magVar; private char magVarDir; private String checksum; //Constructor public Display() { super.setSize(800,800); setL…
tagged with: serial-port
has comment: http://stackoverflow.com/comment/31681293
tagged with: multithreading
tagged with: arduino
upvote count: 1
tagged with: swing
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31684595
downvote count: 0
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/31681150

loops
tags question: http://stackoverflow.com/q/21025225
tags question: http://stackoverflow.com/q/21144598
tags question: http://stackoverflow.com/q/21065002
tags question: http://stackoverflow.com/q/21038812
tags question: http://stackoverflow.com/q/21082509
tags question: http://stackoverflow.com/q/21045820
tags question: http://stackoverflow.com/q/21037994
tags question: http://stackoverflow.com/q/21055228
tags question: http://stackoverflow.com/q/21020432
tags question: http://stackoverflow.com/q/21073313
tags question: http://stackoverflow.com/q/21176216
tags question: http://stackoverflow.com/q/21035079
type: Tag
tags question: http://stackoverflow.com/q/21139786
tags question: http://stackoverflow.com/q/21048870
tags question: http://stackoverflow.com/q/21057588
tags question: http://stackoverflow.com/q/21060604
tags question: http://stackoverflow.com/q/21167651
tags question: http://stackoverflow.com/q/21096276
tags question: http://stackoverflow.com/q/21104223
tags question: http://stackoverflow.com/q/21148766
tags question: http://stackoverflow.com/q/21085963
tag name: loops
tags question: http://stackoverflow.com/q/21056526
tags question: http://stackoverflow.com/q/21147508
tags question: http://stackoverflow.com/q/21081753
tags question: http://stackoverflow.com/q/21078756
tags question: http://stackoverflow.com/q/21173801
tags question: http://stackoverflow.com/q/21066340
tags question: http://stackoverflow.com/q/21062211
tags question: http://stackoverflow.com/q/21138317
tags question: http://stackoverflow.com/q/21057594
tags question: http://stackoverflow.com/q/21161816
tags question: http://stackoverflow.com/q/21064702

http://stackoverflow.com/comment/31812133
type: AnswerComment
has text: r1 is the rectangle for one missile.And r2 is the rectangle for each alien ship.I am using the for loops to checck them like a 2D array.?There can't be another way,can it?
comment on: http://stackoverflow.com/a/21138482
type: Comment
score: 0

http://stackoverflow.com/comment/31853046
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21154964
type: Comment
has text: ok, I don't have any ready made code. but [this](http://axis.apache.org/axis/java/user-guide.html#Consuming_Web_Services_with_Axis) will help

http://stackoverflow.com/a/21127629
score: 0
has body: How big is your database? How many users do you have in your userIndex ? What is your memory / heap configuration? I assume you run into a lot of GC issues, as Cypher tries to fit the whole db into memory for your queries. Also on cold caches and little memory you basically measure disk speed to pull the data into memory. You can combine your queries into one. START user=node:userIndex("Username:*") RETURN has(user.FullNodeCreationTime),has(user.NumFollowers), COUNT(*) AS num that should return 4 entries for the 4 combos which you can easily use / aggregate All of these are not graph queries, and also graph global queries. So neither Neo4j nor Cypher are optimized for them :)
answers question: http://stackoverflow.com/q/21099010
has comment: http://stackoverflow.com/comment/31813070
type: Answer
has comment: http://stackoverflow.com/comment/31813022

http://stackoverflow.com/a/34725715
score: 0
type: Answer
has body: First, run your query from the shell using EXPLAIN to see how the query is being run. That's alway the first place to start understanding performance issues. Second, if I'm understanding your first query correctly you simply want to know how many nodes have the property FullNodeCreationTime. You existing query isn't really using an index in an optimal way as you aren't looking for a specific value. It also appears as if you are looking at a single node type, meaning a node with a specific label such as User. If that is correct, then I would create an index on User.FullNodeCreationTime and simply run this query: match (u:User) where has (u.FullNodeCreationTime) return count(u) That should perform much better.
answers question: http://stackoverflow.com/q/21099010

http://stackoverflow.com/comment/31835593
comment on: http://stackoverflow.com/q/21150516
has text: Question seems ok to me. Traversing the tree left aside you just want to find the common part of two sets of children ([4, 5, 6] + [1, 2, 3, 4, 5, 6] = [4, 5, 6])? http://stackoverflow.com/questions/2851938/efficiently-finding-the-intersection-of-a-variable-number-of-sets-of-strings
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31878337
type: QuestionComment
comment on: http://stackoverflow.com/q/21174735
score: 0
has text: @HotLicks Yes, but it's ugly and intentionally confusing. More problematic is the assignment within conditional, which any decent IDE/lint/PMD will flag. Not to mention the deceiving `return b=false`.
type: Comment

http://stackoverflow.com/q/21166293
has comment: http://stackoverflow.com/comment/31862723
has comment: http://stackoverflow.com/comment/31890216
type: UnansweredQuestion
has title: Around Advice for methods on Interface
type: Question
has answer: http://stackoverflow.com/a/21183899
tagged with: spring
has comment: http://stackoverflow.com/comment/31890618
answer count: 1
has comment: http://stackoverflow.com/comment/31890813
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31896047
has body: I am trying to add an around advice on methods declared in an interface. My package structure is as follows: sample sample.ifaces( this package has SampleInterface which has method declared sampleOperation) sample.ifaces.impl(this package has SampleImplementation which implements sampleOperation) sample.aspect(class SampleAspect) In SampleAspect I am trying to add around advice @Component @Configuration @EnableAspectJAutoProxy @Aspect public class SampleAspect { //@Pointcut("execution(public * sample.ifaces.impl.SampleImplementation .*(..))") //@Pointcut("within(sample.ifaces.SampleInterface+) &amp;&amp; execution(* sample*(..))") //@Pointcut("execution(public * sample.ifaces.SampleInterface+.sample*(..))") //@Pointcut("execution(* sample.ifaces.SampleInterface.*(..))") //@Pointcut("execution(* sample.ifaces.SampleInterface+.*(..))") @Pointcut("execution(* sample.ifaces.SampleInterface.sample*(..))") public void retry() { } @Around("retry()") private void retryHandler(ProceedingJoinPoint pjp){ Object o = null; try { logger.info("before exec"); o = pjp.proceed(); } catch (Exception e) { logger.info("exception in exev"); } catch (Throwable e) { logger.error("unknown"); } } } I tried many combinations to make it work but its not working. I need to have Pointcut defined for method SampleOperation at interface level and the when the implemented method executes via super-class reference, the advice should get executed. ** UPDATE ** I analysed this further. My new package structure is: sample sample.config(This package has ConfigBean which is defined in appContext.xml as bean) sample.ifaces( this package has SampleInterface which has method declared sampleOperation) sample.ifaces.impl(this package has SampleImplementation which implements sampleOperation) sample.aspect(class SampleAspect defined in App context as bean ) ConfigBean bean is initialized from appContext. The initialize method contains code to initialize SampleInterface reference. SampleInterface is not a sprin…

http://stackoverflow.com/q/21133573
score: 3
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21136351
answer count: 1
has body: i'm using following code to generate pdf by html but the rupee symbol is not showing. I can see rupee sign in html but not in pdf file. Document document = new Document(); writer = PdfWriter.getInstance(document, new FileOutputStream("pdf path")); FileReader reader = new FileReader("html path"); document.open(); XMLWorkerHelper.getInstance().parseXHtml(writer, document, reader); document.close(); Please help me.
has title: How to register Indian rupee sign in itext pdf generated by html
favorite count: 0
upvote count: 3
tagged with: http://stackoverflow.com/tag/pdf
type: UnansweredQuestion

http://stackoverflow.com/comment/31820561
has text: You're going to need to look into threading!
type: Comment
comment on: http://stackoverflow.com/q/21143416
type: QuestionComment
score: 4

http://stackoverflow.com/comment/31658039
comment on: http://stackoverflow.com/a/21051205
has text: Besides the comment of @Pshemo about adding `.withDayOfWeek(1)` I have to remember that Joda Time is unfortunately only working with ISO-week starting on Monday. For Europe this is quite okay, but in US this is a no-go. Java 8 (and my time library) will do this much better.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/31779762
comment on: http://stackoverflow.com/q/21120550
has text: Looks to me that you want to Keep a Set of BattingOrder,and every time you encounter a BattingOrder that is better that what is on the set, you do a replacement.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21111671
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21111800
score: 1
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/21111800
answer count: 2
downvote count: 0
has title: How do I run a terminate command on JFrame exit?
has answer: http://stackoverflow.com/a/21111851
favorite count: 0
has body: I know the basics behind trying to write code that terminates a thread, but I've run into a bit of a problem. I've got a JButton in a JFrame GUI that launches the simulation I'm trying to animate. It is called in the ActionPerformed code of the JButton by new AnswerWorker().execute(); The AnswerWorker class, in turn, extends SwingWorker so that the animation frame can be drawn while the GUI is still active. public class AnswerWorker extends SwingWorker&lt;String, Integer&gt; { protected String doInBackground() throws Exception { Threading threading = new Threading(); return null; } protected void done() { try { JOptionPane.showMessageDialog(InputGUI.this, AMEC.unsuccesfulpercentage + "% of iterations had trucks that had to sleep over"); AMEC.unsuccesfulpercentage = 0; } catch (Exception e) { e.printStackTrace(); } } } To create a way of stopping the simulation thread, I created the class Threading, that calls the function that runs the simulation. public class Threading extends Thread { @Override public void run() { while (!Thread.currentThread().isInterrupted()) { try { AMEC.runsimulation(); } catch (IOException ex) { Logger.getLogger(InputGUI.class.getName()).log(Level.SEVERE, null, ex); } catch (InterruptedException ex) { Logger.getLogger(InputGUI.class.getName()).log(Level.SEVERE, null, ex); } } return; } } Now, in the runsimulation() function, I initialize a JFrame, and I want to terminate the thread running the simulation if the JFrame is closed by clicking on its close button. How do I do this? EDIT: all of the above code is called in a file InputGUI.java that contains all my GUI elements. The runsimulation function is in my main project file, AMEC.java
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/21111851
upvote count: 1
tagged with: swing

http://stackoverflow.com/comment/31772665
comment on: http://stackoverflow.com/a/21116779
type: AnswerComment
has text: Create a schema for this (a separate table is likely the best). Every time someone logs in or out you write a record to that table.
score: 0
type: Comment

http://stackoverflow.com/q/21143952
tagged with: junit
downvote count: 0
has answer: http://stackoverflow.com/a/21144202
favorite count: 0
has title: selenium structuring patterns java
has comment: http://stackoverflow.com/comment/31821786
tagged with: design-patterns
type: UnansweredQuestion
score: 1
tagged with: java
has body: I'm pretty new to Selenium, but have good coding experience I'm working on automation of very complex web application. For my testing i'm using junit framework. I don't want my classes to expand to gigantic sizes, so this is how i'm dividing my automation per page. For ex. i have homepage. From it i can get to settings, dashboard and many other pages. So all modifications/functionality related to homePage i keep at homepage class. Then for each next page i have another class, where i'm creating webdriver and assigning it to the previous page webdriver. So again each class is reflecting functionality i can achieve on that particular page. So let's say i have 4th level page, i will have a class of that 4th level, on creating it will go to create 3rd level page, 3rd will create 2nd level first ans so on,and at some point i will get down to the very first login page. Basically i have a tree with my loginPage in the head of it. It works very well and i have no problems with it until it comes to junit. I like an idea of closing the browser in my @After class and i'm having different page classes.. How can i bend it all together that no matter what class-Page i create and work with at my test, my after method is closing that browser? Thanks
tagged with: selenium
has answer: http://stackoverflow.com/a/21166840
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31821772
tagged with: automation
answer count: 2
has comment: http://stackoverflow.com/comment/31822299

http://stackoverflow.com/comment/31862549
score: 0
has text: thanks for explanation and code example! I assume SwingUtilities.invokeLater is called inside the main method of the client class ?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21161917

http://stackoverflow.com/comment/31869629
type: Comment
type: AnswerComment
has text: Thanks for your suggestions. As for the 4 key tuning flags mentioned by the oracle tutorial, I have not many clues as to whether it pays off to try to tune them or what values to start with. I've noticed that roughly only 1 in 5 or 6 collections is mixed, and I guess it could be good to try to have as many mixed collections as possible, but neither do I know for sure whether it can be accomplished by setting G1MixedGCLiveThresholdPercent and G1MixedGCCountTarget, nor do I have the slightest idea what values would be acceptable.
score: 0
comment on: http://stackoverflow.com/a/21148061

http://stackoverflow.com/comment/31659337
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21055228
has text: Why would it be more optimal to edit the contents of the queue multiple times? The second option you show only edits the contents of the queue once, so it should perform better anyway.

http://stackoverflow.com/q/21041673
tagged with: java
answer count: 3
tagged with: maven
upvote count: 1
has comment: http://stackoverflow.com/comment/31634964
type: UnansweredQuestion
tagged with: date
linked to: http://stackoverflow.com/q/30571
has comment: http://stackoverflow.com/comment/31633944
has comment: http://stackoverflow.com/comment/31636384
has body: Is it any way to run Maven as if you were in another date? My problem is I have a pom that worked with a large amount of "RELEASE" versions a month ago, but now some changes in the packages makes my project unable to run (support for some features has been discontinued). Unfortunately this dependencies are quite a lot and I don't know the version they were at that time, is there any way to run maven and tell to download the packages that were "RELEASE" version as of a specified date? I'm editing because I feel I explained my problem poorly. Assume I have the following dependency in my pom.xml commons-io commons-io RELEASE If I run "mvn something" today it will fetch commons-io 2.4 but if I were to run two years ago it would have fetched commons-io 2.2 I'd like to run maven and tell him to fetch the package being the RELEASE version at some time in the past.
downvote count: 0
has comment: http://stackoverflow.com/comment/31633842
score: 1
has answer: http://stackoverflow.com/a/21046050
favorite count: 0
has title: How to run Maven as if you were in the past
has answer: http://stackoverflow.com/a/21044306
type: Question
has answer: http://stackoverflow.com/a/21041789
has comment: http://stackoverflow.com/comment/31640772
tagged with: dependencies
has comment: http://stackoverflow.com/comment/31633986

http://stackoverflow.com/q/21079193
score: 0
has comment: http://stackoverflow.com/comment/31712455
tagged with: rest
type: UnansweredQuestion
answer count: 0
tagged with: java
tagged with: tomcat7
tagged with: jersey-client
has comment: http://stackoverflow.com/comment/31714913
type: Question
has body: I am testing REST Apis using jersey client. They are hosted on tomcat7. For some requests, I am not getting any response from the server. When I checked in the logs, then I didn't find any log created by that particular API in catalina.out I am totally confused what can be the issue. Is it a kind of bug in REST Apis which I am testing or it is some sort of bug in Jersey Client API???
has title: HTTP Requests not reaching to tomcat using jersey client
tagged with: jersey

http://stackoverflow.com/a/26758757
score: 0
upvote count: 1
downvote count: 1
has body: (I understand it's a very old question, but I thought adding this would be beneficial and somebody might find it useful.) If you are using Android Studio, you can directly add Maven dependencies in you build.gradle file. This can save a lots of time and hassle. e.g. link for OP's original request https://mvnrepository.com/artifact/com.github.chrisbanes.photoview/library/1.2.3
answers question: http://stackoverflow.com/q/21110640
type: Answer

http://stackoverflow.com/comment/31748676
score: 2
comment on: http://stackoverflow.com/q/21103153
has text: `new File(mainFolder + "223545".mkdirs();` won't even compile, so it can't possibly have been copied from working code.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/45916424
answers question: http://stackoverflow.com/q/21083170
has body: 1.1 Update via a properties file. /src/main/resources/application.properties server.port=8888 Update via a yaml file. server: port: 8888 EmbeddedServletContainerCustomizer @Component public class CustomContainer implements EmbeddedServletContainerCustomizer { @Override public void customize(ConfigurableEmbeddedServletContainer container) { container.setPort(8888); } }
type: Answer
upvote count: 11
downvote count: 2
score: 9

http://stackoverflow.com/q/21146162
has answer: http://stackoverflow.com/a/21146309
tagged with: sqlite
has comment: http://stackoverflow.com/comment/31826113
has answer: http://stackoverflow.com/a/21146268
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/21146268
type: AnsweredQuestion
upvote count: 2
tagged with: java
downvote count: 2
has title: How to write a SQLite
type: Question
has body: I have a database with two tables , First one contains 2 columns: group_ID , group_name . And the second one : ID, Word, Definition , word_group_id . This is the prototype of the function which I am going to write WordContainer [] findWordsByGroupId(int id); and this is the WordContainer class: public class WordContainer { String word; String definition; int id = -1; public WordContainer (int id , String word ,String definition){ this.id = id; this.word = word; this.definition = definition; } public void setWord (String word){ this.word = word; } public void setDefinition (String definition){ this.definition = definition; } public String getWord (){ return this.word; } public String getDefinition (){ return this.definition; } } So the question is , How to write a SQLite query which will find all the rows (or ids of those rows)which have the given group_id ;
score: 0
possible better answer: http://stackoverflow.com/a/21146309
answer count: 2
tagged with: sql

http://stackoverflow.com/a/41108549
type: Answer
answers question: http://stackoverflow.com/q/21091188
has body: I used a Jersey specific Jackson package in a slightly different case, it worked. Detailed configuration is described in Jersy document. In my case, I used a generic type field in an @XmlRootElement class. MOXy added a type in the JSON output. I can see why MOXy does it. If the JSON output needs to be unmarshalled back to a Java object, MOXy needs to know the type to create the correct object. However, in my case, the type is unsightly in the JSON output.
score: 0

http://stackoverflow.com/comment/39176139
score: 1
type: AnswerComment
type: Comment
has text: I can. The above example I needed to send information off to a JSP. You can store information for such a task as so: request.setAttribute( "mainTabs", mainTabs ); then you can do something like the following to retrieve the needed information in the JSP that requires it: String mainTabs = (String) request.getAttribute( "mainTabs" );
comment on: http://stackoverflow.com/a/21176439

http://stackoverflow.com/q/21030110
accepted answer: http://stackoverflow.com/a/21030243
has body: I have two entity objects (A and B) that have a One-To-Many relationship. I am using JPA (Hibernate) to join these tables and query them for a specific result set, but the criteria I specify for the child table (B) are not applied when fetching my results. This is how I have defined the query: CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery&lt;A&gt; query = builder.createQuery(A.class); Root&lt;A&gt; a = query.from(A.class); Join&lt;A, B&gt; abJoined = a.join(A_.b); query.distinct(true) .where(builder.and( builder.equal(a.get(A_.id), id), builder.equal(a.get(A_.active), 1), builder.equal(a.get(A_.location), 1011), builder.equal(a.get(A_.status), "Pending"), builder.equal(abJoined.get(B_.status), "Not Moved"), builder.greaterThan(abJoined.get(B_.detailId), 0) )); When I call entityManager.createQuery(query).getResultList(); I get one instance of entity 'A', but when I try to access 'B' through 'A' a.getB() the two criteria that I had specified for abJoined are not applied and I get all instances of 'B' that are joined to 'A'. Is there something more I need to do to get these criteria applied? If the criteria cannot be applied, is there a recommended method for removing the corresponding instances of 'B' from the result set? I can provide more code or other details if necessary.
type: Question
answer count: 2
tagged with: jpa
has title: Specifying criteria for child table in One To Many Relationship
downvote count: 0
has answer: http://stackoverflow.com/a/21030243
favorite count: 0
tagged with: one-to-many
upvote count: 2
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/45182444
has answer: http://stackoverflow.com/a/45182444
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/31909345
score: 0
type: AnswerComment
type: Comment
has text: @arshajii Can't call `o` outside of the method, is what I meant - not the value. If `new Object()` is the value, what's the name for `o`?
comment on: http://stackoverflow.com/a/21053023

http://stackoverflow.com/a/21037218
has comment: http://stackoverflow.com/comment/31626848
has body: I don't know who is fragobj but at case 4 I think you have a typo, instead of: FragmentLipaChurches fragobj = new FragmentLipaChurches(); fragobj.setArguments(bundle); you should have: fragment.setArguments(bundle); At least FragmentLipaChurches should be handled differently since you're creating there an instance of FragmentNaturalSite but you're setting the arguments to FragmentLipaChurches. So FragmentNaturalSite doesn't have the arguments set, that's why the NPE.
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21037117
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21037117
type: Answer
has comment: http://stackoverflow.com/comment/31626740

http://stackoverflow.com/q/21029857
has title: Getting Exception - Cannot call sendRedirect() after the response has been committed
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31613608
score: 1
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/2123514
upvote count: 1
tagged with: spring-mvc
duplicate of: http://stackoverflow.com/q/2123514
tagged with: java
tagged with: authentication
has comment: http://stackoverflow.com/comment/31613332
has body: I was writing a interceptor for login help. public class LoginInterceptor extends HandlerInterceptorAdapter { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { HttpSession session = request.getSession(); System.out.println("GreetingInterceptor: REQUEST Intercepted for URI: " + request.getRequestURI()); System.out.println(session.getAttribute("userName")); /*if(request.getRequestURI().equalsIgnoreCase("/studentenrollmentsystem/login")){ return true; } if(request.getRequestURI().equalsIgnoreCase("/studentenrollmentsystem/loginaction")){ return true; }*/ if(session.getAttribute("userName") != null){ if(request.getRequestURI().equalsIgnoreCase("/studentenrollmentsystem/login")){ response.sendRedirect("loginaction"); return true; } else{ return true; } /*if(request.getRequestURI().equalsIgnoreCase("/studentenrollmentsystem/loginaction")){ return true; } return true;*/ } else{ if(request.getRequestURI().equalsIgnoreCase("/studentenrollmentsystem/login") || request.getRequestURI().equalsIgnoreCase("/studentenrollmentsystem/loginaction")){ return true; } else{ response.sendRedirect("login"); return false; } } } } When i first go to /login it work fine, but when after login i go back to /login it gives me exception "Cannot call sendRedirect() after the response has been committed". Can you please help. Also is there a better way to maintain login.
answer count: 0
downvote count: 0

nullpointerexception
tags question: http://stackoverflow.com/q/21172419
tags question: http://stackoverflow.com/q/21043139
tags question: http://stackoverflow.com/q/21123592
tags question: http://stackoverflow.com/q/21124315
tags question: http://stackoverflow.com/q/21178143
tags question: http://stackoverflow.com/q/21132989
tags question: http://stackoverflow.com/q/21078049
tags question: http://stackoverflow.com/q/21070211
tags question: http://stackoverflow.com/q/21172769
tags question: http://stackoverflow.com/q/21077827
tags question: http://stackoverflow.com/q/21114717
tags question: http://stackoverflow.com/q/21068157
tags question: http://stackoverflow.com/q/21124796
tags question: http://stackoverflow.com/q/21084543
tags question: http://stackoverflow.com/q/21150714
tags question: http://stackoverflow.com/q/21058019
tags question: http://stackoverflow.com/q/21132234
tags question: http://stackoverflow.com/q/21174819
tags question: http://stackoverflow.com/q/21154129
tags question: http://stackoverflow.com/q/21026498
tags question: http://stackoverflow.com/q/21132970
tags question: http://stackoverflow.com/q/21052726
type: Tag
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/21168878
tags question: http://stackoverflow.com/q/21147496
tags question: http://stackoverflow.com/q/21071056
tags question: http://stackoverflow.com/q/21083313
tags question: http://stackoverflow.com/q/21121663
tags question: http://stackoverflow.com/q/21131552
tags question: http://stackoverflow.com/q/21176192
tags question: http://stackoverflow.com/q/21024099
tags question: http://stackoverflow.com/q/21049527
tags question: http://stackoverflow.com/q/21083487
tags question: http://stackoverflow.com/q/21063246
tags question: http://stackoverflow.com/q/21151019
tags question: http://stackoverflow.com/q/21071445
tags question: http://stackoverflow.com/q/21056179
tags question: http://stackoverflow.com/q/21037406
tags question: http://stackoverflow.com/q/21167005
tags question: http://stackoverflow.com/q/21133571
tags question: http://stackoverflow.com/q/21101842
tags question: http://stackoverflow.com/q/21039959
tags question: http://stackoverflow.com/q/21141529
tags question: http://stackoverflow.com/q/21132442
tags question: http://stackoverflow.com/q/21148860
tags question: http://stackoverflow.com/q/21084194
tags question: http://stackoverflow.com/q/21047497
tags question: http://stackoverflow.com/q/21143111

http://stackoverflow.com/comment/31891050
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21180576
has text: You can have a single non xa resource participating in a global transaction not multiple. As mentioned if you don't setup things correctly (datasources, hibernate) it isn't going to work. You cannot just slap a `UserTransactionManager` etc. in there and expect it to work.

http://stackoverflow.com/comment/31644862
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21047721
has text: I'm not sure you're using the right constructor for `resizedBitmap`. You don't need a `Matrix` for simple resizing. Consider this constructor: http://developer.android.com/reference/android/graphics/Bitmap.html#createBitmap(android.graphics.Bitmap, int, int, int, int)

http://stackoverflow.com/q/21117966
type: Question
accepted answer: http://stackoverflow.com/a/21119054
tagged with: java
tagged with: mouseevent
score: 0
tagged with: polygon
answer count: 1
tagged with: awt
has answer: http://stackoverflow.com/a/21119054
has title: How to drag a polygon?
type: AnsweredQuestion
tagged with: java-2d
has body: I have drawn a polygon in Java using java.awt.Polygon. I want to move the polygon with mouse (I want to drag it). I know that I have to use mouseDragged method in addMouseMotionListener. That way I can know (x,y) coordinate of the path in which mouse is dragging the polygon. But the problem is that I do not know what to do with the acquired (x,y) to move the polygon. This is a part of the code: public void mouseListeners(DrawEverything det) { det.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { public void mouseDragged(java.awt.event.MouseEvent evt) { if( isMouseInMe(evt.getX(), evt.getY())){//this "if" checks if the cursor is in the shape when we drag it int xTmep , yTemp ; xTmep = (int) (evt.getX() - xMousePressed) ;//xMousePressed--&gt; the x position of the mouse when pressed on the shape yTemp = (int) (evt.getY() - yMousePressed) ; for(int i = 0 ; i &lt; nPoints ; ++i){ xPoints[i] += xTmep;//array of x-positions of the points of polygon yPoints[i] += yTemp; } } } }); This part is the main part that I am having trouble with: for(int i = 0 ; i &lt; nPoints ; ++i){ xPoints[i] += xTmep; yPoints[i] += yTemp; }

http://stackoverflow.com/a/21179932
has comment: http://stackoverflow.com/comment/31888140
accepted answer of: http://stackoverflow.com/q/21179642
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21179642
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31899545
has body: You can use JLayeredPane JLayeredPane adds depth to a JFC/Swing container, allowing components to overlap each other when needed. link how to use Layered Panes and check this example

http://stackoverflow.com/a/24862369
has comment: http://stackoverflow.com/comment/38612499
accepted answer of: http://stackoverflow.com/q/21028438
has comment: http://stackoverflow.com/comment/38611781
answers question: http://stackoverflow.com/q/21028438
has comment: http://stackoverflow.com/comment/38612339
has comment: http://stackoverflow.com/comment/39100010
type: AcceptedAnswer
downvote count: 0
upvote count: 117
has comment: http://stackoverflow.com/comment/47118755
type: Answer
score: 117
has body: It seems this behavior is caused by specifying the sourceCompatibility before apply plugin: 'java', which happens if you try to set the compatibility option inside allprojects. In my setup, the situation can be solved by replacing: allprojects { sourceCompatibility = 1.6 targetCompatibility = 1.6 } with: allprojects { apply plugin: 'java' sourceCompatibility = 1.6 targetCompatibility = 1.6 } Will be glad if anyone else can verify this in a different setup. I am still not sure whether this should be reported as a bug but I believe this solution is better than the work-around mentioned above (which has been very helpful however).

eclipse
tags question: http://stackoverflow.com/q/21181492
tags question: http://stackoverflow.com/q/21115063
tags question: http://stackoverflow.com/q/21169844
tags question: http://stackoverflow.com/q/21090664
tags question: http://stackoverflow.com/q/21064404
tag name: eclipse
tags question: http://stackoverflow.com/q/21101482
tags question: http://stackoverflow.com/q/21179911
tags question: http://stackoverflow.com/q/21124896
tags question: http://stackoverflow.com/q/21087079
tags question: http://stackoverflow.com/q/21041895
tags question: http://stackoverflow.com/q/21047362
tags question: http://stackoverflow.com/q/21153185
tags question: http://stackoverflow.com/q/21097108
tags question: http://stackoverflow.com/q/21154262
tags question: http://stackoverflow.com/q/21112506
tags question: http://stackoverflow.com/q/21131461
tags question: http://stackoverflow.com/q/21170787
tags question: http://stackoverflow.com/q/21099262
tags question: http://stackoverflow.com/q/21099351
tags question: http://stackoverflow.com/q/21069067
tags question: http://stackoverflow.com/q/21055831
tags question: http://stackoverflow.com/q/21112024
tags question: http://stackoverflow.com/q/21172582
tags question: http://stackoverflow.com/q/21067184
tags question: http://stackoverflow.com/q/21032016
tags question: http://stackoverflow.com/q/21093202
tags question: http://stackoverflow.com/q/21028719
tags question: http://stackoverflow.com/q/21150706
tags question: http://stackoverflow.com/q/21038173
tags question: http://stackoverflow.com/q/21139098
tags question: http://stackoverflow.com/q/21044160
tags question: http://stackoverflow.com/q/21179366
tags question: http://stackoverflow.com/q/21140544
tags question: http://stackoverflow.com/q/21182539
tags question: http://stackoverflow.com/q/21111779
tags question: http://stackoverflow.com/q/21161586
tags question: http://stackoverflow.com/q/21181964
tags question: http://stackoverflow.com/q/21078993
tags question: http://stackoverflow.com/q/21168678
tags question: http://stackoverflow.com/q/21114717
tags question: http://stackoverflow.com/q/21047909
tags question: http://stackoverflow.com/q/21034186
tags question: http://stackoverflow.com/q/21084634
tags question: http://stackoverflow.com/q/21068129
tags question: http://stackoverflow.com/q/21038117
tags question: http://stackoverflow.com/q/21170338
tags question: http://stackoverflow.com/q/21146727
tags question: http://stackoverflow.com/q/21180888
tags question: http://stackoverflow.com/q/21146252
tags question: http://stackoverflow.com/q/21151203
tags question: http://stackoverflow.com/q/21144685
tags question: http://stackoverflow.com/q/21067169
tags question: http://stackoverflow.com/q/21057420
tags question: http://stackoverflow.com/q/21130598
tags question: http://stackoverflow.com/q/21167121
tags question: http://stackoverflow.com/q/21054858
tags question: http://stackoverflow.com/q/21136703
tags question: http://stackoverflow.com/q/21129692
tags question: http://stackoverflow.com/q/21077831
tags question: http://stackoverflow.com/q/21136600
tags question: http://stackoverflow.com/q/21089991
tags question: http://stackoverflow.com/q/21018906
tags question: http://stackoverflow.com/q/21175842
tags question: http://stackoverflow.com/q/21092779
tags question: http://stackoverflow.com/q/21041495
tags question: http://stackoverflow.com/q/21163200
tags question: http://stackoverflow.com/q/21126912
tags question: http://stackoverflow.com/q/21019086
tags question: http://stackoverflow.com/q/21142317
tags question: http://stackoverflow.com/q/21066691
tags question: http://stackoverflow.com/q/21030729
tags question: http://stackoverflow.com/q/21135615
tags question: http://stackoverflow.com/q/21171945
tags question: http://stackoverflow.com/q/21093129
tags question: http://stackoverflow.com/q/21175319
tags question: http://stackoverflow.com/q/21116683
tags question: http://stackoverflow.com/q/21108953
tags question: http://stackoverflow.com/q/21062116
tags question: http://stackoverflow.com/q/21167859

http://stackoverflow.com/comment/31651587
has text: 1) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve). 2) One way to get image(s) for an example is to hot-link to the images seen in [this answer](http://stackoverflow.com/a/19209651/418556).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21043525

http://stackoverflow.com/a/21127713
type: Answer
has body: This is a very simple way to do exactly what you asked, using some state: private static final int STATE_START = 0; private static final int STATE_FOUND = 1; private static final int STATE_STOP = 2; public static void main(final String[] args) { final String[] name = { "aval", "H ---- ", "Singh", "Sawh", "Gopi", "G ---- ", "parminder", "kaur", "jaspreet", "asneet", " ---- " }; String keywords = ""; int state = STATE_START; int i = 0; while ((state != STATE_STOP) &amp;&amp; (i &lt; name.length)) { if (name[i].contains(" ---- ")) { if (state == STATE_FOUND) { state = STATE_STOP; } else { keywords = ""; } } else { keywords += name[i]; if (name[i].contains("Sawh")) { state = STATE_FOUND; } } i++; } System.out.println(keywords); // SinghSawhGopi } BUT, maybe you could actually review your data structure... let's assume that you want some Strings to be associated with some letters, for example: "aval" -> "I" "Singh" -> "H" "Sawh" -> "H" "Gopi" -> "H" "parminder" -> "G" ... then I would recommend you to use Google's Guava Multimaps. The following piece of code would be how to achieve what you're looking for using that data structure: // Create the data (code used only once) final Multimap&lt;String, String&gt; multimap = HashMultimap.create(); multimap.put("I", "aval"); multimap.put("H", "Singh"); multimap.put("H", "Sawh"); multimap.put("H", "Gopi"); multimap.put("G", "parminder"); multimap.put("G", "kaur"); multimap.put("G", "jaspreet"); multimap.put("G", "asneet"); final Multimap&lt;String, String&gt; inversedMultimap = Multimaps.invertFrom(multimap, HashMultimap.&lt;String, String&gt; create()); // Find the data you're looking for: System.out.println(multimap.get(inversedMultimap.get("Sawh").iterator().next())); // Output: [Singh,Sawh, Gopi] // Or, if you really need the output you described in your question: String keywords = ""; for (final String keyword : multimap.get(inversedMultimap.get("Sawh").iterator().next())) { keywords += keyword; } System.out.println(keyword…
score: 0
answers question: http://stackoverflow.com/q/21126793

http://stackoverflow.com/comment/31843848
has text: @Roger - I want to continue the execution without answer
comment on: http://stackoverflow.com/q/21155382
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21170414
downvote count: 0
favorite count: 0
type: Question
answer count: 2
has title: Create an entity with two fields that are mutually exclusive
has answer: http://stackoverflow.com/a/21180089
score: 4
has comment: http://stackoverflow.com/comment/31870808
tagged with: java
has body: I would like to create an entity which has two fields that are mutually exclusive i.e. only one or the other of the two fields should contain a value. Is there an annotation I can use to achieve this or do I need to do this by some other means?
upvote count: 4
tagged with: jakarta-ee
accepted answer: http://stackoverflow.com/a/21180089
has comment: http://stackoverflow.com/comment/31874183
tagged with: persistence
possible better answer: http://stackoverflow.com/a/21175947
tagged with: entity
has answer: http://stackoverflow.com/a/21175947
type: AnsweredQuestion

http://stackoverflow.com/q/21046966
type: UnansweredQuestion
tagged with: android
upvote count: 1
tagged with: owner
score: 1
tagged with: java
has title: How to get current android's user info?
has comment: http://stackoverflow.com/comment/40943225
type: Question
has comment: http://stackoverflow.com/comment/40817578
has body: Android 4.2.1, having two system user accounts: owner + created user. Trying to get current user's info: final String[] projection = new String[] { ContactsContract.CommonDataKinds.Phone._ID, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, }; Cursor cursor = getContentResolver().query(ContactsContract.Profile.CONTENT_URI, projection, null, null, null); When the current user is owner, I'm getting empty result, when the current user is not the owner - everything works fine: there is an ID and correct DisplayName. So, the question is: how can I get information about the current android's user? And how can I get all users? Just to make it clear: users aren't expected to enter their google account, etc.
tagged with: user-profile
downvote count: 0
favorite count: 0
answer count: 0

http://stackoverflow.com/a/21174777
has body: You could also consider using the class loader to read files as resources inside packages using getClass().getResourceAsStream("f.txt");. This is the preferred way of accessing resources since you no longer have to worry about absolute vs. relative paths. If a resource is in your classpath, you can access it. it's recommend to use the ClassLoader as returned by Thread.currentThread().getContextClassLoader(), if the application uses multiple class loaders
answers question: http://stackoverflow.com/q/21174574
score: 0
type: Answer

http://stackoverflow.com/comment/31710330
type: Comment
comment on: http://stackoverflow.com/q/21082360
has text: Thanks Jason now i can execute my .exde application My code now is (import apache common exe and tutorial at http://commons.apache.org/proper/commons-exec/tutorial.html) String line = "C:\\ExecuteSSH\\ssh-keygen.exe"; CommandLine cmdLine = CommandLine.parse(line); DefaultExecutor executor = new DefaultExecutor(); //watchdog executor.setExitValue(1); ExecuteWatchdog watchdog = new ExecuteWatchdog(60000); executor.setWatchdog(watchdog); int exitValue = executor.execute(cmdLine);
score: 0
type: QuestionComment

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

http://stackoverflow.com/comment/31669940
type: Comment
comment on: http://stackoverflow.com/a/21060551
type: AnswerComment
has text: So there is no way...so then i will use %20 to _ .
score: 0

http://stackoverflow.com/q/21121769
type: AnsweredQuestion
tagged with: java
has body: I'm writting a program to encript data. It has a JTextArea to edit text, but I want to choose if I save it encripted or in plain text. For this I created a JDialog that appears when the save button is clicked. It contains two radio buttons: one to save the data encripted and the other to save in plain text. In the middle of them there is a JPasswordField requesting the key of the encription. My question is if there is a simple way of making the TextField not useable and half transparent, when the option to save encripted is not selected. Or, if there isn't a simple way of doing it, a way to hide the TextArea. I tryed using a ChangeListener on the radio button but it isn't working. Here is my code: import javax.swing.BoxLayout; import javax.swing.ButtonGroup; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JRadioButton; import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class StackOverflowVersion extends JFrame { public static JFrame frame; public StackOverflowVersion() { dialogoCriptografar(); System.exit(EXIT_ON_CLOSE); } public void dialogoCriptografar(){ final ButtonGroup bGroup = new ButtonGroup(); JRadioButton[] buttons = new JRadioButton[2]; final JPasswordField passwordField = new JPasswordField(20); // create the raio bunttons buttons[0] = new JRadioButton("Encript document before saving"); buttons[1] = new JRadioButton("Just save it"); //ad them to the ButtonGroup bGroup.add(buttons[0]); bGroup.add(buttons[1]); // select the option to encript buttons[0].setSelected(true); //creates a panel with the radio buttons and a JPasswordField final JPanel box = new JPanel(); JLabel descricao = new JLabel("Choose an option to save:"); box.setLayout(new BoxLayout(box, BoxLayout.Y_AXIS)); box.add(descricao); box.add(buttons[0]); box.add(passwordField); box.add(buttons[1]); // creates the …
has answer: http://stackoverflow.com/a/21121849
type: Question
score: 0
answer count: 2
has title: How to hide a Text Field when a radio button is selected/not selected?
tagged with: changelistener
accepted answer: http://stackoverflow.com/a/21121849
possible better answer: http://stackoverflow.com/a/21122434
has answer: http://stackoverflow.com/a/21122434
tagged with: jradiobutton
tagged with: swing
tagged with: jtextfield

http://stackoverflow.com/comment/31714354
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21084984
has text: @Sydroid - it searches for text inside files.

http://stackoverflow.com/comment/81695203
score: 0
comment on: http://stackoverflow.com/a/21089474
type: Comment
has text: This is incorrect in regard to S3 API accepting only file parameter, it accepts also InputStream
type: AnswerComment

http://stackoverflow.com/comment/31667539
comment on: http://stackoverflow.com/a/21059196
type: AnswerComment
has text: ok thank you @MadProgrammer that worked. But it doesnt seem to work for my second menu. I still get AES and DES options instead of CBC and ECB. Can you help me out with that please? Thank you very much!
score: 0
type: Comment

http://stackoverflow.com/comment/31670693
score: 0
type: Comment
has text: @TomThomas: Yes, exactly - see my example.
type: AnswerComment
comment on: http://stackoverflow.com/a/21061499

http://stackoverflow.com/q/21144120
favorite count: 0
has body: I'd like to use simple Spring controller to authenticate the Users using Spring Security. My Controller @Controller @Scope("request") public class Authenticator { private String username; private String password; @Autowired private AuthenticationManager authenticationManager; @RequestMapping(value = "/login", method = {RequestMethod.POST }) public @ResponseBody String authentication(@RequestParam("login") String userName, @RequestParam("password") String password, HttpServletRequest request) { this.username = userName; this.password = password; Authentication authenticationToken = new UsernamePasswordAuthenticationToken( userName, password); try { Authentication authentication = authenticationManager .authenticate(authenticationToken); SecurityContext securityContext = SecurityContextHolder .getContext(); securityContext.setAuthentication(authentication); HttpSession session = request.getSession(true); session.setAttribute("SPRING_SECURITY_CONTEXT", securityContext); return "sucess"; } catch (AuthenticationException ex) { return "fail " + ex.getMessage(); } } My spring-security.xml &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.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd"&gt; &lt;http pattern="/resources/**" security="none" /&gt; &lt;http auto-config="true" use-expressions="true"&gt; &lt;intercept-url pattern="/login" access="permitAll" /&gt; &lt;intercept-url pattern="/logout" access="permitAll" /&gt; &lt;intercept-url pattern="/accessdenied" access="permitAll" /&gt; &lt;intercept-url pattern="/**" access="hasRole('ROLE_USER')" /&gt; &lt;form-login /&gt; &lt;logout logout-success-url="/logout" /&gt; &lt;!-- &lt;session-management in…
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/23226962
tagged with: spring-mvc
tagged with: java
linked to: http://stackoverflow.com/q/6159848
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21145581
has comment: http://stackoverflow.com/comment/57103139
has title: Spring MVC + Spring Security - Controller Authentication using JSON
answer count: 2
downvote count: 0
score: 1
tagged with: spring-security

rmi
tags question: http://stackoverflow.com/q/21170338
tags question: http://stackoverflow.com/q/21114558
tags question: http://stackoverflow.com/q/21041880
tags question: http://stackoverflow.com/q/21085510
tags question: http://stackoverflow.com/q/21112693
tags question: http://stackoverflow.com/q/21035597
tags question: http://stackoverflow.com/q/21054123
tags question: http://stackoverflow.com/q/21031251
tags question: http://stackoverflow.com/q/21125295
tag name: rmi
type: Tag
tags question: http://stackoverflow.com/q/21053842

http://stackoverflow.com/a/21158335
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21158267
answers question: http://stackoverflow.com/q/21158267
type: Answer
score: 2
upvote count: 2
has body: The JSTL c:forEach tag provides the attribute varStatus, which will expose the loop status to the specified variable. Reference the index of varStatus to obtain the index of the current loop and use that index to specify the index of the collection item you want to bind or display. &lt;c:forEach var="sentence" items="${snippet.sentences}" varStatus="i"&gt; &lt;tr&gt; &lt;td&gt;${sentence.id}&lt;/td&gt; &lt;td&gt;${sentence.text}&lt;/td&gt; &lt;td&gt; &lt;form:input type="range" name="snippet.sentences[${i.index}].scale" path="sentences[${i.index}].scale" min="0" max="5" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/c:forEach&gt;
type: AcceptedAnswer

http://stackoverflow.com/q/21078914
has answer: http://stackoverflow.com/a/21079173
type: Question
tagged with: apache-commons-dbutils
has body: I'm executing this query: SELECT psq_id, question_text FROM presales_question WHERE psq_id IN(SELECT zz.psq_id FROM productservice_psq as zz WHERE zz.ps_id = 1) When I execute it directly in SQL Server Management Studio, it works. When I execute it with a standard Java Statement &amp; Result Set, it works. When I execute it using the Apache Commons DBUtils library (v 1.5), I get: Exception in thread "main" java.sql.SQLException: com.microsoft.sqlserver.jdbc.SQLServerException: The multi-part identifier "zz.ps_id" could not be bound. Query: SELECT psq_id, question_text FROM presales_question WHERE psq_id IN(SELECT zz.psq_id FROM productservice_psq as zz WHERE zz.ps_id = ?) Parameters: [1] at org.apache.commons.dbutils.AbstractQueryRunner.rethrow(AbstractQueryRunner.java:363) at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:350) at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:211) It seems the problem is not with the query, but with the dbutils library. Digging into the source, I see the error is thrown when dbutils calls the getParameterMetaData() method of the Statement. I'm still unsure how to fix this. My interim solution has been to edit the source code of the dbutils library and disable the call to getParameterMetaData() (see line 196 of AbstractQueryRunner.java). All it does is check that the param count passed in matches what's found in the query and throw an error if !=. I'm OK with skipping that check since the query will fail anyway if the params don't match.
has comment: http://stackoverflow.com/comment/31703062
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/31703703
type: UnansweredQuestion
has title: java commons dbutils: multi-part identifier could not be bound
score: 0
tagged with: java

http://stackoverflow.com/q/21145605
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21148257
upvote count: 1
type: Question
tagged with: java
tagged with: hibernate
has body: For Hibernate 3.5.4, let's say I have a hibernate entity defined like this: @Entity @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class Team { @Id protected Long id; protected List&lt;Player&gt; players; @OneToMany(targetEntity = Player.class, fetch = FetchType.LAZY) @JoinColumn(name = "team_id") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) @NotFound(action= NotFoundAction.IGNORE) @org.hibernate.annotations.BatchSize(size = 50) public List&lt;Player&gt; getPlayers() { return this.players; } public List&lt;Player&gt; setPlayers(List&lt;Player&gt; players) { this.players = players; } // More stuff } And then I have a Player entity defined as you might expect it to be. Logically, this creates three second level object caches: Team Team.players Player I've found that if the Team.players cache is disabled or empty for the queried Team, Hibernate will make a batch request to the database where it retrieves all Players for a team with one query (doing a lookup of player.team_id = Team.Id). However, if the Team.players cache contains cached associations between a Team and a list of players, and those Player objects are absent from the Player cache, Hibernate will retrieve each of the Player objects one at a time by Player.Id with separate database queries. Is there any way to get Hibernate to retrieve these collection field object cache misses in a batch? I've tried setting values for the following parameters, but they don't seem to impact this behavior: default_batch_fetch_size jdbc.batch_versioned_data jdbc.batch_size jdbc.fetch_size I've also tried EAGER fetching instead of LAZY. This hibernate forum post from 2008 alludes to this problem (https://forum.hibernate.org/viewtopic.php?t=983649) but I haven't turned up any solutions. Thanks for the help!
downvote count: 0
answer count: 1
score: 1
has title: Can Hibernate batch db queries for collection misses in the second level cache?
favorite count: 0

http://stackoverflow.com/comment/31616130
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21029708
has text: Have you read the [ServerSocket](http://docs.oracle.com/javase/7/docs/api/java/net/ServerSocket.html#setReuseAddress%28boolean%29) documentation?
score: 0

http://stackoverflow.com/q/21139468
type: AnsweredQuestion
score: 2
has body: I need to know how to get current midnight from date. For example I get "15.06.2012 16:40:20" and i need "15.06.2012 00:00:00". public List&lt;Game&gt; getGamesByDate(Date day) throws SQLException { final Date startDate = day; //here I need to convert startDate to midnight somehow final Date endDate = new Date(day.getTime() + (23 * HOUR) + (59 * MINUTE)); final List&lt;Game&gt; games = gameDAO.getGamesByDate(startDate, endDate); return games; }
has answer: http://stackoverflow.com/a/21139689
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/21139645
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/6850874
tagged with: date
duplicate of: http://stackoverflow.com/q/6850874
accepted answer: http://stackoverflow.com/a/21139689
has title: How to get midnight of given date?
answer count: 3
has comment: http://stackoverflow.com/comment/140223372
has answer: http://stackoverflow.com/a/21139590
favorite count: 0
has comment: http://stackoverflow.com/comment/31813600
has answer: http://stackoverflow.com/a/21139645

http://stackoverflow.com/comment/31861932
type: Comment
has text: i hoped it will be easier :) ill give it a try!
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21165682

http://stackoverflow.com/a/21136572
has body: as you are using annotations Just mark your service class with @Service annotation and use @Autowired annotation to get the instance of your service class MyServiceImpl.java package com.mypackage.service; @Service class MyServiceImpl implements MyService { public void getString() { return "Hello World"; } } MyBeanImpl.java @Component class MyBeanImpl implements MyBean, SomeOtherBean1, SomeOtherBean2 { @Autowired private MyService myService; public MyBeanImpl() {} } also make sure you mention your package name in &lt;context:component-scan /&gt; element in your dispatcher file as &lt;context:annotation-config /&gt; &lt;context:component-scan base-package="com.mypackage" /&gt; hope this will solve your problem
accepted answer of: http://stackoverflow.com/q/21127225
type: Answer
answers question: http://stackoverflow.com/q/21127225
upvote count: 7
downvote count: 0
type: AcceptedAnswer
score: 7

http://stackoverflow.com/comment/36941534
type: AnswerComment
score: 0
type: Comment
has text: I tried this but I am still getting Registration with Endpoints Server FAILED
comment on: http://stackoverflow.com/a/21343157

http://stackoverflow.com/a/21148066
type: Answer
has body: You don't need to do that in code, you can do it in your XML file where the image view is defined. See this page for more details. &lt;TextView android:layout_height="@dimen/textview_height" android:layout_width="@dimen/textview_width" android:textSize="@dimen/font_size"/&gt;
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21148018
score: 0
accepted answer of: http://stackoverflow.com/q/21148018

http://stackoverflow.com/a/22835705
has body: Approach: By Getting the Index: CSS Selector of div that contains the Text "Hello":css=div:contains("Hello") List&lt;WebElement&gt; texts = driver.findElements(By.cssSelector("div:contains('Hello')")); if(texts.get(2).getText().equals("hello") // Then Second Element that contains the Text Hello is present. else // Not Present.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21027048

http://stackoverflow.com/a/21166174
type: Answer
has body: If you are recreating your activity, the onCreate() method will be called again, so I think you change his value back to false
answers question: http://stackoverflow.com/q/21165746
accepted answer of: http://stackoverflow.com/q/21165746
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/21023801
has comment: http://stackoverflow.com/comment/31717257
has comment: http://stackoverflow.com/comment/31625753
has comment: http://stackoverflow.com/comment/31625855
tagged with: wrapper
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21042288
downvote count: 0
score: 1
favorite count: 0
has body: // I want to use my own custom elements instead of selenium defined web elements //like webElement and WebDriver etc. So,I have created following custom wrapper classes :- //custom webdriver wrapper package org.rsf.wrapper.driver; import org.openqa.selenium.WebDriver; public interface RsfWebDriver extends WebDriver{ } //custom webelement wrapper package org.rsf.wrapper.element; import org.openqa.selenium.WebElement; public interface RsfElement extends WebElement{ } // Now, I am calling my wrapper classes in below pageObject code .But it gives error.Pls //help me:- package org.rsf.pages; import java.util.concurrent.TimeUnit; import org.apache.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.ui.Select; import org.rsf.bean.EnterQuoteBean; import org.rsf.utilities.Utility; import org.rsf.wrapper.driver.RsfWebDriver; import org.rsf.wrapper.element.RsfElement; import org.testng.Assert; //pageObject public class EnterQuotePage extends PageBase { public EnterQuotePage(RsfWebDriver driver) { super(driver); super.driver=driver; } //creating my custom wrapper object private RsfElement element; private static Logger log=Logger.getLogger(EnterQuotePage.class); Utility utilities = new Utility(); EnterQuoteBean eqb= new EnterQuoteBean(); public void open(String url) { System.out.println("Inside get url"); System.out.println("url is : " +url); System.out.println(" PB : Driver value :-" + driver); Assert.assertNotNull(this.driver); this.driver.get(url); System.out.println("After get url"); } public void clickHit() { super.driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); //ERROR OCCURS IN BELOW TWO LINES [in element] element=super.driver.findElement(By.id("hit")); element.click(); } public String getQuoteID(){ String quoteText =findMessage.getText(); String quoteText1[] = quoteText.split("\\="); quoteText1[1]=quoteText1…
type: Question
has answer: http://stackoverflow.com/a/21086853
answer count: 2
has title: WebDriver : Compilation error in custom created Wrapper classes of web elements and drivers
tagged with: selenium-webdriver
tagged with: pageobjects
possible better answer: http://stackoverflow.com/a/21086853
tagged with: java
has answer: http://stackoverflow.com/a/21042288
upvote count: 1

http://stackoverflow.com/q/21074259
favorite count: 0
upvote count: 4
has title: Auto-scroll JTextArea with ScrollPane?
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/21074273
tagged with: swing
accepted answer: http://stackoverflow.com/a/21074273
type: Question
tagged with: jtextarea
has body: I'm trying to build a dynamic log window (basically a auto-scrolling jtext-area). The problem I'm having is that although I'm printing 500 lines in the text area, it displays as below: Below you have my code: import java.awt.Dimension; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.text.DefaultCaret; public class Main { private static JFrame mainFrame; public static void main(String args[]) { mainFrame = new JFrame(); mainFrame.setSize(500, 500); mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ControlPanel cp = new ControlPanel(); mainFrame.add(cp); mainFrame.setVisible(true); } } class ControlPanel extends JPanel { private JButton resetButton = new JButton("Reset"); private JPanel logPanel = new JPanel(); private JLabel actionLogsLabel = new JLabel("Action Log"); private JLabel pointsLogsLabel = new JLabel("Points Log"); private JTextArea actionLog = new JTextArea(); private JTextArea pointsLog = new JTextArea(); private JScrollPane actionScroll; private JScrollPane pointsScroll; public ControlPanel() { init(); this.add(resetButton); this.add(logPanel); } private void init() { this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.setAlignmentX(LEFT_ALIGNMENT); this.logPanel.setLayout(new BoxLayout(logPanel, BoxLayout.Y_AXIS)); this.logPanel.setAlignmentX(LEFT_ALIGNMENT); actionLog.setPreferredSize(new Dimension(500, 300)); actionLog.setMaximumSize(actionLog.getPreferredSize()); actionLog.setEditable(false); actionLog.setWrapStyleWord(true); DefaultCaret caret = (DefaultCaret) actionLog.getCaret(); caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); pointsLog.setPreferredSize(new Dimension(500, 300)); pointsLog.setMaximumSize(pointsLog.getPreferredSize()); pointsLog.setEditable(false); pointsLog.setWrapStyleWord(true); pointsScroll = new JScrollPane(pointsLog, JScrollPane.VERTICAL_…
tagged with: autoscroll
score: 4
tagged with: jscrollpane
answer count: 1

http://stackoverflow.com/q/21060259
has body: I have to read a text file in Java, separate its content into separate arrays, and then compute the average of certain arrays. My problem is that when I try to display a certain array to make sure it works, I get "null" instead of the whole list. Can anyone help me find where I went wrong? import java.io.*; class ReadFile { public static void main(String args[]) String[] id = new String[1234]; // random number just for initialization String[] name = new String[1234]; String[] asg1 = new String[1234]; String[] asg2 = new String[1234]; try { String sCurrentLine; FileReader fr = new FileReader("Information.txt"); BufferedReader textReader = new BufferedReader(fr); int i; String[] array = null; // Read file in separate parts and remove commas while ((sCurrentLine = textReader.readLine()) != null) { array = sCurrentLine.split(","); System.out.print(array[0]); System.out.print(array[1]); System.out.print(array[2]); System.out.println(array[3]); } // enter variables from each line in separate arrays for (i = 0; i &lt; array.length; i++) { id[i] = array[0]; name[i] = array[1]; asg1[i] = array[2]; asg2[i] = array[3]; } System.out.println(name[i]); // "null" appears instead of all the names textReader.close(); } catch (Exception e) { // Catch exception if any System.err.println("Error: " + e.getMessage()); } } } The input looks like this: ID, name, Asg1, Asg2 123456, Max, 98.00, 80.00 012345, James, 40.00, 69.00 234567, Mary, 78.00, 88.00
tagged with: arrays
possible better answer: http://stackoverflow.com/a/21060320
upvote count: 3
tagged with: file-io
answer count: 4
favorite count: 0
downvote count: 0
accepted answer: http://stackoverflow.com/a/21060336
has title: Java reading different arrays in text file
has answer: http://stackoverflow.com/a/21060320
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/21060401
has answer: http://stackoverflow.com/a/21060336
tagged with: java
has answer: http://stackoverflow.com/a/21061913
type: Question

http://stackoverflow.com/q/21049625
has answer: http://stackoverflow.com/a/21107939
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/20664149
tagged with: java
has title: SonarQube 4.0 and Xerces
tagged with: maven
type: Question
tagged with: sonarqube
has body: I'm working in the development of a custom plugin for sonar which generates a report and exports it to PDF. For that purpose I use one of our libraries with xercesimpl 2.9.1 dependency. This plugin works with SonarQube 3.7.4 but I'm getting a ClassNotFoundException with SonarQube 4.0 when I analyze a project with "mvn sonar:sonar" Caused by: java.lang.NoClassDefFoundError: org/apache/xerces/dom/DocumentImpl at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:389) at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42) at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227) at es.excentia.qalitax.report.service.OdtReport.getPdfOutputFile(OdtReport.java:103) at es.excentia.sonar.odtreports.OdtReportPostJob.generateAndSaveReport(OdtReportPostJob.java:204) at es.excentia.sonar.odtreports.OdtReportPostJob.executeOnIfLicenseOk(OdtReportPostJob.java:96) at es.excentia.sonar.licenser.LicensedPostjob.executeOnIfEnabled(LicensedPostjob.java:29) at es.excentia.sonar.plugins.common.DisableablePostjob.executeOn(DisableablePostjob.java:21) It seems sonar-plugin-api requires also xercesimpl, but 2.8.1 version, so I have tried some things To exclude all xercesi…
score: 0
linked to: http://stackoverflow.com/q/11677572
answer count: 1
accepted answer: http://stackoverflow.com/a/21107939

http://stackoverflow.com/comment/31659570
has text: @NathanielJones thanks for the optimization tip! That is great to know. I will definitely stick with the second loop - but I *am* still curious about this problem.
score: 0
comment on: http://stackoverflow.com/q/21055228
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31658966
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21032301
has text: @ryvantage Yes, I said I preferred this solution (the one in the answer this comment is below), which is `c.isInstance(e)` for exactly the reason you point out.

regex
tags question: http://stackoverflow.com/q/21074485
tags question: http://stackoverflow.com/q/21180921
tags question: http://stackoverflow.com/q/21149785
tags question: http://stackoverflow.com/q/21091882
tags question: http://stackoverflow.com/q/21134323
tags question: http://stackoverflow.com/q/21060882
tags question: http://stackoverflow.com/q/21094049
tags question: http://stackoverflow.com/q/21075879
tags question: http://stackoverflow.com/q/21146639
tag name: regex
tags question: http://stackoverflow.com/q/21117965
tags question: http://stackoverflow.com/q/21074990
tags question: http://stackoverflow.com/q/21025199
tags question: http://stackoverflow.com/q/21183351
tags question: http://stackoverflow.com/q/21021219
tags question: http://stackoverflow.com/q/21154593
tags question: http://stackoverflow.com/q/21053836
tags question: http://stackoverflow.com/q/21034584
tags question: http://stackoverflow.com/q/21168864
tags question: http://stackoverflow.com/q/21114247
tags question: http://stackoverflow.com/q/21075418
tags question: http://stackoverflow.com/q/21074629
tags question: http://stackoverflow.com/q/21107998
tags question: http://stackoverflow.com/q/21128246
tags question: http://stackoverflow.com/q/21139839
tags question: http://stackoverflow.com/q/21175810
tags question: http://stackoverflow.com/q/21048843
tags question: http://stackoverflow.com/q/21152110
tags question: http://stackoverflow.com/q/21184188
tags question: http://stackoverflow.com/q/21116826
tags question: http://stackoverflow.com/q/21075643
tags question: http://stackoverflow.com/q/21178627
tags question: http://stackoverflow.com/q/21084940
tags question: http://stackoverflow.com/q/21054524
tags question: http://stackoverflow.com/q/21093340
tags question: http://stackoverflow.com/q/21076153
tags question: http://stackoverflow.com/q/21072979
tags question: http://stackoverflow.com/q/21055054
tags question: http://stackoverflow.com/q/21181596
tags question: http://stackoverflow.com/q/21046632
tags question: http://stackoverflow.com/q/21182409
tags question: http://stackoverflow.com/q/21069113
tags question: http://stackoverflow.com/q/21175364
tags question: http://stackoverflow.com/q/21166480
tags question: http://stackoverflow.com/q/21162610
tags question: http://stackoverflow.com/q/21177778
tags question: http://stackoverflow.com/q/21049557
tags question: http://stackoverflow.com/q/21138586
tags question: http://stackoverflow.com/q/21129998
tags question: http://stackoverflow.com/q/21062859
tags question: http://stackoverflow.com/q/21157351
tags question: http://stackoverflow.com/q/21165706
tags question: http://stackoverflow.com/q/21021179
tags question: http://stackoverflow.com/q/21069551
tags question: http://stackoverflow.com/q/21135955
tags question: http://stackoverflow.com/q/21070272
tags question: http://stackoverflow.com/q/21030109
tags question: http://stackoverflow.com/q/21091808
tags question: http://stackoverflow.com/q/21160895
tags question: http://stackoverflow.com/q/21140343
tags question: http://stackoverflow.com/q/21076074
tags question: http://stackoverflow.com/q/21168525
tags question: http://stackoverflow.com/q/21139843
tags question: http://stackoverflow.com/q/21052674
tags question: http://stackoverflow.com/q/21127919
tags question: http://stackoverflow.com/q/21121213
tags question: http://stackoverflow.com/q/21075537
tags question: http://stackoverflow.com/q/21072156
tags question: http://stackoverflow.com/q/21127530
tags question: http://stackoverflow.com/q/21173145
tags question: http://stackoverflow.com/q/21076729
tags question: http://stackoverflow.com/q/21131022
tags question: http://stackoverflow.com/q/21040658
type: Tag
tags question: http://stackoverflow.com/q/21093635
tags question: http://stackoverflow.com/q/21136703

http://stackoverflow.com/comment/31705679
type: QuestionComment
comment on: http://stackoverflow.com/q/21079489
has text: On the left are JFace's MVC components, on the right are the raw SWT widgets.
score: 0
type: Comment

http://stackoverflow.com/q/21163612
accepted answer: http://stackoverflow.com/a/21163685
tagged with: el
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31883894
type: Question
possible better answer: http://stackoverflow.com/a/21178009
has answer: http://stackoverflow.com/a/21178009
tagged with: jsp
has answer: http://stackoverflow.com/a/21163685
score: 0
answer count: 2
has body: I have this Class Output { HashMap&lt;String,POC&gt; hMap; //Other stuff } and this Class POC { String var1; String var2; String var3; //Other stuff } Basially, a hash map of objects... I am using Spring MVC framework and the above two classes are my model objects. My service class creates creates an output object, that it passes to the controller. The controller returns that output object to the output.jsp after setting it as a model attribute called output In the output.jsp page, I want to display however many items exist in the hashmap in the output object. For example, to display items stored in item1 (stored in HashMap as key1) this is what I've tried, with hard luck: ${output.hMap.key1.var1) ${output.hMap['key1'].var1) None of it works the way I want it to. Please can anybody help me with this, or atleast suggest an alternative. Do share what you have in mind The solution: I feel stupid now. Both of the above work. The reason why I could not have them working, was because I did not initialize the POC with any values, before adding it into the hashMap.
has title: Accessing nested objects in EL
has comment: http://stackoverflow.com/comment/31857292

http://stackoverflow.com/comment/31679039
has text: If you want to use vlc, you need to look at the imem module (e.g. "vlc -H | grep imem"). Unfortunately imem is not exposed as an API by LibVLC so you would have to do it all yourself (it's certainly possible, but it's not straightforward). Anyway the real killer is that imem does not support seeking and that is where most people give up...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21063487

http://stackoverflow.com/comment/31706663
has text: Do you have a file at `/WEB-INF/pages/index.jsp`?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21080598

http://stackoverflow.com/comment/31884399
type: Comment
has text: thank you i did it but i am still getting error of null pointer exception
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21178176

http://stackoverflow.com/comment/31686250
comment on: http://stackoverflow.com/a/21069620
type: AnswerComment
has text: Nevermind -it worked ! I used x and it worked for some reason :)
score: 0
type: Comment

http://stackoverflow.com/q/21041895
answer count: 1
has body: First of all, with a picture (print screen of my IDE) it would be more easy to show my packages and file but when I tried to submit my question, the system says "You need at least 10 reputation to post images" What does that mean ????? I use Eclipse Juno with the ADT plugin from Google to develop Android application. At first, no problem, I could run my app in the emulator and even on my Android device. It is only after I have added the Eclipse plugin for Maven that the problems started. This is the plugin "Integration for the Android Development Tools and the m2eclipse Maven2 plugin ver 0.4.3 " Since then, I've tried everything already spend too much time without being able to move forward. At run time I get this exception: 01-10 09:56:17.804: E/Trace(1180): error opening trace file: No such file or directory (2) 01-10 09:56:17.914: D/AndroidRuntime(1180): Shutting down VM 01-10 09:56:17.914: W/dalvikvm(1180): threadid=1: thread exiting with uncaught exception (group=0x40a71930) 01-10 09:56:17.935: E/AndroidRuntime(1180): FATAL EXCEPTION: main 01-10 09:56:17.935: E/AndroidRuntime(1180): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.shoppinglist2/com.example.shoppinglist2.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.shoppinglist2.MainActivity" on path: /data/app/com.example.shoppinglist2-1.apk 01-10 09:56:17.935: E/AndroidRuntime(1180): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106) 01-10 09:56:17.935: E/AndroidRuntime(1180): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 01-10 09:56:17.935: E/AndroidRuntime(1180): at android.app.ActivityThread.access$600(ActivityThread.java:141) 01-10 09:56:17.935: E/AndroidRuntime(1180): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 01-10 09:56:17.935: E/AndroidRuntime(1180): at android.os.Handler.dispatchMessage(Handler.java:99) 01-10 09:56:17.935: E/AndroidRuntime(1180):…
downvote count: 0
has answer: http://stackoverflow.com/a/24836707
has comment: http://stackoverflow.com/comment/77565733
score: 4
tagged with: android
has comment: http://stackoverflow.com/comment/31634449
has comment: http://stackoverflow.com/comment/31634158
has comment: http://stackoverflow.com/comment/31634162
favorite count: 0
has comment: http://stackoverflow.com/comment/31634325
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31634225
tagged with: maven
has comment: http://stackoverflow.com/comment/31634619
has comment: http://stackoverflow.com/comment/31634264
tagged with: java
has title: android ClassNotFoundException: Didn't find class MainActivity
has comment: http://stackoverflow.com/comment/31636855
tagged with: eclipse
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/31634302

http://stackoverflow.com/a/28701154
answers question: http://stackoverflow.com/q/21083834
has comment: http://stackoverflow.com/comment/47665201
score: 45
has comment: http://stackoverflow.com/comment/101723661
downvote count: 0
upvote count: 45
has body: For the newest version of log4j, here is what should work for loading an external log4j2.xml: String log4jConfigFile = System.getProperty("user.dir") + File.separator + "log4j2.xml"; ConfigurationSource source = new ConfigurationSource(new FileInputStream(log4jConfigFile)); Configurator.initialize(null, source);
type: Answer

http://stackoverflow.com/q/21145779
has comment: http://stackoverflow.com/comment/31835283
has comment: http://stackoverflow.com/comment/31833470
has body: im trying to display in a JTextPane the text of a RTF file, it only show a plain text, but i need the formatted text with bold, font, sizes, etc... here is the code: public void mostraRTF() { RTFEditorKit rtf = new RTFEditorKit(); rtfDisplay.setEditorKit( rtf ); rtfDisplay.setBackground( Color.white ); try { FileInputStream fi = new FileInputStream( "F:\\31012200.rtf" ); rtf.read( fi, rtfDisplay.getDocument(), 0 ); } catch( FileNotFoundException e ) { System.out.println( "File not found" ); } catch( IOException e ) { System.out.println( "I/O error" ); } catch( BadLocationException e ) { } }
linked to: http://stackoverflow.com/q/12142928
answer count: 0
type: UnansweredQuestion
tagged with: jtextpane
has comment: http://stackoverflow.com/comment/31825710
tagged with: swing
tagged with: rtf
type: Question
has title: Display Formatted RTF in JTextPane
tagged with: java
has comment: http://stackoverflow.com/comment/31825670
score: 0
has comment: http://stackoverflow.com/comment/31860314
has comment: http://stackoverflow.com/comment/31840762
has comment: http://stackoverflow.com/comment/31829877

http://stackoverflow.com/comment/31890707
score: 2
has text: Why do you need to create these classes? Why wouldn't it be sufficient to have just one class which encapsulates the JSON-Object from the configuration file and has methods which behave according to the content of that object?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21181933

openssl
tags question: http://stackoverflow.com/q/21183043
tags question: http://stackoverflow.com/q/21086103
type: Tag
tags question: http://stackoverflow.com/q/21135637
tag name: openssl

http://stackoverflow.com/q/21113348
answer count: 1
score: 0
tagged with: android
linked to: http://stackoverflow.com/q/6056231
has body: I'm developing an android app which I want to check if there's internet connection, if it's not the case display a warning message, and when there's internet connection again load a certain url. It can be said that both displaying the message and checking there's internet connection work... but no separately. I mean I have the following code: if (!checkConnectivity()) { browser.stopLoading(); LayoutInflater layoutinflater = LayoutInflater.from(app); final View textEntryView; textEntryView = layoutinflater.inflate(R.layout.exitdialog, null); new AlertDialog.Builder(app) .setView(textEntryView) .setIcon(android.R.drawable.ic_dialog_alert) .setTitle("Exit") .setNegativeButton("CANCEL", null) .show(); while (!checkConnectivity()) { } browser.loadUrl(url); } If I don't use from while (!checkConnectivity()) to browser.loadUrl(url); then AlertDialog shows properly. If I don't use from LayoutInflater layoutinflater = LayoutInflater.from(app); to .show(); then the app loads the web page correctly on browser. But if I use the whole code it looks like it enters the while (!checkConnectivity()) loop before it does the show as what happens when internet connection is restabilished is that the alert dialog is shown briefly and the the web page is loaded. I find this pretty weird, as I'm not using, as far as I know, threads that could cause that one could be executed before other one, and this is not the case this thing doesn't fulfill one of the most basic things in programming, I mean if an instruction is before another one, the one that's before should be plenty executed logically (except for threads). Hope someone has an idea about this and can help me.
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/21113364
tagged with: dialog
tagged with: java
has title: Android alertdialog not showing when I think it should

http://stackoverflow.com/comment/31682044
comment on: http://stackoverflow.com/q/21067502
score: 1
has text: That's very little information to go on. The cause of your problem is the fact that the container you component is in is under the control of a layout manager, the solution will be based on your needs...
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31701899
type: QuestionComment
score: 2
has text: This is not linear, but quadratic time. With a hashset you could easily get linear.
comment on: http://stackoverflow.com/q/21078383
type: Comment

http://stackoverflow.com/a/21103355
score: 6
type: Answer
upvote count: 6
has body: To add a generic type constraint to a method, use this syntax: public void foo&lt;T&gt;() where T : Bar { ... } Or to add a constraint to a class (or struct / interface), use this: public class Foo&lt;T&gt; where T : Bar { ... } Further Reading where (generic type constraint) (C# Reference)
answers question: http://stackoverflow.com/q/21103344
accepted answer of: http://stackoverflow.com/q/21103344
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21123217
has comment: http://stackoverflow.com/comment/31785014
tagged with: jpanel
has comment: http://stackoverflow.com/comment/31785104
score: 0
linked to: http://stackoverflow.com/q/21077322
answer count: 1
has comment: http://stackoverflow.com/comment/31784955
tagged with: paintcomponent
has comment: http://stackoverflow.com/comment/31785209
tagged with: repaint
has comment: http://stackoverflow.com/comment/31784795
linked to: http://stackoverflow.com/q/17874717
has answer: http://stackoverflow.com/a/21123516
has body: I'm working on a Java GUI and I have a JFrame thats 600x800 that I want to split into two portions, the top which has checkboxes for settings and is 600 x 200 and the bottom which is the "canvas" which will be painted on that is 600x600. I have a JFrame that has a JPanel that contains two other JPanels (one for the settings, the other for the canvas). I'm testing the "painting" and for some reason when I try to paint a 600x600 black rectangle, it paints a much smaller rectangle in the area that the settings JPanel occupies. Any ideas what's going on? I'm using the repaint method to call paintComponent and I've tried calling repaint in both the constructor of my JFrame and in the JPanel that is to be painted. HPAProgram public class HPAProgram { public static void main(String[] args) { MapWindow map = new MapWindow(); } } MapWindow //import java.awt.*; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.*; import javax.swing.*; //notice javax public class MapWindow extends JFrame { private static final int WIDTH = 600, HEIGHT = 800; JPanel panel = new JPanel(); SettingsButtonsPanel button_panel = new SettingsButtonsPanel(); MapImagePanel map_panel = new MapImagePanel(); public MapWindow() { setLocationRelativeTo(null); setTitle("HPA* Test"); setSize(WIDTH, HEIGHT); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); add(panel); panel.setBounds(0, 0, 600, 800); //panel.setLayout(new GridBagLayout()); /*GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0;*/ panel.add(button_panel); /*c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 1;*/ panel.add(map_panel); button_panel.setLocation(0,0); /*map_panel.setLocation(0,200); map_panel.setSize(600,600);*/ map_panel.repaint(); } } SettingsButtonsPanel import java.awt.event.*; import java.awt.*; import javax.swing.*; public class SettingsButtonsPanel extends JPanel implements ItemListener{ private static fina…
has comment: http://stackoverflow.com/comment/31785106
type: UnansweredQuestion
tagged with: java
tagged with: swing
type: Question
has title: Paint in JPanel is painting in the wrong location and size
has comment: http://stackoverflow.com/comment/31785239
linked to: http://stackoverflow.com/q/5621338
has comment: http://stackoverflow.com/comment/31784689
has comment: http://stackoverflow.com/comment/31784518

http://stackoverflow.com/a/21175864
has comment: http://stackoverflow.com/comment/31912782
has comment: http://stackoverflow.com/comment/31880634
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21175835
has comment: http://stackoverflow.com/comment/31912595
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21175835
type: Answer
score: 2
downvote count: 0
has body: The &amp;&amp; operator has higher precedence than the || operator. So, the condition is equivalent to if( (false &amp;&amp; false) || s.equalsIgnoreCase("x")) { //throws an exception which is then evaluated to leave: if(false || s.equalsIgnoreCase("x")) { //throws an exception which doesn't short circuit. To make it short-circuit, use parentheses: if(false &amp;&amp; (false || s.equalsIgnoreCase("x"))) { // fine

http://stackoverflow.com/a/21077236
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21076693
upvote count: 2
score: 2
has body: for better help sooner post an MCVE use paintComponent() for Swing JComponents instead of paint() there isn't reason to use NullLayout, use LayoutManager, override getPreferredSize for JPanel, then JFrame.pack() will generate expected Dimension on the screen JLabel is transparent, you have to setOpaque if you to want to dispaly Color as Backgroung in Jlabel you have to use repaint(last code line) for MouseEvents and Color for JLabel, override MouseAdapter miss any, no idea if you would need use transparency or tranclucency, or remove the JLabel

http://stackoverflow.com/a/21060202
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21059946
type: Answer
has comment: http://stackoverflow.com/comment/31668300
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/31668271
answers question: http://stackoverflow.com/q/21059946
has body: Throw an IllegalArgumentException in both cases; that's what it's for. public Future&lt;RedResponse&gt; getUserAsync(RedKey rdKeys) { if (RedUtils.isEmpty(rdKeys)) { throw new IllegalArgumentException("rdKeys can not be empty"); } ... } That said ... I don't see what the issue is. You're returning a Future&lt;RedResponse&gt; ... that's a future that contains a RedResponse. In your getUserSync method you're using a RedResponse to indicate the invalid input.

http://stackoverflow.com/comment/31856017
has text: Java is not good for writing things like device drivers - since they need direct access to the hardware which is made slower and much harder by the JVM. That's accessing hardware though, not accessing other software. For accessing other software there is no difference between C++ and Java, if anything Java makes it easier.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21162855

http://stackoverflow.com/a/21073051
score: 5
type: Answer
upvote count: 6
has body: If you want to send object over network you must serialize your objects. Check this question: How To send an object over TCP in Java Java Serialization: Serialization You could do it like this: import java.net.*; import java.io.*; class testobject implements Serializable { int value; String id; public testobject(int v, String s ){ this.value=v; this.id=s; } } public class SimpleServer { public static void main(String args[]) { int port = 2002; try { ServerSocket ss = new ServerSocket(port); Socket s = ss.accept(); InputStream is = s.getInputStream(); ObjectInputStream ois = new ObjectInputStream(is); testobject to = (testobject)ois.readObject(); if (to!=null){System.out.println(to.id);} System.out.println((String)ois.readObject()); is.close(); s.close(); ss.close(); }catch(Exception e){System.out.println(e);} } } import java.net.*; import java.io.*; public class SimpleClient { public static void main(String args[]){ try{ Socket s = new Socket("localhost",2002); OutputStream os = s.getOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(os); testobject to = new testobject(1,"object from client"); oos.writeObject(to); oos.writeObject(new String("another object from the client")); oos.close(); os.close(); s.close(); }catch(Exception e){System.out.println(e);} } }
downvote count: 1
has comment: http://stackoverflow.com/comment/31692140
has comment: http://stackoverflow.com/comment/31692800
has comment: http://stackoverflow.com/comment/31692232
answers question: http://stackoverflow.com/q/21073024

http://stackoverflow.com/a/21033404
has comment: http://stackoverflow.com/comment/31620119
has body: In fact your factory isn't thread safe, because in race condition you can have more than one ClientFactory living in application. Lets assume two threads: ThreadA is evaluating condition 'if (instance == null)' and instance is null, so it enters statement ThreadB is evaluating condition 'if (instance == null)' and instance is null (because A didn't make to instantiate it), so it enters statement ThreadA creates new ClientFactory() and returns it ThreadB creates new ClientFactory() and returns it Now we have more than one ClientFactory in application. Of course other threads trying to retrieve instance some time later will always return single instance. In my opinion the easiest way to write singleton in Java is to use enum. In your case it will looks: public enum ClientFactory { INSTANCE; public Company getClient() { return new Company(); } } And usage: ClientFactory.INSTANCE.getClient()
score: 24
upvote count: 24
answers question: http://stackoverflow.com/q/21033112
has comment: http://stackoverflow.com/comment/31620256
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21033112

http://stackoverflow.com/comment/31797380
type: QuestionComment
comment on: http://stackoverflow.com/q/21130292
score: 0
has text: 403 Forbidden The request is understood, but it has been refused or access is not allowed. An accompanying error message will explain why. This code is used when requests are being denied due to update limits.
type: Comment

http://stackoverflow.com/comment/31818276
has text: As far as I know the Eclipse debugger works with threads separately, meaning once you stop on a breakpoint it follows that thread, once the flow moves to another thread if you do not have a breakpoint in the code where the new thread went, it will not switch over and instead will continue with whatever the original thread has to do.
comment on: http://stackoverflow.com/a/21142002
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/21177992
type: Answer
has body: You can do it using the onWindowFocusChanged() method. So, in this method you can put something like that: ImageView img = (ImageView)findViewById(R.id.some layout); AnimationDrawable frameAnimation = (AnimationDrawable)img.getDrawable(); frameAnimation.setCallback(img); frameAnimation.setVisible(true, true); frameAnimation.start(); In your xml layout, you can use: <item android:drawable="@drawable/frame1" android:duration="150" /> <item android:drawable="@drawable/frame2" android:duration="150" /> Font: Starting Frame-By-Frame Animation
answers question: http://stackoverflow.com/q/21177841
score: 0
has comment: http://stackoverflow.com/comment/31883989

http://stackoverflow.com/comment/31800652
type: Comment
comment on: http://stackoverflow.com/a/21130753
has text: You can try appending a parameter in request such as clientId which will be specific to the application from where the request is coming. Also in your application maintain a map of each clientId with a specific redirectURL. In the handler then set the redirectURL as per the clientID u get
type: AnswerComment
score: 0

http://stackoverflow.com/q/21153249
tagged with: java
type: Question
has body: This is a weird question . I want to know is there any way we could generate an apk from an android App. Let me explain- An android app which run cmd Commands and could generate apk for another application. Is there any possible way. I have read that this could be done using ant in Java. I want to know that is this possible on a running android app. Thanks.
score: 0
has answer: http://stackoverflow.com/a/21153445
upvote count: 1
tagged with: android
downvote count: 1
has comment: http://stackoverflow.com/comment/31839823
favorite count: 0
has answer: http://stackoverflow.com/a/21153473
has answer: http://stackoverflow.com/a/21153383
has title: How to generate an apk file from Android Application programmatically?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21153345
tagged with: adb
tagged with: apk
answer count: 4
has comment: http://stackoverflow.com/comment/31839898

http://stackoverflow.com/q/21040580
linked to: http://stackoverflow.com/q/19643414
has answer: http://stackoverflow.com/a/21040864
tagged with: java
has body: I want to convert a List&lt;Promise&lt;Boolean&gt;&gt; into a Promise&lt;List&lt;Boolean&gt;&gt;. I know that this can be achieved using the sequence method, but I'm having some problems getting the types right. Here is what I've tried: First (naive) approach List&lt;Promise&lt;Boolean&gt;&gt; foo = new ArrayList&lt;Promise&lt;Boolean&gt;&gt;; // ... Code that loops over some other collection // and adds multiple Promise&lt;Boolean&gt;s to foo Promise&lt;List&lt;Boolean&gt;&gt; bar = Promise.sequence(foo); This does not compile because "the argument type List&lt;Promise&lt;Boolean&gt;&gt; does not conform to formal parameter type Iterable&lt;Promise&lt;? extends A&gt;&gt;". Second approach Declaring the type of foo to conform to the formal parameter type as suggested by the error message above: List&lt;Promise&lt;? extends Boolean&gt;&gt; foo = new ArrayList&lt;Promise&lt;Boolean&gt;&gt;() As per the sub-typing rules laid out in this answer, Promise&lt;Boolean&gt; should be a subtype of Promise&lt;? extends Boolean&gt;, but I am getting a type mismatch here: "cannot convert from ArrayList&lt;F.Promise&lt;Boolean&gt;&gt; to List&lt;F.Promise&lt;? extends Boolean&gt;&gt;. Third approach Removing type information from instantiation of ArrayList&lt;Promise&lt;Boolean&gt;&gt;: List&lt;Promise&lt;? extends Boolean&gt;&gt; foo = new ArrayList(); This compiles but results in a warning about unchecked conversion that I would like to get rid of: "The expression of type ArrayList needs unchecked conversion to conform to List&lt;F.Promise&lt;? extends Boolean&gt;&gt;." What am I missing? How can I get the types to line up correctly?
score: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/21040864
has title: Convert List of Promises into Promise of List in Play Framework
tagged with: playframework
type: AnsweredQuestion
tagged with: type-mismatch
linked to: http://stackoverflow.com/q/5144896
tagged with: generics
linked to: http://stackoverflow.com/q/3546745
favorite count: 0
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/18194956
answer count: 1

http://stackoverflow.com/comment/31951619
type: Comment
comment on: http://stackoverflow.com/a/21113369
type: AnswerComment
has text: I am trying to instrument .war files using cobertura-2.0.3. When I run cobertura-instrument.bat. I get Exception in thread "main" Java.lang.NoClassDefFoundError.
score: 0

http://stackoverflow.com/a/21047826
has body: You need to either allocate more heap to your JVM (-Xmx7g) or tile the image so that you don't need to hold the whole thing in memory at once. The tiling is only useful of course if you aren't showing the whole image at once. If you are the to manage this you could compress the image in some way prior to trying to load it. There's also, third party libraries such as DiscMemImage to use images while limiting memory usage.
answers question: http://stackoverflow.com/q/21047721
score: 0
type: Answer

http://stackoverflow.com/comment/31633467
type: Comment
score: 0
type: QuestionComment
has text: @MarkoTopolnik Alright so if I go `i=5` *after* setting `i=0`, then no GC is needed?
comment on: http://stackoverflow.com/q/21040409

http://stackoverflow.com/comment/31806456
type: AnswerComment
score: 0
type: Comment
has text: Yes it wrong, change your xml and mark my answer as solved please :)
comment on: http://stackoverflow.com/a/21134360

http://stackoverflow.com/comment/31690540
score: 1
has text: did you run it ?? Run and see what comes.
comment on: http://stackoverflow.com/q/21072239
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/32214939
type: Comment
type: QuestionComment
score: 0
has text: Did you try `.setTimeToLive()` instead of `.setTimeout()`? I am not sure, though.
comment on: http://stackoverflow.com/q/21172927

http://stackoverflow.com/comment/31593642
score: 0
type: AnswerComment
has text: I have tried this not working select s from sample where date <= sysdate + 54 order by id;
type: Comment
comment on: http://stackoverflow.com/a/21019057

http://stackoverflow.com/a/21164999
downvote count: 0
type: AcceptedAnswer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21164178
type: Answer
answers question: http://stackoverflow.com/q/21164178
has body: @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(event.getAction() == KeyEvent.ACTION_DOWN){ switch(keyCode) { case KeyEvent.KEYCODE_BACK: if(mWebView.canGoBack() == true){ mWebView.goBack(); }else{ finish(); } return true; } } return super.onKeyDown(keyCode, event); } Edit: put this statement: WebView myWebView; inside of your Activity before the onCreate() method and you should be good to go.
score: 3

http://stackoverflow.com/comment/31697488
comment on: http://stackoverflow.com/a/21076092
type: Comment
score: 1
type: AnswerComment
has text: Why would someone downvote this?

http://stackoverflow.com/comment/31828569
type: Comment
type: QuestionComment
has text: This sounds like an [XY Problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem) (please see link). Can you give some background as to why you even think that you need to do this? I have a strong suspicion that there is a much better approach to solve the overall problem (not the specific code question).
comment on: http://stackoverflow.com/q/21147380
score: 1

http://stackoverflow.com/q/21159889
tagged with: amazon-s3
tagged with: java
has answer: http://stackoverflow.com/a/59939952
has comment: http://stackoverflow.com/comment/31850964
has answer: http://stackoverflow.com/a/21160372
has body: I am very very new to AWS S3. I have the following questions, Question 1) Is it possible to have folders and sub-folders in S3 buckets? For e.g. as below: Here **Root folder 'Folder' has 2 sub-folders and a file. Then Sub-folder1 has 2 sub-folders and a file. etc. Question 2) If i have the above structure in S3, How can I retrieve the data by Java code usinf AWS SDK for Java?
type: Question
has comment: http://stackoverflow.com/comment/31850787
tagged with: amazon-web-services
has title: Is it possible to have folders in AWS S3 bucket?
score: 0
answer count: 2
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31858273
has comment: http://stackoverflow.com/comment/31851168
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/21084222
has body: I want to post a tweet from my application on Twitter. This tweet will show in my application as well as twitter. I have all detail of the user, and I don't want to log in on Twitter. Here is the format which I am getting from the web service: {"Id":"cc02cf6c-c143-4921-b5d6-6afec1243c10","TwitterUserId":"123456", "TwitterScreenName":"abc", "OAuthToken":"xxxxxxxxxxxxxxxxxxxx", "OAuthSecret":"xxxxxxxxxxxx", "UserId":"zzzzzzzzzz", "FollowersCount":1, "IsActive":true, "FollowingCount":13, "ProfileUrl":"", "ProfileImageUrl":"http://abs.xxxxxxxxxxxxx.png", "TwitterName":null} Below is my code which posts a tweet on twitter, but here they are using log in with twitter. I don't want to log in. Please guide me or if possible then provide me some sample code. I am using twitter4j library. public class MainActivity extends Activity implements OnClickListener { // Constants /** * Register your here app https://dev.twitter.com/apps/new and get your * consumer key and secret * */ static String TWITTER_CONSUMER_KEY = "xxxxxxxxxxxxxxxxxx"; static String TWITTER_CONSUMER_SECRET = "xxxxxxxxxxxxxxxxxxxxxxxxxxx"; // Preference Constants static String PREFERENCE_NAME = "twitter_oauth"; static final String PREF_KEY_OAUTH_TOKEN = "oauth_token"; static final String PREF_KEY_OAUTH_SECRET = "oauth_token_secret"; static final String PREF_KEY_TWITTER_LOGIN = "isTwitterLogedIn"; static final String TWITTER_CALLBACK_URL = "oauth://t4jsample"; // Twitter oauth urls static final String URL_TWITTER_AUTH = "auth_url"; static final String URL_TWITTER_OAUTH_VERIFIER = "oauth_verifier"; static final String URL_TWITTER_OAUTH_TOKEN = "oauth_token"; Button btnLoginTwitter; Button btnUpdateStatus; // This is responsible for tweet updation Button btnLogoutTwitter; EditText txtUpdate; ProgressDialog pDialog; // Twitter private static Twitter twitter; private static RequestToken requestToken; // Shared Preferences private static SharedPreferences mSharedPreferences; // Alert Dialog Manager AlertDialogManager …
has title: How to Post Tweet on Twiiter Using own application
tagged with: android
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21090389
tagged with: twitter
type: Question
possible better answer: http://stackoverflow.com/a/21084345
has answer: http://stackoverflow.com/a/21084345
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21090389

http://stackoverflow.com/comment/32041097
has text: As Chritian says, setting QoS to 0 is not a good solution here - you sacrifice reliability of your messages for what should be proper memory management in your application. It is a shame this answer has been accepted.
comment on: http://stackoverflow.com/a/21108882
score: 4
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21086383
upvote count: 1
downvote count: 1
tagged with: excel
type: Question
has answer: http://stackoverflow.com/a/64045058
has answer: http://stackoverflow.com/a/64431010
has title: Error when using xlsx package in write.xlsx
tagged with: http://stackoverflow.com/tag/r
has answer: http://stackoverflow.com/a/67375854
score: 0
favorite count: 0
has body: I am trying to save a file using write.xslx (when saving with write.csv some row got shift in more columns so I am trying to save the file as xlsx directly). If I type this command: write.xlsx (old.data, file ="Documents/new.xlsx", sheetName="Sheet1",col.names=TRUE, row.names=TRUE, append=FALSE) or write.xlsx (old.data, "Documents/new.xlsx", sheetName="Sheet1",col.names=TRUE, row.names=TRUE, append=FALSE) I get this error: Error in .jnew("org/apache/poi/xssf/usermodel/XSSFWorkbook") : Java Exception <no description because toString() failed>.jnew("org/apache/poi/xssf/usermodel/XSSFWorkbook")<S4 object of class "jobjRef"> Can anyone help me sort it out?
has answer: http://stackoverflow.com/a/21088720
linked to: http://stackoverflow.com/q/5963269
type: UnansweredQuestion
answer count: 4
tagged with: java

http://stackoverflow.com/q/21077494
tagged with: jtextfield
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/21077536
has answer: http://stackoverflow.com/a/21084687
has answer: http://stackoverflow.com/a/21077536
upvote count: 0
score: -1
answer count: 3
favorite count: 0
tagged with: netbeans
has answer: http://stackoverflow.com/a/21084811
tagged with: swing
has title: Java Swing update TextField without any action
type: AnsweredQuestion
has body: I created an app in netbeans using swing where i have several JTextFields that i want to update in a cycle without using a buttonactionclick... the problem is when i put in the code of netbeans jFieldText1.setText("test"); in main or in a function... it doesn't appear in the gui... is there any way to do this without having to press a button to update the results? what i want to do is keep polling using a cycle that updates the JTextField. thanks...
accepted answer: http://stackoverflow.com/a/21084811
tagged with: java

http://stackoverflow.com/q/21167816
tagged with: android-activity
favorite count: 0
linked to: http://stackoverflow.com/q/1944656
has comment: http://stackoverflow.com/comment/31910094
type: UnansweredQuestion
upvote count: 1
linked to: http://stackoverflow.com/q/14881002
tagged with: android-intent
score: 1
tagged with: java
has title: Sending Bundle to Main/Launcher Activity BEFORE it's created?
has answer: http://stackoverflow.com/a/21167999
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21169088
has body: Bundles can be easily passed to new activities with intents: Intent intent = new Intent(this, DisplayMessageActivity.class); Bundle b = new Bundle(); // add extras... intent.putExtras(b); startActivity(intent); Is it possible use Bundles (or similar) to send data to the main activity? The Application class is created before any activity and I would like to use it to send data to the main activity. I do not want to have the data accessible globally or use static methods on the main activity to pass data to it.
tagged with: android

http://stackoverflow.com/comment/31639352
comment on: http://stackoverflow.com/q/21041227
has text: This is webservice not hosted by Me. i just Consume it. This is the error when i print it(e). how can i make the program to ignore only this kind of error
type: Comment
type: QuestionComment
score: 0

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

http://stackoverflow.com/a/21065853
accepted answer of: http://stackoverflow.com/q/21064914
answers question: http://stackoverflow.com/q/21064914
has body: Use the word AS to assign a column name to the returned MAX value: final String MY_QUERY = "SELECT MAX(" + REQUEST_CODE + ") AS maxRequest_Code FROM " + TABLE_TASKS; Then get value from cursor: max_request_code = mCursor.getInt(mCursor.getColumnIndex("maxRequest_Code")); or use: max_request_code = mCursor.getInt(0);
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/31843036
has text: Using an external library? I'm not sure if this satisfies the requirements for simplicity implied by the disallowing of if-statements because "it technically has not be learned" @NathanCurtis
type: Comment
comment on: http://stackoverflow.com/a/21153915
score: 1
type: AnswerComment

http://stackoverflow.com/comment/31723972
type: AnswerComment
score: 0
type: Comment
has text: I can't find a link to the javadocs of elemantal, or anywhere with more code examples..
comment on: http://stackoverflow.com/a/21089264

http://stackoverflow.com/a/21075899
has body: First of all you can simply check it with a test and a big for loop. Or even debug, you'll see that methods are called one by one. Think yourself, it could be very dangerous if JVM make such decisions by itself.
answers question: http://stackoverflow.com/q/21075833
score: 0
type: Answer

http://stackoverflow.com/comment/31800345
score: 0
has text: Post your AndroidManifest file.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21131430

http://stackoverflow.com/a/21169228
has body: This is not using CXF at runtime. The JAX-WS implementation built into Glassfish (Metro) is being picked up and used.
answers question: http://stackoverflow.com/q/21167527
score: 0
type: Answer

http://stackoverflow.com/comment/31787216
score: 0
type: Comment
type: QuestionComment
has text: @JVMATL Thanks. I will probably do that
comment on: http://stackoverflow.com/q/21123972

http://stackoverflow.com/a/21161743
upvote count: 1
has comment: http://stackoverflow.com/comment/31854856
has comment: http://stackoverflow.com/comment/31909151
has body: Find bottlenecks of your implementation using profiler . ex. jprofiler is easy to use Use threads in areas where algorithm can run simultaneously. Profile your JavaVM to run faster. Allocate more RAM
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21161416
score: 1

http://stackoverflow.com/comment/31636696
type: QuestionComment
has text: you mean ads:adUnitId="ca-app-pub-xxxxxxxxxxxxx/xxxxxxxx"? i put the whole thing with my publisher id
comment on: http://stackoverflow.com/q/21043326
score: 0
type: Comment

http://stackoverflow.com/q/21079636
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21079769
upvote count: 2
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21079769
answer count: 1
has comment: http://stackoverflow.com/comment/31704228
downvote count: 0
tagged with: imagebutton
favorite count: 0
tagged with: android
has body: I am trying to create a simple app that when an ImageButton is clicked, a message is displayed on the screen. I am following along with this tutorial: http://www.mkyong.com/android/android-imagebutton-example/ EDIT: my entire XML files is as follows: &lt;LinearLayout 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=".MainActivity" android:orientation="horizontal"&gt; &lt;TextView android:textSize = "30sp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity = "center" android:text="@string/user_name" /&gt; &lt;ImageButton android:id="@+id/imageButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/me2" /&gt; &lt;/LinearLayout&gt; and have the picture me2.png in my res/drawable-hdpi folder. in my mainActivity.java file I have: ImageButton imageButton; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); addListenerOnButton(); } public void addListenerOnButton() { imageButton = (ImageButton) findViewById(R.id.imageButton1); imageButton.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View arg0) { Toast.makeText(MainActivity.this, "ImageButton is clicked!", Toast.LENGTH_SHORT).show(); } }); } However, when I run my app on my device (not emulator) all it does is display a string of my name that I had already implemented leaving the rest of the page/layout blank. Any thoughts? Everything builds successfully. Thanks!
has comment: http://stackoverflow.com/comment/31704357
has title: Android ImageButton builds successfully but doesn't show

http://stackoverflow.com/comment/31789982
type: Comment
comment on: http://stackoverflow.com/a/21126017
score: 1
type: AnswerComment
has text: @AmirPashazadeh: Well, OP doesn't *have* to use the import clause; following the Outer.Inner convention will work, and is the typical way. But if he wants an answer "why", the best i can give is "That's the way Java works".

http://stackoverflow.com/a/21055160
downvote count: 0
has comment: http://stackoverflow.com/comment/31659478
has comment: http://stackoverflow.com/comment/31659375
has body: I would not use regular expression for the case you described i would rather store the possible variations of the name e.g. in a List would validate the input just with a simple contains. List&lt;String&gt; daimons = Arrays.asList("Daimon", "Daimo", "Dai", "daimon", "daimo", "DAIMON"); I don't see really the power of the regex for your example. If i would not see your solution probably my would be something similar: public class RegExMyName { public static void main(String[] args) { Scanner scan = new Scanner(System.in); List&lt;String&gt; daimons = Arrays.asList("Daimon", "Daimo", "Dai", "daimon", "daimo", "DAIMON"); StringBuilder diamonCommonUsage = new StringBuilder(); for(String daimonVariations : daimons) { diamonCommonUsage.append(daimonVariations); diamonCommonUsage.append(", "); //+ remove the last "," } System.out.println("Name: Daimon"); System.out.println("Common Usages: " + diamonCommonUsage.toString()); System.out.println("Enter any of the variations listed only: "); if (match.find(daimons.contains(scan.nextLine()))){ System.out.println("*** You entered a valid name ***"); }else{ System.out.println("*** You entered an invalid name ***"); } } }
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21055054

http://stackoverflow.com/a/62647307
type: Answer
has body: These days something like the following will suffice: HttpHeaders headers = new HttpHeaders(); headers.setBearerAuth(accessToken); restTemplate.exchange(RequestEntity.get(new URI(url)).headers(headers).build(), returnType);
downvote count: 0
answers question: http://stackoverflow.com/q/21101250
score: 21
upvote count: 21

http://stackoverflow.com/a/29315535
accepted answer of: http://stackoverflow.com/q/21178980
score: 1
upvote count: 1
has body: Here you can try this code. LinearLayout.LayoutParams par = new LinearLayout.LayoutParams(200,200); par.height = 20; par.width = 10; View.setLayoutParams(params);
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21178980
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31653848
has text: No, I have not tried it yet. How do I use NTLM with Negotiate? The documentation only has Kerberos with Negotiate.
type: QuestionComment
comment on: http://stackoverflow.com/q/21033787
score: 0
type: Comment

http://stackoverflow.com/comment/31747377
comment on: http://stackoverflow.com/q/21102166
score: 0
has text: Following your edit, you can't since the object is created before you receive your data. To continue the chain, **why** do you need these variables to be non-null when you create the instance of the class?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21150736
has body: i'm building app to upload image files into server using POST. After many hours it started to works, but i have last issue. After upload data, my new file have additional header: --cpPHHy2XlygEWv4fZndlhywQcKPxV33Qn0Z8EOf8^M Content-Disposition: form-data; name="file"^M Content-Type: image/jpeg^M Content-Transfer-Encoding: binary^M ^M This header doesn't appear in oryginal file. My upload code is: HttpClient httpclient = new DefaultHttpClient(); httpclient.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); String urlParam = "http://www.modesa.pl/adminPanel/ajax-tab.php?id_product="+productId+"&amp;id_category=0&amp;token=c4c533d2825f8791a07265d812d62d90&amp;tab=AdminProducts&amp;action=addImage&amp;ajax=1&amp;qqfile=IMG_0599.jpg"; HttpPost httppost = new HttpPost(urlParam); File file = new File(filename); MultipartEntity mpEntity = new MultipartEntity(); ContentBody cbFile = new FileBody(file, "image/jpeg"); mpEntity.addPart("IMG_0599", cbFile); Header[] headers2 = { new BasicHeader("Cookie", cookieNew), new BasicHeader("Content-Type", "multipart/form-data") }; httppost.setEntity(mpEntity); httppost.setHeaders(headers2); System.out.println("executing request " + httppost.getRequestLine()); HttpResponse responseX = httpclient.execute(httppost); HttpEntity resEntity = responseX.getEntity(); System.out.println(responseX.getStatusLine()); if (resEntity != null) { System.out.println(EntityUtils.toString(resEntity)); } if (resEntity != null) { resEntity.consumeContent(); } httpclient.getConnectionManager().shutdown(); Can you help me, what to do, that those headers wont appear in new file ?
answer count: 0
type: UnansweredQuestion
tagged with: java
has title: Upload file into server
has comment: http://stackoverflow.com/comment/31835663
type: Question
has comment: http://stackoverflow.com/comment/31835382
linked to: http://stackoverflow.com/q/19985169
score: 0
tagged with: upload

http://stackoverflow.com/q/21049557
has body: I am trying to validate phone number but cannot. My requirement is phone number consist only of digits and + (plus symbol). The + can be only the first character. For example: +123456489 I am using this regular expression but it is not working: /^\+(?:[0-9]??)$/ Thanks in advance.
has answer: http://stackoverflow.com/a/46086627
duplicate of: http://stackoverflow.com/q/29555521
tagged with: asp.net-mvc-4
tagged with: java
score: 10
has answer: http://stackoverflow.com/a/53920685
upvote count: 10
tagged with: knockout.js
has answer: http://stackoverflow.com/a/21049666
type: Question
has answer: http://stackoverflow.com/a/21049686
downvote count: 0
linked to: http://stackoverflow.com/q/29555521
has answer: http://stackoverflow.com/a/59404649
tagged with: javascript
answer count: 6
has comment: http://stackoverflow.com/comment/135372178
tagged with: regex
favorite count: 0
has answer: http://stackoverflow.com/a/21049779
has title: Phone number validation regular expression consist one plus sign in start and preceding digits
type: UnansweredQuestion

http://stackoverflow.com/comment/31663804
score: 0
type: AnswerComment
type: Comment
has text: ok thanks i did that but now the count says even 1 odd 6 when i put in all odds. why is that the only thing i changed was what you said
comment on: http://stackoverflow.com/a/21057525

http://stackoverflow.com/comment/31778466
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21120003
score: 0
has text: why on earth would you want two methods, named identically, taking two identical parameters, but in different orders? That is confusing [at best](http://ballinyourcourt.files.wordpress.com/2012/03/shooting-foot1.jpg).

http://stackoverflow.com/comment/31807690
comment on: http://stackoverflow.com/a/21111013
type: AnswerComment
score: 0
has text: Look at Holger's comment (last as of now) on the original question, and Brian's answer and the two comments on that answer. As I understand it, threads cache all objects locally and thus the changes they make are not guaranteed to be visible to other threads, *unless* using some thread-safe synchronous method or object (like `BlockingQueue`). For primitives that can be accomplished with the `volatile` keyword that makes sure all threads r/w this value from main memory.
type: Comment

http://stackoverflow.com/comment/31891437
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21180576
has text: @M.Deinum But even on the 1st datasource, I don't get why it's committing all the data before I call the ut.commit. Seems this UserTransactionManager is currently totally disconnected from my two non XA datasources. They are both not under its control, that's what it seems to me.

http://stackoverflow.com/q/21045771
has answer: http://stackoverflow.com/a/21045941
has answer: http://stackoverflow.com/a/21046158
has body: As i understand (and i am java noob), when i resize a window or change its content paintComponent() method should be called automatically. It redraws everything, so when i override it with an empty method, nothing should be redrawn...but it is. Why? Probably i am missing something. What exactly is redrawn by paintComponent(), everything? Or some backgrounds or smth? import java.awt.*; import javax.swing.*; public class TextFrame extends JFrame { public TextFrame(String text, String fontName) { super("Show Font"); setSize(725, 150); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); TextFramePanel sf = new TextFramePanel(text, fontName); JButton ok = new JButton("i hate disappearing"); sf.add(ok); add(sf); setVisible(true); } public static void main(String[] arguments) { if (arguments.length &lt; 1) { System.out.println("Usage: java TextFrame message font"); System.exit(-1); } TextFrame frame = new TextFrame(arguments[0], arguments[1]); } } class TextFramePanel extends JPanel { String text; String fontName; public TextFramePanel(String text, String fontName) { super(); this.text = text; this.fontName = fontName; } public void paintComponent(Graphics comp) { //super.paintComponent(comp); /*Graphics2D comp2D = (Graphics2D)comp; comp2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Font font = new Font(fontName, Font.BOLD, 18); FontMetrics metrics = getFontMetrics(font); comp2D.setFont(font); int x = (getSize().width - metrics.stringWidth(text)) / 2; int y = getSize().height / 2; comp2D.drawString(text, x, y); System.out.println("vlad");*/ } }
tagged with: java
has comment: http://stackoverflow.com/comment/31642242
type: Question
has comment: http://stackoverflow.com/comment/31641133
score: 0
answer count: 2
has title: why components redrawn when i override with empty paintComponent(g) method?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31641437
has comment: http://stackoverflow.com/comment/31642053

http://stackoverflow.com/comment/31930383
has text: Thanks @noloader, they all have that as mentioned in my updates above
score: 0
comment on: http://stackoverflow.com/q/21183043
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21044676
type: Question
has body: I'm trying to connect a linux machine which has oracle database 11gr2 setup inside. There is no problem with connecting PL/SQL developer with any user. Unfortunately, with my simple java application, it's impossible to connect to database. Here is my java code: JAVA CODE package oraConn; import java.sql.*; public class OraConn { public static void main(String[] args) { Connection connection=null; try { String driverName= "oracle.jdbc.driver.OracleDriver"; Class.forName(driverName); String serverName="192.168.2.122"; String portNumber="1521"; String sid="sas"; String url="jdbc:oracle:thin:@" + serverName + ":" + portNumber +":"+sid; String userName = "system"; String password = "welcome"; connection = DriverManager.getConnection(url,userName,password); } catch (Exception e) { e.printStackTrace(); } } } When i run this codeblock, i get an exception like this: java.sql.SQLException: IO Error: Connection refused at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:489) at oracle.jdbc.driver.PhysicalConnection.&lt;init&gt;(PhysicalConnection.java:553) at oracle.jdbc.driver.T4CConnection.&lt;init&gt;(T4CConnection.java:254) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:528) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at oraConn.OraConn.main(OraConn.java:16) Caused by: oracle.net.ns.NetException: Connection refused at oracle.net.ns.NSProtocol.connect(NSProtocol.java:399) at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1140) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:340) ... 7 more I am sure that port 1521 is open because i can use PL/SQL developer. What should i do?
has title: Can't Connect To Remote Oracle Database (11g)
has comment: http://stackoverflow.com/comment/31639088
answer count: 1
has answer: http://stackoverflow.com/a/21044817
score: 0
tagged with: java
tagged with: oracle11g
has comment: http://stackoverflow.com/comment/31639526
type: UnansweredQuestion

http://stackoverflow.com/comment/31704622
comment on: http://stackoverflow.com/q/21077515
score: 0
type: QuestionComment
type: Comment
has text: not tried your code, but for animations or movement is neccesary, have to wait for answerer(s) with real skills with Painting in Swing, but you can to click to the paintComponent tag, there are bunch of code in MCVE form

http://stackoverflow.com/q/21137595
has comment: http://stackoverflow.com/comment/31810152
has body: I am trying to loop the user input for flavour and number of scoops until when asked 'more ice cream purchased?' the user enters 'n' but when entering 'n' it displays the report and then asks for a flavour again? How can I stop this? Scanner in = new Scanner(System.in); int index = 0; { System.out.println("What flavour was chosen (strawberry, vanilla, chocolate) or type 'end' to finish?"); iceCreamCone[0] = in.nextLine(); System.out.println("How many scoops of this flavour?"); iceCreamCone[0] = in.nextLine(); index = index + 1; char choice; System.out.println("More ice cream purchased (y/n):"); { choice = in.next().charAt(0); while (choice == 'y') { System.out.println("What flavour was chosen (strawberry, vanilla, chocolate) or type 'end' to finish?"); iceCreamCone[1] = in.nextLine(); in.nextLine(); System.out.println("How many scoops of this flavour?"); iceCreamCone[1] = in.nextLine(); index = index + 1; } if (choice == 'n') { { System.out.println("Report for today: \nTotal ice cream cones sold: \nTotal sales from the customers: "); } } } } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31810021
has answer: http://stackoverflow.com/a/21179409
has comment: http://stackoverflow.com/comment/31809967
tagged with: java
has comment: http://stackoverflow.com/comment/31809941
has answer: http://stackoverflow.com/a/21138043
has comment: http://stackoverflow.com/comment/31809935
type: Question
tagged with: infinite-loop
has comment: http://stackoverflow.com/comment/31809980
has comment: http://stackoverflow.com/comment/31809945
has answer: http://stackoverflow.com/a/21139132
has title: How to fix a continous loop?
has comment: http://stackoverflow.com/comment/31810126
score: 0
answer count: 3
tagged with: while-loop

http://stackoverflow.com/a/21139620
answers question: http://stackoverflow.com/q/21109933
has body: There is a sub project of Spring Batch Admin called Spring Batch Integration. It contains a number of components for using Spring Batch and Spring Integration together. In that project are components for launching jobs via messages. Using these components, you can maintain a decoupled deployment, launch the jobs in an event driven manor and scale them as needed. This is the route I'd recommend. You can read more about this project here: https://github.com/spring-projects/spring-batch-admin/tree/master/spring-batch-integration You can also view a talk Gunnar Hillart and I did on Spring Batch Integration this past year at SpringOne2GX here: http://spring.io/blog/2014/01/14/springone2gx-2013-replay-integrating-spring-batch-and-spring-integration
score: 0
type: Answer

http://stackoverflow.com/a/21211129
has body: You are likely incorrectly using the Hadoop Text class -- this is not an error with Accumulo. Specifically, you make the mistake in your above example: Value val = new Value(new Text(filename).getBytes()); You must adhere to the length of provided by the Text class. See the Text javadoc for more information. If you're using Hadoop-2.2.0, you can use the provided copyBytes method on Text. If you're on older version of Hadoop where this method doesn't yet exist, you can use something like the ByteBuffer class or the System.arraycopy method to get a copy of the byte[] with the proper limits enforced.
accepted answer of: http://stackoverflow.com/q/21173203
answers question: http://stackoverflow.com/q/21173203
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32048268
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/32050300
has comment: http://stackoverflow.com/comment/32096122

http://stackoverflow.com/q/21090022
upvote count: 1
has comment: http://stackoverflow.com/comment/31726520
type: Question
has comment: http://stackoverflow.com/comment/31732295
has comment: http://stackoverflow.com/comment/31724788
tagged with: session
has comment: http://stackoverflow.com/comment/31724190
has title: Session creation difference between Struts 1 and Struts2?
has body: I'm converting a Struts 1 application to Struts 2 and have come across a strange Session issue. We use Apache rewrite rules to change the URL for /page to be /app/proj/page which works fine for both applications. However, everytime we go to /page in the Struts 1 application we keep the same session (the same JSESSIONID for the path / is used) but in the Struts 2 application we get a new Session each time (a different JSESSIONID for the path /app is created each time). I've done some searching in the Struts 2 documentation, on Google and on here but I can't find anything that indicates a difference in how Struts 1 and 2 handle sessions so I'm guessing its a configuration or Java Action change thats required. As I'm a newcomer to Struts 2 I've obviously missed something so any pointers would be gratefully received. Thanks, Z FOLLOWUP : I can't post my own answer yet, but we have resolved it and this is what I was going to post: Thanks to everyone for their help. We have now managed to retain the session using the ProxyPassReverseCookiePath setting in Apache. This was detailed on StackOverflow here : How to properly set JSESSIONID cookie path behind reverse proxy and we implemented by putting : ProxyPassReverseCookiePath /app2 / in the apache httpd-vhosts.conf. Thanks, Z
tagged with: struts2
has comment: http://stackoverflow.com/comment/31722809
downvote count: 0
has comment: http://stackoverflow.com/comment/31724635
has comment: http://stackoverflow.com/comment/31723474
favorite count: 0
has comment: http://stackoverflow.com/comment/31723222
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31724312
answer count: 0
linked to: http://stackoverflow.com/q/9155837
score: 1
tagged with: java

shell
tags question: http://stackoverflow.com/q/21110181
tag name: shell
tags question: http://stackoverflow.com/q/21138079
type: Tag
tags question: http://stackoverflow.com/q/21086112
tags question: http://stackoverflow.com/q/21045945
tags question: http://stackoverflow.com/q/21120630

http://stackoverflow.com/comment/31897956
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21139201
type: Comment
has text: You can see unparsed-text() in action here: http://try.zorba.io/queries/xquery/XZTZOLuKziGhY9ZvLz2HTc3HCGs%3D

http://stackoverflow.com/q/21072760
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21073078
favorite count: 0
tagged with: android
has title: Can I use WebView without any javascript code?
type: AnsweredQuestion
score: 2
tagged with: android-webview
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/21073078
type: Question
has body: I'm new to using WebView and I'm wondering, do I need to know javascript to use WebView to it's fullest potential? For example if I want to interact with a website's actions like post or reply buttons, would I have to use javascript after creating my own buttons to add functionality to them? In other words, if I don't like how these buttons on "www.example.com" look, can I hide them in my webview and add my own and then after adding my own, could I make them do what the websites buttons do, post or reply ? Would I need JS for this or could I do it all just using java?

http://stackoverflow.com/q/21091259
answer count: 1
tagged with: jar
has body: I want to write an dll in C/C++ and call java methods contained in an jar file. I found many threads on SO with the opposite (using a dll from a jar), but not much for my case. So I'm wondering if this is even possible/reasonable at all. I thought just an matching jvm would be required on the machine that loads the dll - but it seems I have to embed a whole jvm in my dll. That would be overkill in my scenario. My reason to do this is the following: I have an 3rd party application that is capable of loading dlls with a certain interface and I have also a license algorithm as jar file (which will check if a valid license is installed on this machine - no source code for this jar is existing at my end). So I want to compile an dll that will only work if the license mechanism from the jar file returns success. Do I really have to embed a whole jvm in my dll then? Which problems could occur? Any ideas/suggestions on this topic? Thanks,
favorite count: 0
downvote count: 0
has answer: http://stackoverflow.com/a/21091478
accepted answer: http://stackoverflow.com/a/21091478
has title: How to call java methods from native code / embed jar in dll
type: Question
type: AnsweredQuestion
tagged with: dll
score: 1
tagged with: java
upvote count: 1
linked to: http://stackoverflow.com/q/819536

http://stackoverflow.com/comment/31753346
comment on: http://stackoverflow.com/q/21105740
score: 0
type: Comment
type: QuestionComment
has text: @maackle I was hoping it was, but apparently, no.

http://stackoverflow.com/comment/79051975
has text: where to get the cert file from? I can't tell which URL to go to. https://www.jetty.com ?
type: Comment
comment on: http://stackoverflow.com/a/40743987
score: 0
type: AnswerComment

ibatis
tags question: http://stackoverflow.com/q/21094785
tags question: http://stackoverflow.com/q/21108656
tags question: http://stackoverflow.com/q/21073480
tag name: ibatis
tags question: http://stackoverflow.com/q/21132589
type: Tag

http://stackoverflow.com/comment/31666327
type: Comment
has text: Your code looks good.. it should work
type: QuestionComment
comment on: http://stackoverflow.com/q/21059072
score: 0

http://stackoverflow.com/q/21179092
accepted answer: http://stackoverflow.com/a/21179352
type: AnsweredQuestion
tagged with: onclicklistener
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31885930
tagged with: layout-inflater
possible better answer: http://stackoverflow.com/a/21179527
type: Question
has comment: http://stackoverflow.com/comment/31886339
answer count: 2
has answer: http://stackoverflow.com/a/21179527
has comment: http://stackoverflow.com/comment/31886043
has answer: http://stackoverflow.com/a/21179352
tagged with: android
has comment: http://stackoverflow.com/comment/31886005
has body: I am relatively new to android development and there are a few ideas I am having trouble getting my head around. What I am trying to achieve is when a button is clicked, a view is inflated to a LinearLayout of R.id.resultsBox. My idea behind what I think I have to do is this: public class FindClassFragment extends Fragment { private Button search_button; private EditText course_abbrev_field; private EditText course_num_field; private Spinner semester_spinner; private String course_abbrev; private String course_num; private String semester; private ArrayList&lt;String[]&gt; sectionsList; private LinearLayout resultsBox; private WebScraper scraper; public FindClassFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_findclass, container, false); resultsBox = (LinearLayout) rootView.findViewById(R.id.resultsView); RelativeLayout f = (RelativeLayout) inflater.inflate(R.layout.fragment_section, null); search_button = (Button) rootView.findViewById(R.id.search_button); course_abbrev_field = (EditText) rootView.findViewById(R.id.course_abbrev); course_num_field = (EditText) rootView.findViewById(R.id.course_num); assert search_button != null; search_button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { System.out.println("CLICK"); if(true) { resultsBox.removeAllViews(); LinearLayout l = (LinearLayout) view.inflate(getActivity(), R.layout.error, (ViewGroup) view); resultsBox.addView(l); } else { resultsBox.removeAllViews(); } } }); return rootView; } } I figured out how to get the click event working. "CLICK" is printed to the log when I click it. I thought I inflated the view correctly but obviously not because the application crashed. I'm assuming my error has something to do with inheritance from the FindClassFragment class to the new View.OnClickListener() sub class but I'm just not sure what exactly. I tr…
has title: Inflate view from Resource layout after on click event

http://stackoverflow.com/q/21019571
has answer: http://stackoverflow.com/a/21019666
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21019638
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/21019616
has body: I'm trying to put not null check to this below return statement below in java file. The property file i have TEMP_CONFIG.properties and it is containing values like: EMP_DEP.DEVL=DEV Employee : DEV. Here I am getting the value of the property using infoType.trim(). Here I have to check the null condition of this. public String buildInfo(String empId,String infoType) throws IOException{ return EmpProperties.getProperty("/TEMP_CONFIG.properties", "EMP_DEP."+infoType.trim()); } Here I have to do null check and just return the original infoType value if it is null. The infoType is DEVL from the above property. Need some suggestion to check not null.
has comment: http://stackoverflow.com/comment/31594256
type: Question
has comment: http://stackoverflow.com/comment/31594103
tagged with: null
score: -2
accepted answer: http://stackoverflow.com/a/21019616
has comment: http://stackoverflow.com/comment/31594097
upvote count: 0
tagged with: string
has title: improving checking Not null Condition
has answer: http://stackoverflow.com/a/21019664
favorite count: 0
has answer: http://stackoverflow.com/a/21019638
has comment: http://stackoverflow.com/comment/31594165

http://stackoverflow.com/comment/70887263
type: AnswerComment
comment on: http://stackoverflow.com/a/21135292
type: Comment
has text: It tells me "This static method cannot hide the instance method from Component" in the method: getGraphicsConfiguration(). If I remove 'static' from all methods it runs but not the transparent effect.
score: 0

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

http://stackoverflow.com/comment/31874545
comment on: http://stackoverflow.com/q/21172582
score: 0
has text: @JaneGoodall have you tried from console or just from Eclipse ?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21074845
downvote count: 0
has comment: http://stackoverflow.com/comment/31695909
type: Answer
has comment: http://stackoverflow.com/comment/31696027
score: 2
accepted answer of: http://stackoverflow.com/q/21074763
has comment: http://stackoverflow.com/comment/31695124
has comment: http://stackoverflow.com/comment/31695457
answers question: http://stackoverflow.com/q/21074763
has body: I think @FD_'s answer is right, however, if you still want to do it the way you proposed, the right way to do it is creating a ScrollView object and then adding the TableLayout via its addView() method. ScrollView sv = new ScrollView(this); sv.addView(yourTableLayout);
upvote count: 2
has comment: http://stackoverflow.com/comment/31695597
has comment: http://stackoverflow.com/comment/31695231
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31695707
has comment: http://stackoverflow.com/comment/31695728
has comment: http://stackoverflow.com/comment/31695825
has comment: http://stackoverflow.com/comment/31695999

http://stackoverflow.com/q/21066492
tagged with: java
has answer: http://stackoverflow.com/a/21067455
type: Question
has comment: http://stackoverflow.com/comment/31680733
has body: Hello, I am working on a bookshelf app that imports pdf files so the user can read them. When you click the import books button, it says it imports the books, but does not view them. As soon as you close the app and try to reopen it you get a force close. Here's what logcat says: Unable to decode stream: java.io.FileNotFoundException: /mnt/sdcard/shelf/preview/LittleBookOfRubypdf.png: open failed: ENOENT (No such file or directory) Unable to decode stream: java.io.FileNotFoundException: /mnt/sdcard/shelf/preview/best_of_ruby_quizpdf.png: open failed: ENOENT (No such file or directory) I have &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt; in AndroidManifest.xml Here's my bookshelf code: package com.sibext.android_shelf; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import java.util.List; import com.d4a.tobias.R; import com.sibext.android_shelf.adapter.ShelfAdapter; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.res.AssetManager; import android.os.Bundle; import android.os.Environment; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ListView; import android.widget.Toast; public class Two extends Fragment{ private static final String TARGET_DIRECTORY = "mnt/sdcard/shelf/"; private ListView list; Context ctx; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.two, container,…
has title: Exception while opening a file
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/31682511
type: Comment
has text: where can i find vlcj 64b because my jdk is jdk-7u45-windows-x64 and my system is 64b and my vlc player is 64xb
comment on: http://stackoverflow.com/a/21067080
type: AnswerComment
score: 0

http://stackoverflow.com/q/21076274
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/31697802
has comment: http://stackoverflow.com/comment/31697784
has title: a method always returns false even if i enter valid values
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21076653
has comment: http://stackoverflow.com/comment/31697875
tagged with: java
has body: in this method i have tried to set row =0 , row =1 row =2 row =3 row =4 and the result is always false. i think its something considering the initilization of the variable valid but if i do not initialize the compiler comes up with error public static boolean isValidMove(int row,int col){ boolean valid=false; if(row&gt;=0&amp;&amp;row&lt;3&amp;&amp;col&gt;=0&amp;&amp;col&lt;3){ if (takenSquare[row][col]==false) { valid= true; } }
type: Question
has comment: http://stackoverflow.com/comment/31697970
has answer: http://stackoverflow.com/a/21076390
has comment: http://stackoverflow.com/comment/31697864
has answer: http://stackoverflow.com/a/21076454

http://stackoverflow.com/comment/31678583
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21065566
has text: @Gene: could you clarify that?
type: Comment

http://stackoverflow.com/q/21054060
type: Question
tagged with: java
has body: If I have a single class that implements both pre and post process will I be able to store things on the object between the preProcess call and postProcess call? So really would this be legal? @ServerInterceptor @Provider public class MyInterceptor implements PreProcessInterceptor, PostProcessInterceptor { private String url; @Override public ServerResponse preProcess(HttpRequest request, ResourceMethod resourceMethod) throws Failure, WebApplicationException { url = request.getUri().getRequestUri().toString(); return null; } @Override public void postProcess(ServerResponse response) { System.out.println(url); } }
has answer: http://stackoverflow.com/a/21055881
score: 5
answer count: 1
downvote count: 0
favorite count: 0
tagged with: resteasy
upvote count: 5
has title: Are resteasy interceptors thread safe between preProcess and postProcess?
type: AnsweredQuestion
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/21055881

http://stackoverflow.com/comment/31780491
type: Comment
has text: It's not that it wipes them. It creates a new UserInformation instance. If you pass it as it is on GlobalValues.userInformation, in practice you'll wipe the other fields' values. You may need to implement a `merge` method (or look up for an existing lib) to do that.
score: 0
comment on: http://stackoverflow.com/a/21117028
type: AnswerComment

points
tag name: points
type: Tag
tags question: http://stackoverflow.com/q/21118771

http://stackoverflow.com/a/21129436
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21129287
upvote count: 2
has body: You can use ArrayList rather than String Array, since its very difficult to remove/insert elements if you use String array. ArrayList&lt;String[]&gt; s1=new ArrayList&lt;String[]&gt;(); ArrayList&lt;String[]&gt; s2=new ArrayList&lt;String[]&gt;(); And use add() method to add all the elements, and scan the lists to find out the overlapped elements by using contains() method. Find that element and save&amp;&amp;remove it.
type: Answer

http://stackoverflow.com/comment/31799803
has text: Luckily, I don't wear glasses :-)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21131644
type: Comment

http://stackoverflow.com/comment/31849372
comment on: http://stackoverflow.com/q/21159042
type: Comment
score: 0
has text: Are you supposed to be typing in the lines or getting filenames from from `ags` ?
type: QuestionComment

http://stackoverflow.com/comment/31889242
type: Comment
type: QuestionComment
score: 1
has text: You should investigate why this method getSelectedView() executed. If you just don't want to throw the exception, you can comment it out //throw new UnsupportedOperationException("Not supported");
comment on: http://stackoverflow.com/q/21181085

http://stackoverflow.com/comment/31621844
type: Comment
has text: are you having the user choose what to be blacklisted or do you just need a mechanism to detect if the chosen item is blacklisted?
comment on: http://stackoverflow.com/q/21034423
score: 0
type: QuestionComment

http://stackoverflow.com/q/21081128
tagged with: actionlistener
score: 0
answer count: 1
tagged with: user-interface
has body: I'm working on a project for a simple game where you can go to different rooms by using buttons (north, east, west, south). Within the makeFrame() method of my gui I'm creating the panel, buttons etc. I then set the default room to "hall" for example and the actionlistener calls the method goRoom and passing the direction and currentRoom to that method. The goRoom method change the currentRoom to another room depending on the currentRoom. I included print statements to see if it works and so far it works fine. Everytime the game starts the default room is the hall. So when you click a button to go for example "North", the northButton is called in which then we call the goRoom method passing the direction (north) and the default room "hall" (as the game just starts and uses the default room). Then the room changes from hall to state room (within the method goRoom). When I try to press another button the currentRoom reset to the default value (hall). I think the action listener get the value from the makeFrame() method instead of the updated value from the goRoom method. The code is below: public class StoreGUI extends JFrame { public String currentRoom; public StoreGUI() { makeFrame(); } private void makeFrame() { currentRoom = "hall"; .... northButton = new JButton("Go North"); northButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { direction = "north"; goRoom(direction, currentRoom); } }); toolbar.add(northButton); westButton .... southButton .... eastButton .... picture.setIcon(new ImageIcon("image/hall.png")); frame.getContentPane().add(picture); frame.pack(); frame.setVisible(true); } private void goRoom(String direction, String currentRoom) { // get current room and check which direction button the user has pressed if (direction == "north"){ if(currentRoom == "hall"){ // Inserts the image icon and change currentRoom imgageTitle = "image/stateRoom.png"; currentRoom = "stateRoom"; } .... } What the problem could be? How c…
tagged with: compare
has title: ActionListener reset variable's current value to default
tagged with: java
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/21081147
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21081147

http://stackoverflow.com/comment/118341759
score: 0
type: AnswerComment
has text: If you believe that this question has the same answer as an existing question, you should be flagging to close as a duplicate of that question, not answering.
type: Comment
comment on: http://stackoverflow.com/a/66949364

http://stackoverflow.com/comment/82649104
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21141913
has text: Hi @munyul ; what is `n.value` ?

http://stackoverflow.com/comment/31821772
score: 0
type: Comment
type: QuestionComment
has text: How about `webDriver.quit()`?
comment on: http://stackoverflow.com/q/21143952

http://stackoverflow.com/q/21060805
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21069901
possible better answer: http://stackoverflow.com/a/21060872
has answer: http://stackoverflow.com/a/21060872
answer count: 2
downvote count: 0
favorite count: 0
tagged with: hex
upvote count: 2
tagged with: double
has body: I would like to initialize a double directly by using the hexadecimal-notation. I know this works for int and Long as shown in the following example (resulting values always right): int i = 0x10000000; // 268435456 Long li = 0x1000000000000000L; // 1152921504606846976 On the other hand, if I try do the same with doubles, it works but only in range of 4 Bytes (view comments in the code example). For the second, not valid notation the Netbeans IDE keeps telling me that is is an integer value and, thus, too large: double d1 = 0x10000000; // 2.68435456E8 double d2 = 0x1000000000000000; // not valid float-values work as well as they are in the range of 4 Bytes: float f1 = 0x10000000; // 2.68435456E8 Is there a way to directly write/initialize a double with hexadecimal-notation? Is the only reason for being able to write a Long with hex-notation that there is no "L" in this notation (in contrast to "f" for float or the not valid "." for marking doubles)? Why is there a limitation to 4 Bytes? And why does it apply to double and not to Long? Thank you for your advise and suggestions.
has answer: http://stackoverflow.com/a/21069901
score: 2
type: AnsweredQuestion
has title: Questions on hexadecimal-notation for primitive initialization

http://stackoverflow.com/q/21125894
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31789935
type: Question
has comment: http://stackoverflow.com/comment/31800096
has body: My pom file does not depend on google-collections-1.0 and neither dependency:resolve or dependency:tree list it but it is causing a conflict with guava and a real pain. Any suggestions on how to track it down. Thanks.
has comment: http://stackoverflow.com/comment/31790403
has title: mvn track down dependency google-collections-1.0
has comment: http://stackoverflow.com/comment/31789680
type: UnansweredQuestion
tagged with: maven

http://stackoverflow.com/q/21181831
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21184729
accepted answer: http://stackoverflow.com/a/21184729
linked to: http://stackoverflow.com/q/21166293
tagged with: spring
type: AnsweredQuestion
has title: Are `Point-Cuts` and `Advices` only applicable to beans in Spring?
downvote count: 0
score: 1
tagged with: java
has body: I posted following question for which I am still looking an answer. Around Advice for methods on Interface While looking in to this another question has come to my mind: Are Point-Cuts and Advices only applicable to the classes which are declared as bean in spring's appContext.xml Are Point-Cuts and Advices Is not applicable to all classes in the code-base ?
type: Question

http://stackoverflow.com/q/21069864
tagged with: jformattedtextfield
has title: Masked JFormattedTextField prevent deleting slash char
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: date-formatting
accepted answer: http://stackoverflow.com/a/21070012
has body: I'm creating a frame with a JFormattedTextField masked with MaskFormatter: public static void main(String[] args) { DateFormat df = new SimpleDateFormat("dd-mm-yyyy"); JFrame frame = new JFrame(""); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); frame.setLayout(new BorderLayout()); JFormattedTextField tf = new JFormattedTextField(df); tf.setColumns(20); panel.add(tf); try { MaskFormatter dateMask = new MaskFormatter("##-##-####"); dateMask.install(tf); } catch (ParseException ex) { Logger.getLogger(MaskFormatterTest.class.getName()).log(Level.SEVERE, null, ex); } frame.add(new JButton(), BorderLayout.LINE_START); frame.add(panel, BorderLayout.LINE_END); frame.pack(); frame.setVisible(true); } OK. It's alright, but when i delete (with keyboard key) the text i write in the field too delete slashes. Are there any mode to prevent it? I want delete the text but the slashes not, like: Writing date: "12-12-1212" After delete: " - - "
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/21070012
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/21123539
has body: My javascript line: $('#name').show(); My webdriver code line: wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("name"))).sendKeys("Some Name"); When I run the test it throws the following exception: WebDriverException: unknown error: cannot focus element So, I have been searching for a solution. There are some issues reported in chromium google code site. There are a lot of suggestions about using JavaScriptExecutor. But it doesn't seem a better solution for me, because it could make a browser dependent code.
tagged with: selenium
type: Question
tagged with: javascript
has answer: http://stackoverflow.com/a/28241583
score: 15
accepted answer: http://stackoverflow.com/a/21123540
has title: Element after jquery.show and WebDriverException: unknown error: cannot focus element
upvote count: 15
answer count: 3
downvote count: 0
tagged with: jquery
favorite count: 0
has answer: http://stackoverflow.com/a/39205317
tagged with: selenium-webdriver
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21123540
possible better answer: http://stackoverflow.com/a/39205317
tagged with: java

http://stackoverflow.com/q/21157009
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21157264
has body: Idea: Computer A: at 03h00 pm generate to 2 primes are 5 and 7 Computer A: at 03h02 pm generate to 2 primes are 17 and 29 Computer B: at 03h00 pm generate to 2 primes are 5 and 7 Computer B: at 03h02 pm generate to 2 primes are 17 and 29 I built an RSA program, and now I want to develop my program by improving the confidentiality for RSA program. If I success, we will not have to exchange the public key for each other as normal. I know I have to build a new random function to put a seed number into that function and I know that if 2 computers have same seed number will generate same random number in same time ,but I don't know the relation between seed number, real time.
score: -1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31845827
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31845872
tagged with: java
tagged with: random-seed
has title: random seed to generate random number
upvote count: 0

http://stackoverflow.com/a/21096043
answers question: http://stackoverflow.com/q/21095642
downvote count: 0
type: Answer
has body: 1) triangular numbers The first (and probably most important) optimization you can do is in how you compute the triangular numbers. You can observe that the nth triangular number (let's call it t(n) ) is equal to n + t(n-1). So each time you compute a triangular number, you can just take the triangular number before it and add n. This would lead to the naive recursive function : private static long triangularNumber(int i) { if(i == 1) return 1; else return i+triangularNumber(i-1); } But this won't improve the performance much... to resolve this, I suggest you do some research on memoization and adapt the function I gave you (I won't give you the answer, this is an excellent exercise) Now, on a regular computer you should have the answer to the problem in a reasonable time. But it can be improved a little better 2) counting divisors Your function for counting divisors is wrong. What you should do is try to divide your number by successive natural numbers and see if the result is an natural integer. private static int getFactors(long triNum) { int divisors = 0; for(int i = 1; i &lt;= triNum; ++i) { if(triNum%i == 0) // triNum is a multiple of 1 &lt;=&gt; i is a divisor of triNum divisors++; } return divisors; } You can even improve this by counting only to the square root of trinum and adding two divisors each time. But there's a trick if you do this, I'll let you figure it out if you decide to try this.
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31734339

http://stackoverflow.com/a/21066930
has comment: http://stackoverflow.com/comment/31681060
has comment: http://stackoverflow.com/comment/31681138
upvote count: 1
has comment: http://stackoverflow.com/comment/31681947
has comment: http://stackoverflow.com/comment/31681411
score: 1
has comment: http://stackoverflow.com/comment/31681330
has comment: http://stackoverflow.com/comment/31682020
has comment: http://stackoverflow.com/comment/31681286
has body: Model attributes only exist during the life cycle of one HttpServletRequest. Consider reading my answer here. In your initForm method, you do the following map.addAttribute("command", command); this add an attribute named command to the model attributes. This attribute will eventually find its way into the HttpServletRequest attributes and be available to your JSP. In here &lt;form:form [...] modelAttribute="studentDetailsCommand" commandName="command"&gt; first of all, modelAttribute and commandName have the same purpose, ie. to find an attribute in the model. If you remove commandName you will get an Exception because there is no model attribute named studentDetailsCommand. Here your commandName's value is overwriting your modelAttribute's value. When the Servlet container is finished rendering your JSP, the rendered content is sent as the body of the HTTP response. At this point, the request has been handled and the HttpServletRequest and the model attributes are garbage collected. When you send your new request through AJAX, there is no longer any model attribute named studentDetailsCommand (there actually never was). Consider using Flash Attributes. Related: How to read flash attributes after redirection in Spring MVC 3.1? Spring RedirectAttributes: addAttribute vs addFlashAttribute Use of getFlashAttributes() in Spring&#39;s RedirectAttributes
has comment: http://stackoverflow.com/comment/31681695
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31681795
accepted answer of: http://stackoverflow.com/q/21066538
has comment: http://stackoverflow.com/comment/31680850
answers question: http://stackoverflow.com/q/21066538
has comment: http://stackoverflow.com/comment/31681890
type: Answer
has comment: http://stackoverflow.com/comment/31681114

http://stackoverflow.com/q/21058081
tagged with: doubly-linked-list
has body: I have made a custom linked list and node classes for school and I have decided to practice how to use it by making a text-twist like game In my linked list class, I have a traverse method which prints out the word and how long the word is into the console. The code I have so far is this: MyLinkedList.java package game; public class MyLinkedList { public int counter; public MyNode head; public MyNode tail; public MyLinkedList() { counter = 0; } public void InsertToHead(MyNode m) { if (counter == 0) { head = tail = m; } else { m.setNext(head); head.setPrev(m); head = m; } counter++; } public int size() { return counter; } public boolean isEmpty() { if (counter == 0) { return true; } else { return false; } } public MyNode retrieveWord(String s) { MyNode n = head; while (n.next != null) { if (s.equals(n.getWord())) { return n; } else { n = n.next; } } if (s.equals(tail.getWord())) { return tail; } return null; } public MyNode retrieveLength(int l) { MyNode n = head; while (n.next != null) { if (l == n.getLength()) { return n; } else { n = n.next; } } if (l == tail.getLength()) { return tail; } return null; } public void traverse() { MyNode n = head; if (head != null) { while (n.next != null) { System.out.println(n.getWord() + "\t" + n.getLength()); n = n.next; } System.out.println(tail.getWord() + "\t" + n.getLength()); } } } MyNode.java package game; public class MyNode { public String word; public int length; public MyNode next, previous; public MyNode() { word = null; length = 0; next = null; previous = null; } public MyNode(String w, int l) { word = w; length = l; next = null; previous = null; } public void setNext(MyNode n) { next = n; } public void setPrev(MyNode n) { previous = n; } public void toHead(MyNode n){ while(n.previous != null){ n.setPrev(n); } } public void setWord(String w){ word = w; } public String getWord(){ return word; } public void setLength(int l){ length = l; } public int getLength(){ return length; } public boolean hasNext(){ return next != …
has title: Custom linked list having unwanted elements
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21058924
type: Question
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/21058924

http://stackoverflow.com/q/21178755
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21280285
upvote count: 5
tagged with: java
possible better answer: http://stackoverflow.com/a/21280285
tagged with: android-alarms
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/21235359
downvote count: 0
favorite count: 0
has body: I have certain dates which once attained lose their relevance and new dates for these fields in the DB should be calculated, I know I can leverage the AlarmManager class for this, however I have a few concerns regarding this: 1) Note: Beginning with API 19 (KITKAT) alarm delivery is inexact: the OS will shift alarms in order to minimize wakeups and battery use. There are new APIs to support applications which need strict delivery guarantees; see setWindow(int, long, long, PendingIntent) and setExact(int, long, PendingIntent). Applications whose targetSdkVersion is earlier than API 19 will continue to see the previous behavior in which all alarms are delivered exactly when requested. So do I need to code for both cases separately or if I target kitkat, will that work for older versions too? Also as my code execution is time critical, say after 12AM in the midnight of some date my Data loses relevance, how to overcome shifting of alarms. 2)Registered alarms are retained while the device is asleep (and can optionally wake the device up if they go off during that time), but will be cleared if it is turned off and rebooted. 2.1) Set the RECEIVE_BOOT_COMPLETED permission in your application's manifest. This allows your app to receive the ACTION_BOOT_COMPLETED that is broadcast after the system finishes booting (this only works if the app has already been launched by the user at least once) 2.1.1) If I have set an alarm at 12, the service related to this alarm fires at 12, Now when I reboot the device, the time "at 12" has already passed, the alarm will be fired again immediately and the service will be called again? At reboot what mechanism do I need to implement in-order to stick to my code execution policy at certain time? How do I set the alarm if the user does not launch my app? The third thing is that if my app is uninstalled I want to clear all alarms set by my code, how do I listen to when the app is uninstalled? Also I want to know, my app is very time critical, t…
tagged with: cron
has comment: http://stackoverflow.com/comment/32117919
tagged with: android
has title: Schedule an event to be executed in future (Cron Job the Android way)
accepted answer: http://stackoverflow.com/a/21235359
has comment: http://stackoverflow.com/comment/32100419
has comment: http://stackoverflow.com/comment/32085070

http://stackoverflow.com/q/21035252
possible better answer: http://stackoverflow.com/a/21036782
has answer: http://stackoverflow.com/a/21035302
has answer: http://stackoverflow.com/a/21036782
tagged with: functional-programming
favorite count: 0
tagged with: scala
has body: I'm new to Scala. I want to read lines from a text file and split and make changes to each lines and output them. Here is what I got: val pre:String = " &lt;value enum=\"" val mid:String = "\" description=\"" val sur:String = "\"/&gt;" for(line&lt;-Source.fromFile("files/ChargeNames").getLines){ var array = line.split("\"") println(pre+array(1)+mid+array(3)+sur); } It works but in a Object-Oriented programming way rather than a Functional programming way. I want to get familiar with Scala so anyone who could change my codes in Functional programming way? Thx.
accepted answer: http://stackoverflow.com/a/21035302
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31630381
downvote count: 0
has title: Scala read file and split and modify each line

http://stackoverflow.com/a/21792739
answers question: http://stackoverflow.com/q/21140168
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: In addition to Chandra's answer, I experienced the same exception in Eclipse on Windows 7: C:/myfile.log // access denied... But it worked OK when I created a folder with permissions to my userid: C:/myLogs/myfile.log // it wasn't necessary to create the file I also noticed that the path must be specified with forward slashes.

http://stackoverflow.com/comment/31749935
comment on: http://stackoverflow.com/a/21103913
score: 0
type: Comment
type: AnswerComment
has text: That's fine, but it doesn't appear to be the OP's problem. Removed my downvote anyway.

http://stackoverflow.com/comment/31706489
comment on: http://stackoverflow.com/q/21080598
score: 0
type: Comment
type: QuestionComment
has text: It's done. You can see it

http://stackoverflow.com/a/21180963
answers question: http://stackoverflow.com/q/21180888
downvote count: 0
has body: Ctrl-Shift-O only organises the import statements at the top of the file. Your error is caused because you haven't declared fields or in-scope variables called latitude, longitude and context. Depending upon the type of class you are working with, you may already have a suitable Context value being passed to your constructor.
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/136749771
has text: Voting to close, as I don't actually see a question any where in there. What's the expected behavior?
comment on: http://stackoverflow.com/q/21135810
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31686412
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21069753
has text: @Reimeus constructor is method :)

http://stackoverflow.com/comment/31886951
has text: @venergiac: 32 bit machine
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21179634

http://stackoverflow.com/q/21156431
tagged with: java
tagged with: date
has comment: http://stackoverflow.com/comment/31845236
tagged with: oracle11g
type: Question
has body: I am currently trying to insert dates into my local Oracle database, the insert is written within a java JAR file which uses wildcards. The INSERT works if I send the dates as null however when I attempt to send a date I get the following error: ORA-01821: date format not recognized I have ran two SQL commands: SELECT PARAMETER, VALUE FROM v$nls_parameters; SELECT CURRENT_TIMESTAMP FROM DUAL; Which return this data: PARAMETER VALUE ---------------------------------------------------------------- ---------------------------------------------------------------- NLS_LANGUAGE ENGLISH NLS_TERRITORY UNITED KINGDOM NLS_CURRENCY £ NLS_ISO_CURRENCY UNITED KINGDOM NLS_NUMERIC_CHARACTERS ., NLS_CALENDAR GREGORIAN NLS_DATE_FORMAT DD-MON-RR NLS_DATE_LANGUAGE ENGLISH NLS_CHARACTERSET AL32UTF8 NLS_SORT BINARY NLS_TIME_FORMAT HH24.MI.SSXFF NLS_TIMESTAMP_FORMAT DD-MON-RR HH24.MI.SSXFF NLS_TIME_TZ_FORMAT HH24.MI.SSXFF TZR NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH24.MI.SSXFF TZR NLS_DUAL_CURRENCY € NLS_NCHAR_CHARACTERSET AL16UTF16 NLS_COMP BINARY NLS_LENGTH_SEMANTICS BYTE NLS_NCHAR_CONV_EXCP FALSE 19 rows selected CURRENT_TIMESTAMP ------------------------------------ 16-JAN-14 08.03.06.437000000 EUROPE/ LONDON After looking at the data above I attempted to amend my prepared statement to match the timestamps shown: TO_TIMESTAMP(?,'DD-MON-RR HH24.MI.SSXFF TZR') TO_TIMESTAMP(?,'DD-MON-RR HH24.MI.SSXFF') Where ? is the wildcard value that I am passing in using java i.e. interaction.getStartDate(); Does anyone know how to find the correct format or where I am going wrong? I have looked online for the last couple of days and am completely baffled.
answer count: 1
has comment: http://stackoverflow.com/comment/31845127
tagged with: wildcard
has comment: http://stackoverflow.com/comment/31845212
has title: Oracle Prepared Statement - ORA-01821: date format not recognized
accepted answer: http://stackoverflow.com/a/21157594
has comment: http://stackoverflow.com/comment/31844957
tagged with: sql
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31844918
favorite count: 0
has comment: http://stackoverflow.com/comment/31845152
has comment: http://stackoverflow.com/comment/31845297
upvote count: 1
has comment: http://stackoverflow.com/comment/31845308
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21157594

http://stackoverflow.com/comment/31598106
score: 1
comment on: http://stackoverflow.com/q/21021670
type: Comment
type: QuestionComment
has text: Counter question: what would you like to write, i.e. what would you consider precise enough and yet easy to read? Can you provide some pseudo code which would help us understand what you're aiming at?

http://stackoverflow.com/q/21065121
tagged with: openssh
answer count: 1
type: UnansweredQuestion
tagged with: servlets
tagged with: ssh
has answer: http://stackoverflow.com/a/21065380
type: Question
has title: Unable to perform SSH from a Servlet
has body: I am building a web service (Sevlets) which uses SSH to fetch informations from other remote servers. For the sake of simplicity I opted to use Apache commons exec library to do the ssh instead of using SSH Client implementions in Java like JSch. This implementation works fine in my developement environment but when I deploy it to the remote web server (A Red Hat Server with OpenSSH client) it fails with an error message. ssh_exchange_identification: Connection closed by remote host But when I ssh to the web server and restart the Apache Tomcat deamon, the SSH in my servlet code works until I terminate my SSH session with the web server and then fails with above message. PS: I would prefer to abstain from using Java SSH client implementations as much as possible, because the ssh set-up in my environment is not straight forward and it involves setting up tunnels. Such set-ups are already done using the ssh config file and hence I would like to use that existing set-up as much as possible.
tagged with: apache-commons
score: 0
tagged with: java

http://stackoverflow.com/comment/31701867
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21078512
has text: It'd call it just once, but would stay in a waiting state forever.
type: AnswerComment

http://stackoverflow.com/comment/31876333
type: Comment
comment on: http://stackoverflow.com/q/21173254
has text: Did you try to google and look at the second link? https://www.google.com/search?q=java+euclid+gcd&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a
score: 0
type: QuestionComment

http://stackoverflow.com/a/21085071
answers question: http://stackoverflow.com/q/21084838
has body: dear your question is unclear,do you hav a problem in getting randm charactr? simply put the characters in an array and generate random number between 0-25 and get the character placed at that randomly generated index. string s[]={a,b,c,d...,z}; int a = (int)(Math.random()*26); char x = s[a]; // you have random character in x
score: 0
type: Answer

http://stackoverflow.com/a/21175149
has body: As you say, Date1 is of the form MM/dd/yyyy... but you're trying to parse it with a format of yyyy-MM-dd HH:mm:ss. The pattern you parse to the SimpleDateFormat constructor has to match the format of the data itself. (What did you think you were specifying in the constructor?) Note that the code you've provided isn't doing and formatting at all - just parsing. You should also work out which time zone you're interested in, and which Locale. Personally I think it's clearer to specify both of those explicitly - even if you want the system default ones. (If you're doing any significant amount of date/time work, you should also consider using Joda Time, which is a much more pleasant date/time API. I'd also consider more useful exception handling, and following Java naming conventions...)
downvote count: 0
has comment: http://stackoverflow.com/comment/31879184
has comment: http://stackoverflow.com/comment/31879084
type: Answer
has comment: http://stackoverflow.com/comment/31879346
has comment: http://stackoverflow.com/comment/31899338
upvote count: 1
has comment: http://stackoverflow.com/comment/31879070
score: 1
has comment: http://stackoverflow.com/comment/31879547
answers question: http://stackoverflow.com/q/21175104
has comment: http://stackoverflow.com/comment/31886655
has comment: http://stackoverflow.com/comment/31900131

uml
tags question: http://stackoverflow.com/q/21122447
type: Tag
tag name: uml
tags question: http://stackoverflow.com/q/21022012

http://stackoverflow.com/a/21062125
score: 1
answers question: http://stackoverflow.com/q/21062007
upvote count: 1
type: Answer
has body: The object firstsheet does only exist in the scope of the constructor function. You have to declare it as a global field if you want to use it in other methods. Here is an example: public class Hotel { private Sheet firstsheet; // firstsheet is a global field // Constructor public Hotel() throws BiffException, IOException { FileInputStream configurationExcel=new FileInputStream("C://Users//Rashmi//Desktop//TravalPS_RegregrestionTest1.xls"); Workbook book = Workbook.getWorkbook(configurationExcel); firstsheet= book.getSheet(0); // firstsheet get's a value } // Some method public void test(){ Cell excelcell = firstsheet.getCell(2, 2); // firstsheet also exists in this scope now } }
downvote count: 0

http://stackoverflow.com/a/21158804
score: 6
downvote count: 0
type: Answer
upvote count: 6
has body: Idea behind it is don't let your CPU sleep, neither load it too much that it waste most of time in thread switching. Its helpful to check Tuning the pool size, In IBMs paper Idea behind is, it depends on the nature of task, if its all in-memory computation tasks you can use N+1 threads (N numbers of cores (included hyper threading)). Or we need to do the application profiling and find out waiting time (WT) , service time (ST) for a typical request and approximately N*(1+WT/ST) number of optimal threads we can have, considering 100% utilization of CPU.
answers question: http://stackoverflow.com/q/21158165

http://stackoverflow.com/q/21128426
has comment: http://stackoverflow.com/comment/31794389
score: 2
tagged with: performance
has title: Fast way for making the sum of an integer and each element of an array
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21128760
downvote count: 0
has comment: http://stackoverflow.com/comment/31801427
has body: I would like to optimize the below code that is very simple, Do you have any idea? public void addValueToTab(int _valueToAdd){ for(int k=0; k &lt; myArray.length; k++){ myArray[k]+= _valueToAdd; } } myArray is an int[] the length of myArray can vary between 50 to 1000. Thanks a lot for your help,
upvote count: 2
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31794392
has comment: http://stackoverflow.com/comment/31812496

http://stackoverflow.com/comment/38609560
type: Comment
comment on: http://stackoverflow.com/a/21051506
has text: We ran into the same situation today. This is a nice work-around by I am still curious what causes the sourceCompatibility setting to be overwritten.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31851024
type: AnswerComment
comment on: http://stackoverflow.com/a/21158187
has text: in struts 1 how can I forward json object instead of jsp. I'm new to java so kindly help me please
type: Comment
score: 0

http://stackoverflow.com/comment/31745828
comment on: http://stackoverflow.com/q/21101593
score: 0
type: Comment
type: QuestionComment
has text: I am more interested in actually seeing the surrounding code to verify that there are no exceptions that are being squashed, etc.

http://stackoverflow.com/comment/31696675
score: 0
type: Comment
type: QuestionComment
has text: @MarkoTopolnik How should I do it then?
comment on: http://stackoverflow.com/q/21075537

http://stackoverflow.com/comment/31649357
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21048857
has text: Exactly what I was looking for, thank you. I need to brush up on my generics it seems.
score: 0

http://stackoverflow.com/comment/31633738
type: AnswerComment
has text: Then ,it will only works on my PC? Because the file path is depend on the PC.
type: Comment
comment on: http://stackoverflow.com/a/21041611
score: 0

http://stackoverflow.com/comment/100957690
type: Comment
comment on: http://stackoverflow.com/q/21082325
has text: FYI, the terribly troublesome 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).
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31618827
has text: Can't use Java8 must be done in Java7, forgot to specify, sorry! Thanks anyway.
comment on: http://stackoverflow.com/a/21032598
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21038028
downvote count: 0
accepted answer: http://stackoverflow.com/a/21045065
favorite count: 0
tagged with: model
has comment: http://stackoverflow.com/comment/31630671
tagged with: jtable
linked to: http://stackoverflow.com/q/10606521
has comment: http://stackoverflow.com/comment/31634669
has comment: http://stackoverflow.com/comment/31629392
has body: I have a JTable called transactionList, each row represents a Transaction where the first column holds the actual Transaction object and each subsequent column displays some data about the Transaction. I don't want the Transaction object appearing to the user so I remove it from the ColumnModel: TableColumnModel cm = transactionList.getColumnModel(); cm.removeColumn(cm.getColumn(0)); transactionList.setColumnModel(cm); This works great and I can then retrieve the selected Transaction using: (Transaction) transactionList.getModel().getValueAt(transactionList.getSelectedRow(), 0)) The problem begins when the user sorts a column in the table, then the selected row does not match up correctly. I solve this by changing the above line so that we get the selected row from the table directly and not from the model: (Transaction) transactionList.getValueAt(transactionList.getSelectedRow(), 0)); But now the 0 column is not my hidden Transaction object but simply its first field. I will try to explain in another way as well. Without allowing sorting of the JTable columns, both examples works: 1) Display Transaction object in first column (don't remove from ColumnModel) Can retrieve Transaction object with: transactionList.getValueAt(transactionList.getSelectedRow(), 0)); 2) Display Transaction object in first column (remove from ColumnModel) Can retrieve Transaction object with: transactionList.getModel().getValueAt(transactionList.getSelectedRow(), 0)) If I now allow sorting of the columns, #1 still works. However, method #2 now passes the JTable.getSelectedRow() to TableModel.getValueAt(). These indexes are no longer equal though, the problem is that the JTable and ColumnModel don't contain the Transaction object (only the TableModel does). transactionList.getColumnCount(); //return 5 transactionList.getColumnModel().getColumnCount(); //return 5 transactionList.getModel().getColumnCount(); //returns 6 A possible solution I see is to sort the TableModel along with the JTable …
has comment: http://stackoverflow.com/comment/31639255
has comment: http://stackoverflow.com/comment/31628970
score: 2
tagged with: tablemodel
upvote count: 2
has comment: http://stackoverflow.com/comment/31632452
has comment: http://stackoverflow.com/comment/31637454
tagged with: swing
has title: Accessing hidden JTable model columns after user sort a column
has comment: http://stackoverflow.com/comment/31627847
has answer: http://stackoverflow.com/a/21045065
type: Question
has comment: http://stackoverflow.com/comment/31635123
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21038099
tagged with: java
has answer: http://stackoverflow.com/a/21038099
has comment: http://stackoverflow.com/comment/31632503
has comment: http://stackoverflow.com/comment/31629153
linked to: http://stackoverflow.com/q/6175139
has comment: http://stackoverflow.com/comment/31636478
has comment: http://stackoverflow.com/comment/31630311
has comment: http://stackoverflow.com/comment/31628784
answer count: 2
linked to: http://stackoverflow.com/q/9852220
linked to: http://stackoverflow.com/q/7369814

http://stackoverflow.com/comment/31633935
score: 1
comment on: http://stackoverflow.com/a/21041491
type: AnswerComment
has text: @membersound Yes, you can use `@Transactional`. Since spring uses java proxies per default you must create an interface that the db class implements. Then you can define your db impl in the spring context xml and enable springs annotation based transaction management. Spring will then create a transaction aware proxy if you request the db access object from the application context.
type: Comment

http://stackoverflow.com/comment/31847090
has text: I have been recently in the same problem. Marko is right about 'being careful with the APIs', if your developers have any bad practice (using sun.* or com.sun.*, etc. packages included in the JDK) you can have a problem once in production. Have a dry run compiling and running your app with an equivalent IBM JDK in your development machine just to be on the safe side
comment on: http://stackoverflow.com/a/21157774
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/31874699
score: 0
type: Comment
type: QuestionComment
has text: I am using the default implemntation to persist the data. do i have to download that jar too?
comment on: http://stackoverflow.com/q/21172844

http://stackoverflow.com/q/21044882
has answer: http://stackoverflow.com/a/21045013
has comment: http://stackoverflow.com/comment/31639612
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/21046565
score: 0
tagged with: linux
answer count: 3
tagged with: windows
has title: Run .sh (from linux) scripts on windows using eclipse
type: UnansweredQuestion
has body: I have a .sh scripts in Linux. I want to create a form in Java (eclipse) on Windows and execute those .sh files. Is there any simple way to do this?
tagged with: sh
has answer: http://stackoverflow.com/a/21045042
tagged with: java

http://stackoverflow.com/comment/31788705
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21124302
has text: Thank you for your answer. Using a policy file, which needs to be present on every client's PC is a bad idea. As I cannot enter a long text with line breaks here, I'll update the question with details on what I'd like to achieve.
type: AnswerComment

http://stackoverflow.com/a/21072314
has comment: http://stackoverflow.com/comment/31690813
has body: Instead of getting three different inputs, just input a single line of string, parse the string accordingly and type cast them to the necessary types. This way you can determine from the string is a factorial (1 variable) or any other operation on it is necessary. Using scanner. boolean binary = true; Scanner input = new Scanner(System.in); double x = input.nextInt(); String z = input.next(); //check if z is a unary operator ie. if(z=='!') binary = true; if(binary) double y = input.nextInt();
upvote count: 4
has comment: http://stackoverflow.com/comment/31690944
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/31690781
answers question: http://stackoverflow.com/q/21072221
type: Answer
has comment: http://stackoverflow.com/comment/31690744

http://stackoverflow.com/q/21083425
type: AnsweredQuestion
tagged with: java
has title: Get actual machine's ip address
tagged with: ip
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31711919
has body: I need to get the actual (not the gateway) ip address of my computer but all the solutions I have tried are returning the gateway IP address. For instance, all suggestions from this link Get the client IP address using PHP return the gateway address. Is there a way I can get the actual ip address (public) of my computer - either in php or java?
accepted answer: http://stackoverflow.com/a/21083590
possible better answer: http://stackoverflow.com/a/21083517
score: 0
has answer: http://stackoverflow.com/a/21083517
has comment: http://stackoverflow.com/comment/31711661
tagged with: gateway
has comment: http://stackoverflow.com/comment/31711599
linked to: http://stackoverflow.com/q/15699101
has comment: http://stackoverflow.com/comment/31711694
has comment: http://stackoverflow.com/comment/31711617
has comment: http://stackoverflow.com/comment/31711621
tagged with: php
has comment: http://stackoverflow.com/comment/31711720
has answer: http://stackoverflow.com/a/21083590
has comment: http://stackoverflow.com/comment/31711783

http://stackoverflow.com/q/21107998
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has body: public Matcher appendReplacement(StringBuffer sb, String replacement) Here why appenedReplacement() method should use Buffer object and why we don't use input string instead off it?
type: Question
has answer: http://stackoverflow.com/a/21108067
has title: use of buffer object at appendReplaccement () method of Matcher class
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21108067
possible better answer: http://stackoverflow.com/a/21108073
has answer: http://stackoverflow.com/a/21108073
tagged with: regex

broadleaf-commerce
tags question: http://stackoverflow.com/q/21059724
tag name: broadleaf-commerce
type: Tag

access-rights
tag name: access-rights
tags question: http://stackoverflow.com/q/21052384
type: Tag

http://stackoverflow.com/comment/68047241
type: AnswerComment
has text: I am getting "java.lang.ClassCastException: org.apache.cxf.transport.http.AbstractHTTPDestination$WrappedOutputStream cannot be cast to org.apache.cxf.io.CachedOutputStream" . Not sure why. Can you help ?
type: Comment
comment on: http://stackoverflow.com/a/21116852
score: 0

http://stackoverflow.com/a/21128583
has body: You could refer to this and get the spinner drawables according to your wish. Hope that helps
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21128263
upvote count: 2

http://stackoverflow.com/q/21081780
has body: i'm currently learning spring ioc/struts2, and i keep getting a NoClassDefFoundError. the correct jars are in my pom file, so i am befuddled. following this advice, i added the problematic jar to my bootstrap entries, and it got rid of that particular NoClassDefFoundError, but i was met with another one. i keep adding jars to my bootstrap entries, and that seems to fix each problem that comes up, but i want to make sure i'm actually solving my problem and not just putting a bandaid on it. here are the current bootstrap entries: below are my pom and my most recent stacktrace. 4.0.0 final-project1.3.1 final-project1.3.1 0.0.1-SNAPSHOT final-project1.3.1 final-project1.3.1 org.hibernate hibernate-core 4.3.0.Final antlr antlr 2.7.7 dom4j dom4j 1.6.1 org.hibernate.common hibernate-commons-annotations 4.0.4.Final log4j log4j 1.2.17 org.hibernate.javax.persistence hibernate-jpa-2.1-api 1.0.0.Final org.javassist javassist 3.18.1-GA junit junit 4.11 org.hamcrest hamcrest-core 1.3 org.jboss.logging jboss-logging 3.1.4.GA org.slf4j slf4j-api 1.7.5 org.jboss.logmanager jboss-logmanager 1.5.1.Final org.hibernate hibernate-entitymanager 4.3.0.Final org.jboss.logging jboss-logging-annotations 1.2.0.Beta1 org.jboss.spec.javax.transaction jboss-transaction-api_1.2_spec 1.0.0.Final org.jboss jandex 1.1.0.Final org.springframework spring-aop 3.2.3.RELEASE org.springframework spring-beans 3.2.3.RELEASE org.springframework spring-context 3.2.3.RELEASE org.springframework spring-core 3.2.3.RELEASE org.springframework spring-expression 3.2.3.RELEASE org.springframework spring-test 3.2.3.RELEASE org.springframework spring-web 3.2.3.RELEASE org.apache.struts struts2-core 2.3.14.3 org.apache.struts struts2-junit-plugin 2.3.14.3 org.apache.struts struts2-spring-plugin 2.3.14.3 org.apache.struts struts2-tiles-plugin 2.3.14.3 org.apache.tiles tiles-api 2.0.6 org.apache.tiles tiles-core 2.0.6 org.apache.tiles tiles-jsp 2.0.6 commons-beanutils commons-beanutils 1.8.3 commons-chain commons-chain 1…
has comment: http://stackoverflow.com/comment/31708862
score: 2
has comment: http://stackoverflow.com/comment/31708502
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31708614
linked to: http://stackoverflow.com/q/15921641
has comment: http://stackoverflow.com/comment/31709065
upvote count: 3
tagged with: maven
has comment: http://stackoverflow.com/comment/31709075
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21089019
has comment: http://stackoverflow.com/comment/31708723
tagged with: java
possible better answer: http://stackoverflow.com/a/21089092
has comment: http://stackoverflow.com/comment/31708579
has answer: http://stackoverflow.com/a/21089092
has comment: http://stackoverflow.com/comment/31708753
answer count: 2
has comment: http://stackoverflow.com/comment/31708444
has comment: http://stackoverflow.com/comment/31708854
has title: NoClassDefFoundError from tomcat. is there something wrong with my pom?
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/21089019
favorite count: 0
tagged with: spring

http://stackoverflow.com/a/21072991
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31711150
downvote count: 0
has comment: http://stackoverflow.com/comment/31691906
type: Answer
has body: You imported the wrong Form class. You need to import play.data.Form as shown in the Javadoc. The class play.api.data.Form is part of the Scala version of Play as shown in the Scaladoc.
upvote count: 6
answers question: http://stackoverflow.com/q/21072889
score: 6
accepted answer of: http://stackoverflow.com/q/21072889
has comment: http://stackoverflow.com/comment/31691828
has comment: http://stackoverflow.com/comment/31712366

http://stackoverflow.com/comment/32048715
type: QuestionComment
has text: Questions asking for code must demonstrate a minimal effort in solving the actual problem, including the attempted code and the encountered issues
score: 0
comment on: http://stackoverflow.com/q/21070272
type: Comment

http://stackoverflow.com/comment/31707879
type: Comment
comment on: http://stackoverflow.com/a/21081417
has text: Thanks for this. I was going to include a non-synchronized method in MyClass and cite its accessibility but I did not want to confuse the issue. Yet, as you point out, there will still be non-synchronized methods like toString(), inherited from class Object that that may be called regardless of monitor.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31759239
score: 0
type: Comment
type: QuestionComment
has text: Though, as I just mentioned below, I am going to dynamically create the checkboxes on the page eventually. As currently only the updating is dynamic. So the converting over to dynamic checkbox creation could put a wrinkle into the accepted approach since I won't be able to specify hard coded values. We shall see.
comment on: http://stackoverflow.com/q/21108969

http://stackoverflow.com/q/21021380
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/21021639
score: 3
possible better answer: http://stackoverflow.com/a/21021558
has answer: http://stackoverflow.com/a/21021558
upvote count: 3
answer count: 2
has title: Java: HDFS copy directory
tagged with: java
has answer: http://stackoverflow.com/a/21021639
tagged with: hadoop
type: AnsweredQuestion
downvote count: 0
tagged with: hdfs
has body: Is there a simple way to copy a HDFS directory to another directory in Java? For example, how would I move the contents of /user/abc/pudding to /user/def/pudding? I'm looking for some HDFS equivalent to UNIX's cp command which I can do programmatically with Java. Note: I'm aware of FileSystem but it only seems to allow me to copy from my local machine to HDFS?

http://stackoverflow.com/a/21162942
downvote count: 0
has comment: http://stackoverflow.com/comment/31856285
type: Answer
has comment: http://stackoverflow.com/comment/31856540
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/31918873
answers question: http://stackoverflow.com/q/21162609
accepted answer of: http://stackoverflow.com/q/21162609
has body: They will both have their own Class instance for ClassZ. Keeping such loading separate is important in various technologies built on Java, such as webservers or Java EE environments that may need to maintain separate contexts for deployed applications. You are also correct in your assumption that if the parent classloader for ClassX and ClassY (assuming it is the same) has loaded ClassZ, then that one will be used by both its children. At least, that's the default approach. A classloader first delegates lookup to its parent and if that one can't find it, it will try itself. Some custom loaders may override this behaviour, though. Complex classloader hierarchies can emerge. While this does "waste" some room in the permgen, trying to share resources is often more trouble than it's worth, and will cause compatibility issues or classloader leaks in some frameworks.
type: AcceptedAnswer

http://stackoverflow.com/comment/31630918
type: QuestionComment
comment on: http://stackoverflow.com/q/21024642
has text: doin't you have a controller or vm? what version of zk is it? (mine answer certainly working on 5.0 and higher, for before I have to check)
score: 0
type: Comment

database
tags question: http://stackoverflow.com/q/21120567
tags question: http://stackoverflow.com/q/21076905
tags question: http://stackoverflow.com/q/21094915
tags question: http://stackoverflow.com/q/21141450
tags question: http://stackoverflow.com/q/21146454
tags question: http://stackoverflow.com/q/21150962
tags question: http://stackoverflow.com/q/21139873
tags question: http://stackoverflow.com/q/21080255
tags question: http://stackoverflow.com/q/21020562
tags question: http://stackoverflow.com/q/21063652
type: Tag
tags question: http://stackoverflow.com/q/21142283
tags question: http://stackoverflow.com/q/21161063
tags question: http://stackoverflow.com/q/21084508
tags question: http://stackoverflow.com/q/21125806
tags question: http://stackoverflow.com/q/21170567
tags question: http://stackoverflow.com/q/21087507
tags question: http://stackoverflow.com/q/21167590
tags question: http://stackoverflow.com/q/21025393
tag name: database
tags question: http://stackoverflow.com/q/21068320
tags question: http://stackoverflow.com/q/21043079
tags question: http://stackoverflow.com/q/21049375
tags question: http://stackoverflow.com/q/21019309
tags question: http://stackoverflow.com/q/21096570
tags question: http://stackoverflow.com/q/21181093
tags question: http://stackoverflow.com/q/21026498
tags question: http://stackoverflow.com/q/21167859
tags question: http://stackoverflow.com/q/21109700
tags question: http://stackoverflow.com/q/21045191
tags question: http://stackoverflow.com/q/21025198
tags question: http://stackoverflow.com/q/21065319
tags question: http://stackoverflow.com/q/21048458
tags question: http://stackoverflow.com/q/21023318
tags question: http://stackoverflow.com/q/21023625
tags question: http://stackoverflow.com/q/21081273
tags question: http://stackoverflow.com/q/21101352
tags question: http://stackoverflow.com/q/21174683
tags question: http://stackoverflow.com/q/21083856
tags question: http://stackoverflow.com/q/21040919
tags question: http://stackoverflow.com/q/21025501
tags question: http://stackoverflow.com/q/21084578
tags question: http://stackoverflow.com/q/21111533
tags question: http://stackoverflow.com/q/21082850
tags question: http://stackoverflow.com/q/21121437

http://stackoverflow.com/q/21113979
has answer: http://stackoverflow.com/a/27156869
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/22008814
tagged with: java
tagged with: hibernate
type: Question
upvote count: 4
answer count: 2
linked to: http://stackoverflow.com/q/17911308
downvote count: 0
score: 4
favorite count: 0
has body: public class HibernateSession { private static final SessionFactory sessionFactory = buildSessionFactory(); private static StandardServiceRegistry serviceRegistry; private static SessionFactory buildSessionFactory() { try { Configuration configuration = new Configuration(); configuration.configure("hibernate.cfg.xml"); StandardServiceRegistryBuilder serviceRegistryBuilder = new StandardServiceRegistryBuilder(); serviceRegistry = serviceRegistryBuilder.build(); SessionFactory sessionFactory = configuration.buildSessionFactory(serviceRegistry); return sessionFactory; } catch (Throwable ex) { System.err.println("Initial SessionFactory creation failed!" + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } } I am using hibernate 4.3. I am getting an error message "Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set". Something is wrong with StandardServiceRegistryBuilder. It's preferred as ServiceRegistryBuilder is deprecated. Please provide me solution to this problem. My hibernate.cfg.xml file looks like this - <?xml version="1.0" encoding="UTF-8"?> com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/company_db root root 1 org.hibernate.dialect.MySQLDialect org.hibernate.cache.internal.NoCacheProvider thread true <mapping resource="com/twopiradian/Employee.hbm.xml" /> </session-factory>
has title: StandardServiceRegistryBuilder not working

http://stackoverflow.com/a/21132478
has body: I think the error is that you're providing a customized class object to the setSingleChoiceItems method. The first parameter has to be a a CharSequence[], a ListAdapter or a Cursor. If you're not intended to put one of them, you'll have to extend the Dialog class an implement your own setSingleChoiceItems method. ---- EDIT ---- In your case, I'd recommend extending the ArrayAdapter class, as you have some customized structures to show (in your case, a CheckBox). To help you do that, you may see my answer to a similar question and also a little basic explaination on how to extend the ArrayAdapter class, here. Hope this helps you!
score: 0
has comment: http://stackoverflow.com/comment/32103468
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31976082
has comment: http://stackoverflow.com/comment/31974923
type: Answer
has comment: http://stackoverflow.com/comment/32098635
accepted answer of: http://stackoverflow.com/q/21132228
has comment: http://stackoverflow.com/comment/31836455
answers question: http://stackoverflow.com/q/21132228

http://stackoverflow.com/a/21111198
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21110677
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21110677
has body: What do you mean by "stops working". Any exceptions in the logs? With Neo4j 2.0 you have to do wrap read operations within transactions. Like this: @GET @Path("/common/{acc1}/{acc2}") public String getCommon(@PathParam("acc1") String acc1, @PathParam("acc2") String acc2, @Context GraphDatabaseService db) throws IOException { try (Transaction tx = db.beginTx()) { String result = db.index().nodeIndexNames().toString(); tx.success(); } }
upvote count: 1

http://stackoverflow.com/q/21175823
answer count: 1
tagged with: jax-rs
has answer: http://stackoverflow.com/a/21193392
has title: How to read input XML for GET request using Jersey (REST)?
tagged with: web-services
type: AnsweredQuestion
has body: want to read the input xml for get method using jax-rs, I know this is weird, but this is my requirement, I want to show user 400(bad request) if a user sends a body for REST GET method. So to throw a bad request if user sends a body, I need to first read the body. Extracts from code written: @GET @Path("{ids}") @Consumes({ MediaType.APPLICATION_XML, MediaType.TEXT_XML, "multipart/form-data", "application/x-www-form-urlencoded" }) @Produces({ MediaType.APPLICATION_XML, MediaType.TEXT_XML }) public Response read(InputStream inputStream, @PathParam("ids") String Ids, @Context HttpHeaders headers, @Context HttpServletRequest httpServletRequest, @Context HttpServletResponse httpServletResponse, @Context UriInfo uriInfo) {.........//Code here So I try to read inputStream like : //Some Code here try { BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8")); while ((line = reader.readLine()) != null) sb.append(line).append("\n"); } catch (Exception e) { //exception handling } //Some code here Whether the request contains, body or not, it is always returning blank to me after reading inputStream. SO my question is how can I check if an xml body is sent in GET request ?
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21193392
tagged with: jersey
score: 0
tagged with: rest

http://stackoverflow.com/a/21147728
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21147703
has body: EditText display = (EditText) findViewById(R.id.textViewResults); or TextView display = (TextView) findViewById(R.id.textViewResults); You need to either change the display to EditText, or cast it as TextView
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31765322
score: 0
type: AnswerComment
type: Comment
has text: So, did this solve the problem for you? Are you till thinking about it?
comment on: http://stackoverflow.com/a/21110401

http://stackoverflow.com/comment/31826720
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21146155
has text: It's such a common scenario (I guess), isn't there a recommended approach ... ?

http://stackoverflow.com/q/21021334
score: 0
has comment: http://stackoverflow.com/comment/31597533
tagged with: android
has comment: http://stackoverflow.com/comment/31597358
has comment: http://stackoverflow.com/comment/31597244
has comment: http://stackoverflow.com/comment/31597901
type: AnsweredQuestion
tagged with: java
has body: Is it possible to populate a spinner with data from a MySQL database without using PHP? I've searched a lot on this matter and every example I can find includes a solution with PHP and most often JSON.
tagged with: mysql
has comment: http://stackoverflow.com/comment/31597174
type: Question
has comment: http://stackoverflow.com/comment/31597212
has comment: http://stackoverflow.com/comment/31597445
has answer: http://stackoverflow.com/a/21021899
accepted answer: http://stackoverflow.com/a/21021899
answer count: 1
has title: Populate spinner from db only with Java?

http://stackoverflow.com/a/21159887
type: Answer
has body: You are starting a new activity and just finishing current activity, add necessary code to finish the activity which you starts from onBackPressed.
answers question: http://stackoverflow.com/q/21159634
score: 0

http://stackoverflow.com/comment/44607068
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21102543
type: Comment
has text: Even though it is a year later, but it seems this boolean default value is not documented anywhere, and I learnt it the hard way. The (default) value of a boolean in a thrift struct is 0 or 1, instead of false or true. So in the thrift it should be "bool someAdvancedFeature = 0"

http://stackoverflow.com/q/21163355
possible better answer: http://stackoverflow.com/a/32840023
answer count: 2
has comment: http://stackoverflow.com/comment/31857170
has answer: http://stackoverflow.com/a/32840023
upvote count: 7
has comment: http://stackoverflow.com/comment/31857680
has body: I've a little experience in Spring. And I wondering about the amount of callbacks in Spring Context/Bean Lifecycle. I've never used them, and can imaging situations in which the most of them are needed. My question is: can you provide for each callback at least one example of usage? Means situations when you need that callback. Conext callbacks: Bean callbacks: P.S.: It is clear for me when majority of callbacks are calling, or what one or another implementation of ApplicationContext was written for. But I can't figure out why someone may want to profit from that callback\implementation. For example: AbstractRefreshableApplicationContext is using to change bean configurations on fly. But Why? In which situation I may want to change bean's configuration on fly? afterPropertiesSet callback, obviously is invoked after all bean's properties are setted :) But why I should know about that, and when I should (may want) use it?
favorite count: 0
has comment: http://stackoverflow.com/comment/31858316
tagged with: spring
has comment: http://stackoverflow.com/comment/31857106
has comment: http://stackoverflow.com/comment/31856948
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/243385
downvote count: 0
has comment: http://stackoverflow.com/comment/31856980
has title: Spring Context and Bean Lifecycle callbacks: practical examples of usage
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/31856847
type: Question
has answer: http://stackoverflow.com/a/21165446
accepted answer: http://stackoverflow.com/a/21165446

http://stackoverflow.com/comment/31619712
has text: `getDamage()` is a bit misleading in that specific case ;) I'd call it `dealDamage()`
type: AnswerComment
comment on: http://stackoverflow.com/a/21033148
type: Comment
score: 1

http://stackoverflow.com/q/21122838
has comment: http://stackoverflow.com/comment/31783882
tagged with: eclipse
type: Question
tagged with: compilation
has comment: http://stackoverflow.com/comment/31783875
score: -1
possible better answer: http://stackoverflow.com/a/21122909
tagged with: class
answer count: 2
downvote count: 1
accepted answer: http://stackoverflow.com/a/21122958
favorite count: 0
tagged with: netbeans
has comment: http://stackoverflow.com/comment/31783835
has body: I better explain the situation from the start. I wanted to change the resolution for a .jar file, so I decompiled it with Java Decompiler, then I went to Notepad++ and made a small edit, in 2 lines for a .java file: paramGraphics.setClip(0, 0, 176, 208); to this: paramGraphics.setClip(0, 0, 320, 240); And: paramGraphics.setClip(0, 0, 176, 208); to this: paramGraphics.setClip(0, 0, 320, 240); Then saved. After that, I wanted to compile that file to a class. I tried with javac command, didn't work and showed like 100 errors. It didn't compile. Ten used NetBeans. Same results, it didn't compile. This is the compiler output in NetBeans: ant -f "C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4" -Dnb.internal.action.name=rebuild clean jar init: deps-clean: Created dir: C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\build Updating property file: C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\build\built-clean.properties Deleting directory C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\build clean: init: deps-jar: Created dir: C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\build Updating property file: C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\build\built-jar.properties Created dir: C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\build\classes Created dir: C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\build\empty Created dir: C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\build\generated-sources\ap-source-output Compiling 1 source file to C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\build\classes C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:4: error: cannot find symbol public Image jdField_int; symbol: class Image location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:18: error: cannot find symbol public a(InputSt…
has title: java - how to compile a java file with Eclipse or NetBeans without errors?
has answer: http://stackoverflow.com/a/21122958
has answer: http://stackoverflow.com/a/21122909
has comment: http://stackoverflow.com/comment/31785084
type: AnsweredQuestion
upvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/7598623

http://stackoverflow.com/comment/31887927
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21179642
has text: See also [this answer](http://stackoverflow.com/questions/21168119/gradient-background-in-a-jframe/21171391#21171391) for an MCVE much like you are trying to achieve (with nice screen-shots).
score: 0

http://stackoverflow.com/comment/31692927
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21073437
has text: @neoprez Nothing happens when I press browse and netbeans just says the program is running.

http://stackoverflow.com/q/21073059
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21083868
tagged with: button
type: Question
tagged with: android
has title: Button layout_alignParentRight does not work on the first loop?
has body: I add dynamically viewflipper and on each view I add multiple views one of which is a RelativeLayer containg two buttons - one to go on the left on to the right of the layer. it works for all loops , but not for the first, where both buttons stay one atop another on the left. Anyone with helpful advice appreciated. LayoutInflater inflater = LayoutInflater.from(this); ViewGroup parent = (ViewGroup) findViewById(R.id.slider_holder); for (int i = 0; i < temp.length; i++) { ViewGroup np = (ViewGroup) findViewById(R.id.nexpre); LinearLayout l=(LinearLayout) inflater.inflate(R.layout.flipper_slides, parent, false); RelativeLayout next_prev =(RelativeLayout) inflater.inflate(R.layout.next_prev, l, false); for (int k = 0; k< temp1.length; k++) { ViewGroup nested_parent = (ViewGroup) findViewById(R.id.nested_slider_holder); LinearLayout nl=(LinearLayout) inflater.inflate(R.layout.nested_flipper_slides, nested_parent, false); TextView temp_tv1 =(TextView) inflater.inflate(R.layout.nested_flipper_tv, nl, false); temp_tv1.setText(temp[i]+" "+temp1[k]); nl.addView(temp_tv1); ff.addView(nl); } next_prev.addView(nested_prev); next_prev.addView(nested_next); l.addView(ff); l.addView(next_prev); f.addView(l); } This is the next_prev.xml <?xml version="1.0" encoding="utf-8"?> Here is the nested_prev.xml <?xml version="1.0" encoding="utf-8"?> And this is the nested_next.xml <?xml version="1.0" encoding="utf-8"?>
score: 0
tagged with: java

http://stackoverflow.com/q/21045160
answer count: 1
tagged with: grails
tagged with: stripe-payments
favorite count: 0
has answer: http://stackoverflow.com/a/21084998
upvote count: 2
has body: I have implemented a webhook url in the stripe account. I am getting an notification in the webhook url but not getting any event. It means I am getting an empty notification in the webhook url. Fig shows Stripe account test result of webhook url and webhook url code def stripeEventHandler(){ println("=========Stripe Request===============") println("${params}") println("========================") render view:'index' } And server logs 2014-01-10T12:58:17.799473+00:00 app[web.1]: =========Stripe Request=============== 2014-01-10T12:58:17.799749+00:00 app[web.1]: [action:stripeEventHandler, controller:home] 2014-01-10T12:58:17.799941+00:00 app[web.1]: ======================== Please Help Thank
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21084998
has title: I am not getting any event in webhook url using stripe
type: Question
downvote count: 0

http://stackoverflow.com/comment/31745333
comment on: http://stackoverflow.com/q/21101482
has text: could you post your Logcat
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31600186
type: AnswerComment
has text: I confess, I'm stumped; it looks like you're doing the right thing, and the answer from @peeskillet, below, looks good to me. Is it possible there's something quirky about how you have defined your classpath? Can you update your question [not in a comment, but in the question above,] to include the class path you are using when executing the program? That might be the missing link.
comment on: http://stackoverflow.com/a/21022343
type: Comment
score: 1

http://stackoverflow.com/a/21205262
answers question: http://stackoverflow.com/q/21155061
score: 0
type: Answer
has body: Please check your google wallet settings. http://productforums.google.com/forum/#!topic/wallet/hJNGInC9m3I%5B1-25-true%5D

http://stackoverflow.com/comment/31848621
has text: @Sree - Updated the code to get all the 2nd values in each element
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21158536
type: AnswerComment

http://stackoverflow.com/comment/31626279
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21036724
has text: it is not a Jframe, it is only a Frame

http://stackoverflow.com/comment/31600003
comment on: http://stackoverflow.com/a/21022518
type: Comment
has text: I guess you're right - I would just make it clear that `Animal` doesn't necessarily need abstract methods or any methods at all. That way the relevance to the question is clear.
score: 0
type: AnswerComment

http://stackoverflow.com/a/21034311
has comment: http://stackoverflow.com/comment/31636300
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21029071
answers question: http://stackoverflow.com/q/21029071
type: Answer
has body: Currently all CDI providers use proxies (it isn't required by the spec, but that's how all three impls have been done) for injecting any non pseudo-scoped objects. If Outer was @DependantScoped I'm pretty sure it would work the way you want it to. The proxies created are naturally subclasses of your classes, so calling a private method on an injected object isn't going to work. Honestly I'm surprised it doesn't blow up.
downvote count: 0

http://stackoverflow.com/comment/31672466
type: Comment
comment on: http://stackoverflow.com/q/21047100
type: QuestionComment
has text: @EricPostpischil - No, the rounding error in a single calculation would be essentially one binary bit. Two decimal places allows for a "normal" situation with several computations (and no "problematic" computations such as subtracting two very similar numbers).
score: 0

http://stackoverflow.com/comment/31600198
type: QuestionComment
type: Comment
has text: @Bart - In the other part of the program which was replaced meanwhile Sets were used.
comment on: http://stackoverflow.com/q/21022609
score: 0

http://stackoverflow.com/q/21040198
possible better answer: http://stackoverflow.com/a/21040631
tagged with: bean-validation
has answer: http://stackoverflow.com/a/75968674
has title: How to ensure mandatory parameters are passed into a Spring MVC controller method?
score: 0
answer count: 3
linked to: http://stackoverflow.com/q/8372957
has answer: http://stackoverflow.com/a/21040382
accepted answer: http://stackoverflow.com/a/21040382
has answer: http://stackoverflow.com/a/21040631
has body: Given a Spring-MVC controller method: @RequestMapping(value = "/method") public void method(@RequestParam int param1, @RequestParam int param2) { /*...*/ } If parameters are missing in the request URL, an error is reported, e.g: JBWEB000068: message Required int parameter 'param1' is not present I need to move the parameters into a single model class yet keep exactly the same GET request URL. So have modified method's parameter to MyModel model, which contains param1 and param2. This works if @RequestParam is omitted but the snag is no error is reported if parameters are missing. If, on the other hand @RequestParam is included, a parameter named "model" is expected in the GET request. Is there a way to make model parameters mandatory yet keep the same request URL?
tagged with: spring
tagged with: parameters
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/21028942
has comment: http://stackoverflow.com/comment/31613428
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31612281
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31611555
has comment: http://stackoverflow.com/comment/31611766
has body: I'm trying to encode Double values in an interval (let's say between "a" and "b") to a binary strings (in Java), given the precision (1.234 - precision is 3 in this case) of the Double values. The resulting strings should be equal in length. I have tried using: String binaryForm = Long.toBinaryString(Double.doubleToRawLongBits(n)); Unfortunately, the resulting strings are not equal in length. Any ideas? The resulting strings are going to be used as chromosomes in a GA.
has answer: http://stackoverflow.com/a/21576304
has comment: http://stackoverflow.com/comment/31651798
tagged with: genetic-algorithm
tagged with: java
has comment: http://stackoverflow.com/comment/31611628
type: Question
has title: Encoding a Double value to a binary string
tagged with: encoding
has comment: http://stackoverflow.com/comment/31611598
has comment: http://stackoverflow.com/comment/31653628

http://stackoverflow.com/a/21109911
answers question: http://stackoverflow.com/q/21109871
type: Answer
has body: Tutorials This tutorial shows how you should do everything: http://www.slideshare.net/scentsome/eclipse-genymotion And this is the original website tutorial: https://cloud.genymotion.com/page/doc/ Both explain it perfectly Extra: Android Studio: Go to File/Settings on Windows and Linux or Android Studio/Preferences on Mac OS X. Select Plugins and click Browse Repositories. Right-click (double-click for Mac OS X) on Genymotion. Click Download and install. Click Yes. Click Close. Click OK. Restart Android Studio by clicking Restart. If you want to do the manual method or want to see the instructions from their website, this is the link: https://www.genymotion.com/#!/developers/user-guide#genymotion-plugin-for-android-studio Eclipse: If you want to have the genymotion virtual devices inside eclipse do this: Go to help -> install new software -> add this link: https://dl.genymotion.com/eclipse
type: AcceptedAnswer
downvote count: 0
score: 47
upvote count: 47
accepted answer of: http://stackoverflow.com/q/21109871

http://stackoverflow.com/a/21846014
score: 1
has comment: http://stackoverflow.com/comment/33068907
upvote count: 1
has body: My soluton for this problem is to convert integer inputed to c-string, then everthing will be easy. class Solution { public: int reverse(int x) { char str[11]; bool isNegative = false; int i; int ret = 0; if ( x &lt; 0 ) { isNegative = true; x = -x; } i = 0; while ( x != 0 ) { str[i++] = x % 10 + '0'; x = x / 10; } str[i] = '\0'; if ( (isNegative &amp;&amp; strlen(str) == 10 &amp;&amp; strcmp(str, "2147483648") &gt; 0) || (!isNegative &amp;&amp; strlen(str) == 10 &amp;&amp; strcmp(str, "2147483647") &gt; 0) ) { cout &lt;&lt; "Out of range!" &lt;&lt; endl; throw new exception(); } i = 0; int strLen = (int)strlen(str); while ( str[i] != '\0' ) { ret += ((str[i] - '0') * pow(10.0, strLen - 1 - i)); i++; } return (isNegative ? -ret : ret); } };
answers question: http://stackoverflow.com/q/21070506
type: Answer
downvote count: 0

http://stackoverflow.com/comment/31711487
type: AnswerComment
type: Comment
has text: the other class creates the expandablelistview, mit creates the parent and childen, the onClick opens the videos Class
comment on: http://stackoverflow.com/a/21083160
score: 0

http://stackoverflow.com/a/21275808
type: Answer
answers question: http://stackoverflow.com/q/21139839
downvote count: 0
score: 1
has body: Directly you cannot search using Java. You can use Tika to extract the contents of the file then you can apply the Regular Expression.
upvote count: 1

http://stackoverflow.com/q/21156445
tagged with: hive
possible better answer: http://stackoverflow.com/a/21159088
type: Question
accepted answer: http://stackoverflow.com/a/23010465
answer count: 3
upvote count: 1
has body: Hi I am trying to create a hive table with some constraints using jdbc,which is giving me an error String sql1="CREATE TABLE sample_hive_table_2 (key1 int PRIMARY KEY ,value1 string)"; System.out.println(sql1); res = stmt.executeQuery(sql1); Exception in thread "main" java.sql.SQLException: Query returned non-zero code: 40000, cause: FAILED: ParseException line 1:43 mismatched input 'PRIMARY' expecting ) near 'int' in create table statement at org.apache.hadoop.hive.jdbc.HiveStatement.executeQuery(HiveStatement.java:194) I need to do two things 1) create a table with constraints 2)find the constraints on columns of a table using jdbc program. Thanks Hitz
has answer: http://stackoverflow.com/a/23010465
has title: creating a hive table with connstraints using java and check column constraints of a hive table using a jdbc program
favorite count: 0
has answer: http://stackoverflow.com/a/21159088
tagged with: jdbc
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/43689607

http://stackoverflow.com/comment/31791691
type: QuestionComment
score: 1
has text: Yeah, Anthony is right. You don't need to set ```updateComponentTreeUI``` when you set your L&F before initialization of your application :)
comment on: http://stackoverflow.com/q/21126388
type: Comment

http://stackoverflow.com/comment/31892982
has text: Thanks for your opinion. Actually, I can't use a static xpath as u have said. The reason is I wanna generic function. I will be only passing the form object kind of thing, and then I wanna to iterate any number of span element depth. So hard coded xpath is not going to work for me here.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21182515
type: AnswerComment

http://stackoverflow.com/q/21043873
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21232963
tagged with: servlets
score: 0
answer count: 2
tagged with: jsp
tagged with: jquery
possible better answer: http://stackoverflow.com/a/21044103
tagged with: ajax
has answer: http://stackoverflow.com/a/21044103
has answer: http://stackoverflow.com/a/21232963
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31637762
has body: Could someone assist here. I have the below servlet class and each time i try to select from parent category nothing gets displayed in subcategory. Have a look at the below if am doing something wrong . Thanks ajax part: $('#parentCategorySelector').change(function () { var selectedValue = $(this).prop('value'); if (selectedValue == '--Select a parent category--') { $('#categorySelector').empty(); } else { $.post('${PREFIX}/category', selectedValue, function(data) { var categorySelectorList = data.categorySelectorList; $('#categorySelector').empty(); $.each(categorySelectorList, function(key, value) { $('#categorySelector').append($(' ', { value : value, text : value })); }); }, 'json'); } }); servlet class : public class CategoryServlet extends HttpServlet { /** * serialization */ private static final long serialVersionUID = -2461387206258395143L; private static final Logger LOGGER = Logger .getLogger(CategoryServlet.class); private Connection connection = null; int cat = 0; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { connection = DBConnection.getConnection(); RequestDispatcher dispatcher = request .getRequestDispatcher("pages/all.jsp"); dispatcher.include(request, response); String id = request.getParameter("id"); String category = request.getParameter("category"); String parentCategory = request.getParameter("parentCategory"); if (StringUtils.paramSet(id)) { request.setAttribute("CATEGORY", CategoryService.getCategoryById( Long.valueOf(id), connection)); } else if (StringUtils.paramSet(parentCategory)) { request.setAttribute( "CATEGORY", CategoryService.getParentCategory( Integer.valueOf(parentCategory), connection)); } else if (StringUtils.paramSet(category)) { String categories = request.getParameter("category"); if (StringUtils.paramSet(categories)) { request.setAttribute("CATEGORY", CategoryService.listAllCategory(cat, connection)); } dispatcher = request.getRequestDispatcher("jsp/pages/al…
has title: chained select with servlets,jquery,ajax, json
has comment: http://stackoverflow.com/comment/31638113

http://stackoverflow.com/q/21157637
upvote count: 1
tagged with: timestamping
type: Question
has answer: http://stackoverflow.com/a/21159561
tagged with: validation
answer count: 1
downvote count: 0
favorite count: 0
tagged with: bouncycastle
has title: How to validate a TimeStampToken using a .cer file from filesystem?
accepted answer: http://stackoverflow.com/a/21159561
has body: There are two validate methods in the TimeStampToken class (bctsp-jdk16-1.46.jar), one of them is deprecated. The deprecated method uses a X509Certificate as argument, and that's quite easy to create. InputStream inPFX = getClass().getClassLoader().getResourceAsStream("tsp.cer"); CertificateFactory cf = CertificateFactory.getInstance("X.509", "BC"); X509Certificate cert = (X509Certificate) cf.generateCertificate(inPFX); // The validate method just takes the X509Certificate object token.validate(cert, "BC"); The new method uses a SignerInformationVerifier object. I found a way to create a SignerInformationVerifier (not sure it's the right way), but I still need a X509CertificateHolder object. How do I create the X509CertificateHolder from a file on the filesystem (*.cer file) Is this the correct way to create a SignerInformationVerifier to validate the TimeStampToken? My current code looks like this: TimeStampToken token = new TimeStampToken(new CMSSignedData(response)); X509CertificateHolder x = // HOW TODO THIS? // create the SignerInformationVerifier object DigestAlgorithmIdentifierFinder daif = new DefaultDigestAlgorithmIdentifierFinder(); DigestCalculatorProvider dcp = new BcDigestCalculatorProvider(); SignerInformationVerifier siv = new BcRSASignerInfoVerifierBuilder(daif, dcp).build(x509ch); // use the new validate method token.validate(siv);
type: AnsweredQuestion
score: 1
tagged with: java

mysql
tags question: http://stackoverflow.com/q/21066818
tags question: http://stackoverflow.com/q/21073254
tags question: http://stackoverflow.com/q/21137534
tags question: http://stackoverflow.com/q/21136117
tags question: http://stackoverflow.com/q/21091298
tags question: http://stackoverflow.com/q/21165326
tags question: http://stackoverflow.com/q/21108890
tags question: http://stackoverflow.com/q/21161211
tags question: http://stackoverflow.com/q/21021334
tags question: http://stackoverflow.com/q/21157315
tags question: http://stackoverflow.com/q/21095225
tag name: mysql
tags question: http://stackoverflow.com/q/21135557
tags question: http://stackoverflow.com/q/21066890
tags question: http://stackoverflow.com/q/21057999
tags question: http://stackoverflow.com/q/21097316
tags question: http://stackoverflow.com/q/21159997
tags question: http://stackoverflow.com/q/21054761
tags question: http://stackoverflow.com/q/21072728
tags question: http://stackoverflow.com/q/21068708
tags question: http://stackoverflow.com/q/21179475
tags question: http://stackoverflow.com/q/21126042
tags question: http://stackoverflow.com/q/21094316
tags question: http://stackoverflow.com/q/21180675
tags question: http://stackoverflow.com/q/21084487
tags question: http://stackoverflow.com/q/21099351
tags question: http://stackoverflow.com/q/21079703
tags question: http://stackoverflow.com/q/21168092
tags question: http://stackoverflow.com/q/21035264
tags question: http://stackoverflow.com/q/21036203
tags question: http://stackoverflow.com/q/21163496
tags question: http://stackoverflow.com/q/21128589
tags question: http://stackoverflow.com/q/21069687
tags question: http://stackoverflow.com/q/21019585
tags question: http://stackoverflow.com/q/21139757
tags question: http://stackoverflow.com/q/21061388
tags question: http://stackoverflow.com/q/21177005
tags question: http://stackoverflow.com/q/21159174
tags question: http://stackoverflow.com/q/21059555
tags question: http://stackoverflow.com/q/21063652
tags question: http://stackoverflow.com/q/21117991
tags question: http://stackoverflow.com/q/21035860
tags question: http://stackoverflow.com/q/21061393
type: Tag
tags question: http://stackoverflow.com/q/21075549
tags question: http://stackoverflow.com/q/21182670
tags question: http://stackoverflow.com/q/21096570
tags question: http://stackoverflow.com/q/21176667
tags question: http://stackoverflow.com/q/21092833
tags question: http://stackoverflow.com/q/21041874
tags question: http://stackoverflow.com/q/21102520
tags question: http://stackoverflow.com/q/21118779
tags question: http://stackoverflow.com/q/21092007
tags question: http://stackoverflow.com/q/21175019
tags question: http://stackoverflow.com/q/21090082
tags question: http://stackoverflow.com/q/21139831
tags question: http://stackoverflow.com/q/21164025
tags question: http://stackoverflow.com/q/21111188
tags question: http://stackoverflow.com/q/21089174
tags question: http://stackoverflow.com/q/21137312
tags question: http://stackoverflow.com/q/21042418
tags question: http://stackoverflow.com/q/21048458
tags question: http://stackoverflow.com/q/21168938
tags question: http://stackoverflow.com/q/21115336
tags question: http://stackoverflow.com/q/21131185
tags question: http://stackoverflow.com/q/21101444
tags question: http://stackoverflow.com/q/21129017
tags question: http://stackoverflow.com/q/21099198
tags question: http://stackoverflow.com/q/21167682
tags question: http://stackoverflow.com/q/21150934

http://stackoverflow.com/a/21146965
score: 0
answers question: http://stackoverflow.com/q/21146756
type: Answer
has body: for debug purposes print canonical path of your file: File file = new new File("text.txt"); System.out.println(file.getCanonicalPath()); so you can see where your file should be located

http://stackoverflow.com/comment/31765794
type: Comment
has text: Plz add follwing dependencies and Check org.apache.poi poi-ooxml 3.10-beta2 and org.apache.poi poi-ooxml-schemas 3.10-beta2
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21106415

http://stackoverflow.com/comment/31660076
has text: This is incorrect. An app with these settings will also run on newer devices (e.g. 18).
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21055399
type: AnswerComment

http://stackoverflow.com/comment/31680852
score: 0
has text: @AndrewThompson I guess he means that he's using some classes both on the client-side and on the server-side (not in an applet, of course)
comment on: http://stackoverflow.com/q/21066333
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21072540
type: Question
has body: I've got Hippo CMS source code with SVN. Fortunately it is maven based and it gets all dependencies automatically. I've installed it with Maven successfully.and both site.war and CMS.war and two other jar file were built. But I don't know how to run it. The documentation says to run it using mvn -P cargo.run. I've done that and everything seems OK, when I try to browse to localhost:8080/cms or localhost:8080/site nothing appears. Can somebody help if I must do some other thing? Or if I did something wrong?
accepted answer: http://stackoverflow.com/a/21076486
has title: How to Run Hippo CMS
tagged with: svn
tagged with: java
has comment: http://stackoverflow.com/comment/31717913
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21076486
type: AnsweredQuestion
upvote count: 2
score: 1
tagged with: maven
tagged with: hippocms
downvote count: 1

http://stackoverflow.com/comment/31751876
score: 0
type: Comment
type: QuestionComment
has text: Looks "hadoop-datajoin-2.0.0.-cdh4.0.0.jar" is using "cdh4.0.0" but other jars are not using "cdh4.0.0". Actually, cdh is not compatible with Apache Hadoop. You'd better using the same version of Hadoop.
comment on: http://stackoverflow.com/q/21098740

http://stackoverflow.com/comment/31679403
type: Comment
comment on: http://stackoverflow.com/a/21066262
score: 1
has text: I'm not sure what you mean, but `Integer.TYPE` != `Integer.class`.
type: AnswerComment

http://stackoverflow.com/comment/31692351
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21073177
has text: i prefer to use SPAJ_ID=master_spaj.SPAJ_ID but i always get errors that said no such column: master_spaj.SPAJ_ID
score: 0

http://stackoverflow.com/comment/31790034
comment on: http://stackoverflow.com/q/21125998
has text: @Njol I will be in the Java Application when I access this file, I need to store virtual bank account users into a file, and then be able to re-read them back into the program when they have a matching pin number and username...
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31661783
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21056188
type: Comment
has text: @CarlA It is responding "now", the moment you add another focusable control or the window loses focus for some reason, it won't

http://stackoverflow.com/a/21022750
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/21022554
type: Answer
has comment: http://stackoverflow.com/comment/31600287
has comment: http://stackoverflow.com/comment/31600322
has body: In java you´d typically work with AudioInputStream instances (that you get out of classes defined by the Java sound API). Those are read byte-wise for playback. I have never doen manipulation myself, but as far as I know, this is mostly done through Java sound´s mixer class. Below tutorial should have all the info you´re looking for: http://docs.oracle.com/javase/tutorial/sound/playing.html
score: 0

http://stackoverflow.com/a/21749581
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21113404
has body: The ArrayList doesn't contain Byte[] or byte[] values, however the list itself can be converted to a byte array as it contains individual byte values byte[] bytes = new byte[array.size()]; for (int i = 0; i &lt; array.size(); i++) { bytes[i] = array.get(i); }
downvote count: 0
type: Answer

illegalstateexception
tags question: http://stackoverflow.com/q/21089963
tags question: http://stackoverflow.com/q/21039471
tags question: http://stackoverflow.com/q/21067637
tag name: illegalstateexception
tags question: http://stackoverflow.com/q/21039049
type: Tag

http://stackoverflow.com/comment/31749565
comment on: http://stackoverflow.com/q/21103401
has text: It could be a case of: http://stackoverflow.com/questions/5502295/samsung-galaxy-wont-return-bitmap-data-getextras-getdata Can you not connect your phone to your PC to see the logcat? Failing that, Google Play has various Log Collector apps to get the logcat, although those don't work since Android 4.1.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21157123
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/29571383
has answer: http://stackoverflow.com/a/21536111
score: 8
downvote count: 0
has answer: http://stackoverflow.com/a/21157598
tagged with: java
tagged with: spring-data
upvote count: 8
type: Question
has answer: http://stackoverflow.com/a/21159617
has answer: http://stackoverflow.com/a/34788675
has body: I was trying to setup and use Spring Data for the first time. Naturally you would want to use the latest version(Spring Data JPA 1.4.3.RELEASE & Hibernate 4.3.0.Final). After configuring as per the examples online, the application threw an exception. org.springframework.data spring-data-jpa 1.4.3.RELEASE org.hibernate hibernate-core Hibernate 4.3.0.Final commons-collections commons-collections org.hibernate hibernate-search 4.4.2.Final org.hibernate hibernate-core This was the error / exception : Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [test-service-persistance-application-context.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index; at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:973) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:750) at org.springframework.context.support.AbstractAp…
tagged with: spring-data-jpa
has answer: http://stackoverflow.com/a/40485091
tagged with: jpa
answer count: 7
has answer: http://stackoverflow.com/a/28405174
favorite count: 0
has title: Hibernate 4.3.0.Final & Spring Data JPA 1.4.3.RELEASE

http://stackoverflow.com/comment/31790645
score: 0
has text: @JohnTangBoyland Well I did, and I still have the same strange random skipping of subsequent lines of code... Still at a loss of what exactly is going on here. It even happens if I attempt a .join() on the thread object instead.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21080162

http://stackoverflow.com/q/21077052
has comment: http://stackoverflow.com/comment/31699167
type: Question
score: -1
has comment: http://stackoverflow.com/comment/31699292
has answer: http://stackoverflow.com/a/21077250
answer count: 2
upvote count: 0
favorite count: 0
has title: How do I pause/stop a song that's being played?
type: UnansweredQuestion
tagged with: javasound
has comment: http://stackoverflow.com/comment/31699748
has body: I have created a program where I can play a song, However I cannot get it to pause/stop and when I click the play button again the song loops over and over again. How can i get the song to pause or stop? Here's my source code below to play a song: public void sound(String nm) { AudioStream BGM; //Backround Music try { InputStream test = new FileInputStream("./"+nm+".wav"); BGM = new AudioStream(test); AudioPlayer.player.start(BGM); } catch (IOException error) { JOptionPane.showMessageDialog(null, error.getMessage()); } }
tagged with: audio
has answer: http://stackoverflow.com/a/21077260
tagged with: java
downvote count: 1

http://stackoverflow.com/q/21154543
type: UnansweredQuestion
has body: I have 7 text-fields in my JSP. In my javascript quite often I need to collectively fill these textfields, empty, validate, etc. So presently in my JS I keep their id's as parameter_1, parameter_2, etc as it helps me to traverse them together easily using id property. JS: function emptyThresholdTextFields(){ $('[id^="parameter_"]').each(function(i, value) { $(this).val(''); }); } function fillThresholdTextFields(data){ $("[name='minNumberOc']").val(data.minNumberOc); $("[name='minDurationOc']").val(data.minDurationOc) $("[name='maxNumberIc']").val(data.maxNumberIc) $("[name='maxDurationIc']").val(data.maxDurationIc) $("[name='maxNumberCellId']").val(data.maxNumberCellId) $("[name='distinctBnumberRatio']").val(data.distinctBnumberRatio) $("[name='minPercentDistinctBnumber']").val(data.minPercentDistinctBnumber) } JSP: &lt;s:textfield id="thresholdParameter_1" label="Minimum Number of OG Calls" required="true" name="minNumberOc" onkeypress="return isNumber(event,'thresholdParameter_1')"&gt; &lt;/s:textfield&gt; Is this a good practice to keep id's like in this form parameter1, parameter2, etc? As in fillThresholdtextFields for filling I have to access each parameter associatively. So later on if parameters increase it will get more cumbersome. Is there some other alternative such that both 1 and 2 can be achieved easily?
upvote count: 1
type: Question
score: 1
tagged with: java
has title: Traverse elements collectively in javascript?
tagged with: struts2
downvote count: 0
answer count: 1
tagged with: jsp
tagged with: javascript
has answer: http://stackoverflow.com/a/21155552
favorite count: 0

http://stackoverflow.com/q/21102071
has title: RestTemplate upload image file
score: 4
answer count: 1
has body: I need to create RestTemplate request, which will send image to upload by PHP application. My code is: Resource resource = new FileSystemResource("/Users/user/Documents/MG_0599.jpg"); MultiValueMap&lt;String, Object&gt; parts = new LinkedMultiValueMap&lt;String, Object&gt;(); parts.add("Content-Type", "image/jpeg"); parts.add("file", resource); parts.add("id_product", productId); ResponseEntity&lt;String&gt; response = cookieRestTemplate.getForEntity(url, String.class, parts); After start this app, PHP server send me information, that file is empty. I was thinking, that problem is by PHP site, but i've installed POSTER plugin for Firefox, and i made GET request onto this same URL, but the file to upload, i've selected normaly like in web form (popup system window to select file). After this PHP program uploaded file without any problem. I think, that problem is maybe with this, that i'm sending resource as value of param name: parts.add("file", resource); And on the POSTER plugin, i just select file from my file system ? Can you help me ?
favorite count: 0
type: UnansweredQuestion
tagged with: resttemplate
has comment: http://stackoverflow.com/comment/31746508
tagged with: spring
has comment: http://stackoverflow.com/comment/31746647
tagged with: java
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/21103238
downvote count: 0

http://stackoverflow.com/comment/31746725
type: Comment
comment on: http://stackoverflow.com/a/21100109
type: AnswerComment
has text: I tried the SQL statement in my database tool the HQL one in my program code along with the criteria.
score: 0

http://stackoverflow.com/q/21036813
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/31626297
has title: How to print day of the date without using inbuilt calendar date day packages, libraries in java
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31626094
has body: In this program i want to print day of the date without using inbuilt calendar packages.. And i'm not able to get exact answer for certain dates (input date). in this i get day of the date correctly for only upto 31.12.0004. Note that it is the assessment given by my guide 5 days before still i'm not getting correct answer and I'm not supposed to use calendar packages and api's because syllabus for my course completed lists : basic array, if &amp; else, for loops, class and objects. import java.util.Scanner; class calendarr { public static void main(String arg[]) { int z=0; do{ int id,im,iy; Scanner ip = new Scanner(System.in); System.out.print("Enter DD MM YYYY : "); id = ip.nextInt(); im = ip.nextInt(); iy = ip.nextInt(); System.out.print("\n"); int totalDays = 0, leapYearDays = 366, ordinaryYearDays = 365, y = iy-1,day=0; int totalDaysOfGivenYear,totalDaysUptoGivenMonth=0, totalDaysEntire; int leapYearCount = y%4, ordinaryYearCount = y - leapYearCount; int totalDaysUptoPreviousYear=0; int totalDaysUptoPreviousYearCount = (leapYearCount * leapYearDays)+(ordinaryYearCount * ordinaryYearDays); System.out.print("Odd Days Leap Year and Ordinary Year : "+leapYearCount+" "+ordinaryYearCount+"\n"); String[] months = new String[] {"January","February","March","April","May","June","July","August","September","October","November","December"}; int[] monthDates = new int[] {0,31,28,31,30,31,30,31,31,30,31,30,31}; String[] weekDays = new String[] {"Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday"}; if((iy%4==0)&amp;&amp;(iy%100!=0)||(iy%400==0)) { monthDates[2] = 29; System.out.println("It is Leap Year"); } else System.out.println("It is Ordinary Year"); for(int i=1;i&lt;=monthDates.length;i++) { totalDays = totalDays + monthDates[i-1]; } for(int j=1;j&lt;=im;j++) { totalDaysUptoGivenMonth = totalDaysUptoGivenMonth+monthDates[j]; } totalDaysOfGivenYear = totalDaysUptoGivenMonth+id-monthDates[im]; System.out.println("Total Days Upto Given Months : "+totalDa…
type: UnansweredQuestion
downvote count: 1
has answer: http://stackoverflow.com/a/21037447
tagged with: java
score: -1

http://stackoverflow.com/comment/31601192
type: Comment
type: QuestionComment
score: 1
has text: See http://stackoverflow.com/questions/2137755/how-do-i-reverse-an-int-array-in-java, http://stackoverflow.com/questions/9995432/reverse-array-order, and http://stackoverflow.com/questions/12678781/reversing-an-array-in-java.
comment on: http://stackoverflow.com/q/21023348

http://stackoverflow.com/q/21082850
accepted answer: http://stackoverflow.com/a/21082934
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21082934
tagged with: java
tagged with: database
tagged with: servlets
type: Question
answer count: 1
tagged with: jsp
tagged with: html-select
score: 0
has title: Display data from database in SINGLE dropdownlist
has body: I have 1 goal which is to DISPLAY DATA from DATABASE in one SINGLE DROPDOWN LIST. Right now in my database there are 3 data. I am able to display in 3 DROPDOWN LISTS which I do not know what. Is there a way to display in one dropdown list instead? Below are my codes. &lt;c:forEach var="staff" items="${staff}"&gt; &lt;select name="staffId"&gt;&lt;option value="${staff.staffId}"&gt;${staff.staffName}&lt;/option&gt;&lt;/select&gt; &lt;/c:forEach&gt;

http://stackoverflow.com/comment/31986680
type: Comment
has text: You have one MORE option. If you do not use the double-apostrophe character as a quate character, you can change the CsvPreference - see http://supercsv.sourceforge.net/apidocs/org/supercsv/prefs/CsvPreference.html - so that double-quote is not considered as a quote character.
comment on: http://stackoverflow.com/a/21182258
score: 0
type: AnswerComment

http://stackoverflow.com/a/21029333
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21029245
downvote count: 0
has body: Man, try this String[] letters = {"a", "b", "c"}; for (String s : letters) letterAverage(s); And change this if(letterGrade == "a") to this if("a".equals(letter)) This is a valid way to compare String, using equals()
type: Answer
has comment: http://stackoverflow.com/comment/31618891

http://stackoverflow.com/q/21169487
accepted answer: http://stackoverflow.com/a/21169765
tagged with: jframe
linked to: http://stackoverflow.com/q/9753722
tagged with: swing
has answer: http://stackoverflow.com/a/21169765
possible better answer: http://stackoverflow.com/a/44034400
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/44034400
tagged with: java
has body: how to put the JFrame on the TOP_RIGHT? i know for center, and the normal one in the top left, but how to put in the TOP RIGHT?
type: Question
answer count: 2
tagged with: layout
downvote count: 1
has title: How to position JFrame to top-right of screen upon start
favorite count: 0
has comment: http://stackoverflow.com/comment/31868778
upvote count: 4

http://stackoverflow.com/comment/31603603
has text: Do you have a way to get the numeric value from your Event object? Something like eventMap.get(i).getNumericValue() ?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21024653

http://stackoverflow.com/q/21111394
tagged with: jdbc
tagged with: spring
tagged with: spring-jdbc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31776425
has comment: http://stackoverflow.com/comment/31762749
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/21136530
tagged with: db2
has title: where do i download jdbc driver for DB2 8.1?
score: 0
has comment: http://stackoverflow.com/comment/31798218
has comment: http://stackoverflow.com/comment/31763243
upvote count: 1
has comment: http://stackoverflow.com/comment/31763842
downvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/21136530
linked to: http://stackoverflow.com/q/7678298
has body: I'm planing to develop a web application with spring framework. I am using DB2 8.1 as database ,but did not find any JDBC driver for accessing DB2 from java.
favorite count: 0
has comment: http://stackoverflow.com/comment/31762365

http://stackoverflow.com/comment/31595253
comment on: http://stackoverflow.com/q/21020107
has text: BTW if you're interested in the meaning of your error, `Map<String, char[]>` is legal, so the compiler expects those array brackets to be added.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/32713788
score: 0
has text: Direct android printing is available, see links http://myhowtohelp.blogspot.in/2014/01/android-based-cash-register-with.html http://myhowtohelp.blogspot.in/2014/01/library-to-print-from-android-device-usb.html https://play.google.com/store/apps/details?id=com.ssssoft.cashregisterdemo
comment on: http://stackoverflow.com/q/21184138
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21088031
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31719669
upvote count: 2
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21088054
tagged with: record
downvote count: 1
linked to: http://stackoverflow.com/q/2772763
type: Question
has title: Two integer value equal in java?
has answer: http://stackoverflow.com/a/21088119
answer count: 2
accepted answer: http://stackoverflow.com/a/21088054
possible better answer: http://stackoverflow.com/a/21088119
favorite count: 0
tagged with: equals
has body: In my below code i check the two infocode if it exist show msg MSG_SAME_INFO_ALREADY_EXISTS but the issue is that when i compare two infocode the infocode value is same but it cannot enter the loop . What i am wrong in below code ? if (folderInfoData.getFolderInforecord().getInfoCode() == map.get("infoCode")) { showError(pageResourceBundle.getText("MSG_SAME_INFO_ALREADY_EXISTS")); return; } Both Debug value given below : the both folderInfoData.getFolderInforecord().getInfoCode() and map.get("infoCode") infocode return integer given below. Can anyone tell me how can resolve this issue ? Thanks
linked to: http://stackoverflow.com/q/4036167
tagged with: dictionary
tagged with: integer

http://stackoverflow.com/q/21102260
upvote count: 2
has comment: http://stackoverflow.com/comment/31746849
linked to: http://stackoverflow.com/q/2127217
has comment: http://stackoverflow.com/comment/31747021
type: AnsweredQuestion
tagged with: recursion
has answer: http://stackoverflow.com/a/21102498
has title: Code gives java.lang.StackOverflowError for 123456789 but not for 9999999999999999999
tagged with: java
has comment: http://stackoverflow.com/comment/31747067
type: Question
has body: So I'm doing this exercise on finding the next palindrome with only the use of the String class. I kinda solved it, but had a question about something. When I enter a String like 123456789, I get a java.lang.StackOverflowError. While when I enter a larger string like 9999999999999999999, I won't get the error. I did some research on this website and I think it has something to do with the recursive palindrome method I use. Is there any way I could improve my code so it will handle bigger numbers? And why would 123456789 give an error and 9999999999999999999 not? The latter is bigger. import java.io.*; public class mainclass { public static void main(String[] args) throws IOException { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader in = new BufferedReader(isr); System.out.println(palindroom(in.readLine())); } public static String increment(String str){ String incre=""; if(str.equals("9")){incre = "10";} else{ switch(str.charAt(str.length()-1)){ case '0': incre = str.substring(0, str.length()-1)+"1";break; case '1': incre = str.substring(0, str.length()-1)+"2";break; case '2': incre = str.substring(0, str.length()-1)+"3";break; case '3': incre = str.substring(0, str.length()-1)+"4";break; case '4': incre = str.substring(0, str.length()-1)+"5";break; case '5': incre = str.substring(0, str.length()-1)+"6";break; case '6': incre = str.substring(0, str.length()-1)+"7";break; case '7': incre = str.substring(0, str.length()-1)+"8";break; case '8': incre = str.substring(0, str.length()-1)+"9";break; case '9': incre = increment(str.substring(0, str.length()-1))+"0";break; }; } return incre; } public static String palindroom(String str){ String palin=increment(str); boolean isPalindroom=true; for(int i=0;i&lt;palin.length();i++){ if(palin.charAt(i)==palin.charAt(palin.length()-i-1)){} else{isPalindroom=false;} } if(isPalindroom){return palin;} else{return palindroom(increment(str));} } }
has comment: http://stackoverflow.com/comment/31746986
score: 2
downvote count: 0
tagged with: stack-overflow
accepted answer: http://stackoverflow.com/a/21102498
answer count: 3
has answer: http://stackoverflow.com/a/21102765
has comment: http://stackoverflow.com/comment/31747080
has answer: http://stackoverflow.com/a/21102964
has comment: http://stackoverflow.com/comment/31747183
has comment: http://stackoverflow.com/comment/31747521
has comment: http://stackoverflow.com/comment/31747031
favorite count: 0
possible better answer: http://stackoverflow.com/a/21102765
has comment: http://stackoverflow.com/comment/31747114

http://stackoverflow.com/comment/31780667
type: Comment
has text: `COM1` generally refers to a physical port on the computer (as opposed to a USB Virtual COM port). If the computer has a physical serial port it should have `COM1` available regardless of whether its a laptop or a desktop.
comment on: http://stackoverflow.com/a/21121092
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31629984
type: Comment
has text: I edited it. Now your output is in the correct format. Just format() it when you want to print.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21039168

http://stackoverflow.com/comment/31681868
type: QuestionComment
score: 3
has text: This sort of general research is OT for a q&a site like SO. Multi threading is a big topic. I'd recommend reading book on the subject, and possibly even finding a course online or at your local college/adult learning center/whatever. For books, Java Concurrency In Practice is good, though it sounds like you may need additional resources.
comment on: http://stackoverflow.com/q/21067286
type: Comment

http://stackoverflow.com/comment/31755539
comment on: http://stackoverflow.com/q/21107202
type: Comment
has text: @Dennis Meng Do you mean because I am returning arrayInDouble at the end so I have to assign something to the variable? So the returning behaviour is calling 'using the variable'? or I am wrong?
type: QuestionComment
score: 0

http://stackoverflow.com/comment/125787677
score: 1
type: AnswerComment
type: Comment
has text: Thank you leokom for pointing this out. However, I am not a fan of the try-with-resources approach that Mockito came up with and thus have replaced it with an JUnit5 Extension. I'll add an answer to describe it. It allows you to simply create an annotated field on your test class for the static mock. Much cleaner, especially when you need to mock multiple statics.
comment on: http://stackoverflow.com/a/62860455

http://stackoverflow.com/a/21099210
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/31770695
has comment: http://stackoverflow.com/comment/31759644
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21099118
has comment: http://stackoverflow.com/comment/31764008
has body: You seem to have an array of SeguradoraLista objects. So just create a TypeToken of type List&lt;SeguradoraLista&gt; Type collectionType = new TypeToken&lt;List&lt;SeguradoraLista&gt;&gt;() {}.getType(); List&lt;SeguradoraLista&gt; ListaSeguradoras = gson.fromJson(respStr, collectionType); Actually, Collection&lt;SeguradoraLista&gt; would work as well.
has comment: http://stackoverflow.com/comment/31771316
answers question: http://stackoverflow.com/q/21099118
has comment: http://stackoverflow.com/comment/31770294
has comment: http://stackoverflow.com/comment/31768763
type: Answer
has comment: http://stackoverflow.com/comment/31770020
has comment: http://stackoverflow.com/comment/31768778
has comment: http://stackoverflow.com/comment/31771946

http://stackoverflow.com/a/21149487
score: 1
has body: Ant files are XML. You might be able to add your script as an External Tool instead (it's the button next to Debug and Run) and then add it as a Builder to your Project.
downvote count: 0
answers question: http://stackoverflow.com/q/21148916
type: Answer
upvote count: 1

http://stackoverflow.com/q/21115685
answer count: 3
has body: I recently (&lt;- keyword) got into programming Java, and I'm loving it! But I've ran into a little obstacle while trying to independently program... My idea was to make a fun little Character Creator - RPG Style, but I don't know how to get the user to select a class without using a bunch of If Statements. I want to use enum's, even though I'm not really familiar with them. So far I've got to the point of asking the user what class it wants to play + I've created the enum. String Name; System.out.println("Welcome to my Character Creator 2.0!\n"); Thread.sleep(2000); System.out.print("First off, what do you want your characters name to be?\n\nName : "); Name = Scan.nextLine(); Thread.sleep(1000); System.out.print("\nYou are now to be known as "+ Name + "!"); System.out.print("\n\n" + Name + ", what class do you want to be? "); Thread.sleep(1000); System.out.print("Classes available : Knight\nMage\nDruid\nNinja\nArcher\nAdventurer"); } So yeah, I basically want to be able to call out the the classes right from the enum, but I'm unsure how to do it. I tried something stupid like : Class = Scan.nextInt();... but it obviously didn't work
has title: Java - How to use enums
favorite count: 0
has answer: http://stackoverflow.com/a/21116059
has answer: http://stackoverflow.com/a/21115852
upvote count: 2
has comment: http://stackoverflow.com/comment/31770177
linked to: http://stackoverflow.com/q/3069743
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31770361
tagged with: enums
has answer: http://stackoverflow.com/a/21115841
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21115852
possible better answer: http://stackoverflow.com/a/21115841
downvote count: 0
has comment: http://stackoverflow.com/comment/31770134
has comment: http://stackoverflow.com/comment/31770202

http://stackoverflow.com/comment/32081892
type: Comment
has text: While your answer is good advice in general, it is not the answer to this question. Spurious wake ups are not occurring as execution would resume after the wait() call if that were the case.
type: AnswerComment
comment on: http://stackoverflow.com/a/21259089
score: 0

http://stackoverflow.com/comment/31665511
type: Comment
type: QuestionComment
has text: `module them`? You mean `modulo`?
score: 0
comment on: http://stackoverflow.com/q/21058575

http://stackoverflow.com/q/21071857
answer count: 2
downvote count: 0
favorite count: 0
has body: I have the activity_main XML like this: &lt;LinearLayout ...&gt; &lt;EditText android.id="@+id/edit_text" android:layout_weight="1" android:layout_width="0dp" android:layout_height="wrap_content" android:hint="@string/edit_message" /&gt; &lt;Button android.id="@+id/my_send" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_send" android:onClick="sendMessage" /&gt; &lt;/LinearLayout&gt; The main java codes are: public class MainActivity extends Activity { void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); EditText editText = (EditText) findViewById(R.id.edit_text); if (editText == null) Log.v("editText", "null editText"); else Log.v("editText", "good editText"); } } The display is correct and I can see the EditText and Button fields. However, I always got NULL for editText. I read the previous problems. Most of them were due to the fact that setContentView(R.layout.active_main) was not used. But I can't find out why I am having problem with my codes. Any help is greatly appreciated.
type: UnansweredQuestion
tagged with: android
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21071948
has answer: http://stackoverflow.com/a/21071871
has title: Having trouble with findViewById - returning null

http://stackoverflow.com/q/21069497
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/31685885
has comment: http://stackoverflow.com/comment/31686134
has title: Hibernate/JPA: ManyToMany and OneToMany relationship on same attribute
type: Question
has answer: http://stackoverflow.com/a/21072590
answer count: 1
tagged with: jpa
downvote count: 0
accepted answer: http://stackoverflow.com/a/21072590
favorite count: 0
score: 2
has body: I have a problem on combining a ManyToMany with an OneToMany relationship. I have entries and categories. Every entry has one main category and 0..* subcategories. This is my implementation: public class Entry extends AbstractEntity { [...] private Category mainCategory; @ManyToMany(targetEntity = hello.Category.class) private Set&lt;Category&gt; subCategories; [...] } public class Category extends AbstractEntity { [...] @ManyToMany(targetEntity = hello.Entry.class, mappedBy = "subCategories") private Set&lt;Entry&gt; entries; [...] } The ManyToMany relationship is functional but i don't know how to implement the OneToMany relationship.
upvote count: 2

http://stackoverflow.com/a/21070554
type: Answer
accepted answer of: http://stackoverflow.com/q/21070532
answers question: http://stackoverflow.com/q/21070532
score: 0
has comment: http://stackoverflow.com/comment/31687775
type: AcceptedAnswer
has body: You should be able to use the Thread.sleep() command to wait in between the calls to sendMessage. EDIT: However, keep in mind that it's not a good idea to call Thread.sleep() in the Android UI thread (which is the thread that click events run on). If you do this, the UI will lock up while the thread is sleeping. See this question: How to pause / sleep thread or process in Android? for more info on how to achieve this without locking up the UI thread.

http://stackoverflow.com/a/21067254
has comment: http://stackoverflow.com/comment/31681669
answers question: http://stackoverflow.com/q/21067214
type: Answer
upvote count: 7
has body: Download the x64 version since it's designed for the computer with your architecture. You have x86 Program Files folder only for application which can't run under 64bit environment. It's basically just backward compatibility.
score: 7
has comment: http://stackoverflow.com/comment/31681672
has comment: http://stackoverflow.com/comment/31681581
accepted answer of: http://stackoverflow.com/q/21067214
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21143209
has comment: http://stackoverflow.com/comment/31820469
has comment: http://stackoverflow.com/comment/31821816
downvote count: 0
linked to: http://stackoverflow.com/q/3649485
type: AnsweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/21151219
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/87295759
has comment: http://stackoverflow.com/comment/31822539
has comment: http://stackoverflow.com/comment/31821261
has body: I need to encrypt a string of 20-32 characters in my Android application, but the string generated have to be as small as possible, preferably 10-20 characters (max 32 characters anyhow). It's a necessary requirement for my app (doesn't matter the type of encryption). I have no knowledge about cryptography technics, it's my first time using Android Crypto APIs. I used this example as a start, it works but the generated string is too big. Can you tell me please what i have to change to that code to achieve this? Or can you provide me some tutorial about this? Note: I will mark as correct answer the answer with full code or link to a tutorial. Thanks! UPDATE: 1) The algorithms I was thinking to use are AES CBC or CFB-8. With this encryption the length of the generated string is 64. I wasn't been able reduce the length to 32. Can you suggest a way to do this? 2) The thing is this string gets encrypted on a java web app, written on a rfid tag and decrypted on the Android app. How can I manage the encryption keys? 3) I didn't find any implementation/tutorial of the FPE (Format-Preserving Encryption) algorithm. Can you provide me one? UPDATE 2: I've decided that I need a more simple algorithm because it's enough that an average user not being able to read the information on the rfid tag. But the requirement of max 32 characters generated remains. Suggestions? P.S. No matter what algorithm i tried in the above example and even if the input string had one letter, the size of the ciphertext was 64. (AES/ or DES/ CTR, CBC, ECB, CFB)
type: Question
tagged with: encryption
has title: How to encrypt string to a limited length string in Android
answer count: 1
accepted answer: http://stackoverflow.com/a/21151219
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/31839935
comment on: http://stackoverflow.com/a/21153482
has text: @user3196297 Without the `else if`, the same condition, `discriminant > 0`, which prints the line you expect, ensures the next `if` condition is false causing the line to be printed in the `else` clause. Adding the other `else` to form an `else if` turns these `if` statements into a three-way conditional which is what you appear to require in this sample code.
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/31625732
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21036135
type: AnswerComment
has text: Thank you every much i realize that i have to use the for-loop to print the string also. Much appreciated!

http://stackoverflow.com/comment/31950316
type: QuestionComment
type: Comment
has text: It is not clear from your text that you want to receive an array of `String`s from Java for use in C code; would you like to edit your question? Actually, there are two different scenarios: provide `String[]` parameter to a C function from Java, or use `searchDatabase()` method as a _callback_ from C code.
comment on: http://stackoverflow.com/q/21065390
score: 0

http://stackoverflow.com/comment/34847210
type: AnswerComment
comment on: http://stackoverflow.com/a/21060644
score: 0
has text: Thank you Avi, currently I can understand your meaning after I learned sping3.X again, both your comment and Roman's are correct. I'm wondering if I can mark all your answers right.
type: Comment

http://stackoverflow.com/q/21112438
has answer: http://stackoverflow.com/a/21112884
has title: Child method from superclass (java)
has answer: http://stackoverflow.com/a/21112659
has answer: http://stackoverflow.com/a/21112650
has body: I have a superclass, let's say BaseClass and two subclasses, let's say SubclassA and SubclassB, they don't have any other relationship between them but their parent class. At a lot of places in my code I need to call to methods that both the subclasses have but not the parentclass... And I find myself repeating a lot of code which looks like: if (obj instanceof SubclassA) { // stuff } else if (obj instanceof SubclassB) { // same stuff } The first idea should be to put that "stuff" into a method in superclass, but I can't as that superclass is parent to other subclasses that don't have that behavior... So... is there a way to avoid repeating aaaalll of that code? Maybe a common superclass for both subclasses that is a subclass itself of superclass?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21112751
tagged with: oop
tagged with: java
has answer: http://stackoverflow.com/a/21112615
type: Question
has answer: http://stackoverflow.com/a/21112751
possible better answer: http://stackoverflow.com/a/21112543
answer count: 6
tagged with: inheritance
has answer: http://stackoverflow.com/a/21112543
has comment: http://stackoverflow.com/comment/31764400
score: 0

http://stackoverflow.com/a/21117973
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21117823
has comment: http://stackoverflow.com/comment/31776787
has body: Your solution is optimal, you cannot do anything with the list faster than O(n) (because the problem requires reading all its elements), and your solution is O(n). Traversing 1.5 times (not 2.5 times - one iteration to the half, and one from the half to begining and from the halt to the end) is also very small constant. If you do not want to rebuild the string I am pretty sure that there is no faster solution (Although your solution consumes N/2 additonal space, but it is unavoidable if you have just one-directional list).
has comment: http://stackoverflow.com/comment/31775750

esb
tags question: http://stackoverflow.com/q/21141864
type: Tag
tags question: http://stackoverflow.com/q/21167348
tags question: http://stackoverflow.com/q/21144148
tag name: esb

http://stackoverflow.com/comment/31686033
type: Comment
has text: After having read all of your posts here a couple of times now I think you've already decided to switch to C/C++ (as it is the preferred language for game programming anyway). Here you will not have to deal with the single-class-inheritance limitation and will have more exclusive capabilities on using the computer hardware. Furthermore, you are already optimizing your code before it is even written. You care on the execution of 3 additional lines that are executed in almost no-op time - in my opinion not the best part to start with
comment on: http://stackoverflow.com/q/21068902
score: 0
type: QuestionComment

http://stackoverflow.com/q/21032996
tagged with: oop
has comment: http://stackoverflow.com/comment/31619658
tagged with: java
has answer: http://stackoverflow.com/a/21033148
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31619469
has body: First off I'm quite new to java. I'm trying to manipulate my code as much as I can to get a good understanding of it. The following code works perfectly, but when I try to move it into it's own construct (i think that's the right term) it fails. Also, the code is just of a small relevant portion. public static void main(Strings[] args) { Hero Player1 = new Hero(); Hero Player2 = new Hero(); Player2.takeDamage(Player1.giveDamage()); Player1.takeDamage(Player2.giveDamage()); } // Fails if: public static void main(Strings[] args) { Hero Player1 = new Hero(); Hero Player2 = new Hero(); combatPhase(); } private static void combatPhase() { Player2.takeDamage(Player1.giveDamage()); Player1.takeDamage(Player2.giveDamage()); } Basically it wants me to use Hero.takeDamage instead of Player1/2. Is there a fairly easy way to fix this so I can put it in combatPhase() to keep my code more organized?
has comment: http://stackoverflow.com/comment/31619569
has comment: http://stackoverflow.com/comment/31619479
score: -1
has title: Java - Can't access a class from the name alone
has answer: http://stackoverflow.com/a/21033235
has comment: http://stackoverflow.com/comment/31619587
accepted answer: http://stackoverflow.com/a/21033235
downvote count: 1
possible better answer: http://stackoverflow.com/a/21033148
favorite count: 0
upvote count: 0
has comment: http://stackoverflow.com/comment/31619492
type: AnsweredQuestion

http://stackoverflow.com/a/21154760
downvote count: 0
score: 1
has body: Heavily inspired by @sln's answer, I would like to offer the following solution: First - concatenate your user name and password into a single string, separated by a newline (assuming that newline does not otherwise occur in either user name or password; reasonable assumption, I think). Next, test the resulting string with the following expression: (?=(...).*\n.*\1) (See it at work here) How this works: (?= ) - positive lookahead: "somewhere we can match this" (...) - three consecutive characters - 'capture group'. We can refer to these as \1 .*\n - followed by "anything" up to a newline character .*\1 - followed by "anything" up to a repeat of the first match (the ...) This is going to try as hard as it can to find a match (that's what regex tries to do). If it succeeds, it means that there was a repeat of three consecutive characters that occurred before the \n in the part after the \n. So try to test for the above; if it succeeds, your "rule" was violated. edit - example of complete (tested, working) Java code: import java.io.*; import java.util.regex.Pattern; import java.util.regex.Matcher; class passwordTester { public static void main (String[] args) throws java.lang.Exception { String username="johnwatson@221bakerstreet.com"; String password = "youcantmakethisup"; String input = username + "\n" + password; System.out.println("testing " + input); Pattern p = Pattern.compile("(?=(...).*\\n.*\\1)"); Matcher m = p.matcher(input); if(m.find()) { System.out.println("the three character sequence '" + input.substring(m.start(), m.start()+3)+ "' was repeated"); } else System.out.println("the password is good"); } } Output: testing johnwatson@221bakerstreet.com youcantmakethisup the three character sequence 'ake' was repeated
upvote count: 1
answers question: http://stackoverflow.com/q/21149785
type: Answer

http://stackoverflow.com/a/21148859
upvote count: 2
answers question: http://stackoverflow.com/q/21148766
type: Answer
score: 2
downvote count: 0
has body: Read about Random.nextInt(int n) Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence Sample usage int rand = new Random().nextInt(3); System.out.println(i); In your case: Random randomGenerator = new Random(); for (int i = 0; i &lt; 10; i++){ int rand = randomGenerator.nextInt(3) + 1; if (rand == 1){ hand.takeCard(one); } else if (rand == 2){ hand.takeCard(two); } else if (rand == 3){ hand.takeCard(three); } }

http://stackoverflow.com/comment/31701032
has text: this is the piece of code at line 1353 : InputStream in = clientSocket.getInputStream(); DataInputStream clientData = new DataInputStream(in); String fileName = clientData.readUTF();
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21076554

http://stackoverflow.com/q/21140383
tagged with: selenium-webdriver
score: 2
downvote count: 0
tagged with: java
tagged with: selenium
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/27787122
has body: Specifically, when I supply a command and XPath to an object within a frame, the IDE can interact with the object without having to execute the "selectFrame" command. When I run the same sequence of commands within a WebDriver execution: | waitForVisible | target | | click | target | The WebDriver produces a stack trace indicating that the object is not visible and cannot be interacted with. I have to update my script with the additional step of: | selectFrame | frame | | waitForVisible | target | | click | target | Does the IDE use some kind of Javascript Injection similar to the RC to emulate the commands within the IDE?
answer count: 1
favorite count: 0
tagged with: xpath
tagged with: selenium-ide
has title: Why do Selenium IDE scripts I have refined behave differently within Selenium WebDriver executions?
type: UnansweredQuestion

http://stackoverflow.com/q/21058746
has comment: http://stackoverflow.com/comment/39341654
type: UnansweredQuestion
tagged with: android
score: 2
answer count: 0
upvote count: 2
tagged with: java
type: Question
tagged with: video-streaming
tagged with: sbt-android-plugin
has title: which players are used in vine app to play videos in android
has body: I would like to play videos to play videos in my android app like vine app. I have all the urls of videos like " http://swytchboard.s3.amazonaws.com/Videos/102_1378616771.mp4 ". How to play these videos efficiently. Thanks to all in advance, Have a happy coding.
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/31667902
comment on: http://stackoverflow.com/q/21059171
has text: you not using even a single xml file, only using xml free java config
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21181974
has comment: http://stackoverflow.com/comment/85105460
accepted answer of: http://stackoverflow.com/q/21179098
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/85110060
type: Answer
answers question: http://stackoverflow.com/q/21179098
has comment: http://stackoverflow.com/comment/31894319
has body: @WebParam maps a message part to a parameter, and parts can't be optional. See Optional Message Parts in WSDL. Therefore the short answer is that precisely what you're asking can't be done. But if you can refactor this method, you can use one of the approaches described below. Usually the optionality of a parameter is set via the schema minOccurs=0. Furthermore, instead of using multiple parameters you could define one Request parameter in your schema which you define as parameter for your WebMethod. The optionality is now encapsulated within the parameter and the same method is invoked for a call with or without the optional parameter(s). I prefer defining the contract first instead of relying on automatically generated files. Once you figured out how XSD, SOAP and WSDL play in-together, you hardly want to use annotation/code-first based definitions any longer as you are more flexible the other way around. Code-Example: &lt;xs:schema targetNamespace="http://your.namespace.com" xmlns:tns="http://your.namespace.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFromDefault="qualified" attributeFromDefault="qualified"&gt; ... &lt;xs:element name="MyRequest" type="tns:MyRequestType" /&gt; &lt;xs:element name="MyResponse" type="tns:MyResponseType" /&gt; &lt;xs:complexType name"MyRequestType"&gt; &lt;xs:sequence&gt; &lt;xs:element name="username" type="xs:string" minOccurs="1" maxOccurs="1" /&gt; &lt;xs:element name="password" type="xs:string" minOccurs="1" maxOccurs="1" /&gt; &lt;xs:element name="newParam" type="xs:string" minOccurs="0" maxOccurs="1" /&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; ... &lt;/xs:schema&gt; In your WSDL file you define the message like that: &lt;wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:msg="http://your.namespace.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soa…
has comment: http://stackoverflow.com/comment/84357421
has comment: http://stackoverflow.com/comment/85108333
upvote count: 17
has comment: http://stackoverflow.com/comment/31891604
score: 17
has comment: http://stackoverflow.com/comment/31899690

http://stackoverflow.com/a/37501730
upvote count: 2
has body: If you have an array of integers which are packed RGB values, this is the java code to save it to a file: int width = 100; int height = 100; int[] rgbs = buildRaster(width, height); DataBuffer rgbData = new DataBufferInt(rgbs, rgbs.length); WritableRaster raster = Raster.createPackedRaster(rgbData, width, height, width, new int[]{0xff0000, 0xff00, 0xff}, null); ColorModel colorModel = new DirectColorModel(24, 0xff0000, 0xff00, 0xff); BufferedImage img = new BufferedImage(colorModel, raster, false, null); String fname = "/tmp/whatI.png"; ImageIO.write(img, "png", new File(fname)); System.out.println("wrote to "+fname); The reason for the arrays 0xff0000, 0xff00, 0xff is that the RGB bytes are packed with blue in the least significant byte. If you pack your ints different, alter that array.
answers question: http://stackoverflow.com/q/21031316
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/21108953
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31758100
has comment: http://stackoverflow.com/comment/31758307
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31760151
score: 2
upvote count: 2
tagged with: maven
has answer: http://stackoverflow.com/a/21109464
has body: I'm using two jars A and B. B is a library and A has classes that uses some old classes from library B. Now this is causing me a problem when I include both jars in my project classpath as there are the same names of two classes but one of them is older than the other and behave differently. One solution to this problem I found is by first importing library B into Eclipse and then I click OK and the project builds. Then I add the jar A. This way all my existing code will use the newer versions of B and the classes of A will be untouched. However now I want to use Maven for my projects but I'm unable to know how to make this trick again using Maven. Please help.
has comment: http://stackoverflow.com/comment/31758516
type: Question
has title: Solving a jar hell with maven?
has comment: http://stackoverflow.com/comment/31758122
tagged with: java
tagged with: eclipse
answer count: 3
has answer: http://stackoverflow.com/a/21109152
has answer: http://stackoverflow.com/a/21109456
has comment: http://stackoverflow.com/comment/31758071
tagged with: jar

http://stackoverflow.com/comment/31792885
comment on: http://stackoverflow.com/a/21127683
type: Comment
has text: You have errors: You used class name instead of object name. You use wrong way to compare strings.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21129329
tagged with: jpanel
tagged with: image
has body: First, I'm sorry for my bad English. I know that my question is similar, maybe same as other people's, many poeple's question out there on internet.but I've tried many of them, but sill dont work. The simple is i dont know my fault. here's the cronology : I have 5 class, they're Game.java, Player.java, Menu.java, System.java, and Control.java. the Control class is a KeyListener class, so thats for controlling from keyboard. System class is the main class, to show the JFrame. Menu class is for menu, which show background and button. It has extends JPanel. Player class, of course for Player statistic. Game.java, is the heart of my project, because it control the gameplay. So, how I load my player's png. My structure is System call Menu, then Menu call Game(new game button), so then Game call Player class. But as I click new game button or press enter, there's nothing happen, the others is fine(loading background, exit button). System.java public class System extends JFrame{ private final int lebar=954; private final int tinggi=540; private static boolean[] kibod = new boolean[525]; public System(){ this.setTitle("Unknown man Unkown power"); this.setSize(new Dimension(lebar,tinggi)); this.setFocusable(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setResizable(false); this.setContentPane(new Menu()); this.addKeyListener(new Control()); this.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { // TODO Auto-generated method stub new Sistem(); } }); } } Menu.java public class Menu extends JPanel{ private int l=954; private int t=540; JButton menu1=new JButton("MULAI BARU"); JButton menu2=new JButton("KELUARRR"); public Menu(){ this.add(menu1); this.add(menu2); menu1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { new Game(); } }); menu2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEve…
has comment: http://stackoverflow.com/comment/31795763
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31795793
accepted answer: http://stackoverflow.com/a/21129583
has comment: http://stackoverflow.com/comment/31795782
score: 2
has comment: http://stackoverflow.com/comment/31795896
upvote count: 3
has title: Load png as sprite java
has answer: http://stackoverflow.com/a/21129583
tagged with: swing
downvote count: 1
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31795996
tagged with: java

storage
tag name: storage
tags question: http://stackoverflow.com/q/21073010
type: Tag

http://stackoverflow.com/comment/31824594
type: AnswerComment
has text: okey,by keeping `.add(Restrictions.eq("source.id", 2)` can you put your logger to `ERROR` level, may be u are missing some error as u said there is hundreds of such log statement.
comment on: http://stackoverflow.com/a/21143792
type: Comment
score: 0

http://stackoverflow.com/a/33359047
type: Answer
answers question: http://stackoverflow.com/q/21153746
upvote count: 1
has body: I used 3 classes. Lets go over theory first. We have two times: A and B. if AtimeDiff = (B-A).....which can be written -(A-B) if A>B, then timeDiff = 1440- (A-B) [1440 is total minutes in day] Thus we need to make timeDiff = 1440 - (A-B) and we need to make 1440 term dissapear when A Lets make a term X = (A-B+1440) / 1440 (notice "/" is integer division. 'if A 'if A>B then X = 1; Now look at a new term Y = 1440 * X. 'if A 'if A>B then Y = 1440'. PROBLEM SOLVED. Now just plug into Java Programs. Note what happens if A=B. Our program will assume we know no time passes if times are exact same time. It assumes that 24 hours have passed. Anyways check out the 3 programs listed below: Class #1 public class MilitaryTime { /** * MilitaryTime A time has a certain number of minutes passed at * certain time of day. * @param milTime The time in military format */ public MilitaryTime(String milTime){ int hours = Integer.parseInt(milTime.substring(0,2)); int minutes = Integer.parseInt(milTime.substring(2,4)); timeTotalMinutes = hours * 60 + minutes; } /** * Gets total minutes of a Military Time * @return gets total minutes in day at certain time */ public int getMinutes(){ return timeTotalMinutes; } private int timeTotalMinutes; } Class#2 public class TimeInterval { /** A Time Interval is amount of time that has passed between two times @param timeA first time @param timeB second time */ public TimeInterval(MilitaryTime timeA, MilitaryTime timeB){ // A will be shorthand for timeA and B for timeB // Notice if A&lt;B timeDifferential = TOTAL_MINUTES_IN_DAY - (A - B) // Notice if A&gt;B timeDifferential = - (A - B) // Both will use timeDifferential = TOTAL_MINUTES_IN_DAY - (A - B), // but we need to make TOTAL_MINUTES_IN_DAY dissapear when needed //Notice A&lt;B following term "x" is 1 and if A&gt;B then it is 0. int x = (timeA.getMinutes()-timeB.getMinutes()+TOTAL_MINUTES_IN_DAY) /TOTAL_MINUTES_IN_DAY; // Notice if A&lt;B then term "y" is TOTAL_MINUTES_IN_DAY(1440 min) // and if A&…
score: 1
downvote count: 0

http://stackoverflow.com/q/21033896
answer count: 3
tagged with: arrays
has answer: http://stackoverflow.com/a/21034984
possible better answer: http://stackoverflow.com/a/21033982
type: AnsweredQuestion
tagged with: declaration
has answer: http://stackoverflow.com/a/21033982
has answer: http://stackoverflow.com/a/21033986
score: 0
tagged with: java
has body: I am writing a program to find the average of an array as well as numbers larger than that average. I am trying to write this all in a method. However, I'm having a problem with the method declaration as I am being told that what I have is an illegal expression. What am I doing wrong? public class Average { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); public double average(double[] number) { int x = 0; double sum = 0; double[] numberList = new double[10]; //array to hold all numbers double[] largerList = new double[10]; //array to hold numbers greater than the average double[] smallerList = new double[10]; int averageIndex = 0; int largerIndex = 0; int smallerIndex = 0; Thank you
tagged with: methods
tagged with: average
type: Question
has title: Error in method declaration
accepted answer: http://stackoverflow.com/a/21033986

http://stackoverflow.com/comment/31661190
has text: @HotLicks so it becomes 10^-n?
comment on: http://stackoverflow.com/a/21055544
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/21157405
has comment: http://stackoverflow.com/comment/31846499
has comment: http://stackoverflow.com/comment/31846535
upvote count: 7
has comment: http://stackoverflow.com/comment/31846693
type: Answer
answers question: http://stackoverflow.com/q/21157343
has comment: http://stackoverflow.com/comment/31846391
has comment: http://stackoverflow.com/comment/31846423
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/31846606
has comment: http://stackoverflow.com/comment/31846600
has body: In Java you can't do this without a hack because C is a B not just an A. If you can do this in C++, it's a bad idea IMHO. This suggests your hierarchy is messed up and C should be only an A not a B. If you really have to do this you can add a method to B like this so you can bypass B.f(); protected void superF() { super.f(); } and call this from C. It is possible to generate the byte code using ASM to do this. The byte code allows you to call any level of parent, it is Java which does not.
has comment: http://stackoverflow.com/comment/31846571

http://stackoverflow.com/comment/31672807
has text: @SirRichie However the API doesn't make it clear whether a new copy is created or not for no whitespaces at the ends.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21062673

http://stackoverflow.com/q/21172847
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/31918842
answer count: 1
has comment: http://stackoverflow.com/comment/31905476
has comment: http://stackoverflow.com/comment/31997811
has answer: http://stackoverflow.com/a/21269278
has comment: http://stackoverflow.com/comment/31887752
tagged with: timestamp
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31887909
tagged with: java
tagged with: itext
has comment: http://stackoverflow.com/comment/32022307
type: Question
has body: I'm using iText 2.1.7 and BC 1.49 Even though I can signing and timestamping a file, when I open it with adobe reader I get a "timestamp authority not available" status (signature it's ok and reader tell me that the file is timestamped). Here is my code after when timestamping: ... byte[] tstoken = timeStampClient.getTimeStampToken(tsdata); Attribute signatureTimeStamp = new Attribute(PKCSObjectIdentifiers.id_aa_signatureTimeStampToken, new DERSet(ASN1Primitive.fromByteArray(tstoken))); SignerInformationStore signerStore = cmsSignedData.getSignerInfos(); ArrayList&lt;SignerInformation&gt; siArray = new ArrayList&lt;SignerInformation&gt;(); Iterator&lt;SignerInformation&gt; infos = signerStore.getSigners().iterator(); while (infos.hasNext()) { SignerInformation si = infos.next(); Hashtable&lt;ASN1ObjectIdentifier, Attribute&gt; unsignedAttrHash = si.getUnsignedAttributes().toHashtable(); unsignedAttrHash.put(PKCSObjectIdentifiers.id_aa_signatureTimeStampToken, signatureTimeStamp); siArray.add(SignerInformation.replaceUnsignedAttributes(si, new AttributeTable(unsignedAttrHash))); } SignerInformationStore newSignerStore = new SignerInformationStore(siArray); return CMSSignedData.replaceSigners(cmsSignedData, newSignerStore); ... The returned CmsSignedData (.getEncoded()) is what I embbed into pdf. I already test the TSA server and signer certificate using Acrobat and those are ok. Thank you in advance. -- Added -- Examples: My signed pdf Acro signed pdf (same cert, same tsa server)
accepted answer: http://stackoverflow.com/a/21269278
has title: Pdf timestamped signature: timestamp authority not available
has comment: http://stackoverflow.com/comment/31978749
score: 0

http://stackoverflow.com/q/21181840
has answer: http://stackoverflow.com/a/21182354
score: 0
tagged with: graphics2d
has answer: http://stackoverflow.com/a/21182216
accepted answer: http://stackoverflow.com/a/21182216
tagged with: swing
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21182354
tagged with: java
tagged with: keylistener
tagged with: rotation
answer count: 2
has body: I am currently experimenting with the Graphics2D and the KeyListener, and I am currently testing out rotating objects (in this case a pentagon). Now, it's working in the sense that it rotates, except it is supposed to rotate by 1 radian each time VK_RIGHT or VK_LEFT are pressed. However, currently it does that for the first key press only. From then on, it creates a pattern of rotating it by 1, 2, 3, 4, 5... and so on radians each time (the nth keypress rotates it by nth radians) instead of just 1 radian per keypress. Creating the JFrame: import javax.swing.JFrame; public class Main { public Main() { JFrame window = new JFrame("Rotating Hexagons"); window.setSize(800,600); window.setLocationRelativeTo(null); window.setResizable(false); window.setContentPane(new RotatingHexagon()); window.pack(); window.setVisible(true); } public static void main(String[]args) { new Main(); } } RotatingHexagon Class: import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Polygon; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JPanel; public class RotatingHexagon extends JPanel implements KeyListener { private Polygon poly; private int[] xpoints = { 0, -10, -7, 7, 10 }; private int[] ypoints = { -10, -2, 10, 10, -2 }; private int rotation = 0; public RotatingHexagon() { setPreferredSize(new Dimension(800,600)); setFocusable(true); requestFocus(); } public void init() { poly = new Polygon(xpoints, ypoints, xpoints.length); addKeyListener(this); } public void paint(Graphics g) { init(); Graphics2D g2d = (Graphics2D) g; int width = getSize().width; int height = getSize().height; g2d.setColor(Color.BLACK); g2d.fillRect(0, 0, width, height); g2d.setColor(Color.WHITE); g2d.drawString(rotation + " radians", 10, 20); g2d.translate(width / 2, height / 2); g2d.scale(20, 20); g2d.rotate(Math.toRadians(rotation)); g2d.setColor(new Color(255, 100, 100)); g2d.fill(poly); g2d.setColor(Color.WHITE)…
has title: Rotation with Graphics2D

http://stackoverflow.com/q/21152572
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2428186
has title: Convention on Classes Inside Methods
has comment: http://stackoverflow.com/comment/31838254
tagged with: java
duplicate of: http://stackoverflow.com/q/2428186
has answer: http://stackoverflow.com/a/21152617
has body: I recently came across some seemingly shocking code. For the years I have been programming with Java, never have I seen a class inside a method, yet the user said it was common practice. I tried checking the Oracle Code Conventions documents, but nothing pertaining to this popped up. The code, showing relevant parts, is below: public void start(){ //... class startListener implements ActionListener { public void actionPerformed(ActionEvent e) { started = true; } } panel.getStartButton().addActionListener(new startListener()); //... } These do seem to compile just fine What are the rules regarding classes inside methods?
type: Question
has comment: http://stackoverflow.com/comment/31838275
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31838330
accepted answer: http://stackoverflow.com/a/21152617
has comment: http://stackoverflow.com/comment/31838296
has answer: http://stackoverflow.com/a/21152673
tagged with: conventions
possible better answer: http://stackoverflow.com/a/21152673

http://stackoverflow.com/a/21067583
has body: you should change RunWeka.ini file in weka folders .you can use this solution to fix your problem: http://weka.8497.n7.nabble.com/Reading-utf8-arff-files-td15810.html
answers question: http://stackoverflow.com/q/21044511
accepted answer of: http://stackoverflow.com/q/21044511
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/31653212
has text: I believe that you need declare advices in your applicationContext.xml for propagate to the transactions
score: 0
comment on: http://stackoverflow.com/q/21051541
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31646170
score: 0
type: Comment
has text: In the meantime I will accept this answer. Definitely answered my question.
type: AnswerComment
comment on: http://stackoverflow.com/a/21046280

http://stackoverflow.com/a/21045812
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21045460
has body: The exception isnt occurring on the line String testCase = myEntries.get(i)[0]; but rather String username = myEntries.get(i)[1]; (as shown in the stacktrace) due to the fact that you're using semi-colon characters ; in the CSV file - only one token is being found for the whole line. OpenCSV's CSVReader uses a , separator by default. You could use CSVReader's overloaded constructor: CSVReader reader = new CSVReader(new FileReader("src/input/LoginTestInputFile.csv"), ';');
upvote count: 1
type: Answer

http://stackoverflow.com/a/25598116
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/21116916
type: Answer
has body: Apparently the HBase could not find JAVA_HOME and java binary although you can run java -version locally. You should run export JAVA_HOME=/the/path/of/you/jdk/ before running HBase. BTY, echo JAVA_HOME JAVA_HOME is incorrect. You may want echo $JAVA_HOME.
upvote count: 4

http://stackoverflow.com/a/21128293
answers question: http://stackoverflow.com/q/21128021
downvote count: 0
type: AcceptedAnswer
has body: First, the no-arg constructor is assumed by the compiler. That said, the main thing to remember about Java constructors is that once a constructor other than the no-arg constructor is defined, any subclasses must call it. So, since your parent class defined a constructor that takes two strings, your child class must invoke it. Your options are: Create a two-string constructor in the child class Create some other constructor in the child class, but must invoke the two-string constructor in the parent, Create a no-arg constructor in the parent class. (There are probably more exotic options, but those are the top three, I think) In code: 1: public class Monster extends Being { . . . public Monster(String n, String rce) { super(n, rce); } . . . } 2: public class Monster extends Being { . . . public Monster() { super("Default n", "Default rce"); // or // super(null, null); // or // super("Default n", null); // etc } . . . } 3: public abstract class Being { . . . public Being() { . . . } public Being(String n, String rce) { . . . } . . . } . . . public class Monster extends Being { . . . public Monster() { super(); } . . . } The point being that once you declare a constructor, subclasses must invoke it. I suppose you could remove the two-string constructor from your Being class, but that's really a design decision. HTH
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21128021

http://stackoverflow.com/comment/31844648
type: Comment
type: QuestionComment
has text: You set a global for mainPanel, yet you insist on using a local one in your constructor ... many things you do wrong, bro ...
comment on: http://stackoverflow.com/q/21137171
score: 0

http://stackoverflow.com/comment/31654494
type: QuestionComment
type: Comment
has text: Normal String comparison/index Of, ... is always faster than regex. Use regex when you have a pattern.
score: 0
comment on: http://stackoverflow.com/q/21052674

http://stackoverflow.com/comment/31640025
type: QuestionComment
score: 1
has text: Avoid using hard coded literals in conditional statements, declare those as static variables or private members.
comment on: http://stackoverflow.com/q/21045146
type: Comment

jboss6.x
tag name: jboss6.x
type: Tag
tags question: http://stackoverflow.com/q/21111701

http://stackoverflow.com/q/21032840
has answer: http://stackoverflow.com/a/21041738
score: 8
tagged with: android-bitmap
tagged with: bitmap
has title: Trying to scale down a Bitmap in Android not working
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21032951
type: Question
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/16408505
favorite count: 0
accepted answer: http://stackoverflow.com/a/21032951
upvote count: 8
possible better answer: http://stackoverflow.com/a/21041738
has body: I'm trying to scale down a bitmap. In short, the image is originally from a ByteArray with a width of 4016. After I scale the image down with factory options, it still reports the image with a width of 4016. Here are two clips of my code: Bitmap myBitmap = null; @Override protected byte[] doInBackground(Object... params) { final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; if (options.outHeight &gt; options.outWidth) { options.inSampleSize = calculateInSampleSize(options, 640, 960); } else { options.inSampleSize = calculateInSampleSize(options, 960, 640); } options.inJustDecodeBounds = false; //myImageByteArray is 4016 wide myBitmap = BitmapFactory.decodeByteArray(myImageByteArray, 0, myImageByteArray.length, options); //This log statement outputs 4016!!! Shouldn't it be smaller since I just decoded the byteArray with options? Log.d("bitmap", myBitmap.getWidth()+""); } public int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) { // Raw height and width of image final int height = options.outHeight; final int width = options.outWidth; int inSampleSize = 1; if (height &gt; reqHeight || width &gt; reqWidth) { // Calculate ratios of height and width to requested height and // width final int heightRatio = Math.round((float) height / (float) reqHeight); final int widthRatio = Math.round((float) width / (float) reqWidth); // Choose the smallest ratio as inSampleSize value, this will // guarantee // a final image with both dimensions larger than or equal to // the // requested height and width. inSampleSize = heightRatio &lt; widthRatio ? heightRatio : widthRatio; } return inSampleSize; } Update: Here are two clips of my code: Bitmap myBitmap = null; @Override protected byte[] doInBackground(Object... params) { final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; //myImageByteArray is 4016 wide myBitmap = BitmapFactory.decodeByteArray(myImag…
tagged with: android

http://stackoverflow.com/comment/31671146
comment on: http://stackoverflow.com/q/21061332
type: QuestionComment
has text: like so: curl -H -X POST --data 'eventId=value1&url=value' http ://localhost:8080/services/SnapEvent/getEncodedURL
score: 0
type: Comment

http://stackoverflow.com/q/21054483
accepted answer: http://stackoverflow.com/a/21054559
tagged with: java
has comment: http://stackoverflow.com/comment/31657663
type: Question
score: 0
answer count: 1
has title: Evaluation of && and || in an if statement
has body: I am a little bit confused right now... I am having an if statement which states: if(!(line[15].contains("Event_Index")) &amp;&amp; line[16].contains("1") &amp;&amp; line[18].contains("1") ) { if does not line 15 contains "Event Index" and line 16 does contain a 1 and line 18 does contain a one then go further. However the if should not be executet: if line 15 contains the string event index or line 16 does not contain a 1 or line 18 does not contain a 1. I wrote it like that: if( (!(line[15].contains("Event_Index"))) || !(line[16].contains("1")) &amp;&amp; !(line[18].contains("1")) ) { However that does not change anything. I appreciate your reply! UPDATE The if should be executed if: there is no "Event Index" String there is a 1 in line 16 there is a 1 in line 18
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31657771
has answer: http://stackoverflow.com/a/21054559

http://stackoverflow.com/q/21167410
has answer: http://stackoverflow.com/a/21168239
accepted answer: http://stackoverflow.com/a/21168239
has comment: http://stackoverflow.com/comment/31865612
favorite count: 0
has body: I am new on java. I am creating android application. I have create list menu based on a tutorial. The menu names comes from class name(MainActivity) however I would like to add title for each activity and show that text not activity name on list. please see my code. there is no layout. Thanks package com.x.xname; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; public class Menu extends ListActivity { String classes [] = {"MainActivity", "example1", "example2", "example3", "example4", "example5", "example6"}; // add class name(MainActivity) to active second menu @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setListAdapter(new ArrayAdapter&lt;String&gt;(Menu.this, android.R.layout.simple_list_item_1, classes)); } @Override protected void onListItemClick(ListView l, View v, int position, long id) { // TODO Auto-generated method stub super.onListItemClick(l, v, position, id); String tikla = classes [position]; try{ Class ourClass = Class.forName("com.x.xname." + tikla); Intent ourIntent = new Intent(Menu.this, ourClass); startActivity(ourIntent); } catch (ClassNotFoundException e){ e.printStackTrace(); } } }
has answer: http://stackoverflow.com/a/21168131
tagged with: android
has title: how can I define string arrays to a activity title at java?
downvote count: 4
type: AnsweredQuestion
upvote count: 0
tagged with: java
score: -4
has comment: http://stackoverflow.com/comment/31864447
type: Question
possible better answer: http://stackoverflow.com/a/21168131
answer count: 2

http://stackoverflow.com/comment/31802003
type: QuestionComment
comment on: http://stackoverflow.com/q/21132865
has text: Obfuscation and reflection are usually mutually exclusive. You can exclude selected classes from obfuscation to retain reflection-ability. Instead of classForName(), use class literals (e.g. Integer.class).
score: 1
type: Comment

http://stackoverflow.com/comment/31835756
score: 1
type: AnswerComment
type: Comment
has text: I understand your reservation, but from my experience you will need it, especially if you're app is going to get more complex than just one POST. There are plenty of "gotcha" problems with implementing background REST calls over HTTP. Granted, it's good to know what you're doing and not use 3rd party libraries as a crutch, but in this case you'll be turning to the experts. For example, here is a SO post on different methods for running the background task
comment on: http://stackoverflow.com/a/21150759

http://stackoverflow.com/comment/31842472
type: QuestionComment
has text: Aside from that, the code you post is **broken** because it's not comparing `String`s correctly. It's using `==` which compares *reference values*
comment on: http://stackoverflow.com/q/21155007
score: 0
type: Comment

http://stackoverflow.com/q/21120454
has body: my first question. lets say i have arraylist of strings in java ArrayList&lt;string&gt; s= new ArrayList&lt;string&gt;; and it contains sorted list by size. s.add("ab"); s.add("abc"); s.add("aab"); s.add("baab"); s.add("abcd"); what i want to do is, iterate the list and pick group of elements which has same length and put into seprate array of arrays. Group 1 ab Group 2 abc,aab and so on... i am doing this in java please help
has answer: http://stackoverflow.com/a/21121206
type: AnsweredQuestion
tagged with: list
possible better answer: http://stackoverflow.com/a/21121206
has comment: http://stackoverflow.com/comment/31779258
has title: parse array and extract string of same length
tagged with: java
has answer: http://stackoverflow.com/a/21120695
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/31779280
score: 0
accepted answer: http://stackoverflow.com/a/21120695
answer count: 2

http://stackoverflow.com/comment/31894676
comment on: http://stackoverflow.com/q/21183805
score: 0
type: Comment
type: QuestionComment
has text: BTW: What i missed. Why are defining the output directory to be the `src` folder which is usually under version control. Which does not make sense. Apart from that the tag `<action>` and `<ignore/>` do not belong there.

http://stackoverflow.com/comment/31755717
score: 0
has text: I can't get the output right. Every time I use \n there would be no column only rows. if I don't use \n I have the column and the row but the output would be -| |-
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21107402

http://stackoverflow.com/a/27144043
answers question: http://stackoverflow.com/q/21151539
score: -1
type: Answer
has body: What I understood from your code is, your culprit is the following line: for(int i = 0;i == (totalNumbers-1); i++){ System.out.println("Enter the Next Number"); numbers[i] = scan.nextInt(); } The loop will not execute unless and until you have totalNumbers = 1. Only then, you'll have i = totalNumbers - 1 = (1 -1) = 0, which satisfies the condition i == (totalNumbers - 1) inside your loop. This is the reason you can input only 1 number; if you have totalNumbers value other than 1, the loop will not execute and your program will terminate. The way you wrote the for loop condition is not correct. Rather, you should write like this: for(int i = 0;i &lt;= (totalNumbers-1); i++){ //do your work here } Write the for loop in the above way in both loops in your question.
has comment: http://stackoverflow.com/comment/42790269
downvote count: 1
upvote count: 0

http://stackoverflow.com/comment/31715004
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21079490
has text: Could you paste your jrxml here? It would be easier to debug the error.

key-value
tags question: http://stackoverflow.com/q/21168185
tag name: key-value
type: Tag

http://stackoverflow.com/a/21086005
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31716264
score: 2
upvote count: 2
has body: I find it easier to think about a as being the same variable that gets repeatedly created and destroyed.
answers question: http://stackoverflow.com/q/21085963
has comment: http://stackoverflow.com/comment/31716065

http://stackoverflow.com/comment/31749950
has text: His code does not show use of the variables outside of the if, hence why I said they don't need to be initialized. in your example, however they do.
type: Comment
comment on: http://stackoverflow.com/a/21103913
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31647728
type: Comment
comment on: http://stackoverflow.com/a/21044636
has text: @Phantrast Great! If you can find a better solution, please post it here. If not, please consider accepting my answer.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21048800
has title: Silly Example of a Deserialisation Attack
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/21048945
has answer: http://stackoverflow.com/a/21053335
downvote count: 0
tagged with: security
answer count: 2
tagged with: deserialization
accepted answer: http://stackoverflow.com/a/21053335
favorite count: 0
tagged with: serialization
tagged with: exploit
has body: I'm trying to understand a deserialisation attack, so I have thought of this example, if you could correct me if I have misunderstood something, that would be helpful. I have this fiction class. public class Player{ String name; int attackStrength; public Player(String name){ this.name = name; this.attackStrength = Random.nextInt(10); } } If I serialised this class It would provide me with a byte array that represented the object instance and its internal values (name, attackStrength). This fiction class randomly creates an attack strength with a max value of 10. If I edited the byte array and read back in. I could modify the bytes that represent attackStrength to 50! and then DeSerialise the array and I now have a hacked character. Is this the idea behind this form of attack.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21048945
score: 1
tagged with: java

http://stackoverflow.com/a/21187756
type: Answer
answers question: http://stackoverflow.com/q/21148777
upvote count: 1
has comment: http://stackoverflow.com/comment/31909220
score: 1
has body: My first guess is that installing the Apple Java messed up the Oracle installation. Try reinstalling that one. Secondly you probably need to get Eclipse to use Oracle's JDK at startup. You can do that from the command line using the "-vm" parameter or patch the JDK's Info.plist as described in this post Eclipse Kepler for OS X Mavericks request Java SE 6.
has comment: http://stackoverflow.com/comment/32117123
downvote count: 0
has comment: http://stackoverflow.com/comment/32032281
has comment: http://stackoverflow.com/comment/32048642

http://stackoverflow.com/q/21164878
has answer: http://stackoverflow.com/a/22618314
has body: How to upload files from Android to Google App Engine Blobstore using Mobile Backend Starter or Google Cloud Endpoints?
upvote count: 3
tagged with: java
has title: Mobile Backend Starter - Upload to AppEngine Blobstore
type: Question
downvote count: 0
tagged with: blobstore
score: 3
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: android
tagged with: google-cloud-endpoints

http://stackoverflow.com/q/21161856
tagged with: newrelic
accepted answer: http://stackoverflow.com/a/21163576
has body: I am deploying java apps to Cloud Foundry v1 as a war files. Cloud Foundry takes my WAR, adds it to tomcat during staging and run this tomcat with my app somewhere on DEA host. And instead of packing newrelic.jar and newrelic.yml to war file, I would prefer them to be already in Cloud Foundry's tomcat. But in such a case all deployments will have same newrelic.yml, and thus I need some way to specify correct application name dynamically instead of statically set in newrelic.yml. Is there any option for this? I have possibility to set environment variables during deployment, if they can be used in some way. Or maybe there is an option to modify newrelic.jar to add dependency on Cloud Foundry runtime to get app name? Could you please suggest some way?
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
tagged with: cloud
answer count: 1
downvote count: 0
favorite count: 0
has title: NewRelic dynamic java application name
has answer: http://stackoverflow.com/a/21163576
score: 3

http://stackoverflow.com/q/21166156
has answer: http://stackoverflow.com/a/21166291
has comment: http://stackoverflow.com/comment/140224632
type: Question
tagged with: jodatime
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/21166291
has comment: http://stackoverflow.com/comment/140224625
favorite count: 0
has title: Calendar.getTime() return different Date objects
has body: I have some code witch Converts Joda- DateTime to java.util.Date using Calendar. Calendar cal = Calendar.getInstance(zone.toTimeZone()); DateTime zonedDT = internal.toDateTime(zone); // Due to JDK and Joda-Time both have time zone implementations and these differ in accuracy. // Joda-Time's implementation is generally more up to date and thus more accurate - for example JDK1.3 has no historical data. // The effect of this is that the field values of the Calendar may differ from those of this object, even though the millisecond value is the same. // Most of the time this just means that the JDK field values are wrong, as our time zone information is more up to date // That's why we should manually set date,year, time to calendar cal.set(zonedDT.getYear(), zonedDT.getMonthOfYear() - 1, zonedDT.getDayOfMonth(), zonedDT.getHourOfDay(), zonedDT.getMinuteOfHour(), zonedDT.getSecondOfMinute()); return cal.getTime(); The problem is that there is a difference between Date instances created in such way in milliseconds. I have tryed in Intellij Idea using code framgent evaluation this code Calendar cal = Calendar.getInstance(); cal.set(2014,3,18,14,44,32); cal.getTime() and it returns different Date. Difference is in milliseconds. My OS is Windwos. jdk 1.7.0_25
possible better answer: http://stackoverflow.com/a/79511771
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/79511771
score: 1
tagged with: java
upvote count: 1
tagged with: calendar

http://stackoverflow.com/a/21132833
type: Answer
accepted answer of: http://stackoverflow.com/q/21130705
score: 2
answers question: http://stackoverflow.com/q/21130705
has body: Is there any way to set java.awt.Image in ImageView? Short answer: No. You can't use Image, BufferedImage (java.awt package) or ImageIO (javax.imageio package) from Android. So I'm guessing the error you see is related to that. Maybe if you try to ask how to achieve your goal, rather than this specific implementation issue, maybe we could help you further. :-)
upvote count: 2
type: AcceptedAnswer
downvote count: 0

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/21087047
tags question: http://stackoverflow.com/q/21129743
type: Tag
tags question: http://stackoverflow.com/q/21091924
tags question: http://stackoverflow.com/q/21131689

http://stackoverflow.com/comment/31606332
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21025712
has text: yeah i just thought i could use just the repaint() to do the job on there, but it seems like its not working. thanks anyway

http://stackoverflow.com/a/21124621
answers question: http://stackoverflow.com/q/21028287
type: Answer
score: 2
upvote count: 2
downvote count: 0
has body: The Row_Number() function is one of the best options to use, but the FETCH FIRST N ROWS syntax is not necessary when using it since you already are doing most of the work to generate the row_number(), so you can just use it to filter down to the rows you want using the row_number value. Aside from that option, I think the first option you listed that you already tried is the best alternative (concatenating the number into the query string). Assuming you have proper indexing. (without indexing, the row_number option is always better). So IF you can get the correct index on the table: Since you're working in Java, you could still avoid SQL injection and build your query dynamically by appending an integer into the query into the "Fetch first N rows only". The one downside to that strategy is that the dynamic statement cache will have to cache one version of the code per page, and you'll have extra DAO code to spin to the right starting point (page - 1 * items per page). As long as you are using a numeric data type, SQL injection should not be possible: private static final String SQL_FETCH_NEXT = "" + " SELECT ID, NAME, AGE " + " FROM DATABASE1.TABLE1 PERSON " + " ORDER BY ID, AGE "; private static Object runQuery(int pageNum, String filterText) { //boilerplate code skipped String sql = SQL_FETCH_NEXT + " fetch first " + pageNum * VALUES_PER_PAGE + " rows only "; //the rest of the method } In this case the FETCH FIRST N ROWS syntax would be warranted for one reason: Sort avoidance, and avoiding a materialization of the results. The sort will likely be the biggest cost to your original query, and using ROW_NUMBER will force you to materialize the whole result set to sort and assign row numbers. Avoiding the sort would require an index on ID, and AGE (in the same order as your order by statement). Or if you have filters, you'd have to have them first on the index, and then your ordering columns. The reason this would work is that the database engine would use the index …

http://stackoverflow.com/comment/31759828
type: Comment
type: QuestionComment
has text: when you added the url as an "update site" and installed the plugins that where found there, than yes! Short question though, why don't you have tried to use the plugin?!
comment on: http://stackoverflow.com/q/21109871
score: 0

http://stackoverflow.com/q/21075853
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/31697247
tagged with: cmd
has body: I want to use cmd Commands in java program, Want to crope all images in folder, I downlaoded ImageMagick, and using cmd commands Its working 1 image, cd C:\Users\Robert\Java-workspace\Crop_test\Crop_test1 cd convert -crop 312x312+0-10 image1.jpg new_image1.jpg But, I want to use this in Java so, I can crop all images in folder by program, Here is my java program: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import org.omg.CORBA.portable.OutputStream; public class test1 { public static void main(String argv[]) throws IOException, InterruptedException { ProcessBuilder pb = new ProcessBuilder("cmd", "/c", "C:\\Users\\Robert\\Java-workspace\\Crop_test\\Crop_test1\\", "convert -crop 312x312+0-10 image1.jpg new_image1.jpg"); Process p = pb.start(); p.waitFor(); } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31697174
linked to: http://stackoverflow.com/q/15464111
has title: How I can use CMD Command in Java program?
has comment: http://stackoverflow.com/comment/31702743
has comment: http://stackoverflow.com/comment/31697230
has answer: http://stackoverflow.com/a/21076032
tagged with: java
has comment: http://stackoverflow.com/comment/31697324
has answer: http://stackoverflow.com/a/21075934
type: Question
has answer: http://stackoverflow.com/a/21076013
has comment: http://stackoverflow.com/comment/31697049
has comment: http://stackoverflow.com/comment/31697369

http://stackoverflow.com/comment/31848185
has text: @kleopatra : added the department and employee class
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21111419
score: 0

http://stackoverflow.com/q/21161416
has comment: http://stackoverflow.com/comment/31854442
downvote count: 1
has answer: http://stackoverflow.com/a/21161786
type: Question
has comment: http://stackoverflow.com/comment/31853731
type: AnsweredQuestion
tagged with: algorithm
tagged with: java
has answer: http://stackoverflow.com/a/21167290
possible better answer: http://stackoverflow.com/a/21161786
answer count: 6
upvote count: 4
has answer: http://stackoverflow.com/a/21161743
has comment: http://stackoverflow.com/comment/31854075
has comment: http://stackoverflow.com/comment/31854462
tagged with: path-finding
score: 3
has comment: http://stackoverflow.com/comment/31861273
has comment: http://stackoverflow.com/comment/31853390
has comment: http://stackoverflow.com/comment/31854096
has answer: http://stackoverflow.com/a/21163115
has answer: http://stackoverflow.com/a/21162021
has body: I'm a student and me and my team have to make a simulation of student's behaviour in a campus (like making "groups of friends") walking etc. For finding path that student has to go, I used A* algorithm (as I found out that its one of fastest path-finding algorithms). Unfortunately our simulation doesn't run fluently (it takes like 1-2 sec between successive iterations). I wanted to optimize the algorithm but I don't have any idea what I can do more. Can you guys help me out and share with me information if its possible to optimize my A* algorithm? Here goes code: public LinkedList&lt;Field&gt; getPath(Field start, Field exit) { LinkedList&lt;Field&gt; foundPath = new LinkedList&lt;Field&gt;(); LinkedList&lt;Field&gt; opensList= new LinkedList&lt;Field&gt;(); LinkedList&lt;Field&gt; closedList= new LinkedList&lt;Field&gt;(); Hashtable&lt;Field, Integer&gt; gscore = new Hashtable&lt;Field, Integer&gt;(); Hashtable&lt;Field, Field&gt; cameFrom = new Hashtable&lt;Field, Field&gt;(); Field x = new Field(); gscore.put(start, 0); opensList.add(start); while(!opensList.isEmpty()){ int min = -1; //searching for minimal F score for(Field f : opensList){ if(min==-1){ min = gscore.get(f)+getH(f,exit); x = f; }else{ int currf = gscore.get(f)+getH(f,exit); if(min &gt; currf){ min = currf; x = f; } } } if(x == exit){ //path reconstruction Field curr = exit; while(curr != start){ foundPath.addFirst(curr); curr = cameFrom.get(curr); } return foundPath; } opensList.remove(x); closedList.add(x); for(Field y : x.getNeighbourhood()){ if(!(y.getType()==FieldTypes.PAVEMENT ||y.getType() == FieldTypes.GRASS) || closedList.contains(y) || !(y.getStudent()==null)) { continue; } int tentGScore = gscore.get(x) + getDist(x,y); boolean distIsBetter = false; if(!opensList.contains(y)){ opensList.add(y); distIsBetter = true; }else if(tentGScore &lt; gscore.get(y)){ distIsBetter = true; } if(distIsBetter){ cameFrom.put(y, x); gscore.put(y, tentGScore); } } } return foundPath; } private int getH(Fiel…
favorite count: 0
has answer: http://stackoverflow.com/a/32010630
tagged with: a-star
accepted answer: http://stackoverflow.com/a/21162021
has title: A* (A star) algorithm optimization

http://stackoverflow.com/a/21144659
type: Answer
answers question: http://stackoverflow.com/q/21144550
has body: No, my friend ++value is equivalent to value=value+1 as it is changing the new value preincrement operator and value++ is changing the old value which is kept in the memory i.e. post incrementing it
score: 0

http://stackoverflow.com/comment/31661557
has text: 1) For Swing, typically use key bindings over the AWT based, lower level, `KeyListener`. See [How to Use Key Bindings](http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html) for details on how to use them. 2) `Thread.sleep(delay);` Use a Swing `Timer`. Don't block the Event Dispatch Thread.
comment on: http://stackoverflow.com/q/21056188
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21119390
has comment: http://stackoverflow.com/comment/31778841
type: Answer
answers question: http://stackoverflow.com/q/21118771
accepted answer of: http://stackoverflow.com/q/21118771
has body: If you ignore curvature (and use a square box) you could do it a lot more efficiently in a single query, something like: query = "SELECT TYPE FROM GPS WHERE NAME='"+name+"' AND TYPE='"+type+"' AND X &lt; x+1 AND X &gt; x-1 AND Y &lt; y+1 AND Y &gt; y-1; If need be, you can then iterate through the result set and filter out pois in the box that wouldn't be in a circle with some maths.
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/31896295
has text: Haha. Indeed. With your help I no longer lack it. Thank you! :)
type: AnswerComment
comment on: http://stackoverflow.com/a/21182655
type: Comment
score: 1

http://stackoverflow.com/q/21051128
has body: Please forgive me, as I am a Java man dabbling in Javascript business :) I wanted to be able to define a set of integration test cases to be easy to script against a Java application. I thought Javascript would be a perfect language to script against. To that end, I am using the Rhino engine that comes with JDK 7, via Java's Scripting API. The scripts would have access to Java classes already defined in the application, and could be reused to define use case scenarios for integration testing. In the Java application, I have binded the javascript engine itself to the script as jsengine, so that I can load javascript files (Including a JavaScript file during Rhino eval). I have two Javascript files, as defined below: Function.js: function send(msg) { send.sendMessage(msg); } TestCase.js jsengine.eval(new java.io.FileReader("Function.js"); sendMsg("Test Message"); I also have the following object defined and binded to the script as "javaobj": public class TestConnection { ... public void send(String message) { // Code to send the string message via JMS } } However, the Rhino engine complains with the following Exception. It seems to not like calling the javaobj's send method, for some reason. javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot find function send in object function sendMsg(msg) {...}. (TestCase.js#3) in TestCase.js at line number 3 at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:224) at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:212) at com.foo.test.scenario.JavaScriptEngine.execute(JavaScriptEngine.java:56) at com.foo.test.TestSuite.start(TestSuite.java:88) at com.foo.test.TestSuite.main(TestSuite.java:41) Caused by: sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot find function send in object function sendMsg(msg) {...}. (TestCase.js#3) in TestCase.js at line number 3 at sun.org.mozilla.javascript.internal.ScriptRuntime.constructError(ScriptRunt…
has comment: http://stackoverflow.com/comment/31652641
type: UnansweredQuestion
score: 1
upvote count: 1
has title: Why does Rhino Javascript engine complain a function does not exist?
tagged with: rhino
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/12357334
linked to: http://stackoverflow.com/q/18634585
has answer: http://stackoverflow.com/a/21054931
answer count: 1
downvote count: 0
tagged with: javascript
favorite count: 0

http://stackoverflow.com/q/21170743
has answer: http://stackoverflow.com/a/21170802
answer count: 6
score: -1
has body: Hey I want to compare my own objects so that i can sort them inside my arrayList, my object has 3 fields, one of them is int my comparator code looks like public class ImageComparator implements Comparator&lt;Obj&gt; { @Override public int compare(Obj 1, Obj 2) { return 1.Id &gt; 2.Id ? 1 : 0; } } Collections.sort(myList, new ImageComparator()); What am I doing wrong?
has title: Java custom comparator does not work
has comment: http://stackoverflow.com/comment/31870649
has comment: http://stackoverflow.com/comment/31870803
has comment: http://stackoverflow.com/comment/31870645
has answer: http://stackoverflow.com/a/21170861
has comment: http://stackoverflow.com/comment/31870678
favorite count: 0
has answer: http://stackoverflow.com/a/21171038
possible better answer: http://stackoverflow.com/a/21170798
has answer: http://stackoverflow.com/a/21170803
has answer: http://stackoverflow.com/a/21170798
tagged with: java
downvote count: 2
accepted answer: http://stackoverflow.com/a/21171038
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31870676
has answer: http://stackoverflow.com/a/21170859
type: AnsweredQuestion

http://stackoverflow.com/q/21108994
favorite count: 0
tagged with: windows
has body: I'm building an application for multiple desktop platforms: Windows, Mac, and maybe later for Linux. I was wondering which programming language and IDE combination would be the best for me: Programming language need to be whether C# (preferred) or Java. Core libraries must be shared between all platforms, means all platforms must link to a single core library (by library I mean a list of classes and functions). Windows and Mac are in priority, Linux app is for future plannings. Design of the app is completely custom, it doesn't follow any guidelines of each platforms. I'm stuck between these three solutions: Use Xamarin.Mac + Visual Studio for Windows and link the core classes between them. Use GTK# for the whole project and compile multiple builds for each platforms. Use Java for the whole project and compile multiple builds for each platforms. For #2 and #3, I need an advice that which language is more suitable for me, considering the design of my application. I mean, which one has a better GUI building ability for my goal? BTW GTK# uses different libraries for each platforms, so that should be an clutter for my core architecture, or not?!
possible better answer: http://stackoverflow.com/a/21110356
tagged with: macos
has answer: http://stackoverflow.com/a/21110356
has title: Cross Platform Desktop Application - Windows+Mac+Linux
linked to: http://stackoverflow.com/q/29966093
has answer: http://stackoverflow.com/a/22277119
tagged with: cross-platform
score: 23
type: AnsweredQuestion
tagged with: c#
has answer: http://stackoverflow.com/a/61905769
has answer: http://stackoverflow.com/a/22276069
tagged with: java
has answer: http://stackoverflow.com/a/64951793
has answer: http://stackoverflow.com/a/60301080
upvote count: 25
type: Question
downvote count: 2
answer count: 7
has answer: http://stackoverflow.com/a/43885668
accepted answer: http://stackoverflow.com/a/43885668

http://stackoverflow.com/a/21122327
has body: You need a component to paint on, like a JPanel. You need to @Override its paintComponent method You can use a loop to paint using Graphics context Use a flag to alternate between colors. Take a look at some Painting Graphics tutorials In the mean time, give this a whirl import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class Board extends JPanel { private static final int DIM_WIDTH = 640; private static final int DIM_HEIGHT = 640; private static final int SQ_SIZE = 80; boolean black = true; @Override protected void paintComponent(Graphics g) { super.paintComponent(g); for (int i = 0; i &lt; DIM_HEIGHT; i += SQ_SIZE) { if (black) { black = false; } else { black = true; } for (int j = 0; j &lt; DIM_WIDTH; j += SQ_SIZE) { if (black) { g.setColor(Color.WHITE); g.fillRect(j, i, SQ_SIZE, SQ_SIZE); black = false; } else { g.setColor(Color.BLACK); g.fillRect(j, i, SQ_SIZE, SQ_SIZE); black = true; } } } } public static void createAndShowGui() { JFrame frame = new JFrame(); frame.add(new Board()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationByPlatform(true); frame.pack(); frame.setVisible(true); } public Dimension getPreferredSize() { return new Dimension(DIM_WIDTH, DIM_HEIGHT); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGui(); } }); } }
has comment: http://stackoverflow.com/comment/31783087
type: Answer
upvote count: 5
answers question: http://stackoverflow.com/q/21121859
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21121859
has comment: http://stackoverflow.com/comment/31782926
has comment: http://stackoverflow.com/comment/31783153
has comment: http://stackoverflow.com/comment/31783004
has comment: http://stackoverflow.com/comment/31783249
score: 5
type: AcceptedAnswer

http://stackoverflow.com/comment/31752224
type: AnswerComment
score: 0
type: Comment
has text: so a `repaint()` has be to called explicitly, if I want my frame to be `redrawn`.?
comment on: http://stackoverflow.com/a/21104884

http://stackoverflow.com/comment/31689468
has text: @anthraxX: Now looking at the full code, I'm not convinced it'd compile, let alone be debuggable. Further to that point, there are some great resources out there that go over how to use a debugger, and I would strongly encourage you to look into them.
score: 0
comment on: http://stackoverflow.com/q/21071445
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31769664
has text: Why don't you have a constructor with city?
comment on: http://stackoverflow.com/q/21115354
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31848358
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/21158240
has text: @Stanley But a new BufferedWriter will get initialised to the same file everytime the method is called. Also when it finishes the recursion if the "path" at the root has just one directory, it will not write anything to it and will flush out an empty file. Maybe you should pass the BufferedWriter in the recursive call so that the same writer instance is used by all the recursive calls.
type: Comment

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/21178268
tags question: http://stackoverflow.com/q/21132055
tags question: http://stackoverflow.com/q/21139839
tags question: http://stackoverflow.com/q/21138731
tags question: http://stackoverflow.com/q/21086143
tags question: http://stackoverflow.com/q/21059403
tags question: http://stackoverflow.com/q/21021502
type: Tag

http://stackoverflow.com/comment/31705200
has text: @SuzanCioc You can hide it with the little button on the top right.
comment on: http://stackoverflow.com/a/21079510
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21027434
linked to: http://stackoverflow.com/q/21026786
upvote count: 3
accepted answer: http://stackoverflow.com/a/21027527
linked to: http://stackoverflow.com/q/3656371
has answer: http://stackoverflow.com/a/21027598
type: Question
score: 3
duplicate of: http://stackoverflow.com/q/3656371
has answer: http://stackoverflow.com/a/21027627
possible better answer: http://stackoverflow.com/a/21027748
has answer: http://stackoverflow.com/a/21027748
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31609079
downvote count: 0
tagged with: string
favorite count: 0
answer count: 5
has body: Please see my previous question here for the full code. In case I want to internationalize my app, I need to create string objects for some statements in my project. The one bothering me most is this code block. ... else Toast.makeText(MainActivity.this, "Good job! The answer was " + comp + ".\n" + "You made " + guesses + " guesses.\n" + "Restart the app to try again.", Toast.LENGTH_LONG).show(); } }; The relative part to this in the strings.xml looks like: Good job! The answer was + comp\n You made + guesses + guesses.\n Restart the app to try again. I want the comp and guesses variables to show their respective values, but I don't know how. I plan to do this to the code block ... else Toast.makeText(MainActivity.this, R.string.correct, Toast.LENGTH_LONG).show(); } }; Thank you.
tagged with: android
has answer: http://stackoverflow.com/a/21027534
has comment: http://stackoverflow.com/comment/31608970
has answer: http://stackoverflow.com/a/21027527
has title: Call variables in string.xml
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion

http://stackoverflow.com/a/21058198
upvote count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31664817
has comment: http://stackoverflow.com/comment/81203411
type: Answer
has body: You only need one line... well less than one line actually: if (str.matches("((.)(?!.*\\1))*")) this uses a negative look ahead to assert that each character is not repeated later in the string. This approach a time complexity of O(n^2), because for all n characters in the input, all characters that follow (there are n of those) are compared for equality.
score: 3
has comment: http://stackoverflow.com/comment/81197487
has comment: http://stackoverflow.com/comment/31665285
answers question: http://stackoverflow.com/q/21057827
has comment: http://stackoverflow.com/comment/31664906
has comment: http://stackoverflow.com/comment/80670061

http://stackoverflow.com/q/21066845
has answer: http://stackoverflow.com/a/21067032
has comment: http://stackoverflow.com/comment/31680971
has answer: http://stackoverflow.com/a/21067004
answer count: 2
downvote count: 0
tagged with: generics
favorite count: 0
accepted answer: http://stackoverflow.com/a/21067004
has comment: http://stackoverflow.com/comment/31680560
type: AnsweredQuestion
tagged with: linked-list
score: 1
tagged with: java
upvote count: 1
has title: How to find the size of a generic singly-linked list in java
type: Question
has body: I am having trouble finding out the size of a generic singly-linked list in java. Here is my code (below I will explain how I tried to find it out and what difficulties I encountered): class List&lt;T&gt; { /** * An immutable singly-linked list. * @param &lt;T&gt; the type of the list elements */ T head; List&lt;T&gt; tail; List(T head, List&lt;T&gt; tail) { this.head = head; this.tail = tail; } /** Generic helper function for list creation. You DO NOT NEED to call this function. */ static &lt;U&gt; List&lt;U&gt; node(U head, List&lt;U&gt; tail) { return new List&lt;U&gt;(head, tail); } /* Getters and Setters for the head and the tail; */ public List&lt;T&gt; getTail() { return tail; } public void setTail(List&lt;T&gt; tail) { this.tail = tail; } public T getHead() { return head; } public void setHead(T head) { this.head = head; } I tried to find out the size like this: loop through the elements of the linked list, beninning with the first element, until the "next" pointer shows null. increment the helper variable size. Code: public int size(){ int size = 0; T temp = head; while (temp.getTail() != null) { temp = temp.getTail(); size++; } return size; } The problem is temp.getTail(). Eclipse is asking in this specific case to cast the variable temp to List&lt;T&gt;. But this makes for me no sense, hence List&lt;T&gt; should be just like a "next" pointer to the next element of the list. Could somebody please be so kind and explin what I'm doing wrong and how I could solve this. I am really trying to understand generics (I also read a lot about generics but still can't seem to figure out how to handle this kind of situation). I will use this list in my test class: List&lt;Integer&gt; coins = List.node(1, List.node(2, List.node(5, List.node(10, List.node(20, List.node(50, List.node(100, List.node(200, null)))))))); I will recursively calculate the number of possible coin combinations (the values 1, 2, 5, 10, 20, 50, 100 and 200) given an EURO amount.
possible better answer: http://stackoverflow.com/a/21067032

http://stackoverflow.com/q/21029527
tagged with: cryptography
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31614749
score: 11
upvote count: 11
tagged with: java
has answer: http://stackoverflow.com/a/32755954
has body: I thought it was simple where JCA was a replacement for JCE. However writing some test code to get all the providers on my system showed this isn't the case. I noticed the following: Some algorithms have multiple providers (eg: MD5withRSA is in SunRsaSign as well as SunJSSE) JCA seems to have type of algorithms that go beyond what's in JCE Item 1 makes sense as JCA appears (to me) as a library/array of JCE providers to pick from. Item 2 is a a bit confusing because it suggests that JCA isn't exact an array of "identical" JCE providers; it's some sort of watering hole for any and every "kind" of provider, JCE interfaced or not. So, whats the working relationship between JCA, it's providers and JCE? Do the providers also exist in independent silos or do they "build" off each other / have dependencies between them? For the folks interested in the code and the results that prompted this question, its listed below import java.security.Provider; import java.security.Security; import java.util.ArrayList; public class ConsoleListJca { public static void main(String[] args) { for (Provider provider : Security.getProviders()) { System.out.println("Provider: " + provider.getName() + " (ver " + provider.getVersion() + ")"); System.out.print(" Algorithms: "); ArrayList&lt;String&gt; algos = new ArrayList&lt;String&gt;(); for (Provider.Service service : provider.getServices()) { algos.add(String.format( "%s (%s)", service.getAlgorithm(), service.getType())); } java.util.Collections.sort(algos); String algorsStr = algos.toString(); // remove [ and ] from ArrayList's toString() algorsStr = algorsStr.substring(1, algorsStr.length()-1); System.out.println(algorsStr); System.out.println(); } } } and the results (formatted for SO) are Provider: SUN (ver 1.7) Algorithms: CaseExactJKS (KeyStore), Collection (CertStore), DSA (AlgorithmParameterGenerator), DSA (AlgorithmParameters), DSA (KeyFactory), DSA (KeyPairGenerator), JKS (KeyStore), JavaLoginConfig (Configuration), JavaPolicy (Polic…
type: Question
has answer: http://stackoverflow.com/a/54364487
answer count: 2
tagged with: jca
downvote count: 0
has title: Relationship between JCA, it's providers and JCE?
tagged with: jce

embedded-tomcat-7
type: Tag
tag name: embedded-tomcat-7
tags question: http://stackoverflow.com/q/21141794

http://stackoverflow.com/comment/31792083
comment on: http://stackoverflow.com/q/21127253
score: 7
has text: Have you defined your own `Stack` class?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31767170
type: Comment
comment on: http://stackoverflow.com/a/21111513
has text: OK, that sounds great... However I'm worried that objects that I push in the queue won't be synchronized... I could be wrong. But if a run method called by thread B creates an object and puts it in the queue that an object that is currently running in thread A has a reference to, will this object be synchronized between the threads? As in it's references? For example `run` creates a `Message` with a single public field called `text`, and sets this field to `"a message"`, and pushes this to the queue (all of that in a synch block), will that object be the same to the other thread?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31747647
has text: Eh, that feels dirty at best, and what happens when you need something like a default value for an `i32 timeout` or some sort of complex object?
type: AnswerComment
comment on: http://stackoverflow.com/a/21102662
type: Comment
score: 0

http://stackoverflow.com/comment/31778508
comment on: http://stackoverflow.com/q/21120003
type: QuestionComment
has text: This should grade student's homeworks who shouldn't be penalized by having different ordering of the parameters!
score: 0
type: Comment

http://stackoverflow.com/comment/31612347
type: Comment
type: QuestionComment
has text: @mKorbel If your referring to the MCVE document, yes. If you are referring to the code shown above, it still lacks a closing `}` ..but I wasn't going to mention that. ..shhhhh ;)
score: 0
comment on: http://stackoverflow.com/q/21028551

http://stackoverflow.com/a/21104596
upvote count: 1
has comment: http://stackoverflow.com/comment/31756731
answers question: http://stackoverflow.com/q/21090648
has comment: http://stackoverflow.com/comment/31754358
type: Answer
downvote count: 0
score: 1
has body: You may well be able to do this with your definition of DOT. If the column 72 requirement is problematic, bear in mind that columns 73-80 can be entirely blank if you like, so you could clear column 73 and treat your data as columns 8-73. If you can't define your DOT that way... A simple way to deal with the example problem in you question is to pre-process the PROCEDURE DIVISION code. Identify all ". ", remove the "." and create a new line with the "." in column 12. Identify all "." in column 72, remove that "." also and again create a new line with the "." in column 12. You must ignore alphanumeric-literals whilst doing this (text starting with " until next ", or ' until next '). This will not affect the program in any way (you can take an example and compile it, the results will be identical, byte-for-byte of the object (excluding compile date/time) to the original program). Even if there are already lines just containing "." it would not hurt to change them, or you could leave those as-is. No difference. If you are just extracting the text of conditions, this will help. If you are trying to parse the conditions fully, you have the problems NealB has pointed out. Bear in mind that there are many places where conditions can exist. Everything which has an END- in can contain a condition. Perhaps AT END in a READ is not significant, but ON SIZE ERROR, where it can exist, is, for instance. In your example, the condition in isolation, without the information in the VARYING, loses a lot of context. You will have similar problems in trying to deal with other conditions in isolation. I'm really not sure what you expect to get out of this. In the example, you have a condition which is just looking at the loop-control variable. You could have a similar-looking condition which was not looking at a loop-control variable, and just from looking at the condition you would not be able to tell them apart with certainty. You should be able to extract the text which makes up the co…
has comment: http://stackoverflow.com/comment/31756363

http://stackoverflow.com/comment/31800286
score: 1
comment on: http://stackoverflow.com/q/21131430
has text: From log traces provided its very clear you havent declared Manage_numbers activity in your AndroidManifest file...
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31617911
type: QuestionComment
score: 0
has text: yes sure this is a my ImageLoader Class https://www.dropbox.com/s/5pown1hr2n4jvk0/ImageLoader.java realy sorry i am new on stackoverflow and i do not know how to post code on comments. sorry
comment on: http://stackoverflow.com/q/21031388
type: Comment

http://stackoverflow.com/q/21035902
has body: I am very confused on what to use in developing a web application. If you can develop a web service using Java se restlet, then why should you bother using Java EE. What are the advantages of the one over the other? When and why should I use each?
has answer: http://stackoverflow.com/a/21036759
has title: Java SE RESTful VS java EE
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31630598
has comment: http://stackoverflow.com/comment/31624264
upvote count: 2
has comment: http://stackoverflow.com/comment/31624677
score: 0
downvote count: 2
answer count: 1
tagged with: web
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/21106257
downvote count: 2
tagged with: android
has comment: http://stackoverflow.com/comment/31753896
linked to: http://stackoverflow.com/q/8101585
tagged with: getresource
score: -2
has answer: http://stackoverflow.com/a/21106293
has answer: http://stackoverflow.com/a/21106329
answer count: 4
has answer: http://stackoverflow.com/a/21109160
duplicate of: http://stackoverflow.com/q/8101585
linked to: http://stackoverflow.com/q/4969171
tagged with: java
type: Question
duplicate of: http://stackoverflow.com/q/4969171
has comment: http://stackoverflow.com/comment/31753925
has comment: http://stackoverflow.com/comment/31753799
upvote count: 0
has comment: http://stackoverflow.com/comment/31753862
has answer: http://stackoverflow.com/a/21106288
has title: Make a static reference to non static field android
has comment: http://stackoverflow.com/comment/31753806
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has body: I trying to develop an android app, where I need to make a static(PLACES_API_BASE) reference to a non-static variable.Please check out the below code. private static final String PLACES_API_BASE= getResources().getString(R.string.places_api_base); But, I am getting an error stating, Cannot make a static reference to the non-static method getResources() from the type Is there any possible work around to achieve this. Please help. Thanks!
tagged with: static
type: UnansweredQuestion

http://stackoverflow.com/a/21067411
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21067286
answers question: http://stackoverflow.com/q/21067286
has comment: http://stackoverflow.com/comment/31722583
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31682512
type: Answer
has comment: http://stackoverflow.com/comment/31681775
has body: It is difficult to answer precisely. You should benchmark if you want to optimize. Some rules of thumb (which have exceptions) : don't create a big lot of threads. More than many hundreds threads is almost always a mistake (on current desktop or ordinary server). Have only dozens of them. benchmark your application perhaps, make the number of threads somehow configurable (use a thread pool) when relevant, have a bit more threads than cores in your processor, especially for I/O bound applications. A multi-core processor has several (parallel) CPUs or cores. Each core executes its own thread (or process, or task). So several threads are genuinely executed in parallel (simultaneously). Some processors are hyper-threaded (i.e. two register banks -etc...- sharing the same physical "core" giving the illusion of two "virtual" cores). If you run a 10 thread Java program (with also 6 other non-threaded system "runnable" processes), the operating system kernel (e.g. your linux kernel) will have to schedule these 10+6=16 tasks (a task is either a thread in a multi-threaded process or a single-threaded process). The scheduler of the kernel will give each task a quantum of runtime on a core. After that quantum of time (e.g. some milliseconds), a new runnable task is rescheduled (on preemptive multi-tasking operating systems) Read a good tutorial on operating system and about processes, tasks and linux or unix...

http://stackoverflow.com/a/41328196
upvote count: 1
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21116916
type: Answer
has body: Just modify hbase-env.sh like this: export JAVA_HOME=/your/java/path I don't know why /etc/profile java path doesn't work, but this way would help you.

http://stackoverflow.com/q/21122500
downvote count: 0
accepted answer: http://stackoverflow.com/a/21122605
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/21122605
score: 2
type: AnsweredQuestion
has body: For Some reason when I programmed getWinner() it only works in 2 cases (for the last row). I have everything else as far as diagonals and columns, but row 2 (well, three, but arrays, so 2) only works with o's basically. x's only win when o's are in 0,0 and 1,1 or 0,2 and 1,1. (Essentially,only if the o's are in a top corner and the center. import java.util.Scanner; public class TicTacToeRunner { public static void main(String[] args) { Scanner in = new Scanner(System.in); String player = "x"; TicTacToe game = new TicTacToe(); boolean done = false; while (!done) { System.out.print(game.toString()); System.out.print( "Row for " + player + " (-1 to exit): "); int row = in.nextInt(); if (row &lt; 0) { done = true; } else if (row &gt; 2) System.out.println("Invalid, please enter a number from 0 to 2"); else { System.out.print("Column for " + player + ": "); int temp = in.nextInt(); if (temp&gt;2) System.out.println("Invalid, please enter a number from 0 to 2"); else { int column = temp; game.set(row, column, player); if (player.equals("x")) player = "o"; else player = "x"; } if(game.getWinner().equals("x")) { System.out.println("x is the winner!"); done = true; } if(game.getWinner().equals("o")) { System.out.println("o is the winner!"); done = true; } } } } } public class TicTacToe { private String[][] board; private static final int ROWS = 3; private static final int COLUMNS = 3; public TicTacToe() { board = new String[ROWS][COLUMNS]; for (int i = 0; i &lt; ROWS; i++) for (int j = 0; j &lt; COLUMNS; j++) board[i][j] = " "; } public void set(int i, int j, String player) { if (board[i][j].equals(" ")) board[i][j] = player; //what if the spot is filled??? } public String toString() { String r = ""; for (int i = 0; i &lt; ROWS; i++) { r = r + "|"; for (int j = 0; j &lt; COLUMNS; j++) r = r + board[i][j]; r = r + "|\n"; } return r; } public String getWinner() //which one isn't working? I tried a few attempts at the third col and third row, and both worked. { for (int i = 0; …
has title: Tic Tac Toe (Conditional)
tagged with: java
tagged with: tic-tac-toe
type: Question
tagged with: arrays
answer count: 1

http://stackoverflow.com/q/21052188
has answer: http://stackoverflow.com/a/21119063
has comment: http://stackoverflow.com/comment/31672445
tagged with: blobstore
type: AnsweredQuestion
tagged with: url
accepted answer: http://stackoverflow.com/a/21119063
has title: Best way to stream from AppEngine blobstore in Android?
type: Question
tagged with: google-app-engine
tagged with: android
has body: I have a GWT Java based AppEngine project that uses blobstore for mp3 files. To stream the blobs, I normally call my serve HttpServlet by passing something like "/myApp/serve?blob-key=AMIfv... " to GWT Audio widget. The code is the same for dev server or deployed. Now I'm trying an android client with MediaPlayer, but I'm having problems with the URLs passed to to MediaPlayer.setDataSource(). For a deployed server, this URL works ok: http://example.appspot.com/myApp/serve?blob-key=AMIfv... but I can't get dev mode to work. As far as I can tell, the server is running at http://localhost:8888/ so I pass: http://localhost:8888/myApp/serve?blob-key=AMIfv... but the servlet is never reached (I tried numerous variations). Is there a better approach for reaching &amp; defining a changing backend? similar to that for datastore objects as provided by Endpoints Support to Android clients ? https://developers.google.com/eclipse/docs/endpoints-android Here if we set LOCAL_ANDROID_RUN to true (in CloudEndpointUtils.java), the Android application connects to the local development server. If LOCAL_ANDROID_RUN is false the client libraries provide the correct URL depending on the application ID.
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/comment/31650022
comment on: http://stackoverflow.com/q/21050334
score: 0
has text: Avoid non static inner class. Scroll don the link and have a look at the points http://android-developers.blogspot.in/2009/01/avoiding-memory-leaks.html
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31706467
score: 0
type: Comment
has text: Java 8: `numbers.stream().map(i->2*i).collect(toList())`
comment on: http://stackoverflow.com/a/21080695
type: AnswerComment

http://stackoverflow.com/q/21149561
has title: How to access secure MQ queue from stand-alone Java application
answer count: 1
has answer: http://stackoverflow.com/a/21240573
tagged with: security
score: 0
has body: I need to access a secure MQ queue from a stand-alone java application. What different mechanisms are available to do so? Where can I find details of the different ways it can be achieved? Any code snippets or document links are appreciated. Thank you UPDATE Thanks Shashi. I am not too familiar with MQ. I am on java side, so I asked our MQ admin to help me explain. This is what they told me, we have. We have a “secure” qmgr MGR1. We are attempting to secure all of the objects. We use two (or more) types of security. Object Level security and Channel Authorization records. Using Channel Authorization records, we can control who can use a channel from where (userid / IP Address) – block everyone else. Object level security, controls who can access a specific object and what they are allowed to do: UID1 has connect authority to the qmgr. Read authority on PV.** queues. Is this what you are asking?
has comment: http://stackoverflow.com/comment/31859909
accepted answer: http://stackoverflow.com/a/21240573
has comment: http://stackoverflow.com/comment/31988886
tagged with: ibm-mq
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/21078789
favorite count: 0
has comment: http://stackoverflow.com/comment/31703209
has comment: http://stackoverflow.com/comment/31702583
score: 3
has body: I accidentally posted this question on a different account of mine, so I deleted the post and reposted on this account. So I wanted to create a maze generation algorithm for fun, but I hit a bit of a bump. The algorithm I wrote puts in spaces that are unreachable and that have no exit. What could the problem be? Here is what I mean # # # # # # # # # # # # # # # # # # # # # # . . . . . # . # . . . # . # . # . . . # # . # # # . # . # # # . # # # . # # # # # # . . . # . # . # . . . . . # . . . . . # # # # . # . # . # # # # # . # # # . # # # # . . . # . # . . . . . # . # . # . # . # # . # # # . # # # # # . # # # . # . # . # # . # . # . . . . . # . . . . . . . # . # # . # . # . # # # # # # # . # # # . # # # # . # . # . . . . . . . # . . . # . # . # # . # . # # # # # # # . # . # . # # # . # # . # . # . . . . . . . # . # . # . . . # # # # # # . # # # # # # # . # . # . # # # # . # . . . # . . . . . . . # . # . # . # # . # # # . # . # # # # # # # # # . # # # # . . . # . . . # . # . . . . . . . # . # # # # . # # # . # # # # # # # . # # # . # # . # . # . . . . . # . . . # . . . . . # # # # . # . # # # . # . # # # . # # # . # # . # . . . # . # . # . # . . . . . # . # # # # # # # # # # # # # # # # # # # # # # And this is my code Description: Create a maze consisting of entirely connected cells. As stated 0 up, 1 down, 2 right, 3 left, orientTo records whether the dfs went up/down/left/right to get to the current cell. In the mazeGen function: generate the cell you came from, now remove the wall between current cell and last cell. Generate all neighbours of current cell and randomly arrange them into an array, array holds x,y, and which way the dfs moved to get to this neighbour cell. Now iterate through this array and recursively call the dfs with these neighbour values.
has comment: http://stackoverflow.com/comment/31702489
upvote count: 3
has title: Recursive maze generation
has answer: http://stackoverflow.com/a/21079560
type: Question
tagged with: recursion
type: AnsweredQuestion
tagged with: algorithm
tagged with: java
accepted answer: http://stackoverflow.com/a/21079560
has comment: http://stackoverflow.com/comment/31702753
has comment: http://stackoverflow.com/comment/31702545
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31702530

http://stackoverflow.com/q/21130598
has title: Eclipse Hello World Plugin Error. Compiles ok, Gives error on Run
has body: I am following this (http://www.vogella.com/tutorials/EclipsePlugIn/article.html) tutorial to create a hello world plugin for eclipse. But I am unable to run this plugin. I am getting these errors: http://pastebin.com/jAuqwH7t
tagged with: eclipse-plugin
linked to: http://stackoverflow.com/q/15372023
has comment: http://stackoverflow.com/comment/31798965
favorite count: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31798114
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31798197
tagged with: eclipse
type: Question
upvote count: 1

http://stackoverflow.com/q/21056710
downvote count: 0
favorite count: 0
answer count: 4
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21056802
has answer: http://stackoverflow.com/a/21057034
upvote count: 2
has answer: http://stackoverflow.com/a/21056802
has answer: http://stackoverflow.com/a/21056724
type: Question
has title: For loop not being entered
has comment: http://stackoverflow.com/comment/31662526
has answer: http://stackoverflow.com/a/21057006
tagged with: java
accepted answer: http://stackoverflow.com/a/21057034
tagged with: for-loop
has body: I'm still working on my Java Diamond Problem. Here is the current state of the diamond I'm thinking the problem is the for loop right here, all I need is for those spaces to be printed and then I'm finished. Can anyone see any obvious reasons why the for loop I labeled with the problem isn't being entered or running? //Bottom half of the diamond int middleSpaces = sides + 2; int downPreSpaces = 1; int dRows = sides + 1; for (int x = 1; x &lt;= dRows; x++) { if (x &gt;= dRows) { for (int z = 1; z &lt;= sides + 1; z++) { System.out.print(" "); } System.out.print("v"); } if (x != dRows) { for(int y = 1; y &lt;= x; y++) { System.out.print(" "); } System.out.print("\\"); //PROBLEM IS HERE for (int e = middleSpaces - 2; e &lt;= 0; e += 2) { System.out.print(" "); } System.out.print("/\n"); }
has comment: http://stackoverflow.com/comment/31662573

http://stackoverflow.com/comment/31671992
has text: A wild guess: maybe this is related to the groovy compiler which triggers the need for some libraries, even though they are not used in Groovy code.
comment on: http://stackoverflow.com/q/21054619
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21060723
type: Answer
has body: Actually, I think the main problem is with zip or tar format. It can not copy when you provide this kinda file format to copy from assets to sdcard. Reason might be that zip is in itself a collection of files which creates problem. But changing the file extension I am able to copy that .tar file to sdcard from assets. The best idea is to keep your file without extension in assets and while writing it to output stream append extension with its name(preceding dot). Then copying this file will be not hinderance anymore.
answers question: http://stackoverflow.com/q/21059761
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21059761

http://stackoverflow.com/comment/31797925
comment on: http://stackoverflow.com/a/21129666
has text: The equivalent of *Thank you* on StackOverflow is to upvote/accept the answer that helped you :-)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21064753
favorite count: 0
has comment: http://stackoverflow.com/comment/31676943
has comment: http://stackoverflow.com/comment/31676804
linked to: http://stackoverflow.com/q/6255106
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31676918
accepted answer: http://stackoverflow.com/a/21065014
has title: How to draw a string array into a Java Applet?
tagged with: java
upvote count: 1
downvote count: 1
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/31676897
tagged with: arrays
has comment: http://stackoverflow.com/comment/31676940
score: 0
has body: I'm amateur when it comes to java, I am trying to create an applet that randomizes the sequence "Black Screen British Guy" into a different sequence. e.x. "Screen Black Guy British" I have got the sequence to print to console, However I am trying to print the strings into a java applet, I'm having trouble with this, and I could use some help. Thanks. package bsbg_gen; import java.lang.String; import java.io.*; import java.util.Arrays; import java.util.Random; import java.applet.*; import java.awt.Graphics; public class main extends Applet { public void init(){ String[] bsbg; String[] bsbg2; String[] bsbg3; String[] bsbg4; String [][] name = {{"Black"}, {"Screen"}, {"British"}, {"Guy"}}; String [][] name2 = {{"Black"}, {"Screen"}, {"British"}, {"Guy"}}; String [][] name3 = {{"Black"}, {"Screen"}, {"British"}, {"Guy"}}; String [][] name4 = {{"Black"}, {"Screen"}, {"British"}, {"Guy"}}; Random rand = new Random(); bsbg = name [rand.nextInt(name.length)]; bsbg2 = name2 [rand.nextInt(name2.length)]; bsbg3 = name3 [rand.nextInt(name3.length)]; bsbg4 = name4 [rand.nextInt(name4.length)]; System.out.print(Arrays.toString(bsbg)); System.out.print(Arrays.toString(bsbg2)); System.out.print(Arrays.toString(bsbg3)); System.out.print(Arrays.toString(bsbg4)); } public void stop(){ } public void paint(Graphics g){ g.drawString((Arrays.toString(bsbg)), 150, 50); g.drawString((Arrays.toString(bsbg2)), 150, 50); g.drawString((Arrays.toString(bsbg3)), 175, 50); g.drawString((Arrays.toString(bsbg4)), 200, 50); } }
answer count: 1
has answer: http://stackoverflow.com/a/21065014
tagged with: applet
tagged with: string

http://stackoverflow.com/comment/31658293
type: QuestionComment
has text: @RC. I don't really want to share the `Connection` object between test classes. But I don't see how I can avoid copying the same Rule into every other class. The doc specifically states "ExternalResource is a base class for Rules (like TemporaryFolder) that set up an external resource before a test (a file, socket, server, database connection, etc.), and guarantee to tear it down afterward", so I assumed I can use it for database connections.
score: 0
comment on: http://stackoverflow.com/q/21053855
type: Comment

http://stackoverflow.com/comment/31900528
score: 0
type: QuestionComment
type: Comment
has text: One element, more specifically it returns this `#-2:0{shortestPath:[2]} v0 `. There is not any function named getIdentity()
comment on: http://stackoverflow.com/q/21182843

http://stackoverflow.com/comment/31785104
has text: I had the MapWindow class using a layout manager but I removed it while I was debugging the paint issue. I'm using a layout manager for SettingsButtonsPanel and I am not putting any JComponents inside of MapImagePanel. It seems like I'm doing what you've mentioned, but I'm not sure if I understood you correctly. Also, how would you set the size of a JPanel if not using setBounds? If I know exactly how big my panel and "sub-panels" need to be, what is the proper way to set the size of the panels? Thanks for the help!
type: QuestionComment
comment on: http://stackoverflow.com/q/21123217
score: 0
type: Comment

http://stackoverflow.com/comment/31767351
type: Comment
comment on: http://stackoverflow.com/a/21114113
has text: what does this method do? and how it will fix the problem?
type: AnswerComment
score: 0

http://stackoverflow.com/a/21023674
has comment: http://stackoverflow.com/comment/31601946
downvote count: 1
score: 3
has comment: http://stackoverflow.com/comment/31653086
has comment: http://stackoverflow.com/comment/31760181
upvote count: 4
has comment: http://stackoverflow.com/comment/31648690
has body: You don't need to publish your API as header files. Everything the developer needs is already in the JAR. If you want to publish documentation publish the java docs of the code.
answers question: http://stackoverflow.com/q/21023623
type: Answer

http://stackoverflow.com/comment/31754528
type: QuestionComment
has text: Are you using viewpager..?
comment on: http://stackoverflow.com/q/21106718
score: 0
type: Comment

http://stackoverflow.com/q/21113768
answer count: 1
has answer: http://stackoverflow.com/a/21113956
favorite count: 0
linked to: http://stackoverflow.com/q/4870273
has comment: http://stackoverflow.com/comment/31766613
tagged with: jdbc
has comment: http://stackoverflow.com/comment/31771190
tagged with: loading
type: AnsweredQuestion
tagged with: event-dispatch-thread
upvote count: 0
has comment: http://stackoverflow.com/comment/31771283
has title: Swing based loading frame hangs on DB query
linked to: http://stackoverflow.com/q/12937759
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/31767444
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/31767293
accepted answer: http://stackoverflow.com/a/21113956
has body: I know there are bunch of similar topics, but I can't apply these solutions to my Project. I've got a huge Java Application in which there are many time consuming operations on database. Everything is realized in a single thread so when the program is querying database the UI hangs. I got a task to make a loading window in described situations. I've tried JWindow objects, JFrame which is always on top, modal dialog, but none of them managed to work. Here is the thing: I've got JDialog which contains JPanel. The panel consists of 2 input fields (login and password) and Log in button. When user press Logs in, there (on top) should appear "Loading..." window. Dialog is modal and is alwaysOnTop. How should I do this? Closest solution I get is: JDialog modalDialog = new JDialog(dialog, "Busy", ModalityType.MODELESS); modalDialog.add(new JLabel("Loading...")); modalDialog.setSize(200, 150); modalDialog.setLocationRelativeTo(dialog); modalDialog.setVisible(true); But the dialog doesn't draw itself well: It contains elements from the background instead of Loading text... After loading is done it shows Loading... text as desired. When I add modalDialog.setUndecorated(true); It doesn't draw on the first plane... and I don't want a bar with [X]
downvote count: 2

http://stackoverflow.com/q/21076086
type: Question
has comment: http://stackoverflow.com/comment/31703754
downvote count: 0
has title: Embedding a native window inside a JFrame
linked to: http://stackoverflow.com/q/6524727
answer count: 1
linked to: http://stackoverflow.com/q/4809713
upvote count: 11
favorite count: 0
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/133993452
score: 11
has body: Does anyone know of a method or API that supports embedding a native window inside either a Java JFrame or JPanel? I found this previous post: How do I run an external program inside a Java frame in netbeans in a platform independent manner? I can get the window handle using: http://www.java-forums.org/advanced-java/44064-getting-window-id-window-frame.html and this works fine. This article appears to suggest that it's possible, but does not illustrate how: Embed HWND (Window Handle) in a JPanel
has answer: http://stackoverflow.com/a/77067720
tagged with: embedding
tagged with: java

http://stackoverflow.com/a/21141540
has body: You would have to use write() of OutputStreamWriter to write the encoded chars: Change: fos.write(16757); To: osw.write(16757);
has comment: http://stackoverflow.com/comment/31817089
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21141308
has comment: http://stackoverflow.com/comment/31817359
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/21141308
score: 2

http://stackoverflow.com/comment/31684298
type: QuestionComment
comment on: http://stackoverflow.com/q/21068397
has text: @peter.petrov Ok thanks. If you post an answer, I'll accept it for the sake of closing the answer up.
score: 0
type: Comment

http://stackoverflow.com/a/21048965
answers question: http://stackoverflow.com/q/21047497
score: 0
has body: You cannot remove UI element if it was declared in XML file. If you want certain elements to be removable you must add them from code, not have them in XML. Also there's no point of removing it in your onDestroyView you haven't added in the first place.
type: Answer

http://stackoverflow.com/a/21113876
has comment: http://stackoverflow.com/comment/31767160
has comment: http://stackoverflow.com/comment/31767057
answers question: http://stackoverflow.com/q/21113857
has comment: http://stackoverflow.com/comment/31766847
score: 9
upvote count: 9
downvote count: 0
has comment: http://stackoverflow.com/comment/31766943
has comment: http://stackoverflow.com/comment/31766803
has comment: http://stackoverflow.com/comment/31766996
has comment: http://stackoverflow.com/comment/31767134
has body: Try Place.split(" "); split the string.It will retrun String array String splitted[]=Place.split(" "); System.out.println(splitted[0]); System.out.println(splitted[1]); As @ᴍarounᴍaroun has suggested you can also use regex this way Place.split("\\s+");
type: Answer
has comment: http://stackoverflow.com/comment/31766971

http://stackoverflow.com/a/21060858
has comment: http://stackoverflow.com/comment/31669658
score: 5
has comment: http://stackoverflow.com/comment/31669478
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Use something like ..getResource("/images/a" + randomNumber + ".jpg") Genderate a random number for randomNumber variable. As long as all your images have the same prefix and just different numerical suffix, you should be fine. If they're all different, then store each string path into a String array and the random number will be the index getResource("/images/" + pathArray[randomNumber]) Example String[] imageNames {"hello.jpg", "world.png", "!.gif"}; Random rand = rand = new Random(); .... private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { int index = rand.nextInt(3); Image im=new ImageIcon(this.getClass() .getResource("/images/" + imageNames[index])).getImage(); ImageIcon iconLogo = new ImageIcon(im); jLabel2.setIcon(iconLogo); } UPDATE to OP comment "Oh!if the folder contains 100 pictures it seems very difficult.My project needs more images" then load the filed names into a data structure via the File API.. file.list() &lt;-- return a String[] File file = new File("src/images"); String[] imageNames = file.list(); ... int index = rand.nextInt(imagNames.length); As long as all the files are files and not directories, this should work fine. UPDATE As discussed below in the comments, its been noted that the above answer will probably not work at time of deployment. Here is @AndrewThompson's suggestion as a fix to the file problem The best way I can think of is: Create a small helper class that creates a list of the images. Write that list to a File, one name per line. Include the file as a resource (the easiest place is where the images are). Use getResource(String) to gain an URL to it. Read it back in at run-time.
has comment: http://stackoverflow.com/comment/31669449
accepted answer of: http://stackoverflow.com/q/21060810
has comment: http://stackoverflow.com/comment/31669590
answers question: http://stackoverflow.com/q/21060810
upvote count: 5
has comment: http://stackoverflow.com/comment/31669942

http://stackoverflow.com/comment/31819045
type: AnswerComment
comment on: http://stackoverflow.com/a/21139482
type: Comment
has text: <project name="A12TEST" default="clean" basedir="."> there was the error.. instead of clean it was the procedure before. But your solution helped me to solve this
score: 0

http://stackoverflow.com/a/34923836
answers question: http://stackoverflow.com/q/21109871
score: 26
upvote count: 26
downvote count: 0
type: Answer
has body: For those who face There are no categorized items on Eclipse Uncheck Group items by category

http://stackoverflow.com/comment/31861976
score: 0
type: QuestionComment
type: Comment
has text: Maybe the problem is not here. Are you sure that `onCreate()` is being called when you think it is? This is only my guess but I think that you really need to move this to the `onResume()`.
comment on: http://stackoverflow.com/q/21165746

http://stackoverflow.com/comment/31593500
comment on: http://stackoverflow.com/q/21019208
has text: poosible duplicate of http://stackoverflow.com/questions/1953530/why-does-java-prohibit-static-fields-in-inner-classes
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/31887107
type: AnswerComment
comment on: http://stackoverflow.com/a/21179656
has text: how much memory I should allocate? giving `-Xmx2048M` won't work either. `Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine.`
score: 0
type: Comment

http://stackoverflow.com/comment/31802183
comment on: http://stackoverflow.com/a/21132821
type: Comment
score: 1
type: AnswerComment
has text: I find this log in my websphere 1TISIGINFO Dump Event "systhrow" (00040000) Detail "java/lang/OutOfMemoryError" received Need more memory. THX all

http://stackoverflow.com/comment/31829463
type: Comment
has text: I hate to jump on the bandwagon here, but indenting your code properly would make this obvious.
type: QuestionComment
comment on: http://stackoverflow.com/q/21147813
score: 1

http://stackoverflow.com/comment/31740576
comment on: http://stackoverflow.com/a/21099089
type: AnswerComment
score: 0
type: Comment
has text: for some reason I thought it was a JavaFX ComboBox but I was mistaken! In JavaFX it would be something like: `comboBox.addChangeListener(...)`

http://stackoverflow.com/a/21035342
type: Answer
upvote count: 1
has body: You are creating a new Person object names.add(newFullName); Person newFullName = new Person (newFirst, newLast, iNewYear); but you are not keeping that referenced (by adding it array or something) but you have names array that keep track of the names. Also, you should rename the variable to something else because you have 2 variable named the same. EDIT: As you asked, here is a simple example. class1: public class Person { public String name; public String lastname; public Person(String name, String lastname) { this.name = name; this.lastname = lastname; } public String toString() { return this.name + " " + this.lastname; } } class 2: import java.util.*; public class PersonManager{ //array list to keep track of all the Person objects that will be created public static ArrayList&lt;Person&gt;peoples = new ArrayList&lt;Person&gt;(); //assume this function takes input from user and returns a new //person object public static Person getPerson(String name, String last) { Person p = new Person(name, last); return p; } //this function removes a person with the first name public static boolean removePerson(String name) { //we should loop through the array and find the object we want to delete Person objectToRemove = null; for (Person p : peoples) { if (p.name.equals(name)) { //this is the object we want to remove //because the name matched objectToRemove = p; break; } } //we will actually remove the object outside of the loop //so we don't run into errors... if (objectToRemove != null) { //tell array list to remove the object we wanted to delete peoples.remove(objectToRemove); System.out.println("\nRemoving person = "+objectToRemove); } return objectToRemove != null; } public static void printInfo() { System.out.println("\n\nPrinting info"); //loop through all the object in the peoples array and print out their names for (Person p : peoples) { System.out.println(p); } System.out.println("In total, there are "+ peoples.size() +" objects saved in the array"); } public static…
score: 1
has comment: http://stackoverflow.com/comment/31623326
downvote count: 0
answers question: http://stackoverflow.com/q/21035295

http://stackoverflow.com/q/21101775
answer count: 2
has comment: http://stackoverflow.com/comment/31758584
has title: How to make method return null with redirect
downvote count: 0
has comment: http://stackoverflow.com/comment/31759850
favorite count: 0
has comment: http://stackoverflow.com/comment/31757545
linked to: http://stackoverflow.com/q/5416070
tagged with: http-redirect
has body: in jsf i want to go back to the same page but with redirect. so if the user click refresh i don't want the form to be submitted again. public String changeLanguage() { if (locale == Locale.ENGLISH) locale = new Locale("ar"); else locale = Locale.ENGLISH; return null; } view code :- mybean sessionscope <h:head> #{msg.hello} </h:head> <h:body> <f:view locale="#{mybean.locale}"> <h:form> <h:commandLink value="lang" action="#{mybean.changeLanguage}"></h:commandLink> </h:form> </f:view> </h:body>
has answer: http://stackoverflow.com/a/21131631
type: UnansweredQuestion
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31759168
has comment: http://stackoverflow.com/comment/31787588
has comment: http://stackoverflow.com/comment/31757978
has comment: http://stackoverflow.com/comment/31757576
tagged with: java
linked to: http://stackoverflow.com/q/10036928
has answer: http://stackoverflow.com/a/21102125
type: Question
tagged with: jsf-2
has comment: http://stackoverflow.com/comment/31756886

http://stackoverflow.com/comment/31880386
has text: @csmckelvey That doesn't make sense. Adding parentheses would either have zero effect or *change* the order of evaluation.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21175835
type: Comment

http://stackoverflow.com/q/21119457
possible better answer: http://stackoverflow.com/a/21119475
has answer: http://stackoverflow.com/a/21119475
score: 0
answer count: 2
tagged with: for-loop
has comment: http://stackoverflow.com/comment/31777379
has answer: http://stackoverflow.com/a/21119506
accepted answer: http://stackoverflow.com/a/21119506
has comment: http://stackoverflow.com/comment/31777449
has comment: http://stackoverflow.com/comment/31777492
type: AnsweredQuestion
has body: In my application, I have list of values of type String, I am iterating throught it and comparing the values of each to another string and if it is true returning true value else false. List&lt;String&gt; roleNames = new ArrayList&lt;String&gt;(); roleNames.add("AAA"); roleNames.add("MMM"); for (int i=0 ; i&lt;roleNames.size();i++){ // if(loggedInRole.equals(roleNames.get(i))){ if("AAA".equals(roleNames.get(i))){ enableLink = "true"; } else { enableLink = "false"; } } In my above code i am expecting the result as true but in the second itertion it returning the result as false. How to reolve this issue?
tagged with: java
tagged with: collections
has title: Java for loop iteration
type: Question
tagged with: jakarta-ee
tagged with: if-statement

http://stackoverflow.com/q/21110677
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Neo4j index does does not work using Java API
has body: I'm writing an unmanaged extension and I'm having problem accessing indexes with JAVA API. The code: package org.neo4j.parent.parentextension; import org.codehaus.jackson.map.ObjectMapper; import org.neo4j.cypher.javacompat.ExecutionEngine; import org.neo4j.cypher.javacompat.ExecutionResult; import org.neo4j.graphdb.GraphDatabaseService; import org.neo4j.graphdb.index.Index; import org.neo4j.graphdb.index.IndexManager; import org.neo4j.graphdb.Node; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; @Path("/parent") public class ParentDistance { @GET @Path("/helloworld") public String helloWorld() { return "Hello World!"; } @GET @Path("/common/{acc1}/{acc2}") public String getCommon(@PathParam("acc1") String acc1, @PathParam("acc2") String acc2, @Context GraphDatabaseService db) throws IOException { return db.index().nodeIndexNames().toString(); } } helloworld call does work and also other methods that execute a Cypher query. But, as soon as any IndexManager or index is called in any method, anything below stops working. Any hint what to look for? Thanks!
has answer: http://stackoverflow.com/a/21111198
answer count: 1
downvote count: 0
tagged with: neo4j
accepted answer: http://stackoverflow.com/a/21111198

http://stackoverflow.com/q/21150508
has answer: http://stackoverflow.com/a/21150531
has title: Modulo operation, why does 4 % 12 give the number 4?
accepted answer: http://stackoverflow.com/a/21150531
has comment: http://stackoverflow.com/comment/31834592
tagged with: math
has comment: http://stackoverflow.com/comment/31834758
answer count: 3
has comment: http://stackoverflow.com/comment/31834705
upvote count: 1
score: -7
has answer: http://stackoverflow.com/a/21150529
favorite count: 0
has comment: http://stackoverflow.com/comment/31834576
possible better answer: http://stackoverflow.com/a/21150529
type: AnsweredQuestion
has body: How does dividing 4 by 12 return a remainder of 4? I know that 12%4 = 0, but what if it is reversed?
tagged with: java
has comment: http://stackoverflow.com/comment/31834618
has answer: http://stackoverflow.com/a/21150532
has comment: http://stackoverflow.com/comment/31834761
has comment: http://stackoverflow.com/comment/31834783
type: Question
downvote count: 8

http://stackoverflow.com/comment/31850958
has text: what is number is "50,00,000"? 5 million? 50 million? What kind of data do you want to add? Why so many? Why all at once? Have you tried lazy loading?
comment on: http://stackoverflow.com/q/21159988
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/33506475
downvote count: 1
upvote count: 144
has comment: http://stackoverflow.com/comment/54960582
has comment: http://stackoverflow.com/comment/73045513
has comment: http://stackoverflow.com/comment/66258345
answers question: http://stackoverflow.com/q/21083170
has comment: http://stackoverflow.com/comment/55374223
has comment: http://stackoverflow.com/comment/115532862
has comment: http://stackoverflow.com/comment/61386356
score: 143
type: Answer
has body: Also, you can configure the port programmatically. For Spring Boot 2.x.x: @Configuration public class CustomContainer implements WebServerFactoryCustomizer&lt;ConfigurableServletWebServerFactory&gt; { public void customize(ConfigurableServletWebServerFactory factory){ factory.setPort(8042); } } For older versions: @Configuration public class ServletConfig { @Bean public EmbeddedServletContainerCustomizer containerCustomizer() { return (container -&gt; { container.setPort(8012); }); } }
has comment: http://stackoverflow.com/comment/65377542
has comment: http://stackoverflow.com/comment/85133582

http://stackoverflow.com/a/21158240
has comment: http://stackoverflow.com/comment/31848735
answers question: http://stackoverflow.com/q/21158142
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31848348
accepted answer of: http://stackoverflow.com/q/21158142
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/31848167
score: 2
has comment: http://stackoverflow.com/comment/31848358
downvote count: 0
has body: I think it's because you're trying to open multiple buffered writers to the same file when it's calling itself through recursion. Try creating your writer outside of this method and pass it in as a parameter. Example public void myCallingMethod() throws IOException{ File rep = new File("report.txt"); BufferedWriter bw = new BufferedWriter(new FileWriter(rep)); walk("my/path", 4, bw); bw.close(); }

http://stackoverflow.com/comment/31701076
has text: I have an enum value which represents either an instance of EntityItem or a subclass of it. If it represents a subclass then i would like to create an instance of that subclass instead of an instance of Entityitem as my method processEntityItem currently does. Otherwise I create an instance of EntityItem.
comment on: http://stackoverflow.com/q/21077993
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31894413
score: 0
type: AnswerComment
has text: what's emulator u runing app? Try to use this S40_5th_Edition_SDK_Feature_Pack_1 from Nokia
comment on: http://stackoverflow.com/a/21177192
type: Comment

http://stackoverflow.com/comment/31616266
score: 0
type: AnswerComment
has text: Shoot! I totally missed that I used a TextArea and not a JTextArea!
type: Comment
comment on: http://stackoverflow.com/a/21031365

http://stackoverflow.com/comment/38145100
type: AnswerComment
comment on: http://stackoverflow.com/a/21112668
type: Comment
has text: I am using an IntentService and I have made it to run in WAKE mode. How can I detect the gestures or power button or any other button press event?
score: 0

http://stackoverflow.com/a/21027154
score: 1
type: Answer
has body: A quick workaround I can think of, is just ignoring the content-length and reading input stream until there's nothing left to read. ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(8192); int read = inputStream.read(); while (read != -1) { byteArrayOutputStream.write((byte) read); read = inputStream.read(); } byteArrayOutputStream.flush(); buf = byteArrayOutputStream.toByteArray();
upvote count: 1
answers question: http://stackoverflow.com/q/21026166
downvote count: 0

http://stackoverflow.com/q/21095991
downvote count: 0
has comment: http://stackoverflow.com/comment/31734874
type: UnansweredQuestion
tagged with: amazon-web-services
has comment: http://stackoverflow.com/comment/31734596
score: 3
answer count: 1
tagged with: amazon-elastic-beanstalk
favorite count: 0
tagged with: c++
type: Question
has title: Deploying a C++ application in the cloud
has body: I am completely new to hosting applications in the cloud. I have a product that consists of 2 separate applications which communicate with each other via HTTP. One is written in (native, unmanaged) C++ (server side), the other is written in Java and includes a web/GUI front end. I have a server side application that is written in native, unmanaged C++, which communicates with a Java web/GUI front end. I want to explore the possibility of hosting it in the cloud and I've been looking at, and experimenting with, Amazon's Elastic Beanstalk in the first instance but I'm struggling to see the wood for the trees. 1) Is it possible to run a native, unmanaged C++ application using Amazon's Elastic Beanstalk? 2) If so, how do I deploy it alongside the war file?
linked to: http://stackoverflow.com/q/16350685
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21096270
tagged with: cloud

http://stackoverflow.com/comment/31694405
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21074408
score: 0
has text: Thanks Rugal for this diagram !

http://stackoverflow.com/comment/31677319
has text: The same using JodaTime is much shorter and cleaner :)
type: AnswerComment
comment on: http://stackoverflow.com/a/21062697
score: 0
type: Comment

http://stackoverflow.com/a/21074804
has comment: http://stackoverflow.com/comment/31696065
type: Answer
answers question: http://stackoverflow.com/q/21074601
has comment: http://stackoverflow.com/comment/31695380
downvote count: 1
has body: Simply put a try block around your call to nextInt(), and if an exception is thrown, tell the user, like so: int number = 0; boolean ok = true; try { number = sc.nextInt(); } catch (Exception ex) { //user did not enter a valid integer ok = false; } if (number&gt;0 &amp;&amp; ok) { //... } else { System.out.println("Enter a positive whole number greater than 0"); }
has comment: http://stackoverflow.com/comment/31695139
score: -1
upvote count: 0

http://stackoverflow.com/q/21058484
possible better answer: http://stackoverflow.com/a/21058646
type: Question
has answer: http://stackoverflow.com/a/21058646
has answer: http://stackoverflow.com/a/21058638
accepted answer: http://stackoverflow.com/a/21058638
score: 0
answer count: 3
has title: How to write a byte array to a part of exist file?
has answer: http://stackoverflow.com/a/21058551
has body: Pls help me this. I have a file(Not a text file). I read a part of the file then I convert it into a byte array and I do something with the array. So, Can I erase the part of the file and write my own byte array into?
tagged with: android
tagged with: io
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/21172019
type: AnsweredQuestion
tagged with: java
has body: I have a table in HBase to store user objects. Each object has 4 columns and I name each column as [object_creation_date]_[column_name] to auto order columns by object creation date. For example: RowKey 20140101_a 20140101_b 20140101_c 20140101_d 20140102_a 20140102_b 20140102_c 20140102_d 1 1a 1b 1c 1d 2a 2b 2c 2d Now I'm trying to filter these values by column. Is there any way to find the object (set of 4 columns) whose property "C" equals "2c"? It should return 20140102 I tried using ColumnRangeFilter class but it only seems to work with prefixes and I´d need a RegExp to find all "C" columns no matter the date they were created. Is there another way of doing this or maybe I could use a different representation for the data?
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21181173
accepted answer: http://stackoverflow.com/a/21181173
possible better answer: http://stackoverflow.com/a/21195516
tagged with: filter
tagged with: hbase
has answer: http://stackoverflow.com/a/21195516
has title: How to find a value among all columns in a row in HBase

http://stackoverflow.com/a/21180113
answers question: http://stackoverflow.com/q/21179964
downvote count: 0
type: Answer
has body: Try using ArrayUtils . int m[] = (int [])ArrayUtils.addAll(x,y);
upvote count: 1
score: 1

http://stackoverflow.com/comment/31750783
comment on: http://stackoverflow.com/q/21104380
type: QuestionComment
has text: Do you remember that parameters in Java are always passed by value?
score: 0
type: Comment

http://stackoverflow.com/comment/31790403
has text: The file ~/.m2/repository/com/google/collections/google-collections/1.0/google-collections-1.0.jar gets downloaded when I run maven install it is causing a problem because com/google/common/base/FinalizableReferenceQueue.class is getting compiled from google-collections but I want to use the version from guava.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21125894

http://stackoverflow.com/q/21176023
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/21176109
has title: Facilitate SQL table query functionality in Java application
has body: Say I have a couple of columns say First Name, LastName, Email, Phone. I want to query for a row based on a dynamic column selection. Say the application will ask for a record based on 1) lastname and phone or 2) FirstName 3) Phone and Email Instead of creating a table to do a SQL query to find a row based on the column data is there a data structure which suits my needs? I am coding in Java, so if there is an inbuilt API please suggest one FirstName | LastName | Email | Phone abc | xyz | abc@m.com | 123 pqr | qwe | pqr@m.com | 342 ijk | uio | ijk@m.com | 987
has comment: http://stackoverflow.com/comment/31880860
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/31881399
has answer: http://stackoverflow.com/a/21176109
has comment: http://stackoverflow.com/comment/31880903
tagged with: data-structures
has answer: http://stackoverflow.com/a/21176108
tagged with: sql
has answer: http://stackoverflow.com/a/21176405
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/31907637
has comment: http://stackoverflow.com/comment/31881260
possible better answer: http://stackoverflow.com/a/21176395
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31880916
has answer: http://stackoverflow.com/a/21176395

http://stackoverflow.com/comment/31898571
score: 0
has text: See also http://stackoverflow.com/questions/8669693/advantage-of-singly-rooted-class-hierarchy
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21181125

http://stackoverflow.com/q/21068910
tagged with: resteasy
has body: I made webservice on jboss-as-7, which works ok with @GET method, but when I tried to add @POST, I'm getting "415 Unsupported Media Type". After a lot of code tweaking on client & server side, now I'm just using REST client for testing. Am I missing here something? webservice: @Stateless @LocalBean @Path("/RESTService") public class ReservationsResource { @EJB private ReservationsSB reservationsSB; @GET @Produces("application/xml") @Path("/reservation/{id}") public Reservations getReservation(@PathParam("id") int id) { return reservationsSB.getReservation(id); } @POST @Consumes("application/xml") @Path("/reservation/delete") public Response deleteReservation(Reservations r){ edited = null; reservationsSB.deleteReservation(r); return Response.status(201).entity(r).build(); } entity: @Entity @XmlRootElement @Table(name="reservations") public class Reservations { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private int id; @Column private String date; private String owner; private int active; @ManyToOne private Tables table; public Reservations(String date, String owner, Tables table, int active) { super(); this.date = date; this.owner = owner; this.table = table; this.active = active; } ... } REST client request: url: http://localhost:8080/BarBar/RESTService/reservation/delete body(same as is returned by getReservation()): 1 2014-01-14 21:00:00.0 23 dqf 6 30 table 4
has answer: http://stackoverflow.com/a/21069243
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21069243
has title: webservice @POST returns 415 Unsupported Media Type
score: 0
answer count: 1
tagged with: jboss7.x

http://stackoverflow.com/q/21163122
has title: atmosphere javascript client - reason for AtmosphereRequest#timeout
has body: What is the reason of timeout parameter of AtmosphereRequest? I am talking about javascript client library - see https://github.com/Atmosphere/atmosphere/wiki/jQuery.atmosphere.js-atmosphere.js-API#timeout-default--300000 where is said this: Timeout The maximum time a connection stay opened when no message (or event) are sent or received. In what usecases it is useful? Why it has default value of 5 minutes (300000 ms)?
favorite count: 0
tagged with: atmosphere
answer count: 0
downvote count: 0
type: UnansweredQuestion
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35877569
upvote count: 1

http://stackoverflow.com/comment/31688467
score: 1
comment on: http://stackoverflow.com/q/21071056
has text: Have you initialised `rand`?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21108216
has comment: http://stackoverflow.com/comment/31757573
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/31757079
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31757119
tagged with: java
has body: I'm trying to use widely-used(according to google) approach for creating canvas drawing in separate thread, it uses thread like below @Override public void run() { Canvas c; while (running) { c=null; try { c = mySurfaceHolder.lockCanvas(null); } .... Here I have infinite loop with calling lockCanvas() method, but I'm confused - sometimes lockCanvas() method is extremely slow and coupled with the fact that I have infinite loop - I have really bad performance sometimes. Could you please advise, how can I avoid this performance issue and is there any other approach for drawing on canvas?
has comment: http://stackoverflow.com/comment/31757204
downvote count: 0
has comment: http://stackoverflow.com/comment/31757022
tagged with: android-canvas
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: Android SurfaceView, thread for drawing, lockCanvas in infinite loop

http://stackoverflow.com/comment/32693991
score: 0
comment on: http://stackoverflow.com/q/21047701
has text: Not sure why the jar fails to run on some hardware, but the fact that memory usage increases when not in debug should not be a problem. It's conceivable that the normal JRE would run the GC less often than the debug JRE in order to increase possible performance.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21697963
has comment: http://stackoverflow.com/comment/32806568
downvote count: 0
answers question: http://stackoverflow.com/q/21024637
type: Answer
has body: you can create separate class for connection. public class HibernateUtil { private static final SessionFactory sessionFactory = buildSessionFactory(); @SuppressWarnings("deprecation") private static SessionFactory buildSessionFactory() { try { // Create the SessionFactory from Annotation return new AnnotationConfiguration().configure().buildSessionFactory(); } catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } } On Server Side you can write :- Session session=null; Transaction tx=null; try { session =HibernateUtil.getSessionFactory().openSession(); tx=session.beginTransaction(); } catch (HibernateException e) { e.printStackTrace(); }finally { session.close(); }
upvote count: 2
score: 2

http://stackoverflow.com/comment/31635950
has text: return `row` in table model instead of converted value.
comment on: http://stackoverflow.com/q/21041837
type: Comment
type: QuestionComment
score: 1

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/21134056
type: Tag
tags question: http://stackoverflow.com/q/21046946
tags question: http://stackoverflow.com/q/21151147
tags question: http://stackoverflow.com/q/21178161
tags question: http://stackoverflow.com/q/21033666

http://stackoverflow.com/comment/31812117
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21138617
has text: very nice solution! However I am (company policy..) locked down to Eclipse Platform Version: 3.7.2 Build id: M20120208-0800 and that option is not in there.

http://stackoverflow.com/q/21064253
has answer: http://stackoverflow.com/a/21064598
has title: How to check the continuousness of a string array & if it is not in the continuousness, then remove it?
has comment: http://stackoverflow.com/comment/31675880
has body: Ok, here is my requirement, I have a following table: ID-Category-No 22-Software-1 45-Software-2 78-Hardware-3 48-Software-4 11-Hardware-5 91-Service -6 95-Service -7 93-Software-8 I select all data with order by No, &amp; put it into a String[], then put this String[] int a list So I will have: String[] s1={"22","Software","1"}; String[] s2={"45","Software","2"}; ..... List&lt;String[]&gt; myL=new ArrayList&lt;String[]&gt;(); myL.add(s1); myL.add(s2); .... Now, from myL, I just want to take all the String[] that has Category in a continuousness, if the category is not in the continuousness, then remove it. Note that: we must take the category that appear first &amp; all of the same category that follows it in a continuousness. So we need to do something so that the final myL will contain only these String[] ID-Category-No 22-Software-1 45-Software-2 78-Hardware-3 91-Service -6 95-Service -7
tagged with: arrays
has comment: http://stackoverflow.com/comment/31675774
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31676017
has comment: http://stackoverflow.com/comment/31676113
has comment: http://stackoverflow.com/comment/31675978
tagged with: string
has comment: http://stackoverflow.com/comment/31675844
has answer: http://stackoverflow.com/a/21065139
favorite count: 0
possible better answer: http://stackoverflow.com/a/21064598
has answer: http://stackoverflow.com/a/21064820
accepted answer: http://stackoverflow.com/a/21064820
has comment: http://stackoverflow.com/comment/31676071
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31675799
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31675824
has comment: http://stackoverflow.com/comment/31675914
type: Question

http://stackoverflow.com/a/21060508
type: Answer
upvote count: 1
has body: It seems that you're using System.out.println statements to debug Hadoop jobs. The problem with this approach is that println statements don't go to your console. They go to the job logs. That's why you don't see "Mapper init!" in your console. You need to look at the job logs. To quote a great man (and this answer): Easy way to access the logs is http://example.com:50030/jobtracker.jsp->click on the completed job->click on map or reduce task->click on tasknumber->task logs->stdout logs.
answers question: http://stackoverflow.com/q/21050814
downvote count: 0
score: 1

http://stackoverflow.com/q/21181761
type: Question
has answer: http://stackoverflow.com/a/21181809
has title: java maven-compiler-plugin:3.1, javacTask: source release 1.7 requires target release 1.7
possible better answer: http://stackoverflow.com/a/21181854
accepted answer: http://stackoverflow.com/a/21181807
has answer: http://stackoverflow.com/a/21181854
answer count: 3
favorite count: 0
tagged with: maven-compiler-plugin
type: AnsweredQuestion
has body: I have a Java code that I want to build for Java 1.7. org.apache.maven.plugins maven-compiler-plugin 3.1 1.7 1.7 But I receive the following error: javacTask: source release 1.7 requires target release 1.7 The below debug outputs shows that target is 1.5: -d C:\Users\przemekb\Documents\NetBeansProjects\ManagingPersistanceObjects\target\classes -classpath C:\Users\przemekb\Documents\NetBeansProjects\ManagingPersistanceObjects\target\classes; C:\Users\przemekb\.m2\repository\org\hibernate\hibernate-validator\5.0.0.Final\hibernate-validator-5.0.0.Final.jar; C:\Users\przemekb\.m2\repository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar; C:\Users\przemekb\.m2\repository\org\jboss\logging\jboss-logging\3.1.1.GA\jboss-logging-3.1.1.GA.jar; C:\Users\przemekb\.m2\repository\com\fasterxml\classmate\0.8.0\classmate-0.8.0.jar; C:\Users\przemekb\.m2\repository\org\hibernate\javax\persistence\hibernate-jpa-2.1-api\1.0.0.Final\hibernate-jpa-2.1-api-1.0.0.Final.jar; C:\Users\przemekb\.m2\repository\javax\persistence\persistence-api\1.0\persistence-api-1.0.jar; C:\Users\przemekb\.m2\repository\org\eclipse\persistence\javax.persistence\2.1.0\javax.persistence-2.1.0.jar; C:\Users\przemekb\.m2\repository\org\eclipse\persistence\eclipselink\2.5.1\eclipselink-2.5.1.jar; C:\Users\przemekb\.m2\repository\org\eclipse\persistence\commonj.sdo\2.1.1\commonj.sdo-2.1.1.jar; C:\Users\przemekb\.m2\repository\org\eclipse\persistence\org.eclipse.persistence.jpa\2.5.1\org.eclipse.persistence.jpa-2.5.1.jar; C:\Users\przemekb\.m2\repository\org\eclipse\persistence\org.eclipse.persistence.asm\2.5.1\org.eclipse.persistence.asm-2.5.1.jar; C:\Users\przemekb\.m2\repository\org\eclipse\persistence\org.eclipse.persistence.antlr\2.5.1\org.eclipse.persistence.antlr-2.5.1.jar; C:\Users\przemekb\.m2\repository\org\eclipse\persistence\org.eclipse.persistence.jpa.jpql\2.5.1\org.eclipse.persistence.jpa.jpql-2.5.1.jar; C:\Users\przemekb\.m2\repository\org\eclipse\persistence\org.eclipse.p…
score: 0
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/21181807
downvote count: 1

http://stackoverflow.com/a/21024165
has body: Your printString2DArray method should look like: private static void printString2DArray(String[][] in) { for (int i = 0; i &lt; in.length; i++) { for (int j = 0; j &lt; in[i].length; j++) { if (i != 0 &amp;&amp; j == 0) { // This is just formatting (you may want to change it) System.out.print(", "); } System.out.print(in[i][j]); } } } To iterate over the array String[][] you may use 2 indexes(i and j), since it is a 2-dimensional array. Edit: Instead of this: char1 = new String[][] { new String[] { hexRGB.getCheck_hex2() } //error stated incompatible types }; you could try: char1 = hexRGB.getCheck_hex2();
accepted answer of: http://stackoverflow.com/q/21024069
has comment: http://stackoverflow.com/comment/31602980
has comment: http://stackoverflow.com/comment/31603721
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31603606
answers question: http://stackoverflow.com/q/21024069
has comment: http://stackoverflow.com/comment/31604791
score: 0
type: Answer

http://stackoverflow.com/comment/31904049
comment on: http://stackoverflow.com/q/21180969
has text: I found the answer and I posted it but I can't accept it today.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31673710
comment on: http://stackoverflow.com/q/21062727
score: 0
type: Comment
type: QuestionComment
has text: Parcable or literal. It's quite straight forward. Just follow the docs.

http://stackoverflow.com/comment/31865494
comment on: http://stackoverflow.com/a/21167805
score: 0
has text: @Max OK, suggested some workaround. I guess you figured it out yourself too.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21182097
downvote count: 0
has body: You can use the JavaCompiler to compile any java code to a class file. You can then load the resulting class with a URLClassLoader. An example is given in the javadocs or for a complete example you can check this question. Applied to your Class1 it would look like the example below. Note that you need to include all the relevant imports in the code or it won't compile. public static void main(String[] args) throws Exception { String packageName = "some.packagename"; String className = packageName + ".Class1"; String body = "package " + packageName + "; " + "public class Class1 extends ShellBolt implements IRichBolt {\n" + " public Class1() {\n" + " super(\"python\", \"class1.py\");\n" + " }\n" + "\n" + " @Override\n" + " public void declareOutputFields(OutputFieldsDeclarer declarer) {\n" + " declarer.declare(new Fields(arg1));\n" + " }\n" + "\n" + " @Override\n" + " public Map&lt;String, Object&gt; getComponentConfiguration() {\n" + " return null;\n" + " }\n" + "}"; Path classFile = Paths.get(System.getProperty("user.home")); compile(className, body, classFile); Class&lt;?&gt; class1 = loadClass(className, classFile); Method getComponentConfiguration = class1.getDeclaredMethod("getComponentConfiguration"); Map&lt;String, Object&gt; result = (Map&lt;String, Object&gt;) getComponentConfiguration.invoke(class1.newInstance()); } private static Class&lt;?&gt; loadClass(String className, Path path) throws Exception { URLClassLoader loader = new URLClassLoader(new URL[]{path.toUri().toURL()}, Test1.class.getClassLoader()); return loader.loadClass(className); } private static void compile(String className, String body, Path path) throws Exception { List&lt;JavaSourceFromString&gt; sourceCode = Arrays.asList(new JavaSourceFromString(className, body)); JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null); fileManager.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(path.to…
upvote count: 2
answers question: http://stackoverflow.com/q/21181933
type: Answer
score: 2

http://stackoverflow.com/a/21050296
type: Answer
upvote count: 2
score: 2
has body: In one case you call t2.setDaemon(true); on the local t2 variable after the next thread has been started. So you always have at least one non-daemon thread running and that prevents the program from exiting. In the other case, you set the the daemon status on the shared t2 variable which allows the program to exit if that statement is executed before the next thread is started, which randomly happens after a few runs. You could add a System.out.println("is daemon: " + t2.isDaemon()); after t2 = new Thread(this); to better see what is going on.
accepted answer of: http://stackoverflow.com/q/21049978
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21049978
downvote count: 0

http://stackoverflow.com/comment/31746816
type: Comment
comment on: http://stackoverflow.com/q/21051541
has text: @jhadesdev i have only one transaction in the service layer.when i do @Transactional("tx1") and getEntitymanager1() it works fine, but when i remove the first transaction and do @Transactional("tx2") and getEntitymanager2() somehow this getEntityManager2() picks up datasource1 which should be picking datasource2.
score: 0
type: QuestionComment

http://stackoverflow.com/a/21088522
has comment: http://stackoverflow.com/comment/31720464
type: Answer
answers question: http://stackoverflow.com/q/21088383
has body: i dont think so 404 error will come if the url is not correct that means if the requested resource is not founded,also when some scripts missing, but we cant distinguish is it because of missing scripts or jsp...
score: 0

http://stackoverflow.com/comment/31800007
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21131124
has text: @avalancha And now this answer (with explanation) will also start to show up on Google. I use regex so infrequently that I have to Google it every time. For people like me it helps that the specific explanations are with the answer so I do not have to go elsewhere to find out how it works. But I get what you are saying.

http://stackoverflow.com/q/21135766
tagged with: android-layout
has title: Android AVD “Unfortunately, <app> has stopped.” when executing calculator app
has comment: http://stackoverflow.com/comment/31806719
has comment: http://stackoverflow.com/comment/31807063
has comment: http://stackoverflow.com/comment/31806726
answer count: 1
has answer: http://stackoverflow.com/a/21135903
tagged with: android
has body: I made an app of a calculator, where the user will provide numbers and by clicking the button they will get the output. When I am running it in the emulator, it is showing that "Unfortunately, &lt;app&gt; has stopped". My Logcat is: 01-15 05:56:24.200: E/AndroidRuntime(874): FATAL EXCEPTION: main 01-15 05:56:24.200: E/AndroidRuntime(874): Process: com1.example.calculator, PID: 874 01-15 05:56:24.200: E/AndroidRuntime(874): java.lang.IllegalStateException: Could not execute method of the activity 01-15 05:56:24.200: E/AndroidRuntime(874): at android.view.View$1.onClick(View.java:3814) 01-15 05:56:24.200: E/AndroidRuntime(874): at android.view.View.performClick(View.java:4424) 01-15 05:56:24.200: E/AndroidRuntime(874): at android.view.View$PerformClick.run(View.java:18383) 01-15 05:56:24.200: E/AndroidRuntime(874): at android.os.Handler.handleCallback(Handler.java:733) 01-15 05:56:24.200: E/AndroidRuntime(874): at android.os.Handler.dispatchMessage(Handler.java:95) 01-15 05:56:24.200: E/AndroidRuntime(874): at android.os.Looper.loop(Looper.java:137) 01-15 05:56:24.200: E/AndroidRuntime(874): at android.app.ActivityThread.main(ActivityThread.java:4998) 01-15 05:56:24.200: E/AndroidRuntime(874): at java.lang.reflect.Method.invokeNative(Native Method) 01-15 05:56:24.200: E/AndroidRuntime(874): at java.lang.reflect.Method.invoke(Method.java:515) 01-15 05:56:24.200: E/AndroidRuntime(874): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777) 01-15 05:56:24.200: E/AndroidRuntime(874): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593) 01-15 05:56:24.200: E/AndroidRuntime(874): at dalvik.system.NativeStart.main(Native Method) 01-15 05:56:24.200: E/AndroidRuntime(874): Caused by: java.lang.reflect.InvocationTargetException 01-15 05:56:24.200: E/AndroidRuntime(874): at java.lang.reflect.Method.invokeNative(Native Method) 01-15 05:56:24.200: E/AndroidRuntime(874): at java.lang.reflect.Method.invoke(Method.java:515) 01-15 05:56:24.200: E…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31806720
score: 0
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21135903

http://stackoverflow.com/q/21160589
answer count: 2
upvote count: 1
has body: I am able to create the sheets for different .csv files present in a folder in one Excel workbook using below java code But i am getting the data of all the csv file data in to single worksheet. i am unable to get the data same as the orginal .csv files into specified sheets public class CreateExlFile22{ public static void main(String[]args){ try{ HSSFWorkbook workbook=new HSSFWorkbook(); File folder = new File("F:/csvfiles/"); File[] listOfFiles = folder.listFiles(); for (File file : listOfFiles) { if (file.isFile()) { System.out.println(file.getName()); String thisline; ArrayList&lt;String&gt; al = null; ArrayList&lt;ArrayList&lt;String&gt;&gt; arlist = new ArrayList&lt;ArrayList&lt;String&gt;&gt;(); HSSFSheet sheet = workbook.createSheet(file.getName()); FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(".csv"); } }; File file1[]=folder.listFiles(filter); for(int r=0;r&lt;file1.length;r++){ File currentFile=file1[r]; FileInputStream fis = new FileInputStream(currentFile); BufferedReader br = new BufferedReader(new InputStreamReader(fis)); while ((thisline = br.readLine()) != null) { al = new ArrayList&lt;String&gt;(); String strar[] = thisline.split(","); for (int j = 0; j &lt; strar.length; j++) { al.add(strar[j]); } arlist.add(al); //i++; } fis.close(); for (int k = 0; k &lt; arlist.size(); k++) { ArrayList&lt;String&gt; ardata = (ArrayList&lt;String&gt;) arlist.get(k); HSSFRow row = sheet.createRow((short) k); for (int p = 0; p &lt; ardata.size(); p++) { HSSFCell cell = row.createCell((short) p); cell.setCellValue(ardata.get(p).toString()); } } FileOutputStream fileOut = new FileOutputStream("F://NewWBFile.xls"); workbook.write(fileOut); fileOut.flush(); fileOut.close(); br.close(); } } } System.out.println("Your excel file has been generated!"); } catch ( Exception ex ) { System.out.println(ex); } } }
possible better answer: http://stackoverflow.com/a/62949029
has comment: http://stackoverflow.com/comment/31886459
score: 0
has comment: http://stackoverflow.com/comment/31886343
has comment: http://stackoverflow.com/comment/31886135
has title: I am trying to combine multiple csv files into one excel workbook as different sheets using java
downvote count: 1
favorite count: 0
tagged with: apache-poi
has answer: http://stackoverflow.com/a/62949029
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21179800
accepted answer: http://stackoverflow.com/a/21179800
tagged with: java
has comment: http://stackoverflow.com/comment/31886172
type: Question

http://stackoverflow.com/comment/31707050
type: QuestionComment
has text: What is your actual output? Are you getting a result less than the expected? Are you getting 0?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21081051

http://stackoverflow.com/a/21088387
answers question: http://stackoverflow.com/q/21025546
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Ok it works now, using the aries blueprint framework as well. I've signed the aries blueprint, proxy and utils jars manually (so they are core bundles as well) to see if this would solve the problem. Worked fine. I'll now create a maven module, where i'll put all the blueprint bundles i need. So i can sign this bundle and don't need to sign each jar separately and also just have one bundle i'll need to deploy.
score: 1
accepted answer of: http://stackoverflow.com/q/21025546
upvote count: 1

garbage-collection
tags question: http://stackoverflow.com/q/21128802
tags question: http://stackoverflow.com/q/21042377
tags question: http://stackoverflow.com/q/21043741
tags question: http://stackoverflow.com/q/21077873
tags question: http://stackoverflow.com/q/21137162
tags question: http://stackoverflow.com/q/21039362
tags question: http://stackoverflow.com/q/21075345
tag name: garbage-collection
tags question: http://stackoverflow.com/q/21043681
tags question: http://stackoverflow.com/q/21178353
type: Tag
tags question: http://stackoverflow.com/q/21182572
tags question: http://stackoverflow.com/q/21044194
tags question: http://stackoverflow.com/q/21040409
tags question: http://stackoverflow.com/q/21041564

http://stackoverflow.com/q/21113114
has comment: http://stackoverflow.com/comment/31765631
has comment: http://stackoverflow.com/comment/31765804
tagged with: java
has title: Searching for a List of Strings start with a particular String from a sorted ArrayList in java
possible better answer: http://stackoverflow.com/a/21113355
has answer: http://stackoverflow.com/a/21113355
tagged with: search
has comment: http://stackoverflow.com/comment/31765906
score: 2
type: AnsweredQuestion
has body: Here I have an English wordlist : (For example ) account angel apple application black ... And I want to search for strings which start with a particular String. For example : the result for "ap" should be { apple, application }. It can be easily implemented by sequence search based solution to return a set corresponding Strings. But out there still have algorithms stronger than sequence search but they return a String only. So, Any ideal to return a set corresponding String from the ArrayList faster than sequence search based one? Thanks!
accepted answer: http://stackoverflow.com/a/21113568
downvote count: 0
has comment: http://stackoverflow.com/comment/31765701
tagged with: string
favorite count: 0
type: Question
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/31765450
has answer: http://stackoverflow.com/a/21113568

http://stackoverflow.com/comment/31820665
type: Comment
comment on: http://stackoverflow.com/q/21143212
has text: @RohitJain I meant the `public class Generics()` part (an example where new lines in comments would be great)
score: 0
type: QuestionComment

http://stackoverflow.com/a/21150412
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21146693
has comment: http://stackoverflow.com/comment/31878371
has body: This is rather impossible to say without viewing your code, knowing if you use parallelization, etc. Indeed, as MrAzzaman says, profiling is the first thing to do. If you find a single bottleneck, especially if it is loop-heavy, it might be sufficient to write that part in C and connect it to Matlab via MEX. In genetics algorithms, I'd believe that a 10x speed increase could be obtained rather than not. I do not quite agree with MrAzzaman here - in some cases (for loops, working with dynamic objects) is much, much slower than C/C++/Java. That is not to say that Matlab is always slow, for it is not, but there is plenty of algorithms where it would be slow. I.e., I'd say that if you don't spend so much time looping over things, don't use objects, are not limited by Matlab's data structures, you might be ok with Matlab. That said, if I was to write GAs in Java or Matlab, I'd rather pick the former (and I'm using Matlab a lot more than Java these days, it's not just a matter of habit). Btw. if you don't want to program it yourself, have a look at JGAP, it's a rather useful Java library for GAs.

http://stackoverflow.com/comment/31845262
has text: Why not to use its `write` method? (http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/Workbook.html#write(java.io.OutputStream))
type: Comment
comment on: http://stackoverflow.com/q/21156461
type: QuestionComment
score: 2

http://stackoverflow.com/comment/31643541
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21046786
has text: This is exactly what i need because i want to add new Weapons later. Also new Weapon types but this then are subclasses. So the question now is: Constantsin class or a file. Isn't it much Trouble loading the files always when you Need new weapon/car? Do you have a file for every car/weapon or 1 file for all of them?

http://stackoverflow.com/q/21164011
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31858213
has title: System property suffix for use in PropertyPlaceholderConfigurer
score: 0
answer count: 2
has body: I having problems defining database properties in different environments. The properties file looks like this: db.url-DEV=host1:port:con... db.user-DEV=user1 db.url-PROD=host2:port:con... db.user-PROD=user2 The suffixes (-DEV,-PROD) are set on server side using a system property. How may I configure my PropertyPlaceholderConfigurer to check for a system property to switch to the right configuration? There has to be a default value if a system property is not set. I have tried something like this, but that did not work: ${#{'db.url'+${systemEnvironmentVar}}} The PropertyConfigurer says 'property with name 'db.url'+${systemEnvironmentVar} not found.
has answer: http://stackoverflow.com/a/21164695
possible better answer: http://stackoverflow.com/a/21164625
has answer: http://stackoverflow.com/a/21164625
tagged with: spring
tagged with: java
accepted answer: http://stackoverflow.com/a/21164695
linked to: http://stackoverflow.com/q/8214862

http://stackoverflow.com/comment/31822472
score: 0
type: Comment
type: QuestionComment
has text: @MxyL Sorry did not mean to put upper case in the comment. replacing dosent work in instances such as when num is equal to mum. I am looking a way to basically go trough each character of two strings. Say character one of string one is m, and character one of string two is n, then it equates that these are equal.
comment on: http://stackoverflow.com/q/21144132

http://stackoverflow.com/q/21142870
has body: I am familiar with JAXB, JAXP and DOM. I know JAXB provides java2xml and xml2java generation(and validation against XML Schema(XSD)). What I want is convenient way to produce XML schema programmatically from scratch. I do not want to produce XSD from java classes. I want to have an object representing the schema itself. For example: XMLSchemaFactory factory = XMLSchemaFactory.newInstance(); XMLSchema schema = factory.newSchema(); schema.setTargetNameSpace("http://www.example.com"); ... schema.addComplexType(complexTypeElement); ... schema.addElement(name, type); ... schema.export(new File("mySchema.xsd")); I know XML schema is itself XML, so I can use Document, Element, Node and other classes/interfaces from org.w3c.dom, but I wonder is there something more convenient ? Why I want this - I have some IDL, which I have to translate to WSDL. I have lexer/parser for the IDL and I have convenient representation of it as java objects. Now I want to produce the WSDL using this objects => a lot of XML schemas have to be generated !
type: UnansweredQuestion
tagged with: xsd
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21143266
tagged with: dom
type: Question
has comment: http://stackoverflow.com/comment/31819583
has title: Java API for XML Schema manipulation
downvote count: 0
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has comment: http://stackoverflow.com/comment/31820376

http://stackoverflow.com/comment/31667993
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21060011
type: Comment
has text: how would i override them. Sry im new to this.

http://stackoverflow.com/comment/31678919
comment on: http://stackoverflow.com/q/21065103
score: 0
type: Comment
type: QuestionComment
has text: I didn't know that `System.out.println(chooseSkin() =="com.jtattoo.plaf.aluminium.AluminiumLookAndFeel");` would return me **true** or **false**, I've just tried it and it returns false... I'm editing the question to show you the code. Thanks

http://stackoverflow.com/comment/31742018
type: Comment
has text: Oh wait. I see now you're talking more along the lines of defining interfaces to use as data types! (http://docs.oracle.com/javase/tutorial/java/IandI/interfaceAsType.html) I was just thinking of when a class implements an interface.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21098970

http://stackoverflow.com/comment/31797170
has text: See my original post - I added that yo my method
score: 1
comment on: http://stackoverflow.com/a/21129751
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21140559
tagged with: jersey
accepted answer: http://stackoverflow.com/a/21146277
downvote count: 0
answer count: 1
favorite count: 0
has title: How to debug IncompatibleClassChange error in a Java War project (Jersey)?
upvote count: 3
has body: I understand what the error is: There is a jar with a class that is not what the caller is expecting. My problem is that the error does not tell me the offending class or jar in my dependency tree. I'll tell you a bit about my project, and then I'll post the error itself. Again, I'm mostly trying to learn how to debug such an error in general. Solving the problem is a bonus for me. Are there any run-time analysis tools for WAR files? Is there something in the error that I am missing? Project It's a Jersey project, running on Tomcat. I am using eclipse for development. It's also a Maven project. It has a dependency on another project which is one of our projects. After digging, it seems the conflict is with a sub-dependency of our project. Error Jan 15, 2014 9:47:21 AM org.apache.catalina.core.ApplicationContext log SEVERE: StandardWrapper.Throwable java.lang.IncompatibleClassChangeError: Implementing class at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2918) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1174) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1669) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547) at org.glassfish.jersey.server.ResourceConfig.scanClasses(ResourceConfig.java:875) at org.glassfish.jersey.server.ResourceConfig._getClasses(ResourceConfig.java:840) at org.glassfish.jersey.server.ResourceConfig.getClasses(ResourceConfig.java:755) at org.glassfish.jersey.server.ResourceConfig$RuntimeConfig.&lt;init&gt;(ResourceConfig.java:1171) at org.glassfish.jersey.server.ResourceConfig$RuntimeConfig.&lt;init&gt;(ResourceConfig.java:1144) at org.glassfish.jersey.server.ResourceConfig.createRuntimeConfig(ResourceConfig.java:1140)…
has answer: http://stackoverflow.com/a/21146277
tagged with: maven
type: Question
type: AnsweredQuestion
score: 3
tagged with: java

http://stackoverflow.com/a/21070428
upvote count: 1
answers question: http://stackoverflow.com/q/21070392
downvote count: 0
score: 1
type: Answer
has body: NOTE: The question has been edited since I wrote this answer. This check seems to be wrong: if (px &gt;= 0 || py &gt;= 0 || px &lt; width || py &lt; height) You'll want logical AND (&amp;&amp;) instead of OR (||), otherwise it could be letting through invalid values of px or py. That's possibly what's causing your array index error (although you haven't shared enough code to be certain of that).

http://stackoverflow.com/comment/129988784
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21170413
has text: @AleksandrM - `<s:property value="domainName(domainId)" />` This doesn't work anymore!
type: QuestionComment

http://stackoverflow.com/comment/31852579
has text: Please show us your code.
type: QuestionComment
comment on: http://stackoverflow.com/q/21160964
type: Comment
score: 4

http://stackoverflow.com/comment/31758071
has text: There is no `jar hell` with maven :) But your old configuration stinks like `jar hell` solution.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21108953

http://stackoverflow.com/comment/100258088
has text: Great answer, but how can i modify the result after i run splitter? i got error Collections$UnmodifiableMap.put
comment on: http://stackoverflow.com/a/21166984
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21176883
tagged with: servlets
has body: Consider the following JSP : Product Inventory Program LOG-OUT Client's page - Please choose one of the options below Hello ${name.firstName} ${name.lastName} , You've logged in successfully! Please choose one of the following options View all the products in the store Press here to continue I have a Servlet called clientAction1 : package controller.client; import java.io.IOException; import java.sql.SQLException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import db.DatabaseInventory; /** * Servlet implementation class Client1_before */ @WebServlet("/clientAction1") public class Client1_inventory extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); synchronized(session) { String grabbedNameAndLastName = request.getParameter("nameAndLastName"); // do something with // uncomment this code if you want to use a for loop // ArrayList<String> inventory = null; String inventoryStringVersion = null; DatabaseInventory myDatabase = new DatabaseInventory(); try { myDatabase.initiateConnection(); // open connection } catch (ClassNotFoundException e1) {e1.printStackTrace();} try { // uncomment this code if you want to use a for loop // inventory = myDatabase.getInventoryProducts(); inventoryStringVersion = myDatabase.returnInventoryWholeString(); } catch (SQLException e) {e.printStackTrace();} // uncomment this code if you want to use a for loop // request.setAttribute("inventoryList", inventory); request.setAttribute("inventoryBigString", inventoryStringVersion); // forwards to the page employeeOpenNewAccount.jsp request.getRequestDispatcher("/WEB-INF/results/client" + "/client1_seeInventory.js…
answer count: 2
has title: How to pass grabbed values in JSP to Servlet?
upvote count: 0
tagged with: jsp
favorite count: 0
possible better answer: http://stackoverflow.com/a/21177072
has answer: http://stackoverflow.com/a/21177072
has comment: http://stackoverflow.com/comment/31882379
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31882358
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31882104
has comment: http://stackoverflow.com/comment/31882126
has answer: http://stackoverflow.com/a/21176951
has comment: http://stackoverflow.com/comment/31882411
score: -1
accepted answer: http://stackoverflow.com/a/21176951

http://stackoverflow.com/q/21062744
upvote count: 6
favorite count: 0
accepted answer: http://stackoverflow.com/a/21062791
has answer: http://stackoverflow.com/a/21062984
score: 6
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21062782
has title: Why does InputStream read() return an int and not a short?
tagged with: java
possible better answer: http://stackoverflow.com/a/21062782
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/21062791
answer count: 3
has body: I was reading the byte stream trial and noticed the following statement Notice that read() returns an int value. If the input is a stream of bytes, why doesn't read() return a byte value? Using a int as a return type allows read() to use -1 to indicate that it has reached the end of the stream. The given reason for using an int is that they can identify EOF by a -1. (seems shallow) So the next bigger primitive type is short and it also supports -1 so why not use it? From what i gather: (reasons to use int) Due to performance int is preferred. (this) int variable holds a character value in its last 16 bits (from character trial) Other more abstract streams would need to read more than just one byte (something that i guess (happens with character streams)) Are my reasons correct? Am i missing something (like error correction)?

http://stackoverflow.com/comment/31849814
type: QuestionComment
has text: I can't get what you want your output to be? Could you type an example of output that you need? @Nidhhog
type: Comment
comment on: http://stackoverflow.com/q/21158926
score: 0

http://stackoverflow.com/q/21096276
type: Question
has answer: http://stackoverflow.com/a/21096733
has answer: http://stackoverflow.com/a/21096547
has answer: http://stackoverflow.com/a/21098691
has answer: http://stackoverflow.com/a/21096410
has comment: http://stackoverflow.com/comment/31735109
has comment: http://stackoverflow.com/comment/31734959
has answer: http://stackoverflow.com/a/21100619
has answer: http://stackoverflow.com/a/21096444
has answer: http://stackoverflow.com/a/21096434
score: 20
downvote count: 4
has answer: http://stackoverflow.com/a/21096390
has comment: http://stackoverflow.com/comment/31738112
has answer: http://stackoverflow.com/a/21096335
has comment: http://stackoverflow.com/comment/32342393
answer count: 17
has comment: http://stackoverflow.com/comment/31738511
favorite count: 0
has answer: http://stackoverflow.com/a/21098564
has answer: http://stackoverflow.com/a/21096416
has comment: http://stackoverflow.com/comment/31745298
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21099219
has answer: http://stackoverflow.com/a/21099018
has title: Why is this loop bad practice?
has comment: http://stackoverflow.com/comment/31737278
has answer: http://stackoverflow.com/a/21099865
tagged with: coding-style
has comment: http://stackoverflow.com/comment/31734843
tagged with: java
has answer: http://stackoverflow.com/a/21096981
has answer: http://stackoverflow.com/a/21099941
has body: The following loop is not good practice. Is it due to a String being the main condition of the for loop rather than an int variable, meaning the for loop is infinite? Also, is it due to there being no instance to enter 'end' to stop the loop? Scanner in = new Scanner(System.in); int i = 0; for (String s = in.next(); !s.equals("end"); i++) { System.out.println("The value of i is: " + i + " and you entered " + s); } How can I rewrite it, so that it conforms to accepted style? (This is a question in a past exam paper.)
has answer: http://stackoverflow.com/a/21096353
tagged with: loops
upvote count: 24

http://stackoverflow.com/comment/31765631
has text: before you search for a faster version: have you profiled the existing code and found it to be an actual bottleneck?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21113114

http://stackoverflow.com/a/21109224
answers question: http://stackoverflow.com/q/21107060
upvote count: 1
type: Answer
has body: I think you are talking about the Monitor principle. This is used to avoid deadlocks while accessing data on memory, that is shared with many threads or processes. If you doing so, please inform yourself about the synchronized block in Java. This ensures that no other thread can access this object at the same time as the thread who is holding the synchronized block in his method body. If the other ones wants to access this data, while you are in synchronzied block, the others have to wait until the current worker thread has leave this state on the relevant object/data.
downvote count: 0
score: 1

http://stackoverflow.com/comment/31687517
score: 0
comment on: http://stackoverflow.com/q/21070459
type: Comment
type: QuestionComment
has text: You've defined ` com.google.caliper.runner.CaliperMain ` in Maven but post the main method inside `MyXercesSAXHandlerBenchmark`?!

http://stackoverflow.com/comment/31823245
comment on: http://stackoverflow.com/a/21144713
type: Comment
score: 0
type: AnswerComment
has text: You can have: while node1 doesnt equal node2 and node1 hasn't reached the end, node1 = node1.nextNode.nextNode, node2 = nextNode.

http://stackoverflow.com/q/21135955
has answer: http://stackoverflow.com/a/21136157
has title: Replace regex characters
has body: I want to replace the substring \\d+-\\d+ to a random genarated number in this String &lt;!-- This is Siebel Order identified --&gt; &lt;tns:id&gt; &lt;tns:idValue&gt;\\d+-\\d+&lt;/tns:idValue. I am using the code below String REGEXSIEBEL = "&lt;!-- This is Siebel Order identified --&gt; &lt;tns:id&gt; &lt;tns:idValue&gt;\\d+-\\d+&lt;/tns:idValue&gt;"; java.util.regex.Pattern p1 = java.util.regex.Pattern.compile(REGEXSIEBEL); java.util.regex.Matcher m = p1.matcher(INPUT); INPUT = m.replaceAll(REGEXSIEBEL.replaceAll(String.valueOf("\\d+-\\d+"), String.valueOf(randomInt))); But it doesnt work.
type: UnansweredQuestion
tagged with: regex
has answer: http://stackoverflow.com/a/21136146
tagged with: java
has comment: http://stackoverflow.com/comment/31807243
type: Question
tagged with: substring
score: 0
answer count: 2

http://stackoverflow.com/q/21073564
type: AnsweredQuestion
has title: Efficiently find which datacenter my machine is in along with its full node?
tagged with: java
has comment: http://stackoverflow.com/comment/31692994
upvote count: 1
accepted answer: http://stackoverflow.com/a/21073636
downvote count: 1
type: Question
tagged with: enums
has comment: http://stackoverflow.com/comment/31693028
score: 0
has body: In our company we can have a machine hostname as - dbx111.dc1.host.com dbx112.dc2.host.com dcx113.dc3.host.com Here dc1, dc2, dc3 are our datacenter and we will be having only three datacenter for now. And also it might be possible that machine hostname can have more dots in between separated by another domain in future. Now I need to find out which datacenter my current machine is in as I will be running below code on the actual machine. If my machine is in DC1 then I need to return /zk/dc1 but if my machine is in DC2 then I need to return /zk/dc2 and if my machine is in DC3 then I would return /zk/dc3. But if my machine datacenter is in DEV, then I would randomly return either /zk/dc1 or /zk/dc2. Currently my below code only writtens, in which DATACENTER I am in such as whether it is either DC1 or DC2 or DC3 or DEV. But I am not sure how to add the above logic as well in this ENUM so that it can also return me /zk/dc1 or /zk/dc2 or /zk/dc3 depending on which datacenter I am in. And also if I just need to get only which Datacenter I am in, then it should be able to work that way as well. public static void main(String[] args) { System.out.println(DatacenterEnum.getCurrentDatacenter()); } public enum DatacenterEnum { DEV, DC1, DC2, DC3; public static String forCode(int code) { return (code &gt;= 0 &amp;&amp; code &lt; values().length) ? values()[code].name() : null; } private static final DatacenterEnum ourlocation = compareLocation(); private static DatacenterEnum compareLocation() { String ourhost = getHostName(); for (DatacenterEnum dc : values()) { String namepart = "." + dc.name().toLowerCase() + "."; if (ourhost.indexOf(namepart) &gt;= 0) { return dc; } } return null; } private static final String getHostName() { try { return InetAddress.getLocalHost().getCanonicalHostName().toLowerCase(); } catch (UnknownHostException e) { //log error } return null; } public static DatacenterEnum getCurrentDatacenter() { return ourlocation; } } Any idea how this can be done e…
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21073636
has comment: http://stackoverflow.com/comment/31693396
tagged with: hostname

http://stackoverflow.com/comment/31764860
type: QuestionComment
comment on: http://stackoverflow.com/q/21112816
score: 0
has text: check you schema, check if its correct and is same in which you need to insert values..
type: Comment

http://stackoverflow.com/comment/31667909
comment on: http://stackoverflow.com/a/21060012
has text: yep use substring to remove `[` and `]` ... or simply use `str .replace("[", "");` and `str .replace("]", "");`
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21115909
answers question: http://stackoverflow.com/q/21115826
score: 0
has body: calling timeToDisplay.format() will NOT change your actual timeToDisplay reference. However, it will return the new string. Add this to your code: String formattedTime = timeToDisplay.format("%d min, %d sec", TimeUnit.MILLISECONDS.toMinutes(millis), TimeUnit.MILLISECONDS.toSeconds(millis) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(millis))); Then, use formattedTime in your setText
type: Answer
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/31837140
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21151019
has text: If I post much code, I post much code, If I Post less code I post poor code......... Go to shit guys......... Who voted bad my post

http://stackoverflow.com/a/21033641
upvote count: 5
has body: Thread safe implementations(examples) on Wiki - Singleton Pattern on Wikipedia As in the link above, a single-element enum type is the best way to implement a Singleton for any Java that supports enums. One of the best yet simple ones: public class ClientFactory{ private ClientFactory() {} private static ClientFactory INSTANCE=null; public static ClientFactory getInstance() { if(INSTANCE==null){ synchronize(ClientFactory.class){ if(INSTANCE==null) // check again within synchronized block to guard for race condition INSTANCE=new ClientFactory(); } } return INSTANCE; } } Source: Wikipedia
downvote count: 0
has comment: http://stackoverflow.com/comment/97105376
score: 5
type: Answer
answers question: http://stackoverflow.com/q/21033112

http://stackoverflow.com/q/21135671
tagged with: cxf
tagged with: java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21965018
downvote count: 0
has body: I am using Apache CXF and I'd like to use the SecureAnnotationsInterceptor to secure my endpoint with the @RolesAllowed annotation. As far as I understand, I have to tell the interceptor which object to protect through passing the reference to the setSecuredObject method. Unfortunatly, the code isn't design to handle a list of bean. I am then wondering how to secure multiple endpoint with this interceptor. Do I have to create my own version of this interceptor or to create multiple instance of it (one per endpoint to secure) or something else ?
favorite count: 0
tagged with: security
has answer: http://stackoverflow.com/a/44577266
tagged with: rest
type: Question
score: 1
possible better answer: http://stackoverflow.com/a/44577266
accepted answer: http://stackoverflow.com/a/21965018
has title: How to secure multiple endpoint with SecureAnnotationsInterceptor (Apache CXF)?
answer count: 2
tagged with: jsr250
upvote count: 1

http://stackoverflow.com/comment/64928991
score: 2
type: Comment
has text: Won't the Repository solution throw an error on startup? It seems like an entity without a table.
type: AnswerComment
comment on: http://stackoverflow.com/a/38775475

http://stackoverflow.com/comment/31819791
score: 0
has text: Ok, if something comes to you in the middle of the night... Feel free to update the post!
type: Comment
comment on: http://stackoverflow.com/a/21139533
type: AnswerComment

http://stackoverflow.com/q/21178851
has answer: http://stackoverflow.com/a/21179163
has answer: http://stackoverflow.com/a/21179075
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21179864
has comment: http://stackoverflow.com/comment/31885787
has body: I am making a quiz game in java with netbeans. I made an array list for all of my questions and another array list for my answers.I put both of them in order (like number one is what is the capital city of ontario... and on the answers list number one is toronto... so they are all matched up) I made it so that it randomly generates a question... but now I have to get it to match with the answer.... and check if the user's input matches the answer. This is what I have tried but it wont work: String input = inputTextField.getText(); String output = ""; questions = answers -------&gt; Those are the names of my 2 array lists if (input = answers) { output = "Congratulations"; } else if (input != answers) { output = "You got the question wrong"; } ** Please help... also I am a beginner, thank you :)
answer count: 4
tagged with: java
has answer: http://stackoverflow.com/a/21179072
type: Question
has title: Match 2 arraylists of questions and answers for a quiz game in java
tagged with: if-statement
tagged with: arraylist
score: 0
tagged with: string

http://stackoverflow.com/a/23879822
score: 1
answers question: http://stackoverflow.com/q/21147566
has body: I hope this can help you. I have copied a working copy of getPemPrivatekey and the way I call it in the main function: public PrivateKey getPemPrivateKey(String filename, String algorithm) throws Exception { File f = new File(filename); FileInputStream fis = new FileInputStream(f); DataInputStream dis = new DataInputStream(fis); byte[] keyBytes = new byte[(int) f.length()]; dis.readFully(keyBytes); dis.close(); String temp = new String(keyBytes); String privKeyPEM = temp.replace("-----BEGIN PRIVATE KEY-----", ""); privKeyPEM = privKeyPEM.replace("-----END PRIVATE KEY-----", ""); //System.out.println("Private key\n"+privKeyPEM); BASE64Decoder b64 = new BASE64Decoder(); byte[] decoded = b64.decodeBuffer(privKeyPEM); PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(decoded); KeyFactory kf = KeyFactory.getInstance(algorithm); return kf.generatePrivate(spec); } The main program looks like this: ... gcsr = new ...... // instantiate the class here privateKey = gcsr.getPemPrivateKey("c:\\testdir\\java_private.pem", "RSA"); BASE64Encoder encoder1 = new BASE64Encoder(); String s1 = encoder1.encodeBuffer(gcsr.getPrivateKey().getEncoded()); System.out.println("Private Key in Base64:" + s1 + "\n"); This is currently working (Java 8 on my computer!). "gcsr" is the name of the object I instantiated from the class containing the function. Regards.
has comment: http://stackoverflow.com/comment/138654169
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/q/21158038
tagged with: junit
type: Question
has answer: http://stackoverflow.com/a/21158168
has body: Sorry I did not research this issue deeply on the internet or on SO. So down voting is welcome. After all I have a feeling this may be a dump question. However I am giving a shot. I have a project which will contain all of the unit tests. All of the unit tests require a setup which basically creates a jndi namespace. I am doing this with @Before tag on each of my unit test class. So I am doing lots of copy paste which is irritating me a little. Is there a way of creating a singleton class which creates this jndi namespace for all of my unit tests possibly with spring or any other way.
tagged with: spring
has answer: http://stackoverflow.com/a/21158216
accepted answer: http://stackoverflow.com/a/21161173
possible better answer: http://stackoverflow.com/a/21158168
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/31847591
tagged with: jndi
tagged with: java
has title: Is there a way for creating a spring context which can run before all of my junit unit tests which are on different classes?
has answer: http://stackoverflow.com/a/21161173
type: AnsweredQuestion

http://stackoverflow.com/a/21030894
has comment: http://stackoverflow.com/comment/31681787
upvote count: 1
has body: You need add code at at the beginning of yours task code for schedule next launch of task (backup task) with an offset of several second (or minutes, depending on how long task is executed) - for failure execution. And at the end of you task code add code to delete this backup task. If the task is going to die then perform again. Or if task is going to finished with success then backup task will be deleted.
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/31671527
score: 1
answers question: http://stackoverflow.com/q/21025203
has comment: http://stackoverflow.com/comment/31681483

http://stackoverflow.com/q/21031367
upvote count: 1
tagged with: observer-pattern
tagged with: model-view-controller
has answer: http://stackoverflow.com/a/24082612
has answer: http://stackoverflow.com/a/21031715
score: 1
tagged with: java
tagged with: observable
has comment: http://stackoverflow.com/comment/31617757
type: Question
has body: I have a java application that implements the observer/observable pattern. In my MVC model, the observer class is the View, and the observable class is the controller. Every changes in my observable class are sent to the observer one using setChanged(); and notifyObservers(); instructions, and the observer class is changed using the update method. This works allright, the problem is that during the execution, sometimes, the user has to interact with the application using some JButtons defined in the observer class, but I don't know how to send this information to the observable class so that this continues its execution considering the user interaction. in fact, I don't even know if it is possible to do it. Any help will be appreciated.
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21031761
has answer: http://stackoverflow.com/a/21031724
answer count: 4
has title: Sending data from observer to observable
tagged with: jframe
type: UnansweredQuestion

http://stackoverflow.com/q/21024810
type: AnsweredQuestion
has body: I'm writing an application which requires the dynamic implementation of an interface. I had no (obvious) issues regarding generating the class: I verified it with both javap and a decompiler. The problem is, after I generate the class I define and instantiate. Finally, I cast it to the type of the implemented interface. The problem is that I am being hit with a java.lang.ClassCastException: MyGeneratedClass cannot be cast to MyInterface, though I do add MyInterface as an interface when I call ClassWriter.visit. Below is an SSCCE demonstrating the issue for an interface named MyInterface full of void methods. ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS); cw.visit(V1_6, ACC_PUBLIC | ACC_SUPER, "MyGeneratedClass", null, "java/lang/Object", new String[]{MyInterface.class.getName().replace(".", "/"}); { MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "&lt;init&gt;", "()V", null, null); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "&lt;init&gt;", "()V"); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); } for (Method call : MyInterface.class.getDeclaredMethods()) { MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, call.getName(), Type.getMethodDescriptor(call), null, null); // ... mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); } cw.visitEnd(); byte[] raw = cw.toByteArray(); try { return (MyInterface) new ClassLoader() { public Class defineClass(byte[] bytes) { return super.defineClass("MyGeneratedClass", bytes, 0, bytes.length); } }.defineClass(raw).newInstance(); } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); return null; } Printing out the generatedObject.getClass().getInterfaces() does indeed show that MyInterface is implemented. But generatedObject instanceof MyInterface returns false, something which I find a contradiction. Can anyone shed some light on whats happening here? Any help would be greatly appreciated.
has answer: http://stackoverflow.com/a/21025034
type: Question
tagged with: java
has title: Implement interface with ASM: ClassCastException
tagged with: class
score: 0
accepted answer: http://stackoverflow.com/a/21025034
answer count: 1
tagged with: java-bytecode-asm

http://stackoverflow.com/a/21113683
has body: For every letter you can use the [a-zA-Z] regex For example: public static String asenda(String s) { return s.replaceAll("[a-zA-Z]", "*"); }
has comment: http://stackoverflow.com/comment/31766445
has comment: http://stackoverflow.com/comment/31766836
type: Answer
answers question: http://stackoverflow.com/q/21113641
score: 2
upvote count: 3
has comment: http://stackoverflow.com/comment/31766530
downvote count: 1
has comment: http://stackoverflow.com/comment/31766592

http://stackoverflow.com/a/21039168
score: 2
answers question: http://stackoverflow.com/q/21039056
has body: Use the SimpleDateFormat like this: String dateString = "2013.06.24 15:43:00"; SimpleDateFormat sdfToDate = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss"); Date date1 = sdfToDate.parse(dateString); System.out.println(sdfToDate.format(date1));
downvote count: 0
has comment: http://stackoverflow.com/comment/31629886
type: Answer
has comment: http://stackoverflow.com/comment/31630097
has comment: http://stackoverflow.com/comment/31630064
has comment: http://stackoverflow.com/comment/31629984
upvote count: 2
has comment: http://stackoverflow.com/comment/31630104
has comment: http://stackoverflow.com/comment/31629864
has comment: http://stackoverflow.com/comment/31630026
has comment: http://stackoverflow.com/comment/31630314
has comment: http://stackoverflow.com/comment/31630083

http://stackoverflow.com/comment/31891313
has text: @hypd09 Thanks ! Ill try that. Could i then use setText on a TextView directly ? So that the spinner starts the async and then inflates the TextView onComplete.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21181993
score: 0

http://stackoverflow.com/comment/31755420
type: QuestionComment
comment on: http://stackoverflow.com/q/21058476
has text: Please clarify about the `baseChanger(int[] f, int A, int B, int P)` method. Are there requirements about the length of the `f` array? If you are implementing long arithmetics, then you anyway deal with at least `P` Karatsuba multiplications. It gives you about `O(|f| ^ 1.585 * P)` complexity.
score: 0
type: Comment

http://stackoverflow.com/q/21057881
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/21058093
answer count: 1
has body: I am trying to make an android app that downloads and save files with a .mp3 extension only.But it keeps downloading and saving the files on the sdcard without any extension. I posted the code below. @SuppressWarnings("deprecation") private LinearLayout.LayoutParams LP_FW = new LinearLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); private LinearLayout.LayoutParams LP_WW = new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); private String fileName; private String path; private boolean openFlag; private static final int DOWNLOAD = 1; private static final int DOWNLOAD_FINISH = 2; private String mSavePath; private int progress; private boolean cancelUpdate ; private Context mContext; private ProgressBar mProgress; private Dialog mDownloadDialog; private TextView textView; private final String[][] type_amp = {{ ".mp3", "audio/x-mpeg" } }; @Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { init(args.getString(0),args.getString(1),args.getBoolean(2)); showDownloadDialog(); return super.execute(action, args, callbackContext); } private void init(String path,String fileName,boolean openFlag){ this.mContext = this.cordova.getActivity(); this.path = path; this.fileName = fileName; this.openFlag = openFlag; this.cancelUpdate = false; } private void showDownloadDialog() { AlertDialog.Builder builder = new Builder(mContext); builder.setTitle("Downloading Music"); LinearLayout layout = new LinearLayout(mContext); layout.setLayoutParams(LP_FW); layout.setGravity(Gravity.CENTER); layout.setOrientation(LinearLayout.VERTICAL); mProgress = new ProgressBar(mContext, null, android.R.attr.progressBarStyleHorizontal); mProgress.setLayoutParams(LP_FW); layout.addView(mProgress); textView = new TextView(mContext); textView.setLayoutParams(LP_WW); layout.addView(textView); builder.setView(layout); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListe…
tagged with: android
type: AnsweredQuestion
has title: Save File as Mp3 on Sd card { Android app}
tagged with: cordova
has answer: http://stackoverflow.com/a/21058093
type: Question

serialization
tags question: http://stackoverflow.com/q/21182037
tags question: http://stackoverflow.com/q/21064355
tags question: http://stackoverflow.com/q/21160153
tags question: http://stackoverflow.com/q/21110555
tags question: http://stackoverflow.com/q/21121305
tags question: http://stackoverflow.com/q/21120879
tags question: http://stackoverflow.com/q/21048800
tags question: http://stackoverflow.com/q/21089357
tags question: http://stackoverflow.com/q/21069098
tags question: http://stackoverflow.com/q/21127171
tags question: http://stackoverflow.com/q/21073010
tags question: http://stackoverflow.com/q/21158605
tag name: serialization
tags question: http://stackoverflow.com/q/21099645
tags question: http://stackoverflow.com/q/21098021
tags question: http://stackoverflow.com/q/21179484
tags question: http://stackoverflow.com/q/21066413
tags question: http://stackoverflow.com/q/21076136
tags question: http://stackoverflow.com/q/21050307
tags question: http://stackoverflow.com/q/21158485
tags question: http://stackoverflow.com/q/21086647
tags question: http://stackoverflow.com/q/21152793
type: Tag
tags question: http://stackoverflow.com/q/21049511
tags question: http://stackoverflow.com/q/21093048
tags question: http://stackoverflow.com/q/21018718
tags question: http://stackoverflow.com/q/21070988
tags question: http://stackoverflow.com/q/21067147
tags question: http://stackoverflow.com/q/21084884
tags question: http://stackoverflow.com/q/21032831
tags question: http://stackoverflow.com/q/21125295
tags question: http://stackoverflow.com/q/21136901
tags question: http://stackoverflow.com/q/21176508
tags question: http://stackoverflow.com/q/21079208

http://stackoverflow.com/comment/31775665
has text: This seems like the most comprehensive answer so far. However two new errors are introlduced: Cannot find symbol (this is at the catch IOExeption) symbol: class IOExeption location: class relay.Relay1 Cannot find symbol (this is at the RuntimeExeption) symbol: class RuntimeExeption location class relay.Relay1
type: Comment
comment on: http://stackoverflow.com/a/21118345
score: 0
type: AnswerComment

http://stackoverflow.com/q/21036846
answer count: 1
type: UnansweredQuestion
tagged with: primefaces
has answer: http://stackoverflow.com/a/21039180
tagged with: java
type: Question
tagged with: jsf-2
has body: I am using primefaces 4.0 and jsf 2.0 I have a tree structure, I want to show/hide multiple panels on selection &lt;p:tree id="tree" value="#{bean.root}" var="node" dynamic="true" cache="false" animate="true" selectionMode="single" selection="#{bean.selectedNode}"&gt; &lt;p:ajax event="select" update=":MainPageForm:dataPanel" listener="#{bean.onNodeSelect}" /&gt; &lt;p:treeNode id="treeNode"&gt; &lt;p:commandLink id="DYNAMIC ID" style="font-size:15px; width:170px; height:30px;" value="#{node}" /&gt; &lt;/p:treeNode&gt; for now I am trying to set dynamic id on each node using '#{node}' but throws an exception I am using JQuery in my app so right now I am trying to hide/show using JQuery.
tagged with: jquery
score: 0
has title: JSF 2.0, PrimeFaces, Tree dynamic ID to hide/show multiple panels

http://stackoverflow.com/q/21098401
type: Question
has answer: http://stackoverflow.com/a/21098477
accepted answer: http://stackoverflow.com/a/21098477
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31738918
tagged with: recursion
has body: I have a method: public long getAppropriatePMStyleId(Office office, KMLFolder kmlFolder) { Long id = null; KMLFolder folderForStyle = kmlFolder; if (kmlFolder.getParentKMLFolderId() != null) { folderForStyle = kmlFolderServiceImpl.find(kmlFolder.getParentKMLFolderId()); getAppropriatePMStyleId(office, folderForStyle); } else { id = Long.parseLong(folderForStyle.getId()); } return id; } I've observed with the debugger that the method works appropriately until it hits the else case. When it does, the id of the kmlFolder that was passed in to the method is assigned in the debugger panel. However, when I step into where the return id statement is highlighted, the app goes to the line getAppropriatePMStyleId(office, folderForStyle); and throws a null pointer. The method is only called in one place in the app, so I don't think it's being called again from outside. Is there some Java behavior I'm not understanding here?
has title: java calling command in if statement after method returns
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/31687249
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21070163
has text: Okay it is definitely inside the .jar file after compiling it. That makes sense but I can't get it to work at all even in eclipse when I remove "src".

http://stackoverflow.com/q/21150620
favorite count: 0
tagged with: c++
has answer: http://stackoverflow.com/a/21151011
has title: Relationship between High-Level Language (Ex. Java) and Assembly Language?
has answer: http://stackoverflow.com/a/21151012
has answer: http://stackoverflow.com/a/21152151
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31834804
has answer: http://stackoverflow.com/a/21151995
has comment: http://stackoverflow.com/comment/125407045
score: 1
tagged with: java
has body: In my Assembly Language book, the Virtual Machine Levels are listed as follows: Level 4: High-Level Language Level 3: Assembly Language Level 2: Instruction Set Architecture (ISA) Level 1: Digital Logic According to the book, Level 2 (ISA) are instructions for the processor; the ISA is also referred to as machine language. Each instruction in this level gets executed either directly by the computer's hardware or by a program embedded in the microprocessor chip called a microprogram. Above Level 2, is the Assembly Language level 3, programming languages that provide translation layers to make large-scale software development practical. This level uses short mnemonics like ADD, SUB, and MOV that can be easily translated to the ISA on level 2. These type of programs must be translated, or assembled, entirely into machine language at the ISA level before they can be executed. Top tier is Level 4, high-level programming languages such as C, C++, and Java. These are stated as languages containing powerful statements that translate into multiple assembly language instructions. That being said, I'm not quite following what the relationship is between a high-level language, say Java in this case, and Assembly Language. In my view high-level languages are simplified to where a single programmed statement may inherently perform many code lines worth of functionality, unlike assembly which needs an explicit statement for each action. Can anyone provide some input to clear it up for me? This is my first time looking into Assembly, and it thus far is a very different world than my experience in C#.
downvote count: 3
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/31834879
has comment: http://stackoverflow.com/comment/125407113
type: Question
upvote count: 4
linked to: http://stackoverflow.com/q/466790
has comment: http://stackoverflow.com/comment/31835076
has answer: http://stackoverflow.com/a/21151059
has comment: http://stackoverflow.com/comment/31837188
tagged with: assembly
has comment: http://stackoverflow.com/comment/31834948

http://stackoverflow.com/q/21127862
has body: I have a server-side java application utilizing struts/jsp. For simplicity I won't go into the details of it, and because I'm only concerned about the value of a particular class variable after my application has been executed. This particular class is directly executed from struts. My application is executed after I submit a form from my JSP page. When the action completes, the value of one of my class variables is updated, and I want to access the value of that class variable from a javascript function in my jsp. Currently I can easily display the value of any class variable in the jsp file by referring to the action name that I defined in struts, and the class variable name. Purely as an example, here's what I would have in my jsp: &lt;s: property value="myInformation.birthDate" /&gt; And in the class, birthdate would look something like this: private String birthDate; Of course the getters/setters: public String getBirthDate(){ return birthDate; } public void setBirthDate(String birthDate){ this.birthDate = birthDate; } Here's what struts would look like: &lt;action name="myInformation" class="com.whatever.whatever2.MyInformation" method="execute"&gt; &lt;result name="success"&gt;&lt;/result&gt; &lt;result name="error"&gt;&lt;/result&gt; &lt;/action&gt; What I want to do is store this value in a javascript variable after my application has been executed, for the purpose of loading the value into a javascript array. I just need help capturing the value of "myInformation.birthDate" and storing it in some javascript variable. EDIT - Adding details from the comments for further clarification: The function is in a file.js which I included in my JSP. The JSP contains a jqgrid. The function uses JQuery's "saverow" to make jqgrid columns editable and pass them into the java application. The function loops for each row that is selected. After each execution, "birthDate" has a new value" I want to load each value into an array within the function.
tagged with: struts2
has comment: http://stackoverflow.com/comment/31793925
has comment: http://stackoverflow.com/comment/31793121
has comment: http://stackoverflow.com/comment/31793662
answer count: 1
has title: Need to access Java class variable from javascript
has answer: http://stackoverflow.com/a/21127950
accepted answer: http://stackoverflow.com/a/21127950
favorite count: 0
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31802252
downvote count: 0
tagged with: jsp
tagged with: javascript
has comment: http://stackoverflow.com/comment/31793717

http://stackoverflow.com/q/21172567
downvote count: 0
possible better answer: http://stackoverflow.com/a/21172774
accepted answer: http://stackoverflow.com/a/21188693
favorite count: 0
score: 8
tagged with: rest
upvote count: 8
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has body: I have the following example: This is the request body: public class UserLoginData implements Serializable { private static final long serialVersionUID = 1L; private String username; private String password; //... getter and setters } This is the Controller: @RequestMapping(value = {"/login"}, method = RequestMethod.POST) @ResponseBody public LoginResponse login(@RequestBody(required = true) UserLoginData loginData){ //... some code } This is how I invoke the service: POST /login {"username":"neuquino"} I expect that Spring returns a HTTP 400 BAD REQUEST error, because password is missing. But instead of that, it returns a HTTP 500 INTERNAL SERVER error with the following stacktrace: java.lang.NullPointerException at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:948) ~[spring-webmvc-3.2.2.RELEASE.jar:3.2.2.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838) ~[spring-webmvc-3.2.2.RELEASE.jar:3.2.2.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:755) ... How can I specify to Spring that username and password are required fields in request body?
tagged with: java
has title: How to return 400 HTTP error code when some property of a RequestBody parameter is null?
type: Question
has answer: http://stackoverflow.com/a/21188693
tagged with: jackson
has answer: http://stackoverflow.com/a/21172774
answer count: 2

http://stackoverflow.com/comment/31672193
comment on: http://stackoverflow.com/q/21062211
type: Comment
score: 0
has text: I'm not one of the down voters, but the moment I saw *"plz .. ???"* I was tempted to down-vote. It is best to spell words correctly and use only one question mark. But for 'please' it is simpler to just leave it out entirely. If people know the answer, they will give it. Saying please is considered a waste of space, noise.
type: QuestionComment

http://stackoverflow.com/comment/31687365
score: 0
type: Comment
type: QuestionComment
has text: Corrected the typo. Still doesn't work.
comment on: http://stackoverflow.com/q/21070163

http://stackoverflow.com/q/21172441
has body: I'm trying to send an HTML email using Apache Commons in my Java program. This is my code: HtmlEmail email = new HtmlEmail(); email.setHostName("mail.axc.nl"); email.setSslSmtpPort("465"); email.setAuthenticator(new DefaultAuthenticator("username", "password")); email.setSSLOnConnect(true); email.addTo(emailadr, name); email.setFrom("noreply@smartfix.me", "SmartFix"); email.setSubject("Subject"); email.setHtmlMsg("here goes my message"); email.send(); Now, this works like a charm on my desktop computer (running Windows 8). Now, on my server (running Windows Server 2012), it fails. It always gets the following exception: Sending the email to the following server failed: mail.axc.nl:465 I checked my credentials a dozen times, nothing wrong with them. I can't figure out why this wouldn't work on my Server, while it works perfectly fine on my desktop :S UPDATE: seems like the error occurs whenever you compile and run the program. When my code runs in netbeans, it works just fine. Here's the stack trace: C:\inetpub\tracking>java.exe -jar SmartFixGUI.jar SmartFix Tracking Terminal - loaded successfully. Currently tracking null 71QJD73I3I is a smartphone. Currently tracking 71QJD73I3I 71QJD73I3I is a smartphone. org.apache.commons.mail.EmailException: Sending the email to the following serve r failed : mail.axc.nl:465 at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1410) at org.apache.commons.mail.Email.send(Email.java:1437) at smartfixgui.trackingNumber.sendMail(trackingNumber.java:378) at smartfixgui.infoViewer.jButton2ActionPerformed(infoViewer.java:262) at smartfixgui.infoViewer.access$200(infoViewer.java:19) at smartfixgui.infoViewer$3.actionPerformed(infoViewer.java:149) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.ba…
type: AnsweredQuestion
has title: Sending the email to the following server failed (apache commons - Java)
tagged with: java
has comment: http://stackoverflow.com/comment/77046377
type: Question
accepted answer: http://stackoverflow.com/a/21183987
score: 0
has comment: http://stackoverflow.com/comment/31893651
has comment: http://stackoverflow.com/comment/31873943
has comment: http://stackoverflow.com/comment/31874574
tagged with: apache
answer count: 1
tagged with: email
has answer: http://stackoverflow.com/a/21183987
has comment: http://stackoverflow.com/comment/31893129
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/a/21086170
type: Answer
answers question: http://stackoverflow.com/q/21060737
has body: See WinSCP FAQ How do I know that script completed successfully? You can tell the result of script by WinSCP exit code. Code 0 indicates success, while 1 indicates an error. For more details refer to scripting documentation. Batch script (specified using /script or /command command-line switches) terminates with code 1 immediately once any error occurs. To find out why the script failed, inspect session log. For an example see guide to transfer automation.
score: 0

http://stackoverflow.com/a/21122572
has comment: http://stackoverflow.com/comment/83090556
downvote count: 0
score: 1
upvote count: 1
has body: Both of them will work because api-verify.recaptcha.net/verify is an alias for www.google.com/recaptcha/api/verify. See it for yourself: me@mylaptop:~$ host api-verify.recaptcha.net api-verify.recaptcha.net is an alias for www.l.google.com. www.l.google.com has address 173.194.44.50 www.l.google.com has address 173.194.44.49 www.l.google.com has address 173.194.44.51 www.l.google.com has address 173.194.44.52 www.l.google.com has address 173.194.44.48 www.l.google.com has IPv6 address 2a00:1450:4016:803::1012 Most probably, this is beacuse reCaptcha was acquired by Google, but they did not want to force all people already using it to update their code. Apart from that, the latter is better because it allows to use a SSL encrypted connection.
type: Answer
answers question: http://stackoverflow.com/q/21122528

http://stackoverflow.com/comment/31870073
score: 1
has text: Take a look at : http://developer.android.com/reference/java/text/SimpleDateFormat.html
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21170419

http://stackoverflow.com/a/21083039
has body: This concern can come up when value generation is a time-consuming process. You don't want to lock the whole map and find a missing value, and keep the map locked while you generate the value. You could release the map during generation, but then you could have two simultaneous misses and generations. Instead of directly storing the value with the key, store it inside a reference object: public class Ref&lt;T&gt; { private T value; public T getValue() { return value; } public void setValue(T value) { this.value = value; } } So if you originally had a map of Map&lt;String, MyThing&gt;, you instead use Map&lt;String, Ref&lt;MyThing&gt;&gt;. Don't bother with a concurrent implementation, just use HashMap or LinkedHashMap or whatever. Now you can lock the map to find or create a reference holder, and then release the map. Following that, you can lock the reference to find or create the value object: String key; // key you're looking up Map&lt;String, Ref&lt;MyThing&gt;&gt; map; // the map // Find the reference container, create it if necessary Ref&lt;MyThing&gt; ref; synchronized(map) { ref = map.get(key); if (ref == null) { ref = new Ref&lt;MyThing&gt;(); map.put(key, ref); } } // Map is released at this point // Now get the value, creating if necessary MyThing result; synchronized(ref) { result = ref.getValue(); if (result == null) { result = generateMyThing(); ref.setValue(result); } } // result == your existing or new object
upvote count: 1
answers question: http://stackoverflow.com/q/21082875
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/31613313
comment on: http://stackoverflow.com/q/21020350
score: 0
type: Comment
type: QuestionComment
has text: @PeterLawrey/all thanks for the help..FileInputstrem works fine. Changed my code like InputStream in = new FileInputStream(filePame);

http://stackoverflow.com/comment/31721108
type: AnswerComment
has text: @Drago.. are you there.?
type: Comment
comment on: http://stackoverflow.com/a/21088106
score: 0

http://stackoverflow.com/comment/31716036
has text: I think this depends on the compiler..
score: 0
comment on: http://stackoverflow.com/q/21085963
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21089689
has comment: http://stackoverflow.com/comment/31722190
tagged with: java
has title: My java graphics.drawImage() doesn't show the image passed to it
tagged with: jpanel
accepted answer: http://stackoverflow.com/a/21089758
downvote count: 0
score: 1
tagged with: awt
type: Question
type: AnsweredQuestion
favorite count: 0
has answer: http://stackoverflow.com/a/21089758
tagged with: jframe
has body: I'm creating a simple app in java which shows a JPEG image on the JFrame. I created a class MyPanel Which extends JPanel and overrode the paintComponent() method: import javax.swing.*; import java.awt.*; public class MyPanel extends JPanel { public void paintComponent(Graphics graphics) { Image image = new ImageIcon("ax.jpeg").getImage(); graphics.drawImage(image, 1, 1, this); } } Then I added the newly created panel to my JFrame in my main app class: import javax.swing.*; public class MyGraphicalApp { public JFrame jFrame = new JFrame(); public MyPanel myPanel = new MyPanel(); public static void main(String[] args) { MyGraphicalApp myGraphicalApp = new MyGraphicalApp(); myGraphicalApp.go(); } public void go() { jFrame.getContentPane().add(myPanel); jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jFrame.setSize(300,300); jFrame.setVisible(true); } } The problem is that it doesn't show the image at all. my image resides to my source files: src ------- ax.jpeg | ------- MyGraphicalApp.java | ------- MyPanel.java Thanks for your help.
upvote count: 1
tagged with: swing
answer count: 1

http://stackoverflow.com/q/21103153
has comment: http://stackoverflow.com/comment/31748706
has body: Maybe its something simple i am over looking, but i need to be able to create sub directories using a list of numbers stored in a txt file. When i use a string literal it creates the directory, but when i switch to using the variable being used for the items in the list it will not. Here is the code block. private static void GetJarDir() throws URISyntaxException { CodeSource codeSource = NewJFrame.class.getProtectionDomain().getCodeSource(); File jarFile = null; jarFile = new File(codeSource.getLocation().toURI().getPath()); jarDir = jarFile.getParentFile().getPath().replace("dist", "").replace("build", ""); mainFolder = jarDir + "Invoices\\"; } this is the method i use to get the directory for the jar file and append the path with the directory i need to create the sub-directories in, i'm sure this works. BufferedImage dest = image.getSubimage(0, 3377, 465, 80); String newDir = new OCR().recognizeEverything(dest); File theDir = new File(mainFolder + newDir); new File(mainFolder + newDir.mkdirs(); im using an optical character recognition library to grab an invoice number off of a cropped image. So newDir is the invoice number. Ive printed out the path and it is the correct path, it is just not creating the directory. If i change the variable to the actual invoice number it works, any ideas? new File(mainFolder + "223545").mkdirs(); so sitting here playing with it ive narrowed the problem down to the string returned from the OCR. It has to be a string or it wouldnt compile...but when i try to parse the string to an int it throws an exception. and it is in fact an integer
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31748798
answer count: 0
has comment: http://stackoverflow.com/comment/31748751
has title: Create directory using a variable as the name
tagged with: java
has comment: http://stackoverflow.com/comment/31748978
type: Question
has comment: http://stackoverflow.com/comment/31748914
has comment: http://stackoverflow.com/comment/31748676
score: 0
has comment: http://stackoverflow.com/comment/31748896

http://stackoverflow.com/comment/31749863
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21103900
has text: where is your `for` loop?

http://stackoverflow.com/comment/31599217
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21022154
has text: @dani-h - See... Whenever a class A uses another class or interface B, then A depends on B. A cannot carry out it's work without B, and A cannot be reused without also reusing B. In such a situation the class A is called the "dependant" and the class or interface B is called the "dependency". A dependant depends on its dependencies.
score: 0

actionlistener
tags question: http://stackoverflow.com/q/21176552
tags question: http://stackoverflow.com/q/21140940
tags question: http://stackoverflow.com/q/21175649
tags question: http://stackoverflow.com/q/21081128
tags question: http://stackoverflow.com/q/21093092
tags question: http://stackoverflow.com/q/21154333
tags question: http://stackoverflow.com/q/21101002
tags question: http://stackoverflow.com/q/21095033
tags question: http://stackoverflow.com/q/21088324
tags question: http://stackoverflow.com/q/21075766
tags question: http://stackoverflow.com/q/21136650
tags question: http://stackoverflow.com/q/21094586
tags question: http://stackoverflow.com/q/21150706
type: Tag
tags question: http://stackoverflow.com/q/21103881
tag name: actionlistener

http://stackoverflow.com/comment/31626969
type: QuestionComment
has text: I am not able to understand last part of your question.
comment on: http://stackoverflow.com/q/21037432
score: 0
type: Comment

http://stackoverflow.com/comment/31886658
comment on: http://stackoverflow.com/q/21179145
score: 0
type: Comment
type: QuestionComment
has text: @mKorbel its for swing

http://stackoverflow.com/comment/31622498
comment on: http://stackoverflow.com/a/21034738
score: 0
type: AnswerComment
type: Comment
has text: AH thank you. That was really silly of me -- I overlooked it somehow. I don't think the stream closing is done elsewhere, since the stream is a local object, and the entire method seems to be posted.

http://stackoverflow.com/a/21101014
accepted answer of: http://stackoverflow.com/q/21100685
answers question: http://stackoverflow.com/q/21100685
has comment: http://stackoverflow.com/comment/31744313
type: Answer
has comment: http://stackoverflow.com/comment/31744475
has comment: http://stackoverflow.com/comment/31744177
has comment: http://stackoverflow.com/comment/31744974
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
has body: You need to understand how OpenGL versioning works to appreciate why glClearBufferfv (...) is in the GL30 namespace. Each version introduces a new set of required functionality, and up until version 3.1 the required functionality only grew. With the introduction of 3.1 and the distinction between core/compatibility profiles in 3.2, you may run into removed functions in older namespaces than 3.1. However, it is literally impossible to build an OpenGL application that only uses features that were added in OpenGL 4.4 or 4.3. Most of the commands you need to do anything useful were introduced 10-15 years ago. For instance, glDrawArrays (...) was introduced in OpenGL 1.1 and is still critical to building GL 4.4 software. Therefore just to draw a vertex array you have to use something from the GL11 namespace. You will therefore be borrowing commands and constants from many different namespaces.
has comment: http://stackoverflow.com/comment/31744721

http://stackoverflow.com/comment/31744481
comment on: http://stackoverflow.com/a/21098564
type: Comment
has text: @Petter I find it readable enough. I prefer it to @andersschuller's solution, where `while (in.hasNext())` only tells part of the story. Here, the condition accurately describes how the loop should terminate.
score: 0
type: AnswerComment

http://stackoverflow.com/a/59584178
has comment: http://stackoverflow.com/comment/105335014
upvote count: 0
has body: public class WriteFile { BufferedWriter out; public void openFile(String file){ try { out = new BufferedWriter(new FileWriter("data.txt")); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void writeInts(int[] ints){ try { for(int i : ints) out.write(i+" "); out.newLine(); out.flush(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void closeFile(){ try { if (out!=null)out.close(); } catch (IOException e) { } } } import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class Test { public static void main(String[] args) throws IOException { WriteFile wf = new WriteFile(); wf.openFile("test.txt"); wf.writeInts(new int[]{1,2,3,4,5}); wf.writeInts(new int[]{5,4,3,2,1}); wf.closeFile(); BufferedReader bf = new BufferedReader(new FileReader("test.txt")); System.out.println(bf.readLine()); System.out.println(bf.readLine()); } } Output: Line1: 1 2 3 4 5 Line2: 5 4 3 2 1
type: Answer
has comment: http://stackoverflow.com/comment/106760907
downvote count: 1
score: -1
answers question: http://stackoverflow.com/q/21137427

http://stackoverflow.com/comment/31703980
type: Comment
has text: Nope. Scrollpane doesn't care what "size" the panel is, it uses a different means to determine what size the panel, and the scroll pane should be...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21079477

http://stackoverflow.com/comment/31659688
score: 0
type: AnswerComment
type: Comment
has text: @DavidWallace Thanks for the help, I'll definitely be able to get it from here on out... I was just looking for a bit of a boost to get past the bottom issue.
comment on: http://stackoverflow.com/a/21055237

http://stackoverflow.com/comment/31620593
score: 3
comment on: http://stackoverflow.com/q/21033691
type: Comment
type: QuestionComment
has text: You can't unmarshall random XML - what would it unmarshall into exactly? You you need to use [JAXP](http://en.wikipedia.org/wiki/Java_API_for_XML_Processing) not JAXB. Read the XML into a [`Document`](http://docs.oracle.com/javase/7/docs/api/javax/swing/text/Document.html).

http://stackoverflow.com/q/21116342
has body: I am learning java and I am using Netbeans IDE. Netbeans interface provides the option to Bind a component's property to another component's property. For example you can set a Jbutton's "enabled" property to be bount to another component's enabled property. This way, when a button (jbutton1) become not enabled you can set the other button (jbutton2) to become not enabled too, without having to use a jbutton2.setEnabled(false) statement for the second button. Using jbutton1.setEnabled(false) is enough. The other button (jbutton2) that is bound becomes disabled too. My 1st question is, is the whole binding usage in cases like the above recommended? Are there any possible problems with using Binding of component's properties? My 2nd question is, can a component's property be set to bind to a variable? For example I may have 15 buttons that have to be disabled when a boolean variable named "usercanpressbuttons" has "false" value. Can this be done? 3rd question is, can this kind of binding be done by coding, instead of using the netbeans interface?
score: 2
type: AnsweredQuestion
tagged with: netbeans
downvote count: 0
tagged with: java
type: Question
has title: Net beans binding
upvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/21124862
accepted answer: http://stackoverflow.com/a/21124862
favorite count: 0

http://stackoverflow.com/comment/32107746
type: QuestionComment
comment on: http://stackoverflow.com/q/21072148
has text: What do you mean with a test file ? This chat only for string communication and not for objects. You have to look up this somewhere else, for example : http://www.kpbird.com/2011/04/android-send-image-via-bluetooth.html
score: 0
type: Comment

http://stackoverflow.com/q/21045007
has comment: http://stackoverflow.com/comment/31640377
tagged with: versioning
has answer: http://stackoverflow.com/a/21045417
score: 15
upvote count: 15
downvote count: 0
linked to: http://stackoverflow.com/q/2712970
has title: Getting application version from pom
favorite count: 0
has comment: http://stackoverflow.com/comment/31641779
possible better answer: http://stackoverflow.com/a/45873767
has body: I have a rest endpoint used to return information about application (so far only app version) But so far this info is hardcoded, and it's pretty easy to forget to change it. I will be better to retrieve app version from pom or manifest file. Is there any project that brings such functionality?
linked to: http://stackoverflow.com/q/34772726
has answer: http://stackoverflow.com/a/45873767
accepted answer: http://stackoverflow.com/a/21045417
has answer: http://stackoverflow.com/a/21046257
has comment: http://stackoverflow.com/comment/31639934
tagged with: spring
has comment: http://stackoverflow.com/comment/31639820
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21045635
tagged with: java
tagged with: maven
type: Question

http://stackoverflow.com/q/21082933
has comment: http://stackoverflow.com/comment/31710811
has comment: http://stackoverflow.com/comment/31710845
tagged with: menu
has answer: http://stackoverflow.com/a/21082995
has comment: http://stackoverflow.com/comment/31710808
has comment: http://stackoverflow.com/comment/31710825
has body: 1)I have GUI Menu below; From this menu, I should select "Add Job" menu item. 2)By selecting this menu item, I want to show the information belongs to a hashmap collection in a JTextFiled by pressing AddJob Button. "peeskillet" already answered 2nd part. Thnks to him. How can I do 1st part? How can I combine two parts? Thanks, Serb
has comment: http://stackoverflow.com/comment/31710881
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/21083068
has comment: http://stackoverflow.com/comment/31710886
tagged with: java
has comment: http://stackoverflow.com/comment/31710789
has comment: http://stackoverflow.com/comment/31710847
type: Question
has comment: http://stackoverflow.com/comment/31710866
has comment: http://stackoverflow.com/comment/31710870
has comment: http://stackoverflow.com/comment/31710732
answer count: 2
has comment: http://stackoverflow.com/comment/31710798
has comment: http://stackoverflow.com/comment/31710852
has comment: http://stackoverflow.com/comment/31710841
has comment: http://stackoverflow.com/comment/31710786
has title: selecting a menu item
score: 0

http://stackoverflow.com/comment/31792590
type: Comment
has text: First off, don't start variable names with a upper-case letter. Standard Java and C convention (outside of Microsoft) to to start variable and method names with a lower-case letter.
score: 0
comment on: http://stackoverflow.com/q/21127514
type: QuestionComment

http://stackoverflow.com/q/21113404
has comment: http://stackoverflow.com/comment/32890333
tagged with: arraylist
has answer: http://stackoverflow.com/a/21113871
has body: I am trying to convert byte array into image in android. I have a ArrayList&lt;Byte&gt; arrays; that contains all byte arrays that I want to convert. Now at byt = (byte[]) arrays.get(0); its giving me Cannot cast from Byte to byte[] java exception. byte[] byt; byt = new byte[4096]; byt = (byte[]) arrays.get(0) ; BufferedImage bImageFromConvert = null; InputStream in = new ByteArrayInputStream(byt); try { bImageFromConvert = ImageIO.read(in); SaveImages(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } How can I solve this?
has answer: http://stackoverflow.com/a/21113482
has answer: http://stackoverflow.com/a/21669347
answer count: 10
has answer: http://stackoverflow.com/a/21113600
has comment: http://stackoverflow.com/comment/31767616
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: Cannot cast from Byte to byte[] java
downvote count: 1
score: 2
upvote count: 3
has answer: http://stackoverflow.com/a/26929380
tagged with: java
has answer: http://stackoverflow.com/a/21751431
linked to: http://stackoverflow.com/q/21115575
has answer: http://stackoverflow.com/a/21113724
has answer: http://stackoverflow.com/a/21113479
type: Question
has comment: http://stackoverflow.com/comment/31765859
has answer: http://stackoverflow.com/a/21749581
tagged with: arrays
has answer: http://stackoverflow.com/a/25255001
linked to: http://stackoverflow.com/q/3176222

http://stackoverflow.com/comment/31700556
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21077716
has text: But this is a NON-STATIC member variable. The moment I create an instance of `A`, this variable will be initialized inside or outside the constructor. Perhaps you mean that the difference is in the order of the operations? First variable `b` is initialized and then method `A()` is called, or vice-versa?
type: AnswerComment

http://stackoverflow.com/a/21077448
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21077361
downvote count: 0
type: Answer
has body: A char is already a 16bit numerical type, whose value is interpreted as the code point of the character being displayed. when you cast it to (int), there is no parsing involved at all and the complexity is O(1), absolutely. Just do as you wrote in your question. If you strictly needed ASCII (or any other specific encoding), then you should use getBytes like: byte character = s.getBytes("ASCII")[8] int ASCII = (int) character; Or even the first line only. Please be aware that non-ASCII-representable characters might get replaced when getting bytes. Also consider that the index of what you are looking for might not be 8 if you used a multi-byte encoding. My 2 cents: consider researching a better representation for your data than a String.

http://stackoverflow.com/q/21144415
downvote count: 0
has comment: http://stackoverflow.com/comment/31822960
favorite count: 0
has answer: http://stackoverflow.com/a/21144583
has answer: http://stackoverflow.com/a/21154004
answer count: 5
has answer: http://stackoverflow.com/a/21144616
has comment: http://stackoverflow.com/comment/31822634
has comment: http://stackoverflow.com/comment/31822681
has comment: http://stackoverflow.com/comment/31823192
has answer: http://stackoverflow.com/a/21144682
has body: I would like to write to a .txt file that is inside a package. I can get it to read from the exact location the .txt file is stored but not from inside the package. I'm assuming it is using class loaders but I cannot seem to get it to work. Here is what I have so far. public void writeFile(String fileLocation) { Writer output = null; File file = new File(fileLocation); try { output = new BufferedWriter(new FileWriter(file)); output.append("WRITING TEST"); output.close(); } catch (IOException ex) { System.out.println("Couldn't write to file."); } } Then I use this in another class to write. WriteFile writeFile = new WriteFile(); writeFile.writeFile("src/com/game/scores.txt"); I understand that if using class loaders you remove "src/" because that will no longer exist when the program is compiled in a .jar.
type: UnansweredQuestion
upvote count: 1
linked to: http://stackoverflow.com/q/14403745
type: Question
has answer: http://stackoverflow.com/a/21144771
has comment: http://stackoverflow.com/comment/31822740
score: 1
tagged with: java
has title: Write to a .txt file in a package
has comment: http://stackoverflow.com/comment/31822756
has comment: http://stackoverflow.com/comment/31822898
has comment: http://stackoverflow.com/comment/31822692
has comment: http://stackoverflow.com/comment/31822814
has comment: http://stackoverflow.com/comment/31822646
has comment: http://stackoverflow.com/comment/31822828
linked to: http://stackoverflow.com/q/21113073

http://stackoverflow.com/comment/31670684
comment on: http://stackoverflow.com/a/21061499
score: 0
type: AnswerComment
type: Comment
has text: So if ClassA is enclosing class and ClassB is member class, I can make object as ObjA.new ClassB()? Or is this wrong?

http://stackoverflow.com/a/21080925
has comment: http://stackoverflow.com/comment/31706696
score: 1
upvote count: 1
has body: You could add an break, right after the System.out.print if ((totalRoll == 7.0) || (totalRoll == 11.0)) { System.out.println("You win!"); break; }
downvote count: 0
answers question: http://stackoverflow.com/q/21080842
type: Answer

http://stackoverflow.com/comment/31719669
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21088031
score: 0
has text: possible duplicate of [Comparing Integer objects vs int](http://stackoverflow.com/questions/4036167/comparing-integer-objects-vs-int)

http://stackoverflow.com/q/21080598
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31706990
has comment: http://stackoverflow.com/comment/31706285
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31706417
has title: spring - jstl - Error 404 - The requested resource is not available
tagged with: spring
tagged with: spring-mvc
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31706646
tagged with: java
has answer: http://stackoverflow.com/a/28393640
has comment: http://stackoverflow.com/comment/31706039
type: Question
has comment: http://stackoverflow.com/comment/31706663
has answer: http://stackoverflow.com/a/21081080
has comment: http://stackoverflow.com/comment/31706489
has body: When I want to access on my website, I've the following error : The requested resource is not available. I noticed that the problem is in the mvc-dispatcher-servlet.xml file on the line <mvc:resources mapping="/resources/**" location="../../resources/normalMode/"/> but I don't know why ? Do you have any solutions ? My project structure : - src - main - java - com - myblog - controller -//all java files as controller - resources - normalMode - css - header.css - webapp - /WEB-INF - /pages - mvc-dispatcher.xml - web.xml mvc-dispatcher-servlet.xml <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:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:component-scan base-package="com.myblog.controller" /> /WEB-INF/pages/ .jsp <mvc:resources mapping="/resources/**" location="../../resources/normalMode/"/> </beans> web.xml Archetype Created Web Application mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1 mvc-dispatcher / IndexController.java package com.myblog.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; @Controller @RequestMapping(value={"","/","home"}) public class IndexController { @RequestMapping(method=RequestMethod.GET) public ModelAndView init(){ return new ModelAndView("index"); } }
tagged with: servlets
has comment: http://stackoverflow.com/comment/31706525
has comment: http://stackoverflow.com/comment/31706243

http://stackoverflow.com/q/21140940
has comment: http://stackoverflow.com/comment/31817505
type: Question
has comment: http://stackoverflow.com/comment/31815998
tagged with: actionlistener
has title: Incorporating a result from an action to another action
has comment: http://stackoverflow.com/comment/31816087
answer count: 1
accepted answer: http://stackoverflow.com/a/21142058
has comment: http://stackoverflow.com/comment/31816150
has comment: http://stackoverflow.com/comment/31816084
tagged with: swing
has body: i'm very confused but it seems this is just simple to you. [JAVA] I have implemented an action performed from pressing a button, lets say its b1. Pressing b1 will result to browsing a file and output it to a text area. I implemented another button, say b2, for generating a tokens This is what i want to do: I want b2 to tokenize the text from the text area(text.getText()) wherein the contents of the text area is brought by b1. Problem is that I can't tokenize the text content resulting from b1 in b2. It just gives blank result. I suspect that it can't get the text from b1 because the text is not global and it is only inside the e.getSource==b1 condition. [EDIT] ok here: if(e.getSource()==button){ fileChooser= new JFileChooser(); returnVal = fileChooser.showOpenDialog(this); if(returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); try { // What to do with the file, e.g. display it in a TextArea text.read( new FileReader( file.getAbsolutePath() ), null ); }catch(IOException ex){} }else{} } if(e.getSource()==b2){ String[] token= text.getText().split(" "); System.out.println(token[0]); } When I put the tokenizer inside b1 condition, it works. however above doesn't. It seems that when I do "text.getText()", it doesn't get the changes made in b1 where you choose a file and output it to the text. That's why I'm asking if there's a way to incorporate an action done by b1 to b2.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31817235
tagged with: tokenize
has comment: http://stackoverflow.com/comment/31817227
score: 0
tagged with: java
tagged with: file
has answer: http://stackoverflow.com/a/21142058

http://stackoverflow.com/a/21056556
has comment: http://stackoverflow.com/comment/31662028
has comment: http://stackoverflow.com/comment/31661941
type: Answer
answers question: http://stackoverflow.com/q/21056526
score: 1
upvote count: 1
has body: And I cannot use throw exceptions or try and catch because we did not learn them yet. For a first attempt, you could create a method that accepts a String as parameter. You will loop through all the chars of this String and check if each char is a digit. While this method returns false, re-ask the user for a new input. Then use Integer.valueOf to get the int value.. public static boolean isNumber(String input) You will have to use sc.nextLine() to get the input The method Character.isDigit and toCharArray() will be useful
has comment: http://stackoverflow.com/comment/31662002
downvote count: 0

http://stackoverflow.com/comment/31683736
type: Comment
type: QuestionComment
has text: What happens when you run the program, and how is it different from what you expect?
comment on: http://stackoverflow.com/q/21068448
score: 0

http://stackoverflow.com/comment/31713823
type: Comment
has text: Have you got all required spring mvc jars in your classpath? Using maven to manage the dependency is recommended
comment on: http://stackoverflow.com/q/21084225
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31838786
type: QuestionComment
comment on: http://stackoverflow.com/q/21152714
score: 0
has text: Thanks guys. What i am trying to do is I want to move each animals one space, until there are no fish or you have performed 100 cycles. But each time I move a animal, I want to look ahead one space to see what's in that space (cell).
type: Comment

http://stackoverflow.com/comment/138024309
comment on: http://stackoverflow.com/a/25750325
score: 0
type: AnswerComment
type: Comment
has text: Tried this, and it worked. Thank you

http://stackoverflow.com/a/22595965
answers question: http://stackoverflow.com/q/21123653
downvote count: 0
has comment: http://stackoverflow.com/comment/129972357
type: Answer
upvote count: 16
has body: This piece of code does the job by default, without providing your own custom view to the AlertDialog.Builder . AlertDialog dialog = builder.show(); //builder is your just created builder TextView messageText = (TextView)dialog.findViewById(android.R.id.message); messageText.setGravity(Gravity.CENTER); dialog.show();
score: 16
has comment: http://stackoverflow.com/comment/46217054

http://stackoverflow.com/a/21064421
score: 0
type: Answer
has body: Try considering this print statement: System.out.println(celsius+" is degrees Celsius and " +fahrenheit+ " is degrees Fahrenheit");
answers question: http://stackoverflow.com/q/21064293

http://stackoverflow.com/a/21093663
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/31729845
has comment: http://stackoverflow.com/comment/31729820
answers question: http://stackoverflow.com/q/21093606
has comment: http://stackoverflow.com/comment/31730090
has comment: http://stackoverflow.com/comment/31729856
downvote count: 0
has comment: http://stackoverflow.com/comment/31730045
has body: XOR is a bitwise operator, so your numbers are XORed bit-by-bit, for example 5 = 4+1 = 0101 10 = 8+2 = 1010 For booleans, it is well known, that a xor b xor b = a. Simply apply it bit by bit and you get the swapping of numbers (or any other data represented as bits, so pretty much everything in computer science).

http://stackoverflow.com/q/21142895
type: Question
has title: change a process name from the outside
score: 0
tagged with: linux
has comment: http://stackoverflow.com/comment/31820177
tagged with: c++
answer count: 0
type: UnansweredQuestion
tagged with: process
has comment: http://stackoverflow.com/comment/31914306
tagged with: java
has comment: http://stackoverflow.com/comment/31820029
has body: I am looking for a way to change the name of a (java) process name from another one. Just to be clear, I have a process named "kuku" and another c++ process named "lolo", inside the "lolo" process I want to change the name of the "kuku" process. Is this possible?

http://stackoverflow.com/comment/31665453
type: AnswerComment
comment on: http://stackoverflow.com/a/21058527
type: Comment
has text: You should make it clearer that `=!` is a combination of two operators: the assignment operator and the unary negation operator.
score: 1

http://stackoverflow.com/comment/31869628
type: Comment
score: 0
type: QuestionComment
has text: Tim, this is a pretty good guide for Ubuntu : https://help.ubuntu.com/community/Java using `update-alternatives` and it's the way I always do it. I think `update-alternatives` comes from the Debian base anyway so it should be available to you.
comment on: http://stackoverflow.com/q/21118477

http://stackoverflow.com/q/21151191
linked to: http://stackoverflow.com/q/1582356
score: 1
favorite count: 0
tagged with: logic
has comment: http://stackoverflow.com/comment/31835968
has answer: http://stackoverflow.com/a/21152292
type: Question
has comment: http://stackoverflow.com/comment/31836219
has title: Fastest way to find the third largest of five given numbers without using array or loops?
tagged with: mathematical-optimization
has comment: http://stackoverflow.com/comment/31837771
has comment: http://stackoverflow.com/comment/31836234
upvote count: 3
linked to: http://stackoverflow.com/q/1585727
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/31836570
has answer: http://stackoverflow.com/a/21151815
has body: I'm thinking of a logic to find the third largest number of five given numbers without using array or loops but can use conditionals. Here is Fastest way of finding the middle value of a triple by stephen c. I want to create a logic for 5 numbers to find the third largest. I want to reduce the comparisons as much as possible to find an optimal solution.
accepted answer: http://stackoverflow.com/a/21152292
tagged with: algorithm
tagged with: math
tagged with: java
possible better answer: http://stackoverflow.com/a/21151815
type: AnsweredQuestion

http://stackoverflow.com/q/21123001
type: Question
possible better answer: http://stackoverflow.com/a/21123689
score: 3
has comment: http://stackoverflow.com/comment/31784976
has comment: http://stackoverflow.com/comment/31784773
answer count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/31784536
favorite count: 0
has answer: http://stackoverflow.com/a/21123689
has comment: http://stackoverflow.com/comment/31784682
accepted answer: http://stackoverflow.com/a/21123718
upvote count: 4
has comment: http://stackoverflow.com/comment/31784379
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/20726441
tagged with: shader
has body: I'm using OpenGL with LWJGL and my own very small framework for trivial tasks. I'm following the book OpenGL SuperBible: Comprehensive Tutorial and Reference (6th Edition). I will list the most important parts of my program: public class GameController extends Controller { private Program test1Program; private int vaoId; @Override protected void init() { glViewport(0, 0, 800, 600); test1Program = new Program( new VertexShader("src/shaders/test.vert.glsl").create(), new ControlShader("src/shaders/test.cont.glsl").create(), new EvaluationShader("src/shaders/test.eval.glsl").create(), new FragmentShader("src/shaders/test.frag.glsl").create() ).create(); vaoId = glGenVertexArrays(); glBindVertexArray(vaoId); } @Override protected void draw(double msDelta) { glClearColor((float)Math.sin(currentTime / 1000f) * 0.5f + 0.5f, (float)Math.cos(currentTime / 1000f) * 0.5f + 0.5f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); test1Program.use(); glVertexAttrib4f(0, (float)Math.sin(currentTime / 1000f) * 0.5f, (float)Math.cos(currentTime / 1000f) * 0.5f, 0.0f, 0.0f); glVertexAttrib4f(1, (float)Math.sin(currentTime / 1000f * 2f) * 0.5f + 0.5f, (float)Math.cos(currentTime / 1000f * 2f) * 0.5f + 0.5f, 0.0f, 1.0f); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glDrawArrays(GL_TRIANGLES, 0, 3); } @Override protected void shutdown() { test1Program.delete(); glDeleteVertexArrays(vaoId); } public static void main(String[] args) { Controller controller = new GameController(); controller.start(); } } My custom VertexShader, ControlShader, EvaluationShader and FragmentShader are working and if shader code does not compile properly or does not get linked correctly, then an exception will be thrown and I would notice it. So I have verified that those and Program are working correctly. The error (Exception in thread "main" org.lwjgl.opengl.OpenGLException: Invalid operation (1282)) gets thrown at the glDrawArrays call. test.vert.glsl: #version 440 core layout(location = 0) in vec4 offset; layout(loc…
tagged with: opengl
tagged with: glsl
has title: GL_INVALID_OPERATION on Tesselation Shader
tagged with: java
tagged with: lwjgl
has answer: http://stackoverflow.com/a/21123718

http://stackoverflow.com/a/21023592
score: 1
has comment: http://stackoverflow.com/comment/31602428
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21023065
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21023065
type: Answer
downvote count: 0
has body: What you need is to read the file as a resource, not as a file with InputStream stream = getClass().getClassLoader().getResourceAsStream("file.txt"); Relevant question and answers can be found here: How to really read text file from classpath in Java

http://stackoverflow.com/a/21053990
score: 0
type: Answer
has body: Global variables (when the language allows), can cause major problems especially in complex systems, where a piece of code can change its value at any time. Besides creating a coupling between places that should not have. so avoid In java I usually use public final constants in a single centralized source.
answers question: http://stackoverflow.com/q/21053507

http://stackoverflow.com/comment/31686045
has text: @deadManN well regex is a tag of the question...
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21069589

bufferedimage
tags question: http://stackoverflow.com/q/21141367
tags question: http://stackoverflow.com/q/21175473
tags question: http://stackoverflow.com/q/21092627
tags question: http://stackoverflow.com/q/21130705
tags question: http://stackoverflow.com/q/21057963
tags question: http://stackoverflow.com/q/21128912
tags question: http://stackoverflow.com/q/21175336
tag name: bufferedimage
tags question: http://stackoverflow.com/q/21114054
tags question: http://stackoverflow.com/q/21045119
tags question: http://stackoverflow.com/q/21176754
tags question: http://stackoverflow.com/q/21064270
tags question: http://stackoverflow.com/q/21057191
tags question: http://stackoverflow.com/q/21041303
type: Tag
tags question: http://stackoverflow.com/q/21056840
tags question: http://stackoverflow.com/q/21072118

performance
tags question: http://stackoverflow.com/q/21068397
tags question: http://stackoverflow.com/q/21052674
tags question: http://stackoverflow.com/q/21068006
tags question: http://stackoverflow.com/q/21099347
tags question: http://stackoverflow.com/q/21073010
tags question: http://stackoverflow.com/q/21060856
tags question: http://stackoverflow.com/q/21055218
tags question: http://stackoverflow.com/q/21076905
tags question: http://stackoverflow.com/q/21136227
tags question: http://stackoverflow.com/q/21109685
tags question: http://stackoverflow.com/q/21024653
tags question: http://stackoverflow.com/q/21139873
tags question: http://stackoverflow.com/q/21050130
tags question: http://stackoverflow.com/q/21090020
tags question: http://stackoverflow.com/q/21105738
tags question: http://stackoverflow.com/q/21170953
tags question: http://stackoverflow.com/q/21052409
tags question: http://stackoverflow.com/q/21077518
tags question: http://stackoverflow.com/q/21123972
tags question: http://stackoverflow.com/q/21119999
tags question: http://stackoverflow.com/q/21161449
tags question: http://stackoverflow.com/q/21059555
tags question: http://stackoverflow.com/q/21167417
tags question: http://stackoverflow.com/q/21137312
tags question: http://stackoverflow.com/q/21073401
tags question: http://stackoverflow.com/q/21039005
tag name: performance
tags question: http://stackoverflow.com/q/21075418
tags question: http://stackoverflow.com/q/21072357
tags question: http://stackoverflow.com/q/21179242
tags question: http://stackoverflow.com/q/21163932
tags question: http://stackoverflow.com/q/21112767
tags question: http://stackoverflow.com/q/21179964
type: Tag
tags question: http://stackoverflow.com/q/21083629
tags question: http://stackoverflow.com/q/21167596
tags question: http://stackoverflow.com/q/21128426
tags question: http://stackoverflow.com/q/21178980
tags question: http://stackoverflow.com/q/21165326
tags question: http://stackoverflow.com/q/21081792
tags question: http://stackoverflow.com/q/21150924

http://stackoverflow.com/a/21060872
type: Answer
has body: Java supports floating-point hexadecimal literals since 1.5 double d = 0x1f.1p1;
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31673902
upvote count: 2
answers question: http://stackoverflow.com/q/21060805

http://stackoverflow.com/comment/31889809
score: 0
has text: Better use `display.addFilter(new Listener...)`.
comment on: http://stackoverflow.com/q/21178802
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31814764
has text: Its just my website... WWW.pagesbyz.com. I don't think so, no API.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21140284

http://stackoverflow.com/a/21184729
upvote count: 2
has body: Straight from the Spring AOP documentation. THe documentation does say that Spring AOP is only for method execution join points(advising the execution of methods on Spring beans) 6.1.2. Spring AOP capabilities and goals Spring AOP is implemented in pure Java. There is no need for a special compilation process. Spring AOP does not need to control the class loader hierarchy, and is thus suitable for use in a J2EE web container or application server. Spring AOP currently supports only method execution join points (advising the execution of methods on Spring beans). Field interception is not implemented, although support for field interception could be added without breaking the core Spring AOP APIs. If you need to advise field access and update join points, consider a language such as AspectJ. Spring AOP's approach to AOP differs from that of most other AOP frameworks. The aim is not to provide the most complete AOP implementation (although Spring AOP is quite capable); it is rather to provide a close integration between AOP implementation and Spring IoC to help solve common problems in enterprise applications. Thus, for example, the Spring Framework's AOP functionality is normally used in conjunction with the Spring IoC container. Aspects are configured using normal bean definition syntax (although this allows powerful "autoproxying" capabilities): this is a crucial difference from other AOP implementations. There are some things you cannot do easily or efficiently with Spring AOP, such as advise very fine-grained objects (such as domain objects typically): AspectJ is the best choice in such cases. However, our experience is that Spring AOP provides an excellent solution to most problems in J2EE applications that are amenable to AOP.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21181831
type: Answer
accepted answer of: http://stackoverflow.com/q/21181831
score: 2
downvote count: 0

http://stackoverflow.com/comment/41222134
comment on: http://stackoverflow.com/a/21157598
score: 0
type: Comment
type: AnswerComment
has text: Hi @ismailyavuz, can you give us the details how to exclude jpa 2.0 from projects?

http://stackoverflow.com/comment/117329742
type: Comment
has text: Once the cache is full, each new addition is going to do a linear search of the map looking for the best entry to delete. Horrible. In my implementation, I'm allowing the map to grow to twice its target size, then doing a rebuild that drops half the entries: the cost of the rebuild is higher, but its frequency is much lower.
type: AnswerComment
comment on: http://stackoverflow.com/a/23668899
score: 0

http://stackoverflow.com/comment/31726088
type: AnswerComment
has text: Well, that constructor won't receive that object if that's not a Triangle, meaning that I'd be able to make the exception outside the constructor. And yes, knowing how to recognize generic objects as specific ones did help a lot, so cheers :)
comment on: http://stackoverflow.com/a/21091489
score: 0
type: Comment

http://stackoverflow.com/comment/31705024
type: Comment
has text: I appreciate the responses, and the best advice yet, Alexander, is from you. I've been testing this for about 10 hours using jGRASP and NetBeans, lol, and couldn't get a loop to work.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21078854

http://stackoverflow.com/a/21189721
has body: When you make a remote EJB invocation using JNDI, you need to pay attention to these points: 1) add to the client CLASSPATH the necessary dependecis, this is:add the remote interface class and the jboss-client.jar. 2) instantiate the InitialConetxt correctly 3) provide a correct lookup name, (this information is logged in the server when the ejb is deployed). You have to accomplish with the JBoss 7 requeriments (are not the same that previous versions) in order to configure the Client correctly .
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21178364

http://stackoverflow.com/q/21040409
tagged with: java
has comment: http://stackoverflow.com/comment/31632914
tagged with: memory
type: Question
answer count: 2
tagged with: benchmarking
has comment: http://stackoverflow.com/comment/31632491
has comment: http://stackoverflow.com/comment/31633467
has comment: http://stackoverflow.com/comment/31632862
has answer: http://stackoverflow.com/a/21040563
score: 0
tagged with: heap-memory
has comment: http://stackoverflow.com/comment/31631996
has body: Suppose I have a private static Integer i = 0 in my object's state. Suppose then that I push this through some method which takes this i as an argument as follows: pushThroughMethod(i). Does i get copied onto heap and become eligible for garbage collection?
has comment: http://stackoverflow.com/comment/31631830
has comment: http://stackoverflow.com/comment/31632455
has comment: http://stackoverflow.com/comment/31632601
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31632446
has comment: http://stackoverflow.com/comment/31632635
has comment: http://stackoverflow.com/comment/31633401
has comment: http://stackoverflow.com/comment/31632424
tagged with: garbage-collection
has answer: http://stackoverflow.com/a/21041838
has comment: http://stackoverflow.com/comment/31632967
has title: Is a copy of an object made when pushing it through a method?
has comment: http://stackoverflow.com/comment/31633535

http://stackoverflow.com/comment/31678419
type: Comment
comment on: http://stackoverflow.com/a/21065348
has text: @AfzaalAhmadZeeshan You need to learn the Java syntax, and back and forth in a StackOverflow question is not a good mechanism for that. Please read up and do some tutorials.
score: 0
type: AnswerComment

installanywhere
type: Tag
tags question: http://stackoverflow.com/q/21097953
tag name: installanywhere

http://stackoverflow.com/comment/31654495
score: 0
type: Comment
type: QuestionComment
has text: Make a short program running each a few times on a loop, and find out for sure, instead of relying on speculation.
comment on: http://stackoverflow.com/q/21052674

http://stackoverflow.com/a/21047045
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21030643
answers question: http://stackoverflow.com/q/21030643
has body: When JAXB derives metadata for a model transitive relationships are processed. When a class is processed its super classes are also processed, but not its subclasses. To overcome this you will need to make JAXB aware of the subclasses. One way to do this is to use the @XmlSeeAlso annotation. Java Model I will use the Java model from your question with the following changes: Vehicle I have added the @XmlSeeAlso annotation. Only the leaf classes need to be added, as processing Sedan will cause the Car class to be processed. import javax.xml.bind.annotation.XmlSeeAlso; import org.eclipse.persistence.oxm.annotations.XmlDiscriminatorNode; @XmlDiscriminatorNode("@type") @XmlSeeAlso({Tank.class, Sedan.class}) class Vehicle {} Sedan I have added a property to the Sedan class to show that it appears in the marshalled result. import org.eclipse.persistence.oxm.annotations.XmlDiscriminatorValue; @XmlDiscriminatorValue("sedan") class Sedan extends Car { private String sedanProperty; public String getSedanProperty() { return sedanProperty; } public void setSedanProperty(String sedanProperty) { this.sedanProperty = sedanProperty; } } Foo Here is a root class as you describe in your question that has a List of Vehicle objects. import java.util.*; import javax.xml.bind.annotation.*; @XmlRootElement public class Foo { private List vehicles = new ArrayList (); @XmlElement(name="vehicle") public List getVehicles() { return vehicles; } } Demo Code Demo import javax.xml.bind.*; public class Demo { public static void main(String[] args) throws Exception { JAXBContext jc = JAXBContext.newInstance(Foo.class); Sedan sedan = new Sedan(); sedan.setSedanProperty("Sedan Value"); Foo foo = new Foo(); foo.getVehicles().add(sedan); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.marshal(foo, System.out); } } Output <?xml version="1.0" encoding="UTF-8"?> Sedan Value
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/31626782
type: Comment
comment on: http://stackoverflow.com/a/21036724
has text: I've added a runnable example
type: AnswerComment
score: 0

http://stackoverflow.com/a/21081160
answers question: http://stackoverflow.com/q/21079208
has body: why not just insert into BulkRequestBuilder json records in the first place, something like this Client client = new TransportClient().addTransportAddress(new InetSocketTransportAddress("localhost", 9300)); BulkRequestBuilder bulk = client.prepareBulk(); ..... bulk.add(client.prepareIndex(&lt;your index&gt;, &lt;your type&gt;) .setSource(&lt;your object&gt;.toJson()); .... and in &lt;your object&gt; class create Gson like this: Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); and method: public String toJson(){ return gson.toJson(this, &lt;you class&gt;.class); }
type: Answer
score: 0

http://stackoverflow.com/a/21119093
answers question: http://stackoverflow.com/q/21118831
downvote count: 0
type: Answer
has body: The parameterized type is missing in private JList tracklist; Try to use parameterized type in generic class. private JList&lt;Object&gt; tracklist;
upvote count: 2
score: 2

http://stackoverflow.com/a/21080896
has body: I think you want to swap your OR for an AND. With an OR, that while statement will always evaluate to true, because a single number can not be both 7 and 11 at the same time (unless it's some brutal quantum computing, but I'll assume it's not). while(totalRoll != 7.0 &amp;&amp; totalRoll != 11.0) { // Continue. } NOTE: If you are trying to make a quantum dice, then one could argue you'd need to roll the dice an infinite amount of times, given the single di face could equal all numbers simultaneously, so in this context your program is working beautifully... just food for thought. Serious NOTE: Using a double to represent a value on a dice is really wasteful. You're reserving a lot more memory than you need to. Use an int or even a byte, if you wanted to optimize your memory usage. Edit in response to comment You added the break to your if statement; I am assuming. Well, you see, this is different. You're claiming if the number equals one of these numbers. Let me run an example for you. When dealing with equality The logic in your if statement is fine, because, let's say: double totalRoll = 7.0; if(totalRoll == 7.0 || totalRoll == 11.0) { // Do something. } This evaluates to: if(7.0 == 7.0 || 7.0 == 11.0) { } Which becomes: if(true || false) And because TRUE OR X == TRUE, it becomes: if(true) Likewise, if you set totalRoll to 9.0: if(9.0 == 7.0 || 9.0 == 11.0) { } Which becomes. if(false || false) Which finally evaluates to: if(false) So we have proven by demonstration, that this if statement can handle input. Let's try out your while loop. When dealing with inequality double totalRoll = 7.0; // We expect this to stop the loop.. while(totalRoll != 7.0 || totalRoll != 11.0) Evaluates to while(7.0 != 7.0 || 7.0 != 11.0) And that evaluates to: while(false || true) Once again, X OR TRUE == TRUE so. while(true) Oh dear. So as you can see, the only way this while loop will ever break, is if the value of totalRoll is both 7.0 and 11.0 at the same time. Why the solution work…
type: Answer
answers question: http://stackoverflow.com/q/21080842
has comment: http://stackoverflow.com/comment/31707205
accepted answer of: http://stackoverflow.com/q/21080842
has comment: http://stackoverflow.com/comment/31707308
upvote count: 5
has comment: http://stackoverflow.com/comment/31707041
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31706773

http://stackoverflow.com/comment/31859910
comment on: http://stackoverflow.com/q/21164605
has text: @GáborCsikós : I donot need a hash map. But, Need a variable whose name is the key which I get from DB and value of that variable will be the value from the table.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31622851
type: QuestionComment
has text: possible duplicate of [XPath for Child Element Using Parent Element As XPath Parameter](http://stackoverflow.com/questions/21034950/xpath-for-child-element-using-parent-element-as-xpath-parameter)
score: 0
comment on: http://stackoverflow.com/q/21034944
type: Comment

http://stackoverflow.com/a/21090063
type: Answer
has body: You should use a connection pool for this. Check this answer about connection pooling outside an application server.
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21089174

http://stackoverflow.com/a/21129361
has comment: http://stackoverflow.com/comment/31795952
has comment: http://stackoverflow.com/comment/41467488
downvote count: 0
type: Answer
upvote count: 1
has body: Looks like you want to generate a public key pair using BouncyCastle? This one asks how to do it without a password, but you can take a look how to do it with a password too: How to generate OpenPGP KeyPair without passphrase using BouncyCastle?
answers question: http://stackoverflow.com/q/21129202
has comment: http://stackoverflow.com/comment/31796884
score: 1

http://stackoverflow.com/q/21164033
favorite count: 0
linked to: http://stackoverflow.com/q/14501233
type: UnansweredQuestion
score: -3
has body: Is there any mathematical formula for X &gt;&gt;&gt; Y. We have formula for X &gt;&gt; y and X &lt;&lt; Y ? If sombody says what is the value of 5 &gt;&gt;&gt; 2, how will you calculate the value without converting them in to binary.
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31858136
type: Question
duplicate of: http://stackoverflow.com/q/14501233
has title: Mathematical formula for unsigned right shift in java
has answer: http://stackoverflow.com/a/21171105
has comment: http://stackoverflow.com/comment/31858114
downvote count: 3
answer count: 1
has comment: http://stackoverflow.com/comment/31858375

http://stackoverflow.com/comment/31840583
has text: I am not excluding any rows by date in the program or Excel at this time. I'm currently just sending `null` to the method for the 2 dates. The only rows that are getting excluded in the program and not in Excel are the rows that have the `cancel` tag on them. If someone could give me a formula that would exclude any rows with `cancel` in the 5th column in Excel from the sum, I'll use that to get a real value in Excel. I'll also look it up in the meantime.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21153533

http://stackoverflow.com/comment/31845655
has text: Can you explain a bit more? I couldn't find a CHANNEL hanguped variable in the Asterisk documentation. It did try to create a variable in the Dialplan that is set to 1 whenever the channel is hung up, and that is checked at each critical step of the Agi script. But again it doesn't work. In fact it seems that Asterisk only runs the "h" extension once the AGI script has finished running.
comment on: http://stackoverflow.com/a/21140540
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21062898
upvote count: 3
has comment: http://stackoverflow.com/comment/31673221
type: AnsweredQuestion
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/21062958
type: Question
has answer: http://stackoverflow.com/a/21062966
downvote count: 0
possible better answer: http://stackoverflow.com/a/21062966
has answer: http://stackoverflow.com/a/21063064
accepted answer: http://stackoverflow.com/a/21062958
has answer: http://stackoverflow.com/a/21069977
favorite count: 0
has answer: http://stackoverflow.com/a/21062980
tagged with: unix-timestamp
has title: Calculating difference in minutes from two timestamps
has body: I have two unix time stamps like currentTimestamp=1213083655; previousTimestamp=1213083715; How do I calculate the number of minutes between these two timestamps. Or in other words difference in minutes between both these timestamps. Currently what I am doing is (previousTimestamp-currentTimestamp)%60 which is the right away to go because timestamps are time in seconds and doing this will return minutes . But only problem is that when the difference is multiple of 60 then the remainder is 0 and therefore the calculation gives a result of 0 minutes which is wrong. Like in the case of above numbers difference is 60 so result is 0. So what's the best way to do this? Regards Ahmar
answer count: 5

http://stackoverflow.com/q/21059019
favorite count: 0
tagged with: google-app-engine
possible better answer: http://stackoverflow.com/a/21071296
has comment: http://stackoverflow.com/comment/31667769
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: cglib is causing a java.lang.VerifyError during query generation in Intuit Partner Platform Java SDK
has comment: http://stackoverflow.com/comment/31667827
type: Question
score: 3
has answer: http://stackoverflow.com/a/21071296
tagged with: cglib
tagged with: intuit-partner-platform
has body: I can't figure out what is causing this error. I am using Intuit's Java v3 SDK for QuickBooks Online (QBO), and I'm attempting to run a query for TimeActivity objects. To do this, I must generate a query entity. My code fails on this line: TimeActivity queryTimeActivity = GenerateQuery.createQueryEntity(TimeActivity.class); The stack trace proceeds from that line as follows: java.lang.VerifyError: class net.sf.cglib.core.DebuggingClassWriter overrides final method visit.(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V at com.google.appengine.runtime.Request.process-4da1515b5814ac28(Request.java) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:795) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at java.lang.ClassLoader.loadClass(ClassLoader.java:360) at net.sf.cglib.core.AbstractClassGenerator.&lt;init&gt;(AbstractClassGenerator.java:38) at net.sf.cglib.core.KeyFactory$Generator.&lt;init&gt;(KeyFactory.java:127) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:112) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104) at net.sf.cglib.proxy.Enhancer.&lt;clinit&gt;(Enhancer.java:69) at com.intuit.ipp.query.GenerateQuery.createQueryEntity(GenerateQuery.java:56) I should mention that this code is in a Google App Engine app. I did some Google searches for this error, and found that many people suggest removing the libraries "cglib" and "asm" from the build path. I could not find "cglib", but I tried removing "asm-4.0.jar", but Google App Engine complained when I tried that. More specifically, the app deployed, but the line …
has answer: http://stackoverflow.com/a/23798184
has comment: http://stackoverflow.com/comment/31667913
upvote count: 3
has answer: http://stackoverflow.com/a/21077215
answer count: 3
accepted answer: http://stackoverflow.com/a/21077215
tagged with: quickbooks-online

http://stackoverflow.com/comment/31801416
has text: You just need to return String ArrayList from your db.getAllNames() method and convert that into String Array and bind to builder.setSingleChoiceItems(Here your String Array,checkedItem,listener)
comment on: http://stackoverflow.com/q/21132228
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31688962
score: 0
type: AnswerComment
has text: @BasilBourque thanks I have corrected that (and for the edits). The difference is the dilution introduced by ignoring the timezone in SimpleDateFormat (the effective difference is 5.5 hours - the difference in IST and Zulu)
type: Comment
comment on: http://stackoverflow.com/a/21042347

http://stackoverflow.com/comment/31756038
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21107486
has text: Please also include full exception stacktrace from logcat. Especially the nested "caused by" exception is helpful, though Vipul has already identified one problem in the code.
score: 0

http://stackoverflow.com/a/21159062
score: 0
has body: As I understood from your requirements, you have a document and you want to get the sentence which contains the matching keyword. Similar problem is discussed here and working example is given.
type: Answer
answers question: http://stackoverflow.com/q/21158657

http://stackoverflow.com/comment/31742852
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21073010
has text: Any clue as to the distribution of reads over the data? Uniform? Bell shaped? Also, some samples of the data entries themselves would be helpful.
score: 0

http://stackoverflow.com/comment/31810267
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21137700
has text: I'm sure that revalidate() & repaint() from JFrame to refresh all JComponents tree, sure there is one potential issue repaint() is possible to switch off, programatically for JComponents

http://stackoverflow.com/q/21050538
favorite count: 0
has comment: http://stackoverflow.com/comment/31650266
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31650975
has comment: http://stackoverflow.com/comment/31650428
has body: So I have the latest version of JRE 7 on my computer, and everything is working fine. Lately, I've downloaded a program that requires JRE 6. I know where all of the files are located on my computer, all I'm asking is the .bat file code to run a specific version of Java with only that program. I am somewhat of a newbie when it comes to Windows and Java PATH structure, so Stanford's computer science course has you use a modified version of Eclipse to code in Java, and it was created when Java was still in version 6. If you are familiar with this, then you may know of karel the robot, a Java application that opens in Eclipse. When I tried to run this, the Karel program did not appear; only a blank screen. I found a youtube video about using Karel and many of the people in the comments had been having this problem, and some said that using JRE 6 fixed it. Also on the installation instructions, it said to use JRE 1.6, but I thought it would work with JRE 7
tagged with: java
has comment: http://stackoverflow.com/comment/31650663
has comment: http://stackoverflow.com/comment/31650362
has comment: http://stackoverflow.com/comment/31650264
has comment: http://stackoverflow.com/comment/31650505
type: Question
has answer: http://stackoverflow.com/a/21051275
score: 9
answer count: 2
upvote count: 9
has comment: http://stackoverflow.com/comment/31650579
downvote count: 0
has title: How to run a specific version of Java with a program?
tagged with: batch-file
has answer: http://stackoverflow.com/a/21051337

http://stackoverflow.com/a/22767547
type: Answer
has comment: http://stackoverflow.com/comment/34710622
score: 0
answers question: http://stackoverflow.com/q/21061283
has body: Use the input element this way (just an example): &lt;pre&gt; &lt;input type="text" value="${result.getCourses().get(i)}"&gt; &lt;/pre&gt;

http://stackoverflow.com/q/21097007
tagged with: http://stackoverflow.com/tag/json
type: Question
has body: I am getting the JSON exception when I am executing the result into the browser, like the following: type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.ProductDetails.ISN, no session or session was closed org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:209) org.apache.struts2.json.JSONWriter.process(JSONWriter.java:140) org.apache.struts2.json.JSONWriter.value(JSONWriter.java:216) org.apache.struts2.json.JSONWriter.write(JSONWriter.java:94) org.apache.struts2.json.JSONUtil.serialize(JSONUtil.java:115) org.apache.struts2.json.JSONResult.createJSONString(JSONResult.java:200) org.apache.struts2.json.JSONResult.execute(JSONResult.java:172) com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:361) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122) com.opensymphony.xwork2…
has comment: http://stackoverflow.com/comment/31738607
answer count: 1
has comment: http://stackoverflow.com/comment/31738141
has comment: http://stackoverflow.com/comment/31738717
has comment: http://stackoverflow.com/comment/31738931
tagged with: struts2
has comment: http://stackoverflow.com/comment/31737041
downvote count: 0
has comment: http://stackoverflow.com/comment/31739292
has comment: http://stackoverflow.com/comment/31738375
favorite count: 0
has title: LazyInitializationException: failed to lazily initialize a collection of role, no session or session was closed, using JSON result in Struts 2
has comment: http://stackoverflow.com/comment/31738843
upvote count: 2
type: UnansweredQuestion
tagged with: actionresult
has answer: http://stackoverflow.com/a/21099135
score: 2
tagged with: java
tagged with: hibernate

rest
tags question: http://stackoverflow.com/q/21039620
tags question: http://stackoverflow.com/q/21094726
tags question: http://stackoverflow.com/q/21148861
tags question: http://stackoverflow.com/q/21103905
tags question: http://stackoverflow.com/q/21145610
tags question: http://stackoverflow.com/q/21098105
tags question: http://stackoverflow.com/q/21146651
tags question: http://stackoverflow.com/q/21134629
tags question: http://stackoverflow.com/q/21172567
tags question: http://stackoverflow.com/q/21151068
tags question: http://stackoverflow.com/q/21051282
tags question: http://stackoverflow.com/q/21160226
tags question: http://stackoverflow.com/q/21073420
tags question: http://stackoverflow.com/q/21043646
tags question: http://stackoverflow.com/q/21071952
tags question: http://stackoverflow.com/q/21150488
tags question: http://stackoverflow.com/q/21135671
tags question: http://stackoverflow.com/q/21079193
tags question: http://stackoverflow.com/q/21021837
tags question: http://stackoverflow.com/q/21053501
tags question: http://stackoverflow.com/q/21086371
tags question: http://stackoverflow.com/q/21072180
tags question: http://stackoverflow.com/q/21147083
tags question: http://stackoverflow.com/q/21074013
tags question: http://stackoverflow.com/q/21140711
tags question: http://stackoverflow.com/q/21052204
tags question: http://stackoverflow.com/q/21171472
tags question: http://stackoverflow.com/q/21071744
tags question: http://stackoverflow.com/q/21175823
tags question: http://stackoverflow.com/q/21167703
tags question: http://stackoverflow.com/q/21033852
tags question: http://stackoverflow.com/q/21156805
type: Tag
tags question: http://stackoverflow.com/q/21067725
tags question: http://stackoverflow.com/q/21018787
tags question: http://stackoverflow.com/q/21164901
tags question: http://stackoverflow.com/q/21143126
tags question: http://stackoverflow.com/q/21098065
tags question: http://stackoverflow.com/q/21125173
tags question: http://stackoverflow.com/q/21101737
tags question: http://stackoverflow.com/q/21088225
tags question: http://stackoverflow.com/q/21042356
tags question: http://stackoverflow.com/q/21018828
tag name: rest
tags question: http://stackoverflow.com/q/21035132
tags question: http://stackoverflow.com/q/21026167
tags question: http://stackoverflow.com/q/21109586
tags question: http://stackoverflow.com/q/21166137
tags question: http://stackoverflow.com/q/21045781
tags question: http://stackoverflow.com/q/21146252
tags question: http://stackoverflow.com/q/21168185
tags question: http://stackoverflow.com/q/21178823

http://stackoverflow.com/q/21132228
has comment: http://stackoverflow.com/comment/31800660
has answer: http://stackoverflow.com/a/21132478
has comment: http://stackoverflow.com/comment/31974836
type: Question
has body: I have a class that retrieves ArrayList from Database. And I need to show this items in Alert Dialog builder. But im getting an error in this. Please Help! Here is my error: Error: The method setSingleChoiceItems(int, int, DialogInterface.OnClickListener) in the type AlertDialog.Builder is not applicable for the arguments (Name[], int, new DialogInterface.OnClickListener(){}) ArrayList&lt;Name&gt; n_names = null; n_names = db.getAllNames(); AlertDialog.Builder builder = new AlertDialog.Builder(Name.this); builder.setTitle("Choose Name"); builder.setSingleChoiceItems(n_names.toArray(new Name[n_names.size()]), -1, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { }}); builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { }}); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { }}); AlertDialog alert = builder.create(); alert.show();
has comment: http://stackoverflow.com/comment/31801766
upvote count: 0
tagged with: arrays
answer count: 1
linked to: http://stackoverflow.com/q/21096674
tagged with: arraylist
tagged with: android
accepted answer: http://stackoverflow.com/a/21132478
has comment: http://stackoverflow.com/comment/31801416
has title: Alert Dialog Builder wont show ArrayList
has comment: http://stackoverflow.com/comment/31801199
favorite count: 0
has comment: http://stackoverflow.com/comment/31800538
has comment: http://stackoverflow.com/comment/31800635
has comment: http://stackoverflow.com/comment/31800940
downvote count: 2
tagged with: android-alertdialog
type: AnsweredQuestion
score: -2
has comment: http://stackoverflow.com/comment/31800903
tagged with: java

http://stackoverflow.com/a/21092036
score: 0
has comment: http://stackoverflow.com/comment/31727753
has comment: http://stackoverflow.com/comment/31728087
has comment: http://stackoverflow.com/comment/31728123
type: Answer
answers question: http://stackoverflow.com/q/21091924
has comment: http://stackoverflow.com/comment/31726728
has comment: http://stackoverflow.com/comment/31728181
has body: You can change the animation used when you switch between the fragments from your home screen using the android.animation framework. Some more information can be found here: Animate the transition between fragments In the sales fragment you will have a ViewPager as you suggested and this ViewPager will contain 3 more Fragments one will be for Sales one will be for New Lead and one will be for Edit info. Hopefully that makes sense to you
has comment: http://stackoverflow.com/comment/31726829

http://stackoverflow.com/q/21100842
tagged with: android
has body: I'm trying to determine whether two rectangles border each other. If they share an edge or part of an edge, then I want to include them, if they only share a vertice then I don't. I've tried using android android.graphics.Rect, I was hoping that the intersect method would return true giving me a rectangle, with 0 width but the points of the intersecting edge. I'm using andEngine and also tried the collideswith method of org.andengine.entity.primitive.Rectangle however that returns true, even if the rectangle only share one corner vertice. Is there a nice way of doing this? The only other way I can think of is to try and create a collection of all the edges then see if they're equal or are in someway partly equal. Here's an image to demonstrate what I want. If I click on rect 1 then I want to return rects 2,3 and 4, but not 5. "Map":
score: 0
tagged with: java
answer count: 2
tagged with: andengine
has answer: http://stackoverflow.com/a/21101390
tagged with: rectangles
tagged with: intersection
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31743973
linked to: http://stackoverflow.com/q/17847830
has title: Rectangle intersection shared edge
has answer: http://stackoverflow.com/a/21101097
has comment: http://stackoverflow.com/comment/31743890
type: Question
has comment: http://stackoverflow.com/comment/31744157

http://stackoverflow.com/q/21023506
has answer: http://stackoverflow.com/a/21024233
tagged with: string
has comment: http://stackoverflow.com/comment/31601495
has body: how to reverse the String without using any API like reverse() , length() , toCharArray() , charAt()
downvote count: 13
has comment: http://stackoverflow.com/comment/31601533
favorite count: 0
has comment: http://stackoverflow.com/comment/31601585
upvote count: 3
has answer: http://stackoverflow.com/a/21024269
has comment: http://stackoverflow.com/comment/31602703
has comment: http://stackoverflow.com/comment/107964282
has comment: http://stackoverflow.com/comment/31604611
has answer: http://stackoverflow.com/a/21023769
has answer: http://stackoverflow.com/a/21023766
has answer: http://stackoverflow.com/a/21023723
has answer: http://stackoverflow.com/a/21023980
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31601558
score: -10
has comment: http://stackoverflow.com/comment/31601821
has comment: http://stackoverflow.com/comment/31602006
has comment: http://stackoverflow.com/comment/31604637
tagged with: algorithm
has comment: http://stackoverflow.com/comment/31601921
has comment: http://stackoverflow.com/comment/31601948
tagged with: java
has comment: http://stackoverflow.com/comment/31601669
has answer: http://stackoverflow.com/a/21024545
has title: How to reverse the String?
has answer: http://stackoverflow.com/a/21025127
type: Question
answer count: 8
has comment: http://stackoverflow.com/comment/31602397
has comment: http://stackoverflow.com/comment/31601820
has comment: http://stackoverflow.com/comment/31601385

http://stackoverflow.com/q/21143416
has comment: http://stackoverflow.com/comment/31820849
has comment: http://stackoverflow.com/comment/31825981
has comment: http://stackoverflow.com/comment/31820604
has title: Delay/Timer in java
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21146100
has comment: http://stackoverflow.com/comment/31820561
has answer: http://stackoverflow.com/a/21143472
has body: Every method I use so far just freeze's my program for the time but I want the game to continue running, I just want the shield boolean to be true for X time and then return to false after the time has expired, is there any way to do this? Thanks. c.removeEntity(tempEnt); c.removeEntity(this); Game.shield = true; // Wait x time and then do the line below; Game.shield = false;
score: 0
has comment: http://stackoverflow.com/comment/31823185
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31820606
has comment: http://stackoverflow.com/comment/31821077
has answer: http://stackoverflow.com/a/21143654
answer count: 4
has answer: http://stackoverflow.com/a/21143891

http://stackoverflow.com/a/21132107
has comment: http://stackoverflow.com/comment/31801506
has comment: http://stackoverflow.com/comment/31801581
score: 0
type: Answer
has body: se CascadeType. Reference @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) private List&lt;UserRole&gt; roles; Update : orphanRemoval attribute can use JPA 2.x version. You have to find out the deleted UserRole data by comparing old rolesList and new rolesList` orphanRemoval attribute does not support in ManyToMany mapping.
answers question: http://stackoverflow.com/q/21131964
has comment: http://stackoverflow.com/comment/31801447

http://stackoverflow.com/comment/31692117
type: Comment
comment on: http://stackoverflow.com/a/21070289
score: 0
type: AnswerComment
has text: It's not correct that this regex matches "any string which starts and ends with a number". This matches

http://stackoverflow.com/comment/31753283
type: Comment
has text: I just have a canvas...I know how to add a button and on button click how to pop up a new window..but I don't know how to carry out animation..
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21105701

http://stackoverflow.com/a/21122741
has body: OpenGL is a dumb drawing API not a scene graph. You tell it to draw something and as soon as it's on the framebuffer OpenGL already forgets about it. Things are drawing in the order as drawing commands are passed to OpenGL. Which essentially means: You'll have to do the legwork. But since you have to properly prepare a drawing pass anyway (frustum culling, asset allocation, state change minimizing preordering, etc.) this doesn't mean a lot of extra work. Of course if you treat OpenGL like something it is not, namely a scene graph, your results will be sub-par.
type: Answer
answers question: http://stackoverflow.com/q/21120260
has comment: http://stackoverflow.com/comment/31787557
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31783992
has comment: http://stackoverflow.com/comment/31783877
downvote count: 0
has comment: http://stackoverflow.com/comment/31783687

http://stackoverflow.com/comment/31821528
comment on: http://stackoverflow.com/q/21140897
has text: This is doomed to never work properly by design. There are a *lot* of ways to make images and text appear in a PDF. You may get it to work with PDF's created by a single source (sufficient for you?), but never reliably with any PDF.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/21061905
type: AcceptedAnswer
has body: I think you should rethink your class design. There are two solutions to your problem Pull the onEvent method up into your super class as non-abstract method with empty body. Then you can override in subclasses only where appropriate. Introduce an interface - let's call it EventHandler - that declares the method onEvent. Implement this interface in your subclasses where appropriate. Then either change your list to be a list of EventHandler objects or leave it as is and use instanceof to check if an object is an EventHandler in your iteration.
type: Answer
accepted answer of: http://stackoverflow.com/q/21061840
answers question: http://stackoverflow.com/q/21061840
score: 0

http://stackoverflow.com/q/21072378
type: UnansweredQuestion
tagged with: package
tagged with: maven
has body: [ SOLVED ] - but still looking for explanation. Please see bottom of question I don't have much experience with command line or with Maven. I'm working on a tutorial from a book. It state I should create a java file src/main/java/com/effectivemaven/chapter01/ExampleAction.java What I did was mkdir each directory separately i.e. mkdir com, mkdir effectivemaven, mkdir chapter01 I create the .java file in the chapter01 directory. package com.effectivemaven.chapter01; import org.slf4j.*; public class ExampleAction { final Logger logger = LoggerFactory.getLogger(ExampleAction.class); public boolean execute() { logger.info( "Example Action Executed." ); return true; } } When I mvn compile, it says compiling 1 file to target..., but when I look at the taget directory, nothing is created. So I tried to create a another .java file without using packages, just a simple public class Hello { public static void main(String[] args) { System.out.println("Hello"); } } in the java directory, then mvn compile and it shows up in the target file. So my assumption is that I'm not creating the packages correctly by using mkdir, or possibly I'm doing something else wrong I'm unaware of. So basically I just want to know, what is the correct way to create a package from the command line? And if I'm doing it correctly, what could be the other possible reasons the .class is not being created in the target? EDIT tree first-webapp src main java Hello.java com effectivemaven chapter01 ExampleAction.java target classes Hello.class pom.xml Command running from C:\Maven Book\first-webapp> C:\Maven Book\first-webapp>mvn compile [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building first-webapp Maven Webapp 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ first-weba pp --- [WARNING] Using platform enco…
has answer: http://stackoverflow.com/a/21078135
has comment: http://stackoverflow.com/comment/31691429
upvote count: 5
tagged with: java
linked to: http://stackoverflow.com/q/10971838
has comment: http://stackoverflow.com/comment/31691342
has comment: http://stackoverflow.com/comment/31691227
type: Question
score: 5
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31690790
has comment: http://stackoverflow.com/comment/31690958
has comment: http://stackoverflow.com/comment/31690850
has comment: http://stackoverflow.com/comment/31690784
favorite count: 0
has comment: http://stackoverflow.com/comment/31691081
has comment: http://stackoverflow.com/comment/31692666
tagged with: command-line
has title: What is the correct way to create a Java package from command line? (trouble with Maven)

http://stackoverflow.com/comment/31873189
has text: except that the `[HH:MM:SS]` isnt actually that, it is an actual time... would that still work?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21172129

http://stackoverflow.com/q/21166592
score: 0
answer count: 2
tagged with: log4j
type: UnansweredQuestion
tagged with: plugins
tagged with: logging
has answer: http://stackoverflow.com/a/21167204
tagged with: java
type: Question
has title: Setting log level for plugin project in Grails
has answer: http://stackoverflow.com/a/21167109
tagged with: grails
has body: I have a grails project with a plugin project whose codes i use in main codes. I have set the logger in main project to info level using "info 'grails.app'". It works for all the classes in the main project but not for those in plugin project. Does the scope of grails.app wont cover plugin classes? If that is so then what is the solution. If not what can be possible issue over here. I am debugging my system and want to see the issue by getting into debug level (ofcourse replacing info by debug) but the logging statements from the plugin classes are not printed. Any help will be really appreciated. Thanks

http://stackoverflow.com/q/21139384
has answer: http://stackoverflow.com/a/21156229
has body: An application run as java applet suddenly stopps working with default java security settings. The reason is that this applet uses a self-signed certificate. Is it possible to get it starting again without lowering the security level configured within the Java control panel? Is there any workaround?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31825110
upvote count: 1
type: Question
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/373295
tagged with: security
tagged with: applet
tagged with: self-signed
has answer: http://stackoverflow.com/a/21139785
favorite count: 0
has title: Is it possible to open self-signed java applet with java version 7 update 51 without decreasing security level
type: UnansweredQuestion

http://stackoverflow.com/q/21142847
has comment: http://stackoverflow.com/comment/31819683
favorite count: 0
linked to: http://stackoverflow.com/q/21139851
has answer: http://stackoverflow.com/a/21142936
has title: Binary Search Tree and AVLTree Issue
has comment: http://stackoverflow.com/comment/31820139
linked to: http://stackoverflow.com/q/8383976
has comment: http://stackoverflow.com/comment/31819554
type: AnsweredQuestion
tagged with: binary-search-tree
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31819904
accepted answer: http://stackoverflow.com/a/21142936
type: Question
has comment: http://stackoverflow.com/comment/31820109
tagged with: tree
tagged with: algorithm
has body: I am making Binary Search Tree and AVL Tree for an assignment. I am having problem when I try to add 1,000,000 elements to Binary Search Tree but I can add key-> value pairs to AVL Tree.(There is no problem with AVLTree) If I Balance Binary Search Tree , there would be NO difference with AVL Tree ??(What is the point if I balance binary search tree it becomes a AVLTree?) I'm getting error from Binary Search Tree after 15,000 elements inserted: Exception in thread "main" java.lang.StackOverflowError Project Definition: Using these tests and the code created for naive binary search trees, compare the performance of AVL trees and naive binary search trees for both the time of search, insert and delete and for tree balance on long sequences. You should run tests with up to 1000000 elements in your trees. public class BinaryTreeExample { public static void main(String[] args) { new BinaryTreeExample().run(); } static class Node { Node left; Node right; int value; public Node(int value) { this.value = value; } } public void run() { Node rootnode = new Node(25); insert3(rootnode, 50_000); for (int i = 0; i &lt; 150_000; i++) insert3(rootnode, i); System.out.println("Bittaaa"); // System.out.println(getNodesCount(rootnode)); } protected int getNodesCount(Node root) { if (root != null) { int counter = 1; counter += getNodesCount(root.left); counter += getNodesCount(root.right); return counter; } else return 0; } void insert3(Node node, int value) { if (value &lt; node.value) { if (node.left == null) node.left = new Node(value); else insert3(node.left, value); } else { if (node.right == null) node.right = new Node(value); else insert3(node.right, value); } } public void printInOrder(Node node) { if (node != null) { printInOrder(node.left); System.out.println(" Traversed " + node.value); printInOrder(node.right); } } }
downvote count: 0
answer count: 1

http://stackoverflow.com/a/21117262
score: 0
answers question: http://stackoverflow.com/q/21045330
has body: I think you should run your code inside an application client, and it will create the initial context for you. See Java EE Application client container for more details.
type: Answer

http://stackoverflow.com/comment/31834618
score: 2
comment on: http://stackoverflow.com/q/21150508
has text: What else should it give?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31649933
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21050328
type: AnswerComment
has text: I've updated my question. the problem persists. I cannot use `key` more than once in the loop.

http://stackoverflow.com/q/21055209
has comment: http://stackoverflow.com/comment/31659287
has answer: http://stackoverflow.com/a/21055389
favorite count: 0
has comment: http://stackoverflow.com/comment/31659166
upvote count: 1
accepted answer: http://stackoverflow.com/a/21055389
type: AnsweredQuestion
tagged with: enums
score: 1
tagged with: java
has body: I have multiple classes that all inherit from the same Block class, and want to instantiate one of them based on a variable value. Here is what I did for now: public enum MapCases { FLOOR (Floor.class), // These are all subclass of my Block class WALL (Wall.class), ROCK (Rock.class); private Class&lt;?&gt; blockType; MapCases (Class&lt;?&gt; pointing) { this.block = pointing; } public Class&lt;?&gt; getType () { return this.blockType; } }; Then later, I try to instantiate them given some data: private Block[] blocks; // Array of the mother type ... blocks = new Block[data.length]; // data is an int array for (int i = 0; i &lt; data.length; i++) { int choice = data[i]; Class&lt;?&gt; blockType = MapCases.values()[choice].getType(); blocks[i] = new blockType(); // blockType is of unresolved type } But Eclipse shows me an error saying it can't resolve blockType to a type (which seems logical given the fact that java don't know yet the type). How could I achieve what I am trying to do?
has title: Choose a type from a list
has answer: http://stackoverflow.com/a/21055283
type: Question
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/21055283
tagged with: inheritance

http://stackoverflow.com/q/21046164
has title: JButton text with different font family in different words
answer count: 1
accepted answer: http://stackoverflow.com/a/21046367
favorite count: 0
tagged with: swing
type: AnsweredQuestion
tagged with: fonts
tagged with: java
type: Question
has body: I am trying to achieve a button with its text having two different font family. I think, it can be achieved using HTML, as said on this page. http://docs.oracle.com/javase/tutorial/uiswing/components/html.html I've tried the following code, but it's not working. JButton button = new JButton(" Hello World "); May be the font tag attribute family is wrong!
has answer: http://stackoverflow.com/a/21046367
score: 5
upvote count: 5
downvote count: 0
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/q/21118370
tagged with: java
has title: delayed response received in java socket
upvote count: 1
tagged with: ibm-midrange
answer count: 1
has answer: http://stackoverflow.com/a/21176775
has comment: http://stackoverflow.com/comment/31775417
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31881305
downvote count: 0
score: 1
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/2028620
tagged with: sockets
has body: I need help on my as400 and java connection. I am experiencing problem on receiving late response during SocketTimeoutExceptions. So what happen is that when i send the first request and response timeout occured, after sending my second request, the response for the first request is received, which creates discrepancy. Is there a way that after the timeout exception, the response should not cache or should not be received upon next request? Below is the snippet of my code to connect to the as400 server: public synchronized static byte[] sendRequestAndGetResponse(byte[] requestBytes) { try { if(checkHostConnection()){ LOG.debug("Sending request bytes to Host: {}", Hexifier.toHex(requestBytes)); IOUtils.write(requestBytes, dos); long startTime = System.currentTimeMillis(); LOG.info("Request sent to host."); LOG.info("Waiting on host response"); byte[] responseLengthBuffer = new byte[4]; IOUtils.readFully(dis, responseLengthBuffer); ByteBuffer bb = ByteBuffer.wrap(responseLengthBuffer); int msgLength = bb.getInt(); byte[] responseRemBytes = new byte[msgLength]; IOUtils.readFully(dis, responseRemBytes); long endTime = System.currentTimeMillis(); byte[] fullResponseBytes = new byte[responseLengthBuffer.length + responseRemBytes.length]; System.arraycopy(responseLengthBuffer, 0, fullResponseBytes, 0, responseLengthBuffer.length); System.arraycopy(responseRemBytes, 0, fullResponseBytes, responseLengthBuffer.length, responseRemBytes.length); LOG.debug("Response from server is received. Time elapsed at {} millis.", (endTime - startTime)); LOG.debug("Bytes received: {}", Hexifier.toHex(fullResponseBytes)); return fullResponseBytes; } else { reconnectToHost(); } } catch (SocketTimeoutException ste){ LOG.error("Reading response from socket timeout: {}", ste.getClass().getName()); try { LOG.warn("Waiting for Host reply from its socket timeout."); socket.shutdownInput(); socket.shutdownOutput(); int hostResponsefromTimeout = dis.read(); if (hostResponsefromTimeout == -1){ LOG.deb…

http://stackoverflow.com/comment/31842939
score: 0
type: QuestionComment
has text: try cleaning it, and then rebuilding it..
type: Comment
comment on: http://stackoverflow.com/q/21155362

http://stackoverflow.com/comment/31611530
type: Comment
comment on: http://stackoverflow.com/a/21028462
score: 0
has text: Now I do too. :P "Pseudo-type" was the kind of thing I was looking for. Thanks.
type: AnswerComment

http://stackoverflow.com/q/21101186
has title: Wicket: Two AjaxButtons inside separate forms issue
has comment: http://stackoverflow.com/comment/31784815
tagged with: wicket
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has comment: http://stackoverflow.com/comment/31757563
has comment: http://stackoverflow.com/comment/31750501
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31788960
has comment: http://stackoverflow.com/comment/31745160
has comment: http://stackoverflow.com/comment/31757663
has comment: http://stackoverflow.com/comment/31757786
has answer: http://stackoverflow.com/a/21125638
has comment: http://stackoverflow.com/comment/31765751
has body: I want to place two separate file upload panels on page, one is for images, another for other files. Each panel contains a form with AjaxButton inside. First I developed the first panel, it worked as expected. But when I added another one, the second AjaxButton inside a form is not responding when clicked. Instead, when I click on the first button, the second one responds. What could be the reasons for that? Here's the first panel's HTML: <wicket:panel> Select file : </wicket:panel> And the second one: <wicket:panel> Select file : </wicket:panel> So now, when both panels are in place, clicking uploadButton-album does nothing but it responds by clicking uploadButton-img. EDIT: <wicket:panel> </wicket:panel>
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21125638
tagged with: ajax
has comment: http://stackoverflow.com/comment/31768780
type: Question

http://stackoverflow.com/a/21097333
answers question: http://stackoverflow.com/q/21097230
type: Answer
score: 0
has body: First of all your code samples will produce different results - the first one does nothing, while the second one actually increments number. Both return the old value of the variable however (i.e. without the added 1), because you use the post-decrement operator x++ (instead of ++x). Secondly using fields is no problem even in big class files if you use self-explaining names. And thirdly it's often not possible to omit using the field if you want to assign a value back to it.

http://stackoverflow.com/comment/31779588
type: AnswerComment
has text: @JudgeMental True, they don't have to be concreted, just that the specify their type parameters in the class/interface definition. Updated.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21120600

http://stackoverflow.com/a/21104499
has comment: http://stackoverflow.com/comment/31771701
has comment: http://stackoverflow.com/comment/31771884
has comment: http://stackoverflow.com/comment/31772227
accepted answer of: http://stackoverflow.com/q/21103990
has comment: http://stackoverflow.com/comment/31773365
score: 0
answers question: http://stackoverflow.com/q/21103990
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31772606
type: Answer
has body: At this line the Y axis range is set to (-1,1) interval: plot.getDomainAxis().setRange(0, 1000); //array plot.getRangeAxis().setRange(-1,1);//time But Y axis is intended to take the value from totalRuntime which is a time difference given in millis: if( insSort.isEnabled()) { long startTime = System.currentTimeMillis(); insSort(A); long endTime = System.currentTimeMillis(); totalRuntime += (endTime - startTime); // this is certainly &gt; 1 } series.add(totalRuntime,A.length); dataset.addSeries(series); This value will be certainly > 1 (unless you have the most powerful computer ever :). So you can see which value is getting totalRuntime and adjust the Y axis range accordingly. You might also check: Domain axis range: if the array has more than 1000 elements then you won't see the graphic either. Is insSort.isEnabled() actually true? If not so then you'll be adding garbage to dataset. Addendum I want to graph sorting time versus the number of elements Well you can take a look to the example below. As I haven't the sort methods implementation the example emulates the times using Swing timer. The key is adding the values to the series properly and having the right ranges set. Note: as times are random generated then the shown info is garbage. The example tries to illustrate the process you should follow to make the graphic work. Pay special attention to fillChart() method: it makes the trick. import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JToggleButton; import javax.swing.SwingUtilities; import javax.swing.Timer; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection; public c…
has comment: http://stackoverflow.com/comment/31776979
has comment: http://stackoverflow.com/comment/31750978
has comment: http://stackoverflow.com/comment/31767103

http://stackoverflow.com/a/21093575
has body: Doesn't your file "utenti.txt" start with an empty line? If it is so, then right after this test while (scnr.hasNextLine()) { the only thing you know is that there is a line available in the file, so that the next command String nome = scnr.next(); fails to get a String token and produces the NoSuchElementException that you get. As a general rule, before calling String whatever = scnr.next(), you should test using scnr.hasNext() instead of scnr.hasNextLine().
score: 0
answers question: http://stackoverflow.com/q/21092675
type: Answer

http://stackoverflow.com/a/21218764
answers question: http://stackoverflow.com/q/21176667
type: AcceptedAnswer
downvote count: 0
has body: You can use another thread (or runnable) to get query results, but make sure that the query-task is self-contained: it opens a connection (or gets one from the conneciton pool), fires the query, gets the results, stores the results in some variable (e.g. HashMap), closes the query, the result-set and the connection (or returns it to the pool). When all this is done (with appropriate try-catch-finally blocks), the task can then 'send' the data to the main processing thread. Using the method described in the answer by TeresaCarrigan, following an example how a "worker thread" can 'send' data to the "main thread": import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Random; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; public class Q21176667 implements Runnable { private static volatile boolean stop; public static void main(String... args) { Thread t = new Thread(new Q21176667()); t.start(); sleep(200); stop = true; } private BlockingQueue&lt;Long&gt; q = new ArrayBlockingQueue&lt;Long&gt;(100); @Override public void run() { try { while (!stop) { if (q.peek() == null) { new Thread(new GetUpdates(this)).start(); } long l = q.take(); System.out.println("Main sleep: " + l); sleep(l); } } catch (Exception e) { e.printStackTrace(); } } public void add(Collection&lt;Long&gt; moreData) { for (Long l : moreData) { q.add(l); } } static class GetUpdates implements Runnable { final Q21176667 processor; public GetUpdates(Q21176667 processor) { this.processor = processor; } @Override public void run() { List&lt;Long&gt; vlist = new ArrayList&lt;Long&gt;(); // Run query, process results sleep(10); Random r = new Random(); for (int i = 0; i &lt; 3; i++) { vlist.add(new Long(r.nextInt(10))); } System.out.println("Adding " + vlist.size() + " more sleeps."); processor.add(vlist); } } public static void sleep(long timeMs) { try { Thread.sleep(timeMs); } catch (Exception ignored) {} } } Output looks l…
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21176667
score: 1

http://stackoverflow.com/comment/32057028
has text: Option 3 is working fine. Thank you for your valuable suggestions.
type: Comment
comment on: http://stackoverflow.com/a/21140694
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31667924
type: AnswerComment
has text: yes that's why if you move large size file from one location to another location in same partition then it takes little time but if you move large size file from one location to another location in different partition then it takes more time because system must have to copy data from one partition to another partition correct me if i am wrong
type: Comment
comment on: http://stackoverflow.com/a/21060023
score: 0

http://stackoverflow.com/q/21179366
has answer: http://stackoverflow.com/a/21179419
has answer: http://stackoverflow.com/a/21180492
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21179419
tagged with: java
accepted answer: http://stackoverflow.com/a/21180492
has title: Eclipse: How to see methods supported by variable's type during debugging ?
tagged with: eclipse
type: Question
tagged with: debugging
score: 0
answer count: 2
has body: During editing Eclipse gives suggestions for the methods that I can call on a variable. Is there a way to see those suggestions during debugging, maybe in the variables window or maybe in some other perspective ?

http://stackoverflow.com/comment/31697393
type: Comment
type: QuestionComment
has text: What have you tried? What methods have you considered using? What did you learn when you searched Google and the existing questions here?
score: 1
comment on: http://stackoverflow.com/q/21076029

http://stackoverflow.com/q/21101330
tagged with: spring-mvc
tagged with: java
type: Question
has body: When defining a tiles definition or attribute, can you reference another definition or attribute without inheriting? I have all sorts of JSP fragments, CSS, and JavaScript that would be considered 'common'. They are certainly not needed for every page, and thus inheriting directly doesn't seem like it's going to work. Example: <put-attribute name="body" value="currentBodyDefinition" /> <put-attribute name="scripts" value="[...???...]" /> <put-attribute name="styles" value="[...???...]" />
tagged with: javascript
score: 0
has title: In Tiles 2, is there a way to reference another definition or attribute without directly inheriting?
answer count: 1
has answer: http://stackoverflow.com/a/21103112
type: UnansweredQuestion
tagged with: tiles2
tagged with: css

http://stackoverflow.com/comment/31648690
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21023674
type: Comment
has text: @OlegS. Yes it does, providing header files is about providing the available API. That's simply not needed when using Java.

traversal
tags question: http://stackoverflow.com/q/21108695
tag name: traversal
type: Tag

http://stackoverflow.com/comment/31689772
type: QuestionComment
comment on: http://stackoverflow.com/q/21071739
has text: The best choice you have is to "reset" the applet back to it's initial state...
score: 0
type: Comment

http://stackoverflow.com/a/37759318
answers question: http://stackoverflow.com/q/21043783
type: Answer
downvote count: 1
score: -1
upvote count: 0
has body: try to change the method data.addAll(newlist) by using addall(newlist, data); inside addall method add one by one the list of element. this way it should work. i had the same problem and i correct it the way i explained.

http://stackoverflow.com/comment/31718336
comment on: http://stackoverflow.com/q/21084487
type: Comment
has text: i want user can custom their db operation by using SQL statement in javascript.
score: 0
type: QuestionComment

http://stackoverflow.com/a/21064343
has comment: http://stackoverflow.com/comment/31676280
type: Answer
score: 2
has body: Well just to fix your error: System.out.print(celsius + "degrees Celsius is " + fahrenheit + " degrees Fahrenheit"); or you could do this if you want to use printf. System.out.printf("%f degrees Celsius is %f degrees Fahrenheit",celsius,fahrenheit); The reason I did all this is mainly just simple syntax. Strings are stuff within double quotes. "blah" for example is a String containing the word blah. If you want to concatenate two strings then you use the + operator in Java. So you want to add "foo" and "bar" you write "foo" + "bar" and you get "foobar". In your attempt you have made two errors: Firstly, (the intention of) string concatenation was done wrong. + celsius isn't a syntax error because celsius is a number but if it were a string then the compiler doesnt have anythign to the left of that + to concatenate the value of celsius with. "" + celsius would have been fine if you wanted to prepend nothing. + celsius effectively does nothing since it is a number. Positive or negative wont matter. -celsius of course flips the sign. If you want to display a positive number always (although your output would then be incorrect) you can use Math.abs(celsius). Secondly, since you are using System.out.printf there is a specific format that you need to follow. i.e. the first argument must be a string (possibly with things like %d, %f, %s, etc) which the function will replace with the subsequent arguments that you provide it. This is what my solution does, it uses %f (for floating point numbers) twice and I give it two things celsius and fahrenheit which are doubles and Java realizes that all is good and just replaces the values in there. You can use things like %.2f if you wanted two decimal places and such as well, this is the advantage of printf over a normal print or println (print + new line). To fix the real other problem is that you are taking in temprature in celsius but saving it to the variable fahrenheit. If you just change that then all will be well. System.out.p…
upvote count: 2
has comment: http://stackoverflow.com/comment/31676307
downvote count: 0
answers question: http://stackoverflow.com/q/21064293
has comment: http://stackoverflow.com/comment/31676074

http://stackoverflow.com/a/21062782
has body: This is an interesting question :-) . It is true, that they had to use signed integer value type to represent EOF, but the preference of int over short is probably really just performance. As I found on a different StackOverflow thread where this was discussed, the Java VM would automatically use int internally even if the definition used short. The Java documentation states, that short should be used in large arrays and situations where memory really matters - source - http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html . That is apparently no the case here, because we always get just one value.
has comment: http://stackoverflow.com/comment/31672993
answers question: http://stackoverflow.com/q/21062744
score: 1
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/q/21159988
has answer: http://stackoverflow.com/a/21160162
has body: Add into array list more than 50,000,000 records from data base. I am adding 30,000,000 records it showing out of heap memory error .
has answer: http://stackoverflow.com/a/21160736
downvote count: 0
has comment: http://stackoverflow.com/comment/31851050
favorite count: 0
has answer: http://stackoverflow.com/a/21160304
tagged with: out-of-memory
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21160164
has comment: http://stackoverflow.com/comment/31851040
has title: How to add more than 50,000,000 records in arraylist from mysql database
score: 2
upvote count: 2
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31851182
linked to: http://stackoverflow.com/q/1565388
has answer: http://stackoverflow.com/a/21162740
has comment: http://stackoverflow.com/comment/31851391
has comment: http://stackoverflow.com/comment/31850958

http://stackoverflow.com/comment/31652598
has text: Yes I'm talking about prevention. Only one at a time should occur. The rest must be ignored. If conversion fails then, there is no meaning to check for any validation(s). If conversion succeeds then, the validations should be performed in a defined order, first empty fields should be validated, if it succeeds then, the value should be checked for a range/length and so on. If one validation fails then, the rest must be ignored. Can this be done?
score: 0
comment on: http://stackoverflow.com/q/21050502
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21142127
type: Answer
has body: The resolution is to "rename" the classes inside the jar. Don't worry, this isn't so hard. It's actually pretty easy. But it'll take you about 15 - 45 minutes to learn. The tool you need is called JarJarLinks. It will make a copy of your jar, but with all the conflicting names renamed. It's a little too much to explain here, but here is a simple example. Hint: If you are unsure of what the conflicts are exactly, there is another great tool which will make a nice report of dependencies for you. It's called Tattletale.
score: 0
answers question: http://stackoverflow.com/q/21141960

http://stackoverflow.com/q/21042147
has title: in Java does transient ignore variable or value?
has comment: http://stackoverflow.com/comment/31634774
duplicate of: http://stackoverflow.com/q/910374
upvote count: 4
has answer: http://stackoverflow.com/a/21042366
has body: Java course assignment: when a variable is put transient will serialisation ignore the variable or only the value of the variable. Test this. How do I test this?
has answer: http://stackoverflow.com/a/21042318
possible better answer: http://stackoverflow.com/a/21042171
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/21042171
favorite count: 0
type: Question
downvote count: 1
accepted answer: http://stackoverflow.com/a/21042318
has comment: http://stackoverflow.com/comment/31634532
linked to: http://stackoverflow.com/q/910374
tagged with: java
answer count: 3

http://stackoverflow.com/q/21064310
type: UnansweredQuestion
tagged with: java
has title: How to arrange image after drag and drop
type: Question
score: 0
answer count: 1
has body: I have a slight problem with my code. I'm developing drag and drop where users can drag the sweets out from the jar to the specific target. The process works just fine. However, when I want to drag the sweets from the specific target back to the jar, the sweets overlaps over each other. This picture below shows that the sweets are placed and arranged neatly. Before I drag the sweets out Then, after the sweets are being drag and drop, it looks like this the second picture. Based on the picture above, I have drag four sweets into the jar. But the sweets are overlapped and that is why you can see only one sweet in the jar. There is suppose to be four sweets in the jar. So, can you please help me. How can I arrange back my sweets so that after I dropped them back in the jar, it will be arrange just like the sweets in the first picture. This is the code. case DragEvent.ACTION_DROP: // // Dropped, reassign View to ViewGroup ViewGroup owner = (ViewGroup) view.getParent(); Log.i("drop", "Id First :" + view.getId()); Log.i("drop", "Id Second :" + v.getId()); Log.i("value", "Value :" + view.getContentDescription()); owner.removeView(view); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(88, 88); lp.addRule(RelativeLayout.CENTER_HORIZONTAL); lp.addRule(RelativeLayout.RIGHT_OF, view.getId()); if(v.getId()==R.id.jaroval) { RelativeLayout container = (RelativeLayout) v; container.addView(view,lp); value=container.getChildCount(); view.setVisibility(View.VISIBLE); } else { GridLayout container2 = (GridLayout) v; container2.setColumnCount(5); container2.addView(view); cValue=container2.getChildCount(); value=10-cValue; view.setVisibility(View.VISIBLE); } sound(); break;
tagged with: drag-and-drop
tagged with: android
has answer: http://stackoverflow.com/a/21064388

resultset
tags question: http://stackoverflow.com/q/21162753
tags question: http://stackoverflow.com/q/21031677
tags question: http://stackoverflow.com/q/21068708
tags question: http://stackoverflow.com/q/21150934
tags question: http://stackoverflow.com/q/21164605
tag name: resultset
tags question: http://stackoverflow.com/q/21160093
type: Tag

http://stackoverflow.com/comment/31672009
has text: what are the down votes for?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21062211

http://stackoverflow.com/comment/31698581
has text: If there's no xProperty() method the TableView will look for getX() instead. So it should work with getId() too.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21063392
type: Comment

http://stackoverflow.com/comment/31813228
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21139071
has text: please remove super.onActivityResult(requestCode, resultCode, data); (2nd line) from your onActivityResult() function.

http://stackoverflow.com/q/21174735
has comment: http://stackoverflow.com/comment/31878268
has comment: http://stackoverflow.com/comment/31878337
type: Question
tagged with: boolean
score: 5
accepted answer: http://stackoverflow.com/a/21174791
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31878300
has answer: http://stackoverflow.com/a/21174791
tagged with: initialization
upvote count: 5
has comment: http://stackoverflow.com/comment/31878414
has comment: http://stackoverflow.com/comment/31878258
has comment: http://stackoverflow.com/comment/31891872
has title: Tricky Java: boolean assignment in if condition
type: AnsweredQuestion
has body: I'm trying to get prepared for the OCA Java certification and got stuck in some questions dealing assignment in if conditions. Can anyone explain me the reason of the different behaviours in the code below? By my point of view I'm just putting the same two boolean values in an "inclusive or" condition 6 times... package pck; class SuperMain{ boolean b; public static void main(String args[]){ new SuperMain(); } SuperMain(){ if(_true()|_false()) System.out.println(b); //1 - prints false if(b=true|_false()) System.out.println(b); //2 - prints true if(_true()|(b=false)) System.out.println(b); //3 - prints false if((b=true)|_false()) System.out.println(b); //4 - prints false if(b=true|(b=false)) System.out.println(b); //5 - prints true if((b=true)|(b=false)) System.out.println(b); //6 - prints false } boolean _true(){return b=true;} boolean _false(){return b=false;} }
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/31882908
type: QuestionComment
has text: Hm, Mad's comment must be in invisible ink. ;)
score: 1
type: Comment
comment on: http://stackoverflow.com/q/21177294

http://stackoverflow.com/comment/31797267
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21115509
score: 0
has text: @TimB i want the bars to look simple there should be no graphics.

http://stackoverflow.com/a/21024807
upvote count: 5
accepted answer of: http://stackoverflow.com/q/21024484
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31615041
type: Answer
answers question: http://stackoverflow.com/q/21024484
score: 5
has body: If you call a method within the same class, Spring AOP does not have a chance to intercept the method. Therefore the @Transactional annotation is ignored. Trying moving the processEvent method to another class that is Spring injected.

http://stackoverflow.com/q/21147319
tagged with: java
has title: How to convert input char to uppercase automatically in Java
linked to: http://stackoverflow.com/q/3696441
possible better answer: http://stackoverflow.com/a/21147403
has comment: http://stackoverflow.com/comment/31829288
tagged with: char
has body: I am using a Scanner class to get the input and want to convert the input to uppercase letter when display it. This is my code Scanner input = new Scanner(System.in); System.out.print("Enter a letter: "); char c = input.next().charAt(0); Character.toUpperCase(c); Since I have convert it to uppercase, but the output is like input: a c = A; output: Enter a letter: a PS: The letter "a" is what I typed in the terminal However I want to it display as an uppercase one. How can I change it?
has answer: http://stackoverflow.com/a/21147354
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31828728
has answer: http://stackoverflow.com/a/21147547
has comment: http://stackoverflow.com/comment/31829374
tagged with: uppercase
has comment: http://stackoverflow.com/comment/31829000
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31828695
has comment: http://stackoverflow.com/comment/31828927
has comment: http://stackoverflow.com/comment/31828440
accepted answer: http://stackoverflow.com/a/21147354
upvote count: 3
has comment: http://stackoverflow.com/comment/31828660
has answer: http://stackoverflow.com/a/47030706
type: Question
has comment: http://stackoverflow.com/comment/31828472
has answer: http://stackoverflow.com/a/21147403
score: 3

http://stackoverflow.com/comment/31684284
type: QuestionComment
comment on: http://stackoverflow.com/q/21068698
has text: This might help you understand: http://stackoverflow.com/questions/2129044/java-heap-terminology-young-old-and-permanent-generations
score: 0
type: Comment

gmail
type: Tag
tag name: gmail
tags question: http://stackoverflow.com/q/21042446

http://stackoverflow.com/comment/31685921
score: 0
type: Comment
has text: I just got the point about your advice of using Guava Splitter ( which btw I dont know what that is) as your solution would not work for backslash '\\' or even string.split(Pattern.quote("\\")) and raises java.util.regex.Pattern.error(Unknown Source) error
comment on: http://stackoverflow.com/a/21069203
type: AnswerComment

http://stackoverflow.com/a/23010465
score: 1
has body: Hive table does not have constraints! Hive is a data warehousing infrastructure based on Hadoop. Hadoop provides massive scale out and fault tolerance capabilities for data storage and processing (using the map-reduce programming paradigm) on commodity hardware. Hive is designed to enable easy data summarization, ad-hoc querying and analysis of large volumes of data. It provides a simple query language called Hive QL, which is based on SQL and which enables users familiar with SQL to do ad-hoc querying, summarization and data analysis easily. At the same time, Hive QL also allows traditional map/reduce programmers to be able to plug in their custom mappers and reducers to do more sophisticated analysis that may not be supported by the built-in capabilities of the language. refer https://cwiki.apache.org/confluence/display/Hive/GettingStarted#GettingStarted-CreatingHiveTables for hive table DDL
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21156445
answers question: http://stackoverflow.com/q/21156445
type: Answer
downvote count: 0

http://stackoverflow.com/a/21140071
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21139849
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31814578
has body: I would suggest to sort your lists by the qicksort algorithm and then search the elements by the binary search. Here you can look at the corresponding wikipedia topics: Wiki - Quicksort Wiki - Binary Search
accepted answer of: http://stackoverflow.com/q/21139849
has comment: http://stackoverflow.com/comment/31815032

http://stackoverflow.com/comment/31855509
has text: Sadly it says "Cannot refer to a non-final variable rowHolder inside an inner class defined in a different method" and changing rowHolder to final is not a solution.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21162499

http://stackoverflow.com/comment/31743229
score: 2
comment on: http://stackoverflow.com/q/21099413
has text: Can't post an answer since it's closed >_< but it's clear what's (most likely) happening now you've posted the code: it works fine except for your diagnostic statements. It's perfectly possible for thread 1 to exit, but for thread 2 to take over before thread 1 has had the chance to print the "released" statement. The lock/release messages don't match what's really happening.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21149145
has comment: http://stackoverflow.com/comment/58875697
score: 1
has body: The ServletFilters registered as part of WebappContext (Web application) will be executed only for requests related to this WebappContext (Web application). So, one of the solutions I see is to register DefaultServlet [1] on the WebappContext and use it instead of StaticHttpHandler. Something like: ArraySet&lt;File&gt; set = new ArraySet&lt;File&gt;(File.class); set.add(new File(absolutePath)); ServletRegistration defaultServletReg = webappContext.addServlet("DefaultServlet", new DefaultServlet(set) {}); defaultServletReg.addMapping("/static"); [1] https://github.com/GrizzlyNIO/grizzly-mirror/blob/2.3.x/modules/http-servlet/src/main/java/org/glassfish/grizzly/servlet/DefaultServlet.java
upvote count: 1
answers question: http://stackoverflow.com/q/21128415
type: Answer
downvote count: 0

http://stackoverflow.com/comment/31611881
type: QuestionComment
has text: A `boolean` instance field will always be initialized to `false` by default. There must be something modifying it.
score: 0
comment on: http://stackoverflow.com/q/21029016
type: Comment

http://stackoverflow.com/q/21025501
tagged with: jdbc
has comment: http://stackoverflow.com/comment/31605331
has title: Delete meta data (Information schema) in H2 data base
tagged with: java
tagged with: h2
has answer: http://stackoverflow.com/a/21036763
has comment: http://stackoverflow.com/comment/31605202
type: Question
tagged with: database
has comment: http://stackoverflow.com/comment/31605410
score: 0
answer count: 1
type: UnansweredQuestion
has body: I am writing code in Java to build schema and populate an H2 in-memory DB In order to test it I want to delete all data and try to rebuild it from code. I tried deleting all data by command: drop all objects But I still have objects in the INFORMATION_SCHEMA folder in the H2 Console. Is there a nice and easy command to drop ALL the information from H2? Thanks.

http://stackoverflow.com/a/21079129
downvote count: 0
answers question: http://stackoverflow.com/q/21076680
type: Answer
has body: Progress (OpenEdge) has two "personalities" -- SQL and 4GL. The 4GL (or "ABL") engine is most commonly used and it does not care how wide a field is. All data is variable width. The width is just a suggestion for display formatting purposes and is routinely ignored by programmers. Naturally this gives SQL tools fits. There is a tool provided to ease your pain -- "dbtool" will scan the database and adjust the "sql-width" to reflect the actual maximum width that it finds in the data. This is commonly run on a regular basis (usually weekly or monthly) in most Progress shops that use SQL. http://knowledgebase.progress.com/articles/Article/P24496 http://knowledgebase.progress.com/articles/Article/P159769
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21076680
type: AcceptedAnswer

http://stackoverflow.com/a/21122757
answers question: http://stackoverflow.com/q/21122447
has body: In an UML class diagram you only represent "is-a" and "has-a" relations, that means, inheritance and composition. Maybe what you need to represent whatever happens between Library and Book objects is a sequence diagram http://en.wikipedia.org/wiki/Sequence_diagram
type: Answer
score: 0

http://stackoverflow.com/comment/31830939
score: 6
type: Comment
has text: Any luck with reading Javadoc?
comment on: http://stackoverflow.com/q/21148575
type: QuestionComment

http://stackoverflow.com/q/21150091
has body: After installing Haddop HDInsight on W7. Unable to compile java programs which have hadoop specific implementaions. They error out saying: c:\Hadoop\hadoop-1.1.0-SNAPSHOT\bin&gt;javac -classpath `C:\Hadoop\hadoop- 1.1.0-SNA PSHOT\hadoop-core.jar` C:\Z\WordCount.java -d C:\Z C:\Z\WordCount.java:6: error: package org.apache.hadoop.fs does not exist import org.apache.hadoop.fs.Path; ^ C:\Z\WordCount.java:7: error: package org.apache.hadoop.conf does not exist import org.apache.hadoop.conf.*; ^ C:\Z\WordCount.java:8: error: package org.apache.hadoop.io does not exist import org.apache.hadoop.io.*; ^ C:\Z\WordCount.java:9: error: package org.apache.hadoop.mapred does not exist import org.apache.hadoop.mapred.*; ^ C:\Z\WordCount.java:10: error: package org.apache.hadoop.util does not exist import org.apache.hadoop.util.*; ^ C:\Z\WordCount.java:14: error: cannot find symbol public static class Map extends MapReduceBase implements Mapper&lt;Long Writable, Text, Text, IntWritable&gt; { ^ symbol: class MapReduceBase location: class WordCount C:\Z\WordCount.java:14: error: cannot find symbol public static class Map extends MapReduceBase implements Mapper&lt;Long Writable, Text, Text, IntWritable&gt; { ^ symbol: class Mapper location: class WordCount C:\Z\WordCount.java:14: error: cannot find symbol public static class Map extends MapReduceBase implements Mapper&lt;Long Writable, Text, Text, IntWritable&gt; { ^ Initially I tried doing javac c:/z/WordCount.java and then also tried c:\Hadoop\hadoop-1.1.0-SNAPSHOT\bin&gt; javac -classpath `C:\Hadoop\hadoop-1.1.0-SNAPSHOT\hadoop-core.jar` C:\Z\WordCount.java -d C:\Z i.e, giving a classpath. Well I'm not sure to where exactly point javac this is what I have in my hadoop folder: 01/09/2014 06:39 PM &lt;DIR&gt; . 01/09/2014 06:39 PM &lt;DIR&gt; .. 10/22/2013 01:43 PM &lt;DIR&gt; .eclipse.templates 01/09/2014 06:41 PM &lt;DIR&gt; bin 10/22/2013 01:43 PM 135,891 build.xml 10/22/2013 01:43 PM 16,372 CHANGES.branch-1-win.txt 10/22/2013 01…
type: Question
tagged with: hadoop
tagged with: azure-hdinsight
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/21154037
has comment: http://stackoverflow.com/comment/31835054
has comment: http://stackoverflow.com/comment/31837858
has title: HDInsight hadoop java programs unable to run - libraries not found
tagged with: hortonworks-data-platform
accepted answer: http://stackoverflow.com/a/21154037
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/21109382
score: 0
tagged with: android
answer count: 1
tagged with: c++
has answer: http://stackoverflow.com/a/21109940
type: AnsweredQuestion
tagged with: tcp
tagged with: boost
tagged with: java
has title: Sending java string as c/c++ bytes
type: Question
accepted answer: http://stackoverflow.com/a/21109940
has body: I'm working on a Android app that acts as TCP server/client i want to send data from the app to a server/client that is written in c/c++(made with the boost libraray). I have a normal Java function that calls a native c function for string converstion to bytes: The function is defined as followed (the native function is Convert String: // Send buffer, the method can be used by both client and server objects. public void SendBuffer(String Buffer){ try { // Convert char to string to byte byte[] Temp = new byte[10]; String Teststring = "AAAAAAAABB"; Temp = ConvertString(Teststring); //byte[] Temp = new String(Buffer).getBytes(); // Get socket output stream OutputStream OutputBuffer = ClientSocket.getOutputStream(); //Write byte data to outputstream OutputBuffer.write(Temp); // Neatly flush and close the outputbuffer OutputBuffer.flush(); OutputBuffer.close(); } catch (IOException e) { Log.e("TCPIPCommunicator: ", "Client: Failed to send", e); e.printStackTrace(); } } The function ConvertString is a native function that converts the Java string to a C/C++ string and returns it as Java bytes, it is defined as followed: JNIEXPORT jbyteArray JNICALL Java_com_example_communicationmoduleTCPIP_communicationmoduleTCPIP_ConvertString( JNIEnv * env, jobject, jstring Buffer) { // Array to fill with data jbyteArray Array; // Init java byte array Array = env-&gt;NewByteArray(10); const char* NewBuffer = env-&gt;GetStringUTFChars(Buffer, 0); // Set byte array region with the size of the SendData CommStruct. // Now we can send the data back. env-&gt;SetByteArrayRegion(Array, 0, 10, (jbyte*)NewBuffer); env-&gt;ReleaseStringUTFChars(Buffer, NewBuffer); // Return java array return Array; } } When i run the program i get two 'AAAA' on the c side but not as a whole array ( so no 'AAAAAAAADD). I think the problem is that the server sends 2 'AAAA' and not the whole array at once. The client crashes with the following error: 'boost::exception_detail::clone_impl >' what(): read: End of file D…

http://stackoverflow.com/q/21116974
tagged with: jenkins
type: UnansweredQuestion
has body: I want to use 1.6 and I've configured it as my JDK version for my Jenkins job, but it keeps building with Java 7 instead. Why is this happening and how can I fix it?
tagged with: cloudbees
tagged with: java
has comment: http://stackoverflow.com/comment/31773513
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21116975
has comment: http://stackoverflow.com/comment/31775455
has answer: http://stackoverflow.com/a/21142882
tagged with: java-6
has title: How do I select my JDK version in CloudBees Jenkins?

http://stackoverflow.com/q/21135661
tagged with: key-bindings
accepted answer: http://stackoverflow.com/a/21138652
tagged with: java
type: Question
upvote count: 4
has title: PhpStorm Unknown keyCode: 0x0
downvote count: 0
score: 4
possible better answer: http://stackoverflow.com/a/26409799
has answer: http://stackoverflow.com/a/26409799
answer count: 3
has answer: http://stackoverflow.com/a/26411847
has body: When I trying to use default keymaps like Ctrl-C, Ctrl-V, etc. they not working. When I trying to map custom keymap, I get error by pressing on character keys: Unknown keyCode: 0x0 What it can be? I tried to install Java 1.6, 1.7, same thing. PS: Using Fedora 19 EDIT My default lang is English. But playing with keyboard settings of XFCE made it work oO. Issue with keyboard layouts.. Thanks
has answer: http://stackoverflow.com/a/21138652
tagged with: phpstorm
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/comment/31876025
has text: Have you tried [debugging your code](http://www.vogella.com/tutorials/EclipseDebugging/article.html)?
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21173541

http://stackoverflow.com/comment/31880634
type: AnswerComment
comment on: http://stackoverflow.com/a/21175864
score: 0
type: Comment
has text: You read my mind with: if(false && (false || s.equalsIgnoreCase("x"))) { Problem was a null pointer exception was getting thrown on the s.equalsIgnoreCase because the value was null. Your correction with the brackets fixes the problem. Thanks Sir!

http://stackoverflow.com/comment/31603767
comment on: http://stackoverflow.com/a/21022950
has text: @turbo Intriguing.. perhaps I was incorrect on that aspect. As an aside. Your *"You can take whole college courses about this."* comment had me nodding in agreement. This is a very complex subject.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21033151
has comment: http://stackoverflow.com/comment/31620129
type: Answer
answers question: http://stackoverflow.com/q/21033112
downvote count: 0
has comment: http://stackoverflow.com/comment/31621107
has comment: http://stackoverflow.com/comment/31620448
score: 2
has body: Your factory is a perfect Singleton (it is just that it is not thread-safe).
upvote count: 2

http://stackoverflow.com/q/21048020
downvote count: 0
has body: Jackson 2.2.2 ObjectMapper mapper = new ObjectMapper(); mapper.getSerializationConfig().withView(Views.Public.class); mapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, false); // if I try to simply configure using .without that config feature doesn't get set. // I MUST use the .configure as above, but I guess that's a different question. // .without(MapperFeature.DEFAULT_VIEW_INCLUSION); // this first one doesn't have the view applied. String result = mapper.writeValueAsString(savedD); // this second one works. result = mapper.writerWithView(Views.Public.class).writeValueAsString(savedD); I would expect this configuration, were I set the view on the SerializationConfig, to be applied to all Objects that are mapped with this ObjectMapper. How can I make an ObjectMapper always apply a JsonView without having to call writerWithView so that I can just give this ObjectMapper to Spring MVC?
favorite count: 0
type: UnansweredQuestion
score: 2
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/21054896
type: Question
tagged with: jackson
has title: Jackson JsonView not being applied
answer count: 1

http://stackoverflow.com/a/21067598
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21067186
has body: Did you make sure that your child items are not focusable? Do they contain views that can take focus? E.g. Button or EditTextView. If so your OnChildClickListener will not be called. See also OnItemClickListener doesn't work with ListView item containing button OnItemCLickLIstener doesn't work on ListView ListView OnItemClickListener Not Responding?
answers question: http://stackoverflow.com/q/21067186
type: Answer
score: 1

http://stackoverflow.com/a/21064585
has comment: http://stackoverflow.com/comment/84047666
has body: Some examples of mocking HttpURLConnection with Mockito: https://gist.github.com/leviwilson/3623053 Issues with Mocking HttpURLConnection using Mockito Remember that for unit testing, you want to mock anything that goes over the network, makes a database call, etc. If you had no internet access at all, the tests should still work. Also don't worry about unit testing third-party libraries. If you want to test a message actually going out over HTTP, then you want to do integration testing.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21030193
answers question: http://stackoverflow.com/q/21030193
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/a/21144610
accepted answer of: http://stackoverflow.com/q/21144133
downvote count: 0
has comment: http://stackoverflow.com/comment/31823127
score: 1
type: Answer
upvote count: 1
has body: Your A4I variable is not needed in this case and is causing you to make offsets that are already calculated. Observe the following: while abstract &gt;loop finds 'abstract' at position 6 while [code]abstract[/code] &gt;A4I is now making all offsets +13 &gt;loop finds 'while' found at position 0 &gt;you add that +13 offset to the insert making it drop right in the middle of the abstract You are also passing in 2 strings to your codeWrap method, because Strings are imutatable you are searching for an index in a string then using it on a different string. There are some other weird issues you will surly find in your program but this should fix your immediate one private static void codeWrap() { int position; for(String keyword: javaKeywords) { if((position = findInString(builder.toString(), keyword)) != -1) { builder.insert(position, "[code]"); builder.insert(position + keyword.length()+6, "[/code]"); } } }
has comment: http://stackoverflow.com/comment/31823432
answers question: http://stackoverflow.com/q/21144133
type: AcceptedAnswer

http://stackoverflow.com/q/21063989
linked to: http://stackoverflow.com/q/21065390
tagged with: c++
has answer: http://stackoverflow.com/a/21064507
has body: so I have String resultNative[] in Java and char result[][] in C++, how can I pass array from java to c++ using JNI? I have tried the following code but error. thank you. JNIEXPORT void JNICALL Java_com_qualcomm_QCARSamples_ImageTargets_GetTargetData_returnResult(JNIEnv *env, jobject obj) { int size = env-&gt;GetArrayLength(resultNative); for (int i=0; i &lt; size; ++i) { jstring string = env-&gt;GetObjectArrayElement(resultNative, i); result[i] = env-&gt;GetStringUTFChars(string, i); env-&gt;ReleaseStringUTFChars(string, resultNative); env-&gt;DeleteLocalRef(string); } }
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31675447
type: Question
has answer: http://stackoverflow.com/a/21064117
tagged with: java-native-interface
answer count: 2
tagged with: arrays
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: Passing String array from Java to C++

http://stackoverflow.com/a/65881701
downvote count: 1
score: 8
upvote count: 9
has body: Problem is, your eclipse is not able to connect the site which actually it is trying to. I have faced similar issue and below given solution worked for me. Turn off any third party internet security application e.g. Zscaler Sometimes also need to disconnect VPN if you are connected. Thanks
type: Answer
answers question: http://stackoverflow.com/q/21076179

http://stackoverflow.com/q/21145630
answer count: 3
has answer: http://stackoverflow.com/a/21145978
has title: How to find the smallest and the biggest number of items in array in Java?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21145877
has comment: http://stackoverflow.com/comment/31824986
tagged with: java
has body: I was wondering if there is any method to display the highest and the smallest number of items stored in array/linkedlist. public Checkout() { tillQueue = new LinkedList&lt;String&gt;(); currentLen = 0; lengthList = new ArrayList &lt;Integer&gt;(); mean = 0; r = new Random(); } public void simulation() { System.out.println("Time" + "\t" + "Rnd" + "\t" + "Queue Status"); for (int t=2; t&lt;10; t++) //number of time-steps in the simulation. { rndNumber = r.nextInt(6) +1; // generates random number between 1 and 6. if (rndNumber==4 || rndNumber==2 || rndNumber==6) { // if rndNumber is 4, t is added to a queue. tillQueue.add(String.valueOf(t)); currentLen++; } else if ((rndNumber==1 || rndNumber==3) &amp;&amp; !tillQueue.isEmpty()) { tillQueue.remove(); currentLen--; //if rndNumber is either 1 or 3, person is removed from the queue } and that's the outcome: Queue number 1 Queue [2] [2, 3] [2, 3, 4] [3, 4] [3, 4] [4] Queue is empty Queue is empty Mean length of queue 1= 1.375 Max length of queue 1= 0.0 Min length of queue 1= 0.0 As you can see from the output the highest number of people is 3 (2,3,4) and lowest 0 (empty) How can I calculate those values?
type: Question
has comment: http://stackoverflow.com/comment/31824976
tagged with: arrays
has answer: http://stackoverflow.com/a/21145698
score: 0

http://stackoverflow.com/q/21168278
tagged with: java
tagged with: apache-camel
tagged with: concurrency
has body: There is a middleware in between of two other software components. In the middleware I'm routing Apache ActiveMQ messages by Apache Camel. this is how it works: 1stComponent uses middleware to send message to the 3rdComponent 3rdComponent replies the message and sends it back to the 1st(using middleware). 1stComponent &lt;&lt;=&gt;&gt; Middleware &lt;&lt;=&gt;&gt; 3rdComponent Problem: I'm using ConcurrentConsumers in middleware. In the middle of sending a lot of messages sequentially, suddenly middleware stops all the process! there is no exceptions or messages! for example, first 100 of 500 messages got processed and the remainders remain in the queue as pending messages. this warning is logged sometimes in the middle of the process: [WARN ] TemporaryQueueReplyManager(Camel (camel-1) thread #11 - TemporaryQueueReplyManager[Q.MyQ]):91 - Reply received for unknown correlationID [c551c7aa061f501c]. The message will be ignored: ActiveMQMapMessage {commandId = 2161, responseRequired = true, messageId = ID:xxxxxxx, originalDestination = null, originalTransactionId = null, producerId = ID:xxxxxxx, destination = temp-queue://ID:localhost.localdomain-40961-1389890357282-3:1:1, transactionId = null, expiration = 0, timestamp = 1389890272360, arrival = 0, brokerInTime = 1389890272360, brokerOutTime = 1389890272360, correlationId = c551c7aa061f501c, replyTo = temp-queue://ID:localhost.localdomain-40961-1389890357282-3:1:1, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = org.apache.activemq.util.ByteSequence@19e19da, dataStructure = null, redeliveryCounter = 0, size = 0, properties = {breadcrumbId=ID:xxxxxxxxxxxxxx, Title=300, CamelJmsDeliveryMode=1}, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false} ActiveMQMapMessage{ theTable = {} } this is the middlewares Code: private static class MyRouteBui…
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/23602269
possible better answer: http://stackoverflow.com/a/21194330
accepted answer: http://stackoverflow.com/a/36676185
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/36676185
has comment: http://stackoverflow.com/comment/32026532
has comment: http://stackoverflow.com/comment/31867693
has answer: http://stackoverflow.com/a/26185840
answer count: 4
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21194330
tagged with: activemq-classic
has title: Apache Camel: Reply received for unknown correlationID

http://stackoverflow.com/comment/31858571
has text: @Raghunandan i understand how i set two array in customAdapter, but i don't understand how pass filterable result.. i'm little confuse
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21164147
type: Comment

http://stackoverflow.com/q/21051260
downvote count: 0
has answer: http://stackoverflow.com/a/21051807
has title: Loading initial data at application startup with Spring Data MongoDB
favorite count: 0
has body: I use embedded MongoDB database in a development environment. It is setup empty at the application startup. I would like to load initial data which is needed for the application when the Spring context is setup. Is there a way in Spring Data MongoDB to point a JSON file(s) which would be loaded into a database (something like import.sql (hibernate.hbm2ddl.import_files) in Hibernate or @UsingDataSet in NoSql Unit)?
tagged with: spring-data-mongodb
tagged with: spring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21051807
tagged with: java
tagged with: spring-data
type: Question
tagged with: mongodb
score: 5
upvote count: 5
answer count: 1

http://stackoverflow.com/comment/31892244
type: Comment
comment on: http://stackoverflow.com/q/21178268
score: 0
type: QuestionComment
has text: Inspect the page content stream. You'll find `q 325.79257 -42.55899 30.90112 236.55064 164.64209 365.19037 cm /X1 Do Q`. Decompose that transformation matrix into its translation, scaling, rotating, and skewing parts. Look at the rotation matrix.

http://stackoverflow.com/q/21158083
answer count: 1
favorite count: 0
score: 6
tagged with: swing
has answer: http://stackoverflow.com/a/21158198
has body: I just want to know how to update specific cell in JTable, like if I want to set the cell(1,1) to have the value of Test Value. my code goes like this but does not work for me: String s = "Test Value"; tableName.setValueAt((Object)s, 1, 1);
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31847667
has title: How to set the value of specific cell in JTable?
tagged with: java
upvote count: 7
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/21158198
has comment: http://stackoverflow.com/comment/31847685
tagged with: jtable

http://stackoverflow.com/comment/31718670
type: QuestionComment
has text: yes, called web services
comment on: http://stackoverflow.com/q/21085510
score: 0
type: Comment

http://stackoverflow.com/a/21053744
has body: That's because you are instantiating ProductCategoryDatabaseRetrieve prodCatDB = new ProductCategoryDatabaseRetrieve(); outside of the while loop once and then replacing it's property values with each loop iteration. Move ProductCategoryDatabaseRetrieve prodCatDB = new ProductCategoryDatabaseRetrieve(); to inside the while loop like while (cursor.moveToNext()) { ProductCategoryDatabaseRetrieve prodCatDB = new ProductCategoryDatabaseRetrieve();//Instantiate here with each iteration. prodCatDB.set_tid(cursor.getInt(cursor.getColumnIndex(DatabaseHandler._TID))); prodCatDB.setTid(String.valueOf(cursor.getInt(cursor .getColumnIndex(DatabaseHandler.TID)))); prodCatDB.setProductCategoryName(cursor.getString(cursor .getColumnIndex(DatabaseHandler.PRODUCT_CATEGORY_NAME))); prodCatDB.setProductCategoryImage(cursor.getBlob(cursor .getColumnIndex(DatabaseHandler.PRODUCT_CATEGORY_IMAGE))); productCategoryDatabaseRetrieve.add(prodCatDB); } Also, in your if statement, cursor != null is useless. The cursor will never be null, and even if it is cursor.getCount() will throw an null pointer exception before cursor != null is reached. Remove cursor != null, you don't need it.
type: AcceptedAnswer
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/21052079
downvote count: 0
answers question: http://stackoverflow.com/q/21052079
score: 4

http://stackoverflow.com/q/21052079
has answer: http://stackoverflow.com/a/21053744
type: Question
upvote count: 2
has body: Here i am trying to get all the data from the table in SQLite. But every time its returning me only last rows twice(my table contains two rows only). e.g ---------------------+ | Id| name | mobile | |--------------------| |1 | abc | 123456 | |--------------------| |2 | xyz | 789654 | +--------------------+ My code returning this: 01-11 00:14:59.291: D/Result:(27629): TID 12274, Name: Tablets , Image: [B@4275d578 01-11 00:14:59.291: D/Result:(27629): TID 12274, Name: Tablets , Image: [B@4275d578 Here I am pasting my query code: public List&lt;ProductCategoryDatabaseRetrieve&gt; getProductCategoryData() { List&lt;ProductCategoryDatabaseRetrieve&gt; productCategoryDatabaseRetrieve = new ArrayList&lt;ProductCategoryDatabaseRetrieve&gt;(); ProductCategoryDatabaseRetrieve prodCatDB = new ProductCategoryDatabaseRetrieve(); SQLiteDatabase sqliteDB = dbHandler.getWritableDatabase(); String[] columns = { DatabaseHandler._TID, DatabaseHandler.TID, DatabaseHandler.PRODUCT_CATEGORY_NAME, DatabaseHandler.PRODUCT_CATEGORY_IMAGE }; Cursor cursor = sqliteDB.query(DatabaseHandler.PRODUCT_CATEGORY_TABLE, columns, null, null, null, null, null); if (cursor.getCount() &gt; 0 &amp;&amp; cursor !=null) { while (cursor.moveToNext()) { prodCatDB.set_tid(cursor.getInt(cursor.getColumnIndex(DatabaseHandler._TID))); prodCatDB.setTid(String.valueOf(cursor.getInt(cursor .getColumnIndex(DatabaseHandler.TID)))); prodCatDB.setProductCategoryName(cursor.getString(cursor .getColumnIndex(DatabaseHandler.PRODUCT_CATEGORY_NAME))); prodCatDB.setProductCategoryImage(cursor.getBlob(cursor .getColumnIndex(DatabaseHandler.PRODUCT_CATEGORY_IMAGE))); productCategoryDatabaseRetrieve.add(prodCatDB); } } dbHandler.close(); return productCategoryDatabaseRetrieve; } Thank a lot for considering.
answer count: 1
favorite count: 0
tagged with: android
score: 2
downvote count: 0
tagged with: android-sqlite
accepted answer: http://stackoverflow.com/a/21053744
type: AnsweredQuestion
has title: Returning only Last value in SQLite Select Statement
tagged with: java

http://stackoverflow.com/a/21125521
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21124355
has comment: http://stackoverflow.com/comment/31879562
answers question: http://stackoverflow.com/q/21124355
has comment: http://stackoverflow.com/comment/31826780
has comment: http://stackoverflow.com/comment/31875832
score: 1
has comment: http://stackoverflow.com/comment/31798185
has body: It's not an elegant solution, but a CountDownLatch could do the trick: public class ClientData { private static final AtomicReference&lt;Map&lt;String, Map&lt;Integer, String&gt;&gt;&gt; primaryMapping = new AtomicReference&lt;&gt;(); private static final CountDownLatch firstSet = new CountDownLatch(1); public static Map&lt;String, Map&lt;Integer, String&gt;&gt; getPrimaryMapping() { try { firstSet.await(); } catch (Exception ignored) {} return primaryMapping.get(); } public static void setPrimaryMapping(Map&lt;String, Map&lt;Integer, String&gt;&gt; map) { primaryMapping.set(map); firstSet.countDown(); } }
upvote count: 1

onclicklistener
tags question: http://stackoverflow.com/q/21110178
tag name: onclicklistener
tags question: http://stackoverflow.com/q/21154571
tags question: http://stackoverflow.com/q/21164210
tags question: http://stackoverflow.com/q/21112627
tags question: http://stackoverflow.com/q/21179092
type: Tag

monospace
tag name: monospace
tags question: http://stackoverflow.com/q/21063232
type: Tag

http://stackoverflow.com/comment/31792925
score: 0
has text: Did you try it in Safari on Windows?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21127598

http://stackoverflow.com/q/21076261
tagged with: java
has title: Java Compilation error "method setSchema in class MpsPojo cannot be applied to given types;"
type: Question
accepted answer: http://stackoverflow.com/a/21076299
possible better answer: http://stackoverflow.com/a/21076282
has answer: http://stackoverflow.com/a/21076282
score: 0
answer count: 2
has body: Hi I saw some of the related question related to this but didn't find any to the point solution. I have a POJO class defined as: MpsPojo.java public class MpsPojo { private String mfr; private String prod; private String sche; public String getMfr() { return mfr; } public void setMfr(String mfr) { this.mfr = mfr; } public String getProd() { return prod; } public void setProd() { this.prod = prod; } public String getSchema() { return sche; } public void setSchema() { this.sche = sche; } } I have 2nd business Logic as:: MpsLogic.java public class MpsLogic { public void calculateAssert(MpsPojo mpspojo){ String manufacturer; String product; String schema; manufacturer = mpspojo.getMfr(); product = mpspojo.getProd(); schema = mpspojo.getSchema(); String url = "http://localhost:9120/dashboards/all/list/"+manufacturer+"/"+product+"/"+schema; } } And final class, the Test class is :: FinalLogic.java public class FinalLogic { MpsPojo mpspojon = new MpsPojo(); MpsLogic mpslogicn = new MpsLogic(); @Test public void firstTest() { mpspojon.setMfr("m1"); mpspojon.setProd("p1"); mpspojon.setSchema("sch1"); mpslogicn.calculateAssert(mpspojon); System.out.println("Printing from Final class"); } } In program FinalLogic.java, this gives me the Compilation error error method setSchema in class MpsPojo cannot be applied to given types; But when I comment the lines mpspojon.setProd("p1"); and mpspojon.setSchema("sch1"); then this works fine without error. I debugged a lot but dint find any clue for this. Any help will be very helpful for me. Thanks
has answer: http://stackoverflow.com/a/21076299
type: AnsweredQuestion

http://stackoverflow.com/comment/31769063
score: 0
comment on: http://stackoverflow.com/a/21113871
has text: Please post a new question as this is off-topic
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21127598
has title: Java applet acting strange in safari
tagged with: safari
has comment: http://stackoverflow.com/comment/31792868
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31868658
score: 0
has comment: http://stackoverflow.com/comment/31792925
answer count: 0
has body: I'm working on some java stuff and the applet I made runs funny on safari. When I run it with Firefox it works fine though... So for mac users who can test this, if anyone knows why, any help would be appreciated. here's the link thank you!!
type: UnansweredQuestion
tagged with: plugins

http://stackoverflow.com/a/21136314
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31833535
has comment: http://stackoverflow.com/comment/31821168
type: Answer
upvote count: 3
has body: It is nothing to do with inner classes. Your B constructor is protected it means only subclasses could access it, but you define the class as final, it doesn't make sense. Maybe you could add a factory method to the AbstractA which creates B instances, outer class has access to its inner classes, even for private methods. public abstract class AbstractA { protected B newB() {return new B();} public static final class B { private B(){} } } // a class (in another package) that inherits from AbstractA public class C extends AbstractA { B[] arrayOfB=new B[10]; for(byte i=0; i&lt;=arrayOfB.length; i++) { arrayOfB[i]=this.newB(); } }
score: 3
accepted answer of: http://stackoverflow.com/q/21136206
answers question: http://stackoverflow.com/q/21136206

http://stackoverflow.com/q/21170787
type: AnsweredQuestion
has title: Compiler and run java program on mac terminal
tagged with: java
has answer: http://stackoverflow.com/a/21170904
type: Question
has comment: http://stackoverflow.com/comment/31914627
tagged with: eclipse
score: 0
answer count: 1
tagged with: macos
has comment: http://stackoverflow.com/comment/31870740
tagged with: terminal
has body: I have written a compiler program and now I am trying to run it from terminal. I am using antlr library inside my program. This code works pretty well when compiled using eclipse. I am using the following command in terminal javac -classpath antlr-runtime-3.2.jar Main.java The file antlr-runtime-3.2.jar is present but still I am receiving the following errors Main.java:34: error: cannot find symbol MiniJavaLexer lexer = new MiniJavaLexer(charStream) Main.java:42: error: cannot find symbol PrintVisitor dfsPrint = new PrintVisitor() Main.java:46: error: cannot find symbol SymbolTableVisitor stVisitor = new SymbolTableVisitor() This error is coming for every class I am using. I want to compile and then run the program using terminal The main.java file contains package mini.java.compiler; import java.io.IOException; import org.antlr.runtime.ANTLRFileStream; import org.antlr.runtime.CharStream; import org.antlr.runtime.CommonTokenStream; import org.antlr.runtime.RecognitionException; import org.antlr.runtime.tree.Tree; public class Main { public static void main(String[] args) throws RecognitionException, IOException { // TODO Auto-generated method stub String file = "samples/factorial.java"; CharStream charStream = new ANTLRFileStream(file); MiniJavaLexer lexer = new MiniJavaLexer(charStream); CommonTokenStream tokens = new CommonTokenStream(lexer); MiniJavaParser parser = new MiniJavaParser(tokens); MiniJavaParser.goal_return res = parser.goal(); Tree tree = (Tree) res.getTree(); // The root node. /* Print tree */ PrintVisitor dfsPrint = new PrintVisitor(); dfsPrint.visit(tree); /* Symbol table construction */ SymbolTableVisitor stVisitor = new SymbolTableVisitor(); SymbolTable symTab = (SymbolTable) stVisitor.visit(tree); System.out.println("-------------------"); System.out.println("Symbol Table"); System.out.println("-------------------"); symTab.printTable(); symTab.resetTable(); /* Type checking */ TypeCheckingVisitor tcVisitor = new TypeCheckingVisitor(symTab); t…
accepted answer: http://stackoverflow.com/a/21170904
tagged with: compiler-construction
has comment: http://stackoverflow.com/comment/31913584

http://stackoverflow.com/comment/31773522
score: 0
type: QuestionComment
type: Comment
has text: There is the same question asked in this thread: http://stackoverflow.com/questions/1506663/can-i-force-jaxb-not-to-convert-into-quot-for-example-when-marshalling-to Hope that helps! Good luck!
comment on: http://stackoverflow.com/q/21117119

http://stackoverflow.com/q/21087778
accepted answer: http://stackoverflow.com/a/21134015
favorite count: 0
has answer: http://stackoverflow.com/a/21908390
type: AnsweredQuestion
score: 1
tagged with: java
has body: I can set the attributes and create the dicom file, but I can not write the image to the dicom file?
type: Question
upvote count: 2
possible better answer: http://stackoverflow.com/a/37177238
has answer: http://stackoverflow.com/a/37177238
has title: How to convert JPG image to DICOM file using dcm4che-3.2.1?
answer count: 3
tagged with: dicom
downvote count: 1
has answer: http://stackoverflow.com/a/21134015

http://stackoverflow.com/comment/31626826
score: 0
type: AnswerComment
has text: This works for the numbers inside of the arrays you made, but I have to check if a group of vectors are palindromatic. So, an array needs to be filled with vectors, each vector probably containing 3 separate numbers, and then it has to check if the first and last vectors are the same, the second and second to last, etc. So (1,2,3) and (1,2,3) would be equal, and if we just had those two in the array that I need to check for a palindrome, then it WOULD be palindromatic. On top of it all, I HAVE to use queues and stacks in the is_palindrome method.
comment on: http://stackoverflow.com/a/21037336
type: Comment

http://stackoverflow.com/a/21139135
has body: To be able to encrypt with the AES-algorithm you will need to base your key on an atleast 128bit String. (Other values are also legal, but I don't have them in my head) To convert that into number of characters needed in your provided key-string you can take 128 divided by 8 128 / 8 = 16 alpha-numeric characters This should solve your problem. EDIT: Answer on comment about BASE64: BASE64 is a different way of encoding a string. The result of a BASE64-encoding may be a 128bit string, but not by default. There is not actually a default length of the outcome of a BASE64-encoding. The result may be 8 characters or 512, or some other output that conforms with the encoding rules of BASE64, it all depends on the string you are encoding.
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/31813094
answers question: http://stackoverflow.com/q/21138811
downvote count: 0
score: 1

http://stackoverflow.com/comment/31657085
type: Comment
has text: I'm halfway to understanding the issue (possibly related: Guava's [`Optional.or`](http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/base/Optional.html#or\(T\))), but your code and remarks are confusing. Why does one `Foo` constructor call take an instance, and another take a `Class` token? Also your code comment says "this should convert the current Foo into a Foo for a sub class ONLY" Did you mean *super* class?
score: 0
comment on: http://stackoverflow.com/q/21049600
type: QuestionComment

http://stackoverflow.com/a/21045941
has body: "...so when i override it with an empty method, nothing should be redrawn...but it is. Why?" So it looks like you're running this program from the command line. If you are running the program, and it's still painting the stuff inside the paintComponent method (even after you commented out its content), most likely you ran the program with compiling again. So the program is still running from the same .class file. When I run the program as is, I see nothing but a button, no painted words. C:\stack&gt;java TextFrame Hello World " What exactly is redrawn by paintComponent(), everything? Or some backgrounds or smth?" paintComponent just paint the component itself, which is just the JPanel in your case. It doesn't paint any other components added to it. That painting is delegated by its paintComponent method. Every JComponent has its own paintComponent method. So if you're wondering why the button still appears, it's because the call to paintComponent in the JPanel only affects the JPanel, not other child components add to it.
score: 0
has comment: http://stackoverflow.com/comment/31643549
type: Answer
has comment: http://stackoverflow.com/comment/31642312
answers question: http://stackoverflow.com/q/21045771

http://stackoverflow.com/comment/31653490
type: QuestionComment
comment on: http://stackoverflow.com/q/21052227
has text: `System.setOut(new PrintStream(taOutputStream));`: Okay, that's a weird thing to do. Where did you get this sample?
score: 0
type: Comment

http://stackoverflow.com/q/21167925
has title: contentDisposition attachment instead of inline when use image/tiff as contentType
tagged with: mime-types
linked to: http://stackoverflow.com/q/15269541
has body: I have a problem and I hope that you could help me. I'm using struts2 and I have an action like that: image/jpeg inputStream inline;filename="${filename}" 1024 Until here everything's perfect, I set from my class the inputStream using this code: filename = "anImage.jpg"; File img = new File("D://anImage.jpg"); inputStream = new FileInputStream(img); and the image shows correctly, but the problem appears when I try to display an imagen with tif format. I change the path of the image, the filename and I set the contentType to: image/tiff But it doesn't work and I wonder why. Can anybody help me? Edit: I edited the answer to explain what I did to resolve the problem. As many users said to me, tiff format isn't for web use. Inspite of it, with IE and AlternaTIFF I accomplished to show the image. But as I wanted a solution for all browsers finally I converted the image to jpg and I displayed it using ImageMagick. Thanks all for your help.
possible better answer: http://stackoverflow.com/a/21168769
has answer: http://stackoverflow.com/a/21168769
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/21173626
tagged with: content-type
type: Question
tagged with: struts2
has comment: http://stackoverflow.com/comment/31901948
answer count: 2
has comment: http://stackoverflow.com/comment/31904996
downvote count: 0
accepted answer: http://stackoverflow.com/a/21173626
favorite count: 0

http://stackoverflow.com/comment/31710315
has text: ok :D how can i do it?
comment on: http://stackoverflow.com/q/21082697
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31774142
type: Comment
type: QuestionComment
score: 1
has text: It sounds like you're opening files without closing them. remember every file open needs to have an associated file close, otherwise you run out of file descriptors
comment on: http://stackoverflow.com/q/21115621

http://stackoverflow.com/comment/31650165
score: 0
has text: @ManuZi This code doesn't compile, you cannot access `T1` from a `static` method...
type: AnswerComment
comment on: http://stackoverflow.com/a/21049512
type: Comment

http://stackoverflow.com/a/21060138
downvote count: 0
answers question: http://stackoverflow.com/q/21059552
accepted answer of: http://stackoverflow.com/q/21059552
has body: There is nothing obviously wrong with your code, so you need to do some investigation. For example, find and install a packet logger and use it to see if the packet is actually being send over the wire and if a reply packet is coming back from the server. Actually, there is a possible clue in the output messages: Local IP: /192.168.0.103 Remote IP: samp.lawlessrp.com/192.223.24.181 You have set up your program to listen on the IP address 192.168.0.103. That is a private IP address. But you are trying to talk to 192.223.24.181, which is a (notionally) public IP address. If 192.223.24.181 is not in your organization's network(s), the chances, it won't know how to route packets to your address ... and they will get silently dropped.
score: 1
has comment: http://stackoverflow.com/comment/31668837
type: Answer
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/21147508
has answer: http://stackoverflow.com/a/21147633
tagged with: loops
has comment: http://stackoverflow.com/comment/31829129
type: Question
has title: Java class won't compile
upvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21147633
answer count: 4
possible better answer: http://stackoverflow.com/a/21147637
has answer: http://stackoverflow.com/a/21147637
tagged with: php
has body: Im quite the novice when it comes to programming and im trying to translate this PHP algorithm to Java. function isPrime($n) { $i = 2; if ($n == 2) { return true; } while ($i &lt; $n) { if ($n % $i == 0) { return false; } $i++; } return true; } for ($i = 3; $i &lt; 100; $i++) { if (isPrime($i)) { echo $i; } } The only thing i've come up with so far is this. public class Primtal { public static boolean isPrime(int n) { int i = 2; if (n == 2) { return true; } while (i &lt; n) { if ( n % i == 0) { return false; } i++; } return true; } for(int i = 3; i &lt; 1000; i++){ if (isPrime(i)) { System.out.print(i); } } } I realize this look really stupid but i really need to get this to work. I think the problem lies mostly with the for loop as im currently getting the error illegal start of type there. Im not really sure how to translate this to Java and i would appreciate any help i can get.
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21147623
has comment: http://stackoverflow.com/comment/31829046
tagged with: java
has answer: http://stackoverflow.com/a/21147631
score: -1

http://stackoverflow.com/comment/31880355
has text: So it starts from the source directory? Then I think the `"\\rpg\\SpriteSheet.png"` should work right?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21175448

http://stackoverflow.com/comment/31772260
comment on: http://stackoverflow.com/q/21115187
score: 0
type: Comment
type: QuestionComment
has text: I need it inside, the whole point of this is to separate some code, because the class of the main frame is too long.

http://stackoverflow.com/comment/31593367
type: Comment
has text: Yes. My main problem is with the time zone component: neither 'z' nor 'Z' created 02:00
comment on: http://stackoverflow.com/q/21019107
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31763427
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21111379
has text: @Marko Topolnik, that's the result expected for each thread. It doesn't make any sense to create three threads just to print numbers, is reasonably to assume there's something more envolved in the process. Yet I stand by my answer.

http://stackoverflow.com/comment/31846970
has text: I Andrew, what I wanted to achieve is to get the text aligned at the bottom of the JTextPane. My idea was to use a table inside the div and say valign=bottom. Therefore I need a surrounding div with the height of the JTextPane.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21154015

http://stackoverflow.com/q/21127919
type: Question
has comment: http://stackoverflow.com/comment/31793356
answer count: 2
tagged with: android
tagged with: regex
has body: I am checking if a string filename is safe for saving by checking if it has any strange characters with a Regular expression. It is will be a .json file and should also allow spaces in the file name. public static boolean fileNameIsSafe(String nameIncExt) { Matcher m = Pattern.compile("regex?").matcher(nameIncExt); return m.matches(); } What would the regular expression be?
tagged with: filenames
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21128120
has answer: http://stackoverflow.com/a/22151989
has title: Java/android - check if string `FileName` contains any file-name-disallowed characters
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31793263
has comment: http://stackoverflow.com/comment/31793316

android-actionbar
tags question: http://stackoverflow.com/q/21062894
type: Tag
tags question: http://stackoverflow.com/q/21075895
tags question: http://stackoverflow.com/q/21086564
tags question: http://stackoverflow.com/q/21134056
tags question: http://stackoverflow.com/q/21099386
tags question: http://stackoverflow.com/q/21147793
tag name: android-actionbar
tags question: http://stackoverflow.com/q/21056158
tags question: http://stackoverflow.com/q/21177002

permissions
tag name: permissions
type: Tag
tags question: http://stackoverflow.com/q/21051976
tags question: http://stackoverflow.com/q/21124016
tags question: http://stackoverflow.com/q/21035364

http://stackoverflow.com/comment/48074136
score: 1
has text: Closely related: [Why are JSR/RET deprecated Java bytecode?](http://stackoverflow.com/questions/5871190/why-are-jsr-ret-deprecated-java-bytecode)
type: Comment
comment on: http://stackoverflow.com/q/21150154
type: QuestionComment

http://stackoverflow.com/a/21041144
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21033666
type: Answer
answers question: http://stackoverflow.com/q/21033666
score: 3
upvote count: 3
has body: Change notification is the inherent responsibility of any observable (in general and a java bean in particular): it would violate its contract if it wouldn't fire a PropertyChangeEvent when any of its bound properties is changed. That being the case, no other party ever needs to use the fireXX methods. So it simply doesn't make any sense to have a scope wider than protected. If you feel like needing it, you are doing something wrong.
has comment: http://stackoverflow.com/comment/31638115
has comment: http://stackoverflow.com/comment/31637948

http://stackoverflow.com/comment/31605410
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21025501
has text: `drop all objects` will do exactly that. You can ignore the objects that are visible in the `INFORMATION_SCHEMA`. As I said: they are an essential (internal) part of the database. Don't mess around with them
score: 0

http://stackoverflow.com/comment/31685306
comment on: http://stackoverflow.com/q/21069113
has text: @alvas please pay more attention, I am looking for a general case where the delimiter is any arbitrary character.
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/comment/31709966
has text: Please, edit your post with the error [stack trace](http://en.wikipedia.org/wiki/Stack_trace)
comment on: http://stackoverflow.com/q/21082530
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/a/21146503
has comment: http://stackoverflow.com/comment/127897262
has body: I have implemented it using JPQL LIKE paired with pattern expression: SELECT p FROM Post p WHERE p.title LIKE :pattern AND p.date&gt;=:startDate AND p.date&lt;=:endDate where pattern = "%" + someString + "%".
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21137719
upvote count: 8
type: Answer
score: 8
answers question: http://stackoverflow.com/q/21137719

http://stackoverflow.com/comment/31730861
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21094124
type: AnswerComment
has text: In that case add the array to a new json object.

http://stackoverflow.com/comment/31828960
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21147046
type: AnswerComment
has text: Thank you :) that was the problem. Shame I didn't see that :/ Really didn't see I set it to false ^^

http://stackoverflow.com/q/21081792
has body: The question is related with memory and primary performance. Last few days I was reflecting on this topic, it is not something I needed to use, just curious. I created a simple example: 1) One class that uses no delegation and has no inner classes: public class NoInnerClass { public void theMethod(int times){ for(int i=0; i&lt;times; i++){ System.out.println("No Inner hello: " + i); } } } 2) One class that calls four inner classes. The last one does the same as NoInnerClass in theMethod method public class InnerMain { private Inner1 inner1 = new Inner1(); public void theMethod(int times){ inner1.doIt(times); } } ... public class Inner4 { public void theMethod(int times){ for(int i=0; i&lt;times; i++){ System.out.println("Inner 4 hello: " + i); } } } I measured the time difference in milliseconds between this two types of calls. The difference was not that big - a bit more than one millisecond. But what if we have much more complex inner objects and more delegating calls, we would for sure have bigger difference. So the questions are: Will the difference in time and amount of memory used between two approaches increase dramatically If yes, is there any articles about this (I couldn't find much) Or maybe todays JVM is so smart, that we shouldn't think about it Thank you in advance for your answers.
type: AnsweredQuestion
tagged with: performance
has comment: http://stackoverflow.com/comment/31748246
has answer: http://stackoverflow.com/a/21081920
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21081899
downvote count: 1
has comment: http://stackoverflow.com/comment/31708510
possible better answer: http://stackoverflow.com/a/21081920
type: Question
answer count: 2
has title: Creation of objects and delegation much slower than one big method?
accepted answer: http://stackoverflow.com/a/21081899
favorite count: 0
upvote count: 2

http://stackoverflow.com/a/21150854
has comment: http://stackoverflow.com/comment/31835285
answers question: http://stackoverflow.com/q/21150791
has body: Once you close your "singleton" BufferedWritter, you never open another one. In short, you never open more than one file to write. To be clear, every call after the first to getBufferedWritter ignores its argument and returns the BufferedWritter used to write the first file and which has since been closed -- assuming br and bw are the same variable and one of the two is not declared in a scope not shown in your question...
score: 0
has comment: http://stackoverflow.com/comment/31835316
has comment: http://stackoverflow.com/comment/31835255
type: Answer

sql
tags question: http://stackoverflow.com/q/21049257
tags question: http://stackoverflow.com/q/21166204
tags question: http://stackoverflow.com/q/21109292
tags question: http://stackoverflow.com/q/21077683
tags question: http://stackoverflow.com/q/21111533
tags question: http://stackoverflow.com/q/21128963
tags question: http://stackoverflow.com/q/21062576
tags question: http://stackoverflow.com/q/21162106
tags question: http://stackoverflow.com/q/21039114
tags question: http://stackoverflow.com/q/21157315
tags question: http://stackoverflow.com/q/21176023
tags question: http://stackoverflow.com/q/21070894
tags question: http://stackoverflow.com/q/21110506
tags question: http://stackoverflow.com/q/21163496
tags question: http://stackoverflow.com/q/21076680
tags question: http://stackoverflow.com/q/21018923
tags question: http://stackoverflow.com/q/21146162
tags question: http://stackoverflow.com/q/21143099
tags question: http://stackoverflow.com/q/21074634
tag name: sql
tags question: http://stackoverflow.com/q/21182670
type: Tag
tags question: http://stackoverflow.com/q/21162753
tags question: http://stackoverflow.com/q/21094785
tags question: http://stackoverflow.com/q/21028287
tags question: http://stackoverflow.com/q/21148241
tags question: http://stackoverflow.com/q/21125385
tags question: http://stackoverflow.com/q/21140812
tags question: http://stackoverflow.com/q/21084487
tags question: http://stackoverflow.com/q/21129056
tags question: http://stackoverflow.com/q/21102520
tags question: http://stackoverflow.com/q/21099351
tags question: http://stackoverflow.com/q/21091700
tags question: http://stackoverflow.com/q/21163313
tags question: http://stackoverflow.com/q/21020167
tags question: http://stackoverflow.com/q/21147506
tags question: http://stackoverflow.com/q/21175019
tags question: http://stackoverflow.com/q/21172582
tags question: http://stackoverflow.com/q/21064023
tags question: http://stackoverflow.com/q/21164025
tags question: http://stackoverflow.com/q/21061388
tags question: http://stackoverflow.com/q/21170567
tags question: http://stackoverflow.com/q/21171025
tags question: http://stackoverflow.com/q/21059555
tags question: http://stackoverflow.com/q/21029797
tags question: http://stackoverflow.com/q/21027139
tags question: http://stackoverflow.com/q/21112816
tags question: http://stackoverflow.com/q/21166584
tags question: http://stackoverflow.com/q/21048458
tags question: http://stackoverflow.com/q/21078914
tags question: http://stackoverflow.com/q/21068320
tags question: http://stackoverflow.com/q/21024224
tags question: http://stackoverflow.com/q/21174752
tags question: http://stackoverflow.com/q/21176667
tags question: http://stackoverflow.com/q/21024895
tags question: http://stackoverflow.com/q/21140037
tags question: http://stackoverflow.com/q/21027943
tags question: http://stackoverflow.com/q/21156431
tags question: http://stackoverflow.com/q/21103103
tags question: http://stackoverflow.com/q/21066818
tags question: http://stackoverflow.com/q/21090082
tags question: http://stackoverflow.com/q/21025198
tags question: http://stackoverflow.com/q/21126379
tags question: http://stackoverflow.com/q/21091298
tags question: http://stackoverflow.com/q/21065319
tags question: http://stackoverflow.com/q/21063139
tags question: http://stackoverflow.com/q/21095385
tags question: http://stackoverflow.com/q/21066890
tags question: http://stackoverflow.com/q/21021834
tags question: http://stackoverflow.com/q/21160785
tags question: http://stackoverflow.com/q/21118771
tags question: http://stackoverflow.com/q/21114474

http://stackoverflow.com/a/21132101
answers question: http://stackoverflow.com/q/21126812
has body: Maybe simple singelton initialization. Something like that: RecordManagerMaster.initRecordManager(...); Getter: RecordManager recman = RecordManagerMaster.getRecordManager();
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31810371
has comment: http://stackoverflow.com/comment/31809969
has comment: http://stackoverflow.com/comment/31808913

http://stackoverflow.com/q/21062147
has body: I have downloaded latest Lucene 4.6.0 and running it in netbeans. Lucence 3.6.x version is running perfectly but the latest version cannot find org.apache.lucene.analysis.standard.StandardAnalyzer and IndexFiles.java, showing an error in the line: Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_40); The error is : java.lang.ExceptionInInitializerError Caused by: java.lang.RuntimeException: Uncompilable source code - package org.apache.lucene.analysis.standard does not exist at org.apache.lucene.demo.IndexFiles.&lt;clinit&gt;(IndexFiles.java:21) Exception in thread "main" Java Result: 1 Actually I have not found any folder standard in latest version. Could any one please help me?
has answer: http://stackoverflow.com/a/38494973
score: 2
upvote count: 2
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/21068954
tagged with: java
answer count: 2
downvote count: 0
tagged with: lucene
favorite count: 0
has title: StandardAnalyzer class not found

http://stackoverflow.com/a/21134048
answers question: http://stackoverflow.com/q/21133962
has comment: http://stackoverflow.com/comment/31804623
upvote count: 1
has comment: http://stackoverflow.com/comment/31804900
score: 1
has comment: http://stackoverflow.com/comment/31805278
has body: Using debugger to find out which object is null is fastest way to solve your problem. OR Find the null return value with the following code: System.out.println(data); System.out.println(data.getData()); System.out.println(data.getData().getTn()); --The following text are newly added----------------- Well, I have run your program on my laptop, and it seem that the json response of https://gdata.youtube.com/feeds/api/videos/aa_wFClyiVE?v=2&amp;alt=jsonc#data/thumbnail/hqDefault contains no tn field at all. That's why you always got null value.
downvote count: 0
has comment: http://stackoverflow.com/comment/31804763
has comment: http://stackoverflow.com/comment/31803726
type: Answer
has comment: http://stackoverflow.com/comment/31804131

http://stackoverflow.com/q/21162443
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21163506
has comment: http://stackoverflow.com/comment/31856502
has comment: http://stackoverflow.com/comment/31855267
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/31856247
upvote count: 3
tagged with: java
answer count: 2
has title: Returning from an Activity started by a Fragment
accepted answer: http://stackoverflow.com/a/21163506
has answer: http://stackoverflow.com/a/28579547
has comment: http://stackoverflow.com/comment/31856280
has comment: http://stackoverflow.com/comment/31856200
tagged with: android-fragments
possible better answer: http://stackoverflow.com/a/28579547
has comment: http://stackoverflow.com/comment/31856312
has comment: http://stackoverflow.com/comment/31857343
tagged with: eclipse
has body: I have an application that uses Tabs. I used Fragments to implement the TabListeners. One of these Fragment starts 2 activities (depending on some buttons). I used the Eclipse interface to create these activities, meaning that Eclipse took care of all the work (creating the layout, updating the manifest etc.). I have no issue if I return from the activity using the return button on the phone. But if I use the "<" symbol on the upper left corner of activity layout, I have an error: 01-04 02:56:56.000 E/Activity( 7556): getParentActivityIntent: bad parentActivityName 'com.android.nfcinfo2.FragmentCeSupport' in manifest 01-04 02:56:56.007 E/NavUtils( 7556): getParentActivityIntent: bad parentActivityName 'com.android.nfcinfo2.FragmentCeSupport' in manifest 01-04 02:56:56.007 D/AndroidRuntime( 7556): Shutting down VM** 01-04 02:56:56.007 W/dalvikvm( 7556): threadid=1: thread exiting with uncaught exception (group=0x41c78b90) 01-04 02:56:56.007 E/AndroidRuntime( 7556): FATAL EXCEPTION: main 01-04 02:56:56.007 E/AndroidRuntime( 7556): Process: com.android.nfcinfo2, PID: 7556 01-04 02:56:56.007 E/AndroidRuntime( 7556): java.lang.IllegalArgumentException: Activity EvtTransactionActivity does not have a parent activity name specified. (Did you forget to add the android.support.PARENT_ACTIVITY <meta-data> element in your manifest?) 01-04 02:56:56.007 E/AndroidRuntime( 7556): at android.support.v4.app.NavUtils.navigateUpFromSameTask(NavUtils.java:177) But it looks like my manifest is OK (FragmentCeSupport is the parent, EvtTransaction and SeRouting are the child activities): <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.android.nfcinfo2.FragmentCeSupport" /> <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.android.nfcinfo2.FragmentCeSupport" /> Here is how I start the activities from the FragmentCeSupport: …
type: AnsweredQuestion
score: 3

http://stackoverflow.com/q/21067981
tagged with: android-intent
has comment: http://stackoverflow.com/comment/31683636
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21068043
score: -1
tagged with: eclipse
type: Question
answer count: 3
has comment: http://stackoverflow.com/comment/31683139
has body: Hello Everyone I have a problem. I'm trying to build an app i join a button which is in the main activity and try to connect another activity which opens just by clicking on this button. I used intent here is the java code import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.Button; public class MainActivity extends Activity { Button exitbu; Button aboutbu; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); aboutbu = (Button) findViewById(R.id.aboutbu); aboutbu.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent i = new Intent("com.nomzapp.ABOUT"); startActivity(i); } }); exitbu= (Button) findViewById(R.id.exitbu); exitbu.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub System.exit(0); } }); @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 When i run this app in emulator or in mobile. The app stops after the splash screen. ( force close message box appear ) Here is the Manifesto <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.nomzapp" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="19" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="com.nomzapp.MAINACTIVITY" /> <category android:name="android.intent.category.DEFAULT" /> <action android:name="com.nomzapp.ABOUT" /> <category android:name="android.intent.category.DEFAULT" /> Any help ?? I want my app to run…
favorite count: 0
has comment: http://stackoverflow.com/comment/31683387
tagged with: android
has comment: http://stackoverflow.com/comment/31682897
has answer: http://stackoverflow.com/a/21068029
accepted answer: http://stackoverflow.com/a/21068029
has title: Android app is not Running
has comment: http://stackoverflow.com/comment/31682964
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/31683151
downvote count: 2
possible better answer: http://stackoverflow.com/a/21068043
has answer: http://stackoverflow.com/a/21068285
upvote count: 1

http://stackoverflow.com/q/21052674
tagged with: regex
possible better answer: http://stackoverflow.com/a/21052975
upvote count: 13
has body: I have two possibilities, make a regex or make a if compare. If Compares if (!(modoImpressao.equals("IMPRESSORA") || modoImpressao.equals("PDF") || modoImpressao.equals("AMBOS"))) Regex Match if (!Pattern.compile("(IMPRESSORA)|(PDF)|(AMBOS)",Pattern.DOTALL).matcher(modoImpressao).find()){ throw new EspdNeverStopParametroInvalidoException(TspdConstMessages.IMPRIMIR_PARAMETRO_MODOIMPRESSAO_INVALIDO,"TspdImprimirNFCe"); } which one is faster?
type: AnsweredQuestion
tagged with: performance
has comment: http://stackoverflow.com/comment/31654235
has title: What is faster, Regex or if compares - Java
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/69474059
type: Question
tagged with: if-statement
has answer: http://stackoverflow.com/a/21052707
accepted answer: http://stackoverflow.com/a/21052707
has answer: http://stackoverflow.com/a/21052975
score: 12
has answer: http://stackoverflow.com/a/73173237
has comment: http://stackoverflow.com/comment/31654494
has answer: http://stackoverflow.com/a/73173305
favorite count: 0
answer count: 5
has comment: http://stackoverflow.com/comment/129231909
has comment: http://stackoverflow.com/comment/31654495

http://stackoverflow.com/comment/31694298
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21074395
has text: Did you check this : http://stackoverflow.com/questions/7296467/google-map-signed-api-key-errors-in-android

http://stackoverflow.com/comment/31840662
has text: Are you running tomcat as root?
score: 4
type: Comment
comment on: http://stackoverflow.com/q/21153933
type: QuestionComment

http://stackoverflow.com/comment/31691906
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21072991
has text: I didn't actually know that convention. Thanks for the tip, @biesior!
score: 0

php
tags question: http://stackoverflow.com/q/21182353
tags question: http://stackoverflow.com/q/21091882
tags question: http://stackoverflow.com/q/21147508
tags question: http://stackoverflow.com/q/21040412
tags question: http://stackoverflow.com/q/21078323
tags question: http://stackoverflow.com/q/21078811
tags question: http://stackoverflow.com/q/21166633
tags question: http://stackoverflow.com/q/21164025
tags question: http://stackoverflow.com/q/21038758
tags question: http://stackoverflow.com/q/21064886
tags question: http://stackoverflow.com/q/21170443
tags question: http://stackoverflow.com/q/21150980
tags question: http://stackoverflow.com/q/21083425
tags question: http://stackoverflow.com/q/21168938
tag name: php
tags question: http://stackoverflow.com/q/21129320
tags question: http://stackoverflow.com/q/21076207
tags question: http://stackoverflow.com/q/21060759
tags question: http://stackoverflow.com/q/21153312
tags question: http://stackoverflow.com/q/21029995
tags question: http://stackoverflow.com/q/21183372
tags question: http://stackoverflow.com/q/21144775
tags question: http://stackoverflow.com/q/21072200
tags question: http://stackoverflow.com/q/21163699
tags question: http://stackoverflow.com/q/21110439
tags question: http://stackoverflow.com/q/21030642
tags question: http://stackoverflow.com/q/21061163
tags question: http://stackoverflow.com/q/21083700
tags question: http://stackoverflow.com/q/21065727
tags question: http://stackoverflow.com/q/21176288
tags question: http://stackoverflow.com/q/21060633
type: Tag

http://stackoverflow.com/comment/31830038
type: Comment
comment on: http://stackoverflow.com/a/21138860
has text: Now it works, the problem was that i didn't know how to use inject in filter class, now it works fine. thanks
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31682667
type: Comment
has text: Just getting started, this looks really nice but haven't covered it yet in class. Didn't want to put that in the code if I couldn't explain it. Thanks for the answer though
comment on: http://stackoverflow.com/a/21067728
score: 0
type: AnswerComment

http://stackoverflow.com/a/45409395
upvote count: 1
answers question: http://stackoverflow.com/q/21083170
downvote count: 0
has body: This worked for me : Added a custom container class : @Component public class CustomContainer implements EmbeddedServletContainerCustomizer { @Override public void customize(ConfigurableEmbeddedServletContainer configurableEmbeddedServletContainer) { configurableEmbeddedServletContainer.setPort(8888); } } But this was still not using port 8888. Then I set "scanBasePackages" property like this on "@SpringBootApplication" class on my main method: (scanBasePackages = {"custom container package"}) @SpringBootApplication(scanBasePackages = {"com.javabrains.util"}) public class CourseApiApp { public static void main (String args []) { SpringApplication.run(CourseApiApp.class, args); } } And it started picking up port set in Custom Container.
type: Answer
score: 1

http://stackoverflow.com/q/21154593
has title: Split line in words and remove String & Numeric words in Java Regex
has body: How to split a line in words and remove String &amp; Numeric words by using Java Regex. Here Input is what I receive and Output is what I want: Input: 05 ECPRF-057 PIC S9(4) VALUE +0057 COMP-3. Output: ECPRF-057 PIC S VALUE COMP-3 Input: 88 ACCT-LVL-CHG VALUE 'WT ' 'WTO', "AA ", Output: ACCT-LVL-CHG VALUE Thanks in Advance Kishore
linked to: http://stackoverflow.com/q/7352034
has comment: http://stackoverflow.com/comment/31841806
has answer: http://stackoverflow.com/a/21156116
favorite count: 0
tagged with: regex
possible better answer: http://stackoverflow.com/a/21156889
has comment: http://stackoverflow.com/comment/31843284
has answer: http://stackoverflow.com/a/21156889
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/32048019
accepted answer: http://stackoverflow.com/a/21156116
has comment: http://stackoverflow.com/comment/31842564
has comment: http://stackoverflow.com/comment/31843620
linked to: http://stackoverflow.com/q/2602230
downvote count: 1
has comment: http://stackoverflow.com/comment/31841754
has comment: http://stackoverflow.com/comment/31841884
has comment: http://stackoverflow.com/comment/31844223
type: Question
answer count: 2
upvote count: 0
score: -1
tagged with: cobol

http://stackoverflow.com/a/21043385
has body: No. You can't change it. This is because the command line is only really a block of text. It makes no sense for a command line to try figure out what data type the text is. That would mean the command line would need to have prior knowledge about the data types available in whatever is about to be run and somehow create (in the case of Java) the correct Objects and cast to them.
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21043362
upvote count: 2

http://stackoverflow.com/q/21103222
answer count: 2
tagged with: intellij-idea
has body: This is very puzzling. I have a multi module polyglot JVM project built using Gradle. I have a few java modules and a couple scala modules. The scala module uses ScalaTest as the test framework. I set up the Gradle to use the scalatest plugin to run tests. I had the whole thing running like a charm in IntelliJ for about a month (using the Gradle idea plugin). Now all of a sudden the ScalaTest specs won't run from the IDE anymore with the following error: Unable to load a Suite class. This could be due to an error in your runpath. Missing class: com.mypackage.MySpec Does anybody know what's going on? I am not sure what has changed since the first time I set up my build file that might have messed this up. This is really frustrating. Ideas? EDIT: Apparently my junit tests won't run either. Looks like the compiled classes aren't on the classpath used by Intellij. This is what I get if I try to run a JUnit test case: Class not found: "com.mypackage.MyUnitTests"
accepted answer: http://stackoverflow.com/a/21115417
has title: Gradle, IntelliJ and ScalaTest plugin: suddenly broken
score: 7
tagged with: scalatest
favorite count: 0
upvote count: 8
tagged with: scala
possible better answer: http://stackoverflow.com/a/21104535
has answer: http://stackoverflow.com/a/21104535
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21115417
tagged with: java
tagged with: gradle
downvote count: 1
type: Question

http://stackoverflow.com/comment/31749121
score: 1
type: QuestionComment
type: Comment
has text: Please post your logcat with details of the error.
comment on: http://stackoverflow.com/q/21103401

http://stackoverflow.com/comment/127752120
type: Comment
has text: Actually my code was tested on Oracle Os as well. You just need to make sure the path define based on OS. Maybe can set variable based on OS checking.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/65576766

http://stackoverflow.com/comment/31810891
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21129823
has text: my code can returning value but i just forgot to put in end of json response with die(json_encode($response));
type: Comment

http://stackoverflow.com/a/21172872
upvote count: 1
answers question: http://stackoverflow.com/q/21172516
type: Answer
has comment: http://stackoverflow.com/comment/36216572
downvote count: 0
score: 1
has body: You don't show how you layout the TextViews in your XML post but it is clear that they are very verbose. When you have such a long TextView to caption an EditText, it would be better to just put the EditText on the next line. If I were you, I would just have a scrolling layout like so: &lt;ScrollView&gt; &lt;TextView android:id="@+id/label1"/&gt; &lt;EditText&gt; android:id="@+id/edit1"/&gt; ... ... &lt;TextView android:id="@+id/labelN"/&gt; &lt;EditText android:id="@+id/editN"/&gt; &lt;/ScrollView&gt;

http://stackoverflow.com/comment/31726099
comment on: http://stackoverflow.com/q/21090020
type: Comment
type: QuestionComment
has text: Have you profiled the processing? Where are the bottlenecks?
score: 0

http://stackoverflow.com/comment/31685892
type: QuestionComment
has text: Create a collection of them and create them using a for loop.
score: 0
comment on: http://stackoverflow.com/q/21069546
type: Comment

http://stackoverflow.com/comment/86104360
comment on: http://stackoverflow.com/a/24264671
has text: I am getting `"The current user has insufficient permissions to perform the requested operation.`. Is there a possible solution for that. I checked that user has Finance access (Also tried by giving administrator access) . Also I am Using the .p12 key as described. Is there a solution with Json (recommended as per guide) ? and do we have to specify the .p12 key password ?
type: AnswerComment
score: 2
type: Comment

http://stackoverflow.com/a/25505826
has body: Maybe this question is a little bit old but i want to provide my solution for the following users. I had similiar circumstances (Spring MVC 3.2.10.RELEASE, Spring HATEAOS 0.16.0.RELEASE) to configure spring hateoas to use hypermedia without java configuration. My solution was the following: Create a custom HalJacksonHttpMessageConverter (which acts similiar as the Spring MVC standard MappingJacksonHttpMessageConverter, it also have to have a method which exposes the ObjectMapper) but register application/hal+json as the supported hypermediatypes. The supports method should return true if the given class is assignable from ResourceSupport. Create a RelProvider (the DefaultRelProvider fulfilled my needs in this case) in your xml configuration. I created a BeanPostProcessorBean (implemented interfaces: BeanPostProcessor and BeanFactoryAware). Enrich the existing ObjectMapper from my HalJachsonHttpMessageConverter with the following settings: // retrieve the object mapper from the messageConverter RelProvider provider = beanFactory.getBean("relProvider", RelProvider.class); ObjectMapper mapper = (ObjectMapper) objectMapper; mapper.registerModule(new Jackson2HalModule()); mapper.setHandlerInstantiator(new Jackson2HalModule.HalHandlerInstantiator(provider, null)); mapper.enable(SerializationFeature.INDENT_OUTPUT); Register these beans in your spring bean xml. I hope this helps. If someone has a better configuration approach, please let me know.
upvote count: 2
answers question: http://stackoverflow.com/q/21040951
has comment: http://stackoverflow.com/comment/115450201
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/21067591
accepted answer: http://stackoverflow.com/a/21067719
type: AnsweredQuestion
tagged with: java
type: Question
has title: Using printf to display the result of a method with 16 places
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/21067726
has answer: http://stackoverflow.com/a/21067719
favorite count: 0
has body: My code display the output using println but when I use printf, I am getting an error at execution. The end result is to have an output like this: Enter an integer: 5 The 16 bits are 0000000000000101 Where can I make a change that will give the above result and no errors? Here is my code: import java.util.Scanner; public class decimalToBits{ public static void main(String[] args){ //initiate variables int integer; Scanner input = new Scanner(System.in); //prompt user to input short integer System.out.println("Enter an integer: "); integer = input.nextInt(); //calculate integer into 16 bits //display results System.out.printf("The bits for decimal input of %d are %d", integer, deciamalToInt(integer)); } //convert short integer into 16 bit integer public static String decimalToInt(int integer){ String bits = ""; while (integer != 0){ int bitsValue = integer % 2; bits = toBitsChar(bitsValue) + bits; integer = integer / 2; } return bits; } //Convert an integer to a single 16 bit digit public static char toBitsChar(int bitsValue){ if (bitsValue &gt; 0) return (char)('1'); //display 1 if value is greater than 0 else return (char)('0'); //display 0 if value is 0 } } Get the following error: Enter an integer: 5 Exception in thread "main" The bits for decimal input of 5 are java.util.IllegalFormatConversionException: d != java.lang.String at java.util.Formatter$FormatSpecifier.failConversion(Unknown Source) at java.util.Formatter$FormatSpecifier.printInteger(Unknown Source) at java.util.Formatter$FormatSpecifier.print(Unknown Source) at java.util.Formatter.format(Unknown Source) at java.io.PrintStream.format(Unknown Source) at java.io.PrintStream.printf(Unknown Source) at decimalToBits.main(decimalToBits.java:22)
possible better answer: http://stackoverflow.com/a/21067726
answer count: 4
has answer: http://stackoverflow.com/a/21067867
has answer: http://stackoverflow.com/a/21067728
upvote count: 1

http://stackoverflow.com/a/21069616
has body: Those instructions do not sound correct (or good). The versions of Eclipse, Java, and GTK+2 all have to be 32-bit or 64-bit together. If you have a mismatch, resolve the mismatch. Where was this help found?
accepted answer of: http://stackoverflow.com/q/21069412
type: Answer
upvote count: 1
score: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31694412
answers question: http://stackoverflow.com/q/21069412
downvote count: 0
has comment: http://stackoverflow.com/comment/31693566

http://stackoverflow.com/comment/31854146
has text: write all of them manually ? what if there is a lot ? there isnt a shorter way ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21161795
type: Comment

http://stackoverflow.com/comment/31741565
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21098021
type: Comment
has text: @BrianRoach, I still don't get how to make use of that in case of a generic type.

http://stackoverflow.com/comment/31786207
has text: your SearchActivity extends Activity not MenuActivity ?
comment on: http://stackoverflow.com/q/21056158
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21182230
tagged with: spring
upvote count: 6
accepted answer: http://stackoverflow.com/a/21182459
tagged with: java
answer count: 3
tagged with: dependency-injection
downvote count: 0
score: 6
type: AnsweredQuestion
has title: Spring: circular dependencies on constructor\setter injection
possible better answer: http://stackoverflow.com/a/36171310
has answer: http://stackoverflow.com/a/36171310
favorite count: 0
has answer: http://stackoverflow.com/a/21182459
type: Question
has body: I've read that circular dependencies are caused by setter injection. So I tried to check it by my own. And it appears that I can reproduce circular dependency only with constructor injection (see code below). So the questions: Can I accomplish circular dependency with setter injection? How to resolve circular dependencies at code below? public class AConstr { private final BConstr b; public AConstr(BConstr bConstr) { System.out.println("AConstructor:: constructor"); this.b = bConstr; } } public class BConstr { private final AConstr a; public BConstr(AConstr aConstr) { System.out.println("BConstructor:: constructor"); this.a = aConstr; } } &lt;bean id="aConstr" class="pack.bean.AConstr"&gt; &lt;constructor-arg ref="bConstr"/&gt; &lt;/bean&gt; &lt;bean id="bConstr" class="pack.bean.BConstr"&gt; &lt;constructor-arg ref="aConstr"/&gt; &lt;/bean&gt;
has answer: http://stackoverflow.com/a/27749334
has comment: http://stackoverflow.com/comment/31894631

http://stackoverflow.com/q/21066369
linked to: http://stackoverflow.com/q/9554636
answer count: 2
has comment: http://stackoverflow.com/comment/31680757
linked to: http://stackoverflow.com/q/5621338
has answer: http://stackoverflow.com/a/21067555
has title: How to take String of a JComboBox Event handler into a variable for query?
tagged with: jdbc
tagged with: jcombobox
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
possible better answer: http://stackoverflow.com/a/21066564
accepted answer: http://stackoverflow.com/a/21067555
tagged with: swing
has answer: http://stackoverflow.com/a/21066564
type: Question
has comment: http://stackoverflow.com/comment/31680642
tagged with: java
has comment: http://stackoverflow.com/comment/31679887
has comment: http://stackoverflow.com/comment/31680483
has body: In the JCombobox are possible Routes for a train.I want to get the value of JCombobox based on the event handler and then use it in a class that uses a Database. This value will be a parameter for a Mysql query.I have succeeded in getting it,but can not use it. I'm not very experienced in java, I am doing something wrong. I have searched the site for similar problems, seen them but not understood them clearly.What am I missing? //imports... public class Cashier extends JFrame{ //here is main... public Cashier(){ //some Window code... final String[] Routes = {"--Select--", "value1",....."valueN" }; final JComboBox comboBox = new JComboBox(Routes); comboBox.addActionListener(new ActionListener() { /*--&gt;*/ public String d; public void WhereTo(String dest){ this.d=dest; System.out.println(d); // comes out correct! /*I want d for use in DBaccess class as query parameter, by invoking GetRoute()*/ } public void actionPerformed(ActionEvent e) { int val = comboBox.getSelectedIndex(); this.d= Routes[val]; WhereTo(d); } }); comboBox.setBounds(165, 124, 130, 23); contentPane.add(comboBox); //this method will be used by DBaccess public String GetRoute(){ return d; } //More Objects... } } This is my DBaccess class where i want to use the string d, probably by invoking Get Route() of Cashier. public DBaccess extends Cashier{ //connection code.... // Executing the query System.out.println("Creating statement..."); stmt = conn.createStatement(); String sql; //probably like this... String go = Cashier.GetRoute(); sql = "SELECT FROM reservations WHERE destination='"+go+"'"; ResultSet rs = stmt.executeQuery(sql); }
score: 0

http://stackoverflow.com/comment/31697117
type: AnswerComment
has text: `ScrollBarPolicy` makes it so that I always see the scrollbars, even if I can't scroll at the moment. `setBounds` sets the initial bounds of the window.
comment on: http://stackoverflow.com/a/21075386
score: 0
type: Comment

http://stackoverflow.com/comment/31755366
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21107202
has text: @Joshua The only time you ever use `arrayInString` is when `data.contains(",")` is true, and in that case, you initialize before using. Thus, the compiler can be sure that you initialize that variable before use. The problem here is that if `data.contains(",")` is false, you're using `arrayInDouble` without initializing (but you wouldn't be using `arrayInString`, hence why it doesn't complain in that way about that variable).
type: QuestionComment

http://stackoverflow.com/q/21034766
has answer: http://stackoverflow.com/a/21034782
has answer: http://stackoverflow.com/a/21034891
has answer: http://stackoverflow.com/a/21034805
has body: I am having a problem with formating a date using Java. The date formatter seems to parse my string using BST (British Summer Time) and not GMT+0 as defined by +0000 in the dateStr string in the code below. String dateStr = "Tue Oct 02 01:06:00 +0000 2012"; DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy"); Date date = df.parse(dateStr); // Test the date System.out.println(date.toString()); When I run the above code I get: Tue Oct 02 02:06:00 BST 2012 Which is evidently not what I want. A useful point of information might be that when I run the following: System.out.println(TimeZone.getDefault().getDisplayName()); I get: Greenwich Mean Time The output I'm trying to get is Tue Oct 02 01:06:00 GMT 2012 I've already tried .setTimeZone on df but to no avail.
downvote count: 0
has title: Formatting date in Java
possible better answer: http://stackoverflow.com/a/21035051
has comment: http://stackoverflow.com/comment/31640088
has answer: http://stackoverflow.com/a/21035051
tagged with: datetime
accepted answer: http://stackoverflow.com/a/21034782
answer count: 4
favorite count: 0
upvote count: 1
tagged with: timestamp
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/31623005
tagged with: java
tagged with: date
type: Question

http://stackoverflow.com/comment/31672737
type: Comment
has text: See my updated answer.. And call this function where you want... onCreate() or any where you want
comment on: http://stackoverflow.com/a/21062444
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31776787
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21117973
score: 1
has text: it does not matter, you won't get any faster then linear, it is impossible from the theoretical point of view. An milions of nodes (with short words in it) is still under a second.

http://stackoverflow.com/a/21136145
type: Answer
accepted answer of: http://stackoverflow.com/q/21135168
has body: Its possible please find the below code @Override public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D)g; GeneralPath path = new GeneralPath(); path.moveTo(10, 10); path.lineTo(10, 100); path.moveTo(100, 10); path.lineTo(100, 100); g2d.draw(path); }
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31930597
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21135168

http://stackoverflow.com/a/21128903
answers question: http://stackoverflow.com/q/21128836
score: 0
has comment: http://stackoverflow.com/comment/31795060
type: Answer
has body: Does this work? GPA = df.format ( Double.valueOf(qualityPoints) / Double.valueOf(sumOfHours) );
has comment: http://stackoverflow.com/comment/31795018

http://stackoverflow.com/a/21239380
accepted answer of: http://stackoverflow.com/q/21027906
answers question: http://stackoverflow.com/q/21027906
type: Answer
score: 0
has body: There doesn't seem to be a good answer for this. I have filed this as a bug in YouTrack http://youtrack.jetbrains.com/issue/IDEA-119625.
type: AcceptedAnswer

http://stackoverflow.com/a/21188693
answers question: http://stackoverflow.com/q/21172567
score: 8
downvote count: 0
has comment: http://stackoverflow.com/comment/31911491
upvote count: 8
has body: @Bart's answer was very useful to find my final solution: public class UserLoginData implements Serializable { private static final long serialVersionUID = 1L; @NotNull @NotBlank private String username; @NotNull @NotBlank private String password; //... getter and setters } On my Controller I have: public LoginResponse login( @RequestBody(required = true) @Valid UserLoginData loginData){ //... login code } Until here is very similar, but it is clearer because the controller's method does not have the error validation. Instead of that, I used another class with the ControllerAdvice annotation @ControllerAdvice public class RestErrorHandler { private MessageSource messageSource; @Autowired public RestErrorHandler(@Qualifier("messageSource") MessageSource messageSource) { this.messageSource = messageSource; } @ExceptionHandler(MethodArgumentNotValidException.class) @ResponseStatus(HttpStatus.BAD_REQUEST) @ResponseBody public ValidationError processValidationError(MethodArgumentNotValidException ex) { BindingResult result = ex.getBindingResult(); List&lt;FieldError&gt; fieldErrors = result.getFieldErrors(); return this.processFieldErrors(fieldErrors); } private ValidationError processFieldErrors(List&lt;FieldError&gt; fieldErrors) { ValidationError dto = new ValidationError(); for (FieldError fieldError : fieldErrors) { String localizedErrorMessage = this.resolveLocalizedErrorMessage(fieldError); dto.getErrors().put(fieldError.getField(), localizedErrorMessage); } return dto; } private String resolveLocalizedErrorMessage(FieldError fieldError) { Locale currentLocale = LocaleContextHolder.getLocale(); String localizedErrorMessage = this.messageSource.getMessage(fieldError, currentLocale); return localizedErrorMessage; } } Now my service is returning this: { "errors":{ "country":"country cannot be null" } } I hope it helps someone else. To get this solution I also used what is written in this post.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21172567
type: Answer

http://stackoverflow.com/q/21145911
has title: Accessing JFrame stuff from the outside
tagged with: eclipse
has answer: http://stackoverflow.com/a/22596339
type: Question
score: 0
answer count: 2
tagged with: swingx
has answer: http://stackoverflow.com/a/21145997
type: UnansweredQuestion
tagged with: swing
has body: Really, really stupid question here. I'm new to Java (and OOP), coming from a Javascript (Extendscript, actually) background. I have a JFrame here: package info.chrismcgee.sky.production; import java.awt.EventQueue; import java.awt.Font; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.border.EmptyBorder; import javax.swing.border.EtchedBorder; import net.miginfocom.swing.MigLayout; import org.jdesktop.swingx.JXTreeTable; import java.awt.Dimension; import java.util.ArrayList; import java.util.List; public class ProductionWindow extends JFrame { /** * */ private static final long serialVersionUID = -1899673458785493250L; private JPanel contentPane; private JTextField textField; private JLabel lblTodaysDate; private JXTreeTable treeTable; /** * Create the frame. */ public ProductionWindow() { setMinimumSize(new Dimension(450, 300)); 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(new MigLayout("", "[][grow,center][]", "[][grow][]")); JButton btnPrev = new JButton("&lt;- PREV"); contentPane.add(btnPrev, "cell 0 0,alignx left"); lblTodaysDate = new JLabel("Today's Date"); lblTodaysDate.setHorizontalAlignment(SwingConstants.CENTER); lblTodaysDate.setFont(new Font("Lucida Grande", Font.PLAIN, 20)); contentPane.add(lblTodaysDate, "cell 1 0,growx"); JButton btnNext = new JButton("NEXT -&gt;"); contentPane.add(btnNext, "cell 2 0,alignx right"); treeTable = new JXTreeTable(); treeTable.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); contentPane.add(treeTable, "cell 0 1 3 1,grow"); JLabel lblTotal = new JLabel("Total:"); lblTotal.setFont(new Font("Lucida Grande", Font.PLAIN, 24)); contentPane.add(lblTotal, "cell 0 2"); textField = new JTextField(); textField.se…
tagged with: oop
tagged with: java

http://stackoverflow.com/q/21060992
has title: How does Java resolve a relative path in new File()?
has body: I am trying to understand the way Java resolves relative path in while creating a File object. OS used: Windows For the below snippet, I am getting an IOException as it cannot find the path: @Test public void testPathConversion() { File f = new File("test/test.txt"); try { f.createNewFile(); System.out.println(f.getPath()); System.out.println(f.getAbsolutePath()); System.out.println(f.getCanonicalPath()); } catch (Exception e) { e.printStackTrace(); } } My understanding here is, Java treats the path provided as absolute and returns an error when the path does not exist. So it makes sense. When I update the above code to use relative path: @Test public void testPathConversion() { File f = new File("test/../test.txt"); try { f.createNewFile(); System.out.println(f.getPath()); System.out.println(f.getAbsolutePath()); System.out.println(f.getCanonicalPath()); } catch (Exception e) { e.printStackTrace(); } } It creates a new file and provides the below output: test\..\test.txt C:\JavaForTesters\test\..\test.txt C:\JavaForTesters\test.txt In this case, my assumption is, even though the path provided doesn't exist, because the path contains "/../", java treats this as a relative path and creates the file in the user.dir. So this also makes sense. But if I update the relative path as below: @Test public void testPathConversion() { File f = new File("test/../../test.txt"); try { f.createNewFile(); System.out.println(f.getPath()); System.out.println(f.getAbsolutePath()); System.out.println(f.getCanonicalPath()); } catch (Exception e) { e.printStackTrace(); } } Then I get IOException: Access is denied. My questions are: why "test/../test.txt" is treated as a relative path and creates the file in "user.dir" but"test/../../test.txt" returns an error? Where does it attempt to create the file for the path "test/../../test.txt"? When the specified relative path is not found, the file seems to be created in the user.dir. So, it appears to me that the below two scenarios does the sam…
score: 58
has answer: http://stackoverflow.com/a/60283193
upvote count: 58
has comment: http://stackoverflow.com/comment/31669948
has comment: http://stackoverflow.com/comment/31669780
has answer: http://stackoverflow.com/a/43935605
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21061081
linked to: http://stackoverflow.com/q/10166453
tagged with: java
has answer: http://stackoverflow.com/a/21061029
possible better answer: http://stackoverflow.com/a/21061094
tagged with: file
has answer: http://stackoverflow.com/a/21061094
type: Question
accepted answer: http://stackoverflow.com/a/21061029
has answer: http://stackoverflow.com/a/50472908
has answer: http://stackoverflow.com/a/46144339
downvote count: 0
answer count: 7
tagged with: relative-path
favorite count: 0

http://stackoverflow.com/comment/31980620
comment on: http://stackoverflow.com/a/21190466
score: 0
type: AnswerComment
has text: Hi there is a properties file but I am not sure how to add that to my .ear file. When I build the application it generates a xyz.ear file which needs to be deployed on WAS 7. But this ear doesnt contain the requires properties file, please help.
type: Comment

http://stackoverflow.com/comment/31607484
has text: @crush The thing is, "constructor" means rather different things in JS and Java, even if the two may be comparable (of which I am not sure). You appear to be confusing two concepts which share the same term.
comment on: http://stackoverflow.com/q/21026704
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/21138147
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31811447
type: Answer
has comment: http://stackoverflow.com/comment/51617091
upvote count: 2
has body: Although classic servlet containers like Tomcat use a Thread-Per-Request model, you cannot rely on any mapping of a single thread to a single web-application. This is because requests are serviced from a pool of container-managed threads, e.g. imagine a thread pool with 3 threads A, B and C. These service requests, which alternate between two webapps W1 and W2 in a round robin fashion: request 1 on W1 serviced by A request 2 on W2 serviced by B request 3 on W1 serviced by C request 4 on W2 serviced by A ... As you can see, Thread A first handled a request to webapp W1 and was later reused for a request to webapp W2. Therefore you cannot assign a web-app id to a thread once and be done with it. Instead, on every single request, you have to set the web-app id in the threads MDC before processing the request remove the web-app id from the request thread after processing is complete Both of these tasks can for example be fulfilled by a Servlet Filter. The logback documentation also explains this in the section "MDC and Managed Threads". There is even a sample filter implementation available, which you can modify to fit your needs.
has comment: http://stackoverflow.com/comment/31811875
accepted answer of: http://stackoverflow.com/q/21136911
score: 2
answers question: http://stackoverflow.com/q/21136911

http://stackoverflow.com/comment/31821838
has text: Thanks for linking to that answer, that's easier than suggested on the XDA article I linked. Glad to hear things worked out
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21143422
type: Comment

jdbc
tags question: http://stackoverflow.com/q/21062576
tags question: http://stackoverflow.com/q/21085977
tags question: http://stackoverflow.com/q/21183014
tags question: http://stackoverflow.com/q/21161211
tags question: http://stackoverflow.com/q/21063393
tags question: http://stackoverflow.com/q/21040635
tags question: http://stackoverflow.com/q/21135557
tags question: http://stackoverflow.com/q/21070894
tags question: http://stackoverflow.com/q/21074299
tags question: http://stackoverflow.com/q/21104197
tags question: http://stackoverflow.com/q/21028447
tags question: http://stackoverflow.com/q/21111123
tags question: http://stackoverflow.com/q/21111779
tags question: http://stackoverflow.com/q/21061393
tags question: http://stackoverflow.com/q/21137208
type: Tag
tags question: http://stackoverflow.com/q/21139066
tags question: http://stackoverflow.com/q/21182670
tags question: http://stackoverflow.com/q/21051541
tags question: http://stackoverflow.com/q/21031995
tags question: http://stackoverflow.com/q/21104097
tags question: http://stackoverflow.com/q/21113768
tags question: http://stackoverflow.com/q/21092833
tags question: http://stackoverflow.com/q/21120038
tags question: http://stackoverflow.com/q/21131461
tags question: http://stackoverflow.com/q/21108656
tags question: http://stackoverflow.com/q/21035264
tags question: http://stackoverflow.com/q/21058511
tags question: http://stackoverflow.com/q/21019585
tags question: http://stackoverflow.com/q/21139757
tags question: http://stackoverflow.com/q/21061388
tags question: http://stackoverflow.com/q/21111188
tags question: http://stackoverflow.com/q/21156445
tags question: http://stackoverflow.com/q/21154938
tags question: http://stackoverflow.com/q/21027139
tags question: http://stackoverflow.com/q/21035508
tags question: http://stackoverflow.com/q/21024224
tags question: http://stackoverflow.com/q/21159263
tags question: http://stackoverflow.com/q/21052708
tags question: http://stackoverflow.com/q/21176667
tags question: http://stackoverflow.com/q/21129017
tags question: http://stackoverflow.com/q/21119096
tags question: http://stackoverflow.com/q/21172817
tags question: http://stackoverflow.com/q/21040337
tags question: http://stackoverflow.com/q/21118698
tags question: http://stackoverflow.com/q/21053443
tags question: http://stackoverflow.com/q/21065319
tags question: http://stackoverflow.com/q/21048458
tags question: http://stackoverflow.com/q/21066890
tags question: http://stackoverflow.com/q/21066369
tag name: jdbc
tags question: http://stackoverflow.com/q/21026276
tags question: http://stackoverflow.com/q/21127255
tags question: http://stackoverflow.com/q/21061890
tags question: http://stackoverflow.com/q/21111471
tags question: http://stackoverflow.com/q/21072728
tags question: http://stackoverflow.com/q/21111394
tags question: http://stackoverflow.com/q/21139192
tags question: http://stackoverflow.com/q/21025501
tags question: http://stackoverflow.com/q/21118771
tags question: http://stackoverflow.com/q/21179475
tags question: http://stackoverflow.com/q/21060946
tags question: http://stackoverflow.com/q/21084658
tags question: http://stackoverflow.com/q/21086372
tags question: http://stackoverflow.com/q/21128963

http://stackoverflow.com/q/21020562
has answer: http://stackoverflow.com/a/21021985
tagged with: mapreduce
has answer: http://stackoverflow.com/a/21020697
type: AnsweredQuestion
score: 3
downvote count: 0
has answer: http://stackoverflow.com/a/34645558
favorite count: 0
possible better answer: http://stackoverflow.com/a/21020697
has body: I have a list of Java Objects and I need to reduce it applying Aggregate Functions like a select over a DataBase. NOTE: The data were calculated from multiples Databases and services calls. I expect to have thousands of rows and each row always will have the same quantity of "cells" for each execution. This quantity changes between executions. Samples: Supposing I have my data represented in a List of Object[3] (List&lt;Object[]&gt;) my data could be: [{"A", "X", 1}, {"A", "Y", 5}, {"B", "X", 1}, {"B", "X", 2}] Sample 1: SUM over index 2, Grouping by index 0 and 1 [{"A", "X", 1}, {"A", "Y", 5}, {"B", "X", 3}] Sample 2: MAX over index 2, Grouping by index 0 [{"A", "Y", 5}, {"B", "X", 2}] Somebody knows about some framework or api that could emulate this behavior in Java? My first option was insert all data in a NO-SQL database (like Couchbase), then apply the Map-Reduce and finally get the result of that. But this solution have a big overhead. My second option was to embed a Groovy script, but it has a big overhead too.
type: Question
accepted answer: http://stackoverflow.com/a/21021985
has comment: http://stackoverflow.com/comment/31596041
upvote count: 3
answer count: 3
tagged with: data-processing
tagged with: java
tagged with: database
has title: Aggregate Functions over a List in JAVA

http://stackoverflow.com/comment/31795934
has text: so you just need to white list the remote server . that's all
comment on: http://stackoverflow.com/q/21108926
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21181986
type: AnsweredQuestion
has body: I am trying to change my screen depending of the device version in BB. I got this instruction: String deviceOS = DeviceInfo.getPlatformVersion(); But it gives me a string like this: 4.0.1.3 and I want to get just the first 2 numbers in a float variable. It is developed in java. The first number almost sure will never be higher than 9 but the second, maybe it reachs to 10 or two digits. I know this is a simple question for java developers but I haven't use java in a couple of years and I don't remember the basics.
has comment: http://stackoverflow.com/comment/31976873
tagged with: java
accepted answer: http://stackoverflow.com/a/21182140
has comment: http://stackoverflow.com/comment/31900962
type: Question
score: 0
answer count: 1
has title: Get an float from a string Blackberry OS
has comment: http://stackoverflow.com/comment/31905248
has answer: http://stackoverflow.com/a/21182140
tagged with: blackberry
has comment: http://stackoverflow.com/comment/31892232
has comment: http://stackoverflow.com/comment/31940668

http://stackoverflow.com/comment/31894893
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21181596
has text: What if the word ("in") occurs more than once after the last upper case word?

http://stackoverflow.com/a/21090389
answers question: http://stackoverflow.com/q/21084222
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21084222
has comment: http://stackoverflow.com/comment/32014658
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33168798
has body: ConfigurationBuilder configurationBuilder = new ConfigurationBuilder(); configurationBuilder.setOAuthConsumerKey(context.getResources().getString(R.string.twitter_consumer_key)); configurationBuilder.setOAuthConsumerSecret(context.getResources().getString(R.string.twitter_consumer_secret)); configurationBuilder.setOAuthAccessToken("HERE ENTER UR ACCESS TOKEN RECEIVED IN YOUR WEB SERVICE")); configurationBuilder.setOAuthAccessTokenSecret("HERE ENTER UR ACCESS TOKEN SECRET RECEIVED IN YOUR WEB SERVICE")); Configuration configuration = configurationBuilder.build(); final Twitter twitter = new TwitterFactory(configuration).getInstance(); new Thread(new Runnable() { private double x; @Override public void run() { boolean success = true; try { x = Math.random(); twitter.updateStatus(message +" "+x); } catch (TwitterException e) { e.printStackTrace(); success = false; } final boolean finalSuccess = success; callingActivity.runOnUiThread(new Runnable() { @Override public void run() { postResponse.onFinsihed(finalSuccess); } }); } }).start(); The above method will let you post the tweet if you have a valid access token and access token secret. cheers :)
type: Answer
score: 2

http://stackoverflow.com/comment/31612580
comment on: http://stackoverflow.com/a/21029350
has text: @Java Devil what i want is to fill these arrays after asynctask is finish, the reason i put arrays in the start of activity is because i want to use them in main activity other methods.. i knew they are getting zero. i have a button i want to start asynctask when i press it and then fill these arrays, any solution
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31632189
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21040635
has text: Well I tend to cleverly apply the code searching features of Eclipse to figure out all the pieces of code that fetch a connection, and then I investigate each and every one. Usually the trouble is in bad error handling, like not closing the connection in a finally clause.
type: QuestionComment

http://stackoverflow.com/comment/31780467
comment on: http://stackoverflow.com/a/21121139
type: Comment
type: AnswerComment
score: 0
has text: **This Will Not Work**!! `hashCode` is **not unqiue**. You will end up randomly getting the wrong elements in your `Map`. Please read up on how `hashCode()` and `equals()` works.

http://stackoverflow.com/a/21051724
downvote count: 0
score: 4
type: Answer
has body: Arrays are not extendible. This is by design. I suggest using an ArrayList. It's like an array (can index any property, works almost as fast in terms of runtime complexity) but has the additional properties that you can add and remove items. The easy way to do this is to change generatedList into ArrayList&lt;Integer&gt;. If you want to preserve an array, you can always create a new array and copy over the contents. (ArrayLists are easier, though.)
upvote count: 4
answers question: http://stackoverflow.com/q/21051665

http://stackoverflow.com/comment/31906326
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21152073
has text: Thanks, this is helpful but it doesn't address the real issue. I have added some info to the question to help clarify my issue.
type: Comment

http://stackoverflow.com/comment/31680441
type: Comment
type: AnswerComment
has text: You mean you want to check how many rows the table currently has?
comment on: http://stackoverflow.com/a/21066752
score: 0

http://stackoverflow.com/comment/31648503
type: Comment
comment on: http://stackoverflow.com/q/21048988
type: QuestionComment
has text: @Raghunandan Same Error..can't work
score: 0

http://stackoverflow.com/comment/31695461
type: QuestionComment
comment on: http://stackoverflow.com/q/21074990
score: 0
has text: But it have to. Because programm where I send my xml doc. doesn't not exept it with no & sign!
type: Comment

http://stackoverflow.com/comment/31913261
type: Comment
comment on: http://stackoverflow.com/a/21176153
score: 0
type: AnswerComment
has text: Alright, thanks! If I email, my address is oinia12@hotmail.com just so you know

http://stackoverflow.com/a/21057777
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: An approach, that relies heavily on a good hashed map: As key use the a linear equation (defining a line), so that you have a map along the line of map&lt;key=(vector, point), value=quantity&gt; pointsOnLine where vector and point define the linear function that two points determine. Then you iterate over all n points: maxPoints = 2 for i=1 to n for j=i+1 to n newKey = lineParametersFromPoints(point[i], point[j]) if pointsOnLine.contains(newKey) pointsOnLine[key] += 1 if maxPoints &lt; pointsOnLine[key] maxPoints = pointsOnLine[key] else pointsOnLine.add(key) pointsOnLine[key] = 2 maxPoints then contains the maximum number of colinear points. Please note (this is probably most important), that the hash-compare function of the map must check that the two lines represent the same linear function, even if the vectors are anti-parallel or the points on the two lines are not the same (but one satisfies the other equation). This approach does of course heavily rely on the map having fast access and insertion times.
answers question: http://stackoverflow.com/q/21034597

http://stackoverflow.com/comment/31792104
type: AnswerComment
has text: now i have white background and text still not displays. Theres a [code](http://pastebin.com/U1PhKU91). Don't worry: panels added to JFrame.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21127112

http://stackoverflow.com/q/21089707
tagged with: datetime-format
possible better answer: http://stackoverflow.com/a/67448999
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/38922754
has body: I want to convert this (Mon Jan 16:20:12 India Standard Time 2014) Date in string to java.util.Date in java how can I do it. I want the date in the following format. SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US); Actually the Date (Mon Jan 16:20:12 India Standard Time 2014) is argument from MFC application which will be launching a executable jar file and the date in string will be its argument. MFC Code that will launch the executable jar. with argument. CString csCurrentTime = CTime::GetCurrentTime().Format("%a %b %X %Z %Y"); TRACE(csCurrentTime); if (CreateProcess(m_csJrePath, TEXT(" -jar DbxUpldDwnld.jar %s",csCurrentTime), NULL, NULL, false, CREATE_NO_WINDOW, NULL, NULL, (LPSTARTUPINFOA)&amp;siStartupInfo, &amp;piProcessInfo) == false) { AfxMessageBox(_T("Please install Java Runtime Environment(JRE) on your PC\n Or JRE not found on given path in INI File."), MB_ICONERROR); CloseHandle(piProcessInfo.hProcess); CloseHandle(piProcessInfo.hThread); return; } Also will it be possible to get the date with spaces as single argument in java. Please Help me, am new to MFC.
has answer: http://stackoverflow.com/a/21090007
has comment: http://stackoverflow.com/comment/119218933
has comment: http://stackoverflow.com/comment/31722649
has comment: http://stackoverflow.com/comment/31722697
type: Question
has comment: http://stackoverflow.com/comment/119218917
accepted answer: http://stackoverflow.com/a/21090007
has title: Convert date in string(Mon Jan 16:20:12 India Standard Time 2014) to java.util.date in JAVA
has comment: http://stackoverflow.com/comment/31722365
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31722242
answer count: 2
has answer: http://stackoverflow.com/a/67448999
has comment: http://stackoverflow.com/comment/31722543
tagged with: mfc
tagged with: date

http://stackoverflow.com/q/21064030
has answer: http://stackoverflow.com/a/21064513
has comment: http://stackoverflow.com/comment/31716869
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23121540
upvote count: 2
answer count: 5
tagged with: gradient-descent
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21084738
score: 2
has answer: http://stackoverflow.com/a/21085107
has title: Gradient Descent in linear regression
tagged with: linear-regression
tagged with: java
tagged with: machine-learning
has answer: http://stackoverflow.com/a/21066221
has comment: http://stackoverflow.com/comment/31679365
type: Question
has body: I am trying to implement linear regression in java. My hypothesis is theta0 + theta1 * x[i]. I am trying to figure out the value of theta0 and theta1 so that the cost function is minimum. I am using gradient descent to find out the value - In the while(repeat until convergence) { calculate theta0 and theta1 simultaneously. } what is this repeat until convergence? I understood that it is the local minimum but what is exact code that I should put in the while loop? I am very new to machine learning and just began to code basic algos to get better understanding. Any help will be greatly appreciated.

http://stackoverflow.com/comment/31781020
type: QuestionComment
has text: @ajb Yes, there is, especially if `Foo` appears in a method signature.
score: 0
comment on: http://stackoverflow.com/q/21121256
type: Comment

http://stackoverflow.com/q/21076074
duplicate of: http://stackoverflow.com/q/9279893
upvote count: 1
accepted answer: http://stackoverflow.com/a/21076092
type: Question
has body: I can't seem to replace a string of ":)" to something else, here is my code: if(message.contains(":)")) message = message.replaceAll(":)", replacement); This is the error: Exception in thread "Listen" java.util.regex.PatternSyntaxException: Unmatched closing ')' near index 0 :) ^ What should I do?
tagged with: java
has answer: http://stackoverflow.com/a/21076102
has comment: http://stackoverflow.com/comment/31697455
answer count: 3
possible better answer: http://stackoverflow.com/a/21076102
has answer: http://stackoverflow.com/a/21076088
downvote count: 0
score: 1
tagged with: string
has title: Why can't I replace ":)"
favorite count: 0
has answer: http://stackoverflow.com/a/21076092
tagged with: regex
linked to: http://stackoverflow.com/q/9279893
type: AnsweredQuestion

http://stackoverflow.com/comment/31696785
type: AnswerComment
type: Comment
has text: I knew that a deadlock! :) Obviously I did not carefully watched documentation. Thank you very much.
comment on: http://stackoverflow.com/a/21075566
score: 0

http://stackoverflow.com/q/21053660
has comment: http://stackoverflow.com/comment/31657320
has comment: http://stackoverflow.com/comment/31656617
tagged with: download
has title: An IDM like app in java
has answer: http://stackoverflow.com/a/21054325
linked to: http://stackoverflow.com/q/869033
type: UnansweredQuestion
tagged with: multithreading
tagged with: java
type: Question
score: 0
has body: I'm writing an small application like IDM in java. But this has has many Exceptions. This is the code of Downloader class which implements runnable and I want use it for multithreading. public class Downloader implements Runnable{ private DataInputStream inputStream; private byte[][] fileData; private int index; private int size; public Downloader(DataInputStream inputStream, byte[][] fileData, int index, int size) { this.inputStream = inputStream; this.fileData = fileData; this.index = index; this.size = size; } public synchronized void run() { try{ inputStream.skipBytes(index * size); for(int i= 0;i&lt;size;i++){ fileData[index][i] = inputStream.readByte(); System.out.println("It works : " + index); } } catch(Exception e){ System.out.println(e.getMessage()); } }} and this is my main class public class Main { public static void main(String[] args) { String s; //Scanner input = new Scanner(System.in); //System.out.print("Enter file destination : "); //s = input.nextLine(); s = "http://video.varzesh3.com/video/clip1/92/uclip/fun/gaf_6_borhani.mp4"; URL url; URLConnection connection; DataInputStream inputStream; FileOutputStream outStream; byte[][] fileData; try{ url = new URL(s); connection = url.openConnection(); inputStream = new DataInputStream(connection.getInputStream()); fileData = new byte[8][connection.getContentLength() / 4]; int size = connection.getContentLength() / 4; Runnable d0 = new Downloader(inputStream, fileData, 0, size); Runnable d1 = new Downloader(inputStream, fileData, 1, size); Runnable d2 = new Downloader(inputStream, fileData, 2, size); Runnable d3 = new Downloader(inputStream, fileData, 3, size); Thread thread0 = new Thread(d0); Thread thread1 = new Thread(d1); Thread thread2 = new Thread(d2); Thread thread3 = new Thread(d3); thread0.start(); thread1.start(); thread2.start(); thread3.start(); inputStream.close(); String path = "C:\\Users\\NetTest\\Desktop\\test.mp4"; outStream = new FileOutputStream(new File(path)); outStream.write(fileData…
answer count: 1

http://stackoverflow.com/a/21049814
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21049622
has body: Here's a pretty naive example. Let's say you have a HashMap that looks like the following: public Map&lt;Integer, String&gt; map = new HashMap&lt;Integer, String&gt;(); You're saying that you want to create a sublist, so I'll assume you want a List&lt;String&gt; as an output: public List&lt;String&gt; getKeyRange(Integer start, Integer end) { List&lt;String&gt; list = new ArrayList&lt;String&gt;(); for (int i = start; i &lt; end; i++) { String value = map.get(i); //Forgot that string can be null in Java if (value != null) list.add(value); } return list; }
answers question: http://stackoverflow.com/q/21049622
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/a/21163007
has comment: http://stackoverflow.com/comment/67100474
type: AcceptedAnswer
has body: You are wrong with with this statement: So, for example between 1st Jan. 2012 and 1st Jan. 2013 should result 365 instead of 366. JodaTime returns 366 in this situation, tested. Solution without JodaTime GregorianCalendar start = new GregorianCalendar(2012, 0, 1); GregorianCalendar end = new GregorianCalendar(2013, 0, 1); int days = (end.get(Calendar.YEAR) - start.get(Calendar.YEAR)) * 365 + (end.get(Calendar.DAY_OF_YEAR) - start.get(Calendar.DAY_OF_YEAR)); System.out.println(days); returns 365.
has comment: http://stackoverflow.com/comment/67100295
type: Answer
accepted answer of: http://stackoverflow.com/q/21162677
has comment: http://stackoverflow.com/comment/67092475
has comment: http://stackoverflow.com/comment/31858573
answers question: http://stackoverflow.com/q/21162677
upvote count: 2
has comment: http://stackoverflow.com/comment/67083257
downvote count: 1
has comment: http://stackoverflow.com/comment/31857957
score: 1
has comment: http://stackoverflow.com/comment/31885489

http://stackoverflow.com/comment/31847082
type: Comment
comment on: http://stackoverflow.com/a/21133937
has text: @rachana The second comment says that a type should be a jclass, not a jobject. You seem to not understand my question. Sorry.
score: 0
type: AnswerComment

http://stackoverflow.com/a/21036133
upvote count: 2
has body: EDIT: Ok. So let's say that you have a user Bob and his code is B001. ItemStateChanged Method ... String code = (String) cmb.getSelectedItem(); try{ String sql = "SELECT * FROM customer WHERE code='"+code"'" PreparedStatement prst = con.prepareStatement(); ResultSet rs = prst.executeQuery(sql); String name = ""; while(rs.next()){ name = rs.getString('name'); } txt.setText(name); }catch(Exception ex){ } You shouldn't actually connect inside the itemStateChanged but this is just an example.
has comment: http://stackoverflow.com/comment/31711012
has comment: http://stackoverflow.com/comment/31624709
answers question: http://stackoverflow.com/q/21036002
has comment: http://stackoverflow.com/comment/31713010
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/31675824
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21064253
has text: Have you tried anything?

http://stackoverflow.com/a/21069483
score: 0
answers question: http://stackoverflow.com/q/21069340
type: Answer
has body: How about using constructor initializing a final field? class Foo { final Bar bar; public Foo(Bar bar) { this.bar = bar } }

nullable
tag name: nullable
type: Tag
tags question: http://stackoverflow.com/q/21018789

http://stackoverflow.com/q/21067186
has answer: http://stackoverflow.com/a/21067598
has comment: http://stackoverflow.com/comment/31681801
score: 2
has comment: http://stackoverflow.com/comment/31681780
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31681417
has title: How to make child of expandablelistview clickable and do something else?
favorite count: 0
linked to: http://stackoverflow.com/q/13350937
tagged with: android
accepted answer: http://stackoverflow.com/a/21067598
has comment: http://stackoverflow.com/comment/31681368
tagged with: listener
upvote count: 2
linked to: http://stackoverflow.com/q/8413656
tagged with: expandablelistview
type: Question
linked to: http://stackoverflow.com/q/2367936
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31681458
has comment: http://stackoverflow.com/comment/31682024
tagged with: java
has comment: http://stackoverflow.com/comment/31681334
has body: Hi just wondering how I can make a listener or sorts. I wanna make it so when one of the childs are click it opens a YouTube video INSIDE the App, not as a Web actitivity....anyways the iportant part is not the youtube part, i just want to know how i can make each child open a different youtube link of its own. To be clear, my question is: HOW can i make each child do something different, for example open a youtube link or EVEN open a new intent. this is what i got so far. public class Adobe extends Activity{ ExpandableListAdapter listAdapter; ExpandableListView expListView; List&lt;String&gt; listDataHeader; HashMap&lt;String, List&lt;String&gt;&gt; listDataChild; String name; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.adobe); // get the list view expListView = (ExpandableListView) findViewById(R.id.lvExp); prepareListData(); listAdapter = new ExpandableListAdapter(this, listDataHeader, listDataChild); // setting list adapter, show the list expListView.setAdapter(listAdapter); expListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { // This is just testing to see what i come up with name = v.getTag().toString(); switch (childPosition) { case 0: Toast.makeText(getBaseContext(), "Intro", Toast.LENGTH_LONG ).show(); break; default: Toast.makeText(getBaseContext(), "" + childPosition, Toast.LENGTH_SHORT ).show(); break; } return false; } }); } PS. the child as set as Buttons instead of Textview in the XML file, but if i can do with Textview then ill will. PSSS. the list is already made in another function, just didnt included here so it wasnt too long.

http://stackoverflow.com/comment/31847685
has text: What table model are using?
comment on: http://stackoverflow.com/q/21158083
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21181690
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21181661
has body: Just call the toString() method: String nounSynset = synsets[j].toString();

http://stackoverflow.com/comment/95221292
comment on: http://stackoverflow.com/a/21451900
has text: Is there a way to remove the added script before randering? I mean after adding the script if it needs to be removed or substituted wih another before rendering the page that is.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21156611
type: Answer
answers question: http://stackoverflow.com/q/21156573
score: 0
has body: You can only replace parts of Strings with a String. String text = "Hello World"; int i = 2; text = text.replaceAll("o", ""+i);

http://stackoverflow.com/comment/31857344
type: Comment
comment on: http://stackoverflow.com/q/21163423
has text: @duffymo yes, on a String
score: 0
type: QuestionComment

http://stackoverflow.com/comment/138769329
score: 0
type: Comment
has text: Do you know what obfuscator uses jsr but does *no* string encryption, but heavy control-flow mangling (causing most decompilers to crash or run endlessly) and uses field/method obfuscation to variable number of underscores, combinations of S, 5 and $ and likewise combinations of I, l and 1? (I asked this on RE, but nobody there knows shit.)
type: AnswerComment
comment on: http://stackoverflow.com/a/21150629

http://stackoverflow.com/comment/31848538
has text: You say you are submitting something. If you're using a form you should validate using `BindingResult` and display the errors through `<form:errors path="property" />`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21157853
score: 0

http://stackoverflow.com/q/21156992
favorite count: 0
has answer: http://stackoverflow.com/a/21157111
has answer: http://stackoverflow.com/a/21263543
has comment: http://stackoverflow.com/comment/31920058
has comment: http://stackoverflow.com/comment/31847121
answer count: 5
has answer: http://stackoverflow.com/a/21157124
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21263543
type: Question
has comment: http://stackoverflow.com/comment/31845803
has title: IntelliJ IDEA: the first compilation takes a lot of time
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/31845938
possible better answer: http://stackoverflow.com/a/55598097
has body: I'm using IntelliJ IDEA to develop my Java application. I'm frustrated with the fact that the first compilation of a project (or a complete rebuild) takes very long, about 15 min (and is very CPU-intensive). The project is composed from a couple of hundreds of Java classes, but compiling it with Eclipse just need 1-2 minutes. Are there any compilation options that I can set in order to speed up this step? UPDATE My configuration: SSD, 64GB RAM, Xeon E5-1660, Win 7 Ultimate Compilation time (Rebuild): Eclipse: 30s IntelliJ IDEA with Eclipse compiler 45s IntelliJ IDEA with javac compiler: more than 10 minutes (!) Number of java classes ~5000
has answer: http://stackoverflow.com/a/22027142
tagged with: eclipse
score: 15
has comment: http://stackoverflow.com/comment/39770486
has answer: http://stackoverflow.com/a/55598097
upvote count: 15
downvote count: 0
has comment: http://stackoverflow.com/comment/31846635

http://stackoverflow.com/a/21127592
answers question: http://stackoverflow.com/q/21127519
score: 0
has body: You need to assure the compiler that z will get a value no matter what. You may want to assign it a default value when declaring it. Something along these lines: int z = 0; // just an example
type: Answer

http://stackoverflow.com/q/21155648
has comment: http://stackoverflow.com/comment/31848649
score: 0
has comment: http://stackoverflow.com/comment/31844014
has comment: http://stackoverflow.com/comment/31848818
tagged with: jsp
has body: I have this code <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page trimDirectiveWhitespaces="true" %> <%@page import="com.itextpdf.text.Document"%> <%@page import="com.itextpdf.text.Paragraph"%> <%@page import="com.itextpdf.text.PageSize,java.sql.Blob"%> <%@ page import="javax.servlet.http.*,javax.servlet.*,com.itextpdf.text.DocumentException" %> <%@page import="java.io.*,java.text.SimpleDateFormat"%> <%@page import="java.sql.*,java.nio.charset.Charset,com.itextpdf.text.pdf.BaseFont"%> <%@ page import="com.itextpdf.tool.xml.ElementHandler,java.util.List,java.util.Arrays,java.util.Collections,java.util.*,com.itextpdf.text.pdf.*,com.itextpdf.tool.xml.ElementList,com.itextpdf.text.Rectangle,com.itextpdf.text.Element,com.itextpdf.text.*,com.itextpdf.text.Font,java.awt.Color,com.itextpdf.text.Font.FontFamily,java.util.Date,java.text.*,com.itextpdf.tool.xml.XMLWorkerHelper" %> Insert title here <% Class.forName("com.mysql.jdbc.Driver"); request.setCharacterEncoding("UTF-8"); String date=request.getParameter("user"); OutputStream output=response.getOutputStream(); response.setContentType("application/pdf"); response.setHeader("Content-Disposition", "inline; filename=details.pdf"); try{ Document document = new Document(PageSize.A4, 20, 20, 130, 20); PdfWriter writer=PdfWriter.getInstance(document, output); document.open(); BaseFont bf = BaseFont.createFont("c:/windows/fonts/arialuni.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); writer.setPageEvent(new HeaderAndFooter(date)); XMLWorkerHelper worker = XMLWorkerHelper.getInstance(); List arrlist = new ArrayList(); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/gla", "root", "root"); Statement st=con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE); ResultSet rs=st.executeQuery("SELECT * FROM user_start2 where date='"+date+"' "); while(rs.next()){ arrlist.add(rs.getString("data")); } InputStream is=null; for(int i=0;i<int…
has comment: http://stackoverflow.com/comment/31844103
type: UnansweredQuestion
has title: Xmlworker displaying garbage/??? instead of hindi font
linked to: http://stackoverflow.com/q/20966185
answer count: 0
tagged with: java
tagged with: itext
tagged with: html-parsing
type: Question
tagged with: xhtml2pdf

http://stackoverflow.com/comment/31700446
type: AnswerComment
has text: Looking into the garbage collector more, the versions of the code that use arraycopy run the gc 5 or 6 more times when encrypting the array than just XOR. Does that sound like a reasonable explanation for the increased speed, and why does the gc run more, I'm making one new array and discarding one array either way?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21072876

http://stackoverflow.com/a/21171377
accepted answer of: http://stackoverflow.com/q/21053429
answers question: http://stackoverflow.com/q/21053429
score: 0
has body: Here in this working example, MessageEntry stands for Message and linf stands for group: DBCollection myColl = ds.getCollection(MessageEntry.class); DBObject key = new BasicDBObject("linf",true); DBObject initial = new BasicDBObject("cnt",true); String reduce = "function(item,prev){prev.cnt+=1;}"; DBObject group = myColl.group(key, null, initial, reduce); HashMap&lt;String,Long&gt; ret = new HashMap(); for(String k:group.keySet()){ BasicDBObject l = (BasicDBObject) group.get(k); DBRef dbRef = (DBRef) l.get("linf"); Linf linf = ds.get(Linf.class,dbRef.getId() ); Double cnt = (Double) l.get("cnt"); ret.put(linf.limad,cnt.longValue()); } return ret;
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/21084065
has comment: http://stackoverflow.com/comment/31712728
favorite count: 0
has comment: http://stackoverflow.com/comment/31712866
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31713102
has body: I have a jsp page that accepts data to be added in the database but whenever i refresh the page it process again the data and the problem is that when i refresh the page the data input will be saved again in the database. How can i clear the current data that is being sent to the servlet? when i refresh the page this pops out "The page you're looking for used information that you entered. Returning to that page might cause any action you took to be repeated. Do you want to continue?".
has comment: http://stackoverflow.com/comment/31713435
has comment: http://stackoverflow.com/comment/31712904
has comment: http://stackoverflow.com/comment/31713134
tagged with: java
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/31712831
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31712941
tagged with: jsp
has answer: http://stackoverflow.com/a/21084162
answer count: 1
has comment: http://stackoverflow.com/comment/31714930
has comment: http://stackoverflow.com/comment/31713148
has title: Clear data when refresh the JSP page

http://stackoverflow.com/comment/31829745
type: AnswerComment
has text: Okay, and how should I rewrite the AuthentificationListener.java to handle this kinds of errors on the failure handler? After fixing this I wanted to use this handler to control login attemps updating the number of attempts. But that's another story. Thanks for the help!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21145809

http://stackoverflow.com/comment/31740834
type: AnswerComment
type: Comment
has text: No worries. Also, for the last line, you could be tempted to write `List<String> list = Arrays.asList(arr);` but that would create an unmodifiable `List`. It would compile, but once you tryed adding an element, say, by `list.add("hello")`, then an Exception would be thrown. It is a common pitfall everybody comes across sooner or later
score: 0
comment on: http://stackoverflow.com/a/21098144

deserialization
type: Tag
tags question: http://stackoverflow.com/q/21032831
tags question: http://stackoverflow.com/q/21048800
tags question: http://stackoverflow.com/q/21110555
tag name: deserialization
tags question: http://stackoverflow.com/q/21158605
tags question: http://stackoverflow.com/q/21140055
tags question: http://stackoverflow.com/q/21064418
tags question: http://stackoverflow.com/q/21064003
tags question: http://stackoverflow.com/q/21049511

http://stackoverflow.com/q/21037104
type: Question
has comment: http://stackoverflow.com/comment/31626434
has comment: http://stackoverflow.com/comment/31626534
has comment: http://stackoverflow.com/comment/31626396
has comment: http://stackoverflow.com/comment/31626535
has answer: http://stackoverflow.com/a/21037325
answer count: 3
score: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/21037190
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/21037190
has answer: http://stackoverflow.com/a/21037280
accepted answer: http://stackoverflow.com/a/21037325
tagged with: utf-8
has title: Can I store special symbols in a String variable?
type: AnsweredQuestion
tagged with: netbeans
upvote count: 3
tagged with: java
has body: I have some 48 special symbols and want to store them in a string variable. Is it possible to do this? If yes, please provide me with the solution. I am using the NetBeans IDE. ♥ ♡ ❤ ♤ ♢ ♦ ♠ ♣ ♧ ❣ ❦ ❧ ☺ ✔ > ⌂ □ ☼ ✯ ✰ ◕ ◔ ♮ ♯ ❝ ❞ Δ ☾✽ ✾ ✿ ❁ ❃ ❋ ❀ ∞ → •♥• ¤ ø „ ★ • * + Ω = ◊ ≥ ‡ › … ¤ Above are the special symbols which i want to store, when i try it looks, public String symbols = "? ? ? ? ? ? ? ? ? ? ? ? ? ? > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? •?• ¤ ø „ ? • * + ? = ? ? ‡ › … ¤"; This is my code: StringBuilder tweetText = new StringBuilder(); if(count_symbol &gt; 50) { count_symbol = 0; } String symbol_array[] = symbols.split(" "); tweetText.append(symbol_array[count_symbol]); tweetText.append(" "); count_symbol++; Please provide some solution.
has comment: http://stackoverflow.com/comment/31626412

http://stackoverflow.com/comment/31705694
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21080252
type: Comment
has text: I put the real code there - some stuff are in another language though.

http://stackoverflow.com/q/21176740
accepted answer: http://stackoverflow.com/a/21176757
type: AnsweredQuestion
tagged with: versioning
tagged with: java
type: Question
answer count: 1
downvote count: 0
has body: Consider this, we have a set of APIs to be released and that are most likely to be re-designed from bottom up in the future, would leaving the versioning at package level for backward compatibility so that users can always get the latest release without worrying about breaking their codes better than to release different library versions where backward compatibility is not always guaranteed if users are not sticking to a certain released version? e.g. MyClass-LATEST.jar, which has package MyClass.v1; and then in the future provide package MyClass.v2; while keeping MyClass.v1 in the same library MyClass-LATEST.jar as oppose to releasing MyClass-vX.X-RELEASE.jar... Cheers
favorite count: 0
tagged with: release-management
has answer: http://stackoverflow.com/a/21176757
score: 1
upvote count: 1
has title: Any Pros and Cons when leaving versions inside APIs?

http://stackoverflow.com/a/21135483
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21135391
has body: I think it can be safer to user a Timer and a TimerTask to achieve this. Then you can program the execution every 3s and check for condition before each.
downvote count: 0

http://stackoverflow.com/comment/31826249
type: AnswerComment
score: 0
type: Comment
has text: when i moved getIntent().getExtras().getInt() to the onCreate he told me on the onclick method A2 cannot be resolved to a variable
comment on: http://stackoverflow.com/a/21146018

http://stackoverflow.com/a/21061131
has comment: http://stackoverflow.com/comment/31669976
has body: ListIterator&lt;Employee&gt; iterator = oldEmplist.listIterator(); while (iterator.hasNext()) { Employee x = iterator.next(); for (Employee y : newEmplist) { if (x.empOrigId == y.empId &amp;&amp; x.empOrigNumber == y.empNumber) { iterator.set(y); break; } } }
downvote count: 0
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/21061087
type: Answer

http://stackoverflow.com/q/21077064
tagged with: java
tagged with: methods
has comment: http://stackoverflow.com/comment/31699342
type: Question
has comment: http://stackoverflow.com/comment/31699290
has comment: http://stackoverflow.com/comment/31699233
tagged with: arraylist
score: 0
has title: Objects keep replacing one and other in Array List?
answer count: 1
has comment: http://stackoverflow.com/comment/31699356
has body: Im making a Shopping Cart for a java project and I'm having trouble adding multiple objects to my array list. My array is created in class Basket package store; import java.util.ArrayList; import java.util.Iterator; import javax.swing.Spring; public class Basket { private double totalPrice; public int orderNumber=1; private ArrayList&lt;Product&gt; basket = new ArrayList&lt;Product&gt;(); In this class i also have the method public ArrayList&lt;Product&gt; getBasket (){ return basket ; } In a seperate class where the user selects what item he wants and hits a button what creates a GolfBag(Sub class of Product Class). GolfBags gb = new GolfBags(1,productType, productPrice, productName, quantity, colour, size); b.getBasket().add(gb); System.out.println(b.getBasket()); int counter=b.getBasket().size(); System.out.println(counter); The first time i hit it, It displays the order correctly,however the second time I would expect it to show two of the same item as two objects should of been created and added however the counter displays the number to still be one and the order only appears once. Any help on this would be very grateful. To the comments about where the basket is created? Isnt it created in the line private ArrayList basket = new ArrayList(); ? addGolfBag.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Basket b = new Basket (); int productNumber = 0 ; String productName = null ; double productPrice = 0 ; String productType = "BAG"; int quantity = 0; String colour = null; String size = null; if (((String) golfBagOptions.getSelectedItem()) .equals("TaylorMade Juggernaut Cart Bag")){ productNumber=b.getOrderNumber(); productName="TaylorMade Juggernaut"; productPrice=(129*(Integer)golfBagQuanititySpinner.getValue()); quantity=(Integer)golfBagQuanititySpinner.getValue(); colour="BLUE"; size="LARGE"; } if (((String) golfBagOptions.getSelectedItem()) .equals("Mizuno Golf Rider Cart Bag")){ productNumber=b.getOrderNumber(); produc…
has answer: http://stackoverflow.com/a/21077155
has comment: http://stackoverflow.com/comment/31699320
tagged with: field
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31699447
has comment: http://stackoverflow.com/comment/31699237

http://stackoverflow.com/comment/31706005
type: Comment
score: 0
has text: My question is below the code block. And thank you, how would I go about storing the results?
type: QuestionComment
comment on: http://stackoverflow.com/q/21080426

http://stackoverflow.com/tag/csv
tags question: http://stackoverflow.com/q/21113865
type: Tag
tags question: http://stackoverflow.com/q/21147518
tag name: csv
tags question: http://stackoverflow.com/q/21048241
tags question: http://stackoverflow.com/q/21180552
tags question: http://stackoverflow.com/q/21130213
tags question: http://stackoverflow.com/q/21142217
tags question: http://stackoverflow.com/q/21045460
tags question: http://stackoverflow.com/q/21110139
tags question: http://stackoverflow.com/q/21145412
tags question: http://stackoverflow.com/q/21153533
tags question: http://stackoverflow.com/q/21023909
tags question: http://stackoverflow.com/q/21096862

http://stackoverflow.com/comment/31596998
score: 0
has text: @prabugp you're right, the threads seems not being released. I'm trying to figure out why, and this is what i'm asking :). If i remove atmosphere calls, threads are released normally without any leak
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21020819

http://stackoverflow.com/comment/31638136
has text: Thanks Paul, normalize-space() fixed it
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21044005
type: Comment

http://stackoverflow.com/comment/31695221
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21074537
has text: Ok then try @RobinDeCroon's answer

http://stackoverflow.com/a/21196561
has body: OK, the first step is just to write a faster MATLAB function. Save the new languages for later. I'm going to make the assumption that the board is full of valid guesses: that is, each entry is in [1, 9]. Now, what we're really looking for are duplicate entries in each row/column. To find duplicates, we sort. On a sorted row, if any element is equal to its neighbor, we have a duplicate. In MATLAB, the diff function does sliding pairwise differencing, and a zero in its output means that two neighboring values are equal. Both sort and diff operate on entire matrices, so no need for looping. Here's the code for the columnwise check: l=sum(sum(diff(sort(board)) == 0)); The rowwise check is exactly the same, just using the transpose. Now let's put that in a test harness to compare results and timing with the previous version: n = 9; % Generate a test board. Random integers numbers from 1:n board = randi(n, n); s = 1:n; K=1000; % number of iterations to use for timing % Repeat current code for comparison tic for k=1:K t=0; l=0; for i=1:n l=l+n-length(intersect(s,board(:,i)')); t=t+n-length(intersect(s,board(i,:))); end end toc % New code based on sort/diff for finding repeated values tic for k=1:K l2=sum(sum(diff(sort(board)) == 0)); t2=sum(sum(diff(sort(board.')) == 0)); end toc % Check that reported values match disp([l l2]) disp([t t2]) I encourage you to break down the sort/diff/sum code, and build it up on a sample board right at the command line, and try to understand exactly how it works. On my system, the new code is about 330x faster.
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21146693
downvote count: 0

http://stackoverflow.com/q/21168938
type: Question
tagged with: inline
tagged with: php
score: -1
tagged with: java
has answer: http://stackoverflow.com/a/21169011
tagged with: mysql
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31867223
has title: Ajax inline editing mysql results
accepted answer: http://stackoverflow.com/a/21169011
has body: I'm getting a list of rows from a MySQL query showing a list of usernames, and I need to be able to edit them inline using ajax, but with this script I'm using I can only edit the first one listed in the results, please HELP! I got these from a mysql result, 3 rows with usernames, and I can only edit inline the first one, but not the other: Username1: user1 Username2: user2 Username3: user3 This is my Custom JS script: $(document).ready(function() { //toggle `popup` / `inline` mode $.fn.editable.defaults.mode = 'inline'; //make username editable $('#username').editable({ //uncomment these lines to send data on server id: 'id', id2: 'id2', url: './ajax_editor.php' }); }); Please keep in mind that I need to be able to edit (inline) each username from the results individually Here is the JS and CSS source i'm using: THANKS
type: AnsweredQuestion
upvote count: 0
tagged with: jquery
favorite count: 0

http://stackoverflow.com/comment/31780278
type: Comment
score: 0
has text: The default layout manager of a JFrame is BorderLayout, which doesn't really care about the bounds you set on your JButton.
comment on: http://stackoverflow.com/q/21121002
type: QuestionComment

http://stackoverflow.com/q/21149149
has title: Algorithm for guessing letters of a name won't display certain letters and gets stuck between (I and R). How can I improve my algorithm?
has answer: http://stackoverflow.com/a/21150661
tagged with: java
type: Question
tagged with: algorithm
score: 0
answer count: 1
type: UnansweredQuestion
has body: The algorithm is suppose to ask the middle letter of the English alphabet, in my program its N. At this point it asks the user whether: The guess is correct The letter is earlier in the alphabet. The letter is later in the alphabet When trying to guess Jose, it will first ask about N. I choose option 2 which then gives me G. I then choose option 3 which then gives me Q. I then choose option 2 which then gives me I. I then choose option 3 which then gives me R. If I choose option 2, it gives me R again, and basically I'm stuck between R and I. How can I fix my algorithm to properly provide all letters available? My code is the following: int let = 26/2; if(n != 0) { //Correct guess if(n == 3) { aLetter = alphabet[let]; actualLetter = Character.toString(aLetter); aName.add(actualLetter); } //earlier in alphabetical order else if(n == 2) { let /= 2; } //later in alphabetical order else if(n == 1) { for(int i = let; i &lt; 27; i++){ r += 1; } r /= 2; let += r; r=0; } } //done guessing else if (n == 0) { for(String str: aName) { result3 += str; } } Any help and or advice would be great. Thanks!

http://stackoverflow.com/q/21161897
answer count: 6
has comment: http://stackoverflow.com/comment/31854312
has answer: http://stackoverflow.com/a/21161937
has answer: http://stackoverflow.com/a/21161981
has answer: http://stackoverflow.com/a/21162122
has answer: http://stackoverflow.com/a/21161945
downvote count: 0
tagged with: replaceall
tagged with: string
has title: Whats wrong with this replaceAll()?
favorite count: 0
has body: The output I get is once the value of x is printed and remaining two println prints blank lines. 1.234.567,89 Process finished with exit code 0 What am I doing wrong? public class Dummy { public static void main(String args[]) { String x = "1.234.567,89 EUR"; String e = " EUR"; x = x.replaceAll(" EUR",""); System.out.println(x); x = x.replaceAll(".", ""); System.out.println(x); x = x.replaceAll(",","."); System.out.println(x); //System.out.println(x.replaceAll(" EUR","").replaceAll(".","").replaceAll(",",".")); } }
has answer: http://stackoverflow.com/a/21161934
possible better answer: http://stackoverflow.com/a/21161937
accepted answer: http://stackoverflow.com/a/21161934
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31854366
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21161961

http://stackoverflow.com/q/21079881
has comment: http://stackoverflow.com/comment/31704616
favorite count: 0
has body: I am writing a piece of code in java, part of this code deals with handling python code. I was just interested if anyone has come across a way of checking if the python code is syntactically correct during runtime. I don't actually need to run the python code, as i'm writing a program that generates small snippets of it for teaching purposes as part of a project. Is using a system commands the only way to achieve this?
accepted answer: http://stackoverflow.com/a/21080176
tagged with: python
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
has title: Is it possible to check for correct python syntax of a given file/string from Java
type: Question
has answer: http://stackoverflow.com/a/21080176
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31704675

http://stackoverflow.com/q/21094498
accepted answer: http://stackoverflow.com/a/21094787
has title: How to set the PATH environment variable for JVM
linked to: http://stackoverflow.com/q/9132987
upvote count: 3
answer count: 2
tagged with: java-7
possible better answer: http://stackoverflow.com/a/21094766
tagged with: jvm
has answer: http://stackoverflow.com/a/21094787
favorite count: 0
tagged with: path
tagged with: maven
has answer: http://stackoverflow.com/a/21094766
has body: I am trying to run executables which are installed on my system with the Java 7 ProcessBuilder. I noticed that the environment variable PATH, which is available via System.getenv("PATH"); does not include my own, custom set path. It returns this: /usr/bin:/bin:/usr/sbin:/sbin My path looks like this: /Users/saschaf/.bin:/Users/saschaf/Entwicklung/spring-roo-1.2.4.RELEASE/bin:/usr/local/opt/ruby/bin:/usr/local/bin:/Users/saschaf/Entwicklung/android-sdk-macosx/tools:/Users/saschaf/Entwicklung/android-sdk-macosx/platform-tools:/usr/local/share/npm/bin:/Users/saschaf/node_modules/.bin:/Users/saschaf/Entwicklung/git/tools:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin I don't know how to set the PATH variable so that the JVM uses the correct one. Whats the problem here? I am running the latest OS X Mavericks, JDK 1.7.0_25-b15, Maven Apache Maven 3.1.1.
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
score: 3
has comment: http://stackoverflow.com/comment/31731244

http://stackoverflow.com/a/21035040
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21034883
score: 1
has body: Here is a Thread version. A Timer would be the way to go but if you really want to use your own thread. new Thread(new Runnable() { @Override public void run() { try { long before, sleepDuration, operationTime; for(int i=0;i&lt;100;i++) { before = System.currentTimeMillis(); // do your operations operationTime = (long)(1500*Math.random()); System.out.print("Doing operations for "+operationTime+"ms\t"); Thread.sleep(operationTime); // sleep for up to 1000ms sleepDuration = Math.min(1000, Math.max(1000 - (System.currentTimeMillis() - before), 0)); Thread.sleep(sleepDuration); System.out.println("wait\t"+sleepDuration+"ms =\telapsed " + (operationTime+sleepDuration) + (operationTime &gt; 1000 ? "&lt;" : "")); } } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }).start();
accepted answer of: http://stackoverflow.com/q/21034883
has comment: http://stackoverflow.com/comment/31623206
has comment: http://stackoverflow.com/comment/31623115
type: Answer
has comment: http://stackoverflow.com/comment/31623319
upvote count: 1
has comment: http://stackoverflow.com/comment/31622948
has comment: http://stackoverflow.com/comment/31623155
has comment: http://stackoverflow.com/comment/31622927

http://stackoverflow.com/q/21148018
has answer: http://stackoverflow.com/a/21148228
score: 0
has answer: http://stackoverflow.com/a/21148066
tagged with: android
answer count: 4
has title: Setting margin on an ImageView
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21148066
has body: I'm trying to set the imageview's layout_marginTop to one value for different density/screen sizes. In my values-mdpi folder I have the following line in dimensions.xml 10dp In the MainActivity ImageView image = (ImageView) findViewById(R.id.s_image); But there is no setmargin method for imageview. Is there a way to do this?
has answer: http://stackoverflow.com/a/21148138
type: Question
tagged with: java
possible better answer: http://stackoverflow.com/a/21148138
has answer: http://stackoverflow.com/a/21148189

http://stackoverflow.com/a/21129158
upvote count: 2
has comment: http://stackoverflow.com/comment/31795477
score: 2
downvote count: 0
type: Answer
has body: As Jitesh already explained I just want to add a little point to remove some confusions. From the name of ImageButton we may think that it is a subclass of Button class (Like textview is to View class). That's why this problem may occur from misconception. As we know we can cast a subclass to it's super class. But ImageButton is not a subclass (neither direct nor indirect) of Button class So you cannot do the casting like you did. Here a ClassCastException is occuring.
answers question: http://stackoverflow.com/q/21129082

http://stackoverflow.com/comment/31666952
type: AnswerComment
has text: Nit Pick - This is a personal thing, but I can't stand the use of `JOptionPane` in this manner, as it doesn't actually teach anything about how to actually make a GUI - but that's just me
score: 0
comment on: http://stackoverflow.com/a/21059482
type: Comment

http://stackoverflow.com/a/21046633
score: 1
downvote count: 0
has body: Should the constructor split the string and trim element before storing the property Should the constructor simply store the property and each time the getter is called, the property should be split Should the getter check the property and if its a string, split it and then store the value for future calls to getter not have to ... I'll address each of these individually. With this approach, you do all of your initialization when the class is being created. This is generally good practice, and it allows your class definition (what fields there are) to really match what the class should be. With this approach, your constructor is simple, but now your getter becomes complicated and your class definition is now not as clear. You have to explain in a comment somewhere that property.split(",")[4] is something specific This is way more complicated logic for something like this than needed. Please don't do this In conclusion, #1 seems like the best solution to me.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21046446

gemfire
tags question: http://stackoverflow.com/q/21122128
type: Tag
tag name: gemfire

http://stackoverflow.com/a/21027263
has comment: http://stackoverflow.com/comment/31608454
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21027097
upvote count: 2
answers question: http://stackoverflow.com/q/21027097
type: Answer
score: 2
downvote count: 0
has body: I would suggest looking into ContentProviders and Loaders (specifically a CusorLoader). Combining these with a CursorAdapter, you can use the ContentProvider which inserts/deletes/updates your sqlite database and notifies your loader to reload it's dataset and update the CursorAdapter/ListView.

http://stackoverflow.com/a/21055829
has comment: http://stackoverflow.com/comment/31661077
has comment: http://stackoverflow.com/comment/31660489
has body: You are using a raw Iterator. Either you need to cast to Staff the Object returned by it.next() or use a generic Iterator. Using a raw iterator : Staff staffMember = (Staff)it.next(); Using a generic iterator (I recommend this version) : Iterator&lt;Staff&gt; it = staffList.iterator(); Staff staffMember = it.next(); //you can keep this
type: Answer
score: 6
upvote count: 6
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21055807
answers question: http://stackoverflow.com/q/21055807

http://stackoverflow.com/comment/31597091
type: Comment
type: QuestionComment
has text: How are you going to use this regex? Do you want to `find` this brackets? Does regex have to `match` entire string? Are brackets always at start and end of your string? Also, can we see what have you tried to solve this?
comment on: http://stackoverflow.com/q/21021219
score: 0

http://stackoverflow.com/a/21130669
has body: if you are using the below code height method has to be recursive to get the height, but you have implemented in balance method i guess which is wrong. max(height(root.leftChild), height(root.rightChild)) + 1; or else you have to setHeight(AVLNode) every time you insert or delete.
type: Answer
answers question: http://stackoverflow.com/q/21122999
score: 0

http://stackoverflow.com/comment/31844014
has text: http://stackoverflow.com/questions/20966185/getting-hindi-to-display-on-pdf-created-with-jsp/20966668#20966668
score: 0
comment on: http://stackoverflow.com/q/21155648
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21048159
score: 1
has body: Something like: var myString = "&lt;%= obj.getMyString() %&gt;"; localStorage.setItem("myString", myString); //Saves to localStorage To retrieve it from local storage (may be in other script or page in the same domain): var myString = localStorage.setItem("myString"); alert(myString); //Shows it Hope this helps. Cheers.
upvote count: 1
answers question: http://stackoverflow.com/q/21048081
type: Answer
downvote count: 0

http://stackoverflow.com/q/21085933
downvote count: 2
score: -2
answer count: 1
accepted answer: http://stackoverflow.com/a/21086538
tagged with: guava
tagged with: java
has comment: http://stackoverflow.com/comment/31715887
has body: I have a scenario where in, i need to find intersection of two sets based on a specific field(only color in this case) from the objects contained in the set. Hence I am trying to find a intersection, subtraction of two Sets(which use a comparator that uses the color of the object to decide on equality of 2 car objects) by using google's Guava. But strangely A intersection B is not equal to B intersection A. Please help me find where it is going wrong. why is A intersection B not equal to B intersection A? I am interested in intersection part only. public class Car { public String id; public String color; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((color == null) ? 0 : color.hashCode()); result = prime * result + ((id == null) ? 0 : id.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; Car other = (Car) obj; if (color == null) { if (other.color != null) return false; } else if (!color.equals(other.color)) return false; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } public Car(String id, String color) { super(); this.id = id; this.color = color; } public Car() { super(); } } import java.util.Comparator; import java.util.Set; import java.util.TreeSet; import com.google.common.collect.Sets; public class Tester { public static void main(String[] args) { final Set&lt;Car&gt; first = new TreeSet&lt;Car&gt;( new Comparator&lt;Car&gt; (){ public int compare( final Car o1, final Car o2 ){ return comp(o1.getColor(), o2.getColor() ); } } ); first.add(new Car("1","blue")); first.add(new Car("2","green")); first.add(new Car("3","red")); final …
upvote count: 0
has answer: http://stackoverflow.com/a/21086538
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31755465
has comment: http://stackoverflow.com/comment/31715941
has title: Guava's Sets.Intersection method misbehaving
favorite count: 0
has comment: http://stackoverflow.com/comment/31715848
type: Question

http://stackoverflow.com/comment/31778735
has text: Is `return compute_speed(3, 1).equals(3) || compute_speed(1, 3).equals(3);` sufficient for your needs? Admittedly, as the number of parameters increases it gets unwieldy...
comment on: http://stackoverflow.com/q/21120003
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21021136
has answer: http://stackoverflow.com/a/53417708
has answer: http://stackoverflow.com/a/25151930
has answer: http://stackoverflow.com/a/21021973
has comment: http://stackoverflow.com/comment/31597250
has comment: http://stackoverflow.com/comment/31598264
has comment: http://stackoverflow.com/comment/31596910
answer count: 15
has comment: http://stackoverflow.com/comment/31597041
score: 39
has answer: http://stackoverflow.com/a/42883180
type: UnansweredQuestion
has title: Tomcat starts but home page cannot open with url http://localhost:8080
has answer: http://stackoverflow.com/a/65781583
has comment: http://stackoverflow.com/comment/69682869
has comment: http://stackoverflow.com/comment/31596907
has answer: http://stackoverflow.com/a/50284361
has comment: http://stackoverflow.com/comment/31597125
has comment: http://stackoverflow.com/comment/31596935
tagged with: java
has answer: http://stackoverflow.com/a/21023118
has comment: http://stackoverflow.com/comment/31597130
has answer: http://stackoverflow.com/a/48283206
has comment: http://stackoverflow.com/comment/31596919
type: Question
has comment: http://stackoverflow.com/comment/31599803
has answer: http://stackoverflow.com/a/21133380
has answer: http://stackoverflow.com/a/21021212
linked to: http://stackoverflow.com/q/18122336
has answer: http://stackoverflow.com/a/45055091
downvote count: 0
has answer: http://stackoverflow.com/a/58235260
has answer: http://stackoverflow.com/a/52757925
has answer: http://stackoverflow.com/a/41091627
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/53836667
upvote count: 39
has body: I am a newbie in Java, and I am trying to develop a web application. I have Windows 7 32 bit. I have installed Java 7 and set the path and classpath as well. After that I installed Tomcat 7. When I try to open tomcat home page using URL localhost:8080, it does not open and Tomcat stops automatically. Please help me.

http://stackoverflow.com/comment/31618053
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21031266
has text: "..Now every user can copy the application jar to his local disk, edit jaas.conf, and set his own LoginModule which would allow him to act as different user. .." can you explan me the meaning of this sentence?

http://stackoverflow.com/q/21136302
has answer: http://stackoverflow.com/a/21136731
has title: FindBugs error: Write to static field from instance method
tagged with: java
type: Question
has body: I have couple of areas in my application where I get the error while manipulating value of static variable from instance method. "Write to static field from instance method". If we take multi-threading out of the equation, does this scenario pose any potential issue even if multiple instances write to the same static variable ?
linked to: http://stackoverflow.com/q/610458
tagged with: findbugs
accepted answer: http://stackoverflow.com/a/21136731
linked to: http://stackoverflow.com/q/3630485
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31807959
favorite count: 0
score: 8
tagged with: static
upvote count: 8
has comment: http://stackoverflow.com/comment/31807810
type: AnsweredQuestion
tagged with: code-analysis

http://stackoverflow.com/comment/35686284
score: 6
type: Comment
has text: Filepath for mac (jdk8): /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/security/java.policy
type: AnswerComment
comment on: http://stackoverflow.com/a/21238953

http://stackoverflow.com/a/21077214
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/31702330
has comment: http://stackoverflow.com/comment/31736218
downvote count: 0
has comment: http://stackoverflow.com/comment/31735922
type: Answer
has comment: http://stackoverflow.com/comment/31702032
has body: Casting to int always truncates towards 0. To round, you can use Math.round() instead. However, that always rounds halves up: class Test { public static void main(String[] args) { System.out.println(Math.round(-7.7)); // -8 System.out.println(Math.round(-7.5)); // -7 System.out.println(Math.round(-7.2)); // -7 System.out.println(Math.round(+7.2)); // 7 System.out.println(Math.round(+7.5)); // 8 System.out.println(Math.round(+7.7)); // 8 } } Are you sure you want to round halves away from zero? If so, Math.round() won't quite do what you want. You could write your own method though: public static long customRound(double x) { return x &gt;= 0 ? (long) (x + 0.5) : (long) (x - 0.5); } This will always round away from zero, by either adding or subtracting 0.5 first (depending on the sign) and then truncating towards 0. That produces the same values as before, except that -7.5 is rounded to -8. EDIT: I suspect the remaining problem is almost certainly due to the division being performed in integer arithmetic. We don't know the types of any of your values, but I suspect they're all int, which would lead to that problem. If you make either of the operands of the division double, it will perform the division in double arithmetic instead. The easiest way to do that - which would also increase readability - is probably to extract some of the expressions to separate variables, and cast where necessary: double xDifference = e.getX() - Frame.x; double widthRatio = Screen.myWidth / (double) World.worldWith; double x = (xDifference / widthRatio) - 8; Player.targetx = (int) Math.round(x); If that still doesn't work, at least you'll have a much easier time seeing what's wrong.
has comment: http://stackoverflow.com/comment/31701970
answers question: http://stackoverflow.com/q/21077151

http://stackoverflow.com/a/27749334
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21182230
has body: I know it's a bit late for an answer, but better late than never: If you carefully read the article you will find out that probably your design is wrong: http://misko.hevery.com/2008/08/01/circular-dependency-in-constructors-and-dependency-injection/ Setter injection will only hide it from you.
upvote count: 1

http://stackoverflow.com/comment/31648300
has text: @TimB Hmm, probably didn't save it. Updated again, do you see it now?
comment on: http://stackoverflow.com/q/21048962
score: 0
type: QuestionComment
type: Comment

casting
tags question: http://stackoverflow.com/q/21150903
tags question: http://stackoverflow.com/q/21032017
tags question: http://stackoverflow.com/q/21103932
tags question: http://stackoverflow.com/q/21105153
tags question: http://stackoverflow.com/q/21149279
tag name: casting
type: Tag
tags question: http://stackoverflow.com/q/21090027
tags question: http://stackoverflow.com/q/21155624
tags question: http://stackoverflow.com/q/21124310
tags question: http://stackoverflow.com/q/21041148
tags question: http://stackoverflow.com/q/21128836
tags question: http://stackoverflow.com/q/21122563
tags question: http://stackoverflow.com/q/21027139
tags question: http://stackoverflow.com/q/21020261

http://stackoverflow.com/comment/31762285
score: 0
type: Comment
has text: You **can** instantiate `static` inner classes. `static` in that case means it has no reference to it's parent class/object.
comment on: http://stackoverflow.com/a/21094836
type: AnswerComment

http://stackoverflow.com/tag/r
tags question: http://stackoverflow.com/q/21030506
tag name: r
tags question: http://stackoverflow.com/q/21165353
type: Tag
tags question: http://stackoverflow.com/q/21086383

http://stackoverflow.com/a/21089254
answers question: http://stackoverflow.com/q/21089174
score: 0
type: Answer
has body: You have to consider dropped connections here as well as stress on the server. You would be better using a connection pool to manage your connections then you don't have this worry.

http://stackoverflow.com/a/21059983
has body: The map key is a Date, you'll have to fix this line: Date date = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH).parse(st.nextToken()); mapInFile.put(date, Arrays.asList(st.nextToken().split(" ,"))); Note that you can use multiple delimiters when you split the right hand side string.
has comment: http://stackoverflow.com/comment/31667863
downvote count: 0
answers question: http://stackoverflow.com/q/21059945
has comment: http://stackoverflow.com/comment/31667957
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31667774
has comment: http://stackoverflow.com/comment/31667844
has comment: http://stackoverflow.com/comment/31667846

http://stackoverflow.com/q/21146824
has comment: http://stackoverflow.com/comment/31840285
accepted answer: http://stackoverflow.com/a/21148590
answer count: 2
score: 2
possible better answer: http://stackoverflow.com/a/21153730
linked to: http://stackoverflow.com/q/8715807
downvote count: 0
has answer: http://stackoverflow.com/a/21153730
has body: I have an application which uses JTextPane basically as a multi line label that can center text and wrap it automatically (centering is the reason I don't use a lighter component, but JTextArea would have the same issue). It is used as a part of a larger entity, which should use one tooltip for it. However, setting the tooltip for the containing component does not work for the JTextPane. Other components show the tooltip as intended. SSCCE: import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextPane; import javax.swing.SwingUtilities; import javax.swing.text.BadLocationException; public class ToolTipTest { ToolTipTest() { JFrame frame = new JFrame("Tool tip test"); frame.setLocationByPlatform(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel bg = new JPanel(new BorderLayout()); frame.add(bg); bg.add(new JLabel("Tooltip shows here"), BorderLayout.NORTH); JTextPane text = new JTextPane(); try { text.getStyledDocument().insertString(0, "Lorem ipsum dolor sit" + " amet, consectetur adipiscielit, sed eiusmod tempor" + " incidunt ut labore et dolore magna aliqua.", null); } catch (BadLocationException e) { e.printStackTrace(); } text.setEditable(false); text.setFocusable(false); bg.add(text); bg.setToolTipText("A tooltip, that should show on both the label and the text"); // Works, but is ugly and results in visible change in tooltip when // moving cursor between components // text.setToolTipText("A tooltip, that should show on both the label and the text"); frame.pack(); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new ToolTipTest(); } }); } } On the above sample the tooltip is displayed on the JLabel, but not on the JTextPane. I am currently setting the same tool tip text for the text pane as a workaround, but this results in a visible switch between tooltips when the user moves …
has comment: http://stackoverflow.com/comment/31827618
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/31829199
has comment: http://stackoverflow.com/comment/31829737
type: AnsweredQuestion
has title: Showing the tooltip of the parent component on JTextPane
has answer: http://stackoverflow.com/a/21148590
tagged with: java
tagged with: jtextpane
tagged with: swing
type: Question
tagged with: tooltip
has comment: http://stackoverflow.com/comment/31827818

http://stackoverflow.com/comment/31836458
type: QuestionComment
has text: I don't really see the issue.
score: 2
comment on: http://stackoverflow.com/q/21151564
type: Comment

http://stackoverflow.com/q/21038391
has comment: http://stackoverflow.com/comment/31628743
has comment: http://stackoverflow.com/comment/31648275
linked to: http://stackoverflow.com/q/21010799
type: UnansweredQuestion
tagged with: jbutton
has comment: http://stackoverflow.com/comment/31629073
has comment: http://stackoverflow.com/comment/31629312
tagged with: java
tagged with: swing
has title: Inset's not resettings
type: Question
tagged with: gridbaglayout
has answer: http://stackoverflow.com/a/21038619
has body: for some reason my insets aren't resetting after I set the values back to 0. My intention is to move one button, for example, to the left 200 pixels, an then reset that straight after so that any other components are not moved 200 pixels. The problem being that even though I redefine my insets as being 0,0,0,0 both components are being moved. Thank's for any answers! Here's the code that I use to initiate the JPanel that has the problem : import java.awt.BorderLayout; import java.io.IOException; import javax.swing.JComponent; import javax.swing.JFrame; public class MainFrame { public static void main(String[] args) throws IOException { MainFrame gui = new MainFrame(); gui.Frame(); } public JFrame Frame() throws IOException { JFrame frame = new JFrame(""); PlayGamePanel passme = new PlayGamePanel(); JComponent panel2 = passme.GamePanel2(frame); frame.add(panel2); frame.getContentPane().add(BorderLayout.CENTER, panel2 ); frame.setSize(860,500); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.setVisible(true); frame.getContentPane().add(panel2, BorderLayout.CENTER); return frame; } } Here's my code that has the inset problem : import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.image.BufferedImage; import javax.swing.BorderFactory; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JLabel; @SuppressWarnings("serial") public class PlayGamePanel extends JComponent{ JComponent GamePanel2() throws IOException { JComponent GamePanel = new JLabel(); //Setting up the GridBagLayout GamePanel.setLayout(new GridBagLayout()); GridBagConstraints gbLayout = new GridBagConstraints(); //Creating the buttons + setting up the GridBagConstraints gbLayout.insets = new Insets(300, 350, 0, 450); JButton AnswerOneButton = new JButton("") GamePanel.add(AnswerOneButton, gbLayout); gbLayout.insets = new Insets(…
has comment: http://stackoverflow.com/comment/31629270
score: 0
answer count: 1

http://stackoverflow.com/comment/31847450
type: QuestionComment
type: Comment
has text: If it has `-` in it, it's not a number.
score: 1
comment on: http://stackoverflow.com/q/21158004

http://stackoverflow.com/q/21096837
favorite count: 0
upvote count: 12
has answer: http://stackoverflow.com/a/26216141
has body: I'm having the jee7 web api as dependency. I can start my app on tomcat application successfully, but what does the following "offending class" statements tell me? Do I have to take any actions? Jan 13, 2014 5:47:47 PM org.apache.catalina.loader.WebappClassLoader validateJarFile Information: validateJarFile(C:\Users\me\Servers\apache-tomcat-7.0.50\wtpwebapps\app\WEB-INF\lib\el-api-2.2.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class Jan 13, 2014 5:47:47 PM org.apache.catalina.loader.WebappClassLoader validateJarFile Information: validateJarFile(C:\Users\me\Servers\apache-tomcat-7.0.50\wtpwebapps\app\WEB-INF\lib\javaee-web-api-7.0.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class pom.xml javax javaee-web-api 7.0
score: 11
has answer: http://stackoverflow.com/a/25780717
answer count: 4
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/25780717
has answer: http://stackoverflow.com/a/21096871
accepted answer: http://stackoverflow.com/a/21096871
type: Question
has comment: http://stackoverflow.com/comment/31738410
tagged with: tomcat
has comment: http://stackoverflow.com/comment/31736922
has title: What does offending class tell me on server startup?
downvote count: 1
has comment: http://stackoverflow.com/comment/31735896
has answer: http://stackoverflow.com/a/31342449

http://stackoverflow.com/a/21125339
type: Answer
has body: The easiest solution might be to not use threads, but i doubt that is what you want. What you might be looking for is the concept of locks: A method may acquire the lock associated with an object by calling: synchronized(nameOfTheLockObject) { //do some code here } This acquires the lock of the given Object, executes the code and releases the lock afterwards. If the lock is already acquired by another method/thread, the code pauses until the lock is released by the other method/thread. You can also add the synchronized statement to methods of a class to make them acquire the lock of the parent object. More Information on this is given at: http://docs.oracle.com/javase/tutorial/essential/concurrency/locksync.html
upvote count: 9
score: 9
downvote count: 0
answers question: http://stackoverflow.com/q/21124879
has comment: http://stackoverflow.com/comment/68515198

http://stackoverflow.com/comment/31892968
has text: For spring you could use the [Spring tool suite](http://spring.io/tools/eclipse), you can install it either as plugin to your existing eclipse or get a bundle including eclipse from the spring site.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21182539

http://stackoverflow.com/comment/31738753
score: 0
type: Comment
has text: @ScottBarta Without those errors I don't know how I would get to the screen shown in the screenshot (Project libraries settings?). What's the right way to get there?
comment on: http://stackoverflow.com/a/21086904
type: AnswerComment

http://stackoverflow.com/a/24615475
score: 0
answers question: http://stackoverflow.com/q/21145261
type: Answer
has body: I am not an Android developer so this is a bit of a shot in the dark. Presumably since the behaviour is not consistent for other activities, but is triggered nonetheless by a completely trivial one, the issue is down to the time taken for onCreate to complete. If onCreate can complete before the pause/stop/destroy sequence is finished (and eventual garbage collection though it need not get quite to that point afaics) for the old activity then there really will be two instances present. A simple solution to prevent this is for the activity to have a static atomicboolean "ready" (initially false) that check before doing anything else in onCreate where you'd loop while(!ready.compareAndSet(false, true)) { //sleep a bit } then override the ondestroy lifecycle callback and invoke ready.compareAndSet(true, false) Apologies if this approach is utterly naive.
has comment: http://stackoverflow.com/comment/39504817
has comment: http://stackoverflow.com/comment/39504917

http://stackoverflow.com/comment/31701710
type: Comment
has text: Unfortunately, db is not null :P
comment on: http://stackoverflow.com/a/21078356
score: 0
type: AnswerComment

http://stackoverflow.com/a/21116703
has comment: http://stackoverflow.com/comment/31797917
accepted answer of: http://stackoverflow.com/q/21113759
downvote count: 0
answers question: http://stackoverflow.com/q/21113759
has comment: http://stackoverflow.com/comment/31899833
has body: Try and use "RSA/ECB/PKCS1Padding" instead of "RSA/ECB/NoPadding" or similar for the value of ALGO. The surrounding random looking characters are actually random padding bytes. Padding is an integral part of RSA encryption and should not be skipped. Note that the KeyPairGenerator should still use "RSA", the generator is not concerned with modes of encryption and/or padding modes.
score: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31975231
has comment: http://stackoverflow.com/comment/31815564
has comment: http://stackoverflow.com/comment/31971913
has comment: http://stackoverflow.com/comment/31806501
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/31909472

http://stackoverflow.com/comment/31891604
type: Comment
comment on: http://stackoverflow.com/a/21181974
score: 0
type: AnswerComment
has text: Thank you. That's the way I want to take.

http://stackoverflow.com/comment/71725451
comment on: http://stackoverflow.com/a/21180314
type: AnswerComment
type: Comment
has text: It is not good practice to change the settings behavior, because some frameworks are not expecting any return from setter method. Like for example, you will get an error with Cassandra Java driver if the setters in your model will return some values.
score: 1

http://stackoverflow.com/comment/31854131
has text: Get rid of the inner do-while loop.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21161816

http://stackoverflow.com/q/21045560
answer count: 1
has comment: http://stackoverflow.com/comment/31640783
has comment: http://stackoverflow.com/comment/31640822
accepted answer: http://stackoverflow.com/a/21045639
type: AnsweredQuestion
has title: How to upgrade a code from java 1.3 to 1.5
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/21045639
tagged with: upgrade
has body: I am a trainer and my project is to upgrade a transcompiler from Java 1.3 to 1.5, I am a beginner in Java and I want to khnow if there is a tool that will help me, I took the first step by reading the new features of 1.4 and 1.5 then we decided that I have to add this features : Generics - Metadata - Autoboxing - Enumerations - Var args - Enhanced for each loop. So if you can tell me what is the next step and if there is a tool that upgrade the code to a recent version ? thank you

http://stackoverflow.com/a/21104840
accepted answer of: http://stackoverflow.com/q/21104591
upvote count: 3
answers question: http://stackoverflow.com/q/21104591
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/31752051
downvote count: 0
has body: since getChildren() returns an ObservableList, shouldnt you be able to use the add(int index, E element) to add the element at your desired index?
score: 3

http://stackoverflow.com/comment/31752486
type: AnswerComment
comment on: http://stackoverflow.com/a/21105392
score: 0
type: Comment
has text: @HotLicks I've removed the NullPointerException part from the answer.

http://stackoverflow.com/a/21106415
has comment: http://stackoverflow.com/comment/31754195
score: 0
answers question: http://stackoverflow.com/q/21106044
has body: Add this dependency in your POM: org.apache.poi poi-ooxml 3.7 An InputStream in hasOOXMLHeader() method which supports either mark/reset, or is a PushbackInputStream
type: Answer
has comment: http://stackoverflow.com/comment/31765794

http://stackoverflow.com/comment/31817941
comment on: http://stackoverflow.com/q/21141529
has text: mainMenu.getGuests().add(newGuest); This is the line where the error was located
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31739606
type: AnswerComment
score: 0
type: Comment
has text: If you want simpleness you could give the NetBeans IDE a try; yes eclipse is a bit overloaded. BTW I use NotePad++ regularly and favour knowing what happens. But things like autocompletion, javadoc, JSE sources, integration of maven, vcs are unbeatable.
comment on: http://stackoverflow.com/a/21094715

http://stackoverflow.com/comment/31727148
type: Comment
has text: yes.. it s a tic tac toe game (wannabe :P).. .can you help me .. :/
score: 0
comment on: http://stackoverflow.com/q/21092302
type: QuestionComment

http://stackoverflow.com/q/21034606
has answer: http://stackoverflow.com/a/21034816
score: 0
answer count: 1
has body: When I use the load method in the session of abnormalities java.lang.ClassCastException: www.csdn.net.blank.bean.City_$$_javassist_0 cannot be cast to javassist.util.proxy.Proxy From api: You should not use this method to determine if an instance exists (use get() instead). Use this only to retrieve an instance that you assume exists, where non-existence would be an actual error. This version is not the load method for persistent objects?
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
has title: How to use session method load() in the hibernate-validator 4.3.0.Final
linked to: http://stackoverflow.com/q/42571072
type: Question
tagged with: session

http://stackoverflow.com/q/21087111
has answer: http://stackoverflow.com/a/21087238
has comment: http://stackoverflow.com/comment/31718026
tagged with: android
has answer: http://stackoverflow.com/a/21087290
answer count: 5
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21087260
tagged with: java
has answer: http://stackoverflow.com/a/21087355
has title: AutoCompleteTextView not working as expected
type: Question
has comment: http://stackoverflow.com/comment/31717955
has body: I am working on an application in which I am using AutoCompleteTextView and am facing few issues. Please find the details of the issues below. The following values are present in the data: 1) Manish Logan Jain 2) M. J. (Logan Fern) 3) Logan Issues: 1) When user searches for Manish, Manish Logan Jain is shown as a suggestion. But when user enters Logan Jain, then no results are returned. 2) When user enters Logan, I expect second value to be shown as suggestion, but currently, the suggestion lists shows nothing. 3) When user enters ogan, I expect suggestion 3 to be shown. Currently, its not shown. AutoCompleteView xml: AutoCompleteTextView android:id="@+id/autoCompleteTextView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:ems="10" android:hint="@string/enter_user_name" &gt; &lt;requestFocus /&gt; &lt;/AutoCompleteTextView&gt; Java code that populates the data: List&lt;String&gt; namesList = new ArrayList&lt;String&gt;(stops); namesList.add("Manish Logan Jain"); namesList.add("Logan"); namesList.add("M. J. (Logan Fern)"); ArrayAdapter&lt;String&gt; namesSuggestion = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_dropdown_item_1line, namesList); AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView1); textView.setAdapter(namesSuggestion); textView.setThreshold(1); Has someone faced similar issues? And if yes, then what are the possible solutions for this?
accepted answer: http://stackoverflow.com/a/21087355
tagged with: autocomplete
possible better answer: http://stackoverflow.com/a/21087238
has answer: http://stackoverflow.com/a/21087271
score: 0

http://stackoverflow.com/q/21061388
has comment: http://stackoverflow.com/comment/31675979
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/31679088
type: Question
has title: JDBC prepared statement UTF-8
score: 1
has comment: http://stackoverflow.com/comment/31672782
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/21066205
accepted answer: http://stackoverflow.com/a/21066205
has comment: http://stackoverflow.com/comment/31671861
tagged with: sql
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31671101
has comment: http://stackoverflow.com/comment/31671482
has comment: http://stackoverflow.com/comment/31673238
has comment: http://stackoverflow.com/comment/31671224
tagged with: jdbc
has body: Continuing my previous question https://stackoverflow.com/questions/21060720/jsp-upload-file-with-utf-8-encoding I discovered that when i do: String url = "jdbc:mysql://localhost:3306/crm2?useUnicode=yes&amp;characterEncoding=UTF-8"; Class.forName ("com.mysql.jdbc.Driver").newInstance (); connection = DriverManager.getConnection (url, MY_USERNAME, MY_PASSWORD); PreparedStatement pst = connection.prepareStatement(sql); . . . pst.setString(1, customer.getFullName()); . . . pst.executeUpdate(); I got the following SQL exception: 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 '(name = '?…?±?ˆ?§?†' As you can see i mentioned in the connection string too use encoding utf-8! looks like i have to do something else in the PST to insure using UTF-8? Thanks
tagged with: utf-8
has comment: http://stackoverflow.com/comment/31670792

http://stackoverflow.com/comment/31653194
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21037775
has text: [contd]-which will finally generate me a #newTable with all the updated columns right after I click the radio button. So its like this #firstTable having radioButton-> clicked->#importandDataColumn retrieved and saved->used #importantDataColumn value in JSP database connection-> queried from database->show result in a dynamic table that is generated after clicking radion button
score: 0

http://stackoverflow.com/comment/31883542
type: QuestionComment
type: Comment
has text: Yes,I understand that.Question is - how are you triggering multiple tests simultaneously?Grid would need to get parallel requests at the same time to execute tests in parallel.
comment on: http://stackoverflow.com/q/21141611
score: 0

http://stackoverflow.com/comment/31777106
comment on: http://stackoverflow.com/q/21118680
score: 0
has text: Thanks Sotirios, that really helped, want to put it as the answer?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21142075
type: Answer
score: 1
upvote count: 1
downvote count: 0
has body: In addition to Duncan's suggested improvements: Never ever use a password/String directly as a key! If you want to create a key based on a password use a "Password based key derivation function" - e.g. the standard is PBKDF2 (see for example this question: PBKDF2 with bouncycastle in Java).
answers question: http://stackoverflow.com/q/21125367

http://stackoverflow.com/comment/31649157
type: AnswerComment
score: 0
type: Comment
has text: Not sure if you fully understand my question, hehe. The String i have with two values is working as it should and the for loop loops two times. The problem is that circle number two won't show itself.
comment on: http://stackoverflow.com/a/21049642

http://stackoverflow.com/a/21138860
type: Answer
answers question: http://stackoverflow.com/q/21137561
has comment: http://stackoverflow.com/comment/31830038
downvote count: 0
has comment: http://stackoverflow.com/comment/31812821
has body: You are mixing JSF managed beans / concepts with CDI managed beans. First off you neglected to specify your container but I will write one answer for plain servlet container and one for a CDI enabled java application server such as TomEE / Wildfly / Glassfish. Use @Named and @SessionScoped but make sure you have the correct @SessionScoped. javax.enterprise.context is the package name. If you use the SessionScoped from JSF the bean will be dependent scoped and that's wrong. Now remove the filter and do a quick test with a test page. Set a field with &lt;h:inputText /&gt; and &lt;h:commandButton&gt; (both in a &lt;h:form&gt;). Make sure the value is still there after F5 and thus sucessfully @SessionScoped. If it does not work makes sure you are using CDI 1.1 or that you have beans.xml present accordingly to docs. Lastly use @Inject private TestBean testBean; Or if you have a plain container like Tomcat or Jetty you need to use Deltaspike Core and then: TestBean testBean = BeanProvider.getContextualReference(TestBean.class, false); good luck
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21137561

http://stackoverflow.com/a/21071683
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21071543
answers question: http://stackoverflow.com/q/21071543
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: ..any way I could make that move with the mouse once I've clicked on it? The main component needs a MouseListener. See How to Write a Mouse Listener for details. Preferably this image would replace the mouse cursor (though not mandatory). Look to the Cursor API for that. This sounds like a classic XY problem. What you might actually be looking for is Drag and Drop and Data Transfer.

http://stackoverflow.com/q/21069412
has answer: http://stackoverflow.com/a/21069616
accepted answer: http://stackoverflow.com/a/21069616
type: Question
tagged with: java-native-interface
linked to: http://stackoverflow.com/q/10165693
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31693923
score: 0
answer count: 1
has body: I'm having trouble with LPCXpresso IDE. I'm unable to launch it. Here is a part of the log file : java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: /home/fouge/.eclipse/org.eclipse.platform_4.2.0_470841845/configuration/org.eclipse.osgi/bundles/213/1/.cp/libswt-pi-gtk-4236.so: libgtk-x11-2.0.so.0: Ne peut ouvrir le fichier d'objet partagé: Aucun fichier ou dossier de ce type I found help saying I need to make a symbolic link : ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86/ # for 32-bit OS ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86_64/ # for 64-bit OS Like said on this post : Eclipse cannot load SWT libraries But the problem is I don't have /usr/lib/jni directory ! I'm running Ubuntu 13.10 The question should be where are SWT library files ?
type: AnsweredQuestion
has title: Eclipse-based IDE, LPCXpresso, doesn't launch because of SWT library not loaded
tagged with: java
tagged with: swt

http://stackoverflow.com/q/21034810
answer count: 2
tagged with: arrays
has answer: http://stackoverflow.com/a/21034975
score: 0
possible better answer: http://stackoverflow.com/a/21034972
tagged with: mode
tagged with: output
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21034972
tagged with: java
has body: I'm writing a program that takes 10 numbers as input and displays the mode of the numbers using parallel arrays and a method that takes an array of numbers as a parameter and returns the value that appears most often in the array. PROBLEM: However, when I run my program it has absolutely no output, also, I am not sure how to implement the parallel arrays. Does anyone know? Thank you. import java.util.Scanner; public class Mode { public static void main(String[] args) { } public int computeMode(int[] nums) { Scanner scanner = new Scanner(System.in); int maxValue = -1; int maxCount = 0; int x = 0; //count how many times nums[i] appears in array System.out.println("Enter 10 numbers: "); for (int i = 0; i &lt; 10; i++) { try { //try catch exception to catch decimal inputs as well as more /less than 10 integers x = scanner.nextInt(); } catch (Exception e) { System.out.println("Invalid input! Please reenter 10 integer values."); scanner = new Scanner(System.in); i = -1; continue; } for (i = 0; i &lt; nums.length; i++) { int count = 0; for (int j = 0; j &lt; nums.length; j++) { if (nums[j] == nums[i]) { count++; } } if (count &gt; maxCount) { maxValue = nums[i]; maxCount = count; System.out.println("The mode is: " + maxValue); } } } return maxValue; } }
accepted answer: http://stackoverflow.com/a/21034975
type: Question
tagged with: try-catch
has title: Finding the mode of an array: no output

http://stackoverflow.com/comment/32775355
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21112303
has text: When you do `myImageView.setImageResource(screenshots[j]);` is your j correct?
type: AnswerComment

http://stackoverflow.com/a/54851791
has body: follow the following your issue hopefully resolved First login into your gmail account then click on below path: google account in the security block, Just turned ON Allow less secure apps: ON Hope It will save your day..... Best of luck
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/21180966
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31790911
type: Comment
has text: @DavidKnipe: That won't run it on its own thread. If the goal were to run it on the same thread, you wouldn't use `Runnable`.
comment on: http://stackoverflow.com/a/21125753
score: 0
type: AnswerComment

http://stackoverflow.com/a/21034440
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/31622766
accepted answer of: http://stackoverflow.com/q/21034416
answers question: http://stackoverflow.com/q/21034416
has body: Your list is printing out backwards because later nodes created are placed at the head of the list, instead of at the back. I.E. head -&gt; Node1 becomes head -&gt; Node2 -&gt; Node1 and then head -&gt; Node3 -&gt; Node2 -&gt; Node1 Your iteration in printList is okay. In add, instead of placing the new Node at the head, you'll need to find the last Node (with next being null) and place the new Node there. I.e. head -&gt; Node1 becomes head -&gt; Node1 -&gt; Node2 Change your else (for when the list isn't empty) to: else { temp = head; // Get last item while (temp.next != null) { temp = temp.next; } // Point old last item to *new* last item temp.next = new Node(d, c, null); }
score: 0
has comment: http://stackoverflow.com/comment/31622073

http://stackoverflow.com/q/21161727
tagged with: java
type: Question
tagged with: joox
has answer: http://stackoverflow.com/a/21169756
downvote count: 0
has body: I've following xml: 4.0.0 com.sndbox joox-test 1.0.0 org.jooq joox 1.2.0 com.google.guava guava 15.0 Now I want to find version tag, but only on the root level of the document (project version = 1.0.0). When i use find("version") it works like xpath("//version") and returns tags from whole document, and I need equivalent of the xpath("version") method. Any ideas?
accepted answer: http://stackoverflow.com/a/21169756
has title: Returning first level tag in JOOX
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
upvote count: 2
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/31960980
score: 1
comment on: http://stackoverflow.com/a/21137608
type: AnswerComment
has text: @pinker depending on your intentions, I guess you either need to implement `mString` on your anonymous `TokenStream` instance, or to prefix `mString` like that: `XLexer.this.mString`
type: Comment

http://stackoverflow.com/comment/40388856
has text: This post should be helpful: [Read data from NFC tag (IsoDep)][1] [1]: http://stackoverflow.com/questions/16815007/read-data-from-nfc-tag-isodep
comment on: http://stackoverflow.com/q/21097489
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21042418
tagged with: mysql
downvote count: 1
type: Question
tagged with: java
score: 10
has body: I've in my database 100 000 addresses (that is records). Each one of them has its own coordinates (latitude and longitude). Now, given the geo location of the user (latitude and longitude), I want to show on a map only the addresses inside the 5 miles range (using Google maps v3 APIs). This means that usually only 5 or 6 addresses have to be shown out of the 100 000 addresses. One solution could be retrieving all the records and apply a formula in Java to calculate the distance of each address and show it only if it's inside the range. That would be a waste of processing power, because I would need to retrieve all the records, when I only need to show 5 or 6 of them on the map. How can I solve this problem on the database side (MySQL), in order to return only the addresses in the 5 miles range?
tagged with: google-maps-api-3
has answer: http://stackoverflow.com/a/21043061
linked to: http://stackoverflow.com/q/20437225
has comment: http://stackoverflow.com/comment/119789812
has title: MySQL select coordinates within range
has answer: http://stackoverflow.com/a/48037966
favorite count: 0
has answer: http://stackoverflow.com/a/60620855
has comment: http://stackoverflow.com/comment/31657714
answer count: 4
upvote count: 11
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21042565

http://stackoverflow.com/q/21070331
has comment: http://stackoverflow.com/comment/31687514
tagged with: java
has comment: http://stackoverflow.com/comment/31687890
has answer: http://stackoverflow.com/a/21070393
has comment: http://stackoverflow.com/comment/31687403
has comment: http://stackoverflow.com/comment/31687412
tagged with: tomcat6
type: Question
tagged with: tomcat
has body: I've set up two tomcat instances running on different ports on the same Windows machine. One is for Alpha, the other is for Development. I've deployed the Alpha and Dev wars (same app name, different settings in META-INF/context.xml) to each server. The Tomcat directories have the exact same content except for: Wars deployed are different (I started fresh, removed webapps/* war files and dirs) conf/server.xml files are different (set different ports) bin/catalina.bat files are different (changed CATALINA_HOME to the full path of each instance) The rest is the same. The thing is that META-INF/context.xml files of each war point to different databases, one for dev and one for alpha. More specifically the connection URL is different, and even more specifically only the database name is different (the string between the slash and the question mark of the URL). However, after starting both instances for some reason they BOTH point at the Dev database. That is, they both are presumably reading the Dev context.xml, and probably the same webapps/AppName folder How is that possible? When I start the Dev tomcat the console displays the values of CATALINA_HOME, CATALINA_BASE, CATALINA_TMPDIR and CLASSPATH, and they all show full paths to the Dev tomcat directory. When I start the Alpha tomcat the console displays the values of those variables as well, and they all show full paths to the Alpha tomcat directory (so the paths seem to be OK). I checked the deployed alpha_tomcat_dir/webapps/AppName/META-INF/context.xml file and it DOES show alpha database configuration. But at runtime it still uses the db information of the Dev database. Where else should I look? These are the context.xml files: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;Context&gt; &lt;Resource name="jdbc/hng" auth="Container" driverClassName="com.mysql.jdbc.Driver" type="javax.sql.DataSource" maxActive="60" minIdle="5" maxIdle="60" maxWait="10000" testOnBorrow="true" testOnReturn="true" testWhileIdle="true"…
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21070976
has title: What config do I have to change for multiple Tomcat instances to use separate context.xml files?
type: UnansweredQuestion

http://stackoverflow.com/comment/31601177
score: 3
comment on: http://stackoverflow.com/q/21023348
type: Comment
type: QuestionComment
has text: @user2336315 - Couldn't agree more.. In recursion, the greater the size the higher the probablity of StackOverFlowError.

http://stackoverflow.com/comment/31769110
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21115113
has text: What are the compile errors you get?
score: 0

http://stackoverflow.com/a/21036830
type: Answer
accepted answer of: http://stackoverflow.com/q/21036671
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: The problem is in the while loop: while (in.hasNext()){ total += in.nextInt(); count++; } This loop exits only when hasNext returns false, which meanse count==0 &amp;&amp; in.hasNext will never be true. Probably, you want the loop to only process ints. This might work better: while (in.hasNextInt()){ total += in.nextInt(); count++; } The loop will end when there is no int - however hasNext will still be true, since there may be letters, etc in the file.
answers question: http://stackoverflow.com/q/21036671

http://stackoverflow.com/comment/51309875
type: QuestionComment
comment on: http://stackoverflow.com/q/21036333
has text: Hello, Did you found out any solutions for ALM integration.
type: Comment
score: 1

arraylist
tags question: http://stackoverflow.com/q/21127642
tags question: http://stackoverflow.com/q/21161001
tags question: http://stackoverflow.com/q/21039999
tags question: http://stackoverflow.com/q/21076756
tags question: http://stackoverflow.com/q/21083589
tags question: http://stackoverflow.com/q/21052678
tags question: http://stackoverflow.com/q/21040854
tags question: http://stackoverflow.com/q/21113404
tags question: http://stackoverflow.com/q/21107090
tags question: http://stackoverflow.com/q/21129794
tags question: http://stackoverflow.com/q/21150324
tags question: http://stackoverflow.com/q/21077064
tags question: http://stackoverflow.com/q/21105166
tags question: http://stackoverflow.com/q/21141145
tags question: http://stackoverflow.com/q/21105276
tags question: http://stackoverflow.com/q/21139294
tags question: http://stackoverflow.com/q/21160070
tags question: http://stackoverflow.com/q/21098900
tags question: http://stackoverflow.com/q/21072200
tags question: http://stackoverflow.com/q/21132228
tags question: http://stackoverflow.com/q/21181533
tags question: http://stackoverflow.com/q/21131005
tags question: http://stackoverflow.com/q/21122143
tags question: http://stackoverflow.com/q/21025667
tags question: http://stackoverflow.com/q/21078383
tags question: http://stackoverflow.com/q/21036464
tags question: http://stackoverflow.com/q/21145424
tags question: http://stackoverflow.com/q/21128025
tags question: http://stackoverflow.com/q/21127171
tags question: http://stackoverflow.com/q/21033614
tags question: http://stackoverflow.com/q/21147347
tags question: http://stackoverflow.com/q/21143111
tags question: http://stackoverflow.com/q/21178851
tags question: http://stackoverflow.com/q/21089129
tags question: http://stackoverflow.com/q/21105502
tags question: http://stackoverflow.com/q/21140549
tags question: http://stackoverflow.com/q/21177382
tags question: http://stackoverflow.com/q/21058411
tags question: http://stackoverflow.com/q/21036781
tags question: http://stackoverflow.com/q/21053867
tags question: http://stackoverflow.com/q/21125998
tags question: http://stackoverflow.com/q/21167988
tags question: http://stackoverflow.com/q/21087801
tags question: http://stackoverflow.com/q/21080255
tags question: http://stackoverflow.com/q/21138137
tags question: http://stackoverflow.com/q/21128039
tags question: http://stackoverflow.com/q/21125318
type: Tag
tags question: http://stackoverflow.com/q/21097326
tags question: http://stackoverflow.com/q/21126678
tags question: http://stackoverflow.com/q/21169789
tags question: http://stackoverflow.com/q/21147380
tags question: http://stackoverflow.com/q/21095997
tags question: http://stackoverflow.com/q/21047544
tags question: http://stackoverflow.com/q/21074214
tags question: http://stackoverflow.com/q/21056895
tags question: http://stackoverflow.com/q/21074397
tags question: http://stackoverflow.com/q/21041564
tags question: http://stackoverflow.com/q/21053055
tag name: arraylist
tags question: http://stackoverflow.com/q/21121332
tags question: http://stackoverflow.com/q/21084755
tags question: http://stackoverflow.com/q/21099562

http://stackoverflow.com/q/21095602
downvote count: 0
has body: My code reads files from a zipfile , which works fine except for files with special characters. Problematic character is 'è' ( See my code fère_champenoise ) String works="(3/(3)_juno.jpa"; String sdoesntwork="ba/battle of fère_champenoise.jpa"; ZipFile file1 = null; try { file1 = new ZipFile(sZipFileOld); } catch (IOException e) { System.out.println("Could not open zip file " + sZipFileOld + ": " + e); } try { file1.getInputStream(file1.getEntry(sdoesntwork)); } catch (IOException e) { System.out.println(sdoesntwork + ": IO Error " + e); e.printStackTrace(); } it throws an error but doesn't go throught the exception handler: Exception in thread "main" java.lang.NullPointerException at java.util.zip.ZipFile.getInputStream(Unknown Source) at ZipCompare.main(ZipCompare.java:56) Any Solutions ?
type: AnsweredQuestion
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21095970
tagged with: http://stackoverflow.com/tag/zip
has title: reading files with special characters from a zipfile
has answer: http://stackoverflow.com/a/21095916
type: Question
tagged with: stream
upvote count: 1
has answer: http://stackoverflow.com/a/52503828
tagged with: java
answer count: 5
has answer: http://stackoverflow.com/a/21095929
accepted answer: http://stackoverflow.com/a/21095916
possible better answer: http://stackoverflow.com/a/21095761
has answer: http://stackoverflow.com/a/21095761

http://stackoverflow.com/comment/31683228
score: 0
type: AnswerComment
has text: Ok I am sorry to pester you, but now the code is allowing the first input to be whatever, while the second through infinite inputs output the error message._For instance,_ **"Please enter 10 grades", I input a wrong number of 201 and it accepts it, then I put in another wrong number and it outputs Grade must be from 1-100**
type: Comment
comment on: http://stackoverflow.com/a/21066486

http://stackoverflow.com/q/21030740
possible better answer: http://stackoverflow.com/a/21031158
downvote count: 0
score: 8
favorite count: 0
has answer: http://stackoverflow.com/a/21031158
upvote count: 8
has body: I am going through Hibernate Documentation an came across the LockModes. Are these same as Isolation levels that we use for database? How are they different from Isolation levels? I am trying a simple example and observed that the hibernate is hitting the database when I use session.load() method itself instead of hitting the DB when I call some methods on the loaded object. session.beginTransaction(); //Line 1 DomesticCat d1 = (DomesticCat)session.load(DomesticCat.class, 1L,LockOptions.UPGRADE); //Line 2 d1.meow(); //Line 3 session.getTransaction().commit(); //Line 4 I observed that hibernate hits the database at line 2 itself, please tell me why it happens like that? If I remove the LockOptions parameter then the DB hit is made on Line 3 instead of Line 2 The API for LockOptions gives very little details on what they are: READ represents LockMode.READ (timeout + scope do not apply) What does it mean that timeout + scope do not apply? UPGRADE represents LockMode.UPGRADE (will wait forever for lock and scope of false meaning only entity is locked) When we should use UPGRADE? what it means that scope of false meaning only entity is locked? May be these are basic questions for experienced guys, please help me in understanding the concept here. Thanks for looking my post.
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has title: Hibernate LockModes/LockOptions
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21031444
accepted answer: http://stackoverflow.com/a/21031444

http://stackoverflow.com/comment/52645474
has text: @SteveL it's more of a gaussian blur as you can see, but with knowledge of GLSL you can easily edit it to make it work as a motion blur.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21211336
type: Comment

http://stackoverflow.com/comment/124289156
type: Comment
comment on: http://stackoverflow.com/a/29995192
has text: I used similar solution with log4j 1.2.x but unable to get working 2.14.x. The reason is, that my "LogContextListener" is created after log4j2 is already initialized with `WARN StatusLogger No Log4j 2 configuration file found. Using default configuration...` I guess it used to be the same for log4j v1 but with `PropertyConfigurator.configure(logConfigProperties);` it has reconfigured current log4j but this doesn't happen with `Configurator.initialize(null, logConfigSource);` My listener is the first one in web.xml but there are others in TLD files that are fired before.
score: 1
type: AnswerComment

http://stackoverflow.com/a/21089758
score: 4
accepted answer of: http://stackoverflow.com/q/21089689
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31722561
answers question: http://stackoverflow.com/q/21089689
has comment: http://stackoverflow.com/comment/31722470
type: Answer
has body: Make sure you add the directory in which the image file resides to your classpath. Then load the image in your class constructor like so: protected BufferedImage image; public MyPanel() throws IOException { URL imageURL = getClass().getResource("/ax.jpeg"); if (imageURL == null) { throw new FileNotFoundException(); } this.image = ImageIO.read(imageURL); }
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/21055007
has comment: http://stackoverflow.com/comment/31658875
has comment: http://stackoverflow.com/comment/31659374
has answer: http://stackoverflow.com/a/21055287
score: 0
has answer: http://stackoverflow.com/a/21055269
has comment: http://stackoverflow.com/comment/31659260
has comment: http://stackoverflow.com/comment/31658741
has title: Reading Multiple Files Java
has answer: http://stackoverflow.com/a/21055276
has answer: http://stackoverflow.com/a/21055338
possible better answer: http://stackoverflow.com/a/21055276
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21055269
tagged with: java
tagged with: file
has body: I'm new here, and I got a problem when I'm trying to read a file. Here is my code public void openFile() { try { if(Board.state == Board.STATE.LEVEL1) { scan = new Scanner(new File("D://OOP Photos//Map.txt")); } } catch(FileNotFoundException e) { e.printStackTrace(); } try { if(Board.state == Board.STATE.LEVEL2) { scan = new Scanner(new File("D://OOP Photos//Map1.txt")); } } catch(Exception e) { System.out.println("Error loading MAP !!! "); } try { if(Board.state == Board.STATE.LEVEL3) { scan = new Scanner(new File("D://OOP Photos//Map2.txt")); } } catch(Exception e) { System.out.println("Error loading MAP !!! "); } } If I comment out the if statement it is okay, but if I leave it there, it will throw a NullPointerException in the next method: public void readFile() { while(scan.hasNext()) { for(int i = 0; i &lt; 10; i++) { if(scan.hasNext()) { Map[i] = scan.next(); } } } } Can you help me ? Thank You :)
type: Question
has comment: http://stackoverflow.com/comment/31658874

http://stackoverflow.com/a/21136472
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31809087
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21136402
type: Answer
upvote count: 6
score: 6
has comment: http://stackoverflow.com/comment/31807947
has comment: http://stackoverflow.com/comment/31809007
answers question: http://stackoverflow.com/q/21136402
has body: The only way to know for sure is to read the javadocs for any particular stream you're interested in. The inheritance hierarchy is quite bad there, but it's an old class. Edit: I just read the javadoc, and while it seems that InputStream itself does implement it (with a naive read/discard implementation), it says "Subclasses are encouraged to provide a more efficient implementation of this method. For instance, the implementation may depend on the ability to seek." Now instead of throwing an IOException if seeking isn't supported, subclasses could always use the default implementation. However, most likely due to backwards compatibility, this artifact of weird design has been left in.

http://stackoverflow.com/comment/31664434
has text: @user2644819 By the way, the list of C++ frameworks in this answer was pulled off Wikipedia, and you can view the full page [here](http://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks), if you want to see examples for other languages.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21054736
type: Comment

http://stackoverflow.com/a/21064837
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31676706
has comment: http://stackoverflow.com/comment/31680443
type: Answer
has body: Look at your code, once properly indented: switch(i % 3) { case 0: v1 = input.nextInt(); break; case 1: v2 = input.nextInt(); break; case 2: s = input.next(); items[i] = new Data(v1, v2, s); break; } ++i; This means that you only initialize items[i] if i % 3 == 2. So 2 out of three elements of the array are null. But in the last loop, you're trying to print every element, without ever testing for null. Side note: naming fields s, n1 and n2 is the best way to have unreadable, unmaintainable code. Give meaninful names to your classes and variables.
accepted answer of: http://stackoverflow.com/q/21064762
upvote count: 1
answers question: http://stackoverflow.com/q/21064762
type: AcceptedAnswer

http://stackoverflow.com/comment/31679687
type: AnswerComment
type: Comment
has text: Exactly, and I indeed get a Class<?> that I should instantiate. Anyway if the question is not clear (it seemed to me) or it is otherwise ambiguous, there is always button "add comment" to ask clarification etc etc before either downvote or provide poor answers @BrianRoach
comment on: http://stackoverflow.com/a/21066260
score: 0

http://stackoverflow.com/comment/31633619
type: QuestionComment
comment on: http://stackoverflow.com/q/21041288
type: Comment
has text: An `int` doesn't have a property that it is octal, decimal or whatever. Octal, decimal, hexadecimal etc. are just different ways to display a number - it's not an intrinsic property of the number. You cannot take an `int` and check if it is octal.
score: 0

http://stackoverflow.com/comment/31730659
type: QuestionComment
comment on: http://stackoverflow.com/q/21094049
type: Comment
score: 3
has text: @KevinWorkman The OP also needs to handle avoiding the "3" in "30" getting replaced with "three".

http://stackoverflow.com/a/21174971
answers question: http://stackoverflow.com/q/21174918
type: Answer
has comment: http://stackoverflow.com/comment/31878682
score: 0
has comment: http://stackoverflow.com/comment/31879259
upvote count: 1
downvote count: 1
has body: You could use the values() method, which returns an array. Then just use Math.random() to return a random instance. Here is an example: public static void main (String[] args) { String[] arr = {"DEV","DC1","DC2","DC3"}; //returned by Enum.values(), you get the idea String randElement = arr[(int) ((Math.random() * 3) +1)]; System.out.println(randElement); } Basically it boils down to generating a random number between 1 and n :)
has comment: http://stackoverflow.com/comment/31878659

jframe
tags question: http://stackoverflow.com/q/21179642
tags question: http://stackoverflow.com/q/21051707
tags question: http://stackoverflow.com/q/21078049
tags question: http://stackoverflow.com/q/21058565
tags question: http://stackoverflow.com/q/21103394
tags question: http://stackoverflow.com/q/21136661
tags question: http://stackoverflow.com/q/21023063
tags question: http://stackoverflow.com/q/21069585
tag name: jframe
tags question: http://stackoverflow.com/q/21148195
tags question: http://stackoverflow.com/q/21109530
tags question: http://stackoverflow.com/q/21148149
tags question: http://stackoverflow.com/q/21089689
tags question: http://stackoverflow.com/q/21069050
tags question: http://stackoverflow.com/q/21182492
tags question: http://stackoverflow.com/q/21066596
tags question: http://stackoverflow.com/q/21169487
tags question: http://stackoverflow.com/q/21081434
tags question: http://stackoverflow.com/q/21106370
tags question: http://stackoverflow.com/q/21136033
tags question: http://stackoverflow.com/q/21146397
tags question: http://stackoverflow.com/q/21124879
tags question: http://stackoverflow.com/q/21135930
tags question: http://stackoverflow.com/q/21070703
tags question: http://stackoverflow.com/q/21110158
tags question: http://stackoverflow.com/q/21054108
tags question: http://stackoverflow.com/q/21134488
tags question: http://stackoverflow.com/q/21177764
tags question: http://stackoverflow.com/q/21063246
tags question: http://stackoverflow.com/q/21080974
tags question: http://stackoverflow.com/q/21051354
tags question: http://stackoverflow.com/q/21076086
tags question: http://stackoverflow.com/q/21112572
tags question: http://stackoverflow.com/q/21168119
tags question: http://stackoverflow.com/q/21060220
tags question: http://stackoverflow.com/q/21179663
tags question: http://stackoverflow.com/q/21071412
tags question: http://stackoverflow.com/q/21031251
tags question: http://stackoverflow.com/q/21079070
tags question: http://stackoverflow.com/q/21085129
tags question: http://stackoverflow.com/q/21083252
tags question: http://stackoverflow.com/q/21066323
tags question: http://stackoverflow.com/q/21178103
tags question: http://stackoverflow.com/q/21074616
tags question: http://stackoverflow.com/q/21035120
tags question: http://stackoverflow.com/q/21025171
tags question: http://stackoverflow.com/q/21137171
type: Tag
tags question: http://stackoverflow.com/q/21113946
tags question: http://stackoverflow.com/q/21049365
tags question: http://stackoverflow.com/q/21031367
tags question: http://stackoverflow.com/q/21066320
tags question: http://stackoverflow.com/q/21169758

http://stackoverflow.com/a/21140005
has body: You may have two problems going on, the first of which is that your transaction is not committing within the timeout period allowed by the JBoss transaction coordinator (ARJUNA). However, if your transaction is just long-running, then this suggestion may help. Look in your JBoss setup file (on Linux it would be somewhere like /etc/jbossas/standalone/standalone.xml in a non-clustered environment) and look for this section: &lt;subsystem xmlns="urn:jboss:domain:transactions:1.3"&gt; &lt;core-environment&gt; &lt;process-id&gt; &lt;uuid/&gt; &lt;/process-id&gt; &lt;/core-environment&gt; &lt;recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/&gt; &lt;coordinator-environment default-timeout="300"/&gt; &lt;/subsystem&gt; Notice the default-timeout attribute of the &lt;coordinator-environment&gt;. By default it is 300 seconds. Now, 5 minutes should be plenty of time for a transaction to run, but in long-running, heavy batch processing, this limit could be exceeded. If you suspect this is your problem, increase this parameter (which is in units of seconds), and bounce JBoss (you can also do this through the JBoss management console, but I've found in development it's just easier to modify the standalone.xml and bounce JBoss). HTH
answers question: http://stackoverflow.com/q/21137049
has comment: http://stackoverflow.com/comment/31870983
downvote count: 0
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/31845981
score: 2

http://stackoverflow.com/q/21180888
has answer: http://stackoverflow.com/a/21180963
has comment: http://stackoverflow.com/comment/31888819
has body: In this part of my code I have three errors: String uri = String.format(Locale.ENGLISH, "geo:%f,%f", latitude, longitude); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); context.startActivity(intent); context cannot be resolved latitude cannot be resolved to a variable longitude cannot be resolved to a variable I have tried with Ctrl+Shift+o to import those things ut it's not working. Can anyone help me?
favorite count: 0
downvote count: 3
type: UnansweredQuestion
tagged with: android
score: -3
has answer: http://stackoverflow.com/a/21181027
has comment: http://stackoverflow.com/comment/31888667
upvote count: 0
tagged with: java
tagged with: maps
type: Question
has comment: http://stackoverflow.com/comment/31888715
tagged with: adt
has title: Three "cannot be resolved to a variable" errors in Android app
tagged with: eclipse
answer count: 2

http://stackoverflow.com/q/21039234
has answer: http://stackoverflow.com/a/21039319
upvote count: 1
has comment: http://stackoverflow.com/comment/31630477
has comment: http://stackoverflow.com/comment/31629986
accepted answer: http://stackoverflow.com/a/21039250
has comment: http://stackoverflow.com/comment/31629957
favorite count: 0
has title: What is better way of using boolean value for conditional statement
has comment: http://stackoverflow.com/comment/31629947
has body: I have a boolean variable isExists. I need to check if isExists is true then i have to perform some action otherwise i need to perform other action. I can write conditional code like following approach-1 if(isExists){ //perform use previous interest }else{ //create new interest } approach-2 if(true == isExists){ //perform use previous interest }else{ //create new interest } In some books approach 2 is used and in others approach-1 is used. What is the difference and which one is better between these two way of checking conditional statement for boolean
has answer: http://stackoverflow.com/a/21039250
duplicate of: http://stackoverflow.com/q/4282708
has answer: http://stackoverflow.com/a/21039344
has answer: http://stackoverflow.com/a/21039283
has answer: http://stackoverflow.com/a/21039406
type: AnsweredQuestion
score: -5
has comment: http://stackoverflow.com/comment/31630162
tagged with: java
has comment: http://stackoverflow.com/comment/31630156
has answer: http://stackoverflow.com/a/21039403
has answer: http://stackoverflow.com/a/21039325
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/21039268
downvote count: 6
possible better answer: http://stackoverflow.com/a/21039406

http://stackoverflow.com/comment/31687766
comment on: http://stackoverflow.com/a/21070581
score: 0
type: AnswerComment
type: Comment
has text: True, in this case a `TreeSet` could be used, OP didn't state whether order was important or not... answer updated to reflect your suggestion!

http://stackoverflow.com/comment/31821369
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21114520
has text: thank you, so i'll have to work with a JTable to show my informations, i think there's no other option, thanks again!

http://stackoverflow.com/q/21125998
tagged with: java
has comment: http://stackoverflow.com/comment/31790065
type: Question
possible better answer: http://stackoverflow.com/a/21126231
has comment: http://stackoverflow.com/comment/31790051
has comment: http://stackoverflow.com/comment/31790125
has body: I'm trying to store an ArrayList into an XML file so that I can retrieve the information later on and then display it back into the console. Can someone show me the most effective way to do this? EDIT: Heres what I am trying to write into an external file // new user is created Bank bank = new Bank(); System.out.println("Enter your full name below (e.g. John M. Smith): "); String name = scanner.nextLine(); System.out.println("Create a username: "); String userName = scanner.nextLine(); System.out.println("Enter your starting deposit amount: "); int balance = scanner.nextInt(); System.out.print(dash); System.out.print("Generating your information...\n"); System.out.print(dash); int pin = bank.PIN(); String accountNum = bank.accountNum(); User user = new User(name, userName, pin, accountNum, balance); //new user gets added to the array list Bank.users.add(user); System.out.println(user); This all creates a Bank user, which gets thrown into an ArrayList, then I want to store their information so that I can come back later and redisplay it.
tagged with: arraylist
upvote count: 3
answer count: 3
accepted answer: http://stackoverflow.com/a/21141147
has answer: http://stackoverflow.com/a/35052876
has comment: http://stackoverflow.com/comment/31789911
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has answer: http://stackoverflow.com/a/21126231
has answer: http://stackoverflow.com/a/21141147
has comment: http://stackoverflow.com/comment/31789947
has title: How to write an ArrayList to an XML file?
has comment: http://stackoverflow.com/comment/31790615
has comment: http://stackoverflow.com/comment/31790034
type: AnsweredQuestion
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31789921

http://stackoverflow.com/a/21145667
type: Answer
score: 25
answers question: http://stackoverflow.com/q/21145558
has comment: http://stackoverflow.com/comment/31825177
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21145558
has comment: http://stackoverflow.com/comment/31826458
has comment: http://stackoverflow.com/comment/31825150
has body: It doesn't matter either way, static or instance. RestTemplate's methods for making HTTP requests are thread safe so whether you have a RestTemplate instance per Task instance or a shared instance for all Task instances is irrelevant (except for garbage collection). Personally, I would create the RestTemplate outside the Task class and pass it as an argument to a Task constructor. (Use Inversion of Control whenever possible.)
upvote count: 25
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31825469

http://stackoverflow.com/a/21536111
upvote count: 1
answers question: http://stackoverflow.com/q/21157123
type: Answer
has body: org.springframework.data spring-data-jpa ${spring-data.version} org.hibernate.javax.persistence hibernate-jpa-2.0-api
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32521356

http://stackoverflow.com/q/21089773
tagged with: jtableheader
has answer: http://stackoverflow.com/a/21090081
tagged with: java
tagged with: swing
type: Question
has body: My JTable doesn't display my column name, and I don't see why. Can anyone help me to tell me why? Thank you in advance. package projet.ihm; import java.awt.Color; public class VueOccupations extends JPanel { class MonModeleTableOccupation extends AbstractTableModel { @Override public boolean isCellEditable(int rowIndex, int columnIndex) { return true; } private JoursHoraire jours; // initialise ma liste de joueurs public MonModeleTableOccupation( JoursHoraire jour) { super(); this.jours=jour; ///périodes = périodes; //jours = JoursHoraire.valueOf(jour); } // @Override // public void setValueAt(Object aValue, int l, int c) { // JoursHoraire[] jours=JoursHoraire.values(); // Joueur j = joueurs.get(l); // switch (c) { // // case 1: // j.setPrenom((String) aValue); // break; //case 2: // j.setDate((Date) aValue); //} //} @Override public Class&lt;?&gt; getColumnClass(int c) { return getValueAt(0, c).getClass(); } @Override public String getColumnName(int c) { // TODO Auto-generated method stub switch (c) { case 0: return "périodes"; case 1: return "Jour"; case 2: return "Heure Debut"; case 3: return "Heure Fin"; case 4: return "Local"; } return "Vide"; } @Override public int getColumnCount() { return 5; } @Override public int getRowCount() { return Periode.NB_PERIODES; } @Override public Object getValueAt(int l, int c) { JoursHoraire jour = jours.JEUDI; // System.out.println(l+" "+c+" "+j); switch (c) { case 0: return jour.values(); case 1: return jour.values(); case 2: // return sdf.format(j.getDate()); return jour.values(); } return "Vide"; } } private ControleurJHOccupation ctrl; private JTable table; private JTable table_1; private JComboBox cbModule; private JComboBox cbPeriode; private JComboBox&lt;JoursHoraire&gt; cbJour; private JComboBox&lt;HeureMinute&gt; cbHeureD; private JComboBox&lt;HeureMinute&gt; cbHeureFin; private ModèleJHOccupation modèleJHOccupation; public VueOccupations(ControleurJHOccupation ctrl)throws HeadlessException { modèleJHOccupation = new …
tagged with: jpanel
has comment: http://stackoverflow.com/comment/31722724
tagged with: jtable
score: 0
answer count: 1
has title: JTable and JPanel
has comment: http://stackoverflow.com/comment/31722648
type: UnansweredQuestion

http://stackoverflow.com/q/21058575
favorite count: 0
has title: How to add, multiply n numbers to a given range in array and also reverse the range in the array in O(n) time?
type: Question
has comment: http://stackoverflow.com/comment/31665605
tagged with: c++
has comment: http://stackoverflow.com/comment/31665511
tagged with: java
answer count: 1
downvote count: 1
upvote count: 4
has comment: http://stackoverflow.com/comment/31665651
has comment: http://stackoverflow.com/comment/31666357
has body: Suppose we have an a array L[]={4,1,2,6}. What we need to do is to take a string S consisting of characters A,R,M as input and apply the following algorithm: for i from 1 to N do if ith letter of S is 'R' reverse L[i...N] else if ith letter of S is 'A' add A to all numbers of L[i..N]. else if ith letter of S is 'M' multiply B to all numbers of L[i..N]. for all number in L[i..N], module them by C. print L[i] end How to optimize this algorithm so that it runs in O(n) time? Length of the array as well as the string is n. Anyway, any optimization (like removing the loop for add and multiply only ) in this algorithm will be welcomed.
has answer: http://stackoverflow.com/a/21060497
tagged with: algorithm
tagged with: arrays
has comment: http://stackoverflow.com/comment/31665589
tagged with: http://stackoverflow.com/tag/c
accepted answer: http://stackoverflow.com/a/21060497
has comment: http://stackoverflow.com/comment/31666287
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/31665547
has comment: http://stackoverflow.com/comment/31668853
has comment: http://stackoverflow.com/comment/31665633

http://stackoverflow.com/a/21063263
has body: I think the easyest way is something like the following: public boolean contains(String s){ return textData.toLowerCase().contains(s.toLowerCase()) } but that only is goint go work for strings!
type: Answer
has comment: http://stackoverflow.com/comment/31673938
answers question: http://stackoverflow.com/q/21063045
has comment: http://stackoverflow.com/comment/31674459
score: 0

http://stackoverflow.com/a/21104277
upvote count: 2
has body: Yes you can. Apart from the "=", "==" mix up in your code (which is why it may not be working) you are setting the value in both setter and getter. Although nothing stops you from doing this, doing this isn't right. Also, you should consider initializing 'terrain' such as public int terrain = DESERT; instead of public int terrain; This way your getter can be simplified to public int getTerrain() { return terrain; } The logic in your setter doesn't make much sense either. You may want to have something like this public void setTerrain(int ter) { //validate input. You could do a full invalid range check although //I just checked here for negative values if (ter &lt; 0) { //handle this use case. You want to validate input for public API of a class always. } //set value. terrain = ter; //Compare with the finals here and do whatever else needs to be done. } Update: Also consider Setting terrain' during construction. Too often work that should be done in the constructor is done in the setter. To avoid clutter, aid in re-use you can also use a validateTerrain( ) method for validating input both in the constructor and the setter. So the constructor will look something like // like someone mentioned enum is a good fit public Creature(int ter) { //setter can set the value same way if (validateTerrain(ter)) { terrain = ter; } } Getting rid of the setter (this needs #1) if 'terrain's value will not change over the life-time of the object containing it. This will make the property read-only after construction. Irrespective of this step, #1 should be done anyway IMO.
score: 2
answers question: http://stackoverflow.com/q/21104149
downvote count: 0
has comment: http://stackoverflow.com/comment/31750966
type: Answer

http://stackoverflow.com/q/21146414
type: Question
has body: I made a simple function: public class AjouterBouton { public AjouterBouton(int nombre) { JButton[] buttons = new JButton[nombre]; for(int i = 0; i &lt; buttons.length; i++) { buttons[i] = new JButton(); buttons[i].setBackground(Color.LIGHT_GRAY); JPanel pan = Main.grille; pan.add(buttons[i]); } } } "grille" is a simple JPanel in my Main Class: JPanel grille = new JPanel(); int ligne = 6; int colone = 5; grille.setBounds(6, 117, 980, 314); grille.setLayout(new GridLayout(ligne,colone)); and finally, I added this into the Main class: new AjouterBouton(72); However, I get a JavaNullPointerException. PS: I tried this, which works: final JButton[] buttons = new JButton[72]; for(int i = 0; i &lt; buttons.length; i++) { buttons[i] = new JButton(); buttons[i].setBackground(Color.LIGHT_GRAY); grille.add(buttons[i]); } But I want to add my button using the method. I'm a beginner; can someone help me?
has comment: http://stackoverflow.com/comment/31826688
has comment: http://stackoverflow.com/comment/31826643
tagged with: java
tagged with: jpanel
accepted answer: http://stackoverflow.com/a/21147069
answer count: 2
has comment: http://stackoverflow.com/comment/31826738
possible better answer: http://stackoverflow.com/a/21146578
has comment: http://stackoverflow.com/comment/31826790
favorite count: 0
has answer: http://stackoverflow.com/a/21147069
has comment: http://stackoverflow.com/comment/31826721
has comment: http://stackoverflow.com/comment/31827780
has title: NullPointerExecption
downvote count: 3
score: -3
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/31828303
has answer: http://stackoverflow.com/a/21146578
has comment: http://stackoverflow.com/comment/31826793
tagged with: swing

http://stackoverflow.com/comment/31696763
comment on: http://stackoverflow.com/a/21075596
type: AnswerComment
has text: @Marc, I don't think StackOverflow is a good venue for giving an introductory lesson in Regular Expressions. But here are much better tutorials than I could write anyway: [character classes](http://www.regular-expressions.info/charclass.html) and [grouping](http://www.regular-expressions.info/brackets.html)
score: 0
type: Comment

http://stackoverflow.com/comment/31891841
score: 1
has text: @DarshanPatel - Good point.. But thats a totally different context.. Such connections will not be local objects.. So, they have to be closed.. and closing of connections occurs asynchronously...
type: Comment
comment on: http://stackoverflow.com/q/21182572
type: QuestionComment

http://stackoverflow.com/comment/31852843
type: Comment
has text: Will try this, good though is that I'm now using pax, very easy to try 2.3.3 with my application.
comment on: http://stackoverflow.com/a/21156546
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31779873
has text: @BoristheSpider I've updated what I want the output to be...basically replace the 3rd line by the 4th line because the last number (2) is greater that (1) ie...better
comment on: http://stackoverflow.com/q/21120550
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21128589
has answer: http://stackoverflow.com/a/21128610
tagged with: java
tagged with: mysql
downvote count: 1
has body: Here is the code for the connection to the database: public void database() { String temp=""; Connection conn = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; Statement statement=null; try { String url = "jdbc:mysql://127.0.0.1:3306/golf"; Class.forName ("oracle.jdbc.driver.OracleDriver"); conn = DriverManager.getConnection (url,"root",""); if (!conn.isClosed()) { statement = conn.createStatement ( ); resultSet = statement.executeQuery("select * from golfdb"); writeResultSet(resultSet); statement.close(); } } catch (Exception e) { System.err.println("Exception: " + e.getMessage());} finally { try { if (conn != null) {conn.close();} } catch (SQLException e) {} } } and here is the error i receive when i run the program: Exception: oracle.jdbc.driver.OracleDriver Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0 &gt;= 0 at java.util.Vector.elementAt(Vector.java:427) at javax.swing.table.DefaultTableColumnModel.getColumn(DefaultTableColumnModel.java:277) at golf.addeditpoints(golf.java:220) at golf$17.actionPerformed(golf.java:728) 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) at java.awt.Component.processMouseEvent(Component.java:6414) at javax.swing.JComponent.processMouseEvent(JComponent.java:3275) at java.awt.Component.processEvent(Component.java:6179) at java.awt.Container.processEvent(Container.java:2084) at java.awt.Component.dispatchEventImpl(Component.java:4776) at java.awt.Container.dispatchEventImpl(Container.java:2142) at java.awt.Component.dispatchEvent(Component.java:4604) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:461…
type: Question
has title: Error connecting mySQL to java netbeans on mac os mavericks
has answer: http://stackoverflow.com/a/21128838
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21128664
favorite count: 0
tagged with: netbeans
tagged with: database-connection
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31794438
upvote count: 1
tagged with: swing

http://stackoverflow.com/comment/31847667
comment on: http://stackoverflow.com/q/21158083
score: 0
type: Comment
type: QuestionComment
has text: what problem your getting with above code?

google-oauth
type: Tag
tag name: google-oauth
tags question: http://stackoverflow.com/q/21043594

http://stackoverflow.com/q/21119852
downvote count: 1
has answer: http://stackoverflow.com/a/24950091
has title: Get all HTTP requests with WebDriver/HtmlUnit
has comment: http://stackoverflow.com/comment/31787938
upvote count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31778802
tagged with: htmlunit
tagged with: http-request
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/46278909
has comment: http://stackoverflow.com/comment/31779016
score: 4
has comment: http://stackoverflow.com/comment/31778530
tagged with: java
answer count: 3
tagged with: selenium
has body: I need to verify a request for testing via WebDriver. Unfortunately there is no easy way to do this as there is no native support. It seems like I should be able to use HtmlUnit to get requests but I have only been able to get responses. Is there a way to do this with HtmlUnit or do I need to setup something else like Browsermob Proxy? I am using Java to do this. Thanks!
has answer: http://stackoverflow.com/a/36087838
has comment: http://stackoverflow.com/comment/31825103

http://stackoverflow.com/a/58815067
type: Answer
upvote count: 3
has body: If you config with .properties file: String propertiesFile = "./test/Configuration/log4j2.properties"; ConfigurationSource source = new ConfigurationSource(new FileInputStream(propertiesFile), new File(propertiesFile)); Configurator.initialize(null, source);
answers question: http://stackoverflow.com/q/21083834
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/139114316

http://stackoverflow.com/q/21022459
score: 0
accepted answer: http://stackoverflow.com/a/21022485
answer count: 1
tagged with: jsp
tagged with: javascript
favorite count: 0
linked to: http://stackoverflow.com/q/3177733
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21022485
upvote count: 1
has body: I have some javascript &lt;script&gt; // some java code that doesn't matter right now localStorage.setItem("myName", "Bob"); alert(localStorage.myName); &lt;script&gt; it works just fine (giving an alert message that says Bob). that's fine and dandy but what I really want is to pass a java variable to a javascript variable and have that print out instead. But when I put these lines into it... var hi5 = &lt;%= "getMyName();" %&gt; localStorage.someName = hi5; It quits. Any javascript before that works fine. but any javascript after it just doesn't show up. now the &lt;% %&gt; tags might not be in the exact syntax but it doesn't really give me any errors I'm sure I'm overlooking something but I'm not sure what it would be. What can I do?
downvote count: 1
type: Question
tagged with: java
has title: inline java makes causing javascript to not execute
has comment: http://stackoverflow.com/comment/31599956

http://stackoverflow.com/q/21029995
has answer: http://stackoverflow.com/a/21030077
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/html
score: -2
possible better answer: http://stackoverflow.com/a/21030106
favorite count: 0
has body: I wanted to show the user's name when the user logs in but I can't make it work. Here is my sample, I created a simple password protected webpage(I'm not gonna put the whole code) but I want to display the name on dashboard.php <?php session_start(); if(isset($_POST['login'])) { $password = $_POST['pswd']; if ( $password == "mypassword" ) { //Replace mypassword with your password it login $_SESSION['phplogin'] = true; header('Location: dashboard.php'); //Replace dashboard.php with what page you want to go to after succesful login exit; } else { ?> <?php } } ?> whats ur Name: What is the Password? dashboard.php <?php session_start(); require 'approve.php'; ?> blah blah.. blah.. some div html contents here <?php echo "Logged as: " .$_POST['txtname']; ?>
has answer: http://stackoverflow.com/a/21030106
type: Question
has comment: http://stackoverflow.com/comment/31613712
answer count: 3
upvote count: 1
accepted answer: http://stackoverflow.com/a/21030077
tagged with: php
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/31613707
has title: How to display the user name, which is inserted from a HTML form
tagged with: javascript
has answer: http://stackoverflow.com/a/21030236

http://stackoverflow.com/q/21170437
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31871088
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/21170768
has title: How to input a file via Unix input redirection into my java programm as an array?
has body: I'm a beginner in Java and need some help with this problem. First of all let me show you my actual program. import java.util.Scanner; import java.util.Arrays; public class IntArraySort { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Array-Size: "); int num = in.nextInt(); int[] arr = new int[num]; for(int i = 0; i &lt; arr.length; i++){ System.out.printf("%2d-tes element: ", i+1); arr[i] = in.nextInt(); } System.out.printf("%nOutput before sort: "); System.out.println(Arrays.toString(arr)); int minIndex, tmp; int n = arr.length; for(int i = 00; i &lt; n - 1; i++) { minIndex = i; for(int j = i + 1; j &lt; n; j++) if (arr[j] &lt; arr[minIndex]) minIndex = j; if (minIndex != i) { tmp = arr[i]; arr[i] = arr[minIndex]; arr[minIndex] = tmp; } System.out.printf("%n%2d-ter Run: ", i+1); System.out.println(Arrays.toString(arr)); } } } It's a program to sort an Int-array from smallest to biggest number while you scan the size of the array and the numbers via keyboard input. But I want to scan my array from a .dat-file. I named it sort.dat and it looks like this: 0 20 12 8 16 6 10 14 2 18 4 21 4 -1 -3 What do I need to change in my Java-program to scan in my sort.dat file via input redirection (IntArraySort.java &lt; sort.dat) on Unix?
has answer: http://stackoverflow.com/a/21455676
score: 1
accepted answer: http://stackoverflow.com/a/21455676
tagged with: java
answer count: 2
tagged with: arrays
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21170768
tagged with: input
tagged with: unix

http://stackoverflow.com/q/21066323
accepted answer: http://stackoverflow.com/a/21066624
tagged with: panels
upvote count: 1
downvote count: 1
possible better answer: http://stackoverflow.com/a/21066587
tagged with: mouse
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21066587
tagged with: java
tagged with: jpanel
type: Question
answer count: 2
has body: so this is my problem. I have an 8*8 grid of panels, all white. Then, when one of them is clicked, it's supposed to change to a random color. The only problem I have right now is that I don't know how to see if the user clicked their mouse in a specific panel. Here is the code I have so far (I'm going to implement the random element afterwards) ` import javax.swing.*; import java.awt.*; import java.awt.event.*; public class GridOfPanels extends JPanel{ int x, y; public GridOfPanels(){ JPanel content = new JPanel(new GridLayout(8,8)); for(int i = 0; i &lt; 64; i++){ JPanel panel = new JPanel(); panel.setBackground(Color.white); content.add(panel); } this.add(content); } public GridOfPanels(Color backColor){ setBackground(backColor); addMouseListener(new PanelListener()); x = 200; y = 200; } private class PanelListener extends MouseAdapter{ public void mousePressed(MouseEvent e){ x = e.getX(); y = e.getY(); repaint(); } } public static void main(String[] args){ JFrame theGUI = new JFrame(); theGUI.setTitle("Grid"); theGUI.setVisible(true); theGUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); theGUI.setSize(400,400); Rectangle z = new Rectangle(x, y, 50, 50); } } `
has answer: http://stackoverflow.com/a/21066624
score: 0
has comment: http://stackoverflow.com/comment/31680469
has title: How do I know if someone clicks in a specific panel?
favorite count: 0
tagged with: jframe

http://stackoverflow.com/a/21160391
downvote count: 0
answers question: http://stackoverflow.com/q/21160187
type: Answer
has body: Unless you run maven install on your project1. It would not be packaged as a jar file into your .m2 repository, and hence it wouldnt be resolved in the project2's pom file. This is similar to using a third party jar file. But not having it in the .m2 repository. Even in that case, you would face the same problem. For your project 2, project 1 is treated as an independent third party jar file. It needs to be in your .m2 repository so that it resolves it.
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21160187
type: AcceptedAnswer

http://stackoverflow.com/a/21124459
score: 0
has body: Java Date objects represent the number of milliseconds seconds since January 1, 1970, 00:00:00 GMT due to the fact that the other methods are deprecated. The two ways to "view" a Date object directly are "getTime()" and "toString()" (using "dow mon dd hh:mm:ss zzz yyyy"). Therefore, you are formatting the GMT value to your local timezone. When working with dates, it is best to think of them as GMT values, and then as a "formatting" exercise when viewing the date.
type: Answer
answers question: http://stackoverflow.com/q/21123315

http://stackoverflow.com/comment/31709996
type: QuestionComment
has text: Are you referring the the button which starts the editing mode?
comment on: http://stackoverflow.com/q/21082379
score: 0
type: Comment

http://stackoverflow.com/q/21043989
has comment: http://stackoverflow.com/comment/31638081
has comment: http://stackoverflow.com/comment/31637718
has comment: http://stackoverflow.com/comment/31637703
has answer: http://stackoverflow.com/a/21045661
type: UnansweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/31637699
tagged with: java
downvote count: 1
type: Question
upvote count: 0
has title: jar file not able to load csv file on a different machine
tagged with: jar
score: -1
has comment: http://stackoverflow.com/comment/31637722
has body: I m new to java and using Netbeans IDE for my project. I need to read and display csv files so i used opencsv library for that. it is working fine on my computer but the jar file is not able to load any csv file on a different machine. what could be the reason? what should I do to resolve this problem? code for reading csv file try{ CSVReader reader = new CSVReader(new FileReader(dataFile)); String [] nextLine; row = 0; ArrayList&lt;String[]&gt; ls = new ArrayList&lt;&gt;(); while ((nextLine = reader.readNext()) != null) { row++; ls.add(nextLine); } col=ls.get(0).length; String[] tempHeader=new String[col]; for(int i=0;i&lt;col;i++) tempHeader[i]=(String)("ATT"+(i+1)); fileData=new String[row][col]; for(int i=0;i&lt;ls.size();i++) fileData[i]=ls.get(i); DefaultTableModel dm = new DefaultTableModel(); dm.setDataVector(fileData,tempHeader); previewTable.setModel(dm); } catch(IOException e){} this is working on my machine. But the jar file which i send to my friend is not able to display the file.
answer count: 1
tagged with: opencsv
favorite count: 0

http://stackoverflow.com/comment/57395765
type: Comment
type: QuestionComment
has text: i found this import for rx java on a pluralsight course compile "com.netflix.rxjava:rxjava-core:0.16.1" what is the difference??
score: 0
comment on: http://stackoverflow.com/q/21060607

http://stackoverflow.com/comment/31626029
type: AnswerComment
comment on: http://stackoverflow.com/a/21036677
type: Comment
has text: I think I might be being stupid here but what if I don't have access to the class implementation? Is there no way to wrap around it to make it safe?
score: 0

http://stackoverflow.com/a/21069836
type: Answer
answers question: http://stackoverflow.com/q/21069817
has body: Yes, it does include spaces by default. For example, public class Tester { public static void main (String[] args) { String temp = "This is a sentence."; char[] arr = temp.toCharArray(); for (char k : arr) { System.out.print(k); } } } Prints out "This is a sentence." You should always consult the Javadocs when in doubt about what a function does. Take a look at this: http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#toCharArray() Which quotes directly: "a newly allocated character array whose length is the length of this string and whose contents are initialized to contain the character sequence represented by this string."
score: 0

http://stackoverflow.com/comment/31702135
score: 0
type: AnswerComment
type: Comment
has text: But my Student class is a static class without an empty constructor. The "newInstance()" call will cause exception
comment on: http://stackoverflow.com/a/21078661

http://stackoverflow.com/comment/31609242
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21027420
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/44905/discussion-between-akhil-jain-and-dharmendra)

http://stackoverflow.com/comment/31622796
has text: It is giving me a mismatch error somehow.. Cannot convert error.. not sure why.. Any idea?
type: Comment
comment on: http://stackoverflow.com/a/21034562
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31654941
type: QuestionComment
score: 2
has text: That's an interesting question. The issues arises from the choice of the designers to expose setPreferredSize instead of actually forcing people to override getPreferredSize. If you look at just about UI component, there doesn't seem to be any logical reason to actually use setPreferredSize (that won't actually break the component). The reason for overriding getPreferredSize in this manner would also be to prevent other people from changing the value you've specified, which could made for particular reason. If you want to, you could call super.getPreferredSize and check if its null or not
comment on: http://stackoverflow.com/q/21052894
type: Comment

http://stackoverflow.com/comment/31783926
type: Comment
comment on: http://stackoverflow.com/q/21122851
score: 3
type: QuestionComment
has text: Did I miss out something here? - yes an [MCVE](http://stackoverflow.com/help/mcve), short, runnable, compilable and for the real answer I missing there description about expected goal

http://stackoverflow.com/a/21161482
type: Answer
score: 3
upvote count: 3
has body: You should add NfcAdapter.ACTION_TAG_DISCOVERED to your intent filter. Your current intent filter( filters[0].addAction(NfcAdapter.ACTION_NDEF_DISCOVERED);) only catches NFC tag containin NDEF messages. by changing your filter to filters[0].addAction(NfcAdapter.ACTION_TAG_DISCOVERED); you should get what you want.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21159717
answers question: http://stackoverflow.com/q/21159717

google-api
tags question: http://stackoverflow.com/q/21050173
tags question: http://stackoverflow.com/q/21045627
tag name: google-api
type: Tag

ondraw
type: Tag
tag name: ondraw
tags question: http://stackoverflow.com/q/21049228

http://stackoverflow.com/a/21058486
has comment: http://stackoverflow.com/comment/31665747
has body: The need for L=a.size() should've been a hint. sub and a values should be preserved (their positions and values) for a proper functioning. Below code creates a new copy of the array lists and operates on them: public static void perm2(ArrayList&lt;Integer&gt; a) { ArrayList&lt;Integer&gt; sub = new ArrayList&lt;Integer&gt;(); perm2(sub, a); } public static void perm2(ArrayList&lt;Integer&gt; sub, ArrayList&lt;Integer&gt; a) { int L = a.size(); if (L == 0) System.out.println(sub); else { System.out.println(sub); for (int i = 0; i &lt; L; i++) { ArrayList&lt;Integer&gt; ab = new ArrayList&lt;Integer&gt;(sub); ab.add(a.get(i)); ArrayList&lt;Integer&gt; bc = new ArrayList&lt;Integer&gt;(a); bc.remove(i); perm2(ab, bc); } } }
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/21058411
score: 2
answers question: http://stackoverflow.com/q/21058411
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31672635
downvote count: 0

http://stackoverflow.com/comment/32168548
score: 0
type: AnswerComment
has text: Currently testing this out, will let you know how it goes!
type: Comment
comment on: http://stackoverflow.com/a/21253613

relative-path
type: Tag
tags question: http://stackoverflow.com/q/21060992
tags question: http://stackoverflow.com/q/21026630
tag name: relative-path
tags question: http://stackoverflow.com/q/21065575

http://stackoverflow.com/a/21077536
answers question: http://stackoverflow.com/q/21077494
has comment: http://stackoverflow.com/comment/31700153
score: 0
has body: You need to do add(jFieldText1) to actually add it to the JFrame. Make sure you actually have a JFrame, too.
type: Answer

http://stackoverflow.com/a/21155168
score: 0
answers question: http://stackoverflow.com/q/21135426
type: Answer
has body: private String getCellValue(Cell cell) { if (cell == null) { return null; } if (cell.getCellType() == Cell.CELL_TYPE_STRING) { return cell.getStringCellValue(); } else if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) { return cell.getNumericCellValue() + ""; } else if (cell.getCellType() == Cell.CELL_TYPE_BOOLEAN) { return cell.getBooleanCellValue() + ""; }else if(cell.getCellType() == Cell.CELL_TYPE_BLANK){ return cell.getStringCellValue(); }else if(cell.getCellType() == Cell.CELL_TYPE_ERROR){ return cell.getErrorCellValue() + ""; } else { return null; } }

http://stackoverflow.com/comment/31751651
type: QuestionComment
comment on: http://stackoverflow.com/q/21103990
has text: Could you explain me how can I use swingworker in my program ? Your help will be greatly appreciated.
score: 0
type: Comment

http://stackoverflow.com/q/21026484
answer count: 2
has comment: http://stackoverflow.com/comment/31606954
has body: What could be the possible usage of having a reference of applicationContext within a bean ?
has comment: http://stackoverflow.com/comment/31607650
has comment: http://stackoverflow.com/comment/31607010
has answer: http://stackoverflow.com/a/21026841
tagged with: spring
has comment: http://stackoverflow.com/comment/31607085
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31606940
has answer: http://stackoverflow.com/a/21026553
score: 0
tagged with: java
has title: Need of ApplicationContext object reference in a bean?
accepted answer: http://stackoverflow.com/a/21026841
possible better answer: http://stackoverflow.com/a/21026553
type: Question
has comment: http://stackoverflow.com/comment/31609523

http://stackoverflow.com/q/21059331
score: -1
tagged with: http://stackoverflow.com/tag/xml
downvote count: 2
upvote count: 1
answer count: 1
tagged with: java
type: UnansweredQuestion
favorite count: 0
has title: How do i parse a XML with the type defined as XSD:any
type: Question
has answer: http://stackoverflow.com/a/21060104
has body: I have a XML structure which has the content type defined as xs:any in the schema. At runtime the schema corresponding to the structure that is being passed in the XML would also be sent. Is there a way that i can parse this xs:any node with the schema that i get as part of the input

http://stackoverflow.com/comment/31819027
type: AnswerComment
type: Comment
has text: you can remove elements with element.removeFromParent().
comment on: http://stackoverflow.com/a/21142137
score: 0

http://stackoverflow.com/comment/31800870
type: AnswerComment
has text: I think a constructor arg should work fine too. I've updated the answer to show what the application.xml should look like then. I find their documentation a bit unclear on the matter so you'd have to simply try it out. If it doesn't work, you can always add a setter for the field.
type: Comment
comment on: http://stackoverflow.com/a/21127048
score: 0

http://stackoverflow.com/q/21063140
score: 6
has title: Saving file to resource directory using Spring
has comment: http://stackoverflow.com/comment/31673743
has comment: http://stackoverflow.com/comment/123726256
upvote count: 6
favorite count: 0
possible better answer: http://stackoverflow.com/a/29893615
tagged with: spring
has answer: http://stackoverflow.com/a/29893615
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31673766
tagged with: java
has body: I have this project structure: /webapp /res /img /profile.jpg /WEB-INF And I need to save file to res/img/ directory. This time I have this code: public String fileUpload(UploadedFile uploadedFile) { InputStream inputStream = null; OutputStream outputStream = null; MultipartFile file = uploadedFile.getFile(); String fileName = file.getOriginalFilename(); File newFile = new File("/res/img/" + fileName); try { inputStream = file.getInputStream(); if (!newFile.exists()) { newFile.createNewFile(); } outputStream = new FileOutputStream(newFile); int read = 0; byte[] bytes = new byte[1024]; while ((read = inputStream.read(bytes)) != -1) { outputStream.write(bytes, 0, read); } } catch (IOException e) { e.printStackTrace(); } return newFile.getAbsolutePath(); } But it saving files to user.dir directory, which is ~/Work/Tomcat/bin/. So how I can upload files to res directory?
has answer: http://stackoverflow.com/a/21063299
type: Question
has comment: http://stackoverflow.com/comment/31673919
answer count: 2
accepted answer: http://stackoverflow.com/a/21063299
has comment: http://stackoverflow.com/comment/31673661
downvote count: 0
tagged with: tomcat

http://stackoverflow.com/comment/41734036
type: Comment
has text: I don't understand. The code was taken from a library, and it's not built into Android, so there wasn't a clash of packages names. What do you suggest here? please explain.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26548547

http://stackoverflow.com/q/21027097
type: AnsweredQuestion
has title: Dynamically refreshing the ListView with changes done to database android
tagged with: java
has comment: http://stackoverflow.com/comment/31608197
type: Question
tagged with: eclipse
tagged with: listview
score: 0
has answer: http://stackoverflow.com/a/21027263
answer count: 1
tagged with: android
has body: I am most concerned about Performance issue and don't want users to wait for progress. I have a chatActivity, where i show a ListView. Here i send a chatMessage Chats chat = new Chats(chatBox.getText().toString(),Chats.TYPE_MINE, dt.format(now)); chat.personId = chatee.getMyId(); chat.isDelievered = Chats.DELIEVERED_NONE; chats.add(chat); mAdapter.notifyDataSetChanged(); Notice that Chat delievery is set to NONE Right now. So basically the message is being added to the Chat List even its not delivered yet. Now on back thread here is what's happening It takes few seconds to send message where i do this boolean bool = sendMessage(m); if (bool) chatee.isDelievered = Chats.DELIEVERED_DONE; (MESSAGE SENT) if (chatee.isDelievered == Chats.DELIEVERED_DONE) { app.mDbHelper.saveMessage(chatee); // SAVING TO DATABASE Intent i = new Intent(Constants.REFRESH_NOTIF).putExtra("refresh",Constants.REFRESH_NOTIF); context.sendBroadcast(i); } It will send a broadcast to the activity. Now here is the problem. Broadcast call this function public void callUIMethodForRefresh(Intent intent) { String ref = intent.getStringExtra("refresh"); if (ref == null) { } else if (ref.equals(Constants.REFRESH_NOTIF)) { } } Here i am confused of how can I reset that previous Chat object added to my List. Points to be noted , i can be sending messages at a very fast speed and the refresh could be called for an old message whereas a new message is already typed. ONE way is i make a For loop and check for all the "ChatList" array for the message sent and then replace its delivery notice, but again this is very low performance incase i have 1000+ objects in the list. Is there any way, i can attach the sqlite database with my listView adapter that automatically detects the changes and reset the listView etc and etc? What could be the best strategies here to avoid performance issues.
accepted answer: http://stackoverflow.com/a/21027263

http://stackoverflow.com/q/21060607
upvote count: 9
has comment: http://stackoverflow.com/comment/31669081
has title: Android Studio adding rxjava library
has comment: http://stackoverflow.com/comment/57395765
has comment: http://stackoverflow.com/comment/31669249
has answer: http://stackoverflow.com/a/30608620
answer count: 3
tagged with: rx-java
tagged with: android
has comment: http://stackoverflow.com/comment/31690996
favorite count: 0
score: 8
has comment: http://stackoverflow.com/comment/31676402
linked to: http://stackoverflow.com/q/10046298
has answer: http://stackoverflow.com/a/32085867
has answer: http://stackoverflow.com/a/21521368
accepted answer: http://stackoverflow.com/a/21521368
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/30608620
has body: Consider following project structure: MainProject -.idea -.grandle -src -SubProject --libs //I created this folder manually ---rxjava-core-0.16.0-sources.jar --src ---main //+ all the sources --build.grandle --SubProject.iml -build.grandle -//other files I downloaded the .jar from http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.netflix.rxjava%22%20AND%20a%3A%22rxjava-core%22 (sources.jar) - but I also tried others Then I created lib folder in the SubProject and then put the .jar to it. In Android Studio I rightclicked on the library and selected "Add as Library..." with level: "Project Library" and module: "SubProject". The rxjava uses package name "rx".I have some code implemented that imports this package: import rx.Observable; import rx.Observer; import rx.Subscription; import rx.subscriptions.Subscriptions; When building the project following error occure: Gradle: package rx does not exist Gradle: package rx.util.functions does not exist Gradle: cannot find symbol class Action1 ... I found that it is required to put a line to SubProject/build.grandle: dependencies { compile 'libs/rxjava-core-0.16.0-sources.jar' //added line compile 'com.android.support:support-v4:19.0.0' compile 'com.android.support:appcompat-v7:19.0.0' } but then it throws: Gradle: A problem occurred evaluating project ':SubProject'. &gt; The description libs/rxjava-core-0.16.0-sources.jar is invalid I tried to moving the .jar around the project structure but so far no luck. How do I properly add a 3rd party library to the project? Is it ok that I created the "libs" folder myself?
linked to: http://stackoverflow.com/q/18735923
tagged with: java
downvote count: 1
type: Question

http://stackoverflow.com/comment/31703541
has text: Ive set it to not resize. It's staying one size. Although does the layout affect the JScrollPane?
comment on: http://stackoverflow.com/q/21079036
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21074418
answers question: http://stackoverflow.com/q/21074402
score: 186
has comment: http://stackoverflow.com/comment/75591720
has comment: http://stackoverflow.com/comment/136589033
upvote count: 188
has comment: http://stackoverflow.com/comment/68224409
has body: Position the cursor inside the class, then press ALT + Ins and select Getters and Setters from the contextual menu.
type: AcceptedAnswer
downvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/21074402
has comment: http://stackoverflow.com/comment/47361007
has comment: http://stackoverflow.com/comment/82649848

user-interface
tags question: http://stackoverflow.com/q/21143234
tags question: http://stackoverflow.com/q/21029784
tags question: http://stackoverflow.com/q/21059430
tags question: http://stackoverflow.com/q/21099603
tags question: http://stackoverflow.com/q/21150672
tags question: http://stackoverflow.com/q/21126388
tags question: http://stackoverflow.com/q/21114125
tags question: http://stackoverflow.com/q/21094586
tags question: http://stackoverflow.com/q/21126248
tags question: http://stackoverflow.com/q/21081035
tags question: http://stackoverflow.com/q/21107433
tags question: http://stackoverflow.com/q/21083386
type: Tag
tags question: http://stackoverflow.com/q/21026904
tags question: http://stackoverflow.com/q/21124573
tags question: http://stackoverflow.com/q/21044863
tags question: http://stackoverflow.com/q/21075552
tags question: http://stackoverflow.com/q/21080022
tags question: http://stackoverflow.com/q/21102553
tags question: http://stackoverflow.com/q/21161675
tags question: http://stackoverflow.com/q/21111368
tags question: http://stackoverflow.com/q/21089161
tags question: http://stackoverflow.com/q/21176425
tags question: http://stackoverflow.com/q/21108180
tags question: http://stackoverflow.com/q/21070500
tags question: http://stackoverflow.com/q/21038117
tags question: http://stackoverflow.com/q/21037345
tags question: http://stackoverflow.com/q/21142686
tags question: http://stackoverflow.com/q/21041495
tags question: http://stackoverflow.com/q/21069050
tags question: http://stackoverflow.com/q/21174819
tags question: http://stackoverflow.com/q/21166280
tags question: http://stackoverflow.com/q/21141824
tags question: http://stackoverflow.com/q/21105701
tags question: http://stackoverflow.com/q/21079634
tags question: http://stackoverflow.com/q/21121888
tags question: http://stackoverflow.com/q/21087047
tags question: http://stackoverflow.com/q/21177139
tags question: http://stackoverflow.com/q/21158508
tags question: http://stackoverflow.com/q/21148149
tags question: http://stackoverflow.com/q/21147951
tags question: http://stackoverflow.com/q/21156333
tags question: http://stackoverflow.com/q/21081128
tags question: http://stackoverflow.com/q/21065035
tags question: http://stackoverflow.com/q/21119052
tags question: http://stackoverflow.com/q/21151829
tag name: user-interface
tags question: http://stackoverflow.com/q/21047721
tags question: http://stackoverflow.com/q/21113935
tags question: http://stackoverflow.com/q/21122990
tags question: http://stackoverflow.com/q/21172309
tags question: http://stackoverflow.com/q/21119994
tags question: http://stackoverflow.com/q/21163912
tags question: http://stackoverflow.com/q/21125320

http://stackoverflow.com/q/21119052
linked to: http://stackoverflow.com/q/9554636
has comment: http://stackoverflow.com/comment/31777239
has comment: http://stackoverflow.com/comment/31778100
has answer: http://stackoverflow.com/a/21121202
has body: I'm in a rather unique situation based on what I've seen in other's coding. I'm working on a multi-frame GUI for a school project and it has four converters between various units: Mass, Volume, Distance, and Temperature. The problem I run into lies with the Text Listeners for my temperature conversions: private class TempListener implements ActionListener{ public void actionPerformed (ActionEvent event){ double faren, cels; String text = temperature.getText(); faren = Integer.parseInt(text); cels = (faren-32) * 5/9; rLabelT.setText(Double.toString(cels)); } } private class Temp1Listener implements ActionListener{ public void actionPerformed (ActionEvent event){ double faren, cels; String text = temperature1.getText(); cels = Integer.parseInt(text); faren = (cels+32) * 9/5; rLabelT1.setText(Double.toString(faren)); } } The Integer.parseInt method catches a NumberFormatException.java and stops it from completing the calculation. Now, this coding is almost identical to a similar program from my textbook with the only edits being the variable type. What I worry about is that the other frames have fully functional calculations based on the same block: private class MassListener implements ActionListener{ public void actionPerformed (ActionEvent event){ double pounds, kilograms; String text = mass.getText(); pounds = Integer.parseInt(text); kilograms = pounds/2.2; rLabelM.setText(Double.toString(kilograms)); } } private class VolumeListener implements ActionListener{ public void actionPerformed (ActionEvent event){ double litres, gallons; String text = volume.getText(); gallons = Integer.parseInt(text); litres = .264 * gallons; rLabelV.setText(Double.toString(litres)); } } private class DistListener implements ActionListener{ public void actionPerformed (ActionEvent event){ double miles, kilo; String text = distance.getText(); miles = Integer.parseInt(text); kilo = miles * 1.609; rLabelD.setText(Double.toString(kilo)); } } All of these work with EXACTLY the same coding wi…
tagged with: awt
has comment: http://stackoverflow.com/comment/31776974
score: 0
tagged with: numberformatexception
has comment: http://stackoverflow.com/comment/31776855
has comment: http://stackoverflow.com/comment/31792701
tagged with: converters
has comment: http://stackoverflow.com/comment/31777902
answer count: 1
tagged with: user-interface
has comment: http://stackoverflow.com/comment/31778248
type: UnansweredQuestion
has title: NumberFormatException in a multi-frame GUI
has comment: http://stackoverflow.com/comment/31778048
has comment: http://stackoverflow.com/comment/31776689
has comment: http://stackoverflow.com/comment/31777877
has comment: http://stackoverflow.com/comment/31799654
tagged with: java
has comment: http://stackoverflow.com/comment/31777290
has comment: http://stackoverflow.com/comment/31779790
type: Question

http://stackoverflow.com/q/21163204
has answer: http://stackoverflow.com/a/21163352
has answer: http://stackoverflow.com/a/21163495
has answer: http://stackoverflow.com/a/21163635
has answer: http://stackoverflow.com/a/21163981
tagged with: arrays
has body: I'm trying to understand recursion by doing some codes. This code should find the maximum number in the array recursively, but for some reason it doesn't work. Thanks for your help! public static void main(String[] args) { int array [] = {11,4,6,9,15,2}; maxNum(array, 1, 0); }//Main public static int maxNum(int array[], int maxIndex, int i) { int ans; if(i==array.length-1) //Condition Stop { ans= maxIndex; } else { ans= maxNum(array, Math.max(array[maxIndex], array[i]), i++); } System.out.println(array[maxIndex]); return ans; }//maxNum }//Class
has comment: http://stackoverflow.com/comment/31856825
has answer: http://stackoverflow.com/a/21163727
score: 0
has answer: http://stackoverflow.com/a/21163342
has comment: http://stackoverflow.com/comment/31856867
has answer: http://stackoverflow.com/a/21163914
has answer: http://stackoverflow.com/a/21163379
has title: Finding the maximum number in the array recursively
answer count: 9
type: AnsweredQuestion
tagged with: recursion
possible better answer: http://stackoverflow.com/a/21163342
accepted answer: http://stackoverflow.com/a/21163635
tagged with: java
has answer: http://stackoverflow.com/a/21163529
type: Question

http://stackoverflow.com/comment/31597125
has text: @user3177634- i thing some other application using same port. Check my answer below. It contain solution
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21021136

http://stackoverflow.com/comment/31855883
type: QuestionComment
has text: Count the occurences of february 29th in your timeframe and substract it.
comment on: http://stackoverflow.com/q/21162677
score: 0
type: Comment

http://stackoverflow.com/a/21019566
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 7
upvote count: 7
answers question: http://stackoverflow.com/q/21018828
has comment: http://stackoverflow.com/comment/31640262
has comment: http://stackoverflow.com/comment/31633947
has body: I think your best bet would be using an intermediate value within request scope. Assuming that you didn't put HelloResource in singleton scope, you can inject this intermediate value in some ContainerRequestFilter implementation and in your resource, and you can fill it inside this ContainerRequestFilter implementation with all authentication and authorization info you need. It will look something like this: // Authentication filter contains code which performs authentication // and possibly authorization based on the request @Provider public class AuthFilter implements ContainerRequestFilter { private final AuthInfo authInfo; @Inject AuthFilter(AuthInfo authInfo) { this.authInfo = authInfo; } @Override public void filter(ContainerRequestContext requestContext) throws IOException { // You can check request contents here and even abort the request completely // Fill authInfo with the data you need Principal principal = ...; // Ask some other service possibly authInfo.setPrincipal(principal); } } @Path("hello") public class HelloResource { private final AuthInfo authInfo; @Inject HelloResource(AuthInfo authInfo) { this.authInfo = authInfo; } @GET @Produces("application/json") public String hello() { // authInfo here will be pre-filled with the principal, assuming // you didn't abort the request in the filter return authInfo.getPrincipal().getUsername(); } } public class MainModule extends AbstractModule { @Override protected void configure() { bind(AuthFilter.class); bind(HelloResource.class); bind(AuthInfo.class).in(RequestScoped.class); } } And even if you did put the resource (or even the filter) in singleton scope for some reason, you can always inject Provider&lt;AuthInfo&gt; instead of AuthInfo. Update It seems that I was somewhat wrong in that the filter is by default not in singleton scope. In fact it seem to behave like singleton even though it is not bound as such. It is created upon JAX-RS container startup. Hence you will need to inject Provider&lt;AuthInf…
accepted answer of: http://stackoverflow.com/q/21018828
has comment: http://stackoverflow.com/comment/31640174

http://stackoverflow.com/q/21041148
favorite count: 0
accepted answer: http://stackoverflow.com/a/21041232
tagged with: extends
has title: Java: Generic type casting, how can I fix this so I don't suppress the unchecked warning
tagged with: generics
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21041232
downvote count: 0
type: Question
has body: private static transient JavaPlugin myPlugin = null; public SomeClass(JavaPlugin plugin) { if (myPlugin == null) myPlugin = plugin; } public &lt;T&gt; T getPlugin(Class&lt;? extends JavaPlugin&gt; plugin) { return (T)myPlugin; // return casted version of "myPlugin" form above } Calling it in the line below works just fine, and trying to use a class that doesn't extend JavaPlugin will throw a compile time error. But how can I make it so the above function works without requiring @SuppressWarnings("unchecked")?? MyPlugin nc = this.getPlugin(my.main.package.MyPlugin.class);
score: 1
tagged with: java
tagged with: casting
tagged with: unchecked-cast
upvote count: 1
answer count: 1

http://stackoverflow.com/q/21171688
has title: Java Interfaces and Templates Confusion
score: 2
type: AnsweredQuestion
upvote count: 2
linked to: http://stackoverflow.com/q/3355408
type: Question
accepted answer: http://stackoverflow.com/a/21172045
tagged with: java
possible better answer: http://stackoverflow.com/a/21172022
answer count: 2
has answer: http://stackoverflow.com/a/21172022
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/31693
tagged with: interface
tagged with: templates
has answer: http://stackoverflow.com/a/21172045
has body: I was reading through some questions on the differences between templates in some different programming languages. I understand that thanks mostly to this questions: What are the differences between Generics in C# and Java... and Templates in C++?. I did however get a little bit confused towards the end of the accepted answer when he starting talking about interfaces and when adding something. I understand the generals of interfaces mostly from this question: Explaining Interfaces to Students. I was still confused by what was stated in the question. So can someone better explain this last portion: Because of this, the C++ compiler places no restrictions on what you can do with templates - basically any code you could write manually, you can get templates to write for you. The most obvious example is adding things: In C# and Java, the generics system needs to know what methods are available for a class, and it needs to pass this down to the virtual machine. The only way to tell it this is by either hard-coding the actual class in, or using interfaces. For example: string addNames( T first, T second ) { return first.Name() + second.Name(); } That code won't compile in C# or Java, because it doesn't know that the type T actually provides a method called Name(). You have to tell it - in C# like this: interface IHasName{ string Name(); }; string addNames( T first, T second ) where T : IHasName { .... } And then you have to make sure the things you pass to addNames implement the IHasName interface and so on. The java syntax is different (), but it suffers from the same problems. The 'classic' case for this problem is trying to write a function which does this string addNames( T first, T second ) { return first + second; } You can't actually write this code because there are no ways to declare an interface with the + method in it. You fail. C++ suffers from none of these problems. The compiler doesn't care about passing types down to any VM's - if both your objects have a …

http://stackoverflow.com/a/21073031
answers question: http://stackoverflow.com/q/21072908
has body: Well, If you can make users to use shortcuts, you can set your thread to be activated if "some key" is pressed. https://java.net/projects/jna/sources/svn/content/trunk/jnalib/contrib/w32keyhook/KeyHook.java Once i used to code a keylogger for windows, and used this one. Maybe it can help you.
has comment: http://stackoverflow.com/comment/31691969
score: 0
type: Answer

http://stackoverflow.com/q/21128957
score: -1
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/21129077
favorite count: 0
has title: Having trouble with a frequency table in Java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31795149
has comment: http://stackoverflow.com/comment/31795137
has answer: http://stackoverflow.com/a/21129060
tagged with: java
has comment: http://stackoverflow.com/comment/31795150
downvote count: 1
type: Question
has body: I have to create a frequency table for how many times a word appears in a sentence. I was trying to accomplish this with 2 arrays but every time I trace it, the words will not go into the frequency tables. boolean found = false; for (int y = 0; y &lt; numWordsInArray; y++) { found = arrayOfWords[y].equals(word); if(found) { numTimesAppeared[y]++; } if (!found) //it's not already found { //add the word to the array of words arrayOfWords[numWordsInArray] = word; numWordsInArray++; } } and when I run this loop: for(int x = 0; x &lt; 10; x++) { System.out.println(arrayOfWords[x]); } to trace the array, I get output of 10 spaces. link to the whole program : http://pastebin.com/F4t6yCkD
has comment: http://stackoverflow.com/comment/31795181
tagged with: arrays

http://stackoverflow.com/q/21025165
has answer: http://stackoverflow.com/a/21025576
type: Question
linked to: http://stackoverflow.com/q/5621338
has answer: http://stackoverflow.com/a/21025642
has comment: http://stackoverflow.com/comment/31605186
has comment: http://stackoverflow.com/comment/31605956
has comment: http://stackoverflow.com/comment/31605115
has comment: http://stackoverflow.com/comment/31605345
downvote count: 0
favorite count: 0
tagged with: focus
has answer: http://stackoverflow.com/a/34272300
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31605325
has comment: http://stackoverflow.com/comment/31605227
has comment: http://stackoverflow.com/comment/31604753
has body: I wrote a code to find and highlight a word in a JTextArea and I'm hitting an issue and I'm too tired and with an headache to see my mistake. I have a search bar(TextField) where I can enter a word and the word gets highlighter in my TextArea. Problem is, after I press my "ENTER" key, the TextField gets deselected and I have to click it again to find the next word. What am I missing? findfieldpage1 = new JTextField(); findfieldpage1.setBounds(37, 295, 63, 24); gtapage1.add(findfieldpage1); findfieldpage1.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { int code = evt.getKeyCode(); if(code == KeyEvent.VK_ENTER){ String find = findfieldpage1.getText().toLowerCase(); textpage1.requestFocusInWindow(); if (find != null &amp;&amp; find.length() &gt; 0) { Document document = textpage1.getDocument(); int findLength = find.length(); try { boolean found = false; if (pos + findLength &gt; document.getLength()) { pos = 0; } while (pos + findLength &lt;= document.getLength()) { String match = document.getText(pos, findLength).toLowerCase(); if (match.equals(find)) { found = true; break; } pos++; } if (found) { Rectangle viewRect = textpage1.modelToView(pos); textpage1.scrollRectToVisible(viewRect); textpage1.setCaretPosition(pos + findLength); textpage1.moveCaretPosition(pos); pos += findLength; } } catch (Exception exp) { exp.printStackTrace(); } } } } });
answer count: 4
linked to: http://stackoverflow.com/q/17874717
score: 2
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/21025871
has title: JTextField. Find and highlight the word in a JTextArea
tagged with: swing

http://stackoverflow.com/q/21048126
has title: The program RedCross.java is supposed to display a red cross on a white background. It's only making the top left of the cross
has comment: http://stackoverflow.com/comment/31646151
has answer: http://stackoverflow.com/a/21048533
type: AnsweredQuestion
upvote count: 2
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21048533
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/31645670
type: Question
tagged with: graphics
has answer: http://stackoverflow.com/a/21048862
possible better answer: http://stackoverflow.com/a/21048388
has answer: http://stackoverflow.com/a/21048388
answer count: 3
favorite count: 0
has body: I don't know what makes it print the whole cross, it only prints the top left corner import java.awt.Graphics; import java.awt.Color; import java.awt.Container; import javax.swing.JFrame; import javax.swing.JPanel; public class RedCross extends JPanel{ public void paintComponent(Graphics g){ super.paintComponent(g); int xCenter = getWidth() / 2; int yCenter = getHeight() / 2; g.setColor(Color.RED); g.fillRect(xCenter, yCenter, 10, 50); g.fillRect(xCenter, yCenter, 50, 10); } public static void main(String[] args){ JFrame window = new JFrame("Red Cross"); window.setBounds(300, 300, 200, 200); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); RedCross panel = new RedCross(); panel.setBackground(Color.WHITE); Container c = window.getContentPane(); c.add(panel); window.setVisible(true); } }

http://stackoverflow.com/a/21110146
type: Answer
has body: Many times java program compile successfully. If it gives error while running program then please check the name of class it is case sencetive, make sure classpath. In windows system it give error if you set classpath in environmental variable and again in running program.
answers question: http://stackoverflow.com/q/21109983
score: 0

http://stackoverflow.com/comment/31800241
comment on: http://stackoverflow.com/a/21112198
type: AnswerComment
score: 0
type: Comment
has text: If this function tries to manipulate the HTML DOM, you have to make sure that you are using ADF Javascript APIs, without it you won't be able to do it successfully.

http://stackoverflow.com/a/22399851
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21042651
type: AcceptedAnswer
has body: I was then able to solve the issue by myslef simply removing and adding again the plugin in Eclipse. Hope this proves to be useful to other people in the future!
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21042651
type: Answer

http://stackoverflow.com/comment/31752054
score: 0
type: AnswerComment
has text: Calling `repaint` puts a `paint` event onto the Event Queue, which is passed to the `RepaintManager` which makes decisions about what and when something should be painted. `paint` is the action, `repaint` is the request.
type: Comment
comment on: http://stackoverflow.com/a/21104884

http://stackoverflow.com/comment/31644822
comment on: http://stackoverflow.com/q/21047701
type: Comment
has text: Fails with OOM Error ?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/32323366
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21383728
type: Comment
has text: Thanks. However, the content of pkcs.cfg may be important. Would it be possible for you to paste it here?

http://stackoverflow.com/a/21176929
score: 1
downvote count: 0
has body: Just try to indent your code properly to avoid confusions. The complete code is here: import java.util.Scanner; public class MatrixMath { public static void main(String[] args) { int m, n, p, q, c, d, k; int sum1 = 0; Scanner scan = new Scanner(System.in); System.out.println("Please enter the number of rows and columns for the first matrix."); m = scan.nextInt(); n = scan.nextInt(); int first[][] = new int[m][n]; System.out.println("Enter the elements of first matrix:"); for ( c = 0 ; c &lt; m ; c++ ) for ( d = 0 ; d &lt; n ; d++ ) first[c][d] = scan.nextInt(); System.out.println("Please enter the number of rows and columns for the second matrix."); p = scan.nextInt(); q = scan.nextInt(); int second[][] = new int[p][q]; int multiply[][] = new int[m][q]; System.out.println("Enter the elements of second matrix:"); for ( c = 0 ; c &lt; p ; c++ ) for ( d = 0 ; d &lt; q ; d++ ) second[c][d] = scan.nextInt(); for ( c = 0 ; c &lt; m ; c++ ) { for ( d = 0 ; d &lt; q ; d++ ) { for ( k = 0 ; k &lt; p ; k++ ) { sum1 = sum1 + first[c][k]*second[k][d]; } multiply[c][d] = sum1; sum1 = 0; } } System.out.println("The product of the two matrices is: "); for ( c = 0 ; c &lt; m ; c++ ) { for ( d = 0 ; d &lt; q ; d++ ) { System.out.print(multiply[c][d]+"\t"); } System.out.print("\n"); } int sum[][] = new int[m][n]; // Sum is calculated. for ( c = 0 ; c &lt; m ; c++ ) { for ( d = 0 ; d &lt; n ; d++ ) { sum[c][d] = first[c][d] + second[c][d]; } } System.out.println("The sum of the two matrices is: "); for ( c = 0 ; c &lt; m ; c++ ) { for ( d = 0 ; d &lt; n ; d++ ) { System.out.print(sum[c][d]+"\t"); } System.out.println(); } } }
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21176802

http://stackoverflow.com/comment/31672577
has text: Updated my post with all of it
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21062242
type: AnswerComment

http://stackoverflow.com/q/21073123
has title: Maven - No plugin found for prefix 'tomcat7' in the current project
downvote count: 0
favorite count: 0
upvote count: 8
answer count: 5
type: UnansweredQuestion
has body: I've created a Maven project with the archetype "webapp" but when I start the command "mvn tomcat7:start", I've the following error : No plugin found for prefix 'tomcat7' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\dark\.m2\repository), central (http://repo.maven.apache.org/maven2)] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. My project structure : -src -main -resources -webapp -WEB-INF -web.xml -index.jsp -target -classes -dependency - // the 'dependency' directory contains all the jar files -lbagno -maven-archiver -surefire lbagno.war My pom.xml contains well the dependency for tomcat. pom.xml 4.0.0 com.myspace lbagno war 0.0.1-SNAPSHOT lbagno Maven Webapp http://maven.apache.org junit junit 3.8.1 test org.springframework spring-core 3.1.0.RELEASE org.apache.tomcat.maven tomcat7-maven-plugin 2.2 maven-plugin lbagno I don't understand why it doesn't work. Do you have any solutions ? Thank you
has answer: http://stackoverflow.com/a/34213506
has answer: http://stackoverflow.com/a/25591370
has answer: http://stackoverflow.com/a/43490294
score: 8
has answer: http://stackoverflow.com/a/28182840
tagged with: maven
type: Question
has answer: http://stackoverflow.com/a/21073158
tagged with: java

http://stackoverflow.com/q/21089354
tagged with: installation
tagged with: java
has answer: http://stackoverflow.com/a/21090021
type: Question
score: 5
has title: Java Browser Plugin Or Manually installing Java
upvote count: 5
has comment: http://stackoverflow.com/comment/31721772
has comment: http://stackoverflow.com/comment/31721742
has body: Here is my question i installed Java Plugin for Chrome it does mean i have installed java in my machine...And after installing this plugin can i run below command java -jar myfile.jar through a batch file or i have to install java in my machine and setup class-path then it should work? If i will install Java browser plugin it automatically installed java in my machine and setup path as well. Its hard for me t understand the situation how it works. Can anyone help me on this?
answer count: 2
has answer: http://stackoverflow.com/a/21089852
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: plugins

http://stackoverflow.com/a/21185703
has body: You can convert the raw files to ASCII atop -r filename.raw &gt; filename.txt and then parse them in Java as usual. I don't think there is a ready made Java library for parsing atop's binary raw format.
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21182242
answers question: http://stackoverflow.com/q/21182242
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/31794460
type: Comment
has text: You can get rid of the first two branches in your regex; `$` covers all the bases.
comment on: http://stackoverflow.com/a/21128367
type: AnswerComment
score: 0

http://stackoverflow.com/q/21019143
tagged with: java
has body: I'm trying to pass null values to a db through xml. email tester@memoir-systems.com password Customer Address I've tried all this but it is taking it as a empty string with length zero and not as a null . my xsd is <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="document"> <xs:complexType> <xs:sequence> <xs:element name="testCaseData" maxOccurs="unbounded" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element type="xs:long" name="id" minOccurs="0"/> <xs:element type="xs:string" name="testCaseName"/> <xs:element type="xs:string" name="expectedResult"/> <xs:element name="parameter" maxOccurs="unbounded" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element type="xs:string" name="key"/> <xs:element name="value" maxOccurs="unbounded" minOccurs="0" nillable="true"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> Can anyone please help me fix this?
score: 2
downvote count: 0
type: UnansweredQuestion
favorite count: 0
type: Question
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/21019269
has title: how do we send null values to a db using xml?
upvote count: 2
answer count: 1

http://stackoverflow.com/q/21164172
type: Question
has comment: http://stackoverflow.com/comment/31858397
has comment: http://stackoverflow.com/comment/31859399
tagged with: jsf-2
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21164361
has comment: http://stackoverflow.com/comment/31858469
has body: I want to display the current locale system date in a jsf page. I'm having the below code but it's not working. &lt;p:column styleClass="columnA"&gt;SOP Date&lt;/p:column&gt; &lt;p:column styleClass="columnB"&gt; &lt;h:outputText value="#{bean.currentDate}" /&gt; &lt;/p:column&gt; The managed bean looks like code: @ManagedBean(name = "bean") public class SopDate implements Serializable { public String currentDate; @PostConstruct public void init(){ SopCurrentDate(); } public void SopCurrentDate(){ DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault()); Calendar cal = Calendar.getInstance(); this.currentDate = df.format(cal.getTime()); } // getter and setter }
has comment: http://stackoverflow.com/comment/31858732
has answer: http://stackoverflow.com/a/21164361
has title: How to display system date on the webpage in JSF?
type: AnsweredQuestion
tagged with: jsf
tagged with: java

http://stackoverflow.com/comment/31608180
score: 0
has text: It depends if the web server allows directory browsing/listing.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21027156

http://stackoverflow.com/comment/31839664
comment on: http://stackoverflow.com/q/21153352
type: QuestionComment
type: Comment
has text: Which line is `wakiliproject.SampleController.setSettersLose(SampleController.java:23)`
score: 0

http://stackoverflow.com/q/21152601
answer count: 0
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/31842234
upvote count: 1
downvote count: 1
tagged with: http
has title: How to get errorstream using HttpURLConnection.getResponseCode() and HttpURLConnection.getErrorStream()?
has body: when I only use HttpURLConnection.getErrorStream(),I can not get errstream.But when I use HttpURLConnection.getResponseCode() before HttpURLConnection.getErrorStream(),then I can get errorstream. like this ,I can get errorstream: if(urlconn.getResponseCode()&gt;=400){ is = urlconn.getErrorStream(); System.out.println("error!!!"); }else{ is=urlconn.getInputStream(); } like this ,I can not get errorstream,'is' is null: is = urlconn.getErrorStream();
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31839200
linked to: http://stackoverflow.com/q/23593486
has comment: http://stackoverflow.com/comment/31839297
tagged with: web
favorite count: 0
has comment: http://stackoverflow.com/comment/31842689
has comment: http://stackoverflow.com/comment/31839606
has comment: http://stackoverflow.com/comment/77839245

http://stackoverflow.com/a/21059927
type: AcceptedAnswer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21059425
has comment: http://stackoverflow.com/comment/31689730
has body: then did an echo, and all I'm getting back is JAVA_HOME. manually did an export JAVA_HOME=/usr/local/jdk1.7.0_13, still nothing once I echo. What's the deal? The deal is you're typing echo JAVA_HOME and it's doing exactly that; printing "JAVA_HOME". You actually did everything correctly as far as your config; to see the contents of the environment variable, you would do: echo $JAVA_HOME
answers question: http://stackoverflow.com/q/21059425
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/31671477
type: QuestionComment
has text: @user2638742 - read ZouZou's comment. If it's not enough, then show the code that you're using and some helpful person will explain.
comment on: http://stackoverflow.com/q/21061828
score: 0
type: Comment

http://stackoverflow.com/comment/90086443
comment on: http://stackoverflow.com/a/37892054
score: 0
type: Comment
has text: This is for a list not an array
type: AnswerComment

http://stackoverflow.com/comment/45586490
type: Comment
has text: There are several tutorials in the internet about that. Here is one for you: http://www.guyrutenberg.com/2013/03/16/manually-install-ssl-certificate-in-android-jelly-bean/
comment on: http://stackoverflow.com/a/21047768
score: 0
type: AnswerComment

http://stackoverflow.com/q/21183281
type: Question
score: 3
has body: How do I set row position and width of a table in iTextpdf?here i need how to set the position of the each cell and how to set line spacing in itextpdf testTable11_close_right.getDefaultCell().setBorder(0); testTable11_close_right.getDefaultCell().setPadding(0); testTable11_close_right.addCell(aarr2); testTable11_close_right.addCell(s6); testTable111.addCell(single_tender_id); testTable111.addCell(s2); testTable111.addCell(s3); testTable111.addCell(testTable11_close_right); PdfPCell cell7 = new PdfPCell(); PdfPTable testTable_dept= new PdfPTable(1); testTable_dept.setWidthPercentage(100); testTable_dept.getDefaultCell().setPaddingTop(0); testTable_dept.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); testTable_dept.addCell(new Phrase(""+temp_department_name,myBoldFont1)); cell7.addElement(testTable_dept); cell7.setBackgroundColor(BaseColor.BLACK); cell7.setHorizontalAlignment(Element.ALIGN_CENTER); table_odd1.addCell(cell7); table_odd1.addCell(testTable111); table_odd.addCell(table_odd1); return table_odd;
upvote count: 3
answer count: 1
favorite count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21183380
has title: i want to set the height of the table row dynamically using itextpdf

android-scrollview
type: Tag
tags question: http://stackoverflow.com/q/21115070
tag name: android-scrollview

http://stackoverflow.com/comment/31681311
has text: Yes, it solved both the flickering and the italics problem. However, now the small-print label's color momentarily becomes dark blue when the fade-in starts and the fade-out ends. I know it's because I do the fading by altering the HTML tag's property on the fly. I only needed HTML for word wrap; is there a text-displaying component that has both horizontal alignment AND word wrap without using HTML? I've been digging through the available components but they either miss one of these or require HTML.
type: Comment
comment on: http://stackoverflow.com/a/21064828
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31696027
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21074845
has text: Hope it helps! Patience and perseverance :-)
type: AnswerComment

http://stackoverflow.com/comment/31739715
comment on: http://stackoverflow.com/a/21098881
has text: Based on the release of jboss the final file name can be different for example in my case useing the integrate eap and as in eclipse the path to the first library was: E:\vpa\jboss\jboss-eap-6.1.0\jboss-eap-6.1\modules\system\layers\base\javax\ejb\api\main\jboss-ejb-api_3.1_spec-1.0.2.Final-redhat-2.jar
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/21111620
upvote count: 3
has body: The database will hash and quickly compare the String values, using indexes designed for the process. Implement it the clean way first and only start to worry if it is too slow. The database will do a good job of accelerating this using thoroughly optimized and tested routines.
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/21111533
score: 3

http://stackoverflow.com/q/21166567
accepted answer: http://stackoverflow.com/a/25971924
favorite count: 0
has answer: http://stackoverflow.com/a/25971924
type: AnsweredQuestion
score: 2
tagged with: boilerpipe
downvote count: 0
has comment: http://stackoverflow.com/comment/40687401
tagged with: java
has body: package com.index; import java.net.URL; import com.opensymphony.xwork2.ActionSupport; import de.l3s.boilerpipe.extractors.ArticleExtractor; public class search_article extends ActionSupport { /** * */ private static final long serialVersionUID = 1L; String article; public String getArticle() { return article; } public void setArticle(String article) { this.article = article; } @Override public String execute() throws Exception { String content = null; URL url = new URL("http://www.nydailynews.com/sports/baseball"); ArticleExtractor ae = new ArticleExtractor(); content = ae.getText(url); System.out.println(content); System.out.println("in execute"); return SUCCESS; } } It Shows following error : HTTP Status 500 - java.lang.reflect.InvocationTargetException
has comment: http://stackoverflow.com/comment/40687454
has title: Im trying using boilerpipe library for article extraction in java
type: Question
has comment: http://stackoverflow.com/comment/31862763
upvote count: 2
answer count: 1

http://stackoverflow.com/q/21147921
has comment: http://stackoverflow.com/comment/31830175
tagged with: timer
has comment: http://stackoverflow.com/comment/31829950
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31829819
has answer: http://stackoverflow.com/a/21148003
has comment: http://stackoverflow.com/comment/31830322
has comment: http://stackoverflow.com/comment/31830675
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31829691
tagged with: algorithm
has body: I'm trying to check the efficiency of this java bubblesort algorithm with a counter and timer. The counter works fine but the timer seems to take into account how long it takes the user to type in the set of numbers to be sorted. I only want the timer to time how long the bubblesort algorithm takes to sort. Any tips or help would be highly appreciated :) public class bubsort { public static void main(String[] args) { int n, c, d, swap; Long startTimer; Scanner in = new Scanner(System.in); System.out.println("Input number of integers to sort"); n = in.nextInt(); int array[] = new int[n]; int counter = 0; System.out.println("Enter " + n + " integers"); for (c = 0; c &lt; n; c++) { array[c] = in.nextInt(); } startTimer = System.nanoTime(); for (c = 0; c &lt; (n - 1); c++) { for (d = 0; d &lt; n - c - 1; d++) { counter++; if (array[d] &gt; array[d + 1]) { swap = array[d]; array[d] = array[d + 1]; array[d + 1] = swap; } } } System.out.println(System.nanoTime() - startTimer + "ms"); System.out.println("Sorted list of numbers"); for (c = 0; c &lt; n; c++) { System.out.println(array[c]); } System.out.println("Counter: " + counter);
has comment: http://stackoverflow.com/comment/31830383
tagged with: sorting
has comment: http://stackoverflow.com/comment/31829734
score: 0
answer count: 1
has title: Java Bubble sort Algorithm timer issues

http://stackoverflow.com/q/21160551
score: 0
has answer: http://stackoverflow.com/a/21163708
answer count: 1
tagged with: maven-3
accepted answer: http://stackoverflow.com/a/21163708
has body: I am working on a fairly big project structure which we recently migrated to maven. The structure is currently as follows: Parent-Project shared core (dependency: "shared") webservice (dependency: "shared", "core") webapp (dependency: "shared") tools gui client (dependency: "shared") reporting client (dependency: "shared") monitoring client (dependency: "shared", "core") ... Every component has it's own project version. How can I automatically create a version.properties file for each build artifact? The properties file needs to contain all version numbers of all components included in the package. Desired output for component webservice: webservice.version=1.0-SNAPSHOT shared.version=0.9 core.version=1.1 Desired output for component webapp: webapp.version=1.1 shared.version=0.9 I know about resource filtering, but I couldn't manage how to include the versions of every dependency.
has title: Create a properties file with version numbers of each dependent component
tagged with: java
tagged with: maven
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/21029364
score: 0
tagged with: jar
has comment: http://stackoverflow.com/comment/31612376
tagged with: maven
has comment: http://stackoverflow.com/comment/31612508
answer count: 0
type: UnansweredQuestion
tagged with: java
has body: I have two java projects: MainProject LibraryProject I use Maven to build my MainProject. In pom.xml of MainProject, I defined the dependency of LibraryProject: com.xxx.LibraryProject LibraryProject 1.0.0-SNAPSHOT jar Under MainProject root path, after I run : maven clean install a MainProject.jar is generated. But those classes defined in LibraryProject & invoked by MainProject are not available in this MainProject.jar. How can I have the LibraryProject classes available in the MainProject.jar ? I have tried Maven Assembly Plugin , but it doesn't work for me. I need the dependency be included in the MainProject.jar
type: Question
has comment: http://stackoverflow.com/comment/31612612
duplicate of: http://stackoverflow.com/q/574594
has title: Have dependencies be included in the final jar
has comment: http://stackoverflow.com/comment/31613220
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31612404

http://stackoverflow.com/q/21141296
downvote count: 0
has answer: http://stackoverflow.com/a/21141821
favorite count: 0
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/21141655
answer count: 4
score: 3
has comment: http://stackoverflow.com/comment/31816952
has comment: http://stackoverflow.com/comment/31817143
tagged with: project
tagged with: java
tagged with: eclipse
has title: How to force Eclipse to see java project as java project?
has answer: http://stackoverflow.com/a/33749389
type: Question
has body: I have downloaded a 3rd party project, which consists of multiple files, including Java ones. General structure is as follows: &lt;topfolder&gt; pom.xml &lt;subfolder1&gt; pom.xml src main java &lt;normalclasspath&gt; resources site apt index.apt test java &lt;normalclasspath&gt; Eclipse imports this project normally, but is unable to index its Java content. For example, I can't browse from a variable to its definition, and so on. Also I can't set my own Build Path since it says No action available. Of course, I can refactor folder structure myself to suite eclipse needs, but are there any automation means for this? UPDATE Yes, this is a Maven project and Eclipse already knows that it has Maven nature. The only option now is to disable it But this is not a question. The question is how to add JAVA NATURE, so that Eclipse knows consistence of classpath and be able to navigate to class definitions and so on. UPDATE 2 @75inchpianist's answer about facets helped partially. It was not available to select Java facet immediately, but required turning on facets at all first. Then Java facet was already there. Now I see, that Eclipse interprets Java, but Maven interpretation is not full. Namely, no Maven dependencies interpreted (no Maven Dependencies node in Package Explorer). The attempt to add it fails:
upvote count: 3
has answer: http://stackoverflow.com/a/21141814

http://stackoverflow.com/comment/31704289
has text: What I've done in the past is to scale the position as well, for [example](http://stackoverflow.com/questions/21070703/how-to-properly-refresh-image-in-jframe/21070799#21070799)
type: QuestionComment
comment on: http://stackoverflow.com/q/21079554
type: Comment
score: 0

http://stackoverflow.com/comment/31723123
comment on: http://stackoverflow.com/a/21045154
type: AnswerComment
score: 0
type: Comment
has text: JTable has similair structure and logics as Database, each row from database is separate row in JTable, then every loop should be creating a new Object[], to put all Object[]s together is Object[][] corresponding with JTables view or database view, shortcut search for TableFromDatabase or ResultSetTableModel

http://stackoverflow.com/comment/31691839
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21073010
type: QuestionComment
has text: Have you considered putting them in a database? That would get you more sophisticated indexing for low programming cost.

http://stackoverflow.com/comment/31800546
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21131319
has text: @Taylor: its working now. can you tell me what was difference in tutorial i was reading on http://www.mkyong.com/spring3/spring-3-mvc-hello-world-example/ and the method suggested by you.

spring-security
tags question: http://stackoverflow.com/q/21117890
tags question: http://stackoverflow.com/q/21049638
tags question: http://stackoverflow.com/q/21036821
tags question: http://stackoverflow.com/q/21109187
tags question: http://stackoverflow.com/q/21090892
tags question: http://stackoverflow.com/q/21022463
tags question: http://stackoverflow.com/q/21148804
tags question: http://stackoverflow.com/q/21071744
tags question: http://stackoverflow.com/q/21153281
tags question: http://stackoverflow.com/q/21097528
tags question: http://stackoverflow.com/q/21040142
tags question: http://stackoverflow.com/q/21159295
tags question: http://stackoverflow.com/q/21123610
type: Tag
tags question: http://stackoverflow.com/q/21130484
tags question: http://stackoverflow.com/q/21039711
tags question: http://stackoverflow.com/q/21088880
tags question: http://stackoverflow.com/q/21123852
tags question: http://stackoverflow.com/q/21096854
tags question: http://stackoverflow.com/q/21049827
tags question: http://stackoverflow.com/q/21078826
tags question: http://stackoverflow.com/q/21034548
tags question: http://stackoverflow.com/q/21144795
tags question: http://stackoverflow.com/q/21094795
tags question: http://stackoverflow.com/q/21144120
tag name: spring-security
tags question: http://stackoverflow.com/q/21036943

http://stackoverflow.com/comment/31802911
score: 0
has text: Where is `theInstructors`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21129365

http://stackoverflow.com/a/21022792
accepted answer of: http://stackoverflow.com/q/21022407
has body: This is just as much an art as it is a science, but one thing that sticks out to me is this: why does your model contain a Timer? Shouldn't that be in the controller? What if you wanted to change the model to support, say, stepping through the simulation? But you should stick with whatever design fits best in your head. The whole point of patterns is to make code more maintainable, and the best way to make code more maintainable is to design it in a way that makes sense to the people who have to work on it. Since that's you, you should do whatever makes sense to you, not strangers on the internet.
has comment: http://stackoverflow.com/comment/31602476
answers question: http://stackoverflow.com/q/21022407
has comment: http://stackoverflow.com/comment/31604346
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31602384
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/31670093
score: 1
has text: @AndrewThompson Right. Not that POST would be very secure but it's slightly better.
type: AnswerComment
comment on: http://stackoverflow.com/a/21061204
type: Comment

http://stackoverflow.com/a/21161006
upvote count: 32
accepted answer of: http://stackoverflow.com/q/21128690
answers question: http://stackoverflow.com/q/21128690
has body: Changing your @PrepareForTest annotation value to MySQLDatabaseConnectionFactory.class will resolve this issue. This annotation tells PowerMock to prepare certain classes for testing. Classes needed to be defined using this annotation are typically those that needs to be byte-code manipulated. This includes final classes, classes with final, private, static. In this situation PowerMockito have to replace invocation to static method DriverManager.getConnection with mocked code. This is done with usage of byte-code manipulation. Full code @RunWith(PowerMockRunner.class) @PrepareForTest(MySQLDatabaseConnectionFactory.class) public class MySQLDatabaseConnectionFactoryTest { private MySQLDatabaseConnectionFactory reference; @Before public void setUp() throws Exception { reference = new MySQLDatabaseConnectionFactory(); } @Test public void testGetConnection() throws SQLException { // given PowerMockito.mockStatic(DriverManager.class); BDDMockito.given(DriverManager.getConnection(anyString(), anyString(), anyString())) .willReturn(mock(Connection.class)); // when reference.getConnection(); // then PowerMockito.verifyStatic(); DriverManager.getConnection("jdbc:mysql://myhost:1111/database", "username", "password"); } } Thanks to @Szpak for helping me to resolve this issue!
type: AcceptedAnswer
downvote count: 0
score: 32
type: Answer

http://stackoverflow.com/q/21062014
has body: I need to access array objects of javascript passed through ajax in java. I am using dojo. This is how I tried to pass values through dojo ajax call. Javascript var arrayObj = [{'id': 4, 'label': 'first', 'value': 'success'}, {'id': 6, 'label': 'second', 'value': 'failed'}]; dojo.xhrPost({ url: "test/deleteItems.json", content: { items: arrayObj }, handleAs: "json", load: function(response) { alert('got response'); } }); In Java(Spring MVC), I tried with List of String, array of Strings in java controller to access the items passed through Javascript Ajax. But none of them got worked with retrieving exact objects passed from Javascript. Java @RequestMapping(value="deleteItems", produces = "application/json") public @ResponseBody String deleteItems( @RequestParam(required = true) String[] items //@Valid @RequestBody List&lt;AnalysisBean&gt; pcptBean ) { /* I need to access the array objects passed from javascript here. */ } How to retrieve the array objects in java controller? Note: I tried with pass multidimensional array through Ajax to java controller. var arrayObj = [[4,'first', 'success'],[6, 'second', 'failed']]; But it didn't work too. I would like to get solution using Dojo/jQuery. Any help will be greatly appreciated.
tagged with: javascript
type: UnansweredQuestion
has title: How we can access the array objects of javascript passing through ajax in java?
downvote count: 0
score: 1
tagged with: jquery
favorite count: 0
type: Question
tagged with: spring
tagged with: dojo
tagged with: java
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/21062500

http://stackoverflow.com/q/21067498
linked to: http://stackoverflow.com/q/27581
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21067622
linked to: http://stackoverflow.com/q/2132334
score: 0
answer count: 2
upvote count: 1
downvote count: 1
has title: Creating int with generated variable name
favorite count: 0
has answer: http://stackoverflow.com/a/21067658
type: UnansweredQuestion
tagged with: android
has body: I have 2 Array list -> ListView, if you click on item in ListView it adds this item to the second ListView. If the clicked item is already in the second list, instead of adding it again it replaces text with number followed by item name. But the counter is global for all items, so if i add another item it still adds the same number for it. I need something that will generate variable name from clicked item name and then adds counter to right item. Here's the code, thanks in advance. menuNapoje.setOnItemClickListener(new OnItemClickListener(){ int pocet= 2; String x = "x "; @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { if(rekapitulaceObjArray.contains(menuNapojeArray.get(position)) || rekapitulaceObjArray.contains(pocet-1 + x + menuNapojeArray.get(position))) { rekapitulaceObjArray.set(position, pocet + x + menuNapojeArray.get(position)); pocet++; } else { rekapitulaceObjArray.add(menuNapojeArray.get(position)); } rekapitulaceAdapter.notifyDataSetChanged(); Toast.makeText(getApplicationContext(), "Položka " + menuNapojeArray.get(position) + " byla pridána", Toast.LENGTH_SHORT).show(); } });

http://stackoverflow.com/a/21022127
has body: If multiple dispatch is not what you want, can you cast the argument in the test script? test.runTest( (Object) [1,2,3] )
has comment: http://stackoverflow.com/comment/32532017
answers question: http://stackoverflow.com/q/21020261
downvote count: 0
score: 3
type: Answer
upvote count: 3

http://stackoverflow.com/comment/105335014
type: Comment
score: 0
comment on: http://stackoverflow.com/a/59584178
type: AnswerComment
has text: Please explain why your code is helpful. That will improve your answer a lot!

http://stackoverflow.com/a/21117508
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21117324
has comment: http://stackoverflow.com/comment/31777462
has comment: http://stackoverflow.com/comment/31776949
upvote count: 5
has comment: http://stackoverflow.com/comment/31776849
type: Answer
has body: Your question is kinda confusing. I'll try to answer two different aspects of the question. How can I test validation annotations? If those validation Annotations conforms to Java JSR-303 Bean Validation (which seems to be this case), you can validate those objects and make the desired assertions on Unit Tests using Hibernate Validator or another implementation. Example: public class FooTest { private static Validator validator; @BeforeClass public static void setUp() { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); validator = factory.getValidator(); } @Test public void checkIfIsNull() { Foo foo = new Foo(); // Field is null at this point Set&lt;ConstraintViolation&lt;Car&gt;&gt; constraintViolations = validator.validate(foo); assertTrue(constraintViolations.size() &gt; 0); } } -- For example how would I go about ensuring that when I attempt to set the description, that it will throw an error (if used by things that recognize the annotations) if I do Foo.new.describe(' ') or Foo.new.describe(null) You're talking about runtime validation here, not Unit Testing. You can check and throw the recommended exception this way: public void describe(String desc) { if (desc == null || desc.trim().isEmpty()) throw new IllegalArgumentException("[desc] parameter is null or empty"); ... } PS: Here I'm assuming that the describe(String) method is not actually setDescription(String).
has comment: http://stackoverflow.com/comment/31777527
score: 5
answers question: http://stackoverflow.com/q/21117324

http://stackoverflow.com/comment/31856431
score: 0
comment on: http://stackoverflow.com/a/21163106
type: AnswerComment
type: Comment
has text: Mikhail, could you please suggest me any alternative? Thanks!

http://stackoverflow.com/comment/31644345
has text: What do you think the error means?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21047544
score: 10

http://stackoverflow.com/a/24207232
score: 1
has body: Please the check the following Click Start >Programs -> Microsoft Sql Server 2008 R2 -> Configuration Tools -> Sql Server Configuration Manager Click Sql Server Network Configuration Click Protocols for SQLExpress Double click TCP/IP and click IP adrress tab Go to the end till you see IP ALL Ensure that you see port number 1433 is configured under TCP Port under IPALL header. If not configured, enter 1433 port and click Apply. You need to restart the MS sql server and try now and it should work. Hope this will solve it.
upvote count: 2
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21114474

http://stackoverflow.com/q/21158043
has comment: http://stackoverflow.com/comment/31852061
has comment: http://stackoverflow.com/comment/31852709
tagged with: jspinner
tagged with: java
has comment: http://stackoverflow.com/comment/31851008
answer count: 1
accepted answer: http://stackoverflow.com/a/21163332
has comment: http://stackoverflow.com/comment/31852311
upvote count: 3
has comment: http://stackoverflow.com/comment/31851398
has answer: http://stackoverflow.com/a/21163332
has comment: http://stackoverflow.com/comment/31850364
has comment: http://stackoverflow.com/comment/31853003
favorite count: 0
has comment: http://stackoverflow.com/comment/31851570
has title: JSpinner not showing minimum value on pressing down arrow
downvote count: 0
has comment: http://stackoverflow.com/comment/31851068
tagged with: swing
has body: Greetings to all of this gr8 StackOverflow community. This is my first question after trying to solve it myself and thus is kinda long... :-) I'm having problem with getting the minimum specified value of JSpinner using the down arrow key. It accepts the value if typed in the text field. Everything else works fine. The strange part of this is, that this occurs in only some combination of Spinner models, specifically new SpinnerNumberModel(29.6, 29.6, 118.1, 0.1) and new SpinnerNumberModel(2.00, 2.00, 6.00, 0.01). Below see the code of 2 JSpinners that have this problem. I'm not sure why these models create the problems and if there are more models that have this problem. import java.awt.EventQueue; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JSpinner; import javax.swing.SpinnerNumberModel; public class JSpinnerBug { private JFrame frame; private JSpinner spinner; private JSpinner spinner_1; private JButton btnChangeValue_1; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { JSpinnerBug window = new JSpinnerBug(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public JSpinnerBug() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[]{119, 88, 105, 0}; gridBagLayout.rowHeights = new int[]{25, 0, 0}; gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE}; gridBagLayout.rowWeights = new double[]{0.0, 0.0, Double.MIN_VALUE}; frame.getContentPane().setLayout(gridBag…
type: Question
type: AnsweredQuestion
score: 3

http://stackoverflow.com/q/21060661
type: Question
score: 5
downvote count: 0
tagged with: spring-batch
has answer: http://stackoverflow.com/a/21107169
linked to: http://stackoverflow.com/q/10651830
answer count: 1
has title: Transaction Issue with Spring Batch JobRepository in Unit Test
favorite count: 0
accepted answer: http://stackoverflow.com/a/21107169
type: AnsweredQuestion
tagged with: transactions
upvote count: 5
tagged with: java
has body: Could anybody help me figure out the solution to the following exception, I guess I just don't quite understand the Transaction Propagation mechanism, which hinder me from understanding the true meaning of the exception message shown below, so please, help me understanding the whole thing, thank you so much indeed! java.lang.IllegalStateException: Existing transaction detected in JobRepository. Please fix this and try again (e.g. remove @Transactional annotations from client). at org.springframework.batch.core.repository.support.AbstractJobRepositoryFactoryBean$1.invoke(AbstractJobRepositoryFactoryBean.java:164) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at com.sun.proxy.$Proxy15.createJobExecution(Unknown Source) at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:111) at TestJob.testExcelParserTasklet(TestJob.java:36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80) at org.testng.internal.MethodInvocationHelper$1.runTestMethod(MethodInvocationHelper.java:169) at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:158) Here is the code resulting the above exception: public class TestJob extends BaseTest { @Test public void testExcelParserTasklet() throws JobParametersInvalidException, JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException, NoSuchJobException { Job job = jobRegistry.getJob("parseExcelJob"); jobLauncher.run(job, new JobParameters());…

http://stackoverflow.com/a/21056258
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31661299
downvote count: 0
has comment: http://stackoverflow.com/comment/31661212
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/21056057
accepted answer of: http://stackoverflow.com/q/21056057
score: 3
has body: javax.sound is the official, documented, supported, Java Sound API. It should be included in any 1.3+ JRE. Use it with confidence that it will be there in the next release. sun.audio isn't (the majority of those things). Don't use it.

http://stackoverflow.com/a/21041417
type: Answer
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/21041288
downvote count: 0
has body: You can use the following regex to match only octal numbers: ^0[1-7][0-7]*$ ^,$: Anchors 0: A literal 0. All octal numbers begin with a 0. [1-7]: Char class for digits from 1 to 7 as only these are valid octal digits. *: Quantifier for zero or more of the previous thing. So basically this regex matches only those strings that have a 0 in the beginning and contain one or more digits from 1 to 7. If the leading 0 requirement is not there you can use the regex: ^[1-7][0-7]*$

http://stackoverflow.com/a/21065479
accepted answer of: http://stackoverflow.com/q/21064913
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21064913
has body: It is not quite possible to do what you want since all your apps use a different package name. As Henry suggested, you can update all your apps and tell the user to install the new app. The other (not so recommended) option would be to create your consolidated app and generate a different apk for each app you already have on the Store, modifying only the package name. All the users will be able to have the consolidated app without the need to install a new app. However, it is a bad approach since you will have many copies of the same app in the store, which may lead you into troubles (not so easy to maintain and probably problems with Google).
type: Answer
score: 0

http://stackoverflow.com/a/21070711
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21070616
has body: First of all: If this is a homework, stop using static! I would mark this as wrong for sure if I would correct it. Instead, instantiate the board in a main method like this: public static void main (String[] args){ ConnectFour connectFour = new ConnectFour(); } Second: Your clearBoard method is wrong. You need to set a new emptyLabel for each Panel. So call the constructor of a JPanel and pass the EmptyCircle ImageIcon. Use this object on the gridComponent's add method.

http://stackoverflow.com/comment/31681245
type: Comment
comment on: http://stackoverflow.com/a/21041147
score: 1
has text: So I created a SessionThreadLocalWrapper (http://pastebin.com/ybqLe2sV). This injected into all of the services and this then delegates all the session related requests to the SessionImpl belonging to the actual thread. You can find the full sourcecode here: https://github.com/reluxa/VDC
type: AnswerComment

http://stackoverflow.com/comment/31729399
comment on: http://stackoverflow.com/a/21093070
score: 0
type: AnswerComment
type: Comment
has text: No, that's not what I'm saying. What I meant is you can use Thread.sleep(), but not in the EDT.

http://stackoverflow.com/comment/31769686
type: AnswerComment
has text: @daba contention is a local not global concept. You have contended locks not systems. The only way to figure out how contended a lock is, is to profile the code.
type: Comment
comment on: http://stackoverflow.com/a/21102677
score: 0

http://stackoverflow.com/q/21167464
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/21329746
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21373671
has title: JSTL Populate server-side variables
score: 2
tagged with: java
has body: Download the NetBeans project here. File -> Download Using JSTL 1.2 I'm trying to get my web app to remember my input and then place it into the input box for me after submitting the form but for some reason it doesn't remember it. I just have 1 .java class and .jsp file. PersonController.java package controller; public class PersonController { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } index.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ page import="controller.PersonController" %> <jsp:useBean id="personController" class="controller.PersonController" scope="session"/> <jsp:setProperty name="personController" property="name" param="name"/> PersonController <input name="name" maxlength="30" type="text" id="name" value="<c:out value="${personController.name}"/>"> Errors HTTP Status 500 - /index.jsp (line: 4, column: 0) The value for the useBean class attribute controller.PersonController is invalid. If it does not show error #1 then it will not populate the input field name after posting with previous input.
type: Question
tagged with: jstl
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/21189663

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/21021191
tags question: http://stackoverflow.com/q/21040409
tags question: http://stackoverflow.com/q/21043741
tags question: http://stackoverflow.com/q/21064578
type: Tag
tags question: http://stackoverflow.com/q/21039362
tags question: http://stackoverflow.com/q/21116971
tags question: http://stackoverflow.com/q/21043681
tags question: http://stackoverflow.com/q/21068698

http://stackoverflow.com/q/21093543
tagged with: jax-ws
upvote count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31739170
tagged with: websphere-7
tagged with: wsdl
downvote count: 0
has body: Excuse me for my english I have an application that uses jax-ws and spring, it work on tomcat fine, but i should deploy it on Websphere 7. WAS7 throws the following exception: 00000027 WSModuleDescr E WSWS7027E: JAX-WS Service Descriptions could not be correctly built because of the following error: javax.xml.ws.WebServiceException: WSWS7054E: The Web Services Description Language (WSDL) file could not be generated for the com.foo.MyEndpoint Web service implementation class because of the following error: java.lang.Exception: A WSDL Definition could not be generated for the implementation class: com.foo.MyEndpoint at com.ibm.ws.websvcs.wsdl.WASWSDLGenerator.generateWsdl(WASWSDLGenerator.java:230) my endpoint classes are: @WebService(endpointInterface = "com.foo.MyService", targetNamespace = "http://www.foo.com/xsd") public class MyEndpoint implements MyService { ... } and interface is: @WebService(portName = "MyPort", serviceName = "MyService", targetNamespace = "http://www.foo.com/xsd") public interface MyService { ... } Any idea what can cause that problem? How to check, what exactly is wrong here? The error message is too vague...
favorite count: 0
has comment: http://stackoverflow.com/comment/31731676
type: Question
answer count: 2
score: 5
has title: Websphere 7 error: A WSDL Definition could not be generated for the implementation class
tagged with: web-services
has answer: http://stackoverflow.com/a/53229958
has answer: http://stackoverflow.com/a/21235947
has comment: http://stackoverflow.com/comment/31732322
tagged with: java

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/21181039
tags question: http://stackoverflow.com/q/21040117
tags question: http://stackoverflow.com/q/21148777
tags question: http://stackoverflow.com/q/21147720
tag name: osx-mavericks

http://stackoverflow.com/a/21041449
type: Answer
has body: try this public final class ModelInput { ... public static class Builder { private long userid; ... public Builder setUserId(long userId) { this.userId = userId; } ... public ModelInput build() { return new ModelInput(userId,... } } }
answers question: http://stackoverflow.com/q/21040771
score: 0

http://stackoverflow.com/comment/31756556
type: AnswerComment
has text: Thanks, but my app work only on Galaxy S3 and S4 so I know for sure that They are support both Autofocus and Flash light.
type: Comment
comment on: http://stackoverflow.com/a/21107888
score: 0

http://stackoverflow.com/comment/31763482
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21112050
score: 0
has text: It's hard to figure your question but you seem to be looking for the remainder `%` operator.

http://stackoverflow.com/comment/31852099
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21160607
has text: @Raffaele Rossi: Because I need to keep a track of original position of the dist value. In this case dist has columns and rows.
type: QuestionComment

http://stackoverflow.com/q/21133337
tagged with: digital-signature
has comment: http://stackoverflow.com/comment/31825145
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21133476
tagged with: java
tagged with: certificate
has body: So, I have this website that contains a java applet (before you insult me, no, I can't replace it with HTML5/JS, I am not responsible for this), but the latest java update prevents websites from running self signed applets. Of course my applet is self signed, so how do I "get it signed"?
type: Question
tagged with: applet
has title: How do I get a java applet signed?
score: 0
accepted answer: http://stackoverflow.com/a/21133476
answer count: 1

http://stackoverflow.com/q/21080842
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21080925
has comment: http://stackoverflow.com/comment/31706636
tagged with: java
has comment: http://stackoverflow.com/comment/31939795
has comment: http://stackoverflow.com/comment/31706562
has comment: http://stackoverflow.com/comment/31706687
type: Question
has comment: http://stackoverflow.com/comment/31706655
linked to: http://stackoverflow.com/q/8759868
has body: New to Java on this end. I'm trying to run a program that rolls two dice and when the total roll between the two die is either 7 or 11 the program will exit. For some reason my while statement is executing over and over again, and I can't figure out why. Any help would be really appreciated. Code is below. Again, very new to this. Not so much focused on a more efficient way to do this at the very moment, but rather the semantic details of why this is not functioning. // import required packages for the program // import all classes to be on the safe side // will be using input/ouput and math, so those imports are needed import java.io.*; import java.math.*; import java.text.*; // Declare a class, class name Dice chosen public class Dice { // need to use throws IOException because we are dealing with input and output, simple main method will not suffice public static void main(String[] args) throws IOException { // declare variables for the two dice, randomize each // die can each be rolled for # between 1-6 double dice1 = Math.round(Math.random() * 6) + 1; double dice2 = Math.round(Math.random() * 6) + 1; // declare variable for combined roll double totalRoll = dice1 + dice2; //create loop to determine if totalRoll is a 7 or 11, if not continue rolling while ((totalRoll != 7.0) || (totalRoll != 11.0)) { dice1 = Math.round(Math.random() * 6) + 1; dice2 = Math.round(Math.random() * 6) + 1; totalRoll = dice1 + dice2; System.out.println("The roll on die 1 is: " + dice1); System.out.println("The roll on die 2 is: " + dice2); System.out.println("The total of the two rolls is: " + totalRoll + "\n"); if ((totalRoll == 7.0) || (totalRoll == 11.0)) { System.out.println("You win!"); } } /* // declare in as a BufferedReader; used to gain input from the user BufferedReader in; in = new BufferedReader(new InputStreamReader(System.in)); //Simulate tossing of two dice */ } }
score: -1
has comment: http://stackoverflow.com/comment/31706618
has answer: http://stackoverflow.com/a/21080949
tagged with: while-loop
has comment: http://stackoverflow.com/comment/31706549
possible better answer: http://stackoverflow.com/a/21080925
has answer: http://stackoverflow.com/a/21209584
has title: While loop not exiting
has answer: http://stackoverflow.com/a/21081078
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21080896
has comment: http://stackoverflow.com/comment/31706664
upvote count: 0
accepted answer: http://stackoverflow.com/a/21080896
answer count: 5
linked to: http://stackoverflow.com/q/6786254
has comment: http://stackoverflow.com/comment/31706584

http://stackoverflow.com/a/21152586
has body: Looks like you're trying to use the same ResultSet for both tables. new JTable(writeItemResult(res4)); The two tables are both using res4. The problem with this is that the first will work fine, but it exhausts the data from the ResultSet. The data had been run through. So trying to can rs.next() in the second writeItemResult(res4) will return nothing but the column headers, as that's just meta data A default ResultSet object is not updatable and has a cursor that moves forward only. Thus, you can iterate through it only once and only from the first row to the last row. It is possible to produce ResultSet objects that are scrollable and/or updatable.The following code fragment, in which con is a valid Connection object, illustrates how to make a result set that is scrollable and insensitive to updates by others, and that is updatable. Statement stmt = con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = stmt.executeQuery("SELECT a, b FROM TABLE2"); // rs will be scrollable, will not show changes made by others, // and will be updatable static final int TYPE_SCROLL_INSENSITIVE - The constant indicating the type for a ResultSet object that is scrollable but generally not sensitive to changes to the data that underlies the ResultSet. static final int CONCUR_READ_ONLY - The constant indicating the concurrency mode for a ResultSet object that may NOT be updated. So you must do the above to make the ResultSet scrollable. Then you need to use void beforeFirst() throws SQLException - Moves the cursor to the front of this ResultSet object, just before the first row. This method has no effect if the result set contains no rows. So if you just put res4.beforeFirst() in your writeItemResult() it should work for the second tables also. Also, on a side note, if you want the tables to use the same data, why not just have them share the same TableModel? table2.setModel(table1.getModel());
answers question: http://stackoverflow.com/q/21150934
type: Answer
accepted answer of: http://stackoverflow.com/q/21150934
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/31903188
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21138357
score: 4
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/21138317
has body: Thing is, why does it wait the 500ms 10 times in the loop THEN do the rest of everything in the for loop. It doesn't. It executes the iterations of the loop, once every 500ms - and then you allow the UI thread to actually display the updates. Add some logging in the loop and you'll see that "one iteration per 500ms" behaviour. Basically, you're blocking the UI thread. Don't do that. Read the Android Processes and Threads guide for more details and alternatives.

http://stackoverflow.com/a/21114007
answers question: http://stackoverflow.com/q/21113935
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: If you want to get notified whenever you list is updated, you can use an ObservableCollection. It will trigger an event whenever your list is modified. Also I'm not sure if you are using the model correctly. Is m_model.processUrl(url); a Setter? If not you should move the logic from that method into the controller. The model should only store the data with minimal (or no) logic.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21113935
score: 1

http://stackoverflow.com/comment/31681310
score: 0
type: AnswerComment
has text: OK, I'll look into using JNLP. Haven't needed such fluff beforem but now... Meanwhile I presume paying money to Verisign is still a must? (Thwates seem to have pulled the free certification they used to offer.) As for HTML5/JS... it means using something like JSON to talk to the server and a brand-new server-side application that I have to keep in step with the (separate) client-side code... sigh.
comment on: http://stackoverflow.com/a/21066906
type: Comment

http://stackoverflow.com/comment/31600866
has text: I picked up the term 'frame' mostly from dealing with [`Clip`](http://docs.oracle.com/javase/7/docs/api/javax/sound/sampled/Clip.html) which has at least 3 method names mentioning it. Perhaps that is the Java Sound team's very 'local' term for a sample. But I do understand what you mean by sample, they are the same thing. I'd have up-voted your answer (and down-voted the other one) if I had any votes remaining for the day. Your answer contains some good information.
type: Comment
comment on: http://stackoverflow.com/a/21022977
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31650319
has text: OK Marco, I'll test the code on my machine.
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21050130

http://stackoverflow.com/q/21076207
score: 0
has title: Android failed to upload multiple type of files to PHP server
linked to: http://stackoverflow.com/q/22101515
has comment: http://stackoverflow.com/comment/31697855
has comment: http://stackoverflow.com/comment/34027708
tagged with: php
answer count: 1
linked to: http://stackoverflow.com/q/2017414
linked to: http://stackoverflow.com/q/18964288
tagged with: java
has comment: http://stackoverflow.com/comment/31697702
has comment: http://stackoverflow.com/comment/31697922
has answer: http://stackoverflow.com/a/24662799
tagged with: apache
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34024411
has comment: http://stackoverflow.com/comment/31698259
tagged with: android
has body: I'm trying to upload an image file and an audio file from Android to the Php server at the same time, this is the upload method on Android part: public String postFile(File image,File audio) throws Exception { HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(uploadUrl); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); FileBody fbImage = new FileBody(image); FileBody fbAudio = new FileBody(audio); builder.addPart("image", fbImage); builder.addPart("audio", fbAudio); final HttpEntity yourEntity = builder.build(); class ProgressiveEntity implements HttpEntity { @Override public void consumeContent() throws IOException { yourEntity.consumeContent(); } @Override public InputStream getContent() throws IOException, IllegalStateException { return yourEntity.getContent(); } @Override public Header getContentEncoding() { return yourEntity.getContentEncoding(); } @Override public long getContentLength() { return yourEntity.getContentLength(); } @Override public Header getContentType() { return yourEntity.getContentType(); } @Override public boolean isChunked() { return yourEntity.isChunked(); } @Override public boolean isRepeatable() { return yourEntity.isRepeatable(); } @Override public boolean isStreaming() { return yourEntity.isStreaming(); } // CONSIDER put a _real_ delegator into here! @Override public void writeTo(OutputStream outstream) throws IOException { class ProxyOutputStream extends FilterOutputStream { public ProxyOutputStream(OutputStream proxy) { super(proxy); } public void write(int idx) throws IOException { out.write(idx); } public void write(byte[] bts) throws IOException { out.write(bts); } public void write(byte[] bts, int st, int end) throws IOException { out.write(bts, st, end); } public void flush() throws IOException { out.flush(); } public void close() throws IOException { out.close(); } } // CONSIDER import this class (and risk more Jar File Hell) class P…
has comment: http://stackoverflow.com/comment/34027547
type: Question

http://stackoverflow.com/a/21079915
has comment: http://stackoverflow.com/comment/31705585
answers question: http://stackoverflow.com/q/21079868
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/31704700
downvote count: 0
has comment: http://stackoverflow.com/comment/31706389
type: Answer
has comment: http://stackoverflow.com/comment/31704624
has body: The init is called once on startup. So you have to live with a partial returnTo, and on request handling (doGet/doPost) complete it with the request parameters. In fact the manager seems to be request dependent and hence should be created in the request - never as field. As there might be several requests. Maybe persisting as session attribute.

http://stackoverflow.com/q/21096862
tagged with: http://stackoverflow.com/tag/csv
has answer: http://stackoverflow.com/a/21097201
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/21167800
tagged with: java
has answer: http://stackoverflow.com/a/21098165
type: Question
tagged with: tomcat
has title: Read a file from Tomcat webapps on different Tomcats
has body: Consider the following: I got a csv-file. This file is stored in the tomcat wepapps directory. The path to this directory is dependent of the computer used. There are users that use different locations for their Tomcats and use different names. I want to achieve the following. Via Spring i did the following: I got an action which imports some data from the csv to the database. &lt;bean id="setCsvPathAction" class="custom.action.importcsv.SetCsvPathAction"&gt; &lt;property name="csvPath" value="C:/temp/test.csv"/&gt; &lt;/bean&gt; This works fine for me. To make this path more configurable for others i got a system.properties file. With this file you can easily overrite properties: setCsvPathAction.csvPath=#{tomcat_home}/webapps/test.csv That is what i want. I want the path to be on the Tomcat webapps directory. The above doesn't work. Do you have any hint how to achieve this?
score: 0
answer count: 3

http://stackoverflow.com/q/21052695
tagged with: authentication
has answer: http://stackoverflow.com/a/21053403
type: Question
has body: I am working on a research project for a university, and I must build a portal-like web application where they see analysis information about their academic performances. My web application is built using the Apache Wicket framework. I need to use the university's CAS authentication server and use its login page to validate the user credentials. However, I also want to retrieve the name the user entered as username, as I need it for storage in session variables and use for the duration of the session. I saw that CAS has a client for Apache Wicket, but I can't see how I can retrieve the username. Any help would be appreciated, Jeremie
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21053403
tagged with: cas
has title: How to retrieve user name from CAS in Apache Wicket
tagged with: wicket
type: AnsweredQuestion
tagged with: java
tagged with: web-applications

http://stackoverflow.com/comment/31631121
score: 0
type: Comment
type: QuestionComment
has text: still the same for both..:(
comment on: http://stackoverflow.com/q/21039849

http://stackoverflow.com/q/21083326
tagged with: java
has comment: http://stackoverflow.com/comment/31711639
type: Question
has body: I am new to server client connection between objective c and java. I am trying to send from the client an NSString to the java server and print it at the server here is my code. [inputStream setDelegate:self]; [outputStream setDelegate:self]; [inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [inputStream open]; [outputStream open]; [self initNetworkCommunication]; NSString *response = @"testt\n"; NSData *data = [[NSData alloc] initWithData:[response dataUsingEncoding:NSASCIIStringEncoding]]; [outputStream write:[data bytes] maxLength:[data length]]; } - (void)initNetworkCommunication { CFReadStreamRef readStream; CFWriteStreamRef writeStream; CFStreamCreatePairWithSocketToHost(NULL, (CFStringRef)@"localhost", 6789, &amp;readStream, &amp;writeStream); inputStream = (__bridge NSInputStream *)readStream; outputStream = (__bridge NSOutputStream *)writeStream; } the server code: ServerSocket welcomeSocket=new Socket(6789); while(true){ Socket connectionSocket=welcomeSocket.accept(); BufferedReader inFromClient=new BufferedReader(new InputStreamReader(connectionSocket.getInputStream()); System.out.println(inFromClient.readLine()); }
score: 0
answer count: 1
tagged with: objective-c
accepted answer: http://stackoverflow.com/a/21083511
has comment: http://stackoverflow.com/comment/31711488
has title: how to send from an objective-c client to a java server?
tagged with: sockets
has answer: http://stackoverflow.com/a/21083511
type: AnsweredQuestion

http://stackoverflow.com/q/21147368
favorite count: 0
tagged with: android
tagged with: hex
tagged with: encryption
has comment: http://stackoverflow.com/comment/31828684
has body: here are the whole story: (1) I have string "123"; (2) Encrypt to "????g*Ox*??D#?\v" using EncryptFromBase64; (3) Converted to hex string using ConvertStringToHex Here is the C# code. public string ConvertStringToHex(string asciiString) { string hex = ""; foreach (char c in asciiString) { int value = Convert.ToInt32(c); // Convert the decimal value to a hexadecimal value in string form. hex += String.Format("{0:X2}", value); } return hex; } public string ConvertHexToString(string HexValue) { string StrValue = ""; while (HexValue.Length &gt; 0) { StrValue += System.Convert.ToChar(System.Convert.ToUInt32(HexValue.Substring(0, 2), 16)).ToString(); HexValue = HexValue.Substring(2, HexValue.Length - 2); } return StrValue; } public string Encrypt(byte[] encryptedData) { byte[] newClearData = rijndaelEncryptor.TransformFinalBlock(encryptedData, 0, encryptedData.Length); return Encoding.ASCII.GetString(newClearData); } public string EncryptFromBase64(string encryptedBase64) { if (encryptedBase64.Length &lt; 1) return ""; byte[] bytes = Encoding.ASCII.GetBytes(encryptedBase64); return Encrypt(bytes); } (4)The hex string is then transported to Android request command to C# web service and converted back to string. using convertHexToString (5) Decryt using decryptAsBase64. There is padding exception. Here is the android code. public String decryptAsBase64(String clearData) { if(clearData.length() &lt; 1) return ""; byte[] encryptedData = clearData.getBytes(); byte[] decryptedData = decryptAsBase64(encryptedData); String str = Base64.encodeBytes(decryptedData); str = str.replace("+", "%2B"); return str; } public byte[] decryptAsBase64(byte[] clearData) { byte[] decryptedData =decrypt(clearData); try { return Base64.decode(decryptedData); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return decryptedData; } public byte[] decrypt(byte[] clearData) { byte[] decryptedData; try { decryptedData = aesCipher_Decoder.doFinal(clearData); } catch (Ill…
upvote count: 1
possible better answer: http://stackoverflow.com/a/21147470
has answer: http://stackoverflow.com/a/21166217
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21147470
has title: stringToHex and hexToString C# anf Android Java
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31828785
type: Question
has comment: http://stackoverflow.com/comment/31828608
tagged with: c#
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/21166217

http://stackoverflow.com/comment/31854651
score: 0
type: AnswerComment
has text: Thank you for replying. Do you think you can show me in example code what you mean for delta as I am still bit unsure on the matter. Sorry again.
type: Comment
comment on: http://stackoverflow.com/a/21147667

http://stackoverflow.com/comment/31820719
has text: Yeah this stopped the whole program :/
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21143472

http://stackoverflow.com/q/21027520
has body: I am sort of new to java and I am currently attempting to make a small Naughts and Crosses program complete with "a.i.". I decided to let the computer make it's move by comparing the current 2d char array to an enum of 2d arrays that have been set up with multiple scenarios and then to move accordingly. The only problem at the moment is that I am unsure as to how to make a 2d char array inside an enum with specific values. If anyone could specify as to how I would accomplish this that would be great, or maybe I'm going about the problem the wrong way? Any help regarding the matter would be highly valued, thank-you.
type: UnansweredQuestion
has title: How do I create multiple two dimensional arrays in an enum?
answer count: 4
tagged with: enums
has answer: http://stackoverflow.com/a/21027773
has answer: http://stackoverflow.com/a/21027780
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21027692
score: 0
has comment: http://stackoverflow.com/comment/31608975
has answer: http://stackoverflow.com/a/21027642

http://stackoverflow.com/a/21150008
has comment: http://stackoverflow.com/comment/31851019
has comment: http://stackoverflow.com/comment/31836745
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/31867531
answers question: http://stackoverflow.com/q/21149785
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21149785
type: Answer
has comment: http://stackoverflow.com/comment/31842665
has body: Short answer: no, you should do this in your application code by generating all the 3-letter substrings and checking if the password contains any of them. But if you feel adventurous, you could still summon a bloody regex monster from a 19th century gothic novel to achieve this. See @sln's and @Floris's answers for that. My 2cents: that's a very, very bad idea. Regex are great when you have a fixed, regular syntactical structure to recognize, which is not your case.

http://stackoverflow.com/comment/31893447
has text: I did get the result by tweaking the regex given by @Keppil
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21182973

http://stackoverflow.com/comment/31750485
score: 0
type: Comment
type: QuestionComment
has text: Other Google search results will turn up other references, but even restricted to the OpenJDK site, the results can be less than useful -- e.g. use Google to search for `Inet4Address site:http://hg.openjdk.java.net/` So, download a source bundle instead and unpack the archive. On Windows, use the search tool of your choice, even Windows search after an index update. On Linux, Unix, or Mac OS X, enter this on the command line in the root directory of the unpacked files: `find . -type f -print0 | xargs -0 egrep -l Inet4Address` That will return the files containing "Inet4Address."
comment on: http://stackoverflow.com/q/21085423

http://stackoverflow.com/a/21177829
has comment: http://stackoverflow.com/comment/31921376
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21147625
score: 22
answers question: http://stackoverflow.com/q/21147625
has body: memberOf is a constructed attribute. You have to add the user to the group's member property, not add the group to the user's memberOf property.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31921330
type: Answer
upvote count: 22

http://stackoverflow.com/comment/31786334
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21123176
has text: Option B: don't fight the percent operator, and format the value `(d/100)` :)

http://stackoverflow.com/a/21123237
upvote count: 5
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21122447
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21122447
has body: You don't represent it. The import simply denotes some syntactic sugar so that so that you don't have to refer to every class with its full qualified name. Thereby it makes the code easier to read and write. They are optional and have no bearing on the model representation of your class, which is what you are documenting with UML.
type: Answer
score: 5

http://stackoverflow.com/comment/31863653
score: 0
has text: Wow.. you seem to know much about this subject. Thank you very much for helping me out. Where did you learn this kind of stuff? (it's working btw)
type: Comment
comment on: http://stackoverflow.com/a/21165663
type: AnswerComment

http://stackoverflow.com/a/21106274
score: 3
answers question: http://stackoverflow.com/q/21105738
downvote count: 0
type: Answer
upvote count: 3
has body: I changed your code to get rid of all of the creation of Vector and Double objects in favor of using a fix-sized matrix (which does assume you know or can calculate the number of rows and columns in the file ahead of time). I threw 500,000 line files at it and was seeing about 25% improvement. private static double[][] readTXTFile(String csvFileName, int skipRows) throws IOException { BufferedReader stream = null; int totalRows = 500000, totalColumns = 6; double[][] matrix = new double[totalRows][totalColumns]; try { stream = new BufferedReader(new FileReader(csvFileName)); for (int currentRow = 0; currentRow &lt; totalRows; currentRow++) { String line = stream.readLine(); if (currentRow &lt;= skipRows) { continue; } String[] splitted = line.split(","); for (int currentColumn = 0; currentColumn &lt; totalColumns; currentColumn++) { matrix[currentRow][currentColumn] = Double.parseDouble(splitted[currentColumn]); } } } finally { if (stream != null) { stream.close(); } } return matrix; }

http://stackoverflow.com/comment/31799667
comment on: http://stackoverflow.com/a/21131276
type: AnswerComment
type: Comment
score: 1
has text: Of course it is possible without grouping *to look for a condition that depends on several parts of information and then only retrieve a specific part of that information*. The OP has not been far away.

http://stackoverflow.com/comment/31746715
type: QuestionComment
has text: How many times should the trigger fire, 0 or 1? The code above suggests 0, but I can't see the point of creating a trigger that never fires.
comment on: http://stackoverflow.com/q/21101715
score: 0
type: Comment

http://stackoverflow.com/a/21142431
has comment: http://stackoverflow.com/comment/31819900
score: 2
has comment: http://stackoverflow.com/comment/31819104
has comment: http://stackoverflow.com/comment/31821267
upvote count: 2
has comment: http://stackoverflow.com/comment/31819847
answers question: http://stackoverflow.com/q/21142317
has comment: http://stackoverflow.com/comment/31819162
has comment: http://stackoverflow.com/comment/31820748
has comment: http://stackoverflow.com/comment/31819685
has comment: http://stackoverflow.com/comment/31819295
downvote count: 0
has body: Look at your call: library.printLibrary(); Now look at the declaration: public static void printLibrary(ArrayList&lt;LibraryItem&gt;items) This is a static method, with a parameter which is a list. You're trying to call it as an instance method (which Java allows even when calling a static method, unfortunately, but which should be avoided anyway) but not supplying any arguments. Given that Library already has a list of items, I suggest you just change the declaration to make it a parameterless instance method: public void printLibrary() ... leaving the body of the method the same, which will then pick up the instance variable items.
type: Answer
has comment: http://stackoverflow.com/comment/31819353

http://stackoverflow.com/q/21112050
has body: this is probably a very unique question because I have searched on Google for a while &amp; could not find a solution. It is also interesting. What I need bascailly is a number, which you can get the day name by it. For example our number is 7, we need to go through a formula to find out it's day name, but for 7 it's basic, all you do is just get "saturday" in the switch statement. Basically it's simple to get the name, you just done: switch (dayNumber) { case 1: return "Sunday"; etc... But my question is pretty complicated I think, and I am not sure if logically there is a possible solution for it. I want to get the index number of the week, by the number. examples: day 7 - Index: 7 day 16 - Index: 2 (because you count the first 2 weeks 7 + 7 = 14 and then + 2 = 16 so the day is monday. day 24 - index: 3 Why do I need this: Well I had a question recently in a java course, not related to this, but it has something to do with looping through the month days, so I wanted to be creative &amp; even get the name of the specific day, in a quick way using Mathematics functions and formulas. So example on how I want to get the name: for (int i = 1; i &lt;= 31; i++) { System.out.println(getDayByInteger(i)); } public static String getDayByInteger(int day) { int dayNumber = 0; //TODO Formula.. switch (dayNumber) { case 1: return "Sunday"; case 2: return "Monday"; case 3: return "Tuesday"; case 4: return "Wednesday"; case 5: return "Thursday"; case 6: return "Friday"; case 7: return "Saturday"; default: return "N/A"; } } I don't mind if it only will support the number range 1-31, but my question focuses on if it's possible to make it work with any number, because you can always build a formula to work for a specific numbers range I think. Is it even possible for any number? Or will it require checking statements?
has answer: http://stackoverflow.com/a/21112099
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31763484
has comment: http://stackoverflow.com/comment/31763482
linked to: http://stackoverflow.com/q/5270272
answer count: 5
type: UnansweredQuestion
has title: Get the name of the day by number
downvote count: 0
has answer: http://stackoverflow.com/a/21112229
has answer: http://stackoverflow.com/a/21112251
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31763506
linked to: http://stackoverflow.com/q/36536265
has answer: http://stackoverflow.com/a/38936761
linked to: http://stackoverflow.com/q/18333099
type: Question
has answer: http://stackoverflow.com/a/21112152
tagged with: formula

http://stackoverflow.com/comment/31598984
type: QuestionComment
type: Comment
has text: It doesn't work. Same problem
comment on: http://stackoverflow.com/q/21022180
score: 0

http://stackoverflow.com/q/21183578
tagged with: java
has comment: http://stackoverflow.com/comment/31893499
has body: How can i sort strings contains numbers in java ? Example : abc12,abc2,xyz3,pqr23,pqr99,wer12 need to get abc2,abc12,pqr23,pqr99,wer12 i tried with comparator but can only compare that of numbers need to compare both strings and numbers . please help me. Thanks
has answer: http://stackoverflow.com/a/21183692
downvote count: 1
has comment: http://stackoverflow.com/comment/31893681
has comment: http://stackoverflow.com/comment/31893435
possible better answer: http://stackoverflow.com/a/21183683
has title: How to sort strings contains numbers in java
type: Question
has comment: http://stackoverflow.com/comment/31893526
has answer: http://stackoverflow.com/a/21183890
upvote count: 0
has comment: http://stackoverflow.com/comment/31893438
score: -1
tagged with: sorting
has comment: http://stackoverflow.com/comment/31893593
answer count: 3
has comment: http://stackoverflow.com/comment/31893467
has comment: http://stackoverflow.com/comment/31893498
has comment: http://stackoverflow.com/comment/31893409
favorite count: 0
linked to: http://stackoverflow.com/q/104599
accepted answer: http://stackoverflow.com/a/21183890
has comment: http://stackoverflow.com/comment/31893540
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31893922
has answer: http://stackoverflow.com/a/21183683

http://stackoverflow.com/comment/31798994
has text: Generally speaking you should avoid it, yes, but sometimes it may be an appropriate choice depending on your requirements an/or design. Not quite sure why it returns an empty list, you should have a look at the generated SQL (set hibernate property `show_sql` to `true`) to see what went wrong. (I did not execute the code myself)
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21116408
type: Comment

http://stackoverflow.com/a/21089824
answers question: http://stackoverflow.com/q/21089596
upvote count: 1
has body: call updateUI() or repaint() or revalidate(); as the table is added but the UI is not getting refreshed.
type: Answer
has comment: http://stackoverflow.com/comment/31722745
downvote count: 0
score: 1

apache
tags question: http://stackoverflow.com/q/21034677
tag name: apache
tags question: http://stackoverflow.com/q/21172441
tags question: http://stackoverflow.com/q/21046111
tags question: http://stackoverflow.com/q/21108591
tags question: http://stackoverflow.com/q/21082602
tags question: http://stackoverflow.com/q/21095471
tags question: http://stackoverflow.com/q/21175340
tags question: http://stackoverflow.com/q/21076207
tags question: http://stackoverflow.com/q/21121031
tags question: http://stackoverflow.com/q/21155541
tags question: http://stackoverflow.com/q/21090125
tags question: http://stackoverflow.com/q/21173559
tags question: http://stackoverflow.com/q/21100067
tags question: http://stackoverflow.com/q/21152099
tags question: http://stackoverflow.com/q/21108111
tags question: http://stackoverflow.com/q/21110954
tags question: http://stackoverflow.com/q/21137375
tags question: http://stackoverflow.com/q/21082692
type: Tag
tags question: http://stackoverflow.com/q/21116617
tags question: http://stackoverflow.com/q/21167527
tags question: http://stackoverflow.com/q/21029708
tags question: http://stackoverflow.com/q/21107452
tags question: http://stackoverflow.com/q/21042356
tags question: http://stackoverflow.com/q/21078522
tags question: http://stackoverflow.com/q/21143749
tags question: http://stackoverflow.com/q/21083954

http://stackoverflow.com/comment/31617846
has text: I was able to get the iteration going in the jsp file for the jstl forEach. I am not too thrilled with it because I basically had to iterate through the recordset in the controller and add the items to a generic list with the type of the class I created. Than I iterated through that generic list with the forEach loop.
comment on: http://stackoverflow.com/q/21031677
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31783168
type: QuestionComment
comment on: http://stackoverflow.com/q/21120933
has text: @ViRALiC You're right that's not an exact duplicate it does not provide the reason why your code doesn't work as expected. You can check this question (that I've put in comments on the top) : http://stackoverflow.com/questions/21120554/arrays-aslist-contains-on-double-vs-double-arrays#21120615
score: 0
type: Comment

http://stackoverflow.com/q/21130722
type: Question
accepted answer: http://stackoverflow.com/a/21140694
score: -1
tagged with: jenkins
has body: Consider the following scenario: Scripts are present in Subversion repository. Jobs are created in Jenkins for scripts. The scripts work based on data present in an Excel sheet in the Subversion repository. QA runs the build and it fails. QA needs to edit the Excel document in the Subversion repository to try again with new Test Data. In the above scenario, please let me know how can the QA be given option to edit the Excel document and upload it into the Subversion repository.
tagged with: java
has title: How to Edit Excel file from Jenkins UI?
answer count: 2
downvote count: 1
tagged with: excel
tagged with: svn
has answer: http://stackoverflow.com/a/21140694
has comment: http://stackoverflow.com/comment/31798660
type: AnsweredQuestion
upvote count: 0
possible better answer: http://stackoverflow.com/a/21141180
has answer: http://stackoverflow.com/a/21141180
has comment: http://stackoverflow.com/comment/31816383
favorite count: 0
has comment: http://stackoverflow.com/comment/31803277

http://stackoverflow.com/q/21043150
linked to: http://stackoverflow.com/q/20634623
has body: On Activity: @Override public void onTabSelected(Tab tab, FragmentTransaction ft) { // on tab selected // show respected fragment view Log.v("Test", "Menjalankan intent antar activity ke fragment"); Bundle bundle=new Bundle(); //String message= "From activity"; int nilai=10; bundle.putInt("Nilai", nilai); Log.v("Testing", "Data yang akan dikirim "+nilai); //set Fragmentclass Arguments Lirik f=new Lirik(); f.setArguments(bundle); viewPager.setCurrentItem(tab.getPosition()); } Fragment code: package com.example.egmim; import com.example.support.dbAdapter; import android.os.Bundle; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class Lirik extends Fragment{ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.lirik_view, container, false); Log.v("Testing", "Menjalankan proses pengambilan data dari activity"); Bundle bundle = getArguments(); if (bundle != null) { Log.v("Testing", "Data adalah "); }else{ Log.v("Testing", "Data null"); } //searchonDB(); return rootView; } } When compiler said: null exception on line 25. (java.lang.nullexception) and the line 25 is int strtext=getArguments().getInt("Nilai", 0); What's wrong? 01-10 06:39:53.734: V/Testing(4097): Proses Intent dijalankan, nomor yang dipilih adalah 1 01-10 06:39:54.144: V/Test(4097): Menjalankan intent antar activity ke fragment 01-10 06:39:54.154: V/Testing(4097): Data yang akan dikirim 10 01-10 06:39:54.845: V/Testing(4097): Menjalankan proses pengambilan data dari activity 01-10 06:39:54.875: D/AndroidRuntime(4097): Shutting down VM 01-10 06:39:54.894: W/dalvikvm(4097): threadid=1: thread exiting with uncaught exception (group=0x41465700) 01-10 06:39:55.104: E/AndroidRuntime(4097): FATAL EXCEPTION: main 01-10 06:39:55.104: E/AndroidRuntime(4097): java.lang.NullPointerException 01-10 06:39:55.10…
has comment: http://stackoverflow.com/comment/31636434
answer count: 2
has comment: http://stackoverflow.com/comment/31637424
has comment: http://stackoverflow.com/comment/31637882
downvote count: 0
has answer: http://stackoverflow.com/a/21043241
has comment: http://stackoverflow.com/comment/31636820
favorite count: 0
linked to: http://stackoverflow.com/q/12739909
has comment: http://stackoverflow.com/comment/31637212
has comment: http://stackoverflow.com/comment/31636467
tagged with: android
has comment: http://stackoverflow.com/comment/31636353
tagged with: android-activity
has comment: http://stackoverflow.com/comment/31638253
has title: Passing value between activity to fragment on android
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/31637096
has comment: http://stackoverflow.com/comment/31638107
has answer: http://stackoverflow.com/a/21044255
type: Question
tagged with: android-fragments
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31644293

http://stackoverflow.com/comment/31726542
score: 0
comment on: http://stackoverflow.com/q/21041809
has text: @0__ Right, did that.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31656580
has text: well, theoretically, if you can add your own javascript and css, i don't know what would stop you from adding js/css from your favorite plugins while you're at it.
comment on: http://stackoverflow.com/q/21053394
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21233056
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21133013
type: Answer
answers question: http://stackoverflow.com/q/21133013
score: 2
has body: Yes, you should create RecordReader to read each record from your excel document. Inside that record reader you should use POI like api to read from excel docs. More precisely please do the following steps: Extend FileInputFromat and create your own CustomInputFrmat and overrride getRecordReader . Create a CustomRecordReader by extending RecordReader ,here you have to write how to generate a key value pair from a given filesplit. So first read bytes from filesplit and from that bufferedbytes read out desired key and value using POI. You can check myown CustomInputFormat and RecordReader to deal with custom data objects here myCustomInputFormat
has comment: http://stackoverflow.com/comment/42169940
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/a/21051735
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21051665
upvote count: 3
score: 3
has body: Your trying to add new elements to an array of size zero size. Use an arraylist or specify array size first.

http://stackoverflow.com/comment/31710501
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21081384
has text: Bleh I just got back on and was going to see if I could implement your version of a solution, but yeah. Perhaps there are only certain special cases?

http://stackoverflow.com/q/21153167
tagged with: executable-jar
tagged with: jar
has body: I made a small game that requires to play background music on it, I have images, a txt file and an audio file, they all work after exporting the JAR except for the audio file. here is the code I used to import : The Images : (new ImageIcon(getClass().getResource("/data/131868.jpg")) The Text file : BufferedReader br = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/data/dictionnaire.txt"))); The Audio file ( I included also the code to play it that I found while searching) : File f =new File(Main.class.getResource("/data/gmu.mp3").getFile()); final Player p=Manager.createRealizedPlayer(f.toURI().toURL()); p.start(); while(true){ if(p.getMediaTime().getSeconds()==p.getDuration().getSeconds()){ p.stop(); p.setMediaTime(new Time(0)); p.start(); } } Basically the File Object was : File f = new File("/data/gmu.mp3") I just added modifications to make it look like the others ... It did work in Eclipse, but not JAR.
has answer: http://stackoverflow.com/a/21153502
type: UnansweredQuestion
type: Question
has title: Exporting JAR with Ressources, Audio won't play
has answer: http://stackoverflow.com/a/21153332
has answer: http://stackoverflow.com/a/21153210
tagged with: java
linked to: http://stackoverflow.com/q/19299470
tagged with: eclipse
score: 0
answer count: 3

http://stackoverflow.com/comment/31633154
type: Comment
type: QuestionComment
score: 3
has text: HINT: Use `while` loop.
comment on: http://stackoverflow.com/q/21041288

http://stackoverflow.com/comment/31652862
comment on: http://stackoverflow.com/a/21051403
score: 0
type: AnswerComment
has text: Hi, I am new to this. Would you explain more what do you mean by background? Sorry if it is a dumb question.
type: Comment

http://stackoverflow.com/comment/31894767
comment on: http://stackoverflow.com/a/21183243
type: Comment
score: 1
has text: Well, `return yourEnumInstance != DEV;` would do the same…
type: AnswerComment

http://stackoverflow.com/comment/31726897
type: AnswerComment
has text: Well, I read both, and yours was cleaner than mine. And I don't need the up-votes, so why muddy the waters?
comment on: http://stackoverflow.com/a/21091997
type: Comment
score: 0

http://stackoverflow.com/comment/31632713
comment on: http://stackoverflow.com/a/21040765
type: AnswerComment
has text: Uhm. I'm not very used with Threading. Atm, I'm keeping the Thread that called the method for first time like `if ( null == originalThread ) { originalThread = Looper.myLooper().getThread(); }`, so now, what I should do is somehow, do something like: `originalThread.run( aRunnableObject )`. Any tips?
type: Comment
score: 0

http://stackoverflow.com/comment/31740021
has text: [How can I create an executable jar with dependencies using Maven?](http://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven?rq=1)
score: 0
comment on: http://stackoverflow.com/q/21098976
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31672883
score: 0
comment on: http://stackoverflow.com/a/21062707
type: AnswerComment
has text: The problem is you wanna set a value in an array, but you have not initialised the array.
type: Comment

http://stackoverflow.com/comment/31890997
comment on: http://stackoverflow.com/a/21179698
type: AnswerComment
has text: can we do aggregations also(like max ,min,sum,mean,sd of each column) using Hive.For that which is better(Hive/mapReduce)
type: Comment
score: 0

http://stackoverflow.com/comment/31832911
has text: With your code Sir I am not getting reading on the last out of 3 JTextBoxes. But Roman C works great! Thank you for a such reply all you guys!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21149188
type: Comment

http://stackoverflow.com/comment/31802773
comment on: http://stackoverflow.com/a/21133049
score: 0
type: Comment
has text: @Raghunandan - I extend BaseAdapter
type: AnswerComment

http://stackoverflow.com/comment/31889440
comment on: http://stackoverflow.com/q/21180666
score: 0
type: QuestionComment
has text: That's something that I don't want to do, as I said.
type: Comment

http://stackoverflow.com/a/21024269
answers question: http://stackoverflow.com/q/21023506
has comment: http://stackoverflow.com/comment/31602910
type: Answer
score: 2
upvote count: 2
has body: An alternative regex based answer. Two steps: Bruteforce the length by matching against ., .., ... Build a regex that replaces (.)(.)(.) with $3$2$1 according to the length Code String input = "Hello"; // brute force the length int length = 0; String dots = null; do { length++; dots = ""; for (int i = 0; i &lt; length; i++) { dots += "."; } } while (!input.matches(dots)); // build reversing regex StringBuilder capture = new StringBuilder(); StringBuilder replace = new StringBuilder(); for (int i = 0; i &lt; length; i++) { capture.append("(.)"); replace.append("$"); replace.append(length - i); } input = input.replaceFirst(capture.toString(), replace.toString()); System.out.println(input);
downvote count: 0

http://stackoverflow.com/q/21056057
downvote count: 0
favorite count: 0
tagged with: javasound
tagged with: package
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21056258
score: 1
upvote count: 1
type: Question
tagged with: audio
has body: I'm starting to learn how to play sounds in Java applications. I've come across two packages that enable the programmer to do this: sun.audio and javax.sound. What are the differences between the two? Advantages and disadvantages?
tagged with: java
accepted answer: http://stackoverflow.com/a/21056258
has title: Sound in Java: What's the difference between javax.sound and sun.audio?
answer count: 1

http://stackoverflow.com/comment/31687425
comment on: http://stackoverflow.com/a/21042347
score: 0
type: AnswerComment
has text: **Error** You used "hh" (meaning half-day 12-hour time) where you should have used "HH" (meaning full-day 24-hour time, 00-23). This applies to both cases, Joda-Time and the old java.text.SimpleDateFormat.
type: Comment

http://stackoverflow.com/comment/31668085
type: QuestionComment
has text: No. I have a YouTube channel myself (not coding related), but don't have the bandwidth allowance or internet speed to actually *watch* YouTube videos. I don't truly feel that people can learn coding from videos anyway..
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21059972

http://stackoverflow.com/comment/31680376
has text: But the problem is that the map has to be dynamically. So the map should change after it has been created already. How can I do this?
type: Comment
comment on: http://stackoverflow.com/a/21066222
score: 0
type: AnswerComment

http://stackoverflow.com/q/21165326
score: 2
type: AnsweredQuestion
tagged with: performance
has comment: http://stackoverflow.com/comment/31865938
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/31864785
type: Question
has answer: http://stackoverflow.com/a/21183516
has comment: http://stackoverflow.com/comment/31865132
tagged with: c3p0
answer count: 1
downvote count: 0
has title: slow read query causes other c3p0 threads to block on acquireStatement
has comment: http://stackoverflow.com/comment/31860745
accepted answer: http://stackoverflow.com/a/21183516
favorite count: 0
upvote count: 2
has body: I have a table articles with 500k rows. I only use select queries on it via a web app. All of my pages load fast (~20ms) and each consists of one or two fast queries (~10ms each). Those fast queries may either select something from the articles table or do something irrelevant, like selecting a row from another small table (5 rows). I am having 30 pageviews per second on this webapp with no problem. Sometimes though a specific page executes a select query which is very slow (~30 seconds) because it almost does a full table scan on the 500k rows of the articles table and just returns 3 rows. When this happens the other fast pages start slowing down heavily and at some point they completelly block. Note that all pages use transactions and all the queries are selects so they shouldn't affect each other to much, performance wise. I also validate the above by executing this slow query manually from a console (outside of the scope of the webapp) and the fast pages from the webapp are not affected at all. So I think that something weird is going on in the application layer. Any idea why does this happen? Why are all threads waiting at com.mchange.v2.c3p0.stmt.GooGooStatementCache.acquireStatement? Some data: MySQL: 5.5.32 engine: InnoDB jdbc driver: mysql-connector-java-5.1.26-bin.jar pool: c3p0-0.9.1.2.jar orm: hibernate 3.6.8 pool config: http://pastebin.com/3zMARM1B thread dump while stuck: http://pastebin.com/YGisWCzY tomcat: tomcat-6.0.32 jdk: 1.6.xx

authentication
tags question: http://stackoverflow.com/q/21167703
tags question: http://stackoverflow.com/q/21057358
tags question: http://stackoverflow.com/q/21158092
tags question: http://stackoverflow.com/q/21090892
tags question: http://stackoverflow.com/q/21102792
tag name: authentication
tags question: http://stackoverflow.com/q/21029857
tags question: http://stackoverflow.com/q/21143272
type: Tag
tags question: http://stackoverflow.com/q/21127606
tags question: http://stackoverflow.com/q/21052695
tags question: http://stackoverflow.com/q/21168041
tags question: http://stackoverflow.com/q/21160295
tags question: http://stackoverflow.com/q/21058443
tags question: http://stackoverflow.com/q/21034548
tags question: http://stackoverflow.com/q/21183762
tags question: http://stackoverflow.com/q/21138115
tags question: http://stackoverflow.com/q/21144795
tags question: http://stackoverflow.com/q/21094795

http://stackoverflow.com/a/21131535
answers question: http://stackoverflow.com/q/21131430
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/31800037
upvote count: 1
has comment: http://stackoverflow.com/comment/31800028
has body: Is Manage_numbers.class defined in the manifest? And is it not null? Are you inflating the correct layout in MainActivity? You need to post your logcat for a better specific answer.
downvote count: 0

http://stackoverflow.com/q/21098072
type: Question
accepted answer: http://stackoverflow.com/a/21098398
upvote count: 2
has answer: http://stackoverflow.com/a/21098220
has answer: http://stackoverflow.com/a/21098398
has comment: http://stackoverflow.com/comment/31743700
has title: what is the best place to verify if an external system is available before executing tests?
answer count: 2
tagged with: junit
linked to: http://stackoverflow.com/q/19358444
has body: We are using JUnit to execute integration tests and also the system integration tests which rely on external test systems (not necessarily maintained by our own company). I wonder where to put the code that checks if the system is available prior to running the test cases? So I can determine if there is a network or other issue and not one with the test itself. JUnit allows to setup some parts of the test in JUnit-Rules. Is it a good idea to setup the service that communicates with the external system within the rule and do some basic checks ("ping") to the external system within the rule? Or to store the state and within the Test use a JUnit assume(rule.isAvailable) to avoid having the test executed? Or would it be smarter to put this verification code in a custom JUnit Runner? Or is there even another way to do this? (simply create some utils?) The goal is to skip the tests if some conditions are not met since it is obvious the tests will fail. I know this indicates a bad exception handling but there is a lot of legacy code I can't change altogether. I tried to find some articles myself but it seems the search terms ("test", "external system" and so on) are a little thankless. thanks!
favorite count: 0
tagged with: junit-rule
linked to: http://stackoverflow.com/q/1689242
possible better answer: http://stackoverflow.com/a/21098220
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: junit-runner

http://stackoverflow.com/comment/31778296
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21119444
has text: AH Nevermind! I changed the encoding from Unicode to UTF-8 after I implemented your fixes! Thank you!
score: 0

http://stackoverflow.com/comment/31864447
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21167410
has text: It's unclear what you are asking, can you provide an example of what is happening and what you want to happen? Screenshots perhaps?
type: Comment

http://stackoverflow.com/q/21038117
tagged with: user-interface
tagged with: android
has title: Do not load the related Landscape/Portrait layout on rotation
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
tagged with: eclipse
type: Question
has body: I am having a very disturbing trouble with my Android application. I am using Fragments. Each fragment contains a seperate XML file for Portrait UI and Landscape UI. If I move from fragment 'InputFragment' to fragment 'OutputFragment', and if I rotate the device now, the Fragment get changed to 'InputFragment' !! Which means, application is going back to the previous fragment on rotation! But, this is not what should happen. If I rotate the device once it is in Portrait, then it should call the Landscape UI of the same fragment and wise versa. Following is the code. I only display the structure of the code, because all other are declaration of variables and assigning values etc. InputFragment.java public class InputFragment extends Fragment { //Declaring variables. CODE REMOVED public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //Intializing instance variables. CODE REMOVED view = inflater.inflate(R.layout.input, container,false); restoreStates(savedInstanceState); return view; } //This method will save the instances @Override public void onSaveInstanceState(Bundle savedInstanceStateBundle) { super.onSaveInstanceState(savedInstanceStateBundle); try{ } catch(NullPointerException e) { } } //This method will restore the instances @Override public void onActivityCreated(Bundle savedInstanceStateBundle) { super.onActivityCreated(savedInstanceStateBundle); if(savedInstanceStateBundle!=null) { } } //Action Listener for the Submit Bar private class SubmitButtonAction implements OnClickListener { @Override public void onClick(View v) { // TODO Auto-generated method stub try { //Put the JSON. Calling to the JSON handling class. CODE REMOVED } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } Fragment frag = new OutputFragment(); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.fragment_container, frag); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft…
has comment: http://stackoverflow.com/comment/31628340
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/21038240
accepted answer: http://stackoverflow.com/a/21038240

http://stackoverflow.com/q/21051873
tagged with: coldfusion
has body: We're having a Java Memory issue. Using JRocket I see a char array on the heap that looks like "---> " (a ColdFusion closing comment marker) taking up 64 Meg. Why is this happening and more importantly how do I track it down and get rid of it? Update: OK I found where this is occuring but not why. the code in question is where I left a closing comment tag by mistake after a tag: " --->" Why the "--->" would show up in memory I don't know. But the thread memory consumption grows exponetially. Can the JVM perform garbage collection inside a thread? It uses a CFC where everything is assigned to a var local struct. This is CF 8 BTW.
tagged with: java
has comment: http://stackoverflow.com/comment/31909758
upvote count: 1
has comment: http://stackoverflow.com/comment/31653475
has answer: http://stackoverflow.com/a/21052316
type: Question
tagged with: debugging
has title: Tracking down a ColdFusion memory leak with JRocket
has comment: http://stackoverflow.com/comment/31701910
answer count: 1
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31678857

http://stackoverflow.com/comment/31692573
comment on: http://stackoverflow.com/a/21073179
score: 0
type: AnswerComment
has text: I have found my problem, You were right, I removed unneeded codes, so I understand the problem. It was because I was trying to send a string through a printwriter but when I changed the code I tried to receive that String by a objectInputStream and it causes the exception, I changed the printwriter to objectOutputStream and the problem solved, Thank you all, but I do not understand why you said when I get EOFException I should close the loop, I have a project like twitter, and I am at the start point. I should send and received objects when client running, why should I close the socket?
type: Comment

spring-jdbc
tags question: http://stackoverflow.com/q/21028287
tags question: http://stackoverflow.com/q/21111394
type: Tag
tags question: http://stackoverflow.com/q/21174705
tag name: spring-jdbc

http://stackoverflow.com/comment/31630836
type: Comment
comment on: http://stackoverflow.com/a/21039479
type: AnswerComment
has text: @Grains That would be my first avenue of investigation, yes. My testing was on Windows.
score: 0

http://stackoverflow.com/a/21035110
score: 1
type: Answer
upvote count: 1
has body: The advantage of the Long class is that the value can be null. In your case, if no Long ID is supplied, if you quickly detect this with something like.. public ClientInput(Long userid, Long clientid, Map&lt;String, String&gt; parameterMap, Long timeout_ms, boolean debug) { if (userid == null) { throw new IllegalArgumentException("userid is null"); } To your second question, you could place your ID validation in the constructor as well. This ensures that if the ID is null or invalid, a ClientInput can never be created. But there is no "best" answer for where you put this validation, it depends on the structure of the rest of your code, but ideally you want to catch such things as early as possible. public ClientInput(Long userid, Long clientid, Map&lt;String, String&gt; parameterMap, Long timeout_ms, boolean debug) { if (userid == null || userid &lt; USER_ID_MIN || userid &gt; USER_ID_MAX ) { throw new IllegalArgumentException("userid is invalid"); } Another option is to accept the userid parameter as a Long, testing it for null, but then store it as a private, primitive long, once you know its valid.
answers question: http://stackoverflow.com/q/21034955
downvote count: 0

http://stackoverflow.com/comment/31819842
score: 0
type: Comment
type: QuestionComment
has text: I agree that this should me moved elsewhere. However, my two cents, always spell in good English. If you had problem because it's too long, you surely find another way to shorten it. If you still have problem, then the problem is elsewhere.
comment on: http://stackoverflow.com/q/21142902

http://stackoverflow.com/a/27873872
downvote count: 0
has body: This looks like the BluetoothSocket.close() bug in Android 4.2 - 4.4.4, which seems to be fixed in 5.0. Basically, it's not releasing the underlying file descriptor, so it leaks until you hit your device's limit, then weird bad things happen. You need to get the ParcelFileDescriptor from the BluetoothSocket and close it yourself. Check out my answer here for the workaround code: https://stackoverflow.com/a/27873675/1893015
has comment: http://stackoverflow.com/comment/49368920
answers question: http://stackoverflow.com/q/21166222
type: Answer
has comment: http://stackoverflow.com/comment/49378000
score: 1
upvote count: 1

http://stackoverflow.com/a/21110188
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21097489
has body: There are no restrictions on the format of the byte array you send (and receive) with IsoDep.transceive(). As your tag is an emulated one, it may be a bit slower to respond. You could try increasing the time-out using setTimeout().
type: Answer

http://stackoverflow.com/q/21121278
score: 0
answer count: 3
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/21121410
has title: MouseListener no movement
has body: I've been learning how to work with rpg style games in java and found a great tutorial. However, the tutorial shows how to move a sprite using a key listener, what I want to do is make the sprite move by getting a mouse location on the screen, and moving the sprite on its own without any key listeners. heres the code i have so far, thanks for the help! (oh, the problem is the sprite is not moving, forgot to say that... is it because of the while loop in the move method?) import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.awt.Image; import java.awt.event.*; import javax.swing.ImageIcon; public class SpaceCraft { private String craft = "craft.png"; private int dx; private int dy; private int x; private int y; private Image image; public SpaceCraft() { ImageIcon spaceCraft = new ImageIcon(this.getClass().getResource(craft)); image = spaceCraft.getImage(); x = 40; y = 60; } public void move() { while ((x==Board.mouseX)==false) { if (x &lt; Board.mouseX){ x += 1; } else if (x &gt; Board.mouseX){ x -= 1; } } while ((y==Board.mouseY)==false) { if (y &lt; Board.mouseY){ y += 1; } else if (y &gt; Board.mouseY){ y -= 1; } } } public int getX() { return x; } public int getY() { return y; } public Image getImage() { return image; } /* public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_LEFT){ dx = -1; } if (key == KeyEvent.VK_RIGHT) { dx = 1; } if (key == KeyEvent.VK_UP) { dy = -1; } if (key == KeyEvent.VK_DOWN) { dy = 1; } }*/ /* public void keyReleased(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_LEFT) { dx = 0; } if (key == KeyEvent.VK_RIGHT) { dx = 0; } if (key == KeyEvent.VK_UP) { dy = 0; } if (key == KeyEvent.VK_DOWN) { dy = 0; } }*/ } import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Toolkit; import java.awt.event.*; import javax.swing.*; import javax.swing.JPanel; import javax.swing.Timer; public class Board extends JPanel implements ActionListener {…
tagged with: java
has answer: http://stackoverflow.com/a/21121405
has answer: http://stackoverflow.com/a/21121379
type: Question
tagged with: mouseevent

http://stackoverflow.com/q/21171609
type: Question
tagged with: jtable
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21171729
tagged with: tablemodel
has body: i have this table model, and i insert values calling in this way: lista.setModel(new SimpleTableModel(dados, colunas)); lista is the JTable the Model: import java.awt.event.MouseEvent; import java.util.ArrayList; import javax.swing.JTable; import javax.swing.ListSelectionModel; import javax.swing.table.AbstractTableModel; public class SimpleTableModel extends AbstractTableModel{ private ArrayList linhas = null; private String [] colunas = null; public String[] getColunas() {return colunas;} public ArrayList getLinhas() {return linhas;} public void setColunas(String[] strings) {colunas = strings;} public void setLinhas(ArrayList list) {linhas = list;} @Override /** * Retorna o numero de colunas no modelo * @see javax.swing.table.TableModel#getColumnCount() */ public int getColumnCount() {return getColunas().length;} /** * Retorna o numero de linhas existentes no modelo * @see javax.swing.table.TableModel#getRowCount() */ public String getColumnName(int col){ return getColunas()[col]; } public int getRowCount() {return getLinhas().size();} /** * Obtem o valor na linha e coluna * @see javax.swing.table.TableModel#getValueAt(int, int) */ public Object getValueAt(int rowIndex, int columnIndex) { // Obtem a linha, que é uma String [] String [] linha = (String [])getLinhas().get(rowIndex); // Retorna o objeto que esta na coluna return linha[columnIndex]; } //added this to try... public boolean deleteLine(int line){ linhas.remove(line); return true; } public boolean deleteAll(){ linhas.clear(); return true; } public SimpleTableModel(ArrayList dados, String[] colunas){ setLinhas(dados); setColunas(colunas); } } but the problem is, i CANT call the deleteLine().... public boolean deleteLine(int line){ linhas.remove(line); return true; } public boolean deleteAll(){ linhas.clear(); return true; } i dont know how to make this to work... since i cant access i think the mistake is that the Constructor is the one that "populate" the table, i think i have to change it and create a in…
tagged with: swing
has answer: http://stackoverflow.com/a/21171974
accepted answer: http://stackoverflow.com/a/21171974
type: AnsweredQuestion
tagged with: java
has title: AbstractTableModel DELETE row not working
has answer: http://stackoverflow.com/a/21171729

http://stackoverflow.com/comment/31767812
has text: Thank you, but it doesn't work...
type: Comment
comment on: http://stackoverflow.com/a/21112552
type: AnswerComment
score: 0

http://stackoverflow.com/a/21167696
has comment: http://stackoverflow.com/comment/31874286
has comment: http://stackoverflow.com/comment/31869510
type: AcceptedAnswer
downvote count: 0
has body: There may be a slight performance loss for the enum whenever you reference Day.SUNDAY, because the int constant is a compile-time constant and so can be inlined, whereas the enum constant requires a getstatic. Comparing two ints or two references is of course identical in terms of time required, since you are comparing the references (addresses), not calling .equals(). Of course, the performance hit here is minuscule; the only reason to worry about this would be if this is in a performance-critical part of your application and profiling shows that using ints is better. The benefits of enums for maintainability and code correctness far outweigh a slight inefficiency like this.
type: Answer
has comment: http://stackoverflow.com/comment/31865949
accepted answer of: http://stackoverflow.com/q/21167417
upvote count: 7
score: 7
answers question: http://stackoverflow.com/q/21167417

http://stackoverflow.com/a/21174488
accepted answer of: http://stackoverflow.com/q/21174400
has body: You do need to cast to ParameterizedType, and then cast the Type values from getActualTypeArguments() to WildcardType, which has a getUpperBounds() method. So assert MyPojo.class == ((WildcardType) ((ParameterizedType) listField.getGenericType()).getActualTypeArguments()[0]).getUpperBounds()[0];
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21174400
type: Answer
has comment: http://stackoverflow.com/comment/31877968
score: 5
upvote count: 5

http://stackoverflow.com/a/21062473
answers question: http://stackoverflow.com/q/21062427
has body: You have put your array initialization outside the constructor, so before the max was set. public class ParkingLot { private int max; private int nr; private Car[] cars; // it was like saying = new Car[0], because max was 0. public ParkingLot(int max) { this.max = max; this.cars = new Car[max]; }
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/69481889
type: Answer
downvote count: 0
score: 1
has body: The cause for this might be that the display variable you're using is not properly set. Run echo $DISPLAY and make sure the output is correct. :0 is typical for the display on the machine if it's a desktop, if it's remote it's usually a hostname or IP and number like 1.2.3.4:0 . Depending on how in the code the existence of the DISPLAY is checked and used, you can unset it, that makes tools like Google Cloud Directory Sync continue without trying to start a graphical installer. If that does not work for you because you need the set the proper display variable and rights (check xhost command). Start Xterm for example to see if it works. In my case I was running the installer in docker and had to set it to the desktop IP where my docker host network was bound to : export DISPLAY=10.11.211.211:0 After that it worked for me.
answers question: http://stackoverflow.com/q/21131855
upvote count: 1

http://stackoverflow.com/comment/31648645
type: Comment
has text: Why [1-9]{1} then [0-9]{10} after?
comment on: http://stackoverflow.com/a/21049779
type: AnswerComment
score: 0

http://stackoverflow.com/a/21104379
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/31750855
score: 3
has body: Aside from the comparator issue (double-equals vs single-equals), there's a few other issues with your code that you can address that might clarify the role of getters and setters. You don't actually need to do any comparison in either of your methods. If we declare that MOUNTAIN is always equal to 1 - then "1" and "MOUNTAIN" can be used interchangeably in our code. Let's replace all the digit literals (0, 1, 2) with the constant names instead. public void setTerrain(int terrain){ if(terrain == DESERT){ this.terrain = DESERT; } if(terrain == MOUNTAIN){ this.terrain = MOUNTAIN; } if(terrain == FOREST){ this.terrain = FOREST; } } This is a bit redundant. Actually, if we instead replace terrain types with numbers, the issue might be more apparent: public void setTerrain(int terrain){ if(terrain == 0){ this.terrain = 0; } if(terrain == 1){ this.terrain = 1; } if(terrain == 2){ this.terrain = 2; } } Imagine if you had 1000 terrain types - the code blows up even more. public void setTerrain(int terrain){ if(terrain == 0){ this.terrain = 0; } if(terrain == 1){ this.terrain = 1; } if(terrain == 2){ this.terrain = 2; } if(terrain == 3){ this.terrain = 3; } ... if(terrain == 999){ this.terrain = 999; } if(terrain == 1000){ this.terrain = 1000; } } Instead, you can just use something like this: public void setTerrain(int terrain){ this.terrain = terrain; } As Dino's answer suggests, it is always a great idea to add Input Validation to handle cases where someone sends a number that isn't one of your supported terrains: public void setTerrain(int terrain){ if (terrain &lt; 0 || terrain &gt; 2) { System.out.println("Invalid terrain number!"); } else { this.terrain = terrain; } } Similarly, you can simplify your getter by just directly returning your Creature's terrain type - no comparisons needed! public int getTerrain(){ return this.terrain; }
answers question: http://stackoverflow.com/q/21104149
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21104149

http://stackoverflow.com/q/21165299
has title: Google AnalyticsService throwing java.lang.reflect.UndeclaredThrowableException
upvote count: 1
type: Question
tagged with: google-analytics
tagged with: java
tagged with: analytics
answer count: 1
downvote count: 0
favorite count: 0
has body: In my code this line DataFeed dataFeed = analyticsService.getFeed(query.getUrl(),DataFeed.class); throwing java.lang.reflect.UndeclaredThrowableException, I tried with both this query URLs 1. DataQuery query = new DataQuery(new URL("https://www.google.com/analytics/feeds/data")); 2. DataQuery query = new DataQuery(new URL("https://www.googleapis.com/analytics/v2.4/data")); sometimes for some id's it is giving result but most of the time it is throwing the exception any suggestion please, it is killing my time These are my query parameters query.setStartDate(startDate); query.setEndDate(endDate); query.setIds(tableID); query.setDimensions("ga:pagePath"); query.setMetrics("ga:pageviews"); query.setSort("-ga:pageviews");
has answer: http://stackoverflow.com/a/21189864
tagged with: google-analytics-api
type: UnansweredQuestion
score: 1

http://stackoverflow.com/a/46144339
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21060992
has body: Only slightly related to the question, but try to wrap your head around this one. So un-intuitive: import java.nio.file.*; class Main { public static void main(String[] args) { Path p1 = Paths.get("/personal/./photos/./readme.txt"); Path p2 = Paths.get("/personal/index.html"); Path p3 = p1.relativize(p2); System.out.println(p3); //prints ../../../../index.html !! } }
upvote count: 2
type: Answer

http://stackoverflow.com/comment/31837535
comment on: http://stackoverflow.com/q/21151476
score: 1
has text: @ChrisH. how about adding 'process.waitFor();' just after the while loop it will properly wait for the process is terminated
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21082566
upvote count: 2
type: AcceptedAnswer
has body: It simply doesnt have time to print the message because main exits too quickly, try to pause for a sec and you will see it Thread t = new Thread(new Practice()); t.setDaemon(true); t.start(); Thread.sleep(1000); &lt;--
has comment: http://stackoverflow.com/comment/31710636
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21082074
answers question: http://stackoverflow.com/q/21082074

http://stackoverflow.com/q/21115321
possible better answer: http://stackoverflow.com/a/21115520
has answer: http://stackoverflow.com/a/21115520
linked to: http://stackoverflow.com/q/6991496
tagged with: http://stackoverflow.com/tag/xml
tagged with: xml-namespaces
tagged with: xpath
upvote count: 1
has answer: http://stackoverflow.com/a/21116036
type: AnsweredQuestion
has body: I am trying to extract a 'PartyID' from a request using XPath. This request is in the form of XML. Here is the XML: <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <s1:invokerules xmlns:s1="http://rules.kmtool.abc.com"><s1:arg0> <?xml version="1.0" encoding="UTF-8"?> USER1_MSG1 08/07/2008 07:34:15 USER1_Ref1 Michael Jackson 02071059053 4777 Michal.Jackson@Neverland.com <Title>Mr Michael MJ INITIATE 000111333777 </s1:arg0> </s1:invokerules> </soapenv:Body> </soapenv:Envelope> I have a method in my java code called getPartyId(). This method should extract the PartyID from the XML. However I cannot get this method to return the PartyID no matter what XPath query I use, this is where I need help. Here is the getPartyId method: private String getPartyId(String xml) throws XPathExpressionException { XPathFactory xPathfactory = XPathFactory.newInstance(); XPath xpath = xPathfactory.newXPath(); xpath.setNamespaceContext(new NamespaceContext() { public String getNamespaceURI(String prefix) { if (prefix == null) throw new NullPointerException("Null prefix"); else if ("SOAP-ENV".equals(prefix)) return "http://schemas.xmlsoap.org/soap/envelope/"; else if ("xml".equals(prefix)) return XMLConstants.XML_NS_URI; return XMLConstants.NULL_NS_URI; } public String getPrefix(String uri) { throw new UnsupportedOperationException(); } public Iterator getPrefixes(String uri) { throw new UnsupportedOperationException(); } }); XPathExpression expr = xpath.compile("/SOAP-ENV:Envelope/SOAP-ENV:Body/*/*/*/*/*/*/*/*/*/*/*[local-name()='PartyID']/text()"); InputSource source = new InputSource(new StringReader(xml)); String dunsId = (String) expr.evaluate(source,XPathConstants.STRING); return dunsId; } I believe that the problem lies with the XPathExpression: XPathExpression expr = xpath.compile("/SOAP-ENV:Envelope/SOA…
score: 1
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31770530
accepted answer: http://stackoverflow.com/a/21116036
downvote count: 0
favorite count: 0
has title: XPATH won't work

http://stackoverflow.com/q/21021191
has comment: http://stackoverflow.com/comment/31597113
has body: I ran into the following problem: The same Java program in Eclipse. On my computer (Macbook Air, 8GB Ram) I get the HeapSpaceError Java Heap Space. The same Java program on a MacBook Pro, 8GB Ram I don't get the Error. The initial Heap Space and the Max Heap Space is the same. Any ideas why this error occurs?
has comment: http://stackoverflow.com/comment/31597282
answer count: 0
has comment: http://stackoverflow.com/comment/31597142
type: UnansweredQuestion
tagged with: error-handling
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/31597006
has title: Java Heap Space on two different computers
has comment: http://stackoverflow.com/comment/31597070
has comment: http://stackoverflow.com/comment/31596939
score: 0
tagged with: heap-memory

http://stackoverflow.com/comment/31807189
comment on: http://stackoverflow.com/q/21136064
score: 1
has text: No, it will only work with the Websphere libraries available. Why do you want to use it in a standalone application?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21061182
upvote count: 1
has comment: http://stackoverflow.com/comment/31670469
answers question: http://stackoverflow.com/q/21060882
score: 1
has body: You want to use ^[\\d\\s]+$ Basically, this will match for sequences of white space and digit making sure that there are not other characters between the beginning of the line and the end. Your original parses my test string in 3000+ steps, this takes 3 steps. This has these results: 123123 123123 123123 123123 - OK 1 - OK 123g 12r3123 123 - NOT OK
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31602023
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21022950
has text: @user3177843 Yes, stereo right would be one channel and stereo left the other
type: AnswerComment

http://stackoverflow.com/comment/31812432
type: QuestionComment
has text: No, it's a query that JBoss will run before returning a connection, for example in oracle this query is usually `select 1 from dual`. See this other question: http://stackoverflow.com/questions/128527/is-there-any-way-to-have-the-jboss-connection-pool-reconnect-to-oracle-when-conn
comment on: http://stackoverflow.com/q/21137049
score: 0
type: Comment

http://stackoverflow.com/a/21172746
downvote count: 0
score: 20
answers question: http://stackoverflow.com/q/21172558
has body: Using Mockito, you can do spying on real objects like this: import org.junit.Test; import static org.mockito.Mockito.*; public class MyClassTest { @Test public void otherMethodShouldBeCalled() { MyClass myClass = new MyClass(); MyClass spy = spy(myClass); spy.myMethod(true); verify(spy).otherMethod(); } } There are some gotchas, so take a look at the relevant documentation as well.
accepted answer of: http://stackoverflow.com/q/21172558
type: AcceptedAnswer
upvote count: 20
has comment: http://stackoverflow.com/comment/133102463
type: Answer

http://stackoverflow.com/comment/31811078
comment on: http://stackoverflow.com/q/21138198
has text: I dont think you should create a thread for such a trivial task.. You will not be gaining any advantage by using a thread here..
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21056933
type: AcceptedAnswer
score: 1
answers question: http://stackoverflow.com/q/21041880
type: Answer
upvote count: 2
has body: The class mentioned in the message isn't available to the Registry on its CLASSPATH. The simplest solution to this and several other problems is to run the Registry inside the server JVM, with LocateRegistry.createRegistry(). Otherwise you will have to figure out how to start the rmiregistry command with a CLASSPATH argument, or else use the codebase feature, which is another kettle of fish altogether.
downvote count: 1
accepted answer of: http://stackoverflow.com/q/21041880

http://stackoverflow.com/q/21062727
tagged with: java
tagged with: gson
tagged with: concurrency
has comment: http://stackoverflow.com/comment/31673292
has answer: http://stackoverflow.com/a/26455314
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/31703370
favorite count: 0
has comment: http://stackoverflow.com/comment/31673695
has comment: http://stackoverflow.com/comment/31673462
has comment: http://stackoverflow.com/comment/31673370
tagged with: android
has comment: http://stackoverflow.com/comment/31673710
has comment: http://stackoverflow.com/comment/31673016
has comment: http://stackoverflow.com/comment/31673200
has comment: http://stackoverflow.com/comment/31673730
has comment: http://stackoverflow.com/comment/31673266
downvote count: 0
type: UnansweredQuestion
has title: Problems with Gson and orientation changes
type: Question
has body: I'm trying to save a serialize/deserialize a List of POJOS with Gson. While normally this isn't such a special task, I'm getting an exception that I've never seen before: 01-11 14:17:22.556: E/AndroidRuntime(15941): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.timkranen.playpalproject/com.timkranen.playpalproject.HomeActivity}: java.lang.RuntimeException: Unable to invoke no-args constructor for interface java.util.concurrent.locks.Lock. Register an InstanceCreator with Gson for this type may fix this problem. I'm suspecting that it has something to with the fact that the List items are being loaded in an AsyncTask. Anyone have experience with this problem? I've tried putting the logic that I execute within onSaveInstanceState (for saving) in a synchronized method, but that didn't help. Edit Here's some of my code to try and make it more clear. I've got a List that is called friendsList. The List is filled in this AsyncTask and is executed in onCreateView() private class RetrieveFriends extends AsyncTask&lt;Void, Integer, String&gt; { @Override protected String doInBackground(Void... params) { // get friends if (friendProfiles == null || friendProfiles.size() == 0) { friendProfiles = new ArrayList&lt;Profile&gt;(); if (currentProfile.getFriendUids() != null &amp;&amp; currentProfile.getFriendUids().size() &gt; 0) for (String fUid : currentProfile.getFriendUids()) { Profile friend = ProfileDataManager .getProfileFromId(fUid); friendProfiles.add(friend); } if (friendProfiles.size() == 0) { return "null"; } } return "notnull"; } @Override protected void onPostExecute(String result) { if (!result.equals("null")) { loadingFriendsBar.setVisibility(View.INVISIBLE); friendsList.setVisibility(View.VISIBLE); FriendListAdapter adapter = new FriendListAdapter( containedActivity, R.layout.friendslist_row, friendProfiles); friendsList.setAdapter(adapter); } else { loadingFriendsBar.setVisibility(View.INVISIBLE); friendMsg.setVisibility(View.VISIBLE); } }…
score: 1
has comment: http://stackoverflow.com/comment/31673684

http://stackoverflow.com/a/21172129
type: Answer
has comment: http://stackoverflow.com/comment/31873251
has comment: http://stackoverflow.com/comment/31873189
score: 0
answers question: http://stackoverflow.com/q/21171888
has body: Adding to what lucian said: String [] data = s.split(", "); data[0]=data[0].replaceAll("[HH:MM:SS] INFO: ", ""); Should replace the unwanted beginning of that string with nothing ("");

http://stackoverflow.com/a/21104015
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/31751012
has comment: http://stackoverflow.com/comment/31750191
upvote count: 1
answers question: http://stackoverflow.com/q/21103905
has body: Since you mentioned json, I assume you are serializing the query result. It seems A's data are being fetched (either eagerly / lazily) because your json serializer assumes parent contains important data to be serialized. You need to skip parent field when serializing (eg with @Transient annotation or other ways depending on your json library)

http://stackoverflow.com/a/21106164
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21106025
upvote count: 2
has body: you need to declare listModel like this DefaultListModel &lt;String&gt; listModel = new DefaultListModel&lt;&gt;(); This enforce the compiler to check if you add a real string object into this collection whose elements must be the string type
type: Answer

http://stackoverflow.com/a/21121333
has comment: http://stackoverflow.com/comment/31782099
type: Answer
answers question: http://stackoverflow.com/q/21121213
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21121213
has body: Click on the expression to see how it works and for an explanation \[^'\]+\[\(\),;{}\.\] should give you an idea of how to get started!
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40860181
comment on: http://stackoverflow.com/a/21136029
score: 0
type: AnswerComment
type: Comment
has text: But OP is initially creating a min heap of size k by taking first element from all the k lists. That will cover above mentioned case and right range will be returned.

http://stackoverflow.com/comment/31790532
score: 0
comment on: http://stackoverflow.com/q/21126248
has text: I wanted to post my entire code so just in case I messed up somewhere that I hadn't thought I messed up, somebody could see it. Sorry if it's an inconvenience to you.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31839693
comment on: http://stackoverflow.com/a/21153323
has text: Tried, didn't seem to make a difference in my testing. From what I understand, the "ball" can not be "contained" within the "brick", but I might misunderstand the logic...
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25969429
has body: The whole problem was the port range which I thought was default set to 0. This turned out to be wrong, we just set the parameter port_range=0 at the TCP and TCPPING configuration and everything works as expected.
answers question: http://stackoverflow.com/q/21111146
score: 0
type: Answer

http://stackoverflow.com/comment/31658068
type: AnswerComment
score: 0
type: Comment
has text: I tried this but got the message: "The possibleRoutes may not have been initialized" and it was declared as a static type at the beginning.
comment on: http://stackoverflow.com/a/21053895

http://stackoverflow.com/a/21040382
has comment: http://stackoverflow.com/comment/31657554
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21040198
has body: Use JSR-303 annotations to validate the object (and don't use primitives but the Object representations in that case). public class MyObject { @NotNull private Integer param1; @NotNull private Integer param2; // Getters / Setters } Controller method. @RequestMapping(value = "/method") public void method(@Valid MyObject obj) { /*...*/ } If you don't have a JSR-303 provider (hibernate-validator for instance) on your classpath create a Validator and use this to validate your object. Links. Spring MVC reference guide Spring Validation reference guide
answers question: http://stackoverflow.com/q/21040198
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/31770701

http://stackoverflow.com/comment/31726250
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21091882
score: 4
has text: check this http://stackoverflow.com/questions/1326682/java-replacing-multiple-different-substring-in-a-string-at-once-or-in-the-most or you can try to use Apache Commons StringUtils.replaceEach() http://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html

http://stackoverflow.com/a/21071634
has comment: http://stackoverflow.com/comment/32046437
has comment: http://stackoverflow.com/comment/32056488
score: 2
answers question: http://stackoverflow.com/q/21068483
downvote count: 0
has body: log4j is available as an OSGi bundle: http://ebr.springsource.com/repository/app/bundle/detail;jsessionid=66ADD0FE737BA9A5DD36A052F4A6809A.jvm1?name=com.springsource.org.apache.log4j. In general, if you want to use a third-party library which isn't published as an OSGi bundle (yet), it's worthwhile checking if SpringSource has an OSGi version. If it wasn't, you could wrap it as a bundle yourself, as Alexander Gavrilov suggests. Finally, if you really want to leave it as a non-OSGi bundle, you need to set Bundle-ClassPath: ., lib/log4j.jar in your MANIFEST.MF. Of course, this will have to be done for every plugin that needs a jar, and for every jar, as well as changing the build path in Eclipse. Some more relevant questions and links: https://stackoverflow.com/questions/5150415/log4j-under-osgi-eclipse-rcp, https://stackoverflow.com/questions/11341627/integrating-3rd-party-jars-into-eclipse-rcp, https://stackoverflow.com/questions/6545212/add-3rd-party-library-to-an-eclipse-plugin. I need SIMPLIFICATION, I don't want to wrap jars into bundles and something similar. Bundles are jars with a bit extra information in MANIFEST.MF, nothing more. OSGi (and therefore Eclipse) does need this information. Most commonly used libraries either already are bundles (just check for Bundle-SymbolicName in MANIFEST.MF), or available as a bundle. Failing that, wrapping a jar only has to be done once for each jar, instead of having to change build path, build.properties and Bundle-ClassPath for every plugin which depends on the jar as well.
upvote count: 2
type: Answer

http://stackoverflow.com/q/21036464
has comment: http://stackoverflow.com/comment/31631794
favorite count: 0
type: UnansweredQuestion
has title: Creating ArrayList from Arrays
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/31631039
type: Question
has comment: http://stackoverflow.com/comment/31625371
has comment: http://stackoverflow.com/comment/31625570
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/31629916
has comment: http://stackoverflow.com/comment/31628497
has body: I want to create 3 ArrayLists from some arrays like below: ([x,y]) ([x1,y1],[x2,y2],[x3,y3]) ([m1,n1],[m2,n2],[m3,n3],[m4,n4],[m5,n5]) Here is the code related to this part: public static ArrayList&lt;Double[]&gt;[] hexpos = (ArrayList&lt;Double[]&gt;[])new ArrayList[3]; for (int i = 0; i &lt; 3; i++) hexpos[ i ] = new ArrayList&lt;Double[]&gt; (); //====================initial arraylist1 Double[] t = new Double[2]; t[0]=x; t[1]=y; hexpos[0].add(t); System.out.println("xtest"+ hexpos[0].get(0)[0]); System.out.println("ytest"+ hexpos[0].get(0)[1]); //======================== initial arraylist2 int count=1; t = new Double[2]; t[0]=x; t[1]=y-(2*r); hexpos[count].add(t); t = new Double[2]; t[0]=x+(3*s/2); t[1]=y-r; hexpos[count].add(t); t = new Double[2]; t[0]=x+(3*s/2); t[1]=y+r; hexpos[count].add(t); count++; //======================== initial arraylist3 t = new Double[2]; t[0]=x; t[1]=y-(4*r); hexpos[count].add(t); t = new Double[2]; t[0]=x+(3*s/2); t[1]=y-(3*r); hexpos[count].add(t); t = new Double[2]; t[0]=x+(3*s); t[1]=y-(2*r); hexpos[count].add(t); t = new Double[2]; t[0]=x+(3*s); t[1]=y; hexpos[count].add(t); I just print out the first arraylist as an example: The output is: xtest 400 ytest 400 xtest 400 ytest 400 xtest 400 ytest 400 The problem is that why it repeats 3times!!!
has comment: http://stackoverflow.com/comment/31629827
tagged with: arraylist
answer count: 1
has answer: http://stackoverflow.com/a/21036574

executorservice
type: Tag
tags question: http://stackoverflow.com/q/21082536
tags question: http://stackoverflow.com/q/21102759
tags question: http://stackoverflow.com/q/21033735
tag name: executorservice
tags question: http://stackoverflow.com/q/21126905
tags question: http://stackoverflow.com/q/21124355
tags question: http://stackoverflow.com/q/21156599

http://stackoverflow.com/a/21025036
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21024099
has body: First, trouble-shooting Exceptions is called Debugging. Second, there are several way to debug. 1. For starts, you should find out what line is causing the exception. You can do this by looking at the topmost line of the stack trace. If this is not a reference to code you wrote, check the next line, then the next, etc - until you find something you wrote. If you do not find such a line, skip to step 3. 2. Once the line is found, add several print statements before the line to print the current variables. For example: Log.d("DEBUG", "myVariable = " + myVariable == null ? "null" : myVariable); Then run it and check the output. 3. The final step is to use the Eclipse Debugger. If you know the line where the code breaks, add a breakpoint by left clicking on the line number. If not, just add the breakpoint on the first line of onCreate. The link above tells how to use this feature in detail. Also remember that Android is shipped with many debug tools. You can read about them here.

http://stackoverflow.com/a/21165663
has comment: http://stackoverflow.com/comment/31863019
has comment: http://stackoverflow.com/comment/31862383
has body: If getNumber() maps 'a' to 1, 'b' to 2, ... , '@' to 29, then the range of possible when multiplied by sleutel (3) would be 3-87. A String such as "abck" would be mapped to "12311", and when multiplied by sleutel would become "36933". But even if the code knows it's a 4 digit String there's no way it can know how it breaks down: 36933 could be 3*6*9*33=5346 (correct) or 36*9*3*3=2916 (incorrect) or 3*69*3*3=1863 (incorrect), etc. Instead of storing each step as a String, here I do everything in one for loop: if (email_text.getText().length() &gt; 0 &amp;&amp; code_text.getText().length() &gt; 0) { final String userEmail = email_text.getText().toString().substring(0, Math.min(6, email_text.length())).toLowerCase(); final String userCode = code_text.getText().toString(); int sleutel = 3; long res = 1; for(int i=0; i&lt;userEmail.length(); i++) // loops through userEmail res *= getNumber(userEmail.charAt(i)) * sleutel; // when the loop ends, res will have the correct value if (userCode.equals(Long.toString(res))) { Intent intent = new Intent(Login.this, Home.class); startActivity(intent); } else {...} // display toast }
has comment: http://stackoverflow.com/comment/31863653
accepted answer of: http://stackoverflow.com/q/21164921
has comment: http://stackoverflow.com/comment/31863803
answers question: http://stackoverflow.com/q/21164921
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31861985

http://stackoverflow.com/comment/31794650
has text: define `better` and show some code and state a problem as this is not a real question.
score: 0
comment on: http://stackoverflow.com/q/21128400
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31787754
type: Comment
type: QuestionComment
has text: It looks like you're using NetBeans, so you might have run into the same issues as described in these questions: http://stackoverflow.com/questions/20165965/java-runtimeexception-uncompilable-source-code-erroneous-tree-type and http://stackoverflow.com/questions/2333285/java-lang-runtimeexception-uncompilable-source-code-what-can-cause-this . The answers to those questions suggest turning off "Compile on Save", which may not fix your problem but the compiler may then show you the actual error in your code.
comment on: http://stackoverflow.com/q/21124689
score: 0

http://stackoverflow.com/a/21078165
has comment: http://stackoverflow.com/comment/31743359
has comment: http://stackoverflow.com/comment/31720049
type: Answer
accepted answer of: http://stackoverflow.com/q/21063975
has comment: http://stackoverflow.com/comment/31738059
answers question: http://stackoverflow.com/q/21063975
has comment: http://stackoverflow.com/comment/31749620
has comment: http://stackoverflow.com/comment/31771325
has body: You may want to look at this SO Q&amp;A. The idea is: You create a server call (e.g., RPC) to fetch your html template as a String. You create a corresponding HTMLPanel that knows how to attach dynamic elements to your html template that you pass in the constructor. You add this newly constructed HTMLPanel to your page root panel where you want it. On this SO you can find a panel template code that may help you. The version therein does not have the "dynamic" html source, instead it is hard-coded in a ClientBundle. But it is easy to extend so the source html is dynamic, simply add a construtor like: public HtmlPanelBase(final String htmlContentAsText) where htmlContentAsText is your template html String from your server as follows: public class HtmlPanelBase extends Composite { private String _dynPostfix = ""; protected final String id(final String staticId) { return staticId + _dynPostfix; } private final String wrapId(final String id) { return "id=\"" + id + "\""; } private final String wrapDynId(final String refId) { return wrapId(id(refId)); } private String _htmlContentAsText = null; protected String getHtmlContentAsText() { return _htmlContentAsText; } private ArrayList&lt;String&gt; _idList = null; protected HTMLPanel _holder = null; private HTMLPanel createHtmlPanel(final boolean defineGloballyUniqueIds) { // HTML panel text containing the reference id's. if (defineGloballyUniqueIds) { // Replace the reference id's with dynamic/unique id's. for (String refId : _idList) _htmlContentAsText = _htmlContentAsText.replace(wrapId(refId), wrapDynId(refId)); } // Return the HTMLPanel containing the globally unique id's. return new HTMLPanel(_htmlContentAsText); } public HtmlPanelBase(final String htmlContentAsText, final ArrayList&lt;String&gt; idList, final boolean defineGloballyUniqueIds) { _htmlContentAsText = htmlContentAsText; _idList = idList; this.setup(defineGloballyUniqueIds); super.initWidget(_holder); } public HtmlPanelBase(final String htmlContentAsText) …
score: 0
upvote count: 1
type: AcceptedAnswer
downvote count: 1

http://stackoverflow.com/q/21162885
tagged with: jsp
has answer: http://stackoverflow.com/a/21168694
tagged with: struts
score: 0
has comment: http://stackoverflow.com/comment/31856344
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31856239
tagged with: java
has body: This is a sample code from config file. <forward name="success" path="/b2b/init.do"/> I did not find any specific configuration for /b2b/init.do. So my question is, where the request will be forwarded?? There is no JSP for it. Will it go again to the Action class?
has comment: http://stackoverflow.com/comment/31856421
tagged with: struts-1
has title: What happens when in struts configuration "xyz.do" is in forward path?
type: Question
answer count: 1

http://stackoverflow.com/q/21137312
possible better answer: http://stackoverflow.com/a/21137658
has answer: http://stackoverflow.com/a/21137658
tagged with: mysql
linked to: http://stackoverflow.com/q/2773302
linked to: http://stackoverflow.com/q/6687422
type: AnsweredQuestion
tagged with: performance
has body: I try to save my data to MySql(local DB) throw HibernateTemplate - getHibernateTemplate().execute(new HibernateCallback&lt;Void&gt;() { @Override public Void doInHibernate(Session session) throws HibernateException, SQLException { for (TimeInvocationStatistics stat : statistics) { session.persist(stat); } session.persist(workloadProcessDescriptiveStatistics); session.flush(); return null; } }); The size of data is not so big, but this operation takes over 60 sec. I tried to profile it - (good picture resolution - picture ) As I can see session.flush() (second row in stacktrace) works slow, how I can improve it ? Could it be MySql server problems ? UPD: find interesting thread - hibernate forum, try to do in this way
upvote count: 5
has answer: http://stackoverflow.com/a/21228666
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/31809737
type: Question
answer count: 2
score: 5
downvote count: 0
has title: Slow Hibernate flush
favorite count: 0
accepted answer: http://stackoverflow.com/a/21228666

http://stackoverflow.com/a/21024993
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31636253
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21024296
has body: Yes, you basically need a few more lines of code (which you can put in a function) to compute the path to a vertex. Something like: (in pseudo-code) Stack getPath(int[] previous, int start, int end) int current = end Stack path path.push(current) while (current != start) current = previous[current] path.push(current) return path A high-level description of this algorithm is fairly simple: Start from the end Repeatedly look at the previous element until we get to the beginning, storing the vertices as we go Why a Stack? Because we're pushing the element from the end of the path, so the last element we push is the start, which would be the first element we pop if using a Stack.
answers question: http://stackoverflow.com/q/21024296

http://stackoverflow.com/q/21030500
downvote count: 1
has comment: http://stackoverflow.com/comment/31614595
has comment: http://stackoverflow.com/comment/31615019
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21060755
has body: Helo guys, my problem is that sometimes if my Rectangle2D gets a big width or height its bottom,left border splits and no longer makes a continous border and if I even make it wider the border goes smaller and smaller, like if there were a limitation of how long a rectangles border can be... It is really confusing and so far I have not found the solution :S I put there a link to a picture so you can see for yourself. new Rectangle2D.Double(mojrectangle.getUpperleftPointmojRectangle().getX(), mojrectangle.getUpperleftPointmojRectangle().getY(),1000,1000) repaint(); thanks for your help.. BTW I have the same problem with Arc2D if it gets really big UPDATE: I removed from the function the setStroke command and now it draws it correctly, but in the future I will need to set the Rectangles stroke so it leaves me sad. @Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2=(Graphics2D)g; //g2.setStroke(stroke); g2.draw(rectangle); } Here I put an example code of my project, please try it with g2.setStroke(selectedstroke)- it wont work, and without it...I hope I explained myself clear . package com.awtgraphicsdemo; import java.awt.*; import java.awt.event.*; import java.awt.geom.*; import javax.swing.JComboBox; public class AWTgraphicsdemo extends Frame { final float dash[] = {10.0f}; final float solid[] = {1000.0f}; // these must be in an Array float lineWidth[]={2.0f,4.0f,6.0f,8.0f,10.0f}; // width of the drawing line String[] lineWidthString={"2.0","4.0","6.0","8.0","10.0"}; JComboBox strokecombobox=new JComboBox(lineWidthString); BasicStroke selectedStroke = new BasicStroke(lineWidth[0],BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER, 10.0f, solid, 0.0f); public AWTgraphicsdemo(){ super("Java AWT Examples"); prepareGUI(); } public static void main(String[] args){ AWTgraphicsdemo awtGraphicsDemo = new AWTgraphicsdemo(); awtGraphicsDemo.setVisible(true); } private void prepareGUI(){ setSize(400,400); addWindowListener(new WindowAdapter() { p…
favorite count: 0
has comment: http://stackoverflow.com/comment/31626116
score: 0
has comment: http://stackoverflow.com/comment/31626248
tagged with: graphics2d
has title: Rectangle2D, borders go missing?
has answer: http://stackoverflow.com/a/21046356
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31626306
upvote count: 1
tagged with: swing

http://stackoverflow.com/q/21085135
has comment: http://stackoverflow.com/comment/31748892
tagged with: java
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/31721827
score: 4
has body: As is said in the documentary, "This code abuses the loadFactor field to do double-duty as a hashCode in progress flag, so as not to worsen the space performance.A negative load factor indicates that hash code computation is in progress." How to understand this paragraph? public synchronized int hashCode() { /* * This code detects the recursion caused by computing the hash code * of a self-referential hash table and prevents the stack overflow * that would otherwise result. This allows certain 1.1-era * applets with self-referential hash tables to work. This code * abuses the loadFactor field to do double-duty as a hashCode * in progress flag, so as not to worsen the space performance. * A negative load factor indicates that hash code computation is * in progress. */ int h = 0; if (count == 0 || loadFactor &lt; 0) return h; // Returns zero loadFactor = -loadFactor; // Mark hashCode computation in progress Entry[] tab = table; for (int i = 0; i &lt; tab.length; i++) for (Entry e = tab[i]; e != null; e = e.next) h += e.key.hashCode() ^ e.value.hashCode(); loadFactor = -loadFactor; // Mark hashCode computation complete return h;
has title: How to understand the hashCode function of java.util.Hashtable in the source codes of JDK
has comment: http://stackoverflow.com/comment/31715013
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31715213
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31714543
tagged with: hashtable
has comment: http://stackoverflow.com/comment/31715373
has answer: http://stackoverflow.com/a/21085551

http://stackoverflow.com/comment/31817637
has text: This is the only valid answer so far
comment on: http://stackoverflow.com/a/21141655
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31796417
has text: @MostafaJamareh His issue is with running it from command line.
type: QuestionComment
comment on: http://stackoverflow.com/q/21129692
score: 0
type: Comment

http://stackoverflow.com/comment/31888546
has text: This is not a SSCCE. A SSCCE should show the actual problem so that others have a chance to help you. Your example does not replicate the problem. Also if this code does not replicate the problem that should already be a hint: From http://sscce.org: "If you are trimming a very large amount of code for others to see, you might trim out a part of it early on that you think is not related to the problem, yet the problem is fixed. [...] You might look more closely at the part you cut out, and in doing so, spot the problem."
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21137700
type: QuestionComment

http://stackoverflow.com/q/21161760
tagged with: java
type: Question
has title: AfterThrow advice based on Exception Types
tagged with: spring-aop
answer count: 1
has answer: http://stackoverflow.com/a/21228907
has body: I am trying to create multiple AfterThrowing advice mechanisms based on the type of exception a method throws. It is not getting invoked. Below is the code snippet: @Component @Configuration @EnableAspectJAutoProxy @Aspect public class ExceptionAspect { @Pointcut("within( sampleapp.config.*)") public void allInitializationMethods() { } @AfterThrowing(pointcut="allInitializationMethods()",throwing="ex" ) public void allInitializationMethodsBefore(FatalInitializationException ex) { System.out.println("Point cut executed"); } @AfterThrowing(pointcut="allInitializationMethods()",throwing="ex" ) public void allInitializationMethodsBefore(RetryToRecoverException ex) { System.out.println("Point cut executed"); } }
has comment: http://stackoverflow.com/comment/31854179
type: UnansweredQuestion
tagged with: spring
score: 0

http://stackoverflow.com/comment/31755705
has text: need help with that? (mvc or mvvm)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21043250

exception
tags question: http://stackoverflow.com/q/21090245
tags question: http://stackoverflow.com/q/21084658
tags question: http://stackoverflow.com/q/21145987
tags question: http://stackoverflow.com/q/21065986
tags question: http://stackoverflow.com/q/21086746
tags question: http://stackoverflow.com/q/21164917
tags question: http://stackoverflow.com/q/21020347
tags question: http://stackoverflow.com/q/21163782
tags question: http://stackoverflow.com/q/21018718
tags question: http://stackoverflow.com/q/21083464
tags question: http://stackoverflow.com/q/21145409
tags question: http://stackoverflow.com/q/21124475
tags question: http://stackoverflow.com/q/21182869
tags question: http://stackoverflow.com/q/21160180
tags question: http://stackoverflow.com/q/21101842
tags question: http://stackoverflow.com/q/21034567
tags question: http://stackoverflow.com/q/21039959
tags question: http://stackoverflow.com/q/21125295
tags question: http://stackoverflow.com/q/21121875
type: Tag
tags question: http://stackoverflow.com/q/21052145
tags question: http://stackoverflow.com/q/21170333
tags question: http://stackoverflow.com/q/21028708
tags question: http://stackoverflow.com/q/21057204
tags question: http://stackoverflow.com/q/21027171
tags question: http://stackoverflow.com/q/21124315
tags question: http://stackoverflow.com/q/21150688
tags question: http://stackoverflow.com/q/21090735
tags question: http://stackoverflow.com/q/21036671
tags question: http://stackoverflow.com/q/21041227
tags question: http://stackoverflow.com/q/21067637
tags question: http://stackoverflow.com/q/21046908
tags question: http://stackoverflow.com/q/21169539
tags question: http://stackoverflow.com/q/21070324
tags question: http://stackoverflow.com/q/21043443
tag name: exception
tags question: http://stackoverflow.com/q/21135873
tags question: http://stackoverflow.com/q/21038779
tags question: http://stackoverflow.com/q/21164931
tags question: http://stackoverflow.com/q/21146956
tags question: http://stackoverflow.com/q/21181085

http://stackoverflow.com/q/21170443
tagged with: android
has comment: http://stackoverflow.com/comment/31873200
linked to: http://stackoverflow.com/q/14180643
has comment: http://stackoverflow.com/comment/31873887
type: UnansweredQuestion
has body: I'm trying to connect an android device to a database using XAMPP MySQL and Apache is working properly This is UpdateDatabase.java public class UpdateDatabase extends ListActivity { private ProgressDialog pDialog; //192.168.1.254 - IP of the server(laptop) private static String url = "http://192.168.1.254:80/shopsmart/test.php"; //JSON Node Names private static final String prod_list = "product"; private static final String prod_id = "ProductID"; private static final String prod_aisle = "Aisle"; private static final String prod_category = "Category"; private static final String prod_subcategory = "SubCategory"; private static final String prod_name = "ProductName"; private static final String prod_price = "Price"; // Product JSON Array JSONArray products = null; // Hashmap for ListView ArrayList&lt;HashMap&lt;String, String&gt;&gt;productList; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.update_database); productList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); ListView lv = getListView(); // Calling async task to get json new GetDatabase().execute(); } /** * Async task class to get json by making HTTP call * */ private class GetDatabase extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected void onPreExecute() { super.onPreExecute(); // Showing progress dialog pDialog = new ProgressDialog(UpdateDatabase.this); pDialog.setMessage("Loading..."); pDialog.setCancelable(false); pDialog.show(); } @Override protected Void doInBackground(Void... arg0) { // Creating service handler class instance ServiceHandler sh = new ServiceHandler(); // Making a request to url and getting response String jsonStr = sh.makeServiceCall(url, ServiceHandler.GET); Log.e("Response: ", "&gt; " + jsonStr); //if (jsonStr != null){ try{ JSONObject jsonObj = new JSONObject(jsonStr); // Getting JSON Array node products = jsonObj.getJSONArray(prod_list); // Looping through all products for(int x =0; x&lt;pr…
tagged with: php
has answer: http://stackoverflow.com/a/21183843
has title: Cannot connect Android device to database using XAMPP
score: 0
has comment: http://stackoverflow.com/comment/31870273
tagged with: java
has comment: http://stackoverflow.com/comment/31872924
type: Question
tagged with: xampp
has comment: http://stackoverflow.com/comment/31871019
answer count: 1
has comment: http://stackoverflow.com/comment/31870797
has comment: http://stackoverflow.com/comment/31871235

http://stackoverflow.com/a/21056678
has body: The other answers are half correct: Your problem can be solved by setting a RenderingHint. But in this case, it's not antialiasing. Try adding this before you apply your transform: g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21043525
answers question: http://stackoverflow.com/q/21043525
type: AcceptedAnswer

http://stackoverflow.com/a/21179682
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/21178674
score: 2
type: AcceptedAnswer
downvote count: 0
has body: You can create a class that implements the Overlay interface and then add it to the ChartPanel using the addOverlay(Overlay) method. Everything that the overlay draws will be drawn after (so on top of) the chart.
accepted answer of: http://stackoverflow.com/q/21178674

http://stackoverflow.com/comment/31876065
comment on: http://stackoverflow.com/a/21173543
type: Comment
has text: The Byte is passed by reference. It's all a matter of terminology. The mechanics behind the scene may pass by value but from the point of view of someone calling a method with an object they are passing by reference. Yes I agree there are subtle differences when it comes right down to it but that's a big discussion of its own. http://stackoverflow.com/questions/40480/is-java-pass-by-reference
score: 0
type: AnswerComment

http://stackoverflow.com/q/21105037
has body: I'm having trouble understanding how tokens are counted in the StringTokenizer class with constructors that have multiple arguments. String line = ("This is a sample sentence, how many tokens are inside this sentence?") ; new StringTokenizer(String str) new StringTokenizer(String str, String delims ) If i use the first StringToknenizer constructor with a single argument of line and write a sample program the result is "thisisasamplesentencehowmanytokensareinside?" and 12 tokens. It returns the whole sentence without any spaces. I understand how this works. If use the second constructor with two arguments, (line, ",") my test program will get "this is a test sentence how many tokens are in this sentence? " with spaces for each word but no comma and only 2 tokens. I thought it should count BOTH the spaces and the comma as token separators but it counts everything before the comma as 1 token and everything after the comma as 1 token. This part is confusing me. My problem is I don't understand how tokens are separated using delimiters using constructors that take multiple arguments such as (line, " ,"). Am i missing something or misunderstanding something?
has answer: http://stackoverflow.com/a/21105060
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21105060
score: 1
tagged with: java
upvote count: 1
tagged with: stringtokenizer
has comment: http://stackoverflow.com/comment/31751915
type: Question
has comment: http://stackoverflow.com/comment/31751937
answer count: 1
downvote count: 0
has title: StringTokenizer class --- Using Delimiters as token separators
has comment: http://stackoverflow.com/comment/31751890
favorite count: 0

http://stackoverflow.com/a/21435787
score: 0
has body: The change would be as below then it works. I have realized this later. Make the Joincolumn as insertable=false,updatable=false in main entity class. @Entity @Table(name="CASE_REMINDER_OPR") public class CaseReminderOpr implements Serializable { private static final long serialVersionUID = 1L; @EmbeddedId private CaseReminderOprPK pk; @ManyToOne @JoinColumn(name = "CASE_ID", insertable=false, updatable=false) private CaseReminders caseRem; } Now the query should work as expected. Criteria ctr = getSession().createCriteria(CaseReminderOpr.class, "CRO").add(Restrictions.eq("pk.oprOperatorId", operatorId)); ctr.createCriteria("CRO.caseRem", "CR", Criteria.INNER_JOIN).add(Restrictions.eq("CR.caseStatus", STATUS.OPEN.getValue())); List&lt;CaseReminderOpr&gt; oprList = ctr.list(); Hopefully I am clear in explaining.
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21025062
answers question: http://stackoverflow.com/q/21025062

http://stackoverflow.com/comment/31802040
type: QuestionComment
has text: Its a library in java which is used for the authentication..
score: 0
comment on: http://stackoverflow.com/q/21132861
type: Comment

http://stackoverflow.com/q/21111471
has body: I have a table with columns RECID,regionID, areaID ,UserID ,AppNo, NextAppNo(Accepts null) and data is as follows (NextApp is not null in the first row only): 1,102,Ar-1,xyz,1,1 2,102,Ar-1,qwe,2 3,102,Ar-1,fgh,3 4,102,Ar-1,yuyi,4 1) Add a record Now I want to add another record: First I get the max number of APPID where areaID = Ar-1 and regionID =102 (Java) Then, if max appNo is 0, add nextappNo, otherwise do nothing Then insert into db Is it possible to do this in one query? 2) Delete a record In another query i want to delete the first record: First I select data where areaID = 'Ar-1' and regionID =102 Then in a loop (Java) I check if Recid is the same id I want to delete From there onward I update the the column approver and also, if the record which we are going to delete has approverNO = 1, then also update the next approver to one of the next record Then delete the record from table.
tagged with: db2
has comment: http://stackoverflow.com/comment/31764555
has comment: http://stackoverflow.com/comment/31765381
score: 0
has comment: http://stackoverflow.com/comment/31763793
answer count: 1
has title: Multiple operation in same sql
has comment: http://stackoverflow.com/comment/31764313
has comment: http://stackoverflow.com/comment/31764455
has answer: http://stackoverflow.com/a/21113300
has comment: http://stackoverflow.com/comment/31764298
has comment: http://stackoverflow.com/comment/31763772
tagged with: jdbc
has comment: http://stackoverflow.com/comment/34664183
type: UnansweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/31996598
type: Comment
comment on: http://stackoverflow.com/a/21144151
has text: My feeling is there should not be any downvoting feature in so. I have seen numerous downvotings which are meaningless.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31637848
has text: It was my first feeling but I would be sure. Thanks for the fast reply.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21044031
type: Comment

http://stackoverflow.com/a/24646805
has comment: http://stackoverflow.com/comment/38301253
type: Answer
has body: You can take a screenshot like this and save it to the SD card: View content = findViewById(R.id.layoutroot); content.setDrawingCacheEnabled(true); Function to get the rendered view: private void getScreen() { View content = findViewById(R.id.layoutroot); Bitmap bitmap = content.getDrawingCache(); File file = new File( Environment.getExternalStorageDirectory() + "/asdf.png"); try { file.createNewFile(); FileOutputStream ostream = new FileOutputStream(file); bitmap.compress(CompressFormat.PNG, 100, ostream); ostream.close(); } catch (Exception e) { e.printStackTrace(); } } You have to add this permission to your AndroidManifest (if you want to save it): &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
downvote count: 2
answers question: http://stackoverflow.com/q/21164321
score: 0
has comment: http://stackoverflow.com/comment/38307441
upvote count: 2

http://stackoverflow.com/a/21166490
score: 3
has comment: http://stackoverflow.com/comment/31889901
downvote count: 0
answers question: http://stackoverflow.com/q/21094027
has body: You must have a connection to the SonarQube server to run an analysis. The interface was simplified in version 3.3. Local analysis did not mean without connection to the server.
type: Answer
upvote count: 3

http://stackoverflow.com/q/21115133
type: UnansweredQuestion
has body: After downloading the latest .tar file I ran tar zxvf jdk-7u45-linux-x64.tar.gz to extract java files. Set the path in .bashrc file (vi ~/.bashrc) as below; export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_45/bin/java export PATH=$PATH:/usr/lib/jvm/jdk1.7.0_45/bin export JDK_HOME=/usr/lib/jvm/jdk1.7.0_45 export JRE_HOME=/usr/lib/jvm/jre1.7.0_45 Now, running command java -version or which java, java PATH still pointing to the older java version (java version "1.6.0_27"). I know default ubuntu takes OpenJDK path. I have to change the path as latest version as my system environment variable set in .bashrc file. Also, sudo update-alternatives --config java Selection Path Priority Status ------------------------------------------------------------ 0 /usr/lib/jvm/java-7-oracle/jre/bin/java 1062 auto mode 1 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode 2 /usr/lib/jvm/java-7-oracle/jre/bin/java 1062 manual mode * 3 /usr/lib/jvm/jdk1.7.0_45/bin/java 1 manual mode Press enter to keep the current choice[*], or type selection number: 3
has answer: http://stackoverflow.com/a/36252179
tagged with: ubuntu-10.04
tagged with: java
score: 23
tagged with: classpath
upvote count: 23
type: Question
has answer: http://stackoverflow.com/a/25487660
has answer: http://stackoverflow.com/a/35305363
has answer: http://stackoverflow.com/a/21115169
has title: Ubuntu: change the path from OpenJDK 6 to Oracle JDK 7
downvote count: 0
linked to: http://stackoverflow.com/q/6477415
has answer: http://stackoverflow.com/a/21115204
favorite count: 0
answer count: 5

http://stackoverflow.com/comment/31837035
has text: A mode is something that occurs the most times in a set. For example, given set {1,1,1,1,1,1,2,3}, 1 would be the mode because it occurs the most amount of times.
score: 0
comment on: http://stackoverflow.com/q/21151844
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21048059
downvote count: 5
score: -4
has body: java code: Map args = new HashMap&lt;String, Boolean&gt;(); args.put("isManufacturingKey", true); ZulHandler window = Preconditions.checkNotNull((ZulHandler) Executions.createComponents("/decision_comment_window.zul", null, args)); right access in .zul file: "${arg.isManufacturingKey}" note: I access to parameter using arg accessor It is working for my ZK version!!!
type: Answer
has comment: http://stackoverflow.com/comment/31717055
upvote count: 1
has comment: http://stackoverflow.com/comment/31716299
has comment: http://stackoverflow.com/comment/31714678
has comment: http://stackoverflow.com/comment/31717846
accepted answer of: http://stackoverflow.com/q/21024642
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21024642

http://stackoverflow.com/comment/32012210
score: 0
type: AnswerComment
has text: thank you @xild ,i solved it like that , but i am searching for `jsf` solution
type: Comment
comment on: http://stackoverflow.com/a/21234473

http://stackoverflow.com/a/21066506
has body: Chech this link, it has the solution. You must use the method hasNextInt() of Scanner.
upvote count: 1
has comment: http://stackoverflow.com/comment/31680249
score: 1
has comment: http://stackoverflow.com/comment/31679985
downvote count: 0
answers question: http://stackoverflow.com/q/21066340
type: Answer

http://stackoverflow.com/comment/31826738
comment on: http://stackoverflow.com/q/21146414
has text: `JPanel pan = Main.grille;` this is not necessary at all..
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31610257
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21028164
type: QuestionComment
has text: so what API is PropertiesConfiguration part of?

http://stackoverflow.com/comment/31800972
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21132442
has text: Post your code block of onActivityResult
score: 0

http://stackoverflow.com/a/35376224
type: Answer
has body: The value of bits2 has been altered during the and operation by the call bits2.and(bits1). The value of bits2 is again altered by the following or and xor operations by the calls bits2.or(bits1) and bits2.xor(bits1)
score: 0
answers question: http://stackoverflow.com/q/21036453

http://stackoverflow.com/a/21177138
answers question: http://stackoverflow.com/q/21176870
score: 1
upvote count: 1
downvote count: 0
type: Answer
has body: Try putting the file not in src/ but in the general project folder.
has comment: http://stackoverflow.com/comment/31882706

http://stackoverflow.com/comment/31811395
has text: add your stack trace.
comment on: http://stackoverflow.com/a/21138310
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21035711
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31626229
type: Question
has comment: http://stackoverflow.com/comment/31626199
possible better answer: http://stackoverflow.com/a/21036076
answer count: 2
has comment: http://stackoverflow.com/comment/31624152
downvote count: 0
has answer: http://stackoverflow.com/a/21036925
favorite count: 0
has title: One-liner to instantiate a Collection of enums with a common interface
tagged with: generics
has body: I have two enums that implement a common interface. I've tried to declare the interface so only enums can implement it. interface CommonEnumInterface&lt;E extends Enum&lt;?&gt;&gt; { /** It doesn't matter what this does. */ E commonInterfaceMethod(); } enum Enum1 implements CommonEnumInterface&lt;Enum1&gt; { FOO, BAR, BAZ; @Override public Enum1 commonInterfaceMethod() { return null; } } enum Enum2 implements CommonEnumInterface&lt;Enum2&gt; { BLAH, YADDA, RHUBARB; @Override public Enum2 commonInterfaceMethod() { return Enum2.BLAH; } } Now I want to create another enum, where each constant has its own Set of elements of type CommonEnumInterface, but not necessarily the same class. Every way I've found feels like a hack, though, especially for cases where I want each constant to declared with more than one set of elements. These comments show what I've tried. Is there a more elegant way (that compiles)? enum CreatingAnotherEnumAttempt { // Type mismatch: cannot convert from List&lt;Enum&lt;?&gt;&amp;CommonEnumInterface&lt;?&gt;&gt; to List&lt;CommonEnumInterface&lt;?&gt;&gt; A(Arrays.asList(Enum1.FOO, Enum2.BLAH)), // Cannot cast from List&lt;Enum&lt;?&gt;&amp;CommonEnumInterface&lt;?&gt;&gt; to List&lt;CommonEnumInterface&lt;?&gt;&gt; B((List&lt;CommonEnumInterface&lt;?&gt;&gt;) Arrays.asList(Enum1.FOO, Enum2.BLAH)), // This works, but it generates type safety warnings, and it's hard to read. C(Arrays.asList((CommonEnumInterface&lt;?&gt;) Enum1.FOO, (CommonEnumInterface&lt;?&gt;) Enum2.BLAH)), // This is the best I've come up with. D(getMixOfElements(Enum1.FOO, Enum2.BLAH)); /** * I want to populate this set in the constructor. */ private final Set&lt;CommonEnumInterface&lt;?&gt;&gt; mixOfElements; /** * I tried declaring the Set this way, but wildcards can extend only one interface, so there's a syntax error at the ampersand. */ private final Set&lt;? extends Enum&lt;?&gt; &amp; CommonEnumInterface&lt;?&gt;&gt; mixOfElements; /** * This is the constructor I'm tryin…
linked to: http://stackoverflow.com/q/2745265
linked to: http://stackoverflow.com/q/9969690
linked to: http://stackoverflow.com/q/3935832
accepted answer: http://stackoverflow.com/a/21036925
upvote count: 1
tagged with: collections
type: AnsweredQuestion
tagged with: enums
has comment: http://stackoverflow.com/comment/31623984
has answer: http://stackoverflow.com/a/21036076

http://stackoverflow.com/a/21034252
answers question: http://stackoverflow.com/q/21034182
downvote count: 0
has body: Your method average() takes an array of doubles, but then retrieves an other array from standard input. That doesn't make sense. Either get the doubles and pass them to the method, or don't pass them to the method and get them from standard input.
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/21039647
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21039579
score: 2
has body: Alternative are classes from java.io or Apache Commons IO, also Guava IO can help. Guava is most modern, so I think it is the best solution for you. Read more: Guava's I/O package utilities, explained.
accepted answer of: http://stackoverflow.com/q/21039579

http://stackoverflow.com/q/21088407
downvote count: 0
answer count: 6
has answer: http://stackoverflow.com/a/21519033
has answer: http://stackoverflow.com/a/28430359
has answer: http://stackoverflow.com/a/21646992
tagged with: android
has answer: http://stackoverflow.com/a/21088567
favorite count: 0
has answer: http://stackoverflow.com/a/21632509
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/45384211
has title: Perfectly linear spacing between gridview items
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21646112
linked to: http://stackoverflow.com/q/10016343
has body: I am using following code to show the GirdView items. &lt;GridView android:id="@+id/gridView" android:gravity="center_horizontal" android:layout_below="@+id/searchLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:horizontalSpacing="10dp" android:numColumns="3" android:stretchMode="columnWidth" android:verticalSpacing="10dp" /&gt; Each GridItem (ImageView) is of size 92dp What i want is to show only 3 Columns or 3 images each Row and each Top, bottom ,left right all needs to be perfectly aligned and equal. Below is the result of above code. It can be seen that spaces on left and right of the grid are very less as compared with the ones in between images and also between rows are very small. Secondly, I am using 92dp. above is the result of S3, but when i use small screen the 3rd image doesn't get fit like in 320 dp screen. Shouldn't using "dp" automatically adjust according to screen size?
type: Question
tagged with: android-layout

http://stackoverflow.com/q/21175710
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31880126
tagged with: date
has comment: http://stackoverflow.com/comment/31899191
has title: Issue with Java Date format
score: 0
has comment: http://stackoverflow.com/comment/31880153
answer count: 1
has answer: http://stackoverflow.com/a/21176744
accepted answer: http://stackoverflow.com/a/21176744
has body: Inside my application I allow my users to enter some dates, which I should save in DB. Now since some of my application users are located in different locations worldwide and each have their own date/time format, I thought of accepting any date format from them, then change those formats to a fixed format which I can then save in DB. Yet my problem now is that I getting an error when trying to change date fromat from that entered by the user to my application format, below is the code I am currently working with Entity field: @Temporal(TemporalType.TIMESTAMP) @Column(name="DDATE", nullable=false, unique=false) private Date dDate; Controller code that save in DB: Date rDate, dDate; String Date1 = request.getParameter("Date1"); String Date2 = request.getParameter("Date2"); //Here the date get display for example as 01/29/2014 (i.e. MM/DD/YYYY) System.out.println("Date1:: "+ Date1); System.out.println("Date2:: "+ Date2); SimpleDateFormat parseRDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat parseDDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { //#########Crashes in the next two lines#########... rDate = (Date)parseRDate.parse(Date1); dDate = (Date)parseDDate.parse(Date2); } catch (ParseException e) { e.printStackTrace(); } So can someone please suggest how I can format any date entered by my users to the application static date format? Thanks
type: AnsweredQuestion

http://stackoverflow.com/a/28878487
has body: Also experienced issues with Java the last 2 weeks no longer working in IE 11 under Windows 7 x64 (reverted to Chrome where it DID work) I had to go through (ALL) the following steps in order to restore Java operation: Try and install latest Java => Error was produced 'The installer cannot proceed with the current Internet Connection setting' Hit 'Retry', and the installer started working Java 8 update 40 was installed successfully, however Java still doesn't work in IE (after closing IE / reboot) Removed older/outdated versions (either using the Oracle-Java tool or through Install/Uninstall programs). In my case, I was able to remove old version 7 update 71. After another attempt to close IE completely and restarting Windows did not resolve the issue (as before, testing Java operation using the Oracle-Java online tool failed to work and even failed to produce the 'grey box' that is always shown (in spite of the fact that the Java-plugins are loaded and activated) Finally restored IE settings through: Internet options -> Advanced -> Reset (Note: I tried that before 1 week earlier, but then this DID NOT yield a solution either) Eureka, it works again ! Result is now as follows using the Oracle-Java online test tool, and any Java-applets now work again in IE11: "Gefeliciteerd! U beschikt over de juiste Java-versie. (Version 8 Update 40)."
type: Answer
answers question: http://stackoverflow.com/q/21145293
score: 0

http://stackoverflow.com/comment/31781094
comment on: http://stackoverflow.com/a/21121139
score: 0
type: AnswerComment
type: Comment
has text: As another note this definition is not _consistent with equals_ and hence breaks the requirement of the `compareTo` method contract.

http://stackoverflow.com/comment/31751611
type: AnswerComment
comment on: http://stackoverflow.com/a/21104896
type: Comment
score: 2
has text: +1 Please use `try-with-resources` or `close()` in finally, never empty catch `do some log` or something like that :)

http://stackoverflow.com/comment/31792745
score: 0
has text: I see. Your constructor for `User` class seems to be OK. PIN and account number should've been assigned and saved as part of a `User` object. Are you 100% sure they are not?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21127171

http://stackoverflow.com/comment/90162753
type: Comment
comment on: http://stackoverflow.com/a/23096737
score: 0
has text: What did the trick for me was indeed removing the ".properties" at the end and adding "file:" at the start. Thank you for pointing that in this answer.
type: AnswerComment

http://stackoverflow.com/q/21054858
tagged with: android
has body: On Windows 7, have installed: 1) Eclipse Standard 4.3.1 64 bit edition, 2) 64 bit JRE deployed in Eclipse folder, 3) IBM Worklight Studio version 6.1.0 from Eclipse Marketplace, and finally 4) ADT deployed from Eclipse Marketplace. Creating simple default Hybrid Hello World app. I do a "Run As Android Application" and get the error: "The project was not built since the build path is incomplete. Cannot find the class file for the java.lang.Object. Details attached in screen captures. Odd since I am including the JRE as is evident in the Build Path preferences shown in the attached screen captures below. Have tried this on two different clean computers and get the same error.
tagged with: ibm-mobilefirst
has title: IBM Worklight Version 6.1.0 with embedded WL Development Server on Win 7, consistent Android build error
downvote count: 0
has comment: http://stackoverflow.com/comment/31658511
accepted answer: http://stackoverflow.com/a/21054921
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21054921
tagged with: eclipse
type: Question
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/a/21043704
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21043443
has body: like Marton said, you need to use Log. Log can basically be used to debug in the same way that you use "System.out.print("String")" in Java. So, you can have the Log class send messages to a view called LogCat within Android (you usually have to open this view yourself). The way log works is like this: Log.v("Testing", "Show me this message"); Where 'v' is the type of Log message (there are a couple) and "Testing" is the tag you would like to associate it. Tags are useful because you can filter by tags, so you could, for example, have LogCat temporarily only display Logs with the tag Testing.
downvote count: 0
type: Answer

http://stackoverflow.com/a/21028779
has body: If you are trying to update your own application with a new version, you must sign your application with the same keystore file each time. If you lost the password for your keystore... you're out of luck, and may have to release your update as a new application. If you are simply trying to upload an application for the first time, this error would show up if the package name of your application is already being used by someone else, as the package name is used as the unique identifier for each application. You can check this by going to the following url: https://play.google.com/store/apps/details?id=your.full.package.name.here To fix this, simply change the package name of your application.
answers question: http://stackoverflow.com/q/21028256
score: 0
type: Answer

http://stackoverflow.com/a/21114041
has body: @Transactional is not responsible for your performance. first of all use Batch Processing for large amount of data as follows int i = 0; for(Deal deal : deals) session.save(deal); if ( i % 20 == 0 ) { //20, same as the JDBC batch size //flush a batch of inserts and release memory: session.flush(); session.clear(); } i++; } session.flush(); session.clear(); read more about Chapter 13. Batch processing Sometimes it is not the query itself which causes a slowdown - another query operating on the table can easily inserts to slow down due to transactional isolation and locking. read more about this external factores link1 innodb_buffer_pool_size=614M too many indexes? Primary Key Genration Why is MySQL InnoDB insert so slow? hope this things will help you out
accepted answer of: http://stackoverflow.com/q/21110285
answers question: http://stackoverflow.com/q/21110285
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/21048843
tagged with: regex
has body: I have two strings: First string should match this pattern: "anyDoubleValue anyDoubleValue anyDoubleValue". Please note these double values are separated by white spaces. What I mean by anyDoubleValue is: any integer or decimal value. Second string should match this pattern: "aSet aSet aSet". The set "aSet" should only have -1 or 0 or 1. Also note that these sets are separated by white spaces. I have tried the following, but they doesn't serve the purpose: if(aString.matches("[\\d\\s\\d\\s\\d]"){//do foo} if(anotherString.matches("[0-1\\s0-1\\s0-1]")){// do bar}
has answer: http://stackoverflow.com/a/21048913
has title: Check for a pattern (that has double values) to match. Regex
tagged with: java
possible better answer: http://stackoverflow.com/a/21048970
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21048935
accepted answer: http://stackoverflow.com/a/21048935
has answer: http://stackoverflow.com/a/21048970
has comment: http://stackoverflow.com/comment/31646920
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/31647077
has comment: http://stackoverflow.com/comment/31646988
has comment: http://stackoverflow.com/comment/31647004

http://stackoverflow.com/comment/31707611
type: QuestionComment
has text: db is on the phone and it is updated as the message is received in Service running .
score: 0
comment on: http://stackoverflow.com/q/21080804
type: Comment

http://stackoverflow.com/a/21172599
downvote count: 0
answers question: http://stackoverflow.com/q/21167596
has body: From the Box2D Manual (7.3 Body Factory): It is faster to attach several shapes to a static body than to create several static bodies with a single shape on each one. Internally, Box2D sets the mass and inverse mass of static bodies to zero. This makes the math work out so that most algorithms don't need to treat static bodies as a special case. It is indeed more performant. Is it noticeable? depends, if you have a lot of bodies with one fixture and you make them fixtures of one single body, but probably not for most games. I would recommend you to use the one which is easier to implement, and only make it more performant when you really need it.
score: 10
has comment: http://stackoverflow.com/comment/31892127
upvote count: 10
type: Answer

http://stackoverflow.com/comment/32267920
score: 3
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21392660
has text: The bug was with Android Studio 0.4.2. If you're using Android Studio 0.4.3 or above, the dependency resolution should work like you've described.

http://stackoverflow.com/comment/31892539
comment on: http://stackoverflow.com/a/21182936
score: 0
has text: Is it being called before `notifyDataSetChanged`?
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31788721
comment on: http://stackoverflow.com/q/21125320
score: 0
type: QuestionComment
has text: You are already getting source object (`b`). What else do you need?
type: Comment

http://stackoverflow.com/comment/31862290
type: Comment
comment on: http://stackoverflow.com/a/21165682
has text: You could try, as @SotiriosDelimanolis suggest, to detect the `ConfigurableWebBindingInitializer` instead of the `RequestMappingHandlerAdapter` that would save you a couple of lines. Although I'm not sure if the `ConfigurableWebBindingInitializer` is actually added as a bean to the context.
type: AnswerComment
score: 0

http://stackoverflow.com/a/21148562
upvote count: 8
has body: Specify the JVM for Eclipse You can specify JDK version for usage with Eclipse in eclipse.ini. This will resolve problem with starting Eclipse. -vm /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/bin/java Warning: Add this configuration before -vmargs. Master your Java Environnement with jenv It is much easier to maintain multiple JDK versions with jenv. jenv is for a equivalent of rbenv, but for Java environnement. It allow to easily switch between several JDKs installations (already presents), and configure which one to use per project. Eclipse JDK Setting JDK in Eclipse
answers question: http://stackoverflow.com/q/21147720
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/31848226
has comment: http://stackoverflow.com/comment/31883582
downvote count: 0
has comment: http://stackoverflow.com/comment/31839533

http://stackoverflow.com/a/21062594
has comment: http://stackoverflow.com/comment/31672693
has comment: http://stackoverflow.com/comment/31672671
has body: Shouldn't it be something like that: public class X { final ConsoleIO io = new ConsoleIO(); private final Board board; private final Player player1; private final Player player2; private boolean playing; public X(String een, String twee) { this.board = new Board(); if (een.toUpperCase().equals("C")) { this.player1 = new Computer(); } else { this.player1 = new Human(een); } if (twee.toUpperCase().equals("C")) { this.player2 = new Computer(); } else { this.player2 = new Human(twee); } this.playing = true; } } Note: Both, Human and Computer are subclasses of Player. Move common methods/fields into the Player base class. If you do it right, it might not be necessary to distinguish between Computer and Human later on. For example, there might be an abstract method move in the Player base class that is implemented individually in subclasses: Computer#move uses an algorithm to calculate the next move; Human#move asks the human player to input the next move. So if it's turn of player1, you simply call player1.move(), regardless of if it's a Human or Computer.
answers question: http://stackoverflow.com/q/21062425
score: 0
has comment: http://stackoverflow.com/comment/31672824
has comment: http://stackoverflow.com/comment/31672953
type: Answer

http://stackoverflow.com/comment/31809613
score: 1
type: AnswerComment
type: Comment
has text: Success is written like 'succes' in my native language, which is probably why I couldn't see it for the life of me. Too bad about the lame downvote. Thanks a bunch man!
comment on: http://stackoverflow.com/a/21137170

http://stackoverflow.com/comment/31693212
has text: possible duplicate of [How to get X and Y index of element inside GridLayout?](http://stackoverflow.com/questions/7702697/how-to-get-x-and-y-index-of-element-inside-gridlayout)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21073313
type: Comment

http://stackoverflow.com/comment/31637061
has text: Thank you very much! Is it possible for you to tell me what is meant by "Cast the new IV into AlgorithmParameterSpec class"? Thanks again!
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21043423

http://stackoverflow.com/comment/31853731
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21161416
has text: You should consider to use UnitTest to verifiy everthing works, before optimizing. I think your code has >1 Bug, in getDist(..) -> `start.getX() == end.getY()` should it be `start.getY()` ?
score: 1

http://stackoverflow.com/comment/31633124
has text: Try to call the `jarsigner` and parse the output of it. Or maybe there is a direct API.
comment on: http://stackoverflow.com/q/21041151
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/31670815
has text: Thank you for the help everyone. @cdMinix yes the file contents text.
type: Comment
comment on: http://stackoverflow.com/q/21061438
score: 0
type: QuestionComment

http://stackoverflow.com/q/21084225
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21086542
tagged with: spring
has comment: http://stackoverflow.com/comment/31714979
tagged with: java
has body: i am building a project using spring mvc framework in netbeans when i use <mvc:annotation-driven\> in project-servlet.xml project deployment failed my code is i_am_alive-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: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" xmlns:mvc="http://www.springframework.org/schema/mvc" 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:annotation-config /> <!--<mvc:annotation-driven/>--> <context:component-scan base-package="i_am_alive.web" /> <property name="basename" value="messages"/> </beans> when i comment <mvc:annotation-driven\> project deploy successfully but no validation occurs and if i uncomment <mvc:annotation-driven\> project deployment fails adduserform.jsp <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@ include file="/WEB-INF/jsp/include.jsp" %> <%@ taglib prefix="form" uri="http://ww…
type: Question
has title: Error using <mvc:annotation-driven/> application is not deploy by tomcat in netbeans
score: 0
has comment: http://stackoverflow.com/comment/31713065
tagged with: validation
answer count: 1
has comment: http://stackoverflow.com/comment/31713823
tagged with: netbeans-7

http://stackoverflow.com/comment/31785945
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21122851
has text: @ the OP - I'd post your solution as an "answer" below and mark it as the correct one so that other can learn too. Also, I'd post some more code to give context to the problem as well as it's solution.

http://stackoverflow.com/q/21022390
tagged with: compiler-errors
score: 0
tagged with: animation
answer count: 1
accepted answer: http://stackoverflow.com/a/21022678
has title: Compiler error using loops, switch and case
tagged with: case
has comment: http://stackoverflow.com/comment/31599463
has comment: http://stackoverflow.com/comment/31599206
tagged with: java
has comment: http://stackoverflow.com/comment/31599601
tagged with: switch-statement
has comment: http://stackoverflow.com/comment/31599276
has body: I've animated my some of my program, it's a guy moving, and it works and everything. I have a lot of repeating code though so I wanted to try and make it more efficient and loop through what's repeating. My problem is that even with the right amount of brackets it gives me errors for almost everything below public void DrawAstronaut(Graphics2D g2d) { if (nViewDX == -1) { DrawAstronautLeft(g2d); } else if (nViewDX == 1) { DrawAstronautRight(g2d); } else { DrawAstronautStand(g2d); } } public void DrawAstronautLeft(Graphics2D g2d) { switch (nAstroAnimPos) { for(int i = 1; i &lt;= 6; i++){ case i: g2d.drawImage(arimgAstroWalkLeft[i], nAstronautX + 1, nAstronautY + 1, this); break; default: g2d.drawImage(imgAstroStandLeft, nAstronautX + 1, nAstronautY + 1, this); break; } } } public void DrawAstronautRight(Graphics2D g2d) { switch (nAstroAnimPos) { for(int i = 1; i &lt;= 6; i++){ case i: g2d.drawImage(arimgAstroWalkRight[i], nAstronautX + 1, nAstronautY + 1, this); break; default: g2d.drawImage(imgAstroStandRight, nAstronautX + 1, nAstronautY + 1, this); break; } } } public void DrawAstronautStand(Graphics2D g2d) { switch (nAstroAnimPos) { default: g2d.drawImage(imgAstroStandLeft, nAstronautX, nAstronautY, this); break; } } When I added the for loop to the DrawAstronautLeft everything below got errors, it didn't even like the public void DrawAstronautRight even though their shouldn't be anything wrong with it. I know I have the right amount of brackets but could someone help put things in the right place? The Errors Include: Not being able to find symbols "case, default, or "}" expected" "class, interface, or enum expected"
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31599432
has answer: http://stackoverflow.com/a/21022678

http://stackoverflow.com/comment/31630009
score: 0
type: Comment
has text: This does not work unfortunately. Response header for error page is set after filter invocation, and no filter is being invoked on error page request... So I can catch servlet exception inside `doFilter` method and define my header, but this gets overridden afterwards :(
comment on: http://stackoverflow.com/a/21025418
type: AnswerComment

http://stackoverflow.com/q/21083301
has body: I have two Java classes as below... (1) JavaClass SyncTest: It defines a class (implementing Runnable) and invokes a "synchronized" method (named "call") defined in Class SyncTestCalled (2) JavaClass SyncTestCalled : There is one synchronized method. ------ After calling from main(), I am thinking it should output something like: [Two] [Three] [One] But, it outputs something like this (note the open bracket which is not paired in right locations) : [[[Two] Three] One] What's wrong with the codes? Please help. Thanks a lot! Here is the code of these two classes... public class SyncTest implements Runnable { Thread t; String name; SyncTestCalled syncTestCalled; public SyncTest(String name) { t = new Thread(this, name); syncTestCalled = new SyncTestCalled(); this.name = name; t.start(); } public void run() { syncTestCalled.call(this.name); } public static void main(String[] args) { SyncTest syncTest1 = new SyncTest("One"); SyncTest syncTest2 = new SyncTest("Two"); SyncTest syncTest3 = new SyncTest("Three"); } } // of class SyncTest public class SyncTestCalled { public SyncTestCalled() { // Do nothing } synchronized public void call(String message) { System.out.print("["); try { Thread.sleep(1000); System.out.print(message); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("]"); } } // of class SyncTestCalled
has comment: http://stackoverflow.com/comment/31714193
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31711637
accepted answer: http://stackoverflow.com/a/21083415
has title: Why this is not right by using synchronized (Java concurrency) in this example?
tagged with: multithreading
has answer: http://stackoverflow.com/a/21084210
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/21084210
has answer: http://stackoverflow.com/a/21083415
type: Question

http://stackoverflow.com/comment/31701700
type: QuestionComment
comment on: http://stackoverflow.com/q/21078383
score: 1
has text: possible duplicate of [find pair of numbers in array that add to given sum](http://stackoverflow.com/questions/8334981/find-pair-of-numbers-in-array-that-add-to-given-sum)
type: Comment

http://stackoverflow.com/q/21125628
tagged with: hibernate
has comment: http://stackoverflow.com/comment/31791156
answer count: 1
tagged with: jpa
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21131398
tagged with: spring
has title: Generating schema using Hibernate schema exporter failed because of @ManyToOne relation
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31791034
upvote count: 1
accepted answer: http://stackoverflow.com/a/21131398
has body: I am using SchemaExporter to generate ddl script. public static void main(String[] args) throws Exception { SchemaDDLGenerator.execute(Dialect.ORACLE, Key.class); } Key class: @Entity public class Key extends AbstractEntity { private static final long serialVersionUID = 7467094398251027638L; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE) @Column(name = "KEY_SID") private Long id; @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.EAGER) private API granter; @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.EAGER) private API grantee; API entity class is an entity class with simple columns. Schema Generator: public class SchemaDDLGenerator { public static void execute(Dialect dialect, Class&lt;?&gt;... classes) { Configuration configuration = new Configuration(); configuration.setProperty(Environment.DIALECT, dialect.getClassName()); for (Class&lt;?&gt; entityClass : classes) { configuration.addAnnotatedClass(entityClass); } SchemaExport schemaExport = new SchemaExport(configuration); schemaExport.setDelimiter(";"); boolean consolePrint = true; boolean exportInDatabase = false; schemaExport.setOutputFile(String.format("ddl_%s_drop.%s ", new Object[] { dialect.name().toLowerCase(), "sql" })); schemaExport.drop(false, false); schemaExport.setOutputFile(String.format("ddl_%s.%s ", new Object[] { dialect.name().toLowerCase(), "sql" })); schemaExport.create(consolePrint, exportInDatabase); } } It is working fine for entities that does not have any relations in it but it is throwing error for the ones having @OneToMany or @ManyToOne relations. Exception in thread "main" org.hibernate.AnnotationException: @OneToOne or @ManyToOne on com.example.data.model.ClientRelationship.grantee references an unknown entity: com.example.data.model.Client at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:109) at org.hibernate.cfg.Configuration.processEndOfQueue(Configuration.java:1532) at org.hibernate.cfg.Configuration.processFkSecondPa…
type: Question
has comment: http://stackoverflow.com/comment/31791708
has comment: http://stackoverflow.com/comment/31791303
has comment: http://stackoverflow.com/comment/31790872
has comment: http://stackoverflow.com/comment/31791443

resttemplate
tags question: http://stackoverflow.com/q/21102071
tags question: http://stackoverflow.com/q/21131429
type: Tag
tags question: http://stackoverflow.com/q/21035132
tags question: http://stackoverflow.com/q/21116719
tags question: http://stackoverflow.com/q/21145558
tags question: http://stackoverflow.com/q/21101250
tag name: resttemplate

http://stackoverflow.com/comment/31886901
has text: 64 or 32 bit machines?
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21179634

http://stackoverflow.com/q/21170567
tagged with: sql
has answer: http://stackoverflow.com/a/21170850
has body: we have a presentation of a java gui handling a postgresql database. On the presentation-server we have some schemas and one is reserved for our group. My problem now is in binding a Schema to the connection, so that over the whole process the schema is bound. Here is what i have so far, but the c.setSchema() doesn't seems to be implemented, maybe there are other ways. Class.forName("org.postgresql.Driver"); c = DriverManager.getConnection("jdbc:postgresql://" + host + ":" + port + "/" + databaseName, username, password); c.setAutoCommit(false); c.setSchema("b7"); Thanks Stefan Sprenger EDIT( FIRST TRY): c = DriverManager.getConnection("jdbc:postgresql://" + host + ":" + port + "/" + databaseName+"?searchpath=b7", username, password); no error but not working
tagged with: database-connection
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/21171800
possible better answer: http://stackoverflow.com/a/21170850
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
tagged with: database
accepted answer: http://stackoverflow.com/a/21171800
favorite count: 0
tagged with: postgresql
has title: Postgre SQL Schema Bind of Connection
score: 0

http://stackoverflow.com/comment/31779007
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21120334
score: 0
has text: Command line variable? Do you mean the String [] args array passed to main into other objects?

http://stackoverflow.com/comment/31851081
comment on: http://stackoverflow.com/q/21159224
type: Comment
type: QuestionComment
score: 0
has text: Not sure I understand. Doesn't the wizard show up at all or does it just not have its own icon in the start-/task-bar?

http://stackoverflow.com/a/21173902
score: 1
has body: The server instance returned from HttpServer server = GrizzlyHttpServerFactory.createHttpServer(baseUri, config); had been already started, so you can remove these lines: server.start(); NetworkListener listener = new NetworkListener("grizzly2","localhost", 4434); server.addListener(listener);
has comment: http://stackoverflow.com/comment/31884740
answers question: http://stackoverflow.com/q/21173127
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/31877457
downvote count: 0

http://stackoverflow.com/comment/32276177
type: Comment
has text: Wait, it still doesn't show. I tried to remove the rs.getDate("movie_dateBorrowed");. I just put String DateStr = rs.getString("movie_dateBorrowed"); System.out.println(DateStr); but it still shows the same error.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21154871

http://stackoverflow.com/comment/106488669
has text: why you use packet.setData, packet.setAddress methods? data and address and other data already defined in new DatagramPacket(bytepacket, bytepacket.length, address, iPort). Isn't it?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21059552

http://stackoverflow.com/q/21059675
accepted answer: http://stackoverflow.com/a/21059789
has comment: http://stackoverflow.com/comment/31667325
has comment: http://stackoverflow.com/comment/31667264
tagged with: android
possible better answer: http://stackoverflow.com/a/21059842
has answer: http://stackoverflow.com/a/21059964
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21059842
tagged with: list
tagged with: java
has comment: http://stackoverflow.com/comment/31667340
has comment: http://stackoverflow.com/comment/31667253
has comment: http://stackoverflow.com/comment/31667313
type: Question
has answer: http://stackoverflow.com/a/21059789
tagged with: arrays
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/31667326
has title: How to remove an item from a List<Integer> that is inside an array?
has body: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView t; List&lt;Integer&gt; listA = Arrays.asList(0,1,2,3); List&lt;Integer&gt; listB = Arrays.asList(0,2,4,6,8); List&lt;Integer&gt;[] listC = (List&lt;Integer&gt;[])new List[2]; t = (TextView)findViewById(R.id.textView1); listC[0] = listA; listC[1] = listB; t.setText("Result: "+ listC[0].get(1)); //Result: 1 listC[0].remove(0); //i get an error in this line } I am very confused as of why I don't get an error with: listC[0].get(1) but something's wrong with: listC[0].remove(0); Is there something wrong with my codes? Is there a more efficient way? Please help me! Thank you so much!

http://stackoverflow.com/q/21051696
type: Question
possible better answer: http://stackoverflow.com/a/21051838
has answer: http://stackoverflow.com/a/21051985
tagged with: ant
tagged with: executable-jar
tagged with: jar
downvote count: 0
has comment: http://stackoverflow.com/comment/31652471
upvote count: 3
answer count: 3
has body: I am trying to run my jar file by executing java -jar myJarFile.jar arg1 but it throws ClassNotFoundException ! for the classfiles which are referred in my class files. FYI, these class files are present in some external jars which i have placed on my classpath by setting the env CLASSPATH variable pointing to the directory where all the external jars are placed. And my MANIFEST.MF would look like Manifest-Version: 1.0 Ant-Version: Apache Ant 1.7.1 Created-By: 20.14-b01 (Sun Microsystems Inc.) Main-Class: com.abc.test.FileGenerator BuildDate: 01/10/2014 12:52:36 Class-Path: C:\libraries\commons-beanutils-1.8.3.jar C:\libraries\commons-collections.jar C:\libraries\commons-discovery-0.2.jar C:\libraries\commons-lang-2.5.jar C:\libraries\commons-logging-1.1.1.jar C:\libraries\commons-logging-1.0.4.jar My main class is available in my jar and I am running from where my jar is getting created by ant script like dist folder. I even changed the absolute path to relative path.. It is still throwing the same error. Here is my jar structure - myFile.jar |- com | | | abc | | | test | |-package1 | |-package2 | |-FileGenerator.class | |-META-INF | |- MANIFEST.MF Kindly help me on this. Thanks in advance!
tagged with: cmd
has answer: http://stackoverflow.com/a/21051786
accepted answer: http://stackoverflow.com/a/21051786
favorite count: 0
has answer: http://stackoverflow.com/a/21051838
has comment: http://stackoverflow.com/comment/31652594
type: AnsweredQuestion
score: 3
tagged with: java
has title: Unable to load the jar files which are on the classpath

http://stackoverflow.com/q/21113452
tagged with: java
upvote count: 1
has title: how to check pageproperty on type String[]?
has body: I have in the dialog.xml the following property: Now I created new page and filled this property with three values (string1, string2, string3). this property in crx jcr:content looks like this: Name | Type | Value ------------------------------ myProperty | String[] | string1, string2, string3 Now I would like to access this property with java and check if it has the type String[]. I do this as follow: boolean result = myPage.getProperties().get("myProperty") instanceof String[]; result returns "false". How to check, if myProperty is String array ? p.s: String.valueOf(...).get("myProperty")) returns [Ljava.lang.Object;@761139f3
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21113731
has answer: http://stackoverflow.com/a/21114540
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/21113731
favorite count: 0
tagged with: crx
has comment: http://stackoverflow.com/comment/31771178
type: Question
tagged with: aem
answer count: 2
accepted answer: http://stackoverflow.com/a/21114540

http://stackoverflow.com/comment/31644374
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21047272
has text: @tucuxi indeed, it was an error of fast writing. Thank you though.

http://stackoverflow.com/comment/31706132
has text: There aren't many ways to interpret `syntax error`. Format your code and check your `{` and `}`.
comment on: http://stackoverflow.com/q/21080627
score: 5
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21171737
tagged with: int
tagged with: inputmismatchexception
possible better answer: http://stackoverflow.com/a/21171795
favorite count: 0
linked to: http://stackoverflow.com/q/4676345
tagged with: return
answer count: 5
has title: Eclipse asks for a return statement though I have one
upvote count: 3
has body: protected int readInt(String prompt) { try { System.out.print(prompt); int i = keyboard.nextInt(); keyboard.nextLine(); return i; } catch (java.util.InputMismatchException e) { System.out.println("Error: Insert a number."); } } Hi! Eclipse gives me this error at the method readInt(): "This method must return a result of type int." and gives the example solutions "Add return statement" and "Change return type to void". I've tried to put the return i statement outside the try-and-catch loop, but when I do, the return statement can't find the variable i. I've been struggeling with this for a while now, and can't seem to make it work... I would appreciate any help! Thank you.
has answer: http://stackoverflow.com/a/21171774
type: AnsweredQuestion
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/21171870
type: Question
tagged with: try-catch
has answer: http://stackoverflow.com/a/21171999
downvote count: 0
has answer: http://stackoverflow.com/a/21171907
accepted answer: http://stackoverflow.com/a/21171774
has answer: http://stackoverflow.com/a/21171795

excel
tags question: http://stackoverflow.com/q/21024224
tags question: http://stackoverflow.com/q/21032468
tag name: excel
tags question: http://stackoverflow.com/q/21184121
tags question: http://stackoverflow.com/q/21111719
tags question: http://stackoverflow.com/q/21113767
tags question: http://stackoverflow.com/q/21156461
tags question: http://stackoverflow.com/q/21092819
tags question: http://stackoverflow.com/q/21115509
tags question: http://stackoverflow.com/q/21086383
tags question: http://stackoverflow.com/q/21130722
tags question: http://stackoverflow.com/q/21085977
tags question: http://stackoverflow.com/q/21116189
tags question: http://stackoverflow.com/q/21131071
tags question: http://stackoverflow.com/q/21038935
type: Tag
tags question: http://stackoverflow.com/q/21133013
tags question: http://stackoverflow.com/q/21156481
tags question: http://stackoverflow.com/q/21178683
tags question: http://stackoverflow.com/q/21167590
tags question: http://stackoverflow.com/q/21153533
tags question: http://stackoverflow.com/q/21108301

http://stackoverflow.com/q/21083298
has comment: http://stackoverflow.com/comment/31711590
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31711441
favorite count: 0
linked to: http://stackoverflow.com/q/15396694
has comment: http://stackoverflow.com/comment/31711725
linked to: http://stackoverflow.com/q/15801069
has title: how can i return control from java swing frame to normal java code
has comment: http://stackoverflow.com/comment/31711696
tagged with: swing
downvote count: 1
has answer: http://stackoverflow.com/a/21083445
type: AnsweredQuestion
has body: am developing a java application in which I am using swings to develop GUI screens. i am supposed to run some application files. which I did by connecting to command prompt by using Runtime.exec() method. if my application failes to execute properly then a GUI frame will come up asking weather to run that file again or to skip. here my problem is when I say run that file again the control should return to the point where the frame is called using ui.setvisible(true); if not the swing frame what can i use to make my code work public static boolean runFormat(String format,String buildNumber) throws Exception { try{ ProcessExecutor process = new ProcessExecutor(); process.executeCommand(format+"\\Scripts"+File.separator+"Step1.bat"+""+"02_00"+" "+format); process.waitForCompletion(); File file = new File(format+File.separator+"Results1.log"); BufferedReader read = new BufferedReader (new FileReader(file)); String line; while((line=read.readLine())!=null) { if(line.contains("Successful exit.")) { return true; } } return false; } catch(Exception e) { System.out.println("EXCEPTION OCCURED.................."); System.out.println("JTag has failed for "+format); e.printStackTrace(); } return true; } void run(Set&lt;String&gt; formats) { try { for(String ar : formats) { boolean b =runFormat(ar,"001"); if(b==false) { ExampleUi ui = new ExampleUi(); ui.setVisible(true); } } } catch(Exception e) { } } Thanks in advance
tagged with: java
accepted answer: http://stackoverflow.com/a/21083445
score: -1
type: Question

http://stackoverflow.com/q/21179098
tagged with: java
score: 16
tagged with: jax-ws
has answer: http://stackoverflow.com/a/21181974
tagged with: jaxb
accepted answer: http://stackoverflow.com/a/21181974
tagged with: web-services
has answer: http://stackoverflow.com/a/21179649
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/8324847
downvote count: 0
upvote count: 16
possible better answer: http://stackoverflow.com/a/21179649
favorite count: 0
tagged with: soap
has body: I have quite a simple method, which I use in WS API by JAX-WS annotations: @WebMethod public MyResponse sendSingle2( @WebParam(name="username") String username, @WebParam(name="password") String password, @WebParam(name="newParam") String newParam) { // the code } Now I want newParam to be optional. I mean I want the method still to work not only when parameter is empty in passed xml: <ws:sendSingle2> user pass </ws:sendSingle2> but also when it is absent: <ws:sendSingle2> user pass </ws:sendSingle2> I need it not to break existing API, which works without the new param.
type: AnsweredQuestion
has title: SOAP WS - make @WebParam optional

fedora
tags question: http://stackoverflow.com/q/21082602
tag name: fedora
type: Tag

http://stackoverflow.com/comment/31641000
has text: Yes, but howto integrate filtering with REST? :)
comment on: http://stackoverflow.com/a/21045635
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31812543
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21111415
type: AnswerComment
has text: @yannbane - You want me to explain the Java Memory Model? No can do! But I can recommend that you buy a copy of "Java Concurrency in Action: by Goetz et al ... and read the last chapter.

http://stackoverflow.com/a/21105180
has comment: http://stackoverflow.com/comment/31752253
upvote count: 2
answers question: http://stackoverflow.com/q/21105156
has body: Your error is in this part: JOptionPane.showMessageDialog(null,"\n\nCiphertext: "); for (int i = 0; i &lt; ciphertext.length; i++) { if (chkEight(i)) { System.out.print("\n"); } JOptionPane.showMessageDialog(null,ciphertext[i] + " "); } You want to take all those ciphertext[i] parts and somehow combine them. Then you can display a single MessageDialog outside of your loop. That will achieve the desired result.
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/31739493
comment on: http://stackoverflow.com/a/21098691
has text: @KonradRudolph Is there an explanation that goes with that or what?
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/a/21142936
accepted answer of: http://stackoverflow.com/q/21142847
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31887045
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/31819675
has body: The StackOverflowError comes from the fact that you implemented your insert recursively. In this case if you add elements 1,2,3,....,15000 your tree will have level 15000 and your recursion will overflow your stack. Implement it imperatively and you won't get StackOverflowError. It should be something like void insert (Node node, int value) { while (true) { if (value &lt; node.value) { if (node.left == null){ node.left = new Node(value); break; } else node = node.left; } else { if (node.right == null){ node.right = new Node(value); break; } else node = node.right; } } } But the whole approach is not optimal. The behavior above is not the one you expect from the BST. You would like to have level log(15000) instead of 15000. You will achieve this by using a balanced structure. It will still be BST tree but with additional constraint that the level is of order O(log n). So once you are done with BST definitely try AVL :)
answers question: http://stackoverflow.com/q/21142847
downvote count: 0

http://stackoverflow.com/q/21092545
possible better answer: http://stackoverflow.com/a/21093298
has answer: http://stackoverflow.com/a/21093298
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31776666
tagged with: java
has answer: http://stackoverflow.com/a/21122286
type: Question
tagged with: intellij-idea
has body: I built an apk using Android 4.4.2 platform using intelliJ 13 , specified the minSdkVersion to 8 (Android 2.2). I tried to deploy the apk to a smartphone with android 4.1, but it could not be installed and gave me parse error .So, I wonder do I need to use android 4.1 api to built the apk in order to deploy it to a android 4.1 phone? This is the manifest file: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8"/> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/>
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21122286
has comment: http://stackoverflow.com/comment/31727537
has title: android versions and parse error
has comment: http://stackoverflow.com/comment/31728708
has comment: http://stackoverflow.com/comment/31782681
tagged with: android
has comment: http://stackoverflow.com/comment/31728820
tagged with: apk

http://stackoverflow.com/q/21101454
type: AnsweredQuestion
has title: Can an HttpServlet inside an uber jar send a page located inside the jar?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21101700
upvote count: 1
tagged with: servlets
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/21101722
downvote count: 0
has answer: http://stackoverflow.com/a/21101722
has comment: http://stackoverflow.com/comment/31746577
linked to: http://stackoverflow.com/q/11947037
has body: I'm writing a localhost web/websocket application bundled inside an uber jar. It's a single-page site, and the HttpServlet will send the html that communicates with the WebSocket server. I'd like the page to remain inside the jar and have the HttpServlet be able to load it from there and send it to the client. Is this possible? If so, how?
has comment: http://stackoverflow.com/comment/31745347
tagged with: uberjar
accepted answer: http://stackoverflow.com/a/21101700
favorite count: 0
tagged with: maven
tagged with: file-location

http://stackoverflow.com/a/21098756
type: Answer
score: 0
has body: JDK misses mutating operations for character sequences, i.e. StringBuilder for some reason does not implement replacement functionality. A possible option would be to use third party libraries, i.e. a MutableString. It is available in Maven Central.
answers question: http://stackoverflow.com/q/21098644

http://stackoverflow.com/comment/31811651
has text: Yes, i did not expect this, but it is logical; another transaction might start while i process the ExecutionResult, which is a reference. Then i might get new values in the object. Is this correct? The no 5 tip is great, thank you for that!
comment on: http://stackoverflow.com/a/21136533
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21122371
type: Answer
answers question: http://stackoverflow.com/q/21097857
accepted answer of: http://stackoverflow.com/q/21097857
has body: The classpath attribute doesn't support directories of jars, you need to include the hibernate jars individually. More easily, you should be able to add the hibernate jars to the "lib" dir in /opt/liquibase/liquibase. The shell script will find all jars in there and add them to the classpath.
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/31648294
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21049527
has text: @Ajeesh P[i].x=Integer.parseInt(s1[0]); in this line
score: 0

http://stackoverflow.com/q/21122018
has comment: http://stackoverflow.com/comment/31782317
has title: retrieving instance from Class object java
has comment: http://stackoverflow.com/comment/31782591
answer count: 2
has comment: http://stackoverflow.com/comment/31783041
has comment: http://stackoverflow.com/comment/31782259
score: 2
downvote count: 0
tagged with: generics
favorite count: 0
accepted answer: http://stackoverflow.com/a/21122105
has comment: http://stackoverflow.com/comment/31782857
has body: I understand that the following can be done . User user = new User(); user.setUsername("a"); user.setPassword("abc"); Class c = user.getClass(); However I have a situation in which I have to extract the instance information from the variable "c" Is it even possible ? . We do have a c.newInstance() method but that would create a new instance of the object User. I need to access the existing instance of the User , which was responsible for creating the "c" variable in the first place . Thanks -----------EDIT----------- Looking at the comments I understood that my concept of getClass was flawed . What I want to achieve is that I need a method which would iterate over an object's getters . So what would be the signature of such ? I was thinking on the lines of public static &lt;T&gt; List&lt;NameValuePair&gt; entityConvert1(Class&lt;T&gt; entity) however as per all the comments , I understand passing the Class wont send in any instance specific information in the method . I need a torch here .
possible better answer: http://stackoverflow.com/a/21122066
has answer: http://stackoverflow.com/a/21122066
type: AnsweredQuestion
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/31782220
type: Question
has answer: http://stackoverflow.com/a/21122105
has comment: http://stackoverflow.com/comment/31783575

http://stackoverflow.com/a/21052702
accepted answer of: http://stackoverflow.com/q/21051445
type: Answer
answers question: http://stackoverflow.com/q/21051445
has comment: http://stackoverflow.com/comment/31656787
has comment: http://stackoverflow.com/comment/31656596
upvote count: 4
type: AcceptedAnswer
score: 4
has comment: http://stackoverflow.com/comment/31654229
downvote count: 0
has body: I'd be interested to know if there's a better way.... But for now, Look for the "wlan0" address. Also, the code below will filter out the loopback addresses for you. List&lt;NetworkInterface&gt; interfaces; try { interfaces = Collections.list(NetworkInterface.getNetworkInterfaces()); for (NetworkInterface ni : interfaces) { if ((ni.isLoopback() == false) &amp;&amp; ni.isUp() &amp;&amp; (ni.getName().equals("wlan0"))) { // enumerate ip addresses on this network interface (e.g. ni.getInetAddresses() // return the first one that is is Ipv4 } } You should combine the above code with calls to android.net.ConnectivityManager to confirm you are on wifi.

http://stackoverflow.com/a/21054341
type: Answer
has body: I'm pretty sure this is not the best way to do it, but it worked for me: public class MyClass extends AbstractPhaseInterceptor&lt; Message &gt; { public MyClass () { super( Phase.PRE_STREAM ); addAfter( AttachmentOutInterceptor.class.getName() ); } @Override public void handleMessage( final Message message ) throws Fault { message.put( "disable.outputstream.optimization", Boolean.TRUE ); final SimpleNsStreamWriter writer = (SimpleNsStreamWriter)StaxUtils.createXMLStreamWriter( message.getContent( OutputStream.class ) ); message.setContent( XMLStreamWriter.class, new DelegatingXMLStreamWriter( writer ) { @Override public void writeCharacters( final String text ) throws XMLStreamException { System.out.println( "text -&gt; " + text ); writer.writeRaw( text ); } } ); }
has comment: http://stackoverflow.com/comment/86533186
downvote count: 0
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21035379

http://stackoverflow.com/a/21073539
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21073420
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21073420
has body: The JSON contains a property named property that is not mappable to a property field on your Property class. Change the JSON to omit this field. If you cannot change your JSON to remove the property property, create a wrapper for the Property class. class PropertyWrapper(){ private Property property; public Property getProperty(){ return property; } public Property setProperty(Property p){ this.property = property; } } Then use the PropertyWrapper within your controller: public ResponseEntity&lt;Property&gt; updateProperty(@RequestBody PropertyWrapper property, @PathVariable String id) { final ResponseEntity&lt;Property&gt; response = new ResponseEntity&lt;Property&gt;(property.getProperty(), HttpStatus.OK); return response; }
type: AcceptedAnswer

http://stackoverflow.com/q/21116971
tagged with: caching
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/31772879
has comment: http://stackoverflow.com/comment/31774267
has comment: http://stackoverflow.com/comment/31772692
has title: How to increase max heap size of Java 6?
score: 0
accepted answer: http://stackoverflow.com/a/21117974
tagged with: heap-memory
has body: I have Java 6 web application(*.war) running on Jetty 8. In application I am caching(with EHCache) some data, but I need to increase max heap size because 1g is not enough. I need min 2g and max 4g. The question is: how to setup this (if it is possible - step by step)? (I was trying "java -Xmx4g -Xms2g" but it respond me that I need to specify file with main method which is imposible for war)
tagged with: ehcache
has answer: http://stackoverflow.com/a/21117974
tagged with: jetty
has comment: http://stackoverflow.com/comment/31774467
has comment: http://stackoverflow.com/comment/31772857
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/31857469
type: Comment
comment on: http://stackoverflow.com/q/21163424
has text: How do you obtain a TGT? By OS-means or through Java? Anyway, you have to tweak your `krb5.conf`.
score: 0
type: QuestionComment

http://stackoverflow.com/q/21118779
has answer: http://stackoverflow.com/a/21119192
duplicate of: http://stackoverflow.com/q/2120255
has answer: http://stackoverflow.com/a/21119370
favorite count: 0
has comment: http://stackoverflow.com/comment/31776186
linked to: http://stackoverflow.com/q/21117991
has comment: http://stackoverflow.com/comment/31776571
has comment: http://stackoverflow.com/comment/31776944
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/21119192
tagged with: java
has body: I am getting the error Before start of result set I thought that I had to use next() on the ResultSet before retrieving data from the ResultSet ? public void getPersonsOrders(String firstName){ Connection con = connect(); try{ Statement s = con.createStatement(); s.executeUpdate("use stl;"); ResultSet rs1 = s.executeQuery("select personID from person where first_name = " +"'"+firstName+"'"+";"); //get persons ID no. ResultSet rs2 = s.executeQuery("select * from orderr where personID = "+rs1.getInt(1)+";"); //use ID no. to rs2.next(); for(int i = 1; i &lt; 4; i++){ //retrive order System.out.println(rs2.getInt(i)); } } catch(SQLException e){ System.out.println("3" +e.getMessage()); } }
tagged with: mysql
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21119334
has comment: http://stackoverflow.com/comment/31776384
has title: MySQL, Before start of resultset
possible better answer: http://stackoverflow.com/a/21119334
has comment: http://stackoverflow.com/comment/31776296
has comment: http://stackoverflow.com/comment/31776260
answer count: 3
downvote count: 0

http://stackoverflow.com/a/21303171
has body: It's probably also worth mentioning the capture component from tapestry-stitch This is only useful in situations where you want to cature part of a page as a String during page / component render.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21161430

http://stackoverflow.com/q/21066875
type: Question
has title: OpenCV Constants.CaptureProperty
downvote count: 0
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/21066952
has answer: http://stackoverflow.com/a/34958903
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31680742
tagged with: opencv
score: 2
has answer: http://stackoverflow.com/a/41684325
tagged with: java
has body: Hi I use OpenCV Java and have some problem. I open video file and try get property like FPS. And others: CV_CAP_PROP_POS_MSEC CV_CAP_PROP_FRAME_COUNT So first I opened video like this: VideoCapture vC = new VideoCapture(url2); and next i have a problem with function vC.get(int i) in OpenCV C++ its look like vC.get(CV_CAP_PROP_FPS); In Java where I find this constants?In HighGui I didnt find them. Only what I find is another libary to OpenCV where are this constants http://siggiorn.com/wp-content/uploads/libraries/opencv-java/docs/sj/opencv/Constants.CaptureProperty.html. But where I find them in OpenCV Java. Anyway how I have to use vC.get() function? Maybe some working example?

http://stackoverflow.com/comment/31708848
type: Comment
score: 0
has text: So do I add student[9].split ... instead of str.split... ?
comment on: http://stackoverflow.com/a/21081595
type: AnswerComment

http://stackoverflow.com/q/21180552
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27086904
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/21182258
has body: I have a .tsv file which has 39 column the last but one column has data as string whose length in more than 100,000 characters Now what is happening is when i am trying to read the file line 1 has headers and then the data follows What is happening is its after reading line 1 its goes to line 3 then line 5 then line 7 Though all the rows have same data Following the log i am getting lineNo=3, rowNo=2, customer=503837-100 , last but one cell length=111275 lineNo=5, rowNo=3, customer=503837-100 , last but one cell length=111275 lineNo=7, rowNo=4, customer=503837-100 , last but one cell length=111275 lineNo=9, rowNo=5, customer=503837-100 , last but one cell length=111275 lineNo=11, rowNo=6, customer=503837-100 , last but one cell length=111275 lineNo=13, rowNo=7, customer=503837-100 , last but one cell length=111275 lineNo=15, rowNo=8, customer=503837-100 , last but one cell length=111275 lineNo=17, rowNo=9, customer=503837-100 , last but one cell length=111275 lineNo=19, rowNo=10, customer=503837-100 , last but one cell length=111275 Following is my code: import java.io.FileReader; import org.supercsv.cellprocessor.Optional; import org.supercsv.cellprocessor.constraint.NotNull; import org.supercsv.cellprocessor.ift.CellProcessor; import org.supercsv.io.CsvBeanReader; import org.supercsv.io.ICsvBeanReader; import org.supercsv.prefs.CsvPreference; public class readWithCsvBeanReader { public static void main(String[] args) throws Exception{ readWithCsvBeanReader(); } private static void readWithCsvBeanReader() throws Exception { ICsvBeanReader beanReader = null; try { beanReader = new CsvBeanReader(new FileReader("C:\MAP TSV\abc.tsv"), CsvPreference.TAB_PREFERENCE); // the header elements are used to map the values to the bean (names must match) final String[] header = beanReader.getHeader(true); final CellProcessor[] processors = getProcessors(); TSVReaderBrandDTO tsvReaderBrandDTO = new TSVReaderBrandDTO(); int i = 0; int last = 0; while( (tsvReaderBrandDTO = beanRead…
tagged with: http://stackoverflow.com/tag/csv
has answer: http://stackoverflow.com/a/21182258
tagged with: opencsv
favorite count: 0
possible better answer: http://stackoverflow.com/a/27086904
has title: Skipping alternate lines while reading .tsv file
type: AnsweredQuestion
score: 3
tagged with: supercsv
upvote count: 3

http://stackoverflow.com/a/21038982
accepted answer of: http://stackoverflow.com/q/21038791
has comment: http://stackoverflow.com/comment/31629493
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31629730
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31630020
answers question: http://stackoverflow.com/q/21038791
has body: You can just POST with Jsoup, no? Connection.Response response = Jsoup.connect("http://www.example.com/xmlhttp.php?action=add_shout") .data("shout_data", "Your shout data in java") .method(Method.POST) .execute()

http://stackoverflow.com/q/21100635
has comment: http://stackoverflow.com/comment/31743480
has comment: http://stackoverflow.com/comment/31743612
tagged with: swing
has body: My code reads an HTML file and I want to show it in new frame as a web page. But I don't know - how can I do this? This is my code: public class EditorPaneLoad extends JFrame{ public EditorPaneLoad() throws Exception{ FileReader reader = new FileReader("a.html"); JEditorPane editor = new JEditorPane(); JTextPane editor = new JTextPane(); editor.setContentType( "text/html" ); editor.setEditable( false ); editor.read(reader, null); //System.out.println(editor.getText()); //System.out.println("\n------------\n"); Document doc = editor.getDocument(); // System.out.println(doc.getText(0, doc.getLength())); JScrollPane scrollPane = new JScrollPane( editor ); scrollPane.setPreferredSize( new Dimension(300, 200) ); getContentPane().add( scrollPane ); } public static void main(String[] args) throws Exception { EditorPaneLoad frame = new EditorPaneLoad(); frame.setDefaultCloseOperation( EXIT_ON_CLOSE ); frame.pack(); frame.setLocationRelativeTo( null ); frame.setVisible(true); } }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31743731
downvote count: 0
score: 1
tagged with: java
favorite count: 0
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/21101645
has comment: http://stackoverflow.com/comment/31743415
possible better answer: http://stackoverflow.com/a/21100864
has answer: http://stackoverflow.com/a/21100864
has title: How can I display an HTML file as a web page?
has answer: http://stackoverflow.com/a/21101645
upvote count: 1
tagged with: http://stackoverflow.com/tag/html
tagged with: web
tagged with: jeditorpane

http://stackoverflow.com/q/21061473
type: AnsweredQuestion
has title: enclosingInstance.newMermberClass(args) in java - effective java text
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21061499
linked to: http://stackoverflow.com/q/19349391
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31670650
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/21061499
has body: In effective java second edition, the author says, It is possible, although rare, to establish the association manually using the expression enclosingInstance.new MemberClass(args). As you would expect, the association takes up space in the nonstatic member class instance and adds time to its construction. What does enclosingInstance.new MemberClass(args) mean? I googled for this and couldn't find anything. Can someone explain to me and shed some light? I have to take a seminar on this topic...
score: 2

http://stackoverflow.com/q/21051445
tagged with: java
tagged with: network-interface
has comment: http://stackoverflow.com/comment/31656698
type: Question
has comment: http://stackoverflow.com/comment/31654116
tagged with: inetaddress
has body: I am using the code to grab the IPv4 address my device is using: public static String getIPAddress(boolean useIPv4) { try { List&lt;NetworkInterface&gt; interfaces = Collections.list(NetworkInterface.getNetworkInterfaces()); for (NetworkInterface intf : interfaces) { List&lt;InetAddress&gt; addrs = Collections.list(intf.getInetAddresses()); for (InetAddress addr : addrs) { if (!addr.isLoopbackAddress()) { String sAddr = addr.getHostAddress().toUpperCase(); boolean isIPv4 = InetAddressUtils.isIPv4Address(sAddr); if (useIPv4) { if (isIPv4) return sAddr; } else { if (!isIPv4) { int delim = sAddr.indexOf('%'); // drop ip6 port suffix return delim&lt;0 ? sAddr : sAddr.substring(0, delim); } } } } } } catch (Exception ex) { } // for now eat exceptions return ""; } My Samsung Galaxy Express is connected to WiFi and has a sim card with cell enabled. The IP I get back from the code above is the 10. address which indicates the phone is using the cell signal, when I need it to use the 192. address available from the network. Is there a way to alter the code above to choose the 192. if available? Or is this the phone that's at fault? I have tried disabling mobile network, placing into airplane mode etc. The only thing that worked was removing the sim card!! I can't expect users to do this just to get an Internal address? Thanks
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/21052702
tagged with: android
has title: Return internal IP from NetworkInterface Android
favorite count: 0
has comment: http://stackoverflow.com/comment/31653922
tagged with: ipv4
has comment: http://stackoverflow.com/comment/31656776
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31652354
score: 3
has answer: http://stackoverflow.com/a/21052702
upvote count: 3

http://stackoverflow.com/comment/31688687
score: 0
comment on: http://stackoverflow.com/a/21070721
has text: No, make a common Parent class of those classes. That class will be a subclass of vehicle
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/31698926
score: 1
has text: Re "parser is not an option", not using a parser is not an option either unless you want to find spurious comments in `"/* A string, not a comment */"`, `"http://foo"`, `"/path/*.txt" /* A file path */`. You need to recognize all tokens that can contain comment boundaries to recognize comment boundaries correctly.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21076729

http://stackoverflow.com/q/21165469
has answer: http://stackoverflow.com/a/63242387
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/31860895
has body: I am working in a project where I have to get input from user by using a JTable. Here I had created a JTable which will have only numerical values. I validated it on keyTyped and its working fine until I press F2 or click on the cell. When I am doing so, it put a cursor in cell and other characters are also being typed. jtblValues.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) { if (e.getKeyCode()==KeyEvent.VK_ENTER &amp;&amp; (jtblValues.getRowCount() == (jtblValues.getSelectedRow()+1))) model.addRow(new Object[]{"", "", ""}); else if (e.getKeyCode()==KeyEvent.VK_TAB &amp;&amp; (jtblValues.getRowCount() == (jtblValues.getSelectedRow()+1)) &amp;&amp; (jtblValues.getColumnCount() == (jtblValues.getSelectedColumn()+1))) model.addRow(new Object[]{"", "", ""}); } public void keyReleased(KeyEvent e) {} public void keyTyped(KeyEvent e) { char c = e.getKeyChar(); if (!((c &gt;= '0') &amp;&amp; (c &lt;= '9') || (c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE) || (c == KeyEvent.VK_ENTER) || (c == KeyEvent.VK_TAB))) { getToolkit().beep(); e.consume(); } } } ); So, how to prevent user by typing other characters than numbers? Thanks.
tagged with: java
tagged with: keylistener
has answer: http://stackoverflow.com/a/45218420
linked to: http://stackoverflow.com/q/15290035
tagged with: jtable
linked to: http://stackoverflow.com/q/12793030
answer count: 3
tagged with: validation
has title: How to prevent typing characters except numbers in JTable cells?
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21165906
has comment: http://stackoverflow.com/comment/31861275

http://stackoverflow.com/a/34182593
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/21083960
type: Answer
has body: The examples by Creature and CycDemo worked for me. However, there is one important thing to note. &lt;custom-handler name="FILE" class="org.jboss.logmanager.handlers.PeriodicSizeRotatingFileHandler" module="org.jboss.logmanager"&gt; &lt;properties&gt; &lt;property name="maxBackupIndex" value="10"/&gt; &lt;property name="rotateSize" value="500000"/&gt; &lt;!-- 500 Kb --&gt; &lt;property name="suffix" value=".yyyy-MM-dd"/&gt; &lt;property name="fileName" value="${jboss.server.log.dir}/server.log"/&gt; &lt;property name="append" value="true"/&gt; &lt;property name="autoFlush" value="true"/&gt; &lt;/properties&gt; &lt;/custom-handler&gt; A maxBackupIndex value of ten means that there could be ten index files for that particular day. However, this will NOT clean up log files that are more than ten days old, or after ten have been written. There is no parameter here like the old MaxRollFileCount in the old log4j.xml TimeAndSizeRollingAppender specification that will clean up log files after a certain number of them have been written. If you want to clean up old JBoss log files, you will have to use cron and the find command with the +mtime parameter.
has comment: http://stackoverflow.com/comment/67963160
downvote count: 1

http://stackoverflow.com/q/21056992
type: Question
answer count: 2
score: 2
has title: Sound in Java: Is it okay to use the same AudioInputStream for several Clips?
tagged with: clip
downvote count: 0
possible better answer: http://stackoverflow.com/a/21060214
favorite count: 0
has body: Here's a little program I wrote: package learningSound; import java.io.*; import java.net.URL; import javax.swing.*; import javax.sound.sampled.*; public class Main extends JFrame { Clip clip1,clip2,clip3; AudioInputStream audioIn; public Main(){ this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setTitle("Test Sound Clip"); this.setSize(300, 200); this.setVisible(true); try{ URL url1 = this.getClass().getResource("ah.wav"); audioIn = AudioSystem.getAudioInputStream(url1); clip1 = AudioSystem.getClip(); clip1.open(audioIn); URL url2 = this.getClass().getResource("eh.wav"); audioIn = AudioSystem.getAudioInputStream(url2); clip2 = AudioSystem.getClip(); clip2.open(audioIn); URL url3 = this.getClass().getResource("ih.wav"); audioIn = AudioSystem.getAudioInputStream(url3); clip3 = AudioSystem.getClip(); clip3.open(audioIn); clip1.start(); clip2.start(); clip3.start(); }catch(Exception e){e.printStackTrace();} } public static void main(String[] args) { new Main(); } } It works, but I wonder if there's a problem with using the same AudioInputStream for several clips. Is this a problem for some reason? Is this the correct way to manage things? Also, a completely different question but a small one: If I have a button that when clicked, plays a Clip. Will the timing of the playing of the clip be 100% accurate? (This is for music-making).
has answer: http://stackoverflow.com/a/21057134
upvote count: 2
tagged with: javasound
tagged with: audio
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21060214
accepted answer: http://stackoverflow.com/a/21057134

http://stackoverflow.com/q/21099335
answer count: 1
downvote count: 0
tagged with: jsmpp
favorite count: 0
has title: Specify "numbering plan indicator" in SMSLib JSMPPGateway
has answer: http://stackoverflow.com/a/21216935
accepted answer: http://stackoverflow.com/a/21216935
upvote count: 1
tagged with: smslib
type: AnsweredQuestion
has body: How can I specify the "Numbering Plan Indicator" when connecting to a SMPP Server with SMSLib (JSMPPGateway). This is my current JSMPPGateway initialization: gateway = new JSMPPGateway(systemId, ip, port, new BindAttributes(username, password, "smpp_1", BindType.TRANSCEIVER)); The problem is that I can't connect to the gateway: IOException: java.io.IOException: Receive negative bind response: Negative response 0000000f found My provider (the owner of the SMPP server) is telling me that I'm not using the correct Numbering Plan Indicator. How can I set that parameter?
score: 1
tagged with: java
type: Question

http://stackoverflow.com/q/21020997
has answer: http://stackoverflow.com/a/21027046
score: 0
answer count: 1
has title: NullPointerException in vaadin table?
has comment: http://stackoverflow.com/comment/31619932
favorite count: 0
tagged with: vaadin7
accepted answer: http://stackoverflow.com/a/21027046
has comment: http://stackoverflow.com/comment/31634968
has comment: http://stackoverflow.com/comment/31597515
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31606348
has comment: http://stackoverflow.com/comment/31597172
tagged with: java
upvote count: 1
has body: I'm having a problem with vaadin table. When I change row of values displayed returns NullPointerException and I don't know why. In vaadin book chapter5 Table, there a method setNullSelectionAllowed(false) when this problem happens, but still doesn't work to me. // Table configs Table tabela = new Table(); tabela.setSizeFull(); tabela.addContainerProperty("Aperfeiçoamento", String.class, null); tabela.addContainerProperty("Entidade", String.class, null); tabela.addContainerProperty("Início", String.class, null); tabela.addContainerProperty("Conclusão", String.class, null); tabela.setNullSelectionAllowed(false); tabela.setImmediate(true); tabela.setSelectable(true); tabela.setColumnReorderingAllowed(false); tabela.addValueChangeListener(this); @Override public void valueChange(ValueChangeEvent event) { /** preenche os campos do formulario com o id do aperfeicoamento */ String id = event.getProperty().getValue().toString(); List&lt;Aperfeicoamento&gt; lista = new AperfeicoamentoDAO().getAperfeicoamentoById(Integer.parseInt(id)); if(!lista.isEmpty()){ try{ for(Aperfeicoamento apf : lista){ aperfeicoamento.setValue(apf.getAperfeicoamento()); entidadeEnsino.setValue(apf.getEntidadeEnsino()); cidade.setValue(apf.getCidade()); comboEstado.setValue(apf.getEstado()); inicio.setValue(new SimpleDateFormat("dd/MM/yyyy").parse(apf.getInicio())); conclusao.setValue(!apf.getConclusao().isEmpty() ? new SimpleDateFormat("dd/MM/yyyy").parse(apf.getConclusao()) : null); } }catch(ParseException e){ e.printStackTrace(); } } } // DAO /** retorna uma lista de perfeicoamento por id e cpf */ public List&lt;Aperfeicoamento&gt; getAperfeicoamentoById(Integer id){ List&lt;Aperfeicoamento&gt; lista = new ArrayList&lt;Aperfeicoamento&gt;(); try{ PreparedStatement stm = this.con.prepareStatement("SELECT * FROM aperfeicoamento WHERE idAperfeicoamento = ? AND cpf = ?"); stm.setInt(1, id); stm.setString(2, SessionCurriculum.getCpfInSession()); ResultSet rs = stm.executeQuery(); if(rs.next()){ Aperfe…
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31596819
tagged with: vaadin

http://stackoverflow.com/comment/31632182
comment on: http://stackoverflow.com/a/21040563
score: 0
type: AnswerComment
type: Comment
has text: They are counterparts. In one hand you have references passed by value, in the other hand you have objects passed by reference.

http://stackoverflow.com/a/21078113
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21078092
type: Answer
has body: You could make your own Dialog for that (not JOptionPane) and use JFormattedTextField and MaskFormatter. You can find an Example here.
accepted answer of: http://stackoverflow.com/q/21078092

http://stackoverflow.com/comment/37524974
type: Comment
comment on: http://stackoverflow.com/a/21043479
has text: firstly you are the one answered.But user `Ramani` copied and posted your answer.Then that answer was accepted within one minutes.I think questions and answer posted by same user.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31888348
comment on: http://stackoverflow.com/q/21180666
type: QuestionComment
has text: Not sure.. but you might want to read some about ascii encoding, I guess
score: 0
type: Comment

http://stackoverflow.com/comment/31638675
score: 0
type: AnswerComment
has text: I mean in activity class whether it is correct the code? Sorry for my english
type: Comment
comment on: http://stackoverflow.com/a/21044255

http://stackoverflow.com/q/21060130
has comment: http://stackoverflow.com/comment/31668175
has body: In Android I have written a program and making a request on a button click to Servlet Page and in response it will execute message written on that servlet page but when I am running my project its not doing anything on that button click. Here is my code, public static final String URL = "http://10.0.2.2:8080/HttpGetServlet/HelloWorldServlet"; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); button = (Button) findViewById(R.id.button); outputText = (TextView) findViewById(R.id.outputTxt); button.setOnClickListener(this); } public void onClick(View view) { GetXMLTask task = new GetXMLTask(); task.execute(new String[] { URL }); } private class GetXMLTask extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... urls) { String output = null; for (String url : urls) { output = getOutputFromUrl(url); } return output; } private String getOutputFromUrl(String url) { String output = null; try { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(url); HttpResponse httpResponse = httpClient.execute(httpGet); HttpEntity httpEntity = httpResponse.getEntity(); output = EntityUtils.toString(httpEntity); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { Toast.makeText(getApplicationContext(), "Server Not Found!", Toast.LENGTH_LONG).show(); } return output; } @Override protected void onPostExecute(String output) { if(output==null) Toast.makeText(getApplicationContext(), "Server Not Found!", Toast.LENGTH_LONG).show(); outputText.setText(output); } } If it can't find url then it should generate an Exception but i am catching exception then also nothing is happing. Where i am wrong. Please help. Thanks.
has comment: http://stackoverflow.com/comment/31668459
has comment: http://stackoverflow.com/comment/31668265
has comment: http://stackoverflow.com/comment/31668240
score: 1
has title: Not getting any response from Servlet Page
tagged with: java
has comment: http://stackoverflow.com/comment/31668542
has comment: http://stackoverflow.com/comment/31668230
has comment: http://stackoverflow.com/comment/31668548
has comment: http://stackoverflow.com/comment/31668188
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/31668219
linked to: http://stackoverflow.com/q/2517468
has comment: http://stackoverflow.com/comment/31668288
has comment: http://stackoverflow.com/comment/31668323
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31668126
has comment: http://stackoverflow.com/comment/31668335
tagged with: android
has comment: http://stackoverflow.com/comment/31669050
has comment: http://stackoverflow.com/comment/31668302
has comment: http://stackoverflow.com/comment/31668202
has comment: http://stackoverflow.com/comment/31668274
has comment: http://stackoverflow.com/comment/31668414
has comment: http://stackoverflow.com/comment/31668320
has comment: http://stackoverflow.com/comment/31668249
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21060305
has comment: http://stackoverflow.com/comment/31668431
upvote count: 1

http://stackoverflow.com/comment/32376523
score: 0
type: Comment
has text: @Kerry Hi, sorry it took so long to get back to you but it takes a while to test as under some situations it was running for a few days between crashes. However I've been running under the Oracle JVM for a while (including doing a full import which caused 3 crashes under the other JVM) with no crashes. If you post your suggestion as an answer I'm quite happy to upvote and accept it :)
type: QuestionComment
comment on: http://stackoverflow.com/q/21118477

http://stackoverflow.com/a/21057989
upvote count: 6
answers question: http://stackoverflow.com/q/21057827
has comment: http://stackoverflow.com/comment/31670628
accepted answer of: http://stackoverflow.com/q/21057827
type: AcceptedAnswer
downvote count: 0
has body: for the asccii character set you can represent the 256bits in 4 longs: you basically hand code an array. public static boolean isUniqueChars(String str) { long checker1 = 0; long checker2 = 0; long checker3 = 0; long checker4 = 0; for (int i = 0; i &lt; str.length(); ++i) { int val = str.charAt(i); int toCheck = val / 64; val %= 64; switch (toCheck) { case 0: if ((checker1 &amp; (1L &lt;&lt; val)) &gt; 0) { return false; } checker1 |= (1L &lt;&lt; val); break; case 1: if ((checker2 &amp; (1L &lt;&lt; val)) &gt; 0) { return false; } checker2 |= (1L &lt;&lt; val); break; case 2: if ((checker3 &amp; (1L &lt;&lt; val)) &gt; 0) { return false; } checker3 |= (1L &lt;&lt; val); break; case 3: if ((checker4 &amp; (1L &lt;&lt; val)) &gt; 0) { return false; } checker4 |= (1L &lt;&lt; val); break; } } return true; } You can use the following code to generate the body of a similar method for unicode characters: static void generate() { StringBuilder sb = new StringBuilder(); for (int i = 0; i &lt; 1024; i++) { sb.append(String.format("long checker%d = 0;%n", i)); } sb.append("for (int i = 0; i &lt; str.length(); ++i) {\n" + "int val = str.charAt(i);\n" + "int toCheck = val / 64;\n" + "val %= 64;\n" + "switch (toCheck) {\n"); for (int i = 0; i &lt; 1024; i++) { sb.append(String.format("case %d:\n" + "if ((checker%d &amp; (1L &lt;&lt; val)) &gt; 0) {\n" + "return false;\n" + "}\n" + "checker%d |= (1L &lt;&lt; val);\n" + "break;\n", i, i, i)); } sb.append("}\n" + "}\n" + "return true;"); System.out.println(sb); }
type: Answer
score: 6

http://stackoverflow.com/comment/31821871
has text: Thanks! This really helps! I didn't knew that you can use only "input.next()". Thanks a lot!
type: Comment
comment on: http://stackoverflow.com/a/21143523
score: 1
type: AnswerComment

http://stackoverflow.com/q/21183811
type: Question
has comment: http://stackoverflow.com/comment/31904720
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31906756
has title: Serialize a Treemap<String, String> using Simple XML
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/21190659
linked to: http://stackoverflow.com/q/3353500
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31905348
tagged with: simple-framework
has body: I've created a wrapper class like below (is this necessary? I tried serializing the treemap directly without making any wrapper class and it failed) following the answer provided in a similar thread. @Root public class Example { @ElementMap(entry="property", value="value", attribute=true, inline=true) private TreeMap&lt;String, String&gt; map; public Example() { map = new TreeMap&lt;String, String&gt;() { { put("testing1", "a"); put("testing2", "b"); put("testing3", "c"); } }; } } Then I try to serialize it with the code below: Serializer serializer = new Persister(); Example example = new Example(); File result = new File("example.xml"); serializer.write(example, result); The example.xml file is generated, but it is an empty file. Is it because Treemap is not supported by Simple XML? Am I doing something wrong?
tagged with: java
has comment: http://stackoverflow.com/comment/31894081
has comment: http://stackoverflow.com/comment/31906414
upvote count: 1
has answer: http://stackoverflow.com/a/21190659

http://stackoverflow.com/q/21043924
answer count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/31638520
has answer: http://stackoverflow.com/a/21056020
has body: can you give me few specific cases when using "streams" in Java 8 would be the best solution? I did a lot of research on the internet but I couldn't find any specific cases... Thank you in advance.
tagged with: java-stream
upvote count: 2
type: UnansweredQuestion
score: -3
tagged with: java-8
has answer: http://stackoverflow.com/a/22019741
type: Question
has title: Examples of streams in Java 8
tagged with: java
downvote count: 5

http://stackoverflow.com/q/21107202
has answer: http://stackoverflow.com/a/21107236
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/20895175
has comment: http://stackoverflow.com/comment/31755366
linked to: http://stackoverflow.com/q/19532591
tagged with: variables
tagged with: initialization
favorite count: 0
possible better answer: http://stackoverflow.com/a/21107236
type: Question
accepted answer: http://stackoverflow.com/a/21107278
answer count: 4
has body: public static double[] processUserInput(String data) { String[] arrayInString; double[] arrayInDouble; int length; if( data.contains(",") ) { arrayInString = data.split(","); length = arrayInString.length; for(int i = 0; i &lt; length; i++) { arrayInDouble[i] = Double.parseDouble( arrayInString[i] ); } } return arrayInDouble; } I am using Netbeans and the compiler is saying that variable arrayInDouble might not have been initialized. What does that mean?
has comment: http://stackoverflow.com/comment/31755297
has comment: http://stackoverflow.com/comment/31755892
score: 0
has comment: http://stackoverflow.com/comment/31755313
has answer: http://stackoverflow.com/a/21107230
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31755575
has title: What does "Variable might not have been initialized" mean?
tagged with: java
has comment: http://stackoverflow.com/comment/31755647
has comment: http://stackoverflow.com/comment/31755585
has answer: http://stackoverflow.com/a/21107278
has answer: http://stackoverflow.com/a/21107222
has comment: http://stackoverflow.com/comment/31755539

http://stackoverflow.com/a/21109754
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31768352
has body: You have to "Use" your library "ODFDOM" and get your class in Java notation with dots. You can shorten your code with direct call of your static method: Use "ODFDOM" Dim js As javasession Dim jSpreadsheetDocumentClass As Javaclass Dim jdoc As JavaObject Set js = New JavaSession Set jSpreadsheetDocumentClass = js.Getclass("org.odftoolkit.simple.SpreadsheetDocument") Set jdoc = jSpreadsheetDocumentClass.newSpreadsheetDocument() UPDATE: LS2J doesn't work with resources. Whenever you use resources in Java code it won't work with LS2J. After a short look into ODF Toolkit source code I saw resources used. So, create an Java agent instead and call it from LotusScript.
type: AcceptedAnswer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21100358
answers question: http://stackoverflow.com/q/21100358
type: Answer
has comment: http://stackoverflow.com/comment/31769164

http://stackoverflow.com/comment/31879559
type: Comment
type: QuestionComment
has text: @ChthonicProject - That's what I want to do- use the position, but how can I do that ... the solutions I found fail due to the repetition of values... is there something like indexOf to return the position and not the value at that position?
score: 0
comment on: http://stackoverflow.com/q/21175220

http://stackoverflow.com/a/21157714
type: Answer
has body: After you downloaded the library from Github, you have to add it to the Eclipse workspace. Go to File -&gt; Import and Choose Android -&gt; Existing Android Code Into Workspace. Now you will see this dialog: To import the library properly you have to: Choose folder of the library Select the library Click finish Now the library is in your workspace. You have to add the library to your project. Right click on your project and choose Properties. Then go to Android settings. Here you can add the library to your project by clicking on Add.... If the library isn't listed in the dialog after you clicked on add, then you have to mark the library as library. Go to the Android project settings for the Library and check Is Library.
score: 0
answers question: http://stackoverflow.com/q/21147672
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21147672

http://stackoverflow.com/q/21173297
tagged with: do-while
possible better answer: http://stackoverflow.com/a/21173403
tagged with: java
score: 0
answer count: 2
tagged with: arrays
tagged with: while-loop
has title: (ADDED) Noughts and Crosses game. While loop
has answer: http://stackoverflow.com/a/21173403
has answer: http://stackoverflow.com/a/21173360
accepted answer: http://stackoverflow.com/a/21173360
type: AnsweredQuestion
has body: for(int i = 0; i &lt; 3; i++){ for(int j = 0; j &lt; 3; j++){ visBoard[i][j] = "[ ]"; board[i][j] = 0; check[i][j] = false; } }for(int i = 0; i &lt; 3; i++){ for(int j = 0; j &lt; 3; j++){ System.out.print(visBoard[i][j]); }System.out.print("\n"); } //Getting Names System.out.println("Player 1 - Enter your name"); play1 = sc.nextLine(); System.out.println("Player 2 - Enter your name"); play2 = sc.nextLine(); // moves = 0; symbol = " X "; do{ do{ //Get Coords System.out.println("X Coordinate"); xcoord = sc.nextInt() -1; System.out.println("Y Coordinate"); ycoord = sc.nextInt() -1; if(check[xcoord][ycoord] == true){ System.out.println("Not a valid move!"); } }while(check[xcoord][ycoord] == true); //Making move check[xcoord][ycoord] = true; visBoard[xcoord][ycoord] = symbol; if(symbol.equals(" X ")){ board[xcoord][ycoord] = 1; }else if(symbol.equals(" O ")){ board[xcoord][ycoord] = 5; }else{ System.out.println("You've messed up James"); } for(int i = 0; i &lt; 3; i++){ for(int j = 0; j &lt; 3; j++){ System.out.print(visBoard[i][j]); }System.out.print("\n"); } //Check if game has won //columns total = 0; for(int i = 0; i &lt; 3; i++){ for(int j = 0; j &lt; 3; j++){ total = total + board[j][i]; }if(total == 15 || total == 3){ gamewon = true; } }total = 0; //rows for(int i = 0; i &lt; 3; i++){ for(int j = 0; j &lt; 3; j++){ total = total + board[i][j]; }if(total == 15 || total == 3){ gamewon = true; } }total = 0; //diagonals for(int i = 0; i &lt; 3; i++){ total = total + board[i][i]; }if(total == 15 || total == 3){ gamewon = true; }total = 0; diag = 2; for(int i = 0; i &lt; 3; i++){ total = total + board[i][diag]; diag--; }if(total == 15 || total == 3){ gamewon = true; } moves++; if(gamewon == false){ if(moves == 9){ System.out.println("Game has been drawn! No one wins!"); }else{ mod = moves % 2; if(mod == 0){ symbol = " X "; }else{ symbol = " O "; } } } }while(gamewon == false || moves != 9); if(gamewon == true){ if(symbol.equals(" X ")){ System.out.println("Winner is "+…
type: Question

eclipse-virgo
tag name: eclipse-virgo
tags question: http://stackoverflow.com/q/21171668
type: Tag

http://stackoverflow.com/comment/31691211
comment on: http://stackoverflow.com/q/21051287
type: QuestionComment
type: Comment
has text: Do you need the _behavior_ of a 128-bit double, or just storage/representation? Note that converting to a different bit depth will likely result in a different value
score: 0

http://stackoverflow.com/q/21051901
favorite count: 0
has answer: http://stackoverflow.com/a/21052278
type: Question
tagged with: sockets
upvote count: 1
answer count: 1
downvote count: 1
tagged with: jmf
score: 0
tagged with: java
tagged with: stream
accepted answer: http://stackoverflow.com/a/21052278
tagged with: http://stackoverflow.com/tag/mp3
has title: How to stream an Mp3 file using Socket programming in Java JMF
has body: I am doing a project in Java I am trying to stream an Mp3 file to client from server Using Socket programming and Play it on client machine using JMF But I am help less in that Is this thing possible??
type: AnsweredQuestion

http://stackoverflow.com/q/21117215
tagged with: weblogic
type: UnansweredQuestion
has title: XmlSchemaException: Top-level attributes may not have a 'use'
tagged with: wsdl
type: Question
has body: I've generated a webservice from the wsdl using maven cxf-codegen-plugin. This was fine and I got no exceptions. Then I attempted to instantiate the webservice using this code(Service class is generated): JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setEndpointName(SERVICE_NAME); factory.setAddress("https://someadress:port/spec"); factory.setServiceClass(Service.class); this.port = (Service) factory.create(); On calling the create method, I receive the following exception when running on weblogic: weblogic.application.ModuleException: org.apache.ws.commons.schema.XmlSchemaException: Top-level attributes may not have a 'use' ... Caused By: org.apache.ws.commons.schema.XmlSchemaException: Top-level attributes may not have a 'use' at org.apache.ws.commons.schema.XmlSchemaAttribute.setUse(XmlSchemaAttribute.java:109) at org.apache.ws.commons.schema.SchemaBuilder.handleAttribute(SchemaBuilder.java:966) at org.apache.ws.commons.schema.SchemaBuilder.handleSchemaElementChild(SchemaBuilder.java:1519) at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:659) at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:157) at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:497) at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:483) at org.apache.cxf.common.xmlschema.SchemaCollection.read(SchemaCollection.java:133) at org.apache.cxf.databinding.AbstractDataBinding.addSchemaDocument(AbstractDataBinding.java:192) at org.apache.cxf.databinding.AbstractDataBinding.addSchemaDocument(AbstractDataBinding.java:95) at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:393) at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:490) at org.apache.cxf.jaxws.sup…
tagged with: cxf
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21117729
tagged with: web-services
answer count: 1

http://stackoverflow.com/comment/31897327
type: Comment
has text: Can you provide code or configuration of receiver to which you actually attach the MessageListener you have defined?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21041980

http://stackoverflow.com/comment/31626932
type: Comment
score: 0
type: AnswerComment
has text: Would you believe if I told you the world would implode if I tried to write this program without queues? :I
comment on: http://stackoverflow.com/a/21037336

http://stackoverflow.com/comment/31728835
score: 0
type: Comment
has text: That is the real problem.
comment on: http://stackoverflow.com/a/21093195
type: AnswerComment

http://stackoverflow.com/a/21149588
answers question: http://stackoverflow.com/q/21149524
has comment: http://stackoverflow.com/comment/31833225
downvote count: 0
has comment: http://stackoverflow.com/comment/31833130
type: Answer
has comment: http://stackoverflow.com/comment/31833253
has body: The installer does not work for a reason that is very clearly stated in the README in directory index: This directory (and version of CentOS) is depreciated. For normal users, you should use /6/ and not /6.4/ in your path. Please see this FAQ concerning the CentOS release scheme: http://www.centos.org/modules/smartfaq/faq.php?faqid=34 If you know what you are doing, and absolutely want to remain at the 6.4 level, go to http://vault.centos.org/ for packages. Please keep in mind that 6.0, 6.1, 6.2, 6.3 and 6.4 no longer gets any updates, nor any security fix's. So, replace /6.4/ with /6/ in the FTP URL or go to http://vault.centos.org (whichever applies to your case) and you are set. Besides, the last line might be interesting for you :) You should also consider getting the package from a repository, so that you will kept up-to-date with security fixes.
score: 1
upvote count: 1

http://stackoverflow.com/q/21157169
has answer: http://stackoverflow.com/a/21159987
type: Question
accepted answer: http://stackoverflow.com/a/21157198
has answer: http://stackoverflow.com/a/21157895
answer count: 6
has body: I have an android view which calls another view and should be closed. I use this code public void onClick(View v) { Intent intent = new Intent(A.this, B.class); startActivityForResult(intent,1); setResult(RESULT_OK); finish(); } and I see after Activity B is on and calls finish, Activity A appears and i understand it has never been closed. How can I resolve this?
has title: how can activity start a new activity and close itself?
tagged with: android
tagged with: android-activity
has answer: http://stackoverflow.com/a/21157198
has answer: http://stackoverflow.com/a/21157306
has comment: http://stackoverflow.com/comment/31846122
has answer: http://stackoverflow.com/a/21157246
tagged with: android-intent
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21157246
has answer: http://stackoverflow.com/a/21157275
score: 0
tagged with: java

http://stackoverflow.com/a/22739354
type: Answer
accepted answer of: http://stackoverflow.com/q/21154295
answers question: http://stackoverflow.com/q/21154295
downvote count: 1
score: -1
upvote count: 0
has body: It turns out the file was just written after a newline feed
type: AcceptedAnswer

http://stackoverflow.com/q/21118202
has body: Say someone is doing encryption, and it requires the use of numbers greater than the max value of long, so I need the ability to do something just as quickly (as in few steps) and efficiently as possible. take this example. I need to take (65^17) % LARGENUMBER, and so I decided to use the 65^17 part like below: 65^17=65(((65^2)^2)^2)^2. (please forgive my formatting, I dont know how to do it for this equation) Now, I have a question about what I chose. how, per say, would I implement that into a Java code line? would it just be a for loop such as: int fin = 65; int times = 17/2; int extra = 17 % 2; for(int i = 0; i &lt; times; i++){ ...code... } and then what would be in the code? would it just be: fin = (fin * 65) % LONGNUMBER; would that even work? or what would I change about this to make it work? This is all theory by the way. Thanks for the help, in advance :)
tagged with: math
has comment: http://stackoverflow.com/comment/31775277
tagged with: theory
score: 0
tagged with: for-loop
answer count: 1
has comment: http://stackoverflow.com/comment/31775133
has answer: http://stackoverflow.com/a/21118602
accepted answer: http://stackoverflow.com/a/21118602
linked to: http://stackoverflow.com/q/17616483
has comment: http://stackoverflow.com/comment/31775432
tagged with: java
tagged with: encryption
has comment: http://stackoverflow.com/comment/31775783
has title: How would I implement an efficient powers method in java
has comment: http://stackoverflow.com/comment/31775077
type: Question
has comment: http://stackoverflow.com/comment/31775594
type: AnsweredQuestion

http://stackoverflow.com/a/21171429
type: Answer
answers question: http://stackoverflow.com/q/21150452
has body: Did you see the solrj example here? http://wiki.apache.org/solr/ExtractingRequestHandler#SolrJ The code looks a little bit different. In addition, having a look at sections before I see a "stream.file" parameter instead of your "stream.url"
score: 0

http://stackoverflow.com/q/21110954
score: 0
has comment: http://stackoverflow.com/comment/31761804
tagged with: netbeans
answer count: 0
has comment: http://stackoverflow.com/comment/31762222
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31761640
tagged with: java
type: Question
has title: Http client program error
tagged with: apache
has comment: http://stackoverflow.com/comment/31763666
has body: I am using netbeans 7.4 on MAC. when compiling the following program I am getting some exception. My code : import java.io.*; import org.apache.commons.httpclient.*; import org.apache.commons.httpclient.methods.*; import org.apache.commons.httpclient.params.HttpMethodParams; public class HttpClientSample { private static String url = "http://www.apache.org/"; public static void main(String[] args) { // Constructor for HttpClient HttpClient client = new HttpClient(); //Creeating a method GetMethod method = new GetMethod(url); method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3,false)); try { //Execute the method int statusCode = client.executeMethod(method); // System.out.println("vikas is my name "); if(statusCode != HttpStatus.SC_OK) { System.err.println("Method failes : " + method.getStatusLine()); } //Read the response body byte[] responsebody = method.getResponseBody(); //Print the response System.out.println(new String(responsebody)); } catch (HttpException e) { System.out.println("fatal protocol violation: " + e.getMessage()); e.printStackTrace(); } catch (IOException e ) { System.out.println("fatal transport error : " + e.getMessage()); e.printStackTrace(); } finally { // release the connection method.releaseConnection(); } } } After running the program i am getting the following exception : Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.apache.commons.httpclient.HttpClient.&lt;clinit&gt;(HttpClient.java:66) at JavaApplication1.main(JavaApplication1.java:13) Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory 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$AppC…

http://stackoverflow.com/a/56452178
upvote count: 1
downvote count: 0
has body: if your port number can be random you can use random function in your application.properties server.port=${random.int(4)}
type: Answer
answers question: http://stackoverflow.com/q/21083170
has comment: http://stackoverflow.com/comment/100161693
score: 1

http://stackoverflow.com/comment/31707423
score: 0
comment on: http://stackoverflow.com/q/21079997
type: QuestionComment
type: Comment
has text: @DavidWallace Now I would just use 2 FOR loops to check for -1s and replace with Ps? Also I would gladly accept your answer if you posted it instead of a comment

http://stackoverflow.com/q/21027486
tagged with: drag-and-drop
has comment: http://stackoverflow.com/comment/31639577
answer count: 1
favorite count: 0
has title: Label properties modified with jQuery and Java code don't save it. in ZK
upvote count: 2
type: UnansweredQuestion
tagged with: zk
has body: I'm creating dynamics labels and set it top and left properties, and I modified the top and left properties dynamically with Drag and drop of jquery, but when I try retrieve these top and left properties from label I get the originals properties the label and I want the new properties to work in my java code. Sorry here is my code main.zul - Jquery Part &lt;script&gt; function dragEvent(label, section){ var txtNom = jq('$txtNom'); var txtX = jq('$txtX'); var txtY = jq('$txtY'); var txtW = jq('$txtWidth'); var txtH = jq('$txtHeight'); label.draggable({ start: function() { }, drag: function(e,u) { txtNom.val(label.text()); txtX.val(label.offset().left-section.offset().left); txtY.val(label.offset().top-section.offset().top); txtW.val(label.width()); txtH.val(label.height()); }, stop: function(e,u) { txtNom.val(label.text()); txtX.val(label.offset().left-section.offset().left); txtY.val(label.offset().top-section.offset().top); txtW.val(label.width()); txtH.val(label.height()); } }); } function bindEventLabel(lblId,trSeccion) { var label = jq('$'+lblId+''); var section = jq('$'+trSeccion+''); dragEvent(label,section); } Main.java @Listen("onClick = #btnGenRep") public void onGenerateReport() { String file = "C:\\Users\\hgarza\\Desktop\\Reportes\\reporte.jrxml"; File src = new File(file); JasperDesign desgin = null; try { desgin = (JasperDesign) JRXmlLoader.load(src); } catch (JRException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } Grid gridtemp = null; for(Component comp : dEBody.getChildren()) { if(comp instanceof Grid) { gridtemp = (Grid) comp; break; } } for(Component rowss : gridtemp.getChildren()) { if(rowss instanceof Rows) { Rows rowsTemp = (Rows)rowss; for(Component roww : rowsTemp.getChildren()) { if(roww instanceof Row){ Row rowTemp = (Row)roww; for(Component labell : rowTemp.getChildren()) { Label lbl = labell instanceof Label ? (Label) labell : null; System.out.println(lbl.getValue()); if(lbl.getId().equals("sTitulo")) { JRDesignStaticT…
score: 2
tagged with: dynamic
tagged with: java
type: Question
downvote count: 0
tagged with: jquery
has answer: http://stackoverflow.com/a/24442076

http://stackoverflow.com/comment/31851229
type: QuestionComment
type: Comment
has text: hey Erum Hannan you are getting this error while installing i think.. If so There is proble with code and package name.. and also set ur min sdk levelas 15 or 14.. it wil work.. because android s3 has ICS..
comment on: http://stackoverflow.com/q/21159636
score: 0

http://stackoverflow.com/q/21183422
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21183898
score: -2
tagged with: java
has title: translate python to java : struct.pack('h', int)
type: Question
upvote count: 0
answer count: 1
has body: I have some python code need to phase to java, python code : &gt;&gt;&gt; struct.pack('h', 19) b'\x13\x00' I want to know how it phase to java, thanks~
has answer: http://stackoverflow.com/a/21183898
tagged with: python
favorite count: 0
duplicate of: http://stackoverflow.com/q/3209898
downvote count: 2

http://stackoverflow.com/a/48129173
downvote count: 0
has body: Following code uses Elliptic Curve Diffie-Hellman to generate and share 128bit key and AES for encryption. import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; import javax.crypto.*; import javax.crypto.spec.SecretKeySpec; import java.io.IOException; import java.security.*; public class AESSecurityCap { private PublicKey publickey; KeyAgreement keyAgreement; byte[] sharedsecret; String ALGO = "AES"; AESSecurityCap() { makeKeyExchangeParams(); } private void makeKeyExchangeParams() { KeyPairGenerator kpg = null; try { kpg = KeyPairGenerator.getInstance("EC"); kpg.initialize(128); KeyPair kp = kpg.generateKeyPair(); publickey = kp.getPublic(); keyAgreement = KeyAgreement.getInstance("ECDH"); keyAgreement.init(kp.getPrivate()); } catch (NoSuchAlgorithmException | InvalidKeyException e) { e.printStackTrace(); } } public void setReceiverPublicKey(PublicKey publickey) { try { keyAgreement.doPhase(publickey, true); sharedsecret = keyAgreement.generateSecret(); } catch (InvalidKeyException e) { e.printStackTrace(); } } public String encrypt(String msg) { try { Key key = generateKey(); Cipher c = Cipher.getInstance(ALGO); c.init(Cipher.ENCRYPT_MODE, key); byte[] encVal = c.doFinal(msg.getBytes()); return new BASE64Encoder().encode(encVal); } catch (BadPaddingException | InvalidKeyException | NoSuchPaddingException | IllegalBlockSizeException | NoSuchAlgorithmException e) { e.printStackTrace(); } return msg; } public String decrypt(String encryptedData) { try { Key key = generateKey(); Cipher c = Cipher.getInstance(ALGO); c.init(Cipher.DECRYPT_MODE, key); byte[] decordedValue = new BASE64Decoder().decodeBuffer(encryptedData); byte[] decValue = c.doFinal(decordedValue); return new String(decValue); } catch (BadPaddingException | InvalidKeyException | NoSuchPaddingException | IllegalBlockSizeException | NoSuchAlgorithmException | IOException e) { e.printStackTrace(); } return encryptedData; } public PublicKey getPublickey() { return publickey; } protected Key generateK…
has comment: http://stackoverflow.com/comment/103747225
type: Answer
has comment: http://stackoverflow.com/comment/100774141
score: 9
upvote count: 9
answers question: http://stackoverflow.com/q/21081713

http://stackoverflow.com/q/21096946
type: Question
tagged with: android-layout
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/21097049
answer count: 3
upvote count: 1
downvote count: 1
has title: Android ListActivity suddenly broke, can't find android.R.id.list even though its there
tagged with: listactivity
has body: I realize that many of these questions floats around out there but I never found anyone with my exact problem. As far as I can see, I'm doing it right, and it worked yesterday. Today I was working on other parts of my application and wanted to test it. Now I get this obnoxious error that it can't find the list with the id android.R.id.list, but again, it seems to be there. Could any changes to other parts of the app have caused this, and in that case, how? Can anybody see the error, cause I sure can't. I'm sorta desperate here since it's a school project and it's due soon. Thanks everybody, beforehand, for your time! (in MainActivity.java) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } (activity_main.xml) &lt;ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;/ListView&gt; LOGCAT as requested: 01-13 19:00:48.852: W/dalvikvm(25254): threadid=1: thread exiting with uncaught exception (group=0x40e6da08) 01-13 19:00:48.857: E/AndroidRuntime(25254): FATAL EXCEPTION: main 01-13 19:00:48.857: E/AndroidRuntime(25254): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.ajhansen.meetme/org.ajhansen.meetme.MainActivity}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list' 01-13 19:00:48.857: E/AndroidRuntime(25254): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2463) 01-13 19:00:48.857: E/AndroidRuntime(25254): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2520) 01-13 19:00:48.857: E/AndroidRuntime(25254): at android.app.ActivityThread.access$600(ActivityThread.java:162) 01-13 19:00:48.857: E/AndroidRuntime(25254): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1366) 01-13 19:00:48.857: E/AndroidRuntime(25254): at andro…
favorite count: 0
tagged with: android-listview
tagged with: android
has answer: http://stackoverflow.com/a/21099554
has comment: http://stackoverflow.com/comment/31735979
has answer: http://stackoverflow.com/a/21097569
has comment: http://stackoverflow.com/comment/31737374
has comment: http://stackoverflow.com/comment/31736020
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31738307

http://stackoverflow.com/a/23668899
score: 4
accepted answer of: http://stackoverflow.com/q/21117636
answers question: http://stackoverflow.com/q/21117636
type: AcceptedAnswer
upvote count: 11
has comment: http://stackoverflow.com/comment/78394483
has body: According to me, the best way to implement a most-recently-used cache of objects would be to include a new variable as 'latestTS' for each object. TS stands for timestamp. // A static method that returns the current date and time as milliseconds since January 1st 1970 long latestTS = System.currentTimeMillis(); ConcurrentLinkedHashMap is not yet implemented in Concurrent Java Collections. (Ref: Java Concurrent Collection API). However, you can try and use ConcurrentHashMap and DoublyLinkedList About the case to be considered: in such case, as I have said that you can declare latestTS variable, based upon the value of latestTS variable, you can remove an entry and add the new object. (Don't forget to update frequency and latestTS of the new object added) As you have mentioned, you can use LinkedHashMap as it gives element access in O(1) and also, you get the order traversal. Please, find the below code for LFU Cache: (PS: The below code is the answer for the question in the title i.e. "How to implement LFU cache") import java.util.LinkedHashMap; import java.util.Map; public class LFUCache { class CacheEntry { private String data; private int frequency; // default constructor private CacheEntry() {} public String getData() { return data; } public void setData(String data) { this.data = data; } public int getFrequency() { return frequency; } public void setFrequency(int frequency) { this.frequency = frequency; } } private static int initialCapacity = 10; private static LinkedHashMap&lt;Integer, CacheEntry&gt; cacheMap = new LinkedHashMap&lt;Integer, CacheEntry&gt;(); /* LinkedHashMap is used because it has features of both HashMap and LinkedList. * Thus, we can get an entry in O(1) and also, we can iterate over it easily. * */ public LFUCache(int initialCapacity) { this.initialCapacity = initialCapacity; } public void addCacheEntry(int key, String data) { if(!isFull()) { CacheEntry temp = new CacheEntry(); temp.setData(data); temp.setFrequency(0); cacheMap.put(key, tem…
type: Answer
has comment: http://stackoverflow.com/comment/97360629
downvote count: 7
has comment: http://stackoverflow.com/comment/117329742

http://stackoverflow.com/a/21118561
downvote count: 0
has body: You need to link in the spotify library. This should be done when you're compiling libspot.so. This can be done with: -L/path/to/spotify/library This should be something/libspotify/lib, and is likely the directory where you built libspot.so. You may also need to specify: -I/path/to/spotify/includes
answers question: http://stackoverflow.com/q/21118383
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31776290
has comment: http://stackoverflow.com/comment/31783755
has comment: http://stackoverflow.com/comment/31776938

http://stackoverflow.com/q/21118771
tagged with: java
has body: I'm working on a project that has to do with poi. I store some pois in a SQL database , but before I store a poi I want to check that there is no poi with the coordinates that I have given in the database and also there is no poi with the same name and the same type around the area of 1km , of the poi that I'm about to add. I have searched the web but I haven't figure out something help full ! Here is a part of my method that try to check if there is another poi in a radius of 1km ! PS : GPS is the name of the table for(i=0.0;i&lt;=1.0;i=i+0.0001){ try{ query = "SELECT TYPE FROM GPS WHERE NAME='"+name+"' AND TYPE='"+type+"' AND X='"+(x+i)+"' AND Y='"+(y+i)+"'"; rs=state.executeQuery(query); if(!rs.next()){ flag=1; } else{ flag=0; break; } }catch(SQLException err){ err.printStackTrace(); } }
type: AnsweredQuestion
tagged with: sql
accepted answer: http://stackoverflow.com/a/21119390
tagged with: points
possible better answer: http://stackoverflow.com/a/21120862
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/21120862
favorite count: 0
has title: find points in a circle with sql
type: Question
tagged with: jdbc
has comment: http://stackoverflow.com/comment/31776653
has answer: http://stackoverflow.com/a/21118870
tagged with: geometry
has comment: http://stackoverflow.com/comment/31776420
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/21119390
has comment: http://stackoverflow.com/comment/31778088

http://stackoverflow.com/a/21065871
downvote count: 0
score: 1
has body: Why don't you use a constructor with null arguments? Is there a reason? Your class would then be... public class DatabaseManager { private Plugin plugin; public DatabaseManager() { this.plugin = new SimpleBeans(); } public DatabaseManager(SimpleBans pluginConstructor) { plugin = pluginConstructor; } public void writeData(String SQL) { // Pseudo code: Write plugin.getName(); into the database. } ... } Then the DatabaseManager could be instantiated using both ways. Hope I helped!
answers question: http://stackoverflow.com/q/21065526
upvote count: 1
type: Answer

http://stackoverflow.com/a/21091959
upvote count: 1
has body: Create new "Display Template" witch include the link to the Document: UPDATE: Define the records variable: <#assign DDLRecordLocalService = serviceLocator.findService("com.liferay.portlet.dynamicdatalists.service.DDLRecordLocalService")> <#assign records = DDLRecordLocalService.getRecords(reserved_record_set_id)> <#if records?has_content> <#list records as cur_record> ${languageUtil.format(locale, "download-x", "Documents and Media")} </#list> </#if> Also, due to bug https://support.liferay.com/browse/LPS-43149, update the portal-ext.properties: Liferay: How to configure Liferay Portal
downvote count: 0
has comment: http://stackoverflow.com/comment/31800979
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31812583
accepted answer of: http://stackoverflow.com/q/21089888
has comment: http://stackoverflow.com/comment/31727598
type: Answer
answers question: http://stackoverflow.com/q/21089888
has comment: http://stackoverflow.com/comment/31799840
has comment: http://stackoverflow.com/comment/31800948
score: 1

http://stackoverflow.com/q/21057262
type: Question
has body: I am relatively new to coding in general and have run into an issue, I've looked everywhere for help but I cant find this issue. It would be greatly appreciated if someone could tell me why the string "s" doesn't ever equal the string "temp" even if I type the correct number in. String s = null; do{ s = (String) JOptionPane.showInputDialog(null, "Select a card to check for (Jacks = 11, Queens = 12, Kings = 13)", "Player's Turn", JOptionPane.PLAIN_MESSAGE, null, null, "Pick a card"); System.out.println(s); for(int x = 0; x &lt; PlayerCards.size(); x++){ String temp = PlayerCards.get(x).getFace(); if(s == temp){ playerhas = true; } } if(s == null || playerhas != true){ JOptionPane.showMessageDialog(null, "Please pick a card you have.", "Error", JOptionPane.INFORMATION_MESSAGE); } }while(s == null || playerhas != true);
tagged with: null
has answer: http://stackoverflow.com/a/21057570
tagged with: arrays
score: 0
linked to: http://stackoverflow.com/q/513832
tagged with: string
has answer: http://stackoverflow.com/a/21057719
duplicate of: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/21057385
has answer: http://stackoverflow.com/a/21057615
type: UnansweredQuestion
has title: Cant get JOptionPane string input to match a string value
answer count: 4
tagged with: joptionpane
tagged with: java

http://stackoverflow.com/comment/31685202
has text: you can specify the split delimiter with `String string = "004-034556"; String[] parts = string.split("-");`
score: 0
comment on: http://stackoverflow.com/q/21069113
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21019474
tagged with: jboss-weld
has body: Let's say I have an interface called SocialNetworkService, and multiple implementations - TwitterService, FacebookService and FriendFeedService, MyService etc. Now I want, whenever my managed bean receives a message, to select one/or more implementations depending on certain rules contained within the message and transmit the message accordingdly. I am not quite sure which would be the best pattern to use? a) Use Interface Instance i.e @Inject @Any Instance&lt;SocialNetworkService&gt; socialNetworkService; SocialNetworkService service = socialNetworkService.get(); How would I pass the message to the SocialNetworkServiceFactory ? b) Use Events observe the event in all services (regardless of their interface, which is not exactly what i would like. I.e if i dont support dont transmit... c). i could have annotaded injection i.e @Twitter, @Facebook all in a controller bean and then select the appropriate but my service implementations number will grow.... Thanks in advance, Dimitri
score: 0
answer count: 3
tagged with: cdi
type: UnansweredQuestion
has title: Inject list of service objects in CDI (Weld)
has answer: http://stackoverflow.com/a/21042669
tagged with: java
has answer: http://stackoverflow.com/a/21070550
has answer: http://stackoverflow.com/a/21189768
type: Question

http://stackoverflow.com/comment/31796375
type: Comment
has text: I have no code to go by, so I did a simple example based on your comments
comment on: http://stackoverflow.com/a/21129165
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31770164
score: 0
type: AnswerComment
type: Comment
has text: I should throw and check my last result after the for loop.. Correct? Bcoz that's where I can see my last result..
comment on: http://stackoverflow.com/a/21106434

http://stackoverflow.com/a/21034394
answers question: http://stackoverflow.com/q/21034374
upvote count: 2
type: Answer
score: 2
downvote count: 0
has body: You have set the local variable newBalance, but that value is lost on the next iteration. Set balance to newBalance in the loop so that balance will change and reflect the correct balance.

http://stackoverflow.com/a/21103889
accepted answer of: http://stackoverflow.com/q/21100900
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21100900
has body: You have implemented a classic anti-pattern in OSGi: you assume that the EventAdmin service will already be available when your bundle starts. This is an inherently unsafe assumption because your bundle might in fact be started before the bundle that provides the EventAdmin service. There is a wrong way and a right way to fix this. The wrong way is to insist that your bundle must be started after EventAdmin. That way leads to start-order dependencies and extreme fragility. See: http://wiki.osgi.org/wiki/Avoid_Start_Order_Dependencies The right way is to use a framework such as Declarative Services (DS) to declare a component inside your bundle that references the EventAdmin service. Then DS will activate your component and inject it with the EventAdmin instance as soon as it becomes available. See: http://wiki.osgi.org/wiki/Declarative_Services
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/31817956
has text: When sending via `println` the last character sent is a `'\n'`.
score: 0
comment on: http://stackoverflow.com/q/21141432
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31623206
score: 0
comment on: http://stackoverflow.com/a/21035040
type: AnswerComment
has text: I may be clutching at straws here but is there a possibility of running a separate thread that notifies the thread that actual function in every second, therefore if the time changes it still has a consistant tick from the other thread?
type: Comment

http://stackoverflow.com/q/21085877
upvote count: 2
has answer: http://stackoverflow.com/a/21085999
tagged with: ide
has body: I have been working on maven for some time but never had this question before, Many times I created my maven project using a IDE wizard which helps me to create a maven project which has pom.xml pre-configured or the other way is to convert a general java project into maven project which generates a pom.xml. I have a question what exactly happens in the background when we convert this java project into a maven project. What will be configured and how does the java project detects it has a pom.xml.
answer count: 1
tagged with: pom.xml
favorite count: 0
has title: How and where does a pom.xml will be configured to be invoked by a web project
tagged with: maven
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/21085999
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/31793789
comment on: http://stackoverflow.com/q/21127171
score: 0
type: Comment
type: QuestionComment
has text: @JavaCoderEx Is serialization the best option for what I'm trying to do? I'm still a beginning programmer, so I don't want to get to complex with this project.

http://stackoverflow.com/a/21158966
answers question: http://stackoverflow.com/q/21158432
upvote count: 2
has body: Problem with your Model that you created for the Json Response. { "results": [ { "user_id": "1", "item_id": "18630", "name": "Unnamed Item", "price": "0", "description": "", "created_at": "2014-01-16 15:31:36", "thumbnail": { "image50": "http://www.example.com/adsa.jpg", "image100": "hhttp://www.example.com/adsa.jpg" },... Try like this for the above Json Response public class ItemListModel { public ArrayList&lt;Result&gt; results; @Override public String toString() { return "Response [results=" + results + "]"; } public ArrayList&lt;Result&gt; getResults() { return results; } } Then public class Result { private String user_id; private String item_id; private String name; private String price; private String description; private String created_at; private ThumbnailModel thumbnail; public String getUser_id() { return user_id; } public String getItem_id() { return item_id; } public String getName() { return name; } public String getPrice() { return price; } public String getDescription() { return description; } public String getCreated_at() { return created_at; } public ThumbnailModel getThumbnail() { return thumbnail; } @Override public String toString() { return "Result [user_id=" + user_id + ", item_id=" + item_id + ", name=" + name + ", price=" + price + ", description=" + description + ", created_at=" + created_at + ", thumbnail=" + thumbnail + "]"; } } And lastly public class ThumbnailModel { private String image50; private String image100; public String getImage50() { return image50; } public String getImage100() { return image100; } @Override public String toString() { return "ThumbnailModel [image50=" + image50 + ", image100=" + image100 + "]"; } } This is the proper model for the above Json. Edit:- private Response.Listener&lt;ItemListModel&gt; createMyReqSuccessListener() { return new Response.Listener&lt;ItemListModel&gt;() { @Override public void onResponse(ItemListModel response) { try { Log.d("Name&gt; ", response.getResults().get(0).getName());//Edite…
has comment: http://stackoverflow.com/comment/31852933
has comment: http://stackoverflow.com/comment/31852350
score: 2
has comment: http://stackoverflow.com/comment/31852157
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31852701
accepted answer of: http://stackoverflow.com/q/21158432
type: Answer

http://stackoverflow.com/q/21167489
has answer: http://stackoverflow.com/a/21168515
type: AnsweredQuestion
tagged with: ant
tagged with: java
tagged with: hibernate
has body: I am writing some hibernate utilities using Core java and as part of that , was able to use it in my local dev environment. When I build the jar, I can see the configuration file - hibernate.cfg.xml as follows However when I run the main class, I keep getting the following error Initial SessionFactory creation failed.org.hibernate.HibernateException: /hibernate.cfg.xml not found. Any idea how to resolve it? I tried different answer but none is matching what I need. I am using Ant for build. Regards,
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21314211
score: 0
has title: Getting the following error - Initial SessionFactory creation failed.org.hibernate.HibernateException: /hibernate.cfg.xml not found
accepted answer: http://stackoverflow.com/a/21314211
possible better answer: http://stackoverflow.com/a/21168515

http://stackoverflow.com/a/21116587
has body: Oke you can add a zul page to an other zul page by doing this : &lt;?component name="details" macro-uri="../folder/myzul.zul" inline="true"?&gt; &lt;window&gt; ... &lt;details/&gt; ... &lt;/window&gt; the code to handle that part is in your MVVM of the main zul page. So if you do in the details an @bind(vm.list) you will need to have an getList and setList in your viewmodel. Mine trick is that I write interfaces for those specific pages (you can implement multiple interfaces so multiple components are possible that way). By that I know I will not forget any getter or setter that I need and they will remember me also on what variables I need to declare. The visibility you can do with : &lt;tab label="tab2" visible=@load(vm.tab2Visible)/&gt; Hope this can help you.
type: Answer
has comment: http://stackoverflow.com/comment/31801582
has comment: http://stackoverflow.com/comment/31800680
answers question: http://stackoverflow.com/q/21043250
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21043250
score: 0

http://stackoverflow.com/comment/31636701
score: 0
type: QuestionComment
type: Comment
has text: Tutorial might help : http://www.mkyong.com/tutorials/java-json-tutorials/
comment on: http://stackoverflow.com/q/21043382

http://stackoverflow.com/comment/31851386
type: AnswerComment
has text: Ah okay, basically the title screen reads "Press enter to continue". I was going to use the TAdapter to implement this but I was trying to get the screen to work first. I tried a couple of other ways to get it to stop before the level executed (infinite loop, wait etc) but they didn't make a difference, or just caused other problems.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21150966

http://stackoverflow.com/a/21119870
score: 0
answers question: http://stackoverflow.com/q/21117636
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40824467
has comment: http://stackoverflow.com/comment/31788218
has body: How about a priority queue? You can keep elements sorted there with keys representing the frequency. Just update the object position in the queue after visiting it. You can update just from time to time for optimizing the performance (but reducing precision).
type: Answer
has comment: http://stackoverflow.com/comment/31789213

http://stackoverflow.com/q/21174357
has answer: http://stackoverflow.com/a/23817270
type: Question
has title: Java get unread emails
answer count: 3
upvote count: 7
has answer: http://stackoverflow.com/a/21174412
tagged with: email
favorite count: 0
tagged with: pop3
has body: I'm writing a code to read email from gmail. So the first time I launch, it reads new emails. That's fine. But I want when I launch it a second time, it doesn't get same emails it got before. For example if there are 3 unread emails, when I launch for the first time, it gets the 3. But When I launch again, it gets nothing (because it already got 3). And if there is a new email and I launch it again, it should get only the last one and not the 3 firsts. Hope I'm clear enough. I use the code from http://alvinalexander.com/java/javamail-search-unseen-unread-messages-mailbox-pop3 package javamailtests; import java.io.InputStream; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.Properties; import javax.mail.*; import javax.mail.internet.*; import javax.mail.search.*; public class JavaMailSearchInbox { public static void main(String args[]) throws Exception { // mail server info String host = "pop.gmail.com"; String user = "USER"; String password = "PASS"; // connect to my pop3 inbox in read-only mode Properties properties = System.getProperties(); Session session = Session.getDefaultInstance(properties); Store store = session.getStore("pop3"); store.connect(host, user, password); Folder inbox = store.getFolder("inbox"); inbox.open(Folder.READ_ONLY); // search for all "unseen" messages Flags seen = new Flags(Flags.Flag.SEEN); FlagTerm unseenFlagTerm = new FlagTerm(seen, false); Message messages[] = inbox.search(unseenFlagTerm); if (messages.length == 0) System.out.println("No messages found."); for (int i = 0; i &lt; messages.length; i++) { // stop after listing ten messages if (i &gt; 10) { System.exit(0); inbox.close(true); store.close(); } System.out.println("Message " + (i + 1)); System.out.println("From : " + messages[i].getFrom()[0]); System.out.println("Subject : " + messages[i].getSubject()); System.out.println("Sent Date : " + messages[i].getSentDate()); System.out.println(); } inbox.close(true); store.close(); } }
has answer: http://stackoverflow.com/a/22147224
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31877653
has comment: http://stackoverflow.com/comment/31878059
downvote count: 0
score: 7
tagged with: java

http://stackoverflow.com/a/27089813
type: Answer
answers question: http://stackoverflow.com/q/21120211
score: 2
has body: When I got this error it was because I registered the job with myJobClass.getClass() but I had guice wrap an interceptor around the class so the class name missmatched (i.e the runtime class was ...$$EnhancerByGuice$$13db15). Something similar may happen with Spring.
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/21051913
has comment: http://stackoverflow.com/comment/31652865
upvote count: 1
has comment: http://stackoverflow.com/comment/31652937
type: Question
tagged with: java-native-interface
downvote count: 0
has comment: http://stackoverflow.com/comment/31653497
has comment: http://stackoverflow.com/comment/31654731
has body: I'm working on an application that uses C++. I'm trying to access the content of this expression: ((std::string*) pPin-&gt;GetUserData())-&gt;c_str(); The problem is that I'm trying to pass this value to Java, through JNI, but in Java, this gets a new value, that has nothing to do with its original value, that I normally can see by using this: EXAMPLE_LOG("User Data='%s'", ((std::string*) pPin-&gt;GetUserData())-&gt;c_str()); I'd like to know how can I get this same value of log and send it to Java. Thanks for your help.
answer count: 1
has title: How to access c.str() content?
favorite count: 0
has answer: http://stackoverflow.com/a/21054027
has comment: http://stackoverflow.com/comment/31652800
tagged with: c++
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21054027
score: 1
tagged with: java

http://stackoverflow.com/comment/31640350
comment on: http://stackoverflow.com/a/21044917
type: AnswerComment
has text: @AmitG: I have improved my answer, hopefully it will shed some more light on the matter.
type: Comment
score: 1

http://stackoverflow.com/q/21052026
type: AnsweredQuestion
has title: threaded communication with email on a spring project
has answer: http://stackoverflow.com/a/21052293
tagged with: java
type: Question
has body: All, I am working on a new java/spring project. I would like to write a communication module which enables communication on a specific entity of a project. For example, A customer fills an expense report, any communication related to that expense should append to the end of the expense report screen and an email should be sent to the responsible party. This is straightforward and doable. The second part is when someone reply's to that email it should append to the trouble ticket. I would need help with this. I would appreciate if you could suggest ways to implement this. Thanks in advance!. -Aanu
accepted answer: http://stackoverflow.com/a/21052293
score: 0
tagged with: email
answer count: 1
tagged with: spring-mvc

http://stackoverflow.com/a/21142406
has comment: http://stackoverflow.com/comment/31818855
upvote count: 2
answers question: http://stackoverflow.com/q/21142031
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31820683
type: Answer
has body: a slightly more extensible version of Miquel's (and also what Teresa suggested): double[] distro=new double[]{.4,.1,.3,.2}; int N; System.out.println(); System.out.print("Enter an integer number: "); Scanner input = new Scanner(System.in); N = input.nextInt(); int[] a = new int[N]; Random generator = new Random(); outer: for(int i = 0; i &lt; a.length; i++) { double rand=generator.nextDouble(); double val=0; for(int j=1;j&lt;distro.length;j++){ val+=distro[j-1]; if(rand&lt;val){ a[i]=j; continue outer; } } a[i]=distro.length; }

http://stackoverflow.com/a/21024034
upvote count: 18
has comment: http://stackoverflow.com/comment/54380354
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/71668600
has comment: http://stackoverflow.com/comment/54377375
has comment: http://stackoverflow.com/comment/54382116
has comment: http://stackoverflow.com/comment/93901775
type: Answer
answers question: http://stackoverflow.com/q/21023671
has comment: http://stackoverflow.com/comment/93919073
accepted answer of: http://stackoverflow.com/q/21023671
score: 18
has body: When you close the parent the child is also closed so you can just close the session to close it's producers and consumer, or you can close the connection to close everything it created.

http://stackoverflow.com/q/21088089
tagged with: java
tagged with: timeout
has body: Related to this question: How to set the timeout for socket when looking for host?, I found it important to know the default timeout for a host lookup If the timeout is short, e.g. several minutes, I think it's safe to do nothing with it. If it's long, e.g several hours, I have to set timeout for it. What's the default timeout for socket when looking up host?
linked to: http://stackoverflow.com/q/21084830
has title: What's the default timeout for a host lookup?
downvote count: 1
has answer: http://stackoverflow.com/a/21088253
type: Question
answer count: 2
favorite count: 0
type: UnansweredQuestion
tagged with: sockets
tagged with: dns
score: 2
upvote count: 3
has answer: http://stackoverflow.com/a/21088204

http://stackoverflow.com/comment/31768827
type: Comment
comment on: http://stackoverflow.com/a/21114828
has text: my answer is regarding to the fact that you didn't properly invoke the method... you can try to import them both and then invoke the method...
type: AnswerComment
score: 0

textarea
tags question: http://stackoverflow.com/q/21066336
tag name: textarea
tags question: http://stackoverflow.com/q/21051354
type: Tag

http://stackoverflow.com/comment/31828759
has text: Im trying to be as generic as possible, so I can't just cast it. in the actual code, its much more separated than the example.
comment on: http://stackoverflow.com/q/21147380
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/21024820
has body: The following always prints the first returned IPv4 address and not the first IPv6 address although I explicitly used Inet6Adress and not InetAddress. Is this a bug in the OpenJDK 1.7.0 I use? InetAddress ipv6 = Inet6Address.getByName("www.google.com"); How am I supposed to get one IPv6 adresse for a given host name (or NULL if none exists)? I do not want to change the resolver preference between IPv4 and IPv6, in this case I really want to see if at least one IPv6 address exists. It's probably doable by iterating all results of InetAddress.getAllByName() and check for any "instanceof Inet6Address" but that does not look like the supposed way to do it.
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: ipv6
has title: Inet6Address.getByName() does return (existing) IPv6 but only IPv4 address?
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/11974232
favorite count: 0
has answer: http://stackoverflow.com/a/21025113
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32563605

http://stackoverflow.com/q/21128802
has comment: http://stackoverflow.com/comment/31794867
tagged with: garbage-collection
type: AnsweredQuestion
tagged with: linked-list
tagged with: java
has comment: http://stackoverflow.com/comment/31794889
has title: Garbage collection -- two cases about linkedlist
has comment: http://stackoverflow.com/comment/31794880
type: Question
has body: Case 1: If there is a LinkedList like this: A --&gt; B --&gt; C --&gt; D if I make A.next = null, so the graph would be A --&gt; null and B --&gt; C --&gt; D Will node B,C,D be garbage collected? Case 2: If there is a LinkedList like this: A --&gt; B --&gt; C --&gt; D if I make A.next = A.next.next, so the graph would be A --&gt; C --&gt; D but also B still points to C like this: B --&gt; C Will node B be garbage collected?
has answer: http://stackoverflow.com/a/21129085
score: 0
accepted answer: http://stackoverflow.com/a/21129085
answer count: 1
has comment: http://stackoverflow.com/comment/31794979

http://stackoverflow.com/comment/31646988
type: Comment
score: 0
has text: Your question is poorly worded. Instead of providing placeholders, provide sample strings, so there isn't so much ambiguity about what you're asking. Right now, it looks like you're trying to match the literal string "anyDoubleValue" multiple times, but your narrative suggests you're actually trying to match a `double` value.
type: QuestionComment
comment on: http://stackoverflow.com/q/21048843

http://stackoverflow.com/q/21144119
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31825562
upvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/10061548
has body: I want a lexical analyzer for java code. Should I write my own or should i use a pre-existing tool? Is it possible to make my lexical analyzer behave the same as the Java lexical analyzer, without writing my own Regular Expressions? For example if i have a class like this: Class Cat { public void fun(){ int a; a=3; int b=0; if((a/b==3)||(a/b==0)) { System.out.println("Test"); } } } I want its output to look like this class keyword Cat (id/className) int a(declaration) a=3 (assignment) int b=0 (declaration and assignment) if (key word) ((a/b==3)||(a/b==0)) (if condition) Please let me know if you have any ideas..
type: Question
has answer: http://stackoverflow.com/a/21145224
tagged with: lexical
has title: java lexical analyzer (for mining java code which is able to analyze it semantically)
score: -1
tagged with: analyzer
downvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/31651005
type: AnswerComment
comment on: http://stackoverflow.com/a/21050833
type: Comment
has text: On my pc, -O3 -funroll-loops results in ~18.6 secs, so it does not win to me... And still, I can't understand how it goes so fast while doing profiling...
score: 0

http://stackoverflow.com/comment/31802800
has text: @kramer65 post a new question with complete code. especially adapter code
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21133049
score: 0

http://stackoverflow.com/comment/81901059
comment on: http://stackoverflow.com/a/21163795
score: 0
type: AnswerComment
type: Comment
has text: This is not adding something to the content stream, but annotations are not part of the content stream...

http://stackoverflow.com/comment/31783550
type: QuestionComment
has text: Nevermind the logcat now but in the future you should post it. That will usually help us to help you easier. See my answer.
comment on: http://stackoverflow.com/q/21122606
score: 0
type: Comment

http://stackoverflow.com/comment/31737263
comment on: http://stackoverflow.com/q/21096079
has text: At a wild guess, generated code from netbeans, if you go to the constructor of the class there should be a line reading `initComponents();`. Put your two lines in that method and it wrap the URL of the `.png` file with a `new java.net.URL()`, as otherwise it won't be able to find the file (assuming it downloads over the internet as you seem to expect). You need to read some java tutorials, and understand at least the layout of the java code you're using
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21091611
has comment: http://stackoverflow.com/comment/31726068
tagged with: java
has answer: http://stackoverflow.com/a/21091812
has comment: http://stackoverflow.com/comment/31726116
has answer: http://stackoverflow.com/a/21092517
type: Question
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/31725826
tagged with: listview
downvote count: 4
has comment: http://stackoverflow.com/comment/31725866
favorite count: 0
has comment: http://stackoverflow.com/comment/31725703
tagged with: sms
type: UnansweredQuestion
score: -4
tagged with: android
linked to: http://stackoverflow.com/q/10087972
has title: How to Read SMS Conversation in Android
has body: I want to read the conversation and put it in ListView. How can I do it? I have two TextViews for each row. I want to set them by using BaseAdapter. By using this, content://mms-sms/conversations/ *Update:* I tried doing this: public ArrayList&lt;String&gt; number = new ArrayList&lt;String&gt;(); public ArrayList&lt;String&gt; body = new ArrayList&lt;String&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ListView listView = (ListView) findViewById(R.id.listView1); listView.setAdapter(new BaseAdapter(){ public int getCount() { return number.size(); } public Object getItem(int position) { return number.get(position); } public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.contact_row, null); TextView textView = (TextView) view.findViewById(R.id.textView1); textView.setText(number.get(position)); return view; }}); } @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; } public void getcon() { Uri uriSMSURI = Uri.parse("content://mms-sms/conversations/"); Cursor cursor = getContentResolver().query(uriSMSURI, null, null, null, "date desc"); cursor.moveToFirst(); while (cursor.moveToNext()) { String address = cursor.getString(cursor.getColumnIndex("address")); //String body = cursor.getString(cursor.getColumnIndexOrThrow("body")); //String read = cursor.getString(cursor.getColumnIndexOrThrow("read")); String contactName = address; Uri Nameuri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(address)); Cursor cs= getContentResolver().query(Nameuri, new String[]{PhoneLookup.DISPLAY_NAME},PhoneLookup.NUMBER+"='"+address+"'",null,null); if(cs…
has comment: http://stackoverflow.com/comment/31725783

identifier
tag name: identifier
type: Tag
tags question: http://stackoverflow.com/q/21096079

http://stackoverflow.com/a/21139730
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21135557
downvote count: 0
type: Answer
has body: Check the value of the wait_timeout variable on your mysql servers. The value of the variable could be too low on your production server. To show the value type this command : SHOW VARIABLES LIKE 'wait_timeout' Set the same value in your local server as the production to see if you can reproduce the problem. If the problem can be reproduced, you may have to increase the value of the wait_timeout on your production server. http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_wait_timeout

http://stackoverflow.com/a/42006080
type: Answer
answers question: http://stackoverflow.com/q/21148631
downvote count: 1
upvote count: 0
score: -1
has body: You have to use Sprite or AtlasSprite to get the rotation properties. TextureRegion or AtlasRegion doesn't consider rotation. If you are converting it into a Drawable, use SpriteDrawable.

http://stackoverflow.com/comment/31879371
type: QuestionComment
has text: Good point. But everything is using Java method calls from the accumulo library, because I haven't written anything where I need to call reads or look in buffers.
comment on: http://stackoverflow.com/q/21173203
score: 0
type: Comment

http://stackoverflow.com/q/21088225
has body: package com.hcl.test.ws; import javax.ws.rs.GET; import javax.ws.rs.Path; @Path("/hello") public class HelloWorld { @GET public String hello() { return "Hello This is RestFull Web Service/"; } } This is my code and working Perfectly but i want deploy its war file in server. currently i am invoking like this in eclipsed[http://localhost:8080/SecondrestFullClient/sampleHelloWorldProxy/TestClient.jsp] but i want to deploy it in server lcaolhost:8089 server so that every one can use from this please help ..
tagged with: java
type: Question
score: 0
has title: how to make Url in web service so that i can directly Invoke hello world
answer count: 1
has answer: http://stackoverflow.com/a/21088335
accepted answer: http://stackoverflow.com/a/21088335
tagged with: rest
tagged with: web-services
type: AnsweredQuestion

http://stackoverflow.com/comment/31623920
comment on: http://stackoverflow.com/a/21028748
score: 0
type: AnswerComment
has text: @MahmoudS I see, but with `setCivil(true)` I get `9/1/32 6:28:16 AM` which is what I get 9/1/32 [here](http://www.staff.science.uu.nl/~gent0113/islam/ummalqura_converter.htm) and [here](http://www.staff.science.uu.nl/~gent0113/islam/ummalqura_converter.htm). Don't know about the validity of these references though!
type: Comment

http://stackoverflow.com/q/21129287
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21129436
type: Question
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21129436
tagged with: arrays
has title: Reuse static string array in Java / Inheritance like concept inside string array
has body: private static String[][] s1 = { { "a", "a1" }, { "b", "b1" }, { "c", "c1" }, { "d", "d1" }, } private static String[][] s2 = { { "c", "c1" }, { "d", "d1" }, { "e", "e1" }, { "f", "f1" }, } Here c,c1 and d,d1 is repeated in those string arrays. How to take that outside and put it in a common string array say s3, and s1 and s2 reuses/inherits it so that it need not be declared in two different places?
tagged with: inheritance
tagged with: multidimensional-array
accepted answer: http://stackoverflow.com/a/21129337
has comment: http://stackoverflow.com/comment/31795719
has comment: http://stackoverflow.com/comment/31795761
has answer: http://stackoverflow.com/a/21129337

http://stackoverflow.com/q/21072148
has body: I try to develop a minimalistic BluetoothChat for Android with Phonegap. The Plugin is based on the Android SDK Example of the BluetoothChat as you can see in the example code. The native BluetoothChat works fine. The Problem is, when i call my "write"-Function, the "ConnectedThread" is always null, although the connection is established. I can't recognize where it is set to null again, after the State was set to 3 (STATE_CONNECTED). So when i run the program native on android, it works fine and the state during write is always 3, but when i use my phonegap plugin 'r'(ConnectedThread) becomes null : public void write(byte[] out) { // Create temporary object ConnectedThread r; // Synchronize a copy of the ConnectedThread synchronized (this) { Log.i(TAG, "State "+mState); if (mState != STATE_CONNECTED) return; Log.i(TAG, "Connected Thread "+mConnectedThread); r = mConnectedThread; } // Perform the write unsynchronized r.write(out); } I used a lot of debug messages, but i was never informed that the state is null again. Full source code : PLUGIN.java public class BluetoothConnection extends CordovaPlugin { //Android specific tag-messages private static final String TAG ="BluetoothConnection"; private static final boolean D = true; // Member-Variables public BluetoothAdapter mBluetoothAdapter; public JSONArray mListOfDiscoveredDevices; public String mConnectedDeviceName; public ConnectionHandler mConnectionHandler; // Phonegap-specific actions, which call the function public String ACTION_ENABLEBLUETOOTH = "enableBluetooth"; public String ACTION_DISABLEBLUETOOTH = "disableBluetooth"; public String ACTION_DISCOVERDECIVES = "discoverDevices"; public String ACTION_STOPDISCOVERDEVICES = "stopDiscoverDevices"; public String ACTION_CREATEBOND = "createBond"; public String ACTION_WRITEMESSAGE = "writeMessage"; // not usable, this moment public String ACTION_DISCONNECT = "disconnect"; //Message types sent from the ConnectionHandler public static final int MESSAGE_STATE_CHANGE =…
tagged with: bluetooth
score: 0
has comment: http://stackoverflow.com/comment/32109817
answer count: 1
has comment: http://stackoverflow.com/comment/32115079
has comment: http://stackoverflow.com/comment/32017206
has title: Phonegap : BluetoothChatExample [Android]
tagged with: android
type: AnsweredQuestion
tagged with: cordova
tagged with: java
has comment: http://stackoverflow.com/comment/32062175
has answer: http://stackoverflow.com/a/21278284
accepted answer: http://stackoverflow.com/a/21278284
type: Question
has comment: http://stackoverflow.com/comment/32107746
has comment: http://stackoverflow.com/comment/32106854

http://stackoverflow.com/q/21039959
has comment: http://stackoverflow.com/comment/31631058
has comment: http://stackoverflow.com/comment/31631162
has comment: http://stackoverflow.com/comment/31631932
linked to: http://stackoverflow.com/q/8111310
has comment: http://stackoverflow.com/comment/31632045
linked to: http://stackoverflow.com/q/52353
has answer: http://stackoverflow.com/a/21041052
answer count: 5
accepted answer: http://stackoverflow.com/a/21040859
downvote count: 1
has comment: http://stackoverflow.com/comment/31631739
upvote count: 13
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31632346
has answer: http://stackoverflow.com/a/21040665
has comment: http://stackoverflow.com/comment/31632150
has answer: http://stackoverflow.com/a/21040598
tagged with: java
tagged with: memory
score: 12
type: Question
has comment: http://stackoverflow.com/comment/31631753
has title: Java size of an Exception in memory
has answer: http://stackoverflow.com/a/21040859
has comment: http://stackoverflow.com/comment/31632283
favorite count: 0
has comment: http://stackoverflow.com/comment/31632594
has comment: http://stackoverflow.com/comment/31631832
possible better answer: http://stackoverflow.com/a/63752882
has comment: http://stackoverflow.com/comment/31630983
tagged with: nullpointerexception
tagged with: exception
has answer: http://stackoverflow.com/a/63752882
has body: Does anyone know how much memory an Exception occupies once it is created and thrown? For example, NullPointerException. And how exceptions are being garbage collected?
has comment: http://stackoverflow.com/comment/31634709

http://stackoverflow.com/q/21110506
has comment: http://stackoverflow.com/comment/31764160
has body: For example I have this query part as predefined temp. String temp = "select st from xxxx st where " Later there is if else operator. if (c&gt;v)temp += "yyy is null"; else temp += "yyy = 2"; Query query = em.createNativeQuery(temp); Stack trace exception: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query Maybe I am doing it wrong?
has comment: http://stackoverflow.com/comment/31761671
tagged with: jpa
has answer: http://stackoverflow.com/a/21110562
has answer: http://stackoverflow.com/a/21110661
score: 0
answer count: 3
tagged with: sql
has comment: http://stackoverflow.com/comment/31760901
has comment: http://stackoverflow.com/comment/31761863
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21110750
has title: JPA/HQL native query from string
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/31781250
has comment: http://stackoverflow.com/comment/31760853
tagged with: hql
type: Question

http://stackoverflow.com/comment/31770695
score: 0
type: AnswerComment
type: Comment
has text: @kaub0st3r I don't understand. Your code doesn't throw any exceptions? Then it must work properly and `return ListaSeguradoras;`
comment on: http://stackoverflow.com/a/21099210

http://stackoverflow.com/comment/31594886
score: 0
comment on: http://stackoverflow.com/q/21019656
type: Comment
type: QuestionComment
has text: Sleeping to achieve some fps seems like a very bad idea.

http://stackoverflow.com/q/21055090
has comment: http://stackoverflow.com/comment/31659004
score: 0
accepted answer: http://stackoverflow.com/a/21055237
answer count: 1
tagged with: console
has body: I have been working on a problem for a few days now to draw a diamond inside of the console that asks for user input, and then draws the diamond in respect to the size that was inputed. I can't draw the diamond in here because the formatting doesn't show up correctly. I have been able to successfully get the top half of the diamond to work, and I thought the bottom half would be easy as it would just be the reverse of the top, however I'm stuck on something and I cant seem to figure it out. Here is my code: import java.util.Scanner; public class Diamond { public static void main(String[] args) { // import the scanner Scanner scanner = new Scanner(System.in); // Ask for the number of sides System.out.println("Enter the diamond size: "); int sides = scanner.nextInt(); //variables for the diamond int matrix = sides * 2 + 3; int midpoint = ((matrix - 1) / 2) + 1; int mspaces = 0; int centerSpaces = 0; // diamond gets made here for (int rows = 1; rows &lt;= midpoint; rows++) { int spaces = (sides * 2 + 2) - (sides + rows); if (rows == 1) { for (int x = 1; x &lt;= spaces; x++) { System.out.print(" "); } System.out.print("^\n"); } //top half of the diamond if (rows &gt; 1 &amp;&amp; rows &lt; midpoint) { if (rows &gt; 2) { mspaces += 2; } for (int x = 1; x &lt;= spaces; x++) { System.out.print(" "); } System.out.print("/"); for (int k = 0; k &lt;= mspaces; k++) { System.out.print(" "); } System.out.print("\\\n"); centerSpaces = mspaces + 2; } //center of the diamond if (rows == midpoint) { System.out.print("&lt;"); for (int i = 0; i &lt;= centerSpaces; i++) { System.out.print(" "); } System.out.print("&gt;"); } } //Bottom half of the diamond for (int x = midpoint - 1; x &lt;= 1; x--) { int downSpace = (sides * 2 + 2) - (sides + x); System.out.println("\n"); if (x == 1) { for (int y = 1; y &lt;= downSpace; y++) { System.out.println(" "); } if (x &gt; 2) { mspaces += 2; } for (int y = 1; x &lt;= downSpace; y++) { System.out.print(" "); } System.out.print("\\"); for (int k = …
has comment: http://stackoverflow.com/comment/31659295
has comment: http://stackoverflow.com/comment/31659731
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31659540
tagged with: java
has comment: http://stackoverflow.com/comment/31658934
has comment: http://stackoverflow.com/comment/31659404
type: Question
has comment: http://stackoverflow.com/comment/31659499
has title: Diamond Drawing in Console
has answer: http://stackoverflow.com/a/21055237
has comment: http://stackoverflow.com/comment/31659142

http://stackoverflow.com/comment/31625664
has text: Is there a folder called NAT in your external storage?/ ALos change to `File directory = new File( android.os.Environment.getExternalStorageDirectory(), AppConstant.PHOTO_ALBUM)`. Reference http://developer.android.com/reference/java/io/File.html#File(java.lang.String, java.lang.String)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21036668

http://stackoverflow.com/q/21099072
has comment: http://stackoverflow.com/comment/31740466
has answer: http://stackoverflow.com/a/70405188
has answer: http://stackoverflow.com/a/36558053
has comment: http://stackoverflow.com/comment/31742245
score: 103
downvote count: 0
has answer: http://stackoverflow.com/a/50528972
has answer: http://stackoverflow.com/a/39336431
favorite count: 0
has answer: http://stackoverflow.com/a/41890704
has comment: http://stackoverflow.com/comment/31740327
has answer: http://stackoverflow.com/a/44083478
has answer: http://stackoverflow.com/a/50926077
has comment: http://stackoverflow.com/comment/31740486
linked to: http://stackoverflow.com/q/15220392
has answer: http://stackoverflow.com/a/31677228
has answer: http://stackoverflow.com/a/41691054
has answer: http://stackoverflow.com/a/41761202
has answer: http://stackoverflow.com/a/38690718
has answer: http://stackoverflow.com/a/39761222
has answer: http://stackoverflow.com/a/37373459
has answer: http://stackoverflow.com/a/40793938
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/44802391
has answer: http://stackoverflow.com/a/31604168
has answer: http://stackoverflow.com/a/21099249
has answer: http://stackoverflow.com/a/68508837
has comment: http://stackoverflow.com/comment/58643620
accepted answer: http://stackoverflow.com/a/21099229
has title: Eclipse/Maven error: "No compiler is provided in this environment"
tagged with: maven
has answer: http://stackoverflow.com/a/39528175
possible better answer: http://stackoverflow.com/a/39336431
has comment: http://stackoverflow.com/comment/31740541
has answer: http://stackoverflow.com/a/47911982
type: Question
has body: My environment is Windows 7 64bit with Eclipse [Kepler SR1] and Maven. I have to run a Maven install to deploy a code change, but this error is showing in the console: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project mrpapp: Compilation failure [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? but I definitely am running a JDK and not a JRE. I double-checked my $JAVA_HOME (C:\Program Files (x86)\Java\jdk1.7.0_60) and it does have a javac.exe in its bin directory.
has answer: http://stackoverflow.com/a/54524057
has comment: http://stackoverflow.com/comment/31740362
answer count: 28
has answer: http://stackoverflow.com/a/43759185
has answer: http://stackoverflow.com/a/21099229
tagged with: java
has answer: http://stackoverflow.com/a/56912017
has answer: http://stackoverflow.com/a/69615742
linked to: http://stackoverflow.com/q/34559379
has answer: http://stackoverflow.com/a/43055921
upvote count: 103
tagged with: eclipse
has answer: http://stackoverflow.com/a/42745321
linked to: http://stackoverflow.com/q/19655184
has answer: http://stackoverflow.com/a/77177587

http://stackoverflow.com/comment/56347830
has text: Check it in your command line tool by typing "Java --version"
comment on: http://stackoverflow.com/a/21119146
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21145468
has comment: http://stackoverflow.com/comment/31824773
downvote count: 0
tagged with: android-canvas
tagged with: clipping
has body: In Android I'm using Canvas.drawPath( Path, Paint ) to fill a Path. I've set the Paint variable to use a BitmapShader &amp; the Style to Fill. This method works fine until I try to use additional clipping, i.e. I try to draw to a sub-region within the Path like so theCanvas.clipRect( visibleRect, Region.Op.REPLACE ); theCanvas.clipRect( additionalClipping, Region.Op.INTERSECT ); theCanvas.drawPath( path, paint ); My desired result is to have the texture within the BitmapShader within the Paint, drawn to a rectangular area intersected with edge of my path. But the actual result of this is to have the texture tiled all over the Path area - the clipping I set on the Canvas seems to have had no effect. Its almost as if calling Canvas.drawPath internally calls Canvas.setClip( Path, Region.Op.Replace ). Any help is much appreciated, thank you.
answer count: 1
accepted answer: http://stackoverflow.com/a/21158878
favorite count: 0
upvote count: 2
tagged with: android
has title: Does Androids Canvas.drawPath use the clipping set in the Canvas?
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21158878

http://stackoverflow.com/q/21116683
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31772693
answer count: 0
type: UnansweredQuestion
tagged with: jboss
has body: When I create jasper report using jaspersoft studio 5.5 and compile it into binary and plug into my webapp, it runs smoothly in my localhost (Win 8.1 + Eclipse Kepler and Mac OSX + Eclipse Juno) by using JBoss runtime However, when I deploy the war file to the production server, which is a CentOS 6 + JBoss 7.1.1 + Java 1.7, follow error occurs: 22:24:05,854 WARN [org.jboss.modules] (http--198.98.98.181-8080-1) Failed to define class net.sf.jasperreports.engine.fill.JRBaseFiller in Module "deployment.TestWebReportEE.ear.TestWebReportProject.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link net/sf/jasperreports/engine/fill/JRBaseFiller (Module "deployment.TestWebReportEE.ear.TestWebReportProject.war:main" from Service Module Loader) at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396) at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243) at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73) at org.jboss.modules.Module.loadModuleClass(Module.java:517) at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182) at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:446) [jasperreports-javaflow-5.5.0.jar:5.5.0] at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:276) [jasperreports-javaflow-5.5.0.jar:5.5.0] at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:745) [jasperreports-javaflow-5.5.0.jar:5.5.0] at com.test.report.util.ReportConfigUtil.fillReport(ReportConfigUtil.java:70) [classes:] at com.te…
tagged with: eclipse
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31794900
type: Question
tagged with: jsf
has title: JBoss 7.1.1 + Jasper Report 5.5 + CentOS 6 ClassNotFoundException: net.sf.jasperreports.engine.fill.JRBaseFiller

http://stackoverflow.com/comment/31671237
has text: Any specific reason for using this code??
comment on: http://stackoverflow.com/q/21061780
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21049058
upvote count: 1
answers question: http://stackoverflow.com/q/21048462
type: Answer
has body: I made it work with constructor injection. @Component public class MyService { private MyDao dao; @Inject // javax.inject.Inject public MyService(MyDao dao) { System.out.println(dao); } }
downvote count: 0
score: 1

http://stackoverflow.com/comment/72865654
comment on: http://stackoverflow.com/a/22932249
score: 0
type: AnswerComment
has text: For some reason, changing the SocketPermission in Java's java.policy file didn't work for me, but changing my $HOME/.java.policy did. It isn't really the "right" general-purpose solution, but it does let me get my work done.
type: Comment

http://stackoverflow.com/q/21063083
has comment: http://stackoverflow.com/comment/31673731
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21063264
tagged with: java
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/31673651
type: Question
has answer: http://stackoverflow.com/a/21063137
has comment: http://stackoverflow.com/comment/31674003
has answer: http://stackoverflow.com/a/21063153
accepted answer: http://stackoverflow.com/a/21063153
score: -1
has comment: http://stackoverflow.com/comment/31673744
tagged with: comparator
has title: Alphabetically sorting an ArrayList<String> using .compareTo()
has body: An assignment we have to do in school is alphabetically sort two different ArrayLists into a final arraylist that contains both of the lists elements lexicographically For example... ArrayList sent1 contains in alphabetical order [., adam, mark] ArrayList sent2 contains in alphabetical order [., betsy, kyle, william] ArrayList sent3 must contain all of the elements in both ArrayLists in alphabetical order. I just can't seem to figure out how to do it. My instructor mentioned using a while loop, but I don't just understand how to code the process. Combining sent1 and sent2 into sent3 and then using Collections.sort(sent3) would make the process so much easier and more compact, but the goal of the lab is to practice the using of compareTo().
has comment: http://stackoverflow.com/comment/31674035
favorite count: 0
has answer: http://stackoverflow.com/a/21063266
possible better answer: http://stackoverflow.com/a/21063137
has comment: http://stackoverflow.com/comment/31673951

http://stackoverflow.com/a/21038740
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21038314
downvote count: 0
has body: If you need to store it on a physical location on your server where your application is deployed, you could just work with basic I/0 operations in JAVA using File class. Local drives are directly accessible. http://docs.oracle.com/javase/tutorial/essential/io/ You could also explore Google Guava API for the same. A simple example using Google Guava API is: File imageFile = new File("D:\\images", imgFileName); FileOutputStream outputStream = new FileOutputStream(newAttachment); ByteStreams.copy(inputStream, outputStream); Also, to access images over URL you'll have to add the directory as context. Check out the blog post to access image file as URL: http://th1rty7.blogspot.in/2009/05/tomcat-is-often-considered-to-be-too.html

http://stackoverflow.com/comment/31747045
type: QuestionComment
comment on: http://stackoverflow.com/q/21100834
has text: ADB (Android Debug Bridge) is used for debugging. You can remotely install apps, browse the storage, log debug messages, etc... http://www.droidwiki.de/Android_Debug_Bridge
score: 0
type: Comment

http://stackoverflow.com/comment/31796963
score: 0
has text: please set the visibility of your frame with `.setVisible(true);`
comment on: http://stackoverflow.com/q/21130010
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21101480
answers question: http://stackoverflow.com/q/21101407
has body: If you want to know when a specific task finishes, use an ExecutorService, which will return a Future&lt;> (a handle that you can use to get the status of a specific job) -- the executor itself doesn't terminate until you shut it down. Think of an executor like 'batch queue' or a 'coprocessor' waiting around for you to throw some work in the hopper. Update: Gray answered this much better than I - see his post. -- (how do people type that fast??)
score: 0
type: Answer

http://stackoverflow.com/comment/31810981
has text: Yea, just like any listener. Here's even an example that looks like what you're trying to do: [A Simple HttpSessionListener Example – Active Sessions Counter](http://www.mkyong.com/servlet/a-simple-httpsessionlistener-example-active-sessions-counter/)
type: Comment
comment on: http://stackoverflow.com/a/21137482
score: 1
type: AnswerComment

http://stackoverflow.com/a/21161917
has comment: http://stackoverflow.com/comment/31865159
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21161675
has comment: http://stackoverflow.com/comment/31863780
has comment: http://stackoverflow.com/comment/31863677
has comment: http://stackoverflow.com/comment/31862735
has comment: http://stackoverflow.com/comment/31862549
type: Answer
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/31863418
has body: Don't ever call the main method. The main method is for the JVM to know the entry point for the program. Don't use two main methods. Whichever is the entry point program, have the main method only in that one Just use a constructor. When the first GUI calls the second one, everything in the constructor will be constructed. Here's a revamped version. It works. I got rid of the main from ClientGUI I called ClientGUI.createAndShowGUI() from the main in the Client class. import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.net.*; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class Client { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new Client(); } }); } Client() { String[] args = {"ggg", "vvv"}; try { ClientGUI.createAndShowGUI(); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } class ClientGUI extends JPanel implements ActionListener { private static JButton btnForward = new JButton("Forward"), btnBackward = new JButton("Backward"); public ClientGUI() throws MalformedURLException { setLayout(new BorderLayout()); add(btnForward, BorderLayout.CENTER); btnForward.addActionListener(this); btnBackward.addActionListener(this); } public void actionPerformed(ActionEvent e) { if (e.getSource() == btnForward) { remove(btnForward); add(btnBackward, BorderLayout.CENTER); revalidate(); repaint(); } else if (e.getSource() == btnBackward) { remove(btnBackward); add(btnForward); revalidate(); repaint(); } } public static void createAndShowGUI() throws MalformedURLException { JFrame frame = new JFrame("ClientGUI"); frame.setMinimumSize(new Dimension(500, 400)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(new ClientGUI()); frame.setSize(500, 400); frame.setVisible(true); } }
accepted answer of: http://stackoverflow.com/q/21161675
score: 5

http://stackoverflow.com/q/21072452
tagged with: jscrollpane
has comment: http://stackoverflow.com/comment/31690938
score: 2
has comment: http://stackoverflow.com/comment/31691586
downvote count: 0
has title: Adding JTable to a JScrollPane
favorite count: 0
upvote count: 2
possible better answer: http://stackoverflow.com/a/21072496
linked to: http://stackoverflow.com/q/20911857
tagged with: swing
has answer: http://stackoverflow.com/a/21072496
has comment: http://stackoverflow.com/comment/31690865
accepted answer: http://stackoverflow.com/a/21072516
has answer: http://stackoverflow.com/a/21072580
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
has body: I am trying to add a JTable to a JScrollPane. But I can't see the Table after doing this. scrollpane.setBounds(100,50,800,400); JTable table = new JTable(myTableModel(res)); scrollpane.add(table); What's wrong with me?
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/5621338
has comment: http://stackoverflow.com/comment/31691670
has comment: http://stackoverflow.com/comment/31703206
tagged with: jtable
has answer: http://stackoverflow.com/a/21072516
answer count: 3

http://stackoverflow.com/a/21139746
score: 0
answers question: http://stackoverflow.com/q/21139539
has body: Create an interface for each subclass , with the functions it can do , that when you create a class of a doctor implements the "Manager" Interface , it will have access to the manager functions if you need something more complex , you might want to reconsider the hierarchy like , for example *Staff -management *Manager *recieption -practioner *doctor *nurse
type: Answer

http://stackoverflow.com/a/21076994
has body: If version is eg 1.0-SNAPSHOT then place the jar here localrepo_folder com google caliper caliper &lt;-- artifact 1.0-SNAPSHOT caliper-1.0-SNAPSHOT.jar
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21076910

http://stackoverflow.com/q/21174819
tagged with: nullpointerexception
tagged with: jlist
has comment: http://stackoverflow.com/comment/31878369
has answer: http://stackoverflow.com/a/21174853
type: Question
type: AnsweredQuestion
tagged with: java
has title: JList.getSelectedValue().toString() returning null?
answer count: 1
has body: I have a jlist that holds a bunch of username strings. I dont have a lot of experience with this, so here is the code making jlist: for (int i = 0; i &lt; usersArray.length; i++) {//usersArray is String[] loaded from a list of username strings defaultListModelObject.addElement(usersArray[i]); } jlistobject = new JList(defaultListModelObject); There is a button next to the jlist, that when i click it, it calls System.out.println(jlistobject.getSelectedValue().toString(); then i'm getting a nullpointerexception, that it is unable to print that value. i'm not sure what the null pointer is to, but here is the result: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at avtech.software.minecraft.server.components.UsersListPanel.getSelectedPlayer(UsersListPanel.java:56) at avtech.software.minecraft.server.components.PlayerCommandPanel.player(PlayerCommandPanel.java:125) at avtech.software.minecraft.server.components.PlayerCommandPanel.access$0(PlayerCommandPanel.java:124) at avtech.software.minecraft.server.components.PlayerCommandPanel$3.actionPerformed(PlayerCommandPanel.java:44) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDi…
tagged with: user-interface
has comment: http://stackoverflow.com/comment/31878372
accepted answer: http://stackoverflow.com/a/21174853
score: 0

http://stackoverflow.com/comment/31708448
score: 0
comment on: http://stackoverflow.com/q/21081622
type: Comment
type: QuestionComment
has text: @SotiriosDelimanolis Ohh, I see now. But Elliot didn't suggest that. We can assume he had something in mind like shown in the replies.

http://stackoverflow.com/q/21128342
type: Question
tagged with: thymeleaf
score: 5
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21294532
tagged with: tiles
upvote count: 5
type: UnansweredQuestion
tagged with: tiles2
tagged with: fragment
has title: Comparing Thymeleaf fragments and Apache Tiles?
downvote count: 0
tagged with: java
has body: Has anyone had experience with Thymeleaf fragments for page layout in a big project? Tiles look cleaner to me compared to fragments. I would appreciate your inputs. Thanks

http://stackoverflow.com/q/21092819
accepted answer: http://stackoverflow.com/a/21093027
possible better answer: http://stackoverflow.com/a/21092934
has answer: http://stackoverflow.com/a/21092934
score: 0
answer count: 2
has title: How to read excel sheet stored on application server
linked to: http://stackoverflow.com/q/18181119
has body: How can I read an Excel file stored on an application server? I have read this and most of the solutions which I have gone through show to read it from a physical location of the local computer. I would like to read it from an application server. Can someone suggest how to achieve this?
type: AnsweredQuestion
tagged with: apache-poi
tagged with: java
has answer: http://stackoverflow.com/a/21093027
tagged with: excel
type: Question

http://stackoverflow.com/q/21181661
type: Question
has title: How to convert noun Synset datatype into string?
has comment: http://stackoverflow.com/comment/31890113
score: 0
answer count: 3
has body: how to convert the word noun synset datatype into string in java ? nounSynset = (NounSynset)(synsets[j]); since I need to pass the meaning of the query to the search engine which have the method that accepts only string I tried to store it in a string variable,but I couldn't able to store. here comes the error of type mismatch:cannot convert nounSynset to string. the string which I tried was given bellow String s= nounSynset
has answer: http://stackoverflow.com/a/21182049
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21181690
tagged with: java
has answer: http://stackoverflow.com/a/21181864

http://stackoverflow.com/q/21083856
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31712640
has body: I am trying to access a data in a table using a sub query. The table 1 contains a foreign key to table 2 , which means i can use that key to access the data in table 2. My problem is after i return the array list from the below shown method , the arraylist is null. This is what i have done: LogEntry logBookDates; List&lt;LogEntry&gt; bookList =new ArrayList(); try{ PreparedStatement getSummaryStmt=con.prepareStatement("SELECT * FROM LOGENTRYTABLE WHERE DIARYCODE =(SELECT Diarycode FROM LOGBOOKTABLE WHERE STUDENTUSERNAME=? OR SUPERVISORUSERNAME=? AND PROJECT_APPROVE_STATUS=?)"); //the above statment is the sub query which i have created, i get the diary code from log book table and then access the log entry table. getSummaryStmt.setString(1,userName); getSummaryStmt.setString(2,userName); getSummaryStmt.setString(3,"Accepted"); ResultSet rs=getSummaryStmt.executeQuery(); while(rs.next()) { logBookDates=new LogEntry(rs.getString("STUDENTUSERNAME"),rs.getString("SupervisorUsername"),rs.getString("projecttitle"),rs.getString("projectDescription"),rs.getDate("startDate"),rs.getDate("enddate"),rs.getString("project_approve_status"),rs.getString("diarycode"),rs.getString("projectcode"),rs.getInt("Index"),rs.getString("log_Entry"),rs.getDate("logentry_date"),rs.getString("supervisor_comment"),rs.getString("project_progress")); bookList.add(logBookDates); } }catch(Exception e){} return bookList; } I have not used sub queries before and this is the first time am using them. What seems to be the problem here ? Thank you for your time. Edit : Sample data of logbook table Sample Data of logentry table Expected output: I don't have a screen shot of that but what i need is just to iterate through the arraylist which will be returned from the above method.
type: Question
has comment: http://stackoverflow.com/comment/31713194
tagged with: database
has comment: http://stackoverflow.com/comment/31712679
tagged with: derby
has comment: http://stackoverflow.com/comment/31712460
has answer: http://stackoverflow.com/a/21083913
answer count: 1
downvote count: 0
has title: Using sub queries
favorite count: 0
has comment: http://stackoverflow.com/comment/31712538
has comment: http://stackoverflow.com/comment/31712615
tagged with: subquery
upvote count: 2
accepted answer: http://stackoverflow.com/a/21083913

http://stackoverflow.com/comment/53187923
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21148953
score: 0
has text: if you lose the opengl context the time to reload a texure is pretty insignificant since the it was lost probably due to a "user world" interruption amounting to seconds if not minutes. A few ms to restart wont matter,

http://stackoverflow.com/q/21087339
has answer: http://stackoverflow.com/a/21089309
accepted answer: http://stackoverflow.com/a/21089309
type: Question
has comment: http://stackoverflow.com/comment/31720820
linked to: http://stackoverflow.com/q/21089888
tagged with: liferay
tagged with: portal
score: 0
tagged with: api
answer count: 1
tagged with: file-upload
has title: Uploading files to Liferay server
has comment: http://stackoverflow.com/comment/31722509
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31721475
has comment: http://stackoverflow.com/comment/31718764
has body: I'm using Liferay 6.2 CE and I would like to add a simple functionality in which administrator can upload files to liferay server and add hyperlink to this file on the page. I've found in Liferay's 6.1 documentation that in that version administrator could just create a data list and add File Upload field there as shown below: Unfortunately in Liferay 6.2 this field doesn't exist (I'm confused here what's the reason): I also saw that during new blog post creation, there is this HTML in-browser editor that has functionality to add images. When pressed, user can select a file from a hard drive which is then uploaded to liferay server and added as &lt;img&gt; tag to the blog editor and links to directory that looks like that: /documents/11469/0/UPLOADED_FILE.zip/. But it's not intuitive for a user to upload normal files (e.g. .zip file), by using image uploader and manually editing the source code to change &lt;img&gt; tags to normal &lt;a&gt; anchors. So my question is whether I need to solve described problem programatically using API (I believe that DLFileEntryLocalServiceUtil is used for that purpose) or is there any other way to achieve this using liferay functionalities?
tagged with: java

http://stackoverflow.com/q/21023065
duplicate of: http://stackoverflow.com/q/1464291
has answer: http://stackoverflow.com/a/21023592
has comment: http://stackoverflow.com/comment/31601134
has body: I have standard maven project structure: -src | --main | ---java ---resources | ----file.txt I need to read this file on app start (read DB schema and execute SQL script, so this file is opened via FileReader). When app is built, then using the following code gets it from project/target/classes/file.txt: getClass().getResource("/file.txt").getFile() This file also appears in the root of the result jar file. And after app start it cannot be accessed because it is searched near the jar file not inside. How to access this file when it is inside jar/resource folder?
tagged with: maven
has comment: http://stackoverflow.com/comment/31600986
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21023592
has title: Open file that is in the resource folder/inside jar
answer count: 1
has comment: http://stackoverflow.com/comment/31600696
has comment: http://stackoverflow.com/comment/31600849
linked to: http://stackoverflow.com/q/1464291
score: 0

http://stackoverflow.com/a/21051786
answers question: http://stackoverflow.com/q/21051696
has comment: http://stackoverflow.com/comment/31657057
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31654412
has body: You need to set the paths to all your jar files in the CLASSPATH, putting only a directory will cause jvm to look for .class files of which the packages start from that directory not .jar files. So set your classpath something like this (windows): set CLASSPATH=%CLASSPATH%;C:\path\to\libs\somelib1.jar;path2\to\libs\somelib2.jar and so on. You have then to run your program like this: java your.main.Klass arg1 Alternatively you could add a Calss-path entry in your manifest and put all your dependencies in it: Class-Path: libs/somelib1.jar libs/somelib3.jar Then you can run it using the -jar option java -jar myJarFile.jar arg1
type: Answer
has comment: http://stackoverflow.com/comment/31653607
has comment: http://stackoverflow.com/comment/31655142
accepted answer of: http://stackoverflow.com/q/21051696
upvote count: 1

http://stackoverflow.com/q/21070770
downvote count: 0
has body: Hello guys i'm reading a page that contain JSON objects with JAVA (Android) Here is what the page contains : { "destination_addresses" : [ "Safi, Maroc" ], "origin_addresses" : [ "Avenue Hassan II, Safi, Maroc" ], "rows" : [ { "elements" : [ { "distance" : { "text" : "1,0 km", "value" : 966 }, "duration" : { "text" : "2 minutes", "value" : 129 }, "status" : "OK" } ] } ], "status" : "OK" } I know how to read from the page doing this JSONObject jArray = new JSONObject(result); String elements = jArray.getString("rows"); the elements string contain that : [{"elements" : [{"distance" : {"text" : "1,0 km","value" : 966},"duration" : {"text" : "2 minutes","value" : 129},"status" : "OK"}]}] But im trying to get the distance value which is "966" Thx guys
has answer: http://stackoverflow.com/a/21070813
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/21070794
accepted answer: http://stackoverflow.com/a/21070813
favorite count: 0
score: 2
upvote count: 2
possible better answer: http://stackoverflow.com/a/21070794
has answer: http://stackoverflow.com/a/21070800
linked to: http://stackoverflow.com/q/9605913
type: Question
has title: Using Json to access a specific attribute
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json

bytecode-manipulation
type: Tag
tags question: http://stackoverflow.com/q/21141583
tag name: bytecode-manipulation

http://stackoverflow.com/q/21127547
favorite count: 0
has comment: http://stackoverflow.com/comment/31793019
has comment: http://stackoverflow.com/comment/31792832
has comment: http://stackoverflow.com/comment/31792901
has title: JPA OneToMany collection returned as Empty
tagged with: entitymanager
has body: Doing a lookup of a previously saved 1-to-many entity. Entitles are: Book.java: @Entity @Table(name = "Book") public class Book { @Id @GeneratedValue @Column(name = "id") private Long id; @OneToMany(fetch=FetchType.LAZY, cascade=CascadeType.ALL, mappedBy="book", orphanRemoval=true) private Collection&lt;Author&gt; authors; public Collection&lt;Author&gt; getAuthors() { return authors; } ... @Override public String toString() { return "Book [id=" + id + ", authors=" + authors + ", title=" + title + ", isbn=" + isbn + "]"; } } Author.java: @Entity @Table(name = "Authors") public class Author { @Id @GeneratedValue @Column(name="id") private Long id; @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="book_id") private Book book; ... @Override public String toString() { return "Author [id=" + id + ", book=" + book + ", firstName=" + firstName + ", lastName=" + lastName + "]"; } } Ignoring the dubious cardinality of the data model, the lookup code is long bookID = 10; // saved entity ID entityManager.getTransaction().begin(); Book savedBook = entityManager.find(Book.class, bookID); System.out.println("Book " + savedBook); entityManager.getTransaction().commit(); which gives the output Book Book [id=10, authors=[], title=Treasure Island, isbn=123456] Any ideas why authors is empty? Retrieving 11... Exception in thread "main" java.lang.StackOverflowError at java.lang.Long.toString(Long.java:240) at java.lang.Long.toString(Long.java:100) at java.lang.String.valueOf(String.java:2946) at java.lang.Long.toString(Long.java:733) at java.lang.String.valueOf(String.java:2827) at java.lang.StringBuilder.append(StringBuilder.java:115) at org.hibstore.domain.Book.toString(Book.java:64) at java.lang.String.valueOf(String.java:2827) at java.lang.StringBuilder.append(StringBuilder.java:115) at org.hibstore.domain.Author.toString(Author.java:67) at java.lang.String.valueOf(String.java:2827) at java.lang.StringBuilder.append(StringBuilder.java:115) at java.util.AbstractCollection.toString(…
has answer: http://stackoverflow.com/a/21127861
accepted answer: http://stackoverflow.com/a/21127861
has comment: http://stackoverflow.com/comment/31792672
possible better answer: http://stackoverflow.com/a/21130590
has comment: http://stackoverflow.com/comment/31792858
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31792727
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31793033
type: Question
answer count: 2
upvote count: 1
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/21130590

http://stackoverflow.com/comment/31696866
comment on: http://stackoverflow.com/q/21075766
type: QuestionComment
type: Comment
has text: What event listeners do you want to register?
score: 0

http://stackoverflow.com/q/21078407
type: Question
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31702382
tagged with: jface
favorite count: 0
has comment: http://stackoverflow.com/comment/31701705
downvote count: 1
has answer: http://stackoverflow.com/a/21078771
accepted answer: http://stackoverflow.com/a/21078771
has title: How to find the row of tableItem?
type: AnsweredQuestion
has body: I created tableviewer ( jface ) In my logic I have TableItem and I need to find the row of the tableItem in the tableViewer. How I can do it ?
tagged with: java
score: -1

http://stackoverflow.com/comment/31680642
type: Comment
type: QuestionComment
has text: All in all, I am trying to pass d to DBaccess to make the query
comment on: http://stackoverflow.com/q/21066369
score: 0

http://stackoverflow.com/q/21088272
linked to: http://stackoverflow.com/q/24833827
answer count: 1
tagged with: android-wheel
has title: Can I add a caption to Wheel picker
tagged with: android
has answer: http://stackoverflow.com/a/21089211
has comment: http://stackoverflow.com/comment/42927147
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31719973
tagged with: java
has body: I want to add a caption to wheel picker. I can't find any methods for a caption. I have already have a wheel picker which is only written in java. I want to add caption only in java.Please help me. Edit: Here is my code. final WheelView minute = new WheelView(Mcontex); minute.setMinimumHeight(300); layoutHome.addView(minute, new LayoutParams( android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 1.2f)); layoutmain.addView(layoutHome); minute.setViewAdapter(new RotationArrayAdapter(context, minutesArray, 1)); minute.setCurrentItem(0); minute.addChangingListener(listener);
type: Question
score: 0

http://stackoverflow.com/q/21157972
answer count: 3
has body: I am learning to develop android apps and I am trying to incorporate OpenCV in the apps. I decided to make a simple app that displays an image. The code is given below: package com.example.first; import org.opencv.android.BaseLoaderCallback; import org.opencv.android.CameraBridgeViewBase; import org.opencv.android.LoaderCallbackInterface; import org.opencv.android.OpenCVLoader; import org.opencv.android.CameraBridgeViewBase.CvCameraViewFrame; import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener2; import org.opencv.core.Mat; import org.opencv.highgui.Highgui; import android.os.Bundle; import android.app.Activity; import android.graphics.Canvas; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.SurfaceView; import android.view.WindowManager; import android.webkit.WebView.FindListener; import android.widget.ImageView; import android.widget.Toast; public class MainActivity extends Activity{ Mat m=Highgui.imread("C:/Users/Administrator/Desktop/circle1.png"); } On checking the logcat the following errors were being displayed: E/AndroidRuntime(1310): FATAL EXCEPTION: main E/AndroidRuntime(1310): java.lang.UnsatisfiedLinkError: Native method not found: org.opencv.highgui.Highgui.imread_1:(Ljava/lang/String;) E/AndroidRuntime(1310): at org.opencv.highgui.Highgui.imread_1(Native Method) E/AndroidRuntime(1310): at org.opencv.highgui.Highgui.imread(Highgui.java:359) E/AndroidRuntime(1310): at com.example.run.MainActivity.(MainActivity.java:26) E/AndroidRuntime(1310): at java.lang.Class.newInstanceImpl(Native Method) E/AndroidRuntime(1310): at java.lang.Class.newInstance(Class.java:1130) E/AndroidRuntime(1310): at android.app.Instrumentation.newActivity(Instrumentation.java:1061) E/AndroidRuntime(1310): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128) E/AndroidRuntime(1310): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) E/AndroidRuntime(1310): at android.…
has comment: http://stackoverflow.com/comment/31849995
favorite count: 0
upvote count: 2
downvote count: 2
tagged with: android
possible better answer: http://stackoverflow.com/a/21159037
has answer: http://stackoverflow.com/a/21159037
has answer: http://stackoverflow.com/a/21163934
tagged with: opencv
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31849183
has answer: http://stackoverflow.com/a/21160015
type: Question
has title: Display image on Android using OpenCV
has comment: http://stackoverflow.com/comment/31848953
accepted answer: http://stackoverflow.com/a/21163934
score: 0
has comment: http://stackoverflow.com/comment/31848840

http://stackoverflow.com/q/21042494
downvote count: 0
has answer: http://stackoverflow.com/a/21042590
favorite count: 0
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/21042905
accepted answer: http://stackoverflow.com/a/21042572
tagged with: android-bitmap
upvote count: 1
possible better answer: http://stackoverflow.com/a/21042590
tagged with: bitmap
type: Question
type: AnsweredQuestion
tagged with: hashmap
has title: How to calculate size of a java hashmap of bitmaps on android
has answer: http://stackoverflow.com/a/21042572
score: 1
tagged with: java
has body: I have created a hahsmap of bitmap objects in my android service, using an int as key. To this, I am adding different bitmaps created dynamically, as per requirement. Can I find the RAM/heap memory footprint added to my service because of this hashmap (including the size of bitmaps), using some tool, or programatically. If anybody has worked in this area before, please help !

http://stackoverflow.com/comment/31804704
type: QuestionComment
comment on: http://stackoverflow.com/q/21113253
has text: @James_D: Ok. Many thanks for helping out! Seems I can't do what I wanted then. I've modified my CSS now with pseudo-selectors (mainly restoring the values from caspian.css), and it seems to work fine for now!
score: 0
type: Comment

http://stackoverflow.com/q/21184139
tagged with: wine
type: Question
has body: I just wonder if WINE can open Windows Application under Linux? I have a Windows standalone application which reads some files, runs its own algorithm, and writes results into some files. If the answer is yes, do you have to have WINE open under Linux and open Windows standalone through WINE like codeweavers? My ultimate question is this: I have an algorithm coded in Java, at the moment my algorithm repeatedly calls the Windows standalone. If I run my java program under Linux, is it possible to call a Windows application and run it normally with the help of WINE? I'm not a computer science graduate and I have limited IT knowledge. I appreciate any help and suggestion. Cheers!
answer count: 1
has comment: http://stackoverflow.com/comment/31894392
tagged with: linux
has comment: http://stackoverflow.com/comment/31894434
tagged with: windows
has answer: http://stackoverflow.com/a/21184614
has comment: http://stackoverflow.com/comment/31894647
favorite count: 0
score: -1
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has title: Can WINE open standalone Windows Application under Linux?
tagged with: java

http://stackoverflow.com/comment/31882855
score: 0
has text: Please re-read my last comment. Again, don't post code in a comment, but as an edit to your question. Again, do *not* use a MouseListener on a JButton but rather use an ActionListener. Again, please post a serious attempt. If your code does not compile, show error messages. If it throws an exception, then post the exception stack trace.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21177139

http://stackoverflow.com/comment/31723545
comment on: http://stackoverflow.com/a/21090344
type: Comment
has text: @VelGanesh See how you get on. If you get stuck edit the question with your code as you wrote it and put a comment on here so I see it. I'll take a look for you.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21062178
answer count: 3
has answer: http://stackoverflow.com/a/21062213
accepted answer: http://stackoverflow.com/a/21062213
tagged with: set
possible better answer: http://stackoverflow.com/a/21062287
has body: My requirement is the if i have 2 strings, i should get the intersection of 2 strings-means returning the common elements of the strings without duplicacy. My approach was: String str1="Character"; String str2="National"; Set&lt;Character&gt; set1=new HashSet&lt;Character&gt;(); Set&lt;Character&gt; set2=new HashSet&lt;Character&gt;(); for(char c:str1.toLowerCase().toCharArray()){ set1.add(c); } for(char c:str2.toLowerCase().toCharArray()){ set2.add(c); } Set&lt;Character&gt; inter=new HashSet&lt;Character&gt;(set1); Set&lt;Character&gt; union=new HashSet&lt;Character&gt;(set1); inter.retainAll(set2); union.addAll(set2); Now the intersection contains the intersection and union contains the union as: Intersection of sets:[t, a] Union of sets:[t, e, c, r, a, n, o, l, h, i] But i want is to convert these sets back to strings as "ta" and"tecranolhi" . I am using String arr1[]=inter.toArray(new String[0]); but it gives an error. **Exception in thread "main" java.lang.ArrayStoreException: java.lang.Character at java.util.AbstractCollection.toArray(Unknown Source) at StringInter.main(StringInter.java:22)** Can someone clarify this?
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31671944
type: Question
has comment: http://stackoverflow.com/comment/31671959
tagged with: arrays
has answer: http://stackoverflow.com/a/21062287
has comment: http://stackoverflow.com/comment/31671922
has title: Intersection of 2 arrays using sets
score: 0
has answer: http://stackoverflow.com/a/21062288

http://stackoverflow.com/a/21184866
has body: You need to check if it is of instance IdleStateEvent and if so cast it and check its state(). public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { if(evt instanceof IdleStateEvent) { IdleStateEvent e = (IdleStateEvent) evt; if(e.state() == IdleState.READER_IDLE) { System.out.println("It's idle!"); } } } See the example in the javadocs: https://github.com/netty/netty/blob/4.0/handler/src/main/java/io/netty/handler/timeout/IdleStateHandler.java#L77
score: 1
has comment: http://stackoverflow.com/comment/31948788
has comment: http://stackoverflow.com/comment/32242425
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31942376
type: Answer
accepted answer of: http://stackoverflow.com/q/21174277
answers question: http://stackoverflow.com/q/21174277
has comment: http://stackoverflow.com/comment/31936722
upvote count: 1

http://stackoverflow.com/comment/41424892
has text: @dexter meyers JProfiler: License with 1 year of Support & Upgrades €599 upgrade: For Single Licenses €159 IDEA: €179 upgrade €89. for my purposes/uses JProfiler is too expensive. IDEA for me was not expensive if you don't want to use NetBeans or Eclipse. but i can stick with the fact that there is no such feature.
type: Comment
score: 6
comment on: http://stackoverflow.com/a/21156875
type: AnswerComment

http://stackoverflow.com/a/21104343
has comment: http://stackoverflow.com/comment/91780551
upvote count: 29
type: Answer
downvote count: 0
score: 29
accepted answer of: http://stackoverflow.com/q/21099953
has comment: http://stackoverflow.com/comment/32081021
has comment: http://stackoverflow.com/comment/45459953
answers question: http://stackoverflow.com/q/21099953
has body: Long polling is supposed to eliminate multiple polls No, long polling is supposed to eliminate a large number of empty polls and false empty responses when messsages are actually available. A long poll in SQS won't sit and wait for the maximum amount of wait time just looking for more things to return, or keep searching once it's found something. A long poll in SQS only waits long enough to find something: “Long polling allows the Amazon SQS service to wait until a message is available in the queue before sending a response. So unless the connection times out, the response to the ReceiveMessage request will contain at least one of the available messages (if any) and up to the maximum number requested in the ReceiveMessage call.” — http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-long-polling.html (emphasis added) So, the “something” that SQS finds and returns may be all of the messages (up to your max), or a subset of the messages, because, as has been mentioned, SQS is a distributed system. There was likely an architectural decision to be made between "return as quickly as possible once we've found something" and "search the entire system for everything possible up to the maximum number of message the client will accept" ... and, given those alternatives, it seems reasonable that most applications would prefer the faster response of "give me whatever you can, as quickly as you can." You don't know that you've actually drained a queue until you get back an empty response from a long poll.
type: AcceptedAnswer

http://stackoverflow.com/comment/31601921
type: Comment
type: QuestionComment
has text: @AliAlamiri The question "?" characters nor any details on asker's intentions, but let's move on. The interviewer tried to check his/her knowledge on core java stuffs (immutability of the String class) and some algorithmic skills (write a method that produces the reverse copy of a String)
comment on: http://stackoverflow.com/q/21023506
score: 0

http://stackoverflow.com/comment/31809114
comment on: http://stackoverflow.com/q/21137098
score: 0
type: Comment
type: QuestionComment
has text: Om my god...i've been stuck on this for 4 hours. Thnx guys!

http://stackoverflow.com/q/21058015
answer count: 1
has answer: http://stackoverflow.com/a/21058118
tagged with: java
has comment: http://stackoverflow.com/comment/31664534
type: UnansweredQuestion
has body: This is a curiousity question about the world of Java programming. Let's say I have this in my code public interface IDoSomethingAndSomethingElse { int doSomething(); int doSomethingElse(); } public abstract class AbstractDoSomethingAndSomethingElse implements IDoSomethingAndSomethingElse{ public int doSomething() { return arcaneAndMysticalProceedings(); } public abstract int doSomethingElse(); //thanks PM77-1 } public class MyDoSomethingAndSomethingElse extends AbstractDoSomethingAndSomethingElse{ @Override public int doSomething(){ return super.doSomething(); } public int doSomethingElse(){ return mystiriousIncantation(); } } My question is this: Is there a point in the concrete implementation to override doSomething() like this? Any use for it? Can you think of a use case for that to be useful? EDIT: To make my question a bit more precise; Is there situations in which it would make a difference if I had not ovveriden doSomething exactly like I did above (without actually adding anything to it)?
has comment: http://stackoverflow.com/comment/31664751
type: Question
tagged with: polymorphism
score: 0
has title: Is there a point in overriding while only calling the 'super' implementation?

runnable
tags question: http://stackoverflow.com/q/21061119
type: Tag
tags question: http://stackoverflow.com/q/21048510
tags question: http://stackoverflow.com/q/21036420
tags question: http://stackoverflow.com/q/21111852
tags question: http://stackoverflow.com/q/21073164
tags question: http://stackoverflow.com/q/21181492
tag name: runnable
tags question: http://stackoverflow.com/q/21072930

http://stackoverflow.com/comment/31689002
score: 3
comment on: http://stackoverflow.com/q/21071317
has text: @MrSimpleMind How is that relevant?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31749887
has text: Possible duplicate of http://stackoverflow.com/questions/11165485/java-why-am-i-required-to-initialize-a-primitive-local-variable
comment on: http://stackoverflow.com/q/21103900
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31692528
has text: requestScope: Maps request-scoped variable names (USER_LIST) to their values -> ${requestScope.USER_LIST} should map your USER_LIST that you set in your HttpServlet (See "Expression Language" link)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21073351
type: AnswerComment

timestamp
tags question: http://stackoverflow.com/q/21040600
tag name: timestamp
tags question: http://stackoverflow.com/q/21034766
tags question: http://stackoverflow.com/q/21172847
type: Tag
tags question: http://stackoverflow.com/q/21175319

http://stackoverflow.com/q/21143234
tagged with: java
tagged with: inputstream
type: Question
has comment: http://stackoverflow.com/comment/100002245
tagged with: user-interface
downvote count: 0
answer count: 1
tagged with: minecraft
favorite count: 0
has answer: http://stackoverflow.com/a/21143740
tagged with: outputstream
has title: Running a minecraft server from within my own program
upvote count: 6
has body: I am trying to set up a minecraft server, for fun, and want to add a control panel to make managing it easier. Part of this control panel is to run the server FROM the panel to reduce miss-clicking the exit button and what-not. (the minecraft server is a non-runnable .jar file, implying you have to make a .bat to run it from the command line) I know how to run the server inside my program, as well as print the output, here: ProcessBuilder pb = new ProcessBuilder("java", "-jar", "gscale.jar"); pb.redirectErrorStream(true); pb.directory(new File("F:\\Documents and Settings\\Administrator\\Desktop")); System.out.println("Directory: " + pb.directory().getAbsolutePath()); Process p = pb.start(); InputStream is = p.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is)); for (String line = br.readLine(); line != null; line = br.readLine()) { System.out.println( line ); // Or just ignore it } p.waitFor(); but, with this, i'm not sure how to implement an input method. for example, if I click a button, it sends the input "stop" to the external jar to stop the server, as it does without this command panel. how would I implement that? the code above I plan to be running in it's own thread, but maybe i'm doing this all wrong? Thanks in advance!
score: 6
accepted answer: http://stackoverflow.com/a/21143740
type: AnsweredQuestion

http://stackoverflow.com/comment/31687098
comment on: http://stackoverflow.com/a/21069421
score: 0
type: AnswerComment
type: Comment
has text: Pssst: `AtomicMarkableReference` ;)

http://stackoverflow.com/a/48455873
score: 15
type: Answer
has body: There are many other stuffs you can alter in server configuration by changing application.properties. Like session time out, address and port etc. Refer below post ref: http://docs.spring.io/spring-boot/docs/1.4.x/reference/html/common-application-properties.html I used few of them as below. server.session.timeout=1 server.port = 3029 server.address= deepesh
upvote count: 15
answers question: http://stackoverflow.com/q/21083170
downvote count: 0

properties-file
tags question: http://stackoverflow.com/q/21163653
type: Tag
tag name: properties-file
tags question: http://stackoverflow.com/q/21020755

http://stackoverflow.com/q/21064830
has title: One Opengl ES Program for each texture?
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21066132
tagged with: opengl-es-2.0
tagged with: android
type: AnsweredQuestion
tagged with: java
type: Question
has body: I'm learning to program in OpenGL ES My questions are: I want to draw two pictures, each with its texture. To do this I create two Opengl ES Program? You can use the same Opengl ES Program for each texture?
has answer: http://stackoverflow.com/a/21066132

http://stackoverflow.com/comment/31894434
type: Comment
comment on: http://stackoverflow.com/q/21184139
has text: You don't need to be a "computer science graduate" to try it out. Just fire up a Linux distro with Wine installed.
score: 0
type: QuestionComment

string
tags question: http://stackoverflow.com/q/21027434
tags question: http://stackoverflow.com/q/21093340
tags question: http://stackoverflow.com/q/21020200
tags question: http://stackoverflow.com/q/21021032
tags question: http://stackoverflow.com/q/21067453
tags question: http://stackoverflow.com/q/21120550
tags question: http://stackoverflow.com/q/21057708
tags question: http://stackoverflow.com/q/21154043
tags question: http://stackoverflow.com/q/21023506
tags question: http://stackoverflow.com/q/21069113
tags question: http://stackoverflow.com/q/21124310
tags question: http://stackoverflow.com/q/21180170
tags question: http://stackoverflow.com/q/21062638
tags question: http://stackoverflow.com/q/21139843
tags question: http://stackoverflow.com/q/21172880
tags question: http://stackoverflow.com/q/21144133
tags question: http://stackoverflow.com/q/21168158
tags question: http://stackoverflow.com/q/21127514
tags question: http://stackoverflow.com/q/21168627
tags question: http://stackoverflow.com/q/21079997
tags question: http://stackoverflow.com/q/21115826
tags question: http://stackoverflow.com/q/21167690
tags question: http://stackoverflow.com/q/21105919
tags question: http://stackoverflow.com/q/21177778
tags question: http://stackoverflow.com/q/21171888
tags question: http://stackoverflow.com/q/21076399
tags question: http://stackoverflow.com/q/21104838
tags question: http://stackoverflow.com/q/21179690
tags question: http://stackoverflow.com/q/21153092
tags question: http://stackoverflow.com/q/21129998
tags question: http://stackoverflow.com/q/21064253
tags question: http://stackoverflow.com/q/21060519
tags question: http://stackoverflow.com/q/21110379
tags question: http://stackoverflow.com/q/21075552
tags question: http://stackoverflow.com/q/21178851
tags question: http://stackoverflow.com/q/21035586
tags question: http://stackoverflow.com/q/21091882
tags question: http://stackoverflow.com/q/21020107
tags question: http://stackoverflow.com/q/21128836
tags question: http://stackoverflow.com/q/21064753
tags question: http://stackoverflow.com/q/21057827
tags question: http://stackoverflow.com/q/21108353
tag name: string
tags question: http://stackoverflow.com/q/21076074
tags question: http://stackoverflow.com/q/21161897
tags question: http://stackoverflow.com/q/21113857
tags question: http://stackoverflow.com/q/21151732
tags question: http://stackoverflow.com/q/21113641
tags question: http://stackoverflow.com/q/21019571
tags question: http://stackoverflow.com/q/21081553
tags question: http://stackoverflow.com/q/21021515
tags question: http://stackoverflow.com/q/21063232
tags question: http://stackoverflow.com/q/21043362
tags question: http://stackoverflow.com/q/21165802
tags question: http://stackoverflow.com/q/21169863
tags question: http://stackoverflow.com/q/21059328
tags question: http://stackoverflow.com/q/21168276
tags question: http://stackoverflow.com/q/21025199
tags question: http://stackoverflow.com/q/21103440
tags question: http://stackoverflow.com/q/21147673
type: Tag
tags question: http://stackoverflow.com/q/21098931
tags question: http://stackoverflow.com/q/21112374
tags question: http://stackoverflow.com/q/21074214
tags question: http://stackoverflow.com/q/21134323
tags question: http://stackoverflow.com/q/21119050
tags question: http://stackoverflow.com/q/21096929
tags question: http://stackoverflow.com/q/21182734
tags question: http://stackoverflow.com/q/21048360
tags question: http://stackoverflow.com/q/21057262
tags question: http://stackoverflow.com/q/21094049
tags question: http://stackoverflow.com/q/21093034
tags question: http://stackoverflow.com/q/21119197
tags question: http://stackoverflow.com/q/21161001
tags question: http://stackoverflow.com/q/21119012
tags question: http://stackoverflow.com/q/21080166
tags question: http://stackoverflow.com/q/21068463
tags question: http://stackoverflow.com/q/21101153
tags question: http://stackoverflow.com/q/21037104
tags question: http://stackoverflow.com/q/21055009

http://stackoverflow.com/comment/31880361
type: QuestionComment
has text: Wow! 4 answers submitted within a span of 3 seconds.
comment on: http://stackoverflow.com/q/21175835
score: 0
type: Comment

http://stackoverflow.com/q/21180269
tagged with: methods
type: Question
has title: How to achieve method chaining in Java?
has comment: http://stackoverflow.com/comment/31888687
possible better answer: http://stackoverflow.com/a/37955843
upvote count: 59
has body: I want to achieve method chaining in Java. How can I achieve it? Also let me know when to use it. public class Dialog { public Dialog() { } public void setTitle(String title) { //Logic to set title in dialog } public void setMessage(String message) { //Logic to set message } public void setPositiveButton() { //Logic to send button } } I want to create method chaining that I can use as follows: new Dialog().setTitle("Title1").setMessage("sample message").setPositiveButton(); or like new Dialog().setTitle("Title1").setMessage("sample message"); or like new Dialog().setTitle("Title1").setPositiveButton();
has answer: http://stackoverflow.com/a/63651011
tagged with: chaining
favorite count: 0
has comment: http://stackoverflow.com/comment/123612884
has comment: http://stackoverflow.com/comment/31887713
has answer: http://stackoverflow.com/a/21180314
accepted answer: http://stackoverflow.com/a/21180314
has answer: http://stackoverflow.com/a/29625931
linked to: http://stackoverflow.com/q/15054237
has answer: http://stackoverflow.com/a/37955843
answer count: 4
type: AnsweredQuestion
score: 59
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/63359963

http://stackoverflow.com/q/21075453
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 2
tagged with: client-server
answer count: 1
has answer: http://stackoverflow.com/a/21075566
accepted answer: http://stackoverflow.com/a/21075566
tagged with: java-io
favorite count: 0
has body: I have server ServerSocket socketListener = new ServerSocket(Config.PORT); ... client = socketListener.accept(); and client sock = new Socket("127.0.0.1", Config.PORT); I want to transfer between them some serialized data using ObjectInputStream and ObjectOutputStream. When I try to do ObjectInputStream inputStream = new ObjectInputStream(socket.getInputStream()); Nothing happens neither on the server side nor client side. Everything falls on that line. Both the client and the server is trying to get the input stream from the socket, but it does not work nor the client nor the server. How do I solve this problem so that I can pass the serialized data between client and server?
downvote count: 0
tagged with: sockets
tagged with: multithreading
has title: ObjectInputStream from socket.getInputStream()
score: 2

http://stackoverflow.com/q/21175287
type: Question
has answer: http://stackoverflow.com/a/21196677
score: 0
answer count: 2
has title: Java Google API oauth2 REDIRECT URI options
has answer: http://stackoverflow.com/a/21176471
has body: I am writing a desktop app using the Java API for google. I can authenticate using oauth2 and a REDIRECT URI of : urn:ietf:wg:oauth:2.0:oob which will give the user a code to copy paste back into my application. I would rather have a better workflow than that though, and replace the REDIRECT URI with http://localhost:8080/myreceiver - or something similar which I believe is valid. My question is - what is the best way to easily bring up a Java based webserver at an address like that allowing me to automatically receive this code and continue oauth2 authentication? Does part of the google api give anything to help here? Or should I be looking at a standard Java based web server like http://tjws.sourceforge.net/ or otherwise? Any opinions would help me out a lot!
tagged with: google-drive-api
type: UnansweredQuestion
tagged with: java
tagged with: oauth-2.0

http://stackoverflow.com/comment/31884046
has text: I think this would give 50% wieghtage to outcome one an 25, 25 % to outcome 2 and outcome 3 respectively
type: AnswerComment
comment on: http://stackoverflow.com/a/21177932
type: Comment
score: 0

http://stackoverflow.com/comment/31641779
type: Comment
type: QuestionComment
has text: Just take a look [here](http://blog.soebes.de/blog/2014/01/02/version-information-into-your-appas-with-maven/).
score: 1
comment on: http://stackoverflow.com/q/21045007

http://stackoverflow.com/comment/31676221
type: QuestionComment
comment on: http://stackoverflow.com/q/21056567
has text: Hi! Thanks for your comments, anyway I'm still getting the same errors... I'm going to update the initial post to show you the complete code
score: 0
type: Comment

http://stackoverflow.com/q/21022821
tagged with: date
has comment: http://stackoverflow.com/comment/31600312
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21023719
has comment: http://stackoverflow.com/comment/31600078
has comment: http://stackoverflow.com/comment/31600159
possible better answer: http://stackoverflow.com/a/21023719
has comment: http://stackoverflow.com/comment/31600173
has title: Formatting date and time inputs into Date object
has body: Using HTML for client side and JAVA for server side, Im trying to convert two text inputs into a Date object in java. my first input should hold the date in format DD/MM/YYYY and my second should have time HH:MM formatted. What ive tried was using input type="text" for both, but im unable to form the object properly on the server's side. Could you please provide me a simple example for doing that properly? Please ignore any validations and of course and you can assume my main problem is the parsing itself.
tagged with: http://stackoverflow.com/tag/html
tagged with: input
has answer: http://stackoverflow.com/a/21023186
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21023186
has comment: http://stackoverflow.com/comment/31600233
type: Question
tagged with: java

http://stackoverflow.com/comment/31782979
type: QuestionComment
comment on: http://stackoverflow.com/q/21121891
score: 0
type: Comment
has text: @SotiriosDelimanolis Does it matter which file I should that tag on? Or should I put it on all the files with definitions I suspect are getting proxied?

http://stackoverflow.com/q/21131858
has comment: http://stackoverflow.com/comment/31799953
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
tagged with: eclipse
type: Question
score: 0
has answer: http://stackoverflow.com/a/21133203
accepted answer: http://stackoverflow.com/a/21133203
has body: I'm practicing Android programming, which uses Java/XML. As for the code below: the method I'm having trouble with is OBClicked. OBClicked is a method from an interface I defined in ShareFragment (which contains a checkbox, and a button which launches TextFragment). I did this, because from what I have learned, defining an interface in a fragment and overriding the interface in the hosting activity is a good way to make it possible to transfer that information to another fragment. In this case, I override the OBClicked method in MainActivity to tell TextFragment (which is just a TextView) whether the CheckBox from ShareFragment is checked. Depending on whether it's checked, I try to tell TextFragment to dispaly certain text using setText, however this crashes the program. Here's the code, any help would be greatly appreciated. : MainActivity: public class MainActivity extends FragmentActivity implements ShareFragment.ClickListener{ @Override public void oBClicked(boolean x){ FragmentManager fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); TextView t = (TextView)findViewById(R.id.text_view); if(x == true){ t.setText("The box is checked"); }else{ t.setText("The box isn't checked"); } Fragment fragment = new TextFragment(); ft.replace(R.id.fragmentContainer, fragment); ft.addToBackStack(null); ft.commit(); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); FragmentManager fm = getSupportFragmentManager(); Fragment fragment = fm.findFragmentById(R.id.fragmentContainer); if(fragment == null){ fragment = new ShareFragment(); } FragmentTransaction ft = fm.beginTransaction(); ft.add(R.id.fragmentContainer, fragment); ft.commit(); } @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; } } ShareFragment: public class Sha…
answer count: 1
has comment: http://stackoverflow.com/comment/31799952
tagged with: view
has comment: http://stackoverflow.com/comment/31800476
tagged with: android
has title: My Android program crashes when I use the setText method

http://stackoverflow.com/a/21161988
accepted answer of: http://stackoverflow.com/q/21044465
score: 2
upvote count: 2
has body: Try this in your manifest: Add a meta-data pointing to the SearchActivity in the tag of the Activity where search is started Move the searchable tag to the SearchAvtivity Add launchMode="singleTop" to the SearchActivity to make sure there's only one instance of it at top of the stack. New search intents will come in trough onNewIntent which you already implemented. &lt;meta-data android:name="android.app.searchable" android:resource="@xml/searchable" /&gt; &lt;/activity&gt; &lt;activity android:name="it.polimi.dima.sound4u.activity.MyGiftsActivity" android:label="@string/title_activity_my_gifts" &gt; &lt;meta-data android:name="android.app.default_searchable" android:value="it.polimi.dima.sound4u.activity.SoundSearchActivity"/&gt; The initial guide by Google (found here) didn't give me a working SearchView either, but making theses changes did.
answers question: http://stackoverflow.com/q/21044465
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/21045013
answers question: http://stackoverflow.com/q/21044882
score: 0
type: Answer
has body: .sh is a a shell script, most likely the default shell for a linux system, i.e. bash, so no, it won't run on your Windows machine. You can try Cygwin shell but still there is no guarantee that it will run. You will have to rewrite it for Windows batch script or your some other scripting language. As far as Java is concerned, you can write in Linux and the code is portable to any other machine supporting JavaVM.

http://stackoverflow.com/comment/31694450
has text: Updated: <permission android:name="com.example.gps2.permission.MAPS_RECEIVE" android:protectionLevel="signature" />
type: Comment
comment on: http://stackoverflow.com/a/21074445
score: 0
type: AnswerComment

http://stackoverflow.com/a/21173166
answers question: http://stackoverflow.com/q/21026323
upvote count: 1
downvote count: 0
score: 1
has body: Weld is the reference implementation of the JSR-299 which brings CDI in JavaEE 6. This reference implementation is included in Glassfish so you can effectively use it. Example from Oracle found here: @Named public class SimpleItemReader extends AbstractItemReader { @Inject private JobContext jobContext; ... } Quote: I never used Weld Here the implementation doesn't matter because, it just implements the specification of the JSR.
type: Answer

mapreduce
tags question: http://stackoverflow.com/q/21020562
type: Tag
tags question: http://stackoverflow.com/q/21170222
tags question: http://stackoverflow.com/q/21107452
tags question: http://stackoverflow.com/q/21180120
tags question: http://stackoverflow.com/q/21136901
tags question: http://stackoverflow.com/q/21040166
tags question: http://stackoverflow.com/q/21027366
tags question: http://stackoverflow.com/q/21072446
tag name: mapreduce
tags question: http://stackoverflow.com/q/21137168
tags question: http://stackoverflow.com/q/21177715
tags question: http://stackoverflow.com/q/21098740
tags question: http://stackoverflow.com/q/21133013

http://stackoverflow.com/q/21134429
has title: GWT 2.6 - Java 6 conflict
tagged with: java
type: Question
tagged with: java-7
answer count: 1
has body: I'm trying to migrate to gwt 2.6 in a project compiled using java 6 The project is made of a library based on gwt and a gwt application. When launching my app I get a "javascriptObject major.minor 51.0 exception" I know that it's because of gwt 2.6 built in java 7 So I added 1.6 to my maven gwt plugin But nothing changed, because I suppose that still persists the problem in the library side. (Library compiled in java 6 with a GWT dependency in java7) Have you got any Idea on how to inidicate sourceLevel while building my lib? Thanks
score: 0
has answer: http://stackoverflow.com/a/21134635
tagged with: java-6
tagged with: maven
accepted answer: http://stackoverflow.com/a/21134635
tagged with: gwt
type: AnsweredQuestion

http://stackoverflow.com/comment/31691055
comment on: http://stackoverflow.com/q/21045049
type: QuestionComment
type: Comment
has text: @noone I knw sir this is a micro optimization. but making games for LDPI i have to take such optimizations into account.Well anyway i found my method very efficient .thanx to you guys ...
score: 0

http://stackoverflow.com/a/21054634
has body: You must put the code to return in the onOptionsItemSelected of your ActionBarActivity. Here you can find more information. @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: //Close current activity finish(); return true; default: return super.onOptionsItemSelected(item); } }
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21054411
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21054411

http://stackoverflow.com/comment/31626809
has text: Thanks Kaustubh, it seems nice and simple, but I can't find a way to fit it into my existing code. I already have a date variable in my Crime.java file, and if I change that I don't know what consequences it will have. I have to find a way to fit code into this one line: `mDateButton.setText(mCrime.getDate().toString());` since that is where the timestamp is currently. The mDateButton is where the new date will go, so I have to preserve the functionality of that line somehow. I can't use `System.out.printlin();` either since the code must go on that button.
comment on: http://stackoverflow.com/a/21037173
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21175649
tagged with: awt
has title: Why is my code not recognizing the addActionListener(ActionListener e) method?
tagged with: events
type: UnansweredQuestion
type: Question
tagged with: actionlistener
has answer: http://stackoverflow.com/a/21191270
has body: My Problem Compiling this class in NetBeans for Java. I'm trying to simply add an ActionListener to each JPanel. However, when I type in the code: `addActionListener(new SquareMouseListener);` I get the error: Cannot Find Symbol; method addActionListener(MinePanel.SquareMouseListener) location: class MinePanel Here is the full code: import java.awt.Color; import java.awt.Graphics; import java.awt.event.*; import javax.swing.JPanel; public class MinePanel extends JPanel{ final private int xPos, yPos; final private int numXPanels, numYPanels; final private boolean isBomb; private MineFrame holderFrame; private boolean seen; public MinePanel(int xPos, int yPos, int numXPanels, int numYPanels, MineFrame holderFrame) { this.xPos = xPos; this.yPos = yPos; this.numXPanels = numXPanels; this.numYPanels = numYPanels; if(Math.random()&lt;.1) { isBomb = true; } else isBomb = false; seen = false; this.holderFrame = holderFrame; addActionListener(new SquareMouseListener()); } @Override public void paint(Graphics g) { //Color thisColor = new Color((float)Math.random(), (float)Math.random(), (float)Math.random()); g.setColor(Color.BLACK); g.fillRect(0,0,getWidth(),getHeight()); g.setColor(Color.LIGHT_GRAY); g.fillRect(1,1,getWidth()-2,getHeight()-2); } private class SquareMouseListener implements ActionListener { @Override public void actionPerformed(ActionEvent ae) { System.out.println("Action Performed"); } } } What can I do? Netbeans tells me to import: import static com.sun.java.accessibility.util.AWTEventMonitor.addActionListener; but I know that's not right because I tried it and it didn't work, and because addActionListener should be included in java.awt.event.*; import above. Thanks in advance!
has comment: http://stackoverflow.com/comment/31880161
tagged with: java
has answer: http://stackoverflow.com/a/21175679
tagged with: import
score: 0
answer count: 2

http://stackoverflow.com/a/77230261
answers question: http://stackoverflow.com/q/21180434
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/136152455
has comment: http://stackoverflow.com/comment/136189510
upvote count: 0
score: -1
has body: Use ("dd/MM/yyyy hh:mm:ss tt") for AM/PM

http://stackoverflow.com/comment/31869851
has text: No, the description was *not* all right. By the description, you wanted one behaviour for version 11 and lower, and another for strictly greater than 11. Your code shows one behaviour for version 11 and higher, and another for strictly lower than 11. There's nothing contextual about that, and I'm perfectly capable of reading properly. If you're going to be rude to people who are trying to help you (and trying to help you get help from others), you're less likely to receive the help you're looking for.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21169004

http://stackoverflow.com/q/21116395
score: 0
tagged with: java
tagged with: dependency-injection
has comment: http://stackoverflow.com/comment/31772346
tagged with: guice
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6970920
has title: Guice bind toInstance equality in Spring Dependency Injection
type: Question
has answer: http://stackoverflow.com/a/21117682
has comment: http://stackoverflow.com/comment/31772732
tagged with: spring
answer count: 1
has body: i will explain the situation with an example. For instance i have a Settings class and i'm configuring some hostname,port information there. Like: public class Settings { @Inject private User user; In guice i can handle this with: private Injector injector; public void setInjector(){ injector=Guice.createInjector( new AbstractModule(){ @Override protected void configure(){ bind( User.class ).toInstance(user); } } } When someone use @Inject User user then my code give him only my instance, i mean there's only one user instance whereever developer create a user instance with Inject. How can i achieve this in spring can someone explain me ? Note that: I just know there's an @Autowired annotation but how to achive this, is confusing :S Thanks in advance BTW: I couldn't get the point that mentioned here

http://stackoverflow.com/q/21108925
tagged with: maven
type: Question
tagged with: ant
tagged with: java
score: 0
has body: I want to use the following maven-script to sign my jars for a webstart application: false org.apache.maven.plugins maven-antrun-plugin 1.3 signWebJars package run <mkdir dir="${project.build.directory}/signedjars" /> <signjar destDir="${project.build.directory}/signedjars" tsaurl="http://timestamp.my-tsa-url.com" alias="server" keystore="src/main/assembly/MyKeystore.jks" storepass="password" preservelastmodified="true" lazy="true"> <fileset dir="${project.build.directory}/dependenciesForSign" includes="*.jar" /> As I am behind a proxy I configured one in the settings.xml and maven can access to the internet. Now I need to contact the tsaurl of the certificate authority. But for the given ant tasks this is not working: [signjar] jarsigner: unable to sign jar: no response from the Timestamping Authority. When connecting from behind a firewall then an HTTP proxy may need to be specified. Supply the following options to jarsigner: [signjar] -J-Dhttp.proxyHost=<hostname> [signjar] -J-Dhttp.proxyPort=<portnumber> I tried to provide the proxy information to the ant task but this was not working. In the manual of the Ant Signjar Task I just found: Ant does not yet support proxy setup for this signing process. How may I get this working? Or do you suggest another way to sign all jars in a folder - of course with proxy support?
answer count: 1
has comment: http://stackoverflow.com/comment/56563653
tagged with: proxy
has title: Specifiying proxy to sign jars with maven with maven-antrun-plugin
has comment: http://stackoverflow.com/comment/56620979
tagged with: maven-antrun-plugin
has answer: http://stackoverflow.com/a/21729703
type: UnansweredQuestion

http://stackoverflow.com/q/21181125
type: Question
linked to: http://stackoverflow.com/q/8669693
has comment: http://stackoverflow.com/comment/31889335
has answer: http://stackoverflow.com/a/21181280
tagged with: java
has answer: http://stackoverflow.com/a/21181159
has comment: http://stackoverflow.com/comment/31898571
has comment: http://stackoverflow.com/comment/31889529
has comment: http://stackoverflow.com/comment/31889967
downvote count: 0
possible better answer: http://stackoverflow.com/a/21181150
accepted answer: http://stackoverflow.com/a/21181147
tagged with: polymorphism
has answer: http://stackoverflow.com/a/21181150
favorite count: 0
has body: I found a class like this: public class Computer implements Serializable { private static final long serialVersionUID = 1L; //... public Computer() { super(); } //... } Can someone explain me, how this works? The class isn't inheriting any super class and there could still be "super();" in the constructor?
answer count: 5
has title: super-constructor if there is no super class?
has comment: http://stackoverflow.com/comment/31889265
upvote count: 6
has comment: http://stackoverflow.com/comment/31889139
linked to: http://stackoverflow.com/q/2490875
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/134726488
has answer: http://stackoverflow.com/a/21181269
score: 6
has comment: http://stackoverflow.com/comment/31898220
linked to: http://stackoverflow.com/q/13572468
has answer: http://stackoverflow.com/a/21181147

http://stackoverflow.com/q/21084054
score: 4
has body: So, I recently switched from Eclipse to IntelliJ Idea, but for some reason when I run my java code, it can't find the directory where I store a file that I read in my program. I know that it works in Eclipse and when I export it as a jar file, so why doesn't it work in IntelliJ Idea? The specific error message is java.io.FileNotFoundException: /Users/Tyler/Google Drive/Java/Mac Workspace/maps/default.txt (No such file or directory)
has answer: http://stackoverflow.com/a/21084532
answer count: 1
downvote count: 0
tagged with: directory
favorite count: 0
has comment: http://stackoverflow.com/comment/31712775
has title: IntelliJ Idea can't find directory
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31712815
type: Question
upvote count: 4
tagged with: filenotfoundexception
accepted answer: http://stackoverflow.com/a/21084532
has comment: http://stackoverflow.com/comment/31712947
tagged with: intellij-idea

http://stackoverflow.com/a/21020730
type: Answer
score: 0
has body: Basically you already solved it. The bytes are arranged in little endian notation, meaning that the most significant byte (192) is at the last position. What you expect is big endian, which is used by "the humans". You might read about Endianness here. Just reverse the order in which you extract each byte and you're done.
answers question: http://stackoverflow.com/q/21020558

http://stackoverflow.com/a/21052883
accepted answer of: http://stackoverflow.com/q/21050502
answers question: http://stackoverflow.com/q/21050502
has comment: http://stackoverflow.com/comment/31678441
has comment: http://stackoverflow.com/comment/31677679
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31678043
upvote count: 2
has body: At the first glance haven't seen so much. But looking at the Type Conversion Error Handling I'd say that there's a way to handle conversion errors. By adding a conversion validator to the configuration which is short-circuit validator. Short-circuit means that if such validator has errors other validators are skipped. conversionErrorFields = @ConversionErrorFieldValidator(fieldName = "price", message = "Price has invalid value", shortCircuit = true) place this code under @Validations annotation.
score: 2

http://stackoverflow.com/comment/31734746
type: QuestionComment
comment on: http://stackoverflow.com/q/21096036
type: Comment
has text: Your CORBA client expects a real IOR so your dummy server has to provide a real IOR to the client. This can be done by creating a real CORBA server to test your client, you can't just create a text string and assume an existing CORBA client to accept that.
score: 0

http://stackoverflow.com/a/21172572
has body: It throws an NPE not because it's empty, it's null. A trivial null check should do. Consider: private String generateURL( final String hostIPAdress ) { StringBuilder url = new StringBuilder(); url.append( "http://" ).append( hostIPAdress ) .append( ":8080/user?userid=" ).append( keys.getUserId() ) .append( "&amp;client_id=" ).append( keys.getClientId() ); if( keys.getDataMap() == null ) { return url.toString(); } for( Entry&lt; String, String &gt; e : keys.getDataMap().entrySet() ) { url.append( '&amp;' ).append( e.getKey() ).append( '=' ).append( e.getValue() ); } return url.toString(); }
upvote count: 1
answers question: http://stackoverflow.com/q/21172419
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31874859
type: Answer

http://stackoverflow.com/q/21155010
has comment: http://stackoverflow.com/comment/31847016
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31842573
tagged with: spring-transactions
type: Question
accepted answer: http://stackoverflow.com/a/21157946
has comment: http://stackoverflow.com/comment/31844640
has title: Spring 3 : @Autowired dao fields are null in service beans with @Transactional annotation
downvote count: 0
favorite count: 0
tagged with: spring-aop
answer count: 1
has comment: http://stackoverflow.com/comment/31843044
has answer: http://stackoverflow.com/a/21157946
upvote count: 1
tagged with: spring
type: AnsweredQuestion
has body: I code to interfaces as follows : DAO interface : public interface SampleTblDao extends BaseDao&lt;SampleTbl&gt; { /** * * @param mapper * @param sampleKey * @return * @throws DataAccessException */ public SampleTbl selectSampleTbl(SampleKey sampleKey) throws DataAccessException; } DAO implementation public class SampleTblDaoImpl extends AbstractBaseDao&lt;SampleTbl, SampleTblMapper&gt; implements SampleTblDao { public SampleTblDaoImpl() { super(SampleTblMapper.class); } @Override public SampleTbl selectSampleTbl(SampleKey sampleKey) throws DataAccessException { return getSqlSession().getMapper(SampleTblMapper.class).selectSampleTbl(sampleKey); } } Business-logic interface : public interface SampleBusinessLogic { /** * * @param sample * @return * @throws SampleException */ public Sample createSample(Sample sample) throws SampleException; /** * * @param sample * @return * @throws SampleException */ public Sample updateSample(Sample sample) throws SampleException; /** * @param sampleKey * @return * @throws SampleException */ public Sample getSample(SampleKey sampleKey) throws SampleException; } Business-logic implementation : public class SampleBusinessLogicImpl implements SampleBusinessLogic { /** * sample table dao */ @Autowired @Qualifier(value = "sampleTblDao") private SampleTblDao sampleTblDao; @Override @Transactional(rollbackFor = Exception.class) public Sample createSample(Sample sample) throws SampleException { try { // sample table createSampleTbl(sample.getSampleTbl()); } catch (Exception e) { List &lt; String &gt; messageList = new ArrayList &lt; String &gt; (); String message = "{createSample : " + "{itemId=" + sample.getSampleTbl().getItemId() + "}," + "{itemName=" + sample.getSampleTbl().getItemName() + "}}"; messageList.add("createShop system error"); throw new SampleException(message, messageList, e); } return sample; } @Override @Transactional(rollbackFor = Exception.class) public Sample updateSample(Sample sample) throws SampleException { List &lt; …

http://stackoverflow.com/comment/31831274
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21148766
score: 0
has text: What are you trying to do?

http://stackoverflow.com/comment/31850694
has text: have added snapshot of manifest file
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21159636
score: 0

http://stackoverflow.com/a/45218420
type: Answer
answers question: http://stackoverflow.com/q/21165469
has body: maybe I have same problem like you. This code worked for me using KeyListener. //define KeyAdapter variable at header KeyAdapter key1, key2; make class TableEditor like this: final class TableEditor extends DefaultCellEditor{ public TableEditor(){ super(new JTextField()); setClickCountToStart(1); } @Override public Component getTableCellEditorComponent(final JTable table,Object value,boolean isSelected,final int row,final int column){ final JTextField cellEdit = (JTextField) super.getTableCellEditorComponent(table,value,isSelected,row,column); cellEdit.setText((String)value); table.setSurrendersFocusOnKeystroke(true); //remove previous keyListener that store in memory cellEdit.removeKeyListener(key1); cellEdit.removeKeyListener(key2); // KeyAdapter that accept numeric only (key1) key1 = new KeyAdapter() { @Override public void keyPressed(KeyEvent evt){ // just for check how much times Enter keyEvent store in memory if(evt.getKeyCode()==KeyEvent.VK_ENTER) System.out.println("enter 2"); } @Override public void keyReleased(KeyEvent evt){ } @Override public void keyTyped(KeyEvent evt){ char c = evt.getKeyChar(); if (!Character.isDigit(c)) evt.consume(); } }; // KeyAdapter that accept all char (key2) key2 = new KeyAdapter() { @Override public void keyPressed(KeyEvent evt){ // just for check how much times Enter keyEvent store in memory if(evt.getKeyCode()==KeyEvent.VK_ENTER) System.out.println("enter 2"); } @Override public void keyReleased(KeyEvent evt){ } @Override public void keyTyped(KeyEvent evt){ } }; // cell column 3rd accept numeric only &gt; addKeyListener(key1) if (column == 3) { cellEdit.addKeyListener(key1); cellEdit.setHorizontalAlignment(javax.swing.JTextField.RIGHT); cellEdit.setCaretPosition(1); return cellEdit; } // other cell accept all char &gt; addKeyListener(key2) else { cellEdit.addKeyListener(key2); cellEdit.setHorizontalAlignment(javax.swing.JTextField.LEFT); return cellEdit; } } } Then call the class using: MyTable.setDefaultEditor(Object.class, …
score: 0

http://stackoverflow.com/a/21086625
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: You can use the Jenkins API over XML: import org.dom4j.io.*; import org.dom4j.*; import java.net.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { URL url = new URL("http://your-hudson-server.local/hudson/api/xml"); Document dom = new SAXReader().read(url); for( Element job : (List&lt;Element&gt;)dom.getRootElement().elements("job")) { System.out.println(String.format("Job %s has status %s", job.elementText("name"), job.elementText("color"))); } } } A complete example (with sources) can be found here. If these examples don't work, you might have problems with Jenkins Security (your client must provide login data before it can send the request)or with CSRF protection (you have to retrieve a token before the first request and add this token as a parameter to each request).
has comment: http://stackoverflow.com/comment/31730297
score: 1
has comment: http://stackoverflow.com/comment/31729409
accepted answer of: http://stackoverflow.com/q/21086380
answers question: http://stackoverflow.com/q/21086380
upvote count: 1

http://stackoverflow.com/comment/31717333
type: AnswerComment
comment on: http://stackoverflow.com/a/21086742
has text: @user1702529: parameters are indeed passed by value. But what is passed is not an object or an array, but a *reference to an object* or a *reference to an array*. If you assign another array to the list argument, the variable in the main method won't be affected.
type: Comment
score: 3

http://stackoverflow.com/comment/31626818
score: 0
type: Comment
has text: Yup. And because that's too short to be a comment, double yup.
comment on: http://stackoverflow.com/a/21037111
type: AnswerComment

http://stackoverflow.com/comment/31730806
comment on: http://stackoverflow.com/q/21094049
has text: @GriffeyDog Good catch. BobbyD17's answer below seems like a good solution.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31811243
has text: @AndrewStewart : I think laalto's answer is the one you are looking for...
comment on: http://stackoverflow.com/q/21138198
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21050626
favorite count: 0
has comment: http://stackoverflow.com/comment/31650402
tagged with: multidimensional-array
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21050667
downvote count: 1
type: Question
tagged with: java
has title: Getting the position of an element in a 2D array in java
has body: Im trying to work out how to find the position of an element in a 2D array. public static void checkTemps(double[][] arrayOfTemps) { for (int a=0;a&lt;4;a++) { for(int b=0;b&lt;3;b++) { if((arrayOfTemps[a][b]&lt;395) || (arrayOfTemps[a][b] &gt;405)) { System.out.println(arrayOfTemps[a][b]+" is faulty"); } } } } That is what I have so far. I need to work out which position in the array is faulty, if it is below 395 or above 405. I know that this will return a number then ' is faulty' but its what I have so far.
score: -1
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/21050667

http://stackoverflow.com/a/21023083
score: 0
has body: EclipseLink by default validates primary keys and interprets 0 the same as Null and unset values, and so will generate a primary key value. So you can set values as have them used, they just must be greater than 0 by default. This is configurable through the primary key validation policy as described here: http://eclipse.org/eclipselink/documentation/2.4/jpa/extensions/a_primarykey.htm If 0 is a valid primary key, you will can set the property: &lt;property name="eclipselink.id-validation" value="NULL"/&gt;
type: Answer
answers question: http://stackoverflow.com/q/21018694

http://stackoverflow.com/q/21041259
type: Question
has answer: http://stackoverflow.com/a/21041349
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/21041388
has answer: http://stackoverflow.com/a/21041642
has answer: http://stackoverflow.com/a/21041391
favorite count: 0
possible better answer: http://stackoverflow.com/a/21041349
tagged with: android
answer count: 4
has body: i need to create a background thread , that check for information from Server on every 20 minutes and make notification if we have news. Any ideas how to do it? Thanks in advance!
type: AnsweredQuestion
upvote count: 0
has title: Background worker for android to be always
downvote count: 1
accepted answer: http://stackoverflow.com/a/21041642

http://stackoverflow.com/q/21138818
has comment: http://stackoverflow.com/comment/31812168
tagged with: java
has body: I have been wondering: Why doesn't the paint() method generate a StackOverflowError? I know that paint() must run repeatedly in the background, but what restricts it to only calling it at a speed which the computer can handle without generating the StackOverflowError? So that it doesn't repeat paint() to the point of using too much memory?
has comment: http://stackoverflow.com/comment/31812093
accepted answer: http://stackoverflow.com/a/21138904
has comment: http://stackoverflow.com/comment/31812200
answer count: 1
tagged with: stack-overflow
has title: Why doesn't paint() make StackOverflowError?
favorite count: 0
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/214741
upvote count: 3
has answer: http://stackoverflow.com/a/21138904
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31812243

http://stackoverflow.com/comment/31805254
has text: @realProgrammer No, actually you mentioned "to"...Is the content of the window opaque or not?
comment on: http://stackoverflow.com/q/21134488
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/53123508
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21028507
has text: Thanks for the mention of renaming the .jnilib to .dylib. This worked for me! I'm using Hiero for SDF font rendering with https://www.npmjs.com/package/three-bmfont-text

http://stackoverflow.com/comment/107249067
type: Comment
has text: it will improve exec time
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/60620855

http://stackoverflow.com/q/21156756
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has answer: http://stackoverflow.com/a/21157226
has answer: http://stackoverflow.com/a/21157132
has answer: http://stackoverflow.com/a/21156842
tagged with: android
answer count: 4
linked to: http://stackoverflow.com/q/8018931
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/21156830
has body: 01-16 08:16:19.210: W/System.err(1394): org.json.JSONException: Value {"GetDoctorsListResult":[ {"Name":"Sujay Sharma","DoctorID":154,"Clinics":null,"speciality":"Allergy and immunology","Locality":"Mumbai","Address":"Abcc Building "} ,{"Name":"Samir Tapiawala","DoctorID":159,"Clinics":null,"speciality":"Homeopath","Locality":"Mumbai","Address":"57\/101, Jawahar Nagar RD. NO. 6, GOREGAON WEST "} ,{"Name":"Sahil Kuma","DoctorID":171,"Clinics":null,"speciality":"Aerospace Medicine","Locality":"Mumbai","Address":"Digvija "} ,{"Name":"Himesh Jagtap","DoctorID":180,"Clinics":null,"speciality":"Bariatric Surgery","Locality":"Mumbai","Address":"Abc- Society "} ,{"Name":"Aarnav Prabhudesai","DoctorID":190,"Clinics":null,"speciality":"Dentistry","Locality":"Mumbai","Address":"Joyvilla Jawahar Nagar "} ,{"Name":"Neeharika Saxana","DoctorID":197,"Clinics":null,"speciality":"Gynaecologist","Locality":"Mumbai","Address":"Joyvilla, Jawahar Nagar "} ,{"Name":"Neeharika Saxena","DoctorID":205,"Clinics":null,"speciality":"Gynaecologist","Locality":"Mumbai","Address":"Joyvilla "} ,{"Name":"Ravi Sharma","DoctorID":207,"Clinics":null,"speciality":"Ayurvedacharya","Locality":"Mumbai","Address":"Q\/02 "} ,{"Name":"Prashant Bhatt","DoctorID":209,"Clinics":null,"speciality":"Dentistry","Locality":"Mumbai","Address":"202 Anand Vihar , Bldg No-2 , D-wing , Bhawani Chowk , b--cabin Road , Ambernath(e). Bhawani Chowk"} ,{"Name":"Samidha Sen","DoctorID":210,"Clinics":null,"speciality":"Addiction Medicine","Locality":"Mumbai","Address":"S\/09 "} ,{"Name":"Subodh Mehta","DoctorID":212,"Clinics":null,"speciality":"Orthopaedic Surgery","Locality":"Mumbai","Address":"Opera "}]} of type org.json.JSONObject cannot be converted to JSONArray here is my activity code: class DownloadTask extends AsyncTask&lt;String, Void, Object&gt; { protected Boolean doInBackground(String... params) { try { Thread.sleep(4000); // Do your real work here } catch (InterruptedException e) { e.printStackTrace(); } return tru…
has title: json object cannot be converted to jsonarray in android
linked to: http://stackoverflow.com/q/12722468

http://stackoverflow.com/q/21086647
has comment: http://stackoverflow.com/comment/31717097
downvote count: 1
has comment: http://stackoverflow.com/comment/31717964
type: Question
has title: NotSerializableException: Not sure what the reason is
tagged with: java
has comment: http://stackoverflow.com/comment/31718428
has comment: http://stackoverflow.com/comment/31718099
has body: Here is part of code I think is relevant for this question. //Enveloping class public class BackupSMS implements Serializable{ transient Cursor cursor; String vfile; transient Context mContext; private final String TAG = "BackupSMS"; SMSBackup smsBackup; transient FileOutputStream mFileOutputStream; public BackupSMS(Context context, String _vfile) { mContext = context; vfile = _vfile; smsBackup = new SMSBackup(); } Inner classes: public class SMSBackup implements Serializable{ public ArrayList&lt;SMSObject&gt; SMSList; public SMSBackup() { SMSList = new ArrayList&lt;SMSObject&gt;(); } } public class SMSObject implements Serializable{ private String id; private String addr; private String msg; .... (more private strings and getter setter methods for them) } //method of enveloping class. public void writeSMSList(){ ...... mFileOutputStream = mContext.openFileOutput(vfile, Context.MODE_PRIVATE); ObjectOutputStream oos = new ObjectOutputStream(mFileOutputStream); //smsBackup is an object of SMSBackup class created earlier. oos.writeObject( smsBackup ); oos.close(); ....... } I don't seem to find any unserializable object in the picture. Any advice as what is going wrong will help. EDIT: I didn't look close enough at the stack trace. Below is the stack trace I obtained but it is still not taking me any closer to a solution. Any suggestions? java.io.NotSerializableException: android.content.ContentResolver$CursorWrapperInner at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1364) at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481) at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979) at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368) at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074) at java.io.ObjectOutputStream…
has answer: http://stackoverflow.com/a/21087483
has comment: http://stackoverflow.com/comment/31718469
upvote count: 0
answer count: 1
favorite count: 0
tagged with: serialization
tagged with: android
accepted answer: http://stackoverflow.com/a/21087483
has comment: http://stackoverflow.com/comment/31717122
score: -1
has comment: http://stackoverflow.com/comment/31719230
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31717168
has comment: http://stackoverflow.com/comment/31719509
has comment: http://stackoverflow.com/comment/31718798

http://stackoverflow.com/a/21091340
upvote count: 1
downvote count: 0
has body: Your code simply delegates the exception handling to the calling method. There is no right answer. Either your code is a component in itself, then it should handle an exception internally. Or you are writing a re-usable library which lets the programer decide how to cope with an error/exception.
type: Answer
answers question: http://stackoverflow.com/q/21091238
score: 1
has comment: http://stackoverflow.com/comment/31726691
has comment: http://stackoverflow.com/comment/31725643

http://stackoverflow.com/a/21044883
score: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21044194
type: Answer
has body: It's true that string concatenation can be a bottleneck in Java because Strings are immutable. This means each concatenation creates a new String, unless a matching String was previously created and is therefore in the string-pool (see string interning). Either way, it can certainly lead to problems. However your predecessor is not the first person to have encountered this and the standard way to deal with the need to concatenate many Strings in Java is to use a StringBuilder. When a double (or any primative for that matter) is used as a local variable, it's kept on the stack and the memory it occupies released along with the stack frame (non sure if they're subject to GC or taken care of by the JVM as it runs). If however the double is the field on an object, it's stored on the heap and will be collected when the object containing it is collected. Without seeing how the double values are being used, it hard to say for sure, but it's more than likely the use of the Map has increased the GC load. In summary, yes, imho this is certainly, as you say 'crazy and completely unnecessary'. These sorts of premature optimizations only serve to complicate the code base making it more prone to bugs and making future maintenance more difficult. The golden rule should practically always be, build the simplest thing that works, profile it and then optimize.
accepted answer of: http://stackoverflow.com/q/21044194
upvote count: 3
has comment: http://stackoverflow.com/comment/31645623

http://stackoverflow.com/comment/31789009
type: Comment
score: 0
has text: There could be an error in the parameter list. Did you check the logs of the server? Set the level to debug in the logging tab for more information.
comment on: http://stackoverflow.com/a/21107902
type: AnswerComment

http://stackoverflow.com/comment/31834512
has text: @MadProgrammer so it's a way to pass events between 'Containers'? What exactly is a container?
score: 1
comment on: http://stackoverflow.com/q/21150419
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21170609
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21170419
type: Answer
upvote count: 1
has body: you have two options: you could try DateFormat.getDateInstance() -see http://developer.android.com/reference/java/text/DateFormat.html for constructor options. DateFormat has built-in a bunch of date and time formatting options, but if it does not fulfills your requirements, check SimpleDateFormat for custom formatting. edit: just now saw the android tags. changed to android links

http://stackoverflow.com/comment/31601857
type: Comment
has text: Also, please share a thread dump to see where Threads are blocked.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21022376

http://stackoverflow.com/a/21176821
type: Answer
has body: 1.Write it in a main function public static void main(String args[]) { Hashtable&lt;String,String&gt; coordenates = new Hashtable&lt;String,String&gt;(); coordenates.put("lat", "36.564565465"); coordenates.put("lng", "64.584616511"); } 2.write it in Constructor Information() { access setter of coordinates to put values }
answers question: http://stackoverflow.com/q/21176715
score: 0

http://stackoverflow.com/q/21152443
has answer: http://stackoverflow.com/a/21206538
has answer: http://stackoverflow.com/a/21266936
type: Question
has title: Can Apache XMLBeans read and inject a partial XML document (fragment) into an XML document?
has comment: http://stackoverflow.com/comment/32049913
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/32037662
tagged with: xmlbeans
has comment: http://stackoverflow.com/comment/31935299
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/32158651
tagged with: java
type: UnansweredQuestion
has body: Suppose that I have something like this: FooDocument fooDoc = FooDocument.Factory.newInstance(); fooDoc.addNewBar(); If I produced a string to represent fooDoc, it would look something like this: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Foo&gt; &lt;Bar/&gt; &lt;/Foo&gt; Now, suppose that I had a file that contained only this: &lt;Bar/&gt; And instead of adding Bar as a child of Foo programmatically, I wanted to read the file and add the contents of the file to the fooDoc, something like this: FooDocument fooDoc = FooDocument.Factory.newInstance(); Bar bar = Bar.Factory.parse("file-containing-bar"); fooDoc.add(bar); Is this possible to do with XML Beans? Obviously, the file containing only the Bar node is not an XML file.

http://stackoverflow.com/q/21080615
has comment: http://stackoverflow.com/comment/31706268
type: Question
has comment: http://stackoverflow.com/comment/31706263
has body: I'm trying to change my way of thinking to be more functional. Here's the sample code which I'm trying to change to be more functional. List&lt;Integer&gt; numbers = Arrays.asList(1, 2 ,3, 4, 5, 6); ArrayList&lt;Integer&gt; multipledByTwo = new ArrayList&lt;Integer&gt;(); for(Integer number : numbers) { multipledByTwo.add(number * 2); } As far as I understand about functional java, the simplest rule which is no shared state. Am I correct to understand that this code there's a shared state which is multipledByTwo. Here's my version of functional java. class MultipleByTwoIteration { public static List&lt;Integer&gt; map(List&lt;Integer&gt; numbers) { ArrayList&lt;Integer&gt; multipledByTwo = new ArrayList&lt;Integer&gt;(); for(Integer number : numbers) { multipledByTwo.add(multipleByTwo(number)); } return multipledByTwo; } private static Integer multipleByTwo(Integer number) { return number * 2; } } So I could just do List&lt;Integer&gt; numbers = Arrays.asList(1, 2 ,3, 4, 5, 6); List&lt;Integer&gt; multipledByTwo = MultipleByTwoIteration.map(numbers); Am I correct that this is more of a functional way thinking? How do I improve my code if it's not functional? Thanks.
has comment: http://stackoverflow.com/comment/31706450
answer count: 2
has comment: http://stackoverflow.com/comment/31706394
tagged with: functional-programming
has answer: http://stackoverflow.com/a/21080945
possible better answer: http://stackoverflow.com/a/21080695
downvote count: 0
has answer: http://stackoverflow.com/a/21080695
has comment: http://stackoverflow.com/comment/31706352
favorite count: 0
upvote count: 2
has title: Is this the correct way of doing functional programming in Java?
score: 2
accepted answer: http://stackoverflow.com/a/21080945
tagged with: coding-style
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31706157
tagged with: java

http://stackoverflow.com/comment/31789319
has text: I see. thank you. i guess the conversion back is "new String(bytes, "UTF-8");" .
score: 0
comment on: http://stackoverflow.com/a/21124416
type: Comment
type: AnswerComment

http://stackoverflow.com/q/21179226
possible better answer: http://stackoverflow.com/a/21179278
has answer: http://stackoverflow.com/a/21179305
has comment: http://stackoverflow.com/comment/31886046
has comment: http://stackoverflow.com/comment/31886554
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/21179278
has answer: http://stackoverflow.com/a/21179765
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31886229
downvote count: 0
score: 1
tagged with: ant
tagged with: java
accepted answer: http://stackoverflow.com/a/21179305
has title: Ant using a lower version of Java than the system's Java version
type: Question
has body: This behaviour appeared strange me. The following is what happened: We have a build.xml file for Ant, which says &lt;javac source="1.5" target="1.5"&gt;&lt;/javac&gt;. We have updated Java on our system (Linux) to 1.6, but we forgot to update the Ant build.xml file. Ant building is happening successfully, How is it happening? Is it like the higher version of Java can downgrade to lower versions? Or if Ant cannot find the version of Java specified it uses the default version?
upvote count: 1

http://stackoverflow.com/comment/31704725
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21066754
has text: @Feuermurmel By declaring `? super Integer`, you declare a lower bound on the generic type. This means the actual list can be any of `List<Integer>`, `List<Number>`, `List<Object>`. The type of the `? :` expression is determined by the least upper bound of the two arguments. They are both `List<? super Integer>` but because of the lower bound, one can be a `List<Number>` and the other can be a `List<Object>`. Java cannot determine this at compile time, so the result of has to be some type that is a sub type of `Object`, ie. `List<? extends Object>`.

http://stackoverflow.com/a/36865796
has body: You can also use SERVER_PORT environment variable to configure Spring Boot port. Just set the environment variable and restart the app: set SERVER_PORT=9999 // on windows machine export SERVER_PORT=9999 // on linux Please note that if you do not set those environment variables system wide, you should run the boot app on the same session.
upvote count: 9
score: 8
type: Answer
answers question: http://stackoverflow.com/q/21083170
downvote count: 1

http://stackoverflow.com/q/21125309
has answer: http://stackoverflow.com/a/21135162
answer count: 1
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/21135162
type: AnsweredQuestion
score: 0
tagged with: java
has body: I have a problem configuring my JSF page. I used to use JSF in a software project, but that was some time ago. Now I need it for a private project and have a huge problem starting my JSF page. Because it was some time ago i used it last, I decided to follow a tutorial to start. It was this. I tried to run it on a Tomcat 6.0 on my localhost, but I got an error showing up on the page. type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException javax.faces.webapp.FacesServlet.service(FacesServlet.java:606) root cause java.lang.StackOverflowError java.net.URLStreamHandler.equals(Unknown Source) java.net.URL.equals(Unknown Source) java.util.concurrent.ConcurrentHashMap.get(Unknown Source) com.sun.faces.util.ExpiringConcurrentCache.get(ExpiringConcurrentCache.java:95) com.sun.faces.facelets.impl.DefaultFaceletCache.getFacelet(DefaultFaceletCache.java:121) com.sun.faces.facelets.impl.DefaultFaceletCache.getFacelet(DefaultFaceletCache.java:62) com.sun.faces.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:256) com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:366) com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:346) com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199) com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:155) com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93) com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86) com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:308) com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:367) com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:346) And I have no idea, why. The code is exatly as in the tutorial. And here is my web.xml <?xml version="1.0" encoding="UTF-…
has title: JSF 2.0 Error at startup
type: Question
tagged with: jsf-2

http://stackoverflow.com/q/21160092
tagged with: parsing
has answer: http://stackoverflow.com/a/21160954
type: UnansweredQuestion
has title: Extract int array from C file
tagged with: java
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/31855433
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/31851174
score: 0
has body: I'm developing a little Java software to decode specific data from another system. This system can only extract data in a *.c file : /* Frame (574 bytes) */ static const unsigned char pkt22[574] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x2f, /* ......./ */ 0x48, 0x00, 0x10, 0x27, 0x40, 0x00, 0x3e, 0x00, /* H..'y.&gt;. */ ... 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0xd6, /* ........ */ 0xac, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* ........ */ }; /* Frame (574 bytes) */ static const unsigned char pkt59[574] = { 0x00, 0xC2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ........ */ 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, /* ........ */ ... 0x00, 0x00, 0xc0, 0x68, 0x40, 0x00, 0xc0, 0x00, /* ...h@..h */ 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* @....... */ }; I want to extract this data and use it in my Java software. Is there a parser that can help me do that ?

http://stackoverflow.com/comment/31720189
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21088106
type: Comment
has text: How to get what is the current value of the captcha.?

http://stackoverflow.com/a/21134635
accepted answer of: http://stackoverflow.com/q/21134429
score: 1
answers question: http://stackoverflow.com/q/21134429
has body: GWT 2.6 “GA” will be compiled using Java 6 to overcome this bug. GWT 2.6 is supposed to still be compatible with Java 6; GWT 3.0 probably won't, at least for client-side code. In the mean time, either move to Java 7 or wait for the next 2.6 release which is compatible with Java 6. Note that the current GWT 2.6 RCs only require Java 7 at dev- and compile-time (for the GWT Compiler, DevMode and GWTTestCase); you can deploy your server-side code into a Java 6 VM.
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31805335

http://stackoverflow.com/q/21102792
tagged with: powerschool
has title: How to programmatically log into a website?
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/66477695
linked to: http://stackoverflow.com/q/3208160
has comment: http://stackoverflow.com/comment/31747933
type: UnansweredQuestion
tagged with: authentication
type: Question
has comment: http://stackoverflow.com/comment/31748068
tagged with: java
has comment: http://stackoverflow.com/comment/31747913
has body: I have looked at multiple examples on stackoverflow and cannot get it to work. This is the url I need to log into programmtically:http://powerschool.fortschools.org/public/ I have tried many different ways but am unsuccessfully. Heres what I have currently: Original Url before logging in: http://powerschool.fortschools.org/public/ Url after logging in: http://powerschool.fortschools.org/guardian/home.html Form I think is submitted before login: Parent Sign In To sign in to PowerSchool, you must use a browser that supports and has JavaScript enabled. Username Password Having trouble signing in? Translator Sign In Sign In After pressing the submit button the form changes to this (only the dbpw changes, (this was two seperate examples so the pstoken and the contextData did change)): This is after you "fully log in" Here is my code (not working): public static final String POWERSCHOOLLOGINURL = "http://powerschool.fortschools.org/public/"; public static final String POWERSCHOOLLOGIN = "http://powerschool.fortschools.org/guardian/home.html"; public static void main(String[] args) throws IOException { Map<String, String> nameToVal = new HashMap<String, String>(); nameToVal.put("pstoken", "308732667b2uBDHKHeNJc1XTXdgDSVwxzHfzldM9M"); nameToVal.put("contextData", "e1c94866f2ed77f3ae37bc1a2a477631"); nameToVal.put("dbpw", "29e3fdf45f7959a5e0c894ad01b34941"); nameToVal.put("translator_username", ""); nameToVal.put("translator_password", ""); nameToVal.put("translator_ldappassword", ""); nameToVal.put("returnUrl", ""); nameToVal.put("serviceName", "PS Parent Portal"); nameToVal.put("serviceTicket", ""); nameToVal.put("pcasServerUrl", "/"); nameToVal.put("credentialType", "User Id and Password Credential"); nameToVal.put("account", "horvste"); nameToVal.put("translatorpw", ""); nameToVal.put("returnUrl", ""); nameToVal.put("pcasServerUrl", "/"); nameToVal.put("credentialType", "User Id and Password Credential"); Map<String, String> cookies = new HashMap<String, String>(); cooki…
has comment: http://stackoverflow.com/comment/31747985
answer count: 2
has answer: http://stackoverflow.com/a/21102938
tagged with: javascript

http://stackoverflow.com/comment/31805734
has text: Apart from that, I highly encourage you to get rid from scriptlets and use jstl if you want to get into JSF. Scriptlets are an ancient technology which should be avoided, as injecting pure Java code into view files (either facelets or jsp) is discouraged. See this http://stackoverflow.com/questions/3177733/how-to-avoid-java-code-in-jsp-files
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21108239
score: 0

http://stackoverflow.com/q/21120630
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/34079520
has title: How to run VLC stream on Linux server using Java code?
type: Question
has answer: http://stackoverflow.com/a/34079520
answer count: 2
accepted answer: http://stackoverflow.com/a/22279432
has comment: http://stackoverflow.com/comment/31820414
score: 0
tagged with: linux
tagged with: shell
tagged with: streaming
has answer: http://stackoverflow.com/a/22279432
has body: I am trying to run vlc stream from my Java code on Debian server. Simple commands as given in the example below works fine both from java code as well as terminal. String cmd = "/Applications/ video.avi" Process p = Runtime.getRuntime().exec(cmd); But I try to run more advanced command with multiple options" vlc -vvv http://umevakameran.net.umea.se/mjpg/video.mjpg --no-audio --sout '#transcode{vcodec=MJPG,venc=ffmpeg{strict=1}}:standard{access=http{mime=image/jpeg},mux=mpjpeg,dst=xxxxx:25000}' This is my main class: NewCamera obj = new NewCamera(); ... String mobile_command = "vlc -d -vvv " + camera.getUrl() + " --no-audio --sout" + " '#transcode{vcodec=MJPG,venc=ffmpeg{strict=1}}:" + "standard{access=http{mime=image/jpeg},mux=mpjpeg,dst=" + camera.getServerName() + ":" + camera.getMobilePort() + "}'"; obj.executeCommand(mobile_command); logger.info("New mobile stream started"); and this is class for executing shell commands: private String executeCommand(String command) { StringBuffer output = new StringBuffer(); Process p; try { p = Runtime.getRuntime().exec(command); logger.info(command); p.waitFor(); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = ""; while ((line = reader.readLine())!= null) { output.append(line + "\n"); } } catch (Exception e) { e.printStackTrace(); } logger.info(output.toString()); return output.toString(); } Process in Linux is created, but the stream is I will say "offline", because I cannot connect and get it. Executing the same command directly from command line in Linux works and creates stream. Any ideas?
tagged with: vlc

http://stackoverflow.com/comment/31812857
comment on: http://stackoverflow.com/a/21123859
score: 0
type: AnswerComment
type: Comment
has text: If you really want only one channel, then yes: one thread is the way to go. One channel means one port, so you will have to examine the incoming packet source address to distinguish the server. I'll add another answer to explain how.

http://stackoverflow.com/a/21043507
downvote count: 0
type: Answer
has body: There is no ExceptionHandler class in Android, use Log.
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21043443

http://stackoverflow.com/a/21109704
downvote count: 0
answers question: http://stackoverflow.com/q/21109650
score: 1
has comment: http://stackoverflow.com/comment/31759404
upvote count: 1
has body: I think, the best for You is creating own project. Create group student who want learn by creating. This is probabli better option for You. Don't scare. Many people start like You:) Good luck!
type: Answer

http://stackoverflow.com/comment/31679705
score: 0
type: AnswerComment
has text: I need to write it to a file as you can see some part of my code
type: Comment
comment on: http://stackoverflow.com/a/21066440

http://stackoverflow.com/comment/31822950
type: Comment
type: QuestionComment
has text: I'll add it as answer then :)
score: 0
comment on: http://stackoverflow.com/q/21143903

http://stackoverflow.com/a/21171156
answers question: http://stackoverflow.com/q/21171088
accepted answer of: http://stackoverflow.com/q/21171088
type: AcceptedAnswer
has body: You will have the actual object and child objects. Unless you have enabled lazy for child objects.
type: Answer
has comment: http://stackoverflow.com/comment/31872353
upvote count: 2
has comment: http://stackoverflow.com/comment/31872853
downvote count: 1
score: 1

http://stackoverflow.com/q/21092096
has comment: http://stackoverflow.com/comment/31727193
type: Question
tagged with: request-headers
tagged with: java
has title: Forming RequestHeader with Parameters
upvote count: 1
has body: GET /sap/sap.dll HTTP/1.1 Host: www17.mywebsite.co.in Connection: keep-alive Authorization: Basic c4FtdWVsajE6Q2hddmdlQDErfw== Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Cookie: fl-cookies-accept=true; PDWPI-SSL-SESSION-COOKIE=8CocgSJ84xGfLABQVo8DZQ==BFZz5qWf+iGI6242re1eg-u4N9pGPnWnVKoK4nF6g2M=; PDWPI-SSL-SESSION-COOKIE=QKkkDzZ84xGfLABQVo8DZQ==9rU8IIgPbB50dk+PraQo2lcb1zp+AwPu2MGtqmyWGWE= I need to form the request url with the following parameters. I have read that conn.setRequestProperty will not work for https request. Moreover I am behind a proxy server as well. Can someone throw some light to form the url as such?
answer count: 0
type: UnansweredQuestion
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/comment/31896360
score: 0
type: AnswerComment
has text: The user is 'null' and that is the problem - I don't know how to pass user instance to my custom view, because it is invoked from controller provided by securesocial. To be precise, this is invoking sequence: PasswordChange.page (built-in controller) -> MyViews.getPasswordChangePage (My own plugin handling template generation) -> passwordChange.scala.html (my custom template) What I am trying to do is to get 'user' instance and pass it to the template, though I don't want to (if it is possible) to modify built-in controller class.
type: Comment
comment on: http://stackoverflow.com/a/21172892

http://stackoverflow.com/comment/65186865
score: 0
type: AnswerComment
type: Comment
has text: @nguyenq, the aboe project doesn't support arabic, are there any projects that supports arabic ?
comment on: http://stackoverflow.com/a/21176859

http://stackoverflow.com/q/21117284
upvote count: 1
type: Question
downvote count: 0
tagged with: bookmarks
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21117851
type: UnansweredQuestion
tagged with: pdf-generation
has body: Before you ask, yes I have read another SO article, plus an article by Bruno Lowagie the creator of iText, on how to do this. The fact remains that I cannot get it to work. Tracing the execution through eclipse makes it look like it's working, but no bookmarks actually get copied using this code. I'm probably missing something really stupid and ask that someone point me the right way: void resize (String pdfIn, String pdfOut, float x, float y, float scale) { PdfReader reader = new PdfReader(pdfIn); List &lt;HashMap &lt;String, Object&gt;&gt; bookmarks = SimpleBookmark.getBookmark ( reader ) ; // landscape letter: Document doc = new Document(new RectangleReadOnly(792, 612), 0, 0, 0, 0); PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream(pdfOut)); doc.open(); PdfContentByte cb = writer.getDirectContent(); for(int i=1; i&lt;=reader.getNumberOfPages(); i++){ doc.newPage(); PdfImportedPage page = writer.getImportedPage(reader, i); // page rescaling, mandatory: cb.addTemplate(page, scale, 0, 0, scale, x, y); } writer.setOutlines ( bookmarks ) ; doc.close(); Any clues?
score: 1
tagged with: java
has title: Bookmarks not being copied
tagged with: itext

http://stackoverflow.com/comment/31850792
type: QuestionComment
comment on: http://stackoverflow.com/q/21159809
score: 0
type: Comment
has text: No Code provided BOSS....!!!!!!

http://stackoverflow.com/comment/31702530
has text: By deleting, you lost my comment. I'll say it again: I haven't checked what else is wrong, but your "randomly arrange" may put the same neighbor into multiple slots and I doubt that's what you intended. Shuffle.
comment on: http://stackoverflow.com/q/21078789
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21164407
answer count: 2
has body: I have the following lines of code that reads a TXT file (most of the time generated in Windows so it's ISO format) and it has the character Ñ. When I try to upload the file using Java on my workstation which is a Windows Machine, it is displayed properly and saved in the database properly. However, when I run the application on my app server which is Unix, the character Ñ is not displayed properly and turns into a symbol. Here is the java code: BufferedReader br = new BufferedReader(new InputStreamReader(fu.getInputStream())); String input; try { while((input = br.readLine()) != null) { if(!input.equals("")) { items.add(input); } } } finally { br.close(); }
has comment: http://stackoverflow.com/comment/31858981
has title: Reading a File in Java in a Unix Server
has comment: http://stackoverflow.com/comment/31858805
has answer: http://stackoverflow.com/a/21164445
type: UnansweredQuestion
score: 0
tagged with: input
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21164865

http://stackoverflow.com/a/21169987
score: 0
upvote count: 1
downvote count: 1
type: Answer
has body: This method is used while a jar you are using is in turn dependent on other jars. Here is the link : http://docs.oracle.com/javase/tutorial/deployment/jar/downman.html ... One of the places I have seen it being used is WebSphere MQ http://pic.dhe.ibm.com/infocenter/wmqv7/v7r1/topic/com.ibm.mq.doc/jm10330_.htm
answers question: http://stackoverflow.com/q/21169814

http://stackoverflow.com/q/21079795
accepted answer: http://stackoverflow.com/a/21079828
score: 0
tagged with: bit-manipulation
has title: Java logical bit shift error with decimals
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21079828
tagged with: java
has body: This one works fine: short x = (short)(0xffff &gt;&gt;&gt; 10); i.e. x = 3F (63) But when the same is done but with decimal representation: short x = (short)((short)(-1) &gt;&gt;&gt; 10); then x is still FFFF (-1). Why does it happen?
type: Question
answer count: 1

http://stackoverflow.com/q/21090879
has answer: http://stackoverflow.com/a/21090931
favorite count: 0
has body: The code looks correct but it does not work like I expect it would: Sample Run1: Fill array of 5 elements with binary? (1-yes, 0- no): 1 Array generated: 0 1 1 0 0 Sample Run2: Fill array of 5 elements with binary? (1-yes, 0- no): 0 Array generated: 9 8 8 2 1 The code: public static boolean Q1(int a) { if (a == 1) return true; return false; } public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.print("Fill array of 5 elements with binary? (1-yes, 0- no): "); int num = s.nextInt(); int[] Array1 = new int[5]; if ( Q1(num) == true){ for ( int i = 0; i&lt;5 ; i++){ int ran = 0 + (int) Math.random() + (2); Array1[i] = ran; System.out.print(Array1[i] + " "); } } else { for ( int i = 0; i&lt;5 ; i++){ int ran = 0 + (int) Math.random() + 10; Array1[i] = ran; System.out.print(Array1[i] + " "); } } } } NOT : Suppose the user only enters 1 &amp; 0* I get this output: Fill array of 5 elements with binary? (1-yes, 0- no): 0 10 10 10 10 10
type: UnansweredQuestion
score: -3
upvote count: 1
tagged with: java
type: Question
downvote count: 4
has title: Numeric output from program not as expected
tagged with: arrays
answer count: 1

http://stackoverflow.com/comment/31679702
comment on: http://stackoverflow.com/a/21066427
score: 1
type: AnswerComment
has text: Professor did not teach us exceptions yet. Not your fault, thanks for your inquiry.
type: Comment

http://stackoverflow.com/q/21098212
upvote count: 1
has title: How to implement gwt-highcharts draggable data points in java?
tagged with: highcharts
downvote count: 0
favorite count: 0
answer count: 0
has body: I need to implement gwt-highcharts draggable data points in java, similar to what's done in js here: http://jsfiddle.net/highcharts/AyUbx/ (code below) I can't figure out how to do that in java from the gwt-highcharts javadocs. None of the mouse or click eventhandler documentation mentions how to capture drag info, or even how to capture mouse-up events, which combined with click events, would let me detect a drag action. I haven't found this anywhere else on the Web. Any help or examples would be greatly appreciated. I'm using GWT 2.5.1, and the latest versions of gwt-highcharts and jquery as of 2014-01-03. Thanks in advance. -Dan var chart = new Highcharts.Chart({ chart: { renderTo: 'container', animation: false, zoomType: 'x' }, xAxis: { //categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, plotOptions: { series: { cursor: 'ns-resize', point: { events: { drag: function(e) { // Returning false stops the drag and drops. Example: /* if (e.newY > 300) { this.y = 300; return false; } */ $('#drag').html( 'Dragging ' + this.series.name + ', ' + this.category + ' to ' + Highcharts.numberFormat(e.newY, 2) + '' ); }, drop: function() { $('#drop').html( 'In ' + this.series.name + ', ' + this.category + ' was set to ' + Highcharts.numberFormat(this.y, 2) + '' ); } } }, stickyTracking: false }, column: { stacking: 'normal' } }, tooltip: { yDecimals: 2 }, series: [{ data: [0, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4], //draggableX: true, draggableY: true, dragMinY: 0, type: 'column', minPointLength: 2 }, { data: [0, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4].reverse(), draggableY: true, dragMinY: 0, type: 'column', minPointLength: 2 }, { data: [0, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4], draggableY: true }] });
type: UnansweredQuestion
tagged with: draggable
type: Question
tagged with: gwt
score: 1
tagged with: java
tagged with: gwt-highcharts

http://stackoverflow.com/comment/31681836
score: 0
has text: setBounds() works always as its constants are declared, then isn't true at all
comment on: http://stackoverflow.com/q/21067502
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21122057
downvote count: 0
has comment: http://stackoverflow.com/comment/31784715
has comment: http://stackoverflow.com/comment/31784833
has comment: http://stackoverflow.com/comment/31784457
has comment: http://stackoverflow.com/comment/31819911
type: Answer
has body: Why do you have a separate method to add the text area to the panel? I'm guessing the problem is that the tab is made visible BEFORE you add the text area to the panel on the tab. So you need to do one of two things: Invoke revalidate() and repaint() on the panel after you add the text area to the panel Keep you code for creating the panel in one place. That is create the panel and the label and the text area to the panel at the same time. This is the easy solution from a code design. Edit The GroupLayout is causing a problem. I changed the following: /* javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(tabbedPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 781, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(tabbedPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 437, Short.MAX_VALUE)) ); pack(); */ add(tabbedPanel); setSize(400, 400); So that the frame just used the default BorderLayout and the tabbed pane will be added to the CENTER. I then changed the panel to use the default FlowLayout: //pan.setLayout(new GridLayout(20,20)); and the text area now displays. I suggest you build GUI's manually to better understand how layout managers work.
accepted answer of: http://stackoverflow.com/q/21121888
has comment: http://stackoverflow.com/comment/31822130
upvote count: 3
answers question: http://stackoverflow.com/q/21121888
has comment: http://stackoverflow.com/comment/31782729
has comment: http://stackoverflow.com/comment/31833786
score: 3
has comment: http://stackoverflow.com/comment/31817453
has comment: http://stackoverflow.com/comment/31783903
has comment: http://stackoverflow.com/comment/31833622
type: AcceptedAnswer

http://stackoverflow.com/q/21180434
tagged with: format
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/77230261
has comment: http://stackoverflow.com/comment/136152570
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77240664
tagged with: date
has comment: http://stackoverflow.com/comment/136154092
score: 2
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/31888030
has title: How to convert 'dd/mm/yyyy hh:mm:ss am/pm' to hh:mm:ss (without am or pm) in java?
has body: I want the convert the string like 1/15/2014 9:57:03 AM or 1/15/2014 5:49:39 PM to 9:57:03 and 17:49:39
tagged with: time
has comment: http://stackoverflow.com/comment/31887964
has answer: http://stackoverflow.com/a/21180635
has comment: http://stackoverflow.com/comment/31887971
answer count: 3
downvote count: 3

http://stackoverflow.com/comment/67918439
has text: answer accepted with a very little delay ;-) , sorry :)
type: Comment
comment on: http://stackoverflow.com/a/21063410
score: 0
type: AnswerComment

http://stackoverflow.com/q/21120756
linked to: http://stackoverflow.com/q/153527
tagged with: java
has body: I have a jsp like this : <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> POST name： when i POST, i debugged it by Fiddler, but I find there is not charset defind in contentType, why? I have define contentType in jsp file top, when I post my form, It didn't use the charset? this is the result in fiddler when I post: I debug in Tomcat class, I find because the contentType didn't have charset, so tomcat use its default charset, I want to know whether the result is correct, the contentType didn't contain charset, or I have some wrong in somewhere?
has answer: http://stackoverflow.com/a/21120795
tagged with: forms
has title: form post in jsp, contentType header didn't have charset,why?
type: Question
tagged with: jsp
score: 0
accepted answer: http://stackoverflow.com/a/21120795
answer count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/31594402
comment on: http://stackoverflow.com/q/21019086
type: Comment
has text: @Gimby: dear u r right, here i m not concern to create my projects in maven , for this i followed this tutorial:http://www.tutorialspoint.com/maven/ please help me how to create websockets in java thats all.
score: 0
type: QuestionComment

tomcat
tags question: http://stackoverflow.com/q/21108591
tags question: http://stackoverflow.com/q/21052708
tags question: http://stackoverflow.com/q/21139194
tags question: http://stackoverflow.com/q/21029607
tags question: http://stackoverflow.com/q/21095573
tags question: http://stackoverflow.com/q/21096862
tags question: http://stackoverflow.com/q/21094477
tags question: http://stackoverflow.com/q/21037735
tags question: http://stackoverflow.com/q/21062102
tags question: http://stackoverflow.com/q/21121031
tags question: http://stackoverflow.com/q/21125309
tags question: http://stackoverflow.com/q/21099710
tags question: http://stackoverflow.com/q/21162832
tags question: http://stackoverflow.com/q/21091934
tags question: http://stackoverflow.com/q/21082404
tags question: http://stackoverflow.com/q/21112703
tags question: http://stackoverflow.com/q/21075345
tags question: http://stackoverflow.com/q/21134406
tags question: http://stackoverflow.com/q/21163094
tags question: http://stackoverflow.com/q/21137307
tags question: http://stackoverflow.com/q/21103382
tags question: http://stackoverflow.com/q/21135264
tags question: http://stackoverflow.com/q/21118368
tags question: http://stackoverflow.com/q/21062586
tags question: http://stackoverflow.com/q/21139192
tags question: http://stackoverflow.com/q/21182660
tags question: http://stackoverflow.com/q/21153933
tags question: http://stackoverflow.com/q/21130565
tags question: http://stackoverflow.com/q/21182521
tags question: http://stackoverflow.com/q/21080174
tags question: http://stackoverflow.com/q/21134757
tags question: http://stackoverflow.com/q/21173559
tag name: tomcat
tags question: http://stackoverflow.com/q/21100451
tags question: http://stackoverflow.com/q/21074000
tags question: http://stackoverflow.com/q/21060856
tags question: http://stackoverflow.com/q/21183014
tags question: http://stackoverflow.com/q/21100364
tags question: http://stackoverflow.com/q/21108111
tags question: http://stackoverflow.com/q/21119650
tags question: http://stackoverflow.com/q/21029595
tags question: http://stackoverflow.com/q/21088383
tags question: http://stackoverflow.com/q/21137184
tags question: http://stackoverflow.com/q/21116658
tags question: http://stackoverflow.com/q/21040635
tags question: http://stackoverflow.com/q/21087412
tags question: http://stackoverflow.com/q/21104340
tags question: http://stackoverflow.com/q/21171668
tags question: http://stackoverflow.com/q/21171472
tags question: http://stackoverflow.com/q/21039049
tags question: http://stackoverflow.com/q/21096837
tags question: http://stackoverflow.com/q/21131520
tags question: http://stackoverflow.com/q/21181964
tags question: http://stackoverflow.com/q/21108105
type: Tag
tags question: http://stackoverflow.com/q/21052186
tags question: http://stackoverflow.com/q/21138279
tags question: http://stackoverflow.com/q/21029708
tags question: http://stackoverflow.com/q/21141960
tags question: http://stackoverflow.com/q/21088864
tags question: http://stackoverflow.com/q/21064787
tags question: http://stackoverflow.com/q/21175842
tags question: http://stackoverflow.com/q/21150670
tags question: http://stackoverflow.com/q/21063140
tags question: http://stackoverflow.com/q/21136911
tags question: http://stackoverflow.com/q/21021136
tags question: http://stackoverflow.com/q/21094708
tags question: http://stackoverflow.com/q/21165208
tags question: http://stackoverflow.com/q/21040142
tags question: http://stackoverflow.com/q/21089558
tags question: http://stackoverflow.com/q/21084634
tags question: http://stackoverflow.com/q/21071666
tags question: http://stackoverflow.com/q/21109465
tags question: http://stackoverflow.com/q/21081780
tags question: http://stackoverflow.com/q/21181399
tags question: http://stackoverflow.com/q/21070331

http://stackoverflow.com/q/21078826
tagged with: spring-mvc
score: 0
tagged with: java
has body: Using spring-webmvc and spring-security-web of version 3.2, I'd like to return different views depending on the user role (or whether user is authenticated or not), so that for a "/" request a user of role ANONYMOUS (or not authenticated user) gets the welcome page and a user of role USER gets the home page. My current approach is doing this with a regular controller: @Controller public class WelcomeCtrl { @RequestMapping("/") public String welcome(Principal principal) { if (userAuthenticated(principal)) { return "redirect:home"; } return "welcome"; } private boolean userAuthenticated(Principal principal) { return principal != null &amp;&amp; principal instanceof Authentication &amp;&amp; hasUserRole((Authentication) principal); } private boolean hasUserRole(Authentication principal) { Collection&lt;? extends GrantedAuthority&gt; authorities = (principal) .getAuthorities(); return Iterables.contains(Collections2.transform(authorities, new Function&lt;GrantedAuthority, String&gt;() { @Override public String apply(GrantedAuthority authority) { return authority.getAuthority(); } }), "ROLE_USER"); } } However, I don't really like it because I feel that this redirection should be done with spring security (am I wrong?). Do you know any way of doing this with Spring Security configuration? My current config is as follows: @Configuration @EnableWebSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .antMatchers("/", "/welcome").permitAll() .anyRequest().authenticated() .and().formLogin() .defaultSuccessUrl("/home").permitAll() .and().logout().permitAll(); } @Override protected void configure(AuthenticationManagerBuilder authManagerBuilder) throws Exception { authManagerBuilder.inMemoryAuthentication().withUser("user") .password("password").roles("USER"); } }
answer count: 1
has title: Spring 3.2: Choose view basing on user role
has answer: http://stackoverflow.com/a/21079545
type: UnansweredQuestion
tagged with: spring-security
type: Question
tagged with: spring

http://stackoverflow.com/q/21170915
type: AnsweredQuestion
score: 2
has title: Array Casting Issue
downvote count: 0
tagged with: java
type: Question
tagged with: arrays
upvote count: 2
has body: I have the following code: String []d=new String[]{"y","z"}; Object []ab=d; d=(String[]) ab; System.out.println(d[0]); System.out.println(ab[0]); as expected returns y twice But the following code throws a java.lang.ClassCastException (here fileList is an ArrayList&lt;File&gt; object) File[] loadedFiles=new File[fileList.size()]; Object[] toArray = fileList.toArray(); loadedFiles=(File[]) toArray; System.out.println(toArray[0]); System.out.println(loadedFiles[0]); While the following doesn't throw anything: loadedFiles=fileList.toArray(new File[0]); Javadoc 1.5 says (about toArray()): The returned array will be "safe" in that no references to it are maintained by this collection. (In other words, this method must allocate a new array even if this collection is backed by an array). The caller is thus free to modify the returned array. So why can't I modify the array type by casting? Thanks!
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21170996
has answer: http://stackoverflow.com/a/21170996

http://stackoverflow.com/a/21059268
type: Answer
answers question: http://stackoverflow.com/q/21059216
score: 4
has body: See In Java, difference between default, public, protected, and private There is no such thing. But you can move the class in an empty package and use protected.
upvote count: 4
downvote count: 0

autowired
tags question: http://stackoverflow.com/q/21097370
type: Tag
tags question: http://stackoverflow.com/q/21116561
tag name: autowired

http://stackoverflow.com/a/21088054
upvote count: 5
accepted answer of: http://stackoverflow.com/q/21088031
score: 5
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21088031
has body: You are comparing objects - Integers, the == operator might work only for numbers between [-128,127]. Look at the JLS: If the value p being boxed is true, false, a byte, or a char in the range \u0000 to \u007f, or an int or short number between -128 and 127 (inclusive), then let r1 and r2 be the results of any two boxing conversions of p. It is always the case that r1 == r2. Since that values you're comparing are not in the mentioned range, the result will be evaluated to false. You should use Integer#equals instead.
has comment: http://stackoverflow.com/comment/31719816
type: Answer
has comment: http://stackoverflow.com/comment/31719697

http://stackoverflow.com/comment/31636285
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21042911
has text: this is assign background image
type: Comment

http://stackoverflow.com/q/21135383
linked to: http://stackoverflow.com/q/12529200
type: Question
has comment: http://stackoverflow.com/comment/31806471
has comment: http://stackoverflow.com/comment/31808555
answer count: 1
has comment: http://stackoverflow.com/comment/31809908
tagged with: netbeans
score: 0
tagged with: java
tagged with: swing
has answer: http://stackoverflow.com/a/21139031
has body: I'm trying to create a simple JFrame with some scomponents like JTextField and JButton The below code is not showing any error, import java.awt.*; import java.util.*; import javax.swing.*; public class Commform { static final JFrame common = new JFrame(); JTextField Farmername = new JTextField(); Commform() { common.getContentPane().setLayout(null); Farmername.setBounds(100, 100, 285, 100); } } But, after declaring the object for JFrame (common) and JTextField (Farmername), if I try to use setBounds method before the constructor like the bolded line, public class Commform { static final JFrame common = new JFrame(); JTextField Farmername = new JTextField(); Farmername.setBounds(100, 100, 285, 100); Commform() { common.getContentPane().setLayout(null); } } then netbeans underlines in red color and shows the tooltip as "package Farmername does not exist, illegal start or expression" When I am able to use object inside constructor, why can't I use just after creating the object ? And even using the Farmername inside static, as shown below doesn't give any error. static { System.out.println("Called from main function"); common.getContentPane().setLayout(null); Farmername.setBounds(100, 100, 285, 100); } I'm creating this form in the class without main function because I would like to call this frame and enter credentials to insert them to database, later to display particular person's credentials in their respective text field, I want to call this same frame. But at any level I don't want to use main function to this class. Please help me.
has title: Why netbeans considering the object of swing component as package
has comment: http://stackoverflow.com/comment/31806103
accepted answer: http://stackoverflow.com/a/21139031
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31808967

http://stackoverflow.com/comment/31829593
score: 0
type: AnswerComment
has text: @BoristheSpider Thanks for suggesting the binary search, I will investigate this evening.
type: Comment
comment on: http://stackoverflow.com/a/21127703

http://stackoverflow.com/comment/31758930
has text: Thank you for that answer. I didn't think of that because in the german wikipedia you sign your input also with CET.
comment on: http://stackoverflow.com/a/21096688
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31858650
type: Comment
has text: search on stackoverflow there are many examples http://stackoverflow.com/questions/20355177/how-to-add-search-functionality-in-listview and this http://stackoverflow.com/questions/17720481/how-could-i-filter-the-listview-using-baseadapter
comment on: http://stackoverflow.com/q/21164147
score: 0
type: QuestionComment

http://stackoverflow.com/q/21150154
has comment: http://stackoverflow.com/comment/31836960
has comment: http://stackoverflow.com/comment/31834764
type: AnsweredQuestion
has body: The Java bytecode language has the JSR instruction. None of the code I've compiled with the Java 7 compiler uses this instruction. However, sometimes Java binaries I've downloaded do use it, although rarely. I'd be interested to know what compilers do use the instruction, and what Java code constructs would cause them to use it. Edit this is not a duplicate as it refers to the JSR bytecode instruction and not a Java Specification Request
has answer: http://stackoverflow.com/a/21150629
has title: What Java compilers use the jsr instruction, and what for?
tagged with: java
linked to: http://stackoverflow.com/q/5871190
has answer: http://stackoverflow.com/a/21150197
type: Question
upvote count: 22
answer count: 2
tagged with: bytecode
has comment: http://stackoverflow.com/comment/48074136
downvote count: 0
has comment: http://stackoverflow.com/comment/31834195
score: 22
possible better answer: http://stackoverflow.com/a/21150197
favorite count: 0
accepted answer: http://stackoverflow.com/a/21150629

http://stackoverflow.com/a/21181789
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21180849
type: Answer
answers question: http://stackoverflow.com/q/21180849
has comment: http://stackoverflow.com/comment/31901295
has comment: http://stackoverflow.com/comment/31900444
has comment: http://stackoverflow.com/comment/31901938
score: 0
has body: The underlying RestAPI(Facade) has a addLabels() method that you can use, but I wouldn't recommend it. The transaction won't work if you want to read your writes. If you want to insert 100 nodes with labels and properties, use Cypher with Parameters. This should work. restQueryEngine.query("foreach (p in {names} | create (n:Person {name:name}))", map("names",asList("John","Jane",...)));

http://stackoverflow.com/comment/31642549
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21045885
has text: @CesarZegarra now prints the system.out at the beginning when i start the server to execute the xhtml page.. but gives null pointer obviously because into "add" there are functions that need values passed when i open the dialog. Think it's not the solution...I think it's something about action or something else that i am mistaking in xhtml dialog..btw i'm new on these..

http://stackoverflow.com/comment/41821300
comment on: http://stackoverflow.com/a/21085886
score: 0
type: AnswerComment
has text: @ambigram_maker Yeah, I can see that, but from where can I get the code for that function
type: Comment

http://stackoverflow.com/comment/31730671
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21094139
has text: While you already link to that question and say it "did not help", it still is the correct answer: you can't do it this way, unless you write everything from scratch (which you really don't want to do).
type: Comment

http://stackoverflow.com/a/21179419
score: 0
type: Answer
has body: No, there isn't...you should always use the editor and the content assistant (be careful don't change source code otherwise the debugger will complain)
answers question: http://stackoverflow.com/q/21179366

http://stackoverflow.com/q/21127666
has title: User of maven build spring mvc project, it's always not found jar such as spring-webmvc.jar, spring-web.jar,jstl.jar etc.
type: Question
score: 0
has answer: http://stackoverflow.com/a/21127839
answer count: 1
has body: I use maven to build spring mvc project, i am confused ** Maven dependency: ** junit junit 3.8.1 test org.springframework spring-context 4.0.0.RELEASE jstl jstl 1.2 org.springframework spring-webmvc 4.0.0.RELEASE and i import some necessary jar such as slf4j.jar, dom4j.jar, stander.jar etc.
tagged with: maven
tagged with: spring
accepted answer: http://stackoverflow.com/a/21127839
tagged with: spring-mvc
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/8814110
tagged with: java

http://stackoverflow.com/comment/31799830
has text: please edit ur question :) ..... In Fragment2 if I click the back button, I can go back to Fragment2
score: 0
comment on: http://stackoverflow.com/q/21131689
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21057961
has body: [sorry if this is a stupid question, I had a lot of trouble wording it for a google search, and couldn't find any answers to the question, even though it'll probably be like a one-line answer] I'm just following some tutorials on my Java programming course's website. Right now I'm coding something that takes will open a prompt screen and be like, "Please enter an integer between 5 and 10: ", and scan the number, and do that for a bunch of different variable types, different boundaries, etc. Super easy stuff. I just have one small question. How do I tell my scanning method to check that the variable is of type int? I know it's probably really obvious, but if someone enters "A" or "1.543," I'm supposed to have it display, "That is not an integer!" but I don't know how to actually use the scanner to check variable types
has title: How do I use Java's Scanner class to determine the datatype of my input?
tagged with: variable-types
type: UnansweredQuestion
score: -3
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/21057983
upvote count: 1
type: Question
tagged with: java
answer count: 2
downvote count: 4
has answer: http://stackoverflow.com/a/21057996
favorite count: 0

http://stackoverflow.com/q/21163667
upvote count: 1
answer count: 1
tagged with: javascript
favorite count: 0
has answer: http://stackoverflow.com/a/21164163
has title: jsf. How to post backbean object from jsf form to javascript
type: UnansweredQuestion
has body: I am using Primefaces/JSF in combination with pure javascript tools in order to implement an image viewer &amp; annotator. Image viewer is built upon the OpenLayers framework. When the user annotates (draws shapes) on the canvas, a JSON object is created and upon Save action passed to the back bean. Back bean retrieves the object (deserialized) and stores it in to a file. Here is the relevant code: OpenLayers javascript (image-viewer.js): function initialiseMap(){' ... map = new OpenLayers.Map(imageEditorID, options); imageLayer = new OpenLayers.Layer.TMS(imgURL, "", { ... }); map.addLayer(imageLayer); var vlayer = new OpenLayers.Layer.Vector("Editable"); map.addLayer(vlayer); //draw controls and shape tools ... //then define save action var save = new OpenLayers.Control.Button({ ... var GEOJSON_PARSER = new OpenLayers.Format.GeoJSON(); var vectorLayerAsJson = GEOJSON_PARSER.write(vlayer.features); //and finally post to server layer with drawn shapes sendJSONToServer([{name:'param', value:vectorLayerAsJson}]); ... The above Image Viewer/Map tool, is loaded via an p:outputPanel component of primefaces and uses sendJSONToServer remoteCommand to get JSON layer: &lt;h:head&gt; &lt;script src="#{facesContext.externalContext.requestContextPath}/js/image-viewer.js" /&gt; ... &lt;h:body&gt; &lt;h:form id="imageEditor"&gt; &lt;p:fieldset legend="Viewer"&gt; ... // inoutHidden does not have on* events? how am i going to post to image-viewer.js? &lt;h:inputHidden value="#{imageAnnotations.fetchJsonString()}" /&gt; ... &lt;p:outputPanel layout="block" styleClass="imageEditorImagePanel" /&gt; &lt;p:remoteCommand immediate="true" name="sendJSONToServer" action="#{imageAnnotations.actionOnString}" /&gt; &lt;/p:fieldset&gt; .... Finally in the backbean the JSON object is fetched and stored in a file (implementation is raw): @ManagedBean(name="imageAnnotations") public class ImageAnnotations { //actionOnString fetches and saves the JSON string - this is a raw impementation public St…
tagged with: jsf
downvote count: 0
tagged with: primefaces
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question

http://stackoverflow.com/a/21066752
answers question: http://stackoverflow.com/q/21066596
has comment: http://stackoverflow.com/comment/31680477
has comment: http://stackoverflow.com/comment/31680836
type: Answer
has comment: http://stackoverflow.com/comment/31680371
has body: Looks like you're using NetBeans GUI builder. If you go to the properties pane (the tab to the very right in Netbeans design view) with the jTable highlighted, you will see a property model Click on the ... button to the right of the property, and a Dialog will pop up Set the number of rows to 0, and the number of columns to how many columns you want, and set the column title and type and if you want it editable Then in your actionPerformed, however you get the data for rows, add an array of that data to the model with model.addRow() public void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // get row data, and put it into an array Object[] row = {data1, data2, data3 ...}; DefaultTableModel model = (DefaultTableModel)jTable1.getModel(); model.addRow(row); } So whenever the button is pressed, a row will be added dynamically to your table. That's the easiest way to do it with GUI Builder EDIT If you want to check the number of rows then you check the rowCount DefaultTableModel model = (DefaultTableModel)jTable1.getModel(); if (model.getRowCount() &lt; 1) { do something. }
has comment: http://stackoverflow.com/comment/31680664
score: 1
has comment: http://stackoverflow.com/comment/31680908
has comment: http://stackoverflow.com/comment/31680441
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31680777
accepted answer of: http://stackoverflow.com/q/21066596
type: AcceptedAnswer

http://stackoverflow.com/a/21058688
has body: Your line if(wordAsArray[i] == userGuess) is comparing two objects to see if they are equal. In this case two String objects. This comparison checks to see whether the references of the objects are equal (memory location). Even though the Strings have the same value, they are two different objects and thus have two different memory locations, which will make them unequal. What you are trying to do, is check to see whether the two objects values are the same. This can be accomplished by using String.equals() method: if(wordAsArray[i].equals(userGuess)) In general, when working with primitive data types (int, float, boolean, char...) the == comparison works just fine. However, when working with objects, you should be using the object's equals() method. More on primitive types: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21058626
type: Answer

http://stackoverflow.com/comment/31741428
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21098970
type: AnswerComment
has text: So in other words, interfaces are useful when code requires multiple implementations of a similar blueprint and having such a blueprint/contract ensures that each individual implementation has all the necessary methods while allowing for case by case variation in implementation details?

http://stackoverflow.com/a/21030051
type: Answer
has comment: http://stackoverflow.com/comment/31625825
answers question: http://stackoverflow.com/q/21029556
has comment: http://stackoverflow.com/comment/31703873
score: 0
has body: Add two classes ContactWrite.java on top declare the schema and table like below @Table(name = "Contact", schema="DB1") Do the same for the other table in the DB2 ContactRead.java @Table(name = "Contact", schema="DB2") Now use these two classes in the persistance xml files like below. persistent.read.only.xml: <?xml version="1.0" encoding="UTF-8"?> org.hibernate.ejb.HibernatePersistence com.demo.domain.ContactWrite persistent.write.only.xml: <?xml version="1.0" encoding="UTF-8"?> org.hibernate.ejb.HibernatePersistence com.demo.domain.ContactRead
has comment: http://stackoverflow.com/comment/31652706

http://stackoverflow.com/a/21147046
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/21146502
type: Answer
has comment: http://stackoverflow.com/comment/31828960
score: 2
has body: The situation is: when calling final Socket clientsocket = serverSocket.accept(); the first time, it's waiting for the first client. when the first client connected, you pass this client to a thread then continue the loop that calls final Socket clientsocket = serverSocket.accept(); the second time. Since starting a thread take more time than going to the next loop, isRunning still is true. In handleConnection(Socket clientSocket), you call closeConnection(clientSocket, instream, outstream); which set isRunning to false. That is the point. When the second client connected, you also pass this client to another thread, then continue the loop where isRunning is false, so the loop is terminated. Hence, you can't get to the third client.
accepted answer of: http://stackoverflow.com/q/21146502
type: AcceptedAnswer

http://stackoverflow.com/comment/31689370
type: QuestionComment
has text: Multi-threaded application that crawls the web. It has running cycles with linked lists that stores crawling sources executes them and once finishes clears the list and repeats.
comment on: http://stackoverflow.com/q/21071519
score: 0
type: Comment

http://stackoverflow.com/q/21043543
has comment: http://stackoverflow.com/comment/31637558
type: Question
score: 0
has body: I want to extend android.net.wifi.WifiManager . Since extension methods does not exists for Java I wanted to extend the class itself. I am however unable to do so, the WiFiManager constructor demands IWifiManager and that interface seems to be hidden. What am I missing here, How can I extend the WiFiManager?
answer count: 1
has comment: http://stackoverflow.com/comment/31637633
has comment: http://stackoverflow.com/comment/31637171
has answer: http://stackoverflow.com/a/21045214
accepted answer: http://stackoverflow.com/a/21045214
linked to: http://stackoverflow.com/q/4359979
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31637423
tagged with: java
has title: Extend android.net.wifi.WifiManager

http://stackoverflow.com/comment/31643949
type: Comment
comment on: http://stackoverflow.com/a/21044221
score: 0
type: AnswerComment
has text: anyway, what is the nullpointerexception actually? is it something i code and i point it to null value? i need to clarify that in order to understand better java. thanks

hdfs
tags question: http://stackoverflow.com/q/21021380
tags question: http://stackoverflow.com/q/21180120
tags question: http://stackoverflow.com/q/21050814
tags question: http://stackoverflow.com/q/21178033
tags question: http://stackoverflow.com/q/21181834
tag name: hdfs
type: Tag

http://stackoverflow.com/a/21036581
upvote count: 1
has comment: http://stackoverflow.com/comment/31626274
score: 1
has comment: http://stackoverflow.com/comment/31625781
has body: You can try it as: String formattedDate = null; long timeInMillis = System.currentTimeMillis(); Calendar cal1 = Calendar.getInstance(); cal1.setTimeInMillis(timeInMillis); SimpleDateFormat dateFormat = new SimpleDateFormat( "EEEE, MMM, dd, yyyy"); formattedDate = dateFormat.format(cal1.getTime()); This will give you output: Friday, Jan, 10, 2014 Hope this gives some idea.
downvote count: 0
answers question: http://stackoverflow.com/q/21036410
type: Answer

http://stackoverflow.com/a/21144713
score: 8
downvote count: 0
has comment: http://stackoverflow.com/comment/31823505
has comment: http://stackoverflow.com/comment/31865039
has comment: http://stackoverflow.com/comment/31823245
upvote count: 8
answers question: http://stackoverflow.com/q/21144598
has comment: http://stackoverflow.com/comment/31823293
has comment: http://stackoverflow.com/comment/31864995
has body: You should have two EntityNode objects. Both start at Node1. Have the first object move two nodes down, and the second only move one node down. Repeat this until you either reach the end (there was no cycle) or the two objects meet at the same node (there is a cycle). For your example: n1: Node1, n2: Node1 n1: Node3, n2: Node2 n1: Node5, n2: Node3 n1: Node4, n2: Node4 -> cycle!! For pseudocode: while (n1.nextNode isn't null): n1 = n1.nextNode.nextNode n2 = n2.nextnode if (n1 equals n2): return 'there is a loop!'
has comment: http://stackoverflow.com/comment/31823094
has comment: http://stackoverflow.com/comment/31823070
has comment: http://stackoverflow.com/comment/31823235
type: Answer

http://stackoverflow.com/q/21049930
has answer: http://stackoverflow.com/a/21049957
possible better answer: http://stackoverflow.com/a/21050188
type: Question
answer count: 2
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/21049957
has body: What I wondered, is if it was possible to open Java classes, like FileWriter, up to view the code inside of them. Thanks for the help!
tagged with: class
has title: Is there a way to access the code inside of built in Java classes?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21050188
score: 2
has comment: http://stackoverflow.com/comment/31649184
downvote count: 0
has comment: http://stackoverflow.com/comment/31650940
favorite count: 0

http://stackoverflow.com/q/21140168
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/62681746
tagged with: log4net
has comment: http://stackoverflow.com/comment/31814969
has answer: http://stackoverflow.com/a/21385449
has title: log4j:ERROR setFile(null,false) call failed
score: 4
has body: Iam facing some strange error as below log4j:ERROR setFile(null,false) call failed. java.io.FileNotFoundException: \debug.log (Access is denied) src/main/dev/environment/dev/config.properties logging.folder=D:/logs log4j.xml maven.xml (not complete) src/main/environment/dev/config.properties when iam directly using , its working fine, BUT when am using iam getting above exception.. Iam pretty sure values from property file able to read, since one of my java file able to read values from this property file only.. then why can't this log4j.xml file able to read? please suggest me what went wrong?
has answer: http://stackoverflow.com/a/60209481
answer count: 4
tagged with: log4j
favorite count: 0
has comment: http://stackoverflow.com/comment/31814614
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21792739
tagged with: maven
upvote count: 4
has answer: http://stackoverflow.com/a/30486368

http://stackoverflow.com/comment/31741348
score: 1
has text: *"I rather don't use threads for this."* I want a flying pony that excretes ice-cream. We don't always get what we want.
comment on: http://stackoverflow.com/q/21099603
type: Comment
type: QuestionComment

http://stackoverflow.com/a/41890704
answers question: http://stackoverflow.com/q/21099072
type: Answer
upvote count: 2
has body: Installed JRE In my case I solved the problem by removing duplicates of names, I kept only one with the name: jdk.1.8.0_101
score: 2
downvote count: 0

http://stackoverflow.com/comment/31672504
comment on: http://stackoverflow.com/a/21062140
score: 2
type: AnswerComment
type: Comment
has text: Fret not. Nothing to worry about.

http://stackoverflow.com/comment/137389957
type: AnswerComment
comment on: http://stackoverflow.com/a/74605095
score: 0
type: Comment
has text: Thank you for this answer. However, it is not the `RootCert` that worked for me as we have a zscaler firewalll running in office. In my case the specific certificate of the site, for example, `repo.maven.apache.org` usually comes at the bottom end of the certificate hierarchy (Although your picture shows the right selection, you mentioned to select the RootCert at the top)

http://stackoverflow.com/comment/31848317
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21158264
has text: Then you should check your write method, maybe you should add an offset and a length [link](http://docs.oracle.com/javase/7/docs/api/java/io/BufferedWriter.html#write(java.lang.String, int, int))

http://stackoverflow.com/comment/31709075
comment on: http://stackoverflow.com/q/21081780
type: Comment
type: QuestionComment
has text: also, if someone could offer insight into why this question has been downvoted, i'd appreciate it.
score: 0

http://stackoverflow.com/q/21174683
tagged with: bigdata
has comment: http://stackoverflow.com/comment/32122262
has body: I am fairly new to big data and we have millions of records that has the data in the following way - ID Timestamp Status 1. 12:00:00. ON 1. 12:00:35. Off 1. 12:01:01. ON 1. 12:10:00. Off 1. 12:11:00. On I need to calculate the total time it was off. This is across millions of records so the solution has to be fast. Any thoughts on what I could do either algorithmically or through queries? I figure one way is to iterate the data through an array but that just seems too time consuming and I am sure people have done this before.
upvote count: 0
has answer: http://stackoverflow.com/a/21213095
has comment: http://stackoverflow.com/comment/31915634
tagged with: java
has comment: http://stackoverflow.com/comment/31878574
type: Question
has comment: http://stackoverflow.com/comment/31886265
tagged with: mongodb
tagged with: algorithm
tagged with: database
score: -1
has comment: http://stackoverflow.com/comment/31878110
has title: MongoDB query or programmatic solution
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31878498
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/21101273
favorite count: 0
tagged with: resteasy
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/21108582
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21120416
tagged with: jboss
answer count: 2
downvote count: 0
has title: Jboss AS7 Resteasy sample Oauth2 skeleton key deploy NoClassDefFoundError from PoolingClientConnectionManager
has body: Running the default Skeleton Key example with Jboss AS7 and Resteasy, I have followed the directions exactly here: https://github.com/resteasy/Resteasy/tree/master/jaxrs/examples/oauth2-as7-example but still get an error on deploy: 14:35:10,453 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-11) Context [/customer-portal] startup failed due to previous errors: java.lang.NoClassDefFoundError: org/apache/http/impl/conn/PoolingClientConnectionManager at org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.initDefaultEngine(ResteasyClientBuilder.java:428) [resteasy-client-3.0.6.Final.jar:] at org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.build(ResteasyClientBuilder.java:333) [resteasy-client-3.0.6.Final.jar:] at org.jboss.resteasy.skeleton.key.as7.OAuthManagedResourceValve.init(OAuthManagedResourceValve.java:115) [skeleton-key-as7-3.0.6.Final.jar:] at org.jboss.resteasy.skeleton.key.as7.OAuthManagedResourceValve.lifecycleEvent(OAuthManagedResourceValve.java:66) [skeleton-key-as7-3.0.6.Final.jar:] at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:115) [jbossweb-7.0.13.Final.jar:] at org.apache.catalina.core.StandardContext.start(StandardContext.java:3845) [jbossweb-7.0.13.Final.jar:] at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25] at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25] Caused by: java.lang.ClassNotFoundException: org.apache.http.impl.conn.PoolingClientConnectionManager from [Module "org.jboss.resteasy.resteasy-j…

http://stackoverflow.com/a/21042366
upvote count: 0
has comment: http://stackoverflow.com/comment/31637213
type: Answer
has body: If you don't want to serialize a variable declare it as transient. Serialization means saving the state of a variable. see here for detailed example.
has comment: http://stackoverflow.com/comment/31637955
downvote count: 1
score: -1
answers question: http://stackoverflow.com/q/21042147

http://stackoverflow.com/comment/31675048
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21063652
has text: as a good practice, you should also consider organizing imports instead of using '*'.

http://stackoverflow.com/comment/31649635
comment on: http://stackoverflow.com/a/21050168
type: Comment
has text: Thank you Frisch. I want to know(or make sure), aren't there any constants specific to Swing or size?
score: 1
type: AnswerComment

http://stackoverflow.com/q/21135225
accepted answer: http://stackoverflow.com/a/24296617
tagged with: cucumber-jvm
has body: I've written a CucumberJVM test harness and a large set of feature files to test my application. Some of these tests can take 10 to 20 minutes to run which means that the test harness appears to hang for long periods of time. To give my end users some confidence that the machine hasn't locked up, what I'd like to do at the start of each Scenario is to print the Scenario name. I know that the @Before can be used to define a glue method that will be executed before each test starts. So my question is: "How can I get the Scenario name in a @Before annotated method"
has title: CucumberJVM : Need to write Scenario name at start of each test
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24296617
tagged with: java
type: Question
score: 0
answer count: 1

http://stackoverflow.com/a/21108811
type: Answer
answers question: http://stackoverflow.com/q/21108328
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/31758522
type: AcceptedAnswer
upvote count: 6
has body: The proper way is to change project.version. But this is not recommended because development jar should has version with suffix -SNAPSHOT. Maven goes a long way to help you with version management and you will often see the SNAPSHOT designator in a version, which indicates that a project is in a state of development. More information: What exactly is a Maven Snapshot and why do we need it? How do I make my first Maven project? Other solution without changing project.version is to use property finalName. This solution removes whole version from artifact. ${project.artifactId} After applying your pom.xml should look like this: 4.0.0 com.example.something myproject 0.1-SNAPSHOT jar <name>My Project<name> ${project.artifactId} ... Property finalName apply also to Maven Assembly Plugin Read also: Controlling maven final name of jar artifact Maven versioning best practices
accepted answer of: http://stackoverflow.com/q/21108328
has comment: http://stackoverflow.com/comment/31758924

http://stackoverflow.com/a/21131275
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21131209
accepted answer of: http://stackoverflow.com/q/21131209
has body: Apparently, an oversight was done on my part. If I want Glassfish to use the context root I provided, I have to leave the Context Root field blank when deploying from web admin console. Everything else is fine, including WEB-INF/glassfish-web.xml file.

http://stackoverflow.com/a/21157410
answers question: http://stackoverflow.com/q/21156280
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21156280
has comment: http://stackoverflow.com/comment/31857119
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: I believe same answer applies to your problem - save WSLD document locally.
has comment: http://stackoverflow.com/comment/31848263

http://stackoverflow.com/q/21054622
has comment: http://stackoverflow.com/comment/31657861
accepted answer: http://stackoverflow.com/a/21058294
tagged with: java
has comment: http://stackoverflow.com/comment/31658078
has comment: http://stackoverflow.com/comment/31657926
has comment: http://stackoverflow.com/comment/31658128
type: Question
answer count: 2
score: 2
has comment: http://stackoverflow.com/comment/31658314
has comment: http://stackoverflow.com/comment/31658426
favorite count: 0
has comment: http://stackoverflow.com/comment/31658225
has comment: http://stackoverflow.com/comment/31657939
has comment: http://stackoverflow.com/comment/31665149
has comment: http://stackoverflow.com/comment/31658492
has answer: http://stackoverflow.com/a/21058294
has title: Name for this type of programming construct/design/pattern?
has comment: http://stackoverflow.com/comment/31657928
has comment: http://stackoverflow.com/comment/31659430
has comment: http://stackoverflow.com/comment/31658947
has comment: http://stackoverflow.com/comment/38796118
has body: Please don't chalk this up as a dumb question. This may seem very obvious to some, but it is not to me. I am working on a very, very large codebase. I continually see, in numerous classes, this pattern: public class myClass { public myClass[] doGetMyClassList(final String someParam) { // some code } } The class contains a method that returns an array or a list of itself. Is there a name for this? I would like to know if this belongs to some kind of programming practice.
possible better answer: http://stackoverflow.com/a/21058136
upvote count: 3
has comment: http://stackoverflow.com/comment/31659825
has answer: http://stackoverflow.com/a/21058136
has comment: http://stackoverflow.com/comment/31658089
tagged with: design-patterns
downvote count: 1
has comment: http://stackoverflow.com/comment/31658243
type: AnsweredQuestion

http://stackoverflow.com/q/21032468
accepted answer: http://stackoverflow.com/a/21032600
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/57347372
tagged with: jexcelapi
upvote count: 2
score: 1
tagged with: java
downvote count: 1
tagged with: excel
has answer: http://stackoverflow.com/a/21032600
type: Question
has answer: http://stackoverflow.com/a/57347372
answer count: 2
favorite count: 0
has title: jExcel getting cell content missing
has body: I read excel file correctly.For example my cell content is 0,987654321 in excel file.When I read it with jExcel api i reads just few chars of cell.For example 0,987. here is my read excel code part: Cell A = sheet.getCell(1, 1); String stringA = A.getContents().toString(); How can I fix that problem.I want all content of cell.

apache-commons
tags question: http://stackoverflow.com/q/21065121
tag name: apache-commons
type: Tag
tags question: http://stackoverflow.com/q/21182968
tags question: http://stackoverflow.com/q/21166573

http://stackoverflow.com/comment/31732216
comment on: http://stackoverflow.com/q/21094816
score: 0
has text: OK, now it makes more sense. Please show more code, though.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21145558
has title: RestTemplate should be static globally declared?
has answer: http://stackoverflow.com/a/21145797
linked to: http://stackoverflow.com/q/130794
favorite count: 0
has answer: http://stackoverflow.com/a/42121212
has answer: http://stackoverflow.com/a/21145667
has body: I am using Java Callable Future in my code. Below is my main code which uses the future and callables - public class TimeoutThread { public static void main(String[] args) throws Exception { ExecutorService executor = Executors.newFixedThreadPool(5); Future&lt;String&gt; future = executor.submit(new Task()); try { System.out.println("Started.."); System.out.println(future.get(3, TimeUnit.SECONDS)); System.out.println("Finished!"); } catch (TimeoutException e) { System.out.println("Terminated!"); } executor.shutdownNow(); } } Below is my Task class which implements the Callable interface and I need to generate URL depending on the hostname we have and then make a call to SERVERS using RestTemplate. If there is any exception in the first hostname, then I will generate URL for another hostname and I will try making a call. class Task implements Callable&lt;String&gt; { private static RestTemplate restTemplate = new RestTemplate(); @Override public String call() throws Exception { //.. some code for(String hostname : hostnames) { if(hostname == null) { continue; } try { String url = generateURL(hostname); response = restTemplate.getForObject(url, String.class); // make a response and then break break; } catch (Exception ex) { ex.printStackTrace(); // use logger } } } } So my question should I declare RestTemplate as static global variable? Or it should not be static in this scenario?
tagged with: multithreading
tagged with: resttemplate
answer count: 4
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/29466443
tagged with: java
has answer: http://stackoverflow.com/a/52971539
type: Question
accepted answer: http://stackoverflow.com/a/21145667
upvote count: 22
downvote count: 0
tagged with: callable
score: 22
possible better answer: http://stackoverflow.com/a/21145797

http://stackoverflow.com/q/21132508
tagged with: session-timeout
accepted answer: http://stackoverflow.com/a/22570285
has body: My problem is, I can't download files that are larger than 100mb and I suspect the html request This is the setHeader from my response HttpServletResponse response = (HttpServletResponse) requestContext.getExternalContext().getNativeResponse(); response.setContentType("application/octet-stream"); response.setHeader("Content-Disposition", "attachment; filename=\""+fileName+"\""); response.setHeader("Pragma", "public"); response.setHeader("Cache-control", "private"); And this is the stream declaration for read the file ServletOutputStream sos = response.getOutputStream(); sos.flush(); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String str = br.readLine(); while (str != null) { sos.write(str.getBytes()); sos.write(13); sos.write(10); str = br.readLine(); } This 'while' works fine for small files but in case of large files, it seems as if the session was lost because I miss debug and does not stop at the next breakpoint. Is there any way to prevent the execution miss
tagged with: filestream
upvote count: 1
tagged with: web-services
has comment: http://stackoverflow.com/comment/31801448
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22570285
tagged with: servlets
answer count: 2
has title: Can't Download large files in html request
possible better answer: http://stackoverflow.com/a/21132821
has comment: http://stackoverflow.com/comment/31801269
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/21132821
favorite count: 0

http://stackoverflow.com/a/21046356
downvote count: 0
answers question: http://stackoverflow.com/q/21030500
type: Answer
has body: Helo again, I figured out my problem, it was in the properties of stroke,so after some lenght of the compoment the stroke got activated which made changed to the drawn shape.By modifying the strokes solid array I was able the get the result I wanted. Thank you for your help and suggestions :) Take Care
score: 1
upvote count: 1

http://stackoverflow.com/q/21151803
has comment: http://stackoverflow.com/comment/31857312
tagged with: java
type: Question
upvote count: 2
favorite count: 0
has title: JavaFX HTMLEditor text wrap
has body: Is there a way to make a HTMLEditor text wrap in JavaFX? TextArea has the method setWrapText. HTML can have text wrapping set through CSS. The JavaFX CSS documentation specifies -fx-wrap-text for Labeled nodes, but that doesn't seem to work. To be specific, the following code doesn't make the text wrap: HTMLEditor htmlEditor = new HTMLEditor(); htmlEditor.setStyle("-fx-text-wrap: false;");
tagged with: http://stackoverflow.com/tag/html
tagged with: css
tagged with: javafx-2
score: 2
answer count: 0
downvote count: 0
type: UnansweredQuestion

timer
tag name: timer
tags question: http://stackoverflow.com/q/21101002
tags question: http://stackoverflow.com/q/21048584
tags question: http://stackoverflow.com/q/21077515
tags question: http://stackoverflow.com/q/21081035
tags question: http://stackoverflow.com/q/21153234
type: Tag
tags question: http://stackoverflow.com/q/21057972
tags question: http://stackoverflow.com/q/21148575
tags question: http://stackoverflow.com/q/21173801
tags question: http://stackoverflow.com/q/21048393
tags question: http://stackoverflow.com/q/21147921
tags question: http://stackoverflow.com/q/21084312
tags question: http://stackoverflow.com/q/21078891
tags question: http://stackoverflow.com/q/21082987
tags question: http://stackoverflow.com/q/21164185

http://stackoverflow.com/comment/31603734
type: AnswerComment
type: Comment
has text: @NarendraPathai Sure, but many novices have no idea what "debug" means. In a perfect world they'd look it up, but in this world they usually ignore the advice. Showing them how easy it is can go a long way. :)
score: 1
comment on: http://stackoverflow.com/a/21024225

http://stackoverflow.com/q/21099198
tagged with: java
tagged with: mysql
downvote count: 0
has body: I am working with TSP(Traveling salesmen problem) Solution in mysql. for that we are going to develop procedure where i want to execute following query -- variable coming from java CREATE PROCEDURE solve_tsp( inout ids varchar(21845); ) begin declare ret_ids varchar(21845); -- some code while length(ids) &gt; 0 do -- some assignment SELECT to_id,distance into @l_tmp_id,@l_distance FROM mst_distance_matrix WHERE from_id =',@l_tmp_id,' AND to_id IN (ids) -- ids is variable contains comma delimited string. order by distance desc limit 1 -- concat value of to_id in ret_ids variable and then remove from ids variable end while; select ret_ids; end;
accepted answer: http://stackoverflow.com/a/21099397
linked to: http://stackoverflow.com/q/15805562
type: AnsweredQuestion
score: 3
tagged with: traveling-salesman
favorite count: 0
has answer: http://stackoverflow.com/a/21099397
has title: how to run inline query in mysql
type: Question
answer count: 1
upvote count: 3

http://stackoverflow.com/comment/33518455
comment on: http://stackoverflow.com/a/21124721
score: 0
type: Comment
has text: How do you consume the file on the server side? I can't make Spring MVC receive it properly
type: AnswerComment

http://stackoverflow.com/comment/31727575
has text: So do you have the sms data and you ask for implementation of list view? If so you can search for simple examples of custom array adapter which you just give an array to the adapter and notify the list view for data change.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21091812

equals
tags question: http://stackoverflow.com/q/21120093
type: Tag
tags question: http://stackoverflow.com/q/21088031
tags question: http://stackoverflow.com/q/21099829
tags question: http://stackoverflow.com/q/21047100
tag name: equals

http://stackoverflow.com/a/21160515
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21160493
downvote count: 0
has comment: http://stackoverflow.com/comment/31892945
has comment: http://stackoverflow.com/comment/31852610
type: Answer
upvote count: 3
has body: You can use generics to make this simpler. Your getAllArticles can return a list of Article objects. It would look like this: public static List&lt;Article&gt; getAllArticles(){ Session se=openSession(); List&lt;Article&gt; li= (List&lt;Article&gt;)(se.createCriteria(Article.class).list()); se.close(); return li; } Then you should be able to iterate over it using the loop you showed: for(Article a : Boss.getAllArticles()){ // }
has comment: http://stackoverflow.com/comment/31887447
score: 3
has comment: http://stackoverflow.com/comment/31889370
accepted answer of: http://stackoverflow.com/q/21160493

http://stackoverflow.com/comment/81397916
type: Comment
type: QuestionComment
has text: Any news on this?
comment on: http://stackoverflow.com/q/21084777
score: 0

http://stackoverflow.com/a/21159954
upvote count: 3
has comment: http://stackoverflow.com/comment/31868950
score: 3
type: AcceptedAnswer
downvote count: 0
has body: Check out SecurityNamespaceHandler and work your way down from there. As you can see, it is in the spring-security-config artifact, in package org.springframework.security.config.
type: Answer
accepted answer of: http://stackoverflow.com/q/21148804
answers question: http://stackoverflow.com/q/21148804

http://stackoverflow.com/q/21089596
type: Question
tagged with: jtable
answer count: 3
downvote count: 0
tagged with: action
has body: I have Jtable that I want to add to the main JFrame when a MenuItem is triggered, but the problem is that will not show. If I add the table to panel from the beginning it shows, but I need it to show when the action occures. Here is the main class that creates the frame(I removed several items which are not needed to be posted like creating the menubar,menu etc): package gestiune; import java.awt.event.ActionEvent; import javax.swing.*; import java.awt.*; public class Gestiune { static Gest gest; static Action actListaAng; static JPanel panouPrinc; static ListaAngajati lang; static JMenuItem listaAng; static class Gest extends JFrame{ public Gest(){ actListaAng = new ActListaAng("List"); listaAng=new JMenuItem(actListaAng); panouPrinc = new JPanel(); panouPrinc.setBackground(Color.white); Container cp = getContentPane(); cp.add(panouPrinc); pack(); setTitle("Some title"); setSize(1000,700); setLocation(0,0); setVisible(true); setDefaultCloseOperation(DISPOSE_ON_CLOSE); } } public static void main(String[] args) { gest = new Gest(); } //class for listing action static class ActListaAng extends AbstractAction { public ActListaAng(String text){ super(text); } @Override public void actionPerformed(ActionEvent e) { lang = new ListaAngajati(); panouPrinc.add(lang); } } } Here is the table class: package gestiune; import javax.swing.*; import java.awt.*; public class ListaAngajati extends JPanel { JTable tabel; JScrollPane panouScroll; public ListaAngajati() { panouScroll = new JScrollPane(tabel); String[] numeCol = { "Nume", "Prenume", "Categorie", "Data Adaugare", "Ultima Modificare" }; Object[][] linii = { {"verban","adrian","sds","16-03-1989","acum"} }; tabel = new JTable(linii,numeCol); setLayout(new BorderLayout()); add(tabel.getTableHeader(), BorderLayout.PAGE_START); add(panouScroll); add(tabel); } } I've tried several things, like using repaint on ActionEvent, or directly into the the table class......and while if I add lang=new ListaAngajati(); panouPrinc.add(lan…
favorite count: 0
has title: Table not adding to panel on Action
possible better answer: http://stackoverflow.com/a/21089824
has answer: http://stackoverflow.com/a/21089802
has answer: http://stackoverflow.com/a/21089824
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21089901
accepted answer: http://stackoverflow.com/a/21089802
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/21078935
type: Question
type: AnsweredQuestion
has title: xml parsing with repeated names of nodes
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/21082409
tagged with: jaxb
answer count: 2
upvote count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/21079105
favorite count: 0
has answer: http://stackoverflow.com/a/21082409
has answer: http://stackoverflow.com/a/21079105
tagged with: http://stackoverflow.com/tag/xml
has body: Please tell me the best way to parse the below xml in java. Here I have the same name for root(element) and other nodes.Is that possible to use jaxb or I have to stick in to normal dom?

http://stackoverflow.com/a/21234667
type: Answer
accepted answer of: http://stackoverflow.com/q/21140032
answers question: http://stackoverflow.com/q/21140032
score: 1
type: AcceptedAnswer
downvote count: 0
has body: I won't advice you to hardcode the html inside the .java files, because the code is not readable and also hard to find for future modifications. Inline javascript is already a bad thing, but putting everything into a string in java code is a step beyond in terms of coupling. Option #1: the cleanest way Instead, you can have a resource html file and load it using a "local:///" URL, as the BrowserField demo shows: Display HTML content from a resource in your application In the same directory you can place javascript and css files, as you would do in a regular static web site. So theoretically you could also place image resource files there and reference them from html or js files. The URLs don't need the full path (e.g.: instead of local:///assets/images/marker.png you would have local:///marker.png). If you need to insert dynamic content into the html, then you can always insert placeholders into a template html resource file, and then do a string.replace from java code to replace the placeholders with the dynamic fields. This way you are addressing modifiability and separation of concerns. Option #2: the dirty hack I've shown you why your code was dirty, but as so many things in life it can still get worse. You can add a new layer of unmodifiability by encoding your image file to a base64 string, and setting a "data://" url to the image in markup or javascript. It might be acceptable for you if the icon is really small and you know in advance you are not going to change it frequently, but be aware base64 strings can grow really large. Option #3 (not tested) This is also kind of a hack. Assuming you can open your image using Class.getResourceAsStream, you could instantiate a ProtocolController in java code, then call setNavigationRequestHandler to set a handler that intercepts the kind of requests you are interested in, and pass the content loaded using Class.getResourceAsStream. Bonus option: (not tested) And here's a link to a BB forum post, where a guy shows you c…
upvote count: 1

http://stackoverflow.com/comment/31798365
comment on: http://stackoverflow.com/a/21128760
has text: Thank you for your help on this one.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21123359
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21123319
type: Answer
has body: I suppose it means something like: while(Math.abs(x*x - 2) &gt; TOLERANCE); which outputs: 1.5 1.4166666666666665 1.4142156862745097 1.4142135623746899
answers question: http://stackoverflow.com/q/21123319
score: 4
upvote count: 4
type: AcceptedAnswer

java-8
tags question: http://stackoverflow.com/q/21140954
tags question: http://stackoverflow.com/q/21163108
tags question: http://stackoverflow.com/q/21068198
tags question: http://stackoverflow.com/q/21171948
tags question: http://stackoverflow.com/q/21143212
tags question: http://stackoverflow.com/q/21043924
tag name: java-8
type: Tag

jax-rs
tags question: http://stackoverflow.com/q/21146651
tags question: http://stackoverflow.com/q/21134629
tags question: http://stackoverflow.com/q/21123389
tags question: http://stackoverflow.com/q/21053501
tags question: http://stackoverflow.com/q/21152099
tags question: http://stackoverflow.com/q/21147083
tags question: http://stackoverflow.com/q/21175823
tags question: http://stackoverflow.com/q/21032848
type: Tag
tags question: http://stackoverflow.com/q/21164901
tags question: http://stackoverflow.com/q/21126812
tags question: http://stackoverflow.com/q/21061332
tags question: http://stackoverflow.com/q/21159077
tags question: http://stackoverflow.com/q/21163962
tags question: http://stackoverflow.com/q/21178823
tags question: http://stackoverflow.com/q/21030643
tag name: jax-rs
tags question: http://stackoverflow.com/q/21181411
tags question: http://stackoverflow.com/q/21094726

http://stackoverflow.com/comment/31648493
type: Comment
comment on: http://stackoverflow.com/a/21048856
has text: Note that "spring " was not created by the above statement. It existed at least since the class was loaded, if not before.
score: 1
type: AnswerComment

http://stackoverflow.com/q/21081972
has comment: http://stackoverflow.com/comment/32004917
tagged with: awt
linked to: http://stackoverflow.com/q/13336802
has title: Strange behavior with platform collision and jumping
has body: I have developed a simple game in java using AWT and Swing. All you do is control a square with the spacebar that jumps up and down onto a never-ending stream of platforms. Everything works fine, but when a player jumps off a platform, holds the spacebar, and lands on another platform, he/she will randomly bounce or simply drop through the platform. From what I can tell, the error lies somewhere with the Player's behavior. Here's the all the code needed to test it: import java.awt.Color; import java.awt.Container; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.Timer; public class main { private static JFrame gui; private static Container pane; private static JPanel panel; public static void main(String[] args) { gui = new JFrame(); gui.setSize(500,500); gui.setTitle("An Experiment"); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pane=gui.getContentPane(); panel = new ColorPanel(Color.WHITE, 500, 500); pane.add(panel); gui.setVisible(true); gui.pack(); } //**************** //ColorPanel class //**************** private static class ColorPanel extends JPanel{ private static final long serialVersionUID = -1101242028703991986L; private Timer timer, dtimer; private KeyListener k; private Platform platform; private Player player; private int difficulty, score; public ColorPanel(Color backColor, int width, int height){ setBackground(backColor); setPreferredSize(new Dimension(width, height)); difficulty=-1; score=0; platform = new Platform(new Point(240,250), 50); player=new Player(width/2, height/2-100); k=new keyboardListener(); addKeyListener(k); setFocusable(true); timer = new javax.swing.Timer(15, new timerListener()); timer.start(); dtimer = new javax.swing.Timer(50000, new difficultyListener()); dtimer.start(); } public void…
score: 0
has comment: http://stackoverflow.com/comment/32224384
has comment: http://stackoverflow.com/comment/31754548
answer count: 1
has comment: http://stackoverflow.com/comment/31754497
has comment: http://stackoverflow.com/comment/32201067
has comment: http://stackoverflow.com/comment/32169105
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32167893
has comment: http://stackoverflow.com/comment/32201081
has answer: http://stackoverflow.com/a/21082030
has comment: http://stackoverflow.com/comment/32204290
tagged with: swing
tagged with: java
has comment: http://stackoverflow.com/comment/32224951
tagged with: collision-detection
linked to: http://stackoverflow.com/q/19626338
type: Question
linked to: http://stackoverflow.com/q/12683533

http://stackoverflow.com/comment/31786133
score: 0
type: Comment
type: QuestionComment
has text: @Sotirios Delimanolis I don't think so, I use Urban Dictionary :D
comment on: http://stackoverflow.com/q/21123852

http://stackoverflow.com/comment/64901888
type: Comment
comment on: http://stackoverflow.com/a/21150955
score: 0
type: AnswerComment
has text: @Mihai Ionescu Page not found for https://developers.google.com/commerce/wallet/instant-buy/

http://stackoverflow.com/q/21027297
has answer: http://stackoverflow.com/a/21052028
has body: I want to make gauge chart in android. I referred the following two sites http://www.fusioncharts.com http://www.amcharts.com But both of them didnot help What i am looking is to built something like this
has comment: http://stackoverflow.com/comment/31608481
has comment: http://stackoverflow.com/comment/31608541
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: charts
has answer: http://stackoverflow.com/a/21027420
answer count: 2
tagged with: gauge
has title: How to make gauge chart in android?
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31608405
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/a/21060401
has body: I assume that your Information.txt file and ReadFile.java are in same default package I edited your program like this: import java.io.*; class ReadFile { public static void main(String args[]) { String[] id = new String[1234]; // random number just for initialization String[] name = new String[1234]; String[] asg1 = new String[1234]; String[] asg2 = new String[1234]; try { String sCurrentLine; FileReader fr = new FileReader(ReadFile.class.getResource( "/Information.txt").getFile()); BufferedReader textReader = new BufferedReader(fr); int i = 0; String[] array = null; // Read file in separate parts and remove commas while ((sCurrentLine = textReader.readLine()) != null) { array = sCurrentLine.split(","); id[i] = array[0]; name[i] = array[1]; asg1[i] = array[2]; asg2[i] = array[3]; i++; } for(int j=0;j&lt;i;j++){ System.out.println(id[j] + " , " + name[j] + " , " + asg1[j] + " , " + asg2[j]); } textReader.close(); } // Catch exception if any catch (Exception e) { System.err.println("Error: " + e.getMessage()); } } }
upvote count: 1
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21060259

http://stackoverflow.com/comment/31710435
comment on: http://stackoverflow.com/a/21082775
has text: That's a good point. We haven't been told anything about how or when the other class is created, though, so I didn't want to make any assumptions.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31633848
comment on: http://stackoverflow.com/q/21040337
type: QuestionComment
type: Comment
has text: There **must** be something you are not telling us. What you describe is the most basic handling of transaction and it definitely works in Postgres that way. Please post the full Java code.
score: 2

http://stackoverflow.com/comment/31734176
type: Comment
comment on: http://stackoverflow.com/a/21095744
has text: That crossed my mind too, but this can't be the case as it would be caught during compile time, not runtime.
type: AnswerComment
score: 0

http://stackoverflow.com/a/21094744
type: Answer
has body: Hibernate itself have this funcionality, using the Example criterion. As you already have to use Hibernate's Session you could just do something like this: List results = session.createCriteria(MyClass.class) .add( Example.create(object) ) .list(); More info on Hibernate Documentation.
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21094249

http://stackoverflow.com/comment/31771568
comment on: http://stackoverflow.com/q/21115187
score: 0
type: QuestionComment
type: Comment
has text: I have added a simple example

http://stackoverflow.com/comment/31681340
comment on: http://stackoverflow.com/q/21067214
has text: In general, if you are running a 64-bit OS, it doesn't really matter unless you need to take advantage of specific features.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/21130696
has comment: http://stackoverflow.com/comment/31817501
answer count: 1
downvote count: 0
has title: Spring embedded database IllegalState error
tagged with: maven-3
favorite count: 0
tagged with: maven
tagged with: spring
tagged with: embedded-database
accepted answer: http://stackoverflow.com/a/21144192
has body: I have a spring project that I am setting up an embedded database to use for testing (currently it is HSQLDB). I have setup the custom context and datasource to use script files to initialize the application. When I run mvn (version 2) against the project, everything builds and tests fine, but as soon as i switch over to mvn (version 3) I get an error whenever the embedded-database has a tag. I can remove the tags and i have a working Datasource that I can run commands against, but adding a single script file (even empty) fails everytime. I know the files exist and are in the classpath at the expected place, cause I can manually open the files and run the commands through a jdbcTemplate. This is the spring context: &lt;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" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd" &lt;jdbc:embedded-database id="dataSource" type="HSQL"&gt; &lt;jdbc:script location="classpath:databaseTestEntries.sql" /&gt; &lt;/jdbc:embedded-database&gt; &lt;/beans&gt; This is the test file: @ContextConfiguration(locations={"classpath:testSpringContext.xml"}) public class TestDBCreationProcess extends AbstractTestNGSpringContextTests { @Autowired private DataSource dataSource; private JdbcTemplate jdbc; @Test public void testCanConnect() { ..... Test Code Here ..... } } Here is the test results that I get from TestNG when running maven 3. Failed tests: TestDBCreationProcess&gt;AbstractTestNGSpringContextTests.springTestContextPrepareTestInstance:130 » IllegalState Full Stack java.lang.IllegalStateException: Failed to load ApplicationContext at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at …
score: 4
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31799468
type: Question
has answer: http://stackoverflow.com/a/21144192
upvote count: 4

http://stackoverflow.com/comment/31686154
comment on: http://stackoverflow.com/q/21069433
score: 0
type: Comment
type: QuestionComment
has text: @Ds.109 Solved. look to my answer

http://stackoverflow.com/a/21155687
upvote count: 2
type: Answer
score: 2
has body: That depends on how you initialize it. According to the JavaDocs, the HashMap can take the data types of what it is storing, so if you do this: Map hashMap = new HashMap(); map.put("hello", "abc"); You would need to cast to get back your keys and data. However, if you do something like so: Map&lt;String, String&gt; hashMap = new HashMap&lt;&gt;(); map.put("hello", "abc"); You no longer need to cast the objects that you have. You can take a look here for more information on Generics.
downvote count: 0
answers question: http://stackoverflow.com/q/21155624

http://stackoverflow.com/a/21097278
has body: You may use Html class, for example: tv.setText(Html.fromHtml("This is a red text and this one is bold"); Further, you may also use SpannableStringBuilder, I recommend reading this link
has comment: http://stackoverflow.com/comment/31736655
has comment: http://stackoverflow.com/comment/31739885
has comment: http://stackoverflow.com/comment/31739904
answers question: http://stackoverflow.com/q/21097207
has comment: http://stackoverflow.com/comment/31748772
has comment: http://stackoverflow.com/comment/31748661
has comment: http://stackoverflow.com/comment/31738093
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31737107

http://stackoverflow.com/q/21062136
has body: I'm working with an activity that has thread operation at the end initialize a new fragment. When running the application there is no problem. But while returning from another window such as settings, it crashes. My code is as follows. Pleas mind that the actual error is ft.commit(). private void preHaberler() { try { new Thread(new Runnable(){ @Override public void run(){ haberler(); } }).start(); } catch(Exception ex) { test(ex.getMessage()); } } private void haberler() { try { int sayfa = 1; int sayi = 10; int modul = -1; int ekModul = -1; HaberlerListModel[] haberler = Haberler.list(modul, ekModul, sayi, sayfa); final Bundle arguments = new Bundle(); arguments.putParcelableArray(HaberListesiFragment.ARG_HABERLER, haberler); arguments.putInt(HaberListesiFragment.ARG_SAYFA, sayfa); arguments.putInt(HaberListesiFragment.ARG_SAYI, sayi); arguments.putInt(HaberListesiFragment.ARG_MODUL, modul); arguments.putInt(HaberListesiFragment.ARG_EKMODUL, ekModul); runOnUiThread(new Runnable(){ @Override public void run(){ HaberListesiFragment hlf = new HaberListesiFragment(); hlf.setArguments(arguments); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); //ft.setCustomAnimations(android.R.anim.slide_in_left, android.R.anim.slide_out_right); ft.setCustomAnimations(R.anim.enter, R.anim.exit, R.anim.pop_enter, R.anim.pop_exit); ft.replace(R.id.main_container, hlf); ft.addToBackStack("bir"); ft.commit(); // here is the error // } }); } catch(Exception ex) { test(ex.getMessage()); } } Here is the stack: DalvikVM[localhost:8629] Thread [&lt;1&gt; main] (Suspended (exception RuntimeException)) &lt;VM does not provide monitor information&gt; ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2180 ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2230 ActivityThread.access$600(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 141 ActivityThread$H.handleMessage(Message) line:…
tagged with: java
has comment: http://stackoverflow.com/comment/31671886
has comment: http://stackoverflow.com/comment/31672362
has comment: http://stackoverflow.com/comment/31671962
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31672229
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/31673755
has answer: http://stackoverflow.com/a/21063222
has title: Android crashes after return back from another window
type: Question

http://stackoverflow.com/q/21120184
has answer: http://stackoverflow.com/a/21120391
has comment: http://stackoverflow.com/comment/31778732
has body: Hello I'm new to Java and after reading a little about it I tried to make little program. The program contain two if stacks and I want if the one resolves the program to end and not read the second at all. Here is the code I came up with: Scanner myScanner = new Scanner(System.in); String independent1 = "money"; String independent2 = "succes"; String independent3 = "career"; String userInput; int randomNumber; System.out.println("I'm listening mortal. Pick your topic."); userInput = myScanner.next(); if(independent1.equals(userInput)) System.out.println("You should rely on yourself more than on mystic forces like me"); if(independent2.equals(userInput)) System.out.println("You should rely on yourself more than on mystic forces like me"); if(independent3.equals(userInput)) System.out.println("You should rely on yourself more than on mystic forces like me"); Random myRandom = new Random(); randomNumber =myRandom.nextInt(100)+1; if (randomNumber &gt;= 50){ System.out.println(randomNumber); System.out.println("Yes"); } else { System.out.println(randomNumber); System.out.println("No!"); I want if the "independent if" is true the program to end and not run the second one, can someone help me?
type: UnansweredQuestion
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21120392
has answer: http://stackoverflow.com/a/21120294
has title: if the first is true don't run the second
score: 0
has comment: http://stackoverflow.com/comment/31778764
has answer: http://stackoverflow.com/a/21120219
answer count: 4

http://stackoverflow.com/comment/31640720
score: 0
type: Comment
has text: you mean org.eclipse.ui.popupMenus extension point is now deprecated. Then what is the other solution for that?
type: AnswerComment
comment on: http://stackoverflow.com/a/21045369

http://stackoverflow.com/comment/31871760
type: Comment
has text: @KevinDiTraglia How do I know it's the first call? (I mean, without passing along some counter and stuff like that)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21171274

orchestration
tags question: http://stackoverflow.com/q/21095139
type: Tag
tag name: orchestration

http://stackoverflow.com/comment/31941472
score: 0
type: AnswerComment
has text: Does it work nice? You can accept your own answer for reputation :)
type: Comment
comment on: http://stackoverflow.com/a/21108041

http://stackoverflow.com/q/21151844
has comment: http://stackoverflow.com/comment/31837426
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21152442
has body: So I need a way to find the mode(s) in an array of 1000 elements, with each element generated randomly using math.Random() from 0-300. int[] nums = new int[1000]; for(int counter = 0; counter &lt; nums.length; counter++) nums[counter] = (int)(Math.random()*300); int maxKey = 0; int maxCounts = 0; sortData(array); int[] counts = new int[301]; for (int i = 0; i &lt; array.length; i++) { counts[array[i]]++; if (maxCounts &lt; counts[array[i]]) { maxCounts = counts[array[i]]; maxKey = array[i]; } } This is my current method, and it gives me the most occurring number, but if it turns out that something else occurred the same amount of times, it only outputs one number and ignore the rest. WE ARE NOT ALLOWED TO USE ARRAYLIST or HASHMAP (teacher forbade it) Please help me on how I can modify this code to generate an output of array that contains all the modes in the random array. Thank you guys! EDIT: Thanks to you guys, I got it: private static String calcMode(int[] array) { int[] counts = new int[array.length]; for (int i = 0; i &lt; array.length; i++) { counts[array[i]]++; } int max = counts[0]; for (int counter = 1; counter &lt; counts.length; counter++) { if (counts[counter] &gt; max) { max = counts[counter]; } } int[] modes = new int[array.length]; int j = 0; for (int i = 0; i &lt; counts.length; i++) { if (counts[i] == max) modes[j++] = array[i]; } toString(modes); return ""; } public static void toString(int[] array) { System.out.print("{"); for(int element: array) { if(element &gt; 0) System.out.print(element + " "); } System.out.print("}"); }
has title: Finding multiple modes in an array of integers with 1000 elements
possible better answer: http://stackoverflow.com/a/21152395
type: Question
linked to: http://stackoverflow.com/q/8858327
has comment: http://stackoverflow.com/comment/31837093
has comment: http://stackoverflow.com/comment/31837058
tagged with: arrays
has comment: http://stackoverflow.com/comment/31837984
has comment: http://stackoverflow.com/comment/31837628
accepted answer: http://stackoverflow.com/a/21152399
has comment: http://stackoverflow.com/comment/31837732
has comment: http://stackoverflow.com/comment/31837035
score: 0
has comment: http://stackoverflow.com/comment/31837581
has comment: http://stackoverflow.com/comment/31838036
tagged with: mode
has answer: http://stackoverflow.com/a/21152399
has answer: http://stackoverflow.com/a/21152395
tagged with: integer
has comment: http://stackoverflow.com/comment/31837884
has comment: http://stackoverflow.com/comment/31837407
has comment: http://stackoverflow.com/comment/31837883
has answer: http://stackoverflow.com/a/21154460
has comment: http://stackoverflow.com/comment/31837275
has comment: http://stackoverflow.com/comment/31837790
has comment: http://stackoverflow.com/comment/31837845
answer count: 4
has comment: http://stackoverflow.com/comment/31837159

http://stackoverflow.com/q/21146248
type: Question
has body: Why i am getting error in the starting of Employee constructor that cannot find symbol constuctor Person? class Person { String name = "noname"; Person(String nm) { name = nm; } } class Employee extends Person { String empID = "0000"; Employee(String eid) {// error empID = eid; } } public class EmployeeTest { public static void main(String args[]) { Employee e1 = new Employee("4321"); System.out.println(e1.empID); } }
has title: how to call superclass parameterized constructor by subclass?
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21147382
has comment: http://stackoverflow.com/comment/31826301
has answer: http://stackoverflow.com/a/21146315
has answer: http://stackoverflow.com/a/21146275
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/31847134
score: 0
type: AnswerComment
type: Comment
has text: @Jorge_B Another pitfall is that some minor methods get added to the core APIs (like String) and it is not very easy to avoid them all.
comment on: http://stackoverflow.com/a/21157774

http://stackoverflow.com/a/21148644
has comment: http://stackoverflow.com/comment/31833704
upvote count: 3
answers question: http://stackoverflow.com/q/21148575
type: Answer
score: 3
downvote count: 0
has body: When the Javadoc says that it repeats with a specific delay, the delay is the initial delay before the TimerTask starts and not for how long the TimerTask will run. You can repeat the task every period milliseconds. Look at the schedule method. Below is a simple example that repeats every 2 seconds, indefinitely. In the example, the call: timer.schedule(new RemindTask(seconds), 0, seconds * 1000); tells timer to run the RemindTask every seconds seconds (*1000 because the time here is really in miliseconds), with an initial delay of 0 - i.e. start the RemindTask right away and then keep repeating at regular intervals. import java.util.Timer; import java.util.TimerTask; public class Main { static Timer timer; static int i = 0; class RemindTask extends TimerTask { private int seconds; public RemindTask(int seconds) { this.seconds = seconds; } public void run() { i+= seconds ; System.out.println(i + " seconds!"); } } public Main(int seconds) { timer = new Timer(); timer.schedule(new RemindTask(seconds), 0, seconds * 1000); } public static void main(String args[]) { new Main(2); System.out.format("Task scheduled.%n"); } }
has comment: http://stackoverflow.com/comment/31831132

http://stackoverflow.com/comment/31686985
type: Comment
has text: If this indeed solved your problem, please consider marking this answer as the solution.
type: AnswerComment
comment on: http://stackoverflow.com/a/21069805
score: 0

http://stackoverflow.com/comment/31821551
comment on: http://stackoverflow.com/a/21143951
score: 1
type: AnswerComment
type: Comment
has text: `Class` isn't reserved, `class` is.

http://stackoverflow.com/comment/31785255
type: Comment
comment on: http://stackoverflow.com/a/21122958
type: AnswerComment
has text: @user1903782 these errors are clear that they shows various resources are missing thats why my friend this "cannot find symbol" error for various resources has been thrown by compiler like for ex: for "class Graphics location:" because you have not resolve the dependency for it by adding required jar to your classpath
score: 0

http://stackoverflow.com/a/21047688
answers question: http://stackoverflow.com/q/21047544
type: Answer
downvote count: 0
score: 1
has body: Just from looking at this snippet, I would assume that you have to convert "numberlist.get(i)" to an int. sum = 0; for(int i=0; i&lt;numberlist.size(); i++){ sum += Integer.parseInt(numberlist.get(i)); } Output.setText("The Sum of all the numbers is " + sum); }
upvote count: 1

http://stackoverflow.com/a/21045769
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21045419
answers question: http://stackoverflow.com/q/21045419
upvote count: 2
type: AcceptedAnswer
type: Answer
has body: You should flush() the PrintWriter in StreamReader.

http://stackoverflow.com/comment/31792701
comment on: http://stackoverflow.com/q/21119052
score: 0
has text: @AndrewThompson I read the article and thanks for that. I agree with it because I tried the JInternalFrame and JDialog methods and just got more and more frustrated until I just came back to the JFrame method. That's not my issue though, the frames display perfectly fine
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21151059
answers question: http://stackoverflow.com/q/21150620
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: There is no direct relationship between higher-level languages and assembly languages. It might be that a C compiler or Java JIT generates assembly language and then runs an assembler to convert this to machine instructions. Then again, it might be that it doesn't, since a compiler or JIT is just as capable of outputting machine instructions as an assembler is. This is entirely a design/implementation decision when you write your C compiler or your Java JIT. So if you were drawing a diagram of the technologies used to compile and execute code in the higher-level language, you might be able to leave out level 3 entirely, depending on exactly how the compiler was written. Assembly language is mostly (not entirely) a long-winded way of writing out machine instructions as human-readable text, but it's not the only way to generate machine instructions (as machine instructions are the only way to get the CPU to do anything involving "digital logic"). I'm not entirely sure why assembly is listed as a separate "virtual machine level". Unlike a high-level language it doesn't relate to a significantly different execution model from the model the machine instructions do. That said, it does abstract a few things that the machine instructions do not necessarily abstract. For example it contains labels and fixups and so on that are replaced by addresses and values by the time the machine code is loaded into memory and ready to run. But then again, machine code stored in an executable file does abstract those things too, so what level is that? Perhaps by reading further into your book you'll find examples of what this classification into levels is intended to achieve.

http://stackoverflow.com/comment/31653155
has text: @Fido, it's a well thought out library. If you plan to generate JSON, give it a `List<Map<String, String>>` and it can easily convert it.
score: 0
comment on: http://stackoverflow.com/q/21051516
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21166956
has body: I have a configuration file in following format : item1=true value=test item2=false pseudocode in app logic : if(item1) { do something } else { do something else } if(item2) { do something } else { do something else } Is there pattern to handle this kind of configuration ? So instead of conditional statements use something else ?
has answer: http://stackoverflow.com/a/21167155
has answer: http://stackoverflow.com/a/21167179
has answer: http://stackoverflow.com/a/21167097
answer count: 4
has answer: http://stackoverflow.com/a/21166986
score: 2
has title: Design pattern for handling app configuration
downvote count: 0
possible better answer: http://stackoverflow.com/a/21167179
type: AnsweredQuestion
favorite count: 0
accepted answer: http://stackoverflow.com/a/21166986
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/6529856
tagged with: design-patterns
tagged with: java

http://stackoverflow.com/q/21175259
tagged with: scala
type: UnansweredQuestion
has body: Long time listener first time caller. :-) I'm trying to slowly move our java webapp at work over to scala and the first small step is getting some scala code to compile in our project. I've added the scala-maven-plugin to our webapp specific pom like so: ... org.scala-lang scala-library <!--version>2.10.3</version--> 2.7.2 .... org.codehaus.mojo build-helper-maven-plugin add-source generate-sources add-source src/main/scala net.alchim31.maven scala-maven-plugin scala-compile-first process-resources add-source compile scala-test-compile process-test-resources testCompile and other variations but this is my latest. Now this is the pom for the webapp we have another pom for a jar that contains some common code we share with other apps. And both projects have dependencies on other internal jars. My scala class is a little tiny controller located in src/main/scala. The error I'm getting when I run a maven package or any maven command really is: [INFO] --- scala-maven-plugin:3.1.6:compile (scala-compile-first) @ producttool-webapp --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.663s [INFO] Finished at: Thu Jan 16 15:34:09 PST 2014 [INFO] Final Memory: 16M/213M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.1.6:compile (scala-compile-fi rst) on project producttool-webapp: Execution scala-compile-first of goal net.alchim31.maven:scala-m aven-plugin:3.1.6:compile failed: For artifact {company.com:vine-xml:null:jar}: The version cannot be em pty. -> [Help 1] I am seeing a warning/error when I debug this build but it doesn't make sense to me: [WARNING] The POM for company.com:vine-xml:jar:1.11.1 is invalid, transitive dependencies (if any) will not be available: 2 problems were encountered while building the effective m…
tagged with: maven
has answer: http://stackoverflow.com/a/21180081
tagged with: java
has title: scala maven plugin compile failing with the "version cannot be empty" for a random dependency
type: Question
tagged with: scala-maven-plugin
score: 4
upvote count: 4
answer count: 1
downvote count: 0
tagged with: maven-3
favorite count: 0

http://stackoverflow.com/q/21066635
has answer: http://stackoverflow.com/a/21071911
type: Question
linked to: http://stackoverflow.com/q/8802157
answer count: 1
downvote count: 0
has title: Append TextView Using Google Cloud Messaging data
has body: I wanna try make some chat apps using GCM. I try to learn step by step and confused on: How to append the TextView in my ReceiveActivity. How to append TextView in my Activity without tapping the notification from BroadcastReceiver? This is my GCMIntentService.java, I want the data from this class shown in ReceiveActivity without tapping the notification package com.fahri.runningchat;import android.app.IntentService; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.SystemClock; import android.support.v4.app.NotificationCompat; import android.util.Log; import com.google.android.gms.gcm.GoogleCloudMessaging; public class GcmIntentService extends IntentService{ Context context; public static final int NOTIFICATION_ID = 1; private NotificationManager mNotificationManager; NotificationCompat.Builder builder; public static final String TAG = "GCM Demo"; public GcmIntentService() { super("GcmIntentService"); // TODO Auto-generated constructor stub } @Override protected void onHandleIntent(Intent intent) { // TODO Auto-generated method stub Bundle extras = intent.getExtras(); String msg = intent.getStringExtra("message"); GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this); String messageType = gcm.getMessageType(intent); if (!extras.isEmpty()) { if (GoogleCloudMessaging. MESSAGE_TYPE_SEND_ERROR.equals(messageType)) { sendNotification("Send error: " + extras.toString()); } else if (GoogleCloudMessaging. MESSAGE_TYPE_DELETED.equals(messageType)) { sendNotification("Deleted messages on server: " + extras.toString()); // If it's a regular GCM message, do some work. } else if (GoogleCloudMessaging. MESSAGE_TYPE_MESSAGE.equals(messageType)) { // This loop represents the service doing some work. for (int i=0; i&lt;5; i++) { Log.i(TAG, "Working... " + (i+1) + "/5 @ " + SystemClock.elapsedRealtime()); try { Thread.sleep(500); } catch (Int…
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: google-cloud-messaging
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31685531
upvote count: 1

http://stackoverflow.com/a/21170868
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21170729
downvote count: 0
has body: Normally hashCode should not change during object lifetime, so it should use final fields. Since color can be changed during execution it should't be used in hashcode or equals
type: Answer

http://stackoverflow.com/comment/31711929
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21083160
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/45081/discussion-between-pmoney-and-user1919840)

http://stackoverflow.com/comment/31760149
type: Comment
comment on: http://stackoverflow.com/a/21109773
has text: Make them to call the reaction of the other aswell, because by the time the other check its collisions,the first one probably already moved (bouncing for example).
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43070394
comment on: http://stackoverflow.com/a/21054896
score: 1
type: AnswerComment
type: Comment
has text: Good catch regarding `withView()` not mutating the existing config. However, `objectMapper.setConfig(objectMapper.getSerializationConfig().withView(YourView.class));` works and is probably prefarable to subclassing `ObjectMapper`

http://stackoverflow.com/comment/31827523
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/21146693
type: Comment
has text: I don't know how much is Java integrated with Matlab with respect to other languages; if you already are going to rewrite it, it may be even better to use a fully compiled language like C++ (provided that you know both, of course)

http://stackoverflow.com/comment/31753027
type: Comment
type: QuestionComment
has text: Could you please roughly show us what you already have, in a nutshell? Like, what is your "drawer", right now? Is it some `JPanel` added to some `Container` that has `null` for layout?
comment on: http://stackoverflow.com/q/21105701
score: 0

http://stackoverflow.com/q/21030729
tagged with: tomcat7
has body: I'm working on Eclipse with Tomcat6 and I use PostgreSQL as database. I try to configure Tomcat6 on eclipse but it doesn't work. So I download a Tomca6 server. When I test my application I put my .war in the webapps directory on Tomcat6. But when I try to create a user in my site I always get the following error : permission denied for the relation User. It seems like I can't access my database from my application. However the user name that I use to insert data has all privileges on the database.I execute a GRANT ALL privileges to user name request when I created my database. Why do I get this error? Here is my exception message: Mapped "{[/getProjection/showAll/{movieId}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.List&lt;com.cap.theater.common.beans.Projection&gt; com.cap.theater.controllers.ProjectionController.showAllProjection(int,org.springframework.ui.ModelMap) Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0' FrameworkServlet 'mvc-dispatcher': initialization completed in 304 ms An error occured while trying to list movies : ERROR: permission denied for relation movie false nouveaute query is : SELECT distinct movie_id FROM Projection WHERE (day &gt; ? OR (day = ? AND "DATE" &gt;= ?)) Listing all movies.. An error occured while trying to list movies : ERROR: permission denied for relation movie false nouveaute query is : SELECT distinct movie_id FROM Projection WHERE (day &gt; ? OR (day = ? AND "DATE" &gt;= ?))
answer count: 0
tagged with: java
upvote count: 1
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/31615251
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31619294
favorite count: 0
tagged with: postgresql
has title: permission denied to access to database tomcat7
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/15520361

http://stackoverflow.com/comment/31731774
has text: Does it cover this case: My favorite number is 7, but I also like 5.
comment on: http://stackoverflow.com/a/21094653
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31604158
type: Comment
type: QuestionComment
has text: Use [ProcessBuilder](http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html), it will make your life much easier. Also, your examples are using globbing. You'll need a shell process to make your commands work.
comment on: http://stackoverflow.com/q/21024935
score: 0

http://stackoverflow.com/a/21057623
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21057594
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21057594
has body: To fix the scoping problem, move the declaration/initialization of x to a point before its first use: int x = scan.nextInt(); if( x&gt;MIN &amp;&amp; x&lt;MAX ) { grades[i] = x; } There are several problems with your code: if(scan.hasNextInt()) will be executed only before the first read of the int; you should change your code to check for next int on each iteration of the loop You need to add variables for the current min, max, and total You do not need to store the values in the array, because the three scalars are enough to compute all three outputs required of your program.

http://stackoverflow.com/q/21060438
answer count: 2
tagged with: singleton
has answer: http://stackoverflow.com/a/21060510
downvote count: 0
has body: I want to make list of inbuilt singleton classes available in Java and reason for making them singleton. For E.G. java.lang.Runtime Reason: since on whole Java application only one runtime environment can be possible. java.awt.Toolkit Reason: AWT needs only a single object to perform the binding and the object is relatively expensive to create Can we list out all singleton classes in Java?
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/52644344
score: 2
has title: Can we list inbuilt Singleton class with proper explanation why these classes require Singleton?
tagged with: java
type: Question

http://stackoverflow.com/comment/31883104
has text: Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: javax.mail.internet.MimeMessage.addRecipient
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21177430
type: Comment

http://stackoverflow.com/comment/31808832
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21135976
type: Comment
has text: Yup, the only thing the JIT has to detect here to be allowed to hoist the load of `stopReq` out of the loop is that no code inside the loop can changes its value to true (this has indeed nothing to do with the JMM as long as there are no synchronization primitives such as volatile, synchronized, etc. involved). In such a trivial case the JIT will *definitely* hoist the load out - heck we only got this post because it does exactly that ;)

http://stackoverflow.com/a/21126370
type: AcceptedAnswer
has body: I've kept SVN history logs in place by using TortoiseSVN's Repository Browser. If you have a recent SVN server, operations like "Move to", "Copy to" and "Rename" will keep history logs to the original. Be sure to update all checkouts after these kind of changes (else local changes will have a hard time merging with the new server reality). Files you no longer use can be moved to a "museum" or "attic" branch (and try to keep the original directory structure in there). Apache projects have been changing package names to indicate new versions that more or less break with previous versions (e.g. compare commons-lang 2.6 with 3.2). In SVN you can do this by simply renaming a directory in the trunk. I find it a good convention: all code that depends on the old version breaks but is easily updated by adding one character to the import statements (and ofcourse you verify the new version works as expected by reading the updated Apidocs). Re-implementing junk is, in my experience, harder than it looks at first glance. I use the @Deprecated annotation at class-level at first for classes that need to be replaced. Your IDE will clearly show where deprecated code is used and the compiler will show warnings. Create the re-implementation in a package 'version 2'. Then you can update like you would update from commons-lang version 2 to commons-lang version 3. Once this is all done, delete the deprecated classes (or package). Be careful when deleting deprecated classes though: the last time I tried deleting deprecated classes, I found a dependency on the deprecated classes in one little and old, but crucial and heavily tested, program and had to keep the deprecated classes in place to maintain backwards compatability.
score: 0
answers question: http://stackoverflow.com/q/21121841
accepted answer of: http://stackoverflow.com/q/21121841
type: Answer
has comment: http://stackoverflow.com/comment/31818416

http://stackoverflow.com/comment/31674138
comment on: http://stackoverflow.com/q/21063386
score: 0
type: Comment
type: QuestionComment
has text: It's `O(n)`, and you've already found out.

http://stackoverflow.com/comment/31713021
has text: thank you!and can you explain how this cache file work?why we need cache?
comment on: http://stackoverflow.com/a/21083779
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31703800
comment on: http://stackoverflow.com/a/21068586
score: 0
type: AnswerComment
type: Comment
has text: If your problem was with the mismatched JVM architecture, like the other answer suggested, maybe you should accept that answer to close this question off.

http://stackoverflow.com/q/21124879
has comment: http://stackoverflow.com/comment/31806190
tagged with: java
tagged with: methods
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31788169
has comment: http://stackoverflow.com/comment/31788076
tagged with: wait
score: 4
favorite count: 0
has answer: http://stackoverflow.com/a/21125339
has body: So my problem is that I need these methods to run one after another but I cannot work out how to make the methods wait before being run. Any help is appreciated. Thank you. Here is my code: public void startMoving() throws InterruptedException { moveEnemy("right",3); wait(); moveEnemy("down",3); wait(); moveEnemy("right",2); wait(); moveEnemy("up",1); wait(); moveEnemy("right",2); wait(); moveEnemy("up",2); wait(); moveEnemy("right",2); wait(); moveEnemy("down",4); wait(); moveEnemy("left",1); wait(); moveEnemy("down",2); wait(); moveEnemy("right",3); wait(); moveEnemy("up",2); wait(); moveEnemy("right",1); wait(); moveEnemy("up",1); wait(); moveEnemy("right",3); } public void moveEnemy(final String direction, final int numMoves) { Thread moveThread = new Thread(new Runnable() { public void run() { isMoving = true; int originalX = getX(); int originalY = getY(); for(int loop = 0; loop &lt;= 98*numMoves; loop++) { try { Thread.sleep(5); } catch (InterruptedException e){} if(direction.equals("up")) { setLocation(originalX,originalY+loop); } if(direction.equals("down")) { setLocation(originalX,originalY-loop); } if(direction.equals("left")) { setLocation(originalX-loop,originalY); } if(direction.equals("right")) { setLocation(originalX+loop,originalY); } } try { Thread.sleep(50); } catch (InterruptedException e){} notify(); } }); moveThread.start();
upvote count: 4
has comment: http://stackoverflow.com/comment/31787954
has comment: http://stackoverflow.com/comment/66254864
downvote count: 0
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31787917
has answer: http://stackoverflow.com/a/21124956
has title: How do I make Java wait for a method to finish before continuing?
tagged with: jbutton

http://stackoverflow.com/q/21139757
has comment: http://stackoverflow.com/comment/31814206
accepted answer: http://stackoverflow.com/a/21140052
favorite count: 0
upvote count: 2
tagged with: jdbc
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21140052
has comment: http://stackoverflow.com/comment/31813887
possible better answer: http://stackoverflow.com/a/21140125
tagged with: mysql
downvote count: 1
has answer: http://stackoverflow.com/a/21140125
type: Question
answer count: 2
has title: JDBC PreparedStatement results in MySQL syntax error
has body: I am getting the error "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 ''orderr'' at line 1" - so I assume the error is that I have used two ' but in my code I have not used any '. NB the table is actually named orderr. public void insertIntoDatabase(String table, Object... entries) { // take a table and Connection con = connect(); //add entries PreparedStatement preparedStatement = null; PreparedStatement preparedStatement2 = null; ResultSet rs = null; StringBuffer columnNames = new StringBuffer(); StringBuffer sbEntries = new StringBuffer(); for (int i = 0; i &lt; entries.length; i++) { if (entries[i] instanceof Integer) sbEntries.append((Integer) entries[i]); else if (entries[i] instanceof String) sbEntries.append((String) entries[i]); if (i != entries.length - 1)//if not last entry add sbEntries.append(" ,"); // a ' ,'. } try { preparedStatement = con.prepareStatement("select * from ? ;"); preparedStatement.setString(1, table); preparedStatement2 = con .prepareStatement("Insert into ?( ? ) values ( ? );"); ResultSet resultSet = preparedStatement.executeQuery(); // get the // number of // columns ResultSetMetaData rsmd; // for the table rsmd = resultSet.getMetaData(); int columnCount = rsmd.getColumnCount(); for (int i = 1; i &lt; columnCount + 1; i++) { // get column names, add to columnNames.append(rsmd.getColumnName(i)); // to sb if (i != columnCount) columnNames.append(" ,"); } columnCount = rsmd.getColumnCount(); preparedStatement2.setString(1, table); preparedStatement2.setString(2, columnNames.toString()); //add sb's to statement preparedStatement2.setString(3, sbEntries.toString()); preparedStatement2.executeUpdate(); } catch (SQLException e) { System.out.println("2" + e.getMessage()); } finally{ try { if (rs != null) { rs.close(); } if (preparedStatement != null) { preparedStatement.close(); } if(preparedStatement2 != null){ preparedStatement2.close(); } if (con != nul…

http://stackoverflow.com/comment/31682447
type: AnswerComment
type: Comment
has text: The static keyword means all customer panels would be using the same controller. What if you want to use a different controller later for only one instance of the customer panel? Also any code anywhere in the entire project could change the static variable for all instances of the panel. Mad programmer is definitely right, static is not the way to go.
comment on: http://stackoverflow.com/a/21067602
score: 0

utf-8
tags question: http://stackoverflow.com/q/21061388
tags question: http://stackoverflow.com/q/21102520
tags question: http://stackoverflow.com/q/21078323
tags question: http://stackoverflow.com/q/21090083
tags question: http://stackoverflow.com/q/21037104
tag name: utf-8
tags question: http://stackoverflow.com/q/21096367
type: Tag

http://stackoverflow.com/q/21028438
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31636010
has title: Gradle sourceCompatibility has no effect to subprojects
has comment: http://stackoverflow.com/comment/31634758
has comment: http://stackoverflow.com/comment/31614102
accepted answer: http://stackoverflow.com/a/24862369
tagged with: gradle
linked to: http://stackoverflow.com/q/16679593
has comment: http://stackoverflow.com/comment/38609670
type: Question
has comment: http://stackoverflow.com/comment/35963853
has comment: http://stackoverflow.com/comment/31634848
has comment: http://stackoverflow.com/comment/31636831
tagged with: bytecode
tagged with: java
possible better answer: http://stackoverflow.com/a/21051506
has comment: http://stackoverflow.com/comment/31618329
has answer: http://stackoverflow.com/a/21051506
tagged with: compatibility
downvote count: 0
has body: I have Java 6 and 7 installed on my machine. Gradle uses 1.7 (checked using gradle -v). But I need to compile my code to be compatible with Java 1.6. As far as I understand the documentation I can use the sourceCompatibility property to do so (and indirectly the targetCompatibility which defaults to the sourceCompatibility). So I added the following line to my build file (on the root level, not in any closure): sourceCompatibility = 1.6 (to be sure I also added the targetCompatibility = 1.6 in some trials, but that should not make a difference) To check whether the result was actually compatible with 1.6 I unzipped the resulting jar, cd into the WEB-INF/classes folder and used javap -verbose on the first .class file I encountered. But no matter whether I set the target compatibility or whether I used 1.5 instead of 1.6 or whether I specified it as string ('1.6'), each time the result of javap was minor version: 0 major version: 51 Afaik this means it is Java 1.7 Bytecode, which is wrong. Any ideas why the sourceCompatibility-setting doesn't work? Or is javap not the correct way to check the compatibility? UPDATE: Yes, this is actually a multi-project build but I only checked one of the subprojects' build results. In this subproject's build file I made the mentioned changes to be sure they are actually applied. In addition, I added the following in the root project's build file (as @Vidya proposed as well): allprojects { sourceCompatibility = 1.6 targetCompatibility = 1.6 } But this didn't help either. UPDATE 2: I checked the setting of sourceCompatibility with this snippet in the relevant build.gradle files: compileJava.doFirst { println "source compatibility " + sourceCompatibility } It revealed that my sourceCompatibility is set to 1.7 although I tried to set it to 1.6. When I extracted the simplest subproject and built in on its own the sourceCompatibility is set correctly and the Java Byte code is compatible to 1.6. However, even this sub-project uses the wrong …
score: 72
has comment: http://stackoverflow.com/comment/31637245
has answer: http://stackoverflow.com/a/24862369
favorite count: 0
has comment: http://stackoverflow.com/comment/38638560
has comment: http://stackoverflow.com/comment/31635475
upvote count: 72
has answer: http://stackoverflow.com/a/36989484
has comment: http://stackoverflow.com/comment/31614215
has answer: http://stackoverflow.com/a/69597825
has comment: http://stackoverflow.com/comment/38610182
answer count: 4

http://stackoverflow.com/q/21108353
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21108548
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31757234
upvote count: 1
answer count: 1
tagged with: string
favorite count: 0
score: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/31757242
has comment: http://stackoverflow.com/comment/31757673
has comment: http://stackoverflow.com/comment/31757370
has title: Getting minumum value but greater than 0
accepted answer: http://stackoverflow.com/a/21108548
has body: I have day, seconds, hours. I want to get the minimum value but not zero among these there variables. How can I get that ? I can get the minimum value, if these variables are Integers. long time = 1387670712 * (long) 1000; Date past = new Date(time); Date now = new Date(); String day = TimeUnit.MILLISECONDS.toDays(now.getTime() - past.getTime()) + " days ago"; String sec = TimeUnit.MILLISECONDS.toMinutes(now.getTime() - past.getTime()) + "minutes ago"; String hours = TimeUnit.MILLISECONDS.toHours(now.getTime() - past.getTime()) + " hours ago";

http://stackoverflow.com/q/21060220
upvote count: 1
tagged with: swing
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31671426
tagged with: jpanel
linked to: http://stackoverflow.com/q/18777893
linked to: http://stackoverflow.com/q/13401109
linked to: http://stackoverflow.com/q/16391680
favorite count: 0
linked to: http://stackoverflow.com/q/13943810
has comment: http://stackoverflow.com/comment/31668805
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31668264
linked to: http://stackoverflow.com/q/9864267
has title: How to set background image on JFrame
has body: i couldn't set a image as a background image on my jframe .. here is my code anyone can help me with that??? import javax.swing.*; import javax.swing.WindowConstants.*; import java.awt.*; import java.awt.event.*; public class project2 extends JFrame{ private JFrame newFrame = new JFrame(); private JButton exitButton; public project2() { mainWindow(); } private void mainWindow() { JPanel mainPanel = new JPanel(); JButton distance = new JButton("Distance"); JButton time = new JButton("Time"); JButton temp = new JButton("Temperature"); JButton weight = new JButton("Weight"); JButton exit = new JButton("Exit"); JLabel unitMeasure = new JLabel("What unit of measure would you like to convert?"); unitMeasure.setFont(new Font("Serif", Font.BOLD, 18)); setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(600,480); setTitle("Universal Converter"); setResizable(false); setLayout(new FlowLayout()); distance.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { actionWindow("Distance", 200, 200); } }); time.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { actionWindow("Time", 300, 300); } }); temp.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { actionWindow("Temp", 400, 400); } }); weight.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { actionWindow("Weight", 500, 500); } }); exit.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { System.exit(0); } }); add(unitMeasure, BorderLayout.CENTER); mainPanel.add(distance, BorderLayout.CENTER); mainPanel.add(time, BorderLayout.CENTER); mainPanel.add(temp, BorderLayout.CENTER); mainPanel.add(weight, BorderLayout.CENTER); add(mainPanel); add(exit); setLocationRelativeTo(null); } public void actionWindow(String title, int xValue, int yValue) { newFrame = new JFrame(title); newFrame.setSize(xValue, yValue); newFrame.setUndecorated(false); exitButton = new…
has comment: http://stackoverflow.com/comment/31668756
linked to: http://stackoverflow.com/q/19699623
linked to: http://stackoverflow.com/q/1064977
answer count: 0
has comment: http://stackoverflow.com/comment/31668303
has comment: http://stackoverflow.com/comment/31668394
score: 0
tagged with: java
duplicate of: http://stackoverflow.com/q/16391680
has comment: http://stackoverflow.com/comment/31668441

http://stackoverflow.com/a/21072363
type: Answer
has body: 1) Tough question to answer without seeing the XML schema, I've seen well designed schemas that result in tight, lean XML, and others that are a mess and very bloated. To test it write some test code that serializes your Java objects to a byte[] and compare it's size to the XML payload you currently produce. 2) Might be worth looking into a chunking process, 150MB is pretty large for a single payload. Also are you using GZIP compression for this already? Also may be worth looking at Fast Infoset. Basically it's a binary encoding for XML that generally helps reduce the size of an XML Document.
answers question: http://stackoverflow.com/q/21072180
accepted answer of: http://stackoverflow.com/q/21072180
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/32293434
type: Comment
has text: @M Oehm I found another possible solution for this: I have the rotation of the enemie, and the angle between the player and the enemie (relative to x-Axis). Couldn't i check, if the angle between them is in a a tollerance area (lets say enemie.getRotation() + 20 >= angle between them >= enemie.getRotation() - 20). And ofc the distance check stays the same. Isn't that easier?
type: AnswerComment
comment on: http://stackoverflow.com/a/21134577
score: 0

http://stackoverflow.com/a/21064855
score: 0
has body: A simple selection based on the type is all you really need. This could be considered a builder pattern because it just initializes a new instance of myClass. Note, this is rough pseudo code. FunctionName(SomeType instance) { string aPostfix = "_1"; string bPostfix = "_2"; string selectedPostFix; // This is your strategy selector switch(typeof(SomeType.Name) { case "TypeA": selectedPostFix = aPostFix; case "TypeB": selectedPostFix = bPostFix; } return new myClass() { A = instance.GetProperty("A" + selectedPostfix).Value, B = instance.GetProperty("B" + selectedPostfix).Value, ... } }
answers question: http://stackoverflow.com/q/21064740
type: Answer

http://stackoverflow.com/comment/31676907
comment on: http://stackoverflow.com/a/21061560
has text: Is there any difference between `Executors.newSingleThreadExecutor()` and `Runnable`?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31881398
comment on: http://stackoverflow.com/a/21176477
type: AnswerComment
score: 0
type: Comment
has text: No, then closing the main JFrame won't behave as expected. The better solution is to use a JDialog as the dependent window.

http://stackoverflow.com/comment/31702310
has text: can you point out MainFrame.java:1353, MainFrame.java:48 and MainFrame.java:1402. without looking thoroughly, I wouldnt be able to help
comment on: http://stackoverflow.com/q/21076825
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21026016
answers question: http://stackoverflow.com/q/21025967
has body: Pass any list size in get count method of your adapter . If it is zero, your list will not populate :- @Override public int getCount() { // TODO Auto-generated method stub return list.size(); // your list }
score: 1
accepted answer of: http://stackoverflow.com/q/21025967
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/63957000
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21047414
downvote count: 0
has comment: http://stackoverflow.com/comment/126327097
has body: This is a Server-Side issue. Server side have .crt file for HTTPS, here we have to do combine cat your_domain.**crt** your_domain.**ca-bundle** &gt;&gt; ssl_your_domain_.crt then restart. sudo service nginx restart For me working fine.
score: 1

http://stackoverflow.com/q/21063982
tagged with: jtable
score: 0
has body: JTable table = new JTable(data,columnNames); JScrollPane pane = new JScrollPane(table); this.add(pane); this.add(table); My data is showing but column name is not showing on top.
favorite count: 0
type: UnansweredQuestion
tagged with: swing
downvote count: 1
linked to: http://stackoverflow.com/q/9647522
has comment: http://stackoverflow.com/comment/31675371
tagged with: java
has title: Unable to get column name in JTable in Swing
upvote count: 1
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21064408
has answer: http://stackoverflow.com/a/21071560

http://stackoverflow.com/q/21154368
type: UnansweredQuestion
tagged with: maven
tagged with: spring
has answer: http://stackoverflow.com/a/21155943
tagged with: java
has comment: http://stackoverflow.com/comment/31846801
type: Question
has comment: http://stackoverflow.com/comment/31848704
has title: Unable to locate NamespaceHandler for namespace (http://www.springframework.org/schema/context)
score: 0
has body: I am getting the following exception on a Spring project.Even I tried several solutions suggested in stackoverflow I could not resolve yet. Could you please help me ? java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate NamespaceHandler for namespace [http://www.springframework.org/schema/context] Offending resource: class path resource [springDAO.xml] SpringDao.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:lang="http://www.springframework.org/schema/lang" xmlns:util="http://www.springframework.org/schema/util" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:amq="http://activemq.org/config/1.0" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://activemq.org/config/1.0 http://activemq.apache.org/schema/core/activemq-core-5.0-SNAPSHOT.xsd" default-autowire="autodetect"> <tx:annotation-drive…
answer count: 1

http://stackoverflow.com/comment/31730648
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21082665
has text: @DennisMeng Hmm, yes it would appear so. Thanks for that, I will keep that in mind.

http://stackoverflow.com/q/21110944
tagged with: swing
linked to: http://stackoverflow.com/q/7971178
tagged with: java
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/7971178
has comment: http://stackoverflow.com/comment/31765454
has title: Swing JLabel check if text got clipped
answer count: 0
has body: when a JLabel's text does not completely fit into the label, it will be cut off and "..." is appended. Can I somehow check if this has happened? Like: JLabel.isTextClipped()?
type: Question
linked to: http://stackoverflow.com/q/3597550
tagged with: jlabel
has comment: http://stackoverflow.com/comment/31761536
score: 0

http://stackoverflow.com/q/21169191
has body: i have an application in which i have a table and that table is converting its data to a pdf file it is in sturts and it is working fine.But i have to add this capability to another application which also have a table with data from the database.i am posting my working code and also the piece of code where i want to add this capability.... this is the page from where i am exporting the data to a pdf file.i have implemented this in my table but when i click on the table <display:table class="tableData context-menu-one" name="sessionScope.DetailsFormBean.listOfUser" requestURI="/search.do" id="tableData" pagesize="10" style="overflow-x: scroll" export="true"> <display:column title="Favourites"/> <display:column property="call_type" title="CALL_TYPE"/> <display:column property="a_no" title="A_NO"/> <display:column property="b_no" title="B_NO"/> <display:column property="call_duration" title="CALL_DURATION"/> <display:column property="start_day" title="START_DAY"/> <display:column property="end_day" title="END_DAY"/> <display:column property="a_home_circle" title="A_HOME_CIRCLE"/> <display:column property="a_rome_circle" title="A_ROME_CIRCLE"/> <display:column property="a_imei" title="A_IMEI"/> <display:column property="a_imsi" title="A_IMSI"/> <display:setProperty name="export.excel.filename" value="ActorDetails.xls"/> <display:setProperty name="export.pdf.filename" value="ActorDetails.pdf"/> <display:setProperty name="export.pdf" value="true" /> </display:table> <forward name="found" path="/searchpage.jsp"/> the table dissapears when i click on the export to pdf options....somebody please help
has answer: http://stackoverflow.com/a/21169592
type: AnsweredQuestion
tagged with: java
tagged with: struts-1
type: Question
score: 0
tagged with: http://stackoverflow.com/tag/pdf
has title: Getting problems with table in struts to convert its data to a pdf format
answer count: 1
accepted answer: http://stackoverflow.com/a/21169592

http://stackoverflow.com/q/21175842
tagged with: eclipse
tagged with: https
type: Question
has title: http request + port 8443
downvote count: 0
has body: My question is quite similar like this (accessing port 8443 with http in tomcat), however the question was not answered. I am developing a site and I am using Eclipse Juno and Tomcat 7. I have configured tomcat to accept https request. <Connector SSLEnabled="true" clientAuth="false" keystoreFile="C:\ssl\.keystore" keystorePass="changeit" maxThreads="150" port="8443" protocol="HTTP/1.1" scheme="https" secure="true" sslProtocol="TLS"/> So, when you access the site through https + 8443, it presents a warning message, therefore it was successfully configured. Also, I redirected all http request to https by adding this code to my web.xml: <web-resource-collection> HTTPSOnly /* </web-resource-collection> CONFIDENTIAL <web-resource-collection> HTTPSOrHTTP *.ico /img/* /css/* </web-resource-collection> NONE So, when you access the site using http + 8080, you are redirected to https + 8443. However, one problem that I encounter is when the user use http + 8443. So, when you access the URL, it prompts a download dialog. Is there any way to throw an error message or a redirection perhaps when you access the site using http + 8443?
score: 1
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/31881135
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/31881539
tagged with: java
upvote count: 1

http://stackoverflow.com/a/21053340
score: 3
downvote count: 1
type: Answer
upvote count: 4
has body: It mostly (who knows what JVM's are out there) does not copy the methods per instance. It maintains the methods per class. It then resolves which class holds the method in question and calls that.
answers question: http://stackoverflow.com/q/21053285

http://stackoverflow.com/q/21068397
has comment: http://stackoverflow.com/comment/31683670
downvote count: 0
tagged with: minecraft
has title: Is there a more efficient way to write to files?
has answer: http://stackoverflow.com/a/21068762
has comment: http://stackoverflow.com/comment/31684221
has body: I'm writing a Bukkit (for those that don't know: "Mod and plugins that simplify running and managing Minecraft servers. Includes forums and documentation.") plugin that stores user's commands into their own respective files. I feel like the code I've written is extremely inefficient. Every time the PlayerCommandPreprocessEvent fires (every time a message with "/" at the beginning is inputted), I create a variable like so... PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(fM.retrievePlayerFile(e.getPlayer().getName()), true))) Then I write to that specific player's file, and then close the output. Inefficient? Yeah, I think so.... Is there a simpler, more efficient way to do this? Thanks in advance. Edit: fM.retrievePlayerFile(Player player) is this: public File retrievePlayerFile(String player) { player = player.toLowerCase(); return (new File(plugin.getDataFolder(), "/users/" + player)); }
has comment: http://stackoverflow.com/comment/31683615
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31684142
has comment: http://stackoverflow.com/comment/31683925
has comment: http://stackoverflow.com/comment/31683660
upvote count: 1
tagged with: plugins
accepted answer: http://stackoverflow.com/a/21068762
has comment: http://stackoverflow.com/comment/31684298
type: AnsweredQuestion
tagged with: performance
score: 1
tagged with: java
tagged with: bukkit
has comment: http://stackoverflow.com/comment/31683804
type: Question

http://stackoverflow.com/q/21068902
type: Question
tagged with: multiple-inheritance
has comment: http://stackoverflow.com/comment/31684817
score: 1
tagged with: inheritance
has body: I'm making a game. I have an Entity class which is a pair of x,y coordinates and width and height. I want to subclass this Entity class into quite a few new classes to add combinations of groups of features. There are several "groups" of features that I want to add: Moveable { public float getVelocityX(); public void setVelocityX(float velocityX); public float getVelocityY(); public void setVelocityY(float velocityY); public void moveRelative(float dx, float dy); public void setPosX(float posX); } and Rotatable { public void setAngularVelocity(float degreesPerSecond); public void setAbsoluteAngle(float angle); } and Resizable { void setAbsoluteSize(int width, int height); void setRelativeSize(int widthGrowFactor, int heightGrowFactor); public void setWidth(float width); public void setHeight(float height); } ... and more (Updateable, Drawable, Collideable). Some Entities can rotate/be drawn but not move/collide/update/resize: "static" non-touchable things such as background animations (clouds, sun, stars). Some entities can move/rotate/be drawn/update/collide/resize: the player characters and monsters. Some entities can only be drawn: the HUD for the game. Some entities can move/be drawn/update/collide but not rotate/resize: gun shots for example. As you can see I have a need for combinations of the above features and it would easily be solved with some multiple inheritance. Why not do it with interfaces you ask? Because that would leave me copy/pasting a LOT of code for all the methods and creating new types of Entity classes would introduce copy/pasta forever. You might ask why I wouldn't just create a subclass that could do it all and then override the methods that aren't supposed to work with empty methods or throw a UnsupportedOperationException in those that are invalid? This is still copy/paste even though it's a single line in each method. An Entity that can only move() might end up with 50 methods with "throw new UnsupportedOperationException();" and that i…
favorite count: 0
has comment: http://stackoverflow.com/comment/31686189
has answer: http://stackoverflow.com/a/21069021
answer count: 4
has comment: http://stackoverflow.com/comment/31686811
has title: Ways to circumvent lack of multiple inheritance acceptably in Java
has answer: http://stackoverflow.com/a/21069519
has answer: http://stackoverflow.com/a/21069858
upvote count: 3
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/31685883
has comment: http://stackoverflow.com/comment/31686033
has comment: http://stackoverflow.com/comment/31684733
has comment: http://stackoverflow.com/comment/31685361
tagged with: oop
has answer: http://stackoverflow.com/a/21069019
has comment: http://stackoverflow.com/comment/31685126
tagged with: java

http://stackoverflow.com/comment/31717055
type: Comment
comment on: http://stackoverflow.com/a/21048059
type: AnswerComment
has text: I have this variable in zul creating place!
score: 0

http://stackoverflow.com/comment/122022297
comment on: http://stackoverflow.com/a/56152688
type: AnswerComment
score: 0
type: Comment
has text: This post really saved my day. I was not able to solve the issue until I tweaked with above settings by adding proxy details. Worked like a champ.

http://stackoverflow.com/comment/31914306
score: 0
has text: @PeterLawrey, how would he go about doing that?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21142895

http://stackoverflow.com/a/78894289
score: 0
type: Answer
has body: tl;dr java.time.Instant // Represent a moment as seen in UTC. .parse( "2014-01-10T09:41:16.000+0000" .replace( "+0000" , "Z" ) // Strict compliance with ISO 8601. ) java.time You are using terribly-flawed legacy classes that have been supplanted by the modern java.time classes defined in JSR 310. Instant The Instant class represents a moment, a point on the timeline, as seen from an offset from UTC of zero hours-minutes-seconds. ISO 8601 Your string nearly complies with the strict version of ISO 8601 standard. The standard tolerates an offset missing its COLON character, +0000 rather than +00:00. But the Instant class does not by default. So replace that part of the string. You can use Z as an abbreviation of +00:00, pronounced “Zulu”. String input = "2014-01-10T09:41:16.000+0000".replace( "+0000" , "Z" ) ; Instant instant = Instant.parse( input ) ; See this code run at Ideone.com. 2014-01-10T09:41:16.000Z 2014-01-10T09:41:16Z
answers question: http://stackoverflow.com/q/21137941

http://stackoverflow.com/comment/31879583
type: Comment
comment on: http://stackoverflow.com/a/21175415
has text: wat is input initalized as?
type: AnswerComment
score: 0

http://stackoverflow.com/a/21069227
type: Answer
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/31685418
answers question: http://stackoverflow.com/q/21069050
has body: Read the section from the Swing tutorial on How to Use GridLayout for an example or arranging components in a grid. I suggest you look at the table of contents for the tutorial to learn the basics of Swing programming.

http://stackoverflow.com/comment/31849670
has text: So the texture of the textureregion of the sprite should be a reference to the atlas? I don't really seethat inside of the create sprite method.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21158947
type: AnswerComment

http://stackoverflow.com/comment/31631058
comment on: http://stackoverflow.com/q/21039959
score: 6
type: Comment
type: QuestionComment
has text: The size of an exception is going to depend on your Java implementation and the depth of the call stack. What do you need this information for? You probably shouldn't have a zillion exceptions lying around, so it won't matter most of the time.

http://stackoverflow.com/comment/31724198
has text: Please include examples of input sequences and the *exact* sequence of tokens that you expect from the input. For example, exactly what token or tokens do you want to see produced by the input `3.`? What about `3`? What about `3.0`? What about `.0`? What about `+3.`? etc...
comment on: http://stackoverflow.com/q/21090648
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21049311
has comment: http://stackoverflow.com/comment/31649099
type: Answer
has comment: http://stackoverflow.com/comment/31648153
has body: I think you have three options, none being bullet proof: Share somehow the common entities. For example it is pretty clear that the Customer entity is used in every package. Of course the best way is to package all entities in an entity jar and provide it when selling other packages. After all you sell the business logic, not the entity mapping. Make some ugly abstractions, getting rid of the FKs. In this way you will have to change the code. E.g instead of relating entities from other modules, you could use an embedded (relatedEntityClass, relatedEntityId). With this solution you will have problems when you'll need to join/ eager load the other entity, for example. Sell the entire code and use some passwords/online activation for enabling modules.
upvote count: 1
answers question: http://stackoverflow.com/q/21049110
has comment: http://stackoverflow.com/comment/31648919
downvote count: 0
score: 1

http://stackoverflow.com/a/21046999
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21034448
score: 0
type: Answer
has body: OK I actually found the solution : https://github.com/libgdx/libgdx/blob/master/tests/gdx-tests/src/com/badlogic/gdx/tests/DecalTest.java
answers question: http://stackoverflow.com/q/21034448

http://stackoverflow.com/q/21115879
has comment: http://stackoverflow.com/comment/31771012
possible better answer: http://stackoverflow.com/a/21116515
has comment: http://stackoverflow.com/comment/31771022
has answer: http://stackoverflow.com/a/21117028
has answer: http://stackoverflow.com/a/21116515
type: AnsweredQuestion
downvote count: 0
score: 1
has title: Parsing JSON to Enum Fields
favorite count: 0
has comment: http://stackoverflow.com/comment/31770576
type: Question
answer count: 2
tagged with: android
accepted answer: http://stackoverflow.com/a/21117028
has comment: http://stackoverflow.com/comment/31770954
tagged with: java
tagged with: http://stackoverflow.com/tag/json
linked to: http://stackoverflow.com/q/10297264
tagged with: gson
has comment: http://stackoverflow.com/comment/31771453
upvote count: 1
has comment: http://stackoverflow.com/comment/31770999
tagged with: enums
has body: in my Android application, I am returned a simple JSON object with simple key value pairs, eg: {"username" : "billySmith", "gender" : 1} And an enum with the respective field names username and gender (String and int, respectively). I am trying to use Gson to parse the JSON object and populate the enum fields with the json values. I am a little uncertain of how to use GSON with enums. I am familiar with the concept that an instance of an object should be set equal to gson.fromJson(jsonObect, instanceType.class);. To add more detail, I am using Enums so that the values can be retrieved from anywhere in my android project. if (response.getStatusLine().getStatusCode() == 200 &amp;&amp; result != "") { GlobalEnum globalEnum = GlobalEnum.getInstance(); Gson gson = new GsonBuilder().create(); globalEnum = gson.fromJson(result, GlobalEnum.class); } where "result" is the string representation of an HTTP Response's entity GlobalEnum snippet: public enum GlobalEnum { INSTANCE; private String username; private int gender; public static GlobalEnum getInstance() { return INSTANCE; } public int getGender() { return gender; } public void setGender(int gender) { this.gender = gender; } } *Edit: Reworded: I have an enum, and I have a jsonObject. Both the enum and JSON object have "username" and "gender". using Gson, I would like to parse the JSON object so that the Values from the JSONobject will be assigned to the respective fields in the Enum.
has comment: http://stackoverflow.com/comment/31770916
has comment: http://stackoverflow.com/comment/31771716

http://stackoverflow.com/a/21096438
answers question: http://stackoverflow.com/q/21096367
has comment: http://stackoverflow.com/comment/107795913
score: 63
type: Answer
upvote count: 63
has body: Use an OutputStreamWriter: pstream = new PrintWriter(new OutputStreamWriter( csocket.getOutputStream(), StandardCharsets.UTF_8), true)
downvote count: 0

http://stackoverflow.com/a/21121139
has comment: http://stackoverflow.com/comment/31783098
type: Answer
answers question: http://stackoverflow.com/q/21120550
has comment: http://stackoverflow.com/comment/31781090
has comment: http://stackoverflow.com/comment/31781720
has comment: http://stackoverflow.com/comment/31781094
has body: In order to treat BattingOrder objects the same on certain fields (but still determine who has better ranking) You must override the equals method as well as the hashCode as well as put an identifier /** * Different BattingOrders who share these 3 fields * will get the same identifier */ public String identifier() { return game_ID +"-" + team_ID + "-" + battingOrder; } @Override public boolean equals(Object obj) { if (obj instanceof BattingOrder) { BattingOrder b = (BattingOrder) obj; if (this.game_ID.equals(game_ID) &amp;&amp; this.team_ID.equals(b.team_ID) &amp;&amp; this.battingOrder.equals(b.battingOrder)) { return true; } } return false; } @Override public int hashCode() { int hash = 5; hash = 59 * hash + Objects.hashCode(this.game_ID); hash = 59 * hash + Objects.hashCode(this.team_ID); hash = 59 * hash + Objects.hashCode(this.battingOrder); return hash; } Also I made BattingOrder implement Comparable @Override public int compareTo(BattingOrder o) { if (this.identifier().equals(o.identifier())) { return this.subOrder.compareTo(o.subOrder); } else if (this.game_ID.equals(o.game_ID) &amp;&amp; this.team_ID.equals(o.team_ID)) { return this.battingOrder.compareTo(o.battingOrder); } else { return o.team_ID.compareTo(this.team_ID); } } Now in your main you set up some Set Collection where you keep track of your BattingOrder objects I am using: HashMap&lt;String,BattingOrder&gt; players = new HashMap&lt;&gt;(); Where the Key is the BattingOrder's identifier and the Value is the BattingOrder Now for-each line you are reading do the following: String[] parsedData = s.split(","); BattingOrder bo = new BattingOrder(parsedData[0], parsedData[1],parsedData[2], parsedData[3], parsedData[4], parsedData[5]); if(players.containsKey(bo.identifier())) { BattingOrder inMap = players.get(bo.identifier()); if(bo.compareTo(inMap) &gt; 0) { players.put(bo.identifier(), bo); } } else { players.put(bo.identifier(), bo); } Once you have read all the lines: Convert your HashMap into a Lis…
has comment: http://stackoverflow.com/comment/31780778
has comment: http://stackoverflow.com/comment/31780668
has comment: http://stackoverflow.com/comment/31783171
has comment: http://stackoverflow.com/comment/31780467
has comment: http://stackoverflow.com/comment/31781154
score: 0

http://stackoverflow.com/comment/31844243
score: 1
comment on: http://stackoverflow.com/q/21154578
has text: *I am not able to use double with this method* - the method signature is `public static Font getFont(final String fontname, final float size)`; thus try using a `float fntSize` or cast your `double fntSize` to `(float)`.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31883884
comment on: http://stackoverflow.com/a/21177911
has text: Funny, it looks familiar, wait - that's my answer - only that I wrote it 5 minutes before you...
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/21034710
score: 2
downvote count: 0
upvote count: 2
has body: No. But you can use a version control software like SVN to check in your files with your comments. Then, if those comments are ever changed, you have historical documentation that the comments were there. And you can even see who changed the comments.
answers question: http://stackoverflow.com/q/21034689
type: Answer

http://stackoverflow.com/q/21093034
has answer: http://stackoverflow.com/a/21093133
tagged with: java
has comment: http://stackoverflow.com/comment/31728967
has comment: http://stackoverflow.com/comment/31728911
score: 4
upvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/31728823
downvote count: 0
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/31729035
type: UnansweredQuestion
tagged with: value-of
has comment: http://stackoverflow.com/comment/31728780
has comment: http://stackoverflow.com/comment/31728949
has comment: http://stackoverflow.com/comment/31728927
has body: String.valueOf(null); why valueOf(char[] c) is called and why not valueOf(Object o); ?? Why String.valueOf(null); produces a NullPointerException and String.valueOf((Object)null); do not produce any exception?
has comment: http://stackoverflow.com/comment/31728594
has answer: http://stackoverflow.com/a/21093143
type: Question
has comment: http://stackoverflow.com/comment/31729067
has title: why valueOf(null) calls the constructor valueOf(char[])

http://stackoverflow.com/comment/31885996
comment on: http://stackoverflow.com/q/21179153
type: Comment
has text: @MagicMan not working
score: 0
type: QuestionComment

http://stackoverflow.com/q/21183939
accepted answer: http://stackoverflow.com/a/21184206
upvote count: 2
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
score: 2
type: AnsweredQuestion
downvote count: 0
has body: I have a non-static data which I need to use on conversion. How can I transfer this data into my adapter class? Probably can I use a XmlAdapter in JAXB RI without an empty constructor (and without annotation of course)? public class VariableAdapter extends XmlAdapter&lt;String, Variable&gt; { private Map&lt;String, Variable&gt; varMap; public VariableAdapter(Map&lt;String, Variable&gt; aVarMap) { varMap = aVarMap; } public Variable unmarshal(String aVarName) { return varMap.get(aVarName); } public String marshal(Variable v) { return v.getName(); } } Here is my class, which I need to convert from/into XML public class Variable { private String name; private Object value; public Value(String aName, Object aValue) { name = aName; value = aValue; } public String getName() {return name;} public Object getValue() {return value;} public void setValue(Object aValue) {value = aValue;} } All Variable objects are initialized before XML processing and must be serialized per its name. Variable after unmarshalling can get another value (if its value was changed between serialization/deserialization).
tagged with: java
has title: Non-stateless JAXB XML Adapters
tagged with: jaxb
type: Question
has answer: http://stackoverflow.com/a/21184206

http://stackoverflow.com/a/77074451
answers question: http://stackoverflow.com/q/21111070
has body: Take a look at SMILE library at https://haifengl.github.io/clustering.html It has a lot of ready made opensource clustering algorithm implementation in Java
score: 0
has comment: http://stackoverflow.com/comment/135902281
type: Answer

http://stackoverflow.com/comment/31628402
comment on: http://stackoverflow.com/a/21028977
score: 0
type: AnswerComment
has text: happy to be of assistance!
type: Comment

http://stackoverflow.com/q/21120043
type: Question
answer count: 2
score: 42
tagged with: java
tagged with: concurrency
upvote count: 42
tagged with: optimistic-locking
tagged with: locking
downvote count: 0
has comment: http://stackoverflow.com/comment/32962532
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21787133
has answer: http://stackoverflow.com/a/26916543
has title: Optimistic Locking by concrete (Java) example
has body: I have spent my morning reading all the top articles that Google churns up on optimistic locking, and for the life of me, I still don't really get it. I understand that optimistic locking involves the addition of a column for tracking the record's "version", and that this column can be a timestamp, a counter, or any other version-tracking construct. But I'm still not understanding how that ensures WRITE integrity (meaning that if multiple process are updating the same entity at the same time, that afterwards, the entity correctly reflects the true state it should be in). Can someone provide a concrete, easy-to-understand example of how optimistic locking could be used in Java (against, perhaps, a MySQL DB). Let's say we have a Person entity: public class Person { private String firstName; private String lastName; private int age; private Color favoriteColor; } And that Person instances get persisted to a people MySQL table: CREATE TABLE people ( person_id PRIMARY KEY AUTO_INCREMENT, first_name VARCHAR(100) NOT NULL, last_name VARCHAR(100) NOT NULL, # } I realize these column defs are not valid but this is just pseudo-code age INT NOT NULL, color_id FOREIGN KEY (colors) NOT NULL # Say we also have a colors table and people has a 1:1 relationship with it ); Now let's say there are 2 software systems, or 1 system with 2 threads on it, that are trying to update the same Person entity at the same time: Software/Thread #1 is trying to persist a surname change (from "John Smith" to "John Doe") Software/Thread #2 is trying to persist a change in the favorite color (from RED to GREEN) My questions: How could optimistic locking be implemented on the people and/or colors tables? (Looking for specific DDL example) How could you then utilize this optimistic locking at the application/Java layer? (Looking for specific code example) Can someone run me through a scenario where the DDL/code changes (from #1 and #2 above) would come into play in my scenario (or any other scenario) an…
favorite count: 0

updates
tags question: http://stackoverflow.com/q/21141643
tags question: http://stackoverflow.com/q/21100666
tag name: updates
type: Tag
tags question: http://stackoverflow.com/q/21171530

http://stackoverflow.com/comment/31715766
comment on: http://stackoverflow.com/a/21068053
has text: this helped me a lot, even more then the official docs. thanks
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21075345
tagged with: threadpool
has answer: http://stackoverflow.com/a/45087112
score: 4
tagged with: tomcat
has body: We have deployed our Remedy mid-tier on Tomcat 6.0.20, however Tomcat goes down very frequently, almost every day, with the following error : Maximum number of threads (400) created for address null and port 8080 We have tried increasing the the number of threads, but it just does not suffice. The time difference between 2 subsequent crashes just increases, but it is the same problem. We have obtained the thread dump, and it shows that most of the threads are in 'Waiting' state. Please refer below obtained from thread logs as follows: *"http-8080-670" - Thread t@8479 java.lang.Thread.State: WAITING at sun.misc.Unsafe.park(Native Method) - parking to wait for &lt;775f1471&gt; (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.park(Unknown Source) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(Unknown Source) at com.bmc.arsys.apitransport.connection.a.get(Unknown Source) at com.bmc.arsys.apitransport.connection.c.getProxy(Unknown Source) at com.bmc.arsys.api.PoolingProxyManager.getProxy(Unknown Source) at com.bmc.arsys.apitransport.connection.c.getProxy(Unknown Source) at com.bmc.arsys.api.ARServerUser.getListEntryObjects(Unknown Source) at com.remedy.arsys.goat.savesearches.ARUserSearches.loadFromServer(Unknown Source) - locked &lt;32e7e815&gt; (a com.remedy.arsys.goat.savesearches.ARUserSearches) at com.remedy.arsys.goat.aspects.IARUserSearchesServiceCacheAspect.ajc$around$com_remedy_arsys_goat_aspects_IARUserSearchesServiceCacheAspect$1$181ba497(IARUserSearchesServiceCacheAspect.aj:44) - locked &lt;794bbdbc&gt; (a java.lang.String) at com.remedy.arsys.goat.savesearches.ARUserSearches.getUserSearches(Unknown Source) at com.remedy.arsys.goat.UserDataEmitter.&lt;init&gt;(Unknown Source) at com.remedy.arsys.goat.service.DHTMLRequestService.requestDispatch(Unknown Source) at com.remedy.arsys.stubs.FormServlet.doRequest(Unknown Source) at com.remedy.arsys.stubs.GoatServlet.po…
has title: Threads in Waiting state - Apache Tomcat
favorite count: 0
type: UnansweredQuestion
tagged with: garbage-collection
upvote count: 4
has answer: http://stackoverflow.com/a/21084045
has comment: http://stackoverflow.com/comment/31712690
downvote count: 0
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/q/21091700
type: Question
has answer: http://stackoverflow.com/a/21092506
accepted answer: http://stackoverflow.com/a/21092506
has answer: http://stackoverflow.com/a/21091840
has title: I want to pass enhanced for loop dynamic values in SQL Query?
score: 0
has answer: http://stackoverflow.com/a/21091954
tagged with: sql
answer count: 4
has body: I'm having one List Collection values like below and I want while retrieving value should be pass in sql query. List obl = new ArrayList(); obs.add(1234); obs.add(1235); obs.add(1236); obs.add(1237); Here problem is only first value getting passed? I want all values should passed and appropriate output should get. for(Object obls:obl){ String sql2 ="select Student_Name,FeesHead,Amount,BankName,YearID from test where ReceiptNo = '"+obls+"'"; stat = con.prepareStatement(sql2); rs=stat.executeQuery(); rs.next(); String StudentName = rs.getString(1); String FeesHead = rs.getString(2); String Amount = rs.getString(3); String BankName = rs.getString(4); Integer LYearID = rs.getInt(5); System.out.println("Fees Head"+FeesHead); System.out.println("Amount"+Amount); System.out.println("Bank Name"+BankName); System.out.println("Year ID --"+LYearID); }
possible better answer: http://stackoverflow.com/a/21091840
has comment: http://stackoverflow.com/comment/31725946
has answer: http://stackoverflow.com/a/21091988
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/21142926
tagged with: android-fragments
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31824895
type: Question
has title: How to make a Fragment callback from within a ListAdapter?
score: 0
has comment: http://stackoverflow.com/comment/31819952
has comment: http://stackoverflow.com/comment/31824803
has body: In my Android app I've created a list of options in a fragment using a custom ListAdapter (extending BaseAdapter). When a user clicks on one of the options it needs to switch the fragment in the activity for another fragment. From within the fragment I can do the following to switch the fragment: callbacks.switchNewScreen(); I don't have any idea though, how I can use this same thing from within the listadapter. Furthermore, the list is created from a string-array: Option one The second option And yet another option I do this because I want to be able to translate them into other languages in the future. The problem is now that even if I get to the other fragment, how do I know which option was pressed?
tagged with: listadapter
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/31819625

http://stackoverflow.com/a/21098221
has comment: http://stackoverflow.com/comment/42815310
has body: You have to create bean extending SimpleUrlAuthenticationSuccessHandler or SavedRequestAwareAuthenticationSuccessHandler. For example: @Bean public SavedRequestAwareAuthenticationSuccessHandler successHandler() { SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler(); successHandler.setTargetUrlParameter("/secure/"); return successHandler; } Then you have to setup it on bean extending AbstractAuthenticationProcessingFilter: UsernamePasswordAuthenticationFilter authenticationFilter = new UsernamePasswordAuthenticationFilter(); authenticationFilter.setAuthenticationSuccessHandler(successHandler());
downvote count: 0
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/63023372
answers question: http://stackoverflow.com/q/21097528

http://stackoverflow.com/a/21088958
type: Answer
has body: You don't need a main method in your Reports2 class. You main frame class already has a main to launch from. Take out the main method and wrap everything from that main in a Report2 constructor Your Reports2 class is already a JFrame yet you are creating another JFrame. Don't do that. instead just add to the class JFrame JTable table = new JTable(buildTableModel(rs)); //JFrame frame = new JFrame("Reports"); &lt;--- take this out //frame.setSize(800, 700); &lt;--- don't set size, just pack setTitle("Reports"); &lt;--- set title add(new JScrollPane(table)); &lt;--- add to scrollpane pack(); &lt;--- pack setVisible(true); &lt;--- set visible Notice how I took out the JFrame, since the class is already a JFrame As seen above, I use .pack() which is preferred rather than setting the size And lastly, all you need to do in the actionPerformed is instantiate the Reports2, that's it private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) { Report2 report = new Report2(); } I ran it, and it works fine with the above mentioned fixes. Given your SQL is correct, it should run for you also. Side Note: NEVER, EVER swallow your exceptions } catch (Exception ex) { } Put something meaningful that will allow you to see what exceptions are being thrown if any. } catch (Exception ex) { ex.printStackTrace(); } Also I would consider using a JDialog (instead of a second JFrame) as you can control its modality. It's just as easy to create a JDialog as it is to create a JFrame. It's almost the exact same process
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21088324
accepted answer of: http://stackoverflow.com/q/21088324
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/21077716
upvote count: 3
answers question: http://stackoverflow.com/q/21077635
downvote count: 0
has body: The first one is a declaration and initialization at the same time . In the second example instead you have the declaration of the b variable not initialized and then in the constructor you initialize the variable ... The functional difference can come at the moment that you add another constructor, in that case the b variable should be initialized even in that constructor or if not, there will be a huge difference . In the first case you have the variable initialized no matter how many constructor you implement ... Honestly I don't understand how can you pretend to have the same bytecode, writing two different things as for this case .
has comment: http://stackoverflow.com/comment/31700556
type: Answer
score: 3

jscrollpane
tags question: http://stackoverflow.com/q/21079036
tag name: jscrollpane
tags question: http://stackoverflow.com/q/21149959
type: Tag
tags question: http://stackoverflow.com/q/21130354
tags question: http://stackoverflow.com/q/21169200
tags question: http://stackoverflow.com/q/21072452
tags question: http://stackoverflow.com/q/21068666
tags question: http://stackoverflow.com/q/21063382
tags question: http://stackoverflow.com/q/21074259
tags question: http://stackoverflow.com/q/21049360
tags question: http://stackoverflow.com/q/21058395
tags question: http://stackoverflow.com/q/21019458
tags question: http://stackoverflow.com/q/21075307
tags question: http://stackoverflow.com/q/21031287
tags question: http://stackoverflow.com/q/21073826
tags question: http://stackoverflow.com/q/21099137

http://stackoverflow.com/comment/31778217
comment on: http://stackoverflow.com/a/21119890
type: AnswerComment
score: 0
type: Comment
has text: @user3194888 have u get my friend

http://stackoverflow.com/comment/31746533
type: Comment
comment on: http://stackoverflow.com/a/21101769
score: 0
type: AnswerComment
has text: @mattforsythe Yeah, my point was more that every networking application has to use a "bare" socket at a low enough level, so it's not a very good way to phrase things. "Ignores proxy settings" or "doesn't support proxying" is more accurate.

memory-management
tags question: http://stackoverflow.com/q/21024492
tags question: http://stackoverflow.com/q/21039472
tags question: http://stackoverflow.com/q/21111015
tags question: http://stackoverflow.com/q/21121837
type: Tag
tags question: http://stackoverflow.com/q/21080522
tags question: http://stackoverflow.com/q/21064578
tags question: http://stackoverflow.com/q/21071519
tag name: memory-management

http://stackoverflow.com/q/21117890
tagged with: spring-mvc
type: AnsweredQuestion
score: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21118649
has body: I'm following the Spring Security guide from here, http://docs.spring.io/spring-security/site/docs/3.2.0.RELEASE/reference/htmlsingle/#jc-httpsecurity I have these set up in my pom.xml org.springframework.security spring-security-web 3.2.0.RELEASE org.springframework.security spring-security-config 3.2.0.RELEASE In my security configuration class @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { I have protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .anyRequest().authenticated() .and() .formLogin() .loginPage("/login") .permitAll(); } HttpSecurity has the method formLogin, but the other calls starting with authorizeRequests() return the type org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer<org.springframework.security.config.annotation.web.builders.HttpSecurity>.ExpressionInterceptUrlRegistry which doesn't have the method formLogin anymore. Any idea where I'm going wrong?
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/21118649
tagged with: spring-security
favorite count: 0
upvote count: 2
has title: spring security HttpSecurity
tagged with: maven
tagged with: spring

http://stackoverflow.com/q/21139576
type: Question
has answer: http://stackoverflow.com/a/21158461
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31814120
has comment: http://stackoverflow.com/comment/31813609
has title: stored procedure(postgresql) and jdbc results are different
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31816727
has comment: http://stackoverflow.com/comment/31815962
downvote count: 1
tagged with: postgresql-9.1
has comment: http://stackoverflow.com/comment/31815431
has body: I have a stored procedure which returns numeric, when i run it on db(posgtresql 9.1), result is 367,52. but when i run it on java, result(resultset.getString) is 367,50 it's not happening always. most of the times the results are same however sometimes the results are different. my jdbc driver: postgresql-9.1-903.jdbc3.jar. java: jdk 6 function is very big, it calculates with double precision values, then cast them numeric values. in db: SELECT function::numeric from function(bigint parameter) in java; PreparedStatement ps=conn.prepareStatement("SELECT function::numeric from function(bigint parameter)"); ResultSet rs=ps.executeQuery(); if(rs.next()){ System.out.println(rs.getString(1)); }
has comment: http://stackoverflow.com/comment/31815166
tagged with: java
score: -1
tagged with: numeric

http://stackoverflow.com/a/21257292
score: -1
downvote count: 1
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/21079435
has body: try to use a jsch ssh connexion insted of socket conexion

http://stackoverflow.com/comment/31608994
has text: I think perhaps because the text I'm looking for is a little bit deeper. I received a TimeoutException. My issue is that I'm trying to keep it as generic as possible so many situations can fit. Here's the full xpath of the text I'm trying to find: //*[@id="elementID"]/div[1]/div[1] Ideally I want to avoid using anything further than the elementID.
comment on: http://stackoverflow.com/q/21027048
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21148761
accepted answer of: http://stackoverflow.com/q/21148726
has body: int is a primitive, its default value is 0. When you try to store a char (another primitive) as an int, the space = 32.
downvote count: 0
answers question: http://stackoverflow.com/q/21148726
type: Answer
score: 3
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/q/21049110
has answer: http://stackoverflow.com/a/21049311
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31647963
has title: JPA Modularization and Entities Relationship
score: 2
has comment: http://stackoverflow.com/comment/31648017
downvote count: 0
tagged with: java
has body: I am trying to split a monolitic ERP into modules (sales, inventory, finance...) so they can be sold as a unit or in a combination of any of them. As I'm using JPA the problem comes when dealing with Foreign Keys since they are represented as collections. If each module, in a separated jar file, has its own set of entities, how do they relate between each other? Should I get rid of FK's? If so what's the point in continue working with JPA?
has comment: http://stackoverflow.com/comment/31647746
tagged with: modularity
has comment: http://stackoverflow.com/comment/31647660
type: Question
upvote count: 2
tagged with: jpa
answer count: 1
has comment: http://stackoverflow.com/comment/31647640
favorite count: 0

http://stackoverflow.com/comment/35767334
comment on: http://stackoverflow.com/a/21064513
score: 0
type: AnswerComment
has text: Simple Linear Regression is only for a single parameter.
type: Comment

http://stackoverflow.com/q/21142109
score: 2
has title: Executable Jar not finding classes
answer count: 0
tagged with: reflection
tagged with: java
has body: My problem is that I have created an executable jar file that will scan classes in a Java project using the Class.forName(...) to get the class object, and then perform some operations. Now I want to use this executable jar in another project, but I'm running into a problem with the Class.forName(...) method not picking up the fully qualified name and getting a class not found exception. Now after some fiddling around with it I found that if I use a fully-qualified class name from the jar it works fine. So my issue is that it is using its own classpath, and not the classpath of the project that it is being used in. Is there a way to update the executable jar's classpath to include the classpath of the Java project that it is being used in?
type: Question
tagged with: executable
has comment: http://stackoverflow.com/comment/31819211
tagged with: class
downvote count: 0
tagged with: jar
favorite count: 0
has comment: http://stackoverflow.com/comment/31818664
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31818421

http://stackoverflow.com/a/21156482
upvote count: 1
has comment: http://stackoverflow.com/comment/31848990
type: Answer
has body: First is to create an ObjectMapper instance and then readValue() method with the value type specified in the argument. You'll get the mapped object. For example: mapper = new ObjectMapper(); idObject = mapper.readValue(jsonpayload.getBytes(), mapClass); Also a valid JSON would look like this: { "ids" : ["id1", "id2"] }
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21152099

http://stackoverflow.com/a/21023468
has comment: http://stackoverflow.com/comment/31605606
upvote count: 2
answers question: http://stackoverflow.com/q/21023348
has body: If you use static arrays, since you will need to access every element once in order to reverse it, there is no smaller complexity than n. However, if you use a double linked list, then by definiton you have access to the elements in both directions. From head to tail and from tail to head, because there are double pointers in the Node class used. Therefore, reverse is not even needed, but rather you iterate from tail to head when needed.
downvote count: 0
has comment: http://stackoverflow.com/comment/31609561
has comment: http://stackoverflow.com/comment/31605433
has comment: http://stackoverflow.com/comment/31605063
has comment: http://stackoverflow.com/comment/31609991
type: Answer
score: 2

http://stackoverflow.com/a/21101888
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21101842
type: Answer
has comment: http://stackoverflow.com/comment/31852946
has comment: http://stackoverflow.com/comment/31746022
answers question: http://stackoverflow.com/q/21101842
has body: File listFiles() may return null for example if the file is not a directory. You'll need to check for != null before accessing the length field to prevent the NPE. Now, why isn't /sdcard a directory? On many devices it is a symbolic link. You'll have to resolve the symbolic link with getCanonicalFile() first. Example: File[] files = dir.getCanonicalFile().listFiles(new myFilter()); if (files != null) { for (File file : files) { //... Also, it's beneficial to store the result of an "expensive" method call such as listFiles() instead of calling it repeatedly.
score: 0

http://stackoverflow.com/a/50845456
has body: Note: There appears to be a fix implemented in JDK 10 that ensures the Custom Thread Pool uses the expected number of threads. Parallel stream execution within a custom ForkJoinPool should obey the parallelism https://bugs.openjdk.java.net/browse/JDK-8190974
answers question: http://stackoverflow.com/q/21163108
type: Answer
score: 6
downvote count: 0
upvote count: 6

http://stackoverflow.com/q/21178674
tagged with: jfreechart
type: Question
tagged with: graphics
has answer: http://stackoverflow.com/a/21179682
score: 0
has title: How do I draw graphics on top a ChartPanel?
answer count: 1
tagged with: mouselistener
has body: I have a ChartPanel object displaying some information, but I would like to be able to use a MouseListener interface to draw on top of it. I'd imagine I would just have to call some sort of "repaint()" method at the end of the interface methods and perform some override, but after spending considerable time researching I haven't a clue how to go about doing this. Is this even possible? Any insight or advice?
accepted answer: http://stackoverflow.com/a/21179682
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31885430

http://stackoverflow.com/q/21168678
has body: I want to save the file to the text in the sd card, after following some tutorials I get a reference about the coding should I use. but after I run it does not work, just get the message "saved files failed". is there any of my coding wrong? I want to save the file came from textview in the activity. I also add a message on the manifest.xml &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; iam using this code public class PreposisiRemoval extends Activity implements OnClickListener{ Button button; Button buttonsave; TextView tv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_preposisi_removal); Intent intent = getIntent(); String result = intent.getStringExtra("resultFilter"); tv = (TextView) findViewById(R.id.textView8); tv.setMovementMethod(new ScrollingMovementMethod()); tv.setText(result); tv.setTextSize(14); buttonsave = (Button) findViewById(R.id.button8); buttonsave.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub boolean mExternalStorageAvailable = false; boolean mExternalStorageWriteable = false; String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { mExternalStorageAvailable = mExternalStorageWriteable = true; } else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) { mExternalStorageAvailable = true; mExternalStorageWriteable = false; } else { mExternalStorageAvailable = mExternalStorageWriteable = false; } try { File myFile = new File("/sdcard/documents/PreposisiRemoval.txt"); myFile.createNewFile(); FileOutputStream FOut = new FileOutputStream(myFile); OutputStreamWriter myOutWriter = new OutputStreamWriter(FOut); myOutWriter.append(tv.getText()); myOutWriter.close(); FOut.close(); Toast.makeText(getBaseContext(), "Save Files Successful", Toast.LENGTH_SHORT).show(); } catch (Exception e) { Toast.makeText(getBaseContext(…
has title: save textfile into sd card
tagged with: android
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: save
type: Question
has answer: http://stackoverflow.com/a/21168980
has answer: http://stackoverflow.com/a/21168737
accepted answer: http://stackoverflow.com/a/21168737
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/21168980
answer count: 2

http://stackoverflow.com/q/21035932
score: 1
tagged with: java
has title: Cannot find RTP payload for encoded audio
upvote count: 1
type: Question
tagged with: network-programming
tagged with: sipdroid
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22895045
accepted answer: http://stackoverflow.com/a/22895045
tagged with: android
has body: I am trying to encrypt Sipdroid, and to do that I have to encrypt the the RTP packet after it gets the encoded audio payload. I am using this function in RTP packet class: public byte[] getPayload() { int header_len = getHeaderLength(); int len = packet_len - header_len; byte[] payload = new byte[len]; for (int i = 0; i &lt; len; i++) payload[i] = packet[header_len + i]; return payload; } The problem is that I cannot find where the rtp packet class is getting the payload as the RTP runs over UDP. I have gone through the UDP socket class but it is not there. I think one way could be to get the datagram payload from the rtp packet and encrypt it. Where is the RTP packet class getting its payload?
type: AnsweredQuestion

http://stackoverflow.com/comment/31733051
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21078366
score: 0
has text: Show how your server is reading the data. Also show how you are transfering the serialized data.

http://stackoverflow.com/q/21126346
has body: I have an array of elements (even number) and I want to get all possible combinations of them in couples. If the array is String[] test = new String[4]; String[] test= {"e1","e2","e3","e4"}; The output should be: Combination1 e1-e2 , e3-e4 Combination2 e1-e3 , e2-e4 Combination3 e1-e4 , e2-e3 Combination4 e4-e1 , e3-e2 Combination5 e3-e1 , e4-e2 Combination6 e2-e1 , e4-e3
has comment: http://stackoverflow.com/comment/31790429
downvote count: 0
has comment: http://stackoverflow.com/comment/31790942
has title: Java: Combination of elements in array in couples
has answer: http://stackoverflow.com/a/21126762
favorite count: 0
has answer: http://stackoverflow.com/a/21127266
has answer: http://stackoverflow.com/a/21126397
answer count: 4
tagged with: combinations
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/21126762
has comment: http://stackoverflow.com/comment/31792598
possible better answer: http://stackoverflow.com/a/21126397
type: Question
has answer: http://stackoverflow.com/a/21127376
tagged with: arrays
has comment: http://stackoverflow.com/comment/31791065

uppercase
tags question: http://stackoverflow.com/q/21147319
type: Tag
tag name: uppercase

http://stackoverflow.com/a/21109940
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31763543
has comment: http://stackoverflow.com/comment/31764418
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/21109382
has comment: http://stackoverflow.com/comment/31759998
has comment: http://stackoverflow.com/comment/31763840
has comment: http://stackoverflow.com/comment/31764036
answers question: http://stackoverflow.com/q/21109382
has body: Are you willing to send the data or to make the JNI stuff work? In the former case, use Java to convert a string into UTF-8 (which will be ASCII for English.) Conversion of text byte[] -> byte[] is not exactly what you need, but you'll get the idea: //byte[] result; //byte[] source; String s = new String(source,"UTF-8"); result = s.getBytes("UTF-16LE"); For the 2nd case, I can share a portion of working code; it calls Java to convert from one encoding to another // it returns NULL in the case of an exception // the returned memory is calloc()'d; it's the caller's responsibility to free() it. char* changeEncoding(const char*source, int len, int direction) { JNIEnv* env = threadUnsafeInfo.env; jobject obj = threadUnsafeInfo.obj; if (!source) { JNU_ThrowByName(env, "java/lang/NullPointerException", 0); return NULL; } jbyteArray srcArray = env-&gt;NewByteArray(len); jclass cls = env-&gt;FindClass("com/xyz/MyClass"); jmethodID mid = env-&gt;GetMethodID(cls, "convert", "([BI)[B"); if (mid != NULL &amp;&amp; srcArray != NULL) { env-&gt;SetByteArrayRegion(srcArray, 0, len, (jbyte*)source); env-&gt;ExceptionClear(); //jbyteArray resArray = (jbyteArray)env-&gt;CallStaticObjectMethod(cls, mid, srcArray, direction); jbyteArray resArray = (jbyteArray)env-&gt;CallObjectMethod(obj, mid, srcArray, direction); if(env-&gt;ExceptionOccurred()) { DLOG("exception in convert ([BI)[B"); env-&gt;ExceptionDescribe(); //env-&gt;ExceptionClear(); // ?? return NULL; } int resultLen = env-&gt;GetArrayLength(resArray); char* result = (char*)calloc(2 + resultLen,1); // why 2: a bit of healthy paranoia ain't gonna hurt anyone if (result == 0) { JNU_ThrowByName(env, "java/lang/OutOfMemoryError", 0); return NULL; } env-&gt;GetByteArrayRegion(resArray, 0, resultLen, (jbyte *)result); env-&gt;DeleteLocalRef(cls); env-&gt;DeleteLocalRef(resArray); env-&gt;DeleteLocalRef(srcArray); return result; } else { JNU_ThrowByName(env, "java/lang/NullPointerException", 0); myassert(("method id = 0",0)); } return …
has comment: http://stackoverflow.com/comment/31762572

http://stackoverflow.com/q/21121837
score: 1
tagged with: jvm
favorite count: 0
has title: How to know occupied heap size during run time
tagged with: memory-management
accepted answer: http://stackoverflow.com/a/21121920
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21132046
upvote count: 1
linked to: http://stackoverflow.com/q/3021727
type: Question
duplicate of: http://stackoverflow.com/q/3021727
possible better answer: http://stackoverflow.com/a/21132046
has body: I am trying to output the memory allocated to a java application during the run time of the application. I have access to the application source code. How can I do that?
has answer: http://stackoverflow.com/a/21121920
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/31681152
type: AnswerComment
has text: @vandale thank you very much for the fast response. I have a question though. Why start the incrementation of count from 1 and not from 0? As far as I know, The first element of the list hast the index 0.
type: Comment
comment on: http://stackoverflow.com/a/21067004
score: 0

http://stackoverflow.com/comment/31689411
has text: Have you tried something?? Post your attempt
type: QuestionComment
comment on: http://stackoverflow.com/q/21071543
score: 0
type: Comment

http://stackoverflow.com/a/21081821
has comment: http://stackoverflow.com/comment/72550965
has comment: http://stackoverflow.com/comment/72549467
has comment: http://stackoverflow.com/comment/72549791
has comment: http://stackoverflow.com/comment/72549553
has comment: http://stackoverflow.com/comment/31708608
type: Answer
has body: @sasankad is mostly correct (+1). Once you have created the font, it will have a default size of 1 Font font = Font.createFont(Font.TRUETYPE_FONT, getClass().getResourceAsStream("/CUSTOMFONT-MEDIUM.TTF")); You then need to derive the font size and style you want. Font biggerFont = font.deriveFont(Font.BOLD, 48f); import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Font; import java.awt.FontFormatException; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagLayout; import java.io.File; import java.io.IOException; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class TestCustomFont { public static void main(String[] args) { new TestCustomFont(); } public TestCustomFont() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class TestPane extends JPanel { public TestPane() { setLayout(new GridBagLayout()); try { Font font = Font.createFont(Font.TRUETYPE_FONT, getClass().getResourceAsStream("/Royal Chicken.ttf")); JLabel happy = new JLabel("Happy little Miss Chicken"); happy.setFont(font.deriveFont(Font.BOLD, 48f)); add(happy); } catch (FontFormatException | IOException ex) { ex.printStackTrace(); } } } } Check out java.awt.Font for more details... You may also want to take a look at Physical and Logical Fonts, Font Configuration Files
answers question: http://stackoverflow.com/q/21081586
upvote count: 10
downvote count: 0
score: 10
has comment: http://stackoverflow.com/comment/72549903
has comment: http://stackoverflow.com/comment/72549358
has comment: http://stackoverflow.com/comment/72549281
has comment: http://stackoverflow.com/comment/72549453

http://stackoverflow.com/q/21151057
answer count: 1
favorite count: 0
tagged with: while-loop
has comment: http://stackoverflow.com/comment/31835556
has answer: http://stackoverflow.com/a/21151133
accepted answer: http://stackoverflow.com/a/21151133
has comment: http://stackoverflow.com/comment/31835637
has body: Sorry, should've added more import java.util.Scanner; public class rpg { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); String input; boolean live = true; if (live == true){ System.out.println("DETECTIVE RPG"); while (true) { // &lt;&lt; ENTER CHECK System.out.print("\n Press Enter..."); input = keyboard.next(); if (input.equals(null)) break; } // ENTER CHECK &gt;&gt; System.out.print("Past check."); keyboard is what I named the Scanner. This prints "Press Enter" to the console and makes sure the input box is empty. If they press Enter it should break the While loop and move onto the next statement, right? When I press Enter it shows another input box and never gets to the next print statement.
has title: Java While loop not continuing to next statement
downvote count: 1
type: AnsweredQuestion
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/31835597
type: Question
upvote count: 0

http://stackoverflow.com/q/21103382
favorite count: 0
linked to: http://stackoverflow.com/q/7145131
has title: How to identify URIs of active (long-running) HTTP requests?
accepted answer: http://stackoverflow.com/a/21201347
score: 2
type: AnsweredQuestion
tagged with: tomcat-valve
has body: Imagine a webapp which (sometimes) takes long time to respond to some HTTP (POST/GET/etc) request - how would You find such a request on server side? So far I've used tomcat AccessLogValve to see the "completed" requests, but that doesn't let me to see the "in-progress" (stuck) ones :( For example: with netstat I'm able to identify long-lived sockets which could give me a count of currently-stuck requests (not URIs though), but HTTP keep-alives invalidate this approach I could stackdump the app-server (kill -3 &lt;server_pid&gt;) multiple times and guess which threads are running long and reverse-engineer the URIs - not a smart way either I could inject a router/proxy in front of web-app server (substitute hostnames, clone certs) which would show me the currently-running calls - not a simple approach I could fall into just running tcpdump continously and parsing the traffic to keep list of currently-running URIs, but what to do with httpS then? the closest I found is tomcat7's StuckThreadDetectionValve which'd periodically reports long-running calls, but it outputs the stacktrace (not URI) and doesn't provide "live" data (e.g. only polls periodically, floods the logs and lets to see the state of 1-60 seconds ago, but not "now") Maybe I'm just missing/overlooking one of vital/core/basic tomcat features? or maybe weblogic (or any other app-server) has something robust to offer for this? I'm kind of lost without such simple and essential feature. Help? Please?
has comment: http://stackoverflow.com/comment/31750387
upvote count: 2
tagged with: java
type: Question
tagged with: jakarta-ee
tagged with: weblogic
has comment: http://stackoverflow.com/comment/31748975
possible better answer: http://stackoverflow.com/a/21127550
has answer: http://stackoverflow.com/a/21201347
has answer: http://stackoverflow.com/a/21127550
answer count: 2
downvote count: 0
tagged with: tomcat

http://stackoverflow.com/q/21066333
has comment: http://stackoverflow.com/comment/31679498
tagged with: java
has answer: http://stackoverflow.com/a/21067096
has comment: http://stackoverflow.com/comment/31679558
downvote count: 1
type: Question
has body: I have an (unsigned) applet that let you draw a logic circuit and test it on-screen (a bit like Electronics Workbench), and it then serializes the circuit (the internal form, not the visual representations) and sends it to the server where a bunch of automated tests are run and a performance report is produced. This is a small but crucial part of a much larger web app. However, the latest Java plug-in now says this: Running unsigned applications like this will be blocked in a future release because it is potentially unsafe and a security risk. Now, self-signing it will still apparently work (for now), but then the code runs OUTSIDE the sandbox, which strikes me as a stupid way to do things, even though my code is of course completely bug-free! (Can I interest you in buying a bridge?) Reading further on the Oracle website I see this: The platform will not deny the execution of Java applications... Future update releases may include additional changes to restrict unsafe behaviors like unsigned and self-signed applications." (Which sounds like it means "Future updates will deny the execution of Java applications" -- unless you pay money to Thwaite or Verisign on a regular basis AND expose users to code running outside a sandbox.) They also say "Even the smallest changes in user experience are sometimes troublesome". (No kidding.) "We have considered how changes affect user experience. Given the current climate around Java security in the browser, code signing is a valuable security control for protecting Java users." Well, I don't see how I can continue using Java under these circumstances. The goalposts have been moved (again), and now I'm looking for a different football team... or more precisely, I'm looking for an alternative technology that will let me continue to do what I do now: drag &amp; drop circuit elements, create connections by dragging between input and outputs or other connections, and finally take the internal form of the diagram and squirt it to the s…
has comment: http://stackoverflow.com/comment/31680533
has answer: http://stackoverflow.com/a/42612006
tagged with: security
answer count: 3
has comment: http://stackoverflow.com/comment/31681686
has title: Alternative technologies to replace applet?
has comment: http://stackoverflow.com/comment/31680852
tagged with: applet
has answer: http://stackoverflow.com/a/21066906
favorite count: 0
type: UnansweredQuestion
score: 5
upvote count: 6

http://stackoverflow.com/q/21119691
type: Question
possible better answer: http://stackoverflow.com/a/21119823
downvote count: 2
answer count: 3
has answer: http://stackoverflow.com/a/21119823
score: -2
has answer: http://stackoverflow.com/a/21119862
favorite count: 0
has answer: http://stackoverflow.com/a/21120504
accepted answer: http://stackoverflow.com/a/21120504
tagged with: android
upvote count: 0
has title: Writing and reading from txt file android
has body: I know that this is a widely discussed question , but I am really confused with those examples provided on android developers manual . So , I have a "source.txt" in my res/raw folder .For example I want to write 2 lines in it(for ex. Hello\nWorld) and then read them from another activity. Can anyone write the source code for this , please.
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/939170
tagged with: java

http://stackoverflow.com/comment/31692346
score: 1
comment on: http://stackoverflow.com/q/21073010
has text: It seems to me to be more like a case for a B-tree, or some other structure with wider fan-out than binary search, with the higher levels kept in memory. Binary search over a billion entries is going to do about 30 random accesses to a data structure that may not fit in physical memory.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31801479
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21132681
type: Comment
has text: Please post some code where the error occurs, and the complete error message

http://stackoverflow.com/comment/31832346
has text: Try adding a [`autoDelay`](http://docs.oracle.com/javase/7/docs/api/java/awt/Robot.html#setAutoDelay(int)), I've found this helps in a lot of circumstances
comment on: http://stackoverflow.com/q/21147675
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21033392
type: AcceptedAnswer
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/21032190
answers question: http://stackoverflow.com/q/21032190
has body: To find the entire tree, you need to recognize when one of the children is itself a directory and gather its contents as well. It looks like you'd want to do that in the method you're calling getChild (getChildren would be a better name for it).

http://stackoverflow.com/comment/31807684
type: QuestionComment
type: Comment
has text: @zapl I think the error is indeed not related to _Thread.sleep()_, but it happens because he creates a _new CategoryAdapter()_ from a background thread.
comment on: http://stackoverflow.com/q/21135391
score: 0

list
type: Tag
tags question: http://stackoverflow.com/q/21118680
tags question: http://stackoverflow.com/q/21073081
tags question: http://stackoverflow.com/q/21026052
tags question: http://stackoverflow.com/q/21105866
tags question: http://stackoverflow.com/q/21062894
tags question: http://stackoverflow.com/q/21139128
tags question: http://stackoverflow.com/q/21179707
tag name: list
tags question: http://stackoverflow.com/q/21048962
tags question: http://stackoverflow.com/q/21180518
tags question: http://stackoverflow.com/q/21144598
tags question: http://stackoverflow.com/q/21171099
tags question: http://stackoverflow.com/q/21059675
tags question: http://stackoverflow.com/q/21122143
tags question: http://stackoverflow.com/q/21167899
tags question: http://stackoverflow.com/q/21061087
tags question: http://stackoverflow.com/q/21120454
tags question: http://stackoverflow.com/q/21158237
tags question: http://stackoverflow.com/q/21077776

http://stackoverflow.com/comment/31643119
score: 0
type: AnswerComment
has text: @user3182091 This is how it works. Ofc. in practice you would define a "id" for tha car and load ALL values depending on id (thus seperating the MODEL and the DATA). Say "Porsche 911" is your id , and your dataset holds information about horse power, wheels, color, etc) - using a method to load your car will insert all information then. (`CarService->loadCar("Porsche 911 Turbo")`
comment on: http://stackoverflow.com/a/21046797
type: Comment

http://stackoverflow.com/comment/31697458
has text: Yes. Thanks. I used the first keyListener and there was no need for getTADapter() since I only had one keyListener
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21075354

http://stackoverflow.com/comment/31631431
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21037230
has text: I would prefer 4.x, or any working example.

dictionary
tags question: http://stackoverflow.com/q/21082875
tags question: http://stackoverflow.com/q/21117827
tags question: http://stackoverflow.com/q/21034955
tags question: http://stackoverflow.com/q/21180290
tags question: http://stackoverflow.com/q/21089112
tags question: http://stackoverflow.com/q/21179581
tags question: http://stackoverflow.com/q/21037263
tags question: http://stackoverflow.com/q/21120093
tags question: http://stackoverflow.com/q/21077193
tag name: dictionary
tags question: http://stackoverflow.com/q/21177722
tags question: http://stackoverflow.com/q/21166573
tags question: http://stackoverflow.com/q/21154801
tags question: http://stackoverflow.com/q/21088031
tags question: http://stackoverflow.com/q/21070874
tags question: http://stackoverflow.com/q/21075905
tags question: http://stackoverflow.com/q/21105413
tags question: http://stackoverflow.com/q/21178615
tags question: http://stackoverflow.com/q/21096512
tags question: http://stackoverflow.com/q/21130527
type: Tag
tags question: http://stackoverflow.com/q/21172419

http://stackoverflow.com/q/21125762
has answer: http://stackoverflow.com/a/21128541
tagged with: selenium
type: AnsweredQuestion
tagged with: java
has body: I am fairly new to Selenium Automation Testing and am experiencing something that I do not see in videos and tutorials. I used Selenium IDE to record a test of: navigating through a website logging in edit profile information submit changes verify changes It works fine when I replay it in Firefox. My issue is when I export it to Java - Junit Webdriver and run the test via Eclipse it takes a very long time to go through the steps and thus causing failure or just fails overall. I tried to even do it by hand step by step and that also seems to work but the part that takes the longest is to input the user login information (Username &amp; Password). Is there something this newbie is not aware of? Should the exported IDE work "Out of the box" when it is run via Eclipse Junit? package Profile; import java.util.concurrent.TimeUnit; import org.junit.*; import static org.junit.Assert.*; import org.openqa.selenium.*; import org.openqa.selenium.firefox.FirefoxDriver; public class ProfileChangeTestCase { private WebDriver driver; private String baseUrl; private StringBuffer verificationErrors = new StringBuffer(); @Before public void setUp() throws Exception { driver = new FirefoxDriver(); baseUrl = "http://gaming.twlstaging.com/"; } @Test public void testOpen() throws Exception { driver.get(baseUrl); //Click LogIn driver.findElement(By.className("logged-out")).click(); //Enter User name driver.findElement(By.xpath("//input[@id='login']")).clear(); driver.findElement(By.xpath("//input[@id='login']")).sendKeys("Demo"); //Enter Password driver.findElement(By.xpath("//input[@id='login_password']")).clear(); driver.findElement(By.xpath("//input[@id='login_password']")).sendKeys("Blam!"); //Click LogIn Button driver.findElement(By.className("login-button")).click(); //Security Alert - Selecting continue Alert alert = driver.switchTo().alert(); alert.accept(); //Buffer for page to load driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); //Verify user name login by echo n…
type: Question
tagged with: automation
tagged with: junit
answer count: 1
accepted answer: http://stackoverflow.com/a/21128541
score: 0
has title: Selenium IDE to Java
tagged with: selenium-webdriver

http://stackoverflow.com/q/21070500
tagged with: user-interface
score: 0
accepted answer: http://stackoverflow.com/a/21070503
possible better answer: http://stackoverflow.com/a/22320962
has body: I'm fairly new to Java coding and I am trying to get a number from a double to display into a JSwing textbox. The code I'm having trouble with: txtCounter = new JTextField(); txtCounter.setText(counter); //Error here Jtextcomponent not available for Double txtCounter.setEditable(false); txtCounter.setToolTipText("Shows time that has passed."); txtCounter.setBounds(10, 69, 100, 20); frmTimer.getContentPane().add(txtCounter); txtCounter.setColumns(10); Is their a different statement I could use for this case?
has answer: http://stackoverflow.com/a/22320962
has title: Show a double using text with Windowbuilder and Java?
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21070503
tagged with: java
tagged with: jtextfield
type: Question
answer count: 2

http://stackoverflow.com/q/21163200
tagged with: eclipse
has title: Usigne ical4j.jar with Java, set parameter X-MS-OLK-FORCEINSPECTOROPEN
answer count: 1
has body: How can i set this parameter X-MS-OLK-FORCEINSPECTOROPEN: to TRUE WHEN creating a new .ics file ? in VEvent ?
has answer: http://stackoverflow.com/a/21776161
score: 0
type: AnsweredQuestion
tagged with: calendar
accepted answer: http://stackoverflow.com/a/21776161
type: Question
tagged with: java

http://stackoverflow.com/q/21070551
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31687651
upvote count: 1
has answer: http://stackoverflow.com/a/21070583
tagged with: primes
type: AnsweredQuestion
tagged with: java
type: Question
has title: Prime Number Finder calculation error
accepted answer: http://stackoverflow.com/a/21070583
downvote count: 0
has body: I am trying to make a prime number finder in Java, and I am aware that there are plenty already out there. I am getting a calculation error when I run it, and no 'quick fixes.' Here is the error: "Exception in thread "main" java.lang.ArithmeticException: / by zero at PrimeNumber.main(PrimeNumber.java:12)" Here is the code: public class PrimeNumber { public static void main(String rane[]){ int f1 = 0; int f2 = 0; int m = 0; int p = 0; loop: for (p = f1 % f2; p &gt; 0; f1 += 1){ if (f1 &lt; 50){ //Do nothing }else{ f2 += 1; if (f2 &gt; 50){ System.out.println("Done!"); break; } } if (p == m){ f1 += 1; f2 += 2; m = 0; break loop; } } } } Please let me know if I can shorten this code or make it better. Thanks!
answer count: 1

http://stackoverflow.com/comment/31840911
type: AnswerComment
comment on: http://stackoverflow.com/a/21153959
score: 0
has text: can yon check my code
type: Comment

http://stackoverflow.com/comment/139726686
comment on: http://stackoverflow.com/a/21116014
has text: This answer is outdated already for several years! Here is another one which is more relevant: https://stackoverflow.com/a/62860455/14197561
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21175019
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/31878887
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/21175057
has body: I'm having a bit of trouble with my java app,either i don't know enough or this isn't possible in a simple manner.I'm hoping it is the first option since i'm a beginner. This is my table : CREATE TABLE IF NOT EXISTS `evolution` ( `id` int(11) NOT NULL AUTO_INCREMENT, `product` varchar(50) NOT NULL, `quantity` double NOT NULL, `date` date NOT NULL, `operator` varchar(50) NOT NULL, PRIMARY KEY (`id`) ) I want to keep track of some product sales by their date. What i'd like to achieve is this : lets say the operator enters today, 17.01.2014 the product banana with the quantity 4.Later that day he will insert apples with the quantity 10.The same day he will insert banana with the quantity 1 and apples with the quantity 12. Tomorrow he will do the same,insert bananas with the quantity 2 but on the date 18.01.2014.This should be on a new row since its the same product but on a different date. In this situation, i need my database to do the following : Check if banana was inserted on 17.01.2014.If not, insert it with the quantity 0+4. If banana was already inserted on 17.01.2014 update the quantity 4+1. The next day it will check if banana was inserted on 18.01.2014.If not,insert it with the quantity 2.If yes,update the quantity. So : i can't have any of the columns unique since the date can be the same forapples and banana and the same for the date and of course,quantity. How can i achieve this ? I thought about a couple of ways but it isn't very efficient: Select (product,date) from evolution where product=banana AND date=18.01.2014 If this returns anything then i will execute an update. If this doesn't return anything then i will execute an insert. Make a column product-date that will be unique. In it i will insert for example banana 17.01.2014.This would be easier but i don't like this way,its dirty. All this would be so easy if i could do something like a double on duplicate key.Try and insert banana and date.Then,if the combination already exist,do an update. To make…
tagged with: sql
has comment: http://stackoverflow.com/comment/31878744
has title: On duplicate key based on two columns
favorite count: 0
has answer: http://stackoverflow.com/a/21175057

http://stackoverflow.com/a/21162668
type: Answer
upvote count: 1
score: 1
downvote count: 0
has body: You could call .cancel() on your tasks that you want to remove - ie. iterate some list with tasks and check using instanceof if they are of C,D,E type. As a list you could use threadPoolExector.getQueue() as KamiSempai suggested. I am actually using ScheduledExecutorService and I have method: cancelTasksOfType(Class&lt;? extends TaskBase) taskClassToCancel) inside it I'am cancelling each task that passes test with instanceof on taskClassToCancel
answers question: http://stackoverflow.com/q/21162310

http://stackoverflow.com/comment/31866488
type: Comment
type: QuestionComment
has text: Take a look at this: http://kegel.com/c10k.html
comment on: http://stackoverflow.com/q/21168424
score: 0

http://stackoverflow.com/comment/31678248
type: Comment
score: 1
has text: Java doesn't directly support operator overloading so the operations would have to be functions
comment on: http://stackoverflow.com/a/21065619
type: AnswerComment

http://stackoverflow.com/q/21168859
upvote count: 1
tagged with: swing
type: Question
has title: jlist won´t show whole line or way too much
linked to: http://stackoverflow.com/q/8197167
tagged with: scrollbar
has comment: http://stackoverflow.com/comment/31868471
downvote count: 0
answer count: 1
favorite count: 0
has body: newbie here. So, I´m trying to list a few items with the Jlist, but I can´t wrap these to the next line like I do it with a jTextArea. When I put a long string for a list item, the window width enlarges with it. That is not desirable. I, then, restricted the width of the list. It worked, but then you can´t read the text. jList1.setModel(new javax.swing.AbstractListModel() { String[] strings = { "Item 1", "Item 2 is a big old thing and it won´t wrap", "Item 3" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); The above code returns: +---------------+ |Item 1 | |Item 2 is a b..| |Item 3 | +---------------+ But I wanted: +---------------+ |Item 1 | |Item 2 is a big| |old thing and i| |t won´t wrap | |Item 3 | +---------------+ The reason I want it is to be able to select a line individually even if I don´t know where each item starts. Someone told me of putting a horizontal scroll bar and that seems nice. I just don´t know how to go about it. Thanks for the input!
type: UnansweredQuestion
tagged with: jlist
has comment: http://stackoverflow.com/comment/31867691
has comment: http://stackoverflow.com/comment/31872053
has answer: http://stackoverflow.com/a/21174736
score: 1
tagged with: java

http://stackoverflow.com/a/21084532
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21084054
has body: Okay, I figured out the problem. For some reason, IntelliJ set the working directory to the folder that contains the working directory. Instead of going to /Users/Tyler/Google Drive/Java/Mac Workspace/Game/maps/default.txt like it was supposed to, it was skipping the game folder and going to /Users/Tyler/Google Drive/Java/Mac Workspace/maps/default.txt. To fix this, go to "Run" > "Edit Configurations...", and add on to the field titled "Working Directory."
answers question: http://stackoverflow.com/q/21084054
type: Answer
has comment: http://stackoverflow.com/comment/31716107
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/31715979
type: AcceptedAnswer

http://stackoverflow.com/q/21125821
has body: I have been wondering this since my early school grades, now I think I have faced a real life scenario regarding this. There is an unexplainable delay in 2 consective log statements, here is the detail: I am using slf4j with logback and here is what I got in my logs: INFO 2014-01-15 01:01:12,215 [Thread-38005034] 185 - REQ Rcvd:68506950 INFO 2014-01-15 01:01:34,183 [Thread-38005035] 123 - [MGW150114010112fc1b][OC]923029563761-&gt;8803026062143 rDialogID: 68506950 These two lines should be printed with no time delay but it takes more than 20 secs for the second line to be printed. Here is my code: public void onRequest(final DPRequest arg0) { new Thread() { @Override public void run() { Request idp = new Request(); idp.arg0 = arg0; Thread dpThread = new Thread(idp); dpThread.start(); logger.info("REQ Rcvd:" + arg0.getId()); } }.start(); } This is the request class @Override public void run() { processdp(); } public void processdp() { OCHandling ocsiHandler = new OCHandling(this.arg0); ocHandler.run(); } This is in the OCHandling class public void run() { logger.info("[" + refId + "][OC]" + PNumber + "-&gt;" + CNumber + " rDialogID: " + arg0.getId()); } onRequest function recieves almost 50 requests per second, this is the first time I have seen this much delay, and it only happened for less than a minute, where do you think could be the issue Thread count: I have checked was normal Logger not writting real time logs? Edit-> I found out this is not an issue Any blocking request, this process wasnt given time in this slot? Java does not pass parameters by reference so its not possible that the API which calls onRequest method is meddling with the parameter or what ever I dont know This program is running on a VM which is on ESXI server
has comment: http://stackoverflow.com/comment/31806031
score: 0
has comment: http://stackoverflow.com/comment/31798048
has comment: http://stackoverflow.com/comment/31789561
tagged with: multithreading
answer count: 1
tagged with: logging
tagged with: java
tagged with: thread-safety
type: UnansweredQuestion
has title: What do softwares do when no one is watching them? (about Java unresponsive program)
has comment: http://stackoverflow.com/comment/31789518
has answer: http://stackoverflow.com/a/21836882
has comment: http://stackoverflow.com/comment/31789717
type: Question

http://stackoverflow.com/comment/31810487
comment on: http://stackoverflow.com/q/21137892
score: 1
type: Comment
type: QuestionComment
has text: @Njol: Of course not, the markup won't appear in the text.

http://stackoverflow.com/comment/45495190
type: Comment
has text: How do you "add your certificate to the trusted system certificates in Android"?
comment on: http://stackoverflow.com/a/21047768
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31686398
score: 0
has text: What is `first_string`?
type: Comment
comment on: http://stackoverflow.com/q/21069817
type: QuestionComment

http://stackoverflow.com/comment/31860351
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21152973
type: AnswerComment
has text: Hi Andrew, Thanks for de answer! Did not quite understand what you said... But I tried to access the applet via browser and the browser tries to download. I think not explained myself and / or poorly written the situation. The applet works fine, all functions work, except the function using GSON... In my local server (IIS 7.5) I create a site, and inside this site I put the files:

http://stackoverflow.com/comment/34146650
score: 0
has text: This did the trick! Thanks. (You should add the how to directly in this question in case the link goes down)
type: AnswerComment
comment on: http://stackoverflow.com/a/22160369
type: Comment

http://stackoverflow.com/a/21131283
accepted answer of: http://stackoverflow.com/q/21131149
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31799696
has comment: http://stackoverflow.com/comment/31799709
has body: You are getting the values using different objects LatLngModel model = new LatLngModel(latitude,longtitude); model.setLatitude(latitude); model.setLongitude(longtitude); Consider the above as Object A LatLngModel model = new LatLngModel(latitude,longtitude); Before acessing , you should make sure that you are using the same object, Using new will create another object UPDATE Simplest but singleton solution private LatLngModel instance; public static LatLngModel GetInstance() { if(instance == null) instance = new LatLngModel(); return instance; } Then call LatLngModel.getInstance(); to get the same object from any class . NOTE Dont call new for this class
has comment: http://stackoverflow.com/comment/31799158
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21131149
downvote count: 0
has comment: http://stackoverflow.com/comment/31799192
type: Answer

http://stackoverflow.com/comment/52358997
type: AnswerComment
has text: This was my problem too. I removed the quotes and that solved it
score: 0
type: Comment
comment on: http://stackoverflow.com/a/30136677

http://stackoverflow.com/comment/31828179
comment on: http://stackoverflow.com/q/21146973
has text: @MadProgrammer Can you please explain how to do so? I've never really dealt with sound before.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31882838
score: 1
has text: And `new String(char[])` or `String.valueOf(char[]`) didn't help?
comment on: http://stackoverflow.com/q/21177294
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21094139
has title: How to read byte stream as an Excel sheet without using POI in Java?
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31731412
has body: I have a Servlet which accepts uploaded Excel file from the user. I convert that file into byte stream and store onto the DB. Now I want to read the same byte stream as an Excel file. But this is to achieved without creating a temporary Excel file and also without using any third party library. How can I do that? I have looked at this, this and this. But did not help.
tagged with: java
linked to: http://stackoverflow.com/q/11611816
has comment: http://stackoverflow.com/comment/31731259
type: Question
score: 0
has comment: http://stackoverflow.com/comment/31730596
has comment: http://stackoverflow.com/comment/31730631
has comment: http://stackoverflow.com/comment/31730671

http://stackoverflow.com/comment/31794343
score: 1
has text: @Andrew Stewart, Gautham is correct.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21128408

http://stackoverflow.com/comment/31883683
type: AnswerComment
has text: Thanks Jens..By this solution I might get xpath and Id paths. But, I also want to have css path of a node. How can I get that from a page source?
type: Comment
comment on: http://stackoverflow.com/a/21125756
score: 0

http://stackoverflow.com/a/21167370
accepted answer of: http://stackoverflow.com/q/21167307
downvote count: 0
answers question: http://stackoverflow.com/q/21167307
has body: emf is null, you have to initialize it: private static EntityManagerFactory emf = Persistence.createEntityManagerFactory("persistanceUnitName");
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/31661430
score: 1
has text: Since I need more features than just Dependency Injection, I will go with **Spring**. Thanks everybody for the responses.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21056063

http://stackoverflow.com/q/21053153
linked to: http://stackoverflow.com/q/4065312
score: 4
has comment: http://stackoverflow.com/comment/31655244
tagged with: java
duplicate of: http://stackoverflow.com/q/4065312
answer count: 1
has comment: http://stackoverflow.com/comment/31655190
type: UnansweredQuestion
upvote count: 4
tagged with: http://stackoverflow.com/tag/html
downvote count: 0
has title: How do I handle a HTML button click in Java, instead of Javascript, on Android?
favorite count: 0
has answer: http://stackoverflow.com/a/21053554
type: Question
tagged with: android
has body: I'm developing an Android application using HTML design. This design contains a Form and Text Field and a submit Button. HTML Code: &lt;form name="form1" onSubmit="return showInfo()" &gt; First name:&lt;input type="text" id="fname" autofocus placeholder="First name"/&gt; &lt;input type="submit" value="submit" id="submitB"/&gt; &lt;/form&gt; Android Code: WebView webView = (WebView)findViewById(R.id.WebView1); webView.setWebChromeClient(new WebChromeClient()); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl("file:///android_asset/web/index.html"); The HTML design works well in the android UI, and this HTML file is connected to a separate Javascript file to handle the onsubmit event. For example, when the user presses on the submit button it calls a function in javascript file. All of this works great. My question is: how I can reference this submit button in Java code? That is, I want this submit button in the HTML to be referenced in Java code when it is clicked on. I don't want to call the javascript function; I want, for example, to show a Toast message. To illustrate : &lt;input type="submit" value="submit" id="submitB"/&gt; Button x = (button) findViewById(R.id.submitB) // I know this cant be happen but I want like this idea I hope you got my Idea...

http://stackoverflow.com/comment/31870367
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21146129
has text: Yea like it's very strange. It won't be lagging at some moments and others it will always happen when you change directions

http://stackoverflow.com/q/21089003
tagged with: encryption
has answer: http://stackoverflow.com/a/21091241
accepted answer: http://stackoverflow.com/a/21091241
type: AnsweredQuestion
tagged with: java
has body: I have an android project that uses BasicTextEncryptor to encrypt and decrypt some information from a server. I'm implementing an iOS version and would like to know if there is an iOS equivalent version of this that uses the same method of encryption/decryption? This is the encryption framework for java http://www.jasypt.org/api/jasypt/1.8/org/jasypt/util/text/BasicTextEncryptor.html Thank you in advance
type: Question
tagged with: ios
has title: iOS and Java encryption using BasicTextEncryptor in jasypt
score: 0
answer count: 1

http://stackoverflow.com/comment/31963262
comment on: http://stackoverflow.com/a/21179033
score: 0
type: Comment
has text: You had to click on the document.xml part, then on the relevant element name, then you would have seen the code.
type: AnswerComment

http://stackoverflow.com/q/21177475
possible better answer: http://stackoverflow.com/a/21180036
answer count: 4
has answer: http://stackoverflow.com/a/21177682
has comment: http://stackoverflow.com/comment/31883197
has answer: http://stackoverflow.com/a/21177659
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21177969
type: Question
score: 0
linked to: http://stackoverflow.com/q/10086936
tagged with: swing
accepted answer: http://stackoverflow.com/a/21177659
linked to: http://stackoverflow.com/q/17874717
has title: adding component with out JPanel is it right thing
has answer: http://stackoverflow.com/a/21180036
tagged with: java
tagged with: jpanel
has body: hello i had a question about JPanel component it is very simple question no coding the question why do i have to add gui component to the JPanel if i can simply adding them to the JFrame directly do i always have to add all the component to JPanel and if i did not do that is that going to effect the appellation in any term

http://stackoverflow.com/comment/31890975
type: QuestionComment
score: 1
has text: This is an duplicity for this - http://stackoverflow.com/questions/9532663/formatting-the-date-on-a-jspinner
comment on: http://stackoverflow.com/q/21181801
type: Comment

http://stackoverflow.com/comment/31639962
type: QuestionComment
score: 0
has text: Hi, Thanks dadoonet - your project was my first choice, but I had the same problem which is why I'm using this stripped down version to isolate the issue. When I resolve it I'll switch to your factories.
type: Comment
comment on: http://stackoverflow.com/q/21043128

http://stackoverflow.com/a/21123498
type: Answer
accepted answer of: http://stackoverflow.com/q/21123246
answers question: http://stackoverflow.com/q/21123246
score: 1
has body: referenceCityCenter is out of scope. Put it outside of your if statement and make sure you check for null afterwards like follows: public String citiesNorthOf(String cityName){ String allCitiesNorthOf = "";// must be initialized Point referenceCityCenter = null; for(int i=0; this._cities[i] != null ; i++) { if (this._cities[i].getCityName() == cityName) { referenceCityCenter = new Point(this._cities[i].getCityCenter()); } } for(int i=0; this._cities[i] != null ; i++)//we don't need to exclude the comparable city itself because it will give a false { if (referenceCityCenter !- null &amp;&amp; this._cities[i].getCityCenter().isAbove(referenceCityCenter)) { allCitiesNorthOf = allCitiesNorthOf.concat(this._cities[i].toString()+"\n\n"); } } }
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31811194
has text: Try converting the string to a char[] using .toCharArray(). Then iterate over that array in the debugger so you can examine each character in turn. At the very least, that should tell you which position has the unwanted character which you can then trim or substring off.
comment on: http://stackoverflow.com/q/21137536
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31910094
has text: Not really sure what you are after. You need to understand that the `Application` class is only created once per process. This means, when you launch your app for the first time, `Application` class will be created and then your `MainActivity`. Now user presses BACK. Your `MainActivity` will finish. Now user starts your application again. If the process hasn't been reclaimed (killed), then Android will just create and launch a new instance of `MainActivity`. **It will not call `onCreate()` on the `Application` class again.**
comment on: http://stackoverflow.com/q/21167816
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21119334
has body: You can use the following mechanism. resultSet=s.executeQuery("select personID from person where first_name = " +"'"+firstName+"'"+";"); if (resultSet!= null) { do { //You can code your business logic here by getting data from db like: System.out.println(resultSet.getString("first_name")); } while (resultSet.next());
type: Answer
answers question: http://stackoverflow.com/q/21118779
score: 0

http://stackoverflow.com/comment/43599395
has text: Sorry the domain is moved, i guess.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21043048
type: QuestionComment

http://stackoverflow.com/q/21127253
has answer: http://stackoverflow.com/a/21127628
has comment: http://stackoverflow.com/comment/31792196
has comment: http://stackoverflow.com/comment/31792175
has comment: http://stackoverflow.com/comment/31792248
accepted answer: http://stackoverflow.com/a/21128098
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21127628
has comment: http://stackoverflow.com/comment/31792227
has comment: http://stackoverflow.com/comment/31792304
has comment: http://stackoverflow.com/comment/31792165
favorite count: 0
has comment: http://stackoverflow.com/comment/31792076
has comment: http://stackoverflow.com/comment/31792083
has body: I wrote a very simple program on java stack operation. I am using Java(TM) SE Runtime Environment with OS X 10.9.1. I have tried JDK build 1.7.0_13-b20 and build 1.7.0_51-b13, both do not work for me. I just wanted to test the java Stack class. I do not have a private stack implementation. And the $CLASSPATH environment variable is set to empty. I tested the same program on Windows (Win 8.1) with JDK 1.7.0_25. It worked fine. import java.util.*; public class MyStackTest { public static void main(String[] args){ Stack&lt;Integer&gt; mys = new Stack&lt;Integer&gt;(); mys.push(5); while ( ! mys.empty() ) { System.out.println(mys.peek()); mys.pop(); } } } However, while compiling using javac 1.7.0_13, I got "cannot find symbol" error: $ javac MyStackTest.java -Xlint MyStackTest.java:9: error: cannot find symbol while ( ! mys.empty() ) { ^ symbol: method empty() location: variable mys of type Stack&lt;Integer&gt; 1 error I found that if I change the import statement to import java.util.Stack the program compiles fine. Why did "import java.util." cause the problem? How can I tell which class in java.util. cause the problem? Thanks!
has comment: http://stackoverflow.com/comment/31792291
has title: java "import java.util.*" compilation failure on OS X 10.9.1
has answer: http://stackoverflow.com/a/21128098
upvote count: 2
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/31792183
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/31809640
type: Comment
has text: Can you plz try after adding above part in web.xml.
comment on: http://stackoverflow.com/a/21132386
type: AnswerComment
score: 0

http://stackoverflow.com/a/21026633
type: AcceptedAnswer
has body: First of all, don't use JList for animations. JLabels are much better options. Check this out, it explains how to use images. To answer your question, the for should be changed to iterate to list size (list.getModel().getSize()), and not to selected index, which is (obviously) the index of the selected item. Also, you might want a delay between each for iteration.
has comment: http://stackoverflow.com/comment/31608760
accepted answer of: http://stackoverflow.com/q/21026376
answers question: http://stackoverflow.com/q/21026376
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/31666139
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21058870
has text: You can either use an Interface or since your AsyncTask class is an inner class, create an Object in the Base Class and then assign the value to it

http://stackoverflow.com/comment/31882773
type: Comment
has text: Am trying to create a new entity each time the method is called.I am not very conversant with persisting objects but judging by your example, is a new entity created and stored every time a call is made to `createUserEntity()`?
comment on: http://stackoverflow.com/a/21177206
type: AnswerComment
score: 0

http://stackoverflow.com/a/21162256
has body: juniversalchardet is one of the best available API for detecting the encoding type. Please checkout this link. You can go through the list of encoding types supported by it Working Example from the site import org.mozilla.universalchardet.UniversalDetector; public class TestDetector { public static void main(String[] args) throws java.io.IOException { byte[] buf = new byte[4096]; String fileName = args[0]; java.io.FileInputStream fis = new java.io.FileInputStream(fileName); // (1) UniversalDetector detector = new UniversalDetector(null); // (2) int nread; while ((nread = fis.read(buf)) &gt; 0 &amp;&amp; !detector.isDone()) { detector.handleData(buf, 0, nread); } // (3) detector.dataEnd(); // (4) String encoding = detector.getDetectedCharset(); if (encoding != null) { System.out.println("Detected encoding = " + encoding); } else { System.out.println("No encoding detected."); } // (5) detector.reset(); } } Hope this helps!
has comment: http://stackoverflow.com/comment/31859998
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21162106
answers question: http://stackoverflow.com/q/21162106
has comment: http://stackoverflow.com/comment/31857721
type: AcceptedAnswer
upvote count: 1
type: Answer

android-image
tags question: http://stackoverflow.com/q/21070211
tag name: android-image
type: Tag

http://stackoverflow.com/a/21143774
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21141965
has body: 1.By dividing by zero (gallon) that is why it is giving "The average speed is infinity miles per hour" In this statement there is a concatenation error ....... ,",endMiles +", it should be ...... ,"+ endMiles +", JOptionPane.showMessageDialog(null, "Your ending mileage,",endMiles +", must be greater than your starting mileage, " + startMiles, "Error in Mileage", JOptionPane.ERROR_MESSAGE);

http://stackoverflow.com/a/21030065
answers question: http://stackoverflow.com/q/21025743
score: 0
has body: There are a few issues here. A USB-Sync for full-speed is 32-bits. An int is capable of containing the data, but not as an unsigned integer. The only reason your code stores it as a long is to store values of 0x80000000 to 0xFFFFFFFF as a positive number. However, only the least significant 32-bits of the long are used. To calculate the first little-endian unsigned 32-bit number in the stream and store it as a long, use: long ll = (buffer[0] &amp; 0xFF) | ((buffer[1] &amp; 0xFF) &lt;&lt; 8) | ((buffer[2] &amp; 0xFF) &lt;&lt; 16) | ((buffer[3] &amp; 0xFFL) &lt;&lt; 24); Here's a breakdown of what's happening: Your Sync packet in hex is 0x17E1444C. USB transmits this value using little-endian, which means the least significant byte is sent first. Over the wire, the bytes come in this order: 4C 44 E1 17 To break-down the steps: long ll = buffer[0] &amp; 0xFF; // ll == 0x4C &amp; 0x000000FF // == (long) 0x0000004C // == 0x000000000000004C ll |= (buffer[1] &amp;&amp; 0xFF) &lt;&lt; 8; // ll == 0x000000000000004C | ((0x44 &amp; 0x000000FF) &lt;&lt; 8) // == 0x000000000000004C | (0x00000044 &lt;&lt; 8) // == 0x000000000000004C | 0x00004400 // == 0x000000000000004C | (long) 0x00004400 // == 0x000000000000004C | 0x0000000000004400 // == 0x000000000000004C ll |= (buffer[2] &amp; 0xFF) &lt;&lt; 16; // ll == 0x000000000000444C | ((0xE1 &amp; 0x000000FF) &lt;&lt; 16) // == 0x000000000000444C | (0x000000E1 &lt;&lt; 16) // == 0x000000000000444C | 0x00E10000 // == 0x000000000000444C | (long) 0x00E10000 // == 0x000000000000444C | 0x0000000000E10000 // == 0x0000000000E1444C That last inclusion illustrates why we use &amp; 0xFF. Without using this bitwise AND, here's what happens without using &amp; 0xFF: ll |= buffer[2] &lt;&lt; 16; // ll == 0x000000000000444C | ((int) 0xE1) &lt;&lt; 16) // == 0x000000000000444C | (0xFFFFFFE1 &lt;&lt; 16) // == 0x000000000000444C | 0xFFE10000 // == 0x000000000000444C | (long) 0xFFE10000 // == 0x000000000000444C | 0xFFFFFFFFFFE10000 // == 0xFFFFFFFFFF…
type: Answer

http://stackoverflow.com/comment/31818337
has text: Please do the homework yourself or ask your teacher for further assistance. Voting to close.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21141965
score: 3

http://stackoverflow.com/q/21132442
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/21132820
type: Question
tagged with: weather
tagged with: java
has comment: http://stackoverflow.com/comment/31800968
has title: Null Pointer Exception while converting Temperature from Celcius to Farenheit in android
has comment: http://stackoverflow.com/comment/31800999
has comment: http://stackoverflow.com/comment/31801422
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/31800972
answer count: 1
favorite count: 0
tagged with: nullpointerexception
has body: I am trying to convert the temperature from celcius to farenheit(C to F) in Settings Page for weather app. once i click the toggle button to "C" or "F" and press "SAVE" button the app gets crashed and force closes, instead after the convert, it should display the result in MainActivity.java screen. The error in the logcat tells that this is due to "Null Pointer" Exception, but i have declared all the varible correctly. Please help me to rectify this issue. Thanks. Here's the code. this is the line which gets null pointer exception String ccmin1 =data.getStringExtra("cmin1"); .. public class MainActivity extends SherlockActivity implements OnClickListener { private TextView tempmin1; Logcat Error. 01-15 13:37:25.287: E/AndroidRuntime(602): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2, result=1, data=Intent { (has extras) }} to activity {com.weather/com.weather.MainActivity}: java.lang.NullPointerException 01-15 13:37:25.287: E/AndroidRuntime(602): at android.app.ActivityThread.deliverResults(ActivityThread.java:2532) 01-15 13:37:25.287: E/AndroidRuntime(602): at android.app.ActivityThread.handleSendResult(ActivityThread.java:2574) 01-15 13:37:25.287: E/AndroidRuntime(602): at android.app.ActivityThread.access$2000(ActivityThread.java:117) 01-15 13:37:25.287: E/AndroidRuntime(602): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:961) 01-15 13:37:25.287: E/AndroidRuntime(602): at android.os.Handler.dispatchMessage(Handler.java:99) 01-15 13:37:25.287: E/AndroidRuntime(602): at android.os.Looper.loop(Looper.java:123) 01-15 13:37:25.287: E/AndroidRuntime(602): at android.app.ActivityThread.main(ActivityThread.java:3683) 01-15 13:37:25.287: E/AndroidRuntime(602): at java.lang.reflect.Method.invokeNative(Native Method) 01-15 13:37:25.287: E/AndroidRuntime(602): at java.lang.reflect.Method.invoke(Method.java:507) 01-15 13:37:25.287: E/AndroidRuntime(602): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(Z…
has comment: http://stackoverflow.com/comment/31801103
tagged with: android

http://stackoverflow.com/q/21079985
score: 0
tagged with: slidingdrawer
answer count: 1
has body: Let's say I have an activity which is called Main, and in this activity I have a sliding drawer . I wonder if instead of putting an image in the sliding drawer maybe I could put the map, so when I slide out the drawer I can use the map. Is it possible? Thank you.
tagged with: android
has answer: http://stackoverflow.com/a/21082980
type: AnsweredQuestion
has title: How to put Google Map in sliding drawer
accepted answer: http://stackoverflow.com/a/21082980
type: Question
tagged with: java

http://stackoverflow.com/q/21047475
tagged with: sockets
tagged with: android
has answer: http://stackoverflow.com/a/21047717
accepted answer: http://stackoverflow.com/a/21047717
type: AnsweredQuestion
score: 3
upvote count: 3
has body: In my Android application I send out UDP packets and I use this code to wait for a particular one. When it arrives, I don't need to listen anymore. However, it is in "receive mode", and when I call socket.close(), it throws an exception. Somehow I should stop it. How can I stop receiving without an exception? socket.send(packet); Log.d(Tags.DEBUG, "Sent"); while (shouldRunning) { byte[] buf = new byte[1024]; DatagramPacket packet2 = new DatagramPacket(buf, buf.length); Log.d(Tags.DEBUG, "Receive start"); //if (socket != null && !socket.isClosed()) { socket.receive(packet2); Log.d(Tags.DEBUG, "ADDR" + packet2.getAddress().toString()); String data = String.valueOf(packet2.getData()); Log.w(Tags.DEBUG, "Data: " + data); if (data.equals(Tags.SPEC1)) shouldRunning= false; } //else //shouldRunning= false; } And I close the socket this way: @Override protected void onCancelled() { if (socket != null) { //socket.disconnect(); shouldRunning=false; socket.close(); socket = null; } } And I get this exception: java.net.SocketException: Socket closed at org.apache.harmony.luni.platform.OSNetworkSystem.recv(Native Method) at dalvik.system.BlockGuard$WrappedNetworkSystem.recv(BlockGuard.java:321) at org.apache.harmony.luni.net.PlainDatagramSocketImpl.doRecv(PlainDatagramSocketImpl.java:172) at org.apache.harmony.luni.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:181) at java.net.DatagramSocket.receive(DatagramSocket.java:402) at com.example.Data.DataAsyncTask.Networking(DataAsyncTask.java:745)
tagged with: java
type: Question
has title: How to close a DatagramSocket when it is in receive state
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/a/21161898
type: Answer
answers question: http://stackoverflow.com/q/21155120
has body: In Swing Application: JPanel editorPanel = new JPanel(new BorderLayout()); JideSplitPane splitPane = new JideSplitPane(); splitPane.add(diffUtil.getLeftEditor())); splitPane.add(diffUtil.getRightEditor())); editorPanel.add(splitPane); In Swing, I got the dialog window populating two contents in left and right pane and the difference is colored. In this Panel I have a button to saveToHTML. On click of the button I have to store the content displayed in this popup to the HTML. SaveToHTML Button onclick, I have written this function. ConfigurationDiffUtil util = new ConfigurationDiffUtil(previous.getRuRO().getContent(), latest.getRuRO().getContent()); JEditorPane yourEditorPane = new JEditorPane(); yourEditorPane.setContentType("text/html"); // yourEditorPane.setText(util.getLeftEditor().getText()); JideSplitPane splitPane = new JideSplitPane(); splitPane.add(diffUtil.getLeftEditor())); splitPane.add(diffUtil.getRightEditor())); yourEditorPane.add(splitPane); if (selectedFile.isDirectory()) { String deviceFolderName = selectedFile.getPath() + File.separator + escapeFileName(deviceId.getName()); File deviceFolder = new File(deviceFolderName); if ( (deviceFolder.exists() &amp;&amp; confirmOverwrite(deviceFolderName)) || deviceFolder.mkdir()) { String saveFileName = escapeFileName(deviceId.getName())+"."+ "html"; File dataFile = new File (deviceFolder, saveFileName); try { BufferedWriter out = new BufferedWriter(new FileWriter(dataFile)); HTMLWriter hw = new HTMLWriter(out, (HTMLDocument) yourEditorPane.getDocument()); hw.write(); out.flush(); out.close(); } catch (FileNotFoundException e) { Log.error(this, "ExportCredentials:credentials file not found",e); } catch (BadLocationException e) { Log.error(this, "ExportCredentials:credentials file not found",e); } catch (IOException e) { Log.error(this, "ExportCredentials:unable to read the file",e); } } } } i) setText shows the content in the html page. yourEditorPane.setText(util.getLeftEditor().getText()); this line shows m…
score: 0

http://stackoverflow.com/comment/101145369
comment on: http://stackoverflow.com/q/21105403
type: Comment
has text: Feature-tracking issue is https://github.com/mockito/mockito/issues/1013
score: 0
type: QuestionComment

http://stackoverflow.com/a/21105286
accepted answer of: http://stackoverflow.com/q/21105153
upvote count: 1
score: 1
has body: Just cast and java autoboxing will convert to the Long object type for you. No need to make special libraries or extra methods (stay lean!) linkcatch.setCode((long)relatedCd.getDouble(value)); Notes: You might want to round instead of just casting. (double to long conversion) I see you have a 'realtedCd' object which means you might be dealing with money or arithmetic operations. If so, I'd advise using BigDecimal instead of doubles for precision Double vs. BigDecimal?
answers question: http://stackoverflow.com/q/21105153
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31742085
score: 2
has text: If you have to do this, it suggests your design is may be flawed to start with. Can you not have a method in `SuperClass` and override it in the `SubClass`?
comment on: http://stackoverflow.com/q/21100051
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21098144
type: Answer
has comment: http://stackoverflow.com/comment/31740834
score: 1
has body: I quote SLaks's answer and I would like to add an answer to your comment here, as I do not have enough reputation yet. You "don't need to set the length at the declaration". The line String[] menuArray; actually only declares a reference to an array object, it does not create the object itself, it does not allocate the memory for the array (except the tiny bit for the reference on the stack). Remember to initialise the variable before accessing it though. That said, I think if you are looking for an "expandable" array, then you should use ArrayList and the List interface. An ArrayList, not ListArray, is a 'Resizable-array implementation of the List interface', from the Java official docs. Could you change the method setUpView to take a List? If not you can still convert ArrayList to array back and forth with: List&lt;String&gt; menuList; // ... String[] arr = (String[]) menuList.toArray(); List&lt;String&gt; list = new ArrayList&lt;String&gt;(Arrays.asList(arr));
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21096929

http://stackoverflow.com/comment/31662616
comment on: http://stackoverflow.com/a/21056555
has text: The torment is over. Thank you.
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21043362
downvote count: 1
linked to: http://stackoverflow.com/q/890966
tagged with: parameters
type: AnsweredQuestion
tagged with: object
score: 2
has answer: http://stackoverflow.com/a/21043413
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/21043385
duplicate of: http://stackoverflow.com/q/890966
linked to: http://stackoverflow.com/q/8102610
has body: Main method in Java have the String[] as input parameter to the main method, but i want to pass object as a parameter. Java and all command line parametrized languages accept only String array of arguments which make sense as our ability to call using command line gives us the ability to enter text that could be represented by String object in Java This is how we used to have a method like: public static void main (String[] args) { for (String text: args) { System.out.println(text); } } If we need to pass integer value, we need to use parsing method to obtain the numeric value from it. try { Arg = Integer.parseInt(args[0]); } catch (NumberFormatException e) { System.err.println("Number format mismatch"); } What if we need to pass a whole object as an argument to the class? Regards
has answer: http://stackoverflow.com/a/21043431
type: Question
accepted answer: http://stackoverflow.com/a/21043413
duplicate of: http://stackoverflow.com/q/8102610
tagged with: program-entry-point
tagged with: string
has title: can we change the main method of java?
has comment: http://stackoverflow.com/comment/31636650
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/21043601
has answer: http://stackoverflow.com/a/21043399
has answer: http://stackoverflow.com/a/21043385

http://stackoverflow.com/comment/31842453
score: 3
has text: `equals()` does not "compare the hashcode" ... it compares whatever the method is written to compare.
type: Comment
comment on: http://stackoverflow.com/q/21155007
type: QuestionComment

http://stackoverflow.com/a/21074069
has comment: http://stackoverflow.com/comment/31693754
score: 1
has comment: http://stackoverflow.com/comment/31693938
upvote count: 1
answers question: http://stackoverflow.com/q/21074024
has comment: http://stackoverflow.com/comment/31693722
has comment: http://stackoverflow.com/comment/31693966
downvote count: 0
has comment: http://stackoverflow.com/comment/31693742
has body: I don't think the width will be calculated until the Label is shown: add it to a Parent that is visible and you should get a non-zero result.
type: Answer

http://stackoverflow.com/a/21183180
score: 3
upvote count: 3
has body: Note: I'm the EclipseLink JAXB (MOXy) lead and a member of the JAXB (JSR-222) expert group. You could use the @XmlPath extension in the MOXy implementation of JAXB to map this use case. import javax.xml.bind.annotation.*; import org.eclipse.persistence.oxm.annotations.XmlPath; @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class ProductInfo { @XmlPath("product/productPrice/price/text()") private double price; } For More Information http://blog.bdoughan.com/2010/07/xpath-based-mapping.html http://blog.bdoughan.com/2011/05/specifying-eclipselink-moxy-as-your.html
answers question: http://stackoverflow.com/q/21179432
type: Answer
downvote count: 0

http://stackoverflow.com/comment/31664333
comment on: http://stackoverflow.com/a/21032301
type: AnswerComment
has text: Ahhhhhh haha sorry I didn't see the "to". :) I thought you were saying you prefer `isAssignableFrom()`. Sorry. :)
score: 0
type: Comment

http://stackoverflow.com/a/21127950
upvote count: 3
has body: 3 options sorted (arguably) from worst to better: render the javascript as part of the page as @DaveNewton commented have the value hidden in the html document and get it with javascript getElementBy... or jquery like make an ajax call and return a proper JSON
has comment: http://stackoverflow.com/comment/31795349
has comment: http://stackoverflow.com/comment/31795450
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21127862
downvote count: 0
has comment: http://stackoverflow.com/comment/32526978
has comment: http://stackoverflow.com/comment/31793965
type: Answer
score: 3
answers question: http://stackoverflow.com/q/21127862

http://stackoverflow.com/a/21172323
downvote count: 0
type: Answer
score: 2
has body: Generally, a factory method is placed in a separate class when you're going to be plugging in different implementations of the object at different times. The factory is a well-known entry point to obtain an instance of the object, and needs to always be findable. But the factory may be selecting among multiple implementations, or dynamically loading them via reflection, with the caller not knowing (or caring) which implementation is returned.
answers question: http://stackoverflow.com/q/21169301
accepted answer of: http://stackoverflow.com/q/21169301
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/a/21078968
has comment: http://stackoverflow.com/comment/31704075
upvote count: 1
answers question: http://stackoverflow.com/q/21065850
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/31704703
score: 1
has body: This is a duplicate of How to return 2D long array with JNI except that you want a 2D double array instead of a 2D long array. For 2D double arrays your FindClass() method needs to find "[D" instead of "java/lang/Double"

http://stackoverflow.com/a/21092169
upvote count: 2
type: Answer
has body: You try to acces non static method getClass() from static context(method main()). You can use from static context: inicializador_tela_login.class.getResource(...) or create instance of class and use getClass() method: new inicializador_tela_login().getClass().getResource(...)
answers question: http://stackoverflow.com/q/21091987
score: 2
downvote count: 0

http://stackoverflow.com/q/21066918
favorite count: 0
has body: Right now I am finding out 25% of a persons years and for example if you had 5 years 25% is 1.25. Though the plugin im making cant remove 1.25 years from you the .25 needs to be converted to weeks and then any leftovers to days and so on. Though I dont know how I would convert these times. Integer y = itapi.getPlayerYears(player.getName()); Double yremove = Integer.valueOf(y) * 0.25; Integer w = itapi.getPlayerWeeks(player.getName()); Double wremove = Integer.valueOf(w) * 0.25; Integer d = itapi.getPlayerDays(player.getName()); Double dremove = Integer.valueOf(d) * 0.25; Integer h = itapi.getPlayerHours(player.getName()); Double hremove = Integer.valueOf(h) * 0.25; Integer m = itapi.getPlayerMinutes(player.getName()); Double mremove = Integer.valueOf(m) * 0.25; Integer s = itapi.getPlayerSeconds(player.getName()); Double sremove = Integer.valueOf(s) * 0.25; String yminus = String.valueOf(yremove) + 'y'; String wminus = String.valueOf(wremove) + 'w'; String dminus = String.valueOf(dremove) + 'd'; String hminus = String.valueOf(hremove) + 'h'; String mminus = String.valueOf(mremove) + 'm'; String sminus = String.valueOf(sremove) + 's'; ItemStack book = itapi.createTimeCard("Death of " + player.getName(), yminus + wminus + dminus + hminus + mminus + sminus, 1); itapi.removeTime(player.getName(), yminus + wminus + dminus + hminus + mminus + sminus ); e.getDrops().add(book); Would it be possible to work the conversion out or would it be better to convert all time to seconds then take 25% and convert it back?
has answer: http://stackoverflow.com/a/21067108
tagged with: plugins
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/21067129
has title: Converting the left over decminal to weeks, days, hours, min, seconds
accepted answer: http://stackoverflow.com/a/21067108
has answer: http://stackoverflow.com/a/21067129
tagged with: math
tagged with: minecraft
has answer: http://stackoverflow.com/a/21067176
answer count: 3
downvote count: 0

http://stackoverflow.com/comment/31668621
type: Comment
comment on: http://stackoverflow.com/a/21051598
score: 0
type: AnswerComment
has text: @Sotirios Delimanolis spring 3 supports spring 2 as well, so why are you downgrading me

http://stackoverflow.com/q/21042915
has answer: http://stackoverflow.com/a/30728495
type: Question
has answer: http://stackoverflow.com/a/21043020
tagged with: java
has comment: http://stackoverflow.com/comment/31636060
has comment: http://stackoverflow.com/comment/31636113
has body: I am new to java programming language. First i download the sdk and install it in to my pc. Then i add a new environment variable like this path C:\Program Files\Java\jdk1.6.0_29\bin After creating this i entered javac in my cmd prompt. But i didn't get any thing. 'javac' is not recognized as an internal or external command. operable program or batch file. i am look in to some tutorials they said this way for setting path. if any one know about this please help me.
tagged with: path
has comment: http://stackoverflow.com/comment/31636026
has answer: http://stackoverflow.com/a/21043086
answer count: 4
has answer: http://stackoverflow.com/a/21042997
score: 0
type: UnansweredQuestion
has title: java path is not set when add path field in environment variables
has comment: http://stackoverflow.com/comment/31635869
has comment: http://stackoverflow.com/comment/31636058

http://stackoverflow.com/comment/31714542
score: 0
type: Comment
type: QuestionComment
has text: OK I'll post the serialization part....
comment on: http://stackoverflow.com/q/21084884

http://stackoverflow.com/comment/31884387
score: 0
type: Comment
type: QuestionComment
has text: is menu a base activity class?
comment on: http://stackoverflow.com/q/21178143

http://stackoverflow.com/a/21053090
score: 1
upvote count: 1
has body: Do not close it, just flush, this is what Log4j FileAppender does by default.
downvote count: 0
answers question: http://stackoverflow.com/q/21053017
type: Answer

http://stackoverflow.com/a/21141718
has comment: http://stackoverflow.com/comment/31817763
type: Answer
answers question: http://stackoverflow.com/q/21141485
score: 2
accepted answer of: http://stackoverflow.com/q/21141485
upvote count: 2
has comment: http://stackoverflow.com/comment/31818039
has body: If you're looking to get back the value 4245 (the port your server socket is listening on) from the connected socket, you want getLocalPort, not getPort. getPort: Returns the remote port number to which this socket is connected. getLocalPort: Returns the local port number to which this socket is bound. (My emphasis)
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21101748
upvote count: 1
tagged with: jersey-client
has body: I've been toying around with jersey's OAuth2.0 Client Support Library. And it works like a charm too. However I can't seem to find a way to specify the state parameter which gets sent in the authorization request. Jersey generates a random UUID for me and lets me retrieve it when I get the authorization provider's response. Before that the only option I have come up with is to manually parse the URI string which start() returns. But this shouldn't be right, right? Either I am missing something in jersey or I am missing the point of the state parameter... So do you know of any (more elegant than mine) way to extract the state parameter just after I start() the flow? Or a way to put my own state variable in the flowBuilder? I'm using jersey 2.5.1 by the way. Edit to include a code sample: final ClientIdentifier clientIdentifier = new ClientIdentifier(CLIENT_ID, CLIENT_SECRET); final OAuth2CodeGrantFlow codeGrantFlow = OAuth2ClientSupport .googleFlowBuilder(clientIdentifier, redirectURI, scope) .prompt(OAuth2FlowGoogleBuilder.Prompt.CONSENT).build(); final String googleAuthURI = codeGrantFlow.start(); How do I get/set the state somewhere in there? Edit2: Here is the feature request on Jersey's JIRA https://java.net/jira/browse/JERSEY-2342 In the meantime what Michal Gajdos suggested works fine for me.
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: jersey
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21118438
accepted answer: http://stackoverflow.com/a/21118438
has title: Explicit state parameter in jersey's OAuth2CodeGrantFlow
tagged with: oauth
has comment: http://stackoverflow.com/comment/31775189
tagged with: oauth-2.0

http://stackoverflow.com/comment/31632159
score: 0
comment on: http://stackoverflow.com/q/21039620
type: Comment
type: QuestionComment
has text: Actually I already had Jackson 1.9.2 and along with that I added jersey-media-json-processing-2.5.1.

http://stackoverflow.com/a/27296177
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21104340
upvote count: 2
score: 2
has body: This work for me in apache-tomcat-8.0.15, but i think it would be the same for all to tomcat's version. I had executed regedit and found this path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tomcat8 And change ImagePath key to: C:\apache-tomcat-8.0.15\bin\tomcat8.exe //RS//Tomcat8 ++JvmOptions -XX:PermSize=128m -XX:MaxPermSize=512m

http://stackoverflow.com/a/21162900
downvote count: 1
answers question: http://stackoverflow.com/q/21162677
score: 3
has body: Just look at the year and the dayOfYear. int days = (end.year-start.year)*365 + end.dayOfYear - start.dayOfYear;
upvote count: 4
type: Answer

http://stackoverflow.com/comment/31841432
type: QuestionComment
comment on: http://stackoverflow.com/q/21139128
score: 0
has text: `List <WebElement> a3 = a2.findElements(By.xpath(".//*));`..double quote is missing in this statement, guess its a typo...have you tried using other xpaths or cssSelectors?
type: Comment

http://stackoverflow.com/comment/63359963
comment on: http://stackoverflow.com/q/21180269
has text: You would create a Builder for the Dialog instead of using the setters for a fluent api. If you do so many bean like access will no longer work as the frameworks restrict setters to return void. Have a look at project lombok if you don't like to write all that boiler plate.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/77067720
has body: I can only repeat the answer given in another question: This is not supported. Using Windows APIs, you can add a window into a HWND of JFrame, Panel (not JPanel!) or Canvas. Yet Java will never know you did it, it could break many assumptions inside AWT code. Even when you write a native Win32 app, you can't embed an arbitrary window into your top-level window. If the window you want to embed is a top-level window, it may not play well when it's made a child window of another window because, again, the assumptions are now wrong, some messages are handled differently.
has comment: http://stackoverflow.com/comment/135871064
answers question: http://stackoverflow.com/q/21076086
score: 0
has comment: http://stackoverflow.com/comment/135877629
type: Answer

internationalization
tags question: http://stackoverflow.com/q/21094947
type: Tag
tags question: http://stackoverflow.com/q/21083544
tags question: http://stackoverflow.com/q/21180607
tag name: internationalization
tags question: http://stackoverflow.com/q/21134482

http://stackoverflow.com/a/29841824
type: Answer
score: 88
has comment: http://stackoverflow.com/comment/67380943
answers question: http://stackoverflow.com/q/21105403
upvote count: 90
downvote count: 2
has body: The typical strategy for dodging static methods that you have no way of avoiding using, is by creating wrapped objects and using the wrapper objects instead. The wrapper objects become facades to the real static classes, and you do not test those. A wrapper object could be something like public class Slf4jMdcWrapper { public static final Slf4jMdcWrapper SINGLETON = new Slf4jMdcWrapper(); public String myApisToTheSaticMethodsInSlf4jMdcStaticUtilityClass() { return MDC.getWhateverIWant(); } } Finally, your class under test can use this singleton object by, for example, having a default constructor for real life use: public class SomeClassUnderTest { final Slf4jMdcWrapper myMockableObject; /** constructor used by CDI or whatever real life use case */ public myClassUnderTestContructor() { this.myMockableObject = Slf4jMdcWrapper.SINGLETON; } /** constructor used in tests*/ myClassUnderTestContructor(Slf4jMdcWrapper myMock) { this.myMockableObject = myMock; } } And here you have a class that can easily be tested, because you do not directly use a class with static methods. If you are using CDI and can make use of the @Inject annotation then it is even easier. Just make your Wrapper bean @ApplicationScoped, get that thing injected as a collaborator (you do not even need messy constructors for testing), and go on with the mocking.

http://stackoverflow.com/a/78187787
type: Answer
has body: Most of the answers above regarding getting the certificate from the browser and importing it into your JRE cacerts are correct. I just wanted to clarify why this is happening and why is this necessary sometimes? Simply put, this could happen in 2 cases: When the certificate used by the target server is signed by an unknown CA (Certificate Authority). By unknown here is meant - unknown to your java. Java maintains a list of trusted CAs in its cacert and if the certificate was signed by some unknown CA or an incomplete set of CAs, the error will happen When you are behind a proxy which sniffs the https connection and replaces the target server certificate with its own certificate (e.g. Zscaler). Same thing, you need to get that certificate and import it into your JRE.
upvote count: 3
answers question: http://stackoverflow.com/q/21076179
has comment: http://stackoverflow.com/comment/138906646
downvote count: 0
score: 3

http://stackoverflow.com/a/21097049
answers question: http://stackoverflow.com/q/21096946
type: Answer
has body: Try &lt;ListView android:id="@+id/list" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; Cal the list view like ListView mlist = (ListView)findViewById(R.id.list); Then clean your project and check.
has comment: http://stackoverflow.com/comment/31736096
upvote count: 0
has comment: http://stackoverflow.com/comment/31738658
has comment: http://stackoverflow.com/comment/31736175
score: -1
downvote count: 1

http://stackoverflow.com/a/21114520
has body: I need to make an application that allows the management of a Hotel, i would like to draw in the interface a calender which contains the dates and rooms, so the user can see which room is available for which date. JXDatePicker is intended to use as is, you cannot add any information in the calendar. But you can listen to selection changes and show available rooms in other components such as JList or JTable or even JComboBox. Adding an ActionListener JXDatePicker picker = new JXDatePicker(); picker.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // implementation here } }); Adding a PropertyChangeListener JXDatePicker picker = new JXDatePicker(); picker.addPropertyChangeListener("date", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent e) { // implementation here } });
accepted answer of: http://stackoverflow.com/q/21111368
has comment: http://stackoverflow.com/comment/31823322
score: 0
has comment: http://stackoverflow.com/comment/31821369
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21111368

http://stackoverflow.com/comment/31607409
has text: @delnan I don't see how it doesn't make sense. A JS object with a constructor is closer to resemblance of a Java class which also has a constructor than a Java interface which does not have a constructor.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21026704

http://stackoverflow.com/q/21059809
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21059836
type: Question
has title: String Causing Unexpected Errors
has body: I'm having a problem with some code, in the constructor of the level, i have this.public Level(int width, int height, String level) { grid=new Block[width][height]; String v = ""; for (int y = 0; y &lt; height; y++) { for (int x = 0; x &lt; width; x++) { char s = level.charAt(y * height + x); if (s=='#') { grid[x][y] = new Wall(x, y); } else if (s=='_'){ grid[x][y] = new Block(x, y); } } } } Only when I run the Level initializer with the following... new Level(16,16,"###############" + "#_____________#" + "#___######____#" + "#___#____###__#" + "#___#__###_#__#" + "#####_________#" + "#_____#__######" + "#___###_______#" + "#_#_#_# #####_#" + "#_#___#____#__#" + "#_#####__###_##" + "#_____####____#" + "#_#_#______##_#" + "###_#__#####__#" + "#___#______#__#" + "###############"); I get Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String Index out of range: 240 at java.lang.String.charAt(String.java:686) at Level.&lt;init&gt;(Level.java:17) at Game.&lt;init&gt;(Game.java:12) at Main.main(Main.java:7)` Any help is greatly appreciated.
answer count: 2
score: 3
accepted answer: http://stackoverflow.com/a/21059836
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/21059856
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21059856

http://stackoverflow.com/a/21035302
downvote count: 0
has comment: http://stackoverflow.com/comment/31650625
has comment: http://stackoverflow.com/comment/31628881
has comment: http://stackoverflow.com/comment/31623896
accepted answer of: http://stackoverflow.com/q/21035252
type: Answer
has comment: http://stackoverflow.com/comment/31627929
has comment: http://stackoverflow.com/comment/51443005
has comment: http://stackoverflow.com/comment/31628173
has comment: http://stackoverflow.com/comment/31630350
score: 9
answers question: http://stackoverflow.com/q/21035252
upvote count: 9
has body: One traversal and no additional memory Source .fromFile("files/ChargeNames") .getLines .map { line =&gt; //do stuff with line like line.replace('a', 'b') } .foreach(println) Or code which is a little bit faster, according to @ziggystar Source .fromFile("files/ChargeNames") .getLines .foreach { line =&gt; //do stuff with line like println(line.replace('a', 'b')) }
type: AcceptedAnswer

http://stackoverflow.com/q/21126432
has comment: http://stackoverflow.com/comment/31790607
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31790647
has answer: http://stackoverflow.com/a/21126486
has comment: http://stackoverflow.com/comment/31791963
has body: I would like to check if class name is valid at the compile time. I can certainly import the class and get a compilation error, however what I want is to be able to catch this error. How can I do that, if that's not a good way what other alternatives can I do that? For example import com.foo.classname; public class Foo { public String classProperties() { if(classname) {//this is when class is found ClassName className = new ClassName(); return className.toString(); } else {//this is when class is not found return getOtherProperty(); } } } Please don't post anything runtime such as Class.forName solutions. Edit: After getting so many negative feedback. I would like to explain a little more about my idea. My main motivation ideas were: 1) I have seen some code which are using Reflection for this. Such as loading a library from JDK 7 and using that library methods to initialise a String, also writing something else(probably less efficient) to catch block where exception is occurred. I wanted to avoid this situation 2) Both errors and warnings are created by the compiler. If we can suppress a warning, then I thought it was possible to suppress an error.
has comment: http://stackoverflow.com/comment/31790990
has comment: http://stackoverflow.com/comment/31790986
tagged with: java
score: -4
type: Question
has comment: http://stackoverflow.com/comment/31790997
has comment: http://stackoverflow.com/comment/31791931
tagged with: class
has comment: http://stackoverflow.com/comment/31790936
downvote count: 4
has comment: http://stackoverflow.com/comment/31790980
has comment: http://stackoverflow.com/comment/31790688
upvote count: 0
has comment: http://stackoverflow.com/comment/31791105
answer count: 1
has comment: http://stackoverflow.com/comment/31792918
has title: Checking if class name is valid in Java

http://stackoverflow.com/comment/31687169
comment on: http://stackoverflow.com/q/21070207
type: Comment
type: QuestionComment
has text: @RomanVottner will that give me a valid path?
score: 0

http://stackoverflow.com/comment/31773480
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21116672
has text: @TominJacob Not sure I understand. 99% of classes in Java don't extend Application... `class MyClassThatDoesNotExtendApplication { }`
type: Comment

http://stackoverflow.com/comment/31810204
has text: I think the Java panel in the system control is the reason. The options there are stronger than the enviroment variable.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21137704

http://stackoverflow.com/comment/31879822
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21175450
has text: Database access is expensive for larger objects and so it should be done in detached mode to ensure you don't make unnecessary calls to the backend.
score: 0

http://stackoverflow.com/q/21109502
has title: Spring MVC + Hibernate
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/21109962
tagged with: spring-mvc
tagged with: hibernate-4.x
score: 0
tagged with: java
type: Question
has body: i've a problem with hibernate configuration in Spring. My project is a repository project. This is 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 Framework-core-data-oracle Framework-core-data-oracle 1.0-SNAPSHOT com.oracle ojdbc6 11.2.0 org.springframework spring-orm 4.0.0.RELEASE org.springframework spring-core 3.1.1.RELEASE org.hibernate hibernate-core 4.2.8.Final This are my beans definition: classpath:hibernate.cfg.xml This is my hibernate config xml: <?xml version="1.0" encoding="utf-8"?> <hibernate-configuration> oracle.jdbc.driver.OracleDriver jdbc:oracle:thin:@10.10.10.4:1521:BAGSTORAGE system bagstorage! org.hibernate.dialect.Oracle10gDialect BAGSTORAGE true </hibernate-configuration> When i try to autowire SessionFactory i've got this error: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.orm.hibernate4.LocalSessionFactoryBean] for bean with name 'sessionFactory' defined in ServletContext resource -> nested exception is java.lang.ClassNotFoundException: org.springframework.orm.hibernate4.LocalSessionFactoryBean I have spring orm added in pom, spring mvc version is > 3, so there is no problem with hibernate 4. Any ideas? I've this situation: Project A: core project, with spring dependency in maven Project B: Repository project, where there are core project (project A), hibernate-core, oracle and spring-orm dependencies Project C: Work project, with beans configurations and project A and project B in dependencies Thanks
has answer: http://stackoverflow.com/a/21109684
answer count: 2

http://stackoverflow.com/comment/31737747
type: AnswerComment
has text: Oh, those errors are pretty much completely bogus. I have a bug open to suppress them.
type: Comment
comment on: http://stackoverflow.com/a/21086904
score: 0

http://stackoverflow.com/comment/31641444
has text: Also, arrays are 0-based. And it'd better using a List...
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21045820
type: Comment

http://stackoverflow.com/comment/31605606
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21023468
type: Comment
has text: No, you can assign the array to a member of the wrapper class (or it can start off in the wrapper class) and simply set a "reversed" flag in the wrapper class (indicating to the accessors and mutators that they should indexes the array in reverse), both in O(1).

http://stackoverflow.com/comment/31755892
type: Comment
type: QuestionComment
has text: There are so many questions titled `Variable may not have been initialized`, or something similar, that it was difficult to clean up your title. Seriously, before posting a question, go through the other answers (especially the ones that come up when you start typing you question) and **read** them. Stackoverflow is not a random person you ask for an answer. Before asking, see if there is already an answer to your question. If you want more explanation, find some other forum.
comment on: http://stackoverflow.com/q/21107202
score: 0

http://stackoverflow.com/comment/31759285
score: 0
has text: Yeah I've been using `AliasToBeanResultTransformer`, but would it map the data to the proper collection? To use some DTO containing fields `race.id` and `List<Integer> startingNumbers`? Maybe worth trying, I'll try something with that. Thanks for the hint.
type: Comment
comment on: http://stackoverflow.com/a/21108786
type: AnswerComment

http://stackoverflow.com/a/21075605
downvote count: 0
type: Answer
has body: In case your line is 6 length long that means the range of possibilities are [0, 5]. Then if we take i as 0 and invertire as 6 will get the following evaluation: invertire.charAt(6 - 0) The result is of course invertire.charAt(6) that doesn't appears in the range, and it's what causing the exception. Fix: invertire.charAt(invertire.length() - i - 1)
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21075501

http://stackoverflow.com/comment/31612817
comment on: http://stackoverflow.com/q/21029604
type: Comment
has text: @LuiggiMendoza: no, it's inside. it's outside the two if() blocks, but still inside the while()
score: 0
type: QuestionComment

http://stackoverflow.com/a/21180917
type: AcceptedAnswer
downvote count: 0
has body: It seems that Show in Breadcrumb action does just this. It can be found from the editor's popup menu.
answers question: http://stackoverflow.com/q/21180916
type: Answer
accepted answer of: http://stackoverflow.com/q/21180916
upvote count: 3
score: 3

http://stackoverflow.com/q/21100694
tagged with: http://stackoverflow.com/tag/xml
tagged with: maven
upvote count: 1
type: AnsweredQuestion
has body: I have some XML that I am processing using JAXB. I don't understand why I cannot access the inner element of this tag. XML snippet: &lt;binary&gt; &lt;route&gt; &lt;payload source="SomeService" version="1.2"&gt;&lt;![CDATA[ACAA8f///...snip...AAAAAGGAAAARAFR]]&gt; &lt;/payload&gt; &lt;/route&gt; &lt;/binary&gt; From this I generated an XSD: &lt;xsd:element name="binary"&gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="route"&gt; &lt;xsd:complexType&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="payload"&gt; &lt;xsd:complexType&gt; &lt;xsd:attribute name="source" type="xsd:string" /&gt; &lt;xsd:attribute name="version" type="xsd:string" /&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; I am using maven-jaxb2-plugin and all works well: &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;inherited&gt;true&lt;/inherited&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; &lt;configuration&gt; &lt;source&gt;1.6&lt;/source&gt; &lt;target&gt;1.6&lt;/target&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;groupId&gt;org.jvnet.jaxb2.maven2&lt;/groupId&gt; &lt;artifactId&gt;maven-jaxb2-plugin&lt;/artifactId&gt; &lt;executions&gt; &lt;execution&gt; &lt;goals&gt; &lt;goal&gt;generate&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; On my object, I have methods for getSource() and getVersion() but no getValue() or something along those lines. Am I fundamentally missing something? Is attempting to access inner element data in this manner not correct? EDIT: Included generated Java code /** * &lt;p&gt;Java class for anonymous complex type. * * &lt;p&gt;The following schema fragment specifies the expected content contained within this class. * * &lt;pre&gt; * &amp;lt;complexType&gt; * &…
score: 1
tagged with: java
tagged with: jaxb
has comment: http://stackoverflow.com/comment/31743650
type: Question
has comment: http://stackoverflow.com/comment/31743535
downvote count: 0
answer count: 1
favorite count: 0
has title: JAXB inner element ignored
has answer: http://stackoverflow.com/a/21100876
accepted answer: http://stackoverflow.com/a/21100876

http://stackoverflow.com/comment/31708688
type: AnswerComment
type: Comment
has text: +1, Yes a DocumentListener is the better approach. See the section from the Swing tutorial on [How to Write a Document Listener](http://docs.oracle.com/javase/tutorial/uiswing/events/documentlistener.html) for more information.
comment on: http://stackoverflow.com/a/21081552
score: 0

http://stackoverflow.com/comment/31664507
comment on: http://stackoverflow.com/q/21058019
type: QuestionComment
has text: please indent your code!
type: Comment
score: 1

http://stackoverflow.com/a/21137203
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31809539
has comment: http://stackoverflow.com/comment/31809236
score: 1
answers question: http://stackoverflow.com/q/21136938
has comment: http://stackoverflow.com/comment/31809826
downvote count: 0
has body: You could try IoC container. E.g. in guice it will be: class MyClass { @Inject @Named("host") String host; @Inject @Named("port") int port; } or with custom annotations: class MyClass { @Inject @Host String host; @Inject @Port int port; }

http://stackoverflow.com/comment/31749532
type: Comment
comment on: http://stackoverflow.com/q/21103617
has text: And if you have 1000 websites? :)
score: 0
type: QuestionComment

http://stackoverflow.com/q/21029276
has title: Hibernate Search - Unknown Service Requested
has comment: http://stackoverflow.com/comment/31672751
has body: I'm trying to make use of Hibernate Search in my Java EE 6 project, deployed under JBoss EAP 6.1. However, I am not seeing the indices being created when I save an object to the database. The data models are annotated properly with the necessary Hibernate Search annotations. I've tried to recreate the search indices manually, but when I do I get the following exception: Caused by: org.hibernate.service.UnknownServiceException: Unknown service requested [org.hibernate.search.spi.MassIndexerFactory] at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:126) [hibernate-core-4.2.0.Final-redhat-1.jar:4.2.0.Final-redhat-1] at org.hibernate.search.impl.FullTextSessionImpl.requestService(FullTextSessionImpl.java:213) [hibernate-search-orm-4.3.0.Final.jar:4.3.0.Final] at org.hibernate.search.impl.FullTextSessionImpl.createIndexer(FullTextSessionImpl.java:208) [hibernate-search-orm-4.3.0.Final.jar:4.3.0.Final] at org.hibernate.search.jpa.impl.FullTextEntityManagerImpl.createIndexer(FullTextEntityManagerImpl.java:292) [hibernate-search-orm-4.3.0.Final.jar:4.3.0.Final] at net.odyssi.projectx.web.actions.test.TestAction.reindexData(TestAction.java:564) [classes:] at net.odyssi.projectx.web.actions.test.TestAction$Proxy$_$$_WeldSubclass.reindexData(TestAction$Proxy$_$$_WeldSubclass.java) [classes:] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_45] at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45] at org.jboss.weld.interceptor.proxy.SimpleInterceptionChain.invokeNextInterceptor(SimpleInterceptionChain.java:85) [weld-core-1.1.13.Final-redhat-1.jar:1.1.13.Final-redhat-1] at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java…
tagged with: jpa
score: 0
has comment: http://stackoverflow.com/comment/31656694
has comment: http://stackoverflow.com/comment/31672780
has comment: http://stackoverflow.com/comment/31647274
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31651918
type: Question
tagged with: hibernate-search
tagged with: java
tagged with: hibernate
tagged with: jboss

http://stackoverflow.com/q/21164622
answer count: 1
tagged with: jsp
has answer: http://stackoverflow.com/a/21165590
has body: I am new to using JSP, I have used JSF much before but now need to build a portlet with JSP. I put a string in my list in my java code every time the user presses the submit button. But each time the list is cleared and only have the size of 1 and i dont know why. I guess I get a new instance of Main each time the page rerender. How do I fix this? My JSP: &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt; &lt;jsp:useBean id="Main" class="com.classes.Main" /&gt; &lt;div&gt; La Till: &lt;%= request.getParameter("inputText")%&gt; &lt;form name="myForm" action="" method="post" &gt; &lt;input type="text" name="inputText" &gt; &lt;input type="submit" value="Lägg till!"&gt; &lt;/form&gt; &lt;% String name = request.getParameter("inputText"); if (name != null &amp;&amp; !name.isEmpty()) { Main.addToList(name); } %&gt; &lt;c:forEach var="name" items="${Main.list}"&gt; &lt;tr&gt; &lt;c:out value="${name}"&gt;&lt;/c:out&gt; &lt;/tr&gt; &lt;/c:forEach&gt; My Java: public class Main extends HttpServlet { private List &lt;String&gt; pplList = new ArrayList(); public void addToList(String inName) { pplList.add(inName); } public List &lt;String&gt; getList() { return pplList; } public void setList(List &lt;String&gt; inList) { pplList = inList; } }
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: renderer
has title: List get empty for every rerender on jsp page in JSP
accepted answer: http://stackoverflow.com/a/21165590
score: 0

http://stackoverflow.com/comment/31665784
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21045343
has text: I'm making AssetManager .Sry that i dint mentioned here (thought its quite obvious ). Thankx for your help ...
type: AnswerComment

http://stackoverflow.com/a/21051438
downvote count: 3
has body: Yes Hibernate make sense without Spring but it will make more sense with Spring :) As you have already studied Hibernate, you know about it so let me tell you that Spring will make your life more easier mainly because of DI and it also have Hibernate support classes for doing common functions, transaction management. I suggest you to do both together because without Spring you will be learning obsolete Hibernate Design, for example using Service Locator etc. Note : You will find learning Spring way much easier as compared to Hibernate :)
score: 3
answers question: http://stackoverflow.com/q/21051259
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/84076625

http://stackoverflow.com/comment/113980926
type: Comment
has text: i think he is refering to hardcoded values not a variable
type: AnswerComment
comment on: http://stackoverflow.com/a/21155506
score: 0

http://stackoverflow.com/q/21050164
possible better answer: http://stackoverflow.com/a/21050379
linked to: http://stackoverflow.com/q/18099717
tagged with: jtable
has body: I have a program to display database into a dynamic JTable. Its working fine. Now I want to add 1 more column into the table with CheckBox in each field. What should I do? Here is my code: public static DefaultTableModel myTableModel(ResultSet rs) throws SQLException { ResultSetMetaData metadata = (ResultSetMetaData) rs.getMetaData(); int columnsCount = metadata.getColumnCount(); Vector&lt;String&gt; columnNames = new Vector&lt;&gt;(); for (int i = 1; i &lt; columnsCount; i++) { columnNames.add(metadata.getColumnName(i)); } Vector&lt;Object&gt; data = new Vector&lt;&gt;(); while (rs.next()) { Vector&lt;Object&gt; eachLine = new Vector&lt;&gt;(); for (int i = 1; i &lt; columnsCount; i++) { eachLine.add(rs.getObject(i)); } data.add(eachLine); } return new DefaultTableModel(data, columnNames); }
score: 0
has answer: http://stackoverflow.com/a/21051073
accepted answer: http://stackoverflow.com/a/21051073
has title: Adding JCheckBox into JTable
tagged with: swing
has comment: http://stackoverflow.com/comment/31649724
has answer: http://stackoverflow.com/a/21050379
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31649704
answer count: 2
has comment: http://stackoverflow.com/comment/31649550
tagged with: jcheckbox
linked to: http://stackoverflow.com/q/4526779
has comment: http://stackoverflow.com/comment/31649650

http://stackoverflow.com/comment/31812913
type: Comment
type: AnswerComment
has text: Just ran the tests in a more stable and faster environment (was getting widely varying results on the first one) and am consistently getting twice the speed on the pre-allocated case.
score: 0
comment on: http://stackoverflow.com/a/21138936

http://stackoverflow.com/comment/31649610
has text: If `temp.info == insertItem`, then they are a reference to the same object, thus "duplicates".
comment on: http://stackoverflow.com/a/21050194
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21102122
accepted answer: http://stackoverflow.com/a/21103369
tagged with: java
has answer: http://stackoverflow.com/a/21104335
score: 9
type: Question
has answer: http://stackoverflow.com/a/45350983
upvote count: 9
has answer: http://stackoverflow.com/a/21103369
has title: Freemarker compress single_line without spaces
has body: It seems that &lt;@compress single_line=true> is replacing line breaks with single spaces (" "), instead of just suppressing them. Example: &lt;@compress single_line=true&gt; "First cell" &lt;#if something &gt; |"Second cell" &lt;/#if&gt; |"Third cell" &lt;/@compress&gt; Is printing: "First cell" |"Second cell" |"Third cell" Which can't be parsed by a legacy system just because of the spaces between the pipes. Is there any way to avoid this?, perhaps a way to read every "nested" line in a macro to substitute the functionality of @compress? In the end, I don't want "structural source code", but presentation code, so assigning to variables to just print the result won't be nice. Thank you in advance, kind regards.
answer count: 3
downvote count: 0
favorite count: 0
tagged with: freemarker
possible better answer: http://stackoverflow.com/a/21104335
type: AnsweredQuestion

http://stackoverflow.com/comment/31742175
comment on: http://stackoverflow.com/q/21100069
score: 0
type: QuestionComment
type: Comment
has text: My guess is clarity, so when someone goes back to look at this code there is 0 confusion.

http://stackoverflow.com/q/21102592
has body: I can see that ReentrantLock is around 50% faster than synchronized and AtomicInteger 100% faster. Why such difference with the execution time of these three synchronization methods: synchronized blocks, ReentrantLock and AtomicInteger (or whatever class from the Atomic package). Are there any other popular and extended synchronizing methods aside than these ones?
accepted answer: http://stackoverflow.com/a/21102673
tagged with: java
answer count: 3
tagged with: concurrency
tagged with: mutex
possible better answer: http://stackoverflow.com/a/21102677
upvote count: 5
downvote count: 0
has answer: http://stackoverflow.com/a/21102677
has comment: http://stackoverflow.com/comment/31747619
has comment: http://stackoverflow.com/comment/31747663
has title: synchronized vs ReentrantLock vs AtomicInteger execution time
has answer: http://stackoverflow.com/a/21102673
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31749051
has comment: http://stackoverflow.com/comment/31747443
tagged with: synchronization
favorite count: 0
has answer: http://stackoverflow.com/a/21102748
type: Question
tagged with: multithreading
score: 5

http://stackoverflow.com/comment/31715972
type: Comment
comment on: http://stackoverflow.com/a/21059125
has text: @MiteshPathak Your comment is correct for the Date instance, but incorrect for the result of call to `.format(date)`. The java.text.SimpleDateFormat class uses the JVM's default time zone by default. The answer's author (hd1) must be in a -08:00 time zone. If UTC time is 15 hours, going back with an offset of 8 hours results in 7 hours as the time. See [my answer](http://stackoverflow.com/a/21059490/642706) for details.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31698590
type: Comment
comment on: http://stackoverflow.com/a/21069858
has text: @Xabster - I suppose the essence of the idea is to point out that you don't actually need to put **all** of the functionality into the classes - you can use *machinery* such as this for example. A well designed mixture of machinery and interface driven inherited functionality can often produce a much more intuitive API. Remember that you should design your objects depending on what they **are** not what they **do**.
type: AnswerComment
score: 0

http://stackoverflow.com/a/21372901
upvote count: 1
type: Answer
has body: The word "mod" is a reserved word, so don't use it as a name of the data "model" you want to mention in JEXL bean context.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21019784
score: 1
answers question: http://stackoverflow.com/q/21019784
type: AcceptedAnswer

http://stackoverflow.com/comment/31626306
comment on: http://stackoverflow.com/q/21030500
has text: Also, you example doesn't exactly demonstrate the problem at hand as the rectangle will painted beyond the visible range of the component
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31628812
score: 0
has text: hm ok but I have a problem. I have a ArrayList of own object. `ArrayList<Info> list = new ArrayList<Info>();` and then it says me an error that i cant create a generic array of `Info`. Can u help me?
type: AnswerComment
comment on: http://stackoverflow.com/a/21038427
type: Comment

http://stackoverflow.com/a/21082942
downvote count: 0
type: Answer
has body: I believe your problem is that JFrame can have only one component added to it (by default). You add a CustomPaintComponent, which paints your graphics. Then, you add the JPanel, which automatically removes the CustomPaintComponent Are you trying to paint the custom drawing on top of the JPanel? If that is the case, simply move that code over to the JPanel (but instead of using a CustomPaintComponent, put it in the paintComponent(Graphics g) method of the JPanel)
answers question: http://stackoverflow.com/q/21082817
score: 4
upvote count: 4

http://stackoverflow.com/comment/31858034
type: Comment
type: QuestionComment
has text: @Harsh ThreadA is already started check in the above snippet.I just want the sum from the above thread, it hangs if i run the code
comment on: http://stackoverflow.com/q/21163891
score: 0

http://stackoverflow.com/comment/31884967
has text: what is the return type of `getInfoCode()`
score: 0
comment on: http://stackoverflow.com/q/21178615
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21172739
has title: put background color on slot time of vaadin calendar
has body: I would like to put background colors on Vaadin calendar. This color should be different depending on the time: eg : daily between 8am and 12pm: green background, daily between 12h and 14h: blue background, ... I don't find a solution. Is it possible?
tagged with: colors
has comment: http://stackoverflow.com/comment/32998404
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/32998403
has comment: http://stackoverflow.com/comment/32998405
tagged with: java
tagged with: vaadin
tagged with: calendar
type: Question
has answer: http://stackoverflow.com/a/40105882
score: 0
answer count: 1

http://stackoverflow.com/comment/37369442
type: Comment
comment on: http://stackoverflow.com/a/21087859
score: 0
type: AnswerComment
has text: I'm trying to do the same thing but am failing even with the code above. Did you have the log4j2 web dependency in your project? My log4j2.xml is outside the classpath and I'm trying to load it up in a Spring bean that has a @PostConstruct method.

http://stackoverflow.com/comment/31614193
has text: ObReference: [What Every Computer Scientist Should Know About Floating-Point Arithmetic](http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html)
score: 16
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21030282

http://stackoverflow.com/a/21079274
has body: Here normally this kind of exception occurs when there is mismatch in the PATH of trusted certificate. Check the configuration or path where this server certificate is required for secured communication.
has comment: http://stackoverflow.com/comment/32040849
answers question: http://stackoverflow.com/q/21076179
type: Answer
has comment: http://stackoverflow.com/comment/55425669
score: -1
has comment: http://stackoverflow.com/comment/41857680
downvote count: 2
upvote count: 1

http://stackoverflow.com/q/21144133
score: 1
tagged with: java
tagged with: search
type: Question
tagged with: find
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21144610
tagged with: string
has comment: http://stackoverflow.com/comment/31822088
has body: I'm trying to make some sort of system that would detect java syntax and highlight that code. However, I seem to be having trouble finding a string within a string. This is what I have so far: import java.util.Scanner; public class Client { private static String[] javaKeywords = { "abstract", "assert", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "default", "do", "double", "else", "enum", "extends", "final", "finnaly", "float", "for", "goto", "if", "implements", "import", "instanceof", "int", "interface", "long", "native", "new", "package", "primitve", "private", "protected", "public", "return", "short", "static", "strictfp", "super", "switch", "synchronized", "this", "throw", "throws", "transient", "try", "void", "volatile", "while" }; private static String[] javaSyntax = { "++", "--", "~", "!", "*", "/", "%", "+", "-", " &lt;&lt;", "&gt;&gt;", "&gt;&gt;&gt;", "&lt;", "&gt;", "&lt;=", "&gt;=", "==", "!=", "&amp;", "^", "|", "&amp;&amp;", "||", "?", ":", "=", "+=", "-=", "/=", "%=", "&amp;=", "^=", "|=", "&lt;&lt;=", "&gt;&gt;=", "&gt;&gt;&gt;=" }; private static Scanner scanner = new Scanner(System.in); private static StringBuilder builder = new StringBuilder(); public static void main(String args[]) { String input; while(!(input = scanner.nextLine()).toLowerCase().contains("exit")) { switch(input.toLowerCase()) { case "print": System.out.println(builder.toString()); continue; case "clear": builder = new StringBuilder(); continue; } builder.append(input + "\n"); codeWrap(builder.toString()); } } private static void codeWrap(String code) { int A4I = 0, position; // A4I = Account for insert length for(String keyword: javaKeywords) { if((position = findInString(code, keyword)) != -1) { builder.insert(position + A4I, "[code]"); A4I += 6; builder.insert(position + keyword.length() + A4I, "[/code]"); A4I += 7; } } } private static int findInString(String string, String keyword) { for(int index = 0, keywordIndex = 0; index &lt; string…
has comment: http://stackoverflow.com/comment/31822422
favorite count: 0
has title: Java: Find string within string
accepted answer: http://stackoverflow.com/a/21144610
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/a/21128760
has body: I'd bet that with a server JVM and hot code, there's nothing you could do to speed it up (since the JVM does all the optimizations already). Especially, myArray.length gets cached in a local variable and the loop gets unrolled several times. In case you care about performance with a weaker JIT compiler, you could do the two above things manually, but why should you care? A side note Interestingly, there's a similar loop where the JVM is pretty loosy: for (int i = 0; i &lt; value.length; i++) { h = 31 * h + val[i]; } It's not an unimportant piece of code, it's the body of String.hashCode. By unrolling it manually you can get a speedup of factor 2+.
type: Answer
upvote count: 5
score: 5
answers question: http://stackoverflow.com/q/21128426
downvote count: 0
has comment: http://stackoverflow.com/comment/31798365

http://stackoverflow.com/a/21035534
type: Answer
upvote count: 5
has body: It will be easier when you use collections. Use this for simple implementation and better understanding for collections. Scanner scanner = new Scanner(System.in); List&lt;String&gt; list = new ArrayList&lt;String&gt;(); for (int i = 0; i &lt; 5; i++) { list.add(scanner.nextLine()); } For printing use this. for(String result : list){ System.out.println(result); }
downvote count: 0
score: 5
answers question: http://stackoverflow.com/q/21035079
has comment: http://stackoverflow.com/comment/31623612

http://stackoverflow.com/comment/31788949
type: QuestionComment
comment on: http://stackoverflow.com/q/21123972
has text: @RonBurk It runs very very slowly. I actually tried a different app that just reads a 400MB file and it is taking forever
score: 0
type: Comment

http://stackoverflow.com/q/21052682
has body: I want to make an element for a game that glows when mouse enters/exits and mouse click can be performed on it. I know abaut MoseAdapter and Listener, but when I implement MouseListener the element doesn't do anything. From what should I extend it from or implement it? I made it work using 2 for loops to check where was the mouse clicked - in a panel where all the elements ar positioned and painted - but that's a waste of memory/time. public class GElement { private int size=30; private int x=0; private int y=0; private int width=size; private int height=size; private int minesNear=0; private boolean visible=false; private boolean flagged=false; private boolean mined=false; public GElement() {} public GElement(int x, int y) { this.x=x; this.y=y; this.width=size; this.height=size; } public void paintIt(Graphics2D g2) { if(flagged) { g2.setColor(new Color(0,150,0)); } else if(!visible) { g2.setColor(new Color(0,0,250)); } else if(mined) { g2.setColor(new Color(150,0,0)); } else { g2.setColor(new Color(0,0,50)); } g2.fillRect(x,y,width,height); } } This element is drawed in a panel whit it's paintComponent. public GamePane(int r, int c, int m) { this.rows=r; this.cols=c; this.mines=m; // Mine field setter posX=offset; posY=offset; eArray=new GElement[rows][cols]; GElement e=new GElement(); for(int i=0;i&lt;rows;i++) { for(int j=0;j&lt;cols;j++) { e=new GElement(posX,posY); posX+=e.getWidth()+offset; eArray[i][j]=e; } width=posX-10; posX=offset; posY+=e.getWidth()+offset; } height=posY-10; // Standard properties this.bgColor=new Color(0,0,150); this.setOpaque(true); this.setPreferredSize(new Dimension(width,height)); } @Override public void paintComponent(Graphics g) { Graphics2D g2=(Graphics2D)g; // Background g2.setColor(bgColor); g2.fillRect(0, 0, width+10, height+10); // Rest // TODO for(int i=0;i&lt;rows;i++) { for(int j=0;j&lt;cols;j++) { eArray[i][j].paintIt(g2); } } } } The GamePane is set as the contentPane of the main frame. Thank you!
linked to: http://stackoverflow.com/q/14574045
tagged with: awt
score: 0
has comment: http://stackoverflow.com/comment/31654430
has title: How can I make an element that uses mouse adapter?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31658989
answer count: 0
tagged with: mouselistener
tagged with: java
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/31654547
has comment: http://stackoverflow.com/comment/31654304

http://stackoverflow.com/comment/31692470
type: QuestionComment
has text: my problem is the id and the layout , and sorry for tags @Tim B
comment on: http://stackoverflow.com/q/21073313
score: 0
type: Comment

http://stackoverflow.com/comment/31845406
score: 0
type: Comment
type: QuestionComment
has text: @kleopatra : Please see the SSCCE that i have posted.
comment on: http://stackoverflow.com/q/21111419

http://stackoverflow.com/comment/31885028
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21139174
has text: How are you triggering your testcase?
score: 0

http://stackoverflow.com/a/39172410
has comment: http://stackoverflow.com/comment/99742745
upvote count: 24
has comment: http://stackoverflow.com/comment/125467050
answers question: http://stackoverflow.com/q/21163108
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/99704777
score: 24
has comment: http://stackoverflow.com/comment/101242923
has comment: http://stackoverflow.com/comment/101278477
has body: The original solution (setting the ForkJoinPool common parallelism property) no longer works. Looking at the links in the original answer, an update which breaks this has been back ported to Java 8. As mentioned in the linked threads, this solution was not guaranteed to work forever. Based on that, the solution is the forkjoinpool.submit with .get solution discussed in the accepted answer. I think the backport fixes the unreliability of this solution also. ForkJoinPool fjpool = new ForkJoinPool(10); System.out.println("stream.parallel"); IntStream range = IntStream.range(0, 20); fjpool.submit(() -&gt; range.parallel() .forEach((int theInt) -&gt; { try { Thread.sleep(100); } catch (Exception ignore) {} System.out.println(Thread.currentThread().getName() + " -- " + theInt); })).get(); System.out.println("list.parallelStream"); int [] array = IntStream.range(0, 20).toArray(); List&lt;Integer&gt; list = new ArrayList&lt;&gt;(); for (int theInt: array) { list.add(theInt); } fjpool.submit(() -&gt; list.parallelStream() .forEach((theInt) -&gt; { try { Thread.sleep(100); } catch (Exception ignore) {} System.out.println(Thread.currentThread().getName() + " -- " + theInt); })).get();

http://stackoverflow.com/a/33308732
type: AcceptedAnswer
downvote count: 0
has body: I want to post my solution because A. it was extremely difficult to get this working, and B. If any crypto pro's want to audit my code I'd be eternally grateful. I included the 4 following libraries: compile 'com.madgag.spongycastle:core:1.50.0.0' compile 'com.madgag.spongycastle:pg:1.50.0.0' compile 'com.madgag.spongycastle:pkix:1.50.0.0' compile 'com.madgag.spongycastle:prov:1.50.0.0' Bouncy Castle needs to be added as a security provider. I included this code in a class that initializes some other objects when the app loads. static { Security.addProvider(new BouncyCastleProvider()); } Here's the utils class I created that really contains the nuts and bolts. Edited slightly: import com.example.Device; import org.spongycastle.bcpg.ArmoredInputStream; import org.spongycastle.bcpg.ArmoredOutputStream; import org.spongycastle.bcpg.HashAlgorithmTags; import org.spongycastle.bcpg.SymmetricKeyAlgorithmTags; import org.spongycastle.bcpg.sig.Features; import org.spongycastle.bcpg.sig.KeyFlags; import org.spongycastle.crypto.generators.RSAKeyPairGenerator; import org.spongycastle.crypto.params.RSAKeyGenerationParameters; import org.spongycastle.openpgp.PGPCompressedData; import org.spongycastle.openpgp.PGPCompressedDataGenerator; import org.spongycastle.openpgp.PGPEncryptedData; import org.spongycastle.openpgp.PGPEncryptedDataGenerator; import org.spongycastle.openpgp.PGPEncryptedDataList; import org.spongycastle.openpgp.PGPException; import org.spongycastle.openpgp.PGPKeyPair; import org.spongycastle.openpgp.PGPKeyRingGenerator; import org.spongycastle.openpgp.PGPLiteralData; import org.spongycastle.openpgp.PGPLiteralDataGenerator; import org.spongycastle.openpgp.PGPObjectFactory; import org.spongycastle.openpgp.PGPPrivateKey; import org.spongycastle.openpgp.PGPPublicKey; import org.spongycastle.openpgp.PGPPublicKeyEncryptedData; import org.spongycastle.openpgp.PGPPublicKeyRing; import org.spongycastle.openpgp.PGPSecretKey; import org.spongycastle.openpgp.PGPSecretKeyRing;…
type: Answer
score: 11
answers question: http://stackoverflow.com/q/21129202
upvote count: 11
accepted answer of: http://stackoverflow.com/q/21129202
has comment: http://stackoverflow.com/comment/79310020
has comment: http://stackoverflow.com/comment/85068452
has comment: http://stackoverflow.com/comment/79309982

http://stackoverflow.com/comment/31876861
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21173627
has text: plugin.xml? I dont understand.
type: Comment

http://stackoverflow.com/comment/32056488
has text: Probably because there is no simple way to disable it.
type: Comment
comment on: http://stackoverflow.com/a/21071634
score: 1
type: AnswerComment

http://stackoverflow.com/q/21073337
has answer: http://stackoverflow.com/a/21083355
tagged with: cordova
score: 0
has title: Cordova /Phonegap Native File Download Plugin with progressbar
upvote count: 1
answer count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/21083355
tagged with: java
type: AnsweredQuestion
tagged with: javascript
favorite count: 0
type: Question
tagged with: android
has body: Am making an android Phonegap app that Downloads mp3 files and stores it in the Music directory on the Device's Sd card. I stumbled on a native android cordova plugin that handles the Files download.It even has a progressbar. My problem is that.The Plugin after completing a File download always stores the File in the phone's internal storage and not in the Music directory on the Phone's Sd card. i'd be grateful if someone can modify the plugin to save downloaded files directly into the music directory. I posted the code in the Download.java file of the Plugin below. package com.cmpsoft.mobile.plugin.download; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import org.apache.cordova.CallbackContext; import org.apache.cordova.CordovaPlugin; import org.json.JSONArray; import org.json.JSONException; import android.annotation.SuppressLint; import android.app.AlertDialog; import android.app.Dialog; import android.app.AlertDialog.Builder; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.os.Environment; import android.os.Handler; import android.os.Message; import android.view.Gravity; import android.view.ViewGroup.LayoutParams; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; @SuppressLint({ "DefaultLocale", "HandlerLeak" }) public class DownLoad extends CordovaPlugin { / / The following layout parameters / / Identify the current situation of the control width and height FILL_PARENT = occupy all parent controls, WRAP_CONTENT = only the contents of the package control / / There are other effects such as left and right margins, where we use the default @SuppressWarnings("deprecation") private LinearLayout.Layout…

http://stackoverflow.com/comment/31658957
score: 1
type: AnswerComment
type: Comment
has text: pay attention with this since it allows dates like "2012-13-01", which in truth will be converted into "2013-01-01"
comment on: http://stackoverflow.com/a/21055132

http://stackoverflow.com/a/21178176
has comment: http://stackoverflow.com/comment/31884687
type: Answer
has comment: http://stackoverflow.com/comment/31884399
has comment: http://stackoverflow.com/comment/31884759
has body: Replace public static TextView text1; with TextView text1; text1 can not be static. Next time, please click on the file name in the error log and indicate which line number in your code listing is the line that the error actually points to. Learn to start all your class names with capital letters (athough, this is not what's causing the problem). And while I'm at it, please stop using numbers in class names and in variables, especially the number 1, which can be ambiguously read as an "l" in some fonts.
has comment: http://stackoverflow.com/comment/31884563
answers question: http://stackoverflow.com/q/21178143
score: 0
has comment: http://stackoverflow.com/comment/31884526

http://stackoverflow.com/q/21035438
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/21035456
has answer: http://stackoverflow.com/a/21035564
has comment: http://stackoverflow.com/comment/31623486
type: UnansweredQuestion
tagged with: decimal
has body: I've made a calculator that calculates measurements of a circle. I am currently using this command to ask the player to enter the radius of the circle: String br = JOptionPane.showInputDialog(null, "Enter The Radius" , "CircleHacker", JOptionPane.PLAIN_MESSAGE); int bravo = Integer.parseInt(br); It works for now but I had just realized that since it is integer based, it can't do decimals! Is there anything that I can do to modify what I have here to make it to where it can handle decimals? -thanks (I have only known java for 4 days now by the way so I am just a beginner) -thanks!
downvote count: 0
has title: How do I turn decimals into integers? (Java)
score: 1
tagged with: integer
favorite count: 0
has answer: http://stackoverflow.com/a/21035463
type: Question
tagged with: java

http://stackoverflow.com/comment/31802705
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21119250
type: Comment
has text: @user3005306 I'd use UTF-8. It can encode all Unicode, and also, if you ever need to work on the bytes with another program (like Python, C++, etc.) this encoding will be supported and well-known. Note that UTF-8 is a superset of ASCII, so no overhead here as long as you have (mostly) ASCII.

http://stackoverflow.com/a/21021721
score: 0
answers question: http://stackoverflow.com/q/21020755
type: Answer
has body: In a production ready application you wouldn't want your properties to be bundled in your app, but rather be outside of it, so you can change just them rather than having to rebuild the whole app, so I would advise you to make your application production-ready and not have the properties included in the first place.

http://stackoverflow.com/q/21127642
type: Question
has body: In an array list, if you add a string, then sort it, then want to delete everything before that string, what would you do?
score: -1
has comment: http://stackoverflow.com/comment/31792857
tagged with: arraylist
has answer: http://stackoverflow.com/a/21127683
has answer: http://stackoverflow.com/a/21127690
has title: How to remove all names from the array list before a certain string?
has answer: http://stackoverflow.com/a/21127742
favorite count: 0
answer count: 5
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/21128068
has answer: http://stackoverflow.com/a/21127703
tagged with: java
upvote count: 1
tagged with: collections

http://stackoverflow.com/a/21157594
type: Answer
answers question: http://stackoverflow.com/q/21156431
accepted answer of: http://stackoverflow.com/q/21156431
has body: I got the date to store into the database correctly after some tests. The date format that I used in the TO_TIMESTAMP call was 'DD-Mon-RRRR HH:MI:SS PM', full insert shown below: TO_TIMESTAMP(?,'DD-Mon-RRRR HH:MI:SS PM')
has comment: http://stackoverflow.com/comment/31846705
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/31772606
has text: I really need your help.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21104499

http://stackoverflow.com/comment/42975667
has text: Hy sparty, thanks for you Note, it's included in the solution now :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21885863
type: AnswerComment

http://stackoverflow.com/comment/31790607
type: QuestionComment
type: Comment
has text: Class name valid <=> code compiles with appropriate import
score: 1
comment on: http://stackoverflow.com/q/21126432

http://stackoverflow.com/q/21165746
has comment: http://stackoverflow.com/comment/31861480
has comment: http://stackoverflow.com/comment/31864700
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21166174
tagged with: java
tagged with: sharedpreferences
has body: I'm trying to use SharedPreferences in my app but it just doesn't seem to be working. First, I declare SharedPreferences as a global variable in the activity where I'm planning to use them: SharedPreferences prefs; Then I set the default SharedPreferences in onCreate: prefs = getSharedPreferences("urnikSp", 0); SharedPreferences.Editor editor = prefs.edit(); editor.putBoolean("schudeleDownloaded", false); editor.commit(); I then change the boolean value when a certain action is completed: prefs.edit().putBoolean("schudeleDownloaded", true).commit(); And then in the same activity (when it is restarted), I check for the boolean value in onCreate like this: boolean schudeleDownloaded = prefs.getBoolean("schudeleDownloaded", false); if (!schudeleDownloaded){ new PopulateDatabase().execute(); } And even though I clearly set the new value to "true" upon completing a certain action, the IF statement you see above still executes because the boolean value still seems to be false. What am I doing wrong?
possible better answer: http://stackoverflow.com/a/21166143
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31861587
type: Question
has answer: http://stackoverflow.com/a/21166174
has comment: http://stackoverflow.com/comment/31862154
has answer: http://stackoverflow.com/a/21166143
has comment: http://stackoverflow.com/comment/31861976
score: 0
answer count: 3
has title: SharedPerferences doesn't seem to be working
linked to: http://stackoverflow.com/q/17852576
has comment: http://stackoverflow.com/comment/31861825
has answer: http://stackoverflow.com/a/21165901
tagged with: android
has comment: http://stackoverflow.com/comment/31861834

http://stackoverflow.com/q/21168627
tagged with: comparison
linked to: http://stackoverflow.com/q/7375427
has title: Problems with String Input
linked to: http://stackoverflow.com/q/513832
linked to: http://stackoverflow.com/q/338206
has answer: http://stackoverflow.com/a/21168684
has comment: http://stackoverflow.com/comment/31866695
tagged with: string
linked to: http://stackoverflow.com/q/767372
favorite count: 0
linked to: http://stackoverflow.com/q/1643067
type: UnansweredQuestion
score: -4
has answer: http://stackoverflow.com/a/21168791
has body: So, for some reason I'm having problems just USING a string input. I don't know why. Maybe it's some incredibly stupid thing everyone knows, but I don't. Here's the non-functioning code: import javax.swing.*; public class Thing { public static void main(String[] args) { String input; JOptionPane.showMessageDialog(null,"Welcome to the test..."); input = JOptionPane.showInputDialog("Do you wish to take the tutorial?" + "\n" + "If affirmative, enter 'Yes'"); String i = input; if(i == "Yes") { tutorial(); } else if(input=="'Yes'") { JOptionPane.showMessageDialog(null,"Don't actually put apostraphes around you're answer."); tutorial(); } else { JOptionPane.showMessageDialog(null,"Remember, you can pull up the tutorial at any time with 'T'"); } } Yes, I actually do have a tutorial method somewhere else, and it works fine. The main problem is that if I enter 'Yes' or Yes, it still goes to the final else. I only put in the String i = input; and changed it from if(input == "Yes") { because it didn't work then, either. So what am I doing wrong?
tagged with: java
duplicate of: http://stackoverflow.com/q/513832
tagged with: eclipse
type: Question
answer count: 2
downvote count: 4
upvote count: 0

http://stackoverflow.com/q/21105377
type: AnsweredQuestion
upvote count: 0
favorite count: 0
score: -1
accepted answer: http://stackoverflow.com/a/21105392
type: Question
has comment: http://stackoverflow.com/comment/31752422
has comment: http://stackoverflow.com/comment/31752583
tagged with: java
has comment: http://stackoverflow.com/comment/31752423
has body: I had a lecture today where the professor reviewed basic Object-oriented concepts in Java. At one point, she said that "Exceptions are extremely important to your code, you need to handle all possible cases." I always thought that many try {...} catch(...) {...} ... sections of code were an indicator of bad code design. I know that various Java classes require try-catch sections, but I didn't think that catching all (or many) possible exceptions was a part of good design.
has comment: http://stackoverflow.com/comment/31752425
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31752457
has title: Java Exceptions - Important?
has answer: http://stackoverflow.com/a/21105392

http://stackoverflow.com/comment/113958771
type: Comment
type: QuestionComment
has text: For those who stumble upon this question, but use `librdkafka` for the communication with Kafka, see also: https://stackoverflow.com/questions/60739858/how-to-set-the-max-size-of-a-kafka-message-using-librdkafka
score: 0
comment on: http://stackoverflow.com/q/21020347

http://stackoverflow.com/comment/31770651
type: Comment
score: 0
type: AnswerComment
has text: Here is a gist on installing ElasticSearch - https://gist.github.com/wingdspur/2026107
comment on: http://stackoverflow.com/a/21113074

http://stackoverflow.com/q/21148760
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21149006
accepted answer: http://stackoverflow.com/a/21149006
possible better answer: http://stackoverflow.com/a/21149169
has title: Problems with a converter from seconds to day, hours, minutes, and seconds using Java
has comment: http://stackoverflow.com/comment/31831246
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21149169
has comment: http://stackoverflow.com/comment/31839528
type: Question
has body: I am doing this for a programming class and I keep getting these errors when I go to compile the program in jGrasp: TimeCalculator.java:94: error: variable dblMinutes might not have been initialized + timeFormat.format(dblMinutes) + " minutes, and " + timeFormat.format(dblSecondsAfterMinutes) + " seconds."); ^ TimeCalculator.java:94: error: variable dblSecondsAfterMinutes might not have been initialized + timeFormat.format(dblMinutes) + " minutes, and " + timeFormat.format(dblSecondsAfterMinutes) + " seconds."); ^ TimeCalculator.java:98: error: variable dblMinutes might not have been initialized JOptionPane.showMessageDialog(null, "There are " + timeFormat.format(dblHours) + " hours, " + timeFormat.format(dblMinutes) + " minutes, and " ^ TimeCalculator.java:99: error: variable dblSecondsAfterMinutes might not have been initialized + timeFormat.format(dblSecondsAfterMinutes) + " seconds."); ^ TimeCalculator.java:101: error: variable dblMinutes might not have been initialized else if (dblMinutes &gt;= 1) ^ TimeCalculator.java:102: error: variable dblSecondsAfterMinutes might not have been initialized JOptionPane.showMessageDialog(null, "There are " + timeFormat.format(dblMinutes) + " minutes and " + timeFormat.format(dblSecondsAfterMinutes) + " seconds."); ^ 6 errors My program is supposed to take user input (an amount in seconds) and convert it to days, hours, minutes, and seconds. It then should display the final amount. Here is my code so far: /* This program prompts the user to enter an amount of seconds. When the user enters an amount, it is stored in a variable and calculated to how many days, hours, minutes, and seconds there are in the given amount of seconds. The information is then output for the user to read. 60 seconds = 1 minute 3600 seconds = 1 hour 86400 seconds = 1 day */ import javax.swing.JOptionPane; import java.text.DecimalFormat; public class TimeCalculator { public static void main(String[] args) { DecimalFormat timeFormat = new DecimalFormat("#0…
has comment: http://stackoverflow.com/comment/31831357
has comment: http://stackoverflow.com/comment/31831257

http://stackoverflow.com/comment/31837618
type: QuestionComment
has text: what is the column type for column 'movie_dateBorrowed'? Make sure its date
score: 0
comment on: http://stackoverflow.com/q/21152232
type: Comment

http://stackoverflow.com/a/21105414
score: 0
type: Answer
has body: One idea is to extract the retrieval into another method (perhaps even "static"), like so // I don't recognize your library... public ClientResponse call(String hostname) throws Exception { if (hostname == null) { return null; } // You might also make generateURL static String url = generateURL(hostname); String response = restTemplate.getForObject(url, String.class); if (response == null) { // add more logic here to test your response. return null; } return new ClientResponse(response, ClientError.NONE, ClientStatus.SUCCESS); } Then you can pass in your url(s) one by one, until you get a good response. Like this, // String hostname1 = hostname1; // String hostname2 = hostname2; // String hostname3 = hostname3; // String hostname4 = hostname4; if(remoteFlag &amp;&amp; secondaryFlag) { ClientResponse response = call(hostname1); // != null is one test. However you test the response is valid. if (response != null) return response; response = call(hostname2); if (response != null) return response; response = call(hostname3); if (response != null) return response; return call(hostname4); }
has comment: http://stackoverflow.com/comment/31753581
has comment: http://stackoverflow.com/comment/31753407
has comment: http://stackoverflow.com/comment/31753625
answers question: http://stackoverflow.com/q/21105347

http://stackoverflow.com/comment/31788452
score: 0
has text: Hmmm...that didn't work either.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21124313

http://stackoverflow.com/a/34821813
upvote count: 1
score: 1
downvote count: 0
type: Answer
has body: This can also happen when your class is missing its @Entity annotation. When you get weird warnings like these, sometimes it helps to try and compile and see if the compiler complains.
answers question: http://stackoverflow.com/q/21059451

http://stackoverflow.com/comment/31788827
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21125304
has text: This is know problem with turkish letters, look here: http://www.w3.org/International/wiki/Case_folding, 'Turkish i/I etc.'

http://stackoverflow.com/q/21175810
type: Question
has answer: http://stackoverflow.com/a/21175888
has comment: http://stackoverflow.com/comment/31888817
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/21175871
answer count: 2
has body: I'm working on reversing the string word by word and making sure that all the spaces, tabs and white spaces character etc. are not changed or removed. I have tried few solution using Java, but ending up with no good result. For example , to convert following string The rule about++[] the input stream. And get output like this without removing any white space character. ehT elur tuoba++[] eht tupni maerts. My code String reverseString(String str) { StringBuilder temp = new StringBuilder(); StringBuilder result = new StringBuilder(); for (char ch : str.toCharArray()) { if (Character.isAlphabetic(ch)) { temp.append(ch); } else { result.append(temp.reverse()).append(ch); temp.delete(0, temp.length()); } } result.append(temp); return result.toString(); } I getting same result with one issue that word about++[], should be ][++tuoba0 where as it is showing like this tuoba++[]. Any way to resolve this issue?
downvote count: 0
tagged with: string
accepted answer: http://stackoverflow.com/a/21175888
favorite count: 0
has title: Reverse the string without changing white spaces in java
tagged with: regex
type: AnsweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/21175871

http://stackoverflow.com/a/21083749
type: Answer
answers question: http://stackoverflow.com/q/21072118
has body: Based on Hovercraft Full of Eels's answer, this is how I altered the initial code using the Java Swing Timer Animation: public class RotateLine extends JPanel **implements ActionListener**{ private static final int PREF_W = 800; private static final int PREF_H = 800; private static final int X1 = 100; private static final int Y1 = 100; private static ArrayList&lt;Point&gt; pointsList; private static Point p; private int counter = 0; private int index = 0; **Timer time = new Timer(10, (ActionListener) this);** public RotateLine () { pointsList = new ArrayList&lt;Point&gt;(); p = new Point(X1, Y1); int X2 = 400; int Y2 = Y1; for (int count = 0; count &lt; 300; count++) { pointsList.add(new Point(X2, Y2)); X2 = X2 - 1; Y2 = Y2 + 2; } **time.start();** } @Override public Dimension getPreferredSize() { return new Dimension(PREF_W, PREF_H); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D)g; drawRotatingLine(g2d); } public static void main(String[] args) { JFrame frame = new JFrame("clock"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new RotateLine()); frame.pack(); frame.setVisible(true); } public void drawRotatingLine(Graphics2D g) { g.drawLine(p.x, p.y, pointsList.get(index).x, pointsList.get(index).y); } **public void actionPerformed(ActionEvent arg0) { if (index &lt; pointsList.size() - 1){ time.setDelay(20); repaint(); index++; } }**
score: 0

http://stackoverflow.com/a/53263055
score: 0
answers question: http://stackoverflow.com/q/21105403
type: Answer
has body: Use JMockit framework. It worked for me. You don't have to write statements for mocking DBConenction.getConnection() method. Just the below code is enough. @Mock below is mockit.Mock package Connection jdbcConnection = Mockito.mock(Connection.class); MockUp&lt;DBConnection&gt; mockUp = new MockUp&lt;DBConnection&gt;() { DBConnection singleton = new DBConnection(); @Mock public DBConnection getInstance() { return singleton; } @Mock public Connection getConnection() { return jdbcConnection; } };

http://stackoverflow.com/a/21051275
score: 10
answers question: http://stackoverflow.com/q/21050538
upvote count: 10
type: Answer
downvote count: 0
has body: you can call each java.exe directly. You can create 2 batch file named java6.bat and java7.bat : java6.bat @echo off "C:\Program Files\Java\jre6\bin\java.exe" %* java7.bat @echo off "C:\Program Files\Java\jre7\bin\java.exe" %* to call a program with jre6 java6 -jar helloworld.jar and to call a program with jre7 java7 -jar helloworld.jar

http://stackoverflow.com/comment/31888351
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21179573
has text: thanks for reply i tried second one its work but can u tell whether it accept html tag here is sample what i tried document.add(new Paragraph(" hiiii "));. But it print the as it.
type: AnswerComment

http://stackoverflow.com/comment/31665425
comment on: http://stackoverflow.com/q/21058477
has text: @Marc B, can you show where it is explained in the link you provided?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31829095
comment on: http://stackoverflow.com/a/21147530
type: AnswerComment
has text: Yeah since its hard to find an answer on this, my approach may be wrong. I basically have a class that manipulates ArrayLists and needs add new instances of the objects already inside, but the list may have different class types inside of it.
score: 0
type: Comment

http://stackoverflow.com/q/21166633
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31863414
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/105034
has comment: http://stackoverflow.com/comment/31863408
type: Question
has body: In my use case, a javascript tracker generate a unique ID for a visitor whenever he/she visits the site, using the following formula: function generateUUID(){ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = Math.random()*16|0, v = c == 'x' ? r : (r&amp;0x3|0x8); return v.toString(16); }); } It generates strings like this (rfc4122): "3314891e-285e-40a7-ac59-8b232863bead" Now I need to encode that string in a Number (e.g. BigInteger in Java) that can be read by Mahout. And likewise, restore it (in PHP) to display results. Is there any fast, consistent and reliable way to do that? Some solutions are: Mapping each possible char (alphanumeric + '-') to a number [1..M] and summing each char position accordingly get 2 longs from md5 hash keep a hash map in memory Any ideas appreciated!
tagged with: encoding
has comment: http://stackoverflow.com/comment/31862916
has answer: http://stackoverflow.com/a/21170964
has comment: http://stackoverflow.com/comment/31863515
has comment: http://stackoverflow.com/comment/31862946
has title: Encode String (rfc4122) to Number in Java, decode in PHP
answer count: 1
tagged with: perfect-hash
accepted answer: http://stackoverflow.com/a/21170964
tagged with: mahout
has comment: http://stackoverflow.com/comment/31865202
tagged with: php

http://stackoverflow.com/q/21053724
has comment: http://stackoverflow.com/comment/31656462
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2624410
downvote count: 1
has comment: http://stackoverflow.com/comment/31656235
duplicate of: http://stackoverflow.com/q/2624410
tagged with: java
has comment: http://stackoverflow.com/comment/31656460
has comment: http://stackoverflow.com/comment/31656567
score: -1
has comment: http://stackoverflow.com/comment/31656182
has comment: http://stackoverflow.com/comment/31656195
type: Question
has body: I am trying to understand below statement came across code in my project if(name != null &amp;&amp; +ssnCount.getLongValue &gt; 0){ ...... } Can some one explain me +ssCount.getLongValue mean? and difference. Thanks for you time.
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/31656472
has comment: http://stackoverflow.com/comment/31656422
has answer: http://stackoverflow.com/a/21055469
has answer: http://stackoverflow.com/a/21055258
favorite count: 0
has comment: http://stackoverflow.com/comment/31656363
has comment: http://stackoverflow.com/comment/31656295
has comment: http://stackoverflow.com/comment/31656343
has comment: http://stackoverflow.com/comment/31656172
has comment: http://stackoverflow.com/comment/31656202
has title: increment of longvalue before conditional operator
has comment: http://stackoverflow.com/comment/31656388

event-dispatch-thread
tags question: http://stackoverflow.com/q/21066320
tags question: http://stackoverflow.com/q/21113768
tag name: event-dispatch-thread
tags question: http://stackoverflow.com/q/21150928
tags question: http://stackoverflow.com/q/21065624
tags question: http://stackoverflow.com/q/21099603
tags question: http://stackoverflow.com/q/21147240
type: Tag

cxf
tags question: http://stackoverflow.com/q/21135671
tags question: http://stackoverflow.com/q/21167456
tags question: http://stackoverflow.com/q/21117215
type: Tag
tags question: http://stackoverflow.com/q/21140767
tags question: http://stackoverflow.com/q/21018787
tags question: http://stackoverflow.com/q/21167527
tags question: http://stackoverflow.com/q/21134867
tags question: http://stackoverflow.com/q/21120264
tags question: http://stackoverflow.com/q/21035379
tags question: http://stackoverflow.com/q/21165733
tags question: http://stackoverflow.com/q/21167564
tag name: cxf
tags question: http://stackoverflow.com/q/21043646
tags question: http://stackoverflow.com/q/21079103

http://stackoverflow.com/a/21162759
score: 0
answers question: http://stackoverflow.com/q/21162505
has comment: http://stackoverflow.com/comment/31859457
type: Answer
has body: This is an misunderstanding about the layout which is to be passed to SimpleAdapter. In your call to the constructor (Context context, List> data, int resource, String[] from, int[] to) you need to pass the layout for a list item, not of the layout containing the ListView itself. As the items are displayed in the ListView and dynamically added, the SimpleAdapter expects this layout to be known (and passed). If you compare it to a table, e.g.: The layout you are using defines the layout for the table, the layout for the list items defines on how one row in that table should look like.
has comment: http://stackoverflow.com/comment/31856545
has comment: http://stackoverflow.com/comment/31857139
has comment: http://stackoverflow.com/comment/31855817
has comment: http://stackoverflow.com/comment/31857411
has comment: http://stackoverflow.com/comment/31858968

http://stackoverflow.com/comment/31623697
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21035586
has text: I don't know, what is the string at the beginning?
score: 0

http://stackoverflow.com/comment/31794131
has text: Thank you @JB Nizet, you help me find out the answer.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21113568

http://stackoverflow.com/q/21125385
type: Question
tagged with: java
upvote count: 6
linked to: http://stackoverflow.com/q/3493495
has comment: http://stackoverflow.com/comment/31792488
tagged with: eclipselink
tagged with: sql
answer count: 1
tagged with: jpa
has answer: http://stackoverflow.com/a/38775475
favorite count: 0
has body: I'm wondering if there's a db agnostic way to check if a certain table exists in JPA (specifically, eclipse link). Right now the way we do it is with a native query like this: select count(*) from table_name where 1=2 If this throws an exception, we know the table doesn't exist. And, as far as I know, this will work on most SQL databases. The thing I don't is it's a hacky query and it throws a SQL exception when the table doesn't exist. I'd prefer to be able to do a query that returns a true/false instead of a no error/error. But the only way I know how to do that is to query data dictionaries, and that won't be database agnostic. In JPA, is there a DB agnostic way to check if a table exists?
has title: In JPA, is there a DB agnostic way to check if a table exists?
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/31791566
has comment: http://stackoverflow.com/comment/31793234
score: 6

http://stackoverflow.com/comment/31664057
comment on: http://stackoverflow.com/a/21057319
has text: @HassaanHafeez Test it out with a default value. If it is not a number then the line would throw a Number Format Expection.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31867870
type: AnswerComment
type: Comment
has text: So, what is the stacktrace?
comment on: http://stackoverflow.com/a/21168737
score: 0

http://stackoverflow.com/q/21047448
score: 0
has comment: http://stackoverflow.com/comment/31644598
answer count: 1
tagged with: applet
has title: Programmatically update image in Applet, which was received from servlet
type: UnansweredQuestion
tagged with: jakarta-ee
tagged with: java
has answer: http://stackoverflow.com/a/21051376
tagged with: desktop
has comment: http://stackoverflow.com/comment/31649960
tagged with: servlets
type: Question
has body: I want a desktop(mac preferable) side Java program, which should be able to receive images from a servlet and show image. Basically, I have a mobile client application, which sends an image periodically to a servlet which runs on Eclipse with Tomcat server on Mac. So, This servlet receives an updated image from the client periodically. This is done already. Now, I want to push this image from this servlet project to a desktop Java applet or some desktop based Java application, where it will be updating with the image it receives periodically. Both the server and desktop applet can run on the same machine for testing. Could someone please advise, How can I push the image received in the server side servlet project to the desktop java applet program? How would I program it, what is the easy way to develop desktop(mac preferable) based java applet which can receive images and show? I want to develop in java language only for viewing this image received.

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

http://stackoverflow.com/q/21124475
has comment: http://stackoverflow.com/comment/31787582
tagged with: encryption
linked to: http://stackoverflow.com/q/4385623
has comment: http://stackoverflow.com/comment/31789105
type: Question
type: AnsweredQuestion
has body: I'm using the following example: http://compscipleslab.wordpress.com/category/java/ But I'm getting an exception and when I log the exceptions it it appears in my logcat stating: InvalidKeyException I'm not sure exactly what I've done wrong. I haven't really modified the methods from the tutorial (perhaps this is the problem) so I'm not sure exactly why I'm getting this error. Source: public class FileChooser extends ListActivity { private File currentDir; private File moveToDir; private FileArrayAdapter adapter; public static String TAG = "DEBUG THIS:"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); currentDir = new File("/sdcard/"); fill(currentDir); registerForContextMenu(getListView()); // get the attachment's filename SharedPreferences preferences = PreferenceManager .getDefaultSharedPreferences(this); String attachmentFileName = preferences.getString("fileName", ""); // save the attachment try { InputStream attachment = getContentResolver().openInputStream( getIntent().getData()); File savedFile = new File(Environment.getExternalStorageDirectory() .getAbsolutePath(), attachmentFileName); FileOutputStream f = new FileOutputStream(savedFile); byte[] buffer = new byte[1024]; int len1 = 0; while ((len1 = attachment.read(buffer)) &gt; 0) { f.write(buffer); } f.close(); } catch (Exception e) { } } // File Manager Source to view SD Card or Internal Storage Contents private void fill(File f) { File[] dirs = f.listFiles(); this.setTitle("Current Dir: " + f.getName()); List&lt;Item&gt; dir = new ArrayList&lt;Item&gt;(); List&lt;Item&gt; fls = new ArrayList&lt;Item&gt;(); try { for (File ff : dirs) { Date lastModDate = new Date(ff.lastModified()); DateFormat formater = DateFormat.getDateTimeInstance(); String date_modify = formater.format(lastModDate); if (ff.isDirectory()) { File[] fbuf = ff.listFiles(); int buf = 0; if (fbuf != null) { buf = fbuf.length; } else buf = 0; String num_item = String.valueOf(buf); if (buf == 0…
tagged with: java
has comment: http://stackoverflow.com/comment/31787638
possible better answer: http://stackoverflow.com/a/21126349
has comment: http://stackoverflow.com/comment/31789407
has answer: http://stackoverflow.com/a/21126349
answer count: 2
has answer: http://stackoverflow.com/a/21124833
accepted answer: http://stackoverflow.com/a/21124833
linked to: http://stackoverflow.com/q/992019
score: 0
linked to: http://stackoverflow.com/q/4147451
has title: InvalidKeyException Encrypting-Decrypting a file - Java / Android
tagged with: exception
tagged with: aes

http://stackoverflow.com/comment/31796641
type: Comment
type: QuestionComment
has text: I have created a static int variable stroke in PadDraw() class and then in the action of Bursh 1 and Bursh 2 i have changed its value and at the bottom i have added it to nBsize, now it is working
comment on: http://stackoverflow.com/q/21128671
score: 0

http://stackoverflow.com/q/21048773
has comment: http://stackoverflow.com/comment/31646758
type: Question
has title: Can you recast an enum?
answer count: 2
has comment: http://stackoverflow.com/comment/31649188
score: 0
has answer: http://stackoverflow.com/a/21048857
has answer: http://stackoverflow.com/a/21049142
possible better answer: http://stackoverflow.com/a/21049142
has comment: http://stackoverflow.com/comment/31646764
accepted answer: http://stackoverflow.com/a/21048857
type: AnsweredQuestion
tagged with: enums
has body: I have created an interface Columns which is extended by a number of enums of the pattern ColumnsReportname. One of the methods defined in the interface is getHeaderText(). I have also created a method createHeader(Columns[]) which ideally creates a header row based on ColumnsReportname.values(). Except it doesn't work because createHeader(Columns[]) won't accept ColumnsReportname parameters. So I can just create a List of header names and pass those in, but do I need to or is there an easier way? method: public void setHeader(Columns[] columns) { List&lt;Object&gt; headers = new Vector&lt;Object&gt;(); for (Columns c : columns) { headers.add(c.getHeaderText()); } headerRow = new Row(headers, true); } enum: public enum ColumnsObligations implements Columns { CLAIMNO(15, "Claim #", false), ACTIONDATE(10, "Action Dt.", false), DATEPAID(10, "Dt. Paid", false), ACTION(15, "Action"), CLAIMANT( 15, "Claimant"), FY(6, "FY", false), FUNDCITE(15, "Fund Cite"), AMTPAID(15, "Amt Paid", true), CHECKNO(15, "Ins. Dpt."), VOUCHERNO( 15, "Voucher No."); private ColumnsObligations(int colWidth, String headerText, boolean totaled) { this.colWidth = colWidth; this.headerText = headerText; this.totaled = totaled; } private ColumnsObligations(int colWidth, String headerText) { this.colWidth = colWidth; this.headerText = headerText; this.totaled = false; } private final int colWidth; private final String headerText; private final boolean totaled; public int getColWidth() { return colWidth; } public String getHeaderText() { return headerText; } public boolean isTotaled() { return this.totaled; } Thank you. Edit: Solution public &lt;T extends Columns&gt; void setHeader(T... columns) { List&lt;Object&gt; headers = new Vector&lt;Object&gt;(); for (Columns c : columns) { headers.add(c.getHeaderText()); } headerRow = new Row(headers, true); }
tagged with: java

http://stackoverflow.com/q/21086113
type: Question
tagged with: jar
downvote count: 0
favorite count: 0
tagged with: class
tagged with: dependencies
has comment: http://stackoverflow.com/comment/31716143
answer count: 0
type: UnansweredQuestion
upvote count: 1
has title: How to load classes from jar files which some of the classes in a one jar depends on the classes in the other jar file
has body: Let's say that there are two jar files where one jar file contains java interfaces that are used by the classes in the other jar file. If, I load all the classes inside both the jar files into the class loader does the class dependencies are solved at the run-time? Or, else is it possible to do this task with out using any other third party libraries.
score: 1
tagged with: java

http://stackoverflow.com/comment/31654547
type: QuestionComment
comment on: http://stackoverflow.com/q/21052682
has text: Oh, but see also [Collision detection with complex shapes](http://stackoverflow.com/a/14575043/418556). It is only a short step from collision detection to determining if a point is within a `Shape`..
score: 0
type: Comment

http://stackoverflow.com/comment/32131272
comment on: http://stackoverflow.com/q/21141691
score: 0
type: QuestionComment
type: Comment
has text: Was the answer helpful?

http://stackoverflow.com/comment/31846175
score: 1
has text: Write to a `ByteArrayOutputStream`, grab the byte array from that when writing is complete, then pass that to a `ByteArrayInputStream` ?
comment on: http://stackoverflow.com/q/21156461
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31883657
type: Comment
type: QuestionComment
has text: When I un comment the Sysout in the ThreadA, it normally runs fine.Two threads (Main and ThreadA) ,ThreadA starts first it tries to notify and nobody is waiting on object and hangs indefinitely I guess
comment on: http://stackoverflow.com/q/21163891
score: 0

http://stackoverflow.com/q/21179117
has answer: http://stackoverflow.com/a/21323765
has comment: http://stackoverflow.com/comment/31921449
has comment: http://stackoverflow.com/comment/31886202
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32009192
tagged with: java
tagged with: scrollpane
has body: I understand from this post Don't Set sizes on a JComponent that you dont set preferred sizes on any component and instead let the layout manager do this for you. My question is, I have a JPanel that I put into a JTabbedPane into a JFrame like this JFrame frame=new JFrame(); JTabbedPane pane=new JTabbedPane(); pane.addTab("Tab 1",new JScrollPane(getJPanel1())); pane.addTab("Tab 2",new JScrollPane(getJPanel2())); frame.setContentPane(pane); Now in this case the JTabbedPane will take the size of the maximum sized component you add to it. Because of this my JScrollPane does not show up at all. I need to set the preferred size of the JScrollPane, if I dont set it, the scroll bars will not appear and content is getting cut. How do I use a layout manager to solve this. I want to specifically do this: Make the JFrame/JTabbedPane/JPanelInTab extend upto the height of the screen (taking into the taskbar of windows), if the tab content is going to get cut the scrollbars should appear. The width of the frame should fit exactly as much as the JTabbedPane. EDIT Here's an MVCE that shows what I am trying to do. I have included the changes as per the suggestion by peeskillet but there is no effect import javax.swing.*; import java.awt.*; public class ScrollPaneTest { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JFrame frame=new JFrame(); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); JTabbedPane tabbedPane=new JTabbedPane(); tabbedPane.addTab("Tab 1", wrapWithBorderLayoutPanel(getPanel())); tabbedPane.addTab("Tab 2", wrapWithBorderLayoutPanel(getPanel())); // // tabbedPane.addTab("Tab 1", new JScrollPane(getPanel())); // tabbedPane.addTab("Tab 2", new JScrollPane(getPanel())); frame.setContentPane(tabbedPane); frame.pack(); frame.setVisible(true); } private JPanel wrapWithBorderLayoutPanel(JPanel panel) { JPanel borderLayoutPanel=new JPanel(new BorderLayout()); borderLayoutPanel.add(new JScrol…
linked to: http://stackoverflow.com/q/21247623
has title: Sizing a JScrollPane in a JTabbedPane in a JFrame
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/7229226
has answer: http://stackoverflow.com/a/21181702
accepted answer: http://stackoverflow.com/a/21323765
tagged with: layout-manager
has comment: http://stackoverflow.com/comment/31885781
has comment: http://stackoverflow.com/comment/31887629
score: 0
possible better answer: http://stackoverflow.com/a/21181702
answer count: 2
tagged with: preferredsize
favorite count: 0
has comment: http://stackoverflow.com/comment/31925468
has comment: http://stackoverflow.com/comment/31885932
upvote count: 1
tagged with: swing

http://stackoverflow.com/comment/31770090
score: 1
has text: Can you provide the value of `iK` ?
comment on: http://stackoverflow.com/q/21115659
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31697372
type: Comment
comment on: http://stackoverflow.com/q/21075374
score: 0
type: QuestionComment
has text: Instead of `final JTextField firstField = new JTextField(); firstField.setPreferredSize( new Dimension( 495, 24 ) );` try something like `final JTextField firstField = new JTextField(25);`..

http://stackoverflow.com/comment/31858629
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21164361
score: 0
has text: You don't have to pass a String Date, you can use Date property to show date.

http://stackoverflow.com/a/21063550
type: Answer
has body: The order of execution of initializer blocks, and variable initializer is specified in JLS &sect; 12.5: Just before a reference to the newly created object is returned as the result, the indicated constructor is processed to initialize the new object using the following procedure: [...] 4 Execute the instance initializers and instance variable initializers for this class, assigning the values of instance variable initializers to the corresponding instance variables, in the left-to-right order in which they appear textually in the source code for the class. [..] So, the initializer blocks and variable initializers executed in order in which they appear in the source file. If you move the variable declaration, int x = 1;, before the initializer block, you'll get the result 2. Technically, your Test class is compiled to the this: class TestClass { int x; public TestClass() { super(); x = 2; x = 1; } } For actual bytecode you can run javap -c command.
score: 5
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/21063391

javascript
tags question: http://stackoverflow.com/q/21157733
tags question: http://stackoverflow.com/q/21069648
tags question: http://stackoverflow.com/q/21114989
tags question: http://stackoverflow.com/q/21115471
tags question: http://stackoverflow.com/q/21182733
tags question: http://stackoverflow.com/q/21179475
tags question: http://stackoverflow.com/q/21037194
tags question: http://stackoverflow.com/q/21045627
tags question: http://stackoverflow.com/q/21066182
tags question: http://stackoverflow.com/q/21073337
tags question: http://stackoverflow.com/q/21049557
tags question: http://stackoverflow.com/q/21132657
tags question: http://stackoverflow.com/q/21022459
tag name: javascript
tags question: http://stackoverflow.com/q/21097371
tags question: http://stackoverflow.com/q/21051128
tags question: http://stackoverflow.com/q/21154543
tags question: http://stackoverflow.com/q/21062689
tags question: http://stackoverflow.com/q/21114629
tags question: http://stackoverflow.com/q/21157828
tags question: http://stackoverflow.com/q/21039098
tags question: http://stackoverflow.com/q/21024214
tags question: http://stackoverflow.com/q/21021206
tags question: http://stackoverflow.com/q/21153671
tags question: http://stackoverflow.com/q/21053864
tags question: http://stackoverflow.com/q/21026704
tags question: http://stackoverflow.com/q/21098432
tags question: http://stackoverflow.com/q/21163667
tags question: http://stackoverflow.com/q/21065047
type: Tag
tags question: http://stackoverflow.com/q/21141495
tags question: http://stackoverflow.com/q/21158441
tags question: http://stackoverflow.com/q/21089991
tags question: http://stackoverflow.com/q/21059301
tags question: http://stackoverflow.com/q/21121294
tags question: http://stackoverflow.com/q/21048962
tags question: http://stackoverflow.com/q/21093212
tags question: http://stackoverflow.com/q/21026538
tags question: http://stackoverflow.com/q/21102792
tags question: http://stackoverflow.com/q/21061283
tags question: http://stackoverflow.com/q/21153000
tags question: http://stackoverflow.com/q/21158224
tags question: http://stackoverflow.com/q/21127862
tags question: http://stackoverflow.com/q/21049839
tags question: http://stackoverflow.com/q/21034674
tags question: http://stackoverflow.com/q/21153234
tags question: http://stackoverflow.com/q/21135142
tags question: http://stackoverflow.com/q/21140773
tags question: http://stackoverflow.com/q/21123539
tags question: http://stackoverflow.com/q/21101330
tags question: http://stackoverflow.com/q/21141145
tags question: http://stackoverflow.com/q/21038791
tags question: http://stackoverflow.com/q/21162453
tags question: http://stackoverflow.com/q/21109868
tags question: http://stackoverflow.com/q/21067338
tags question: http://stackoverflow.com/q/21042124
tags question: http://stackoverflow.com/q/21137200
tags question: http://stackoverflow.com/q/21029995
tags question: http://stackoverflow.com/q/21084777
tags question: http://stackoverflow.com/q/21170343
tags question: http://stackoverflow.com/q/21183372
tags question: http://stackoverflow.com/q/21028954
tags question: http://stackoverflow.com/q/21152110
tags question: http://stackoverflow.com/q/21160697
tags question: http://stackoverflow.com/q/21062014
tags question: http://stackoverflow.com/q/21108926
tags question: http://stackoverflow.com/q/21137373
tags question: http://stackoverflow.com/q/21178980
tags question: http://stackoverflow.com/q/21048081
tags question: http://stackoverflow.com/q/21118444

http://stackoverflow.com/a/21096376
has body: Here is some code that can accomplish that: KeyEvent key = new KeyEvent(instance, KeyEvent.KEY_PRESSED, System.currentTimeMillis(), 0, KeyEvent.VK_UP,'Z'); instance.getKeyListeners()[0].keyPressed(key);
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21075354
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/50971451
upvote count: 3
answers question: http://stackoverflow.com/q/21075354

http://stackoverflow.com/a/21259089
answers question: http://stackoverflow.com/q/21080162
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32081892
upvote count: 1
has body: waits should always occur in loops. (Refer to javadoc of Object.wait() for more details). Maintain a flag to mark the completion of the task and use it in the condition to guard sendAction.wait() while(!sendAction.finished) { sendAction.wait(TIMEOUT_MS); } set "sendAction.finished" to true before calling the notifyAll()... AND DO THIS IN FINALLY.

http://stackoverflow.com/comment/31829873
comment on: http://stackoverflow.com/a/21147965
type: Comment
has text: But it's not available in IntelliJ IDEA :)
type: AnswerComment
score: 1

http://stackoverflow.com/comment/31746013
type: QuestionComment
comment on: http://stackoverflow.com/q/21080162
has text: @JohnTangBoyland Correct, I placed a try-catch-block around my main loop and it has never caught an exception even when the final lines of the test are being skipped.
score: 0
type: Comment

http://stackoverflow.com/a/21019976
upvote count: 2
type: Answer
has body: I guess there is no file in your request. getFileNames will never return null: if there is no file, it's an iterator on an empty collection. To know if there is a file, you can call itr.hasNext().
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21019833
answers question: http://stackoverflow.com/q/21019833

http://stackoverflow.com/q/21132487
has comment: http://stackoverflow.com/comment/31804352
type: Question
answer count: 2
tagged with: spring
has answer: http://stackoverflow.com/a/21170470
has comment: http://stackoverflow.com/comment/31805807
tagged with: spring-mvc
score: 0
has answer: http://stackoverflow.com/a/21173854
tagged with: java
accepted answer: http://stackoverflow.com/a/21170470
has comment: http://stackoverflow.com/comment/31804520
has comment: http://stackoverflow.com/comment/31876637
possible better answer: http://stackoverflow.com/a/21173854
has title: Spring MVC Service Junit Test Case
type: AnsweredQuestion
tagged with: junit
has comment: http://stackoverflow.com/comment/31805243
has body: I am having a Java Spring MVC application. Here is my Service class. import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.integration.Message; import org.springframework.integration.MessagingException; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.core.MessageHandler; import org.springframework.stereotype.Service; @Service public class EmailService implements MessageHandler { @Autowired @Qualifier("receiveChannel") private DirectChannel messageChannel; private final Log logger = LogFactory .getLog(EmailService.class); public void init() { messageChannel.subscribe(this); } @Override public void handleMessage(Message&lt;?&gt; message) throws MessagingException { logger.info("Message: " + message); } } I want to write a Test Case for the above class. This is what I have tried import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.web.context.WebApplicationContext; //other imports @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration("classpath:webapptest") @ContextConfiguration(locations = {"classpath:test-applicationcontext.xml"}) public class EmailServiceTest { @Autowired private EmailService emailService; @Autowired WebApplicationContext wContext; @Test public void testEmailService() throws Exception { emailService=Mockito.spy(new EmailService()); Mockito.doNothing().when(emailService).init(); } } In my applicationcontext.xml, I am specifying one Gmail and its password (Its IMAP Access is enabled) What it should…

http://stackoverflow.com/comment/31780629
comment on: http://stackoverflow.com/q/21121256
type: Comment
type: QuestionComment
score: 2
has text: _but every object is simply Object._ No...where did you read that?

http://stackoverflow.com/q/21062587
downvote count: 1
type: Question
has body: I am trying to compile and run the below code from command prompt. But when compiling I am getting error. I am new to programming and I am new to java. How to resolve this error? I am unable to find what is going wrong. Below is the complete code: package myprograms; class Employee { private String empID; private String empName; private int empPhoneNumber; public String getEmpID() { return empID; } public String getEmpName() { return empName; } public int getEmpPhoneNumber() { return empPhoneNumber; } public void setEmpID(String empID) { this.empID = empID; } public void setEmpName(String empName) { this.empName = empName; } public void setEmpPhoneNumber(String empPhoneNumber) { try { this.empPhoneNumber = Integer.parseInt(empPhoneNumber); } catch (NumberFormatException nfe) { throw new NumberFormatException("Invalid Phone number"); } } public String toString() { return empID + " : " + empName + " : " + empPhoneNumber; } } public class EmployeeData { public static void main(String[] args) { Employee e1 = new Employee(); e1.setEmpID("e123"); e1.setEmpName("Tom"); try { e1.setEmpPhoneNumber("ertr"); } catch (NumberFormatException nfe) { System.out.println(nfe.getMessage()); } finally { System.out.println(e1.toString()); return; } if (e1.getEmpID().equals("e123")) { System.out.println("Welcome " + e1.getEmpName()); } } }
has title: Compiler error when trying to run the below program
has answer: http://stackoverflow.com/a/21062595
has comment: http://stackoverflow.com/comment/31672644
score: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21062595
type: AnsweredQuestion
tagged with: compiler-errors
tagged with: java
upvote count: 1

http://stackoverflow.com/a/21131127
answers question: http://stackoverflow.com/q/21131005
accepted answer of: http://stackoverflow.com/q/21131005
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
has body: I'm guessing you're getting a ConcurrentModificationException because you're calling the list remove method while iterating it. You can't do that. An easy fix is to work on a copy of the array when iterating: for (Action action : new ArrayList&lt;&gt;(this.actionStack)) { action.step(this); } A slightly more efficient fix is to use an explicit Iterator and call its remove method. Perhaps have step() return a boolean indicating whether it wants to remain in the list for the next step or not: for (Iterator&lt;Action&gt; it = this.actionStack.iterator(); it.hasNext();) { Action action = it.next(); if (!action.step(this)) { it.remove(); } }
type: Answer

http://stackoverflow.com/comment/31846571
comment on: http://stackoverflow.com/a/21157405
type: AnswerComment
has text: What happens if you say `super.super.F()` in C?
score: 0
type: Comment

http://stackoverflow.com/comment/31900962
type: Comment
comment on: http://stackoverflow.com/q/21181986
score: 1
has text: Which phone? Are you sure it is not just a bug. Check in Options --> About to see what software level the BB thinks is installed.
type: QuestionComment

http://stackoverflow.com/a/21031540
has comment: http://stackoverflow.com/comment/31671015
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31636694
score: 1
has comment: http://stackoverflow.com/comment/31671173
accepted answer of: http://stackoverflow.com/q/21028719
has body: Each ViewPart (and editor part) has a separate selection maintained by the selection service and set by your selection providers. The enabledWhen and visibleWhen use the selection for the currently active part obtained from the selection service for the part. The property test calls are usually inside a &lt;with&gt; block in the enablement expression which establishes the object that is being tested. Something like: &lt;with variable="org.eclipse.ui.selection"&gt; &lt;iterate operator="or"&gt; &lt;adapt type="music.resources.data.IMusicFile"&gt; &lt;or&gt; &lt;test property="music.isMusicOrPlaylist"/&gt; &lt;test property="music.isVideo"/&gt; &lt;/or&gt; &lt;/adapt&gt; &lt;/iterate&gt; &lt;/with&gt; which is working with the current selection, requiring the selection to adapt to a particular type, and testing either of two properties.
answers question: http://stackoverflow.com/q/21028719
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31636479

http://stackoverflow.com/comment/31839944
has text: @[Brian Roach](http://stackoverflow.com/users/302916/brian-roach): You mean something like TextField KIWITextField; instead of TextField KIWITextField = null; - None works. Or what did you mean please.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21153352
type: QuestionComment

http://stackoverflow.com/comment/62163181
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21052384
has text: You are completely and utterly wrong about Java Web Start. Users never use it directly. The user clicks a link, and the app is installed locally, with automatic updating enabled by default. No user knowledge of Web Start is required.
score: 0

http://stackoverflow.com/q/21025393
possible better answer: http://stackoverflow.com/a/21025510
type: Question
has answer: http://stackoverflow.com/a/21025510
has title: Equivalent Data Types in Java
has body: I am developing an Android application and it is dealing with BigML big data server. I need to parse the data in the following formats. int16 int8 What are the equivalent data types in Java/Android for the above mentioned types?
tagged with: type-conversion
has comment: http://stackoverflow.com/comment/31604884
score: 0
answer count: 3
tagged with: android
accepted answer: http://stackoverflow.com/a/21025544
favorite count: 0
has comment: http://stackoverflow.com/comment/31605201
tagged with: bigdata
upvote count: 1
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21025503
tagged with: java
tagged with: database
has answer: http://stackoverflow.com/a/21025544

http://stackoverflow.com/comment/31679887
score: 1
has text: Please try to describe your exact problem. Does your code compile? Does it run? Does it produce a result? Is this result different from what you expected?
comment on: http://stackoverflow.com/q/21066369
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31665525
type: Comment
type: QuestionComment
has text: @MichaelPetrotta hey it was not for you it was for Op Sorry
comment on: http://stackoverflow.com/q/21058477
score: 0

http://stackoverflow.com/comment/31718234
type: Comment
score: 0
has text: JNCrypt would come to mind. You could also use a well known format like Cryptographic Message Syntax (CMS) but that takes a bit more getting used to.
type: QuestionComment
comment on: http://stackoverflow.com/q/21073254

http://stackoverflow.com/a/21032155
has comment: http://stackoverflow.com/comment/31652262
upvote count: 3
has comment: http://stackoverflow.com/comment/31645816
accepted answer of: http://stackoverflow.com/q/21031326
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31646772
has comment: http://stackoverflow.com/comment/31649484
type: Answer
has comment: http://stackoverflow.com/comment/31646156
score: 3
downvote count: 0
has body: Given above declaration, and assuming that code hasn't changed, the jar task should only be out-of-date if version has changed. (Running with --info will tell you which file(s) have changed.) Best solution is to prevent that, at least at development time. (E.g. don't set version to new Date().) Also note that out-of-date does not cascade. Downstream tasks will only rerun if their inputs or outputs have changed. They don't care if upstream tasks were up-to-date or not.
has comment: http://stackoverflow.com/comment/31651392
has comment: http://stackoverflow.com/comment/31651616
answers question: http://stackoverflow.com/q/21031326

http://stackoverflow.com/q/21075905
tagged with: boolean
has title: Annotate a Map in Hibernate
has answer: http://stackoverflow.com/a/21086775
answer count: 1
has body: How to annotate a Map where keys are entity classes, and values normal java Objects (Boolean in my case) in an entity class? I have two @Entity classes: Voter and Poll. In the Poll class, I want to keep a Map&lt; Voter,Boolean > of the Voters that can vote on this Poll. Boolean marks whether a Voter has voted or not. So the Mapping is Many-to-many in polls to voters. I have classes: @Enity public class Voter { ...some attributes and their getters and setters private List&lt;Poll&gt; polls; private int voterId; @Id public int getVoterId() { return voterId; } @ManyToMany(mappedBy="voters") public List&lt;Poll&gt; getPolls() { return polls; } ..and setter. } @Enity public class Poll { ...some attributes and their getters and setters private Map&lt;Voter,Boolean&gt; voters; @ManyToMany @JoinColumn(referencedColumnName="voterId") public Map&lt;Voter,Boolean&gt; getVoters() { return voters; } ..and setter. } This fails when run and causes AnnotationException. I have seen annotation @MapKeyJoinColumn used, and tried with it as well (instaed of @JoinColumn), and failed. I haven't found an example like this (key of map an entity, value of map just an object) anywhere yet, so I basically used the try-fail way. So the question is: what annotations should I put where?
score: 0
tagged with: dictionary
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/31700945
type: Question

http://stackoverflow.com/q/21128209
tagged with: java
tagged with: class
type: Question
has body: I'm trying to make a Weather applet for school but I'm having a problem calling a class to a main class. In the end I will want 3 permanent components (Location, Temperature, Precipitation) then in image box I want to do an if statement that pics the appropriate image from the data in components. Layout idea Main Class code // The "Weather" class. import java.applet.*; import javax.swing.*; import java.awt.*; public class Weather extends Applet { //TempBar Intergers //int x= //int y= //int H= //H = Heat //PercipBar Intergers //int x2= //int y2= //int P = //P = pericipitation public void init () { GridLayout umm = new GridLayout(0,2); PercipBar percip = new PercipBar(); getContentPane.addItem (percip()); } public void paint (Graphics g) { } } PercipBar Code import java.awt.*; import java.applet.*; public class PercipBar extends Applet { int x2 =2; int y2 =2; int P =80;//P = percipitation will be declared in main file public void paint (Graphics g) { g.setColor (Color.black); g.drawRect (x2, y2, 100, 20);//outline of bar g.setColor (Color.blue); g.fillRect (x2+1, y2+4, P, 14 ); //indicator bar (+4 puts space beetween outline bar) } }
answer count: 1
downvote count: 0
tagged with: layout-manager
tagged with: applet
tagged with: awt
favorite count: 0
type: UnansweredQuestion
has title: Calling a class into grid
upvote count: 1
linked to: http://stackoverflow.com/q/6255106
has answer: http://stackoverflow.com/a/21153064
has comment: http://stackoverflow.com/comment/31839298
score: 1

http://stackoverflow.com/a/21136995
answers question: http://stackoverflow.com/q/21124361
upvote count: 50
downvote count: 0
has body: The error can be caused by several things. I'm not taking the credit for it, found it here. Flushing the data before committing the object may lead to clear all object pending for persist. If object has primary key which is auto generated and you are forcing an assigned key if you are cleaning the object before committing the object to database. Zero or Incorrect ID: If you set the ID to zero or something else, Hibernate will try to update instead of insert. Object is Stale: Hibernate caches objects from the session. If the object was modified, and Hibernate doesn’t know about it, it will throw this exception — note the StaleStateException Also look at this answer by beny23 which gives a few further hints to find the problem. In your hibernate configuration, set hibernate.show_sql to true. This should show you the SQL that is executed and causes the problem. Set the log levels for Spring and Hibernate to DEBUG, again this will give you a better idea as to which line causes the problem. Create a unit test which replicates the problem without configuring a transaction manager in Spring. This should give you a better idea of the offending line of code.
score: 50
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/39633952
type: Answer
accepted answer of: http://stackoverflow.com/q/21124361

http://stackoverflow.com/q/21078891
has body: I looked up many threads on how to use delta time and I can't figure it out. I want my guy to move at a constant speed every time I run the game. So I have: timer = new Timer(9, this); timer.start(); then the paint method. I tried doing start time at the beginning of the paint method and then a current time at the end of it. How would I make it affect the timer's speed or how far the player moves. I've tried multiplying the time delta by the increment to the x. nHeroX = dx*deltaTIme; I feel like it's very simple I just need someone to tell me straight what to do please.
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/21078917
linked to: http://stackoverflow.com/q/18283199
has title: Using Delta Time to Improve Movement
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/21078917
accepted answer: http://stackoverflow.com/a/21079419
tagged with: timedelta
tagged with: timer
has answer: http://stackoverflow.com/a/21079419
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31702645

applet
tags question: http://stackoverflow.com/q/21133337
tags question: http://stackoverflow.com/q/21161493
tags question: http://stackoverflow.com/q/21022799
tags question: http://stackoverflow.com/q/21041151
tags question: http://stackoverflow.com/q/21071543
tags question: http://stackoverflow.com/q/21109467
tags question: http://stackoverflow.com/q/21026793
tags question: http://stackoverflow.com/q/21124016
tags question: http://stackoverflow.com/q/21139384
tags question: http://stackoverflow.com/q/21154262
tags question: http://stackoverflow.com/q/21064753
tags question: http://stackoverflow.com/q/21035572
tags question: http://stackoverflow.com/q/21108180
tags question: http://stackoverflow.com/q/21164627
tags question: http://stackoverflow.com/q/21098420
tags question: http://stackoverflow.com/q/21034835
tags question: http://stackoverflow.com/q/21110138
type: Tag
tag name: applet
tags question: http://stackoverflow.com/q/21167449
tags question: http://stackoverflow.com/q/21024996
tags question: http://stackoverflow.com/q/21066333
tags question: http://stackoverflow.com/q/21145293
tags question: http://stackoverflow.com/q/21047448
tags question: http://stackoverflow.com/q/21071739
tags question: http://stackoverflow.com/q/21141970
tags question: http://stackoverflow.com/q/21128209
tags question: http://stackoverflow.com/q/21018812
tags question: http://stackoverflow.com/q/21055921
tags question: http://stackoverflow.com/q/21153707
tags question: http://stackoverflow.com/q/21046139
tags question: http://stackoverflow.com/q/21163419
tags question: http://stackoverflow.com/q/21107894
tags question: http://stackoverflow.com/q/21171099
tags question: http://stackoverflow.com/q/21098754
tags question: http://stackoverflow.com/q/21078785
tags question: http://stackoverflow.com/q/21082363
tags question: http://stackoverflow.com/q/21127164
tags question: http://stackoverflow.com/q/21131520

http://stackoverflow.com/q/21050346
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21055461
tagged with: android
type: AnsweredQuestion
upvote count: 3
tagged with: gson
has title: Parsing json with nested arrays with Gson
type: Question
score: 3
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/21055461
has body: I am new to Gson parsing and did few basic Gson parsing. But this time my JSON is much complex. My JSON looks like : {"uname":"man101", "uid":"2", "account":{ "entry":[8,15.48], "exit":[8,15.48], "details": [[0,0],[0,8.2],[1.15,8.2],[1.15,18.23],[7.33,18.23],[7.33,15.48],[12.15,2.28], [12.35,2.28],[12.35,0],[10.65,0],[10.65,1.42],[8.1,1.42],[8.1,3.95], [4.25,3.95],[4.25,0]], "section": [ { "account":[[0,0],[0,3.35], [4.25,3.35],[4.25,0]], "category":"office", "description":"Mobile based company", "sectionname":"xyz", "id":1 }, { "account":[[0,3.95],[0,7.8], [4.25,7.8],4.25,3.95]], "category":"office", "description":"Network based company", "sectionname":"ABC", "id":2 }, ] }, "category":"Cowork", "description":"Combined office space" } And I tried to parse this in following way public class AccountData { public String uname; public String uid; public String category; public String description; public Account account; public class Account { public float[] entry; public float[] exit; public List&lt;float[]&gt; details; public List&lt;Section&gt; section; } public class Section { public List&lt;float[]&gt; account; public String category; public String description; public String sectionname; public String id; } } And try to pass result like this Gson gson = new Gson(); beaconList = gson.fromJson(result, AccountData.class); It's run without any error but when I tried to access some data it gives null values.

http://stackoverflow.com/q/21107404
has answer: http://stackoverflow.com/a/21107507
type: Question
has comment: http://stackoverflow.com/comment/31758960
tagged with: unmarshalling
has title: How would you unmarshall the following with JAXB
linked to: http://stackoverflow.com/q/13026825
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/21107507
score: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has body: How would one unmarshall the following XML response with JAXB into a domain class: <?xml version="1.0" encoding="UTF-8"?> 2014-01-14T06:24:34+00:00 My first instinct was to use something like (short version): @XmlRootElement public class Time { @XmlElement public Date time; } but I think JAXB then sees 2 elements with the Time name. I also tried without using the @XmlRootElement annotation, but to no avail.
tagged with: java
tagged with: jaxb
upvote count: 1

http://stackoverflow.com/q/21132761
linked to: http://stackoverflow.com/q/8985497
has comment: http://stackoverflow.com/comment/31808190
answer count: 0
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/31805327
has body: I am trying to show JasperReports report from web application which content some marathi (indian regional language) text. When I run preview in iReport it looks perfect but when I try it from web application to view report as in pdf format then text not shown. Here is what I try to do. ServletContext context = getServletContext(); InputStream is = context.getResourceAsStream("report/name.jasper"); Map param = new HashMap(); param.put("para", "1"); byte[] bytes = JasperRunManager.runReportToPdf(is, param, con); response.setContentType("application/pdf"); response.setContentLength(bytes.length); ServletOutputStream outStream = response.getOutputStream(); outStream.write(bytes, 0, bytes.length); outStream.flush(); outStream.close(); I also suggested that to add jasperreports.properties are as follows net.sf.jasperreports.default.pdf.encoding=Cp1250 but when I use this property text shows like "?????" This is the preview from iReport: This is the preview when I shown report as pdf from my web application: This is preview when I use net.sf.jasperreports.default.pdf.encoding=Cp1250
has comment: http://stackoverflow.com/comment/31847006
tagged with: hindi
type: Question
tagged with: jasper-reports
has comment: http://stackoverflow.com/comment/31803128
has title: When Report Shown As Pdf from web application Hindi (Indian lang) text not displayed
has comment: http://stackoverflow.com/comment/31839516
has comment: http://stackoverflow.com/comment/31808836
has comment: http://stackoverflow.com/comment/31808049
type: UnansweredQuestion
tagged with: pdf-generation

http://stackoverflow.com/a/21174205
answers question: http://stackoverflow.com/q/21174044
upvote count: 4
has body: Your heredoc looks good except it will send the spaces at the start of each line. To get rid of those, you can either use -EOF and start each line of the heredoc with Tab characters, which will get stripped: cd $i/lab0 java AddThree &lt;&lt;-EOF TabTab2 TabTab3 TabTab4 TabTabEOF cd ../../.. Or unindent the heredoc contents. It's ugly, but it'll work. cd $i/lab0 java AddThree &lt;&lt;EOF 2 3 4 EOF cd ../../.. Alternatively, if the input is short enough you could do it inline: java AddThree &lt;&lt;&lt; $'2\n3\n4' (Using $'...' tells the shell to interpret \n escape sequences.)
accepted answer of: http://stackoverflow.com/q/21174044
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/31877300
type: Answer
has comment: http://stackoverflow.com/comment/31877344
has comment: http://stackoverflow.com/comment/31877348

http://stackoverflow.com/a/45350983
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21102122
upvote count: 1
has body: The following solution works also fine: &lt;#assign var&gt; "First cell" &lt;#if something &gt; |"Second cell" &lt;/#if&gt; |"Third cell" &lt;/#assign&gt; ${var?replace("^\\s+|\\s+$|\\n|\\r", "", "rm")}
type: Answer

http://stackoverflow.com/comment/31775901
type: QuestionComment
has text: Take a look at SQL JOINs
comment on: http://stackoverflow.com/q/21117991
score: 0
type: Comment

http://stackoverflow.com/comment/32857018
comment on: http://stackoverflow.com/a/21088720
type: Comment
type: AnswerComment
has text: @user2452520 What is v3 and what is v2?
score: 0

http://stackoverflow.com/a/73688839
answers question: http://stackoverflow.com/q/21083170
downvote count: 0
score: 1
has body: Aside from adding the port on application.properties, you can also easily achieve multiple ports for different environments, by combining the property files approach with Spring profiles. Specifically, we can create a property file for each environment. For example, we'll have an application-dev.properties file with this content: server.port=8081 Then you can add another application-qa.properties file with a different port: server.port=8082
upvote count: 1
type: Answer

http://stackoverflow.com/comment/31611851
type: Comment
has text: thx, yes indeed to encode a utf-8 and to code it back to utf-8 doesn t make sense at all.
comment on: http://stackoverflow.com/a/21028153
type: AnswerComment
score: 0

http://stackoverflow.com/a/21181432
answers question: http://stackoverflow.com/q/21181366
type: Answer
has body: If your ID is unique (no two objects has the same ID), just define properly the equals() method of your to-be-stored objects and use HashSet instead.
has comment: http://stackoverflow.com/comment/31889920
score: 0
has comment: http://stackoverflow.com/comment/31889635

http://stackoverflow.com/comment/31607434
comment on: http://stackoverflow.com/q/21025712
score: 1
has text: Swing components can't be used from any other thread that the event dispatch thread. Wrap the code of the main method inside a SwingUtilities.invokeLater() call, and everything will go fine. http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21025113
upvote count: 2
downvote count: 2
has body: Just found this answer . I am copying textually the answer of the user Pr0gr4mm3r java.net.Inet6Address does not override getByName() so it will always return the specific IPv4-Address, unless your parameter itself is in the form of an valid IPv6-Address, in this case this method will return an Inet6Address-Object. For example: getByName("stackoverflow.com") --> Inet4Address getByName("2001:0db8:85a3:08d3:1319:8a2e:0370:7344") --> Inet6Address
has comment: http://stackoverflow.com/comment/32563821
score: 0
has comment: http://stackoverflow.com/comment/32571915
type: Answer
has comment: http://stackoverflow.com/comment/32563653
answers question: http://stackoverflow.com/q/21024820

http://stackoverflow.com/comment/31622820
has text: How can it? You're waiting until the process ends before trying to read it's input stream, which is probably closed by now. Take a look at [this example](https://stackoverflow.com/questions/15218892/running-a-java-program-from-another-java-program/15220419#15220419)
comment on: http://stackoverflow.com/q/21035043
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/31733321
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21091228
has text: Can you please provide also how do you test that?
score: 0

http://stackoverflow.com/a/21077680
answers question: http://stackoverflow.com/q/21077502
type: Answer
has body: This: Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: empty String Suggests you have an empty String that is attempted to being converted into some sort of Number (double, int, etc.). Over here: double number1 = Double.parseDouble(textField.getText()); Is the issue. I would recommending only converting after doing some basic checks on this: textField.getText() For example: double number1; String temp = textField.getText(); if("".equals(temp)){ number1 = 0.0;//some default value } else{ number1 = Double.parseDouble(textField.getText()); } I would recommend doing other checks too for any characters that aren't digits. I would recommend looking at this regex solution
score: 0

http://stackoverflow.com/comment/66318512
type: AnswerComment
comment on: http://stackoverflow.com/a/21142687
has text: I know this is some old code you may not have looked at in a while, but I was wondering why you made chessPieceImages an array of Image objects instead of ImageIcon objects. Is it because you want to create a new ImageIcon for each piece or something like that?
score: 0
type: Comment

http://stackoverflow.com/comment/31659704
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21055280
score: 1
has text: As I said in question commands I found the mistake in my engine.

http://stackoverflow.com/a/21128507
score: 2
accepted answer of: http://stackoverflow.com/q/21128440
has body: " because i am trying to select file using JFileChoosear " The JFileChooser will return a File object if APPROVE_OPTION is the return value. You can use chooser.getSelectedFile() then pass it to the Scanner JFileChooser chooser = new JFileChooser(); File file = null; int returnVal = chooser.showOpenDialog(null); if(returnVal == JFileChooser.APPROVE_OPTION) { file = chooser.getSelectedFile(); } try { Scanner scanner = new Scanner(file); // read file } catch (Exception ex) { ex.printStackTrace(); } Run this import java.io.File; import java.util.Scanner; import javax.swing.JFileChooser; public class TestFileChooser { public static void main(String[] args) { JFileChooser chooser = new JFileChooser(); File file = null; int returnVal = chooser.showOpenDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { file = chooser.getSelectedFile(); } try { Scanner scanner = new Scanner(file); while (scanner.hasNextLine()) { System.out.println(scanner.nextLine()); } } catch (Exception ex) { ex.printStackTrace(); } } }
answers question: http://stackoverflow.com/q/21128440
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31796225
has comment: http://stackoverflow.com/comment/31796515
has comment: http://stackoverflow.com/comment/31796497
upvote count: 2
type: Answer

http://stackoverflow.com/comment/31677001
has text: Thank you very much. I was certain it was me not understanding it at the most basic level and that was proven to be correct.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21065031
type: Comment

http://stackoverflow.com/q/21052299
type: Question
tagged with: android
answer count: 1
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21052515
tagged with: broadcastreceiver
accepted answer: http://stackoverflow.com/a/21052515
tagged with: eclipse
type: AnsweredQuestion
has body: I'm working on an android application. I'm using BroadcastReciever to get the on know where a download is finished. DownloadManager.Request request = new DownloadManager.Request(Uri.parse(urlString)); request.setDescription(artistString); request.setTitle(titleString); // in order for this if to run, you must use the android 3.2 to compile your app if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB) { request.allowScanningByMediaScanner(); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); } request.setDestinationInExternalPublicDir(Environment.DIRECTORY_MUSIC + "/Tunesto", titleString + " - " + artistString + ".mp3"); Toast.makeText(mainContext, "Downloading " + titleString + " - " + artistString, Toast.LENGTH_SHORT).show(); // get download service and enqueue file DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE); manager.enqueue(request); Then I use this in my onCreate method to show a toast when the download ended: onComplete = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub String info = ""; info = info + " - " + intent.getStringExtra(DownloadManager.COLUMN_DESCRIPTION); info = info + " - " + intent.getStringExtra(DownloadManager.COLUMN_TITLE); info = info + " - " + intent.getStringExtra(DownloadManager.COLUMN_ID); info = info + " - " + intent.getStringExtra(DownloadManager.COLUMN_LOCAL_FILENAME); info = info + " - " + intent.getStringExtra(DownloadManager.COLUMN_MEDIA_TYPE); info = info + " - " + intent.getStringExtra(DownloadManager.COLUMN_TOTAL_SIZE_BYTES); info = info + " - " + intent.getDataString(); info = info + " - " + intent.getType(); info = info + " - " + intent.EXTRA_TITLE; info = info + " - " + intent.EXTRA_TEXT; //Toast.makeText(mainContext, Integer.valueOf(dlCount) + " Download \"" + titleString + " - " + artistString + "\" completed", Toast.LENGTH_LONG).show(); Toast.makeText(…
tagged with: android-download-manager
has title: Android - Get title and description from BroadcastReceiver

http://stackoverflow.com/comment/31759850
has text: You must have something more in your view that is issuing your code. The example you provided works form me with that version.
type: QuestionComment
comment on: http://stackoverflow.com/q/21101775
type: Comment
score: 0

http://stackoverflow.com/comment/31742160
type: Comment
type: QuestionComment
has text: @patterned: No, it just shows that it's whitespace. You want to see the Unicode character number. Your debugger screenshot doesn't really show the return value of `test.charAt(0)` at all as far as I can see.
score: 1
comment on: http://stackoverflow.com/q/21099829

http://stackoverflow.com/a/21154485
has comment: http://stackoverflow.com/comment/31847866
has comment: http://stackoverflow.com/comment/31842424
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/31843202
has comment: http://stackoverflow.com/comment/31849791
answers question: http://stackoverflow.com/q/21154262
score: -1
has comment: http://stackoverflow.com/comment/31847164
downvote count: 1
has comment: http://stackoverflow.com/comment/31841974
has body: 1. open your .java file that contains the main(). 2. Right click -&gt; Select "Run As"-&gt; "Run Configuration". 3. In the resulting Screen, under "Java Application" see if there exist ur already executed entry.If not Right click on "Java Application" to create one. 4. Select that entry 5. Select "Arguments" tab. 6. Under "VM Argumets" area, type `-Xmx1g` 7. click Apply followed by Run button. Try the above steps and see whether you are getting the same error or not.
has comment: http://stackoverflow.com/comment/31887360

http://stackoverflow.com/comment/31675885
type: QuestionComment
has text: *"Protecting Java code of a game"* Don't distribute it. Either that, or make it so broken nobody would want to steal it.
score: 6
comment on: http://stackoverflow.com/q/21064329
type: Comment

http://stackoverflow.com/a/21032226
type: Answer
score: 0
has body: It might be simpler to put labels at each spot in the grid, and then just change the icons associated with each label as your creatures move. See Add and remove an icon on a JLabel
answers question: http://stackoverflow.com/q/21032140
has comment: http://stackoverflow.com/comment/31618756
has comment: http://stackoverflow.com/comment/31618292

http://stackoverflow.com/a/46935683
score: 3
downvote count: 0
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/21093129
has body: I got this problem, took help from following link solution which basically says to 1. delete the corresponding maven download folder 2. maven>update project in eclipse In my case I deleted hibernate folder, since i was getting error related to hibernate-validator.jar

http://stackoverflow.com/q/21139071
favorite count: 0
has body: How know that subject is well documented and I have read a lot on that issue, but I still have the following problem: when I take a picture with my app and click on "validate" button, nothing occur. The aime of what I am doing: passing to onActivityReult function not only the thumbnail, but the "whole" picture taken by the camera. Here is the listener as defined for the "take a picture" button: @Override public void onClick(View v) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "CameraTest"); mediaStorageDir.mkdir(); // make sure you got this folder Log.i("Report",mediaStorageDir.toString()); String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); File mediaFile = new File(mediaStorageDir.getPath() + File.separator + "IMG_"+ timeStamp + ".jpg"); try { //create directories and the file mediaFile.getParentFile().mkdirs(); mediaFile.createNewFile(); } catch (IOException e) { Log.e("Report", "create error for file "+mediaFile); e.printStackTrace(); } mFileUri = Uri.fromFile(mediaFile); Log.i("Report","Uri: "+mFileUri); intent.putExtra(MediaStore.EXTRA_OUTPUT, mFileUri);// this line causes issue - onActivityResult not called... startActivityForResult(intent, CAMERA_PIC_REQUEST); } }); and here is the onActivityResult method... that is never called (and that is not declared in the onClickListener method): @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d("Report", "1"); if (resultCode == Activity.RESULT_OK) { if (requestCode == CAMERA_PIC_REQUEST) { try { String[] projection = { MediaStore.Images.Thumbnails._ID, // The columns we want MediaStore.Images.Thumbnails.IMAGE_ID, MediaStore.Images.Thumbnails.KIND, MediaStore.Images.Thumbnails.DATA }; String selection = MediaStore.Images.Thumbnails.KIND + "=" + MediaStore.Images.Thumbnails.MINI_KIND; String sort = MediaStore.Images.Thumb…
type: Question
tagged with: android
answer count: 3
has title: onActivityResult not called after taking picture
has answer: http://stackoverflow.com/a/21139533
has comment: http://stackoverflow.com/comment/31812967
has comment: http://stackoverflow.com/comment/31813159
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/31814387
has comment: http://stackoverflow.com/comment/31813228
tagged with: android-camera
has comment: http://stackoverflow.com/comment/31812876
downvote count: 0
has answer: http://stackoverflow.com/a/21139339
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31813241
has comment: http://stackoverflow.com/comment/31813352
score: 3
has comment: http://stackoverflow.com/comment/31813017
has answer: http://stackoverflow.com/a/21157599
linked to: http://stackoverflow.com/q/14783758

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/21183372
tags question: http://stackoverflow.com/q/21046164
tags question: http://stackoverflow.com/q/21137373
tags question: http://stackoverflow.com/q/21034961
tags question: http://stackoverflow.com/q/21157322
tags question: http://stackoverflow.com/q/21101186
tags question: http://stackoverflow.com/q/21065522
tags question: http://stackoverflow.com/q/21114629
tags question: http://stackoverflow.com/q/21146454
tags question: http://stackoverflow.com/q/21039098
tags question: http://stackoverflow.com/q/21182733
tags question: http://stackoverflow.com/q/21053864
tags question: http://stackoverflow.com/q/21034835
tags question: http://stackoverflow.com/q/21138297
tags question: http://stackoverflow.com/q/21024371
type: Tag
tags question: http://stackoverflow.com/q/21179492
tags question: http://stackoverflow.com/q/21141495
tags question: http://stackoverflow.com/q/21065727
tags question: http://stackoverflow.com/q/21073081
tags question: http://stackoverflow.com/q/21088340
tags question: http://stackoverflow.com/q/21172302
tags question: http://stackoverflow.com/q/21054392
tags question: http://stackoverflow.com/q/21155120
tags question: http://stackoverflow.com/q/21176288
tags question: http://stackoverflow.com/q/21131748
tags question: http://stackoverflow.com/q/21166879
tags question: http://stackoverflow.com/q/21123806
tags question: http://stackoverflow.com/q/21049839
tags question: http://stackoverflow.com/q/21021261
tags question: http://stackoverflow.com/q/21112946
tags question: http://stackoverflow.com/q/21169560
tags question: http://stackoverflow.com/q/21141685
tags question: http://stackoverflow.com/q/21108301
tags question: http://stackoverflow.com/q/21172441
tags question: http://stackoverflow.com/q/21139128
tags question: http://stackoverflow.com/q/21112374
tags question: http://stackoverflow.com/q/21022821
tags question: http://stackoverflow.com/q/21059301
tags question: http://stackoverflow.com/q/21034682
tags question: http://stackoverflow.com/q/21143750
tags question: http://stackoverflow.com/q/21029995
tags question: http://stackoverflow.com/q/21040312
tags question: http://stackoverflow.com/q/21130950
tags question: http://stackoverflow.com/q/21068389
tags question: http://stackoverflow.com/q/21160697
tags question: http://stackoverflow.com/q/21053153
tags question: http://stackoverflow.com/q/21100635
tags question: http://stackoverflow.com/q/21027048
tags question: http://stackoverflow.com/q/21111945
tags question: http://stackoverflow.com/q/21048081
tags question: http://stackoverflow.com/q/21118444
tag name: html
tags question: http://stackoverflow.com/q/21034674
tags question: http://stackoverflow.com/q/21182467
tags question: http://stackoverflow.com/q/21095157
tags question: http://stackoverflow.com/q/21151803
tags question: http://stackoverflow.com/q/21067075
tags question: http://stackoverflow.com/q/21037194
tags question: http://stackoverflow.com/q/21100736

http://stackoverflow.com/q/21060759
type: Question
tagged with: php
has body: i am trying to get response from servlet page and displaying alert on success. but its show me error always. i am not able to figure it out. My ajax code: $(document).ready(function() { $("#srch").click(function() { var txt1 = $("#store-qsearch").val(); alert(txt1) $.ajax({ url : 'http://localhost:8080/searchengine/SearchDataServlet', data : 'val='+txt1, type : 'GET', success : function(response) { alert("Success"); // create an empty div in your page with some id }, error: function(){ alert("error"); } }); }); }); My servlet code: public class SerachDataServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String searchkey = request.getParameter("val").toString(); SearchInput searchinput = new SearchInput(); searchinput.searchkeys = searchkey; System.out.println(searchkey); SearchParser searchparser = new SearchParser(); searchparser.searchData(searchkey); PrintWriter output = response.getWriter(); output.println("successs"); } }
has title: calling servlet from php page using ajax
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/21060802
tagged with: java
tagged with: servlets
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
tagged with: ajax
has answer: http://stackoverflow.com/a/21060802

http://stackoverflow.com/a/21089383
answers question: http://stackoverflow.com/q/21046591
accepted answer of: http://stackoverflow.com/q/21046591
downvote count: 1
upvote count: 0
type: AcceptedAnswer
score: -1
has body: I have seen that this the answer to this question depends on the own opinion and on the design of the game. No answer is realy the right answer so i decided to write a summary: If your objects (cars, weapons etc.) have the same functionalities and fields there is no Need for a subclass. To safe your fixed values you can write them in external Files and read them when needed. You can also store them in your source-code as final Constants or as Enums. You also can have a Constructor of car or whatever you Need with a int typ as Parameter. Depending on this type you can use the right constants for your object. If you Need many objects with the same typ and values you can also implement a copy-method and load all the different types on Startup (but think about the Memory they take), and then copy them when needed. Hope this helps you and thanks for your answers (:
type: Answer
has comment: http://stackoverflow.com/comment/31767290

http://stackoverflow.com/a/21062610
has body: This can be a bit of a puzzle until you figure out the Java initialization scheme. Statements outside of any method (that aren't simple declarations) are considered to be static (if preceded by the static keyword) or instance (if no static) initializers. As such, they are collected into two unnamed methods (one for static, one not). The static initializer method is executed when the class is loaded. The instance initializer method is executed before any constructor is called. In your case you want to leave private Car[] cars; where it is, but move cars=new Car[max]; into the constructor. To avoid this puzzle, novices are probably well-advised to avoid using such initializers, especially ones that depend on other values.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21062427

http://stackoverflow.com/a/21028542
type: Answer
score: 1
upvote count: 1
has body: Hmm good question. Would suggest to hava a look at the source since it is open source. I would say it returns void when the givenClass is of type java.lang.Void.
answers question: http://stackoverflow.com/q/21028434
downvote count: 0
has comment: http://stackoverflow.com/comment/31610922

http://stackoverflow.com/comment/31744734
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21095913
has text: The same way you iterate over the contents of HEAD in the question. I also added instructions for how to get file contents to the answer.
score: 0

http://stackoverflow.com/comment/31765133
has text: Oh I'm right there with you. How many times a *day* do we need to repeat these things?
type: Comment
comment on: http://stackoverflow.com/a/21112630
score: 1
type: AnswerComment

http://stackoverflow.com/q/21102294
has comment: http://stackoverflow.com/comment/31748415
tagged with: java
linked to: http://stackoverflow.com/q/1156552
has title: Programmatically determine list of JRE classes that need not be imported
has answer: http://stackoverflow.com/a/21102823
upvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/31748534
downvote count: 0
linked to: http://stackoverflow.com/q/520328
score: 4
has comment: http://stackoverflow.com/comment/31747579
favorite count: 0
linked to: http://stackoverflow.com/q/9220887
has comment: http://stackoverflow.com/comment/31748294
has answer: http://stackoverflow.com/a/21121193
tagged with: classloader
tagged with: urlclassloader
type: UnansweredQuestion
has body: I need to programmatically find out which JRE classes can be referenced in a compilation unit without being imported (for static code analysis). We can disregard package-local classes. According to the JLS, classes from the package java.lang are implicitly imported. The output should be a list of binary class names. The solution should work with plain Java 5 and up (no Guava, Reflections, etc.), and be vendor agnostic. Any reliable Java-based solution is welcome. Here are some notes on what I've tried so far: At first glance, it seems that the question boils down to "How to load all classes from a package?", which is of course practically impossible, although several workarounds exist (e.g. this and this, plus the blog posts linked there). But my case is much simpler, because the multiple classloaders issue does not exist. java.lang stuff can always be loaded by the system/bootstrap classloader, and you cannot create your own classes in that package. Problem is, the system classloader does not divulge its class path, which the linked appoaches rely on. So far, I haven't managed to get access to the system classloader's class path, because on the HotSpot VM I'm using, Object.class.getClassLoader() returns null, and Thread.currentThread().getContextClassLoader() can load java.lang.Object by delegation, but does not itself include the classpath. So solutions like this one don't work for me. Also, the list of guaranteed system properties does not include properties with this kind of classpath info (such as sun.boot.class.path). It would be nice if I didn't have to assume that there is an rt.jar at all, and rather scan the list of resources used by the system classloader. Such an approach would be safer with respect to vendor specific JRE implementations.
type: Question

http://stackoverflow.com/q/21125945
has answer: http://stackoverflow.com/a/21126017
has answer: http://stackoverflow.com/a/21126125
answer count: 3
accepted answer: http://stackoverflow.com/a/21126125
downvote count: 1
favorite count: 0
has title: Why do I have to import a nested class in the class it is defined?
has answer: http://stackoverflow.com/a/21126225
upvote count: 10
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21126017
tagged with: java
type: Question
score: 9
has body: In the following example the import is necessary, otherwise Java's compiler will complain that Nested cannot be resolved to a type in Iterable&lt;Nested&gt;: package test; import test.Example.Nested; public class Example implements Iterable&lt;Nested&gt; { public final static class Nested {} } (using Iterable&lt;Example.Nested&gt; instead of an import works as well) This only happens when referencing a nested class in the definition of the outer class, e.g. when using it as a parametric type, but also when extending/implementing it (which will result in another error once the compiler can resolve the class), or when using it as or in an annotation. My question is: Why can't the compiler find the nested class without an explicit declaration?

queue
tags question: http://stackoverflow.com/q/21037206
type: Tag
tags question: http://stackoverflow.com/q/21099953
tags question: http://stackoverflow.com/q/21095844
tag name: queue
tags question: http://stackoverflow.com/q/21026380
tags question: http://stackoverflow.com/q/21110803

http://stackoverflow.com/a/21096553
type: Answer
has body: getElementsByTagName returns all descendant elements. You just want all immediate child elements. You can use getChildNodes() and then filter them if you want. For example: NodeList children = element.getChildNodes(); for (int i = 0; i &lt; children.getLength(); i++) { Node node = children.item(i); if (node.getNodeType() == Node.ELEMENT_TYPE &amp;&amp; node.getLocalName().equals("type")) { // Use the node, get its value etc } } You might want to look at using XPath or an alternative Java XML API (e.g. JDOM) to make this simpler, too. If you do the above a lot, you probably want to extract it to a helper method to return all the direct children with a particular element name (or just the first one).
score: 1
answers question: http://stackoverflow.com/q/21096433
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21096433
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21148176
has comment: http://stackoverflow.com/comment/31832822
has comment: http://stackoverflow.com/comment/31831039
answers question: http://stackoverflow.com/q/21147489
type: Answer
accepted answer of: http://stackoverflow.com/q/21147489
has comment: http://stackoverflow.com/comment/31830919
score: 3
downvote count: 0
has body: Use two indexes and System.arraycopy(), copying 3 elements each time: for (int i = 0, j = 0; i &lt; argbBytes.length; i += 4, j += 3) { System.arraycopy(argbBytes, i, thumbRGB888, j, 3); } Should be significantly faster. Not only does it get rid of the modulo and comparison, System.arraycopy() is implemented with native code, relying on memcpy which is going to be faster than individual assignments.
type: AcceptedAnswer
upvote count: 3

http://stackoverflow.com/comment/31882120
has text: The file is in \Workspace\BombTimer.I run everything off JRE7 in Eclipse
comment on: http://stackoverflow.com/q/21176870
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31835556
has text: Questionable console output...
score: 4
comment on: http://stackoverflow.com/q/21151057
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21112509
upvote count: 6
accepted answer of: http://stackoverflow.com/q/21111098
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21111098
downvote count: 0
has body: The solution was to use: ObjectAnimator posterSlider = ObjectAnimator.ofFloat(imageView, "translationX", 0); ...for the return animation. It seems that a view "remembers" its original position after a translation. So, passing 0 as the destination to the ObjectAnimator is the same as saying "send the view back to it's original position".
score: 6
type: Answer

http://stackoverflow.com/a/21114549
type: Answer
has comment: http://stackoverflow.com/comment/31770917
accepted answer of: http://stackoverflow.com/q/21114474
answers question: http://stackoverflow.com/q/21114474
has comment: http://stackoverflow.com/comment/31769299
has body: I would check things following these steps: Ensure that SQL Server is up and running. Check your running services to see if SQL Server service is up. I would check the SQL Server Configuration Manager to see if the TCP/IP communication is enabled. I would check my firewall settings. Perhaps something is in the way between SQL Server and the client. I would check if another application from the same client can connect to the same server. Then I would check the connection string differences. If all of the above were playing correctly, then I would check the privileges on the specific SQL Server, on the specific database, for the account I am trying to connect with. Allow everyone to use this database as a first step to check if it is an account-permissions problem. Hope I helped!
has comment: http://stackoverflow.com/comment/31768174
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/31771434
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31767502
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/21111481
type: Comment
has text: This is unlikely to be related to JavaFX. Can you show the relevant sections of the jnlp?

http://stackoverflow.com/comment/31743785
score: 7
has text: Marko: and also does away with readabilty…
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21096353

http://stackoverflow.com/comment/31698693
type: QuestionComment
comment on: http://stackoverflow.com/q/21075484
score: 0
has text: @creatice1933 try using the `Toast.makeText(MorseActivity.this, "Displaying "+character,Toast.LENGTH_LONG).show();` instead of your toast.
type: Comment

http://stackoverflow.com/comment/31691469
comment on: http://stackoverflow.com/q/21072613
type: QuestionComment
score: 0
has text: I am able to copy zip file from assets folder to sdcard but now I want to unzip it at the same location, that is what I need to do now.
type: Comment

http://stackoverflow.com/q/21033511
type: Question
score: 3
tagged with: jsr223
answer count: 2
downvote count: 0
has body: I'm using a JSR223 ScriptEngine (JAV8) which is not thread-safe by itself. Since I need multiple threads to be able to access the ScriptEngine, each ScriptEngine belongs to an EngineContext Object. These EngineContexts again have one ReentrantLock that the individual threads acquire before accessing the ScriptEngine. The problem I have is that the locks are successfully acquired by the Threads but I still sometimes get JVM crashes (the famous SIGSEGV (0xb)) when two Threads call it. As an overview, here is some pseudo-code of the locking process Thread needs the ScriptEngine Thread waits and acquires lock Thread uses the ScriptEngine (Methods: eval, put) Thread releases the lock Thread does something else I am really not sure, what the problem here is.
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22938620
upvote count: 3
tagged with: java
tagged with: multithreading
tagged with: v8
has answer: http://stackoverflow.com/a/24163982
tagged with: scriptengine
has title: Java ScriptEngine with multiple Threads and Lock

http://stackoverflow.com/comment/31846171
comment on: http://stackoverflow.com/q/21156877
type: Comment
score: 0
has text: Is this just an academic exercise? Can you explain what the real world problem is that you are trying to solve?
type: QuestionComment

http://stackoverflow.com/a/21128650
accepted answer of: http://stackoverflow.com/q/21128408
has body: You call on a method from onCreate like this: Example: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.example); myMethod(); //Any parameters you need in the method can be passed through the parentheses } myMethod(){ //Do stuff in here } In your case, you should put this line in your onCreate() to call the method: additionCalc();
answers question: http://stackoverflow.com/q/21128408
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/q/21175900
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31880469
has comment: http://stackoverflow.com/comment/31880565
tagged with: java
accepted answer: http://stackoverflow.com/a/21176423
type: Question
score: 0
tagged with: android
answer count: 1
has body: I have an Activity that displays 2 fragments. One acts as a list of options and includes a few textviews and the other is the corresponding fragment. What is the best way use OnClick for those text views to swap between the corresponding fragments? Thank you in advanced, I really appreciate it.
has answer: http://stackoverflow.com/a/21176423
has title: How can I use an OnClickListener inside of a fragment to swap between the other fragments
tagged with: fragment

http://stackoverflow.com/q/21065686
tagged with: java
has answer: http://stackoverflow.com/a/21065773
has comment: http://stackoverflow.com/comment/31678502
downvote count: 1
type: Question
has body: I am developing an android game and I got it working until the point that I now need to include animation. Basically I need to draw a line between 2 points. I have 1 relative layout (holding a table layout) inside of a main relative layout. there are 9 buttons that they hover over and create a sequence, I need to create a line that follows the finger from one point to the next (using the blocks coordinates sequence). I am storing the order of the blocks in an arraylist - like this: [1,2,3,6,5,4,7,8,9]. So I got to draw the line from the first block to the second block and so on. Now I am introducing the animation using the .drawLine() method. But every time it crashes with a NullPointerException. I am new to this, am I doing it wrong or missing something? Any ideas to how to do this otherwise? Here is the game class: public class Game extends Activity implements OnTouchListener{ TextView memorize, menu; ImageButton b1, b2, b3, b4, b5, b6, b7, b8, b9; Rect b1R, b2R, b3R, b4R, b5R, b6R, b7R, b8R, b9R; int x, y; ArrayList&lt;String&gt; arr = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; fin = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; fin2 = new ArrayList&lt;String&gt;(); Intent i; String LEVEL; int data; String mainSequence, gameSequence; Paint paint1, paint2, paint3, paint4, paint5, paint6, paint7, paint8, paint9; Canvas canvas = new Canvas(); int b1X, b1Y; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.ingame); Bundle extras = getIntent().getExtras(); LEVEL = extras.getString("level"); DB ourdb = new DB(this); data = 0; ourdb.open(); data = ourdb.getSequence(LEVEL); ourdb.close(); setup(); } private void setup(){ // TextViews memorize = (TextView) findViewById(R.id.tvMemorize); menu = (TextView) findViewById(R.id.tvInGameMenu); // ImageButtons b1 = (ImageButton) findViewById(R.id.ib1); b2 = (ImageButton) findViewById(R.id.ib2); b3 = (Im…
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/21065879
score: -1
favorite count: 0
has title: NullPointerException when trying to draw a line - android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31678405
has comment: http://stackoverflow.com/comment/31678366
tagged with: android
has comment: http://stackoverflow.com/comment/31678559
has comment: http://stackoverflow.com/comment/31678957

http://stackoverflow.com/comment/31708862
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21081780
has text: `[INFO] +- org.springframework:spring-aop:jar:3.2.3.RELEASE:compile [INFO] | \- aopalliance:aopalliance:jar:1.0:compile [INFO] +- org.springframework:spring-beans:jar:3.2.3.RELEASE:compile [INFO] +- org.springframework:spring-context:jar:3.2.3.RELEASE:compile [INFO] +- org.springframework:spring-core:jar:3.2.3.RELEASE:compile [INFO] +- org.springframework:spring-expression:jar:3.2.3.RELEASE:compile [INFO] +- org.springframework:spring-test:jar:3.2.3.RELEASE:compile [INFO] +- org.springframework:spring-web:jar:3.2.3.RELEASE:compile `
type: Comment

http://stackoverflow.com/comment/31834043
type: Comment
type: QuestionComment
has text: Can you show your whole program please? There's no error in the part you've shown here.
comment on: http://stackoverflow.com/q/21150190
score: 0

http://stackoverflow.com/comment/31802214
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21110581
type: Comment
has text: i tried that one but it is not giving the correct crc in my case. but it is also not giving the correct crc. i will update the code that i used above.

http://stackoverflow.com/q/21082074
tagged with: multithreading
upvote count: 1
has answer: http://stackoverflow.com/a/21082566
has title: simple daemon thread doesn't output msg
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31709172
answer count: 1
accepted answer: http://stackoverflow.com/a/21082566
downvote count: 0
has comment: http://stackoverflow.com/comment/31709085
has body: I was learning daemon thread content from "Think in Java", however, while I tried to run to daemon thread and was expecting some output, it gave me nothing... my programming IDE is Eclipse and operating system is ubuntu13.04... Please let me know what is going on. The following code will output msg if you comment out "t.setDaemon(true);" public class Practice implements Runnable{ @Override public void run() { // TODO Auto-generated method stub try { Thread.sleep(1000); System.out.println(Thread.currentThread()+" "+this); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("Daemon is working"); } public static void main(String[] args){ Thread t = new Thread(new Practice()); t.setDaemon(true); t.start(); } }
linked to: http://stackoverflow.com/q/2213340
favorite count: 0
tagged with: daemon

http://stackoverflow.com/comment/31965030
comment on: http://stackoverflow.com/a/21141041
type: AnswerComment
score: 0
has text: You should be able to send the raw bytes - I think you said you did it for a structure of 8 ints but you do need to know the underlying structure very well and I think the Mat data structure is fiddly. encoding/decoding seems the best way to go and a quick check says it compresses too so that should improve transfer speeds. Glad you got it sorted so good luck with the rest of your project.
type: Comment

http://stackoverflow.com/a/53920685
downvote count: 0
score: 8
upvote count: 8
answers question: http://stackoverflow.com/q/21049557
has body: If you only want to allow + sign and that is only at the beginning of the number and does not want to allow any other characters or symbols other that the digits, then try the below regex: var regEx = /^[+]?\d+$/; regEx.test("+123345"); // this will be true regEx.test("++123345"); // this will be false regEx.test("1+23345"); // this will be false regEx.test("111222"); // this will be true
type: Answer

http://stackoverflow.com/q/21129017
score: 0
has body: My program was working fine while connected to a MySQL database, but now that I have it connected to an embedded Derby file database, it is no longer inserting new rows. Whenever I try to insert a new row, I get the error: java.sql.SQLException: Invalid cursor state - no current row. The stack trace is referring to a certain line in my getValueAt() function in my table model: public Object getValueAt(int row, int column) { Object object = null; try { resultSet.absolute(row + 1); object = resultSet.getObject(column + 1); // &lt;--------- return object; } catch (SQLException se) { se.printStackTrace(); } return ""; } But I'm pretty sure that that is resulting in an error because no row is getting inserted in the first place. Here is my addRow() method in my table model: public void addRow(Object[] newRow) { try { resultSet.moveToInsertRow(); for (int i = 0; i &lt; newRow.length; i++) { resultSet.updateObject(i + 2, newRow[i]); } resultSet.insertRow(); rowCount++; fireTableRowsInserted(rowCount - 1, rowCount - 1); } catch (SQLException se) { se.printStackTrace(); } } (The i+2 in resultSet.updateObject(i + 2, newRow[i]); is just to skip the first primary key column.) I also have auto commit set to false so I can implement a simple Save button by calling connection.commit(). My statement object has the following flags set: statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); As I said, the code was working fine with MySQL. Does anyone know why it is having trouble inserting a new row?
has title: Trouble migrating from MySQL to Derby: Invalid cursor state - no current row
has comment: http://stackoverflow.com/comment/31807277
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31825996
tagged with: jdbc
has comment: http://stackoverflow.com/comment/31798946
answer count: 0
tagged with: java
tagged with: mysql
type: Question
tagged with: derby

http://stackoverflow.com/comment/31773372
type: QuestionComment
comment on: http://stackoverflow.com/q/21116826
has text: Welcome to stackoverflow! I think it will help if you post what regex you tried and write where it failed.
score: 0
type: Comment

http://stackoverflow.com/comment/31629191
has text: You are trying to add the object InfoForLog to the ArrayList listForLg which will accept only object of Info as in Line 1. Either change the line1 to ArrayList<Info> to ArrayList<InfoForLog> or change the add only objects of Info to arraylist
type: QuestionComment
comment on: http://stackoverflow.com/q/21038384
score: 0
type: Comment

http://stackoverflow.com/q/21100153
has comment: http://stackoverflow.com/comment/31776474
has title: File download in Struts 2
has comment: http://stackoverflow.com/comment/31743413
has comment: http://stackoverflow.com/comment/31851317
has comment: http://stackoverflow.com/comment/31746846
tagged with: spring
has comment: http://stackoverflow.com/comment/31755520
has answer: http://stackoverflow.com/a/21121669
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/30159059
has comment: http://stackoverflow.com/comment/31743940
upvote count: 5
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/30159059
type: Question
score: 5
has answer: http://stackoverflow.com/a/44259364
downvote count: 0
tagged with: jsp
accepted answer: http://stackoverflow.com/a/21121669
favorite count: 0
tagged with: struts2
answer count: 3
has comment: http://stackoverflow.com/comment/31758650
has body: I am trying to download a file from my web server running Struts2, Hibernate and Spring but I am always getting this exception. java.lang.IllegalArgumentException: Can not find a java.io.InputStream with the name [inputName] in the invocation stack. Check the tag specified for this action. org.apache.struts2.dispatcher.StreamResult.doExecute(StreamResult.java:237) org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186) com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:371) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:275) org.apache.struts2.interceptor.DeprecationInterceptor.intercept(DeprecationInterceptor.java:41) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doI…

http://stackoverflow.com/comment/31692861
comment on: http://stackoverflow.com/a/21073559
score: 0
type: AnswerComment
type: Comment
has text: _extending_ JButton just to place it somewhere? Boooohhh...

nutiteq
tag name: nutiteq
tags question: http://stackoverflow.com/q/21091910
type: Tag

http://stackoverflow.com/q/21023759
type: Question
tagged with: jakarta-ee
tagged with: java
tagged with: hibernate
tagged with: eclipse
has body: I got a problem that consumes a lot of time during the development i have to test somes HQL that i put in DAO, but i had to recompile all the project in eclipse and put in tomcat that takes something like 40-60seconds just to start again and if something goes wrong... again had to redeploy... So, there is a way to test a HQL without recompile everything? like i tried the hibernate tools plugin but i don't see how to do it with annotations (the project is all with annotations, don't make use of hbm files...) Thanks
downvote count: 0
has answer: http://stackoverflow.com/a/21025715
has answer: http://stackoverflow.com/a/21025136
favorite count: 0
possible better answer: http://stackoverflow.com/a/21024794
has answer: http://stackoverflow.com/a/21024794
has answer: http://stackoverflow.com/a/21023894
has title: How to test HQL without redeploy all the project?
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31601889
accepted answer: http://stackoverflow.com/a/21023894
score: 1
upvote count: 1

http://stackoverflow.com/q/21143126
has answer: http://stackoverflow.com/a/21143229
tagged with: rest
downvote count: 0
answer count: 1
tagged with: url
has body: I'm designing a RESTful API and I have a pretty simple "philosophical" question: I have a resource representing a set of values stored in a period of time: loggers/2/data?begin=10h&amp;end=12h Doing this request I get the data stored by a Data Logger (with id=2) from 10:00h to 12:00h. response: [ { "data": "10h", "value": 10 }, { "data": "11h", "value": 15 }, { "data": "12h", "value": 9 } ] Now, I want only the max value in this period: [ { "data": "11h", "value": 15 } ] So... Is this a new resource? like: loggers/2/data/max?begin=10h&amp;end=12h or the same resource filtered? loggers/2/data?begin=10h&amp;end=12h&amp;filter=max What do you think? thanks!
score: 1
has title: REST good practices: new resource or parameter?
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: web-services
tagged with: java
tagged with: http
type: Question

http://stackoverflow.com/comment/31709496
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21082325
has text: Also add a `Z` at the end of your format to see your timezone.

http://stackoverflow.com/a/21162967
has comment: http://stackoverflow.com/comment/31856371
accepted answer of: http://stackoverflow.com/q/21162383
score: 4
answers question: http://stackoverflow.com/q/21162383
type: Answer
has body: I don't think JavaFX 2.x supports running in a headless mode. I don't know of any workaround. For further info see the JavaFX issue tracker feature request: RT-34241 Use of WebEngine in a headless system, currently scheduled for implementation for Java 9.
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21617419
type: Answer
has body: Okay, Actually this won't working in this way. I want to achieve an functionality which was of a phonegap app. And I am working in Android (Java) platform.
accepted answer of: http://stackoverflow.com/q/21168388
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21168388

http://stackoverflow.com/a/43590348
answers question: http://stackoverflow.com/q/21101250
type: Answer
score: 36
downvote count: 1
has comment: http://stackoverflow.com/comment/79573978
has body: Here's a super-simple example with basic authentication, headers, and exception handling... private HttpHeaders createHttpHeaders(String user, String password) { String notEncoded = user + ":" + password; String encodedAuth = "Basic " + Base64.getEncoder().encodeToString(notEncoded.getBytes()); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); headers.add("Authorization", encodedAuth); return headers; } private void doYourThing() { String theUrl = "http://blah.blah.com:8080/rest/api/blah"; RestTemplate restTemplate = new RestTemplate(); try { HttpHeaders headers = createHttpHeaders("fred","1234"); HttpEntity&lt;String&gt; entity = new HttpEntity&lt;String&gt;("parameters", headers); ResponseEntity&lt;String&gt; response = restTemplate.exchange(theUrl, HttpMethod.GET, entity, String.class); System.out.println("Result - status ("+ response.getStatusCode() + ") has body: " + response.hasBody()); } catch (Exception eek) { System.out.println("** Exception: "+ eek.getMessage()); } }
upvote count: 37

http://stackoverflow.com/a/21144872
type: Answer
score: 1
upvote count: 1
has body: As has been discussed many times before, you can't directly create a generic array using the type parameter. You can follow that question's answers if you must use an array. However, you can create a List of a type parameter instead. No tricks are necessary, and it's more flexible. public NamesRepository(){ names = new ArrayList&lt;T&gt;(); // Easy creation } public List&lt;T&gt; names; Then, your iterator's hasNext() method can compare its index to names.size(), and the next() method can return names.get(index++). You can even implement the other method required for the Iterator interface, remove(), by calling names.remove(index).
answers question: http://stackoverflow.com/q/21144534
downvote count: 0

http://stackoverflow.com/a/21069021
has body: As Roman said in the comment: Java does permit multiple inheritance of interfaces. If all you need is to inherit the is-a relationship and a guaranteed set of methods to communicate with the object, this works perfectly. Only a single class (abstract or not) can be inherited from (along with however many interfaces are desired). This is to avoid the complications of "diamond inheritance" -- websearch that phrase to learn more. The usual workaround if you do need to reuse logic from several sources is to define the additional shared behaviors in a utility class, and have your class delegate to an instance of that. Yes, this is a has-a rather than is-a relationship, but since is-a can be abstracted out into an interface you can get the desired final appearance of combined behaviors. (And unlike diamond inheritance, this forces you to make explicit decisions about which implementation you want to invoke.)
has comment: http://stackoverflow.com/comment/31686396
has comment: http://stackoverflow.com/comment/31686415
downvote count: 0
answers question: http://stackoverflow.com/q/21068902
has comment: http://stackoverflow.com/comment/31686313
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/31684955
has comment: http://stackoverflow.com/comment/31686229
upvote count: 2
has comment: http://stackoverflow.com/comment/31684975

log4j
tags question: http://stackoverflow.com/q/21137307
tags question: http://stackoverflow.com/q/21156444
tags question: http://stackoverflow.com/q/21065854
tags question: http://stackoverflow.com/q/21160701
tags question: http://stackoverflow.com/q/21143749
tags question: http://stackoverflow.com/q/21182869
tags question: http://stackoverflow.com/q/21140646
tags question: http://stackoverflow.com/q/21166592
tags question: http://stackoverflow.com/q/21115307
tags question: http://stackoverflow.com/q/21117329
tags question: http://stackoverflow.com/q/21091536
tags question: http://stackoverflow.com/q/21061791
tags question: http://stackoverflow.com/q/21140365
tags question: http://stackoverflow.com/q/21140168
tag name: log4j
tags question: http://stackoverflow.com/q/21155751
tags question: http://stackoverflow.com/q/21091937
tags question: http://stackoverflow.com/q/21090735
tags question: http://stackoverflow.com/q/21141183
type: Tag
tags question: http://stackoverflow.com/q/21124647
tags question: http://stackoverflow.com/q/21097953

http://stackoverflow.com/q/21061119
possible better answer: http://stackoverflow.com/a/21061560
has comment: http://stackoverflow.com/comment/31671078
has answer: http://stackoverflow.com/a/21061560
has answer: http://stackoverflow.com/a/21061526
accepted answer: http://stackoverflow.com/a/21061526
tagged with: android-imageview
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
answer count: 2
has title: How to decide the sequence of runnable
has comment: http://stackoverflow.com/comment/31670539
upvote count: 1
tagged with: android
has comment: http://stackoverflow.com/comment/31670044
tagged with: runnable
has body: I'm doing an application in which I have to show a sequence of pictures: The sequence is the follow: A red X has to be shown for 400 milliseconds An image called "Screenshot" has to be shown for 500 milliseconds An image called "Noise" has to be shown for 50 milliseconds The "Noise" image disappear to make space for an EditText But the results that comes out is the red X shown for 400 milliseconds and then a blank screen. Here is the code I wrote: private void startThread(){ handler.postDelayed(new TaskScreenshot(), 400); handler.postDelayed(new TaskNoise(), 500); handler.postDelayed(new TaskEditText(), 100); } class TaskScreenshot implements Runnable{ @Override public void run() { myImageView.setImageResource(R.drawable.googleplaybooks2); myImageView.getLayoutParams().width = LayoutParams.MATCH_PARENT; myImageView.getLayoutParams().height = LayoutParams.MATCH_PARENT; } } class TaskNoise implements Runnable{ @Override public void run() { myImageView.setImageResource(R.drawable.noise); myImageView.getLayoutParams().width = LayoutParams.MATCH_PARENT; myImageView.getLayoutParams().height = LayoutParams.MATCH_PARENT; } } class TaskEditText implements Runnable{ @Override public void run() { myInputFragment.getView().setVisibility(View.VISIBLE); myImageFragment.getView().setVisibility(View.INVISIBLE); } } The red X is already set in the ImageView before the sequence starts. Is there something I'm doing wrong? Is Runnable the right way of doing this sequence?
favorite count: 0
has comment: http://stackoverflow.com/comment/31670164

http://stackoverflow.com/a/21168661
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21168321
answers question: http://stackoverflow.com/q/21168321
has body: You are probably getting a relative path from the getPath(). To be sure that you are getting the absolute path from the File object, use: if (file.getAbsolutePath().equals("C:\\Users\\Desktop\\Application\\folder2")) ... instead of getPath().
upvote count: 1

http://stackoverflow.com/comment/31815078
type: AnswerComment
type: Comment
score: 2
has text: @assylias, TimB I'd say we can write this off to a preference in style... the objective measurements do not support a rule which would mandate presizing as a relevant best practice, but at least they give you *something*. Therefore we have a minor code style issue on one side (a bit more code everywhere) and a minor performance issue on the other. It comes down to how much you value not having extra code in the constructor call. I for one value it more than the quite abstract advantage I may get from it.
comment on: http://stackoverflow.com/a/21139631

http://stackoverflow.com/comment/31858875
has text: Thank you for your response. Does that mean that the Unix Server uses the UTF encoding while reading the file? So by passing the "ISO-8859-1" encoding in the InputStreamReader constructor will make it use the ISO encoding?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21164445

http://stackoverflow.com/a/21022518
has body: The idea of the Abstract class is a common base for a number of other classes.. Think of "Animals".. You cannot create something called 'Animal'.. You have Cats and Dogs and Rabbits that 'Are' animals. You have a abstract class called "Animal" and then you have a class called Cat that extends Animal, or Dog that extends Animal... but you do not instantiate the class "Animal" directly as its only a common base.
score: 3
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/31599679
has comment: http://stackoverflow.com/comment/31600003
answers question: http://stackoverflow.com/q/21022462
has comment: http://stackoverflow.com/comment/31599815
downvote count: 0

http://stackoverflow.com/q/21164505
tagged with: java
has comment: http://stackoverflow.com/comment/31859127
has comment: http://stackoverflow.com/comment/31859472
has comment: http://stackoverflow.com/comment/31859283
tagged with: arrays
has answer: http://stackoverflow.com/a/21164767
answer count: 1
has comment: http://stackoverflow.com/comment/31858975
has body: I am trying to build a program where I have a visual representation of an int array while they get sorted. There will be two different search algorithms of choice. All the functionality is split up into classes, interfaces and abstract classes. My main problem is getting the data from one thing to the next. My main class implements basic window functionality. Paints the window, a few buttons to choose the search algorithm, provides a textfield to input an array and displays in its center a bar graph visualisation of the array. Drawing the bars is done in a class that extends JComponent. This is also where I transform the String of numbers into an int array. I can already draw the graphs, change the array and it gets also drawn. Now I have an interface called Sorter which provides the following methods. public void setUpTo( int i ); // to limit the number of swaps during the search public void setNumbers( int[] numbers ); public void sort(); public String getName(); public int getSwaps(); Then I have the abstract class CountingSort that implements Sorter and the class CountingBubbleSort which extends CountingSort. This is all pretty confusing to me. Within my main class I listen to a button to pass on the content of TextField and start the sorting. What do I need to do to get the int array through CountingSort into CountingBubbleSort? I have already implemented CountingBubbleSort. Let me know what additional information I need to provide.
score: 0
tagged with: abstract-class
has comment: http://stackoverflow.com/comment/31859772
tagged with: interface
linked to: http://stackoverflow.com/q/11389137
type: UnansweredQuestion
type: Question
has title: Java: Implementation of Interfaces and abstract classes

http://stackoverflow.com/comment/74022648
score: 1
comment on: http://stackoverflow.com/a/21062958
type: AnswerComment
type: Comment
has text: nice!! to geter hour constant `Math.ceil((previousTimestamp-currentTimestamp)/60)`

http://stackoverflow.com/q/21160153
possible better answer: http://stackoverflow.com/a/21160287
has answer: http://stackoverflow.com/a/21160287
has title: How to effectively write big data structure to file?
accepted answer: http://stackoverflow.com/a/21160449
answer count: 3
tagged with: dump
downvote count: 0
has answer: http://stackoverflow.com/a/61473316
favorite count: 0
tagged with: serialization
has body: I have a variable of type HashMap&lt;String, HashSet&lt;Long&gt;&gt; and it's size can grow upto 100MB. I need to write this to secondary storage. Serialization is not an option as it's too slow for me. Is there any other better method to dump the byte structure into the hard drive? PS: I am worried only about the speed of writing to disk, slow reading isn't an issue.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21160449
score: 1
tagged with: java
tagged with: save
upvote count: 1
type: Question

http://stackoverflow.com/q/21082325
has answer: http://stackoverflow.com/a/66353225
tagged with: java
has title: How to convert UTC and local timezone in Java
upvote count: 10
has comment: http://stackoverflow.com/comment/31709464
type: Question
score: 10
has comment: http://stackoverflow.com/comment/31709496
possible better answer: http://stackoverflow.com/a/21087443
has answer: http://stackoverflow.com/a/21087443
has answer: http://stackoverflow.com/a/21082465
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21082465
tagged with: timezone
has answer: http://stackoverflow.com/a/57228375
has comment: http://stackoverflow.com/comment/100957690
answer count: 4
has body: I am curious about timezone in Java. I want to get UTC time in milliseconds from a device and send to server. Server will convert it to local timezone when it displays time to users. Timezone in my system is Australia/Sydney( UTC + 11:00), and I have got the result below when I tested timezone: int year = 2014; int month = 0; int date = 14; int hourOfDay = 11; int minute = 12; int second = 0; Calendar c1 = Calendar.getInstance(); c1.set(year, month, date, hourOfDay, minute, second); SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss z"); System.out.println(sdf.format(c1.getTime())); Calendar c2 = Calendar.getInstance(TimeZone.getTimeZone("UTC")); c2.set(year, month, date, hourOfDay, minute, second); System.out.println(sdf.format(c2.getTime())); output: 14/01/2014 11:12:00 EST 14/01/2014 22:12:00 EST I thought I could have 13/01/2014 00:12:00 for c2 because UTC time is 11 hours later than mine. Does not Calendar work the way I expect? Your help would be appreciated. EDIT Added z to display timezone. This makes me more confused because Mac says its timezone is (AEDT) Australian Eastern Daylight Time but Java is EST. Anyway still result is different because EST is UTC-5 hours.
type: AnsweredQuestion

http://stackoverflow.com/comment/31864891
comment on: http://stackoverflow.com/q/21149785
has text: I agree. Unfortunately I don't get to make these rules! :)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21099700
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has title: java runtime error when loading a class
has comment: http://stackoverflow.com/comment/31741632
has comment: http://stackoverflow.com/comment/31741605
score: 0
has answer: http://stackoverflow.com/a/21099837
answer count: 1
has comment: http://stackoverflow.com/comment/31741675
favorite count: 0
has comment: http://stackoverflow.com/comment/31741472
has comment: http://stackoverflow.com/comment/31741583
tagged with: classloader
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31741467
tagged with: linker
has comment: http://stackoverflow.com/comment/31741474
has body: I will do my best to explain the exact situation we ran into. Let me know if you guys have additional questions. I do not know if this is a java linking issue or a java loading issue. I have compiled the code using a external jar file which has changed during the execution. I am referencing a class file called "Contract" in my code. The library which I am using at compile time has a "Contract" class which extends from the "BaseContract" class. But the library which I am using at execution time does not have a super class ("BaseContract"). At runtime, I get a a error saying BaseContract class is not found. The class referencing the "Contract" class, lets say, is called "AppClass". At compile time, does java store the class hierarchy of all its referenced classes in the class file which is being compiled. In my specific example, does java store the class hierarchy of the "Contract" class in the AppClass.class file? If so, why does java have to store the class hierarchy here. Is it not more efficient to store the class "Contract" hierarchy in the Contract.class file rather than in the AppClass.class file? Any help or pointers are greatly appreciated.

http://stackoverflow.com/a/21070527
has body: Citation: progress.setProgress(0); this should be progress.setProgress(jumpTime); I suppose? Also I guess, this will lead to a problem. You cannot access UI-Components from background Threads. You need to use a Handler. See this Example.
type: Answer
has comment: http://stackoverflow.com/comment/31687641
answers question: http://stackoverflow.com/q/21070509
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/31625853
type: AnswerComment
comment on: http://stackoverflow.com/a/21036740
has text: Have you opened a new CMD window after setting the environment variable?
score: 0
type: Comment

http://stackoverflow.com/comment/31680227
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21060731
has text: The concerns are noted and voicing them is appreciated. Let me just add that this is a boiled down example and the actual project provides a plausible use-case for this feature.
type: Comment

http://stackoverflow.com/comment/31746886
score: 2
has text: I would suggest that you check if your adb is working properly. I think it seems that the issue is not with the emulator itself, but with the upload of the HelloDroid example. Try to set up an emulator without loading an app and after that push your app onto the emulator with adb - then see if it works.
comment on: http://stackoverflow.com/q/21100834
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21067130
has title: Proper use of @Security.Authenticated(Secured.class) statement in Play FrameWork
favorite count: 0
has body: Hi I am having trouble understanding how to properly use @Security.Authenticated(Secured.class) statement within the PlayFrameWork. I am trying to make sure that only authenticated users can access their accounts. Following from the example provided in the Play docs , it appears that their authentication allows a single user to access every users' account once logged in - rather than just their own. Normally I would have assumed that you simply get the session value within the action say, public static Result viewAccount(String account) { //get session value and check against account name } However the Docs use another route: They define a class public class Secured extends Security.Authenticator { @Override public String getUsername(Context ctx) { return ctx.session().get("username"); } @Override public Result onUnauthorized(Context ctx) { return redirect(routes.Application.login()); } } Apparently now simply using the statement: @Security.Authenticated(Secured.class) before an action insures that it is authenticated. But by my understanding and testing this does not block users from logging in to anyones account as it passes simply if the a session value exists - and not if it matches. How to fix this? Should I just directly compare the session value? What is the purpose then of @Security.Authenticated(Secured.class)? Thanks (Edit) to clarify: I want to allow users to be authorised only to see their own accounts and not others. So when the statement @Security.Authenticated(Secured.class) is used, I would like it to not only check for the presence of a session id but check that it matches an account
accepted answer: http://stackoverflow.com/a/21067400
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: http
type: Question
tagged with: session
has answer: http://stackoverflow.com/a/21067400
tagged with: playframework
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/109701778
type: Comment
score: 2
has text: @Leomord well I think the reason I did that was that we will be adding x % 10 to the number so 0-9 is going to be added or substracted which could result in an over/under flow, so it is acting like a buffer to allow those values to be taken into account as well, you could alternatively add another if statement check after multiplication and pre addition and not use the div by 10.
comment on: http://stackoverflow.com/a/59647892
type: AnswerComment

http://stackoverflow.com/comment/101723674
score: 0
comment on: http://stackoverflow.com/a/21087859
has text: why pass null to the Configurator.initialize() ?
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21028645
type: Answer
score: 2
upvote count: 2
has body: The Proxy#getProxyClass(ClassLoader, Class) method is declared as public static Class&lt;?&gt; getProxyClass(ClassLoader loader, Class&lt;?&gt;... interfaces) Its return type is therefore Class&lt;?&gt;. The normal syntax would be Class proxyClass&lt;?&gt; = Proxy.getProxyClass(getClass().getClassLoader(), Transportable.class, Order.class); Technically you could do (with a warning) public &lt;T extends Order &amp; Transportable&gt; void doSomething() { Class&lt;T&gt; proxyClass = (Class&lt;T&gt;) Proxy.getProxyClass(Driver.class.getClassLoader(), Transportable.class, Order.class); } but that gains you nothing as you will pretty much never need to use that T variable. The Class class provides very little methods that makes use of it, namely getConstructor(Class...) and newInstance(). But again, the whole point of reflection is that you only know the class types at run time, not at compile time where generics are useful.
accepted answer of: http://stackoverflow.com/q/21021670
has comment: http://stackoverflow.com/comment/31633930
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21021670

http://stackoverflow.com/comment/31878604
comment on: http://stackoverflow.com/a/21174853
score: 0
type: AnswerComment
type: Comment
has text: @PulsePanda: I suspect you mean `getSelectedValue()` in that first call, not `getSelectedIndex()`. But assuming that - you need to investigate why the selection isn't in the list you think it is. We don't have even *slightly* enough context to help you with that... I suggest you look closely at your code again, and shorten it to something like can post as a complete (but short!) program in a new question. (The reason for the NullPointerException - the cause of this question - has been answered.)

http://stackoverflow.com/q/21078824
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/16138217
has title: Somewhat confused on the use of the @param tag
answer count: 1
downvote count: 1
duplicate of: http://stackoverflow.com/q/16138217
has answer: http://stackoverflow.com/a/21078860
has comment: http://stackoverflow.com/comment/31710910
has comment: http://stackoverflow.com/comment/31713556
accepted answer: http://stackoverflow.com/a/21078860
type: AnsweredQuestion
favorite count: 0
type: Question
has body: Hi I was wondering what the @param tag does? I read up a bit on various other stackoverflow questions and the documentation for java but am still confused. Could someone explain it in simpler terms (I'm a beginning programmer)? From my interpretation it basically tells what the type of parameter that a method accepts, is that correct or not? Thank you!
upvote count: 1
has comment: http://stackoverflow.com/comment/31767814
tagged with: parameters

http://stackoverflow.com/comment/31789153
comment on: http://stackoverflow.com/a/21125468
type: AnswerComment
score: 0
type: Comment
has text: My point is that string conversion is locale-aware while character conversion is not. And like my edit says, the JavaDoc is provably incorrect.

http://stackoverflow.com/comment/31816669
score: 0
type: AnswerComment
type: Comment
has text: Sorry didn't understand how do your two snippets relate? Should I use both or one of them?
comment on: http://stackoverflow.com/a/21141010

http://stackoverflow.com/q/21126379
has title: hibernate create generic object from a query
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/21126423
has body: I need to consult data of DB without use Entity classes. My query like this SELECT count(e), MONTHNAME(e.someDate) /*and maybe anothers*/ FROM Entity e WHERE ...... GROUP BY MONTHNAME(e.someDate) ORDER BY e.someDate desc This simple query is a search for totals in months. The SQL query that generate is right, this return data similar to this. +-----+---------+ |count|MONTHNAME| +-----+---------+ |15 |January | +-----+---------+ |31 |December | +-----+---------+ |18 |November | +-----+---------+ In java code i get the query via list method List&lt;Object&gt; objs = query.list(); When i debug, get this in object value But, i cant work with this objects, objs.get(index) return a object without any method that return my data total or month How to build the object from the query? to work data.
score: 0
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/31790521
accepted answer: http://stackoverflow.com/a/21126423
has comment: http://stackoverflow.com/comment/31790691
type: AnsweredQuestion

http://stackoverflow.com/comment/31808717
comment on: http://stackoverflow.com/a/21136552
has text: Yes, I think they will have the same effect
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21043741
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21043865
tagged with: memory
type: Question
possible better answer: http://stackoverflow.com/a/21043753
has answer: http://stackoverflow.com/a/21043753
has title: Is Garbage Collection time related to number of objects or size of objects?
has answer: http://stackoverflow.com/a/21043832
answer count: 3
accepted answer: http://stackoverflow.com/a/21043865
score: 3
has body: I am having an issue with slow garbage collection. Obviously, the more objects in heap (all else equal) will lead to longer GC time, and larger sized objects in heap will lead to longer GC times. However I am wondering about the trade-off between object size and number of objects. For example, comparing two sets of objects that are the same total megabytes but one set has 1,000,000 objects and the other has 5 objects, which is faster to GC?
downvote count: 0
favorite count: 0
tagged with: heap-memory
tagged with: garbage-collection
type: AnsweredQuestion

http://stackoverflow.com/a/21062595
answers question: http://stackoverflow.com/q/21062587
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21062587
type: AcceptedAnswer
downvote count: 0
has body: In your case, the return statement in the finally block is the reason for compliation failure. Because the code below try...catch...finally is not reachable. In general, there is no need of return statement in finally block. A suggestion: It is good to write programs in Notepad/Textpad and compile/execute it from Command-Line. But, learn to use Eclipse IDE or any other IDEs. It would be very easy to handle these type of errors. A 13 year old using Getters/Setters..!! Well done .. :)
type: Answer

http://stackoverflow.com/q/21025546
has comment: http://stackoverflow.com/comment/31630928
has body: i have a problem using OSGi. What i have: 2 simple bundles (Bundle A calls Bundle B) blueprint usage OSGi security usage both bundles are core bundles with all permissions third party bundles don't have all permissions, i.e. the PropertyPermission("bla", "write") will be denied So as already mentioned the bundle call is pretty simple. Bundle A calls bundle B. The only complicated thing in it is, that the call is a doPrivileged call. Following scenarios/examples: Set a "bla" property in bundle A without doPrivileged -> fails (ok) public void foo() { System.setProperty("bla", "blubb"); // throws java.security.AccessControlException: access denied ("java.util.PropertyPermission" "bla" "write") -&gt; ok } Set a "bla" property in bundle A with doPrivileged -> works (ok) public void foo() { AccessController.doPrivileged(new PrivilegedExceptionAction&lt;Boolean&gt;() { @Override public Boolean run() throws Exception { System.setProperty("bla", "blubb"); // sets the bla property without throwing an exception -&gt; ok return null; } }); } Now trying to set the "bla" property in bundle B using the doPrivileged call of bundle A -> fails (why?) Bundle A: public void foo() { AccessController.doPrivileged(new PrivilegedExceptionAction&lt;Boolean&gt;() { @Override public Boolean run() throws Exception { // calls Bundle B bundleBService.bar(); return null; } }); } Bundle B: public void bar() { System.setProperty("bla", "blubb"); // throws java.security.AccessControlException: access denied ("java.util.PropertyPermission" "bla" "write") } So why does it fail to set the property in bundle B using a doPrivileged call of bundle A? I would expect, that the doPrivileged call would also work here. Why it doesn't? Is it the fault of using blueprint? And is it possible wo solve this issue without adding the doPrivileged block to the method of bundle B? Update: Here is the StackTrace: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "bla" "write") at java.s…
downvote count: 0
has comment: http://stackoverflow.com/comment/31628989
has comment: http://stackoverflow.com/comment/31630881
has title: OSGi doPrivileged call between two bundles
type: AnsweredQuestion
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21088387
has comment: http://stackoverflow.com/comment/31610519
type: Question
tagged with: osgi
upvote count: 1
answer count: 1
tagged with: blueprint
has comment: http://stackoverflow.com/comment/31630898
tagged with: java
accepted answer: http://stackoverflow.com/a/21088387

http://stackoverflow.com/q/21056806
has comment: http://stackoverflow.com/comment/31662333
answer count: 1
has title: Is there a way to intercept data on a particular port?
has comment: http://stackoverflow.com/comment/31662424
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31662355
has comment: http://stackoverflow.com/comment/31662389
type: Question
has answer: http://stackoverflow.com/a/21056916
accepted answer: http://stackoverflow.com/a/21056916
tagged with: java
has body: I would like to read all the data that comes via port 8080 even if my application is not the one who requested it. e.g on google chrome, I type www.google.com, I press enter and the incoming packets are read by my app (and google chrome). is there a way to do this?
score: 0

http://stackoverflow.com/a/21120183
answers question: http://stackoverflow.com/q/21120093
downvote count: 0
type: Answer
score: 6
upvote count: 6
has body: C++ std::map is an ordered map, with requirements that mean that it is implemented as a self-balancing binary search tree (usually red-black tree). This means that the key types must have some kind of strict weak ordering, which can come in the form of a less-than operator, or as a user defined comparison functor. There are plenty of SO posts on how to use an std::map with user-defined types as keys (see one example here). C++11 has std::unordered_map, which is a hash table with different requirements on key types (specifically, a hashing function and equality comparison are required)

http://stackoverflow.com/q/21157689
linked to: http://stackoverflow.com/q/304268
tagged with: java
duplicate of: http://stackoverflow.com/q/304268
type: Question
has body: I have wrote a java programme to download a file from FTP server. I need to check are there any corruptions after download the file. so i decided to check md5 of the file before and after download. I need to know how can i generate the md5 hash of this file, before it downloading ?
score: 0
has title: Get md5 hash of a file in ftp server using java
answer count: 1
has comment: http://stackoverflow.com/comment/31846962
tagged with: ftp
has answer: http://stackoverflow.com/a/21157831
type: UnansweredQuestion
tagged with: md5
has comment: http://stackoverflow.com/comment/31846939

http://stackoverflow.com/q/21072156
accepted answer: http://stackoverflow.com/a/21072183
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31690424
upvote count: 3
tagged with: java
has title: Why java String.replaceAll regex removes part of string which it shouldn't?
type: Question
score: 3
has answer: http://stackoverflow.com/a/21072183
answer count: 1
downvote count: 0
favorite count: 0
has body: I want to use regex to remove all characters that are not in range from input string. Here is my code: System.out.print("Input: "); Scanner scan = new Scanner(System.in); String input = scan.next(); scan.close(); String formattedInput = input.replaceAll("[^a-zA-Z]", ""); System.out.println(formattedInput); Here how it works: input: test,test test testtest Why it removed 3rd occurence of test? I wanted him to remove only "," and " " in that particular case.
tagged with: regex

http://stackoverflow.com/a/21051839
answers question: http://stackoverflow.com/q/21051668
has body: You should use the contains method. while((currentLine = reader.readLine()) != null) { // CHANGED EQUALS TO CONTAINS if(trimmedLine.contains(lineToRemove)) continue; writer.write(currentLine); } Good luck!
type: Answer
has comment: http://stackoverflow.com/comment/31652743
has comment: http://stackoverflow.com/comment/31653275
score: 0

http://stackoverflow.com/comment/31714808
type: Comment
comment on: http://stackoverflow.com/q/21084884
type: QuestionComment
has text: I don't believe the Android `Context` object is serializable. Try removing it and run the process again to see if that's the issue
score: 0

http://stackoverflow.com/a/21133479
type: Answer
has body: At the second image you edit cell of your JTable, for saving and getting that value by button click or somthing else action you can add next code before getting value: TableCellEditor cellEditor = table.getCellEditor(); if(cellEditor != null){ cellEditor.stopCellEditing(); } where table is your JTable.
answers question: http://stackoverflow.com/q/21133266
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/21127190
score: 2
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21122447
upvote count: 2
has body: You can use a package diagram and specify the «imports» stereotype on the line between the package containing your class, and the package being imported.

http://stackoverflow.com/q/21060568
type: AnsweredQuestion
tagged with: java
tagged with: scenebuilder
type: Question
upvote count: 32
possible better answer: http://stackoverflow.com/a/24228172
answer count: 3
has title: JavaFX scene builder 2: controller class
accepted answer: http://stackoverflow.com/a/21061669
favorite count: 0
has body: Hi im building a JavaFX project and am using JavaFX Scene Builder 2. I wanted to link my controller to my fxml file but i can't see the possibility to add a controller to my fxml file in Scene Builder 2. I was wondering if someone could help me out. Thank you.
tagged with: javafx-2
downvote count: 0
has answer: http://stackoverflow.com/a/21060801
score: 32
has answer: http://stackoverflow.com/a/21061669
has answer: http://stackoverflow.com/a/24228172

http://stackoverflow.com/q/21131959
has answer: http://stackoverflow.com/a/21132369
accepted answer: http://stackoverflow.com/a/21132369
score: 0
has body: I'm having difficulty trying to create a XML file that could match with this json structure, "properties": { "network_id": { "get_resource": "private_net" }, "fixed_ips": [ { "subnet_id": { "get_resource": "private_subnet" } } ] } My problem is trying to create in XML, the symbols [ ] that appears after the Node "fixed_ips" . What I have tried is this, //This part of the code is in a for loop Element propertiesn = doc.createElement("properties"); serverports.appendChild(propertiesn); Element networkidd = doc.createElement("network_id"); propertiesn.appendChild(networkidd); Element getress = doc.createElement("get_resource"); getress.appendChild(doc.createTextNode("private_net")); networkidd.appendChild(getress); Element fixesips = doc.createElement("fixed_ips"); propertiesn.appendChild(fixesips); Element qq = doc.createElement("qq"); fixesips.appendChild(qq); Element subnetid = doc.createElement("subnet_id"); qq.appendChild(subnetid); Element getresss = doc.createElement("get_resource"); getresss.appendChild(doc.createTextNode("private_subnet"+i6)); subnetid.appendChild(getresss); Element qq2 = doc.createElement("qq"); fixesips.appendChild(qq2); And this is what I got, "properties": { "network_id": { "get_resource": "private_net" }, "fixed_ips": [ { "subnet_id": { "get_resource": "private_subnet1" } }, [] ] } As u see, it's close but not close enough. Any help would be appreciated. Thanks in advance.
answer count: 1
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has title: Create a Nodelist XML in Java
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/a/21069779
has body: In Java method has to have return type (int, Integer, Random) or void if it is not intended to return anything. Add void after public. public void UserNumber() { ... } There is a chance you wanted to create a class constructor, but then its name has to be the same as the class name. For example: public class UserNumber { private final Random randy; public UserNumber() { super(); randy = new Random(); } } (in that case calling super() can be omitted - it is performed anyway) Please provide full code of this class.
score: 2
answers question: http://stackoverflow.com/q/21069753
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/a/21042997
has body: Follow this Step for Windows for Permanent Path setup: 1) My Computer Properties 2) Advanced Option 3) Environment Variable 4) New tab 5) Name= Path 6) Value = C:\Program Files\Java\jdk1.6.0_29\bin 7) Ok EDIT See that you are into c:\Windows\System32 and your admin That's IT now type javac and its DONE
type: Answer
answers question: http://stackoverflow.com/q/21042915
score: 0

http://stackoverflow.com/comment/31723618
has text: What is the complete package name for `JsonType` which you are extending in your `TestUser`?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21086717
type: QuestionComment

http://stackoverflow.com/q/21109340
tagged with: collision-detection
type: Question
has answer: http://stackoverflow.com/a/21109773
tagged with: libgdx
has title: Collision detection management in Libgdx
answer count: 1
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/21109773
favorite count: 0
linked to: http://stackoverflow.com/q/4311034
has body: After reading this: Managing Collision Detection I thought about how to manage it in libgdx as it supports other collision detection (using Intersector) and other classes you can use in game. I have the logic of my Objects with their properties (Zombie for example with moving Speed and health) and the appearance with the Textures, Position on Screen etc.( Zombie2d for example which is a subclass of Actor). The Zombie2d has also a reference to Zombie to have all the attributes of a Zombie. The Question: Should every Actor have a Reference to the Level where all other Objects are stored and detect the collision on his own or should I have a Manager with the Level as reference? Should i do the collision detection inside the Actor.act(delta) method or between Actor.act() and Actor.draw()?
upvote count: 1
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/21052758
has body: Don't create a new MusicGetter - change it to .lookup(File file); and pass it the file. Why are you converting the File to a string path, anyway? Edit Here's what I mean: public class MusicGetter { private final File root; private int count = 0; public MusicGetter(File root) { this.root = root; } public void lookup() { lookup(root); System.out.println("count is: " + count); } private void lookup(File folder) { if (folder == null) return; for (File file : folder.listFiles()) { if (file.isDirectory()) { lookup(file); } else if (file.getName().matches(".*\\.(mp3|wav|flac|m4a|ogg|wma)$")) { System.out.println(file); count++; } } } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21052691

http://stackoverflow.com/comment/31605430
has text: yes, i am using oracle 11g...
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21024895
type: QuestionComment

http://stackoverflow.com/comment/31836989
comment on: http://stackoverflow.com/a/21151748
score: 0
type: AnswerComment
type: Comment
has text: … In effect, the latter constructor allows the user to copy any collection, producing an equivalent collection of the desired implementation type. There is no way to enforce this convention (as interfaces cannot contain constructors) but all of the general-purpose Collection implementations in the Java platform libraries comply."

http://stackoverflow.com/comment/31859127
has text: Not sure if I understood, but, why don't you just create an instance of `CountingBubbleSort`? Then call `setNumbers(...)` (and all required methods) for that instance.
score: 0
comment on: http://stackoverflow.com/q/21164505
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21043796
downvote count: 0
favorite count: 0
tagged with: antlr4
type: UnansweredQuestion
upvote count: 1
has title: Is it possible to export ANTLR4 railroad diagrams as png? If so, how?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22349016
tagged with: antlrworks2
type: Question
has body: I want to export ANTLR4 rules in the railroad format. Please notice that this format is not the same as generated by command line option "-atn". The railroad format is generated by antlrworks, but I'd like to generate this programatically. I am looking for something like http://clapham.sourceforge.net/ clapham generates what I want from BNF. Is there any tool to convert from antlr4 to BNF? (question probably related to Generate BNF diagrams from an antlr grammar?, but notice I am not asking the same thing here. Converting to BNF is just a workaround, what I want is to generate the railroad diagram directly from ANTLR grammar) Following the answer for Generate BNF diagrams from an antlr grammar? worked for me Just get your ANTLR grammar, send to https://www.bottlecaps.de/convert/ and then to https://www.bottlecaps.de/rr/ui ANTLR4 expressions such as "WS : [ \t\r\n]+ -> skip;" could not be processed so I've changed to the traditional form "WS ::= ( #x9 | #xD | #xA )*" Clapham could not work with the BNF grammar generated by https://www.bottlecaps.de/convert/ unfortunately. This is a way to get the diagram, but this is not programatically. I wish I had some JAR I could just add to generate on the fly.
tagged with: grammar
has answer: http://stackoverflow.com/a/21142360
linked to: http://stackoverflow.com/q/18436796
answer count: 2

http://stackoverflow.com/a/21110389
downvote count: 0
has body: You can not respond to the Service Request with more than one response. You'd need to show the search page with the search criterea and have the search page create the excel-file (in an iframe or something).
has comment: http://stackoverflow.com/comment/32022268
answers question: http://stackoverflow.com/q/21108301
type: Answer
accepted answer of: http://stackoverflow.com/q/21108301
has comment: http://stackoverflow.com/comment/31857587
upvote count: 1
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/31692840
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21070942
has text: It depends on how 'character' is declared and what type is realy stored inside. Please add this code and we'll easily eliminate all the compiler warnings.

http://stackoverflow.com/comment/31637426
has text: why are you overriding notifyDataSetChanged???
comment on: http://stackoverflow.com/q/21043783
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31867224
type: Comment
comment on: http://stackoverflow.com/a/21168891
type: AnswerComment
has text: At least `[\s\S]` is a solution that works across different languages.
score: 0

http://stackoverflow.com/comment/41028531
type: QuestionComment
comment on: http://stackoverflow.com/q/21157450
has text: See also http://stackoverflow.com/questions/16196425/java-error-your-security-settings-have-blocked-a-local-application-from-runnin
score: 0
type: Comment

http://stackoverflow.com/comment/31842139
type: QuestionComment
has text: What is the problem you are facing.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21154809

http://stackoverflow.com/q/21076075
tagged with: url
has answer: http://stackoverflow.com/a/21076245
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21076157
score: 0
tagged with: java
has body: I am trying to read the first line of a URL. Then i want to use that as a string later in the code. Anyone can help me? I already tried it with public static String main(String[] args) { try { URL url = new URL("myurlhere"); // read text returned by server BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); String line; while ((line = in.readLine()) != null) { return line; } in.close(); } catch (MalformedURLException e) { System.out.println("Malformed URL: " + e.getMessage()); } catch (IOException e) { System.out.println("I/O Error: " + e.getMessage()); } return null; } I just can't get a string out of it.
type: UnansweredQuestion
has title: Read first text line of an URL

http://stackoverflow.com/a/21150163
upvote count: 1
has body: when n=3 you get func(3) = &gt; return 3 * func(2) + 1 where func(2) is func(2) = &gt; return 3 * func(1) + 1 where func(1) is func(1) = &gt; return 2 once you combine them you get that func(3) =&gt; return 3 * (3 * (2) + 1) + 1 func(3) =&gt; return 22
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21149968
score: 1

http://stackoverflow.com/q/21107699
has title: Convert from string to double removes trailing zeros
has comment: http://stackoverflow.com/comment/31756443
answer count: 4
has answer: http://stackoverflow.com/a/21107850
accepted answer: http://stackoverflow.com/a/21107947
favorite count: 0
has body: I am trying to convert a list of doubles from a string format into a double format. I did this by putting them into a list and using the Double.parseDouble(string) method. This works for most numbers but it gives an unwanted output when the double contains a trailing zero the parseDouble method is removing it. I don't want this to be removed. String[] values = {"124.50", "45.801", "-15.210"}; List&lt;Double&gt; nums = new ArrayList&lt;Double&gt;(); for(String s: values) nums.add(Double.parseDouble(s)); Collections.sort(nums); for(Double d: nums){ System.out.print(d + " "); } This yields the output: -15.21 45.801 124.5 But I want the trailing zeros. The problem with using a formatted line is that I would have to specify the floating point accuracy that I want when printing values, but I don't have any specific desire to make the numbers accurate to a certain point, merely leave the zeros alone if they are there. Am I approaching this wrong?
tagged with: double
possible better answer: http://stackoverflow.com/a/21110407
has answer: http://stackoverflow.com/a/21110407
has comment: http://stackoverflow.com/comment/31756213
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31756178
has comment: http://stackoverflow.com/comment/31756249
tagged with: java
has comment: http://stackoverflow.com/comment/31756226
type: Question
has answer: http://stackoverflow.com/a/21107947
score: 5
upvote count: 5
has answer: http://stackoverflow.com/a/21107801
downvote count: 0
has comment: http://stackoverflow.com/comment/31756220
tagged with: number-formatting
has comment: http://stackoverflow.com/comment/31756152

http://stackoverflow.com/q/21169200
tagged with: java
has comment: http://stackoverflow.com/comment/31871018
has comment: http://stackoverflow.com/comment/31867724
answer count: 2
tagged with: jscrollpane
has body: I have a JTextArea in a small app that shows all the exceptions e.getMessage and other things. However, the JScrollPane does not show the latest results. I have to manually scroll it so that I could see what has just happened. I want it to be exactly like Eclipse Console How can I set up the cursor ? Here is my code publiv void createGUI)( { JTextArea progress = new JTextArea(""); JScrollPane jsp = new JScrollPane(progress); jsp.setBounds(320, 10, 280, 300); j.add(jsp) ; JScrollBar max = jsp.getVerticalScrollBar() ; max.setValue(max.getMaximum() ) ; // I tried this as suggested by Yasmani Llanes, but it did not work ...
downvote count: 0
score: 1
possible better answer: http://stackoverflow.com/a/21169284
favorite count: 0
has comment: http://stackoverflow.com/comment/31868114
accepted answer: http://stackoverflow.com/a/21169627
has answer: http://stackoverflow.com/a/21169284
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31888567
has comment: http://stackoverflow.com/comment/31867764
upvote count: 1
tagged with: swing
has title: How to auto-scroll when text is added to my JScrollPane/JArea?
type: Question
tagged with: caret
has answer: http://stackoverflow.com/a/21169627
has comment: http://stackoverflow.com/comment/31868255
tagged with: jtextarea

http://stackoverflow.com/a/21171391
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31881053
has body: Now, obviously, your example image above does not specify buttons and does not add a label for the message at the bottom. But since it was obvious you intended the user to select those options, I used buttons. The label at the bottom is just to show proof they are buttons (with an action listener attached, to show the message). The advantage of using actual buttons is that they are also keyboard accessible (press Enter to see the first message, press Tab to navigate to the next one... If the game does not need to be keyboard accessible, you can swap those out for labels and add a mouse listener. I'll leave that to you. The code has a lot of comments containing the word 'adjust'. Look at them closely, check the JavaDocs, adjust them as needed.. import java.awt.*; import java.awt.event.*; import java.awt.image.BufferedImage; import javax.swing.*; import javax.swing.border.EmptyBorder; public class GradientPaintBackground { public static void main(String[] args) { Runnable r = new Runnable() { @Override public void run() { // the GUI as seen by the user (without frame) JPanel gui = new JPanel(new BorderLayout(15, 15)) { @Override public void paintComponent(Graphics g) { super.paintComponent(g); Point point1 = new Point(10, 10); Point point2 = new Point( getWidth() - 10, getHeight() - 10); final GradientPaint gp = new GradientPaint( point1, Color.YELLOW, point2, new Color(255, 225, 100), true); // we need a Graphics2D to use GradientPaint. // If this is Swing, it should be one.. final Graphics2D g2 = (Graphics2D) g; g2.setPaint(gp); g.fillRect(0, 0, getWidth(), getHeight()); } }; // adjust size to need. gui.setBorder(new EmptyBorder(20, 20, 20, 20)); // Start: Add components // adjust size to size of logo BufferedImage logo = new BufferedImage( 100, 40, BufferedImage.TYPE_INT_RGB); JLabel logoLabel = new JLabel(new ImageIcon(logo)); gui.add(logoLabel, BorderLayout.NORTH); // adjust spacing to need JPanel menuPanel = new JPanel(new GridLayout(0, 1, 20, 20)); menuPanel.se…
accepted answer of: http://stackoverflow.com/q/21168119
type: Answer
answers question: http://stackoverflow.com/q/21168119
has comment: http://stackoverflow.com/comment/31884653
score: 5
upvote count: 5

http://stackoverflow.com/comment/31841351
score: 0
has text: You are so mistaken it is hard to know where to begin. But I will start with, check [this](http://stackoverflow.com/tags/java-web-start/topusers) & [this](http://stackoverflow.com/tags/applet/topusers)... (I am not just 'plucking this information out of the air'.)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21153707

http://stackoverflow.com/q/21132989
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21133049
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31802007
type: Question
has comment: http://stackoverflow.com/comment/31801937
score: 3
has answer: http://stackoverflow.com/a/21133100
upvote count: 3
answer count: 2
possible better answer: http://stackoverflow.com/a/21133100
favorite count: 0
tagged with: listadapter
tagged with: nullpointerexception
accepted answer: http://stackoverflow.com/a/21133049
tagged with: android
has title: inflater.inflate gives nullpointer in Adapter getview method. Why?
has comment: http://stackoverflow.com/comment/31801997
has comment: http://stackoverflow.com/comment/31801922
linked to: http://stackoverflow.com/q/21133692
has body: In my Android app I'm building my first custom adapter. I now run into a nullpointer at the line in which I inflate the convertView. See the code below: private List&lt;String&gt; possibilitiesList = new ArrayList&lt;String&gt;(); public void setPossibilitiesList(List&lt;String&gt; possibilitiesList) { for (String possibility : possibilitiesList) { addItem(possibility); } } public void addItem (final String item) { possibilitiesList.add(item); notifyDataSetChanged(); } private LayoutInflater inflater; @Override public View getView(final int position, View convertView, ViewGroup viewGroup) { Log.e(this, "is called here!!"); ViewHolder holder = new ViewHolder(); convertView = inflater.inflate(R.layout.list_item_posibility, viewGroup, false); holder.possibilityTitle = (TextView) convertView.findViewById(R.id.text_possibility); holder.possibilityTitle.setText(possibilitiesList.get(position)); return convertView; } and in my fragment I set the possibilitiesList as follows: List&lt;String&gt; list = Arrays.asList(getResources().getStringArray(R.array.the_possibilities)); Log.e(this, new Integer(list.size()).toString()); // outputs 8 adapter.setPossibilitiesList(list); I am 100% sure that the list_item_posibility.xml exists (Android Studio also highlights is as being existing), so I'm kinda lost on why this gives a nullpointer. Does anybody know what I could be doing wrong here?

http://stackoverflow.com/comment/31892484
type: Comment
comment on: http://stackoverflow.com/a/21182936
score: 0
type: AnswerComment
has text: int currentCount = getConnectionCount(); setConnectionCount(currentCount + 1); getAndParseNotes(lvPropertyNotes); --> getAndParseNotes() calls the Thread...

http://stackoverflow.com/comment/31887999
type: QuestionComment
comment on: http://stackoverflow.com/q/21179911
has text: You can't randomly select a class to debug without setting a breakpoint before starting the debugging.
score: 0
type: Comment

m2e
type: Tag
tag name: m2e
tags question: http://stackoverflow.com/q/21090664

http://stackoverflow.com/comment/31824976
type: QuestionComment
has text: sort the list, then take the first and last values.
comment on: http://stackoverflow.com/q/21145630
score: 0
type: Comment

http://stackoverflow.com/q/21175329
has answer: http://stackoverflow.com/a/21175390
has answer: http://stackoverflow.com/a/21175351
has comment: http://stackoverflow.com/comment/31879300
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/21175415
has comment: http://stackoverflow.com/comment/31879307
upvote count: 1
has answer: http://stackoverflow.com/a/21175447
has answer: http://stackoverflow.com/a/21175363
tagged with: java
has body: if a input a number, how do i count the multiples of that inputted number until 100. For example if i input the number 8 It would print out 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96
score: -1
has answer: http://stackoverflow.com/a/21175420
type: Question
answer count: 7
has answer: http://stackoverflow.com/a/21175425
favorite count: 0
has title: Programming Help-Finding and Printing multiples
has comment: http://stackoverflow.com/comment/31879661

http://stackoverflow.com/q/21181614
has answer: http://stackoverflow.com/a/21186664
tagged with: android
has comment: http://stackoverflow.com/comment/31890609
has comment: http://stackoverflow.com/comment/31890880
has comment: http://stackoverflow.com/comment/31890623
has comment: http://stackoverflow.com/comment/31890625
has comment: http://stackoverflow.com/comment/31890594
has comment: http://stackoverflow.com/comment/31891471
upvote count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/21186664
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31890372
has title: Android SharedPreferences Multiple values in Multiple Activities
tagged with: java
tagged with: sharedpreferences
has comment: http://stackoverflow.com/comment/31890463
has comment: http://stackoverflow.com/comment/31890415
has comment: http://stackoverflow.com/comment/31890653
has comment: http://stackoverflow.com/comment/31891007
type: Question
score: 0
has comment: http://stackoverflow.com/comment/31890567
has comment: http://stackoverflow.com/comment/31890575
answer count: 1
linked to: http://stackoverflow.com/q/10150899
has comment: http://stackoverflow.com/comment/31890424
favorite count: 0
has comment: http://stackoverflow.com/comment/31891127
has comment: http://stackoverflow.com/comment/31891110
has body: In my android application I used sharedpreference to store values in two activites like in first activity to store the values of login. So once user logs in, his username and password is saved and he will be routed to calculation activity, where user needs to fill his data inside several edittexts here I used second shared preference to store the edittext value. On pressing the show report button, user is directed to the next page that is daily prediction. So next time when user want to see the prediction, if he has logged in then he needs to skip the above said two activities and display the result. In my case I am able to achieve the login process correctly, but I used the second sharedpreference to store the edittext value the app is crashing. I am giving my code below. first activity .. login activity protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.directcalc_xm); /* * Check if we successfully logged in before. * If we did, redirect to calculation page */ SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); if (settings.getString("logged", "").toString().equals("logged") &amp;&amp; settings.getString("log", "").toString().equals("log")) { Intent intent = new Intent(DirectCalculation.this, FullExplanationEntry.class); startActivity(intent); } else { btn1 = (Button) findViewById ( R.id.button1); btn2 = (Button) findViewById ( R.id.button2); btn1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(DirectCalculation.this, SignInActivity.class); startActivity(intent); } }); btn2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent in = new Intent(DirectCalculation.this, SignUpActivity.class); startActivity(in); } }); } second Activity .. calculation …

http://stackoverflow.com/q/21163523
has body: I am creating a user macro for Confluence used for inline commenting. The user will be able to enter some text related to a certain paragraph and this information is then saved. My current problem is that I don't know where or how to save the information entered by the user through this macro. My idea was to modify the $body of the macro through the macro but I have found no way to do this. I have created a function that is supposed to save this data (somewhere): function post_reply() { var f = document.getElementById("comment_content"); var g = document.getElementById("new_comment"); $body += "&lt;br&gt; $action.remoteUser.fullName: " + f.value; f.value=""; g.style.display= "none"; } This does not work so I need your help.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21174133
upvote count: 1
tagged with: confluence
score: 1
tagged with: java
tagged with: wiki
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/79207538
has title: How can I save data entered through a user macro in Confluence?
favorite count: 0

http://stackoverflow.com/comment/31818061
has text: Does IntelliJ have any suggestions for what classes that it's indicating are in error in the tests?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21141593

http://stackoverflow.com/comment/31667253
comment on: http://stackoverflow.com/q/21059675
has text: are u getting an exception or an error?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21129056
tagged with: hsqldb
has title: Preparing a compare query between two database tables with similar columns
has comment: http://stackoverflow.com/comment/31844238
has answer: http://stackoverflow.com/a/21174945
has comment: http://stackoverflow.com/comment/31841765
type: AnsweredQuestion
tagged with: java
has body: Given two tables each having n columns where 1 to n-1 columns are the columns which together form a unique key and the nth column is the value column, how can I create a generalized query in my java program which outputs 1 to n-1 columns, nth column of first table, nth column of second table and the difference of the nth column of the two tables. For e.g. when n = 2, that is when given tables have two columns where first column is the key and the second column is the value, my query would be like: SELECT COALESCE(A.COL1, B.COL1) AS COL1, CAST(A.VALCOL AS DECIMAL(18,2)) AS SRC_TAB_VALUE, CAST(B.VALCOL AS DECIMAL(18,2)) AS TRGT_TAB_VALUE, CAST(CAST(A.VALCOL AS DECIMAL(18,2)) - cast(B.VALCOL AS DECIMAL(18,2)) AS DECIMAL(18,2)) AS DIFF_OF_VAL FROM SCHEMA1.TAB1 A FULL JOIN SCHEMA2.TAB2 B ON A.COL1 = B.COL1 ORDER BY COL1 I am preparing above query in my Java program. The diff query above runs against two in memory HSQL tables. But how can I generalize this query when the number of key columns are greater then 1. e.g. given two tables with 5 columns each, the combination of first 4 columns will create a unique key while the fifth column would be the value of that key which is to be compared. Thanks for reading!
type: Question
accepted answer: http://stackoverflow.com/a/21174945
tagged with: db2
possible better answer: http://stackoverflow.com/a/21129999
has answer: http://stackoverflow.com/a/21129999
score: 0
answer count: 2
tagged with: sql

http://stackoverflow.com/comment/31819162
type: AnswerComment
has text: @user3198936: Now that you've included the message... which is line 62? Where are you declaring `library` and how are you initializing it?
type: Comment
comment on: http://stackoverflow.com/a/21142431
score: 0

http://stackoverflow.com/comment/31675867
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21064295
has text: Where `ele5` is declared?
type: Comment

http://stackoverflow.com/comment/46930975
type: Comment
has text: lookupuri does not work for thumbnail images on lower android versions (tested on API level 15). Thankyou for mentioning that!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21214524

http://stackoverflow.com/comment/31880421
has text: Why did you post [the same question](http://stackoverflow.com/q/21175710/642706) under two titles inside of an hour?
score: 0
comment on: http://stackoverflow.com/q/21175104
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24063366
type: Answer
accepted answer of: http://stackoverflow.com/q/21018812
answers question: http://stackoverflow.com/q/21018812
type: AcceptedAnswer
has body: Steps to resolve in my case: -create jar per applet -create jnlp file per applet outside jar file -still you need jnlp in jar file in JNLP-INF -set properties in manifest -then sign every lib and jar with cert
score: 0

http://stackoverflow.com/a/21120645
accepted answer of: http://stackoverflow.com/q/21096413
has comment: http://stackoverflow.com/comment/33594055
score: 1
answers question: http://stackoverflow.com/q/21096413
upvote count: 1
has comment: http://stackoverflow.com/comment/31786839
has body: The arguments for the polygon shape are "half-width" and "half-height". It's one of the strange carry-overs from box2d (see the manual here), and not the most intuitive behavior. Try: cs.setAsBox(width / 2, height / 2);
has comment: http://stackoverflow.com/comment/31799927
has comment: http://stackoverflow.com/comment/32090900
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31783774
type: Answer

http://stackoverflow.com/comment/31692666
has text: @peeskillet the groupId should not have any effect on compilation. The archetype plugin however creates a default class in a package which is the same as the groupId
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21072378
type: QuestionComment

http://stackoverflow.com/comment/31758615
comment on: http://stackoverflow.com/a/21088525
has text: I'd normally do that, but there's a specific case of invoking an external application from within the managed bean, and the invoker method also has to be accessible via a web service.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/21141183
has comment: http://stackoverflow.com/comment/31819235
has comment: http://stackoverflow.com/comment/31821150
has comment: http://stackoverflow.com/comment/31821592
tagged with: log4j
has comment: http://stackoverflow.com/comment/31816349
has body: why log4j.xml unable to read values of tags? iam getting below exception: log4j:ERROR setFile(null,false) call failed. java.io.FileNotFoundException: \debug.log (Access is denied) log4j.xml <?xml version="1.0" encoding="UTF-8" ?> <log4j:configuration debug="true" xmlns:log4j='http://jakarta.apache.org/log4j/'> D:/logs <level value="INFO" /> <appender-ref ref="consoleAppender" /> <appender-ref ref="fileAppender" /> </log4j:configuration> please suggest me what went wrong? EDIT: Iam pretty sure the prob is not about permissions, since when I use directly as then its working fine for me.. now please tell me what could be the actual issue for it? why log4j.cml can't read property value when used ${somepropertyname}
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21175846
has answer: http://stackoverflow.com/a/21142219
tagged with: logging
tagged with: java
tagged with: log4j2
type: Question
answer count: 2
has title: why log4j.xml unable to read values of its own property tags
tagged with: log4net
score: 0

http://stackoverflow.com/q/21051516
has comment: http://stackoverflow.com/comment/31652314
score: 0
answer count: 2
upvote count: 1
downvote count: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/31652133
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31653155
has comment: http://stackoverflow.com/comment/31652200
tagged with: backbone.js
has answer: http://stackoverflow.com/a/21051616
has title: Automatic Conversion of JSON to Java Object
type: Question
favorite count: 0
has answer: http://stackoverflow.com/a/45346732
has body: I was wondering if there is any way or library which allows the automatic conversion of json strings to java objects ? i.e. similar functionality provided by Backbone for javascript. I am fully aware you can do it step by step for each field using something like: JSONObject json = new JSONObject(jsonString); String body = json.get("body").toString; However I have many json files to convert and manually typing out the code for ever object I need seems tedious. Is there anyway to do it autonomously ? I.e. provide an object template which can be populated regardless of it's fields ?
has comment: http://stackoverflow.com/comment/31655941
has comment: http://stackoverflow.com/comment/31652132

http://stackoverflow.com/comment/31680483
has text: neoprez --- I declared as you said but also had to make it static, inluding GetRoute. Yes it compiles, now! but the value is null in DBaccess though. Cannot make the query!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21066369
score: 0

http://stackoverflow.com/comment/31795162
type: QuestionComment
has text: Those who put the question on hold have way, way more reputation than I do, but I wonder whether this question should be allowed despite being borderline. The question is vague, and the answers may be all over the place, but OP has a very practical question, and needs some guidance in order to get to a more concrete question or questions. (Or maybe the question should be moved to Programmers.SE.)
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21109294

http://stackoverflow.com/comment/31846153
type: Comment
score: 0
type: AnswerComment
has text: have to ? why onCreate/onPause?
comment on: http://stackoverflow.com/a/21157275

http://stackoverflow.com/a/21137647
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21134759
downvote count: 0
score: 1
has body: use android:inputType="textPassword" Ex:

http://stackoverflow.com/comment/31780664
type: Comment
has text: @SotiriosDelimanolis Confusion with type erasure?
type: QuestionComment
comment on: http://stackoverflow.com/q/21121256
score: 0

http://stackoverflow.com/comment/31778493
has text: There is no correct way as JAR files are basically ZIP files which do not have directories. Some tools create empty files within the ZIP/JAR file as pseudo directory entries but you should not rely on that. There’s no feature like listing the contents of such a directory entry anyway.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/21119514
type: QuestionComment

http://stackoverflow.com/a/21087418
type: Answer
has comment: http://stackoverflow.com/comment/31727896
has comment: http://stackoverflow.com/comment/31727031
has body: You can do some simple things. At first i would log the Memory when switching the Screens like this to see if you are right that the application memory(not the VM!) growth: static class MySecurityManager extends SecurityManager { public String getCallerClassName(int callStackDepth) { return getClassContext()[callStackDepth].getName(); } } private static Runtime runtime = Runtime.getRuntime();; private static final long KILOBYTE = 1024L; private static MySecurityManager securityManager = new MySecurityManager(); public static long bytesToMegabytes(long bytes) { return bytes / KILOBYTE; } public static void CurrentMemoryUsage() { long memory = runtime.totalMemory() - runtime.freeMemory(); Gdx.app.log("[LOG] " + securityManager.getCallerClassName(2), " Used memory: " + bytesToMegabytes(memory) + "kb"); } Everywhere you call the static Logger.CurrentMemoryUsage() it does automaticaly log the calling class (securityManager.getCallerClassName(2)) and the current memory usage. (Take care this isn't the fastest way to log! Getting the caller class can be slow but this is already the fastest way for it. I think it's really usefull. see how to get the calling class) After a switch call the Gabagecollector by using the System.gc(). This does a deep gabage collecting which does take some Time so just call it when there is no problem if it does take time. (mapswitch, screenchanges and so on) The last thing i can recomend to check your memory is using the jconsole.exe from the java sdk. C:\Program Files (x86)\Java\jdk1.7.0_45\bin\jconsole.exe Start your application in desktop-mode and connect to it with the jconsole and you can see how much RAM and so on it does use. You can even see how much classes are currently created and much more. Take a look at teh graph at your memory while the application is in use to see if it really rises or if you just have the regulare up and downs of the memory. If it does rise take a look at your objects if you do create objects inside of your rend…
has comment: http://stackoverflow.com/comment/31728659
answers question: http://stackoverflow.com/q/21068345
score: 0

http://stackoverflow.com/a/21075246
upvote count: 1
has body: int diff = (int) start - stop; is equal to int diff = (int) (long) start - (long) stop; // we substract long types can be simplified to int diff = (int) start - (long) stop; // (int)(long) x means (int) x is equal to int diff = ((int) start) - (long) stop; // casting is applied only to start is equal to int diff = ((long)(int) start) - (long) stop; // compiler make types equal can be simplified to int diff = (long) start - (long) stop; // we can substract now is equal to int diff = (long) startMinusStop; // because long - long =&gt; long and here we are readable error Type mismatch: cannot convert from long to int.
answers question: http://stackoverflow.com/q/21075215
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/21066413
type: Question
answer count: 2
has title: How to use a cached json string with gson?
downvote count: 0
tagged with: serialization
has answer: http://stackoverflow.com/a/21066487
accepted answer: http://stackoverflow.com/a/21066487
has body: I have a class that holds onto a cached json string: class Foo { private transient String cachedJson; // value = [ "john", "mary" ] private List&lt;String&gt; names; } when I go to serialize an instance of the Foo class using gson, is there a way I could have a custom serializer, and just write the cached string for the "names" field instead of having the serializer re-serialize everything again? Something like: public class CustomParserFoo implements JsonSerializer&lt;Foo&gt; { @Override public JsonElement serialize(Foo src, Type typeOfSrc, JsonSerializationContext context) { JsonObject element = new JsonObject(); if (src.cachedJson != null) { // cached value present, use it. element.addProperty("names", src.cachedJson); } else { // have to really serialize it. element.addProperty("names", ...); } return element; } } The problem with the above is that gson will try to escape the string you supply (which is already json-escaped). The use case is something like having a very large object, and only one field might change, and you have to serialize it often - so it'd be nice to not have to re-serialize the entire object, only the attributes that have changed. Thanks
possible better answer: http://stackoverflow.com/a/30811549
favorite count: 0
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: gson
has answer: http://stackoverflow.com/a/30811549

http://stackoverflow.com/comment/31628664
has text: Oh I see, did you make sure the support library was added to the project. Right click --> Android Tools --> Add Support Library
type: Comment
comment on: http://stackoverflow.com/a/21038107
score: 0
type: AnswerComment

http://stackoverflow.com/a/21468744
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21118477
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21118477
has body: You could try installing Oracle 'official' binaries and guidance on how to do that for Ubuntu can be found here. It uses update-alternatives which is a Debian tool and hence will be available in Ubuntu to point to the Oracle JRE installation.
type: Answer

http://stackoverflow.com/comment/31766971
score: 0
type: Comment
has text: Also change the var name 'Place' to lower case.
type: AnswerComment
comment on: http://stackoverflow.com/a/21113876

indexoutofboundsexception
tags question: http://stackoverflow.com/q/21077831
tags question: http://stackoverflow.com/q/21062427
tags question: http://stackoverflow.com/q/21075501
tag name: indexoutofboundsexception
tags question: http://stackoverflow.com/q/21070392
tags question: http://stackoverflow.com/q/21039999
tags question: http://stackoverflow.com/q/21101614
tags question: http://stackoverflow.com/q/21100881
type: Tag

http://stackoverflow.com/a/21021192
downvote count: 0
has comment: http://stackoverflow.com/comment/31597380
has comment: http://stackoverflow.com/comment/31912281
has comment: http://stackoverflow.com/comment/31598911
type: Answer
answers question: http://stackoverflow.com/q/21019536
has comment: http://stackoverflow.com/comment/31649628
accepted answer of: http://stackoverflow.com/q/21019536
score: 1
upvote count: 1
has body: That's because you are not parsing data correctly. It is returning zero elements. I have modified you parsing code. The following code extracts all the options of Comune di Partenza. Use the following code in your try block doc = Jsoup.connect(BLOG_URL).get(); Elements nodeBlogStats = doc.select("#comunePartINI &gt; option"); for(Element sezione : nodeBlogStats) { titoli.add(sezione.text()); } Also its a good practice to return the result from asynctask and use it in onPostExecute rather than defining a field of a class and then modifying it.
has comment: http://stackoverflow.com/comment/31952336
has comment: http://stackoverflow.com/comment/31878958
type: AcceptedAnswer

http://stackoverflow.com/comment/31669502
comment on: http://stackoverflow.com/q/21060882
type: Comment
type: QuestionComment
has text: If you are just going to check, `"[\\d\\s]"` would be enough.
score: 0

http://stackoverflow.com/comment/31627421
has text: do you mean singletons of other classes or of the same class?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21037746

http://stackoverflow.com/comment/31829874
score: 0
type: Comment
type: QuestionComment
has text: as the others already pointed out, you can use the `string.charAt(index)` method to return you the character you are pointing at. All you have to do is loop through all characters of your string and test if they are 1 or 0 .. or what ever you may expect. But if you want the hints to be more concrete I can give you some code of course
comment on: http://stackoverflow.com/q/21147673

http://stackoverflow.com/comment/31826572
comment on: http://stackoverflow.com/q/21139921
score: 0
has text: You will need to post your stack trace with the crash exception, so we can see whats going on.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31874025
comment on: http://stackoverflow.com/q/21170551
type: Comment
score: 0
has text: Any ideas/suggestions? (it's one of the primary issues I'm having)
type: QuestionComment

http://stackoverflow.com/q/21093654
has comment: http://stackoverflow.com/comment/31753785
has body: I have models: Switch: @Entity public class Switch extends Model { /** Management IP */ public String managementIP; /** Hostname description, e.g. lan-bc-sw2 */ public String hostname; /** Switch state, e.g. active */ public String status; /** Swith model, e.g. C2960-48TS-L */ public String model; /** IOS version */ public String osVersion; /** Switch ports */ @OneToMany public List&lt;Port&gt; ports; ... Port: @Entity public class Port extends Model { /** Switch port id, e.g. Gi0/1 */ public String portID; /** Switch port description */ public String description; /** Switch port type, e.g. 10/100BaseTX */ public String type; /** Switch port VLAN */ @ManyToOne public VLAN vlan; /** Is switch port int trunk mode? */ public boolean isTrunk = false; /** Switch port speed */ public String speed; /** Switch port duplex mode */ public String duplex; /** Port state */ public String state; /** Port security*/ @OneToOne public PortSecurity portSecurity; ... VLAN: @Entity public class VLAN extends Model { /** VLAN id, e.g. 5 */ public int vlanID; /** VLAN description */ public String description; /** VLAN status, e.g. active */ public String state;` .... Pass to template: public static void index(long switch_id) { Switch sw = Switch.findById(switch_id); render(sw); } Then, when i try to get VLAN from port: #{list items:sw.getPorts(), as:'port'} &lt;tr&gt; &lt;td&gt;${port.portID}&lt;/td&gt; &lt;td&gt;${port.description}&lt;/td&gt; &lt;td class="center"&gt; &lt;td&gt;${port.vlan.state}&lt;/td&gt; .... Im getting: Execution error occured in template /app/views/Switches/index.html. Exception raised was NullPointerException : Cannot get property 'state' on null object. But, if i do port.vlan.toString(), im getting all VLAN fields with correct data! Help, please...
score: 0
tagged with: java
answer count: 0
type: UnansweredQuestion
type: Question
tagged with: playframework
has title: Nested models in Play Framework 1.2.7 templates
has comment: http://stackoverflow.com/comment/31757063
has comment: http://stackoverflow.com/comment/31755827

http://stackoverflow.com/q/21083170
linked to: http://stackoverflow.com/q/36357135
has answer: http://stackoverflow.com/a/45409395
type: Question
has answer: http://stackoverflow.com/a/37220486
tagged with: application.properties
score: 1104
has answer: http://stackoverflow.com/a/62713218
has answer: http://stackoverflow.com/a/73688839
has answer: http://stackoverflow.com/a/77581092
has answer: http://stackoverflow.com/a/33506475
has answer: http://stackoverflow.com/a/55744297
has answer: http://stackoverflow.com/a/57731887
has answer: http://stackoverflow.com/a/39526976
has answer: http://stackoverflow.com/a/52817244
has answer: http://stackoverflow.com/a/47223314
has comment: http://stackoverflow.com/comment/84370445
has comment: http://stackoverflow.com/comment/88992302
has answer: http://stackoverflow.com/a/66370832
has answer: http://stackoverflow.com/a/65153632
has answer: http://stackoverflow.com/a/63259079
has answer: http://stackoverflow.com/a/78301675
has answer: http://stackoverflow.com/a/53861348
has answer: http://stackoverflow.com/a/35157801
has answer: http://stackoverflow.com/a/56452178
has title: How to configure port for a Spring Boot application
has answer: http://stackoverflow.com/a/71924982
has answer: http://stackoverflow.com/a/38667712
has answer: http://stackoverflow.com/a/58538147
has body: How do I configure the TCP/IP port listened on by a Spring Boot application, so it does not use the default port of 8080.
has answer: http://stackoverflow.com/a/65828231
has answer: http://stackoverflow.com/a/50412178
has answer: http://stackoverflow.com/a/42970422
has answer: http://stackoverflow.com/a/43582675
tagged with: port
downvote count: 1
linked to: http://stackoverflow.com/q/47198100
has answer: http://stackoverflow.com/a/30249389
has answer: http://stackoverflow.com/a/65795203
has answer: http://stackoverflow.com/a/36067066
has answer: http://stackoverflow.com/a/61126136
has answer: http://stackoverflow.com/a/36855591
has answer: http://stackoverflow.com/a/67560321
has answer: http://stackoverflow.com/a/68613020
has answer: http://stackoverflow.com/a/27280069
has answer: http://stackoverflow.com/a/74134746
has answer: http://stackoverflow.com/a/55869404
has answer: http://stackoverflow.com/a/44868307
favorite count: 0
accepted answer: http://stackoverflow.com/a/21083284
has answer: http://stackoverflow.com/a/45916424
has answer: http://stackoverflow.com/a/61794227
has answer: http://stackoverflow.com/a/56766604
has comment: http://stackoverflow.com/comment/102935227
has answer: http://stackoverflow.com/a/32836692
has answer: http://stackoverflow.com/a/77109784
has comment: http://stackoverflow.com/comment/139514696
has answer: http://stackoverflow.com/a/42525966
answer count: 65
has comment: http://stackoverflow.com/comment/107271692
has answer: http://stackoverflow.com/a/56200225
has answer: http://stackoverflow.com/a/76955833
has answer: http://stackoverflow.com/a/48455873
has answer: http://stackoverflow.com/a/45704995
has answer: http://stackoverflow.com/a/71567809
has answer: http://stackoverflow.com/a/21088820
has answer: http://stackoverflow.com/a/36658166
has answer: http://stackoverflow.com/a/44240986
has answer: http://stackoverflow.com/a/47198167
has answer: http://stackoverflow.com/a/36387906
has answer: http://stackoverflow.com/a/21083284
has answer: http://stackoverflow.com/a/52822248
has answer: http://stackoverflow.com/a/40115381
linked to: http://stackoverflow.com/q/36217949
type: AnsweredQuestion
tagged with: spring-boot
has answer: http://stackoverflow.com/a/36865796
tagged with: server
has answer: http://stackoverflow.com/a/44248717
has answer: http://stackoverflow.com/a/37878580
has answer: http://stackoverflow.com/a/40799750

postorder
type: Tag
tags question: http://stackoverflow.com/q/21173541
tag name: postorder

http://stackoverflow.com/comment/31645679
type: Comment
comment on: http://stackoverflow.com/a/21048167
has text: You could use a JSON encoder, for example gson. Personally I do all exchanges java-js in JSON.
score: 0
type: AnswerComment

http://stackoverflow.com/q/21090915
has body: The global build of our application (30 Maven modules) is taking too much time (15 minutes). This includes units and integration tests. The majority of the time is consumed by the integrations tests (60%). Our tech stack comprises of Spring, Spring MVC, Spring Batch etc. and Maven. Our developers are not motivated to keep this practice (Build All before commit) Since I want to improve the build time I am suggesting these scenarios: Parallel build : mvn -T 1C is not going to work as this consumes all resources of developer machine which prevents the developer from doing other things. Organize module by profile (front, batch, connector, commons) is not going to work either as our modules are inter-dependent and we must do the build all. Do you have some suggestions to improve the build time of large projects? Thanks in advance.
has answer: http://stackoverflow.com/a/21091014
tagged with: spring-batch
score: 12
has answer: http://stackoverflow.com/a/21091183
has comment: http://stackoverflow.com/comment/31724579
favorite count: 0
upvote count: 12
has title: The maven build takes too long
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21091030
has comment: http://stackoverflow.com/comment/31724707
tagged with: maven
has comment: http://stackoverflow.com/comment/31724717
tagged with: spring
has comment: http://stackoverflow.com/comment/31724502
tagged with: spring-mvc
downvote count: 0
has answer: http://stackoverflow.com/a/25688743
tagged with: java
has comment: http://stackoverflow.com/comment/31724899
has comment: http://stackoverflow.com/comment/31724575
has answer: http://stackoverflow.com/a/21091021
linked to: http://stackoverflow.com/q/161698
type: Question
has comment: http://stackoverflow.com/comment/31730697

http://stackoverflow.com/q/21045119
type: Question
has answer: http://stackoverflow.com/a/21045293
accepted answer: http://stackoverflow.com/a/21045459
linked to: http://stackoverflow.com/q/11369171
has answer: http://stackoverflow.com/a/21045446
tagged with: image
answer count: 3
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31642535
has body: I've been struggling to get an image to show up for some time now. Ive read a few different things, and all of them seem to have different ways of showing images. Can someone tell me what I'm doing wrong? I'm trying to make a program that uses 2 classes to make a picture show up in a frame. I guess what I don't understand still is what a Graphics object is, what a Graphics2D object is and how its different, and what method from what class do I call in order to make an image show up. Here is my code: public class Smiley { private BufferedImage smileyFace; private Graphics2D renderWindow; private Dimension smileyPosition; private File smileyFile; public Smiley() { try{ smileyFile = new File("C:\\Users\\MyName\\Desktop\\smiley.png"); smileyFace = ImageIO.read(smileyFile); } catch (Exception e){ System.out.println("There was an error finding or reading the file \" smiley.png.\""); } MainScreen.graphicPane.drawImage(smileyFace,50,50, null); } and the second class: public class MainScreen extends JFrame{ public static MainScreen ms; public static Graphics2D graphicPane; public static void main (String[] args){ MainScreen ms = new MainScreen(); Smiley newSmiley = new Smiley(); } public MainScreen(){ super("Main Screen Window"); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setVisible(true); this.setSize(500,800); this.getContentPane().setBackground(Color.black); graphicPane = (Graphics2D) this.getContentPane().getGraphics(); } } the program compiles with no errors and nothing is reported back to me about not finding the file.
linked to: http://stackoverflow.com/q/9864267
has title: Making an image show up in Java
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/21045459
tagged with: swing
tagged with: bufferedimage
possible better answer: http://stackoverflow.com/a/21045293

http://stackoverflow.com/comment/31686189
has text: You may be interested to know that with java 8 (which I think is released next month) you can achieve a safe form of multiple inheritance as interfaces are being allowed [default methods](http://cr.openjdk.java.net/~dlsmith/jsr335-0.6.2/H.html) whereby interfaces can have method bodies which are used unless the implementing class provides its own implementation
score: 3
comment on: http://stackoverflow.com/q/21068902
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31643504
type: QuestionComment
comment on: http://stackoverflow.com/q/21047100
score: 1
has text: Choosing the correct epsilon depends very much on what's already happened in your computation (errors accumulate). So I doubt there is a credible library that satisfies this.
type: Comment

http://stackoverflow.com/comment/31801549
score: 1
comment on: http://stackoverflow.com/q/21132692
type: Comment
type: QuestionComment
has text: @ThomasMueller Good catch there

http://stackoverflow.com/comment/31850138
comment on: http://stackoverflow.com/q/21159428
score: 0
type: Comment
type: QuestionComment
has text: You are going to have one database still.. isnt it ?

http://stackoverflow.com/q/21143768
has comment: http://stackoverflow.com/comment/31821817
type: Question
tagged with: libgdx
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/21154363
tagged with: ascii-art
has body: I'm writing a 3D game that is drawn with ASCII art just to achieve a special look. I render my models to a ModelBatch and now I would like to convert every pixel to an ASCII symbol before drawing the final result to the screen. I already have the code to convert pixels to ASCII, but I have no idea how to get the pixels of the render result. Code so far (not including the ASCII convertation): import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.GL10; import com.badlogic.gdx.graphics.PerspectiveCamera; import com.badlogic.gdx.graphics.VertexAttributes.Usage; import com.badlogic.gdx.graphics.g3d.Model; import com.badlogic.gdx.graphics.g3d.ModelBatch; import com.badlogic.gdx.graphics.g3d.ModelInstance; import com.badlogic.gdx.graphics.g3d.materials.ColorAttribute; import com.badlogic.gdx.graphics.g3d.materials.Material; import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder; public class MyGame implements ApplicationListener { private PerspectiveCamera cam; private ModelBatch batch; public Model model; public ModelInstance instance; @Override public void create() { //float w = Gdx.graphics.getWidth(); //float h = Gdx.graphics.getHeight(); cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); cam.position.set(10f, 10f, 10f); cam.lookAt(0,0,0); cam.near = 0.1f; cam.far = 300f; cam.update(); batch = new ModelBatch(); ModelBuilder modelBuilder = new ModelBuilder(); model = modelBuilder.createBox(5f, 5f, 5f, new Material(ColorAttribute.createDiffuse(Color.GREEN)), Usage.Position | Usage.Normal); instance = new ModelInstance(model); } @Override public void dispose() { batch.dispose(); model.dispose(); } @Override public void render() { Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); batch.begin(cam); batch.render(instance); batch.end(); } @Override public vo…
favorite count: 0
has title: LibGDX - modify pixels after rendering a 3D scene
accepted answer: http://stackoverflow.com/a/21154363
upvote count: 1
has comment: http://stackoverflow.com/comment/31821444
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31821338
tagged with: render
has comment: http://stackoverflow.com/comment/31822191

http://stackoverflow.com/comment/31706065
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21080419
type: Comment
has text: It doesn't look like that exception is related to the code you've posted.

http://stackoverflow.com/comment/31772046
type: AnswerComment
type: Comment
has text: @XtremeBiker That's precisely what the includeViewParams=true bit of the redirect does. All view parameters of the current page are automatically added to the redirect when this parameter is included in the outcome.
score: 0
comment on: http://stackoverflow.com/a/21102125

webserver
tags question: http://stackoverflow.com/q/21154295
tag name: webserver
type: Tag
tags question: http://stackoverflow.com/q/21040219
tags question: http://stackoverflow.com/q/21082602
tags question: http://stackoverflow.com/q/21095573

http://stackoverflow.com/a/21078203
has body: from Oracle web site : "..reading from a URLConnection instead of reading directly from a URL might be more useful. This is because you can use the URLConnection object for other tasks (like writing to the URL) at the same time."
answers question: http://stackoverflow.com/q/21078040
score: 0
type: Answer

http://stackoverflow.com/q/21041322
score: 0
has title: How to replace fragment from array
tagged with: java
accepted answer: http://stackoverflow.com/a/21041474
type: AnsweredQuestion
tagged with: arrays
type: Question
tagged with: android
has body: I don't get this.. I'm trying to use transaction.replace to replace one fragment with another, using an arrayAdapter. The value in the array is a com.example.package.fragment- address. But I can't figure out how to actually replace the fragment. If I try to use the code below with these lines: FragmentTransaction transaction = getFragmentManager() .beginTransaction(); transaction.replace(R.id.fragment_container, Fragment.instantiate(this, getResources().getStringArray(R.array.adressLista[position]))); transaction.commit(); I get "The type of the expression must be an array type but it resolved to int". But if I use the same R.array to replace text in a TextView, like this: TextView infoText = (TextView) getActivity().findViewById(R.id.fragmentTextView); infoText.setText(getResources().getStringArray(R.array.adressLista)[position]); Then the text shown is the com.example. address. How do I replace the Fragment? Codes: VisaFragment (The error is on the 11th row From the Bottom): import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; public class VisaFragment extends Fragment { static final String ARG_POSITION = "position"; int mCurrentPosition = -1; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){ if (savedInstanceState != null){ mCurrentPosition = savedInstanceState.getInt(ARG_POSITION); } return inflater.inflate(R.layout.om_sida, container, false); } @Override public void onStart(){ super.onStart(); System.out.println("VisaFragment onStart"); Bundle argument = getArguments(); if (argument != null){ visaFragmentArgument(argument.getInt(ARG_POSITION)); }else if (mCurrentPosition != -1){ visaFragmentArgument(mCurrentPosition); } } public void visaFragmentArgument(int position) { System.out.println("VisaFragment VisaFragmentArg…
has answer: http://stackoverflow.com/a/21041474
possible better answer: http://stackoverflow.com/a/21041511
answer count: 2
has answer: http://stackoverflow.com/a/21041511
tagged with: android-fragments

http://stackoverflow.com/a/21079429
accepted answer of: http://stackoverflow.com/q/21079051
score: 2
type: AcceptedAnswer
downvote count: 0
has body: Regarding your first problem, if you want Java 1.7+, then just say so in your resources. Replace: &lt;java version="1.5+" initial-heap-size="128M" max-heap-size="256M"/&gt; with: &lt;java version="1.7+" href="http://java.sun.com/products/autodl/j2se" initial-heap-size="128M" max-heap-size="256M"/&gt; The href part will ask the client to download Java 7 if it is still on Java 6 (or less). I don't know how to solve your second problem.
answers question: http://stackoverflow.com/q/21079051
type: Answer
upvote count: 2

http://stackoverflow.com/a/21123718
answers question: http://stackoverflow.com/q/21123001
has body: I found the answer just now: glDrawArrays(GL_TRIANGLES, 0, 3); needs to be: glDrawArrays(GL_PATCHES, 0, 3); Some more effort from OpenGL to show what was wrong would have been appreciated. Also nowhere in the book it has been (explicitely) mentioned that I need to use GL_PATCHES, I just figured it out by looking at the source code of the compilable examples from the book.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37870602
type: Answer
score: 7
upvote count: 7
accepted answer of: http://stackoverflow.com/q/21123001

http://stackoverflow.com/q/21177198
has body: I am making Eclipse plugin that run alternative build from within Eclipse (e.g. for project that have both pom.xml and build.gradle do run with mvn package or gradle build) But entry point for both of them are batch .bat files on Windows and bash on Linux. For Windows running from Java would look like Runtime.getRuntime().exec("cmd /c start mvn"); but that will start new window, while I want it to see running in Eclipse Console. There must be something like but in Eclipse way I guess. How to run such script from Eclipse and see output in Console? This is meant to be alternative and not dependent on m2e and Gradle Integration.
has comment: http://stackoverflow.com/comment/31882899
linked to: http://stackoverflow.com/q/21397170
linked to: http://stackoverflow.com/q/21360995
has answer: http://stackoverflow.com/a/21187387
has title: Run Maven, Gradle or other batch-based script from Java (and then Eclipse)
accepted answer: http://stackoverflow.com/a/21187387
has comment: http://stackoverflow.com/comment/31882662
score: 0
answer count: 1
tagged with: eclipse-plugin
has comment: http://stackoverflow.com/comment/31884190
has comment: http://stackoverflow.com/comment/31883145
tagged with: maven
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31883331
tagged with: java
tagged with: eclipse
tagged with: gradle
type: Question

http://stackoverflow.com/a/21040881
accepted answer of: http://stackoverflow.com/q/21040664
answers question: http://stackoverflow.com/q/21040664
type: AcceptedAnswer
downvote count: 0
has body: Let your FragmentActivity implement an interface that has a categorySelected(int categoryId) method. Inside CategoryOverviewFragment you call this when a category is selected: @Override public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l) { ((CategorySelectedListener)getActivity()).categorySelected(i); } Then in the activity you implement categorySelected and replace the overview fragment with CategoryFragment. When you create you CategoryFragment set the cateogry ID as argument. It's best to use the newInstance pattern to setArguments(). To replace the category overview list fragment with the category details fragment use the FragmentManager to beginTransaction() and then replace(). Assuming the category overview fragment is added dynamically and not in XML use code like this: CategoryFragment newFragment = CategoryFragment.newInstance(categoryIdSelected); FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.replace(R.id.fragment_container, newFragment); transaction.addToBackStack(null); transaction.commit(); If the category list fragment is added in XML you need to remove that change it to a FrameLayout and add the fragment dynamically in the code.
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/21058958
has comment: http://stackoverflow.com/comment/31666162
has comment: http://stackoverflow.com/comment/31666239
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/21058992
has answer: http://stackoverflow.com/a/21058988
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/21058988
type: Question
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/21058992
has body: Will any problems arise from using the following for loop when variable is equal to 0? for(int i = 0; i &lt; variable; i++) This seems to sometimes work, but other times I am getting an error with the code inside the for loop. Should I be specifying to only run the for loop when variable is greater than 0? I had figured the for loop simply wouldn't run through at all if the initialization and termination values were the same. Thanks in advance.
has title: Java for loop from 0 to 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31666145
tagged with: android

nodes
tags question: http://stackoverflow.com/q/21071445
tags question: http://stackoverflow.com/q/21122999
tags question: http://stackoverflow.com/q/21161319
tag name: nodes
tags question: http://stackoverflow.com/q/21114229
type: Tag

epub
type: Tag
tags question: http://stackoverflow.com/q/21018980
tag name: epub

http://stackoverflow.com/comment/31853805
comment on: http://stackoverflow.com/q/21161493
has text: Modify your question to include the code please.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31626401
has text: add `try{}` and `catch(){}` block where your `catch` looks something like this: `catch(Exception e){System.out.println("Check your formatting");}`
score: 0
comment on: http://stackoverflow.com/q/21036781
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21106431
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/21113377
has answer: http://stackoverflow.com/a/21106672
tagged with: java
has title: Parse HTML table after clicking a button to make it visible
possible better answer: http://stackoverflow.com/a/21106581
accepted answer: http://stackoverflow.com/a/21113377
tagged with: web-scraping
has answer: http://stackoverflow.com/a/21106581
tagged with: html-parsing
tagged with: html-table
tagged with: jsoup
answer count: 3
score: 2
has comment: http://stackoverflow.com/comment/31754065
type: AnsweredQuestion
has body: I am working on a Java program that needs to read data from a website when it launches. The website in question is this: http://bitcoincharts.com/charts/btceUSD#rg10zigHourlyztgSzm1g10zm2g25zv To access the table that is needed, there is a button near the bottom of the page titled "Load raw data." When clicked, the table with the information that I need appears. While I've never done it before, I believe that I can easily learn how to parse the table and get it into some arrays. What I haven't been able to figure out, though, is how to have my program "click" that button to make the table appear. How can I go about doing this? Edit: here is what I am working with right now. Currently this prints absolutely nothing, and I suspect that it's because jsoup is not seeing the table because the "Load raw data" button has not been "clicked." for (Element table : doc.select("table[id=chart_table]")) { for (Element row : table.select("tr:gt(2)")) { Elements tds = row.select("td:not([rowspan])"); for (Element element : tds) { System.out.println(element); } } }
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/70320594
type: QuestionComment
has text: Another option is adding the certificate to `%JAVA_HOME%\lib\security\cacerts`: http://stackoverflow.com/questions/11617210/how-to-properly-import-a-selfsigned-certificate-into-java-keystore-that-is-avail
score: 0
comment on: http://stackoverflow.com/q/21157450
type: Comment

http://stackoverflow.com/comment/31698442
has text: This is an issue with the foreach loop in java. please check this SO thread to solve your issue.. http://stackoverflow.com/questions/9806421/concurrentmodificationexception-when-adding-inside-a-for-each-loop-in-arraylist
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21075880
type: QuestionComment

http://stackoverflow.com/q/21046898
tagged with: jfreechart
type: Question
has title: Create a taskoverview with JFreechart
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21047518
favorite count: 0
upvote count: 1
type: AnsweredQuestion
has body: I want to show whithin my Java application wheather a person is free or blocked on a particular date. I made an example of my intention in Power Point: example chart My first intuition was to use JFreeChart. Therefore I created some tasks and put them together in one taskseries for each Person. With this data i created a Gantt chart. But in a Gantt chart every task is placed into a new Line and the axis a far away from my intention. image of unuseful gantt chart is it possible to create a chart like my example chart with JFreeChart? What would be the best way to do this? Many thanks in advance
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21047518

http://stackoverflow.com/comment/31751471
type: QuestionComment
has text: i got an error if i don't leave it null
score: 0
comment on: http://stackoverflow.com/q/21104756
type: Comment

http://stackoverflow.com/comment/31627972
type: Comment
has text: Recursive or iterative, make sure you aren't re-considering cells you've already analyzed. Haven't checked your code, but that's a common mistake when coding this sort of problem.
score: 0
comment on: http://stackoverflow.com/q/21037015
type: QuestionComment

http://stackoverflow.com/comment/101841923
type: Comment
comment on: http://stackoverflow.com/a/21343878
has text: Hi, do you also need to set the `batch.size` and `linger.ms` on the producer side? https://www.cloudera.com/documentation/kafka/latest/topics/kafka_performance.html
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31869510
comment on: http://stackoverflow.com/a/21167696
type: AnswerComment
has text: @Kevin Kostlan: `getstatic` is a static field access which is an atomic operation (reading of a certain memory location). There isn’t something to inline. Since the `static` fields of the `enum` constants are `final` the JVM might merge multiple accesses to the same field into one but there will always be one access remaining. However, the JIT optimizations work the other way: the code providing the two values you are comparing might get inlined, analyzed, and simplified until the JVM can deduce the result of the comparison from the remaining code. Then the comparison can be removed entirely.
score: 0
type: Comment

http://stackoverflow.com/comment/31824483
type: Comment
score: 0
has text: I edited both my comment and my answer. I hope it's what you were going for.
type: AnswerComment
comment on: http://stackoverflow.com/a/21127658

http://stackoverflow.com/q/21035379
score: 0
has comment: http://stackoverflow.com/comment/31655556
tagged with: soap
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
tagged with: cxf
has title: CXF encoding embedded XML
tagged with: java
has comment: http://stackoverflow.com/comment/31623599
type: Question
has body: I have a SOAP service which one of the methods accepts a String as a parameter. However, the expectation is that this String is XML. When I call this service, CXF encodes the XML for me by default, like so: &amp;lt;ORM_O01&gt;&amp;lt;MSH&gt; Even though when I called it, I called it like so: &lt;ORM_O01&gt;&lt;MSH&gt; Is there a way to turn this off? I would like CXF to just send what I've specified and not an encoded version. I am using CXF 2.7.8 and JDK 1.7. Thanks in advance.
has answer: http://stackoverflow.com/a/21054341
answer count: 1

http://stackoverflow.com/comment/31806753
has text: It's an old application that I recovered to the evolutions. Dojo plugin is very used in this application and I dont have a big experience in struts2. And the client dont want to change...I dont understant what you want to say here "Seems like you are using wrong formId"
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21135481
type: QuestionComment

http://stackoverflow.com/a/30871332
downvote count: 1
has body: A much more simplified version of tellob's orignal anwser. public static Mat mat2(BufferedImage image) { byte[] data = ((DataBufferByte)image.getRaster().getDataBuffer()).getData(); Mat mat = new Mat(image.getHeight(), image.getWidth(), CvType.CV_8UC3); mat.put(0, 0, data); return mat; }
has comment: http://stackoverflow.com/comment/82046925
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21175336
upvote count: 1

http://stackoverflow.com/comment/101328868
type: Comment
comment on: http://stackoverflow.com/a/36427118
type: AnswerComment
score: 1
has text: Its not working for me. Tried it from Android Studio and still getting the same

http://stackoverflow.com/comment/31837771
type: QuestionComment
has text: possible duplicate of [given 5 numbers, what is the minimum number of comparisons needed to find the median?](http://stackoverflow.com/questions/1585727/given-5-numbers-what-is-the-minimum-number-of-comparisons-needed-to-find-the-me) According to Knuth's AOCP, the minimum is 6 comparisons.
comment on: http://stackoverflow.com/q/21151191
score: 2
type: Comment

http://stackoverflow.com/comment/31748600
score: 0
has text: okay never mind this was a really dumb bug, somebody set the thread pool size to 1 :[
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21102759

text-size
tag name: text-size
tags question: http://stackoverflow.com/q/21149675
type: Tag

http://stackoverflow.com/q/21105413
tagged with: dictionary
has comment: http://stackoverflow.com/comment/31753646
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21106730
tagged with: java
has comment: http://stackoverflow.com/comment/31752749
upvote count: 1
tagged with: collections
has body: I am doing some execrices in java, I have to read words from file, then put this words into Map type Hashmap (word&lt;String,Integer&gt;) . All it's done . Next set of pair (type java.util.Map.Entry) , save into List( List&lt;Entry&lt;String,Integer&gt;&gt;) and than sort it by Collections.sort(List,Comparator) . But it doesn't works, cause it says that the sort is not suitable and I havent so much experiences with this sort, can someone help me in this current example how to ? ... thank you for help . There is part from code: public static void Reader(){ class Word{ private String key; private int value; public int getValue(){ return value; } public void setValue(){ value=this.value; } public String getKey(){ return key; } public void setKey(){ key=this.key; } public Word(String key,Integer value){ this.key= key; this.value = value; } public Word(){ } } Map&lt;String, Integer&gt; wordsmap = new HashMap&lt;String, Integer&gt;(); wordsmap.put("car",2); // wordsmap.put(word as key,frequency as value) wordsmap.put("bike",6); wordsmap.put("like",1); List&lt;Entry&lt;String,Integer&gt;&gt; words = new ArrayList&lt;&gt;(wordsmap.entrySet()); Collections.sort(words,new Comparator&lt;Word&gt;(){ public int compare(Word o1,Word o2){ return o1.getValue() - o2.getValue(); } }); } public static void main(String[] args) { Reader(); }
type: Question
has comment: http://stackoverflow.com/comment/31753217
accepted answer: http://stackoverflow.com/a/21106730
tagged with: comparator
downvote count: 4
answer count: 1
has title: Java java.util.Map.Entry and Collection.sort(List,Comparator)
has comment: http://stackoverflow.com/comment/78996118
favorite count: 0
has comment: http://stackoverflow.com/comment/31753534
has comment: http://stackoverflow.com/comment/31752485
score: -3

http://stackoverflow.com/comment/31861250
comment on: http://stackoverflow.com/q/21145345
score: 0
has text: @SazzadurRahaman, please see my latest updates.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31711348
has text: @user2994631 Ah, of course, it's a method that needs to be called on the string from which you are removing the ending.
type: AnswerComment
comment on: http://stackoverflow.com/a/21083190
type: Comment
score: 0

http://stackoverflow.com/comment/31710404
score: 0
comment on: http://stackoverflow.com/q/21082360
type: Comment
type: QuestionComment
has text: how do i rate people comment into answer? sorry i am new here

http://stackoverflow.com/q/21180921
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31888805
downvote count: 0
has comment: http://stackoverflow.com/comment/31888834
possible better answer: http://stackoverflow.com/a/21181011
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21181011
has answer: http://stackoverflow.com/a/21180994
type: Question
accepted answer: http://stackoverflow.com/a/21180994
has title: Get an array of Strings matching a pattern from a String
has answer: http://stackoverflow.com/a/41163288
linked to: http://stackoverflow.com/q/10287685
has body: I have a long string let's say I like this #computer and I want to buy it from #XXXMall. I know the regular expression pattern is Pattern tagMatcher = Pattern.compile("[#]+[A-Za-z0-9-_]+\\b"); Now i want to get all the hashtags in an array. How can i use this expression to get array of all hash tags from string something like ArrayList hashtags = getArray(pattern, str)
upvote count: 1
has answer: http://stackoverflow.com/a/21181060
favorite count: 0
tagged with: pattern-matching
answer count: 5
has answer: http://stackoverflow.com/a/21181050
tagged with: regex

http://stackoverflow.com/comment/31659476
comment on: http://stackoverflow.com/q/21055249
type: Comment
has text: I'm using out.write("...");
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31829922
comment on: http://stackoverflow.com/q/21147380
type: Comment
type: QuestionComment
has text: @jkbot, cloning should work. I thought this method would be the more clean way, I suppose not!
score: 0

http://stackoverflow.com/a/21057610
score: 0
has comment: http://stackoverflow.com/comment/31663789
has body: System.out.println (name[j] + " sold " + sales[j]);aa I think that aa needs to be deleted
type: Answer
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/21057588

http://stackoverflow.com/comment/31754706
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21089019
score: 0
has text: For the webapp to run, yes its preferred to put the Spring jars there. This is autonatically taken from your POM, but whats surprising to me is your mvn dependencytree shows `org.springframework:spring-beans:jar:3.2.3.RELEASE:compile` which means it's only used for the Compile and not bundled into the Web app which is the default. But your POM does not specify a `scope` of `compile` so why does mvn only take it for compile time.

http://stackoverflow.com/q/21079051
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31703832
type: Question
has answer: http://stackoverflow.com/a/21079429
tagged with: java-web-start
score: 0
has title: Customize Java Web Start
answer count: 1
tagged with: jnlp
accepted answer: http://stackoverflow.com/a/21079429
has body: I have an issue concerning JNLP / Java Web Start. I have absolutely no knowledge of JNLP. A (Swing) application is compiled with JDK 1.7 (source and target) and launched by client via Web Start. This is the JNLP file, unimportant info omitted: ... ... <homepage href="www.mycom.com" /> ... <all-permissions /> <update check="always" policy="always"/> <java version="1.5+" initial-heap-size="128M" max-heap-size="256M"/> <jar href="lib/main.jar" main="true"/> <jar href="lib/other.jar"/> <application-desc main-class="com.pkg.Launcher"/> Problem one: Whenever a client has a JRE 1.6 installed (or a least JAVA_HOME or PATH is set to it), Web Start doesn't start at all. Desired behavior Download Java 7 JRE Problem two: If V 7 is installed on the client machine, the launcher prompts to download an up-to-date version, with an option to update now / postpone for later. Desired behavior Do the update in background / somehow ignore it as long as this message will not appear.

http://stackoverflow.com/q/21127782
has answer: http://stackoverflow.com/a/21127825
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21127869
has comment: http://stackoverflow.com/comment/31793073
has comment: http://stackoverflow.com/comment/31793506
has comment: http://stackoverflow.com/comment/31793026
has comment: http://stackoverflow.com/comment/31792981
has comment: http://stackoverflow.com/comment/31793191
tagged with: java
type: Question
has title: generate random numbers without repetition - java
has comment: http://stackoverflow.com/comment/31792997
has comment: http://stackoverflow.com/comment/31816422
score: 0
tagged with: random
answer count: 3
has body: i'm writing a program for a complicated mathematical operation. I read numbers from a file, then use these numbers to generate as many as possible of sets of 10 random numbers whose sum is 590 and has 5 even numbers and 5 odd numbers (the sum and number of odd and even is changeable). every time I run the code, I get either repeated sets or repeated numbers withing the set. how to fix this so I have unique sets with 10 unique numbers? here is my code: public static void main(String args[]) { List&lt;Long&gt; numbers = new ArrayList&lt;Long&gt;(); try{ FileInputStream fstream = new FileInputStream("numbers.txt"); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; while ((strLine = br.readLine()) != null) { numbers.add(Long.valueOf(strLine)); } Long[] selectedNumbers = new Long[10]; Random r = new Random(); for (int j =0; j&lt;100000; j++){ long sum = 0; int odd = 0; int even = 0; for(int i = 0; i &lt; selectedNumbers.length; i++){ selectedNumbers[i] = numbers.get(r.nextInt(numbers.size())); if (selectedNumbers[i] % 2 == 0) { even++; } else { odd++; } sum = sum + selectedNumbers[i]; } if (even == 5 &amp;&amp; sum == 590 ) { for(int k = 0; k &lt; selectedNumbers.length; k++) { System.out.print(selectedNumbers[k] + "\t"); } System.out.print("\n"); } } in.close(); }catch (Exception e){//Catch exception if any System.err.println("Error: " + e.getMessage()); } }
has answer: http://stackoverflow.com/a/21127902

http://stackoverflow.com/comment/31622475
type: QuestionComment
comment on: http://stackoverflow.com/q/21034679
type: Comment
has text: It won't, it just won't this is simply not how painting works in Swing. You'd have an easier time getting an elephant to fly using a single feather...
score: 0

http://stackoverflow.com/q/21041564
has title: How to overwrite an ArrayList without invoking garbage collection
has answer: http://stackoverflow.com/a/21041711
tagged with: immutability
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/21041615
upvote count: 1
type: Question
tagged with: arraylist
has comment: http://stackoverflow.com/comment/31634292
has body: Is there any way to do the following without either invoking garbage collection or increasing heap size to avoid eventual GC? List&lt;Long&gt; someList = new ArrayList&lt;Long&gt;(); someList.add(1l); someList = new ArrayList&lt;Long&gt;(); //Will this cause GC of the old `someList`? So what I'm asking is if the original ArrayList will get deleted (and eventually GCd)? If so, how do I remedy this such that I can overwrite the original list without GCing?
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/21041615
has comment: http://stackoverflow.com/comment/31633915
has comment: http://stackoverflow.com/comment/31633658
has comment: http://stackoverflow.com/comment/31633749
has answer: http://stackoverflow.com/a/21041634
favorite count: 0
accepted answer: http://stackoverflow.com/a/21041634
tagged with: garbage-collection

http://stackoverflow.com/q/21098413
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/31738879
downvote count: 2
type: Question
has body: I've been researching to find a faster alternative to list. In an algorithm book, hashtable seems to be the fastest using separate chaining. Then I found that java has an implementation of hashtable and from what I read it seems to it uses separate chaining. However, there is the overhead of synchronization so the implementation of hashmap is suggested as a faster alternative to hashtable. My queations are: Is java hashmap the fastest data structure implemented in java to insert/delete/search? While reading, a few posts had concerns about the memory usage of hashmap. One post mentioned that an empty hashmap occupy 300 bytes. Is hashtable more memory efficient than hasmap? Also, is the hash function in each the most efficient for strings?
tagged with: hashmap
has comment: http://stackoverflow.com/comment/31738935
tagged with: algorithm
answer count: 6
has answer: http://stackoverflow.com/a/21098478
has answer: http://stackoverflow.com/a/21098801
has answer: http://stackoverflow.com/a/21098672
upvote count: 4
has title: Java hashtable or hashmap?
has answer: http://stackoverflow.com/a/21098632
has answer: http://stackoverflow.com/a/21098446
favorite count: 0
has comment: http://stackoverflow.com/comment/31739902
linked to: http://stackoverflow.com/q/40471
tagged with: hashalgorithm
type: UnansweredQuestion
tagged with: hashtable
duplicate of: http://stackoverflow.com/q/40471
has answer: http://stackoverflow.com/a/21099399

http://stackoverflow.com/q/21119538
type: Question
has comment: http://stackoverflow.com/comment/31806904
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/31778076
has answer: http://stackoverflow.com/a/21119910
accepted answer: http://stackoverflow.com/a/21119910
has comment: http://stackoverflow.com/comment/87124550
has comment: http://stackoverflow.com/comment/31805367
has body: I am using Java 1.7 Desktop application with Eclipse and SQL Server 2012 database with Windows authentication. When I run through eclipse works correctly. The problem is when I try to generate a .Jar. The application works correctly but when I am going to do some query on the database the application stop working. I wonder what are the correct settings I have to do on the machine (the same machine) and time to generate. Jar, thanks. Got this error by compiling in the prompt: C:\Users\jean&gt;java -jar C:\Users\jean\Desktop\Jean\aee.jar Jan 15, 2014 8:29:34 AM com.microsoft.sqlserver.jdbc.AuthenticationJNI &lt;clinit&gt; AdvertÛncia: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java .library.path com.microsoft.sqlserver.jdbc.SQLServerException: Esse driver nÒo estß configurad o para autenticaþÒo integrada. ClientConnectionId:02155bdf-555d-4b59-8933-a98091 48a83f at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerC onnection.java:1667) at com.microsoft.sqlserver.jdbc.AuthenticationJNI.&lt;init&gt; My problem is solved by just adding the .dll in the same directory of the .jar.
has title: Generating .jar using Java 1.7 with Eclipse and SQL Server 2012 database with Windows authentication
has comment: http://stackoverflow.com/comment/31806087
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31805696
has comment: http://stackoverflow.com/comment/31806714
tagged with: eclipse

http://stackoverflow.com/q/21085524
has body: I have a following code sample int i = 1; while(i != 0) { i++; } I was expecting this to run in an infinite loop but it didn't. Then when I printed the value after while loop I got: i value is 0. Can any one let me know what exactly is happening?
type: Question
answer count: 2
tagged with: post-increment
accepted answer: http://stackoverflow.com/a/21085570
tagged with: increment
favorite count: 0
has comment: http://stackoverflow.com/comment/31715195
possible better answer: http://stackoverflow.com/a/21085576
has answer: http://stackoverflow.com/a/21085576
has comment: http://stackoverflow.com/comment/31831926
upvote count: 6
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/21085570
tagged with: java
has title: Why incrementing int primitive in while loop does not loop forever
downvote count: 3
has comment: http://stackoverflow.com/comment/31715155

http://stackoverflow.com/a/21075546
downvote count: 0
has comment: http://stackoverflow.com/comment/31697550
has body: Can you try this instead: Criteria criteria = Criteria.where("question").regex(questionPattern, "i"); Query query = Query.query(criteria); query.limit(getLimit()); query.skip(getSkip()); return mongoOperations.find(query, Question.class);
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21075319

http://stackoverflow.com/comment/31960694
score: 0
type: Comment
has text: Iterate over all `AtlasRegion` in your `TextureAtlas`. If an `AtlasRegion` rotate is true, rotate that region clockwise 90 degrees, and swap the width and height. This should work for you. You could try just deleting the rotate line in your pack file, but you'd have to do this every time.
type: AnswerComment
comment on: http://stackoverflow.com/a/21148953

http://stackoverflow.com/q/21154400
has answer: http://stackoverflow.com/a/22932249
tagged with: derby
has answer: http://stackoverflow.com/a/22183810
has answer: http://stackoverflow.com/a/21244450
has answer: http://stackoverflow.com/a/21784353
has title: Unable to start derby database from Netbeans 7.4
downvote count: 0
has answer: http://stackoverflow.com/a/21334878
has answer: http://stackoverflow.com/a/22708591
has answer: http://stackoverflow.com/a/21238953
favorite count: 0
has answer: http://stackoverflow.com/a/21155303
tagged with: netbeans
answer count: 12
score: 54
upvote count: 54
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21252979
has answer: http://stackoverflow.com/a/21187030
accepted answer: http://stackoverflow.com/a/21238953
type: Question
has answer: http://stackoverflow.com/a/27882675
has answer: http://stackoverflow.com/a/21923521
possible better answer: http://stackoverflow.com/a/21252979
has body: I downloaded Netbeans 7.4 and Java 7 Update 51. I get the below error when I try to start Java DB or derby connection from Netbeans. This is on a windows 8 PC. I downloaded the version for windows xp 32 bit at work. It works fine. I am not sure what is missing. Thu Jan 16 00:48:23 EST 2014 : Security manager installed using the Basic server security policy. Thu Jan 16 00:48:24 EST 2014 : access denied ("java.net.SocketPermission" "localhost:1527" "listen,resolve") java.security.AccessControlException: access denied ("java.net.SocketPermission" "localhost:1527" "listen,resolve") at java.security.AccessControlContext.checkPermission(AccessControlContext.java:372) at java.security.AccessController.checkPermission(AccessController.java:559) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at java.lang.SecurityManager.checkListen(SecurityManager.java:1134) at java.net.ServerSocket.bind(ServerSocket.java:375) at java.net.ServerSocket.&lt;init&gt;(ServerSocket.java:237) at javax.net.DefaultServerSocketFactory.createServerSocket(ServerSocketFactory.java:231) at org.apache.derby.impl.drda.NetworkServerControlImpl.createServerSocket(Unknown Source) at org.apache.derby.impl.drda.NetworkServerControlImpl.access$000(Unknown Source) at org.apache.derby.impl.drda.NetworkServerControlImpl$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at org.apache.derby.impl.drda.NetworkServerControlImpl.blockingStart(Unknown Source) at org.apache.derby.impl.drda.NetworkServerControlImpl.executeWork(Unknown Source) at org.apache.derby.drda.NetworkServerControl.main(Unknown Source)

http://stackoverflow.com/comment/127897262
comment on: http://stackoverflow.com/a/21146503
type: AnswerComment
type: Comment
has text: I think it goes without saying that if the `pattern` contains user input, this might not be what one wants. Imagine a user typing `%` and being surprised at the results.
score: 1

instantiation
type: Tag
tags question: http://stackoverflow.com/q/21180518
tags question: http://stackoverflow.com/q/21179581
tag name: instantiation

http://stackoverflow.com/q/21089106
possible better answer: http://stackoverflow.com/a/29537216
tagged with: java
has answer: http://stackoverflow.com/a/71900410
has answer: http://stackoverflow.com/a/21089474
type: Question
has answer: http://stackoverflow.com/a/68022767
tagged with: multipart
tagged with: file-io
has answer: http://stackoverflow.com/a/29537216
downvote count: 0
has title: Converting MultipartFile to java.io.File without copying to local machine
favorite count: 0
linked to: http://stackoverflow.com/q/1378920
has body: I have a Java Spring MVC web application. From client, through AngularJS, I am uploading a file and posting it to Controller as webservice. In my Controller, I am gettinfg it as MultipartFile and I can copy it to local machine. But I want to upload the file to Amazone S3 bucket. So I have to convert it to java.io.File. Right now what I am doing is, I am copying it to local machine and then uploading to S3 using jets3t. Here is my way of converting in controller MultipartHttpServletRequest mRequest=(MultipartHttpServletRequest)request; Iterator&lt;String&gt; itr=mRequest.getFileNames(); while(itr.hasNext()){ MultipartFile mFile=mRequest.getFile(itr.next()); String fileName=mFile.getOriginalFilename(); fileLoc="/home/mydocs/my-uploads/"+date+"_"+fileName; //date is String form of current date. Then I am using FIleCopyUtils of SpringFramework File newFile = new File(fileLoc); // if the directory does not exist, create it if (!newFile.getParentFile().exists()) { newFile.getParentFile().mkdirs(); } FileCopyUtils.copy(mFile.getBytes(), newFile); So it will create a new file in the local machine. That file I am uplaoding in S3 S3Object fileObject = new S3Object(newFile); s3Service.putObject("myBucket", fileObject); It creates file in my local system. I don't want to create. Without creating a file in local system, how to convert a MultipartFIle to java.io.File?
accepted answer: http://stackoverflow.com/a/21089474
answer count: 4
score: 14
tagged with: spring-mvc
type: AnsweredQuestion
upvote count: 14

http://stackoverflow.com/a/21095854
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31756829
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21086908
answers question: http://stackoverflow.com/q/21086908
has body: It's hard to say what's "best" without knowing what your criteria are. Performance? Ease of use? Both approaches are somewhat heavyweight. In the first you're allocating an object, looking up the class and constructor, and invoking the constructor on every call. In the second you're adding the overhead of creating and parsing JSON data. You can optimize #1 by caching the result of FindClass in a JNI global reference, and the result of GetMethodID in a simple global. If your data is actually as simple as it appears in your example, with just X and Y values, you don't need to pass an object around at all -- just pass in an int[2] and store the values in the array. That would reduce your overhead to a single SetIntArrayRegion. If you really want to pass data through an object -- maybe it's more complex than a pair of integers -- you can avoid the allocation by repeatedly passing a re-usable object into your native method. The native method populates the object and hands it back. If that's still too much overhead, you can use other tricks, like creating parallel arrays and passing those around (i.e. an array with all the X coordinates, and an array with all the Y coordinates). This reduces your overhead to one set of array allocations and one method call for the whole set so long as you're just working with primitive types. If there's an upper bound on the number of points you can pre-allocate the arrays and completely avoid allocations. As your objects become more complex this becomes more unwieldy.

http://stackoverflow.com/comment/31753813
type: Comment
has text: Sure, but I don't feel like a guru.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21098370

http://stackoverflow.com/comment/31858389
score: 0
type: AnswerComment
has text: @user3199577 Let me know if there any problem in above query.
type: Comment
comment on: http://stackoverflow.com/a/21163940

http://stackoverflow.com/comment/31812270
comment on: http://stackoverflow.com/q/21137932
score: 0
type: Comment
type: QuestionComment
has text: Maybe i should you other component like JLabel to make it like that. Thz for your answer. and @Andrew i can write code to make it change between that tab. just use: JTabbedPane.setSelectedIndex(int index)

http://stackoverflow.com/q/21159636
has comment: http://stackoverflow.com/comment/31850431
has comment: http://stackoverflow.com/comment/31850826
answer count: 1
has comment: http://stackoverflow.com/comment/31851219
has comment: http://stackoverflow.com/comment/31851688
favorite count: 0
tagged with: android
upvote count: 4
linked to: http://stackoverflow.com/q/4604239
has comment: http://stackoverflow.com/comment/31850490
has comment: http://stackoverflow.com/comment/31851066
has comment: http://stackoverflow.com/comment/31850342
has comment: http://stackoverflow.com/comment/31850735
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31853469
tagged with: android-install-apk
has comment: http://stackoverflow.com/comment/31852236
has comment: http://stackoverflow.com/comment/31850548
has comment: http://stackoverflow.com/comment/31850694
downvote count: 1
has answer: http://stackoverflow.com/a/21160724
has comment: http://stackoverflow.com/comment/31850793
score: 3
has title: Apk File download Error using Java in Android
has comment: http://stackoverflow.com/comment/31850926
linked to: http://stackoverflow.com/q/4967669
has comment: http://stackoverflow.com/comment/31850811
tagged with: java
has comment: http://stackoverflow.com/comment/31852192
has body: .I followed this tutorial and getting errors "PARSING ERROR THERE IS A PROBLEM PARSING THE PACKAGE". I have check the result in Android Device Samsung Galaxy S3. package com.mrfs.android.surveyapp.activities; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.Environment; import android.util.Log; public class ApkFileAsync extends Activity { UpdateApp updateAppInstance; @Override public void onCreate(Bundle savedBundleInstance) { super.onCreate(savedBundleInstance); updateAppInstance = new UpdateApp(); updateAppInstance.setContext(getApplicationContext()); updateAppInstance.execute("http://demo.ingresssolutions.com/proposalmanagement/services/user/getApkFile"); } private class UpdateApp extends AsyncTask&lt;String,Void,Void&gt;{ private Context context; public void setContext(Context contextf){ context = contextf; } @Override protected Void doInBackground(String... arg0) { try { URL url = new URL(arg0[0]); HttpURLConnection c = (HttpURLConnection) url.openConnection(); c.setRequestMethod("POST"); c.setDoOutput(true); c.connect(); String PATH = "/mnt/sdcard/Download/"; File file = new File(PATH); file.mkdirs(); File outputFile = new File(file,"surveyapp.apk"); if(outputFile.exists()){ outputFile.delete(); } FileOutputStream fos = new FileOutputStream(outputFile); InputStream is = c.getInputStream(); byte[] buffer = new byte[1024]; int len1 = 0; while ((len1 = is.read(buffer)) != -1) { fos.write(buffer, 0, len1); } fos.close(); is.close(); /* Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File("/mnt/sdcard/Download/update.apk")), "application/vnd.android.package-archive"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);*/ // without this flag android returned…
has comment: http://stackoverflow.com/comment/31851229
has comment: http://stackoverflow.com/comment/31851148
type: Question
has comment: http://stackoverflow.com/comment/31854159

http://stackoverflow.com/q/21037879
tagged with: java
tagged with: gradle
has comment: http://stackoverflow.com/comment/31654044
has body: I'm trying to add org.apache.commons.lang3 to my build. I've downloaded the library which is directory containing jar files. My group is using gradle to build the project, and I know just enough to maybe ask the right question. So what I think the build is doing is copying a bunch of .bnds to the build directory compiles the java we have in src/main/java (via source sourceSets.main.java.srcDirs?) I would like to add the lang3 library, but I'm not sure how to go about doing that. Can I just dump it into src/main/java? Or do I have to tell gradle about it? This is what I think is relevant from the current build.gradle ext.releaseDir = "${buildDir}/release/${tpVersion.getProgramName()}" ext.bundlesDir = "${releaseDir}/nucleus/bin/nucleus_java/bundles/" dependencies { compile fileTree(dir: bundlesDir, include: '*.jar') bnd { source sourceSets.main.java.srcDirs include '**/*.bnd'
answer count: 2
has answer: http://stackoverflow.com/a/21039399
has title: Add library to gradle build
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/21039399
has answer: http://stackoverflow.com/a/21038488
tagged with: dependencies
upvote count: 19
score: 19
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21038488

http://stackoverflow.com/comment/31878874
score: 0
type: AnswerComment
type: Comment
has text: doh! Time for some more coffee. Thanks :)
comment on: http://stackoverflow.com/a/21174747

http://stackoverflow.com/comment/31780747
comment on: http://stackoverflow.com/a/21104090
score: 0
has text: Tried that, still not working, I think the formatter property is not getting overwritten, or even the SimpleFormatter object :(
type: Comment
type: AnswerComment

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

http://stackoverflow.com/comment/31794747
type: Comment
type: AnswerComment
has text: Same answer but different links may be ?
comment on: http://stackoverflow.com/a/21128664
score: 0

http://stackoverflow.com/comment/31856380
score: 0
comment on: http://stackoverflow.com/q/21162753
type: Comment
type: QuestionComment
has text: Why are you converting to a String anyway? I don't really understand what you're trying to do with the value after you've retrieved it from your ResultSet.

http://stackoverflow.com/q/21132701
answer count: 1
linked to: http://stackoverflow.com/q/13829157
has body: I have a problem when trying to persist a class... Hibernate throws this exception: Root cause: java.lang.NullPointerException: null entities are not supported by org.hibernate.event.def.EventCache at org.hibernate.event.def.EventCache.containsKey(EventCache.java:80) at org.hibernate.event.def.DefaultMergeEventListener.mergeTransientEntity(DefaultMergeEventListener.java:361) at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:303) at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:258) at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:84) at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:867) at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:851) at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:855) at com.mycompany.myapp.service.data.DataServiceBean.merge(DataServiceBean.java:1337) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy64.merge(Unknown Source) at com.mycompany.myapp.web.base.BaseForm.store(BaseForm.java:991) at com.mycompany.myapp.web.base.BaseForm.store(BaseForm.java:942) at com.mycompany.myapp.web.forms.therapie.TherapieForm.onSaveFormData(TherapieForm.java:591) at com.mycompany.myapp.web.base.BaseForm.doSave(BaseForm.java:370) at com.mycompany.myapp.web.base.BaseFo…
has comment: http://stackoverflow.com/comment/31801676
tagged with: oracle-database
accepted answer: http://stackoverflow.com/a/21133463
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
has title: java.lang.NullPointerException: null entities are not supported by org.hibernate.event.def.EventCache
has answer: http://stackoverflow.com/a/21133463
score: 0
has comment: http://stackoverflow.com/comment/31801746

http://stackoverflow.com/comment/31829911
type: Comment
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/21147965
has text: I contradicted the part "*all profilers that are available for Java*".

http://stackoverflow.com/a/21064048
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21063608
accepted answer of: http://stackoverflow.com/q/21063608
has body: The kind of exception you are getting suggests thats your application is trying to connect to a datanode that does not have 8020 port open. As per this documentation 8020 is the default port namenode. I'd suggest adding your hostname and port info. in your core-site.xml. something like this: fs.default.name hdfs://[namenode]:[port]
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/31734438
comment on: http://stackoverflow.com/q/21095997
has text: Well, it is equivalent so it has to produce the same exception. `this.m_children = Collections.s..` happens just once in the entire lifetime of that class instance? (synchronization would fail if you change the list). Also please append the stacktrace / point out where it fails.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/140223372
score: 0
type: Comment
type: QuestionComment
has text: `java.time.LocalDate.of ( 2012 , Month.JUNE , 15 ).atStartOfDay ( ZoneId.of ( "America/Edmonton" ) )`
comment on: http://stackoverflow.com/q/21139468

http://stackoverflow.com/comment/31955113
score: 0
type: AnswerComment
has text: Is there any other way to get permanent user identifier that do not rely on cookies than to perform some authorized request with access token that returns service's user id?
type: Comment
comment on: http://stackoverflow.com/a/21188188

http://stackoverflow.com/q/21029653
tagged with: swing
type: Question
tagged with: alignment
score: 4
answer count: 3
favorite count: 0
has body: I have a JList on a panel. How can I center align the text in the JList? I can't seem to find the settings anywhere for the model? I have looked for align settings on the GUI but cant seem to find any there.
has title: Java Jlist text center align
type: UnansweredQuestion
tagged with: jlist
upvote count: 4
has answer: http://stackoverflow.com/a/21029761
downvote count: 0
has answer: http://stackoverflow.com/a/66996623
tagged with: java
has answer: http://stackoverflow.com/a/21029692

http://stackoverflow.com/q/21176552
type: Question
tagged with: actionlistener
has title: Running a void method from a different class using actionlistener for my menu combobox.
has answer: http://stackoverflow.com/a/21176912
answer count: 1
has body: I am creating a little combobox menu for my ap comp sci project. This is my first time working with GUI so I am still familiarizing myself with it. I have a menu class and a few other classes that run mostly void methods to do simple things like calculate GPA, etc. My menu is working fine (at least I think so). However, when I select my first item in the menu (I only have one actionlistener at the moment but I will add more after) the actionlistener runs the void method (run()) and it opens the window. But after that nothing happens. I have user input in that method to type in grade percentages, etc, and it works when i run the method directly from the class. But I can't type or seem to have any input when the actionlistener runs it. Thank you for your time and help! package First_Semester_Project; import java.awt.Color; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Menu extends GradeCalculator { String [] info = {"Grade Calculator", "Spanish Conjugator", "Period Table of Elements", "Sentence Compiler"}; JLabel l= new JLabel("Welcome to the Resource Library!"); JComboBox c = new JComboBox(info); JButton b = new JButton ("Select Resource"); public Menu () { frame(); } public void frame () { JFrame f = new JFrame ("Resource Library"); l.setForeground(Color.white); l.setFont(new Font("Arial", Font.BOLD, 16)); f.setSize(600,90); f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel p = new JPanel(); p.setBackground(Color.gray); p.add(c); p.add(b); p.add(l); f.add(p); b.addActionListener(new ActionListener() { public void actionPerformed (ActionEvent e ){ String s = c.getSelectedItem().toString(); //l.setText(s); if (s.equals("Grade Calculator")) { run(); } else if (s.equals("travel time")) { l.setText(s); } } }); }
tagged with: combobox
tagged with: void
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: methods

http://stackoverflow.com/q/21140773
upvote count: 0
tagged with: java
type: Question
downvote count: 2
score: -2
tagged with: jsp
tagged with: javascript
has title: Menu component in JSP
has answer: http://stackoverflow.com/a/21141002
accepted answer: http://stackoverflow.com/a/21141002
answer count: 1
has body: I look for what components is presented on the picture, I exactly mean about menu, how to make the manu in JSP page ? It can be done with CSS, JS or what ?
favorite count: 0
tagged with: spring
tagged with: css
type: AnsweredQuestion

http://stackoverflow.com/comment/31838805
has text: This is what I thought too, I can't seem to finger out the code. how to replace it with 0 or 1?Can you tell in more specific detail?thanks
type: Comment
comment on: http://stackoverflow.com/a/21152802
type: AnswerComment
score: 0

http://stackoverflow.com/q/21133098
linked to: http://stackoverflow.com/q/1037139
has title: Java Set default disabled textfield text to black instead of grey
has body: Problem I have a problem where by I have to disable 10 textfield but the default text become grey. I know we can use textfield1.setDisabledTextColor(Color c) . But I will have to do this for all 10 textfield, which I find it irreverent. Is there another option for me to change the UI manager so by default its black? btw, I am using netbean GUI builder. Code txtField1.setEnabled(false); txtField1.setDisabledTextColor(Color.BLACK)
answer count: 1
favorite count: 0
tagged with: colors
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21133182
score: 0
tagged with: java
upvote count: 1
tagged with: swing
tagged with: jtextfield
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/21133182

http://stackoverflow.com/q/21057799
type: AnsweredQuestion
score: 2
downvote count: 0
favorite count: 0
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/21057929
has body: I'm having some issues. It seems like I'm randomly getting null return from findViewById().Sometimes it returns the TextView and LinearLayout..Sometimes it just gives null exception. - This is if it's return correctly. - If i re debug it. It would end up like this... While other time during debug it would return null. Any way to achieve a constant result? Log a Case Java. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_log_acase); // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Create the adapter that will return a fragment for each of the three // primary sections of the app. mSectionsPagerAdapter = new SectionsPagerAdapter( getSupportFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); // When swiping between different sections, select the corresponding // tab. We can also use ActionBar.Tab#select() to do this if we have // a reference to the Tab. mViewPager .setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by // the adapter. Also specify this Activity object, which implements // the TabListener interface, as the callback (listener) for when // this tab is selected. actionBar.addTab(actionBar.newTab() .setText(mSectionsPagerAdapter.getPageTitle(i)) .setTabListener(this)); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.new_case, menu); return true; } …
upvote count: 2
accepted answer: http://stackoverflow.com/a/21057929
answer count: 1
has title: FindViewByID Fragment Null
tagged with: android-fragments
tagged with: java

http://stackoverflow.com/a/21145581
has comment: http://stackoverflow.com/comment/31825787
has comment: http://stackoverflow.com/comment/31865187
score: 0
has comment: http://stackoverflow.com/comment/31830646
answers question: http://stackoverflow.com/q/21144120
has comment: http://stackoverflow.com/comment/31858068
type: Answer
has body: 1 - if I try to access http: //localhost/app is redirect to http: //localhost/app/spring_security_login to login as expected If the normal way of login works and its not redirecting to login page again when you request the http: //localhost/app then your configuration is good. After send POST method and get login sucess, if I try to acess http: //localhost/app is redirect to http: //localhost/app/spring_security_login , so I cant undestand beacause the authentication worked fine! For each request , the application considers as new session. if you have configured Spring Security filter already in web.xml ( which makes the point 1 works fine) should create Session for you, So you can just call getSession() instead of getSession(true) in your controller. Just log the session id between the request and see the sessions are different. it may be due to the way you are calling from client.

pdf-conversion
tags question: http://stackoverflow.com/q/21110439
type: Tag
tag name: pdf-conversion

http://stackoverflow.com/q/21128856
has comment: http://stackoverflow.com/comment/31794938
upvote count: 0
tagged with: nested-loops
has answer: http://stackoverflow.com/a/21128986
answer count: 3
has body: I don't really know how to program... I was working on this for a Computer Science Class Instruction: Use nested loops to print out the square word pattern show below. I'm guessing the error is in the toString method, but I can't spot where. the desired output is: (when input is SQUARE) SQUARE Q R U A A U R Q ERAUQS The code: import static java.lang.System.*; class BoxWord { private String word; public BoxWord() { word=""; } public BoxWord(String s) { setWord(s); } public void setWord(String w) { word=w; } public String toString() { String output=word +"\n"; for(int i =0;i&lt;word.length(); i++){ output += word.charAt(i); for(int j = 2; j&lt;word.length();j++) output += " "; output+= word.charAt(word.length()-(i-1))+ "\n"; } for(int k=0; k&lt;word.length(); k++) output+= word.charAt(k); return output+"\n"; } } main: import static java.lang.System.*; public class Lab11f { public static void main( String args[] ) { BoxWord test = new BoxWord("square"); out.println(test); } }
accepted answer: http://stackoverflow.com/a/21128986
has title: java.lang.StringIndexOutOfBoundsException: String index out of range: 7
favorite count: 0
has comment: http://stackoverflow.com/comment/31795034
possible better answer: http://stackoverflow.com/a/21128941
has answer: http://stackoverflow.com/a/21129052
has answer: http://stackoverflow.com/a/21128941
score: -3
has comment: http://stackoverflow.com/comment/31795002
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31795037
tagged with: java
downvote count: 3
type: Question
tagged with: for-loop

http://stackoverflow.com/q/21122563
has body: beginner Java coder here. Here's the code: private ArrayList&lt;Rectangle&gt; rectangles; try { InputStream IS = MyClass.class.getResourceAsStream("file.dat"); ObjectInputStream input = new ObjectInputStream(IS); rectangles = (ArrayList&lt;Rectangle&gt;) input.readObject(); } catch (IOException | ClassNotFoundException ex) { System.out.println(ex); } Netbeans tells me that this is an unchecked cast. Google tells me I should try to avoid this warning rather than suppress it, so how would I go about doing that? The only files that should be read by this program do indeed contain an ArrayList, and if not, I'm fine with just catching those exceptions. Furthermore, if I do the same with with a char[][] (read it from and OIS and try to cast), netbeans doesn't have any problems with it. Why is that? I would think it's still an unchecked cast.
tagged with: unchecked
has answer: http://stackoverflow.com/a/21122656
tagged with: casting
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/21122640
has title: Unchecked cast - should I suppress this?
has answer: http://stackoverflow.com/a/21122640
has answer: http://stackoverflow.com/a/21122945
accepted answer: http://stackoverflow.com/a/21122656
score: 2
type: AnsweredQuestion
upvote count: 2
answer count: 5
type: Question
has answer: http://stackoverflow.com/a/21122797
tagged with: java
has answer: http://stackoverflow.com/a/21122654

http://stackoverflow.com/a/21039092
score: 0
type: Answer
has body: See... For example we might have String s= "abcde"; String str = s.trim().subString(2); 1 --&gt; trim() is called on "s". 2 --&gt; subString() is called on the result of s.trim()
answers question: http://stackoverflow.com/q/21039052

http://stackoverflow.com/comment/31765000
type: Comment
comment on: http://stackoverflow.com/a/21098398
has text: thanks! with assume i've found some related topics as well: http://stackoverflow.com/questions/19358444/junit-how-to-make-conditional-tests and http://stackoverflow.com/questions/1689242/conditionally-ignoring-tests-in-junit-4
score: 0
type: AnswerComment

http://stackoverflow.com/comment/32001142
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21239282
score: 1
has text: @G_H thank you for the upvote. Strategy is a very simple, yet powerful pattern. As far as how to best implement pluggability, that would depends on how exactly your customer is going to plug their custom functionality in. Do you ship the product to them and they run it in their environment? That would make introducing overridden functionality really easy, they place their jar on the classpath before yours. If, on the other hand, you host the app, you'd need to introduce some kind of extension points which would call a service method or retrieve some resource (JS file?) on the customer's end.

http://stackoverflow.com/comment/31649097
has text: I'd highly recommend using AtomicInt rather than int for this and avoiding most of manual synchronization.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21049861
type: QuestionComment

http://stackoverflow.com/a/63887996
type: Answer
answers question: http://stackoverflow.com/q/21113190
score: 0
has body: You can use the imdecode method which comes as part of opencv (this is for emgucv but it should have a similar operation on other versions of opencv, syntax might just be different) Example: byte [] imageArray Mat dest CvInvoke.Imdecode(imageArray, ImreadModes.Unchanged, dest)

http://stackoverflow.com/comment/31673755
has text: Log the exceptions and get the stacktrace from logcat. The thread snapshot you included isn't that helpful in the static context we have here on SO.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21062136

http://stackoverflow.com/a/21113902
downvote count: 0
answers question: http://stackoverflow.com/q/21113857
upvote count: 3
has body: Place.split("\\s+"); to split at empty spaces
type: Answer
score: 3

http://stackoverflow.com/comment/32192719
has text: It is set to `224.0.0.115`. And how does the router affect the port opening on my machine? It doesn't work no matter what router (incl. phone via hotspot) i use
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21347798
type: Comment

http://stackoverflow.com/comment/31805973
score: 1
has text: We can't tell you why they designed it that way. Anyone who does is only giving an opinion ... unless they were on the design team. I expect that the real answer is that the API was designed in a hurry, and once the shortcomings were realized it was too late to fix them.
type: Comment
comment on: http://stackoverflow.com/q/21135220
type: QuestionComment

http://stackoverflow.com/a/21173998
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21173929
answers question: http://stackoverflow.com/q/21173929
upvote count: 3
type: Answer
has body: Just wrap the string in a ByteArrayInputStream and you can use the method you linked: InputStream pemStream = new ByteArrayInputStream(pemKey.getBytes()); byte[] derKey = EncryptionUtil.convertRsaPemToDer(pemStream);
downvote count: 0
has comment: http://stackoverflow.com/comment/31901981
score: 3

http://stackoverflow.com/q/21043762
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21043931
tagged with: java
has body: Hello I am trying to perform some actions while the user is holding down a button. My problem is that my Runnable wont "run". Here is my code: @Override public boolean onLongClick(View v) { final Runnable r = new Runnable() { public void run() {//do the forwarding logic here int test = 0; if(holdingDown) test++; else return; Log.i("test", test+""); } }; r.run(); } return false; } @Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction() &amp; MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_UP: { holdingDown= false; Log.i("holdingDown", "false"); break; } } return false; } The onTouch is for detecting when the user stop pressing the button. When I look at my logs I see at that the Runnable runs only once. My test log get only the value 1. The log call for Log.i("holdingDown", "false") is getting triggered at the right time, only when I stop touching the button. Why is it that my Runnable won't run? Thanks. EDIT: I tried this code: @Override public boolean onLongClick(View v) { // TODO Auto-generated method stub holdingDown = true; new Thread(new Runnable() { @Override public void run() { if(holdingDown) { int test = 0; test++; Log.i("test", test+""); } else return; } }).start(); return false; } Its till not working.
type: Question
has answer: http://stackoverflow.com/a/21045229
has title: Do action while long click
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21043822
has answer: http://stackoverflow.com/a/21043931
has comment: http://stackoverflow.com/comment/31637344
possible better answer: http://stackoverflow.com/a/21043822
tagged with: android

http://stackoverflow.com/comment/31793602
type: QuestionComment
comment on: http://stackoverflow.com/q/21127955
type: Comment
has text: To read the content of an element in your array dynamically, you would have to use matrix[i][j]. To print out the coordinates, use System.out.println(i + " " + j);
score: 3

http://stackoverflow.com/q/21109349
has answer: http://stackoverflow.com/a/21113369
has comment: http://stackoverflow.com/comment/31759008
has answer: http://stackoverflow.com/a/21114858
answer count: 2
tagged with: instrumentation
downvote count: 0
has comment: http://stackoverflow.com/comment/31758981
favorite count: 0
has body: I am new to java world. Our team is using Maven to building everything into single .war file. I am looking for tools to instrument .war files to enable code coverage. Idea is to manually instrument .war file and then run the test. I looked at couple of tools, but not getting exactly what I am looking for e.g. Emma, jester, cobertura etc. Looking for simple instructions.
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: maven
linked to: http://stackoverflow.com/q/1660141
tagged with: war
type: Question
has title: Maven code coverage
tagged with: java
has comment: http://stackoverflow.com/comment/31760202

http://stackoverflow.com/comment/31836952
comment on: http://stackoverflow.com/q/21151829
type: Comment
type: QuestionComment
has text: They already stripped the code out!
score: 1

http://stackoverflow.com/q/21059328
tagged with: string
has body: I have two strings which are mentioned below - HelloWorld GoodBye How do I randomly select any one of the strings? Below is an enum which contains the above two strings and I am supposed to use below enums to randomly select any one of the string between HelloWorld and GoodBye public enum StringEnum { HelloDavid, HelloWorld, GoodBye; private static final Map&lt;Integer, StringEnum&gt; BY_CODE_MAP = new LinkedHashMap&lt;Integer, StringEnum&gt;(); static { for (StringEnum rae : StringEnum.values()) { BY_CODE_MAP.put(rae.ordinal(), rae); } } public static String forCode(int code) { return BY_CODE_MAP.get(code).name(); } } Any idea how this can be done efficiently by getting the strings from enum?
has answer: http://stackoverflow.com/a/21059473
has comment: http://stackoverflow.com/comment/31666716
has title: How to randomly select a string between two strings from ENUM in java?
linked to: http://stackoverflow.com/q/13340516
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21059473
type: Question
tagged with: enums
tagged with: java
score: 0
tagged with: random
answer count: 1

http://stackoverflow.com/q/21036943
upvote count: 1
type: Question
has body: I'm trying to override the default permission evaluator in Spring Security 3.0, but no matter what I do, the permission elevator is ignored and the default, DenyAllPermissionEvaluator is invoked instead. I'm using programmatic configuration, and I've tried setting the permission evaluator by overriding the configure(WebSecurity) and configure(Http) methods of the WebSecurityConfigurerAdapter class, but this doesn't help much. What is the proper way of setting a custom permission evaluator that will actually be used by Spring Security?
tagged with: java
has title: Custom Permission Evaluator
answer count: 1
downvote count: 0
tagged with: spring-security
favorite count: 0
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/21040728
score: 1
has comment: http://stackoverflow.com/comment/31630027

http://stackoverflow.com/a/21100928
answers question: http://stackoverflow.com/q/21100881
type: AcceptedAnswer
has body: You created your 2D array too early. With this line: int [][] matrix = new int[alen+1][blen+1]; alen and blen are still 0 (their default initial value), so you created a 1x1 matrix. Don't create it until you have initialized alen and blen in main: blen = b.length(); usrip.close(); // Now create it: String1.matrix = new int[alen+1][blen+1]; System.out.println("Matrix size: " + alen + "X" + blen ); It would be cleaner to move such initialization logic to a constructor. Such a constructor would take alen and blen as parameters and create the matrix there. Additionally, this line looks incorrect, checking i when looping over j: for(int j=0;i&lt;blen+1;j++) Try for(int j=0;j&lt;blen+1;j++)
upvote count: 3
has comment: http://stackoverflow.com/comment/31744434
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/21100881
downvote count: 0

http://stackoverflow.com/comment/31619667
comment on: http://stackoverflow.com/a/21033085
has text: Thanks very much for the explanation. It was actually the first option that i had to use. It's a school exercise and i had to do it that way (from the setTitle() method) but I didn't know that i can use the frame object in the setTitle() method that way too. Thanks very much!
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/21163201
has comment: http://stackoverflow.com/comment/31862547
has comment: http://stackoverflow.com/comment/31868615
tagged with: sockets
has body: I am trying to write some code that allows clients to send files to server. But I cannot send files with this code. Server: package Server; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; public class SimpleServer { public static int serverThreadCount = 0; public static final int maxUser = 10; public static String[] username = new String[maxUser]; public static String[] password = new String[maxUser]; public static String[] online = new String[maxUser]; public static void main(String[] args) { int id = 1; username[0] = "a"; username[1] = "b"; username[2] = "c"; username[3] = "d"; username[4] = "e"; username[5] = "f"; username[6] = "g"; username[7] = "h"; username[8] = "i"; username[9] = "j"; for(int i=0; i&lt;maxUser; i++) { password[i] = "123"; online[i] = "free"; } try { ServerSocket ss = new ServerSocket(7777); System.out.println("Server has successfully been started."); while(true) { Socket socket = ss.accept(); new Thread(new ServerThread(socket, id)).start(); serverThreadCount++; System.out.println("Client " + id + " is now connected to the server."); id++; } } catch(IOException e) { System.err.println("IOException in serverSocket"); e.printStackTrace(); } } public static boolean verifyLogin(String u, String p) { for(int i=0; i&lt;maxUser; i++) { if(username[i].equals(u) &amp;&amp; password[i].equals(p)) return true; } return false; } public static void setOnline(String name) { for(int i=0; i&lt;maxUser; i++) { if(online[i].equals("free")) { online[i] = name; break; } } } public static boolean isOnline(String u) { for(int i=0; i&lt;maxUser; i++) { if(online[i].equals(u)) return true; } return false; } } ServerThread: package Server; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.EOFException; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io…
answer count: 0
type: UnansweredQuestion
tagged with: file
type: Question
has comment: http://stackoverflow.com/comment/31861751
tagged with: network-programming
tagged with: java
has title: File cannot be sent to server from client using sockets in Java
score: 0
tagged with: client-server

jogl
tags question: http://stackoverflow.com/q/21095997
tag name: jogl
type: Tag

http://stackoverflow.com/comment/31871532
comment on: http://stackoverflow.com/q/21150452
score: 0
type: Comment
type: QuestionComment
has text: @Andrea i have added the details as per your request.

http://stackoverflow.com/a/21072516
accepted answer of: http://stackoverflow.com/q/21072452
downvote count: 2
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/31691592
has body: Try this scrollpane.setBounds(100,50,800,400); JTable table = new JTable(myTableModel(res)); scrollpane.setViewporView(table);
answers question: http://stackoverflow.com/q/21072452
score: -1

http://stackoverflow.com/a/21130278
answers question: http://stackoverflow.com/q/21130213
downvote count: 0
score: 4
has body: Try Apache Commons CSV or OpenCSV.
type: Answer
upvote count: 4

http://stackoverflow.com/a/43500900
answers question: http://stackoverflow.com/q/21151512
score: 0
type: Answer
has body: public static void main(String[] args) throws IOException{ Scanner in = new Scanner(System.in); int output = 0; int ip1_cols = 0; ip1_cols = Integer.parseInt(in.nextLine().trim()); in.useDelimiter(" "); char[] ip1 = new char[ip1_cols]; for(int ip1_j=0; ip1_j&lt;ip1_cols; ip1_j++) { ip1[ip1_j] = in.next().charAt(0); } enumerate(ip1); for (Iterator iterator = possibleAleternatives.iterator(); iterator.hasNext();) { String cs = (String) iterator.next(); System.out.println(cs); } } static Set&lt;String&gt; possibleAleternatives=new HashSet(); static void enumerate(char[] charArr){ for (int i = 0; i &lt; charArr.length; i++) { char c = charArr[i]; if(c=='?'){ findPossibleAlternatives(charArr, i); } } String s=String.valueOf(charArr); if(!s.contains("?")){ possibleAleternatives.add(s); } } static void findPossibleAlternatives(char[] charArray,int i ){ char[] newArr1=Arrays.copyOf(charArray, charArray.length); char[] newArr=Arrays.copyOf(newArr1, newArr1.length); newArr1[i]='0'; enumerate(newArr1); newArr1=null; newArr[i]='1'; enumerate(newArr); newArr=null; } A complete version without replaceFirst()

http://stackoverflow.com/a/21201261
has body: Its Seems that your java file code is wrong. Your first function should be OnCreate() and rest of the code should be write after that. Even you have set your view after long code which is totally wrong. public class PadActivity extends Activity { // set your variables &amp; objects .. .. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.pad_layout); ... ... //Other code } } Please change your code position that will definitely work.
downvote count: 0
type: Answer
score: 3
answers question: http://stackoverflow.com/q/21165595
upvote count: 3

http://stackoverflow.com/a/21148598
downvote count: 0
answers question: http://stackoverflow.com/q/21122128
type: Answer
accepted answer of: http://stackoverflow.com/q/21122128
score: 1
upvote count: 1
has body: It looks like it is an actual defect. We have logged the details (along with a sample project simulating the defect) here: https://jira.springsource.org/browse/SGF-247
type: AcceptedAnswer

http://stackoverflow.com/a/21167854
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31867804
has comment: http://stackoverflow.com/comment/31866262
has body: Here is what I came up with after a bit of testing... public String keepOneWS(String str) { Pattern p = Pattern.compile("(\\s+)"); Matcher m = p.matcher(str); Pattern pBlank = Pattern.compile("[ \t]+"); String newLineReplacement = System.getProperty("line.separator") + System.getProperty("line.separator"); StringBuffer sb = new StringBuffer(); while (m.find()) { if(pBlank.matcher(m.group(1)).matches()) { m.appendReplacement(sb, " "); } else { m.appendReplacement(sb, newLineReplacement); } } m.appendTail(sb); return sb.toString().trim(); } public void testKeepOneWS() { String str = " This \t is\r\n " + "\r\n" + " \r\n " + " \r \n \t \n " + "\r\n" + " a \t string. \t "; String expected = "This is" + System.getProperty("line.separator")+ System.getProperty("line.separator") + "a string."; String actual = keepOneWS(str); System.out.println("'" + actual + "'"); assertEquals(expected, actual); } After a goup of whitespace is captured, it is checked whether it consists only of spaces, if yes then that goup is replaced by one single space, otherwise the goup consits of spaces and line terminators, in this case the group is replaced by one line terminator. The output is: 'This is a string.'
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21165802

http://stackoverflow.com/a/21133829
has body: Check RandomAccessFile: http://docs.oracle.com/javase/7/docs/api/java/io/RandomAccessFile.html You have to keep track of the position you are reading from and the position you are writing to. Initially both are at the start. Then you read N bytes (one line), shorten it, seek back N bytes and write M bytes (the shortened line). Then you seek forward (N - M) bytes to get back to the position where next line starts. Then you do this over and over again. In the end truncate excess with setLength(long). You can also do it in batches (like read 4kb, process, write, repeat) to make it more efficient. The process is identical in all languages. Some make it easier by hiding the seeking back and forth behind an API. Of course you have to be absolutely sure that your program works flawlessly, since there is no way to undo this process. Also, the RandomAccessFile is a bit limited, since it can not tell you at which position the file is at a given moment. Therefore you have to do conversion between "decoded strings" and "encoded bytes" as you go. If your file is in UTF-8, a given character in the string can take one ore many bytes in the file. So you can't just do seek(string.length()). You have to use seek(string.getBytes(encoding).length) and factor in possible line break conversions (Windows uses two characters for line break, Unix uses only one). But if you have ASCII, ISO-Latin-1 or similar trivial character encoding and know what line break chars the file has, then the problem should be pretty simple. And as I edit my answer to match all possible corner cases, I think it would be better to read the file using BufferedReader and correct character encoding and also open a RandomAccessFile for doing the writing. If your OS supports having a file being opened twice. This way you would get complete Unicode support from BufferedReader and yuou wouldn't have to keep track of read and write positions. You have to do the writing with RandomAccessFile because using a Writer to the f…
has comment: http://stackoverflow.com/comment/31808101
downvote count: 0
score: 9
type: Answer
answers question: http://stackoverflow.com/q/21133391
accepted answer of: http://stackoverflow.com/q/21133391
upvote count: 9
type: AcceptedAnswer

http://stackoverflow.com/comment/31719345
type: Comment
has text: I advise you to integrate some XML operating API into your project, e.g. DOM4J, SAX. Usually it provides lots of convenient method of for DOM operation. otherwise you'll have to replace and replace.
comment on: http://stackoverflow.com/a/21087325
score: 0
type: AnswerComment

http://stackoverflow.com/a/21150032
has body: You have to reinput that value you get for the deepest recursion call into the previous level and so forth. func(1) = 2 func(2) = 3 * func(1) + 1 = 7 func(3) = 3 * func(2) + 1 = 22 func(4) = 3 * func(3) + 1 = 67
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21149968

http://stackoverflow.com/comment/31824471
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21145372
has text: well debugged! got my mistake
score: 0

http://stackoverflow.com/a/79346433
has comment: http://stackoverflow.com/comment/139929445
type: Answer
has body: If anyone has followed the answers on this question and is still strugling to get the links working, make sure to avoid my mistake... From my testing, the link annotation will not work if the URI String doesn't start with one of those prefixes https://, http:// or www. This behaviour was observed on PDFBox 3.0.3. Edit: This behavirour is PDF reader dependent, in my case I was using Firefox 134.0 (64-bit). Thanks to K J for pointing this out!
has comment: http://stackoverflow.com/comment/139923450
answers question: http://stackoverflow.com/q/21021502
score: 0

http://stackoverflow.com/a/21106186
answers question: http://stackoverflow.com/q/21106121
has body: Becase after you do "i1 = 5;", i1 starts pointing to another address. And it is no more the same Integer than is stored in your HashSet.
score: 0
type: Answer

http://stackoverflow.com/comment/31844949
comment on: http://stackoverflow.com/q/21156383
score: 0
type: Comment
has text: @TheLostMind - workbook and sheet are not null. Only the cell or the row can be null, judging by the fact he gets the error here XSSFCell cell = row.getCell(j); and not above
type: QuestionComment

http://stackoverflow.com/q/21046765
has body: I installed java 7 on windows xp. Test was ok: C:\Users\nlel&gt;java -version java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode) I added system variables for JAVA_HOME: C:\Program Files\Java\jdk1.7.0_45 I need to change to 1.6 version I installed 1.6 version and changed system variable for java home: C:\Program Files\Java\jdk1.6.0_45 at PATH I have next: %JAVA_HOME%terminal\bin but after restarting console with PC I keep having the same java version after checking: C:\Users\nlel&gt;java -version java version "1.7.0_45" .... Update: Now with suggestions it looks next: C:\Users\nlel&gt;echo %PATH% C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windo owsPowerShell\v1.0\;C:\Program Files (x86)\Kaspersky Lab\Kaspers rity 8 for Windows\;C:\Program Files\Java\jdk1.6.0_45\bin;C:\Pro e\apache-maven-3.1.1\bin;C:\Program Files\Apache\apache-ant-1.9. Files (x86)\SMLNJ\bin\;C:\Program Files (x86)\sbt\;C:\Program F \\bin;C:\cygwin64\bin;C:\tools\utils;C:\Program Files\Java\jdk1. ndows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\Sy werShell\v1.0\;C:\Program Files (x86)\Kaspersky Lab\Kaspersky En 8 for Windows\;C:\Program Files\Java\jdk1.6.0_45\bin;C:\Program che-maven-3.1.1\bin;C:\Program Files\Apache\apache-ant-1.9.3/bin s (x86)\SMLNJ\bin\;C:\Program Files (x86)\sbt\;C:\Program Files ;C:\cygwin64\bin;C:\tools\utils C:\Users\nlel&gt;echo %JAVA_HOME% C:\Program Files\Java\jdk1.6.0_45 C:\Users\nlel&gt;java -version java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode) And javac -version: C:\Users\nlel&gt;jav javac 1.6.0_45 Why exactly this happen?
has comment: http://stackoverflow.com/comment/31643039
possible better answer: http://stackoverflow.com/a/21046954
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/48062985
tagged with: java
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/21046982
type: Question
accepted answer: http://stackoverflow.com/a/21046982
has title: how to change java environment variable on windows
score: 0
answer count: 2
tagged with: environment-variables
favorite count: 0
has answer: http://stackoverflow.com/a/21046954

izpack
tag name: izpack
type: Tag
tags question: http://stackoverflow.com/q/21056074

http://stackoverflow.com/q/21087659
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21088141
has answer: http://stackoverflow.com/a/21088106
linked to: http://stackoverflow.com/q/21228900
accepted answer: http://stackoverflow.com/a/21088106
type: Question
tagged with: captcha
tagged with: imageview
tagged with: java
has comment: http://stackoverflow.com/comment/31719606
has comment: http://stackoverflow.com/comment/31719242
score: 0
answer count: 2
has body: I have a PNR Inquiry app on Google Play. It was working very fine. But recently Indian Railwys added captcha to their PNR Inquiry section and because of this I am not able to pass proper data to the server to get proper response. How to add this captcha in my app in form of an imageview and ask the users to enter captcha details also so that I can send proper data and get proper response. Indian Railways PNR Inquiry Link
has answer: http://stackoverflow.com/a/21088141
upvote count: 1
downvote count: 1
favorite count: 0
has title: How to display captcha in ImageView in Android.?
tagged with: android

http://stackoverflow.com/comment/31711783
score: 0
type: Comment
type: QuestionComment
has text: Ok thanks. Since the server outside my network can only see my public IP, is there a way I can make the website (web service) uniquely identify each computer connects to it?
comment on: http://stackoverflow.com/q/21083425

http://stackoverflow.com/comment/31672857
comment on: http://stackoverflow.com/a/21062444
type: Comment
has text: i have some red curly lines at public **boolean** onItemClick(AdapterView<?> arg0, View arg1, and **adapter.notifyDataSetChanged();**
type: AnswerComment
score: 0

http://stackoverflow.com/a/21123890
has comment: http://stackoverflow.com/comment/31787240
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/31785826
type: Answer
has comment: http://stackoverflow.com/comment/31785888
has comment: http://stackoverflow.com/comment/31786087
has comment: http://stackoverflow.com/comment/31786263
has body: I will give you a simple piece of code: public class Test { private int foo = bar; private int bar = foo; } What would you expect this to do? I presume that designers of Java has done it so because assignment of values to instance variables must be executed in some order. In the case of Java, they are executed downwards (from up to bottom). EDIT What about this? public class Test { private int foo = quu++; private int bar = quu++; private int quu = 1; } What values would foo and bar have? Which quu++ statement would be executed first? My point is, Java designers must have thought that it is counter intuitive to do it as you did describe in your question, i.e. unordered execution with compile time code analysis. FINAL EDIT Let's complicate things: class Test { private James james = new James(anInt); private Jesse jesse = new Jesse(anInt); private IntWrapper anInt = new IntWrapper(); } class James { public James(IntWrapper anInt) { if(--anInt.value != 0) { new Jesse(anInt); } else { anInt.isJames = true; } } } class Jesse { public Jesse(IntWrapper anInt) { if(--anInt.value != 0) { new James(anInt); } else { anInt.isJames = false; } } } class IntWrapper { public int value = 99; public boolean isJames; } I am not sure what it proves regarding your question because I am not sure about your point. There is no circular dependency here but value of an instance variable of IntWrapper, isJames, depends on the execution order and it might be difficult to detect this kind of stuff with a lexical/semantic analyzer.
upvote count: 4
answers question: http://stackoverflow.com/q/21123836
has comment: http://stackoverflow.com/comment/31786501
has comment: http://stackoverflow.com/comment/31786109

http://stackoverflow.com/comment/39661923
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21091207
has text: Useful tip just just as discussed [here](http://stackoverflow.com/questions/10719729/cannot-deserialize-instance-of-object-out-of-start-array-token-in-spring-3-rest)

http://stackoverflow.com/a/21110431
answers question: http://stackoverflow.com/q/21110379
score: 0
has body: You using String incorrectly. Instead of accessing via [] use dna.charAt(i). Altough logically a string is an array of characters in Java a String type is a class (which means it has attributes and methods) and not a typical array. And if you want to compare a single character to another enclose it with '' instead of "": if (dna.charAt(i) == 'c') . .
type: Answer

tablemodel
type: Tag
tag name: tablemodel
tags question: http://stackoverflow.com/q/21038028
tags question: http://stackoverflow.com/q/21171609

http://stackoverflow.com/q/21128310
answer count: 2
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21129189
has answer: http://stackoverflow.com/a/65549720
has comment: http://stackoverflow.com/comment/31794242
has comment: http://stackoverflow.com/comment/31794440
possible better answer: http://stackoverflow.com/a/65549720
linked to: http://stackoverflow.com/q/6849705
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21129189
tagged with: android
has body: So I'm trying to make a timer like a stopwatch but I'm a complete noob. I tried "combining" things from Here and Here. The goal is to take user input for how long they want to set the timer for, then when the time is up it does stuff. This is what I have so far: package com.example.timer; import android.app.Activity; import android.os.Bundle; import android.os.CountDownTimer; 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 { private CountDownTimer countDownTimer; private boolean timerHasStarted = false; public TextView text; private final long interval = 1 * 1000; EditText editTime1; Button startButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); editTime1 = (EditText)findViewById(R.id.editTime1); startButton = (Button)findViewById(R.id.startButton); text = (TextView) this.findViewById(R.id.timer); startButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { //get the name from edittext and storing into string variable long timeVal = Long.parseLong(editTime1.getText().toString()); countDownTimer = new MyCountDownTimer(timeVal, interval); text.setText(text.getText() + String.valueOf(timeVal / 1000)); if (!timerHasStarted) { countDownTimer.start(); timerHasStarted = true; startButton.setText("STOP"); } else { countDownTimer.cancel(); timerHasStarted = false; startButton.setText("RESTART"); } } class MyCountDownTimer extends CountDownTimer { public MyCountDownTimer(long timeVal, long interval) { super(timeVal, interval); } @Override public void onTick(long millisUntilFinished) { text.setText("" + millisUntilFinished / 1000); } @Override public void onFinish() { text.setText("Times up"); } } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu…
has title: User input and timer (java android app)
type: Question

http://stackoverflow.com/comment/31871993
score: 0
type: Comment
has text: Thanks. Appreciated. But NOW it crashes if the array is empty. It didn't before.
type: AnswerComment
comment on: http://stackoverflow.com/a/21170652

http://stackoverflow.com/comment/31671919
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21051165
has text: Sure : https://bitbucket.org/Josef_Lowdin/civilforsvaret_webapp
score: 0

http://stackoverflow.com/comment/31699014
type: Comment
has text: Thanks. I downloaded both commons-io.1.3 and commons-io-2.0 versions. But i tried only with 1.3. Now i will try with 2.0 version.
type: AnswerComment
comment on: http://stackoverflow.com/a/21076704
score: 0

http://stackoverflow.com/q/21092638
has comment: http://stackoverflow.com/comment/31727976
favorite count: 0
accepted answer: http://stackoverflow.com/a/21119321
tagged with: android
has comment: http://stackoverflow.com/comment/31739410
has body: Below is what I want to achieve. Each rounded-corner View is a LinearLayout. The 3 Views inside of the LinearLayout are supposed to each have a weight of 1. Right now, when I run the below code nothing is displayed. Only the background is showing but none of the Views. LinearLayout.LayoutParams params2 = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT); params1.weight = 1; LinearLayout.LayoutParams params3 = new LinearLayout.LayoutParams(0, 75); params1.weight = 1; LinearLayout.LayoutParams params4 = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT); params1.weight = 1; ll.addView(levelTV, params4); ll.addView(recordTV, params2); ll.addView(image, params3); linearlayout.addView(ll, params1); When setting weights, aren't you supposed to set the widths to zero? When I change the widths to LinearLayout.LayoutParams.MATCH_PARENT, all I see are the numbers (1, 2, 3, etc.) but nothing else. How can I get my desired layout?
has answer: http://stackoverflow.com/a/21119321
has comment: http://stackoverflow.com/comment/31734605
upvote count: 1
has comment: http://stackoverflow.com/comment/31741893
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31728394
score: 1
tagged with: java
tagged with: android-linearlayout
has comment: http://stackoverflow.com/comment/31735770
has comment: http://stackoverflow.com/comment/31727786
has comment: http://stackoverflow.com/comment/31736258
type: Question
has title: Set weight of Views in LinearLayout
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/31781765
comment on: http://stackoverflow.com/a/21120846
score: 0
type: AnswerComment
has text: @user3195144 Then basically copy the code that you have for monday and put it in different views, changing variable names appropriately.
type: Comment

http://stackoverflow.com/comment/31687639
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21070392
type: QuestionComment
has text: Did changing the `||` to `&&` fix the out-of-bounds exception? If so, it's really confusing to have the fixed code in your question now. If you have a separate problem then you need to create a new question.

http://stackoverflow.com/a/21126231
upvote count: 2
type: Answer
score: 2
downvote count: 0
has body: The way I do it is either using XStream or Jackson API (preferred) to serialize the java object to either a XML or a JSON file. For example, see my XStream data provider I wrote for use with TestNG or JUnit parameterized tests.
answers question: http://stackoverflow.com/q/21125998

http://stackoverflow.com/a/21134756
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21134425
accepted answer of: http://stackoverflow.com/q/21134425
has body: Refer this link it would be helpfull. http://developer.android.com/training/design-navigation/ancestral-temporal.html As they say, a picture says a thousands words:
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/21050088
downvote count: 0
score: 3
accepted answer of: http://stackoverflow.com/q/21049986
has comment: http://stackoverflow.com/comment/31649502
has body: Double quoted strings are a shell feature and Runtime.exec() does not invoke a shell to parse the command.
answers question: http://stackoverflow.com/q/21049986
upvote count: 3
has comment: http://stackoverflow.com/comment/31649434
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/30068576
has body: I was also in the same problem, check your build path in eclipse by Right Click on Project > build path > configure build path Now check for Excluded Files, it should not have your file specified there by any means or by regex. Cheers!
score: 4
answers question: http://stackoverflow.com/q/21068440
upvote count: 4
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31699320
has text: The object of type Basket: where is it created?
score: 0
comment on: http://stackoverflow.com/q/21077064
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21042809
possible better answer: http://stackoverflow.com/a/21052099
favorite count: 0
has answer: http://stackoverflow.com/a/21052099
has answer: http://stackoverflow.com/a/21109809
has title: bad reloc address 0x0 when compiling hsdis (Java HotSpot disassembler plugin) on cygwin
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/21109809
answer count: 2
tagged with: jvm-hotspot
downvote count: 0
tagged with: compilation
tagged with: cygwin
tagged with: http://stackoverflow.com/tag/c
score: 4
has body: I'm trying to compile the hsdis-amd64.dll library that the JVM needs to disassemble JIT compiled code. I followed this accepted answer. I installed cygwin downloaded openjdk-7u40-fcs-src-b43-26_aug_2013.zip and downloaded binutils-2.24.tar.gz I created a folder structure like this: + +- hsdis // unzipped dir hotspot/src/share/tools/hsdis of openjdk zip +- binutils-2.24 // unzipped binutils-2.24.tar.gz First I tried to just compile it using: $ make OS=Linux MINGW=x86_64-w64-mingw32 BINUTILS=../binutils-2.24 but it failed with /Linux-amd64/opcodes/libopcodes.a build/Linux-amd64/libiberty/libiberty.a hsdis.c:32:20: fatal error: sysdep.h: No such file or directory #include &lt;sysdep.h&gt; ^ compilation terminated. So I applied the patch provided in this accepted answer and tried again. The compilation failed again In file included from hsdis.c:34:0: build/Linux-amd64/bfd/bfd.h:35:2: error: #error config.h must be included before this header #error config.h must be included before this header ^ I followed the proposal of the compiler and added config.h just before the errno.h include. Then the error is e -I../binutils-2.24/bfd -Ibuild/Linux-amd64/bfd -DLIBARCH_amd64 -DLIBARCH=\"amd64\" -DLIB_EXT=\".dll\" -O hsdis.c -shared build/Linux-amd64/bfd/libbfd.a build/Linux-amd64/opcodes/libopcodes.a build/Linux-amd64/libiberty/libiberty.a build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x15): undefined reference to `compressBound' build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x48): undefined reference to `compress' build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x28a): undefined reference to `inflateInit_' build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x2c7): undefined reference to `inflate' build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x2d6): undefined reference to `inflateReset' build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x2f1): undefined reference to `inflateEnd' /usr/lib/gcc/x86_64-w…
linked to: http://stackoverflow.com/q/9341083

http://stackoverflow.com/a/21175820
has comment: http://stackoverflow.com/comment/31881899
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31884815
has comment: http://stackoverflow.com/comment/31883173
has comment: http://stackoverflow.com/comment/31881132
has body: while((buffer = bot1.getReader().readLine()) != null){ This looks as though you are constructing a new BufferedReader every time you read a line. You must use the same one for the life of the socket. Ditto whatever you use for output.
has comment: http://stackoverflow.com/comment/31882089
upvote count: 1
answers question: http://stackoverflow.com/q/21175578

http://stackoverflow.com/q/21133692
score: 3
has answer: http://stackoverflow.com/a/21134287
has title: Why does my Android ListAdapter only show one item?
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/31803227
has comment: http://stackoverflow.com/comment/31804272
has body: In my Android app I'm trying to build my very first custom listadapter. I now managed to get it to display one item, but unfortunately one item only where there are 8 in the list. My adapter looks like this: public class PossibilitiesAdapter extends BaseAdapter { private AdapterCallbacks callbacks; private List&lt;String&gt; possibilitiesList = new ArrayList&lt;String&gt;(); private LayoutInflater inflater; public PossibilitiesAdapter(Context context) { inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public void setPossibilitiesList(List&lt;String&gt; possibilitiesList) { for (String possibility : possibilitiesList) { addItem(possibility); } } public void addItem (final String item) { possibilitiesList.add(item); notifyDataSetChanged(); } private class ViewHolder { TextView possibilityTitle; } @Override public View getView(final int position, View convertView, ViewGroup viewGroup) { ViewHolder holder = new ViewHolder(); convertView = inflater.inflate(R.layout.list_item_posibility, viewGroup, false); holder.possibilityTitle = (TextView) convertView.findViewById(R.id.text_possibility); holder.possibilityTitle.setText(possibilitiesList.get(position)); return convertView; } @Override public int getCount() { return possibilitiesList.size(); } // And here are some more things like getItemId() and getItem() } and I set the possibilitiesList from my fragment like so: List&lt;String&gt; list = Arrays.asList(getResources().getStringArray(R.array.the_possibilities)); Log.e(this, new Integer(list.size()).toString()); // Outputs 8, so there are enough in the array. adapter.setPossibilitiesList(list); My fragment_possibilities.xml looks like this: &lt;ListView android:id="@+id/list_possibilities" android:layout_width="match_parent" android:layout_height="match_parent"/&gt; and my list_item_possibility.xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orient…
type: Question
has comment: http://stackoverflow.com/comment/31803405
has comment: http://stackoverflow.com/comment/31804191
has comment: http://stackoverflow.com/comment/31809455
has comment: http://stackoverflow.com/comment/31805247
accepted answer: http://stackoverflow.com/a/21134360
has comment: http://stackoverflow.com/comment/31803846
has comment: http://stackoverflow.com/comment/31803198
possible better answer: http://stackoverflow.com/a/21133892
has comment: http://stackoverflow.com/comment/31803418
has answer: http://stackoverflow.com/a/21133892
downvote count: 0
has comment: http://stackoverflow.com/comment/31808584
has answer: http://stackoverflow.com/a/21133956
favorite count: 0
tagged with: listadapter
has comment: http://stackoverflow.com/comment/31805673
has comment: http://stackoverflow.com/comment/31803165
has comment: http://stackoverflow.com/comment/31805431
tagged with: android
has comment: http://stackoverflow.com/comment/31803283
answer count: 4
has comment: http://stackoverflow.com/comment/31805709
has answer: http://stackoverflow.com/a/21134360
type: AnsweredQuestion

http://stackoverflow.com/q/21156660
tagged with: macos
has body: After deleting all Java installations (multiple Java versions were present) in my Mac from /System/Library/Frameworks/JavaVM.framework/ any new installation of JRE fails with following exception (from /var/log/install.log) Jan 16 13:28:51 MacBook-LT installd[1171]: ./postinstall: Error occurred during initialization of VM Jan 16 13:28:51 MacBook-LT installd[1171]: ./postinstall: java.lang.NullPointerException Jan 16 13:28:51 MacBook-LT installd[1171]: ./postinstall: at java.util.Hashtable.put(Hashtable.java:514) Jan 16 13:28:51 MacBook-LT installd[1171]: ./postinstall: at java.lang.System.initProperties(Native Method) Jan 16 13:28:51 MacBook-LT installd[1171]: ./postinstall: at java.lang.System.initializeSystemClass(System.java:1119) How to recover from this error?
favorite count: 0
has comment: http://stackoverflow.com/comment/32597077
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/46604483
score: 2
answer count: 0
upvote count: 2
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/26252591
has comment: http://stackoverflow.com/comment/32586572
has comment: http://stackoverflow.com/comment/32534941
has title: JRE installation fails in mac os 10.8
downvote count: 0

http://stackoverflow.com/q/21021834
has comment: http://stackoverflow.com/comment/31598266
favorite count: 0
has comment: http://stackoverflow.com/comment/31598720
tagged with: netbeans
has comment: http://stackoverflow.com/comment/31609072
upvote count: 0
has comment: http://stackoverflow.com/comment/31598180
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/31602872
tagged with: java
has title: Cannot run an SQL query in Netbeans 7.3
score: -1
type: Question
has body: public jIFraEditSchoolNew() { initComponents(); try { con = new DBConnection().connect(); stmt = con.createStatement(); query = "select item_name from mst_item where flag != 'D'"; rs = stmt.executeQuery(query); jCmbItemName1.addItem(""); jCmbItemName.addItem(""); while (rs.next()) { jCmbItemName.addItem(rs.getString(1)); jCmbItemName1.addItem(rs.getString(1)); } jCmbYear.addItem(""); query = "select DISTINCT(school_year) from mst_school where flag != 'D'"; rs = stmt.executeQuery(query); while (rs.next()) { \\stops at this line jCmbYear.addItem(rs.getString(1)); } jDtePurchasedOn.setDate(new Date()); model1 = (DefaultTableModel) jtblStitch.getModel(); model2 = (DefaultTableModel) jtblMaterial.getModel(); } catch (SQLException ex) { JOptionPane.showMessageDialog(this, ex.getMessage()); } finally { try { if (!rs.isClosed()) { rs.close(); } if (!con.isClosed()) { con.close(); } if (!stmt.isClosed()) { stmt.isClosed(); } } catch (SQLException ex) { JOptionPane.showMessageDialog(this, ex.getMessage()); } } } This is a constructor of my java internal frame, the program stops when is reaches the second loop. I tried debugging the problem but did not show any error message but it keeps showing Java Result: 1 in the output screen. I checked whether there is any thing wrong with my SQL query but it runs fine (returns one row). I can't figure out the problem, please help if anyone knows how to solve this problem! These are information about my development environment: Product Version: NetBeans IDE 7.3 (Build 201306052037) Java: 1.7.0_17; Java HotSpot(TM) 64-Bit Server VM 23.7-b01 Runtime: Java(TM) SE Runtime Environment 1.7.0_17-b02 System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
has answer: http://stackoverflow.com/a/21023469
has comment: http://stackoverflow.com/comment/31603090
tagged with: sql
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31598451

http://stackoverflow.com/comment/31815481
type: Comment
score: 0
has text: Guess you have to read the source yourself.
comment on: http://stackoverflow.com/q/21128852
type: QuestionComment

http://stackoverflow.com/comment/31725426
type: QuestionComment
type: Comment
has text: You're trying to define the copy constructor in a wrong way. Just use Triangle for your array and you'll be fine. Or define an interface (or an abstract class) and implement/extend those. Also check the instanceof operator (your if conditions is a bit weird).
comment on: http://stackoverflow.com/q/21091343
score: 0

selenium-webdriver
tags question: http://stackoverflow.com/q/21175847
tags question: http://stackoverflow.com/q/21043928
tags question: http://stackoverflow.com/q/21184218
tags question: http://stackoverflow.com/q/21139174
tags question: http://stackoverflow.com/q/21088703
tags question: http://stackoverflow.com/q/21027048
tags question: http://stackoverflow.com/q/21123539
tags question: http://stackoverflow.com/q/21043191
tags question: http://stackoverflow.com/q/21125762
tag name: selenium-webdriver
tags question: http://stackoverflow.com/q/21123770
tags question: http://stackoverflow.com/q/21100072
tags question: http://stackoverflow.com/q/21132556
tags question: http://stackoverflow.com/q/21050652
tags question: http://stackoverflow.com/q/21141611
tags question: http://stackoverflow.com/q/21118444
tags question: http://stackoverflow.com/q/21036239
tags question: http://stackoverflow.com/q/21043715
tags question: http://stackoverflow.com/q/21140383
tags question: http://stackoverflow.com/q/21136586
tags question: http://stackoverflow.com/q/21020412
type: Tag
tags question: http://stackoverflow.com/q/21180333
tags question: http://stackoverflow.com/q/21129708
tags question: http://stackoverflow.com/q/21023801
tags question: http://stackoverflow.com/q/21116392
tags question: http://stackoverflow.com/q/21084564

http://stackoverflow.com/a/33963160
has body: Just add the following code in the configuration of ResourceConfig class. property(ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR, "true"); See jersey.config.server.response.setStatusOverSendError
answers question: http://stackoverflow.com/q/21134629
downvote count: 0
score: 7
upvote count: 7
type: Answer

jsp
tags question: http://stackoverflow.com/q/21170413
tags question: http://stackoverflow.com/q/21146454
tags question: http://stackoverflow.com/q/21063349
tags question: http://stackoverflow.com/q/21037394
tags question: http://stackoverflow.com/q/21043128
tags question: http://stackoverflow.com/q/21179475
tags question: http://stackoverflow.com/q/21167464
tags question: http://stackoverflow.com/q/21178983
tags question: http://stackoverflow.com/q/21040997
tags question: http://stackoverflow.com/q/21120590
tags question: http://stackoverflow.com/q/21053864
tags question: http://stackoverflow.com/q/21108105
tags question: http://stackoverflow.com/q/21088456
tags question: http://stackoverflow.com/q/21050502
tags question: http://stackoverflow.com/q/21160577
tags question: http://stackoverflow.com/q/21138297
tags question: http://stackoverflow.com/q/21179492
tags question: http://stackoverflow.com/q/21175861
tags question: http://stackoverflow.com/q/21183014
tags question: http://stackoverflow.com/q/21171750
tags question: http://stackoverflow.com/q/21100153
tags question: http://stackoverflow.com/q/21029595
tags question: http://stackoverflow.com/q/21073081
tags question: http://stackoverflow.com/q/21098095
tags question: http://stackoverflow.com/q/21121294
tags question: http://stackoverflow.com/q/21154543
tags question: http://stackoverflow.com/q/21093212
tags question: http://stackoverflow.com/q/21155094
tags question: http://stackoverflow.com/q/21083267
tags question: http://stackoverflow.com/q/21049967
tags question: http://stackoverflow.com/q/21137375
tags question: http://stackoverflow.com/q/21120756
tags question: http://stackoverflow.com/q/21024214
tags question: http://stackoverflow.com/q/21172354
tags question: http://stackoverflow.com/q/21129556
tags question: http://stackoverflow.com/q/21127862
tags question: http://stackoverflow.com/q/21164627
tags question: http://stackoverflow.com/q/21027732
tags question: http://stackoverflow.com/q/21151592
tags question: http://stackoverflow.com/q/21084065
tags question: http://stackoverflow.com/q/21021261
tags question: http://stackoverflow.com/q/21145345
tags question: http://stackoverflow.com/q/21089558
tags question: http://stackoverflow.com/q/21036530
tags question: http://stackoverflow.com/q/21084634
tags question: http://stackoverflow.com/q/21158267
tags question: http://stackoverflow.com/q/21103958
type: Tag
tags question: http://stackoverflow.com/q/21140773
tags question: http://stackoverflow.com/q/21142696
tags question: http://stackoverflow.com/q/21048136
tags question: http://stackoverflow.com/q/21163612
tags question: http://stackoverflow.com/q/21115774
tags question: http://stackoverflow.com/q/21157919
tags question: http://stackoverflow.com/q/21143750
tags question: http://stackoverflow.com/q/21133796
tags question: http://stackoverflow.com/q/21108239
tags question: http://stackoverflow.com/q/21084755
tags question: http://stackoverflow.com/q/21026538
tags question: http://stackoverflow.com/q/21183002
tags question: http://stackoverflow.com/q/21042124
tags question: http://stackoverflow.com/q/21177513
tags question: http://stackoverflow.com/q/21061283
tags question: http://stackoverflow.com/q/21030160
tags question: http://stackoverflow.com/q/21130950
tags question: http://stackoverflow.com/q/21136658
tags question: http://stackoverflow.com/q/21028954
tags question: http://stackoverflow.com/q/21053438
tags question: http://stackoverflow.com/q/21068389
tags question: http://stackoverflow.com/q/21051991
tags question: http://stackoverflow.com/q/21022240
tags question: http://stackoverflow.com/q/21135873
tag name: jsp
tags question: http://stackoverflow.com/q/21099710
tags question: http://stackoverflow.com/q/21160697
tags question: http://stackoverflow.com/q/21050295
tags question: http://stackoverflow.com/q/21169560
tags question: http://stackoverflow.com/q/21048081
tags question: http://stackoverflow.com/q/21176883
tags question: http://stackoverflow.com/q/21034674

http://stackoverflow.com/comment/31652330
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21051401
has text: None work. Trust me, I tried everything, it changed from '12 'till now.
score: 0

http://stackoverflow.com/comment/31723264
has text: this function returns imagestring that store bytes and this string pass in to webservice.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21090156
type: Comment

http://stackoverflow.com/q/21179624
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21180350
accepted answer: http://stackoverflow.com/a/21180350
downvote count: 0
score: 1
tagged with: java
tagged with: jfilechooser
has body: I am adding to JCheckBoxes to a JFileChooser to get let the user chose between some extra options when exporting some data to a text file: JCheckBox field1 = new JCheckBox("Export people gender"); JCheckBox field2 = new JCheckBox("Export people age"); JPanel accessory = new JPanel(); accessory.setLayout(new BoxLayout(accessory, BoxLayout.PAGE_AXIS)); accessory.add(field1); accessory.add(field2); JFileChooser chooser = new JFileChooser(); chooser.setAccessory(accessory); int result = chooser.showOpenDialog(null); How do I get the 2 extra checkboxes checked/unchecked value (isSelected() true/false) back to the class from which the chooser is called?
type: Question
tagged with: custom-component
tagged with: variables
upvote count: 1
answer count: 1
favorite count: 0
has title: Custom JFileChooser. How to return variable?
tagged with: swing

http://stackoverflow.com/comment/72550965
type: AnswerComment
comment on: http://stackoverflow.com/a/21081821
type: Comment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/137739/discussion-between-faithreaper-and-madprogrammer).
score: 0

http://stackoverflow.com/q/21024099
answer count: 3
has body: The below program throws a NullPointerException. In Log cat it shows: 01-09 20:40:34.366: D/RemoteIt(2809): java.lang.NullPointerException When the button is clicked it doesn't goes to Mousefragment class. I tried to solve it but I can't - how to troubleshoot this? public class connect extends ListActivity implements OnClickListener{ WifiApManager wifiApManager; TextView tv; Button ipscan,con; ListView lv; EditText tbIp; private static final String TAG = "RemoteIt"; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.connect); tv =(TextView) findViewById(R.id.iptv); ipscan=(Button) findViewById(R.id.scan); con=(Button) findViewById(R.id.connect); tbIp=(EditText) findViewById(R.id.etIp); ipscan.setOnClickListener(this); con.setOnClickListener(this); lv = getListView(); } class scan extends AsyncTask&lt;Void, Void, ArrayList&lt;ClientScanResult&gt;&gt;{ public Context context; public scan(Context c) // constructor to take Context { context = c; // Initialize your Context variable } protected ArrayList&lt;ClientScanResult&gt; doInBackground(Void... params) { wifiApManager = new WifiApManager(context); // use the variable here return wifiApManager.getClientList(false); } protected void onPostExecute(ArrayList&lt;ClientScanResult&gt; clients){ CustomArrayAdapter cus = new CustomArrayAdapter(connect.this,clients); lv.setAdapter(cus); } } @Override public void onClick(View v) { // TODO Click Action... if(v == ipscan){ scan myScan = new scan(this); // pass the context to the constructor myScan.execute(); } if(v == con){ onConnectButton(); } } private void onConnectButton() { // TODO When Btn s Clicked... String ip = this.tbIp.getText().toString(); if (ip.matches("^[0-9]{1,4}\\.[0-9]{1,4}\\.[0-9]{1,4}\\.[0-9]{1,4}$")) { try { Settings.setIp(ip); Intent intent = new Intent(connect.this,MouseFragment.class); connect.this.startActivity(intent); //Intent i = new Intent(this,…
has answer: http://stackoverflow.com/a/21024628
accepted answer: http://stackoverflow.com/a/21024225
tagged with: nullpointerexception
tagged with: android
has comment: http://stackoverflow.com/comment/31602666
possible better answer: http://stackoverflow.com/a/21025036
score: 0
has title: How to troubleshoot NullPointerException?
has answer: http://stackoverflow.com/a/21025036
has comment: http://stackoverflow.com/comment/31604591
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21024225
tagged with: java
has comment: http://stackoverflow.com/comment/31603326
has comment: http://stackoverflow.com/comment/31604440
has comment: http://stackoverflow.com/comment/31603444
has comment: http://stackoverflow.com/comment/31602609

http://stackoverflow.com/comment/31714465
has text: or [`SwingUtilities.invokeLater`](http://stackoverflow.com/questions/8847083/swingutilities-invokelater-vs-eventqueue-invokelater).
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21084422

http://stackoverflow.com/q/21103900
possible better answer: http://stackoverflow.com/a/21103913
type: AnsweredQuestion
has title: How to access an integer that is inside braces?
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31751926
has comment: http://stackoverflow.com/comment/31751675
answer count: 2
has comment: http://stackoverflow.com/comment/31751794
has comment: http://stackoverflow.com/comment/31751733
favorite count: 0
tagged with: scope
has answer: http://stackoverflow.com/a/21103913
has answer: http://stackoverflow.com/a/21104868
accepted answer: http://stackoverflow.com/a/21104868
downvote count: 3
has comment: http://stackoverflow.com/comment/31751562
has comment: http://stackoverflow.com/comment/31749831
upvote count: 4
has comment: http://stackoverflow.com/comment/31749887
has comment: http://stackoverflow.com/comment/31751879
has body: Data file: J A V A 1 H 11 H 21 H 1 V 2 V 3 V 2 H 12 H 22 H 3 V 4 V 5 V 7 H 6 V 17 H Code (part of a larger program): File dataFile = new File("data.txt"); Scanner in; in = new Scanner (dataFile); String letter1 = in.next(); //Reads first letter of the word and stores it as a string String letter2 = in.next(); //Reads second letter of the word and stores it as a string String letter3 = in.next(); //Reads third letter of the word and stores it as a string String letter4 = in.next(); //Reads fourth letter of the word and stores it as a string // Not all of these ints are used in the code shown here int firstLetterValue1; int secondLetterValue1; int thirdLetterValue1; int fourthLetterValue1; int firstLetterValue2; int secondLetterValue2; int thirdLetterValue2; int fourthLetterValue2; int firstLetterValue3; int secondLetterValue3; int thirdLetterValue3; int fourthLetterValue3; int multiplier1 = 1; int multiplier2 = 1; int multiplier3 = 1; int totalWordValue1 = 0; int totalWordValue2 = 0; int totalWordValue3 = 0; // These test to see whether the first, second, third, or fourth letter of the word // Are equal to a specified letter and if they are, // then a value is stored into a different integer if (letter1.equalsIgnoreCase("A") || letter1.equalsIgnoreCase("E")) { firstLetterValue1 = 1; firstLetterValue2 = 1; firstLetterValue3 = 1; } else if (letter1.equalsIgnoreCase("D") || letter1.equalsIgnoreCase("R")) { firstLetterValue1 = 2; firstLetterValue2 = 2; firstLetterValue3 = 2; } else if (letter1.equalsIgnoreCase("B") || letter1.equalsIgnoreCase("M")) { firstLetterValue1 = 3; firstLetterValue2 = 3; firstLetterValue3 = 3; } else if (letter1.equalsIgnoreCase("V") || letter1.equalsIgnoreCase("Y")) { firstLetterValue1 = 4; firstLetterValue2 = 4; firstLetterValue3 = 4; } // For example, in the word "J A V A", the first letter, which is "J", will store // the value "8" into the integers inside the brackets (firstLetterValue1, firstLetterValue2, etc.) else if (letter1.equalsIgnore…
linked to: http://stackoverflow.com/q/11165485
has comment: http://stackoverflow.com/comment/31749864
has comment: http://stackoverflow.com/comment/31749972
has comment: http://stackoverflow.com/comment/31749863

http://stackoverflow.com/comment/31751992
comment on: http://stackoverflow.com/a/21104896
score: 0
type: Comment
has text: @nachokk You are absolutely correct and the SO code that I copied was merely pasted without alteration. I amended the answer.
type: AnswerComment

http://stackoverflow.com/comment/31687121
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/21070221
has text: return is also not required, automatically it will goto main.

http://stackoverflow.com/comment/31798495
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21130705
has text: @Raghunandan I already did that. I can't find proper solution

http://stackoverflow.com/comment/31730113
type: AnswerComment
score: 0
type: Comment
has text: I've tried it and it does not work. My frame does need a controller as specified in that class under the method "Private void link()".
comment on: http://stackoverflow.com/a/21067839

http://stackoverflow.com/a/21139871
has comment: http://stackoverflow.com/comment/31814852
score: 0
has comment: http://stackoverflow.com/comment/31814435
has comment: http://stackoverflow.com/comment/31814597
accepted answer of: http://stackoverflow.com/q/21139768
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21139768
type: Answer
has comment: http://stackoverflow.com/comment/31814450
has body: Your problem lies here : this.getLastWorkRelevantEvent(new Date(System.currentTimeMillis()-anz*24*60*60*1000L)) This always returns null and by that you will never get in your if (temp!=null){ if (temp.getSummary().equals(CalendarHelper.EventType.off)){ return false; } if (temp.getSummary().equals(CalendarHelper.EventType.work)){ return true; } } Now you have a problem with the integer anz to, it will always be 2. do this in stead: public boolean is_error(Event temp, int anz) throws IOException{ if (temp!=null){ if (temp.getSummary().equals(CalendarHelper.EventType.off)){ return false; } if (temp.getSummary().equals(CalendarHelper.EventType.work)){ return true; } //for fun do this: throw new RuntimeException("no equals is good"); } return is_error(this.getLastWorkRelevantEvent(new Date(System.currentTimeMillis()-anz*24*60*60*1000L)),++anz); } now if you get the runTimeException the fault is in the 2 if's. Otherwise you get always null back from 'getLastWorkRelevantEvent(...)' Greetz Chill.

http://stackoverflow.com/a/21758822
has body: I've run into this myself many times. Ordinarily my first recommendation would be Spring transaction management, however I understand you are trying to limit the number of third party libraries you are using. Since you're using a static API in your HibernateUtil class, you may find it helpful to consolidate your logic in a method, and putting the 'what you want to do in a transaction' code (which varies controller to controller) in a callback. First, define an interface to describe each controller's inTransaction behavior: public interface TransactionCallback { void doInTransaction(); } Now, create a static method in your HibernateUtil class to handle beginning, committing, and if necessary rolling back your transactions: public class HibernateUtil { public static void inTransaction(TransactionCallback tc) { Transaction transaction = HibernateUtil.getSessionFactory().getCurrentSession().getTransaction(); if (!HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().isActive()) { transaction.begin(); try { tc.doInTransaction(); transaction.commit(); } catch (Exception e) { transaction.rollback(); } } } } In your controller, you'd use your new method with an anonymous inner class: .... HibernateUtil.inTransaction(new TransactionCallback() { void doInTransaction() { // do stuff for this controller } }); .... This approach should at least take care of the duplication you'd like to eliminate, and there's plenty of room for extending it to handle particular exceptions, etc.
upvote count: 6
type: AcceptedAnswer
type: Answer
score: 6
accepted answer of: http://stackoverflow.com/q/21024637
downvote count: 0
answers question: http://stackoverflow.com/q/21024637

http://stackoverflow.com/a/21056308
accepted answer of: http://stackoverflow.com/q/21055809
answers question: http://stackoverflow.com/q/21055809
has comment: http://stackoverflow.com/comment/31661404
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: Use path.quadTo (the javadoc for it). Because this shape is so simple I would just write it out line by line. Heres the start of it. int borderRadius = 15; Path path = new Path(); path.moveTo(borderRadius , 0); path.lineTo(width-borderRadius, 0); // top side path.quadTo(width, 0, width, borderRadius); // top right corner path.lineTo(width, height-borderRadius); // right side path.quadTo(width, height, width-borderRadius, height); // bottom right corner ... path.close();
score: 1

http://stackoverflow.com/comment/31793114
has text: This is probably only focusing on one element, but essentially, just because `JFrame` extends from `Frame` which extends from `Window`, which extends from `Container` (which extends from `Component`), you might assume that you can add one `JFrame` to another. But you can't. These is a restriction within the component to prevent you from doing this. He's highlighting a discrepancy between what the object hierarchy is telling you and what the API can do...so yes, it's contradictive, because it has to be.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21127792

http://stackoverflow.com/comment/31666735
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21027961
has text: Actually, I think .//div[text()[contains('text')]] also might work in some cases where the above answer wont.

http://stackoverflow.com/comment/31635922
type: AnswerComment
comment on: http://stackoverflow.com/a/21042882
type: Comment
has text: if you have import javax.persistence.EntityManager; you should can use it
score: 0

http://stackoverflow.com/comment/31688863
score: 0
type: Comment
has text: yes I use more than 3GB heap,, mainly to test jvm jittering. Certainly I can run a jvm independently of STS. It's just odd that thing worked perfectly fine on a weaker machine.
type: QuestionComment
comment on: http://stackoverflow.com/q/21070034

http://stackoverflow.com/q/21182539
type: Question
has comment: http://stackoverflow.com/comment/31893555
has comment: http://stackoverflow.com/comment/31893034
has comment: http://stackoverflow.com/comment/31892531
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31895608
score: 0
tagged with: aspectj
has body: I installed AJDT plugin from eclipse site. Then created Aspectj project. And if I saved anything in there, it started building workspace forever. I tried to close Eclipse, but needed to force close it and now it won't even starts, just loads forever. My code in project are only few lines, so I don't get it why it should be that slow. What could be wrong? Is AspectJ that slow or what? How could I restore Eclipse as I can't even use it now.. Update Eclipse loaded after like 10 minutes. Then I deleted one character of code and pressed save and it all started again. That is insane. I suppose it shouldn't be like that? I unchecked 'Build automatically' option, but it sill does the same thing. And now I just got this error: java.lang.OutOfMemoryError Compile error: OutOfMemoryError thrown: GC overhead limit exceeded So it just ran out of memory. So it is something really wrong, but I don't see what could be. Also this only happens with AspectJ project, with normal project everything runs smoothly. So maybe I should do something in AspectJ project before trying to write there, like check/uncheck something? P.S. I also added Spring jars and commons-logging jars in that project. Maybe that has something to do with it?
has comment: http://stackoverflow.com/comment/31892821
type: UnansweredQuestion
tagged with: spring
has title: Java - AspectJ corrupted Eclipse?
has comment: http://stackoverflow.com/comment/31892968
answer count: 0
tagged with: java

http://stackoverflow.com/q/21167527
has answer: http://stackoverflow.com/a/21169228
tagged with: apache
has title: NullPointerException while retrieving Port for Apache CXF web service client over https
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: web-services
tagged with: cxf
tagged with: java
type: Question
has body: I have a web service that I am calling using a client generated using the wsdl2java tool from Apache CXF. Everything was working well until we moved the web service behind https. Now I'm getting a NullPointerException when I try to get the Port. I'm pretty sure that it's not a problem with the server's certificate since I can get the WSDL for the web service. Specs: Apache CXF 2.7.6 Glassfish 3.1.2.2 Here is my client code: public final static QName BasicHttpEndpoint2 = new QName("http://tempuri.org/", "BasicHttpEndpoint2"); @WebEndpoint(name = "BasicHttpsEndpoint") public IAppts getBasicHttpsEndpoint() { return super.getPort(BasicHttpsEndpoint, IAppts.class); } And here is part StackTrace I'm getting: Caused by: java.lang.NullPointerException at java.io.Reader.&lt;init&gt;(Reader.java:78) at java.io.InputStreamReader.&lt;init&gt;(InputStreamReader.java:72) at com.sun.xml.wss.jaxws.impl.RMPolicyResolver.getResourceReader(RMPolicyResolver.java:114) at com.sun.xml.wss.jaxws.impl.RMPolicyResolver.unmarshalPolicy(RMPolicyResolver.java:107) at com.sun.xml.wss.jaxws.impl.RMPolicyResolver.getOperationLevelPolicy(RMPolicyResolver.java:98) at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.buildProtocolPolicy(SecurityTubeBase.java:1298) at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.collectPolicies(SecurityTubeBase.java:774) at com.sun.xml.wss.jaxws.impl.SecurityTubeBase.&lt;init&gt;(SecurityTubeBase.java:274) at com.sun.xml.wss.jaxws.impl.SecurityClientTube.&lt;init&gt;(SecurityClientTube.java:152) at com.sun.xml.wss.provider.wsit.SecurityTubeFactory.__AW_createTube(SecurityTubeFactory.java:285) at com.sun.xml.wss.provider.wsit.SecurityTubeFactory.createTube(SecurityTubeFactory.java) at com.sun.xml.ws.assembler.TubeCreator.createTube(TubeCreator.java:84) at com.sun.xml.ws.assembler.TubelineAssemblerFactoryImpl$MetroTubelineAssembler.__AW_createClient(TubelineAssemblerFactoryImpl.java:130) at com.sun.xml.ws.assembler.TubelineAssemblerFactoryImpl$MetroTubelineAssembler.createClie…

http://stackoverflow.com/a/21156546
upvote count: 1
has comment: http://stackoverflow.com/comment/31852843
downvote count: 0
has body: You should use the latest Karaf Container 2.3.3, afairc with 2.3.2 onward the blueprint graceperiod issue had been fixed or better worked around, this might lead to these situations.
type: Answer
answers question: http://stackoverflow.com/q/21134867
score: 1

http://stackoverflow.com/q/21171018
tagged with: spring
answer count: 4
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/29469313
has answer: http://stackoverflow.com/a/21171790
possible better answer: http://stackoverflow.com/a/21171141
score: 0
has answer: http://stackoverflow.com/a/21171141
has body: I'm trying to run the most up to date spring sample projects in eclipse but i'm always getting ClassNotFoundException. (For example with spring-mvc-showcase project) Environment: Ubuntu 12.04, 64bit (same problem with 13.10) openjdk-7-jdk, openjdk-7-jre installed Eclipse kepler Java EE version, STS installed. Steps: I make a new project: Spring/Import Spring Getting Started Content When all the dependencies loaded, right click on the project name / Run As / Run On Server: J2EE Preview at localhost Jetty output: 2014-01-16 20:13:01.241:INFO:oejs.Server:jetty-8.1.10.v20130312 2014-01-16 20:13:02.905:WARN:oejw.StandardDescriptorProcessor:Could not instantiate listener org.springframework.web.context.ContextLoaderListener java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener 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:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:424) at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:377) at org.eclipse.jetty.server.handler.ContextHandler.loadClass(ContextHandler.java:1517) at org.eclipse.jetty.webapp.StandardDescriptorProcessor.visitListener(StandardDescriptorProcessor.java:1839) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.visit(IterativeDescriptorProcessor.java:80) at org.eclipse.…
has answer: http://stackoverflow.com/a/21171282
accepted answer: http://stackoverflow.com/a/21171790
tagged with: maven
has title: ClassNotFoundException with Spring sample projects

http://stackoverflow.com/q/21040080
has comment: http://stackoverflow.com/comment/31631197
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31631724
has body: I'm working on having weapons weapon restrictions when players want to fight one another in an arena. My combinations work but my 'all weapons' doesn't work. Weapon restrictions is you choose which weapons are allowed &amp; which ones aren't. Code: public static final WeaponCombination[] WEAPON_COMBINATIONS; static { WEAPON_COMBINATIONS = new WeaponCombination[] { new WeaponCombination("@cya@All", (Weapon[]) null), new WeaponCombination("@red@Whip + Staff of Gods", new Weapon(300), new Weapon(302)), new WeaponCombination("@red@Swords Only", new Weapon(306, 308, 310, 312)), new WeaponCombination("@red@Axe's Only", new Weapon(360, 362, 364, 366)) }; } I forgot my weapon class: package rezzion.model.minigames.duel; public class Weapon { private int[] items; public Weapon(int... items) { this.items = items; } public int[] getItems() { return items; } } The all should account for all id's Every weapon in the game (1-3905). Anyone know why (Weapons[]) null doesn't work? I don't really want to type out all 3905 id's into a string...
has title: weaponCombinations all item id's
tagged with: java
has answer: http://stackoverflow.com/a/21041076
has comment: http://stackoverflow.com/comment/31631809
type: Question
has comment: http://stackoverflow.com/comment/31631694
score: 0
has comment: http://stackoverflow.com/comment/31631193
linked to: http://stackoverflow.com/q/11097664
has comment: http://stackoverflow.com/comment/31632324
answer count: 1

http://stackoverflow.com/comment/31703149
type: Comment
has text: what if you try: **android:versionCode="1"** and **android:versionName="1.14.01.12 a"**? I use such values in my Manifest file.
type: QuestionComment
comment on: http://stackoverflow.com/q/21079121
score: 0

http://stackoverflow.com/comment/31830092
score: 0
type: AnswerComment
has text: Hi Teresa, I have moved the start timer to where you suggested, which is where I had commented it out in my original post but it still has the same issue. But I'm wondering if maybe I'm coding it in the wrong way. For example if I sort 4 numbers in the order 3 4 1 2, I expect each time I run the programme the output from the timer should be the same or am I using the wrong timer? Thank you
comment on: http://stackoverflow.com/a/21148003
type: Comment

jboss5.x
tag name: jboss5.x
tags question: http://stackoverflow.com/q/21041444
type: Tag

http://stackoverflow.com/comment/31651820
comment on: http://stackoverflow.com/q/21051282
has text: You need to provide code that you use to "tries to call post method". There should be absolutely nothing specific to ASP.Net/MVC - likely your Java code is not doing right thing. (or JavaScript?)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31883072
type: QuestionComment
has text: The way you organized your map - fields of the same object being stored under different keys and, as a result, in different lists - wouldn't allow for this form of iteration. The only thing that "links" `FistName` and `LastName` together is their position in their respective lists.
type: Comment
comment on: http://stackoverflow.com/q/21177062
score: 0

http://stackoverflow.com/comment/31872084
comment on: http://stackoverflow.com/a/21170652
type: Comment
has text: Ok. So, does Java have any decent implementation of Predicates? They would certainly help clean things up a bit.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31656056
has text: Database is SQL Server.. checking the answers
comment on: http://stackoverflow.com/q/21053443
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21025376
has title: Hide/customize status 500 error message/status description inside response header (Glassfish)
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21025418
tagged with: glassfish
tagged with: jsf-2
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21039856
possible better answer: http://stackoverflow.com/a/21025418
has answer: http://stackoverflow.com/a/21039856
has body: I'm developing jsf 2 web app which runs under GlassFish (v3.1.2.2). This app has custom error 500 page which is defined in web.xml. My question is whether there is a possibility to disable/hide/customize error message/status description inside response header for status 500 response? Currently I'm getting something like this: HTTP/1.1 500 /view.xhtml @11,30 [error message same as in root exception] &lt;- I want to hide this one (only message/status description) X-Powered-By: JSF/2.0 Content-Type: text/html;charset=UTF-8 Transfer-Encoding: chunked Date: Thu, 09 Jan 2014 15:33:44 GMT Connection: close Thank you!

akka
type: Tag
tags question: http://stackoverflow.com/q/21179680
tags question: http://stackoverflow.com/q/21117671
tag name: akka

http://stackoverflow.com/comment/31727948
has text: in that case you could try something like textView.setVisibility(View.GONE)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21092480

http://stackoverflow.com/comment/31764298
type: QuestionComment
has text: @TheUnknown i have to update the apprNo e.g if rec with aprpno 2 is delete than frome there onwards apprNo 3 becomes apprNo 2 and appNo 4 becomes 3 and so on , and if this is first approver that is deleted than also add next approver no to 1
comment on: http://stackoverflow.com/q/21111471
score: 0
type: Comment

spring-mvc
tags question: http://stackoverflow.com/q/21047867
tags question: http://stackoverflow.com/q/21130209
tags question: http://stackoverflow.com/q/21082413
tags question: http://stackoverflow.com/q/21165135
tags question: http://stackoverflow.com/q/21127666
tags question: http://stackoverflow.com/q/21075319
tags question: http://stackoverflow.com/q/21037574
tags question: http://stackoverflow.com/q/21052026
tags question: http://stackoverflow.com/q/21116513
tags question: http://stackoverflow.com/q/21078826
tags question: http://stackoverflow.com/q/21019833
tags question: http://stackoverflow.com/q/21076023
tags question: http://stackoverflow.com/q/21047104
tags question: http://stackoverflow.com/q/21184258
tags question: http://stackoverflow.com/q/21151969
tags question: http://stackoverflow.com/q/21108160
tags question: http://stackoverflow.com/q/21132487
tags question: http://stackoverflow.com/q/21101250
tags question: http://stackoverflow.com/q/21040198
tags question: http://stackoverflow.com/q/21163872
tags question: http://stackoverflow.com/q/21173283
tags question: http://stackoverflow.com/q/21116902
tags question: http://stackoverflow.com/q/21049638
tags question: http://stackoverflow.com/q/21073420
tags question: http://stackoverflow.com/q/21025848
tags question: http://stackoverflow.com/q/21164915
tags question: http://stackoverflow.com/q/21029556
tags question: http://stackoverflow.com/q/21170808
tags question: http://stackoverflow.com/q/21157853
tags question: http://stackoverflow.com/q/21171018
tags question: http://stackoverflow.com/q/21018997
tag name: spring-mvc
tags question: http://stackoverflow.com/q/21066728
tags question: http://stackoverflow.com/q/21153933
tags question: http://stackoverflow.com/q/21097528
tags question: http://stackoverflow.com/q/21144120
tags question: http://stackoverflow.com/q/21110285
tags question: http://stackoverflow.com/q/21174705
tags question: http://stackoverflow.com/q/21164185
tags question: http://stackoverflow.com/q/21070693
tags question: http://stackoverflow.com/q/21146401
tags question: http://stackoverflow.com/q/21021546
tags question: http://stackoverflow.com/q/21043250
tags question: http://stackoverflow.com/q/21089106
tags question: http://stackoverflow.com/q/21182183
tags question: http://stackoverflow.com/q/21020819
tags question: http://stackoverflow.com/q/21123610
tags question: http://stackoverflow.com/q/21026223
type: Tag
tags question: http://stackoverflow.com/q/21135787
tags question: http://stackoverflow.com/q/21106779
tags question: http://stackoverflow.com/q/21117890
tags question: http://stackoverflow.com/q/21156475
tags question: http://stackoverflow.com/q/21118505
tags question: http://stackoverflow.com/q/21035606
tags question: http://stackoverflow.com/q/21131319
tags question: http://stackoverflow.com/q/21090892
tags question: http://stackoverflow.com/q/21078110
tags question: http://stackoverflow.com/q/21113168
tags question: http://stackoverflow.com/q/21022463
tags question: http://stackoverflow.com/q/21131429
tags question: http://stackoverflow.com/q/21089963
tags question: http://stackoverflow.com/q/21095515
tags question: http://stackoverflow.com/q/21027021
tags question: http://stackoverflow.com/q/21062057
tags question: http://stackoverflow.com/q/21022022
tags question: http://stackoverflow.com/q/21178981
tags question: http://stackoverflow.com/q/21164627
tags question: http://stackoverflow.com/q/21131964
tags question: http://stackoverflow.com/q/21142967
tags question: http://stackoverflow.com/q/21061638
tags question: http://stackoverflow.com/q/21029857
tags question: http://stackoverflow.com/q/21145345
tags question: http://stackoverflow.com/q/21040244
tags question: http://stackoverflow.com/q/21159295
tags question: http://stackoverflow.com/q/21080598
tags question: http://stackoverflow.com/q/21088976
tags question: http://stackoverflow.com/q/21158267
tags question: http://stackoverflow.com/q/21065047
tags question: http://stackoverflow.com/q/21055713

http://stackoverflow.com/comment/31648061
type: QuestionComment
score: 0
has text: add a counter variable outside of the loop and increment it during each iteration of the loop.
comment on: http://stackoverflow.com/q/21048870
type: Comment

http://stackoverflow.com/q/21161757
type: UnansweredQuestion
score: 2
tagged with: java
has title: How to insert a package declaration using an Eclipse template?
type: Question
has comment: http://stackoverflow.com/comment/31857191
has answer: http://stackoverflow.com/a/21162498
tagged with: eclipse
has body: My template package ${enclosing_package}; ${is:importStatic('org.junit.Assert.*')} ${i:import( org.junit.Test)} public class ${primary_type_name} { @Test public void test() { fail(); } } What I want it to produce package com.example; import static org.junit.Assert.*; import org.junit.Test; public class ExampleUTest { @Test public void test() { fail(); } } What it actually produces (package declaration below imports so compilation failure) import static org.junit.Assert.*; import org.junit.Test; package com.example; public class ExampleUTest { @Test public void test() { fail(); } } I'm using this template in a blank java file. It seems a template always puts import statements at the top of the file, below the package declaration if there is one, which does make sense. I guess my template isn't working because it doesn't 'know' I'm making a package declaration on that top line, so it just gets treated like any other line of code and puts it below the imports. How can I get this to work - does a variable exist which explicitly does a package declaration, or is there another way?
has comment: http://stackoverflow.com/comment/31855191
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21162839
tagged with: templates
favorite count: 0
upvote count: 2

http://stackoverflow.com/q/21044873
tagged with: primefaces
upvote count: 0
score: -1
answer count: 1
has answer: http://stackoverflow.com/a/21046147
favorite count: 0
type: UnansweredQuestion
has title: PrimeFaces Datatable Implementation
tagged with: datatable
has body: I am trying to add run datatable project my class file package org.springframework.webflow.samples.booking; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.UUID; import java.lang.String; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; @ManagedBean @RequestScoped public class Car implements Serializable { private final static String[] colors; private final static String[] manufacturers; private List&lt;CarTemp&gt; cars; static { colors = new String[10]; colors[0] = "Black"; colors[1] = "White"; colors[2] = "Green"; colors[3] = "Red"; colors[4] = "Blue"; colors[5] = "Orange"; colors[6] = "Silver"; colors[7] = "Yellow"; colors[8] = "Brown"; colors[9] = "Maroon"; manufacturers = new String[10]; manufacturers[0] = "Mercedes"; manufacturers[1] = "BMW"; manufacturers[2] = "Volvo"; manufacturers[3] = "Audi"; manufacturers[4] = "Renault"; manufacturers[5] = "Opel"; manufacturers[6] = "Volkswagen"; manufacturers[7] = "Chrysler"; manufacturers[8] = "Ferrari"; manufacturers[9] = "Ford"; } public Car() { cars = new ArrayList&lt;CarTemp&gt;(); populateRandomCars(cars, 50); } private void populateRandomCars(List&lt;Car&gt; list, int size) { CarTemp a= new CarTemp(getRandomModel(), getRandomYear(), getRandomManufacturer(), getRandomColor()); for(int i = 0 ; i &lt; size ; i++) list.add(a); } public List&lt;CarTemp&gt; getCars() { return cars; } private int getRandomYear() { return (int) (Math.random() * 50 + 1960); } private String getRandomColor() { return colors[(int) (Math.random() * 10)]; } private String getRandomManufacturer() { return manufacturers[(int) (Math.random() * 10)]; } private String getRandomModel() { return UUID.randomUUID().toString().substring(0, 8); } } this is my CarTemp.Java file package org.springframework.webflow.samples.booking; public class CarTemp { private String model; private int year; private String manufacturer; private String color; public CarTemp(String model, int year, S…
tagged with: jsf
tagged with: java
downvote count: 1
type: Question

http://stackoverflow.com/comment/31661018
type: Comment
type: QuestionComment
score: 1
has text: Which line is line 62?
comment on: http://stackoverflow.com/q/21056179

http://stackoverflow.com/comment/31672860
has text: Because then if I later make a temp variable in a method: Computer speler = this.speler1; "can not convert from Player to Computer".
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21062591

http://stackoverflow.com/a/21083355
accepted answer of: http://stackoverflow.com/q/21073337
answers question: http://stackoverflow.com/q/21073337
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31717138
type: Answer
has body: The quick and easy fix is to replace: String sdpath = Environment.getExternalStorageDirectory() + "/"; with String sdpath = Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_MUSIC) + "/"; However, I'd love to update this plugin so you can specify the apps internal storage or external storage. If external storage you should have the options for Music, Pictures, Movies, Podcasts or Downloads. If the source is up on Github somewhere let me know.

http://stackoverflow.com/a/21109954
answers question: http://stackoverflow.com/q/21109893
has comment: http://stackoverflow.com/comment/31766199
type: Answer
has comment: http://stackoverflow.com/comment/31766868
has comment: http://stackoverflow.com/comment/31764179
has body: To A) Yes, one solution is to wrap your first line into a try-catch block. Be sure to catch only the Exception you expect and no other as your test will contain holes then. Your code might look like this: @Test public void checkIfTodaysDateDisplayed(){ WebElement currentDate = null; try { currentDate = driver.findElement(By.cssSelector(".currentDate")); } catch (NoSuchElementException e) { Assert.fail("Web page is not properly set up! " + e.getMessage()); } Assert.assertNotNull(currentDate); Assert.assertEquals("The current date is not displayed", currentDate.isDisplayed()); } You may want to append additional information to your Asserts, such as the exception stacktrace or whatever is needed for you to debug. To B) Write singular tests for each case you want to have tested. If you put everything in one monolithic test it'll be more difficult to chase the exact position where your test failed. Write tests that do not depend on each other.
has comment: http://stackoverflow.com/comment/31766754
has comment: http://stackoverflow.com/comment/31805245
downvote count: 0
has comment: http://stackoverflow.com/comment/31764474
score: 1
has comment: http://stackoverflow.com/comment/31765053
upvote count: 1

http://stackoverflow.com/comment/31731082
comment on: http://stackoverflow.com/a/21094124
type: AnswerComment
has text: Okay thanks I'm trying that - in terms of upload vs parameter how large is large? Anything else I should bear in mind?
type: Comment
score: 0

http://stackoverflow.com/comment/31804564
type: QuestionComment
has text: it must have generated an error log... post its content here..
comment on: http://stackoverflow.com/q/21134508
score: 4
type: Comment

http://stackoverflow.com/q/21159599
answer count: 1
has answer: http://stackoverflow.com/a/21159665
favorite count: 0
type: AnsweredQuestion
has title: onClick event Fragment
tagged with: android-fragments
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21159665
upvote count: 1
has body: I have some issues with onClick event in a Fragment. I make Tab-Navigation in the Actionbar and with an TabListener the fragments change. This works fine. My problem is that a ''normal'' OnClickListener (see below) does not work. I've tried a lot of different things.Here is the current status: package com.artifact.actionbarfragments; import android.app.ActionBar; import android.app.ActionBar.Tab; import android.app.Activity; import android.app.Fragment; import android.app.FragmentTransaction; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.CheckBox; import android.widget.TextView; public class ActionBarFragmentsActivity extends Activity { /** Called when the activity is first created. */ public OnClickListener listener; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // lädt die ActionBar ActionBar actionbar = getActionBar(); // ActionBar.LayoutParams(0); actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionbar.setDisplayShowHomeEnabled(false); actionbar.setDisplayShowTitleEnabled(false); actionbar.setDisplayShowCustomEnabled(false); // actionbar.setCustomView(R.layout.actionbarview); // lädt die Tabs in die Actionbar und setzt ''eigene'' Icons ActionBar.Tab TabA = actionbar.newTab().setIcon(R.drawable.ic_action_view_as_list); ActionBar.Tab TabB = actionbar.newTab().setIcon(R.drawable.ic_action_directions); ActionBar.Tab TabC = actionbar.newTab().setIcon(R.drawable.ic_action_group); ActionBar.Tab TabD = actionbar.newTab().setIcon(R.drawable.ic_action_person); // erstellt neue Fragmente Fragment fragmentA = new fragmentA(); Fragment fragmentB = new fragmentB(); Fragment fragmentC = new fragmentC(); Fragment fragmentD = new fragmentD(); // Listener werden angelegt TabA.setTabListener(new MyTabsListener(fragmentA)); TabB.setTabListener(new MyTabsListener(fragmentB)); TabC.setTabLis…
type: Question
downvote count: 0
tagged with: android

http://stackoverflow.com/q/21052418
tagged with: minecraft
score: 0
answer count: 2
has title: Java Multiplying
accepted answer: http://stackoverflow.com/a/21052494
has answer: http://stackoverflow.com/a/21052499
tagged with: plugins
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21052499
has body: I am creating a minecraft plugin based on the movie InTime and am trying to create code that on death of the player the player will lose 25% of their time. Current code is: String minus = itapi.getTimeString(player.getName()); itapi.removeTime(player.getName(), itapi.getDeathTime()); ItemStack book = itapi.createTimeCard("Death of " + player.getName(), minus, 1); itapi.removeTime(player.getName(), minus * 0.25); e.getDrops().add(book); Though line 4 flags "The operator * is undefined for the argument type(s) String, double" I know it is probally a real simple fix but im out of ideas any suggestions? TimeString has to be a string
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21052494

http://stackoverflow.com/a/21034758
has comment: http://stackoverflow.com/comment/31625274
has comment: http://stackoverflow.com/comment/31622600
has comment: http://stackoverflow.com/comment/31622842
has comment: http://stackoverflow.com/comment/31628430
has comment: http://stackoverflow.com/comment/31638155
has body: You can use angular coefficient between two points with Ox to solve this problem. For example, for 3 points : A B C. If they're collinear if and only if line AB and line AC make a same angular coefficient with Ox line. So, here is pseudocode of mine : // Type : an object to store information to use later List&lt;Type&gt; res = new ArrayList&lt;Type&gt;(); for (int i = 0; i &lt; points.lenght(); i++) { for (int j = i+1; j &lt; points.length(); j++) { double coefficient = CoeffiecientBetweenTwoLine( line(points[i], points[j]), line((0,0), (0,1)); res.add(new Type(points[i], points[j], coefficient); } } After that, you use QuickSort, sort again above List base on Coefficient. And any coefficient equals, we can know which points are collinear. Complexity of this algorithm is O(N^2logN) (dominated by sorting a list with O(N^2) elements, only O(N^2) required to build the list). @Edit: So how can we know how many points collinear when we show equal coefficient ? There are many ways to solve this problem. At sort step, you can sort by first parameter (is which point in that line) when two coefficient are equal. For example. After sort, the result should be (in this case, if 1 3 and 4 are collinear) : (1 3) (1 4) (3 4) From above building, you just need to see streak of 1. in this example, is 2. so the result should be 3. (always k + 1) Use formula : because number of pair that equals always : n*(n-1)/2 . So, you will have : n*(n-1)/2 = 3. and you can know n = 3 (n >= 0). That means you can solve quadratic equation here (but not too difficult, because you always know it have solution, and just get one solution that positive) Edit 2 Above step to know how many collinear points is not true, because at case for example, A B and C D are two parallel line (and line AB is different from line CD), the result, they still have same coefficient with Ox. So, I think to fix this problem, you can use Union-Find Data structure to solve this problem. Step will be : Sort again angular coeff…
answers question: http://stackoverflow.com/q/21034597
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21034597
has comment: http://stackoverflow.com/comment/31625239
upvote count: 3
has comment: http://stackoverflow.com/comment/31623102
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/31638139
score: 3

http://stackoverflow.com/a/21131019
type: Answer
answers question: http://stackoverflow.com/q/21123386
upvote count: 0
score: -1
has body: you can use this code MyDataProvider.getList().add(new MyModel());
downvote count: 1
has comment: http://stackoverflow.com/comment/31799393

http://stackoverflow.com/a/22269778
has comment: http://stackoverflow.com/comment/103036343
type: Answer
has body: There actually is a trick how to execute a parallel operation in a specific fork-join pool. If you execute it as a task in a fork-join pool, it stays there and does not use the common one. final int parallelism = 4; ForkJoinPool forkJoinPool = null; try { forkJoinPool = new ForkJoinPool(parallelism); final List<Integer> primes = forkJoinPool.submit(() -> // Parallel task here, for example IntStream.range(1, 1_000_000).parallel() .filter(PrimesPrint::isPrime) .boxed().collect(Collectors.toList()) ).get(); System.out.println(primes); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } finally { if (forkJoinPool != null) { forkJoinPool.shutdown(); } } The trick is based on ForkJoinTask.fork which specifies: "Arranges to asynchronously execute this task in the pool the current task is running in, if applicable, or using the ForkJoinPool.commonPool() if not inForkJoinPool()"
has comment: http://stackoverflow.com/comment/34645210
has comment: http://stackoverflow.com/comment/124507334
has comment: http://stackoverflow.com/comment/45490989
has comment: http://stackoverflow.com/comment/103452426
has comment: http://stackoverflow.com/comment/42493863
type: AcceptedAnswer
upvote count: 521
has comment: http://stackoverflow.com/comment/99718309
has comment: http://stackoverflow.com/comment/97640318
has comment: http://stackoverflow.com/comment/99765326
has comment: http://stackoverflow.com/comment/131524933
has comment: http://stackoverflow.com/comment/61485962
downvote count: 3
has comment: http://stackoverflow.com/comment/61456573
has comment: http://stackoverflow.com/comment/99574235
score: 518
accepted answer of: http://stackoverflow.com/q/21163108
has comment: http://stackoverflow.com/comment/69086121
has comment: http://stackoverflow.com/comment/83608446
answers question: http://stackoverflow.com/q/21163108
has comment: http://stackoverflow.com/comment/103452568
has comment: http://stackoverflow.com/comment/42535244

http://stackoverflow.com/a/21153581
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21153185
has body: You can do this in some cases directly, e.g in TextView you can change the Text Color by applying this statement in Java code textView1.setTextColor(Color.Red); for other objects like buttons etc. you can not change their Color Directly like C#. You have to create different .xml file and then you will store this .xml file inb drawable folder, in your activity_main(where button is created in your layout file) you have to make reference e.g &lt;Button android:background="@drawable/red_button" /&gt; now the colored button .xml file located in res/drawable/red_button.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:state_pressed="true" android:drawable="@drawable/red_button_pressed" /&gt; &lt;item android:state_focused="true" android:drawable="@drawable/red_button_focus" /&gt; &lt;item android:drawable="@drawable/red_button_rest" /&gt; &lt;/selector&gt; Check this Link for more Details

http://stackoverflow.com/a/21021212
downvote count: 1
upvote count: 20
has comment: http://stackoverflow.com/comment/31598001
has comment: http://stackoverflow.com/comment/31598580
has comment: http://stackoverflow.com/comment/31597447
has comment: http://stackoverflow.com/comment/54134657
has comment: http://stackoverflow.com/comment/31599692
has comment: http://stackoverflow.com/comment/88726178
has comment: http://stackoverflow.com/comment/92151002
has body: Make sure no other application using port 8080 before starting tomcat. If that's not the problem please paste tomcat log. If you want to change tomcat's default port, go to tomcat folder and open conf folder, in which you can see server.xml. In that file you can see something like &lt;Connector port= . Change the port value and start tomcat.
type: Answer
score: 19
answers question: http://stackoverflow.com/q/21021136

http://stackoverflow.com/a/21109571
has comment: http://stackoverflow.com/comment/31767907
has comment: http://stackoverflow.com/comment/31767068
has comment: http://stackoverflow.com/comment/31768073
has comment: http://stackoverflow.com/comment/31767693
has comment: http://stackoverflow.com/comment/31766774
score: 0
has comment: http://stackoverflow.com/comment/31766674
type: Answer
has comment: http://stackoverflow.com/comment/31766926
answers question: http://stackoverflow.com/q/21109341
has comment: http://stackoverflow.com/comment/31767366
has body: For sending tweet in java, you can use Twitter4J Create a Twitter application: Refer here Initialize your object: Fill in credentials by using twitter app credentials ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true) .setOAuthConsumerKey("") .setOAuthConsumerSecret("") .setOAuthAccessToken("") .setOAuthAccessTokenSecret(""); TwitterFactory tf = new TwitterFactory(cb.build()); Send your tweet Twitter twitter = TwitterFactory.getSingleton(); Status status = twitter.updateStatus(latestStatus); For best practices, please refer here
has comment: http://stackoverflow.com/comment/31767412

http://stackoverflow.com/q/21072728
accepted answer: http://stackoverflow.com/a/21072749
score: -3
linked to: http://stackoverflow.com/q/2839321
upvote count: 1
type: Question
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/2839321
tagged with: java
tagged with: mysql
downvote count: 4
answer count: 1
has answer: http://stackoverflow.com/a/21072749
favorite count: 0
has comment: http://stackoverflow.com/comment/31691312
has title: No suitable driver found for jdbc
has comment: http://stackoverflow.com/comment/31691300
tagged with: jdbc
has body: I'm getting a message that:"No suitable driver found for jdbc:mysql://localhost/db" When I run the jar file in dist folder. I'm using Netbeans,what's confusing me is the fact that,when I execute the program from inside Netbeans ,it works perfectly. try { Class.forName("java.sql.DriverManager"); //**please note that I also tried "com.mysql.jdbc.Driver",but same result** } catch (Exception e) { JOptionPane.showMessageDialog(null, e.getMessage()); } And my connection string is:"jdbc:mysql://localhost/db"
linked to: http://stackoverflow.com/q/9139714
tagged with: netbeans

http://stackoverflow.com/comment/31677080
has text: it worked I just added a couple of exclusions thanks.
comment on: http://stackoverflow.com/a/21060189
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21024642
has title: Zk how to pass parameter from java code to zk page?
has answer: http://stackoverflow.com/a/21038626
has comment: http://stackoverflow.com/comment/31630040
has answer: http://stackoverflow.com/a/21025114
has comment: http://stackoverflow.com/comment/31628650
possible better answer: http://stackoverflow.com/a/21038626
favorite count: 0
has answer: http://stackoverflow.com/a/21048059
tagged with: zk
has comment: http://stackoverflow.com/comment/31631296
answer count: 4
has comment: http://stackoverflow.com/comment/31635495
accepted answer: http://stackoverflow.com/a/21048059
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31630918
upvote count: 2
score: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26061167
has body: I am novice in ZK. I use very old zk framework version(legacy project). I render zk page so: Executions.createComponents("/myZul.zul", null, null)) I need to pass parameter to zul. And if parameter is true I need render checkbox and otherwise - not on myZul.zul I need something like this on zul: if(parameter){ &lt;checkbox id="my_id" label="my checkbox" /&gt; } UPDATE my zul: &lt;window xmlns="http://www.zkoss.org/2005/zul" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:zk="http://www.zkoss.org/2005/zk" xmlns:ca="http://www.zkoss.org/2005/zk/client" xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd " border="normal" closable="false" position="center,center" width="383px" height="270px" onCancel="self.detach();" id="decisionCommentWindow" title="${c:l('approvalTaskWindow.title')}" use="handlers.ZulHandler"&gt; .... I need override method doAfterCompose inside of ZulHandler? One more time: zul: &lt;window xmlns="http://www.zkoss.org/2005/zul" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:zk="http://www.zkoss.org/2005/zk" xmlns:ca="http://www.zkoss.org/2005/zk/client" xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd " border="normal" closable="false" position="center,center" width="383px" height="270px" onCancel="self.detach();" id="decisionCommentWindow" title="${c:l('approvalTaskWindow.title')}" use="handlers.ZulHandler"&gt; &lt;zk if="${isManufacturingKey}"&gt; &lt;checkbox id="checkbox_id" label="check" /&gt; &lt;/zk&gt; &lt;/window&gt; zul creater: ... Map args = new HashMap&lt;String, Boolean&gt;(); Boolean isManufacturing = true; args.put("isManufacturingKey", isManufacturing); ZulHandler window = Preconditions .checkNotNull((ZulHandler) Executions.createComponents( "/decision_comment_window.zul", null, args)); window.setTitle(decisionModel.getName() + " decision"); if (isManufacturi…
tagged with: java

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/21068397
tags question: http://stackoverflow.com/q/21168525
type: Tag
tags question: http://stackoverflow.com/q/21104507
tags question: http://stackoverflow.com/q/21065526

http://stackoverflow.com/comment/31707720
has text: Not really a homework assignment, just something I've been thinking about.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21081384

http://stackoverflow.com/comment/31820050
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21143053
type: Comment
has text: The DHCP is a router I am administrating... But I want it be be usable in other networks too

http://stackoverflow.com/a/22457177
upvote count: 12
accepted answer of: http://stackoverflow.com/q/21093723
type: Answer
answers question: http://stackoverflow.com/q/21093723
downvote count: 0
has body: New feature (8087516: Conditional support for GTK 3 on Linux) allows using either GTK v2 or 3 with JavaFX. The default has not changed: GTK 2 will be used by default. Switch GTK versions by setting the following properties: // Output the version detected and used -Djdk.gtk.verbose=true // Toggle the preferred version to GTK 3 -Djdk.gtk.version=3 More details can be found on the OpenJDK mailing list thread. Previous versions of JavaFX used GTK2 libraries. See the related issue for details. JavaFX bugs are now at: https://bugs.openjdk.java.net/browse/JDK-8088966 (closed as duplicate) https://bugs.openjdk.java.net/browse/JDK-8089584 (open) The last issue has a comment: Since mixing GTK2 and GTK3 in the same application causes this problem, we might have to deliver two native libraries, one for GTK2 and one for GTK3.
score: 12
has comment: http://stackoverflow.com/comment/117674540
type: AcceptedAnswer

http://stackoverflow.com/comment/40074123
type: AnswerComment
has text: It's better if you try to explain it in your words.
type: Comment
comment on: http://stackoverflow.com/a/25646116
score: 0

http://stackoverflow.com/comment/31827705
type: Comment
type: QuestionComment
has text: can you please add some comments to your code, and give some examples of usage?
comment on: http://stackoverflow.com/q/21146947
score: 0

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/21122999
tags question: http://stackoverflow.com/q/21122855
tags question: http://stackoverflow.com/q/21139851
type: Tag
tags question: http://stackoverflow.com/q/21183032

http://stackoverflow.com/q/21094027
has answer: http://stackoverflow.com/a/21166490
has body: I have a sonarQube server running on my work location. I use the eclipse plugin to connect to the server and see the issues and run analyis. My only problem is that I would like to be able to run analysis locally as well, when not connected to the network. I looked up on the internet and found several places with screenshots showing a "local analysis" option. I don't have that option available in my eclipse, for some reason I have installed both the java sonarqube plugin and the m2e connector. The version installed is 3.3.0. See screenshot for the available choices in my eclipse config : Any help to solve this would be appreciated, thanks!
score: 0
answer count: 2
tagged with: eclipse-plugin
has title: Not possible to analyze locally in SonarQube
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21163758
linked to: http://stackoverflow.com/q/17492303
tagged with: java
tagged with: sonarqube
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/31693653
comment on: http://stackoverflow.com/q/21074013
has text: I think it is much simpler to create REST server with Spring, look at this example http://spring.io/guides/gs/rest-service/ This still uses Jersey, but requires a lot less code to create whole REST service.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31620573
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21033669
has text: And it works. I feel embarrassed but it definitely solved the problem.

http://stackoverflow.com/comment/31818520
score: 0
comment on: http://stackoverflow.com/q/21141965
has text: What exactly does not work? You just told us that you're not able debug an unknown problem...
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31679961
type: Comment
comment on: http://stackoverflow.com/q/21066549
has text: in which line do you take this error
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31759185
comment on: http://stackoverflow.com/q/21109294
has text: I don't say it's a problem. I only wonder if it's necessary. Anything can be done in pure java and it depends on the specific task if it's better to learn new programming paradigm or do it with the technologies the team has already experience with. And you're right about jakarta of course, I should have said apache commons.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21109868
upvote count: 1
has comment: http://stackoverflow.com/comment/31759880
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21110609
has comment: http://stackoverflow.com/comment/31759864
answer count: 1
downvote count: 0
tagged with: javascript
tagged with: exec
accepted answer: http://stackoverflow.com/a/21110609
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31761644
has title: Browser close event by Process
has body: I am using a Process to open Internet Explorer or any other browser and then I want to go into an infinite loop until the browser is closed such that: Process p = Runtime.getRuntime().exec( "C:\\Program Files\\Internet Explorer\\iexplore.exe"); while(true) { if(p.browserclosed) break; } Can any one help me with this event so that I could know when the browser is closed, or there is any other method for this? In future I'm going to go to one specific JSP on the browser.
tagged with: process

http://stackoverflow.com/comment/31880249
type: Comment
comment on: http://stackoverflow.com/a/21175624
score: 0
type: AnswerComment
has text: Try running your application as Administrator. Also, try putting the image file within your eclipse project and accessing with only the file name.

http://stackoverflow.com/comment/31770574
type: Comment
comment on: http://stackoverflow.com/q/21115826
type: QuestionComment
score: 1
has text: This boils down to **Read The Friendly Manual**. Your title is 100% accurate.

http://stackoverflow.com/q/21026166
score: 1
tagged with: java
has title: Request Method GET returns wrong content length
upvote count: 1
tagged with: http
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21027154
downvote count: 0
tagged with: connection
has answer: http://stackoverflow.com/a/21026473
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: Hi i am using an HttpURLConnection that gets a txt file's content and i want to know the size of that file and i use the content length Method but it returns wrong value for example in this code the file's size is 17509 but it returns 5147 ? so Any Help? Thanks so much in advance :). new Thread() { @Override public void run() { String path = parser.getValue(e, "txt"); URL u = null; try { u = new URL(path); HttpURLConnection c = (HttpURLConnection) u .openConnection(); c.setRequestMethod("GET"); c.connect(); int lenghtOfFile = c.getContentLength(); InputStream in = c.getInputStream(); final ByteArrayOutputStream bo = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; long total = 0; Log.i("p1",""+lenghtOfFile); while ((count = in.read(buffer)) != -1) { total += count; Log.i("p2",""+total); bo.write(buffer, 0, count); } bo.close(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (ProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }.start();

http://stackoverflow.com/comment/31862027
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21147750
type: Comment
has text: @MarkoTopolnik: Thanks! I guess, I have to accept that. Since the AWT EventQueue guarantees FIFO order when tasks/Runnables are pushed into the EventQueue by invokeLater(), there has to be synchronization. As a result of this we can assume that the “call of invokeLater()” happens-before the “start of the task” and visibility is given (in this direction). The task sees at least the values at the time when invokeLater() was called. Anyway, I would have preferred not to be required to consider about internal implementations, but to have an authoritative source (e.g. API) guaranteeing me that.

http://stackoverflow.com/q/21161816
has comment: http://stackoverflow.com/comment/31877011
answer count: 6
has answer: http://stackoverflow.com/a/21161998
has answer: http://stackoverflow.com/a/21199929
has title: What am I doing wrong with my 'Do' loop?
possible better answer: http://stackoverflow.com/a/21161923
has answer: http://stackoverflow.com/a/21161923
has comment: http://stackoverflow.com/comment/31854151
tagged with: loops
has comment: http://stackoverflow.com/comment/31854268
has answer: http://stackoverflow.com/a/21161993
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31854297
has answer: http://stackoverflow.com/a/21161939
has comment: http://stackoverflow.com/comment/31854131
tagged with: java
has body: A Java Newbie here, I tried to program a oracle machine and it worked. However, the last part of asking the users if they want to continue is not working. I will ask the users if they want to continue and if they did not reply 'Y','y','N' or 'n',they will have to rerun the test again. So the problem that I am getting is this: What is the question that you want to ask?... agafds No! And Stop asking me! Continue asking?(Y/N)...Y Continue asking?(Y/N)...Y Continue asking?(Y/N)...Y Continue asking?(Y/N)...Y Continue asking?(Y/N)...Y From this: import java.util.Scanner; import java.util.Random; import static java.lang.System.out; public class firstClass { public static void main(String args[]) { Scanner kbScanner=new Scanner(System.in); Random intRand=new Random(); String yOn; do { int oneten; out.print("What is the question that you want to ask?... "); kbScanner.nextLine(); oneten=intRand.nextInt(10)+1; switch (oneten) { case 1 : out.println("Not a chance, buster."); break; case 2 : out.println("Get a life man!"); break; case 3 : out.println("Why are you even asking me this?!"); break; case 4 : out.println("Depends on your thinking."); break; case 5 : out.println("What are you seeking for?"); break; case 6 : out.println("Maybe... But don't trust me..."); break; case 7 : out.println("Do I look like I care?"); break; case 8 : out.println("Why would you even ask that?"); break; case 9 : out.println("The chances are as thin as searching for a needle in a haystack."); break; case 10 : out.println("No! And Stop asking me!"); break; } do{ out.print("Continue asking?(Y/N)..."); yOn=kbScanner.nextLine(); }while (!yOn.equals("Y")||!yOn.equals("y")||!yOn.equals("N")||!yOn.equals("n")); out.println("Continuing"); }while (yOn.equals("Y")||yOn.equals("y")); } } So: The problem is that no matter what the user inputs there seems to be no difference.
accepted answer: http://stackoverflow.com/a/21161939
type: Question
score: 0
has answer: http://stackoverflow.com/a/21161906

android-preferences
tags question: http://stackoverflow.com/q/21044126
type: Tag
tags question: http://stackoverflow.com/q/21159530
tag name: android-preferences

http://stackoverflow.com/comment/31669919
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21052894
has text: @mKorbel _final size can be set three ways_ - back to our usual relationship: I don't have the faintest idea what you are talking about ;-) There is exactly one way to set the size of a component - either done by the LayoutManager or manually - and that's setBounds(...), so you must mean something else.
score: 0

http://stackoverflow.com/a/21119294
has body: i use the jdbc's native timestamp type: Date date = myobject.getDate(); cstmt = conn.prepareCall("{call dbo.myproc(?)}"); cstmt.setTimestamp("date", new Timestamp(date.getTime()) cstmt.execute();
answers question: http://stackoverflow.com/q/21119096
type: Answer
score: 0

ubuntu-server
type: Tag
tag name: ubuntu-server
tags question: http://stackoverflow.com/q/21094477

http://stackoverflow.com/comment/31780888
type: Comment
comment on: http://stackoverflow.com/a/21045869
score: 0
type: AnswerComment
has text: Thanks. I've seen the wiki and it looks promising. I'll look into it.

http://stackoverflow.com/q/21083834
has answer: http://stackoverflow.com/a/29995192
has answer: http://stackoverflow.com/a/74277604
tagged with: java
has answer: http://stackoverflow.com/a/51222665
has answer: http://stackoverflow.com/a/25881592
upvote count: 50
has body: I want to load Log4j2 XML configuration file programmatically from my application. Tried this: ConfigurationSource source = new ConfigurationSource(); source.setLocation(logConfigurationFile); Configurator.initialize(null, source); and this: ConfigurationSource source = new ConfigurationSource(); source.setLocation(logConfigurationFile); ConfigurationFactory factory = (ConfigurationFactory) XMLConfigurationFactory.getInstance().getConfiguration(source); ConfigurationFactory.setConfigurationFactory(factory); But nothing works yet.
downvote count: 0
has title: Load Log4j2 configuration file programmatically
has answer: http://stackoverflow.com/a/21087859
favorite count: 0
has comment: http://stackoverflow.com/comment/82811656
score: 50
has answer: http://stackoverflow.com/a/42524443
answer count: 10
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/23394041
has answer: http://stackoverflow.com/a/58815067
has answer: http://stackoverflow.com/a/49334573
has answer: http://stackoverflow.com/a/79479467
accepted answer: http://stackoverflow.com/a/21087859
possible better answer: http://stackoverflow.com/a/28701154
tagged with: log4j2
tagged with: logging
type: Question
has answer: http://stackoverflow.com/a/28701154

http://stackoverflow.com/a/24264671
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/86104360
type: Answer
has body: You can use com.google.api-client and google-api-services-androidpublisher libraries. First go to the project on google developer console (https://console.developers.google.com) APIs & Auth -> APIs Enable "Google Play Android Developer API" Go to Credentials -> Create new Client ID Select service account Create client ID Save the p12 file somewhere safe Then add the just generated email address for the service account to your google play developer console (https://play.google.com/apps/publish/) Settings -> User accounts & rights -> Invite new user Paste the @developer.gserviceaccount.com email account Select "View financial reports" Send invitation Now to the code. Add the following dependencies to your pom.xml file: com.google.api-client google-api-client 1.18.0-rc com.google.http-client google-http-client-jackson2 1.18.0-rc com.google.apis google-api-services-androidpublisher v1.1-rev25-1.18.0-rc Then first validate the signature: byte[] decoded = BASE64DecoderStream.decode(KEY.getBytes()); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); PublicKey publicKey = keyFactory.generatePublic(new X509EncodedKeySpec(decoded)); Signature sig = Signature.getInstance("SHA1withRSA"); sig.initVerify(publicKey); sig.update(signedData.getBytes()); if (sig.verify(BASE64DecoderStream.decode(signature.getBytes()))) { // Valid } If the signature verifies fetch subscription details: // fetch signature details from google HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport(); JsonFactory jsonFactory = JacksonFactory.getDefaultInstance(); GoogleCredential credential = new GoogleCredential.Builder() .setTransport(httpTransport) .setJsonFactory(jsonFactory) .setServiceAccountId(ACCOUNT_ID) .setServiceAccountScopes(Collections.singleton("https://www.googleapis.com/auth/androidpublisher")) .setServiceAccountPrivateKeyFromP12File(new File("key.p12")) .build(); AndroidPublisher pub = new AndroidPublisher.Builder(httpTransport, jsonFactory, credential) .setApplicati…
has comment: http://stackoverflow.com/comment/44986110
accepted answer of: http://stackoverflow.com/q/21111518
has comment: http://stackoverflow.com/comment/96222339
upvote count: 1
answers question: http://stackoverflow.com/q/21111518

http://stackoverflow.com/comment/31707017
type: Comment
comment on: http://stackoverflow.com/a/21080085
has text: ... and the pennies don't always end up in the same five spots?
type: AnswerComment
score: 0

http://stackoverflow.com/q/21145365
answer count: 1
linked to: http://stackoverflow.com/q/11732006
tagged with: equinox
has body: My company produces a small suite of Eclipse RCP applications that are installed into the same shared location on Windows (C:\Program Files (x86)\MyCompany). They share a plug-ins directory but have separate configuration areas. The desired location for osgi.configuration.area, osgi.user.area, and osgi.instance.area are in a user's roaming application data area (%APPDATA% on Windows XP/7). Due to localization requirements and differences in path locations between the OSes, it is not sufficient to build a path in the PRODUCT.ini launcher file starting from @user.home. Bug 241192 added the ability to specify environment variables in the config.ini file, but not in the PRODUCT.ini file. This is the installation directory structure: C:/Program Files (x86)/MyCompany configurationProgram1/config.ini configurationProgram2/config.ini configurationProgram3/config.ini jre/ plugins/*.jar Program1.exe Program1.ini Program2.exe Program2.ini Program3.exe Program3.ini This is an example PRODUCT.ini file: --launcher.defaultAction openFile -clean -vmargs -Xmx768m -Dosgi.locking=none -Dosgi.requiredJavaVersion=1.7 -Dvisualvm.display.name=Program1 -Dosgi.baseConfiguration.area=file:configurationProgram1 -Dosgi.sharedConfiguration.area=file:configurationProgram1 This is an example config.ini file: #Product Runtime Configuration File eclipse.application=com.mycompany.app.program1.application osgi.bundles.defaultStartLevel=4 eclipse.product=com.mycompany.app.program1.product osgi.splashPath=platform:/base/plugins/com.mycompany.app.program1 osgi.bundles= ... org.eclipse.equinox.common@2:start,\ ... org.eclipse.equinox.launcher.win32.win32.x86,\ org.eclipse.swt.win32.win32.x86 osgi.configuration.area=$APPDATA$/MyCompany/Program1/configuration osgi.user.area=$APPDATA$/MyCompany/Program1/user osgi.instance.area=$APPDATA$/MyCompany/Program1/instance If the working directory is in installation directory when the application is launched (e.g. double-click the exe in Windows Explorer, use a shor…
has comment: http://stackoverflow.com/comment/31874549
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31845825
tagged with: java
type: Question
has title: osgi.baseConfiguration.area does not resolve using a relative path
tagged with: eclipse-rcp
has answer: http://stackoverflow.com/a/21244351
accepted answer: http://stackoverflow.com/a/21244351
score: 0

http://stackoverflow.com/a/21057134
accepted answer of: http://stackoverflow.com/q/21056992
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21056992
has comment: http://stackoverflow.com/comment/31687467
has comment: http://stackoverflow.com/comment/31662991
has body: When you call the static method AudioSystem.getAudioInputStream() you are getting the audio input stream from the given URI, as long as that URI points to an audio. This mean what your doing in your code isn't actually using the same stream. In other words, what you are doing is correct. As for the 'part 2' of the question I'm not sure what you mean by the timing of the clip? Could you expand on that a little?
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31662951
type: Answer

http://stackoverflow.com/a/21146277
score: 1
answers question: http://stackoverflow.com/q/21140559
has comment: http://stackoverflow.com/comment/31829568
accepted answer of: http://stackoverflow.com/q/21140559
has comment: http://stackoverflow.com/comment/31905984
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31828635
has comment: http://stackoverflow.com/comment/31828114
type: Answer
downvote count: 0
has body: It's also a Maven project. It has a dependency on another project which is one of our projects. After digging, it seems the conflict is with a sub-dependency of our project. Check that all of your projects are using the same version of Jersey and the same version of any other major frameworks that your project uses. Use the Maven dependency analysis tool in Eclipse to show what JARs are being included in your WAR and what dependency declaration is causing the JAR to be included. You may need to add exclusions in your POM to fix things. For example, so that some ancillary dependency doesn't pull in an outdated version of Jersey. Are there any run-time analysis tools for WAR files? You can add -verbose:class to your Java options to get a printout of classes and JARs as they are loaded.

http://stackoverflow.com/q/21063232
tagged with: monospace
has comment: http://stackoverflow.com/comment/31674301
tagged with: text
has comment: http://stackoverflow.com/comment/31678655
has comment: http://stackoverflow.com/comment/31674036
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31678539
upvote count: 1
has title: Display a tree with monospaced font (as in notepad)
downvote count: 1
has comment: http://stackoverflow.com/comment/31674359
linked to: http://stackoverflow.com/q/4965335
tagged with: tree
has answer: http://stackoverflow.com/a/21075774
tagged with: java
has answer: http://stackoverflow.com/a/34686007
has body: Currently I have a program that generates a tree. I used https://stackoverflow.com/a/8948691 to get a string output of the tree. For this, I slightly altered the function in the link: Instead of using System.out.println I rewrote the code to fit my requirements: public String getStringRepresentation(String prefix, boolean end, int position) { String retval = prefix + (position != -1? (end ? "└──" : "├──") + " " + position +(branches==null? "[" + content + "]" : ""):"") + "\r\n"; if(branches != null) { for (int i = 0; i &lt; branches.size() - 1; i++) { retval += branches.get(i).getStringRepresentation(prefix + (end ? " " : "│ "), false,i); } if (branches.size() &gt;= 1) { retval += branches.get(branches.size() - 1).getStringRepresentation(prefix + (end ?" " : "│ "), true,branches.size() - 1); } } return retval; } An example text output would be ├── 0 │ ├── 0[F] │ └── 1 │ ├── 0[V] │ └── 1[A] └── 1 ├── 0[D] └── 1[S] This String I display with the following: JTextArea textarea = new JTextArea(infoMessage); textarea.setFont(new Font("monospaced", Font.PLAIN, 14)); JOptionPane.showMessageDialog(null, textarea); which looks like this: (As you can see, the alignment is not as it should be.)
type: UnansweredQuestion
tagged with: string
favorite count: 0
type: Question

http://stackoverflow.com/comment/31906757
comment on: http://stackoverflow.com/q/21181795
has text: using system.arraycopy seems to give some speedup ( while drawing ), http://answers.opencv.org/question/18304/which-class-can-show-an-image-in-java/ ( look at the last comment )
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21182936
accepted answer of: http://stackoverflow.com/q/21182882
has comment: http://stackoverflow.com/comment/31892997
answers question: http://stackoverflow.com/q/21182882
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31892539
has comment: http://stackoverflow.com/comment/31892484
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31893490
score: 1
has body: You will need to update your count variable too in addItem so that the all the rows are created when notifyDataSetChanged is called

http://stackoverflow.com/q/21023522
answer count: 2
tagged with: java.util.logging
has comment: http://stackoverflow.com/comment/31601535
score: 0
has answer: http://stackoverflow.com/a/21023601
tagged with: netbeans
has body: I have a swing application that requires some logging capabilities. I would like to log all global issues to a log file somewhere on the system. I started off with setting up my logger in my main: // Setup global logging. Logger.getLogger("").addHandler(new FileHandler("%t/log.txt")); I understand that the %t denotes the temporary directory, but when I'm working in Netbeans, where is this directory located on a Windows machine? Where would the file be located when running standalone (e.g. outside of Netbeans)? Is there a better alternative such as placing the file in My Documents or something similar? Is creating a log file in a temp directory standard practice? Also, is leaving the name of the logger "" common practice for a global logger or should I be using the most general package (e.g. com.some.package)? Now, when I go to actually log something to the file I can simply make the following calls, correct? Logger.getLogger("").log(Level.SEVERE, msg, ex); Any advice on best practices would be much appreciated.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21023607
tagged with: swing
has title: Global logging to file in a Java application
type: Question
tagged with: java

http://stackoverflow.com/comment/31759299
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21109637
has text: Hmm... I know it's fairly easy to get a settings screen for Android using SharedPreferences, but I'm trying to put this listView together with three different arrays.

http://stackoverflow.com/q/21071744
has body: I am new to Posting question in Stack Overflow. I am currently implementing Spring Security ACL for my REST Services. What i want is a way to hide and show certain UI tags based on ACL entry. Since i am using REST Services - All my calls from UI are ajax based and returns a JSON. Now with Spring Security ACL tags its required to send a DomainObject to the tag so that it can resolve the authorization. Since i get a JSON from backend i cant create a DomainObject. Also the time i return a JSON to frontened the JSP will be delivered in first place so the security tag will not be effected. Best Regards Sriram
tagged with: spring-security
tagged with: rest
type: UnansweredQuestion
tagged with: spring
tagged with: acl
tagged with: java
has answer: http://stackoverflow.com/a/22368540
has title: Spring Security ACL tags for REST Services
type: Question
score: 0
answer count: 1

http://stackoverflow.com/q/21111533
has answer: http://stackoverflow.com/a/21112478
tagged with: database
has comment: http://stackoverflow.com/comment/31762659
has body: I'd like to save 3 letter codes to SQL database, and would like to use them later to execute many queries against that codes (probably 3-4 combinations of these codes to identify some a list of records). I think if I use String representation for this could be slow as I will be having >100.000 entries. I'm now thinking if I could just represent these 3 letter codes (english alphabet) with a unique digit, and just query for this digit? Therefore I could transform each character to ascii and map A=01, Z=26 (if I subtract 64 from the ascii value). Thus AAA=010101, ZZZ=262626. Would this make sense? Could I do better?
has comment: http://stackoverflow.com/comment/31762570
score: 0
answer count: 2
tagged with: sql
has comment: http://stackoverflow.com/comment/31762877
has comment: http://stackoverflow.com/comment/31762584
possible better answer: http://stackoverflow.com/a/21111620
has comment: http://stackoverflow.com/comment/31762623
has comment: http://stackoverflow.com/comment/31762542
tagged with: postgresql
has title: How to convert letter codes to digit?
linked to: http://stackoverflow.com/q/1108
has comment: http://stackoverflow.com/comment/31762727
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21112478
tagged with: java
has answer: http://stackoverflow.com/a/21111620
has comment: http://stackoverflow.com/comment/31794376
type: Question
has comment: http://stackoverflow.com/comment/31762546

http://stackoverflow.com/a/21129855
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21129794
answers question: http://stackoverflow.com/q/21129794
type: Answer
has body: Add a continue statement instead of reading the next value inside the if block if (value &lt; 0) { System.out.println("Error: Can not be a Negative Value"); System.out.println("Please enter CU or Type q and Enter to Total."); //value = in.nextDouble(); continue; } This way, the validation happens for all inputs. A continue statement will end the current iteration and the next iteration begins.
score: 2
downvote count: 0

http://stackoverflow.com/comment/31689609
type: Comment
has text: If on OS X or Linux/Unix, try replacing all ; with : on the command line. I assumed Windows. Different platforms has different separators, has nothing to do with Java.
comment on: http://stackoverflow.com/a/21030305
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31826301
has text: The `super` keyword is your friend. http://docs.oracle.com/javase/tutorial/java/IandI/super.html
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21146248

http://stackoverflow.com/comment/31882238
score: 0
type: AnswerComment
has text: Thanks so much!! I will definitely use that auto indent next time. Now the Multiplication section prints fine, but the sum is all zeroes (but correctly shaped). Any idea what could fix this problem?
type: Comment
comment on: http://stackoverflow.com/a/21176876

http://stackoverflow.com/comment/35874847
score: 0
type: Comment
has text: Yes, this is not really a hack as it is the only way Cassandra seems to communicate the result of the mutation. I am doing the same thing. I discovered this by logging the content of the result sets, which I expected to be empty. I wish the documentation were clearer on this behavior.
type: AnswerComment
comment on: http://stackoverflow.com/a/23074977

http://stackoverflow.com/a/21157198
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21157169
type: Answer
has body: Try public void onClick(View v) { Intent intent = new Intent(A.this, B.class); A.this.finish(); startActivity(intent); }
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21157169
upvote count: 1

http://stackoverflow.com/q/21081434
type: Question
has title: Adding a timer button in a frame to another frame
has comment: http://stackoverflow.com/comment/31757232
has answer: http://stackoverflow.com/a/21084480
has body: I want to add a timer button to my main frame but it is in another class and I don't know how to use it in my main class. I need a timer button in my frame but I can't make it without another class. In that class I can't call my main frame. This is my code: class ButtonTimer extends Thread{ private JButton button = new JButton(" "); private int count = 1; public ButtonTimer() { Timer time = new Timer(1000, new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { button.setText(String.valueOf(count)); count++; } }); time.start(); JFrame frame1 = new JFrame(); frame1.add(button); frame1.setBounds(0, 20, 100, 50); frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame1.pack(); frame1.setVisible(true); } } public class game { public static void main(String[] args) { JFrame frame2 = new JFrame(); frame2.setBounds(0, 0, 1000, 5000); frame2.setVisible(true); JLayeredPane jlp = new JLayeredPane(); jlp.setBounds(0, 0, 1000, 500); frame2.add(jlp); SwingUtilities.invokeLater(new Runnable() { public void run() { new ButtonTimer(); } }); } } How can I do this?
linked to: http://stackoverflow.com/q/9554636
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/21081549
favorite count: 0
tagged with: jframe
tagged with: time
score: -1
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31713067
tagged with: swing
downvote count: 1

http://stackoverflow.com/q/21088976
tagged with: dispatcher
has comment: http://stackoverflow.com/comment/31723291
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31721315
has comment: http://stackoverflow.com/comment/31722662
tagged with: maven
has comment: http://stackoverflow.com/comment/31721387
has comment: http://stackoverflow.com/comment/31730727
has comment: http://stackoverflow.com/comment/31721330
has comment: http://stackoverflow.com/comment/31721468
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/31721250
has comment: http://stackoverflow.com/comment/31723040
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/31722355
answer count: 1
has comment: http://stackoverflow.com/comment/31722269
has title: Exception on casting Dispatcher Servlet
has body: I have a maven web in eclipse and on compiling it, i am getting some exception saying java.lang.ClassCastException: org.springframework.web.servlet.DispatcherServlet cannot be cast to javax.servlet.Servlet I am not able to understand the exception and i dont know whats going wrong. pom.xml: 4.0.0 saumyaraj wishtree 0.0.1-SNAPSHOT war javax.persistence persistence-api 1.0.2 javax javaee-api 7.0 provided org.springframework spring-webmvc 4.0.0.RELEASE org.springframework spring-beans 4.0.0.RELEASE org.hibernate hibernate-core 4.2.8.Final javax.transaction javax.transaction-api 1.2 maven-taglib maven-taglib-plugin 1.4.2 My web.xml:- <?xml version="1.0" encoding="UTF-8"?> Spring3-Hibernate spring org.springframework.web.servlet.DispatcherServlet 1 spring / Error Stack:- SEVERE: Servlet /wishtree threw load() exception java.lang.ClassCastException: org.springframework.web.servlet.DispatcherServlet cannot be cast to javax.servlet.Servlet at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1116) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4350) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4659) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardHost.start(StandardHost.java:785) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445) at org.apache.catalina.startup.Embedded.start(Embedded.java:825) at org.codehaus.mojo.tomcat.AbstractRunMojo.startContainer(AbstractRunMojo.java:558) at org.codehaus.mojo.tomcat.AbstractRunMojo.execute(AbstractRunMojo.java:255) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.in…
has answer: http://stackoverflow.com/a/21094499
score: 0
has comment: http://stackoverflow.com/comment/31721705
has comment: http://stackoverflow.com/comment/31723685

http://stackoverflow.com/comment/31711696
comment on: http://stackoverflow.com/q/21083298
has text: from above code i will call the GUI screen and when i give click on button in screen i should return to run method
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31867531
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21150008
type: AnswerComment
has text: Agree that sln's solution is obscure; but `(?=(...).*\n.*\1)` is pretty readable, as regexes go. As for "magic spells" - the proper word for "book of magic spells" is "grymoire", and http://www.grymoire.com is a most fascinating place to visit.

http://stackoverflow.com/a/37878580
has body: Add this in your application.properties file server.port= 8080
downvote count: 1
upvote count: 16
score: 15
type: Answer
answers question: http://stackoverflow.com/q/21083170
has comment: http://stackoverflow.com/comment/84370378
has comment: http://stackoverflow.com/comment/63212398

http://stackoverflow.com/a/21170800
has body: Java 8 solution : boolean match = Arrays.stream(arr).allMatch(s -&gt; s.equals(arr[0])); Same logic for lists : boolean match = list.stream().allMatch(s -&gt; s.equals(list.get(0))); It comes quite complicated if there are only or any null values in the array (resulting in a NullPointerException). So possible workarounds are: Using Predicate.isEqual, it uses the static method equals from the Objects class and it will do the null check for you before calling equals on the first argument. boolean match = Arrays.stream(arr).allMatch(Predicate.isEqual(arr[0])); boolean match = Arrays.stream(arr).allMatch(s -&gt; Objects.equals(arr[0], s)); Using distinct() and count() : boolean match = Arrays.stream(arr).distinct().count() == 1; that can be improved into Arrays.stream(arr).distinct().limit(2).count() == 1; as there is no need to check the all pipeline's content if you already find 2 distinct elements.
has comment: http://stackoverflow.com/comment/31873157
upvote count: 26
has comment: http://stackoverflow.com/comment/34617203
type: Answer
has comment: http://stackoverflow.com/comment/31871032
answers question: http://stackoverflow.com/q/21170608
downvote count: 0
has comment: http://stackoverflow.com/comment/31871036
has comment: http://stackoverflow.com/comment/31870916
has comment: http://stackoverflow.com/comment/31872477
score: 26
has comment: http://stackoverflow.com/comment/31872761
has comment: http://stackoverflow.com/comment/31871946

http://stackoverflow.com/a/21099229
has comment: http://stackoverflow.com/comment/71347826
upvote count: 188
has comment: http://stackoverflow.com/comment/71341361
has comment: http://stackoverflow.com/comment/111553460
has comment: http://stackoverflow.com/comment/31741256
accepted answer of: http://stackoverflow.com/q/21099072
score: 187
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21099072
has comment: http://stackoverflow.com/comment/52098613
has comment: http://stackoverflow.com/comment/111546849
has comment: http://stackoverflow.com/comment/71350343
type: Answer
has body: Go to Window → Preferences → Java → Installed JREs. And see if there is an entry pointing to your JDK path, and if not, click on Edit button and put the path you configured your JAVA_HOME environment.
has comment: http://stackoverflow.com/comment/111552730
has comment: http://stackoverflow.com/comment/111552216
downvote count: 1

http://stackoverflow.com/q/21058012
has answer: http://stackoverflow.com/a/21058057
tagged with: google-polyline
tagged with: google-maps
tagged with: google-maps-api-2
answer count: 1
type: UnansweredQuestion
tagged with: android
type: Question
has body: I am trying to make an app in where i have set 3 colors for polylines according to the speed ,but they polylines are not showig up.I have created a function and have added it to the polylines but there are no lines showing up. Can anyone help me with my code as follows::. Thank you PolylineOptions rectOptions = new PolylineOptions(); @Override public void onLocationChanged(Location location) { // mMessageView.setText("Location = " + location); rectOptions.add(new LatLng(location.getLatitude(), location.getLongitude())); if (setIt == true){ setcolortopoly(); mMap.addPolyline(rectOptions); } } public void setcolortopoly(){ if(mIsMetric){ if(speed_poly&lt;5.0){ rectOptions = new PolylineOptions().width(3).color( Color.YELLOW ); } else if(5.0&lt;= speed_poly &amp;&amp; speed_poly &lt;10){ rectOptions = new PolylineOptions().width(3).color( Color.GREEN ); } else if(10.0&lt;=speed_poly){ rectOptions = new PolylineOptions().width(3).color( Color.RED ); } } else{ if(speed_poly&lt;3.1){ rectOptions = new PolylineOptions().width(3).color( Color.YELLOW ); } else if(3.1&lt;= speed_poly &amp;&amp; speed_poly &lt;6.21){ rectOptions = new PolylineOptions().width(3).color( Color.GREEN ); } else if(6.21&lt;=speed_poly){ rectOptions = new PolylineOptions().width(3).color( Color.RED ); } } }
tagged with: java
has title: How to change polyline color according to the speed
score: 0

http://stackoverflow.com/q/21064138
has comment: http://stackoverflow.com/comment/32082967
linked to: http://stackoverflow.com/q/212350
upvote count: 16
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31805799
tagged with: java
tagged with: hibernate
score: 16
accepted answer: http://stackoverflow.com/a/27866835
type: Question
has comment: http://stackoverflow.com/comment/44136172
answer count: 2
tagged with: jpa
has body: in my Model project (it only has the persistent classes, aka java beans) i have a class which has a composite primary key. To map this, i have used two @Id in my class. Before hibernate 4 it was not possible but now it is Ok. So, the problem is, eclipse is showing an error in this class, saying that it should be done in the old way. Like this: As i said, it is a false error, because the code works fine if i execute it. I have JBoss Tools plugin installed on eclipse, but i don't know if the errors is being caused by it or by eclipse. Anyone know how to solve this issue? Not that it is preventing me from executing the app, but it is an annoying thing to have the error being always shown. --- EDIT --- So, now i know the problem is on JBoss Tools because i deactivated the JPA facet on the project and the error have stopped. But i wish i could use the facilities that JBoss Tools gives, so... no solution yet.
tagged with: jboss-tools
has title: Eclipse error when using multiple @Id for composite primary keys
possible better answer: http://stackoverflow.com/a/21135133
downvote count: 0
has answer: http://stackoverflow.com/a/21135133
has answer: http://stackoverflow.com/a/27866835
favorite count: 0

http://stackoverflow.com/comment/31755508
has text: `protected void Paint (Graphics g){` Use `@Override` notation for an informative compiler error..
comment on: http://stackoverflow.com/q/21092627
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31883848
comment on: http://stackoverflow.com/a/21177682
type: Comment
has text: Reuse and portability. You can add `JPanel` to other containers. Understand the (loosly speaking), `JFrame` is a container like `JPanel`, it just has several more layers wrapped ontop it. Also, you get the benifit of compound layout, which allows you develop complex interfaces. Also understand, the only way to get any component on the screen is through some class which extends from `Window`, like `JFrame`
score: 0
type: AnswerComment

http://stackoverflow.com/q/21086669
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36100361
tagged with: file
tagged with: tree
has comment: http://stackoverflow.com/comment/35945139
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36075232
has title: displaying file tree view of specific drive using java web
type: Question
upvote count: 1
tagged with: web
favorite count: 0
has comment: http://stackoverflow.com/comment/36012882
has comment: http://stackoverflow.com/comment/36019528
has body: As i searched, getting the file tree view for the specific path is quite straight forward and achievable by using swing packages on a desktop app. But is there any web application based on java to display it on browsers? Many of the application i found are written in PHP. If you have any other option. Please suggest it to me. Thanks in Advance!
tagged with: view
answer count: 0
downvote count: 0

http://stackoverflow.com/a/46858110
answers question: http://stackoverflow.com/q/21166573
score: -2
downvote count: 2
has body: In java 8 and up there is another way without external dependencies: use StringJoiner: List&lt;String&gt; cities = Arrays.asList("Milan", "London", "New York", "San Francisco"); String citiesCommaSeparated = String.join(",", cities); System.out.println(citiesCommaSeparated); //Output: Milan,London,New York,San Francisco Credits and example go to this URL (https://reversecoding.net/java-8-convert-list-string-comma/)
type: Answer
has comment: http://stackoverflow.com/comment/87446384
upvote count: 0

http://stackoverflow.com/a/21334878
has comment: http://stackoverflow.com/comment/32436394
downvote count: 2
answers question: http://stackoverflow.com/q/21154400
has body: The problem is the Java 7u51, it have a bug that affect Derby and other programs and libraries, I suggest to install the Java 7u45
upvote count: 0
score: -2
type: Answer

http://stackoverflow.com/comment/31760740
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21110285
has text: In general solution is bulk insert: http://stackoverflow.com/questions/9718305/batch-insertions-with-hibernate-spring
type: Comment

http://stackoverflow.com/comment/31893101
comment on: http://stackoverflow.com/q/21183014
has text: You should be able to monitor the connection pool I suppose. Check if is fully consumed at some point.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21138621
answers question: http://stackoverflow.com/q/21138297
has body: You could try using Java Beans When the value is updated . You can set them to the setters . You can retrieve the values through JSTL or EL Hope it helps!!
score: 0
type: Answer

http://stackoverflow.com/a/21108067
score: 1
accepted answer of: http://stackoverflow.com/q/21107998
upvote count: 1
answers question: http://stackoverflow.com/q/21107998
has comment: http://stackoverflow.com/comment/31761451
downvote count: 0
has body: In case you pass String instead of StringBuffer and perform append operation on it then the to get the result you must have to retrun that String, because String is immutable so any opertaion performed on it create new String and the method who called appenedReplacement() contins the refrence of old actual string. StringBuffer provides you the functionality to append string without changing the reference. So any operation performed on StringBuffer remains even if you not retrn the resultant String. Matcher StringBuffer String
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/31813600
has text: Not a duplicate IMO. That question is mostly about `Calender`s, this is about `Date`s.
comment on: http://stackoverflow.com/q/21139468
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/q/21040299
has body: I have seen in adobe API documentation QueryBuilder Service which can be called by URLs for many query options, this returns JSON based responses. Very well. I wan to use this in java API. I have found some examples and tried in eclipse but some thing i dont know that how to get the Service "sling" as in given code below: OR in other words how to make a QueryBuilder Java object. Any specific JAR i needed or i need to install Apache SLING on my PC i am not sure any one who can share this will be helpful as i am new to CQ5 and has no idea. The example code is as below: Repository repository = JcrUtils.getRepository(SERVER); SimpleCredentials credentials = new SimpleCredentials(USERNAME, PASSWORD.toCharArray()); Session session = repository.login(credentials); System.out.println("got session: " + session); /*HERE SLING IS THE PROBLEM HOW TO GET SLING */ QueryBuilder qbuilder = sling.getService(QueryBuilder.class); String fulltextSearchTerm = "Geometrixx"; // create query description as hash map (simplest way, same as form // post) Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); // create query description as hash map (simplest way, same as form // post) map.put("path", "/content"); map.put("type", "cq:Page"); map.put("group.p.or", "true"); // combine this group with OR map.put("group.1_fulltext", fulltextSearchTerm); map.put("group.1_fulltext.relPath", "jcr:content"); map.put("group.2_fulltext", fulltextSearchTerm); map.put("group.2_fulltext.relPath", "jcr:content/@cq:tags"); // can be done in map or with Query methods map.put("p.offset", "0"); // same as query.setStart(0) below map.put("p.limit", "20"); // same as query.setHitsPerPage(20) below Query query = qbuilder.createQuery(PredicateGroup.create(map), session); query.setStart(0); query.setHitsPerPage(20); SearchResult result = query.getResult();
possible better answer: http://stackoverflow.com/a/21844157
has answer: http://stackoverflow.com/a/21042449
has answer: http://stackoverflow.com/a/21844157
tagged with: aem
type: AnsweredQuestion
tagged with: sling
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21042449
answer count: 2
score: 0
has title: CQ5 Java QueryBuilder API

http://stackoverflow.com/comment/92618380
type: QuestionComment
comment on: http://stackoverflow.com/q/21147896
has text: In Java collection comparison how would you get parent collection for a child element? It's totally different situation. I think you should remove components inside your layout class where you will just call `removeComponent` method without any casts
score: 0
type: Comment

http://stackoverflow.com/comment/31795884
type: Comment
has text: What's problem you are facing ? @user3193714
type: AnswerComment
comment on: http://stackoverflow.com/a/21112552
score: 0

http://stackoverflow.com/comment/31620286
type: AnswerComment
comment on: http://stackoverflow.com/a/21033465
type: Comment
has text: +1, See the section from the Swing tutorial on a [Closer Look at the Paint Mechanism](http://docs.oracle.com/javase/tutorial/uiswing/painting/closer.html). Read the entire section for examples on the proper way to do custom painting.
score: 2

http://stackoverflow.com/a/21029835
score: 1
upvote count: 1
has body: You forgot to return the instance : public Quiz questionPosition(int x, int y) { this.xPos = x; this.yPos = y; } Should be : public Quiz questionPosition(int x, int y) { this.xPos = x; this.yPos = y; return this; } In addition, calling the same method multiple times overwrites the member values of your object.
downvote count: 0
answers question: http://stackoverflow.com/q/21029751
type: Answer

http://stackoverflow.com/comment/31832372
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21035472
type: QuestionComment
has text: When you have resolved the build/run-time related problem, you ought to correct your AT command handling to read and parse responses. See this answer for instance, http://stackoverflow.com/a/20730446/23118.

http://stackoverflow.com/q/21072239
has comment: http://stackoverflow.com/comment/31690478
has answer: http://stackoverflow.com/a/21072320
tagged with: oop
downvote count: 14
tagged with: java
has comment: http://stackoverflow.com/comment/31690471
type: Question
has comment: http://stackoverflow.com/comment/31690518
upvote count: 0
has body: I got confused for this java program . Can anybody please tell me what will be the output of this program? class Sample { public static void start() { System.out.println("Bla bla..."); } public static void main(String []args) { try { start(); } catch(Exception e) { } } }
has comment: http://stackoverflow.com/comment/31690490
score: -14
answer count: 2
has comment: http://stackoverflow.com/comment/31690540
favorite count: 0
has answer: http://stackoverflow.com/a/21072336
type: UnansweredQuestion
has title: Java program to call static method from main

http://stackoverflow.com/a/32791295
score: 4
type: Answer
has body: After hours of having the same problem, notice that if your jar is on the libs folder will cause problem once you set it upon the "Dependencies ", so i just comment the file tree dependencies and keep the one using dependencies //compile fileTree(dir: 'libs', include: ['*.jar']) &lt;-------- commented one compile 'com.google.android.gms:play-services:8.1.0' compile 'com.android.support:appcompat-v7:22.2.1' and the problem was solved.
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/21081598

http://stackoverflow.com/q/21157919
has comment: http://stackoverflow.com/comment/31847295
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/31847370
has title: Getting undefined value while passing hidden value from jsp to servlet
has body: I have a hidden value in JSP. &lt;input type="hidden" name="selectedtxn" value="" /&gt; And I access the value from servlet. String selectedTxnNo = request.getParameter("selectedtxn"); But the value I get in servlet is undefined. Am I doing anything wrong?
tagged with: java
downvote count: 1
type: Question
tagged with: jsp
tagged with: servlets
has answer: http://stackoverflow.com/a/21157947
score: 0
has comment: http://stackoverflow.com/comment/31848032
has comment: http://stackoverflow.com/comment/31847781
answer count: 1

http://stackoverflow.com/q/21161169
accepted answer: http://stackoverflow.com/a/21189205
tagged with: http://stackoverflow.com/tag/json
has body: In my project , i need to make a navigation application to give the directions to a blind user,so i need to get get audio tracks for all route nodes in that Google map. I have referenced many navigation tutorials on the web, but i didn't get what i needs. For any help, i am thankful to you. this is my jsonparser class public class DirectionsJSONParser { /** Receives a JSONObject and returns a list of lists containing latitude and longitude */ public List&lt;List&lt;HashMap&lt;String,String&gt;&gt;&gt; parse(JSONObject jObject){ List&lt;List&lt;HashMap&lt;String, String&gt;&gt;&gt; routes = new ArrayList&lt;List&lt;HashMap&lt;String,String&gt;&gt;&gt;() ; JSONArray jRoutes = null; JSONArray jLegs = null; JSONArray jSteps = null; try { jRoutes = jObject.getJSONArray("routes"); /** Traversing all routes */ for(int i=0;i&lt;jRoutes.length();i++){ jLegs = ( (JSONObject)jRoutes.get(i)).getJSONArray("legs"); List path = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); /** Traversing all legs */ for(int j=0;j&lt;jLegs.length();j++){ jSteps = ( (JSONObject)jLegs.get(j)).getJSONArray("steps"); /** Traversing all steps */ for(int k=0;k&lt;jSteps.length();k++){ String polyline = ""; // polyline = (String)((JSONObject)((JSONObject)jSteps.get(k)).get("polyline")).get("formatted_address"); polyline = (String)((JSONObject)((JSONObject)jSteps.get(k)).get("polyline")).get("points"); List&lt;LatLng&gt; list = decodePoly(polyline); /** Traversing all points */ for(int l=0;l&lt;list.size();l++){ HashMap&lt;String, String&gt; hm = new HashMap&lt;String, String&gt;(); hm.put("lat", Double.toString(((LatLng)list.get(l)).latitude) ); hm.put("lng", Double.toString(((LatLng)list.get(l)).longitude) ); path.add(hm); } } routes.add(path); } } } catch (JSONException e) { e.printStackTrace(); }catch (Exception e){ } return routes; } /** * Method to decode polyline points * Courtesy : http://jeffreysambells.com/2010/05/27/decoding-polylines-from-google-maps-direction-api-with-java * */ private…
tagged with: google-maps
has title: how we can get audio tracks for all route nodes in that google map v2
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21189205
tagged with: android
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
tagged with: navigation
type: Question

http://stackoverflow.com/comment/31895331
score: 1
type: Comment
comment on: http://stackoverflow.com/q/21183418
type: QuestionComment
has text: Maybe you could try and clean the .m2-folder manually, and then run mvn install on your project? Then after that, run your above command to see if the problem persists.

http://stackoverflow.com/a/21021159
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21021075
has body: The effect is that the JVM crashes, exits, stops, dies, finishes ... It does this abruptly, and the JVM gets no chance to execute any application-specific shutdown hooks to tidy things up. If the application was in the middle of writing a file, or something like that, that file not get written completely. A JVM crash like this is typically caused by some application provided native code doing something that triggers a hardware exception (e.g. a "segmentation fault"). It is also possible that it is due to a bug in Java itself.
downvote count: 0

http://stackoverflow.com/a/21053088
answers question: http://stackoverflow.com/q/21053017
has comment: http://stackoverflow.com/comment/31654969
score: 0
has comment: http://stackoverflow.com/comment/31655009
type: Answer
has body: You should open once (and close once). If you do nothing, Java will close it for you. You may prefer to explicitly override Object.finalize().
has comment: http://stackoverflow.com/comment/31655050

http://stackoverflow.com/comment/31841884
score: 0
type: QuestionComment
has text: the line following `**Input**` is the string to apply regex? and the line following `**Output**` is what you want the result to be??
type: Comment
comment on: http://stackoverflow.com/q/21154593

http://stackoverflow.com/comment/31874549
score: 0
has text: @greg-449, Thanks for the comment. I also could not find any bugs reports, but I did find this relevant SO question: http://stackoverflow.com/questions/11732006. It appears that using a relative path to an alternate configuration directory is only possible if both the plugins/ and configuration/ directories are in the same parent. The options -startup and --launcher.library are used to define the location of the plugins/ directory.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21145365

http://stackoverflow.com/comment/31783803
comment on: http://stackoverflow.com/q/21121663
score: 0
type: QuestionComment
has text: First try hardcoding the userid in the xml like 1 and make sure the problem isn't on the server side.
type: Comment

http://stackoverflow.com/a/21175623
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21082404
answers question: http://stackoverflow.com/q/21082404
has body: If anyone else runs into this, it seems that tomcat 8 is not supported by geoserver as yet. My recommendation is downloading and unzipping tomcat7 from the .tar, according the instructions at : http://diegobenna.blogspot.com.au/2011/01/install-tomcat-7-in-ubuntu-1010.html

http://stackoverflow.com/q/21144598
has answer: http://stackoverflow.com/a/21144765
upvote count: 7
has comment: http://stackoverflow.com/comment/31910557
has answer: http://stackoverflow.com/a/21167756
has comment: http://stackoverflow.com/comment/32164253
answer count: 7
has comment: http://stackoverflow.com/comment/31823141
has comment: http://stackoverflow.com/comment/31823096
favorite count: 0
has answer: http://stackoverflow.com/a/21323419
linked to: http://stackoverflow.com/q/494830
has comment: http://stackoverflow.com/comment/31822920
score: 6
possible better answer: http://stackoverflow.com/a/21144713
has comment: http://stackoverflow.com/comment/31822946
has comment: http://stackoverflow.com/comment/31823211
has comment: http://stackoverflow.com/comment/31823654
type: AnsweredQuestion
tagged with: recursion
has answer: http://stackoverflow.com/a/21333468
has comment: http://stackoverflow.com/comment/31822921
tagged with: list
tagged with: java
has answer: http://stackoverflow.com/a/21290978
has comment: http://stackoverflow.com/comment/31823042
tagged with: loops
has comment: http://stackoverflow.com/comment/31823023
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31823592
has comment: http://stackoverflow.com/comment/31823613
has comment: http://stackoverflow.com/comment/31822909
has comment: http://stackoverflow.com/comment/31823688
accepted answer: http://stackoverflow.com/a/21144765
has comment: http://stackoverflow.com/comment/32085281
linked to: http://stackoverflow.com/q/2663115
has title: Identify loop or recursion in the list
has answer: http://stackoverflow.com/a/21144713
has body: I want to identify the loop or recursion in the list for the below structure of the node. How can I identify the same? public class EntityNode { private EntityNode nextNode; // Points to the next node } Example, Node1 -&gt; Node2 -&gt; Node3 -&gt; Node4 -&gt; Node5 -&gt; Node6 -&gt; Node4 Here, you can see that Node6 is pointing to Node4, and here there comes the looping or recursion and my code will go into infinite. So what if I want to find out this type of scenario with the optimum performance level?
has answer: http://stackoverflow.com/a/21144746

http://stackoverflow.com/a/21123935
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21122990
type: Answer
answers question: http://stackoverflow.com/q/21122990
score: 1
upvote count: 1
has body: Usually GUIs are done with the Java Swing API. A good starting point is this tutorial: http://docs.oracle.com/javase/tutorial/uiswing/. Of course there are many other GUI frameworks available. For a good overview see this question.
type: AcceptedAnswer

http://stackoverflow.com/comment/31706285
has text: Is `lbagno` your context path? Let's see your web.xml too.
type: Comment
comment on: http://stackoverflow.com/q/21080598
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31710543
comment on: http://stackoverflow.com/a/21078556
score: 0
type: AnswerComment
has text: Thank your for you response,as what you said,it seems that each time we "new an instance" for a class that we define,each Object instance was created,right?
type: Comment

http://stackoverflow.com/a/21120817
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21120689
has body: Why Boolean.class is java.lang.Class and String.class is java.lang.String? It isn't. public static void main(String[] args) { System.out.println(Boolean.class); System.out.println(boolean.class); } prints class java.lang.Boolean boolean as expected.
upvote count: 2
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21120689

http://stackoverflow.com/q/21065566
tagged with: hashmap
has answer: http://stackoverflow.com/a/21066269
has comment: http://stackoverflow.com/comment/31678473
has title: How to reverse a HashMap?
has comment: http://stackoverflow.com/comment/31679602
has comment: http://stackoverflow.com/comment/31678627
has comment: http://stackoverflow.com/comment/31678126
upvote count: 3
downvote count: 2
has comment: http://stackoverflow.com/comment/31678260
has answer: http://stackoverflow.com/a/21066199
favorite count: 0
has comment: http://stackoverflow.com/comment/31678630
accepted answer: http://stackoverflow.com/a/21065860
answer count: 5
has comment: http://stackoverflow.com/comment/31678298
has body: I need to reverse the order of what the below method returns. For example if it returns: 1=ball, 2=save, 3=take 4=till I want to reverse and return: 1=till, 2=take, 3=save, 4=ball My method is: public Map&lt;Integer, String&gt; returnMapOfValues(ArrayList&lt;String&gt; wordsList) { int getFrequencyValue = 0; Set&lt;String&gt; uniqueSetWords = new HashSet&lt;String&gt;(wordsList); for (String temp : uniqueSetWords) { getFrequencyValue = Collections.frequency(wordsList, temp); //prints the Collection of words and they frequency, For testing only //System.out.println(temp + ":" + Collections.frequency(wordsList, //temp)); map.put(getFrequencyValue, temp); getFrequencyValue = 0; } return map; }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31678294
has answer: http://stackoverflow.com/a/21065860
has answer: http://stackoverflow.com/a/21065778
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/25940014
has comment: http://stackoverflow.com/comment/31678583
has comment: http://stackoverflow.com/comment/31678121
has answer: http://stackoverflow.com/a/25940014
type: Question

http://stackoverflow.com/comment/34637337
has text: @KP_JavaDev Welcome. If this answer is useful to you make it as correct answer, It will helpful for some others.
type: Comment
comment on: http://stackoverflow.com/a/21020306
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31790854
type: Comment
comment on: http://stackoverflow.com/a/21126413
score: 0
type: AnswerComment
has text: @SIlkySmoothNuts - Use the Singleton pattern, it's explained in the link in my post. That will solve your issues... :) - Also, you want to be able to access the variables from another class. Which file it is in is unimportant, you don't pass things between files...

http://stackoverflow.com/q/21129340
favorite count: 0
has answer: http://stackoverflow.com/a/21129400
score: 0
answer count: 5
has comment: http://stackoverflow.com/comment/31795799
has comment: http://stackoverflow.com/comment/31795921
has comment: http://stackoverflow.com/comment/31796007
has title: Java instance variable initialization inside and outside constructor confusion
has body: Lets see a small snippet of java code class Foo { int i = 0; int j; public Foo(int j){ this.j = j; } } Above example shows two ways of initializing variables in Java. But my question is which variable first get initialized? The variable outside the constructor or the variable inside the constructor? When I instantiate the above class Foo foo = new Foo(5), I know that the constructor of the class get called which implies variable j get initialized first. Can anyone make me clear about the ordering.
accepted answer: http://stackoverflow.com/a/21129384
has comment: http://stackoverflow.com/comment/31795801
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21129400
has answer: http://stackoverflow.com/a/21129384
tagged with: java
has answer: http://stackoverflow.com/a/21129463
type: Question
has answer: http://stackoverflow.com/a/21129435
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/31795842
has answer: http://stackoverflow.com/a/21129378

http://stackoverflow.com/comment/31786104
type: AnswerComment
score: 0
type: Comment
has text: Regarding your example, the same is true for `final` fields if you leak the `this` reference.
comment on: http://stackoverflow.com/a/21123872

http://stackoverflow.com/comment/31800754
type: Comment
has text: You do realize this site is not help desk right? It's a Question and Answer site. You ask one question, you get it answered, then you move on. No one is here to help you develop your entire program.
score: 0
comment on: http://stackoverflow.com/a/21129583
type: AnswerComment

hql
tag name: hql
tags question: http://stackoverflow.com/q/21042240
tags question: http://stackoverflow.com/q/21111478
tags question: http://stackoverflow.com/q/21144542
type: Tag
tags question: http://stackoverflow.com/q/21110506

http://stackoverflow.com/comment/31875289
has text: @Artur Yes, you can make that assumption. You correctly noted that it's not possible to make instances of abstract classes that don't implement the abstract, so if something's giving you an `X`, but `X` is abstract, you're getting something that _implements_ or _extends_ `X`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21148903
score: 0

http://stackoverflow.com/a/21048751
score: 1
has body: Mapper should transpose the file - for each line read, emit the key as the column number and the value as the value of the column. Reducer should min/max. For each input key, emit the min and max value found.
answers question: http://stackoverflow.com/q/21040166
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/31659028
type: QuestionComment
has text: Does the url (e.g. "http://localhost:7055") work when you test outside of Selenium?
comment on: http://stackoverflow.com/q/21054412
score: 0
type: Comment

http://stackoverflow.com/comment/31666207
comment on: http://stackoverflow.com/q/21058969
has text: Why not use a `char` and a `char[]`?
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/31742093
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21056797
has text: I can see that setting it to `true` if it's already `true` could be seen as redundant. But adding a check doesn't add anything in terms of readability, and it slows things down. It would be different if setting it to `true` required the program to access the Internet and store the variable value on a remote computer or something. :)
score: 0

http://stackoverflow.com/a/21141002
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21140773
has comment: http://stackoverflow.com/comment/31816094
answers question: http://stackoverflow.com/q/21140773
type: Answer
downvote count: 0
score: 1
has body: You can make simple horizontal menu using HTML & CSS. Checkout the following structure in HTML, Link one Link two Link three Link four and in CSS You can find details here. Hope this helps you.
upvote count: 1

http://stackoverflow.com/q/21159428
has comment: http://stackoverflow.com/comment/31850521
has comment: http://stackoverflow.com/comment/31850335
type: Question
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/21160105
has comment: http://stackoverflow.com/comment/31850430
has body: I am looking for the options to solve the custom sequence generation problem. Let me describe my problem by giving an example: Let say, there are two tables company and employee table, Table: Company ----------------------------------------------- CompanyId | CompanyName | LatestSequenceValue ----------------------------------------------- c1 | XYZ | 100 c2 | ABC | 150 ----------------------------------------------- Table: Employee ---------------------------------------------------------- EmployeeId | EmployeeName | CompanyId | EmployeeSurveyNo ---------------------------------------------------------- e1 | NVERMA | c1 | 101 e1 | DAVID | c1 | 102 e2 | VGUPTA | c2 | 151 e2 | MAC | c2 | 152 ---------------------------------------------------------- Whenever, employee joins the company, he is asked to complete the company specific survey and after completion of the survey, 'Survey No' is generated based on LatestSequenceValue from company table. To generate the survey no below steps are performed: Read the current sequence value specific to a company from company table (LatestSequenceValue) Increment the sequence count by 1 Use this incremented value to log into employee table as 'EmployeeSurveyNo' Also, update the incremented value in company table (LatestSequenceValue) so next survey should get proper sequence. Before converting above approach into the program/logic, below points should be kept in mind: Application can be deployed in cluster environment Application supports Multi threading Last but not least, application supposed to do 50K surveys in one hour. What should be the proper approach to solve this custom sequence generation problem? Optimistic locking at database level can be good idea. But this approach may somehow degrade the performance. Is there any thing like In-Memory sequence generation that can handle above problem and improve the performance? Ideas/Suggestions are most welcome.
has comment: http://stackoverflow.com/comment/31850138
has answer: http://stackoverflow.com/a/21375562
accepted answer: http://stackoverflow.com/a/21375562
has comment: http://stackoverflow.com/comment/31855539
has comment: http://stackoverflow.com/comment/31850399
has title: Custom sequence generation in multithreaded & cluster environment
has comment: http://stackoverflow.com/comment/31850619
tagged with: oracle-database
tagged with: sequence
favorite count: 0
upvote count: 5
possible better answer: http://stackoverflow.com/a/21160105
has comment: http://stackoverflow.com/comment/31850130
has comment: http://stackoverflow.com/comment/31850933
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31852998
downvote count: 0
tagged with: java

http://stackoverflow.com/q/21165156
tagged with: string
has comment: http://stackoverflow.com/comment/31860369
favorite count: 0
tagged with: string-literals
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/21165815
linked to: http://stackoverflow.com/q/4918399
has comment: http://stackoverflow.com/comment/31860148
has comment: http://stackoverflow.com/comment/31862152
has comment: http://stackoverflow.com/comment/31861470
accepted answer: http://stackoverflow.com/a/21165815
has comment: http://stackoverflow.com/comment/31860212
has comment: http://stackoverflow.com/comment/31860112
tagged with: java
has body: If i have a code: String s="a"; s="b"; Note that there is no reference or use of s in between these two statements. Will java compiler optimize this, ignore the first assignment and only store "b" in string pool?
has comment: http://stackoverflow.com/comment/31860113
answer count: 1
has comment: http://stackoverflow.com/comment/31860210
has comment: http://stackoverflow.com/comment/31860032
has title: Does compiler optimize String literals?
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31861823
downvote count: 0

http://stackoverflow.com/q/21062138
tagged with: google-search
tagged with: java
has body: i have to use this Code to search in google and Show the result Link,but i dont know how to send My Query String s="reza"; Document doc = Jsoup.connect("http://google.com/search?q=").userAgent("Mozilla").data(?????).get(); Elements titles = doc.select(".entrytitle"); //print all titles in main page for(Element e: titles){ System.out.println("text: " +e.text()); System.out.println("html: "+ e.html()); } //print all available links on page Elements links = doc.select("a[href]"); for(Element l: links){ System.out.println("link: " +l.attr("abs:href")); } } "reza" is my query that i want to search it in google How can i use this method to search my problem is sending query to Google search page
has answer: http://stackoverflow.com/a/21062369
tagged with: jsoup
has title: How to do a Google Search with Jsoup
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/31672315
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/31672324
accepted answer: http://stackoverflow.com/a/21062369
upvote count: 2
has comment: http://stackoverflow.com/comment/94519302
downvote count: 1
answer count: 1

http://stackoverflow.com/q/21178364
has answer: http://stackoverflow.com/a/21178503
has body: I am working on the project to achieve stateful session using EJB and JBOSS7.1 in eclipse. I came up with an exception while running the client code as javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288) at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325) at javax.naming.InitialContext.lookup(InitialContext.java:392) at com.sridhar.client.ShoppingCartClient.main(ShoppingCartClient.java:15) What is the problem over here ? Below is my code, Interface: package com.sridhar.shoppingcart; import java.util.HashMap; import javax.ejb.Remote; import javax.ejb.Remove; @Remote public interface ShoppingCartLocal { void buy(String product,int quantity); HashMap&lt;String,Integer&gt; getCartContents(); @Remove void checkOut(); } The Bean which is implementing the business logic package com.sridhar.shoppingcart; import java.util.HashMap; import java.util.Map; import javax.ejb.Remote; import javax.ejb.Stateful; /** * Session Bean implementation class ShoppingCart */ @Stateful @Remote(ShoppingCart.class) public class ShoppingCart implements ShoppingCartLocal { private Map&lt;String,Integer&gt; cart = new HashMap&lt;String,Integer&gt;(); /** * Default constructor. */ @Override public void buy(String product, int quantity) { // TODO Auto-generated method stub if(cart.containsKey(product)){ int currentQuantity = cart.get(product); currentQuantity = currentQuantity+quantity; cart.put(product, currentQuantity); }else{ cart.put(product, quantity); } } @Override public HashMap&lt;String, Integer&gt; getCartContents() { // TODO Auto-generated method stub return (HashMap&lt;String, Integer&gt;) cart; } @Override public void checkOut() { // TODO Auto-generated method stub System.ou…
score: 0
has title: Using stateful bean in EJB using Client
type: UnansweredQuestion
tagged with: jakarta-ee
tagged with: java
tagged with: jboss
has answer: http://stackoverflow.com/a/21189721
type: Question
answer count: 2
tagged with: ejb

http://stackoverflow.com/a/21189877
accepted answer of: http://stackoverflow.com/q/21177931
answers question: http://stackoverflow.com/q/21177931
score: 1
has comment: http://stackoverflow.com/comment/31911970
type: AcceptedAnswer
downvote count: 0
has body: The re-sizing issue is not relevant as you already told an estimate of the number of elements in your question. So you can give a ConcurrentHashMap an initial capacity large enough to avoid any rehashing. The performance will not depend on the number of elements, that’s the main goal of hashing, but the number of concurrent threads. The main problem is that you don’t have a plan of how to handle failed locks. Unless you want to poll until locking succeeds (which is not recommended) you need a way of putting a thread to sleep which implies that the thread currently owning the lock has to wake up a sleeping thread on release if one exists. So you end up requiring conventional Lock features a ConcurrentHashMap does not offer. Creating a Lock per element (as you said ~1,000,000) would not be a solution. A solution would look a bit like the ConcurrentHashMap works internally. Given a certain concurrency level, i.e. the number of threads you might have (rounded up), you create that number of Locks (which would be a far smaller number than 1,000,000). Now you assign each element one of the Locks. A simple assignment would be based on the element’s hashCode, assuming it is stable. Then locking an element means locking the assigned Lock which gives you up to the configured concurrency level if all currently locked elements are mapped to different Locks. This might imply that threads locking different elements block each other if the elements are mapped to the same Lock, but with a predictable likelihood. You can try fine-tuning the concurrency level (as said, use a number higher than the number of threads) to find the best trade-off. A big advantage of this approach is that you do not need to maintain a data structure that depends on the number of elements. Afaik, the new parallel ClassLoader uses a similar technique.
has comment: http://stackoverflow.com/comment/31912382
has comment: http://stackoverflow.com/comment/31911686
type: Answer
upvote count: 1

http://stackoverflow.com/q/21025203
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22344479
type: UnansweredQuestion
tagged with: google-app-engine
has body: Currently I am running a task on a Java backend using cron. /admin/stats?action=dailyStats Send daily statistics every day 16:50 backends1 Europe/Madrid The backends are configured with 2 dynamic instances: B2 2 true Usually it works fine, but some times the instance executing the task just dies without any further notice so I would need it to be retried automatically after this failure.
has title: How can I automatically retry a task executed on a GAE backend?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21030894

http://stackoverflow.com/comment/31745935
type: QuestionComment
has text: You probably didn't copy the project folder, but the folder where the sources are located. A NetBeans project folder contains a `build.xml` and a sub-directory `nbproject` which in turn contains e.g. a `project.properties` and a `project.xml` (and much more): https://netbeans.org/kb/docs/java/project-setup.html#ide-concepts
score: 1
comment on: http://stackoverflow.com/q/21067790
type: Comment

ejb
tags question: http://stackoverflow.com/q/21021619
tags question: http://stackoverflow.com/q/21051324
tags question: http://stackoverflow.com/q/21088029
tag name: ejb
tags question: http://stackoverflow.com/q/21144054
tags question: http://stackoverflow.com/q/21052027
tags question: http://stackoverflow.com/q/21089271
tags question: http://stackoverflow.com/q/21104097
type: Tag
tags question: http://stackoverflow.com/q/21178364

http://stackoverflow.com/comment/31894945
type: AnswerComment
type: Comment
score: 0
has text: You could also add methods to the enum or do a `contains` but I find this is the easiest to read and adapt
comment on: http://stackoverflow.com/a/21183243

http://stackoverflow.com/a/69291027
type: Answer
answers question: http://stackoverflow.com/q/21068440
has comment: http://stackoverflow.com/comment/122469936
has comment: http://stackoverflow.com/comment/122472823
score: 0
has body: What I did was I created a new project and opened the file location from my old project and new one. Then I copied everything from the old project besides the run file, and ran it on the new project and now it works fine.

http://stackoverflow.com/a/21061769
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21061667
has body: Well, it seems you are facing a variation of the Hamiltonian Path Problem. In this problem, given a graph - you are looking for a path that go through all vertices without repeating any node twice. Note that a hamiltonian path is a perfect solution to your problem, and thus if your problem can be solved efficiently - so does the hamiltonoan path problem. Unfortunately, there is no known polynomial solution for the hamiltonian path problem, and the problem is NP-Complete (so the general belief is such a (efficient) solution does not exist). A brute force solution will be O(n!) - check all possible permutations, and choose the optimal one. This can be optimized using branch and bound techniques.
answers question: http://stackoverflow.com/q/21061667
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/31868790
comment on: http://stackoverflow.com/q/21169743
has text: ` counter--; if(counter<0){ return i;}` it indicate that has more ) thatn (, so return the `i` that is the current position
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21075307
score: 1
has body: here is my problem: I have a JTextPane, which I added to a JScrollpane. Now, when I write to the StyledDocument of this JTextPane and a line is longer than the width of the JTextPane it displays the rest of the line in a new line, instead of activating the scrollbar so that I can simply scroll to the end of the line. Here is an image of what I mean: In this picture, all the text should just be in one line and the horizontal scrollbar at the bottom should therefore be active. Does anyone know how to achieve this? Thanks in advance! Edit1: Here is the code I have at the moment: import java.awt.BorderLayout; public class MainFrame extends JFrame { private ArrayList&lt;RssFeed&gt; rssFeeds = new ArrayList&lt;RssFeed&gt;(); private JPanel contentPane; private JTextPane newsPane; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { MainFrame frame = new MainFrame(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public MainFrame() { setMinimumSize(new Dimension(450, 300)); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); newsPane = new JTextPane(); newsPane.setEditable(false); JScrollPane scrollPane = new JScrollPane(); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane.add(newsPane); scrollPane.setViewportView(newsPane); contentPane.add(scrollPane, BorderLayout.CENTER); final StyledDocument doc = newsPane.getStyledDocument(); JPanel updateButton = new JPanel(); FlowLayout fl_updateButton = (FlowLayout) updateButton.getLayout(); fl_updateButton.setAlignment(FlowLayout.RIGHT); contentPane.add(updateButton, BorderL…
tagged with: java
type: Question
downvote count: 0
has title: JScrollbar doesnt activate when text goes over the width of the window
has answer: http://stackoverflow.com/a/21075386
tagged with: jscrollpane
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: jtextpane
upvote count: 1
tagged with: swing

http://stackoverflow.com/a/21078356
has comment: http://stackoverflow.com/comment/31785571
has comment: http://stackoverflow.com/comment/31786080
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31702014
has comment: http://stackoverflow.com/comment/31701710
accepted answer of: http://stackoverflow.com/q/21078109
score: 0
type: Answer
has body: Check your db Try this code: public void insertData(){ String time; Time now = new Time(); now.setToNow(); time = now.toString(); values.put("ID", "2"); values.put("LEFT_POSITION", xPosition); values.put("RIGHT_POSITION", xPosition); values.put("GPS", GPSposition); values.put("TIME", time); if(db!=null) db.insert("baza", null, values); else Log.d("AppName","db is null); } Edited Answer: myDBAdapter = new Database(this).open(); //TODO Any database operations myDBAdapter.close(); Why are you closing your database adapter here? After inserting the values this should be closed.Plus where are you initialising db? Edit no. 2: Change this in your code protected void onStop() { myDBAdapter.close();; } The visible lifetime of an activity happens between a call to onStart() until a corresponding call to onStop(). During this time the user can see the activity on-screen, though it may not be in the foreground and interacting with the user. Between these two methods you can maintain resources that are needed to show the activity to the user. For example, you can register a BroadcastReceiver in onStart() to monitor for changes that impact your UI, and unregister it in onStop() when the user no longer sees what you are displaying. The onStart() and onStop() methods can be called multiple times, as the activity becomes visible and hidden to the user. Please go through the basic of android.
answers question: http://stackoverflow.com/q/21078109
has comment: http://stackoverflow.com/comment/31702307
has comment: http://stackoverflow.com/comment/31784048

http://stackoverflow.com/q/21066551
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21066639
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/21066707
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21066639
has answer: http://stackoverflow.com/a/21066707
has body: I have class A (extends Activity) which present a list of items from a table. In class B (which extends activity) i am calling a method which eventually trigger class C (C extends a broadcast receiver). In my class C i am updating a table in my DB in which class A gets the items to present. My question is how to invoke a class A method after class C finish updating the table. Making class A function static is quite impossible in this case.
tagged with: android
has title: Calling third part class method

kinect
type: Tag
tags question: http://stackoverflow.com/q/21181039
tag name: kinect

http://stackoverflow.com/a/21063039
upvote count: 2
has comment: http://stackoverflow.com/comment/31673708
type: Answer
score: 2
answers question: http://stackoverflow.com/q/21062865
downvote count: 0
has body: You need to change the value given in the mp.load() in the main() method. Instead of 34.50 , please give 112.50. Then you will get the output you want

http://stackoverflow.com/q/21114247
answer count: 3
has answer: http://stackoverflow.com/a/21114420
has body: I have a string like this any text text and I want to find a , that contains shortest text in this string. I used the following regex .*? , but instead of any text i got any text . Here is the example. Why it doesn't works and what am I doing wrong?
tagged with: regex
has comment: http://stackoverflow.com/comment/31767539
has answer: http://stackoverflow.com/a/21114311
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31767914
accepted answer: http://stackoverflow.com/a/21114513
tagged with: java
has comment: http://stackoverflow.com/comment/31767695
has comment: http://stackoverflow.com/comment/31767889
possible better answer: http://stackoverflow.com/a/21114420
has title: Non-greedy match does not work
type: Question
has answer: http://stackoverflow.com/a/21114513
linked to: http://stackoverflow.com/q/1732348
score: 0

http://stackoverflow.com/comment/31884197
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21177682
has text: sorry one more thing i use JPanel to set layout for every panel so that is how i compound layout is there way to compound layout with out JPenel i mean several panels
type: Comment

http://stackoverflow.com/comment/31781080
has text: @KevinWorkman he's currently using an ActionListener to get the X and Y co-ordinates of the mouse when it is clicked, this invokes actionPerformed() with an event e which gives you those X and Y co-ordinates. He's already doing that, so I talked about that method, but there are better alternatives so I offered those. What do you not understand?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21121405

cryptography
tags question: http://stackoverflow.com/q/21029527
tags question: http://stackoverflow.com/q/21113759
tag name: cryptography
type: Tag
tags question: http://stackoverflow.com/q/21073254
tags question: http://stackoverflow.com/q/21043028
tags question: http://stackoverflow.com/q/21019348
tags question: http://stackoverflow.com/q/21041874
tags question: http://stackoverflow.com/q/21066902
tags question: http://stackoverflow.com/q/21098449
tags question: http://stackoverflow.com/q/21138811

http://stackoverflow.com/comment/31639949
has text: Can you give me more examples of libraries like jssh?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21045042
type: Comment

http://stackoverflow.com/q/21179302
type: AnsweredQuestion
has body: I have following data table in MS Excel phone no cost 1231231221 10.45 1234234232 12.67 1234234453 30.00 The code below is printing phone no correctly but leaving out the decimal places of cost. for (int rowNum = rowStart-1; rowNum &lt; rowEnd+1; rowNum++) { List&lt;String&gt; cellTempList = new ArrayList&lt;String&gt;(); Row rowObj = hssfSheet.getRow(rowNum); for (int col = 0; col &lt; columnEnd; col++) { Cell cell = rowObj.getCell(col, Row.CREATE_NULL_AS_BLANK); if (cell.getCellType()==Cell.CELL_TYPE_NUMERIC) { DecimalFormat df = new DecimalFormat("#"); String cellValue=df.format(cell.getNumericCellValue()); System.out.println(cellValue); cellTempList.add(cellValue.toString()); } else { cellTempList.add(cell.toString()+""); } } cellDataList.add(cellTempList); System.out.println(cellDataList);
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21179444
has title: Printing decimal values as well as phone numbers using poi
downvote count: 0
answer count: 1
favorite count: 0
tagged with: apache-poi
has answer: http://stackoverflow.com/a/21179444
upvote count: 1

http://stackoverflow.com/a/21111236
has comment: http://stackoverflow.com/comment/31762261
has comment: http://stackoverflow.com/comment/31763348
has comment: http://stackoverflow.com/comment/31764544
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21110943
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21110943
score: 1
has body: What you want can probably only achieved by reading the file line by line and then write the new text if it is one of the lines to be replaced. otherwise, write the original line. You will then have the original file and a new file. You can rename them accordingly, this way you also have a backup of the last change. Coarse outline: open input file (i.e. BufferedReader) open new outfile file (i.e. some Writer) line = 0 data = read line from input while (there is data) line = line + 1 if (line &gt;= y &amp;&amp; line &lt;= y+2) write replaced data else write data data = read line from input close output file close input file
has comment: http://stackoverflow.com/comment/31764737
type: Answer
has comment: http://stackoverflow.com/comment/31764786
has comment: http://stackoverflow.com/comment/31764433
has comment: http://stackoverflow.com/comment/31762914

http://stackoverflow.com/comment/31752691
comment on: http://stackoverflow.com/q/21098740
has text: did you try other mapreduce jobs? can them proceed?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21052409
tagged with: rgb
type: Question
answer count: 1
tagged with: awtrobot
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21052959
has comment: http://stackoverflow.com/comment/31653774
tagged with: matrix
has comment: http://stackoverflow.com/comment/31657353
has title: Speed up looking through matrix
has comment: http://stackoverflow.com/comment/31653891
has comment: http://stackoverflow.com/comment/31654093
upvote count: 1
linked to: http://stackoverflow.com/q/19209650
has comment: http://stackoverflow.com/comment/31653738
has comment: http://stackoverflow.com/comment/31654503
type: AnsweredQuestion
tagged with: performance
has comment: http://stackoverflow.com/comment/31654525
has body: I have code public static void program() throws Exception{ BufferedImage input = null; long start = System.currentTimeMillis(); while((System.currentTimeMillis() - start)/1000 &lt; 220){ for (int i = 1; i &lt; 13; i++){ for (int j = 1; j &lt; 7; j++){ input = robot.createScreenCapture(new Rectangle(3+i*40, 127+j*40, 40, 40)); if ((input.getRGB(6, 3) &gt; -7000000) &amp;&amp; (input.getRGB(6, 3)&lt;-5000000)){ robot.mouseMove(10+i*40, 137+j*40); robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); } } } } } On a webpage there's a matrix (12*6) and there will randomly spawn some images. Some are bad, some are good. I'm looking for a better way to check for good images. At the moment, on good images on location (6,3) the RGB color is different from bad images. I'm making screenshot from every box (40 * 40) and looking at pixel in location (6,3) Don't know how to explain my code any better EDIT: Picture of the webpage. External links ok? https://i.sstatic.net/YAZkF.png
has answer: http://stackoverflow.com/a/21052959
has comment: http://stackoverflow.com/comment/31653806
score: 1
tagged with: java

http://stackoverflow.com/comment/31698341
comment on: http://stackoverflow.com/a/21075713
score: 0
type: AnswerComment
type: Comment
has text: waitFor() is just a for loop which does some pointless calculation to waist time :) I know that this is very primitive solution but it works for me and I'm stil a beginner:) public void waitFor (int seconds) { for(int wait=0;wait<seconds*20000000;wait++) { int nothing=(1000000*99)/33; } }

http://stackoverflow.com/q/21155026
linked to: http://stackoverflow.com/q/18954394
has answer: http://stackoverflow.com/a/21155100
answer count: 1
tagged with: tcpserver
favorite count: 0
has comment: http://stackoverflow.com/comment/31842587
accepted answer: http://stackoverflow.com/a/21155100
tagged with: tcp
duplicate of: http://stackoverflow.com/q/18954394
downvote count: 1
type: AnsweredQuestion
tagged with: java
score: -1
type: Question
has body: I was trying to make a TCP GUI Server application for windows. But when i am trying to start the server it becomes unresponsive. I couldn't find out what is the problem here,somebody please give me a good solution for this bug... code import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.ServerSocket; import java.net.Socket; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; public class frame_example extends JFrame{ private static ServerSocket serverSocket; private static Socket clientSocket; private static InputStreamReader inputStreamReader; private static BufferedReader bufferedReader; private static String message; /** * */ private static final long serialVersionUID = 1L; public frame_example(){ //JFrame jf = new JFrame(); JPanel jp = new JPanel(); final JTextArea jt = new JTextArea(10,20); JScrollPane scrolltxt = new JScrollPane(jt); scrolltxt.setBounds(0,0, 300, 200); //add(scrolltxt); JButton jb1 = new JButton("START"); jb1.setActionCommand("Server Started.."); JButton jb2 = new JButton("STOP"); jb2.setActionCommand("Server has been Stoped.."); jp.add(scrolltxt); jp.add(jb1); jp.add(jb2); getContentPane().add(jp); jb1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub try { serverSocket = new ServerSocket(4020); //Server socket } catch (IOException e) { System.out.println("Could not listen on port: 4020"); } while (true) { try { Thread.sleep(20); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { clientSocket = serverSocket.accept(); //accept the client connection inputStreamReader = new InputStreamReader(clientSocket.getInputStream()); bufferedReader = new BufferedReader(inputStreamReader); //get the client mess…
has title: TCP Server application becomes unresponsive
upvote count: 0

http://stackoverflow.com/q/21056939
type: Question
has answer: http://stackoverflow.com/a/21057519
has comment: http://stackoverflow.com/comment/31662662
has comment: http://stackoverflow.com/comment/31662959
has comment: http://stackoverflow.com/comment/31662682
has comment: http://stackoverflow.com/comment/31663085
has comment: http://stackoverflow.com/comment/31663036
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31663078
favorite count: 0
has body: This is the code I have in my first class: public class Factorial { public void Sequence(){ String value = JOptionPane.showInputDialog("Please enter the number of which you want your shit."); System.out.println("Factorial:"); System.out.println(fact(Integer.valueOf(value))); getValues(Integer.valueOf(value)); } public static int getValues(int n){ return n; } And this is a subclass of Factorial: public class Fibonacci extends Factorial { public void Sequence(){ Factorial get = new Factorial(); //not working EDIT: Just realized this obv wont work, but still need help to get it to work get.getValues(n); However I cannot get the Value returned in the getValues from the Factorial Class
has comment: http://stackoverflow.com/comment/31662909
has answer: http://stackoverflow.com/a/21057319
has comment: http://stackoverflow.com/comment/31662545
accepted answer: http://stackoverflow.com/a/21057319
has comment: http://stackoverflow.com/comment/31662567
has comment: http://stackoverflow.com/comment/31662953
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21057519
has comment: http://stackoverflow.com/comment/31663008
tagged with: return-value
has comment: http://stackoverflow.com/comment/31662827
tagged with: java
upvote count: 1
has title: Get Return Integer Value from a super class
downvote count: 1

http://stackoverflow.com/a/21171893
type: Answer
score: 0
has body: // depth should be 0 on first call public static boolean myMeth(int n, int depth) { // do something // now execute the recursive call if (n &lt; 0) return true; else if ( n == SOME_CONST ) return false; boolean success = myMeth(n - 1, depth + 1); if (depth == 0 &amp;&amp; !success) { // uh-oh } return success; } Or if you don't care about each individual frame in the recursion, replace depth with a boolean and change to boolean success = myMeth(n - 1, false); I'm not sure what you're asking when you say you want to get back to the first frame though. Do you want to go back to the beginning of the first method call, so you can repeat the steps in the // do something block? Or are you fine executing right after the recursive call to myMeth? If you're generating the Exception yourself, I replaced the need for that by using booleans. If not, you can replace it. You could also just throw an exception in the first frame, while still using booleans.
answers question: http://stackoverflow.com/q/21171274

http://stackoverflow.com/a/21120479
has comment: http://stackoverflow.com/comment/31779445
type: AcceptedAnswer
downvote count: 0
has body: You'll want to use a HashMap to avoid recalculating the same numbers multiple times. Checking if the HashMap already contains the number is a quick process and can save you many steps. For Example: If you get to the number 200,000 for a second time, you already know how many more steps in the Collatz sequence.
accepted answer of: http://stackoverflow.com/q/21119920
answers question: http://stackoverflow.com/q/21119920
has comment: http://stackoverflow.com/comment/31779388
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/21040507
has body: i dont know why you want to do that ..... as putting pages under web-inf is a wrong practice....... also the container cant access the static contents that are under web-inf folder. I have faced exactly same problem see resource problem post. what i have found from googling is you can access dynamic resources under web-inf folder but not the static. I have tried even regestring all the static contents (ie. css, js,html, etc) in xml at the first place but nothing worked. finally i moved my pages out and it worked with no configuration .... so try moving the resources out of web-inf and under webcontent tell me if you got some extras on this. thanks.
has comment: http://stackoverflow.com/comment/56548675
type: Answer
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/21039711
score: 0

http://stackoverflow.com/comment/31658079
has text: The idea behind resources is to have something self-contained (like start a webserver before() and stop it after())
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21053855

http://stackoverflow.com/a/21157750
answers question: http://stackoverflow.com/q/21137843
has body: I could make it work. the above persistence unit was correct. Assuming that the in an Entity Book class the id has the following annotations: @Id @GeneratedValue private Long id; With the following persistence unit: <persistence-unit name="Book" transaction-type="JTA"> org.eclipse.persistence.jpa.PersistenceProvider com.tutorial.Book <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/> <property name="javax.persistence.schema-generation.scripts.action" value="drop-and-create"/> <property name="javax.persistence.schema-generation.scripts.create-target" value="create.ddl"/> <property name="javax.persistence.schema-generation.scripts.drop-target" value="drop.ddl"/> <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver"/> <property name="javax.persistence.jdbc.url" value="jdbc:derby://localhost:1527/library_db;create=true"/> <property name="javax.persistence.jdbc.user" value="APP"/> <property name="javax.persistence.jdbc.password" value="APP"/> <property name="javax.persistence.sql-load-script-source" value="insert.sql"/> <property name="eclipselink.logging.level" value="INFO"/> Scripts like the following: create.ddl ------------------------------------------------------------ CREATE TABLE book ( ID BIGINT NOT NULL, DESCRIPTION VARCHAR(255), ILLUSTRATIONS SMALLINT DEFAULT 0, ISBN VARCHAR(255), NBOFPAGE INTEGER, PRICE FLOAT, TITLE VARCHAR(255), PRIMARY KEY (ID)) CREATE TABLE SEQUENCE ( SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL(15), PRIMARY KEY (SEQ_NAME)) INSERT INTO SEQUENCE(SEQ_NAME, SEQ_COUNT) values ('SEQ_GEN', 0) drop.ddl -------------------------------------------------- DROP TABLE book DELETE FROM SEQUENCE WHERE SEQ_NAME = 'SEQ_GEN' insert.sql---------------------------------------- INSERT INTO BOOK(ID, TITLE, DESCRIPTION, ILLUSTRATIONS, ISBN, NBOFPAGE, PRICE) values (1000, 'Beginning Java EE 6', 'Best Java EE book ever', 1, '1234-5678', 450, 49) INSERT INTO BOOK(ID, TITLE, DESCRIP…
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/31640222
comment on: http://stackoverflow.com/a/21045268
score: 0
type: AnswerComment
has text: The thing is that I want the user to be able to add new measurement areas and new units, so that's why I was thinking of the DB. Could this be done any other way?
type: Comment

http://stackoverflow.com/q/21095385
has comment: http://stackoverflow.com/comment/31733662
has comment: http://stackoverflow.com/comment/31733110
has body: I had a database which has lots of tablespaces in it. All tablespaces' used and free spaces are backed up daily (everyday at 3:00 am). All backups are stored in a table called TBS_SIZE, which has tbs_name, used_space, free_space, backup_date columns. I need to get the values to a line chart in Java like in this example. But the problem is, there is values repeating each day. Because all tablespace names are written again for every day. Therefore some of my columns are looping. Let me give an example: system | 50 | 1 | 12/01/2013 tmp | 43 | 8 | 12/01/2013 users | 80 | 2 | 12/01/2013 system | 50 | 1 | 13/01/2013 tmp | 45 | 6 | 13/01/2013 users | 77 | 5 | 13/01/2013 I need a useful idea, or a reference that can help me.
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21095620
answer count: 2
tagged with: sql
has comment: http://stackoverflow.com/comment/31733348
downvote count: 0
has answer: http://stackoverflow.com/a/21095557
score: 1
has comment: http://stackoverflow.com/comment/31733432
favorite count: 0
has comment: http://stackoverflow.com/comment/31733548
has title: Import repeating values to a line chart in Java
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/a/21039388
has body: format-date() is an XSLT 2.0 function. When you load an XSLT transformer using the JAXP TransformerConfigurationFactory, you have no way of controlling whether the processor that is returned is an XSLT 1.0 or 2.0 processor - it depends on what happens to be found on the classpath. My guess is that there was no XSLT 2.0 processor on the classpath, so the default built-in Xalan processor has been loaded, and this does not support XSLT 2.0 (and therefore format-date()). If your code is dependent on XSLT 2.0, then a) make sure Saxon is on the classpath b) load it explicitly by replacing TransformerFactory factory = TransformerFactory.newInstance(); with TransformerFactory factory = new net.sf.saxon.TransformerFactoryImpl();
answers question: http://stackoverflow.com/q/21036765
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21036765
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/21093027
accepted answer of: http://stackoverflow.com/q/21092819
has body: You can use Apache POI for read the file. e.g.: InputStream inputStream = new URL("http://localhost/report.xls").openStream(); //Get the workbook instance for XLS stream HSSFWorkbook workbook = new HSSFWorkbook(inputStream); See also Read / Write Excel File In Java Using Apache POI.
answers question: http://stackoverflow.com/q/21092819
upvote count: 6
type: AcceptedAnswer
score: 6
type: Answer
downvote count: 0

http://stackoverflow.com/a/21161016
answers question: http://stackoverflow.com/q/21160697
accepted answer of: http://stackoverflow.com/q/21160697
has body: Change the following line: image.setAttribute("onclick",function(){getDetails(data);}); into: image.setAttribute("onclick",(function(d){return function(){getDetails(d);}}(data)); Also, the line: row.appendChild(cell); is redondant because the cell was inserted with row.insertCell(k)
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/q/21174918
upvote count: 1
has comment: http://stackoverflow.com/comment/31878630
possible better answer: http://stackoverflow.com/a/21175536
has answer: http://stackoverflow.com/a/21174971
tagged with: enums
has answer: http://stackoverflow.com/a/21175341
has comment: http://stackoverflow.com/comment/31878586
tagged with: java
linked to: http://stackoverflow.com/q/1972392
downvote count: 0
has title: How to use ENUM to return random strings out of three?
has comment: http://stackoverflow.com/comment/31878537
accepted answer: http://stackoverflow.com/a/21175341
tagged with: random
has comment: http://stackoverflow.com/comment/31878555
type: AnsweredQuestion
score: 1
has body: With the use of below code, I am finding out which datacenter I am in and it is working fine.. public enum DatacenterEnum { DEV, DC1, DC2, DC3; private static DatacenterEnum compareLocation() { String ourhost = getHostName(); for (DatacenterEnum dc : values()) { String namepart = "." + dc.name().toLowerCase() + "."; if (ourhost.indexOf(namepart) &gt;= 0) { return dc; } } return null;// I don't want to do this now. } } But it might be possible that it is not able to find any datacenter, so currently I am returning null. Is there any direct way or a single line command by which I can return randomly either DC1 or DC2 or DC3 in the ENUM instead of returning null? I know one way is to make a list of string and then randomnly select any integer between 0 to 2 inclusive and then find the string. But it is too much code, actually it's not but just trying to see is there any other way we can do this? Any simple and direct way which I can use in the ENUM directly?
favorite count: 0
has answer: http://stackoverflow.com/a/21175536
type: Question
answer count: 3

http://stackoverflow.com/a/21133375
has body: Did you see the constructor method of Exception.java public Exception(String message) { super(message); } everything you need to do is just add your error message when you throw the exception. or if you want to customize your exception class extends the Exception.java, please add the corresponding constructor like: public class MyException extends Exception { public MyException(String message) { super(message); } }
type: Answer
answers question: http://stackoverflow.com/q/21132970
score: 0

http://stackoverflow.com/q/21170551
answer count: 1
has comment: http://stackoverflow.com/comment/31874914
has comment: http://stackoverflow.com/comment/31874885
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31873655
tagged with: file
has answer: http://stackoverflow.com/a/21881829
tagged with: filenotfoundexception
has comment: http://stackoverflow.com/comment/31873417
has body: I'm attempting encrypt files using AES by converting the files to base64 then applying AES however there is never any output on my SD Card and it appears I'm throwing a FileNotFoundException. I've set a breakpoint at the line: SecretKeySpec secretKey = new SecretKeySpec(Password.getBytes("ASCII"), "AES"); however I noticed it is only being reached when I select a folder - but not a file (in either case: there is no encrypted file output). Also - I'm not sure if this line is correct: boolean encryptedString = MySecurity.encryptFile(chosenFile); I simply need to figure out why I cannot encrypt files using this method. Permissions: &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" /&gt; LogCat: 01-16 19:54:50.551: I/System.out(18108): Sending WAIT chunk 01-16 19:54:50.556: I/dalvikvm(18108): Debugger is active 01-16 19:54:50.751: I/System.out(18108): Debugger has connected 01-16 19:54:50.751: I/System.out(18108): waiting for debugger to settle... 01-16 19:54:50.951: I/System.out(18108): waiting for debugger to settle... 01-16 19:54:51.151: I/System.out(18108): waiting for debugger to settle... 01-16 19:54:51.351: I/System.out(18108): waiting for debugger to settle... 01-16 19:54:51.551: I/System.out(18108): waiting for debugger to settle... 01-16 19:54:51.751: I/System.out(18108): waiting for debugger to settle... 01-16 19:54:51.956: I/System.out(18108): waiting for debugger to settle... 01-16 19:54:52.156: I/System.out(18108): debugger has settled (1454) 01-16 19:54:52.416: E/SensorManager(18108): thread start 01-16 19:54:52.426: D/SensorManager(18108): registerListener :: handle = 0 name= K3DH Acceleration Sensor delay= 200000 Trklfufi 9 budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht…
tagged with: java
tagged with: fileoutputstream
type: Question
has comment: http://stackoverflow.com/comment/31872861
has comment: http://stackoverflow.com/comment/31874025
has comment: http://stackoverflow.com/comment/31873318
score: 0
tagged with: android
has title: FileNotFoundException Using AES Encryption - Android / Java

http://stackoverflow.com/q/21093166
has comment: http://stackoverflow.com/comment/31729333
type: UnansweredQuestion
has title: Play framework 2.2.1 always tries to create DB at startup
tagged with: java
tagged with: hibernate
tagged with: persistence.xml
type: Question
answer count: 1
tagged with: jpa
has answer: http://stackoverflow.com/a/25257740
has comment: http://stackoverflow.com/comment/31729070
has body: I have project in Play 2.1.5 and I've decided to migrate to Play 2.2.1. I followed http://www.playframework.com/documentation/2.2.1/Migration22 and everything works except that on startup it looks like the project is trying to create DB instead updating it. I always get duplicity errors. I didn't have this problem while I was using Play 2.1.5. I don't see any problem in my configuration, but maybe I overlooked something: application.conf: db.default.jndiName=DefaultDS jpa.default=defaultPersistenceUnit db.default.url="jdbc:mysql://localhost/database" db.default.driver=com.mysql.jdbc.Driver persistence.xml: <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0"> org.hibernate.ejb.HibernatePersistence DefaultDS <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <property name="hibernate.format_sql" value="true"/> <property name="hibernate.hbm2ddl.auto" value="update"/> Build.scala dependencies contain: javaCore, javaJdbc, javaJpa, cache, "org.hibernate" % "hibernate-entitymanager" % "4.2.7.Final"
score: 0
tagged with: playframework-2.0
has comment: http://stackoverflow.com/comment/31728985

http://stackoverflow.com/q/21018997
has comment: http://stackoverflow.com/comment/31594543
favorite count: 0
has body: What is the main advantage of the Spring framework? Is it loosing dependence between objects ? We can setup the values of fields in xml files but what is the difference between initializing these fields with help xml or simply in the java code? Here is very similar question: What exactly is Spring Framework for? Is there any other advantage ?
score: 0
has comment: http://stackoverflow.com/comment/31599360
has comment: http://stackoverflow.com/comment/31593176
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31593207
linked to: http://stackoverflow.com/q/1061717
has comment: http://stackoverflow.com/comment/31593345
tagged with: spring
tagged with: design-patterns
type: Question
tagged with: spring-mvc
has title: The sense of Spring Framework
tagged with: java
accepted answer: http://stackoverflow.com/a/21020115
upvote count: 2
has comment: http://stackoverflow.com/comment/31593671
downvote count: 2
has comment: http://stackoverflow.com/comment/31622062
answer count: 1
has answer: http://stackoverflow.com/a/21020115

http://stackoverflow.com/q/21072763
type: Question
has title: a LocalSocket (Unix domain) client-server data flow issue for MediaRecorder in Android (Java)
downvote count: 0
has body: What I don't get is data flow among the Unix Domain Sockets . I understand Unix Domain Socket data flow is LocalSocket client .connect() --> LocalServerSocket server .accept() The client sends data to the server, straight enough that I understand. However, for Streaming video/audio from MediaRecorder of Android, after a lot of research, I've seen every example to use a LocalSocket instead of a file for MediaRecorder is in principle as below: https://static.foxdogstudios.com/static/presentations/keeping-it-real-time.html#/9 LocalServerSocket server = new LocalServerSocket("some name"); receiver = new LocalSocket(); receiver.connect(server.getLocalSocketAddress()); LocalSocket sender = server.accept();//LocalSocket not LocalServerSocket as in Source link // ... // Give the MediaRecorder our fake file recorder.setOutputFile(sender.getFileDescriptor()); This code looks like: MediaRecorder --> LocalSocket sender --> LocalServerSocket server .accept() --> LocalSocket receiver .connect() What is going on?? Appearently, the sockets data flows in the opposite direction, therefore, I don't get why this code works as expected. Could you kindly advise. Thanks.
tagged with: android
answer count: 1
favorite count: 0
upvote count: 2
tagged with: sockets
tagged with: stream
accepted answer: http://stackoverflow.com/a/21080860
tagged with: unix-socket
type: AnsweredQuestion
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/21080860

http://stackoverflow.com/a/21021268
type: Answer
has comment: http://stackoverflow.com/comment/31597202
has comment: http://stackoverflow.com/comment/31597517
upvote count: 1
has body: All you need is to use the regex: "\\(.*\\)" If it must start and end with the brackets use: "^\\(.*\\)$"
answers question: http://stackoverflow.com/q/21021219
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21021219

http://stackoverflow.com/q/21158872
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21159377
tagged with: xsd
has body: How could I make the XSD schema string element(password) as type encrypted, This in turn would be used in XSD to java code generator encrypt and decrypt during Writing/Reading process of XML not just validation. Does any XSD to java class generator provide this feature ?? Cheers, Reddy.
tagged with: http://stackoverflow.com/tag/xml
tagged with: castor
upvote count: 3
type: UnansweredQuestion
type: Question
score: 3
tagged with: java
tagged with: jaxb
has title: XSD schema string elements Encrypt/Decrypt

http://stackoverflow.com/comment/31884496
has text: @ramanrayat post the stacktrace for further help. also post more relevant code.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21178175
type: Comment

http://stackoverflow.com/comment/31887477
type: Comment
type: QuestionComment
has text: I want to obtain the TGT through Java, as in the tutorial. My krb5.conf is set up such that OS command line tools (either Heimdal or MIT) return tickets with the desired properties. Java apparently uses its own mechanisms to get the tickets and does not obey krb5.conf settings.
comment on: http://stackoverflow.com/q/21163424
score: 0

immutability
tags question: http://stackoverflow.com/q/21168276
tags question: http://stackoverflow.com/q/21054070
tag name: immutability
type: Tag
tags question: http://stackoverflow.com/q/21041564

http://stackoverflow.com/q/21149959
has comment: http://stackoverflow.com/comment/31833708
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/31834190
has body: i want a scrollpane on my GUI. The area, i want to have "scrollable" is a JPanel without any LayoutManager, because the content is something between static and dynamic... but maybe a part of my code will help Here it is: pane = getContentPane(); jpane = new JPanel(); // jpane.setBounds(0, 75, 680, 255); jpane.setLayout(null); jsp = new JScrollPane(jpane, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); jsp.setBounds(0, 75, 680, 255); jsp.setPreferredSize(new Dimension(680,255)); pane.add(jsp); My JPanel will be filled with this piece of code... for(int i = 0; i &lt; Integer.parseInt(spaltenzahl.getText()); i++) { JTextField spaltennamen_feld = new JTextField(); spaltennamen_feld.setBounds(10, 10+35*i, 150, 25); spaltennamen_arraylist.add(spaltennamen_feld); JComboBox&lt;String&gt; datentypen_box = new JComboBox&lt;String&gt;(types); datentypen_box.setBounds(170, 10+35*i, 150, 25); datentypen_arraylist.add(datentypen_box); JComboBox&lt;String&gt; datenzusatz_box = new JComboBox&lt;String&gt;(comb); datenzusatz_box.setBounds(330, 10+35*i, 100, 25); datenzusatz_arraylist.add(datenzusatz_box); jpane.add(spaltennamen_feld); jpane.add(datentypen_box); jpane.add(datenzusatz_box); } Problem: i can't add a screenshot of my GUI, cause of missing ehr... i forgot the name of this required things here ^_^ But i the real problem is: overflowing content won't be displayed on my JPanel and my ScrollPane does not scroll. Any idea? Thanks alot :)
type: Question
has comment: http://stackoverflow.com/comment/31833943
has answer: http://stackoverflow.com/a/21150124
has comment: http://stackoverflow.com/comment/31833642
has title: JScrollPane on dynamic filled JPanel with null layout
has comment: http://stackoverflow.com/comment/31833666
has comment: http://stackoverflow.com/comment/31833568
tagged with: jscrollpane
answer count: 1
downvote count: 0
tagged with: layout-manager
favorite count: 0
accepted answer: http://stackoverflow.com/a/21150124
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31834074
tagged with: null-layout-manager
score: 1
tagged with: java

http://stackoverflow.com/q/21164182
score: -1
has answer: http://stackoverflow.com/a/21164357
answer count: 1
downvote count: 1
tagged with: arrays
has body: I have a JSONArray contained in another JSONArray in a JSON Object like the following: { "protocol": "test", "query": [ { "locked": false, "ids": [ { "id": 1, "locked": false }, { "id": 1, "locked": false } ] }, { "locked": false, "ids": [ { "id": 1, "locked": false }, { "id": 1, "locked": false } ] } ], } here i want to get the ids arrays, i can get the query arrays like that: private JSONArray getDB_Query(String json) throws JSONException{ JSONObject jsonObj = null; try { jsonObj = new JSONObject(json); } catch (JSONException e) { Login.errorMessage.setText(sys_err); } JSONArray query = jsonObj.getJSONArray("query"); return query; } Now if I want to get the ids, is that true : jsonObj = new JSONObject(query.toString()); // query is the JSONArray I retrieved from the above method for(int i= 0; i &lt; query.length(); i ++){ JSONArray ids_query = jsonObj.getJSONArray("ids"); }
favorite count: 0
has comment: http://stackoverflow.com/comment/31858757
type: AnsweredQuestion
upvote count: 0
tagged with: java
has title: How to get JSONArray exists in another JSONArray?
type: Question
accepted answer: http://stackoverflow.com/a/21164357
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/31891987
comment on: http://stackoverflow.com/a/21159938
type: AnswerComment
score: 0
type: Comment
has text: Thank you for your answer ! It is preliminary optimization, I agree. It is a sort of "cache" for my portlet' preferences, mostly. It's just technical data, no business here. From the data in preferences, I compute some beans that will be usefull for my portlet. The computing of those beans depends on the content in the portal, and I don't want to make this on every viewing of the portlet because of the time it would take. The resulting beans are not really big, but I don't want to store that data in preferences (I don't want to parse it).

http://stackoverflow.com/comment/31593345
type: Comment
type: QuestionComment
has text: @chrylis what does exactly mean JavaConfig ? Configuration in java code by spring annotations ?
comment on: http://stackoverflow.com/q/21018997
score: 0

http://stackoverflow.com/a/23227960
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21062484
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21062484
type: Answer
score: 2
has body: The bug was reported to Oracle in January 2014, and three months later it appeared in the public bug tracker as JDK-8041480. The bug was fixed for Java 9 in September 2016.
downvote count: 0

http://stackoverflow.com/comment/31888905
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21180935
has text: Java, maybe? Please add your language as another tag.
type: Comment

http://stackoverflow.com/comment/31813267
has text: this is the link of my image [link](http://ubuntuone.com/7QBgJ9MVMUw5gDJhJ15WFN) its small example I'm working on it
type: AnswerComment
comment on: http://stackoverflow.com/a/21134015
type: Comment
score: 0

http://stackoverflow.com/a/21166291
answers question: http://stackoverflow.com/q/21166156
has comment: http://stackoverflow.com/comment/31863002
type: AcceptedAnswer
type: Answer
has body: Adding a line as below: cal.set(Calendar.MILLISECOND, 0); Will set the milliseconds value. The API docs specify the field as below: public final void set(int year, int month, int date, int hourOfDay, int minute, int second) So it doesn't offer the granularity to set the millisconds. Side note: If your using the Java Date libs checkout Jodatime: http://www.joda.org/joda-time/ its a lot better!
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/21166156
downvote count: 0

http://stackoverflow.com/comment/31630593
comment on: http://stackoverflow.com/a/21039479
type: Comment
score: 0
has text: @Grains Works just fine for me, once I fixed that line in my answer. I tested with http://www.urbanfonts.com/fonts/Back_to_Bay_6.htm (for no particular reason).
type: AnswerComment

http://stackoverflow.com/comment/31812463
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21123801
has text: If that is your only concern, then yes, it's wrong. Your database will provide techniques to manage large tables. First strategy is making a unique index on your company ID and user ID (in that order). The second strategy (if the first one isn't enough) is to make a partition on the company. Unless you have a billion users, I doubt you'll need to partition though. The index should suffice for tens of millions

http://stackoverflow.com/comment/31711617
score: 0
has text: Is this like an AWS instance?
comment on: http://stackoverflow.com/q/21083425
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21109364
has comment: http://stackoverflow.com/comment/139966528
has body: Always recommended one is Date with time-stamp. If you don't need then while storing store it as 00:00:00.(Use Sql Date for date without time-stamp.) Use business logical in order to truncate the time and the format you required. Service layer you can play with date and in most of DB its better to store Date with timestamp.
answers question: http://stackoverflow.com/q/21109292
has comment: http://stackoverflow.com/comment/123477899
has comment: http://stackoverflow.com/comment/31759609
score: 0
has comment: http://stackoverflow.com/comment/31759272
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/31801313
downvote count: 4
has comment: http://stackoverflow.com/comment/31759009

http://stackoverflow.com/comment/31842084
has text: `Doesn't fit` means it outstretches your page? A screenshot of 6 and 7 would help
comment on: http://stackoverflow.com/q/21154578
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21136550
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21135391
answers question: http://stackoverflow.com/q/21135391
type: Answer
has body: First of all, AsyncTask threads are a limited resource. Thread.sleep() does not seem to be a good style. To get something repeated after a delay: in Activity: private Handler uiHandler = new Handler(Looper.getMainLooper()); in a method: //uiHandler.removeCallbacks(myRunnable); uiHandler.postDelayed(myRunnable, ms_interval); But this will not solve the problem with the exception. Most likely, the error will disappear if you initialize your CategoryAdapter on the UI thread and probably (not sure) you will also have to use it from the same thread. But this probably is not what you want. Maybe you will have to write your own service thread, initialize a looper and a handler on this thread, and only then post (delayed) runnables to the handler. If you do the latter, please check what happens with the background thread when the screen is turned by 90 degrees and the activities are re-created. You definitely don't want to leak threads and activities that are referenced from these threads because they have started them (non-static inner classes have an implicit pointer to the containing instance of the containing class, which means that a new Runnable(){} references the activity that has created it).
score: 1

http://stackoverflow.com/q/21138811
has answer: http://stackoverflow.com/a/21139096
has body: I am trying to write a class that will encrypt/decrypt text using AES. I want to generate a key, store the key in a database column and use that key to encrypt/decrypt corresponding text in the database row containing the key. The following is the class that I wrote to generate the key and do encryption and decryption tasks. import java.io.UnsupportedEncodingException; import java.math.BigInteger; import java.security.InvalidKeyException; import java.security.Key; import java.security.NoSuchAlgorithmException; import java.util.logging.Level; import java.util.logging.Logger; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.KeyGenerator; import javax.crypto.NoSuchPaddingException; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; public class StringDecryptor { public static String encrypt(String text, String key) { Key aesKey = null; Cipher cipher = null; byte[] encrypted = null; try { aesKey = new SecretKeySpec(key.getBytes("UTF-8"), "AES"); cipher = Cipher.getInstance("AES"); cipher.init(Cipher.ENCRYPT_MODE, aesKey); encrypted = cipher.doFinal(text.getBytes()); } catch (NoSuchAlgorithmException ex) { Logger.getLogger(StringDecryptor.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchPaddingException ex) { Logger.getLogger(StringDecryptor.class.getName()).log(Level.SEVERE, null, ex); } catch (InvalidKeyException ex) { Logger.getLogger(StringDecryptor.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalBlockSizeException ex) { Logger.getLogger(StringDecryptor.class.getName()).log(Level.SEVERE, null, ex); } catch (BadPaddingException ex) { Logger.getLogger(StringDecryptor.class.getName()).log(Level.SEVERE, null, ex); } catch (UnsupportedEncodingException ex) { Logger.getLogger(StringDecryptor.class.getName()).log(Level.SEVERE, null, ex); } return new String(encrypted); } public static String decrypt(String text, String key) { Key aesKey = null…
score: 0
has answer: http://stackoverflow.com/a/21139368
has answer: http://stackoverflow.com/a/21139135
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21139236
tagged with: cryptography
answer count: 4
has title: AES key string throws exceptions
type: Question
tagged with: java

http://stackoverflow.com/comment/31697890
comment on: http://stackoverflow.com/q/21075319
type: Comment
type: QuestionComment
has text: Did you try to debug your code? I suspect that you don't even access the if clause. `question.getCategory() == ""` is false (identity). Should be `"".equals(question.getCategory())`
score: 0

http://stackoverflow.com/comment/31847228
comment on: http://stackoverflow.com/a/21154338
type: AnswerComment
type: Comment
has text: Sorted out in my local machine. still looking solid solution to fix it in Client's side machine and Browser.
score: 0

http://stackoverflow.com/q/21079888
answer count: 1
accepted answer: http://stackoverflow.com/a/21079908
has comment: http://stackoverflow.com/comment/31705155
duplicate of: http://stackoverflow.com/q/513832
favorite count: 0
type: AnsweredQuestion
has title: Get String from JTextArea
tagged with: java
has answer: http://stackoverflow.com/a/21079908
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31704892
score: -1
has body: I am making a Repository Client for my sites repositories and I need to be able to detect when a user enters a certain id to detect which URL Repository to get it from. Here is my code: JTextField repo = new JTextField(); JButton submit = new JButton("Download!"); String repod = repo.getText(); final String repoid = repod; submit.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ if(repoid.equals("pb")){ //this }else if(repoid.equals("mb")){ //this }else if(repoid.equals("repo29-update")){ //this }else{ System.out.println("Contacting SERVER..."); System.out.println("Finding REPOID: "+repoid); System.out.println("Not Found! Returning Error!"); JLabel err = new JLabel("Invalid REPOID"); JFrame a = new JFrame("Error"); a.setSize(300,100); a.setLocationRelativeTo(null); a.setResizable(false); a.setAlwaysOnTop(true); a.add(err); a.setVisible(true); } } }); When I go through this script, I always get the else option, why? This is not a duplicate, I changed the == to .equals() and it still doesnt work.
upvote count: 0

http://stackoverflow.com/comment/31762727
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21111533
score: 0
has text: From the question it is not obvious if you want to search for the whole codes or for parts of it. If it will be whole codes, then I doubt there will be performence difference on integer/varchar indexed column. If every letter is a standalone identifier, then it should be split to three columns.

http://stackoverflow.com/a/21052780
score: 1
upvote count: 1
has body: To stay close to what's already been done, as the exception is caught the invalid contents we can clear the Scanner of the wrong input. input.nextLine() would read the invalid input. Not doing anything with the caught value would ignore it. Solution: Just add input.nextLine(); in your catch block try { System.out.print("Enter payrate: "); //ask for payratea payrate = input.nextFloat(); //store input from console } catch (Exception InputMismatchException) { System.out.println("Payrate must be &gt; 0."); payrate = 0; input.nextLine(); }
answers question: http://stackoverflow.com/q/21052145
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31795990
has text: post your logcat along with the line number
comment on: http://stackoverflow.com/q/21129473
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21062928
type: Question
linked to: http://stackoverflow.com/q/21068345
accepted answer: http://stackoverflow.com/a/21063460
upvote count: 3
tagged with: java
answer count: 1
tagged with: libgdx
has body: The following command: game.setScreen(new GameScreen()); launches you into a new screen, similar to Android's startActivity(). But then how do you leave the screen and return the screen that called you (similar to Android's finish())? Plus, is there a graphic showing the screen lifecycle for LibGDX similar to Android?
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/21063460
downvote count: 0
favorite count: 0
has title: libgdx leave screen and screen lifecycle

http://stackoverflow.com/q/21117828
accepted answer: http://stackoverflow.com/a/21118287
favorite count: 0
score: 2
type: AnsweredQuestion
tagged with: geometry
has body: Is there a computational 3D geometry (only computation, not rendering) library written in Java? I need it for operations like: finding primitives intersection, such as planes, cubes etc. create "meshes" from triangles, and set properties to mesh elements(vertices, edges, triangles) and other geomtrical operations - finding objects by distance, creating mesh from line etc.
upvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/84749812
has answer: http://stackoverflow.com/a/21118287
has title: Java 3D geometry library
tagged with: java
tagged with: 3d
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/31647430
has text: Can you maybe share your code?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21041286

http://stackoverflow.com/comment/31703918
type: AnswerComment
type: Comment
has text: Of course that should be there but the OP may not have neglected to included that in the question...
comment on: http://stackoverflow.com/a/21079454
score: 0

http://stackoverflow.com/a/21065063
score: 0
type: AcceptedAnswer
has body: The problem has been resolved by changing transport to ApacheHttpTransport class. But it will be quite useful to get to know whats wrong with NetHttpTransport. Regards, Sergey.
answers question: http://stackoverflow.com/q/21043594
type: Answer
accepted answer of: http://stackoverflow.com/q/21043594

http://stackoverflow.com/comment/31654880
type: QuestionComment
has text: The url only reaches to controller level, have you defined in your routing that default action is "Add"? Otherwise you need to change your url to *"http://www.life-projects.com/api/orders/add"* in order to reach the action
type: Comment
comment on: http://stackoverflow.com/q/21051282
score: 0

http://stackoverflow.com/q/21173912
linked to: http://stackoverflow.com/q/7261039
answer count: 2
score: 2
has comment: http://stackoverflow.com/comment/31876998
has body: As of today it is not possible to run Haskell programs on the JVM (see this question). I'm wondering if there is a production-ready functional language that supports a fair amount of the abstractions Haskell offers like: static typing type inference type classes currying lazy evaluation functors, applicative functors, monads, monad transformers ... Edit : With production ready I mean: good documentation (books, websites, tutorials) libraries active (large) community, mailing lists, ... stable and mature (no academic abandonware) In general a language that is likely to have a 'future'. I heard about Frege and CAL but don't know about their status.
has comment: http://stackoverflow.com/comment/31883384
has answer: http://stackoverflow.com/a/21174299
has title: Is there a Haskell like production-ready language on the JVM?
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/31877128
has comment: http://stackoverflow.com/comment/31982500
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31876653
accepted answer: http://stackoverflow.com/a/21174299
upvote count: 3
has comment: http://stackoverflow.com/comment/31876706
tagged with: java
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/21174482
has comment: http://stackoverflow.com/comment/31877484
has answer: http://stackoverflow.com/a/21174482
tagged with: haskell

http://stackoverflow.com/comment/31782926
type: AnswerComment
comment on: http://stackoverflow.com/a/21122327
score: 0
has text: What if i had to add a another panel with two buttons in it just under my chess board?
type: Comment

http://stackoverflow.com/comment/31705980
score: 0
type: AnswerComment
type: Comment
has text: I did and now it runs. How do I modify it so that the program reads a .txt file instead of asking for imput?
comment on: http://stackoverflow.com/a/21080423

http://stackoverflow.com/q/21090020
type: Question
has answer: http://stackoverflow.com/a/21108491
tagged with: processing-efficiency
has title: large-scale document co-occurrence analysis
score: 7
tagged with: multithreading
upvote count: 7
has comment: http://stackoverflow.com/comment/31726099
has answer: http://stackoverflow.com/a/21090280
tagged with: performance
has body: I have about 1000 files. Each of which contains about 20,000 documents. I also have a list of about 1,000,000 words. I want to calculate how many time each word occurs with any other words. So, there is a sparse matrix of size 1M X 1M. To speed up computation, I'm working on each file separately by doing the following: 1- Each core in my machine is processing a single file and outputing a file of the following format WordId1 WordId2 Frequency 2- After doing each file, I merge the 1000 file into a single file. This is my current approach but It takes so long to do it and I assume there should be much efficient way of doing it so your comments are welcome.
has comment: http://stackoverflow.com/comment/31727417
has comment: http://stackoverflow.com/comment/31727790
tagged with: java
answer count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31723653
has comment: http://stackoverflow.com/comment/31724118
has comment: http://stackoverflow.com/comment/31724062
has comment: http://stackoverflow.com/comment/31724346
downvote count: 0
has comment: http://stackoverflow.com/comment/31735797
has answer: http://stackoverflow.com/a/21108826
has comment: http://stackoverflow.com/comment/31723039
favorite count: 0

http://stackoverflow.com/q/21135787
score: 0
tagged with: junit
type: UnansweredQuestion
has title: JUnit for Spring mvc service method void return type
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/21137215
tagged with: java
has body: Here is my Service class import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.integration.Message; import org.springframework.integration.MessagingException; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.core.MessageHandler; import org.springframework.stereotype.Service; @Service public class EmailService implements MessageHandler { @Autowired @Qualifier("receiveChannel") private DirectChannel messageChannel; private final Log logger = LogFactory .getLog(EmailService.class); public void init() { logger.info("initializing..."); System.out.println("INIT"); messageChannel.subscribe(this); } @Override public void handleMessage(Message&lt;?&gt; message) throws MessagingException { logger.info("Message: " + message); } } For the init I want to create a JUnit Test Case. How to write? Here is what I have tried. But it is not working @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration("classpath:webapptest") @ContextConfiguration(locations = {"classpath:test-applicationcontext.xml"}) public class EmailServiceTest { @Autowired private EmailService emailService; @Test(timeout=600000) public void testEmailService() throws Exception { emailService=Mockito.spy(emailService); Mockito.doNothing().when(emailService).init(); } } In the console it is not printing the logger or print statements in the init() method. What error I am doing? How to write the test case?
type: Question
answer count: 1

http://stackoverflow.com/comment/31998914
type: AnswerComment
type: Comment
has text: I've updated my question's content, to show if the "Compatibility View" fixes the problem. Still no luck.
comment on: http://stackoverflow.com/a/21183484
score: 0

http://stackoverflow.com/a/21131290
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31800075
score: 0
has comment: http://stackoverflow.com/comment/31799154
has comment: http://stackoverflow.com/comment/31799140
answers question: http://stackoverflow.com/q/21131264
type: Answer
has body: Change your input and use single quotes there instead of double quotes for value since value also contains those value="&lt;%=objCraftsUploadDataBean.getStrFullContent() %&gt;" can be value='&lt;%=objCraftsUploadDataBean.getStrFullContent() %&gt;' Or you can escape them if you still want to use double quotes.
has comment: http://stackoverflow.com/comment/31799099

http://stackoverflow.com/comment/31843235
has text: Can you show the plugin source..
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21155551
type: QuestionComment

http://stackoverflow.com/comment/31666104
has text: I think you misunderstood my question. I just want to pass the JSONObject to my main thread, so that I can do the parsing there. I already know how to get keys.
score: 0
comment on: http://stackoverflow.com/q/21058870
type: Comment
type: QuestionComment

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/21163108
tags question: http://stackoverflow.com/q/21111305
tags question: http://stackoverflow.com/q/21172817
tags question: http://stackoverflow.com/q/21174345
tags question: http://stackoverflow.com/q/21177931
tags question: http://stackoverflow.com/q/21096507
tags question: http://stackoverflow.com/q/21120043
tags question: http://stackoverflow.com/q/21133509
tags question: http://stackoverflow.com/q/21082536
tags question: http://stackoverflow.com/q/21132174
tags question: http://stackoverflow.com/q/21149139
tags question: http://stackoverflow.com/q/21044054
tags question: http://stackoverflow.com/q/21062727
tags question: http://stackoverflow.com/q/21156599
tags question: http://stackoverflow.com/q/21149095
tags question: http://stackoverflow.com/q/21148085
tags question: http://stackoverflow.com/q/21101864
type: Tag
tags question: http://stackoverflow.com/q/21143996
tags question: http://stackoverflow.com/q/21095997
tags question: http://stackoverflow.com/q/21078616
tags question: http://stackoverflow.com/q/21025738
tags question: http://stackoverflow.com/q/21096212
tags question: http://stackoverflow.com/q/21075833
tags question: http://stackoverflow.com/q/21168278
tags question: http://stackoverflow.com/q/21135870
tags question: http://stackoverflow.com/q/21082875
tags question: http://stackoverflow.com/q/21102759
tags question: http://stackoverflow.com/q/21101407
tags question: http://stackoverflow.com/q/21102592

http://stackoverflow.com/comment/100326958
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25881592
type: Comment
has text: I had setProperty() call but not in "static" block. It worked once I kept the call in the static block. Thanks!

http://stackoverflow.com/q/21133134
type: UnansweredQuestion
tagged with: model-view-controller
has body: I've been told that MVC is an architecture pattern for the presentation tier on a multi-tier architecture. I didn't understand the MVC Model concept. So I made a web application, as an aproach to learn MVC model, only using JSP and Servlets, I made the DataAccess layer too. In my WebContent folder, I put all the views. In my src (Java content) folder, I made 4 packages. data presentation.model presentation.controller businessEntities I used Servlets as Controllers (used the FrontController pattern) and JSP for all the Views. As the title says, my problem is with the model. Now, lets make an example.. I have 2 classes. - Car - CarLogic CarLogic is a class that calls a possible CarDAO to get data and to return it to anyone who asks it. Car is just the POJO. I placed CarLogic inside presentation.model and Car on businessEntities. Am i wrong? What should i put on Model package? Thanks!
tagged with: java
has title: Doubts about MVC Model
type: Question
has answer: http://stackoverflow.com/a/21133342
has answer: http://stackoverflow.com/a/21133642
upvote count: 5
answer count: 6
has answer: http://stackoverflow.com/a/21134075
has answer: http://stackoverflow.com/a/21133845
tagged with: servlets
has answer: http://stackoverflow.com/a/21133319
score: 5
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21134612

http://stackoverflow.com/comment/31866052
type: AnswerComment
has text: If you use [java 8](https://jdk8.java.net/download.html) you won't have to worry about most of that as jfxrt is included in the default java platform.
type: Comment
comment on: http://stackoverflow.com/a/21158169
score: 0

http://stackoverflow.com/a/21026780
score: 3
has body: I don't see what's so difficult. If you are certain your root JSON is a JSON object, simply cast the value returned by ObjectMapper#readTree(..) to an ObjectNode and manipulate it. String json = "{\"sample\": \"some value\", \"nested\": {\"prop\": 123, \"nestedArray\":[1,2, \"string value\"], \"array\":[null, 42]}}"; ObjectNode node = (ObjectNode) new ObjectMapper().readTree(json); System.out.println(node); ArrayNode arrayNode = node.putArray("new array"); arrayNode.add(true).add(1).add("new value"); // chain add calls arrayNode.addObject().put("nestedInArray", "nested object value"); // add an object and add to it System.out.println(node); prints {"sample":"some value","nested":{"prop":123,"nestedArray":[1,2,"string value"],"array":[null,42]}} {"sample":"some value","nested":{"prop":123,"nestedArray":[1,2,"string value"],"array":[null,42]},"new array":[true,1,"new value",{"nestedInArray":"nested object value"}]} Note that you can also add your custom objects too. They will typically be wrapped in POJONode objects.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21026486
upvote count: 3

http://stackoverflow.com/a/70334837
type: Answer
has body: Split the 250 GB file into 5 files of 50 GB each. Then process each file and then delete it. This way you will always have 50 GB left on your machine and you will also be able to process 250 GB file.
has comment: http://stackoverflow.com/comment/125543407
answers question: http://stackoverflow.com/q/21133391
score: 0

http://stackoverflow.com/a/21050923
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21050003
has body: Register custom font with: GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment() ge.registerFont(myFont); After, provide file name, something like: URL fontUrl; try { fontUrl = new URL("http://www.webpagepublicity.com/" + "free-fonts/a/Airacobra%20Condensed.ttf"); // dummy font Font myFont = Font.createFont(Font.TRUETYPE_FONT, fontUrl.openStream()); myFont = myFont.deriveFont(Font.PLAIN,20); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); ge.registerFont(myFont); button.setText(" Hello World "); } catch (MalformedURLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (FontFormatException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } The filename can be accquired on windows by rightclicking on the font file, selecting Properties -> Details and there it's the title. Example: FontAwesome Regular.
type: Answer
answers question: http://stackoverflow.com/q/21050003

http://stackoverflow.com/comment/31662951
has text: I mean that I need the program to be able to play an audio file without any delay. The moment I call clip.start(), I want the clip to play. Any delay longer than a few milliseconds will be a problem.
score: 0
comment on: http://stackoverflow.com/a/21057134
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/31673719
has text: in the line `boolean sc = m.contains(s);id` -> what is id?
type: QuestionComment
comment on: http://stackoverflow.com/q/21063045
score: 0
type: Comment

http://stackoverflow.com/comment/31601544
has text: @TheLostMind i know, i only want to point out that there is a memory problem too. thats not my downvote :)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21023445

http://stackoverflow.com/comment/31827301
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21146756
score: 0
has text: Are you running from an IDE like Eclipse

http://stackoverflow.com/comment/77046377
comment on: http://stackoverflow.com/q/21172441
has text: This problem can also occur because anti-virus software is blocking port 25. Check your anti-virus log files for an entry like this: "7/10/2017 12:54:12 PM Blocked by port blocking rule C:\PROGRAM FILES\JAVA\JRE1.8.0_131\BIN\JAVAW.EXE Anti-virus Standard Protection:Prevent mass mailing worms from sending mail 0:0:0:0:0:ffff:aa2:cdcc:25
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31651743
score: 0
comment on: http://stackoverflow.com/q/21051287
type: Comment
type: QuestionComment
has text: How would you import the numbers? Is it your intention to parse string representations of the original numbers?

unmarshalling
tags question: http://stackoverflow.com/q/21026167
tag name: unmarshalling
type: Tag
tags question: http://stackoverflow.com/q/21110139
tags question: http://stackoverflow.com/q/21107404

http://stackoverflow.com/comment/31616058
type: AnswerComment
type: Comment
has text: Yeah, no clue how that happened. :[
score: 1
comment on: http://stackoverflow.com/a/21029082

http://stackoverflow.com/comment/31967487
comment on: http://stackoverflow.com/a/21139689
score: 0
type: AnswerComment
type: Comment
has text: Adding the [Joda-Time](http://www.joda.org/joda-time/) library is highly recommended. It is a high-quality well-worn library. In Java 8, the java.util.Date & .Calendar classes are being supplanted by new [java.time.* classes](http://download.java.net/jdk8/docs/api/java/time/package-summary.html) because of deficiencies. Those new classes were inspired by Joda-Time. Until you can move to Java 8, use Joda-Time.

http://stackoverflow.com/comment/31687406
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21070392
type: QuestionComment
has text: Can you tell us the line that out of bounds exception is happening at?

http://stackoverflow.com/comment/31703620
has text: I got it working by doing the following, but it now adds duplicate keys? interconnects = TreeMultimap.create(Ordering.natural(), Ordering.natural().nullsFirst()); I'm using multimap not Map because it provides so many nice methods that Map doesn't :)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21078677

http://stackoverflow.com/comment/31782185
type: Comment
comment on: http://stackoverflow.com/q/21120260
score: 0
has text: To do this properly, you should find the projected positions for your geometry, and then sort by the depth (Z) that produces. Often this is inadequate because it would assume that your object can be represented by a single point and cannot nicely handle overlapping objects, but in the case of a voxel engine you should be fine if you use the centroid as the sort point.
type: QuestionComment

http://stackoverflow.com/comment/31858068
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21145581
type: Comment
has text: Exacly, how can I avoid this?

http://stackoverflow.com/a/21034782
type: Answer
answers question: http://stackoverflow.com/q/21034766
score: 1
upvote count: 1
has body: The .toString() method is using your locale when printing the date. Use: SimpleDateFormat format = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy"); format.setTimeZone(TimeZone.getTimeZone("GMT")); System.out.println(format.format(date));
accepted answer of: http://stackoverflow.com/q/21034766
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/21126282
has answer: http://stackoverflow.com/a/21126340
score: 0
answer count: 3
tagged with: file-io
has answer: http://stackoverflow.com/a/21126305
accepted answer: http://stackoverflow.com/a/21126305
possible better answer: http://stackoverflow.com/a/21126340
type: AnsweredQuestion
has body: I have a file: RandomAccessFile file = new RandomAccessFile("files/bank.txt", "r"); And I am reading and writing data to/from this file using: for (int pos = 0; pos &lt; 1000; pos++) { file.seek(40 * pos + 30); double money = file.readDouble(); if (pos == num) { money += i; System.out.println(money+" "+i); file.seek(40 * pos + 30); file.writeDouble(money); } } In this way it reads the double - works correctly, and then it should overwrite that double with the value it held previously plus i. However this is not working as the value doesn't change. What have I done wrong?
tagged with: java
has title: file.writeDouble is not writing a double
type: Question
has answer: http://stackoverflow.com/a/21126341
tagged with: randomaccessfile

http://stackoverflow.com/comment/113006313
has text: Not sure why Google brought me to this question (I was searching an error about missing classes in a plugin), but thanks, your answer got me on the right track! I didn't want to delete or rename my repository because I suspect it contains jars that do not exist elsewhere
comment on: http://stackoverflow.com/a/42728971
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21045051
tagged with: jtable
accepted answer: http://stackoverflow.com/a/21045154
favorite count: 0
upvote count: 1
tagged with: swing
possible better answer: http://stackoverflow.com/a/21058704
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31640333
has answer: http://stackoverflow.com/a/21058704
score: 1
has body: I know how to populate jtable and i had prepared the code for the above which works fine. But the problem is that it is working in another project but bot in my current project. The code for both the project is same. Here is the code... purchaswtab is the table name which has been already created using swing palette. And this function is executed in the event of the exit button of the Item Master. the array elements of an array ap are defined as i have to fetch them from the given position from the resultset. public void populatetable(ItemMaster imm) { imm.dispose(); String t[][]=new String [30][10]; int[] ap={19,1,2,4,18,16,17}; Object[] h1=new Object[7]; String a1,a2; int j=0,i=1; int len=0; try { st=fun.connect1(); String query="select * from Temp_Purchase"; ResultSet rs=st.executeQuery(query); ResultSetMetaData rsmd=rs.getMetaData(); while(rs.next()) { int k=0; for(i=1;i&lt;=7;i++,k++ ) { t[j][i-1]=rs.getString(ap[k]); System.out.println(t[j][i-1]); } j++; len++; } fun.close(); } catch(Exception e) { fun.close(); System.out.println("Exception:"+e); } DefaultTableModel de=(DefaultTableModel)purchaseTab.getModel(); purchaseTab=new JTable(de); //Code for filling data into table for(i=0;i&lt;len;i++) { for(j=1;j&lt;=7;j++) { h1[j-1]=t[i][j-1]; } if(h1[0]=="0") { h1[0]=Boolean.FALSE; } de.insertRow(i,h1); } //jsp.setViewportView(Table); }
tagged with: java
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21045154
has title: How to show data from database to jtable with checkboxes in the first column in jtable?

http://stackoverflow.com/q/21067338
tagged with: javascript
score: 0
has comment: http://stackoverflow.com/comment/31701513
answer count: 1
has title: How to silently print a pdf from a servlet output in a web application
has comment: http://stackoverflow.com/comment/31681644
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31691388
tagged with: struts-1
has answer: http://stackoverflow.com/a/27774512
tagged with: java
tagged with: itext
type: Question
has body: In struts1 web application, we have an itextpdf generator that write directly pdf in the struts servlet output stream. We use itextepdf to generate a receipt, so we need to print the generated pdf without showing it to the user. The user should not be able to download the receipt to avoid to print the same receipt twice. What's the best way to accomplish this? The code to serve the pdf is like that : public ActionForward printReceipt(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, final HttpServletResponse response) throws Exception { final OutputStream out = response.getOutputStream(); final Document doc = new Document(); final PdfWriter docWriter = PdfWriter.getInstance(doc, out); doc.open(); final PdfContentByte cb = docWriter.getDirectContent(); cb.beginText(); // .. write all required data in the pdf doc.close(); docWriter.close(); out.flush(); out.close(); return mapping.findForward(null); }

http://stackoverflow.com/comment/31678300
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21065560
score: 0
has text: a good edit, but if you put in a try with resources better ;) then it's `autocloseable` and don't need to use `close` or `flush` in this case

http://stackoverflow.com/a/21068128
score: 0
has comment: http://stackoverflow.com/comment/31683172
has comment: http://stackoverflow.com/comment/31683268
has body: You could use the Google Maps Geocoding API. Querying coordinates returns a JSON response containing the current location in multiple levels of detail that you could parse. E.g. for the position lat:40.714224 long: -73.961452, the query URL would look like the following: http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&amp;sensor=false The result now contains the city and country, beside much more. You can find more information on the API here: https://developers.google.com/maps/documentation/geocoding/
type: Answer
answers question: http://stackoverflow.com/q/21068040
has comment: http://stackoverflow.com/comment/31683129

http://stackoverflow.com/comment/31773237
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21117030
has text: What USB class is the ATmega presenting? Are you using an external USB chip or bit-banging the USB stack on the microcontroller?

http://stackoverflow.com/comment/31676131
type: QuestionComment
has text: Look at Minecraft; even though it is almost fully obfuscated and keeps changing all the time structure wise, it's got enough momentum that people actually have not just reverse engineered it but basically torn it to bits, built injector APIs inside it and extended the game beyond anything anyone could ever dream of. So in short, I agree with @Andrew
score: 7
comment on: http://stackoverflow.com/q/21064329
type: Comment

http://stackoverflow.com/q/21067679
score: 0
tagged with: linux
has body: I want to recreate what DockBarX does but in Java. So I need to be able to query the top level windows in X11 (I can do that already) find the PID (got that too : _NET_WM_PID) but then map that to the application that created the window. I need to find which .desktop file (stored in /usr/share/applications) was launched that created the top-level window. But the pid is not really helpfull, often the pid could be a child process of another process which makes things complicated. How does DockBarX do it? I'm trying to look thru source but my python knowledge is very limited. Thanks.
has comment: http://stackoverflow.com/comment/31687199
has comment: http://stackoverflow.com/comment/31933498
answer count: 0
type: UnansweredQuestion
tagged with: python
tagged with: dock
has title: x11 query top-level windows and map them to application which created it (making task bar)
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31702187
tagged with: x11

jqplot
tags question: http://stackoverflow.com/q/21042088
tag name: jqplot
type: Tag

http://stackoverflow.com/comment/115543285
score: 0
type: Comment
comment on: http://stackoverflow.com/a/47141367
has text: Link is broken.However it does work for me.
type: AnswerComment

http://stackoverflow.com/q/21070211
score: 0
has title: Image wont load from assets
answer count: 1
tagged with: android-image
tagged with: assets
has answer: http://stackoverflow.com/a/21070345
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/31687250
tagged with: android
accepted answer: http://stackoverflow.com/a/21070345
type: AnsweredQuestion
tagged with: java
has body: I am writing an android game from the book "Beginning Android Games." The game is called Mr. Nom and its essentially like Snake. I finished writing it, and it worked as expected, however the code from the book only allowed for left and right turns with two buttons (a left arrow and a right arrow) to accomplish that task. I wanted to edit the code to allow for another two buttons (an up arrow and a down arrow) that would allow you to turn up or turn down. The source code download with the book had a set of images that went along with this particular game. One of the images included the left and right arrows, so I simply opened the image in Paint.Net and rotated it 90 degrees so that the arrows were facing up and down instead of left to right. All of these images are stored in the assets folder and I saved the rotated image as buttonsrotate.png. This is the code for drawing the buttons to the screen: private void drawRunningUI() { Graphics g = game.getGraphics(); g.drawPixmap(Assets.buttons, 0, 0, 64, 128, 64, 64); g.drawLine(0, 416, 480, 416, Color.BLACK); g.drawPixmap(Assets.buttons, 0, 416, 64, 64, 64, 64); g.drawPixmap(Assets.buttons, 256, 416, 0, 64, 64, 64); g.drawPixmap(Assets.buttonsrotate, 64, 416, 64, 0, 64, 64); g.drawPixmap(Assets.buttons, 192, 416, 0, 64, 64, 64); } When I run the app, the loading screen will open but as soon as I touch the screen to start the game it stops responding and closes. It only does this if I include the line: g.drawPixmap(Assets.buttonsrotate, 64, 416, 64, 0, 64, 64); Otherwise the game runs fine. Im sure that the image is in the assets, so I have no idea what is causing the problem. This is the logcat I get when I run the game with the g.drawPixmap(Assets.buttonsrotate, 64, 416, 64, 0, 64, 64); line in the code: 01-11 20:25:50.625: D/ActivityThread(9344): setTargetHeapIdealFree:8388608 01-11 20:25:50.625: D/ActivityThread(9344): setTargetHeapConcurrentStart:2097152 01-11 20:25:50.695: V/SoundPoolThread(9344): beginThread 01-11…
type: Question

http://stackoverflow.com/comment/31721793
has text: Wow! Thanks man. Now it works. I had to put the two statements in a method.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21089031
type: AnswerComment

http://stackoverflow.com/comment/31675371
type: QuestionComment
score: 0
has text: How you implementing `TableModel` ? Please have a look at this [thread](http://stackoverflow.com/q/9647522/1057230). Hopefully that might be able to answer this post :-)
type: Comment
comment on: http://stackoverflow.com/q/21063982

http://stackoverflow.com/comment/31652021
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21046139
has text: BTW - Don't block the EDT (Event Dispatch Thread) - the GUI will 'freeze' when that happens. Instead of calling `Thread.sleep(n)` implement a Swing `Timer` for repeating tasks or a `SwingWorker` for long running tasks. See [Concurrency in Swing](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/) for more details.
score: 0

http://stackoverflow.com/a/21070714
has comment: http://stackoverflow.com/comment/31688248
score: 3
upvote count: 3
has body: You split it up Vehicle * Other fields MotorizedVehicle extends Vehicle * Specialized fields NotMotorizedVehicle extends Vehicle * Chain Car extends MotorizedVehicle Bike extends NotMotorizedVehicle
answers question: http://stackoverflow.com/q/21070699
has comment: http://stackoverflow.com/comment/31688129
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31812771
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21138971
type: QuestionComment
has text: at least everything down from your point of modification.

http://stackoverflow.com/comment/31750921
type: Comment
score: 0
has text: Could also create a new instance (i.e. `GuessNumber gn = new GuessNumber()`, pass that (`input.range(gn)`), and set the variables within `range()` using `gn.lowRange = foo;`.
comment on: http://stackoverflow.com/a/21104455
type: AnswerComment

http://stackoverflow.com/a/21157246
answers question: http://stackoverflow.com/q/21157169
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31846207
has comment: http://stackoverflow.com/comment/31846131
has body: Call finish() before starting the activity public void onClick(View v) { Intent intent = new Intent(A.this, B.class); finish(); startActivityForResult(intent,1); setResult(RESULT_OK); }

http://stackoverflow.com/comment/31884629
type: AnswerComment
has text: line 106 : view11.small(mytext); in this i am calling a method define in my view1 class which change text
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21178175

http://stackoverflow.com/q/21019086
tagged with: maven
has comment: http://stackoverflow.com/comment/31594113
type: AnsweredQuestion
has body: As i m new to the web sockets i want to clarify that is there any simple methods to create web sockets in java without using maven. please help me friends.
has title: Is maven necessary to create web sockets in java?
has comment: http://stackoverflow.com/comment/31593453
tagged with: java
accepted answer: http://stackoverflow.com/a/21019169
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21019169
has comment: http://stackoverflow.com/comment/31594055
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31593226
has comment: http://stackoverflow.com/comment/31594402
downvote count: 4
answer count: 1
has comment: http://stackoverflow.com/comment/31593394
favorite count: 0
has comment: http://stackoverflow.com/comment/31593263
has comment: http://stackoverflow.com/comment/31594237
has comment: http://stackoverflow.com/comment/31593584
score: -3
has comment: http://stackoverflow.com/comment/31593323

http://stackoverflow.com/q/21173541
tagged with: tree
type: AnsweredQuestion
tagged with: algorithm
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21173687
tagged with: postorder
type: Question
has comment: http://stackoverflow.com/comment/31876025
answer count: 1
accepted answer: http://stackoverflow.com/a/21173687
downvote count: 0
has title: construct binary search tree from Post-order traversal in Java
favorite count: 0
has body: I am implementing code to construct BST(binary search tree) from a given post-order traversal array following this algorithm. I do not get back the binary Search Tree back. I am getting something that makes no-sense. here is my code public class BinaryTreemethods { public static void main(String[] args) { int[] preOrder = { 5, 3, 1, 4, 8, 6, 9 }; int[] inOrder = { 1, 3, 4, 5, 6, 8, 9 }; int[] postOrder = {1,4,3,8,6,9,5}; static int postIndex=postOrder.length-1; Node postordertree= buildBinarytreefromPostOrder(postOrder, 0, postOrder.length-1); System.out.println("pre order traversal of node from postorder reconstructed tree "); printPreOrder(postordertree); } private static void printPreOrder(Node tree) { if (tree != null) { System.out.print(" " + tree.data); printPreOrder(tree.left); printPreOrder(tree.right); } } //this just reconstructs BT from post-order traversal elements public static Node buildBinarytreefromPostOrder(int[] post, int start, int end){ if (postIndex&lt;start || start &gt; end ){ return null; } Node root = new Node(post[postIndex]); postIndex--; if (end == start){ //System.out.println("called"); return root; } int i = 0; for (i=end;i&gt;=start;i--){ if (post[i]&lt;root.data) break; } // Use the index of element found in postorder to divide postorder array // in two parts. Left subtree and right subtree root.right=buildBinarytreefromPostOrder(post,i+1, postIndex); root.left=buildBinarytreefromPostOrder(post,start,i); //root.left=buildBinarytreefromPostOrder(post,start,i); //root.right=buildBinarytreefromPostOrder(post,i+1, postIndex); return root; } } The output when I print in pre-order traversal is 5 9 6 8 3 4 which is not correct. Any idea where I could be going wrong? EDIT: After swapping the order of lines for root.right and root.left (commented out one were before), the left tree is build correctly, but the right tree is not. The output I get is 5 3 1 4 9 6 8
tagged with: binary-search-tree
linked to: http://stackoverflow.com/q/8850705
upvote count: 1

http://stackoverflow.com/a/21168915
type: Answer
has body: You need @Retention with a run time retention policy @Retention(RetentionPolicy.RUNTIME) public @interface PrintDevice{ String defaultPrint(); int defaultNumber(); } otherwise the annotation is not available at run time.
accepted answer of: http://stackoverflow.com/q/21168878
answers question: http://stackoverflow.com/q/21168878
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31867400

http://stackoverflow.com/comment/31824045
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21142692
type: Comment
has text: same idea with a brilliant implementation. Thanks to this I don't have to manually sort the distribution values.

http://stackoverflow.com/q/21093170
has comment: http://stackoverflow.com/comment/31730784
has answer: http://stackoverflow.com/a/21093233
tagged with: java
has comment: http://stackoverflow.com/comment/31729024
has body: I'm trying to learn SQLite, trying basic things and (as expected) it doesn't really work. I've tried to create another DB (different file), but the error remains the same. Please guide me. I an new to Android so I do not have much knowledge. package net.multiplesystem.nosms.database; import android.content.ContentValues; import android.content.Context; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; public class RegisterAdapter { static final String DATABASE_NAME = "register.db"; static final int DATABASE_VERSION = 1; public static final int NAME_COLUMN = 1; // TODO: Create public field for each column in your table. // SQL Statement to create a new database. static final String DATABASE_CREATE = "create table "+"REGISTER"+ "( " +"ID"+" integer primary key autoincrement,"+ "NAME text,"+"NUMBER text); "; // Variable to hold the database instanceSTER public SQLiteDatabase db; // Context of the application using the database. private final Context context; // Database open/upgrade helper private DataBaseHelper dbHelper; public RegisterAdapter(Context _context) { context = _context; dbHelper = new DataBaseHelper(context, DATABASE_NAME, null, DATABASE_VERSION); } public RegisterAdapter open() throws SQLException { db = dbHelper.getWritableDatabase(); return this; } public void close() { db.close(); } public SQLiteDatabase getDatabaseInstance() { return db; } public void insertEntry(String userName,String number) { ContentValues newValues = new ContentValues(); // Assign values for each row. newValues.put("NUMBER",number); newValues.put("NAME", userName); // Insert the row into your table db.insert("REGISTER", null, newValues); ///Toast.makeText(context, "Reminder Is Successfully Saved", Toast.LENGTH_LONG).show(); } } This is my logcat: 01-13 08:55:49.269: E/SQLiteLog(2588): (1) table REGISTER has no column named NAME 01-13 08:55:49.319: E/SQLiteDatabase(2588): Error inserting NAME=hhhh NUMBER=564 01-13 08:55:49.319: E/SQLiteDatabase(2…
type: Question
score: 0
answer count: 2
tagged with: sqlite
favorite count: 0
has title: Table * has no column named **
tagged with: android
linked to: http://stackoverflow.com/q/21078184
has comment: http://stackoverflow.com/comment/31728884
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/65585181
tagged with: android-sqlite
downvote count: 1

http://stackoverflow.com/comment/31760516
type: AnswerComment
comment on: http://stackoverflow.com/a/21110133
type: Comment
has text: Also, recommending to use `/` as the separator in Java names is not exactly instructive.
score: 0

http://stackoverflow.com/a/21166041
answers question: http://stackoverflow.com/q/21165863
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21165863
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31863189
downvote count: 0
has body: Here is sample code to set selection background on SWT Table/Tree Items table.addListener(SWT.EraseItem, new Listener() { public void handleEvent(Event event) { event.detail &amp;= ~SWT.HOT; if ((event.detail &amp; SWT.SELECTED) == 0) return; int clientWidth = ((Composite)event.widget).getClientArea().width; GC gc = event.gc; Color oldForeground = gc.getForeground(); Color oldBackground = gc.getBackground(); gc.setBackground(event.display.getColor(SWT.COLOR_YELLOW)); gc.setForeground(event.display.getColor(SWT.COLOR_BLUE)); gc.fillGradientRectangle(0, event.y, clientWidth, event.height, true); gc.setForeground(oldForeground); gc.setBackground(oldBackground); event.detail &amp;= ~SWT.SELECTED; } });
type: Answer

http://stackoverflow.com/a/21048221
type: Answer
answers question: http://stackoverflow.com/q/21047909
score: 0
has body: Based on the documentation NoClassDefFoundError is 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. Couple of things you should do to make sure all the classes are available at runtime. 1 Make sure that you add Java Mail API to your classpath. 2 Make sure that you are using the -classpath option to pass the classpath to java as well as to javac to pick up those .jar files at runtime: for example: java -classpath :.:/usr/jdk/mail.jar

http://stackoverflow.com/a/21180228
score: 5
has body: You can use StringBuilder and define a method called e.g. getString. public static String getString(char ch, int n){ StringBuilder sb = new StringBuilder(n); for (int i=0; i&lt;n; i++){ sb.append(ch); } String s = sb.toString(); return s; } Now you can make some calls to this method. String sA1 = getString('a', 10); String sA2 = getString('a', 20); String sB = getString('b', 30); String sC = getString('c', 5);
downvote count: 0
type: Answer
upvote count: 5
answers question: http://stackoverflow.com/q/21180170

http://stackoverflow.com/comment/31869326
type: Comment
score: 0
has text: Where did the `.dat` file come from? However you created it, I'm sure you can reverse that process
type: QuestionComment
comment on: http://stackoverflow.com/q/21169789

http://stackoverflow.com/comment/31864231
type: Comment
has text: @maaartinus for the same reason "separator" might be a constant: memory. Each time you call append() with "something" an anonymous variable will be created with the content of "something". Call that in a loop(n) and you have n times "something" stored in your memory. Using a constant you would only pass the memory address and no real content.
comment on: http://stackoverflow.com/a/21166705
score: 1
type: AnswerComment

http://stackoverflow.com/a/21176303
has body: It seems like you are using the Linear Impulse when you should be just applying forces. The Linear Impulse "smacks" a body with a large force to give it a hefty instantaneous velocity. This is good if you are hitting a golf ball (large force, small time), or simulating a fired bullet, but it does not look good for the movement of real bodies. This is a function that I use on my Entities, which are a class to hold the box2D body and apply control forces to the body. In this case, this function, ApplyThrust, makes the body move towards a target (seek behavior): void ApplyThrust() { // Get the distance to the target. b2Vec2 toTarget = GetTargetPos() - GetBody()-&gt;GetWorldCenter(); toTarget.Normalize(); b2Vec2 desiredVel = GetMaxSpeed()*toTarget; b2Vec2 currentVel = GetBody()-&gt;GetLinearVelocity(); b2Vec2 thrust = desiredVel - currentVel; GetBody()-&gt;ApplyForceToCenter(GetMaxLinearAcceleration()*thrust); } In this case, the Entity has been given the command to move to a Target position, which it caches internally and can be recovered using GetTargetPos(). The function applies force to the body by generating a difference vector between the desired maximum velocity (towards the target) and the current velocity. If the body is already headed towards the target at the maximum velocity, the contribution from this function is effectively 0 (same vectors). Note that this does NOT change the orientation of the body. There is actually a separate function for that. Note the original question appears to be in Java (libgdx?). This is in C++, but the general idea is applicable and should work in any Box2d implementation by using references instead of pointers, etc. There is a code base with samples of doing this located here. You can read more about this code base in this post. Watch the video...I suspect it will tell you immediately if this is the information you are looking for. The Normalize function, which should be a member of the b2Vec2 class is: /// Convert this vector …
type: Answer
has comment: http://stackoverflow.com/comment/31934608
has comment: http://stackoverflow.com/comment/31929764
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21173949
upvote count: 2
answers question: http://stackoverflow.com/q/21173949
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31919618
has comment: http://stackoverflow.com/comment/31934715

http://stackoverflow.com/a/21070721
score: 0
has comment: http://stackoverflow.com/comment/31687982
type: Answer
answers question: http://stackoverflow.com/q/21070699
has comment: http://stackoverflow.com/comment/31688687
has body: Declare the Chain member field inside of Bike, where it belongs. What you are asking for is not possible, nor is it really necessary.

http://stackoverflow.com/a/21177810
has body: As mentioned in the oracle docs Calling Java from Database Triggers ,You have to publish your Java method as procedure and have to call that procedure in the trigger. Have a look at the example in the above link or other example here
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21177723

http://stackoverflow.com/q/21168424
tagged with: sockets
tagged with: android
has comment: http://stackoverflow.com/comment/31866546
has title: Multiple HTTP POST over single socket
has comment: http://stackoverflow.com/comment/31866286
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31868882
has comment: http://stackoverflow.com/comment/31866488
tagged with: network-programming
has answer: http://stackoverflow.com/a/21169887
has answer: http://stackoverflow.com/a/21171768
has body: I am trying to send multiple HTTP POST over single socket connection , but EPIPE broken once I read inputstream. mBufferedWriter.write("POST " + "/base/mypath" + " HTTP/1.1" + "\r\n"); mBufferedWriter.write("Host: " + mIp + "\r\n"); mBufferedWriter.write("Content-Length: " + json.toString().length()"\r\n"); mBufferedWriter.write("Content-Type: application/json\r\n"); mBufferedWriter.write("Connection: Keep-Alive\r\n\r\n"); mBufferedWriter.write(json.toString() + "\r\n"); mBufferedWriter.flush(); My first POST will reach server. Am trying to achieve pipelining. Set keep-alive for socket also
has comment: http://stackoverflow.com/comment/31866418
score: 0
answer count: 2

http://stackoverflow.com/q/21079997
tagged with: arrays
has comment: http://stackoverflow.com/comment/31704805
tagged with: string
linked to: http://stackoverflow.com/q/12530380
accepted answer: http://stackoverflow.com/a/21083234
has comment: http://stackoverflow.com/comment/31707423
has title: How to replace an integer element in a 2d array with a string type, using a Random
score: 0
has answer: http://stackoverflow.com/a/21080085
has comment: http://stackoverflow.com/comment/31708073
has comment: http://stackoverflow.com/comment/31710004
possible better answer: http://stackoverflow.com/a/21080085
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31709108
has comment: http://stackoverflow.com/comment/31706609
has comment: http://stackoverflow.com/comment/31706406
has body: I have this table (2d array) and I'm using a Random utility from numbers 0-4 to select a row and column to replace a number with the letter "P" and I have everything but I get this. - Type mismatch: cannot convert from String to int - Type mismatch: cannot convert from Random to int - Type mismatch: cannot convert from Random to int Meanwhile this question How to change value of array element in 2D arrays? says you can just do someArray[row][column] = "x"; Here is what I have (I assume my problem is with using the random) import java.util.Random; public class Server{ private int number; private boolean pennyLanded; public Server() { int n = 0; number = n; pennyLanded = false; } public boolean pennyLanded() { return pennyLanded; } public void setPennyLanded() { pennyLanded = true; } public int getNumber() { return number; } public String toString() { if (pennyLanded) return "P"; else return "" + number; } public static int[][] tableMaker(){ int[][] table = new int[5][5]; for(int i=0; i&lt;table.length; i++){ for(int j=0; j&lt;table.length; j++){ if(i==2 &amp;&amp; j==2){ table[i][j] =3; } else if(i==0 || i==4){ table[i][j] = 1; } else if(j==4 || j==0){ table[i][j] = 1; } else if((i==1 || i==3) &amp;&amp; (j&gt;0 || j&lt;4)){ table[i][j] = 2; } else if((i==2 &amp;&amp; j==1) || (i==2 &amp;&amp; j==3)){ table[i][j] = 2; } } } for(int i=0; i&lt;table.length; i++){ for(int j=0; j&lt;table.length; j++){ System.out.print(table[i][j] + " "); } System.out.println(); } return table; } public static int[][] tossPenny(){ Random row = new Random(); Random column = new Random(); int[][] table = Server.tableMaker(); for(int i=0; i&lt;5; i++){ table[row.nextInt(4)][column.nextInt(4)] = -1; } return table; } } The table is printed in a Client class public class Client{ public static void main(String[] args){ System.out.println(Server.tableMaker()); } } I Don't know how simple of a fix this is, and I have searched I just have a particular problem The table is printed as so 1 1 1 1 1 …
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21083234
answer count: 2
tagged with: random
has comment: http://stackoverflow.com/comment/31710103

http://stackoverflow.com/a/21135976
has comment: http://stackoverflow.com/comment/31807619
has comment: http://stackoverflow.com/comment/31807551
has comment: http://stackoverflow.com/comment/31807447
downvote count: 0
has comment: http://stackoverflow.com/comment/31807984
has body: Your explanation is right. The compiler detects than stopReq is never modified in the loop and since it is not volatile, optimizes the while(!stopReq) instruction to while(true). Even though the value changes later, the thread does not even read it any more.
has comment: http://stackoverflow.com/comment/31810394
has comment: http://stackoverflow.com/comment/31808832
has comment: http://stackoverflow.com/comment/31808035
has comment: http://stackoverflow.com/comment/31808809
has comment: http://stackoverflow.com/comment/31810592
has comment: http://stackoverflow.com/comment/31810353
has comment: http://stackoverflow.com/comment/31809662
has comment: http://stackoverflow.com/comment/31807577
type: AcceptedAnswer
upvote count: 16
has comment: http://stackoverflow.com/comment/31807307
has comment: http://stackoverflow.com/comment/31810675
has comment: http://stackoverflow.com/comment/31807804
has comment: http://stackoverflow.com/comment/31809881
accepted answer of: http://stackoverflow.com/q/21135870
type: Answer
has comment: http://stackoverflow.com/comment/31810120
answers question: http://stackoverflow.com/q/21135870
has comment: http://stackoverflow.com/comment/31807661
has comment: http://stackoverflow.com/comment/31807784
has comment: http://stackoverflow.com/comment/31809750
has comment: http://stackoverflow.com/comment/31808281
has comment: http://stackoverflow.com/comment/31810229
score: 16
has comment: http://stackoverflow.com/comment/31808866

http://stackoverflow.com/comment/31884386
score: 0
type: AnswerComment
type: Comment
has text: also add to that, there are plugins in Quartz which job monitoring for you. Quartz is definitely a better implementation of scheduling
comment on: http://stackoverflow.com/a/21139735

http://stackoverflow.com/comment/31869198
has text: Yeah, I wasn't quite sure at how that'd work though.
type: QuestionComment
comment on: http://stackoverflow.com/q/21169743
score: 0
type: Comment

http://stackoverflow.com/a/21036689
accepted answer of: http://stackoverflow.com/q/21036530
score: 2
answers question: http://stackoverflow.com/q/21036530
has body: Its never a good idea to put (even the tiniest) business logic inside your view. The responsibility of the view part of MVC is to just , well, generate the view for the end user ! No processing , no business logics involved. So I suggest you handle duplication on the business logic end and then send the duplicate-free list over the view and display it
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/q/21142686
upvote count: 31
has comment: http://stackoverflow.com/comment/31822447
tagged with: java
linked to: http://stackoverflow.com/q/7143287
has comment: http://stackoverflow.com/comment/31819566
downvote count: 3
has comment: http://stackoverflow.com/comment/31819253
has comment: http://stackoverflow.com/comment/31820221
has answer: http://stackoverflow.com/a/21142687
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/18686199
linked to: http://stackoverflow.com/q/21077322
has title: Making a robust, resizable Swing Chess GUI
has comment: http://stackoverflow.com/comment/31822764
has comment: http://stackoverflow.com/comment/31819291
has comment: http://stackoverflow.com/comment/31823570
possible better answer: http://stackoverflow.com/a/21145798
has body: How would I go about making this resizable Chess GUI? Our company has been tasked with making a Chess game. It needs to work on Windows, OS X and Linux/Unix machines, and we have chosen Java to achieve this, while maintaining a common code-base (handy for both maintenance, and keeping costs down). My task is to create the GUI. The User Design Team has cleared the following spec. with the client. The chess game (Chess Champ) will be robust to resizing and straightforward, it includes: A tool-bar at the top, with UI components: New button Save button Restore button Resign button A label for providing messages to the player. On the left hand side of the game, we need an area which will be reserved for future use, it might include things like: Lists of captured pieces A selector for choice of piece when promoting pawns Game statistics Hints, etc. The details of this are are still being settled with the client and the Logic Team. So for the moment, simply mark it with a label containing ? as text. The rest of the GUI will consist of the chess board itself. It will have: The main area for the chess board. If the user points at a chess piece, it should show focus with a border. It should also be keyboard accessible. The client will be supplying multiple sprite sheets of chess pieces (of a variety of sizes, styles and colors) to allow the user to change the look of the game. The chess board will have labels indicating the columns (left to right: A, B, C, D, E, F, G &amp; H) and rows (top to bottom: 8, 7, 6, 5, 4, 3, 2 &amp; 1). The chess board and column/row labels will be bordered by a 1px black border, with an 8px padding around that. As the player increases the size of the game, the chess board should remain square, but otherwise fill the available space. The background color behind the chess board should be ochre, but in the mock-ups below we have made the area behind the chess board green in order to highlight the resize behavior. Chess Champ at minimum size, before a …
has answer: http://stackoverflow.com/a/21145798
has comment: http://stackoverflow.com/comment/31822860
tagged with: user-interface
accepted answer: http://stackoverflow.com/a/21142687
has comment: http://stackoverflow.com/comment/31825147
tagged with: layout-manager
favorite count: 0
score: 28
has comment: http://stackoverflow.com/comment/31829270
tagged with: swing
linked to: http://stackoverflow.com/q/19209650
has comment: http://stackoverflow.com/comment/33526484
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2561690

http://stackoverflow.com/a/21176691
score: 2
has comment: http://stackoverflow.com/comment/31881793
downvote count: 0
upvote count: 2
has body: You're reassigning the list variable here: public static void generateUsers(){ //called from a button called refreshList String s = ... call for the user list ... (s contains ', ' as well as the usernames) String[] users = s.split(", "); // to seperate only the usernames for(int i = 0; i &lt; users.length; i++){ listModel.addElement(users[i]); } list = new JList(listModel); // ******** here ********** } Which means that the JList reference by the list variable is not the same as the displayed JList. Solution: don't do this, don't re-assign the variable. Also, none of these methods or fields should be static. None.
has comment: http://stackoverflow.com/comment/31881839
has comment: http://stackoverflow.com/comment/31881820
answers question: http://stackoverflow.com/q/21176671
type: Answer
has comment: http://stackoverflow.com/comment/31881809

http://stackoverflow.com/a/21137820
answers question: http://stackoverflow.com/q/21132657
score: 4
has body: funny, after investigating nodejs source code i saw exec function use 'cmd /s /c [command]' then i try to run the same command without cmd. found out that i still get this message . turns out that this bug is related to cmd so i searched for it and came up with solution. for the right answer go here: https://stackoverflow.com/a/13343337/1211174 summary the answer: cmd has option of autorun. and this auto run faild. then cmd write to stderr and then many nodejs faild - because they just check for if (error != null) and not check for error.code ...
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/21116719
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21232521
downvote count: 0
accepted answer: http://stackoverflow.com/a/21232521
score: 1
tagged with: java
tagged with: resttemplate
tagged with: socketexception
has comment: http://stackoverflow.com/comment/31772189
type: Question
has title: java.net.SocketException: Invalid argument with RestTemplate
upvote count: 1
answer count: 1
has body: I'm using RestTemplate in order to send a post request. Something like this: restTemplate.postForObject(url, fetchImageDataRequest, SimpleImageHolder[].class); When I create restTemplate like that: restTemplate = new RestTemplate(); MappingJacksonHttpMessageConverter converter = new MappingJacksonHttpMessageConverter(); restTemplate.getMessageConverters().add(converter); Everything works fine. But when I use RestTemplate that is created in spring.xml and defined like this: I get an java.net.SocketException: Invalid argument exception. Trying to figure this issue. The full stacke trace: org.springframework.web.client.ResourceAccessException: I/O error: Invalid argument; nested exception is java.net.SocketException: Invalid argument at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:453) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:401) at org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:279)
favorite count: 0
tagged with: spring

http://stackoverflow.com/q/21101614
tagged with: weka
accepted answer: http://stackoverflow.com/a/21102055
answer count: 1
has body: I am using Weka to implement a bunch of NLP algorithms. For this, I want to write the datasets I create (from plain texts) to csv files. The instances are created properly. I have tested the instance creation process by manually checking very small parts of the dataset (e.g. just two texts with 10 words each). I have also used Weka's k-means clusterer directly on the instances I create, and it runs flawlessly. But, when I try to use CSVSaver to save the instances to a file, I get an indexOutOfBoundsException. As far as I can see, both the methods Saver#writeBatch() and Saver#writeIncremental() are looping all the way up to and including the length of the instance. That baffles me! Java is 0-indexed, and an instance object is also 0-indexed. So why is Weka looping until size() and not size() - 1? Am I missing something extremely obvious here? The relevant portion of the code is as follows: CSVSaver csvSaver = new CSVSaver(); csvSaver.setFieldSeparator("\t"); csvSaver.setFile(new File(optionSet.valueOf("doc-output").toString())); csvSaver.setMaxDecimalPlaces(3); csvSaver.setNoHeaderRow(false); csvSaver.setInstances(documentInstances); csvSaver.setRetrieval(AbstractSaver.INCREMENTAL); for (Instance instance : csvSaver.getInstances()) csvSaver.writeIncremental(instance); The very first iteration of the for loop writes the header row, which contains 346 elements (indexed from 0 to 345). Weka writes all of them, and then throws the following error: java.lang.IndexOutOfBoundsException: Index: 346, Size: 346 at java.util.ArrayList.rangeCheck(ArrayList.java:635) at java.util.ArrayList.get(ArrayList.java:411) at weka.core.Instances.attribute(Instances.java:341) at weka.core.AbstractInstance.toString(AbstractInstance.java:744) at weka.core.converters.CSVSaver.instanceToString(CSVSaver.java:578) at weka.core.converters.CSVSaver.writeIncremental(CSVSaver.java:472) Why is Weka going all the way to index 346, when even a Java beginner knows to stop at 345?
score: 0
type: AnsweredQuestion
tagged with: java
tagged with: indexoutofboundsexception
has answer: http://stackoverflow.com/a/21102055
type: Question
has title: Weka CSVSaver indexing issue

http://stackoverflow.com/q/21156888
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/21162101
has answer: http://stackoverflow.com/a/21162101
tagged with: buffer
accepted answer: http://stackoverflow.com/a/21156986
has comment: http://stackoverflow.com/comment/31847056
favorite count: 0
tagged with: c++
score: 2
has title: Converting C++ OpenGL to Java/LWJGL
has body: I am following the book OpenGL SuperBible: Sixth Edition, and they work with C++ there, however I prefer to program in Java, I am doing quite good at mapping all functions, LWJGL is after all pretty straight forward, however now I have some concerns. Given the following code in C++: GLuint buffer; //buffer id glGenBuffers(1, &amp;buffer); //generate an unique id glBindBuffer(GL_ARRAY_BUFFER, buffer); //bind buffer glBufferData(GL_ARRAY_BUFFER, 12 * 4, NULL, GL_STATIC_DRAW); //allocate data on GPU void *ptr = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); //obtain memory pointer on GPU memcpy(ptr, data, sizeof(data)); //copy data, which is an array of float[] glUnmapBuffer(GL_ARRAY_BUFFER); //done with copying I made this Java code: abId = glGenBuffers(); glBindBuffer(GL_ARRAY_BUFFER, abId); glBufferData(GL_ARRAY_BUFFER, ByteBuffer.allocateDirect(12).asFloatBuffer(), GL_STATIC_DRAW); FloatBuffer data; //declares FloatBuffer object data = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY, 12 * 4, null).asFloatBuffer(); //gets FloatBuffer to which we can write, allocate 12 floats * 4 [float length] data.put(0.25f).put(-0.25f).put(0.5f).put(1.0f) .put(-0.25f).put(-0.25f).put(0.5f).put(1.0f) .put(0.25f).put(0.25f).put(0.5f).put(1.0f); //put data, NOT backed by array glUnmapBuffer(GL_ARRAY_BUFFER); //unmap the buffer Everything seems pretty straightforward, I circumvent using an array of float[] by the FloatBuffer, this is not as important yet, but I wanted to know that I could get that technique to work. However one thing concerns me, that is that I cannot pass (ByteBuffer)null as second argument into glBufferData, as LWJGL gets a NPE then. So I've decided to allocate a buffer without elements, does this still follow the C++ idiom of putting NULL into there? Are there any performance concerns regarding this Java version vs the C++ version?
has comment: http://stackoverflow.com/comment/31846825
tagged with: lwjgl
downvote count: 1
has comment: http://stackoverflow.com/comment/31861775
type: AnsweredQuestion
upvote count: 3
tagged with: opengl
has answer: http://stackoverflow.com/a/21156986
tagged with: java

http://stackoverflow.com/comment/31736009
type: Comment
comment on: http://stackoverflow.com/q/21096929
score: 0
type: QuestionComment
has text: this has nothing to do with android, it is how arrays (not only string arrays) work in java.

grouplayout
type: Tag
tags question: http://stackoverflow.com/q/21075863
tag name: grouplayout

http://stackoverflow.com/comment/31888544
comment on: http://stackoverflow.com/a/21169284
has text: How should this interact with the user? Would they be able to scroll up if they want to?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31820271
comment on: http://stackoverflow.com/a/21127883
score: 0
type: AnswerComment
type: Comment
has text: Nice Answer. How did you create the animation?

http://stackoverflow.com/q/21053864
has title: parse a string in localStorage
possible better answer: http://stackoverflow.com/a/24968577
tagged with: http://stackoverflow.com/tag/html
has body: I have a string in localStorage localStorage.setItem("listOfNames","&lt;%= myList.getNames() %&gt;"); The string it get's is actually a vector converted into a string "[name1,name2,name3,name4]" I would like to be able to parse it after I put it in localStorage (I want to be able to search for a specific name with an index) How would I go about doing this? or would I need to even parse it if I could just traverse it?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21053897
tagged with: java
tagged with: local-storage
type: Question
has answer: http://stackoverflow.com/a/21053897
has answer: http://stackoverflow.com/a/24968577
has comment: http://stackoverflow.com/comment/31657336
tagged with: javascript
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31656430
tagged with: jsp

http://stackoverflow.com/comment/31648955
score: 1
has text: @MarkusMalkusch: Exactly. His code isn't thread-safe.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21049861

http://stackoverflow.com/q/21156558
type: Question
type: AnsweredQuestion
tagged with: reflection
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21156663
accepted answer: http://stackoverflow.com/a/21156663
upvote count: 1
answer count: 1
downvote count: 0
favorite count: 0
has body: I am using JAVA7. I have below method. public static &lt;T extends BaseClass&gt; T newObject(Class&lt;T&gt; classOfT, String someName) { SomeClass data = new SomeClass(); data.setName(someName); Class[] constructorSignature = new Class[] {SomeClass.class}; Object[] constructorArgs = new Object[] {data}; return returnNewObject(classOfT, constructorSignature, constructorArgs); } Now i have to write a generic method which will accept above parameters. Method should be generic. private static &lt;T extends BaseClass&gt; T returnNewObject(Class&lt;T&gt; classOfT, Class[] constructorSignature, Object[] constructorArgs) throws SomeException { try { Constructor&lt;T&gt; domainObjectConstructor = classOfT.getDeclaredConstructor(constructorSignature); return (T)domainObjectConstructor.newInstance(constructorArgs); } } Now how can i avoid below two lines? Class[] constructorSignature = new Class[] {SomeClass.class}; Object[] constructorArgs = new Object[] {data}; I simply took arrays of Class and Object just to make the returnNewObject method generic. Now how can i avoid above arrays and still make the returnNewObject method generic? returnNewObject method should take any class, any data and any class type to copy the data.
tagged with: generics
tagged with: java-ee-7
has title: How to improve below method logic?

http://stackoverflow.com/comment/31702305
type: Comment
type: QuestionComment
has text: Project Euler explicitly asks people not to post solutions online.
comment on: http://stackoverflow.com/q/21077678
score: 0

http://stackoverflow.com/q/21151189
has title: Serialize sub-class after super-class?
answer count: 1
has comment: http://stackoverflow.com/comment/31840392
has answer: http://stackoverflow.com/a/21151606
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31837119
has comment: http://stackoverflow.com/comment/31859691
score: 2
tagged with: java
tagged with: gson
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/31853580
has body: I cannot find any documentation on this, but it seems Gson serializes fields of sub-class before those of the super-class: class G9 { static class B { String s1 = "1"; String s2 = "2"; } static class C extends B { String s3 = "3"; } public static void main(String args[]) { System.out.println(new Gson().toJson(new C())); } } This program produces the following output: /cygdrive/c/Java/jdk1.8.0/bin/javac -classpath gson-2.1.jar -g G9.java &amp;&amp; /cygdrive/c/Java/jdk1.8.0/bin/java -classpath ".;gson-2.1.jar" G9 {"s3":"3","s1":"1","s2":"2"} I would like it to be the following: {"s1":"1","s2":"2","s3":"3"} I realize I can do this with a TypeAdapter but that essentially amounts to implementing serialization figuring out how to delegate deserialization to Gson OR implementing that as well. Is there an easier way to achieve this? I guess I am looking for a new FieldOrderingTypeAdapter&lt;C&gt;(C.class, "s1", "s2", "s3") or GsonBuilder.setFieldOrder("s1", "s2", "s3") or something. I am using Gson 2.1.

http://stackoverflow.com/q/21136600
has title: How to get workspace path in Eclipse Plugin project?
has comment: http://stackoverflow.com/comment/31808231
score: -2
has body: I have an Eclipse plugin project and I'm trying to get the path of the workspace the project is running in. (not the path of the plugin's workspace) All what I found is the following code which gives the workspace of the plugin: String url = ResourcesPlugin.getWorkspace().getRoot().getLocation().toString(); Is there any way to get the path of the current workspace (and not the workspace of the plugin)?
has comment: http://stackoverflow.com/comment/31971934
upvote count: 1
accepted answer: http://stackoverflow.com/a/21136756
type: AnsweredQuestion
tagged with: java
downvote count: 3
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/31808303
answer count: 1
has comment: http://stackoverflow.com/comment/31808542
tagged with: eclipse-plugin
favorite count: 0
has answer: http://stackoverflow.com/a/21136756

http://stackoverflow.com/comment/31801856
score: 2
comment on: http://stackoverflow.com/q/21132865
type: Comment
type: QuestionComment
has text: Could you provide what you already tried?

http://stackoverflow.com/a/21075713
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/31699273
has body: As your comments on this question show, the reason your Toasts aren't showing is because of your waitFor() method. As described, this performs a pointless calculation, which a) wastes precious CPU time (and therefore battery) and b) performs this on the UI thread. This means that anything that should happen on the UI thread won't happen all the time waitFor() is running, including Toasts. You'll have to include some sort of threading here to get over this issue (the Android Developers website has a good tutorial). You'll want the dispDot, dispLine and waitFor calls to happen on a background thread. Bear in mind that if any of these three methods interact with your UI, they must do that back on the UI thread (see Communicating with the UI thread in the linked tutorial). Previous (wrong) answer You're creating your Toasts, but not calling show() on them! It's a very easy mistake to make. Just change the line: toast = Toast.makeText(MorseActivity.this, "Displaying "+character,Toast.LENGTH_LONG); to toast = Toast.makeText(MorseActivity.this, "Displaying "+character,Toast.LENGTH_LONG).show();
has comment: http://stackoverflow.com/comment/31698341
has comment: http://stackoverflow.com/comment/31698181
score: 2
answers question: http://stackoverflow.com/q/21075484
has comment: http://stackoverflow.com/comment/31723800
has comment: http://stackoverflow.com/comment/31700787
has comment: http://stackoverflow.com/comment/31707054
type: Answer
has comment: http://stackoverflow.com/comment/31697311
has comment: http://stackoverflow.com/comment/31699490
has comment: http://stackoverflow.com/comment/31704292

http://stackoverflow.com/comment/31633249
type: Comment
comment on: http://stackoverflow.com/a/21040864
type: AnswerComment
has text: @itsjeyd Is your foo of type `List<? extends Promise<? extends Boolean>> foo`?
score: 0

http://stackoverflow.com/q/21068708
tagged with: resultset
type: UnansweredQuestion
has title: ResultSet is false in executeQuery Mysql - Java even when row exist
has comment: http://stackoverflow.com/comment/31684409
tagged with: java
tagged with: executequery
tagged with: mysql
tagged with: prepared-statement
type: Question
has comment: http://stackoverflow.com/comment/31684378
answer count: 2
has body: I am fetching two columns from a table in MySql using preparedStatement in Java.The query is valid and returns rows if I execute it on mySql DB directly. but for this method call, ResultSet has values "false" on each ResultSet.next() call. Below is the code: private ResultSet fetchFriends(int lActProfId) throws SQLException { // TODO Auto-generated method stub String selectRelationQry= "SELECT friend_id, type FROM fs_relationship WHERE profile_id =?"; System.out.println("---- In method FetchAndInsertInWall()-&gt;fetchFriends - Qry: "+selectRelationQry); pst = lCon.prepareStatement(selectRelationQry); pst.setInt(1, lActProfId); System.out.println("lActProfId: "+ lActProfId ); ResultSet res3 = pst.executeQuery(); System.out.println("---- temp--- In method FetchAndInsertInWall()-&gt;fetchFriends query has no Results"); if(!res3.next()){ System.out.println("---- In method FetchAndInsertInWall()-&gt;fetchFriends query has no Results"); } else {System.out.println("Elements in res3: "+res3.next() + res3.next() + res3.next()); } pst = null; return res3; } I am getting following output on console: ---- In method FetchAndInsertInWall()-&gt;fetchFriends - Qry: SELECT friend_id, type FROM fs_relationship WHERE profile_id =? lActProfId: 5002 ---- temp--- In method FetchAndInsertInWall()-&gt;fetchFriends query has no Results Element in res31: false ----&gt; WallInsertions Failed for Uid: 5002 java.sql.SQLException: Illegal operation on empty result set. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:920) at com.mysql.jdbc.ResultSetImpl.checkRowPos(ResultSetImpl.java:855) at com.mysql.jdbc.ResultSetImpl.getInt(ResultSetImpl.java:2710) at com.mysql.jdbc.ResultSetImpl.getInt(ResultSetImpl.java:2851) at com.fs.javadbact.FetchDataAndInsertInWall.fetchAndInsertInWall(FetchDataAndI…
has answer: http://stackoverflow.com/a/21069215
has comment: http://stackoverflow.com/comment/31684800
score: 0
has comment: http://stackoverflow.com/comment/31684494
has comment: http://stackoverflow.com/comment/31700303
has answer: http://stackoverflow.com/a/21068914

http://stackoverflow.com/a/21144570
score: 8
type: Answer
downvote count: 0
upvote count: 8
answers question: http://stackoverflow.com/q/21144550
has comment: http://stackoverflow.com/comment/31823015
has comment: http://stackoverflow.com/comment/31823231
has body: Yes to both, except that (value++) evaluates to the old value, whereas (value = value + 1) evaluates to the new value. The direct equivalent of (value = value + 1) within an expression is (++value). Note that neither of them are thread-safe. For added fun, here are two more equivalent options: value += 1; value -= -1;

http://stackoverflow.com/comment/31602282
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21023186
has text: I edited my answer to demonstrate splitting the Date back into two strings.
type: AnswerComment

http://stackoverflow.com/comment/31664793
type: AnswerComment
comment on: http://stackoverflow.com/a/21058140
has text: sorry, you're right. The code works find without (if(curr.left==null) break A; if(curr.right==null) break A;). See my answer below.
type: Comment
score: 0

http://stackoverflow.com/a/21122237
score: 1
has body: Not having deeply investigated the current case, I see a difference when I use an AnchorPane instead of the StackPane to place the Button on. By changing the label text of the Button by the mouseMoved-Event the Pane is rendered (layout is requested). With a StackPane placing all it's children in the center of itself the Button's position is reset to the center of the Pane. When you have a look into the layoutChildren method of StackPane you'll see a call to resizeRelocate. So layoutX and layoutY are reset and the button moves back to the center position (or whatever you set the alignment of the StackPane to). So I think this is a correct behavior of the StackPane and I recommend to use another Pane, e.g. AnchorPane.
upvote count: 1
answers question: http://stackoverflow.com/q/21118394
type: Answer
downvote count: 0

jython-2.5
tag name: jython-2.5
type: Tag
tags question: http://stackoverflow.com/q/21045893

http://stackoverflow.com/a/21083721
has body: You should have a look at this Q/A: How to view memory allocation stacktrace in Java VisualVM - a heap profile, which is a "memory allocation stacktrace" is what you want. Here is a nice tutorial : Analyzing Memory Leak in Java Applications using VisualVM. In general, there is several ways howto diagnose this problem, using a Java profiler: use CPU profiling, the best in a instrumentation mode, this will record all method invocations, look at String.&lt;init&gt; - this will show you all the possible methods that execute new String(). The best tools are e.g. jProfiler, Java Mission Control, where you can easily identify all the callers of the String.&lt;init&gt;. The same applies for VisualVM. I think using CPU profiling is the most straightforward way of idenifying where in the code the new String occurs the most. collect a heap dump in MAT, and analyze that, this will allow you to traverse the heap, you will again search for String finding all the references to a String object. use Heap profiling option of a Java profiler (e.g. VisualVM), is similar to collecting a heap dump, only this heap profiling is usually collected online. So just enable heap profiling in VisualVM and follow the references from the String instances (i.e. find objects referencing String).
downvote count: 0
answers question: http://stackoverflow.com/q/21043681
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/comment/31767905
has text: please to read [Oracle tutorial Performing Custom Painting](http://docs.oracle.com/javase/tutorial/uiswing/painting/index.html), rest of you can see in [posts by (leader here) @MadProgrammer](http://stackoverflow.com/search?tab=newest&q=user%3a992484%20paintcomponent)
comment on: http://stackoverflow.com/a/21114113
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/31622073
comment on: http://stackoverflow.com/a/21034440
score: 0
type: AnswerComment
has text: @bimm3rBoy I added code to my answer to add to the end of the list.
type: Comment

http://stackoverflow.com/comment/31753688
comment on: http://stackoverflow.com/a/21106126
has text: No, it does not changed
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21028944
score: 0
has comment: http://stackoverflow.com/comment/31632970
answers question: http://stackoverflow.com/q/21022426
type: Answer
has body: You're using the "imaps" protocol but setting properties for the "imap" protocol. Change your property names to "mail.imaps.*".

http://stackoverflow.com/comment/31806381
type: QuestionComment
comment on: http://stackoverflow.com/q/21112946
has text: *"after that, HTML tags does not work anymore. However I need them"* Why? Can you show us a typical 'actual' document that might need it? And by 'actual' I mean it can use nonsense text (e.g. blocks of [Lorem ipsum](http://en.wikipedia.org/wiki/Lorem_ipsum)) wherever you want, so long as the it *looks* a lot like you are actually needing. As an aside, can you produce this effect in plain HTML as seen in a browser? I actually expect that HTML/CSS is not well suited to the task at all.
score: 0
type: Comment

http://stackoverflow.com/comment/31776065
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21117026
has text: @TazMan You're very welcome. Because I spend so much time there, [here's](http://docs.spring.io/spring/docs/4.0.1.BUILD-SNAPSHOT/spring-framework-reference/html/mvc.html#mvc-ann-requestparam) the link to the documentation that explains this behaviour.
score: 0

http://stackoverflow.com/q/21150934
accepted answer: http://stackoverflow.com/a/21152586
tagged with: resultset
possible better answer: http://stackoverflow.com/a/21151214
has answer: http://stackoverflow.com/a/21151214
tagged with: swing
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/13737417
tagged with: mysql
has answer: http://stackoverflow.com/a/21152948
has body: Note: this is not a duplicate, I have already checked out: I can't get my JTable to show anything and I get the Jtable but no data Although these seem to have very similar problems, they aren't the same as what I'm experiencing. Let me explain: I have a GUI that has several JTables being populated from a MySQL database. On my initial GUI, the table is working fine. However, at one point I take the user to a new JFrame. On this frame, for some reason, the table shows up and it's populated with the column names, but no data. I can't for the life of me figure out why. Here is the code from my first GUI that WORKS: iTable = new JTable(writeItemResult(res4)); iTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); iTable.getColumnModel().getColumn(0).setPreferredWidth(27); iTable.getColumnModel().getColumn(1).setPreferredWidth(375); iTable.getColumnModel().getColumn(2).setPreferredWidth(150); iTable.getColumnModel().getColumn(0).setResizable(false); sorter = new TableRowSorter<TableModel>(iTable.getModel()); iTable.setRowSorter(sorter); JScrollPane scrollpane3 = new JScrollPane(iTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollpane3.setPreferredSize(new Dimension(500, 150)); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 16; c.gridwidth = 6; pane.add(scrollpane3, c); My writeItemResult method: public static DefaultTableModel writeItemResult (ResultSet res4) throws SQLException { ResultSetMetaData metaData = res4.getMetaData(); Vector<String> columnNames = new Vector<String>(); int columnCount = metaData.getColumnCount(); for (int column = 1; column <= columnCount; column++) { columnNames.add(metaData.getColumnName(column)); } Vector<Vector<Object>> data = new Vector<Vector<Object>>(); while (res4.next()) { Vector<Object> vector = new Vector<Object>(); for (int columnIndex = 1; columnIndex <= columnCount; columnIndex++) { vector.add(res4.getObject(columnIndex)); } data.add(vector); } return new DefaultTableModel…
tagged with: prepared-statement
type: Question
has title: ResultSet populating JTable column names but not data
has answer: http://stackoverflow.com/a/21152586
score: 0
answer count: 3
linked to: http://stackoverflow.com/q/13732705

file
type: Tag
tags question: http://stackoverflow.com/q/21128440
tags question: http://stackoverflow.com/q/21169789
tags question: http://stackoverflow.com/q/21072109
tags question: http://stackoverflow.com/q/21060992
tags question: http://stackoverflow.com/q/21061438
tags question: http://stackoverflow.com/q/21163201
tag name: file
tags question: http://stackoverflow.com/q/21040854
tags question: http://stackoverflow.com/q/21123052
tags question: http://stackoverflow.com/q/21132861
tags question: http://stackoverflow.com/q/21140940
tags question: http://stackoverflow.com/q/21170551
tags question: http://stackoverflow.com/q/21059703
tags question: http://stackoverflow.com/q/21083171
tags question: http://stackoverflow.com/q/21104344
tags question: http://stackoverflow.com/q/21115336
tags question: http://stackoverflow.com/q/21076104
tags question: http://stackoverflow.com/q/21184057
tags question: http://stackoverflow.com/q/21059979
tags question: http://stackoverflow.com/q/21086669
tags question: http://stackoverflow.com/q/21174246
tags question: http://stackoverflow.com/q/21062021
tags question: http://stackoverflow.com/q/21069098
tags question: http://stackoverflow.com/q/21022180
tags question: http://stackoverflow.com/q/21176870
tags question: http://stackoverflow.com/q/21062226
tags question: http://stackoverflow.com/q/21141269
tags question: http://stackoverflow.com/q/21064084
tags question: http://stackoverflow.com/q/21141308
tags question: http://stackoverflow.com/q/21141367
tags question: http://stackoverflow.com/q/21138971
tags question: http://stackoverflow.com/q/21037994
tags question: http://stackoverflow.com/q/21110921
tags question: http://stackoverflow.com/q/21038812
tags question: http://stackoverflow.com/q/21033928
tags question: http://stackoverflow.com/q/21020424
tags question: http://stackoverflow.com/q/21126780
tags question: http://stackoverflow.com/q/21055249
tags question: http://stackoverflow.com/q/21174574
tags question: http://stackoverflow.com/q/21055007
tags question: http://stackoverflow.com/q/21056781
tags question: http://stackoverflow.com/q/21084393
tags question: http://stackoverflow.com/q/21062167
tags question: http://stackoverflow.com/q/21142791
tags question: http://stackoverflow.com/q/21125318
tags question: http://stackoverflow.com/q/21077097

http://stackoverflow.com/a/21052786
score: 1
has body: In Java the assignment to references and primitives are atomic except for the 64bit primitive types long and double. Assignments to Java longs and doubles can be made atomic by declaring them with the volatile modifier. See: Are 64 bit assignments in Java atomic on a 32 bit machine? This is so because the Java VM specification requires it in order for the VM to be Java compliant. Scala runs on top of a standard Java VM and so will also provide the same guarantees as Java with respect to assignments unless they start using JNI. One of the problems with C/C++ (and one of its strengths) is that both languages allow very fine grained mapping of data structures to memory addresses. At this level, whether writes to memory are atomic or not depend very much on the hardware platform. For instance, CPU's are usually unable to atomically read, let alone write to variables that are not aligned appropriately. e.g. When 16bit variables aren't aligned to even addresses, or when 32bit variables aren't aligned to addresses that are a multiple of 4, and so on. It gets worse when the variable extends beyond one cache line into the next, or beyond one page into the next. Hence C does not guarantee that assignments will be atomic.
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21045669
type: Answer
has comment: http://stackoverflow.com/comment/31656040

http://stackoverflow.com/q/21063045
has comment: http://stackoverflow.com/comment/31673737
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21063263
type: Question
has comment: http://stackoverflow.com/comment/31673561
score: 0
has comment: http://stackoverflow.com/comment/31673719
answer count: 3
has body: I can parse the file and I can read out the contents of the file, but I am unable to search for a specific word in the file or count the number of words in the file: Code below: public class Manager{ private String[] textData; private String path; public String loadFile (String file_path){ return path= file_path; } public String [] openFile() throws IOException{ FileReader fr = new FileReader(path); BufferedReader textReader = new BufferedReader (fr); int numberOfLines = readLines(); textData = new String[numberOfLines]; int i; for (i=0; i &lt; numberOfLines; i++) { textData[i] = textReader.readLine(); } textReader.close( ); return textData; } int readLines() throws IOException{ FileReader file_to_read = new FileReader(path); BufferedReader bf = new BufferedReader (file_to_read); String aLine; int numberOfLines = 0; while ((aLine =bf.readLine()) !=null){ numberOfLines++; } bf.close(); return numberOfLines; } } private int findText(String s){ for (int i = 0; i &lt; textData.length; i++){ if (textData[i] != null &amp;&amp; textData[i].equals(s)){ return i; } } return -1; } public boolean contains(String s){ for(int i=0; i&lt;textData.length; i++){ if(textData[i] !=null &amp;&amp; textData[i].equals(s)){ return true; } } return false; } public int count(){ int counter = 0; for (int i = 0; i &lt; textData.length; i++){ if (textData[i] != null) counter++; } return counter; } } My other Class: ublic class Runner { private String fileInput; private Scanner scanner = new Scanner(System.in); private boolean keepRunning= true; private Manager m = new Manager(); public static void main(String[] args) throws Exception { new Runner(); } public Runner() throws Exception{ do { System.out.println("--------------------------------------------------"); System.out.println("\t\t\t\tText Analyser"); System.out.println("--------------------------------------------------"); System.out.println("1)Parse a File"); System.out.println("2)Parse a URL"); System.out.println("3)Exit"); System.out.…
has title: Parse a file into an array and then search for words in the file, count the words in the file
tagged with: java
has comment: http://stackoverflow.com/comment/31673692
has answer: http://stackoverflow.com/a/21063628
has answer: http://stackoverflow.com/a/21063177
has comment: http://stackoverflow.com/comment/59695573

http://stackoverflow.com/q/21148241
type: UnansweredQuestion
has title: Java Hibernate populate transient property
has comment: http://stackoverflow.com/comment/31831222
tagged with: spring
has answer: http://stackoverflow.com/a/21148645
tagged with: java
tagged with: hibernate
type: Question
has body: I have several entities that have transient properties that I would like to populate from the sql query. I have tried several things but have not found the correct combination yet. here is an example entity @Id @GeneratedValue(strategy=GenerationType.AUTO) long id; @Size(max=1000) String image_url; @Transient boolean liked; @Transient long numLikes; **getters and setters** for persistent properties public boolean isLiked() { return liked; } public void setLiked(boolean liked) { this.liked = liked; } public long getNumLikes() { return numLikes; } public void setNumLikes(long numLikes) { this.numLikes = numLikes; } I have tried using the @Basic anotation and setting it's fetch method to eager @Basic(fetch = FetchType.EAGER) on the getters but that didn't seem to do anything. I've seen it set to lazy as well. Am I missing anything in here that would cause a column name not be mapped to one of these transient properties? here is my impl code. SQLQuery query = getCurrentSession().createSQLQuery("" + "SELECT * ,count(likes1.liked) as numLikes " + "FROM aboutme " + "left JOIN " + "(" + " select liked, likedObject_id " + " from likes " + " where liked = 1" + ") as likes1 ON aboutme.id = likes1.likedObject_id " + "left join " + "(" + " select likedObject_id, liked " + " from likes " + " where liked = 1 and profile_id = :id" + ") as likes2 on likes2.likedObject_id = aboutme.id " + "WHERE aboutme.profile_id = :id " + "group by aboutme.id"); query.addEntity(AboutMe.class); query.setParameter("id",id); return query.list(); I've tried using the SQLQuery query = ..."Select count(value that returns properly) as {object.numLikes}..." query.addEntity("object",Object.class), I get an error here that says it can't find the column name for property [property] for alias [alias] What am I doing wrong? Transient properties are probably not the way to go for what I am trying to do. what I need to figure out is how to map these derived columns to an object that I can return to the front end.…
has answer: http://stackoverflow.com/a/21152005
score: 0
answer count: 2
tagged with: sql
has comment: http://stackoverflow.com/comment/31830474

http://stackoverflow.com/q/21073021
answer count: 2
has title: use java and .net in same project
tagged with: java
has comment: http://stackoverflow.com/comment/31692069
has comment: http://stackoverflow.com/comment/31692513
has body: I am trying to develop a small project in college. My team mates want to go for Java technology while I am more interested in .net. Is it possible to develop the web site using Java and then redirecting it to .net(asp.net,which is our final module)? So that I can work on .net module while letting my friends work on Java. Summing it up, Is it possible to develop the project(web site) using java and .net both(in the same project)? I googled it but didnt found anything relevant. can you please help.
score: 2
downvote count: 0
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/21073355
tagged with: asp.net
favorite count: 0
has answer: http://stackoverflow.com/a/21073262
upvote count: 2

http://stackoverflow.com/comment/31831342
has text: do you even ASCII table?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21148726

http://stackoverflow.com/comment/31707323
type: Comment
comment on: http://stackoverflow.com/a/21080843
type: AnswerComment
has text: I did the homework, I just had trouble figuring out the errors I recieved
score: 0

http://stackoverflow.com/a/21030512
answers question: http://stackoverflow.com/q/21029022
has body: To fix this, I actually ended up breaking the downloadImage method (and a couple others) out of the ImageManager class into their own separate non-static class. The ImageManager is still a static class now, but it's not causing any problems and the app is not crashing. So, it appears that the problem was the Dropbox API call(s) that I was making from a static context, but I don't know why exactly. I'm happy enough with what I've got now, though.
type: Answer
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/q/21076023
has comment: http://stackoverflow.com/comment/31697368
type: Question
has body: I have this DataSource bean below which creates a datasource using my Hibernate properties. @Bean public DriverManagerDataSource dataSource() { DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setUrl(env.getProperty("hibernate.connection.url")); dataSource.setUsername(env.getProperty("hibernate.connection.username")); dataSource.setPassword(env.getProperty("hibernate.connection.password")); return dataSource; } I have the spring-jdbc jar depency set up in Maven. I also have the relevant classes imported with no compile errors. org.springframework spring-jdbc 4.0.0.RELEASE When I initialize my application, I get a java.lang.ClassNotFoundException: org.springframework.jdbc.datasource.DriverManagerDataSource. Would anyone know why my application would be unable to find this class?
has comment: http://stackoverflow.com/comment/31697932
has answer: http://stackoverflow.com/a/21076488
has comment: http://stackoverflow.com/comment/31697770
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/31697973
has title: Defining Spring DataSource programmatically gets me ClassNotFoundException
favorite count: 0
type: UnansweredQuestion
tagged with: maven
tagged with: spring
tagged with: spring-mvc
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/31697644

http://stackoverflow.com/comment/31841226
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21153707
score: 0
has text: JNLP file can be run only via javaws (installed on system) i.e it rely on System JRE. Where as applets need only java plugin on browser(provided by every browser).Applets doesn't depend upon system's JRE

http://stackoverflow.com/a/21175871
answers question: http://stackoverflow.com/q/21175810
has body: + and [] are not alphabetical, so you are treating them the same way you treat whitespace. Character.isWhitespace can help you solve your problem.
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/31964551
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21212814
type: AnswerComment
has text: Your code is amazing i must admit, but i can't exactly get what it does. What i understood generally is that you traverse the object in a BFS fashion, and you keep reference for each object you serialize in a HashMap then you write it. Can you describe generally how your method works ? (maybe some comments or just a general description)

http://stackoverflow.com/q/21084279
has comment: http://stackoverflow.com/comment/31713122
has answer: http://stackoverflow.com/a/21084346
has answer: http://stackoverflow.com/a/21084392
accepted answer: http://stackoverflow.com/a/21084392
has title: How to create multiple JSON array
has comment: http://stackoverflow.com/comment/31713221
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31713153
has body: I was looking this for creating JSON and the output is { "age":100, "name":"mkyong.com", "messages":["msg 1","msg 2","msg 3"] } But i want an array of 10 times like this { "engine": "Trident", "browser": "Internet Explorer 4.0", "platform": "Win 95+", }, { "engine": "Trident", "browser": "Internet Explorer 5.0", "platform": "Win 95+", }, { "engine": "Trident", "browser": "Internet Explorer 5.5", "platform": "Win 95+", }, And this is the way I tried import java.io.FileWriter; import java.io.IOException; import org.json.simple.JSONArray; import org.json.simple.JSONObject; public class TestJson { public static void main(String[] args) { JSONObject obj=null; obj = new JSONObject(); for(int i=0;i&lt;10;i++) { obj.put("engine", "mkyong.com"); obj.put("browser", i); obj.put("platform", i); //obj.put("messages", list); } try { FileWriter file = new FileWriter("c:\\test.json"); file.write(obj.toJSONString()); file.flush(); file.close(); } catch (IOException e) { e.printStackTrace(); } System.out.print(obj); } } but this only prints 1 json { "engine": "Trident", "browser": "Internet Explorer 4.0", "platform": "Win 95+", }
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/21084346
type: Question
has comment: http://stackoverflow.com/comment/31713475
score: 0
answer count: 2

http://stackoverflow.com/q/21080295
has body: I'm working with Spring batch and trying to build TASKLET with two 'ORM' frameworks: use jdbcTemplate for simple queries, and JOOQ framework for more complex query. Here is a part of spring config: <property name="dataSource" ref="dataSourceDbcp_MySQL" /> <property name="transactionManager" ref="transactionManager" /> <property name="jobRepository" ref="jobRepository" /> <chunk reader="multiResourceReader" processor="itemProcessor" writer="itemWriter" commit-interval="250" /> <property name="dataSourceTransactionManager" ref="transactionManager" /> I initialise my ORMs at setter in com.myexample.writer.JdbcSequenceWriter: private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate2; private DSLContext dslContext; public void setDataSourceTransactionManager(DataSourceTransactionManager trxManager) { this.jdbcTemplate = new JdbcTemplate(trxManager.getDataSource()); this.jdbcTemplate2 = new JdbcTemplate(trxManager.getDataSource()); dslContext = DSL.using(trxManager.getDataSource(), SQLDialect.MYSQL); } Both jdbcTemplate's has one session and I can INSERT a record using 'jdbcTemplate', and find this record using SELECT with 'jdbcTemplate2'. But if try to INSERT a record with any 'jdbcTemplate' and find it using dslContext (JOOQ ORM) I have empty result. I undarstand that Spring Batch use some tricky tansaction manager, witch rollback all the operation if 'writer' can't finish all it's operations. But how can I synchronize another framework with single transaction manager?
has answer: http://stackoverflow.com/a/21080606
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: transactionmanager
type: Question
tagged with: java
has title: How to synchronize JOOQ with SpringBatch JdbcTemplate
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42045729
favorite count: 0
tagged with: spring-batch
tagged with: jooq

http://stackoverflow.com/a/70610305
answers question: http://stackoverflow.com/q/21084830
downvote count: 0
has body: One solution is to execute the DNS resolution on a different thread which is given only a certain amount of time to complete. Here's a simple utility that can help you do this: public class TimeSliceExecutor { public static class TimeSliceExecutorException extends RuntimeException { public TimeSliceExecutorException(String message, Throwable cause) { super(message, cause); } } public static void execute(Runnable runnable, long timeoutInMillis) { ExecutorService executor = Executors.newSingleThreadExecutor(); try { Future<?> future = executor.submit(runnable); getFuture(future, timeoutInMillis); } finally { if (executor != null) { executor.shutdown(); } } } public static <T> T execute(Callable<T> callable, long timeoutInMillis) { ExecutorService executor = Executors.newSingleThreadExecutor(); try { Future<T> future = executor.submit(callable); return getFuture(future, timeoutInMillis); } finally { if (executor != null) { executor.shutdown(); } } } public static <T> T getFuture(Future<T> future, long timeoutInMillis) { try { return future.get(timeoutInMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new TimeSliceExecutorException("Interrupton exception", ex); } catch (ExecutionException ex) { throw new TimeSliceExecutorException("Execution exception", ex); } catch (TimeoutException ex) { throw new TimeSliceExecutorException(String.format("%dms timeout reached", timeoutInMillis), ex); } } } Then build the socket along these lines: private Socket buildSocket() throws IOException { final Socket socket = new Socket(); socket.setSoTimeout(socketTimeout); socket.connect(new InetSocketAddress(resolveHost(host, dnsTimeout), port), connectionTimeout); return socket; } private static InetAddress resolveHost(String host, long timeout) throws IOException { try { return TimeSliceExecutor.execute(() -> InetAddress.getByName(host), timeout); } catch (TimeSliceExecutor.TimeSliceExecutorException ex) { throw new UnknownHostE…
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/31753237
has text: Why are you synchronizing on some random Object? Try using **one** Object instance if you want to actually *synchronize* on that object. Otherwise, you need to synchronize the method (or at the block level). And use a [Lock](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/Lock.html) if you want a lock.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21105869

http://stackoverflow.com/q/21163424
has comment: http://stackoverflow.com/comment/31964164
has comment: http://stackoverflow.com/comment/31963687
has comment: http://stackoverflow.com/comment/31889338
tagged with: java
has comment: http://stackoverflow.com/comment/31887477
has comment: http://stackoverflow.com/comment/31963286
has comment: http://stackoverflow.com/comment/31964269
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31857469
tagged with: kerberos
score: 2
has body: I have configured Kerberos for various authentication purposes. OS command line tools are working and return renewable tickets with a configurable lifetime. I now need to obtain tickets in a custom application and store them away in a ticket cache file that I can use with any Kerberos system tool. Since the custom application is Java-based, it seems most natural to use Java means to authenticate and deal with the tickets. I have been following the example given in JAAS Authentication Tutorial and successfully authenticated to my Kerberos KDC. Now, I would like to Fine tune the properties of the obtained TGT ticket. What I get is a non-renewable ticket with unlimited lifetime. Instead, I would like to request a renewable ticket with configurable lifetime, renewable lifetime etc. Store the obtained ticket into a ticket cache file for use outside the sample application (e.g. command line kerberos utilities). I do have two open questions: How can I configure the login context to obtain tickets with the desired settings? How can I extract the credentials from the authenticated subject and save them into a ticket cache file? Update: Digging into the code, it seems that sun.security.krb5.KrbAsReqBuilder is used to do the Kerberos communication. The lifetime options seem to be hardcoded in there, although sun.security.krb5.KrbAsReq allows to specify them. Seems I might need to take another route to get what I want. Update2: After reviewing other options, I have decided to use a modified version of the original C source code for MIT Kerberos' kinit tool instead of using Java at all.
downvote count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/31888571
has comment: http://stackoverflow.com/comment/31890501
favorite count: 0
has comment: http://stackoverflow.com/comment/31964507
type: Question
tagged with: credentials
has title: Java Kerberos login - store credentials
upvote count: 2
has comment: http://stackoverflow.com/comment/31905859

http://stackoverflow.com/comment/31890012
type: QuestionComment
has text: yup. i already know it @alex2410 but i can read and println the lines of text and its actually working but if i set this on JTextArea, it shows the NPE
comment on: http://stackoverflow.com/q/21181459
score: 0
type: Comment

http://stackoverflow.com/a/21041721
type: Answer
answers question: http://stackoverflow.com/q/21040871
score: 0
has body: I Got it from this link Problem when using JXL Formula like SUM() AVG() STDEV() returns #VALUE! when it refers values from another sheet String filename = "C:\\input.xls"; WorkbookSettings ws = new WorkbookSettings(); ws.setLocale(new Locale("en", "EN")); WritableWorkbook workbook = Workbook.createWorkbook(new File(filename), ws); WritableSheet s = workbook.createSheet("Input", 0); WritableSheet s1 = workbook.createSheet("Output", 1); s1.addCell(new Number(3, 0, 5)); s1.addCell(new Number(3, 1, 6)); s1.addCell(new Number(3, 2, 1)); s1.addCell(new Number(3, 3, 6)); s1.addCell(new Number(3, 4, 1)); Formula formula = new Formula(3,5,"AVERAGE(D1:D5)"); s.addCell(formula);
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21040871

http://stackoverflow.com/a/21054536
downvote count: 1
answers question: http://stackoverflow.com/q/21054415
score: 4
upvote count: 5
has comment: http://stackoverflow.com/comment/31657695
type: Answer
has body: You can't explicity sort the HashMap, but can sort the entries. Maybe something like this helps: // not yet sorted List&lt;Integer&gt; intList = new ArrayList&lt;Integer&gt;(map.values()); Collections.sort(intList, new Comparator&lt;Integer&gt;() { public int compare(Integer o1, Integer o2) { // for descending order return o2 - o1; } });
has comment: http://stackoverflow.com/comment/31657734
has comment: http://stackoverflow.com/comment/31657843

http://stackoverflow.com/a/21047017
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/21040337
accepted answer of: http://stackoverflow.com/q/21040337
has body: If the select doesn't see the rows produced by the insert, then the code you're running doesn't do what you think. The only ways this can really happen are: Each statement is run in autocommit mode, the insert fails, and you swallow the exception. Each statement is being run in its own new transaction, which remains open and uncommitted - so the insert is in a different not-yet-committed tx to the select. The insert or select don't do what you think they do. To tell you more, it would be necessary to see the code - both the client code, and the generated SQL.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31710508
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21082817
has text: As it is right now, I have no idea what your problem is. You say you have graphics displayed in your frame, but how is it displayed?

http://stackoverflow.com/q/21032551
tagged with: java
has title: Classloader to isolate a jar (class identity crisis)
upvote count: 1
has answer: http://stackoverflow.com/a/21032765
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31646535
has body: I'm using jarX that has embedded dependencies that conflict with my own dependencies, so I'm creating a classloader to isolate jarX's dependencies from my main classloader. jarX is outside my app's classpath, but my classes that use jarX's classes are in my classpath, so when I instantiate my classes loaded via the custom classloader, I run into the class identity crisis in the form of ClassCastException as the JVM's version of my classes are considered different from those loaded by my custom classloader. I found this blog post where they solved a similar problem by only interacting with the custom classloader loaded classes via reflection, which seems to solve this problem. It just feels like it should be easier than this. Does anyone know a better way to handle this problem?
downvote count: 0
tagged with: jar
favorite count: 0
has comment: http://stackoverflow.com/comment/31619106
has comment: http://stackoverflow.com/comment/31702741
tagged with: classloader
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21063710
tagged with: conflict
score: 1

http://stackoverflow.com/a/21052004
type: Answer
accepted answer of: http://stackoverflow.com/q/21051976
score: 2
answers question: http://stackoverflow.com/q/21051976
downvote count: 0
has body: Since they are equivalent in hex or decimal, that only adds in terms of readability for other developers. It's functionally the same. Although, if you are doing it for readability, octal would be even better given the underlying system: public static final int READ = 04; public static final int WRITE = 02; public static final int EXECUTE = 01; or even more obvious: public static final int READ = 1&lt;&lt;2; public static final int WRITE = 1&lt;&lt;1; public static final int EXECUTE = 1; But that might be excessive :)
has comment: http://stackoverflow.com/comment/31652949
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/q/21103379
has body: I have created Android application using Qt5.2. It takes a long time to start my application. Qt5 draws black screen by default during application start up. I want to display company's logo during application start up. How can I do it? I have found code in QtActivity.java for loading splash screen if it presents. There is a reference in AndroidManifest.xml to splash screen layout. I have tried to create splash.xml in res/layout directory but it doesn't work. Thank you!
upvote count: 1
tagged with: android
favorite count: 0
downvote count: 0
type: UnansweredQuestion
has title: How can I create splash screen in Qt5.2 on Android?
has answer: http://stackoverflow.com/a/21103480
tagged with: c++
score: 1
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/37418375
tagged with: qt5

http://stackoverflow.com/comment/31678121
comment on: http://stackoverflow.com/q/21065566
has text: A `HashMap` doesn't have a predictable iteration order so you can't reverse it reliably either. Look into a [`LinkedHashMap`](http://docs.oracle.com/javase/6/docs/api/java/util/LinkedHashMap.html) instead.
type: Comment
type: QuestionComment
score: 8

apple-push-notifications
tags question: http://stackoverflow.com/q/21091135
tag name: apple-push-notifications
type: Tag

http://stackoverflow.com/a/22180842
type: Answer
has body: Knowing Java is absolutely recommended ! 1 year for getting these 4 certifications is impossible due to the following information: From TIBCO website: BW611: TIBCO ActiveMatrix BusinessWorksTM 5.x Integration Boot Camp: Recommended General Experience One year Enterprise Application Integration development experience, have an understanding of concepts such as distributed computing, adapters, services and canonical data model, exposure to Message Oriented Middleware, Java and other relevant technologies: XML, XPath, HTTP, JMS, SOAP, JDBC and Web Services. ARC701: Fundamentals of TIBCO Enterprise 3.0 Architecture Product Specific Experience Candidates should have at least: Two years experience designing message-based distributed systems using TIBCO products. One year of hands-on experience with TIBCO ActiveMatrix BusinessWorks, TIBCO ActiveMatrix Service Bus and TIBCO ActiveMatrix Service Grid. One year of active experience using TIBCO products delivering successful composite applications and services projects. Apparently, these two certifications doesn't exists any more: EMS11: Fundamentals of TIBCO Enterprise Message Service BPM401: Developing Business Processes with TIBCO Business StudioTM 3.5.x Regards,
upvote count: 3
answers question: http://stackoverflow.com/q/21095139
accepted answer of: http://stackoverflow.com/q/21095139
type: AcceptedAnswer
downvote count: 0
score: 3

http://stackoverflow.com/comment/31759891
comment on: http://stackoverflow.com/q/21109871
score: 0
type: Comment
has text: @WarrenFaith Doing that as I type this. Downloading the virtual device :)
type: QuestionComment

http://stackoverflow.com/a/21083516
downvote count: 0
has comment: http://stackoverflow.com/comment/31711922
score: 2
accepted answer of: http://stackoverflow.com/q/21083487
has body: If it is in fragment layout then in onCreateView EditText ediText1; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub View v = inflater.inflate(R.layout.fragmentlayout, container, false); editText1 = (EditText) v.findViewById (R.id.editText1); return v; } or You may be referencing the wrong id. You are missing a break case R.id.button1: Toast.makeText(getActivity(), "Clicked on add button" + " CRN: " + editText1.getText().toString(), Toast.LENGTH_LONG).show(); break; // missing
upvote count: 2
answers question: http://stackoverflow.com/q/21083487
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/21147672
tagged with: android
accepted answer: http://stackoverflow.com/a/21157714
tagged with: pull-to-refresh
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31829612
has answer: http://stackoverflow.com/a/21147759
has comment: http://stackoverflow.com/comment/31829671
tagged with: java
has title: Android: How to put github library into project
has answer: http://stackoverflow.com/a/21157714
has body: I want to put LoadMore/PullToRefresh feature to my app via this library made by shontauro. I've tried it like it's said to be done in README, but I think that something is missing there. I don't understand the logic at all. I've put some libraries to my projects in the past (appcompat support library, other .jar libraries etc.) but I didnt figure out what is the system of this type of libraries. Do you have any idea how to accomplish that?
type: Question
tagged with: listview
score: 0
possible better answer: http://stackoverflow.com/a/21147759
answer count: 2
tagged with: github

http://stackoverflow.com/q/21069124
possible better answer: http://stackoverflow.com/a/21069158
has body: Hi I am sort of new to java and am trying to extract a string from a .txt file. BufferedReader br = new BufferedReader(new FileReader("file.txt")); try { StringBuilder sb = new StringBuilder(); String line = br.readLine(); while (line != null) { sb.append(line); sb.append(System.lineSeparator()); line = br.readLine(); } String everything = sb.toString(); } catch(IOException e) { } finally { br.close(); } my issue is that when I compile this i get an error message --> cannot find symbol symbol : method lineSeparator() location: class java.lang.System. This error message does not occur when i try to compile the line with a different method from the System class. When I try to comment off this line to see if the rest works smoothly, I get another error message --> unreported exception java.io.FileNotFoundException; must be caught or declared to be thrown. Any explanation for how to fix my issue with not being able to access this method and/or how to get rid of the second error message would be appreciated.
has answer: http://stackoverflow.com/a/21069158
accepted answer: http://stackoverflow.com/a/21069176
type: AnsweredQuestion
tagged with: java
downvote count: 1
linked to: http://stackoverflow.com/q/14777511
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/3747155
score: 0
has title: Why is the system class method not accessed?
linked to: http://stackoverflow.com/q/5748656
favorite count: 0
has comment: http://stackoverflow.com/comment/31685119
has answer: http://stackoverflow.com/a/21069176
upvote count: 1

http://stackoverflow.com/comment/31877457
type: Comment
comment on: http://stackoverflow.com/a/21173902
type: AnswerComment
score: 0
has text: i did but i is still telling me that the adress is already in use

http://stackoverflow.com/comment/31644403
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21047411
has text: @SamArmen The names of the buttons shouldn't be the same, since they're different buttons.

http://stackoverflow.com/comment/31687595
has text: If your question has been answered by any of the users, please dont forget to marked it as answered.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21046907

http://stackoverflow.com/q/21164627
has title: Applet is not shown on a jsp on a spring web project
favorite count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
has body: I developing a spring mvc web project with spring security. I also developed a Java Applet, which works fine in the browser in an html file (the Applet is also signed with the jarsigner). Now I want to include it in an jsp file on the spring web project, so I used the tag as followed in the jsp file: &lt;jsp:plugin type="applet" archive="MutualAuthentication.jar" code="MutualAuthenticationHTTPApplet.class" codebase="." width="400" height="300"&gt; &lt;/jsp:plugin&gt; I looked into the other examples but with no luck. Everything is running on a tomcat Server and the message tomcat is giving me is the following: Jan 16, 2014 3:09:24 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound WARNING: No mapping found for HTTP request with URI [/tkey/MutualAuthentication.jar] in DispatcherServlet with name 'mvc-dispatcher' Jan 16, 2014 3:09:24 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound WARNING: No mapping found for HTTP request with URI [/tkey/MutualAuthentication.jar] in DispatcherServlet with name 'mvc-dispatcher' Jan 16, 2014 3:09:24 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound WARNING: No mapping found for HTTP request with URI [/tkey/MutualAuthentication.jar] in DispatcherServlet with name 'mvc-dispatcher' Jan 16, 2014 3:09:24 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound WARNING: No mapping found for HTTP request with URI [/tkey/MutualAuthentication.jar] in DispatcherServlet with name 'mvc-dispatcher' Jan 16, 2014 3:09:24 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound WARNING: No mapping found for HTTP request with URI [/tkey/MutualAuthenticationHTTPApplet.class] in DispatcherServlet with name 'mvc-dispatcher' Jan 16, 2014 3:09:24 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound WARNING: No mapping found for HTTP request with URI [/tkey/MutualAuthenticationHTTPApplet/class.class] in DispatcherServlet with name 'mvc-dispatcher' and my Applet is loc…
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26163135
answer count: 1
downvote count: 0
tagged with: jsp
tagged with: applet

http://stackoverflow.com/comment/31808787
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21136650
type: QuestionComment
has text: *"add some grid in my JTextArea"* Use a `JTable` for that. As general advice, ask just one question per question and post an [MCVE](http://stackoverflow.com/help/mcve) that focuses on that single question.

http://stackoverflow.com/q/21078626
answer count: 1
has comment: http://stackoverflow.com/comment/31702402
tagged with: jsp
has title: JSP c:forEach items attribute cannot resolve variable
has comment: http://stackoverflow.com/comment/31702170
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21079260
accepted answer: http://stackoverflow.com/a/21079260
has body: I using javax.servlet.jsp.jstl-1.2.1 lib in my JSP project. Here's my code: &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt; // other classes are included too &lt;% Tools tools = new Tools(); news [] list = tools.getEvent(); %&gt; &lt;html&gt; &lt;body&gt; &lt;c:forEach var="i" items="${list}"&gt; &lt;-- cannot resolve variable 'list', why? /* Do something */ &lt;/c:forEach&gt; &lt;/body &lt;/html&gt; As you see, the 'list' variable extsts but invisible for forEach. What i missed? c:out works fine. It crashes with java.lang.ClassNotFoundException: org.apache.jsp.index_jsp signature. Strange things are happens... I tried to execute this: &lt;c:forEach var="i" begin="1" end="5"&gt; &lt;c:out value="works"/&gt; &lt;/c:forEach&gt; But i got the same error..
tagged with: servlets
score: 0

http://stackoverflow.com/a/21086059
answers question: http://stackoverflow.com/q/21085963
type: Answer
score: 2
upvote count: 2
has body: Basically, a is a local variable, which is initialized every iteration in the loop with the value 0, and then destroyed, and so on, until the loop is finished when it is ultimately destroyed Note: while(//Some Condition) would comment out the right parenthesis, and therefore the code would not run anyway Correct this to: while(/* some condition */)
downvote count: 0

http://stackoverflow.com/comment/31850328
score: 1
comment on: http://stackoverflow.com/q/21159296
type: QuestionComment
type: Comment
has text: By the way, note that there is not difference between returning -1, -50 or -100 in the compareTo contract http://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html

http://stackoverflow.com/comment/31663037
type: QuestionComment
comment on: http://stackoverflow.com/q/21057204
score: 0
type: Comment
has text: For sure another exception is thrown, not an inputMismatch..

http://stackoverflow.com/comment/31614128
comment on: http://stackoverflow.com/q/21030078
has text: @ScottBarta updated my question to clarify that it is a gradle project. Will take a look at that link.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/31730297
comment on: http://stackoverflow.com/a/21086625
type: AnswerComment
has text: The correct URL should look like this: "HUDSON_URL/job/JOBNAME/build?token=TOKEN" (see https://wiki.eclipse.org/Using_Hudson/Remote_access_API#Submitting_jobs for details)
score: 0
type: Comment

http://stackoverflow.com/q/21065215
has comment: http://stackoverflow.com/comment/31677451
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21065348
has comment: http://stackoverflow.com/comment/31677612
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/31677487
type: Question
answer count: 2
upvote count: 0
has title: What is missing in this code block?
possible better answer: http://stackoverflow.com/a/21065372
score: -3
has answer: http://stackoverflow.com/a/21065372
has comment: http://stackoverflow.com/comment/31677519
has body: I am new to Android Application development and so I am learning from this site and from any other website I get to pass through! From another site I got the code to show the current DateTime value of the phone. The code is as: TextView textView1 = (TextView) findViewById(R.id.textView1); SimpleDateFormat timeNow = new SimpleDateFormat("hh:mm:ss"); textView1.setText(timeNow.format(new Date())); Now, I used this site to get the refreshing suggestion for each second, so I will use a Timer. The code now, looks like this: private static updateTextView () { TextView textView1 = (TextView) findViewById(R.id.textView1); SimpleDateFormat timeNow = new SimpleDateFormat("hh:mm:ss"); textView1.setText(timeNow.format(new Date())); } private Timer timer1 = new Timer(); timer1.schedule(updateTextView, 1000); I am doing this on my own, each timer needs its own method, so I tried to create one. But since I am a newbie I don't know how to create a method in Java. And the error is at static the error line is: insert enumbody to complete block statement What would I do now? The complete code is as: package com.something.widget; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Timer; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.TextView; public class Main_Page extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_page); private static TextView updateTextView () { TextView textView1 = (TextView) findViewById(R.id.textView1); SimpleDateFormat timeNow = new SimpleDateFormat("hh:mm:ss"); textView1.setText(timeNow.format(new Date())); } private Timer timer1 = new Timer(); timer1.schedule(updateTextView, 1000); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main__page, menu); return true; } }
linked to: http://stackoverflow.com/q/8375916
tagged with: android
has answer: http://stackoverflow.com/a/21065348
favorite count: 0
has comment: http://stackoverflow.com/comment/31677547

http://stackoverflow.com/q/21146956
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/31827796
has comment: http://stackoverflow.com/comment/31827740
tagged with: null
upvote count: 0
score: -2
tagged with: arrays
has comment: http://stackoverflow.com/comment/31827767
has comment: http://stackoverflow.com/comment/31827929
duplicate of: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/31827843
has title: Null pointer exception
tagged with: exception
answer count: 1
has comment: http://stackoverflow.com/comment/31827793
has answer: http://stackoverflow.com/a/21147006
favorite count: 0
type: UnansweredQuestion
has body: I am trying to display the elements of my ArrayList in an action listener method by calling a printlibrary method from another class(library). I keep getting a null pointer exception at this line library.addItem(libraryItem); I dont understand how to fix this I have already used validation in the form of an if statement to see if library is null and a system.out to see if the button action listner is actually working and the button does work { {System.out.println("hello world"); String t = title.getText(); int y = Integer.parseInt(year.getText()); int q = Integer.parseInt(quantity.getText()); if(library != null) { LibraryItem libraryItem = new LibraryItem(t,y,q); library.addItem(libraryItem); } else { System.out.println("its null"); } library.printLibrary(); } HERE IS THE REST OF MY LIBRARYFRAME CLASS!!! import javax.swing.JFrame; import javax.swing.JButton; import java.awt.GridLayout; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JTextField; import javax.swing.JLabel; public class LibraryFrame extends JFrame implements ActionListener { JLabel label, label2, label3; JTextField title, year, quantity; JButton button, button2; private Library library; public LibraryFrame() { this.setLayout(new GridLayout(4,2,10,10)); //2nd set of co-ord (10,10) is for row and coloumn spacing. label = new JLabel("Title"); title = new JTextField(20); label2 = new JLabel("Year"); year = new JTextField(20); label3 = new JLabel("Quantity"); quantity = new JTextField(20); button = new JButton("Add"); button2 = new JButton("Search"); button.addActionListener(this); this.add(label); this.add(title); this.add(label2); this.add(year); this.add(label3); this.add(quantity); this.add(button); this.add(button2); } public void actionPerformed(ActionEvent ev) { {System.out.println("hello world"); String t = title.getText(); int y = Integer.parseInt(year.getText()); int q = Integer.parseInt(quantity.getText()); if(library != null) { LibraryItem libraryItem …
downvote count: 2
has comment: http://stackoverflow.com/comment/31827840
has comment: http://stackoverflow.com/comment/31827788
tagged with: java
has comment: http://stackoverflow.com/comment/31827871
type: Question

http://stackoverflow.com/a/21086335
score: 1
answers question: http://stackoverflow.com/q/21085977
has body: Maybe you are mixing things. You have already solved how to present a JSP, read an Excel file with POI and write rows into a database. I suggest you to redesign your code to separe those tasks. Maybe a simple class (Reader.java) which only reads the excel file and produces an ArrayList for each sheet, and then a simple class (Writer.java) with 2 methods, each of which takes an ArrayList and writes them to the database as needed. That leads to a more simple top-down design, which would be easier to debug. By the way, you are creating a database connection in your code and not returning it. You should call the .close() method for every database resource (ResultSets, Statements and Connections) that you use in your application, or use some idiom (try with resources, Spring resources management, whatever) that makes sure to do so. Bonus track: when you feel more comfortable with java, have a look at http://en.wikipedia.org/wiki/Connection_pool This would be the preferred manner to connect to a database in a web application with, potentially, hundreds or thousands of concurrent users. Your idea, opening a new connection for each access to your page, which is perfectly right for an academic exercise, would lead to efficiency problems in a real environment. Maybe your application server has a built-in connection pool mechanism (latest version of tomcat, weblogic, websphere have them for example) or maybe you could consider using apache DBCP or C3PO.
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/31817948
comment on: http://stackoverflow.com/q/21141965
has text: What IDE are you using? Eclipse? IntelliJ? NetBeans?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21115107
has comment: http://stackoverflow.com/comment/31769411
has comment: http://stackoverflow.com/comment/31876639
score: 2
downvote count: 0
has body: Assuming this is all in a single class: public static void main (String[] args) { int[] numbers = {3, 15, 1, 9, 6, 12, 21, 17, 8}; selectionSort(numbers, 0, 8); System.out.println(Arrays.toString(numbers)); }
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21115056
answers question: http://stackoverflow.com/q/21115056
type: Answer

http://stackoverflow.com/a/21019440
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21019309
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21019309
has body: I'd use a Long Id. I'd avoid the string because country names aren't constant: they're known to change, and it'd suck to have to go change all the foreign key values. I'd avoid the enum route because it'd require to you change/rebuild/recompile to handle new countries or country name changes.

http://stackoverflow.com/q/21112304
tagged with: selendroid
type: UnansweredQuestion
tagged with: selenium-grid
has answer: http://stackoverflow.com/a/23493954
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/31764310
has body: I have install the selenium grid successfully for the FF, chrome and IE now I want to install capabilities for the Android (using Selendroid) I got the following screenshot error
tagged with: java
tagged with: selenium
has title: While set up the Android Driver for the Selenium Grid I got the error "ANDROID_HOME" environment variable not set, anybody provide the solution
upvote count: 1
answer count: 1

http://stackoverflow.com/q/21133702
answer count: 3
has title: JNI and C++ - UnsatisfiedLinkError
tagged with: c++
downvote count: 0
has answer: http://stackoverflow.com/a/21139513
type: AnsweredQuestion
score: 3
tagged with: java-native-interface
tagged with: java
has answer: http://stackoverflow.com/a/21133937
accepted answer: http://stackoverflow.com/a/21133937
type: Question
linked to: http://stackoverflow.com/q/935379
possible better answer: http://stackoverflow.com/a/21139513
has answer: http://stackoverflow.com/a/21133934
favorite count: 0
upvote count: 3
has body: I'm using JNI successfully to call some C code, however when I want to change to C++ JNI throws an UnsatisfiedLinkError whenever I try to call a method. This one works: g++ -c -Icryptopp562 -O3 -fPIC -fpermissive CI3CppEncryptionToolsImpl.cpp gcc -I${JAVA_HOME}/include -O3 -shared -fPIC -o libCI3CppEncryptionTools.so de_zdv_research_emdu_CI3CppEncryptionTools.c CI3CppEncryptionToolsImpl.o -lcryptopp With this one, I get an UnsatisfiedLinkError: g++ -c -Icryptopp562 -O3 -fPIC -fpermissive CI3CppEncryptionToolsImpl.cpp g++ -I${JAVA_HOME}/include -O3 -shared -fPIC -fpermissive -o libCI3CppEncryptionTools.so de_zdv_research_emdu_CI3CppEncryptionTools.cpp CI3CppEncryptionToolsImpl.o -lcryptopp The generated header is as follows: /* DO NOT EDIT THIS FILE - it is machine generated */ #include &lt;jni.h&gt; /* Header for class de_zdv_research_emdu_CI3CppEncryptionTools */ #ifndef _Included_de_zdv_research_emdu_CI3CppEncryptionTools #define _Included_de_zdv_research_emdu_CI3CppEncryptionTools #ifdef __cplusplus extern "C" { #endif /* * Class: de_zdv_research_emdu_CI3CppEncryptionTools * Method: encrypt * Signature: (Ljava/lang/String;)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_de_zdv_research_emdu_CI3CppEncryptionTools_encrypt (JNIEnv *, jclass, jstring); /* * Class: de_zdv_research_emdu_CI3CppEncryptionTools * Method: decrypt * Signature: (Ljava/lang/String;)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_de_zdv_research_emdu_CI3CppEncryptionTools_decrypt (JNIEnv *, jclass, jstring); #ifdef __cplusplus } #endif #endif And my implementation (.cpp) is as follows, I omitted the decrypt method: #include &lt;jni.h&gt; #include "CI3CppEncryptionToolsImpl.h" #include "de_zdv_research_emdu_CI3CppEncryptionTools.h" jstring Java_de_zdv_research_emdu_CI3CppEncryptionTools_encrypt(JNIEnv *env, jobject obj, jstring s) { return env-&gt;NewStringUTF(encrypt(env-&gt;GetStringUTFChars(s, JNI_FALSE))); } For the C version I simply write return (*env)-&gt;NewStringUTF(env, encr…

http://stackoverflow.com/comment/31616560
comment on: http://stackoverflow.com/a/21031365
score: 0
has text: @HeatherT: please re-read my answer and also read the BorderLayout tutorial (Google will get it for you quick). It's because that is BorderLayout's behavior. Consider nesting JPanels with different layouts if you want a different behaving GUI. Also and again, avoid calling `setSize(...)` or `setPreferredSize(...)` on anything.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/31632102
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/21040593
has text: please give us the code you have in `implements`
type: Comment

http://stackoverflow.com/comment/31810400
has text: Sorry, the way the code was parsing, it looked like all the filter mappings were commented out as they were all gray-text. Can you put a break after getting your `LoginBean` and see if it's always `null`?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21137561

http://stackoverflow.com/comment/31879661
has text: This question appears to be off-topic because it does not show what you have tried so far. Please show us your attempt at solving the problem rather than simply telling us what your assignment is.
comment on: http://stackoverflow.com/q/21175329
type: Comment
type: QuestionComment
score: 4

http://stackoverflow.com/a/25881592
type: Answer
has comment: http://stackoverflow.com/comment/102202187
answers question: http://stackoverflow.com/q/21083834
upvote count: 25
score: 25
has comment: http://stackoverflow.com/comment/79688983
downvote count: 0
has comment: http://stackoverflow.com/comment/100326958
has body: If you have a single main entry point, this code snippet might save you some trouble. The set property call must fire before any loggers are created. This approach works with files on the classpath. public class TestProcess { static { System.setProperty("log4j.configurationFile", "log4j-alternate.xml"); } private static final Logger log = LoggerFactory.getLogger(TestProcess.class); }

http://stackoverflow.com/comment/33617234
score: 0
comment on: http://stackoverflow.com/a/21115447
type: AnswerComment
has text: May be you have to set: devModeUrlWhitelistRegexp in your module descirptor. That was something I missed.
type: Comment

http://stackoverflow.com/comment/31755459
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21099448
has text: @ashur: I'd bet that using 30 bits rather than 32 is not a good idea. The reasoning by Henry is fine, but 30 bits per `int` means redundancy or unused bits and each of them may cause enough problems. There's actually no problem with `int`s being signed as the result of add/sub are the same as for unsigned (and you need some special handling for mul/div anyway). For learning, doing it yourself is good but I'd recommend to look at the existing sources too.
type: Comment

http://stackoverflow.com/q/21058774
has comment: http://stackoverflow.com/comment/44233465
has comment: http://stackoverflow.com/comment/44323739
has comment: http://stackoverflow.com/comment/54203831
score: 10
answer count: 1
tagged with: java
has body: I am developing a Swing application in Java. The program is to be run on dedicated Windows 7 Touch Screen machines, and as far as I know, this program should be the only thing running on them under normal operation. I've noticed that Windows 7's touch screen interface has this thing where it will hold back mousedown events. Due to the "tap-and-hold right click" gesture, Windows 7 won't actually send the application a mouse down event until: the user "touch ups" (raise their finger from a touch, at which point both down and up are sent) moves their finger (at which point the click becomes a drag) or the right click circle gesture times out (after about 5-6 seconds) Trivially, this means that buttons don't look depressed on the application until the mouse down event is sent (and never draw depressed at all with a quick tap). But, recently, more seriously, this means functionality that requires a press-and-hold cannot happen without major amounts of confusion to the average user. At this point in development it is far too late to turn around and start from scratch with one of the many touch libraries offered on other questions. (They require redoing the entire application in their component hierarchy, and that simply isn't feasible. Plus things coded to use mouse events would then have to be recoded using touch events, and we don't really need multi-touch...) Yes, I have attempted to simply turn off the touch-and-hold right click gesture. Unfortunately, doing so simply disables the drawing of a circle indicating a right click gesture around your finger and the fire of the subsequent right click. It does NOT remove the underlying problem: the delayed mouse down event for up to six seconds. My Question: Is there a way to: Ideally, indicate to Windows that my application is a touch-ready application, so it sends down events immediately (but, I suppose, still send mouse events instead of touch events)? I can see that the built-in soft keyboard works correctly, it seems. I …
tagged with: swing
has answer: http://stackoverflow.com/a/33281345
upvote count: 10
linked to: http://stackoverflow.com/q/2436740
has comment: http://stackoverflow.com/comment/44286727
downvote count: 0
has comment: http://stackoverflow.com/comment/51413276
type: UnansweredQuestion
tagged with: touch
has title: Windows 7 Touch Screen + Java Swing = Delayed Mouse Events
favorite count: 0
tagged with: windows-7
type: Question

http://stackoverflow.com/comment/31660814
has text: IMHO use guice if you only need dependency injection.
comment on: http://stackoverflow.com/q/21056063
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/21076179
has answer: http://stackoverflow.com/a/52643649
has answer: http://stackoverflow.com/a/41259084
has comment: http://stackoverflow.com/comment/118014538
has comment: http://stackoverflow.com/comment/68084371
has answer: http://stackoverflow.com/a/59394822
has answer: http://stackoverflow.com/a/51477089
downvote count: 1
has answer: http://stackoverflow.com/a/54742944
has answer: http://stackoverflow.com/a/73816710
has answer: http://stackoverflow.com/a/47563948
type: Question
has answer: http://stackoverflow.com/a/36427118
linked to: http://stackoverflow.com/q/72859703
has answer: http://stackoverflow.com/a/68564551
has answer: http://stackoverflow.com/a/43726527
has comment: http://stackoverflow.com/comment/76048454
has answer: http://stackoverflow.com/a/74802450
has answer: http://stackoverflow.com/a/37665482
has answer: http://stackoverflow.com/a/56877298
has answer: http://stackoverflow.com/a/47955799
has answer: http://stackoverflow.com/a/68801301
has answer: http://stackoverflow.com/a/66889979
has answer: http://stackoverflow.com/a/75948144
has answer: http://stackoverflow.com/a/78187787
linked to: http://stackoverflow.com/q/8980364
has answer: http://stackoverflow.com/a/57285966
has answer: http://stackoverflow.com/a/71204298
has answer: http://stackoverflow.com/a/74173665
tagged with: ssl-certificate
possible better answer: http://stackoverflow.com/a/21507568
linked to: http://stackoverflow.com/q/74799868
has answer: http://stackoverflow.com/a/59325503
has answer: http://stackoverflow.com/a/45100780
has answer: http://stackoverflow.com/a/40743987
linked to: http://stackoverflow.com/q/25940396
has answer: http://stackoverflow.com/a/78251925
has answer: http://stackoverflow.com/a/30532709
has title: "PKIX path building failed" and "unable to find valid certification path to requested target"
has answer: http://stackoverflow.com/a/56152688
has answer: http://stackoverflow.com/a/37934102
has answer: http://stackoverflow.com/a/76375673
has answer: http://stackoverflow.com/a/65881701
has answer: http://stackoverflow.com/a/75532442
answer count: 62
has answer: http://stackoverflow.com/a/53295765
has body: I'm trying to get tweets using twitter4j library for my java project which uses under the covers java.net.HttpURLConnection (as can be seen in stack trace). On my first run I got an error about certificate sun.security.validator.ValidatorException and sun.security.provider.certpath.SunCertPathBuilderException. Then I added twitter certificate by: C:\Program Files\Java\jdk1.7.0_45\jre\lib\security>keytool -importcert -trustcacerts -file PathToCert -alias ca_alias -keystore "C:\Program Files\Java\jdk1.7.0_45\jre\lib\security\cacerts" But without success. Here is the procedure to get tweets: public static void main(String[] args) throws TwitterException { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true) .setOAuthConsumerKey("myConsumerKey") .setOAuthConsumerSecret("myConsumerSecret") .setOAuthAccessToken("myAccessToken") .setOAuthAccessTokenSecret("myAccessTokenSecret"); TwitterFactory tf = new TwitterFactory(cb.build()); Twitter twitter = tf.getInstance(); try { Query query = new Query("iphone"); QueryResult result; result = twitter.search(query); System.out.println("Total amount of tweets: " + result.getTweets().size()); List<Status> tweets = result.getTweets(); for (Status tweet : tweets) { System.out.println("@" + tweet.getUser().getScreenName() + " : " + tweet.getText()); } } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to search tweets: " + te.getMessage()); } And here is the error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target Relevant discussions can be found on the Internet at: http://www.google.co.jp/search?q=d35baff5 or http://www.google.co.jp/search?q=1446302e TwitterException{exceptionCode=[d35baff5-1446302e 43208640-747fd158 43208640-747fd158 43208640-747fd158], statusCode=-1, message=null, code=-1, retryAfter=-1, rateLimitStatus=null, version=3.0.5} …
linked to: http://stackoverflow.com/q/68531872
has answer: http://stackoverflow.com/a/76262524
has answer: http://stackoverflow.com/a/69793427
has answer: http://stackoverflow.com/a/70812354
has answer: http://stackoverflow.com/a/61925589
tagged with: httpurlconnection
favorite count: 0
has answer: http://stackoverflow.com/a/21079274
has comment: http://stackoverflow.com/comment/120672576
linked to: http://stackoverflow.com/q/9619030
has answer: http://stackoverflow.com/a/71329551
has answer: http://stackoverflow.com/a/57431480
has answer: http://stackoverflow.com/a/41799444
has answer: http://stackoverflow.com/a/74605095
has answer: http://stackoverflow.com/a/64240996
has answer: http://stackoverflow.com/a/46195965
has answer: http://stackoverflow.com/a/66009703
has answer: http://stackoverflow.com/a/75793837
linked to: http://stackoverflow.com/q/26697118
has answer: http://stackoverflow.com/a/47548746
has answer: http://stackoverflow.com/a/34996234
has answer: http://stackoverflow.com/a/68268082
has answer: http://stackoverflow.com/a/21507568
has answer: http://stackoverflow.com/a/73943425
upvote count: 986
accepted answer: http://stackoverflow.com/a/36427118
has answer: http://stackoverflow.com/a/51907615
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/68174751
has answer: http://stackoverflow.com/a/56654175
has comment: http://stackoverflow.com/comment/117246835
has answer: http://stackoverflow.com/a/47141367
has answer: http://stackoverflow.com/a/76992172
has answer: http://stackoverflow.com/a/45860983

http://stackoverflow.com/a/21175888
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21175810
type: Answer
accepted answer of: http://stackoverflow.com/q/21175810
has body: Try changing if (Character.isAlphabetic(ch)) { to if (!Character.isWhitespace(ch)) { This way you will include all characters that are not whitespaces. Otherwise you will reverse only alphabetic characters which [ ] + are not.
score: 3

http://stackoverflow.com/a/21044255
has comment: http://stackoverflow.com/comment/31638675
has comment: http://stackoverflow.com/comment/31638786
score: 0
has comment: http://stackoverflow.com/comment/31638555
has body: public class MyFragment extends Fragment { int strtext; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle data = getArguments(); strtext= data.getInt("Nilai"); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.lirik_view, container, false); Log.v("Testing", "Menjalankan proses pengambilan data dari activity"); Log.v("Testing", "Data adalah "+strtext); return rootView; } }
answers question: http://stackoverflow.com/q/21043150
type: Answer

http://stackoverflow.com/a/21131644
has comment: http://stackoverflow.com/comment/31799766
has body: Check if you are pointing to the right directory and its not a relative path. I feel the following code is giving a null object files: File[] files = dir.listFiles();
answers question: http://stackoverflow.com/q/21131552
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31799718
has comment: http://stackoverflow.com/comment/31799651
has comment: http://stackoverflow.com/comment/31799610
has comment: http://stackoverflow.com/comment/31799711
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31799673
has comment: http://stackoverflow.com/comment/31799803

http://stackoverflow.com/a/34996234
has comment: http://stackoverflow.com/comment/72897144
has comment: http://stackoverflow.com/comment/120672206
answers question: http://stackoverflow.com/q/21076179
has comment: http://stackoverflow.com/comment/131521043
has comment: http://stackoverflow.com/comment/101199588
score: 60
has comment: http://stackoverflow.com/comment/80379091
has comment: http://stackoverflow.com/comment/93825673
has comment: http://stackoverflow.com/comment/107609218
has comment: http://stackoverflow.com/comment/107440508
has comment: http://stackoverflow.com/comment/131724672
downvote count: 35
has body: -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true It is used for jump the certificate validation. Warning! Only use for development purposes for this is unsecure!
upvote count: 95
has comment: http://stackoverflow.com/comment/99781911
has comment: http://stackoverflow.com/comment/107591186
type: Answer

date
tags question: http://stackoverflow.com/q/21042484
tags question: http://stackoverflow.com/q/21034766
tag name: date
tags question: http://stackoverflow.com/q/21089707
tags question: http://stackoverflow.com/q/21022821
tags question: http://stackoverflow.com/q/21156431
tags question: http://stackoverflow.com/q/21050455
tags question: http://stackoverflow.com/q/21096581
tags question: http://stackoverflow.com/q/21041673
tags question: http://stackoverflow.com/q/21162083
tags question: http://stackoverflow.com/q/21039056
tags question: http://stackoverflow.com/q/21139468
type: Tag
tags question: http://stackoverflow.com/q/21181801
tags question: http://stackoverflow.com/q/21036410
tags question: http://stackoverflow.com/q/21109292
tags question: http://stackoverflow.com/q/21059072
tags question: http://stackoverflow.com/q/21054744
tags question: http://stackoverflow.com/q/21050912
tags question: http://stackoverflow.com/q/21100133
tags question: http://stackoverflow.com/q/21079703
tags question: http://stackoverflow.com/q/21105502
tags question: http://stackoverflow.com/q/21175710
tags question: http://stackoverflow.com/q/21180434
tags question: http://stackoverflow.com/q/21162677

http://stackoverflow.com/q/21135873
tagged with: java
linked to: http://stackoverflow.com/q/20726425
type: Question
tagged with: jsp
linked to: http://stackoverflow.com/q/20445940
linked to: http://stackoverflow.com/q/14852089
tagged with: struts2
has answer: http://stackoverflow.com/a/21136394
answer count: 1
downvote count: 0
has body: I have my Action class below in which getTspNameIdMap throws ReqMgmtException exception (custom exception). public String findTspNameIdMap(){ SlsReqMgmtCommonRemote slsReqMgmtCommonRemote = null; tspNameIdMap = new HashMap&lt;String, String&gt;(); try{ slsReqMgmtCommonRemote = getSlsReqMgmtCommonRemote(); tspNameIdMap = slsReqMgmtCommonRemote.getTspNameIdMap(gmaThresholdParameters.getId().getCircleId()); } catch(ReqMgmtException rEx){ addActionError(rEx.getError()); result = "error"; return ERROR; } catch (Exception e){ addActionError("Error in processing your request. Contact Administrator"); e.printStackTrace(); System.out.println("[ConfigureTspThresholdAction: findTspNameIdMap Function]:In catch Inside Constructor!!"); result = "error"; return ERROR; } return SUCCESS; } I know there is exception handling in Struts2 too, however presently I am not using it. Should I use Struts2 exception handling? What would be its usage?
has comment: http://stackoverflow.com/comment/31823797
favorite count: 0
tagged with: exception
upvote count: 1
linked to: http://stackoverflow.com/q/20952538
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21136394
has title: Struts2 Exception handling usage?
score: 1

http://stackoverflow.com/comment/31779224
score: 0
type: Comment
has text: Thank you so much! It appears now. You're a life saver.
comment on: http://stackoverflow.com/a/21120279
type: AnswerComment

http://stackoverflow.com/q/21140111
type: UnansweredQuestion
has title: Error with nullable Double PathParam
upvote count: 1
tagged with: web-services
has body: I have a REST service: @POST @Path("/shop/{prodID}/{price}") public Response updatePrice(@PathParam("prodID") Long prodID, @PathParam("price") Double price) { priceDAO.updatePrice(prodID, price); return Response.ok().build(); } If i send number for UI they work great, but if a send empty param (null) I have error: sitesurl/shop/33/null 404 Not Found and Class java.lang.Double can not be instantiated using a constructor with a single String argument on console. If null sending as string ("null") we could see NumberFormatException. Why my service can not parse nullable PathParam?
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31814879
tagged with: jersey
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21156580
has comment: http://stackoverflow.com/comment/31814459

http://stackoverflow.com/comment/31665333
type: Comment
has text: I retrieve the 32 Byte blob I store in db. I checked the size after it is retrieved, before it goes to secret key spec and every where I could but all return 32 bytes
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21041874

http://stackoverflow.com/a/65828231
answers question: http://stackoverflow.com/q/21083170
score: 0
has body: If you are use the spring command line interface (CLI) use the -- to separate commands from the spring command arguments, to change the port: spring run hello.groovy -- --server.port=9000 spring-boot cli
type: Answer

http://stackoverflow.com/a/21139631
upvote count: 5
has comment: http://stackoverflow.com/comment/31814110
has comment: http://stackoverflow.com/comment/31813945
has comment: http://stackoverflow.com/comment/31838919
score: 5
has comment: http://stackoverflow.com/comment/31844603
downvote count: 0
has comment: http://stackoverflow.com/comment/31815181
has comment: http://stackoverflow.com/comment/31844512
has comment: http://stackoverflow.com/comment/31815495
has comment: http://stackoverflow.com/comment/31814887
type: Answer
answers question: http://stackoverflow.com/q/21138920
has comment: http://stackoverflow.com/comment/31815078
has comment: http://stackoverflow.com/comment/31814038
has comment: http://stackoverflow.com/comment/31814039
has comment: http://stackoverflow.com/comment/31814187
has comment: http://stackoverflow.com/comment/31834874
has body: OK, here's my jmh code: @OutputTimeUnit(TimeUnit.MICROSECONDS) @BenchmarkMode(Mode.AverageTime) @Warmup(iterations = 3, time = 1) @Measurement(iterations = 3, time = 1) @Fork(3) public class Comparison { static final int size = 1_000; @GenerateMicroBenchmark public List&lt;?&gt; testSpecifiedSize() { final ArrayList&lt;Integer&gt; l = new ArrayList(size); for (int i = 0; i &lt; size; i++) l.add(1); return l; } @GenerateMicroBenchmark public List&lt;?&gt; testDefaultSize() { final ArrayList&lt;Integer&gt; l = new ArrayList(); for (int i = 0; i &lt; size; i++) l.add(1); return l; } } My results for size = 10_000: Benchmark Mode Thr Cnt Sec Mean Mean error Units testDefaultSize avgt 1 9 1 80.770 2.095 usec/op testSpecifiedSize avgt 1 9 1 50.060 1.078 usec/op Results for size = 1_000: Benchmark Mode Thr Cnt Sec Mean Mean error Units testDefaultSize avgt 1 9 1 6.208 0.131 usec/op testSpecifiedSize avgt 1 9 1 4.900 0.078 usec/op My interpretation: presizing has some edge on the default size; the edge isn't that spectacular; the absolute time spent on the task of adding to the list is quite insignificant. My conclusion: Add the initial size if that makes you feel warmer around the heart, but objectively speaking, your customer is highly unlikely to notice the difference.
has comment: http://stackoverflow.com/comment/31814006
has comment: http://stackoverflow.com/comment/31814609

http://stackoverflow.com/comment/31819652
type: AnswerComment
score: 0
type: Comment
has text: @Navneet The link I posted has an example and explanation.
comment on: http://stackoverflow.com/a/21141933

http://stackoverflow.com/a/21099397
type: Answer
answers question: http://stackoverflow.com/q/21099198
has body: You should look here. http://dev.mysql.com/doc/refman/5.0/en/sql-syntax-prepared-statements.html Example: PREPARE stmt1 FROM 'SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse'; SET @a = 3; SET @b = 4; EXECUTE stmt1 USING @a, @b; DEALLOCATE PREPARE stmt1; See also: Dynamic Query in MySQL
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21099198

http://stackoverflow.com/a/21058924
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21058081
accepted answer of: http://stackoverflow.com/q/21058081
has comment: http://stackoverflow.com/comment/31674999
has body: Your problem here is mainly one of design. The main flaw: attempting to use one instance MyNode in multiple linked lists. When you InsertToHead(node) you're modifying the contents of node itself, specifically the head and next references. Fix: Simple declare a new MyNode for each LinkedList you want to use it in. In your project specifically you're using two for any given node. ll and one of the &lt;inset_number&gt;Letters lists. So declare a new MyNode for each list: ... while (wordScan.hasNext()) { String temp = wordScan.next(); MyNode node = new MyNode(); MyNode node2 = new MyNode(); node.setWord(temp); node2.setWord(temp); node.setLength(temp.length()); node2.setLength(temp.length()); ll.InsertToHead(node2); ... That should fix your problem. If you want to know WHY it was happening. Trace the code. It has to do with attempting to add nodes that already have some more nodes attached into a list. Additional Notes: Try your best to avoid public fields unless you're SURE you want them. I.E. in MyLinkedList someone using your class shouldn't be able to access (or even see!) the counter, head or tail, so those should be made private. If you really want to access them, create get and set methods Your nested if block in WordSort is a perfect place for a switch like this: switch(temp.length()) { case 6: sixLetters.InsertToHead(node); break; case 5: fiveLetters.InsertToHead(node); break; case 4: fourLetters.InsertToHead(node); break; case 3: threeLetters.InsertToHead(node); break; default: rejects.InsertToHead(node); break; } MyNode works fine as a separate class. However I will many times choose to implement a simple class like a node as a nested class. It can make for some very clean code. Try it out! Be careful when designing your classes. There are a lot of extra methods in your design. It can be easy to chug ahead creating methods you may or may not ever use. I like to only create methods when I see that I need them in a class that uses the class in question. Happy C…
type: AcceptedAnswer

dom
tags question: http://stackoverflow.com/q/21049806
type: Tag
tags question: http://stackoverflow.com/q/21158441
tags question: http://stackoverflow.com/q/21183921
tags question: http://stackoverflow.com/q/21170909
tags question: http://stackoverflow.com/q/21121332
tags question: http://stackoverflow.com/q/21142870
tag name: dom
tags question: http://stackoverflow.com/q/21019509
tags question: http://stackoverflow.com/q/21039098

http://stackoverflow.com/comment/31671625
score: 0
type: AnswerComment
has text: This would be useful, if I wanted to have _one_ customized errorpage for all XyzNotFound cases. But what I want is multiple customized errorpages for multiple different domain classes (one domain class => one errorpage). These might include some hints for the user, where to look further. I clarified my question concerning this.
comment on: http://stackoverflow.com/a/21061882
type: Comment

http://stackoverflow.com/comment/31738214
comment on: http://stackoverflow.com/q/21098095
type: Comment
type: QuestionComment
has text: What do you think `out` is referring to? Why do you think that?
score: 0

http://stackoverflow.com/comment/31746869
comment on: http://stackoverflow.com/a/21099685
score: 0
has text: @Jules: It sounds like you should put down serialization etc and go back to the basics of how Java references and objects work. It's *really* fundamental to working properly with Java.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31996945
has text: Upvoted because it is certainly a valid strategy. But actually, this is already kind of implicitly the case with JEE. An EJB will usually have at least one interface (a local one, and optionally remote one), and its implementation. When you use it somewhere by injecting it with `@EJB`, you refer to the interface. Various EJBs have various tasks (managing JPA, security checks, calculations...). The question is, HOW to best make different implementations pluggable in Java EE. I believed the `@Alternative` annotation might be one way of doing this. In a sense this already is close to Strategy.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21239282

http://stackoverflow.com/comment/31825895
type: Comment
type: QuestionComment
has text: I'm pretty sure that this isn't possible. What makes you think that you can see custom widgets in the "Palette"? (I'm assuming you mean a plugin like WindowBuilder)...
comment on: http://stackoverflow.com/q/21145923
score: 0

http://stackoverflow.com/comment/31841595
comment on: http://stackoverflow.com/q/21154333
has text: @MadProgrammer Gave a great tip, but if it is *always* one question with 4 answers, I'd tend to simply have a `JLabel` for the question and 4 x `JRadioButton` objects in a button group for the answers. When the user selects an answer, and is informed of right/wrong, change the text (usinf `setText()`) of the question and possible answers. This has the advantage of only requiring a single panel for as many as thousands of questions.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31603227
has text: It is indeed not a good idea to code to interfaces just to hide the implementation as it simply leads to generating extra unnesessary piles of code, and my recommendation was not meant so. The main benefit is rather a clean contract for the functionality which evolves much slower (the contract) than the actual implementation, thus providing (external) users of the API an improved stability and clarity of their own code base. It would not be surprising to see the current version of the API at e.g. 1.2.2 and the current version of the implementation at e.g. 1.2.35...
comment on: http://stackoverflow.com/a/21023768
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21023909
linked to: http://stackoverflow.com/q/4897935
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/csv
has title: How to return datatypes using CSV Reader API in Java
score: 1
tagged with: java
type: Question
has body: I am working with .csv file that contains multiple columns (variables) . Each of these variables might be either Decimal , VARCHAR , or Date type . If a column contains all numbers , then it is Decimal; if all dates then Date ; otherwise the default is VARCHAR. I know one way to determine this by checking EACH value in the data set . CSVReader reader = new CSVReader (new FileReader(.....)); String row [] = reader.readNext(); while ((row = reader.readNext()) !=null ) { // I go through EACH value to see if it is `Decimal` , `VARCHAR` , or `Date` } } reader.close(); However the above approach is slow . Is there any better way or Command in CSV Reader to do this fast ? Thank You!
upvote count: 1
has answer: http://stackoverflow.com/a/21024170
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/49095254
has text: If it wasn't immediately obvious to anyone (like it wasn't to me), the Javadocs for `@SafeVarargs` has an example of a method that is unsafe https://docs.oracle.com/javase/7/docs/api/java/lang/SafeVarargs.html
type: Comment
score: 18
type: AnswerComment
comment on: http://stackoverflow.com/a/21150650

http://stackoverflow.com/a/21041699
answers question: http://stackoverflow.com/q/21041649
score: 3
upvote count: 3
has body: String expectedMsg2 = "test: \""+A1+ "\" is mapped to Product. Cannot delete";
accepted answer of: http://stackoverflow.com/q/21041649
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/21128039
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/31793380
has answer: http://stackoverflow.com/a/21128093
has answer: http://stackoverflow.com/a/21128076
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31793362
has title: How to return true if there is a duplicate object in ArrayList?
tagged with: java
tagged with: duplicates
tagged with: eclipse
has body: Writing a method in Java that looks through an ArrayList of objects (specifically "card" objects, that contain the number and suit of the card) that has been filled with random cards. The method returns a boolean value whether the ArrayList contains a duplicate. So far I've tried a for loop within a for loop, but I didn't get very far. Also, I need another method that returns the duplicate card, but I need to finish this first method first before I attempt that.
type: Question
tagged with: boolean
has answer: http://stackoverflow.com/a/21128070
has comment: http://stackoverflow.com/comment/31793389
has comment: http://stackoverflow.com/comment/31793397
tagged with: arraylist

http://stackoverflow.com/a/21170904
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21170787
type: Answer
has body: Looks like MiniJavaLexer and MiniJavaParser are not on your class path. Just make sure they do and try to compile again. Looks like they are declared in the same package as there are no imports - that's why you are able to run this in eclipse. Say, those classes are already compiled and are near Main.java try running javac -classpath .:antlr-runtime-3.2.jar Main.java - (use ; to separate paths on Windows and : on Unix) If you only have sources for them they need to be compiled to. One reason they may not be here with ANTLR is that if you are using grammar files to declare lexer and parser and thus first must generate those classes.
score: 1
accepted answer of: http://stackoverflow.com/q/21170787

http://stackoverflow.com/comment/31789274
has text: Can you check whether your IDE imported the right annotation as `JsonProperty` ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21125173

http://stackoverflow.com/comment/33439949
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21169413
has text: @Zeus Bump...pretty desperate
score: 0

http://stackoverflow.com/q/21122999
type: Question
score: 0
possible better answer: http://stackoverflow.com/a/21130669
answer count: 2
has answer: http://stackoverflow.com/a/21130669
tagged with: data-structures
tagged with: avl-tree
favorite count: 0
tagged with: binary-tree
has comment: http://stackoverflow.com/comment/31784384
has title: Can't get Height from AVLTree in JAVA
has answer: http://stackoverflow.com/a/21123316
has body: I am making an AVL Tree as an assignment. I am having problems when getting height of a tree. Something wrong with my code all methods are working properly except height method. When i call getHeight() it shows me that: Zero(0) it has to be 6 or 7. I could not find where i did wrong. class AVLNode&lt;K extends Comparable&lt;K&gt;, V extends K&gt; { AVLNode&lt;K, V&gt; leftChild, rightChild; K key; V value; int avlNodeHeight; /* Constructor */ public AVLNode() { leftChild = null; rightChild = null; key = null; avlNodeHeight = 0; } /* Constructor */ public AVLNode(K n) { leftChild = null; rightChild = null; key = n; avlNodeHeight = 0; } /* Constructor */ public AVLNode(K key, V value) { leftChild = null; rightChild = null; this.key = key; this.value = value; avlNodeHeight = 0; } public void setLeftChild(AVLNode&lt;K, V&gt; leftChild) { this.leftChild = leftChild; } public AVLNode&lt;K, V&gt; getLeftChild() { return leftChild; } public void setRightChild(AVLNode&lt;K, V&gt; rightChild) { this.rightChild = rightChild; } public AVLNode&lt;K, V&gt; getRightChild() { return rightChild; } public void setKey(K key) { this.key = key; } public K getKey() { return key; } public void setValue(V value) { this.value = value; } public V getValue() { return value; } public void setHeight(int height) { avlNodeHeight = height; } public int getHeight() { return avlNodeHeight; } } /* Class AVLTree */ class AVLTree&lt;K extends Comparable&lt;K&gt;, V extends K&gt; { AVLNode&lt;K, V&gt; root; /* Constructor */ public AVLTree() { root = null; } /* Function to check if tree is empty */ public boolean isEmpty() { return root == null; } /* Make the tree logically empty */ public void makeEmpty() { root = null; } /* Function to get height of node */ protected int height(AVLNode&lt;K, V&gt; root) { return root == null ? -1 : root.avlNodeHeight; } /* Function to max of left/right node */ protected int max(int value1, int value2) { return Math.max(value1, value2); } protected K getSmallestValue(A…
has comment: http://stackoverflow.com/comment/31784087
upvote count: 1
downvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21123316
tagged with: java
tagged with: nodes

http://stackoverflow.com/comment/31743169
has text: Lol nope, it isn't a BOT or somthing iLegal , only programming a MapleStory Source.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21099526
score: 0

http://stackoverflow.com/comment/31669976
type: AnswerComment
has text: My understanding of the question is that this would be correct if the line that says `break;` were not there.
score: 0
comment on: http://stackoverflow.com/a/21061131
type: Comment

http://stackoverflow.com/q/21082697
answer count: 4
tagged with: netbeans
has title: Using component outside main class
has answer: http://stackoverflow.com/a/21082763
tagged with: swing
type: AnsweredQuestion
has body: Is there a way to use component created in main class(which extends JFrame) outside that class? I am using netbeans generator and I want to: textArea.setText("") but I don't have access to that textArea component outside main class
tagged with: java
accepted answer: http://stackoverflow.com/a/21082775
type: Question
has comment: http://stackoverflow.com/comment/31710337
has answer: http://stackoverflow.com/a/21082770
has comment: http://stackoverflow.com/comment/31710312
has answer: http://stackoverflow.com/a/21082775
has comment: http://stackoverflow.com/comment/31710315
has comment: http://stackoverflow.com/comment/31710505
has comment: http://stackoverflow.com/comment/31714417
score: 0
linked to: http://stackoverflow.com/q/21074616
possible better answer: http://stackoverflow.com/a/21082770
has answer: http://stackoverflow.com/a/21082751

http://stackoverflow.com/comment/31618866
comment on: http://stackoverflow.com/q/21030178
type: Comment
type: QuestionComment
has text: @paulb: What are all possible `EntityWrapper` values?
score: 0

http://stackoverflow.com/comment/31726829
has text: You can use a ViewPager where ever you want. It doesn't have to necessarily be in a FragmentActivity. If you want Sales, New Lead and Edit Info to be part of a View Pager then they should be Fragments. You then create a ViewPager object and add your 3 fragments to it
comment on: http://stackoverflow.com/a/21092036
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21145206
type: Answer
has body: Try this: package Scanners; import java.util.Scanner; public class ConsoleScanner { static Scanner scanner = new Scanner(System.in); //Creates the scanner public static void main(String[] args){ String input = scanner.NextLine(); //Sets the string input equal to whatever the user types next if(input.equals("Hello")) System.out.println("You typed in: Hello "); if(input.equals("Good Bye")) System.out.println("You typed in: Good Bye"); else{ System.out.println("You typed in: " + input); } } }
answers question: http://stackoverflow.com/q/21145119
score: 0

http://stackoverflow.com/comment/31921088
has text: thanks, but I didn't want to use mapping file because I have a lot of sub-classes. Finally, if you set keyword transient field may be ignored by marshaller in XML file.
type: AnswerComment
comment on: http://stackoverflow.com/a/21159495
score: 0
type: Comment

http://stackoverflow.com/comment/31812498
score: 0
type: AnswerComment
has text: Thanks, BTW my solution is O(n) ?
type: Comment
comment on: http://stackoverflow.com/a/21137495

http://stackoverflow.com/a/21070611
answers question: http://stackoverflow.com/q/21070555
score: 1
downvote count: 0
has body: You need to actually create 42 panels. Currently you have an array with 42 references to the same panel. Change the fillGrid method, so it calls the constructor of JPanel and set the necessary Label etc. (like you do above). Then add it to the GridLayout.
type: Answer
upvote count: 1

http://stackoverflow.com/comment/31636842
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21035815
type: Comment
has text: Sorry, I don't have a ready-made example I can share. Use XML layouts and an adapter, possibly a Loader to fetch the images themselves. Look for some of the GoogleIO talks on Adapter or other resources, there are plenty out there.

http://stackoverflow.com/a/25125101
accepted answer of: http://stackoverflow.com/q/21020926
answers question: http://stackoverflow.com/q/21020926
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
has body: This was a bug and will be fixed in 7.6.Final.

http://stackoverflow.com/comment/31622202
type: Comment
type: QuestionComment
has text: @ccjmne Copy and pasted exactly what you have and I am getting an error under CloseShieldInputStream. Is it part of a class that may need to get imported?
comment on: http://stackoverflow.com/q/21034391
score: 0

http://stackoverflow.com/q/21123055
linked to: http://stackoverflow.com/q/14572270
tagged with: java
has title: Swing - How to dispatch KeyEvents as if by keyboard?
has comment: http://stackoverflow.com/comment/31784262
upvote count: 1
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/3929932
has comment: http://stackoverflow.com/comment/31784433
downvote count: 0
has comment: http://stackoverflow.com/comment/31786362
score: 1
has comment: http://stackoverflow.com/comment/31784233
favorite count: 0
has body: Is there a way to dispatch programmatically constructed KeyEvents so that they are indistinguishable by my application from those arising from physical key presses? I have tried looking at How does Java Dispatch KeyEvents as well as the KeyboardFocusManager and KeyEventDispatcher APIs, but I haven't been able to figure it out, nor is it even clear that these were the correct places to be looking for an answer. Thanks for any help.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31785442
has comment: http://stackoverflow.com/comment/31784318
has comment: http://stackoverflow.com/comment/31786058
tagged with: keyevent
answer count: 0

http://stackoverflow.com/a/21171686
upvote count: 3
has comment: http://stackoverflow.com/comment/31890153
type: Answer
has comment: http://stackoverflow.com/comment/31901716
answers question: http://stackoverflow.com/q/21096412
has comment: http://stackoverflow.com/comment/31873442
score: 2
has body: You'll want to create a Query with hibernate that has two WHERE conditions. @PersistenceContext protected EntityManager em; List&lt;Integer&gt; raceIds = Arrays.asList(1, 2, 3); Query query = em.createQuery("FROM RaceDriver r WHERE r.raceId IN (:raceIds) AND r.disqualified = true"); query.setParameter("raceIds", raceIds); List&lt;RaceDriver&gt; drivers = query.getResultList(); This will return a list of disqualified drivers within the raceIds that you've provided. Update After getting List&lt;RaceDriver&gt; you can for loop on drivers and make List of HashMaps with raceId as a key, and a List of startingNr (of disqualified drivers) as a value. HashMap&lt;Integer,List&lt;Integer&gt;&gt; startingNrHashMap=new...; for(RaceDriver driver:drivers) { List&lt;Integer&gt; strNr = new ArrayList&lt;Integer&gt;(); if(startingNrHashMap.containsKey(driver.race.raceid)) { //if race id is already present in hash map then strNr = startingNrHashMap.get(driver.race.raceid); strNr.add(driver.startingNr); startingNrHashMap.put(driver.race.raceid,strNr); } else { // if race id is NOT present in hash map strNr.add(driver.startingNr); startingNrHashMap.put(driver.race.raceid,strNr); } strNr =null; }
has comment: http://stackoverflow.com/comment/31900928
downvote count: 1

http://stackoverflow.com/a/24539426
score: 0
has comment: http://stackoverflow.com/comment/39341197
type: Answer
has comment: http://stackoverflow.com/comment/58941389
answers question: http://stackoverflow.com/q/21056074
has body: Where did you get the COIOSHelper DLLs? Those don't seem to be included in my IzPack installation. I didn't have to do anything for the ShellLink DLLs, they're just there and work. Also of note, I've found that my "native" entries for the ShellLink DLLs can't be inside the "natives" tag. If I put them there the installer breaks. They have to be right under the "installation" tag.

http://stackoverflow.com/q/21028434
answer count: 4
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21028542
score: 9
type: Question
downvote count: 0
possible better answer: http://stackoverflow.com/a/21028462
favorite count: 0
tagged with: class
has answer: http://stackoverflow.com/a/21028558
has body: The java documentation for Class.getName() says: Returns the name of the entity (class, interface, array class, primitive type, or void) represented by this Class object, as a String. When will it return void?
upvote count: 9
has answer: http://stackoverflow.com/a/21028554
accepted answer: http://stackoverflow.com/a/21028554
has title: When does getClass().getName() return void?
has answer: http://stackoverflow.com/a/21028462

http://stackoverflow.com/q/21160070
has answer: http://stackoverflow.com/a/21160163
has comment: http://stackoverflow.com/comment/31851230
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21160163
has answer: http://stackoverflow.com/a/21160444
tagged with: jvm
tagged with: arraylist
type: Question
tagged with: out-of-memory
has title: Exception created : java.lang.OutOfMemoryError
has answer: http://stackoverflow.com/a/21160218
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/21160218
has comment: http://stackoverflow.com/comment/31851350
has comment: http://stackoverflow.com/comment/31851144
has body: I have made some modification in a code of an existing application. While testing i am getting Exception created : java.lang.OutOfMemoryError. But the error occurs only once in a while. Below the is the code snippet where the error occurs }else if(subject.equals("Mobile")){ to=(String)hashMap.get("M_MOBILETOMAIL"); m_mobileoptionvalue=(String)parameters.get("m_mobileoptionvalue"); m_mobileq1value=(String)parameters.get("m_mobileq1value"); StringTokenizer m_tokenizer1 = new StringTokenizer(m_mobileq1value,"|"); while (m_tokenizer1.hasMoreTokens()){ m_mobileq1List.add(m_tokenizer1.nextToken()); } m_mobileq2value=(String)parameters.get("m_mobileq2value"); StringTokenizer m_tokenizer2 = new StringTokenizer(m_mobileq2value,"|"); while (m_tokenizer2.hasMoreTokens()){ m_mobileq2List.add(m_mobileq2value); } m_mobileq3value=(String)parameters.get("m_mobileq3value"); StringTokenizer m_tokenizer3 = new StringTokenizer(m_mobileq3value,"|"); while (m_tokenizer3.hasMoreTokens()){ m_mobileq3List.add(m_mobileq3value); } m_mobileq4value=(String)parameters.get("m_mobileq4value"); m_mobileq4=(String)parameters.get("m_mobileq4"); } The error i am gettting is in the line m_mobileq2List.add(m_mobileq2value); Also attaching the JVM logs ---- exception created in one of the service methods of the servlet MailSend in application interact_assorted_intapp7. Exception created : java.lang.OutOfMemoryError at java.util.ArrayList.newElementArray(ArrayList.java:94) at java.util.ArrayList.growAtEnd(ArrayList.java:375) at java.util.ArrayList.add(ArrayList.java:158) at com.international.servlets.MailSend.doPost(MailSend.java:473) at javax.servlet.http.HttpServlet.service(HttpServlet.java:738) at javax.servlet.http.HttpServlet.service(HttpServlet.java:831) I went through a few related post but did not get any proper results.Also Increase of HeapSize is out of scope.
tagged with: java
has comment: http://stackoverflow.com/comment/31851076
has comment: http://stackoverflow.com/comment/31851126

http://stackoverflow.com/q/21110921
has title: How to validate a file with valid extension?
upvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21111868
has answer: http://stackoverflow.com/a/70156964
score: 1
has answer: http://stackoverflow.com/a/21111566
tagged with: java
tagged with: file
has body: Lets say the input to my Java code is a jpeg file. How can i verify it before starting process that the input is having a valid extension. Sometimes the user upload a pdf file with extension modified to a jpeg, thus crashing the code. There is a point of magic number with each file. But is there any alternative to solve this problem.
type: Question
has comment: http://stackoverflow.com/comment/31762956
has answer: http://stackoverflow.com/a/21111175
answer count: 6
has comment: http://stackoverflow.com/comment/31761476
linked to: http://stackoverflow.com/q/1915317
has answer: http://stackoverflow.com/a/21111868
accepted answer: http://stackoverflow.com/a/21475184
has answer: http://stackoverflow.com/a/21112785
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21475184

http://stackoverflow.com/comment/31744465
score: 0
has text: Thx. ForkJoinPool is a very elegant solution when dealing with recursive dependent subtasks. Btw.: The JavaDocs of RecursiveTask contain a simple example that's maybe easier to start with (and understand) than the one in the tutorial.
type: AnswerComment
comment on: http://stackoverflow.com/a/21100574
type: Comment

http://stackoverflow.com/q/21118477
has comment: http://stackoverflow.com/comment/31853987
answer count: 1
has comment: http://stackoverflow.com/comment/31892891
favorite count: 0
has comment: http://stackoverflow.com/comment/32376523
has comment: http://stackoverflow.com/comment/31854596
tagged with: linux
has title: Java Glassfish 4 crashes with "double free or corruption (fasttop)"
has comment: http://stackoverflow.com/comment/31892811
has body: I've been running Glassfish 4 on my development environment Windows java version "1.7.0_40" Java(TM) SE Runtime Environment (build 1.7.0_40-b43) Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode) Everything works perfectly. Last week I deployed to a Debian Linux server running: java version "1.7.0_25" OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1~deb7u1) OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode) When running in the Linux environment the application intermittently crashes. It has run for several days without a crash, then crashed several times within a few hours. When it crashes there are no error messages in the glassfish or jvm log files, the process just disappears and in one case the jvm.log contained a line that was truncated. The only clue I've found so far is that the syslog and userlog contain: grep java * syslog:Jan 14 13:41:19 omega-rm java: *** glibc detected *** /usr/lib/jvm/java-7-openjdk-amd64/bin/java: double free or corruption (fasttop): 0x00007fb6ac076730 *** syslog.1:Jan 13 19:48:04 omega-rm java: *** glibc detected *** /usr/lib/jvm/java-7-openjdk-amd64/bin/java: double free or corruption (fasttop): 0x00007fb037835c90 *** user.log:Jan 13 19:48:04 omega-rm java: *** glibc detected *** /usr/lib/jvm/java-7-openjdk-amd64/bin/java: double free or corruption (fasttop): 0x00007fb037835c90 *** user.log:Jan 14 13:41:19 omega-rm java: *** glibc detected *** /usr/lib/jvm/java-7-openjdk-amd64/bin/java: double free or corruption (fasttop): 0x00007fb6ac076730 *** user.log.1:Jan 8 10:19:30 omega-rm java: *** glibc detected *** /usr/lib/jvm/java-7-openjdk-amd64/bin/java: double free or corruption (fasttop): 0x0000000007974a90 *** user.log.1:Jan 8 14:29:11 omega-rm java: *** glibc detected *** /usr/lib/jvm/java-7-openjdk-amd64/bin/java: double free or corruption (fasttop): 0x00000000082431f0 *** user.log.1:Jan 8 14:57:19 omega-rm java: *** glibc detected *** /usr/lib/jvm/java-7-openjdk-amd64/bin/java: double free or corruption (…
upvote count: 1
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32394652
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21468744
has comment: http://stackoverflow.com/comment/31869628
type: Question
has comment: http://stackoverflow.com/comment/31870958
downvote count: 0
tagged with: glassfish
accepted answer: http://stackoverflow.com/a/21468744

http://stackoverflow.com/q/21027366
type: AnsweredQuestion
score: 3
downvote count: 0
has answer: http://stackoverflow.com/a/21028820
favorite count: 0
type: Question
upvote count: 3
accepted answer: http://stackoverflow.com/a/21028820
tagged with: java
has body: I am processing large amounts of data using hadoop MapReduce. The problem is that, ocassionaly, a corrupt file causes Map task to throw a java heap space error or something similar. It would be nice, if possible, to just discard whatever that map task was doing, kill it, and move on with the job, never mind the lost data. I don't want the whole M/R job to fail because of that. Is this possible in hadoop and how?
answer count: 1
has title: Hadoop: Can you silently discard a failed map task?
tagged with: mapreduce
tagged with: hadoop

http://stackoverflow.com/q/21171945
has comment: http://stackoverflow.com/comment/31877259
has comment: http://stackoverflow.com/comment/31880846
tagged with: eclipse
score: 0
has comment: http://stackoverflow.com/comment/31879230
has answer: http://stackoverflow.com/a/21193738
answer count: 1
has title: can't play audio File with JMF
accepted answer: http://stackoverflow.com/a/21193738
has comment: http://stackoverflow.com/comment/31877195
has comment: http://stackoverflow.com/comment/31889334
type: AnsweredQuestion
tagged with: jmf
has body: I have a problem with playing an MP3 file with JMF, it displays the following error : Error: Unable to realize com.sun.media.amovie.AMController@80669d Exception in thread "main" javax.media.CannotRealizeException at javax.media.Manager.blockingCall(Manager.java:2005) at javax.media.Manager.createRealizedPlayer(Manager.java:528) at tp.Main.main(Main.java:44) Error value: 80070020 here is my code : public class Main { public static void main(String[] args) throws NoPlayerException, CannotRealizeException, MalformedURLException, IOException, URISyntaxException { Fenetre F1 = new Fenetre(); F1.setVisible(true); InputStream is = Main.class.getClass().getResourceAsStream("/data/gmu.mp3"); File temp=File.createTempFile("temp", ".mp3"); OutputStream os = new FileOutputStream(temp); int read = 0; byte[] bytes = new byte[1024]; while ((read = is.read(bytes)) != -1) { os.write(bytes, 0, read); } final Player p=Manager.createRealizedPlayer(temp.toURI().toURL()); p.start(); while(true){ if(p.getMediaTime().getSeconds()==p.getDuration().getSeconds()){ p.stop(); p.setMediaTime(new Time(0)); p.start(); } } } } normally it works If I don't use the InputStream, and use simply File f =new File(Main.class.getResource("/data/gmu.mp3").getFile()); final Player p=Manager.createRealizedPlayer(temp.toURI().toURL()); but this way It doesn't work when I pack my JAR file, so I'm trying to use InputStream, the aim is to make a JAR with a WORKING music
tagged with: java
has comment: http://stackoverflow.com/comment/31873186
type: Question

http://stackoverflow.com/comment/31612855
comment on: http://stackoverflow.com/q/21029604
type: Comment
has text: @MarcB I know by this code that is inside, but probably is a typo.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31721676
type: Comment
has text: Thanks @bellabax, it worked. I had to made some slight changes:set stepExecution as StepExecution type and then use the getExecutionContext().putInt() to add lineNumber. Finally added MyLineMapper as a listener in step1
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21088121

http://stackoverflow.com/comment/31786183
type: Comment
has text: @NPE Yes, I want to distribute the IO efficiently among them but it seems the processor is not serving the third application at all, even for the non IO part
comment on: http://stackoverflow.com/q/21123972
score: 0
type: QuestionComment

http://stackoverflow.com/q/21028117
upvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21028428
type: Question
tagged with: multiprocessing
has comment: http://stackoverflow.com/comment/31610134
has comment: http://stackoverflow.com/comment/31610204
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/21028215
has title: In-Process communication way
accepted answer: http://stackoverflow.com/a/21028428
has answer: http://stackoverflow.com/a/21028215
has body: I have 2 programs. I want create task delegation between programs. How can I provide task to other program without RabbitMQ and socket-based server? I want to implement only with vanilla Java way. I see: pipes ExecutorService
has comment: http://stackoverflow.com/comment/31610085
has comment: http://stackoverflow.com/comment/31610505
score: 1
favorite count: 0
tagged with: multithreading

http://stackoverflow.com/comment/31740895
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21082030
has text: Without a runnable example, it's impossible to know exactly what's going on
score: 0

http://stackoverflow.com/comment/31784650
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21122990
has text: If you want an alternative to Swing you can also try [JavaFX](http://docs.oracle.com/javafx/).
score: 0

http://stackoverflow.com/comment/31856907
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21163397
has text: Where's the effort on your part?
type: QuestionComment

http://stackoverflow.com/comment/31809029
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21137055
type: Comment
has text: It didn't change anything - most important things because you added something to the already visible JFrame, rest is elsewhere

http://stackoverflow.com/comment/31881053
type: Comment
has text: The reason I don't like to use JButtons is because I have stylish images that I want to use in place of the custom Java buttons. I feel like the layout managers don't offer me much flexibility.
comment on: http://stackoverflow.com/a/21171391
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31612711
score: 0
comment on: http://stackoverflow.com/q/21029015
type: Comment
type: QuestionComment
has text: Can you also post the XML layout for your Activity?

http://stackoverflow.com/comment/31868980
has text: u can use substring method for this
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21169863
type: QuestionComment

http://stackoverflow.com/q/21133013
answer count: 2
accepted answer: http://stackoverflow.com/a/21233056
favorite count: 0
has title: Custom InputFormat or InputReader for Excel files(xls)
possible better answer: http://stackoverflow.com/a/21140565
has answer: http://stackoverflow.com/a/21140565
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42169964
upvote count: 2
score: 1
has answer: http://stackoverflow.com/a/21233056
downvote count: 1
tagged with: excel
type: Question
has body: I need to read a excel(xls) file stored on Hadoop cluster. Now I did some research and found out that I need to create a custom InputFormat for that. I read many articles but none of them is helpful from programming point of view. If someone can help me with sample code for writing custom inputformat so that I can understand the basics of "Programming InputFormat" and can use Apache POI library to read the excel file. I had made a mapreduce program for reading text file. Now I need help regarding the fact that even if I some how manage to code my own custom InputFormat where would I write the code in respect to the mapreduce program I have already written. PS:- converting the .xls file into .csv file is not an option.
tagged with: java
tagged with: mapreduce
tagged with: hadoop

http://stackoverflow.com/a/21035253
type: Answer
answers question: http://stackoverflow.com/q/21035043
has body: I have two solutions first solution (you need Java 7): ... ProcessBuilder pb = new ProcessBuilder("ls"); pb.redirectOutput(Redirect.INHERIT); Process p = pb.start(); second solution: Process p=Runtime.getRuntime().exec("ls"); InputStream is = p.getInputStream(); int c; StringBuilder commandResponse = new StringBuilder(); while( (c = is.read()) != -1) { commandResponse.append((char)c); } System.out.println(commandResponse); is.close();
score: 0

http://stackoverflow.com/q/21061060
tagged with: java
type: Question
has title: Best practice to update my data structure?
has answer: http://stackoverflow.com/a/21061105
accepted answer: http://stackoverflow.com/a/21061105
score: 0
tagged with: android
answer count: 1
type: AnsweredQuestion
has body: I have the following problem and need a best practice to solve it: I have a App with a List of data of Type Foo. This list (ArrayList&lt;Foo&gt;) I save to the file system with: FileOutputStream fos = context.openFileOutput(FILENAME, Context.MODE_PRIVATE); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(MyList); oos.close(); When I start the App I load it with: FileInputStream fis = context.openFileInput(FILENAME); ObjectInputStream ois = new ObjectInputStream(fis); MyList = (ArrayList&lt;Foo&gt;) ois.readObject(); ois.close(); Now my problem: I want to extend the Foo class with some additional attributes. The problem is, that a user has the old list saved and want to load it into the new Foo class, the app will crash. What is a a best practice to solve this update problem?

http://stackoverflow.com/comment/31662471
type: AnswerComment
has text: can initialize the number to a value it won't be.
comment on: http://stackoverflow.com/a/21056555
type: Comment
score: 1

http://stackoverflow.com/q/21090289
has answer: http://stackoverflow.com/a/22368070
type: Question
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31723567
has comment: http://stackoverflow.com/comment/32747141
tagged with: osgi
has comment: http://stackoverflow.com/comment/31724704
has comment: http://stackoverflow.com/comment/31723720
favorite count: 0
has title: How to use package from com.sun
has body: I'm working on a commercial software which needs the package com.sun.rowset.CachedRowSetImpl I tried many times import the package but many times unsuccessful because I use OSGI and this makes the import of the package very difficult. I found the original source code here: http://www.docjar.com/html/api/com/sun/rowset/CachedRowSetImpl.java.html One quick way will be just copy the code and use it. But if I do this I may violate the license because my application source code is closed. Can you give me some advice how I can solve this issue?
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java

http://stackoverflow.com/comment/31815204
has text: @Konrad Thanks for your detailed answer. My issue now is that nextToken method uses variables and methods defined in the outer class. how is that achieved in C#?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21137608

http://stackoverflow.com/comment/125467452
score: 3
type: AnswerComment
has text: @omjego because it never was an intended feature. The Stream implementation happened to use Fork/Join tasks and it wasn’t considered that these tasks have the feature of picking up the caller’s pool if being called from a Fork/Join pool’s worker thread. Even today, this trick is not documented nor officially supported. That’s also the reason why the first versions didn’t respect the custom pool’s parallelism but inconsistently used the common pool’s. Using a different pool wasn’t foreseen.
comment on: http://stackoverflow.com/a/50575042
type: Comment

http://stackoverflow.com/a/21053564
score: 0
answers question: http://stackoverflow.com/q/21053438
type: Answer
has body: For MySQL: select * from Kabinet order by id DESC limit 1 For MSSQL: select top 1 * from Kabinet order by id DESC For Oracle: select * from Kabinet where rownum&lt;2 order by id DESC
has comment: http://stackoverflow.com/comment/31657134

http://stackoverflow.com/q/21112848
tagged with: selenium
has comment: http://stackoverflow.com/comment/31767518
score: 2
downvote count: 0
has title: selenium no suitable method found for until(ExpectedCondition<WebElement>)
tagged with: java
type: Question
upvote count: 2
answer count: 1
has body: This is a wired issue ! The project I've imported was working 100% (several months ago) and today I've imported it with the dependencies and there is an issue in WebDriverWait Here is my code : WebDriverWait driverWait = new WebDriverWait(driver, 10000); driverWait.until(ExpectedConditions.presenceOfElementLocated(By.id("saveBut1")));//here's the issue Here is the error: no suitable method found for until(ExpectedCondition&lt;WebElement&gt;) method FluentWait.until(Predicate&lt;WebDriver&gt;) is not applicable (argument mismatch; ExpectedCondition&lt;WebElement&gt; cannot be converted to Predicate&lt;WebDriver&gt;) method FluentWait.&lt;V&gt;until(Function&lt;? super WebDriver,V&gt;) is not applicable (cannot infer type-variable(s) V (argument mismatch; ExpectedCondition&lt;WebElement&gt; cannot be converted to Function&lt;? super WebDriver,V&gt;)) where V,T are type-variables: V extends Object declared in method &lt;V&gt;until(Function&lt;? super T,V&gt;) T extends Object declared in class FluentWait I'm using Netbeans as IDE and I export the project (3 months ago) using it
has comment: http://stackoverflow.com/comment/31768743
favorite count: 0
has comment: http://stackoverflow.com/comment/31765284
tagged with: netbeans
has answer: http://stackoverflow.com/a/22312117
type: UnansweredQuestion

http://stackoverflow.com/comment/52617085
type: AnswerComment
comment on: http://stackoverflow.com/a/21098682
type: Comment
has text: For DAOs check http://stackoverflow.com/questions/3223112/javaee6-dao-should-it-be-stateless-or-applicationscoped (in a few words DAOs should not be EJBs).
score: 0

http://stackoverflow.com/comment/31738992
type: QuestionComment
comment on: http://stackoverflow.com/q/21096036
type: Comment
has text: I don't know, I was never able to get it working... unless I comment out the the second line and replace it with a result of `orb.object_to_string(objRef)` from the second snippet, that is a ref like this: `IOR:00000...41a`.
score: 0

http://stackoverflow.com/q/21157309
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has comment: http://stackoverflow.com/comment/31846276
type: Question
has answer: http://stackoverflow.com/a/21157404
has comment: http://stackoverflow.com/comment/31846339
possible better answer: http://stackoverflow.com/a/21157404
score: 0
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/21157365
has answer: http://stackoverflow.com/a/21157510
has title: Android - Deserialize this JSON to a POJO
accepted answer: http://stackoverflow.com/a/21157365
has body: This is my JSON: { "results": [ { "user_id": "1", "item_id": "18630", "name": "Unnamed Item", "price": "0", "description": "", "created_at": "2014-01-16 15:31:36", "thumbnail": { "image50": "http://www.example.com/adsa.jpg", "image100": "hhttp://www.example.com/adsa.jpg" },... Am I doing the deserialization right? public class ItemListModel { private String user_id; private String item_id; private String name; private String price; private String category; private ArrayList&lt;ThumbnailResponse&gt; thumbnail; public ItemListModel(){} // getters } public class ThumbnailResponse { private String image50; private String image100; public ThumbnailResponse(){ } //getters } I'm just confused, when do we use ArrayList, Array or List for array or object in the JSON file? One more thing, do I need to make results as an array too if that's the case?

http://stackoverflow.com/a/21183935
has comment: http://stackoverflow.com/comment/31893911
accepted answer of: http://stackoverflow.com/q/21183858
has comment: http://stackoverflow.com/comment/31897002
has body: You need to state an identifier after SingularValueDecomposition like SingularValueDecomposition myValueDecomp = An.svd(); etter paste your code then. I just downloaded Jama and created a simple code snippet with your getSingularVectors method in NetBeans and Eclipse Kepler and it works for me. my code: private ArrayList&lt;Vector&lt;Double&gt;&gt; getSingularVectors(Matrix an, int i){ ArrayList&lt;Vector&lt;Double&gt;&gt; list = new ArrayList&lt;Vector&lt;Double&gt;&gt;(i); SingularValueDecomposition svd = an.svd(); return list; }
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21183858
type: Answer

http://stackoverflow.com/q/21141040
upvote count: 1
has title: How to copy nodes if they don't belong to the same AST
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse-jdt
tagged with: abstract-syntax-tree
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21160448
favorite count: 0
has body: Using Eclipse JDT I would like to copy code from multiple source CompilationUnits to a central CompilationUnit. I am using ASTRewrite to collect all the changes. In order to copy the code, I use ASTRewrite.createCopyTarget(ASTNode) to create a virtual copy which I would then like to add to my central CompilationUnit. My problem is that ASTRewrite.createCopyTarget(ASTNode) throws an IllegalArgumentException: java.lang.IllegalArgumentException: Node is not inside the AST at org.eclipse.jdt.core.dom.rewrite.ASTRewrite.validateIsCorrectAST(ASTRewrite.java:582) ~[na:na] at org.eclipse.jdt.core.dom.rewrite.ASTRewrite.createTargetNode(ASTRewrite.java:698) ~[na:na] at org.eclipse.jdt.core.dom.rewrite.ASTRewrite.createCopyTarget(ASTRewrite.java:723) ~[na:na] The ASTRewrite is setup using the AST for the central target CompilationUnit. So the question is: Is it possible to parse multiple Units, so they belong to the same AST? Or ist it passible to set the parent AST of a CompilationUnit in some way? My parsing code looks like this: private static ASTParser parser = ASTParser.newParser(AST.JLS4); public static CompilationUnit parseAst(IType type, SubMonitor progress) { parser.setSource(type.getCompilationUnit()); parser.setResolveBindings(true); return (CompilationUnit)parser.createAST(progress); } I assume, that this must be possible in some way, otherwise ASTRewrite.createCopyTarget(ASTNode) would be restricted to creating copies in the scope of a CompilationUnit only. Any pointers are greatly appriciated!
accepted answer: http://stackoverflow.com/a/21160448

http://stackoverflow.com/q/21106156
has answer: http://stackoverflow.com/a/21106226
upvote count: 3
tagged with: java
type: Question
has title: jacoco:check failing due to invalid parameters
score: 3
has body: I am trying to run a maven build in my eclipse environment and I receive the following error: [ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.6.1.201212231917:check (check) on project schedule-adapter: The parameters 'check' for goal org.jacoco:jacoco-maven-plugin:0.6.1.201212231917:check are missing or invalid -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jacoco:jacoco-maven-plugin:0.6.1.201212231917:check (check) on project schedule-adapter: The parameters 'check' for goal org.jacoco:jacoco-maven-plugin:0.6.1.201212231917:check are missing or invalid at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:221) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) I don't understand as this works in my other project in a different workspace. I copied the exact jacoco config over to my new project pom, and it reads as follows: org.jacoco jacoco-maven-plugin ${jacoco.version} prepare-agent prepare-agent report prepare-package report check check true INSTRUCTION COVEREDRATIO 0.75 CLASS COVEREDRATIO 0.75 METHOD COVEREDRATIO 0.75 BRANCH COVEREDRATIO 0.75 COMPLEXITY COVEREDRATIO 0.75 LINE COVEREDRATIO 0.75 My maven command from running in eclipse is mvn clean install -e Anything stand out to anyone? I've been trying to figure this out for a while. When I remove all of this from my pom, my project builds but jacoco is not checked. Thanks Ryan
tagged with: jacoco
tagged with: eclipse
downvote count: 0
answer count: 1
favorite count: 0
tagged with: eclemma
type: UnansweredQuestion
tagged with: maven

http://stackoverflow.com/q/21054013
has comment: http://stackoverflow.com/comment/31657253
has comment: http://stackoverflow.com/comment/31657019
answer count: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/21054272
has answer: http://stackoverflow.com/a/21054501
linked to: http://stackoverflow.com/q/11843690
has answer: http://stackoverflow.com/a/21054272
has comment: http://stackoverflow.com/comment/31656766
has body: I have a two servlets in my application and I want an object of class A to be injected to both the servlets, and I would also like the same ApplicationContext throughout the application i.e. both servlets as mentioned in the first answer of this question on SO: Spring injection Into Servlet Now I went through many questions like these but couldnt find something exactly that matches my question. To explain better Ill write a rough code here: public class servletOne extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } } public class servletTwo extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } } So above are the two servelts now in applicationContext.xml I want to pass an object to both these servlets so as per normal convention I want a functionality like this: <property name="message" ref="classObject" /> <property name="message" ref="classObject" /> I dont know if this is possible or not, I am new to spring and I have only basic knowledge of dependency Injection. If anyone can help me with this I would really really appreciate it. This would clear a lot of my doubts and help me move forward in the process of learning Spring. This is web.xml contextConfigLocation /WEB-INF/applicationContext.xml org.springframework.web.context.ContextLoaderListener dispatcher org.springframework.web.servlet.DispatcherServlet 2 servletOne mypackage.servletOne servletTwo mypackage.servletTwo dispatcher *.htm servletOne /servletOne servletTwo /servletTwo 300 </web-app>
tagged with: spring
has comment: http://stackoverflow.com/comment/31657030
upvote count: 6
accepted answer: http://stackoverflow.com/a/21054501
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31657058
has comment: http://stackoverflow.com/comment/31656885
tagged with: java
score: 6
type: Question
has comment: http://stackoverflow.com/comment/31657153
tagged with: servlets
linked to: http://stackoverflow.com/q/18745770
has title: I want to inject an object in servlet using Spring

http://stackoverflow.com/comment/31813457
has text: @Andreas, thanks for pointing it out. I have corrected the answer.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21138718
type: AnswerComment

http://stackoverflow.com/a/21025470
answers question: http://stackoverflow.com/q/21025449
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/31605731
has body: Is it correct to say that this multidimensional array is also an array of objects? Yes, that is correct. An array is an object. So, an array of arrays, is an array of objects.
type: Answer

http://stackoverflow.com/a/72716758
upvote count: 0
type: Answer
score: -1
answers question: http://stackoverflow.com/q/21076179
has body: This is for Glassfish Server: Normally Glassfish looks at the cacerts.jks certificate file stored in the GLASSFISH_SERVER\glassfish\domains\domain1\config location.You can change this configuration or replace cacerts.jks file with your cacerts file. There are some default JVM Options which Glassfish is used: -XX:+UnlockDiagnosticVMOptions -XX:NewRatio=2 -XX:MaxPermSize=192m -Xmx512m -client -javaagent:C:/glassfish5/glassfish/lib/monitor/flashlight-agent.jar -Djavax.xml.accessExternalSchema=all -Djavax.net.ssl.trustStore=C:\glassfish5\glassfish\domains\domain1/config/cacerts.jks -Djdk.tls.rejectClientInitiatedRenegotiation=true -Djdk.corba.allowOutputStreamSubclass=true
downvote count: 1

authorization
tags question: http://stackoverflow.com/q/21138115
tag name: authorization
type: Tag

http://stackoverflow.com/q/21154393
tagged with: jvm
has answer: http://stackoverflow.com/a/21154781
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31841624
score: 1
tagged with: shutdown-hook
upvote count: 1
has answer: http://stackoverflow.com/a/21154715
type: Question
tagged with: weblogic
has title: Java shutdown hook across different JVM
tagged with: java
has body: Can i attach java shutdown hook across jvm . I mean can I attach shut down from my JVM to weblogic server running in different jvm?
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/13599217

http://stackoverflow.com/comment/31811156
comment on: http://stackoverflow.com/a/21138196
score: 0
type: AnswerComment
type: Comment
has text: "\s+" gives me: Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )

http://stackoverflow.com/q/21028954
accepted answer: http://stackoverflow.com/a/21031122
upvote count: 4
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
tagged with: java
has body: I am creating a web application which is based on Spring mvc framework.This application contains four radio buttons.My requirement is to pass the selection of radio buttons to controller that part is done.Now,once the selection is passed to controller then I don't know how to retain the selection of the radio on JSP.Because When I am returning the name of jsp as index.jsp then page is getting reloaded with intial values of no selection in radio button &lt;form id="envselection" action="${pageContext.request.contextPath}/env" method="post"&gt; &lt;input type="radio" name="env" id="radioSelection" value="QA 71" onclick="submitForm()"&gt; &lt;input type="radio" name="env" id="radioSelection" value="QA 72" onclick="submitForm()"&gt; &lt;input type="radio" name="env" id="radioSelection" value="QA 73" onclick="submitForm()"&gt; &lt;input type="radio" name="env" id="radioSelection" value="QA 74" onclick="submitForm()"&gt; &lt;/form&gt; Javascript &lt;script&gt; function submitForm() { document.getElementById("envselection").submit(); } &lt;/script&gt; Controller part @RequestMapping(value = "/env", method = RequestMethod.POST) public String env(HttpServletRequest request){ logger.info("parameter is "+request.getParameter("env")); return "index"; } Is there any other way of setting the selected value of radio button for java use and retaining the selection of radio button on JSP also. Thanks in advance
type: Question
has title: Radio button selection and its value in spring mvc
tagged with: javascript
score: 4
answer count: 1
tagged with: jsp
favorite count: 0
has answer: http://stackoverflow.com/a/21031122

http://stackoverflow.com/a/21175153
downvote count: 0
has comment: http://stackoverflow.com/comment/31879106
has comment: http://stackoverflow.com/comment/31879073
has body: You need to match the DateFormat pattern to your input String SimpleDateFormat parseRDate = new SimpleDateFormat("MM/dd/yyyy"); Any idea how I can convert the format from MM/dd/YYYY to yyyy-MM-dd HH:mm:ss? All you need to do is use a separate SimpleDateFormat instance for formatting SimpleDateFormat output = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); System.out.println(output.format(date1));
type: Answer
has comment: http://stackoverflow.com/comment/31880293
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/31879594
answers question: http://stackoverflow.com/q/21175104

http://stackoverflow.com/comment/31704228
type: Comment
has text: Show your entire xml, please.
comment on: http://stackoverflow.com/q/21079636
score: 1
type: QuestionComment

http://stackoverflow.com/comment/31978928
score: 0
type: AnswerComment
has text: See,an access-point helps to connect wireless devices to a wired network. By outdoor I meant an access-point is outside the building. Indoor access-point meant its inside the building. These access-points are connected to the router through a switch. When using the above code i'm getting the ip and other details of the router like subnet mask. What i am looking for is , when I turn on wifi near an access point and use any of the tool or code ( i'm also the member of the network), i should be getting the ip of the outdoor/indoor access-point THAT I AM CONNECTED TO not the router.
type: Comment
comment on: http://stackoverflow.com/a/21179322

http://stackoverflow.com/comment/31750538
comment on: http://stackoverflow.com/a/21103369
has text: Yesss... thank you so much. `<#local captured><#nested></#local>` with regular expressions is what better suits my needs, why?, becuase if I can deliver my solution without custom java code it means that a System Administrator will be able to edit the template without need of I to recompile, if requirements change in a near future. How can I upvote more than once your answer?, I appreciate the Java-side solutions too to better understand Freemarker architecture, I'll check it out deeper. Kind regards.
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/21082817
has comment: http://stackoverflow.com/comment/31710613
tagged with: java
has comment: http://stackoverflow.com/comment/31710626
tagged with: jpanel
possible better answer: http://stackoverflow.com/a/21082942
accepted answer: http://stackoverflow.com/a/21082925
has comment: http://stackoverflow.com/comment/31710583
has comment: http://stackoverflow.com/comment/31710646
has comment: http://stackoverflow.com/comment/31710503
has answer: http://stackoverflow.com/a/21082942
has comment: http://stackoverflow.com/comment/31710490
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31710508
has title: Graphics are blocked out when I add a JPanel to the frame (java)
has body: I have some Graphics2D graphics displayed in my frame, and then I added a JPanel to the entire frame so that I can add a mouselistener to clicks anywhere in the panel. However, the graphics disappear, I assume blocked out by the frame. I tried setting the panel to visible false, but that didnt do anything. How can I keep my mouselistener listening on the entire window, and still display my graphics? EDIT: Heres a bit of code: EDIT:(and some more) //adding the panel and mouselistener JPanel allPanel = new JPanel(); allPanel.addMouseListener(this); frame.add(allPanel); //... //drawing some of the graphics public void draw() { frame.add(new CustomPaintComponent()); // Display the frame frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); frame.setVisible(true); JPanel allPanel = new JPanel(); allPanel.addMouseListener(this); frame.add(allPanel); } static class CustomPaintComponent extends Component { private static final long serialVersionUID = 1L; public void paint(Graphics g) { Graphics2D g2d = (Graphics2D)g; g2d.fillRoundRect(10, 10, 50, 50, 10,10); //...
has comment: http://stackoverflow.com/comment/31710597
score: 0
tagged with: graphics2d
has comment: http://stackoverflow.com/comment/31710557
tagged with: mouselistener
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21082925

http://stackoverflow.com/a/21118345
has comment: http://stackoverflow.com/comment/31775665
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31775878
has comment: http://stackoverflow.com/comment/31776735
has comment: http://stackoverflow.com/comment/31776580
has body: You really don't have any handling code to offer for your checked exception. It will be perfectly acceptable if that exception just propagates to the caller, in this case the place where new Relay1() is written. To achieve this, write as follows: final PiFace piface; { try { piface = new PiFaceDevice(PiFace.DEFAULT_ADDRESS, Spi.CHANNEL_0); } catch(IOException e) { throw new RuntimeException("Failed to create Pi Face Device", e); } } This will allow you to both preserve the diagnostic information in the exception, and to satisfy the compiler's wish.
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31775705
has comment: http://stackoverflow.com/comment/31775806
accepted answer of: http://stackoverflow.com/q/21117967
has comment: http://stackoverflow.com/comment/31776073
answers question: http://stackoverflow.com/q/21117967
upvote count: 3

http://stackoverflow.com/comment/31817706
comment on: http://stackoverflow.com/a/21138482
score: 0
type: AnswerComment
type: Comment
has text: main issue is collison..how to get the total_hit updated only once per rectangle intersection

http://stackoverflow.com/a/21124118
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21123852
has body: On a servlet container, each request will be handled from the moment the request is received until the response is returned by only one thread (request == current thread). So it's a matter of putting a servlet filter BEFORE the spring security filter chain (with the filter-mapping element above the filter-mapping of spring security), and storing the request and response in the thread using a ThreadLocal variable - see also this answer. Then on the DarnGoodAuthenticaionProvider access the request using a static method RequestResponseHolder.getRequest(). web.xml config: saveRequestResponseFilter sample.save.request.filter.SaveRequestResponseFilter saveRequestResponseFilter /mobilews/* Filter to save the request response in the thread: public class SaveRequestResponseFilter implements Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse resp = (HttpServletResponse) response; RequestResponseHolder.setRequestResponse(req,resp); try { chain.doFilter(request, response); } finally { RequestResponseHolder.clear(); } } @Override public void init(FilterConfig filterConfig) throws ServletException { ... } @Override public void destroy() { ... } } Request/Response holder: public class RequestResponseHolder { private static ThreadLocal<HttpServletRequest> requestHolder = new ThreadLocal<HttpServletRequest>(); private static ThreadLocal<HttpServletResponse> responseHolder = new ThreadLocal<HttpServletResponse>(); public static void setRequestResponse(HttpServletRequest request, HttpServletResponse response) { requestHolder.set(request); responseHolder.set(response); } public static HttpServletRequest getServletRequest(){ return requestHolder.get(); } public static HttpServletResponse getServletResponse() { return responseHolder.get(); } public static void clear() { requestHolder.remove(); responseHolder.remove(); …
type: Answer
accepted answer of: http://stackoverflow.com/q/21123852

http://stackoverflow.com/comment/31796548
type: AnswerComment
has text: You should use `BufferedImage` if you are painting. Not an `ImageIcon`. I was just using a quick example without having to paint. But I used your class in my **EDIT** and it also works fine
type: Comment
comment on: http://stackoverflow.com/a/21129583
score: 0

http://stackoverflow.com/a/45055091
has body: For mac users First Try : go to activity monitor -> search for java and kill the instance then restart the server and try. Second Try: Check log file for any errors under tomcat logs folder. Use below command to check tomcat logs in terminal tail -f {tomcatpath}/logs/catalina.out Third Try: Check if node or other apps using the same port. Use below command to check which app listening to a specific port. You will see list of apps with pid in second column. lsof -i :8080 | grep LISTEN Kill the process using below command sudo kill -9 pid
upvote count: 1
answers question: http://stackoverflow.com/q/21021136
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/21128963
tagged with: sql
linked to: http://stackoverflow.com/q/7391876
tagged with: jdbc
has body: Guys Here's what I am having. The current error is javax.servlet.ServletException: java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state and this is the piece of work thats causing the error String query3 = "SELECT Last(threadID) AS thread2 FROM msthread"; ResultSet rs = stmt.executeQuery(query3); rs.getString("thread2"); The result of that query is only to return 1 column and 1 row, ran it through MSAccess and it showed exactly what I wanted to see. This is exactly what it looks like: thread2 43 But now I kept getting the Invalid Cursor State error. I have no idea why. Thanks for the help guys
tagged with: ms-access
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21136236
tagged with: java
has comment: http://stackoverflow.com/comment/31807424
type: Question
tagged with: jdbc-odbc
answer count: 1
has title: [Microsoft][ODBC Driver Manager] Invalid cursor state
score: 0

http://stackoverflow.com/q/21175835
type: Question
possible better answer: http://stackoverflow.com/a/21175862
has title: Why does this not short circuit?
has body: public static void main(String args[]){ String s = null; if(false &amp;&amp; false || s.equalsIgnoreCase("x")) { //throws an exception System.out.println("true"); } else { System.out.println("false"); } } I was expecting after this encounters false to short circuit but it doesn't. Why is that? I assumed if you have a false there is NO need to proceed to the next &amp;&amp;. Please help me to understand.
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31880386
has answer: http://stackoverflow.com/a/21175865
favorite count: 0
has answer: http://stackoverflow.com/a/21175863
has comment: http://stackoverflow.com/comment/31880400
accepted answer: http://stackoverflow.com/a/21175864
has answer: http://stackoverflow.com/a/21175862
answer count: 4
has comment: http://stackoverflow.com/comment/31880367
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21175864
tagged with: java
has comment: http://stackoverflow.com/comment/31880361

http://stackoverflow.com/comment/31776947
type: QuestionComment
score: 0
has text: Not static.. adding simpler example down now
comment on: http://stackoverflow.com/q/21119142
type: Comment

http://stackoverflow.com/comment/31887029
has text: It will print "test" every time the panel is painted. Try moving / resizing the frame, it will print "test" often.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21179663
type: Comment

http://stackoverflow.com/a/21143891
has body: Since you failed to mention your framework, I'll suggest this. If you wrap your game in Swing framework, just use a javax.swing.Timer Timer timer = new Timer(delay null); public Game() { timer = new Timer(delay, new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { Game.stop(); timer.stop(); } }); } After the delay time is up, the game will stop. You can use timer.start(); in whatever method you use to start the game.
score: 0
answers question: http://stackoverflow.com/q/21143416
type: Answer

http://stackoverflow.com/q/21088324
accepted answer: http://stackoverflow.com/a/21088958
tagged with: swing
answer count: 1
has body: I am writing a java swing application that collects data from textfields and stores it in a database. I have a JmenuItem that i want to use to display the data in the database. I have a class that collects the data from the database and inserts the data in the jtable. The class extends jframe. Now the problem i have is executing that class from the jmenuitem. When i click the jmenuitem it displays an empty jframe without the table. here is the code for the class with the jtable. The class is Reports2 public class Reports2 extends JFrame { Connection con = null; Statement st; ResultSet rs; public static void main(String[]args) throws Exception { try { Connection con= null ; Statement st; ResultSet rs; String url = "jdbc:mysql://localhost:3306/first"; String user = "root"; String password = "Admin123"; try{ con = DriverManager.getConnection(url,user,password); st = con.createStatement(); String qry = "SELECT * FROM request"; rs = st.executeQuery(qry); JTable table = new JTable(buildTableModel(rs)); JFrame frame = new JFrame("Reports"); frame.setSize(800, 700); frame.add(table); frame.setVisible(true); } catch (SQLException ex) { Logger.getLogger(Reports2.class.getName()).log(Level.SEVERE, null, ex); } }catch(Exception e){ }} public static DefaultTableModel buildTableModel(ResultSet rs) throws Exception{ ResultSetMetaData metaData = rs.getMetaData(); Vector&lt;String&gt; columnNames = new Vector &lt;String&gt;(); int columnCount = metaData.getColumnCount(); for(int column = 1; column&lt;=columnCount;column++){ columnNames.add(metaData.getColumnName(column)); } 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); } return new DefaultTableModel(data, columnNames); } } Here is the code of the jmenuitem. The Jmenuitem variable name is get_repo…
score: 0
tagged with: java
tagged with: jmenuitem
has title: JMenuItem displays an empty Jframe when clicked
tagged with: actionlistener
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21088958
tagged with: jtable
type: Question

http://stackoverflow.com/comment/31773550
type: Comment
type: QuestionComment
has text: Please explain what exactly you're trying to do; it's not clear. If you're asking about testing a validator, then the existing validator libraries have extensive test suites already. If you're asking about making sure that your configuration has one wired up correctly, you need to load a test context, pass in an invalid object, and make sure you get the appropriate application error.
comment on: http://stackoverflow.com/q/21117324
score: 0

http://stackoverflow.com/comment/31718130
type: QuestionComment
comment on: http://stackoverflow.com/q/21086491
has text: Also provide details on how you are doing that.
score: 0
type: Comment

http://stackoverflow.com/comment/31686003
comment on: http://stackoverflow.com/q/21069591
score: 0
type: QuestionComment
type: Comment
has text: Can you give an example of exactly what result you expect? Are you trying to find where two or more rectangles intersect? The bounding box of two or more rectangles? Something else?

http://stackoverflow.com/a/21086542
answers question: http://stackoverflow.com/q/21084225
type: Answer
has comment: http://stackoverflow.com/comment/31719274
has comment: http://stackoverflow.com/comment/31717323
has body: You havent specified the XML namespace location for the MVC schema in your i_am_alive-servlet.xml file, which is why the validation failure. <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" xmlns:mvc="http://www.springframework.org/schema/mvc" 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"> This is just the snippet of your i_am_alive-servlet.xml You need to add this to the xmlSchemaDefinition http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd and it should work in my opinion. Having said that, dont you want to qualify your schema definitions with the version? I see that your applicationContext.xml uses the 3.0 version in it. but your i_am_alive-servlet.xml which is the WebAppContext would use the 4.0 xml schema for validation. I would suggest you use the same schema definitions in your i_am_alive-servlet.…
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31724692

http://stackoverflow.com/a/21022456
has comment: http://stackoverflow.com/comment/31600604
has comment: http://stackoverflow.com/comment/31600496
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/31600673
answers question: http://stackoverflow.com/q/21022180
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31599457
has comment: http://stackoverflow.com/comment/31599993
has body: Your effect directory should be a direct child of the src dir. Also in which case, you need a / to start the string path. So you would need this System.out.println(Logic.class.getResource("/effects/newball.wav")); ProjectRoot src effect newball.wav What I normally do using an IDE is just create a new package and name it whatever I want the file to be - in your case "effect". It's easier that way. UPDATE "I did it exatly so, but it still returns null" It works fine for me package stackoverflow; public class Test { public static void main(String[] args) { System.out.println(Test.class.getResource("/effects/stack_reverse.png")); } } Output: file:/C:/Android/workspace/StackOverflow/bin/effects/stack_reverse.png

http://stackoverflow.com/comment/31774537
score: 0
type: AnswerComment
has text: Eclipse balks at me: "Type mismatch: cannot convert from Map<String,String> to LinkedHashMap<String,String>". I can cast it to a LinkedHashMap.. but that still leave me scratching my head as to why I would define it as `Map<T,T>` instead of `LinkedHashMap<T,T>`
type: Comment
comment on: http://stackoverflow.com/a/21117930

http://stackoverflow.com/q/21055622
has comment: http://stackoverflow.com/comment/31662074
linked to: http://stackoverflow.com/q/6255106
has comment: http://stackoverflow.com/comment/31660996
type: AnsweredQuestion
has body: I have written a code for a calculator but it is not working 100% reliably,yet. Every time I do a calculation, for example: "1+1=2", and I want to do another calculation I have to close the applet and start it again. How can I make it go back at the start. Here is the code: package beispiele; import java.awt.*; import java.awt.event.*; import java.applet.*; public class Kalkulator extends Applet { String arg1= "", arg2=""; int ergebnis; Button zahl[] =new Button[10]; Button funktion[] = new Button[4]; Button ausfuehren; Panel zahlPanel,funktionPanel,ergebnisPanel; TextField ergebnisFeld; int operationArgument; char operation; public void init () { operationArgument= 1; operation =' '; setLayout(new BorderLayout()); zahlPanel = new Panel(); zahlPanel.setLayout(new GridLayout (4,3)); for (int i=9; i&gt;=0; i--) { zahl[i] = new Button(String.valueOf(i)); zahl[i].addActionListener(new ButtonZahlen()); zahlPanel.add(zahl[i]); } zahlPanel.add(new Button(".")); //leere Taste ausfuehren = new Button("="); ausfuehren.addActionListener(new ButtonAusfuehren()); //zu dem Listener zahlPanel.add(ausfuehren); add("Center",zahlPanel); funktionPanel = new Panel(); funktionPanel.setLayout(new GridLayout(4,1)); funktion[0] = new Button("+"); funktion[0].addActionListener(new ButtonOperation()); funktionPanel.add(funktion[0]); funktion[1] = new Button("-"); funktion[1].addActionListener(new ButtonOperation()); funktionPanel.add(funktion[1]); funktion[2] = new Button("*"); funktion[2].addActionListener (new ButtonOperation()); funktionPanel.add(funktion[2]); funktion[3] = new Button("/"); funktion[3].addActionListener (new ButtonOperation()); funktionPanel.add(funktion[3]); //funktionPanel.add(new Button("*")); //funktionPanel.add(new Button("/")); add("East",funktionPanel); ergebnisPanel = new Panel(); ergebnisFeld = new TextField("0",5); ergebnisPanel.add(ergebnisFeld); add("North",ergebnisPanel); } class ButtonZahlen implements ActionListener{ public void actionPerformed(ActionEvent …
has comment: http://stackoverflow.com/comment/31660023
type: Question
tagged with: java
has title: Java-Calculator more than one calculation
score: 0
has answer: http://stackoverflow.com/a/21056149
accepted answer: http://stackoverflow.com/a/21056149
answer count: 1

http://stackoverflow.com/a/21074448
has comment: http://stackoverflow.com/comment/31694433
has body: In this case use OneToOne relationship. But make sure your database table UserDetailshas foreign key relationship to User table. Use below code to implement it using JPA and Hibernate. @Entity class User{ @Id @Column(name="USER_ID") private int id; // getters and setters } @Entity class UserDetails{ @Id @Column(name="USER_DETAILS_ID") private int userDetailsId; @OneToOne(optional = false, fetch = FetchType.LAZY) @JoinColumn(name = "USER_ID") private User user; // getters and setters }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21074007

http://stackoverflow.com/comment/31699176
type: AnswerComment
type: Comment
has text: This wastes your memory.
score: 0
comment on: http://stackoverflow.com/a/21076749

variables
tag name: variables
tags question: http://stackoverflow.com/q/21145924
tags question: http://stackoverflow.com/q/21062425
tags question: http://stackoverflow.com/q/21107202
tags question: http://stackoverflow.com/q/21121177
tags question: http://stackoverflow.com/q/21179624
tags question: http://stackoverflow.com/q/21052136
type: Tag
tags question: http://stackoverflow.com/q/21163301
tags question: http://stackoverflow.com/q/21081753
tags question: http://stackoverflow.com/q/21076087
tags question: http://stackoverflow.com/q/21034928
tags question: http://stackoverflow.com/q/21038384
tags question: http://stackoverflow.com/q/21138421

http://stackoverflow.com/q/21160895
has title: Java: Replace all matching substrings of a string with their hashes
has comment: http://stackoverflow.com/comment/31852739
tagged with: replace
score: 0
has comment: http://stackoverflow.com/comment/31854812
answer count: 1
has answer: http://stackoverflow.com/a/21162571
accepted answer: http://stackoverflow.com/a/21162571
has body: I would like to replace all matching substrings of a string with a hashing of them. Lets say I have a string like this String myString = "This is a A1B4F string with some 342BF matches FFABC that should be replaced."; And now I would like to replace all the matching strings to regex (for example here "([a-fA-F\d]{5})" ) with their hashed value. Assume that there is a sting method that gets as a parameter the substring and returns its sha1 value public static String giveMeTheSha1Of(String myClearText){ return ....; (the sha1 value of the string) } How can I find all the matching substrings, and replace them with their hash?
has comment: http://stackoverflow.com/comment/31852903
tagged with: regex
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31853706
tagged with: substring
type: Question
has comment: http://stackoverflow.com/comment/31852533

http://stackoverflow.com/q/21035132
has comment: http://stackoverflow.com/comment/31623023
has body: How to write asynchronous REST client? My controller (not sure if it's enough for being async): @RequestMapping(method = RequestMethod.GET, value = "/get/all") @ResponseBody public Callable &lt; CustomersListDTO &gt; getAllCustomers() { return new Callable &lt; CustomersListDTO &gt; () { @Override public CustomersListDTO call() throws Exception { Thread.sleep(2000); return customerService.getAllCustomers(); } }; } My synchronous REST client method: public Response get_all_customers() { ResponseEntity &lt; CustomersListDTO &gt; response; try { response = restTemplate.getForEntity( getMethodURI(ServiceExplanation.GET_ALL_CUSTOMERS), CustomersListDTO.class ); message = "Customers obtained successfully!"; } catch (HttpServerErrorException ex) { message = "ERROR: " + ex.getMessage() + " - " + ex.getResponseBodyAsString(); } catch (HttpClientErrorException ex) { message = "ERROR: " + ex.getMessage() + " - " + ex.getResponseBodyAsString(); } catch (RestClientException ex) { message = checkIfServerOrInternetDown(); } return formResponse(message, response); } How do I make it asynchronous? How can the CLIENT continue doing other tasks while SERVER is obtaining data and later return found data?
has comment: http://stackoverflow.com/comment/31623032
tagged with: rest
answer count: 3
upvote count: 7
has answer: http://stackoverflow.com/a/21035402
tagged with: asynchronous
favorite count: 0
has answer: http://stackoverflow.com/a/22856863
type: UnansweredQuestion
tagged with: resttemplate
has title: Asynchronous REST client
tagged with: spring
has answer: http://stackoverflow.com/a/21035243
downvote count: 0
score: 7
tagged with: java
type: Question

http://stackoverflow.com/comment/31597142
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21021191
has text: I will try it out. Thanks already for all these hints.
score: 0

http://stackoverflow.com/comment/31713435
has text: @SotiriosDelimanolis can i do something like this i submit data through POST and in servlet i save to data base and response.sendRedirect("jsppage/data=tobedisplayed"); is it a good implementation?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21084065
type: QuestionComment

http://stackoverflow.com/q/21170535
possible better answer: http://stackoverflow.com/a/21170724
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/21170612
score: 0
tagged with: android
has body: sometimes I need the values to be null. For example: Switch(animal.getId(){ case animal.equals("dog"){ String size=small; String fur=fluffy; placement(size,fur); break; } case animal.equals("lizard"){ String size=small; placement(size); break; } public void placement(String size, String fur){ System.println("Size: "+size); System.println("Fur: +fur); } If animal equals dog it works fine. however if animals equals lizard I need the Fur to come up as Null, or none. I'm attempting to just have null values for when the data is not needed. If I can't then I guess I'll just have put in all the data and have the default saved as String fur="none" and place placement(size,fur) for each time it's called.
has comment: http://stackoverflow.com/comment/31870324
has comment: http://stackoverflow.com/comment/31870736
has title: when there is no value make the value null
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21170724
has answer: http://stackoverflow.com/a/21170612
tagged with: java
tagged with: methods

http://stackoverflow.com/comment/31768064
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/21114525
has text: Seriously, dude? Read a book on java before posting.

http://stackoverflow.com/comment/31974297
type: Comment
has text: The error is related to the 4.th line, which is `useBean` - from your code. It looks like the PersonController is not available as WEB-INF/classes/controller/PersonController. You'll get this error even without the suggested `setProperty` tag.
score: 0
comment on: http://stackoverflow.com/a/21189663
type: AnswerComment

http://stackoverflow.com/comment/31666509
type: AnswerComment
comment on: http://stackoverflow.com/a/21059125
has text: What will you get if you change date2 to `08:00:01` which is the same with date1?
score: 0
type: Comment

http://stackoverflow.com/q/21140264
has comment: http://stackoverflow.com/comment/31815015
tagged with: class
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21140329
has title: How to reference methods in a class from another class (more details)
has answer: http://stackoverflow.com/a/21140293
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21140358
has comment: http://stackoverflow.com/comment/31814624
has comment: http://stackoverflow.com/comment/31815119
type: Question
tagged with: oop
has body: Class A instantiates Class B inside it. Class B is unrelated, not a child. How can class B reference methods inside Class A? Ex: Class A { public static void main(String[] args) { B newClass = new B(); // Call method from within B works no problem newClass.testMethod(); } public void someImportantMethod() { } } However within Class B, how can I call methods from within Class A since I dont have a reference to it? I figure I could create another object for Class A if i just needed to call methods, but I need to access the same instance of Class A that originally instantiated Class B.
tagged with: java

http://stackoverflow.com/a/21058325
has comment: http://stackoverflow.com/comment/31665314
accepted answer of: http://stackoverflow.com/q/21058278
answers question: http://stackoverflow.com/q/21058278
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
has body: In your Factorial class, you have this: public final String valueInput = JOptionPane.showInputDialog("Please enter a number between 1 and 20."); Which means every time you create an instance of it or a subclass, that input dialog will pop up. The answer is: Don't do that. Put it in a method and call the method when you want the input dialog to show.
score: 1
has comment: http://stackoverflow.com/comment/31666111

http://stackoverflow.com/a/23074977
has comment: http://stackoverflow.com/comment/60860902
accepted answer of: http://stackoverflow.com/q/21147871
downvote count: 0
answers question: http://stackoverflow.com/q/21147871
score: 3
has comment: http://stackoverflow.com/comment/35874847
has body: Even I am stuck with the same issue . One thing (a bad hack though) I discovered is if the update or insert fails the column definitions in the result set are more than one and if mutations succeeds the column definition contain only one column i.e "applied" . The problem is ResultSet does not contain the value of "applied" column which is "true" in case the mutation succeeds and "false" when the transactions prevent changing the data . I am using this hack as of now in my application but I don't think its a good solution , so even Im looking for a better solution.
type: AcceptedAnswer
upvote count: 3
type: Answer

http://stackoverflow.com/comment/31626589
score: 0
type: AnswerComment
has text: Actually I was adding java as a separate environment variable but now I added that in Path separated by colon(;). So it's working now.
type: Comment
comment on: http://stackoverflow.com/a/21036783

http://stackoverflow.com/q/21148860
tagged with: netbeans
downvote count: 0
has title: Using Processing 2.0 in Netbeans throws NullPointerException
type: Question
tagged with: processing
type: AnsweredQuestion
has body: So I'm using Processing 2.0 in Netbeans 7.4, and have managed to get it successfully working in the main class. However, when I try and extend another class from PApplet I get a NPE error when trying to use a simple rect() function through an object in the main class. The main class is called ProcessingApp and contains the main function, while the class I'm trying to get to work with processing functions is called processing (sorry if the similar names get confusing) Exception in thread "Animation Thread" java.lang.NullPointerException at processing.core.PApplet.rect(PApplet.java:11934) at processing.processing.thing(processing.java:16) at processing.ProcessingApp.draw(ProcessingApp.java:16) at processing.core.PApplet.handleDraw(PApplet.java:2306) at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:243) at processing.core.PApplet.run(PApplet.java:2177) at java.lang.Thread.run(Thread.java:744) BUILD SUCCESSFUL (total time: 4 seconds) Main class: package processing; import processing.core.*; public class ProcessingApp extends PApplet{ processing p = new processing(); public static void main(String[] args) { PApplet.main(new String[]{"processing.ProcessingApp"}); } public void setup(){ size(1000,800); } public void draw(){ p.thing(); } } And the class I'm trying to get processing functions to work in: package processing; import processing.core.*; public class processing extends PApplet { public void thing(){ rect(0,0,50,100); } } These are all test classes for a larger project but the fact is that they both throw the same errors whenever I try and incur the rect() function, or really any processing function. Any help would be greatly appreciated, &amp;&amp; thank you for taking the time to read :)
score: 1
tagged with: java
tagged with: class
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/21151156
tagged with: nullpointerexception
favorite count: 0
has answer: http://stackoverflow.com/a/21151156

http://stackoverflow.com/comment/31603992
has text: +1 This is correct. If there is at least one `non Date` value in a column although all other values are `Date` it is `VARCHAR`. I was hoping that `CSV Reader` had some shortcut for this
type: Comment
comment on: http://stackoverflow.com/a/21024170
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31671142
type: Comment
has text: But the menu uses a lot of animations with only one option to add animations (menu.startanimation) ... If I use clear animations that too changes nothing... How exactly are you suggesting I fix this?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21061692

http://stackoverflow.com/comment/31803332
score: 0
comment on: http://stackoverflow.com/a/21124455
type: Comment
has text: Instead of DUMP, if I do 'ILLUSTRATE B', then the output is correctly shown on the console. It means that the **input file is correctly read/loaded from HDFS.** The problem occurs only while trying to **write the result in HDFS**.
type: AnswerComment

http://stackoverflow.com/q/21167035
has comment: http://stackoverflow.com/comment/31865871
answer count: 1
has comment: http://stackoverflow.com/comment/31863713
linked to: http://stackoverflow.com/q/7071133
upvote count: 3
score: 0
downvote count: 3
has comment: http://stackoverflow.com/comment/31865621
tagged with: windows
favorite count: 0
tagged with: launch4j
has answer: http://stackoverflow.com/a/21183933
type: UnansweredQuestion
has body: I just wonder if I use launch4j to convert jar to executable (exe file) on Windows. If I take the executable (and other created files if there is any) to another computer which doesn't have JRE installed and I don't have administrative permission, will the executable file still work? Many thanks! -updated from here- I didn't try launch4j yet and from reading doc I didn't quite understand really and I didn't think I get my answers. Reading english literature is very different from reading a technique doc. I have a very limited IT knowledge. I did do a bit search here. I found someone says launch4j is just a wrapper and still need jre installed in the end user's computer, but the the post was 4 years old. So after some research I'm still not 100% sure if I need install jre in the destination computer. For me if jre is an absolute need in the destination computer, then I can forget about using launch4j as I know I won't get jre installed there. However I got a feeling launch4j maybe can somehow bundle jre with the exe file and the exe file can then be run on any computer without jre installed. I'm just trying to confirm things I'm unsure about. So the answer I'm looking for is 1) yes still need jre installed, then I can't use launch4j 2) no you don't need jre installed, then I will learn how to use launch4j 3) depends, then I will probably give a try However, I don't think I should be punished by being marked down because my lack of background knowledge. Although the original post does look like some random post. Thanks.
has comment: http://stackoverflow.com/comment/31864989
linked to: http://stackoverflow.com/q/516399
has comment: http://stackoverflow.com/comment/31865346
has comment: http://stackoverflow.com/comment/31866376
tagged with: java
has comment: http://stackoverflow.com/comment/31864796
type: Question
has title: Using launch4j, will end user still need the JRE installed?

http://stackoverflow.com/a/56152688
downvote count: 1
score: 2
upvote count: 3
answers question: http://stackoverflow.com/q/21076179
has body: In case your host sits behind firewall/proxy , use following command in cmd: keytool -J-Dhttps.proxyHost=&lt;proxy_hostname&gt; -J-Dhttps.proxyPort=&lt;proxy_port&gt; -printcert -rfc -sslserver &lt;remote_host_name:remote_ssl_port&gt; Replace &lt;proxy_hostname&gt; and &lt;proxy_port&gt; with the HTTP proxy server that is configured. Replace &lt;remote_host_name:remote_ssl_port&gt; with one of the remote host (basically url) and port having the certification problem. Take the last certificate content printed and copy it (also copy begin and end certificate). Paste it in text file and give .crt extension to it . Now import this certificate to cacerts using java keytool command and it should work . keytool -importcert -file &lt;filename&gt;.crt -alias randomaliasname -keystore %JAVA_HOME%/jre/lib/security/cacerts -storepass changeit
has comment: http://stackoverflow.com/comment/122022297
type: Answer

http://stackoverflow.com/comment/31683139
comment on: http://stackoverflow.com/q/21067981
has text: iGio90 I attach the logcat
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/42788657
type: Comment
has text: Unfortunately the huge disadvantage of this is the need for PowerMockRunner though.
score: 56
comment on: http://stackoverflow.com/a/21116014
type: AnswerComment

http://stackoverflow.com/a/46195965
upvote count: 84
has body: 1. Check the certificate Try to load the target URL in browser and view the site's certificate (usually it's accessible by the icon with the lock sign. It's on the left or right side of the browser's address bar) whether it's expired or untrusted by other reason. 2. Install latest versions of JRE and JDK New versions usually come with the updated set of the trusted certificates. Also if it's possible, uninstall old versions. This will make misconfiguration errors explicit. 3. Check your configuration: Check where your JAVA_HOME environment variable points to. Check which java version you use to run the program. In IntelliJ check: File -> Project Structure... -> Project Settings -> Project -> Project SDK: File -> Project Structure... -> Platform Settings -> SDKs 4. Copy whole keystore from the new Java version If you develop under the JDK other than the latest available - try to replace the %JAVA_HOME%/jre/lib/security/cacerts file with the new one from the latest installed JRE (make a backup copy first) as @jeremy-goodell suggests in his answer 5. Add certificate(s) to your keystore If nothing above solves your problem use keytool to save certificate(s) to the Java's keystore: keytool -trustcacerts -keystore "%JAVA_HOME%jre\lib\security\cacerts" -storepass changeit -importcert -alias &lt;alias_name&gt; -file &lt;path_to_crt_file&gt; File with the certificate can be obtained from the browser as @MagGGG suggests in his answer. Note 1: you may need to repeat this for every certificate in the chain to you site's certificate. Start from the root one. Note 2: &lt;alias_name&gt; should be unique among the keys in the store or keytool will show an error. To get list of all the certificates in the store you may run: keytool -list -trustcacerts -keystore "%JAVA_HOME%jre\lib\security\cacerts" -storepass changeit In case something goes wrong this will help you to remove certificate from the store: keytool -delete -alias &lt;alias_name&gt; -keystore "%JAVA_HOME%jre\lib\security\…
has comment: http://stackoverflow.com/comment/110826778
answers question: http://stackoverflow.com/q/21076179
score: 84
has comment: http://stackoverflow.com/comment/107590993
has comment: http://stackoverflow.com/comment/112875436
type: Answer
downvote count: 0

http://stackoverflow.com/comment/31696635
type: QuestionComment
score: 1
has text: @MarkoTopolnik It will use +31 or 0, it must choose one of those 2. After that it goes to the next things in the regex.
type: Comment
comment on: http://stackoverflow.com/q/21075537

http://stackoverflow.com/comment/31830182
type: Comment
comment on: http://stackoverflow.com/a/21147470
has text: The first portion is C# code and the second portion is Android code. I changed back forth to fix the problem. All codes posted can be compiled.
type: AnswerComment
score: 0

http://stackoverflow.com/a/21134034
accepted answer of: http://stackoverflow.com/q/21132589
answers question: http://stackoverflow.com/q/21132589
type: AcceptedAnswer
upvote count: 3
type: Answer
has body: Try as : Map<String,Long> mCountMap = getSqlMapClientTemplate().queryForMap("mydata", "", "key", "value"); <result property="key" column="col_1"/> <result property="value" column="col_2"/> select col_1, col_2 from sometable
downvote count: 0
score: 3

http://stackoverflow.com/q/21069050
has body: I'm new to programming so I've just recently learned about GUIs and am still in the learning process of how to make them. I'm making sudoku but I don't know how to make a 9x9 grid of textfields so I would like some assistance with creating that.
has title: Grid of textfields for Sudoku
linked to: http://stackoverflow.com/q/4148336
tagged with: java
type: Question
score: -1
has comment: http://stackoverflow.com/comment/31692616
answer count: 1
tagged with: user-interface
downvote count: 1
favorite count: 0
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
upvote count: 0
has answer: http://stackoverflow.com/a/21069227

http://stackoverflow.com/comment/31755507
has text: Try deleting the poi folder in .m2 repo and rerun it
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21106350

http://stackoverflow.com/a/21169064
has comment: http://stackoverflow.com/comment/31867412
score: 0
has body: You can use the java features to do this too ... Use public static &lt;T&gt; void sort(T[] a, int fromIndex, int toIndex, Comparator&lt;? super T&gt; c) But the elements need to be objects ... The comparator needs to be changed while sorting the first half and second half of the array.
type: Answer
answers question: http://stackoverflow.com/q/21168716

http://stackoverflow.com/comment/31602170
type: Comment
comment on: http://stackoverflow.com/a/21022977
type: AnswerComment
has text: @user3177843 That's basically it. You have a left channel that goes to the left speaker, a right channel that goes to the right speaker and when it sounds like something is in the middle, it's because it's the same sound playing in both channels. (The middle is called the "phantom center".)
score: 0

http://stackoverflow.com/a/21054325
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: There are 2 Problems in your code. At the current state you close() the InputStream from which all Thread try to read directly after you started them (-> while they are running). To solve this Problem you can call the join() Method of the Thread class. In your case your'd have to call it for all 4 Threads to make sure they are finished. If I understand it correctly you want to seperate the download File into 4 parts downloading at the same time. To do this you need 4 independent InputStreams. (Currently you are using ONE [See also: Java Object Copying]) So to change this your code would look something like this: public class Downloader implements Runnable{ private byte[][] fileData; private int index; private int size; private URL url; public Downloader(URL url, byte[][] fileData, int index, int size) { this.fileData = fileData; this.index = index; this.size = size; this.url = url; } public synchronized void run() { try{ URLConnection connection = url.openConnection(); DataInputStream inputStream = new DataInputStream(connection.getInputStream()); inputStream.skipBytes(index * size); for(int i= 0;i&lt;size;i++){ fileData[index][i] = inputStream.readByte(); System.out.println("It works : " + index); } }catch(Exception e){ System.out.println(e.getMessage()); } } }
answers question: http://stackoverflow.com/q/21053660

http://stackoverflow.com/a/21077901
has comment: http://stackoverflow.com/comment/31797664
has body: The following then should work with a bit of luck: String content = mail. ... // The bytes as sent, and then interpreted as gb2312: byte[] bytes = content.getBytes("gb2312"); // Now correctly interprete the bytes as Big5: content = new String(bytes, "Big5");
type: Answer
has comment: http://stackoverflow.com/comment/31722214
has comment: http://stackoverflow.com/comment/31728759
score: 0
answers question: http://stackoverflow.com/q/21077771
has comment: http://stackoverflow.com/comment/31738733

http://stackoverflow.com/comment/31748428
score: 0
type: Comment
type: QuestionComment
has text: I added an answer. I was not sure you could change the connection pool configuration, but it seems you can.
comment on: http://stackoverflow.com/q/21040635

http://stackoverflow.com/q/21159236
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/20811514
tagged with: android-gradle-plugin
tagged with: java
has body: I can't seem to build my Android app with Gradle. build.gradle: buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.6.+' } } apply plugin: 'android' repositories { mavenCentral() } dependencies { compile 'com.intellij:annotations:12.0' } android { compileSdkVersion 19 buildToolsVersion "19" defaultConfig { minSdkVersion 14 targetSdkVersion 19 versionCode = 82 versionName = "0.6.1" } sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } xposedmodule { manifest.srcFile 'xposed/AndroidManifest.xml' java.srcDirs = ['xposed/src'] resources.srcDirs = ['xposed/src'] aidl.srcDirs = ['xposed/src'] renderscript.srcDirs = ['xposed/src'] res.srcDirs = ['xposed/res'] assets.srcDirs = ['xposed/assets'] } } /* compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 }*/ signingConfigs { release } buildTypes { release { signingConfig signingConfigs.release } } } // ~/.gradle/gradle.properties if (project.hasProperty('keystoreFile') &amp;&amp; project.hasProperty('keystorePassword') &amp;&amp; project.hasProperty('keystoreAliasPassword')) { android.signingConfigs.release.storeFile = file(keystoreFile) android.signingConfigs.release.storePassword = keystorePassword android.signingConfigs.release.keyPassword = keystoreAliasPassword android.signingConfigs.release.keyAlias = keystoreAlias } else { android.buildTypes.release.signingConfig = null } //http://stackoverflow.com/questions/16683775/include-so-library-in-apk-in-android-studio tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask -&gt; pkgTask.jniDir new File(buildDir, 'native-libs') } I use Gradle 1.10 and I get the following error when issuing this command: gradle build.gradle --refresh-dependencies Error: Could not create plugin of type 'AppPlugi…
upvote count: 10
tagged with: gradle
type: Question
has title: Gradle: Could not create plugin of type AppPlugin
accepted answer: http://stackoverflow.com/a/21159459
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/32335768
has comment: http://stackoverflow.com/comment/32260842
tagged with: android
possible better answer: http://stackoverflow.com/a/32335768
score: 10
has answer: http://stackoverflow.com/a/21159459

http://stackoverflow.com/a/21176335
type: Answer
answers question: http://stackoverflow.com/q/21176288
score: 0
has body: I did something very similar to this using python and mechanize (a web bot). You could also just use urllib and parse the response since you know the exact string you are looking for. I think Python is great for this.

http://stackoverflow.com/q/21074634
has title: Image datatype and BLOB datatype in derby
type: Question
tagged with: blob
has answer: http://stackoverflow.com/a/21075990
tagged with: derby
tagged with: image
tagged with: sql
upvote count: 1
answer count: 1
downvote count: 0
favorite count: 0
has body: I want to insert image into derby database Steps I followed: Read images from the document: public Image[] ReadImg() throws IOException { Image[] img; String[] pname; int[] imageid; int l; XWPFDocument doc = new XWPFDocument(new FileInputStream("import.docx")); BufferedImage jpg = null; List&lt;XWPFPictureData&gt; pic = doc.getAllPictures(); int length = pic.size(); img = new Image[length]; pname = new String[length]; for (int i = 0; i &lt; length; i++) { XWPFPictureData pict = pic.get(i); pname[i] = pict.getFileName(); } imageid = new int[length]; imageid = sorting(pname, length); for (int i = 0; i &lt; length; i++) { XWPFPictureData pict = pic.get(imageid[i]); System.out.println(pict.getFileName()); byte[] data = pict.getData(); jpg = ImageIO.read(new ByteArrayInputStream(data)); String[] prop = jpg.getPropertyNames(); img[i] = jpg; } return img; } Insert image into derby database: a) I have created column image with "BLOB" datatype for(int k=0;k&lt;img.length;k++) { PreparedStatement stmt2 = con.prepareStatement("insert into APP.IMAGES(IMAGES) values(?)"); InputStream f=new FileInputStream(img[k]); stmt2.setBlob(1, f); stmt2.executeUpdate(); stmt2.close(); } I don't know what to do at the step InputStream f=new FileInputStream(img[k]); How to convert my image datatype and put it here? Could you please help me to resolve it?
type: UnansweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/31649633
score: 0
has text: What Fonts are involved?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21050181

http://stackoverflow.com/comment/31667860
type: Comment
comment on: http://stackoverflow.com/q/21044703
type: QuestionComment
has text: possible duplicate of [Zk how to pass parameter from java code to zk page?](http://stackoverflow.com/questions/21024642/zk-how-to-pass-parameter-from-java-code-to-zk-page)
score: 0

http://stackoverflow.com/q/21136056
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21136224
has comment: http://stackoverflow.com/comment/31807267
tagged with: java
tagged with: image-processing
type: Question
has title: change color of transparent pixel in java
has body: Now i am able to apply pixel of another image to source image pixel of pg to m. but problem is that i m loosing gradient or fading effect. public static void main(String[] args){ try { BufferedImage image = ImageIO.read(new File("c:\\m.png")); BufferedImage patt = ImageIO.read(new File("c:\\pg.png")); int f = 0; int t = 0; int n = 0; BufferedImage bff = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB); for (int y = 0; y &lt; image.getHeight(); ++y) { for (int x = 0; x &lt; image.getWidth(); ++x) { int argb = image.getRGB(x, y); int nrg = patt.getRGB(x, y); if(((argb&gt;&gt;24) &amp; 0xff) == 0) { bff.setRGB(x, y, (255&lt;&lt;24)); } else { bff.setRGB(x, y, nrg); } } } System.out.println("Trans : " + t + " Normal : " + n); File outputfile = new File("c://imagetest.png"); ImageIO.write(bff, "png", outputfile); } catch (IOException ex) { } } thanks.
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31807406
has answer: http://stackoverflow.com/a/21136549

http://stackoverflow.com/a/21177175
upvote count: 2
answers question: http://stackoverflow.com/q/21177020
has body: This should do what you want it to I think: import java.util.*; /* 10,100,1000 intervals of 10 App generates a number:unkown person enters a number */ class GenerateNumber { public static void main(String args[]) throws java.io.IOException { int randomNumber; int loopTimes; /* loopTimes = System.in.read(); //casted System.out.println("Loop Times is: " +loopTimes) */ //one byte at a time gets read System.out.println("How many times do you want to loop?"); Scanner sc = new Scanner(System.in); loopTimes = sc.nextInt(); //new scanner System.out.println("Loop Times is: " +loopTimes); System.out.println("What would be the max number to guess?"); int maxNumber = sc.nextInt(); Random generator = new Random(); randomNumber = generator.nextInt(maxNumber); for (int i=1;i&lt;=loopTimes;i++) { System.out.println("Guess number " + i + ":"); int guess = sc.nextInt(); if (randomNumber == guess) { System.out.print("YOU WIN! Random number was " + randomNumber); sc.close(); System.exit(0); } else { System.out.println("Keep Guessing!"); } } sc.close(); System.out.println("SORRY! YOU LOSE! The number was " + randomNumber); } }
downvote count: 0
has comment: http://stackoverflow.com/comment/31882853
type: Answer
score: 2

http://stackoverflow.com/q/21057827
tagged with: string
has body: This is one of the questions in the Cracking the Coding Interview book by Gayle Laakmann McDowell: Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures? The author wrote: We can reduce our space usage a little bit by using a bit vector. We will assume, in the below code, that the string is only lower case 'a' through 'z'. This will allow us to use just a single int. The author has this implementation: public static boolean isUniqueChars(String str) { int checker = 0; for (int i = 0; i < str.length(); ++i) { int val = str.charAt(i) - 'a'; if ((checker & (1 << val)) > 0) return false; checker |= (1 << val); } return true; } Let's say we get rid of the assumption that "the string is only lower case 'a' through 'z'". Instead, the string can contain any kind of character—like ASCII characters or Unicode characters. Is there a solution as efficient as the author's (or a solution that comes close to being as efficient as the author's)? Related questions: Detecting if a string has unique characters: comparing my solution to "Cracking the Coding Interview?" Explain the use of a bit vector for determining if all characters are unique String unique characters Implementing an algorithm to determine if a string has all unique characters determine if a string has all unique characters?
has answer: http://stackoverflow.com/a/21059283
linked to: http://stackoverflow.com/q/17357370
has comment: http://stackoverflow.com/comment/31664271
favorite count: 0
has comment: http://stackoverflow.com/comment/31664154
possible better answer: http://stackoverflow.com/a/21058198
has answer: http://stackoverflow.com/a/65750922
has answer: http://stackoverflow.com/a/61342866
linked to: http://stackoverflow.com/q/2589610
tagged with: bitvector
has comment: http://stackoverflow.com/comment/31664212
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31664399
has answer: http://stackoverflow.com/a/67100681
has answer: http://stackoverflow.com/a/21057989
tagged with: bit-manipulation
linked to: http://stackoverflow.com/q/9141830
downvote count: 1
type: Question
tagged with: algorithm
tagged with: java
has answer: http://stackoverflow.com/a/21061418
has title: Determining a string has all unique characters without using additional data structures and without the lowercase characters assumption
upvote count: 10
score: 9
accepted answer: http://stackoverflow.com/a/21057989
has answer: http://stackoverflow.com/a/21058198
linked to: http://stackoverflow.com/q/4987863
linked to: http://stackoverflow.com/q/19484406
answer count: 7

http://stackoverflow.com/comment/31840141
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21153533
has text: Print out the first 20 numbers and the "running sum" - do they make sense? When does it go wrong?
score: 0

http://stackoverflow.com/q/21088815
tagged with: asynchronous
favorite count: 0
type: UnansweredQuestion
tagged with: android
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/3821423
has comment: http://stackoverflow.com/comment/31720931
has answer: http://stackoverflow.com/a/21089084
tagged with: memory
tagged with: task
type: Question
answer count: 2
downvote count: 0
has title: (Android) Using getActivity() causes a memory leak but adding get application context causes bad token exception
has body: The main class extends Fragment and Implements onclicklistner. this snippet is from my async task. Any ideas of how to get the application text within fragment classes? As far as I understand there is a timing/calling issue somewhere which causes the memory leak. Would I have to declare a Context variable maybe? @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate( R.layout.tracklist_fragment_view_fragment, container, false); Button b = (Button) rootView.findViewById(R.id.sendtofriend); b.setOnClickListener(this); return rootView; } @Override public void onClick(View v) { new GetDataTask().execute(); } @SuppressWarnings("unused") private class GetDataTask extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected void onPreExecute() { pd = new ProgressDialog(getActivity().getApplicationContext()); pd.setTitle("Grabbing Track!"); pd.setMessage("Please wait..."); pd.setCancelable(false); pd.setIndeterminate(true); pd.show(); } LOGCAT >>> 01-13 10:15:01.511: W/dalvikvm(11829): threadid=1: thread exiting with uncaught exception (group=0x4163a970) 01-13 10:15:01.521: E/AndroidRuntime(11829): FATAL EXCEPTION: main 01-13 10:15:01.521: E/AndroidRuntime(11829): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application 01-13 10:15:01.521: E/AndroidRuntime(11829): at android.view.ViewRootImpl.setView(ViewRootImpl.java:623) 01-13 10:15:01.521: E/AndroidRuntime(11829): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:269) 01-13 10:15:01.521: E/AndroidRuntime(11829): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:94) 01-13 10:15:01.521: E/AndroidRuntime(11829): at android.app.Dialog.show(Dialog.java:286) 01-13 10:15:01.521: E/AndroidRuntime(11829): at com.superbit.swipeexperiment.TrackListFragment$GetDataTask.onPreExecute(TrackListFragment.java:79) 01-13 10:15:01.521: E/AndroidRuntime(11829): at andro…
upvote count: 1
has answer: http://stackoverflow.com/a/21090867

http://stackoverflow.com/a/21067380
has comment: http://stackoverflow.com/comment/53445445
has comment: http://stackoverflow.com/comment/53467542
upvote count: 12
has comment: http://stackoverflow.com/comment/53491986
has body: The fact that you have @Transactional on a method in a @Service annotated class along with a TransactionManager means the whole transaction lifecycle will be managed by Spring. When your saveEmployee method is called, Spring will open a Session, start a transaction, execute your code, commit the transaction and close the Session. The Session it starts is bound to the current thread and available through getCurrentSession(). If you instead use openSession(), you are opening a completely unrelated Session, not managed by Spring's TransactionManager. As such, the transaction won't be committed and the Sessionwon't be closed unless you do it yourself.
score: 12
has comment: http://stackoverflow.com/comment/61394331
downvote count: 0
has comment: http://stackoverflow.com/comment/53501320
has comment: http://stackoverflow.com/comment/61397073
type: Answer
answers question: http://stackoverflow.com/q/21067307

http://stackoverflow.com/comment/31794834
type: QuestionComment
comment on: http://stackoverflow.com/q/21128408
type: Comment
has text: It would be great if you also read and follow some guidelines about Naming Conventions. (For example, Class names should be nouns in UpperCamelCase, with the first letter of every word capitalized.) Source: Internet.
score: 0

http://stackoverflow.com/comment/31678126
type: Comment
comment on: http://stackoverflow.com/q/21065566
type: QuestionComment
has text: I did read but I can't get it to work.
score: 0

http://stackoverflow.com/comment/31870740
comment on: http://stackoverflow.com/q/21170787
has text: You don't import them...
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31732295
comment on: http://stackoverflow.com/q/21090022
score: 0
type: Comment
type: QuestionComment
has text: Thanks for the link Andrea. We have now resolved the issue by using ProxyPassReverseCookiePath in Apache.

http://stackoverflow.com/comment/31605591
comment on: http://stackoverflow.com/q/21025743
type: QuestionComment
type: Comment
score: 2
has text: `Sync` sounds more like a 64 **BIT** value...

android-progressbar
tags question: http://stackoverflow.com/q/21099473
type: Tag
tag name: android-progressbar

http://stackoverflow.com/a/21056235
type: AcceptedAnswer
type: Answer
score: 2
has body: You declared but didn't initialize your playerStatistics array, so it's null. Try declaring it as: int playerStatistics[] = new int[7]; or one more than your largest index possible. You will need to do something similar with your other arrays, which also don't appear to be initialized.
downvote count: 0
has comment: http://stackoverflow.com/comment/31662626
accepted answer of: http://stackoverflow.com/q/21056179
answers question: http://stackoverflow.com/q/21056179
upvote count: 2

http://stackoverflow.com/a/21256111
answers question: http://stackoverflow.com/q/21038992
score: 0
type: AcceptedAnswer
type: Answer
has body: In the end I had to give in and just created another test class @RunWith(PowerMockRunner.class) @PrepareForTest( { CustomPageLayoutUtils.class }) public class ModuleCloningServiceImplPowermockTest { private ModuleCloningServiceImpl moduleCloningService; private final CouponViewer moduleContent = new CouponViewer(); private final PageLayout pageLayout = DomainObjectBuilder.newPageLayout().build(); private Site site; private Product product; private CrudDao crudDao; private AuditLogger auditlogger; @Before public void init() { moduleCloningService = new ModuleCloningServiceImpl(); crudDao = PowerMock.createMock(CrudDao.class); auditlogger = PowerMock.createMock(AuditLogger.class); ReflectionUtils.setByType(moduleCloningService, crudDao); ReflectionUtils.setByType(moduleCloningService, auditlogger); product = new Product(1L); site = DomainObjectBuilder.newSite().withId(1l).withProduct(product).build(); PowerMock.mockStatic(CustomPageLayoutUtils.class); } @Test public void copyModuleToPages_success_customLayoutTileCopy_default_tile() { ModuleType moduleType = getModuleType(ModuleTypeCode.COUPON, 2, 3); Module&lt;CouponViewer&gt; module = getModule(1L, moduleType); Page copyPage = getPage(1L, moduleType); PageLayout newPageLayout = DomainObjectBuilder.newPageLayout().build(); newPageLayout.setCode(PageLayoutCode.CUSTOM); copyPage.setPageLayout(newPageLayout); List&lt;Page&gt; pages = Arrays.asList(copyPage); CustomPageLayoutUtils customPageLayoutUtils = PowerMock.createMock(CustomPageLayoutUtils.class); customPageLayoutUtils.tileNumberExistsInCustomPageLayout(9, null); expectLastCall().andReturn(false); customPageLayoutUtils.getPreferredOrDefaultTile(copyPage, moduleType); expectLastCall().andReturn(1); crudDao.save(EasyMock.anyObject()); expectLastCall(); auditlogger.audit(EasyMock.anyObject(AuditLogEntry.class)); PowerMock.replayAll(); OperationReport operationReport = moduleCloningService.copyModuleToPages(module, pages, 9); PowerMock.verifyAll(); checkCopySuccessInPa…
accepted answer of: http://stackoverflow.com/q/21038992

http://stackoverflow.com/a/21142275
has body: Ok so weird thing happened! I decided to switch the > into a &lt; in the for loop and now it works!! I'm laughing at myself because the only problems were the less than/greater than signs. for (int i = 0; i &lt; length; i++) {
accepted answer of: http://stackoverflow.com/q/21094816
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21094816
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/21106288
answers question: http://stackoverflow.com/q/21106257
has body: No you cannot make a static reference to the non-static method because the method is "attached" to an instance (object scope) which the "static" reference (class scope) is not "aware" of.
score: 0
type: Answer

http://stackoverflow.com/q/21070459
tagged with: caliper
has body: I'm trying to get Caliper working with maven, I haven't successfully ran a caliper benchmark test as of yet. Caliper version: 1.0-beta-1 My benchmark: public class MyXercesSAXHandlerBenchmark extends Benchmark{ @Param({"10", "100", "1000", "10000"}) private int length; public void timeNanoTime(int reps) { for (int i = 0; i < reps; i++) { System.nanoTime(); } } public static void main(String[] args) { CaliperMain.main(MyXercesSAXHandlerBenchmark.class, args); } } My maven pom.xml has: benchmarks org.codehaus.mojo exec-maven-plugin 1.1 caliper compile java test my.path.to.benchmark.MyXercesSAXHandlerBenchmark I ran: mvn clean install mvn compile -P benchmarks -e -X Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occured while executing the Java class. The specified mainClass doesn't contain a main method with appropriate signature. at org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:345) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) ... 19 more Caused by: java.lang.Exception: The specified mainClass doesn't contain a main method with appropriate signature. at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:294) at java.lang.Thread.run(Thread.java:680) Caused by: java.lang.NoSuchMethodException: com.google.caliper.runner.CaliperMain.main([Ljava.lang.String;) at java.lang.Class.getMethod(Class.java:1632) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:283) ... 1 more
has comment: http://stackoverflow.com/comment/31688527
has comment: http://stackoverflow.com/comment/31687517
has comment: http://stackoverflow.com/comment/31687854
has answer: http://stackoverflow.com/a/21071993
type: Question
has comment: http://stackoverflow.com/comment/31687820
tagged with: maven
linked to: http://stackoverflow.com/q/2472376
answer count: 1
tagged with: exec-maven-plugin
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31688064
has comment: http://stackoverflow.com/comment/31688131
has title: Caliper test using exec-maven-plugin is saying main method signature isn't valid
has comment: http://stackoverflow.com/comment/31687944
tagged with: benchmarking
has comment: http://stackoverflow.com/comment/31687883
has comment: http://stackoverflow.com/comment/31687986
type: UnansweredQuestion

http://stackoverflow.com/q/21066431
has answer: http://stackoverflow.com/a/21066678
has body: Cliff Click, in his speech, "A JVM Does That?", says "There are better ways to describe semantics than Java bytecodes": http://www.youtube.com/watch?v=uL2D3qzHtqY&amp;t=8m55s Why? What are the problems with Java bytecode? What are the alternatives?
has title: "There are better ways to describe semantics than Java bytecodes"?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21066656
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/21066678
type: Question
possible better answer: http://stackoverflow.com/a/21066656
tagged with: bytecode
has comment: http://stackoverflow.com/comment/31679748
answer count: 2
score: 2
downvote count: 0
tagged with: jvm
favorite count: 0

http://stackoverflow.com/comment/31654884
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21052726
score: 0
has text: How about the full stacktrace?

http://stackoverflow.com/comment/31610269
comment on: http://stackoverflow.com/q/21028256
type: Comment
type: QuestionComment
has text: Is it an update? You probably used another keystore to generate the apk file. You need to use the same to release another version.
score: 1

http://stackoverflow.com/comment/31602286
comment on: http://stackoverflow.com/a/21022950
score: 0
type: AnswerComment
type: Comment
has text: OK - see the latest, *latest* edit for you more recent comments.. When you get up. :)

http://stackoverflow.com/comment/31878767
has text: Why? It's right there in the source code.
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21174400

http://stackoverflow.com/comment/31886173
type: AnswerComment
has text: Thanks for the quick reply. But could you please show that on my example code?
type: Comment
comment on: http://stackoverflow.com/a/21175549
score: 0

http://stackoverflow.com/comment/31688416
comment on: http://stackoverflow.com/q/21071008
score: 0
type: Comment
type: QuestionComment
has text: Windows 7, but what shell? Cygwin Bash may work.

http://stackoverflow.com/comment/31645056
type: Comment
comment on: http://stackoverflow.com/q/21047796
score: 0
type: QuestionComment
has text: there is a example @ http://developer.android.com/training/displaying-bitmaps/load-bitmap.html. for gridview. should not be too hard to implement the same with listview

http://stackoverflow.com/a/21065139
has body: That's removing approach. I've coded a retaining approach. public void myMethod() { String[] s1 = {"22", "Software", "1"}; String[] s2 = {"45", "Software", "2"}; String[] s3 = {"78", "Hardware", "3"}; String[] s4 = {"48", "Software", "4"}; String[] s5 = {"11", "Hardware", "5"}; String[] s6 = {"91", "Service", "6"}; String[] s7 = {"95", "Service", "7"}; String[] s8 = {"93", "Software", "8"}; ArrayList&lt;String[]&gt; myL = new ArrayList&lt;&gt;(); myL.add(s1); myL.add(s2); myL.add(s3); myL.add(s4); myL.add(s5); myL.add(s6); myL.add(s7); myL.add(s8); List&lt;String&gt; list = new ArrayList&lt;String&gt;(); List&lt;String[]&gt; retainList = new ArrayList&lt;String[]&gt;(); String previous = ""; for (String[] s : myL) { if(list.size() == 0) { previous = s[1]; add(list, retainList, s); continue; } if(previous.equals(s[1])) add(list, retainList, s); else if(!list.contains(s[1])) add(list, retainList, s); previous = s[1]; } myL.retainAll(retainList); for(String[] r : myL) System.out.println(r[0] + "-" + r[1] + "-" + r[2]) ; } public void add(List&lt;String&gt; t, List&lt;String[]&gt; r, String[] s) { t.add(s[1]); r.add(s); }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21064253

http://stackoverflow.com/q/21031822
has comment: http://stackoverflow.com/comment/31617141
has comment: http://stackoverflow.com/comment/31617241
score: 0
has comment: http://stackoverflow.com/comment/31617128
answer count: 3
has comment: http://stackoverflow.com/comment/31617139
has comment: http://stackoverflow.com/comment/31617120
has answer: http://stackoverflow.com/a/21032006
has comment: http://stackoverflow.com/comment/31617209
has body: import javax.swing.JOptionPane; public class NewClass { int i = 1; public static void main(String[] args) { String output = ""; System.out.println("kilograms | pounds"); System.out.println("--------+-----------"); for ( i = 1; i &lt;= 199; i ++) { // Every table line in between System.out.printLn(“| “+i+” | “+i*2.2+” |”); } System.out.println(output); } //end method } // end class what's wrong here, why can't I run it??trying to display a list of KG to pound from 1 to 199
has answer: http://stackoverflow.com/a/21031844
has comment: http://stackoverflow.com/comment/31617119
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21031844
tagged with: java
has answer: http://stackoverflow.com/a/21031961
has comment: http://stackoverflow.com/comment/31617046
accepted answer: http://stackoverflow.com/a/21032006
type: Question
has comment: http://stackoverflow.com/comment/31617063
has title: Converting KG to Pounds program

http://stackoverflow.com/comment/31843127
has text: I use Maven, and it work perfectly, thanks for the help!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21142534
type: AnswerComment

http://stackoverflow.com/a/21170964
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21166633
downvote count: 0
answers question: http://stackoverflow.com/q/21166633
type: Answer
upvote count: 1
score: 1
has body: If Mahout can use a compound ID of two longs, you can use: UUID uuid = UUID.fromString(string); long l1 = uuid.getMostSignificantBits(); long l2 = uuid.getLeastSignificantBits(); If you really are stuck with one long, then I'd agree with your idea to use a portion of a hash based on the entire UUID

http://stackoverflow.com/comment/32040849
comment on: http://stackoverflow.com/a/21079274
score: 0
type: AnswerComment
has text: Can you please tell me the exact configuration where i can install certificate. Actaully i am having issue regarding this, i had installed the certificate regarding this issue using **keytool**, this works for around 20-30 mins and then the server issue same error again. Please help me. I have been stucked in this issue for 2 days.
type: Comment

http://stackoverflow.com/a/21837040
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/21126851
score: 0
has body: I was attempting the same thing and tracked an issue down to the "Insets" entry. There is an "Insets is not a valid type" error at the top of my output (after I straightened out my naming.) This might depend on the version of NetBeans in use. (I am using 7.2.1 but hope to get upgraded to 7.4 this afternoon.) To fix it, I simply commented out the "Insets" entry:
type: Answer

http://stackoverflow.com/comment/31903062
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21151214
has text: Hi there, thanks for your answer! Unfortunately none of your solutions helped. No, ID is int(5). However I am certain this is not the problem.

http://stackoverflow.com/comment/31791634
type: AnswerComment
comment on: http://stackoverflow.com/a/21126762
type: Comment
has text: I mean repetition of elements in group of permutations. Like in your output permutation 1 can be grouped only with permutation 5 or permutation 8. It's like a sports championship, each group of 2 permutations represents a round where every team has to play with another one. The ouput has to show all the rounds. (every teams plays another one twice on home and away basis hence the permutation and not combination apparently)
score: 0

http://stackoverflow.com/q/21023348
has comment: http://stackoverflow.com/comment/31601192
has answer: http://stackoverflow.com/a/21023504
downvote count: 1
type: AnsweredQuestion
tagged with: algorithm
tagged with: java
score: -1
type: Question
has answer: http://stackoverflow.com/a/21023412
possible better answer: http://stackoverflow.com/a/21023445
upvote count: 0
has comment: http://stackoverflow.com/comment/31601142
has answer: http://stackoverflow.com/a/21023445
has comment: http://stackoverflow.com/comment/31601097
duplicate of: http://stackoverflow.com/q/2137755
has answer: http://stackoverflow.com/a/21023703
linked to: http://stackoverflow.com/q/12678781
linked to: http://stackoverflow.com/q/9995432
has body: I have written code to reverse an array that has Time Complexity: O(n). Is there a faster method? My code: void reverseArray(int arr[], int start, int end){ int temp; if(start &gt;= end) return; temp = arr[start]; arr[start] = arr[end]; arr[end] = temp; reverseArray(arr, start+1, end-1); }
has comment: http://stackoverflow.com/comment/31601177
has title: Fast Algorithm in Java to Reverse an Array
accepted answer: http://stackoverflow.com/a/21023412
favorite count: 0
has answer: http://stackoverflow.com/a/21023468
linked to: http://stackoverflow.com/q/2137755
answer count: 5

http://stackoverflow.com/comment/31661814
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21056249
has text: Do you want me to break my quickSortArray into three different methods??
type: AnswerComment

http://stackoverflow.com/comment/31629399
score: 1
comment on: http://stackoverflow.com/q/21038901
type: Comment
type: QuestionComment
has text: Be aware that "multi-homed" on IPv6 isn't necessarily a clear concept when applied to a host; all IPv6 hosts on the Internet have at least two IP addresses, and it's not unusual for them to have several even on a single uplink.

http://stackoverflow.com/comment/31896302
score: 0
type: Comment
has text: Yes it is obvious i have loaded 32 bit library. Can you give me more details how to run a 32bit chroot/multilib setup? There is no 64bit driver for this device as i can see. EDIT I have run sudo service pcscd start and i can see that device is working, signal lights are blinking when i swipe nfc card over it. When i go with pcsc_scan i get this: SCardEstablishContext: Service not available.
comment on: http://stackoverflow.com/a/21182342
type: AnswerComment

http://stackoverflow.com/comment/31787203
type: QuestionComment
comment on: http://stackoverflow.com/q/21124361
has text: Do you try to delete the same `member` twice?
score: 0
type: Comment

http://stackoverflow.com/a/21074408
type: Answer
has body: It is a question that relate to JVM, here I have a good article to explain about it, let's study together: JVM - Jamesdbloom blog Image source: http://blog.jamesdbloom.com/images_2013_11_17_17_56/JVM_Internal_Architecture_small.png
has comment: http://stackoverflow.com/comment/31694417
accepted answer of: http://stackoverflow.com/q/21074341
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/21074341
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31694405

http://stackoverflow.com/comment/31833348
type: Comment
score: 1
has text: There's no native support. What you're looking for is here: [Question asked in another thread](http://stackoverflow.com/questions/5033012/auto-scale-textview-text-to-fit-within-bounds)
comment on: http://stackoverflow.com/q/21149675
type: QuestionComment

http://stackoverflow.com/q/21131552
tagged with: processing
answer count: 2
has comment: http://stackoverflow.com/comment/31799524
has comment: http://stackoverflow.com/comment/31799528
tagged with: nullpointerexception
has body: I am currently doing a port over of codes from Processing to Netbeans. However, I have met with some difficulties as the exact same codes running in processing gave me a Null Pointer Exception when I run it in Netbeans java. The errors I'm faced with are these: Exception in thread "Animation Thread" java.lang.NullPointerException at gardeningmania.GardeningMania.loadPng(GardeningMania.java:303) at gardeningmania.GardeningMania.setupThreading(GardeningMania.java:315) at gardeningmania.GardeningMania.setup(GardeningMania.java:182) at processing.core.PApplet.handleDraw(PApplet.java:2281) at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:243) at processing.core.PApplet.run(PApplet.java:2177) at java.lang.Thread.run(Thread.java:722) These are some parts of the codes that resulted in the above state error: @Override public void setup() { setupThreading("/Menus/", menuLoader, menuThread); setupThreading("/Navigations/", navLoader, navThread); setupThreading("/Navigations2/", nav2Loader, nav2Thread); } void loadPng(File[] files, ImageLoader loader) { for (int i = 0; i &lt; files.length; i++) { String path = files[i].getAbsolutePath(); if (path.toLowerCase().endsWith(".png")) { loader.loadImg(path); } } } void setupThreading(String folderName, ImageLoader loader, Thread threading) { File dir = new File(sketchPath + folderName); File[] files = dir.listFiles(); threading = new Thread(loader); loadPng(files, loader); threading.start(); } Any idea how I can go about solving these errors?
favorite count: 0
has title: How to solve "Exception in thread "Animation Thread" java.lang.NullPointerException"?
tagged with: netbeans
has answer: http://stackoverflow.com/a/21131681
type: UnansweredQuestion
tagged with: multithreading
downvote count: 1
score: 2
upvote count: 3
has comment: http://stackoverflow.com/comment/31799574
tagged with: java
has answer: http://stackoverflow.com/a/21131644
type: Question

http://stackoverflow.com/a/21158571
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31848822
has body: What you are looking for is javax.crypto.SealedObject or java.security.SignedObject.
has comment: http://stackoverflow.com/comment/31848521
score: 1
answers question: http://stackoverflow.com/q/21158485
upvote count: 1

http://stackoverflow.com/a/21133342
has comment: http://stackoverflow.com/comment/31803921
answers question: http://stackoverflow.com/q/21133134
downvote count: 0
has body: When nested in the presentation layer of a multi-tier architecture, MVC's models are usually nothing more than (possibly enhanced) key-value maps. The controller, after having called the appropriate business layer service, instanciate a new map with the values the view will have to display. Spring MVC for example implemented the MVC pattern this way: see how the ModelMap extends LinkedHashMap. See this answer to see a typical HTTP request life cycle, when the MVC pattern is nested in the presentation layer of a 3-tier architecture. So to sum up, I would put CarLogic in your businessEntities package, and the Car POJO within a new presentation.bean package for example (so you won't need your presentation.model package anymore). Thus, your controller would add the Car instance as an attribute of the request, which would then play the part of the model: request.setAttribute("theBean", yourBeanInstance); In your JSP views, simply use ${theBean.anyProperty} to access the attribute (don't forget the getter in your bean). Note that the EL will scan the following scopes in given order: page, request, session, application; the first found match will then be returned.
has comment: http://stackoverflow.com/comment/31804347
has comment: http://stackoverflow.com/comment/31803009
score: 3
has comment: http://stackoverflow.com/comment/31803549
has comment: http://stackoverflow.com/comment/31803480
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/31803626

http://stackoverflow.com/comment/87360589
comment on: http://stackoverflow.com/a/36427118
type: AnswerComment
score: 1
type: Comment
has text: For us it was necessary to import the certificate to the file $JAVA_HOME/jre/lib/security/jssecacerts as well.

http://stackoverflow.com/q/21124400
has body: i'm using java 7's flight recorder to dump execution of Hadoop tasks. to do this, i use this configuration option: mapred.child.java.opts -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,dumponexit=true,dumponexitpath=/root/recordings The result is many .jfr files (as expected). I can open anyone of these in Java Mission Control without issue. However, if I try and concatenate them together using: java oracle.jrockit.jfr.tools.ConCatRepository [directory] [-o output_filename] (taken from: http://docs.oracle.com/cd/E15289_01/doc.40/e15070.pdf: http://docs.oracle.com/cd/E15289_01/doc.40/e15070.pdf) I can not open the result in Java Mission Control with error "Loading events from condensed.jfr has encountered a problem. Could not load events from condensed.jfr". What am I doing wrong?
upvote count: 3
type: UnansweredQuestion
has title: java flight recorder concatenation error
type: Question
score: 3
tagged with: java
tagged with: hadoop
has answer: http://stackoverflow.com/a/21146105
tagged with: profiling
downvote count: 0
answer count: 1
tagged with: jfr
favorite count: 0

http://stackoverflow.com/comment/31886655
score: 1
comment on: http://stackoverflow.com/a/21175149
type: AnswerComment
has text: @MChan: No, it doesn't - because string formatting shouldn't be involved in the transfer to the database at all. As you've said, you've got a field of type `Date` - why would you need to convert that to a string format? At the storage level, there's no such thing as fixing it "in one fixed format" - the underlying storage will be in a binary format, and the JDBC driver is responsible for transmitting the `Date` to the database. That *could* end up with a textual intermediate form, but in most cases there'd be no need for that.
type: Comment

http://stackoverflow.com/comment/31643441
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21046860
type: Comment
has text: Yea Weapons have subclasses like Shotgun and Sniper but this subclasses have a Special Instance like an AWM Sniper is always the same AWM sniper. And the same is with the cars then...

http://stackoverflow.com/comment/31740800
has text: Ideally, as a short but complete program demonstrating the problem...
comment on: http://stackoverflow.com/q/21099413
score: 3
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31756347
type: QuestionComment
comment on: http://stackoverflow.com/q/21107520
score: 0
has text: Are these variables ones that are normally present when you log in via ssh and execute your command manually?
type: Comment

http://stackoverflow.com/comment/31835651
comment on: http://stackoverflow.com/q/21150924
score: 0
has text: @Ingo the `randomRIO (0,1)` gives in every loop cycle a different value - it is in the IO monad. in my output the result of "./main 1000000" is different each time I call it. Do you experience another behavior, please let me know.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21176935
has comment: http://stackoverflow.com/comment/31882486
type: AnsweredQuestion
has body: Am trying to create a method that when called will add a new Entity.Am trying to use a for loop and an ArrayList to do this. So far this is what i have: public void createUserEntity() { ArrayList&lt;Entity&gt; user = new ArrayList&lt;Entity&gt;(); } The problem is the Entity class is from com.google.appengine.api.datastore.Entity and it requires a key argument when creating it.For example Entity user = new Entity("user"); Am not sure how to add thiskeyargument when creating a newEntityusing ArrayList. An Attempt at ArrayList&lt;Entity&gt; user = new ArrayList&lt;Entity&gt;("user"); is flagged with the error message Remove argument to match 'ArrayList&lt;Entity&gt;()'
tagged with: java
type: Question
has title: Creating multiple Google App Engine Entities in a for loop
has answer: http://stackoverflow.com/a/21177206
score: 0
answer count: 1
tagged with: google-app-engine
accepted answer: http://stackoverflow.com/a/21177206

http://stackoverflow.com/comment/31836789
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21151748
has text: You don't even need `addAll`. The set constructors will accept a collection, so you could use `Set<String> mySet = new TreeSet<>( Arrays.asList( wordArr ));`.

wamp
tag name: wamp
tags question: http://stackoverflow.com/q/21092833
type: Tag

http://stackoverflow.com/comment/31695771
has text: I was wondering what an OArray is, couldn't find in google.
score: 0
comment on: http://stackoverflow.com/q/21075189
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31801023
score: 0
has text: can you post a SSCCE?
comment on: http://stackoverflow.com/q/21132278
type: Comment
type: QuestionComment

http://stackoverflow.com/a/32517158
answers question: http://stackoverflow.com/q/21020347
score: 22
has comment: http://stackoverflow.com/comment/63217093
upvote count: 22
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/125099881
has body: The idea is to have equal size of message being sent from Kafka Producer to Kafka Broker and then received by Kafka Consumer i.e. Kafka producer --> Kafka Broker --> Kafka Consumer Suppose if the requirement is to send 15MB of message, then the Producer, the Broker and the Consumer, all three, needs to be in sync. Kafka Producer sends 15 MB --> Kafka Broker Allows/Stores 15 MB --> Kafka Consumer receives 15 MB The setting therefore should be: a) on Broker: message.max.bytes=15728640 replica.fetch.max.bytes=15728640 b) on Consumer: fetch.message.max.bytes=15728640

http://stackoverflow.com/comment/31708295
comment on: http://stackoverflow.com/a/21081655
has text: The way you do it is indeed not very readable. I'd ask myself why would someone write it in such a way as to write `e.getMessage()` twice?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31735977
type: Comment
type: QuestionComment
has text: I think so, it is like this one `Object[] data = (Object[]) server.call("input", num);` didn't send anything. use this link as reference http://www.codeforest.net/how-to-build-php-xml-rpc-server-client-and-android-app , http://www.wordtracker.com/docs/api/ch03s02.html , and
comment on: http://stackoverflow.com/q/21094698
score: 0

http://stackoverflow.com/a/21143239
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21143088
answers question: http://stackoverflow.com/q/21143088
type: Answer
score: 2
downvote count: 0
has body: Ant's Jar task lets you specify a manifest file to use as attribute of the jar-element:
upvote count: 2

http://stackoverflow.com/a/21083191
has body: In java when you say: ObjA == ObjB It is interpreted absolutely pedantically as "Does Obja refer to the same object as Objb" Whereas the ".equals" method is implemented within the object and varies from class to class. Mostly it does what you expect, i.e. compare some internal members of the class for equality. But it entirely depends on the implementation of the class.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21083119

http://stackoverflow.com/a/21166065
type: Answer
upvote count: 19
answers question: http://stackoverflow.com/q/21165871
score: 19
has body: The following should work. private Document obtenerDocumentDeByte(byte[] documentoXml) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); return builder.parse(new ByteArrayInputStream(documentoXml)); }
accepted answer of: http://stackoverflow.com/q/21165871
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31797356
comment on: http://stackoverflow.com/a/21124394
type: Comment
has text: Thank you haha you saved me alot of hair pulling!
score: 0
type: AnswerComment

http://stackoverflow.com/a/71329551
upvote count: 1
score: -1
answers question: http://stackoverflow.com/q/21076179
type: Answer
has body: In my case I solved this problem running from the Android Studio terminal the following command ./gradlew assemble After that the project ran without problem.
downvote count: 2

http://stackoverflow.com/q/21034351
accepted answer: http://stackoverflow.com/a/21034352
tagged with: java
tagged with: spring-data
linked to: http://stackoverflow.com/q/21034018
type: Question
tagged with: jodatime
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/21034352
has body: I try to just save a document with org.joda.time.DateTime field from Joda-Time. @Document public class JodaDoc { @Id private BigInteger id; private String dateAsString; private DateTime date; public JodaDoc(String dateAsString, DateTime date) { this.dateAsString = dateAsString; this.date = date; } public BigInteger getId() { return id; } public String getDateAsString() { return dateAsString; } public DateTime getDate() { return date; } } Standard application config using AbstractMongoConfiguration from spring-data-mongodb: @ComponentScan @EnableMongoRepositories public class AppConfig extends AbstractMongoConfiguration { ... } A test which explicit uses AppConfig class (with Spock, but internally mechanisms provided by spring-test are used): @ContextConfiguration(classes = AppConfig) class JodaDocRepositorySpec extends Specification { @Autowired private JodaDocRepository jodaDocRepository def "save document with DateTime"() { given: def jodaDoc = new JodaDoc(DateTime.now()) when: def savedJodaDoc = jodaDocRepository.save(jodaDoc) then: savedJodaDoc.id } } Joda-Time converters in Spring Data MongoDB (and also in Spring Core itself) should be enabled by default when Joda-Time jar is on a classpath. Unfortunately my test fails with: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type org.joda.time.DateTime to type java.util.Date I tried to add DefaultFormattingConversionService: @Bean public ConversionService conversionService() { return new DefaultFormattingConversionService(); } ConversionServiceFactoryBean and a few other things with no effect. I wasn't able to find an answer on StackOverflow. Question. Why Spring Data MongoDB doesn't see a standard org.joda.time.DateTime -&gt; java.util.Date conveter?
favorite count: 0
has title: Spring Data MongoDB doesn't see enabled by default Joda-Time converter
upvote count: 2
tagged with: spring-data-mongodb
tagged with: spring
score: 2
type: AnsweredQuestion

http://stackoverflow.com/a/21049666
upvote count: 16
has comment: http://stackoverflow.com/comment/31648883
score: 16
downvote count: 0
has body: I'd use this instead: ^\+?\d*$ Matches your + at the start, then any digit, dash, space, dot, or brackets. See it in action: http://regex101.com/r/mS9gD7
answers question: http://stackoverflow.com/q/21049557
has comment: http://stackoverflow.com/comment/31648481
type: Answer

http://stackoverflow.com/comment/31751890
has text: Have you tried printing each token?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21105037

http://stackoverflow.com/q/21181527
tagged with: nfc
has answer: http://stackoverflow.com/a/21182342
has title: SCL01x Contactless Reader with PCSC lite on Ubuntu
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21202795
accepted answer: http://stackoverflow.com/a/21202795
type: Question
has body: I am having smartcard reader from Ingenico, trying to make it work on Ubuntu 12.4. 64bit I have already installed pcsc lite and libusb and reader driver which is SCL01x Contactless Reader - driver. The situation is when i plug the rader in my USB port, signal light is off on reader. When i try to run pcscd i get his errors: 00000000 dyn_unix.c:37:DYN_LoadLibrary() /usr/local/lib/pcsc/drivers/SCLGENERIC.bundle/Contents/Linux/libSCLGENERIC.so.2.09: /usr/local/lib/pcsc/drivers/SCLGENERIC.bundle/Contents/Linux/libSCLGENERIC.so.2.09: wrong ELF class: ELFCLASS32 00000096 readerfactory.c:996:RFInitializeReader() RFLoadReader failed: 0xFFFFFFFF80100014 00000074 readerfactory.c:312:RFAddReader() SCL011G Contactless Reader [SCL01x Contactless Reader] (21161207200555) init failed. 00000047 hotplug_libudev.c:391:HPAddDevice() Failed adding USB device: SCL011G Contactless Reader when i run pcsc_scan: PC/SC device scanner V 1.4.18 (c) 2001-2011, Ludovic Rousseau &lt;ludovic.rousseau@free.fr&gt; Compiled with PC/SC lite version: 1.7.4 Using reader plug'n play mechanism Scanning present readers... 0: SCL011G Contactless Reader [SCL01x Contactless Reader] (21161207200555) 00 00 Fri Jan 17 03:27:45 2014 Reader 0: SCL011G Contactless Reader [SCL01x Contactless Reader] (21161207200555) 00 00 Card state: And nothing... I tried also example with smartcardio package in java, and error is: no terminals, cardreader can not be found. When i run lsusb, there is my reader in device list marked as SCM Microsystem [EDIT][1.0] I have managed to start pcscd service, now i can see that device is working by signal lights When i swipe smart card over it the lights are working. 64bit driver installed Trying to figure out why do i get error: SCardEstablishContext: Service not available. after pcsc_scan command
tagged with: ubuntu
tagged with: pcsc
score: 0
tagged with: linux
answer count: 2
possible better answer: http://stackoverflow.com/a/21182342

http://stackoverflow.com/comment/31795060
score: 0
type: AnswerComment
has text: No, it doesn't. It gives me the exact error as I posted in original post.
type: Comment
comment on: http://stackoverflow.com/a/21128903

http://stackoverflow.com/comment/31735804
type: Comment
has text: But that's exactly what I _don't_ want to happen. The user should be able to hold the spacebar and bounce off the platform. This should happen so that the player instead of having to tap the spacebar after landing on a tiny platform can just bounce off it.
comment on: http://stackoverflow.com/a/21082030
type: AnswerComment
score: 0

encryption
tags question: http://stackoverflow.com/q/21143209
tags question: http://stackoverflow.com/q/21056311
tags question: http://stackoverflow.com/q/21173929
tags question: http://stackoverflow.com/q/21118202
tags question: http://stackoverflow.com/q/21125367
tags question: http://stackoverflow.com/q/21147368
tag name: encryption
tags question: http://stackoverflow.com/q/21041874
tags question: http://stackoverflow.com/q/21146947
tags question: http://stackoverflow.com/q/21073254
tags question: http://stackoverflow.com/q/21089003
tags question: http://stackoverflow.com/q/21113759
tags question: http://stackoverflow.com/q/21046671
tags question: http://stackoverflow.com/q/21076104
tags question: http://stackoverflow.com/q/21078737
tags question: http://stackoverflow.com/q/21086103
tags question: http://stackoverflow.com/q/21124475
type: Tag
tags question: http://stackoverflow.com/q/21105156
tags question: http://stackoverflow.com/q/21068668
tags question: http://stackoverflow.com/q/21129202

http://stackoverflow.com/a/21055689
upvote count: 2
has comment: http://stackoverflow.com/comment/31660326
score: 2
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21055641
has body: The easiest way to do this would be to set up an html mailto form, which will do all the work in the user's browser rather than needing any java or server involvement at all. Websearch on that phrase will find more information. The biggest advantage of the more complicated solutions is that they hide the address being mailed to, to some degree, which can help reduce how badly you're targeted by spammers.

http://stackoverflow.com/comment/88942514
type: Comment
comment on: http://stackoverflow.com/a/46204403
score: 0
has text: How to add the link to an existing pdf file? Using "PDDocument" object.
type: AnswerComment

http://stackoverflow.com/a/21172364
accepted answer of: http://stackoverflow.com/q/21166939
score: 1
has comment: http://stackoverflow.com/comment/31888151
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31875938
has body: Try This One , we are using it: public class Demographic extends CustomComponent implements Upload.SucceededListener,Upload.FailedListener, Upload.Receiver,Upload.ProgressListener { private Upload uploadPic; public Demographic() { mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(true); mainLayout.setWidth("100%"); mainLayout.setHeight("100%"); mainLayout.setMargin(false); uploadPic = new Upload("Upload image", this); uploadPic.setImmediate(true); uploadPic.setWidth("-1px"); uploadPic.setHeight("-1px"); mainLayout.addComponent(uploadPic, "top:135.0px;left:32.0px;"); uploadPic.addListener((Upload.SucceededListener) this); uploadPic.addListener((Upload.FailedListener) this); uploadPic.addListener((Upload.ProgressListener)this); } @Override public void uploadFailed(FailedEvent event) { // TODO Auto-generated method stub app.getMainWindow().showNotification("Error! &lt;br /&gt;", "Upload Failed due to: " + event.getReason().getMessage() , Window.Notification.TYPE_WARNING_MESSAGE); } @Override public void uploadSucceeded(SucceededEvent event) { // all success logic if(event.getMIMEType().contains("image")){//mimeType can be made a global variable and can set in Receive upload // System.out.println(event.getFilename()); savePicture(event.getFilename());// save pic to db from the path provided in receive upload app.getMainWindow().showNotification("Success! &lt;br /&gt;", "Image upload successful!", Window.Notification.TYPE_TRAY_NOTIFICATION); } } } @Override public OutputStream receiveUpload(String filename, String mimeType) { FileOutputStream fos; if(mimeType.contains("image")){ String basePath = getApplication().getContext().getBaseDirectory().getAbsolutePath() + "\\Documents\\"+filename; File file= new File(basePath); boolean checkForDir = file.exists(); if(!checkForDir){ checkDir.mkdir(); } try { // Open the file for writing. fos = new FileOutputStream(file); } catch (final java.io.FileNotFoundException e) { // Error while opening the file. Not reported here.…
downvote count: 0
answers question: http://stackoverflow.com/q/21166939
type: Answer
upvote count: 1

http://stackoverflow.com/a/21041246
has body: In Files class source you can see that in readAllBytes method bytes are read from InputStream. public static byte[] readAllBytes(Path path) throws IOException { long size = size(path); if (size &gt; (long)Integer.MAX_VALUE) throw new OutOfMemoryError("Required array size too large"); try (InputStream in = newInputStream(path)) { return read(in, (int)size); } } return read(in, (int)size) - here it uses buffer to read data from InputStream. So you can do it in the same way or just use Guava or Apache Commons IO http://commons.apache.org/io/.
answers question: http://stackoverflow.com/q/21039579
score: 3
downvote count: 0
upvote count: 3
type: Answer

http://stackoverflow.com/q/21110178
score: 0
has title: How to get the position on custom view onclick
tagged with: java
has comment: http://stackoverflow.com/comment/31760310
has body: In custom view for a particular view on Click I am unable to get the position, please help me. holder.operation.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Log.v("onClick", "Position: " + v.getTag()); } });
has answer: http://stackoverflow.com/a/21110685
has comment: http://stackoverflow.com/comment/31760260
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/3657243
type: Question
tagged with: android
answer count: 1
tagged with: onclicklistener

http://stackoverflow.com/comment/31636777
comment on: http://stackoverflow.com/q/21043435
has text: This is depends from JVM implementation.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31775278
score: 0
comment on: http://stackoverflow.com/q/21114624
type: Comment
type: QuestionComment
has text: I don't know the reason for editing imports. You can directly use any classes in your build path and when compiler crys for unresolved symbol use quick fix to import it.

http://stackoverflow.com/a/21199929
answers question: http://stackoverflow.com/q/21161816
has body: Try to replace do{ out.print("Continue asking?(Y/N)..."); yOn=kbScanner.nextLine(); }while (!yOn.equals("Y")&amp;&amp;!yOn.equals("y")&amp;&amp;!yOn.equals("N")&amp;&amp;!yOn.equals("n")); out.println("Continuing"); By out.print("Continue asking?(Y/N)..."); yOn=kbScanner.nextLine(); You really do not need the inner do-while loop as the outer loop can do the same thing for you. Try this or this to see when the nested loops are really useful.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31924030

http://stackoverflow.com/q/21073888
tagged with: opencv
type: AnsweredQuestion
has body: I am finding the contours only on part of a frame (below the horizon line) . I want to have real coordinates of the points after I use MatOfPoint.toList(). This is the code I have: Iterator&lt;MatOfPoint&gt; itr = mContours.iterator(); while(itr.hasNext()){ MatOfPoint tmp = itr.next(); List&lt;Point&gt; listOfPoints = tmp.toList(); Iterator&lt;Point&gt; iterator = listOfPoints.iterator(); while(iterator.hasNext()){ Point p = iterator.next(); p.y=p.y+CONSTANT; } } The problem is: It's very slow. Is there any way to do it faster?
tagged with: java
tagged with: image-processing
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/21202036
has title: Add constant to each element of ListOfPoints in openCV Android
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/21202036

http://stackoverflow.com/q/21156073
type: UnansweredQuestion
tagged with: android
tagged with: windows
score: 2
answer count: 0
upvote count: 2
tagged with: maven
type: Question
tagged with: java
tagged with: dex
has body: I have a big problem with my android project: If I want to build my project on windows command line (cmd.exe) I get an error with the message: command line too long from the dex call. The problem is that a lot of dependencies are defined and needed for this project, so the command line is longer than 3000 characters. I searched for a way to make the dex build step of android maven plugin convert each jar in a single process step instead of converting all jars in one process step. Is it be able to do this?
downvote count: 0
has title: Android Maven Plugin - dex creation with too long command line (windows)
favorite count: 0

http://stackoverflow.com/a/21035611
has comment: http://stackoverflow.com/comment/31623738
has body: do like this public boolean containsIgnoreCase(searchIn, seachFor){ return searchIn.toLowerCase().contains(seachFor.toLowerCase()); }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21035586
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/31623722

http://stackoverflow.com/a/21110917
downvote count: 0
type: Answer
has body: Create an object which has your attribues. (recordID, recordName , titleFeild, titleIDMap, titleId, titleStartDate, titleEndDate, languageId) Get data from dao and convert it to json. It will looks like what you want. Gson gson = new Gson(); // convert java object to JSON format, // and returned as JSON formatted string String json = gson.toJson(obj);
upvote count: 1
answers question: http://stackoverflow.com/q/21110537
score: 1

http://stackoverflow.com/a/21120701
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/21120590
has body: Doing this in a JSP is actually very painless! <%@ page language ="java"%> <% boolean b = true; if(b){ %> first <% else{ %> other <% } %> OTHER HTML HERE JSPs really are pretty magic, you can mix Java and HTML as you need, just keep <% %> tags around the java code. And remember that JSPs are all generated server-side, so you can't do any real-time client handling logic. It is all executed before the user ever sees the page, and he just receives the static HTML output of the java.
upvote count: 1

http://stackoverflow.com/q/21171472
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21171887
has body: Basically I want to run some Rest classes in Tomcat 8 embedded. I am unsure how to add them to the tomcat embedded instance I am creating. So this is what I do. Here is just that Jersey class: import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import static javax.ws.rs.core.MediaType.*; @Path("register") public class RegisterRestAPI { private MerchantRegistrationService merchantRegistrationService; public RegisterRestAPI(MerchantRegistrationService merchantRegistrationService) { this.merchantRegistrationService = merchantRegistrationService; } @GET @Produces(TEXT_PLAIN) public String register() { return "Hello!!!!"; } } And here is the class where I create Tomcat: import org.apache.catalina.Context; import org.apache.catalina.LifecycleException; import org.apache.catalina.startup.Tomcat; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer; import javax.servlet.ServletException; import java.io.File; public class TomcatServer { private MerchantRegistrationService merchantRegistrationService; public TomcatServer(MerchantRegistrationService merchantRegistrationService) { this.merchantRegistrationService = merchantRegistrationService; } public void start() throws ServletException, LifecycleException { String webappDirLocation = "restui/src/main/webapp/"; Tomcat tomcat = new Tomcat(); String webPort = System.getenv("PORT"); if(webPort == null || webPort.isEmpty()) { webPort = "8080"; } tomcat.setPort(Integer.valueOf(webPort)); Context context = tomcat.addWebapp("/", new File(webappDirLocation).getAbsolutePath()); tomcat.addServlet(context,"jersey-container-servlet",resourceConfig()); context.addServletMapping("/register", "registration rest"); tomcat.start(); tomcat.getServer().await(); } private ServletContainer resourceConfig() { return new ServletContainer(new ResourceConfig().register(new RegisterRestAPI(merchantRegistrationService)))…
tagged with: jersey
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0
tagged with: rest
has comment: http://stackoverflow.com/comment/86499516
has title: How to add a Jersey REST webservice into embedded tomcat?
type: AnsweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/21171887
type: Question

http://stackoverflow.com/a/21054896
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/43070394
upvote count: 2
answers question: http://stackoverflow.com/q/21048020
downvote count: 1
has comment: http://stackoverflow.com/comment/43097437
has body: Turns out if you actually read the docs you find out that you can't just change serialization configuration by calling getSerializationConfig and calling setters on it. /** * Method that returns the shared default {@link SerializationConfig} * object that defines configuration settings for serialization. *&lt;p&gt; * Note that since instances are immutable, you can NOT change settings * by accessing an instance and calling methods: this will simply create * new instance of config object. */ SerializationConfig getSerializationConfig(); I repeat, you can NOT change settings by accessing an instance and calling methods: So you must call the .configure method instead of .without and you cannot set the view by calling .withView. Those methods will construct a new instance of SerializationConfig, but there is no way to get your new SerializationConfig back into the ObjectMapper. In order to get around that and wire my ObjectMapper up to be used by Spring MVC when it processes a @ResponseBody I implemented the following: @Configuration class WebConfig extends WebMvcConfigurerAdapter { @Override public void configureMessageConverters(List&lt;HttpMessageConverter&lt;?&gt;&gt; converters) { MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); ObjectMapper mapper = new ObjectMapper() { private static final long serialVersionUID = 1L; @Override protected DefaultSerializerProvider _serializerProvider(SerializationConfig config) { // replace the configuration with my modified configuration. // calling "withView" should keep previous config and just add my changes. return super._serializerProvider(config.withView(Views.Public.class)); } }; mapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, false); converter.setObjectMapper(mapper); converters.add(converter); } } With all that in place, everything is working for me.
has comment: http://stackoverflow.com/comment/43097694

http://stackoverflow.com/q/21105846
favorite count: 0
has body: I am a newbie in android application. When i clicked the button, the camera should appear. What should I do? What are the codes to be used? Please help, thank you.
has comment: http://stackoverflow.com/comment/31753160
tagged with: android
upvote count: 1
possible better answer: http://stackoverflow.com/a/21105877
type: AnsweredQuestion
tagged with: java
downvote count: 3
type: Question
answer count: 2
tagged with: camera
score: -2
has answer: http://stackoverflow.com/a/21105877
has title: ANDROID -How to open camera when a button is pressed in android?
has answer: http://stackoverflow.com/a/21105858
accepted answer: http://stackoverflow.com/a/21105858
has comment: http://stackoverflow.com/comment/31753180

http://stackoverflow.com/a/21068258
answers question: http://stackoverflow.com/q/21068239
upvote count: 1
score: 1
has body: That's fine. The @ character is not valid in a URL (x-www-form-urlencoded), it must be properly encoded. Your server should have no problem decoding it.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31637708
type: QuestionComment
comment on: http://stackoverflow.com/q/21043777
has text: Code of the bean named 'TA_APPDB_TST' ?
score: 0
type: Comment

http://stackoverflow.com/comment/31688291
type: AnswerComment
score: 0
type: Comment
has text: So it was (almost) valid T-SQL?
comment on: http://stackoverflow.com/a/21070933

http://stackoverflow.com/comment/31798971
type: QuestionComment
comment on: http://stackoverflow.com/q/21130677
has text: Of course the `new FileWriter` line is 'causing ISSUE'. It overwrites the file, so it is now zero length, so when you go to read an object from it you fail. Just remove it. What's the point of it anyway?
type: Comment
score: 0

http://stackoverflow.com/q/21045460
tagged with: http://stackoverflow.com/tag/csv
tagged with: testng
has comment: http://stackoverflow.com/comment/31640853
has title: Getting an ArrayIndexOutOfBoundsException when reading from CSV with JAVA testNG, but why?
tagged with: java
has body: When using a dataprovider to read a csv with testcases, I'm getting an ArrayIndexOutOfBoundsException. The CSV looks like this: TC1;tester@test.com;tester;t;Valid login TC2;tester@test.com;incorrect;f;Invalid password TC3;incorrect@test.com;tester;f;Invalid user TC4;tester@test.com;;fp;Empty password TC5;;tester;fe;Empty user The Code: package tools; import java.io.FileReader; import java.io.IOException; import java.util.List; import org.testng.annotations.DataProvider; import au.com.bytecode.opencsv.CSVReader; public class DataProviders { @DataProvider static Object[][] LoginTestInput() throws IOException{ CSVReader reader = new CSVReader(new FileReader("src/input/LoginTestInputFile.csv")); List&lt;String[]&gt; myEntries = reader.readAll(); Object[][] returnObject = new Object[myEntries.size()][5]; for(int i = 1;i&lt;myEntries.size();i++){ String testCase = myEntries.get(i)[0]; String username = myEntries.get(i)[1]; String password = myEntries.get(i)[2]; String loginSuccessful = myEntries.get(i)[3]; String description = myEntries.get(i)[4]; returnObject[i][0] = testCase; returnObject[i][1] = username; returnObject[i][2] = password; returnObject[i][3] = loginSuccessful; returnObject[i][4] = description; } return returnObject; } } Stacktrace: java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: 1 at org.testng.internal.MethodInvocationHelper.invokeDataProvider(MethodInvocationHelper.java:161) at org.testng.internal.Parameters.handleParameters(Parameters.java:429) at org.testng.internal.Invoker.handleParameters(Invoker.java:1383) at org.testng.internal.Invoker.createParameters(Invoker.java:1075) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1180) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111) at org.testng.TestRunner.privateRun(TestRunner.java:767) at org.testng.TestRunner.run(TestRunner.java:617) at org.testng.SuiteRunner.runTe…
type: Question
tagged with: dataprovider
has answer: http://stackoverflow.com/a/21045812
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21046205
tagged with: multidimensional-array
type: UnansweredQuestion

http://stackoverflow.com/comment/32314160
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21253613
has text: This worked. I had to do this in javascript to make it work: var users = JSON.parse(JSON.stringify(userObjectsFromJava));
type: AnswerComment

http://stackoverflow.com/q/21072193
tagged with: jtable
score: 0
has title: How to populate jTable using MS ACCESS on a button event?
answer count: 1
has body: Here is my Code: Its not displaying any data on Jtable please help me guys: Connection con=null; ResultSet rs=null; PreparedStatement ps=null; try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection co=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=c:\\a.accdb"); String sql="Select * from expenses"; ps=con.prepareStatement(sql); rs=ps.executeQuery(); Table_Expenses.setModel(DbUtils.resultSetToTableModel(rs)); } catch(Exception e) { }
accepted answer: http://stackoverflow.com/a/21072308
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: apache-commons-dbutils
has answer: http://stackoverflow.com/a/21072308

http://stackoverflow.com/a/21085222
answers question: http://stackoverflow.com/q/21084521
score: 0
has body: Just add the URL for jgroups-3.4.2.Final.jar to the URLClassLoader's array of URLs.
type: Answer

http://stackoverflow.com/comment/31641990
comment on: http://stackoverflow.com/a/21029586
type: AnswerComment
score: 0
type: Comment
has text: i still get the same error when i use this, but i've attached the xml

http://stackoverflow.com/q/21168434
has title: How to create list in both model classes in one another
score: 0
type: Question
tagged with: java
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21168609
has answer: http://stackoverflow.com/a/21168602
has body: I have 2 bean classes- Country &amp; city. I need to keep city list in Country class. ANd also when i am setting the city information I need to set the country name, so need country inside city class too. How to do it? Below are the codes: Country.java public class Country { private String name; private String about; ArrayList&lt;City&gt; cities; public Country() { cities = new ArrayList&lt;City&gt;(); } public Country(String name, String about) { this.name= name; this.about = about; } public int getNoOfCities() { return cities.size(); } public long getNoOfCitizens() { Long aPop= 0L; //Long aPopulation = cities.get for(City aCity: cities) { aPop += aCity.getPopulation(); } return aPop; } public String getName(){ return name; } public String getAbout(){ return about; } } City.java public class City { private String name; private String about; private Long population; public City(String name, String about, Long population) { this.name= name; this.name = about; this.population = population; } public String getName(){ return name; } public String getAbout(){ return about; } public Long getPopulation(){ return population; } } How can i solve it? Someone told me something like ViewObject but don't know what it is or whether its going to solve. Help me :-) Country Entry/details UI 1. Name (Entry) 2. About (Entry) 3. List of every country 4. For each country in the listView- a details UI (Details UI) which will have: 4.1. Name 4.2 Number of cities under this country 4.3. Number of population in this country(WHich will be the sum of all City population under the country) City Entry UI 1. Name (Entry) 2. About (Entry) 3. Population (Entry) 4. Country (Drop down)

http://stackoverflow.com/q/21170035
has answer: http://stackoverflow.com/a/21170209
accepted answer: http://stackoverflow.com/a/21170643
possible better answer: http://stackoverflow.com/a/21170209
tagged with: indexing
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21170643
has body: When we create a Collection (ArrayList,HashMap) in Java, does Java internally create some kind of index for faster retrieval of data ? In Oracle we have to manually create indexes but what is the technique (if any) used in Java
score: 0
tagged with: oracle-database
has title: Does Java use indexes for Data structure like Oracle
has comment: http://stackoverflow.com/comment/31869299

http://stackoverflow.com/comment/35662135
score: 0
type: AnswerComment
has text: It's only scrolls at the first time. because, consumeTouchEvents needs to be false again somewhere.
type: Comment
comment on: http://stackoverflow.com/a/21102854

http://stackoverflow.com/a/21059482
type: Answer
has comment: http://stackoverflow.com/comment/31666979
has comment: http://stackoverflow.com/comment/31666965
answers question: http://stackoverflow.com/q/21059430
score: 1
has comment: http://stackoverflow.com/comment/31666952
has body: Trying to transfer a console program to a GUI program is not an easy task if you've never made a GUI program before. You need to learn about event-driven programming. I suggest you have a look at the Swing tutorials Some tips though. It you want a "semi-gui" program. You can just use JOptionPanes for the input. Say you want to get an number input. You would do something like this String numberString = JOptionPane.showInputDialog(null, "Enter a Number"); int number = Integer.parseInteger(numberString); once you do the first line, an input pane automatically pops up. asking for an input. The result is a String, so you have to parse it to get a number. Also if you just want to diplay a message, just use JOptionPane.showMessageDialog(null, message); You can do that do display some result. In the above case when you just want to show a message, you don't need to make it equal to anything. So instead of the System.out.println()s, you can just use the JOPtionpane.showMesageDialog(), and instead of scan.next(), you would use JOptionPane.showInputDialog()
has comment: http://stackoverflow.com/comment/31667024
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/31776681
comment on: http://stackoverflow.com/a/21118917
score: 0
type: AnswerComment
type: Comment
has text: Well you should have the compilation issue explained in detail in the Maven output. This is just a compilation issue anyway.

http://stackoverflow.com/a/21027748
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21027434
downvote count: 0
has body: Store a format string in the resource and use String.format to replace the comp and guesses placeholders. Use the appropriate places holders for each and include the variables as arguments to format(). You can find details of what placeholders to use under the Formatter class. The resource would then be something like: Good job! The answer was %s \n You made %d guesses.\n Restart the app to try again. And the code would be: ... else String correctFormat = getString(R.string.correct); Toast.makeText(MainActivity.this, String.format(correctFormat, comp, guesses), Toast.LENGTH_LONG).show(); } };
score: 1

http://stackoverflow.com/a/21140496
downvote count: 0
score: 6
has body: Your format string specifies that you'll provide a two-digit month, but you're only providing "1". I suspect you want: String sdfPattern = "M/d/yyyy hh:mm:ss aa"; Additionally, the "AM/PM" designator is locale-sensitive (as are the date and time separators) . If you know that it will always use English, you should say so: SimpleDateFormat sdf = new SimpleDateFormat(sdfPattern, Locale.US); Unless the data is actually entered by the user (or being formatted for the user) you should avoid Locale.getDefault().
has comment: http://stackoverflow.com/comment/31815110
has comment: http://stackoverflow.com/comment/31815513
has comment: http://stackoverflow.com/comment/31815352
accepted answer of: http://stackoverflow.com/q/21140464
upvote count: 6
answers question: http://stackoverflow.com/q/21140464
has comment: http://stackoverflow.com/comment/31815075
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31816361
type: Answer

http://stackoverflow.com/q/21173949
tagged with: java
tagged with: box2d
type: Question
answer count: 2
has body: I'm creating my own Game Application using Box2D and i'm facing some problems. I managed to render every body i wanted, moving them but i have to put high value to move them correctly. For example here is my Player body definition : bodyDefPlayer = new BodyDef(); bodyDefPlayer.type = BodyType.DynamicBody; bodyDefPlayer.position.set(positionX, (positionY * tileHeight) + 50); playerBody = world.createBody(bodyDefPlayer); polygonPlayer = new PolygonShape(); polygonPlayer.setAsBox(50, 50); fixturePlayer = new FixtureDef(); fixturePlayer.shape = polygonPlayer; fixturePlayer.density = 0.8f; fixturePlayer.friction = 0.5f; fixturePlayer.restitution = 0.0f; playerBody.createFixture(fixturePlayer); playerBody.setFixedRotation(true); And here is how i have to apply my impulse to move him : Vector2 vel = this.player.playerBody.getLinearVelocity(); Vector2 pos = this.player.playerBody.getWorldCenter(); player.playerBody.applyLinearImpulse(new Vector2(vel.x + 20000000, vel.y * 1000000), pos, true); As you can see my values are pretty high plus the player isn't doing a curve when he is going down but more going straight down when he can. I'd like to have some help please :) Thanks !
has answer: http://stackoverflow.com/a/21197113
has title: Linear Impulse values
accepted answer: http://stackoverflow.com/a/21176303
score: 0
has answer: http://stackoverflow.com/a/21176303
possible better answer: http://stackoverflow.com/a/21197113
type: AnsweredQuestion

http://stackoverflow.com/a/21147304
answers question: http://stackoverflow.com/q/21146973
type: Answer
has body: It has nothing to do with sound, it has to do with being able to access the Clip reference. Because you've created local reference to Clip, nothing else will be able to access the reference in order to change the state... You need to change the local reference so that it is a class level reference, allowing other methods to interact with it... For example... protected static Clip clip; public static void backgroundMusic() { try { if (clip == null) { AudioInputStream audio = AudioSystem.getAudioInputStream(new File("SoundFile.wav")); clip = AudioSystem.getClip(); clip.open(audio); } if (!clip.isRunning()) { clip.start(); } } catch(UnsupportedAudioFileException uae) { System.out.println(uae); } catch(IOException ioe) { System.out.println(ioe); } catch(LineUnavailableException lua) { System.out.println(lua); } } public static void stopBackgroundMusic() { if (clip != null) { clip.stop(); } } ps- I've never really dealt with the audio APIs so there might be a few other tweaks you need to make, but this is the basic concept you are after...
score: 0

http://stackoverflow.com/comment/31726068
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21091611
has text: Please check this link you idea how to implement listview in android..`http://www.vogella.com/tutorials/AndroidListView/article.html`
score: 0

http://stackoverflow.com/comment/31664335
type: QuestionComment
comment on: http://stackoverflow.com/q/21057910
score: 0
has text: dude, this is for appengine. there is no key for that i already refer api
type: Comment

http://stackoverflow.com/comment/31759778
score: 1
type: Comment
type: QuestionComment
has text: @MarkoTopolnik in that case [controlsFX](http://fxexperience.com/controlsfx/features/) is probably better (JavaFX 8).
comment on: http://stackoverflow.com/q/21108927

awt
tags question: http://stackoverflow.com/q/21073335
tags question: http://stackoverflow.com/q/21128671
tags question: http://stackoverflow.com/q/21098754
tags question: http://stackoverflow.com/q/21081972
tags question: http://stackoverflow.com/q/21150419
tags question: http://stackoverflow.com/q/21128209
tags question: http://stackoverflow.com/q/21110158
tags question: http://stackoverflow.com/q/21119052
tags question: http://stackoverflow.com/q/21075543
tag name: awt
tags question: http://stackoverflow.com/q/21092579
tags question: http://stackoverflow.com/q/21046139
tags question: http://stackoverflow.com/q/21103630
tags question: http://stackoverflow.com/q/21052682
tags question: http://stackoverflow.com/q/21124313
tags question: http://stackoverflow.com/q/21117966
tags question: http://stackoverflow.com/q/21079906
tags question: http://stackoverflow.com/q/21059972
tags question: http://stackoverflow.com/q/21137700
tags question: http://stackoverflow.com/q/21091957
tags question: http://stackoverflow.com/q/21176008
tags question: http://stackoverflow.com/q/21143563
tags question: http://stackoverflow.com/q/21043525
tags question: http://stackoverflow.com/q/21075552
tags question: http://stackoverflow.com/q/21159829
tags question: http://stackoverflow.com/q/21024235
tags question: http://stackoverflow.com/q/21024455
tags question: http://stackoverflow.com/q/21056188
tags question: http://stackoverflow.com/q/21035572
tags question: http://stackoverflow.com/q/21096512
tags question: http://stackoverflow.com/q/21145659
tags question: http://stackoverflow.com/q/21021366
tags question: http://stackoverflow.com/q/21175649
type: Tag
tags question: http://stackoverflow.com/q/21148195
tags question: http://stackoverflow.com/q/21089689
tags question: http://stackoverflow.com/q/21182492
tags question: http://stackoverflow.com/q/21137984

http://stackoverflow.com/q/21144054
has answer: http://stackoverflow.com/a/21211612
tagged with: ejb
answer count: 5
has answer: http://stackoverflow.com/a/21144151
score: 11
has answer: http://stackoverflow.com/a/21240979
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21144151
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21211612
type: Question
has answer: http://stackoverflow.com/a/21234496
linked to: http://stackoverflow.com/q/6199458
tagged with: extensibility
upvote count: 11
has answer: http://stackoverflow.com/a/21239282
tagged with: java
has body: We are currently in the process of analyzing the technical requirements for a new version of a Java EE application. It's Java EE 6, but moving onto 7 is an option. Until now this was a single application, one EAR, offering well-defined functionality. However, it needs to become possible to define some functionality in a very specific way based on implementation project and/or customer. For example, some customers are going to have very specific security constraints. A list of messages processed by a framework can be shown. For one customer, it's okay to have users see everything, but another customer would like to show only certain types of messages based on the user's group. That's an example of defining an implementation in a context-specific way, adapting the core functionality. Another possible requirement is that some customers will want to expand on the given functionality, adding new possibilities. So that's the extensible part. Because of this, it is necessary to have an architecture that defines generic functionality but has pluggable parts, as well as a possibility for extension. For some aspects I have a rough idea of how this could be handled. This question has an answer that would work perfectly for the presentation layer, which we'll do in JSF 2: How to create a modular JSF 2.0 application? I'm less certain about the business logic layer, security etc. My initial idea would be to define interfaces (a couple of facades) and find the implementation at run-time or deployment time. In much the same way as the service provider mechanism. A default implementation can be offered, with the possibility of defining a custom one. This does feel like a sort of Java SE solution, and I'm wondering if I'm just applying concepts that I'm familiar with from that context and if there's nothing better for EE. I think the @Alternative annotation serves a purpose like this. Another possibility might be to use interceptors and decorators. I'm not certain to what extent inte…
tagged with: jakarta-ee
has title: Extensible/adaptable Java EE application: interfaces vs interceptors and decorators

http://stackoverflow.com/comment/31794088
comment on: http://stackoverflow.com/a/21127839
has text: Thank you for your answer. I checked, jar files are there, i placed them into /WEB_INF/lib, it works. Next time, I will try "mvn clean install". Thank you again!
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31882902
comment on: http://stackoverflow.com/a/21174615
has text: I think assylias' answer is also correct but this seems like the simplest solution.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31840258
comment on: http://stackoverflow.com/a/21153600
has text: This answer highlights one example of problems which can arise when summing a large number of floating-point numbers. One very good solution is the [Kahan summation algorithm](http://en.wikipedia.org/wiki/Kahan_summation_algorithm).
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/21157309
tags question: http://stackoverflow.com/q/21151270
tags question: http://stackoverflow.com/q/21129864
tags question: http://stackoverflow.com/q/21043382
tags question: http://stackoverflow.com/q/21153835
tags question: http://stackoverflow.com/q/21140235
tags question: http://stackoverflow.com/q/21133962
tags question: http://stackoverflow.com/q/21174637
tags question: http://stackoverflow.com/q/21174924
tags question: http://stackoverflow.com/q/21166137
tags question: http://stackoverflow.com/q/21183921
tags question: http://stackoverflow.com/q/21164406
tags question: http://stackoverflow.com/q/21063367
tags question: http://stackoverflow.com/q/21135142
tags question: http://stackoverflow.com/q/21164182
tags question: http://stackoverflow.com/q/21039620
tags question: http://stackoverflow.com/q/21023326
tags question: http://stackoverflow.com/q/21115879
tags question: http://stackoverflow.com/q/21181089
tags question: http://stackoverflow.com/q/21129320
tags question: http://stackoverflow.com/q/21078323
tags question: http://stackoverflow.com/q/21088997
tags question: http://stackoverflow.com/q/21110537
tags question: http://stackoverflow.com/q/21102871
tags question: http://stackoverflow.com/q/21134590
type: Tag
tags question: http://stackoverflow.com/q/21070173
tags question: http://stackoverflow.com/q/21026486
tags question: http://stackoverflow.com/q/21140055
tags question: http://stackoverflow.com/q/21069952
tags question: http://stackoverflow.com/q/21040492
tags question: http://stackoverflow.com/q/21064418
tags question: http://stackoverflow.com/q/21034485
tags question: http://stackoverflow.com/q/21093989
tags question: http://stackoverflow.com/q/21073420
tags question: http://stackoverflow.com/q/21058482
tags question: http://stackoverflow.com/q/21156756
tags question: http://stackoverflow.com/q/21176530
tags question: http://stackoverflow.com/q/21089052
tags question: http://stackoverflow.com/q/21053501
tags question: http://stackoverflow.com/q/21099118
tags question: http://stackoverflow.com/q/21176195
tags question: http://stackoverflow.com/q/21146947
tags question: http://stackoverflow.com/q/21083926
tags question: http://stackoverflow.com/q/21081891
tag name: json
tags question: http://stackoverflow.com/q/21084279
tags question: http://stackoverflow.com/q/21108160
tags question: http://stackoverflow.com/q/21090612
tags question: http://stackoverflow.com/q/21097007
tags question: http://stackoverflow.com/q/21046340
tags question: http://stackoverflow.com/q/21131959
tags question: http://stackoverflow.com/q/21019131
tags question: http://stackoverflow.com/q/21131015
tags question: http://stackoverflow.com/q/21041286
tags question: http://stackoverflow.com/q/21182153
tags question: http://stackoverflow.com/q/21067484
tags question: http://stackoverflow.com/q/21055755
tags question: http://stackoverflow.com/q/21161169
tags question: http://stackoverflow.com/q/21158432
tags question: http://stackoverflow.com/q/21170808
tags question: http://stackoverflow.com/q/21050307
tags question: http://stackoverflow.com/q/21085595
tags question: http://stackoverflow.com/q/21051516
tags question: http://stackoverflow.com/q/21070770
tags question: http://stackoverflow.com/q/21173054
tags question: http://stackoverflow.com/q/21053702
tags question: http://stackoverflow.com/q/21031264
tags question: http://stackoverflow.com/q/21166329
tags question: http://stackoverflow.com/q/21050346
tags question: http://stackoverflow.com/q/21086717
tags question: http://stackoverflow.com/q/21091188
tags question: http://stackoverflow.com/q/21024562
tags question: http://stackoverflow.com/q/21157957
tags question: http://stackoverflow.com/q/21163667
tags question: http://stackoverflow.com/q/21099367
tags question: http://stackoverflow.com/q/21145089
tags question: http://stackoverflow.com/q/21152099
tags question: http://stackoverflow.com/q/21178215
tags question: http://stackoverflow.com/q/21067725

http://stackoverflow.com/a/21124761
has comment: http://stackoverflow.com/comment/31788199
type: Answer
answers question: http://stackoverflow.com/q/21124599
has comment: http://stackoverflow.com/comment/31787952
downvote count: 0
score: 1
has body: Calendar#getTime() is implemented as (Oracle JDK7) public final Date getTime() { return new Date(getTimeInMillis()); } so regardless of the TimeZone the Calendar has, the Date object will use the system's default when you invoke its toString() method. EST is 3 hours ahead of PST. From the comments in your code snippet, String tzId = tz.getID();**//"PST"** ... String str = date.toString();**//"Tue Jan 14 10:28:49 EST 2014"** final SimpleDateFormat sdFormatter = new SimpleDateFormat("hh:mm:ss a zzz"); sdFormatter.setTimeZone(TimeZone.getTimeZone(tzId)); String calStr = sdFormatter.format(cal.getTime());**//"07:28:49 AM PST"** Everything seems all right. You are formatting the time represented as Tue Jan 14 10:28:49 EST 2014 as a PST value. The time itself is exactly the same. The representation is different. If you don't want to show it as PST, leave out the setTimeZone() call.
upvote count: 1

http://stackoverflow.com/comment/31682222
comment on: http://stackoverflow.com/a/21067694
score: 0
type: Comment
has text: it can be easily altered, isnt it?
type: AnswerComment

rpc
tag name: rpc
tags question: http://stackoverflow.com/q/21179484
type: Tag

http://stackoverflow.com/q/21110004
type: UnansweredQuestion
tagged with: birt
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/29561816
type: Question
has body: I'm new in birt and I am trying to use xml as data source, but I don't get it works. I don't know if it's necessary specified more data, but I don't found any domentation that specify what is necessary to specify for using xml as data source. I use with next code: Method to specify source and dataset /** Set data source */ void buildDataSource() throws SemanticException { OdaDataSourceHandle dsHandle = this.efactory.newOdaDataSource("Data Source", "org.eclipse.datatools.enablement.oda.xml"); dsHandle.setProperty("FILELIST", "http://localhost:8080/BirtIntegrationImproved/ReportXmlDatasource/books.xml"); this.design.getDataSources().add(dsHandle); } /** Set data set */ void buildDataSet() throws SemanticException { OdaDataSetHandle dsHandle = this.efactory.newOdaDataSet("ds","org.eclipse.datatools.enablement.oda.xml.dataSet"); dsHandle.setDataSource("Data Source"); this.design.getDataSets().add(dsHandle); } Creation of table where data source is used /** List of columns */ ArrayList&lt;String&gt; cols = new ArrayList&lt;String&gt;(); cols.add("id"); cols.add("author"); cols.add("title"); cols.add("genre"); cols.add("price"); buildDataSource(); buildDataSet(); TableHandle table = this.efactory.newTableItem("table", cols.size()); table.setWidth("100%"); table.setDataSet(this.design.findDataSet("ds")); PropertyHandle computedSet = table.getColumnBindings(); ComputedColumn cs1 = null; for( int i=0; i &lt; cols.size(); i++) { cs1 = StructureFactory.createComputedColumn(); cs1.setName((String)cols.get(i)); cs1.setExpression("dataSetRow[\"" + (String)cols.get(i) + "\"]"); computedSet.addItem(cs1); } // table header RowHandle tableheader = (RowHandle) table.getHeader().get(0); for(int i=0; i &lt; cols.size(); i++) { LabelHandle label1 = this.efactory.newLabel((String)cols.get(i)); label1.setText((String)cols.get(i)); CellHandle cell = (CellHandle) tableheader.getCells().get(i); cell.getContent().add(label1); } // table detail RowHandle tabledetail = (RowHandle) table.getDetai…
upvote count: 1
has title: Use xml as data source in birt report programmatically
answer count: 1
favorite count: 0
tagged with: reporting
downvote count: 0

http://stackoverflow.com/a/21102409
answers question: http://stackoverflow.com/q/21102315
score: 6
type: Answer
upvote count: 6
has body: You get this error message since getNoOfStars() returns a primitive int and there is no method compareTo() defined for primitive types. If you're using Java SE 7 you can use something like this: public class DVDComparator implements Comparator &lt;DVD&gt; { public int compare(DVD d1,DVD d2){ return Integer.compare(d1.getNoOfStars(), d2.getNoOfStars()); } }
downvote count: 0

http://stackoverflow.com/a/21118933
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31777042
accepted answer of: http://stackoverflow.com/q/21118051
type: AcceptedAnswer
downvote count: 0
has body: The XPath language is only defined on namespace-well-formed XML, so the behaviour of different processors on a non-namespace-aware DOM tree (even one like &lt;a&gt;&lt;b/&gt;&lt;/a&gt; that, had it been parsed in a namespace-aware manner, would not actually use any namespaces) is at best implementation-specific and at worst completely undefined.
answers question: http://stackoverflow.com/q/21118051
has comment: http://stackoverflow.com/comment/31777368
type: Answer
has comment: http://stackoverflow.com/comment/31777617
has comment: http://stackoverflow.com/comment/31777738

http://stackoverflow.com/q/21147566
score: 3
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23879822
type: Question
has body: I know that there are several other questions about that topic, but none of them have helped me out. I tried the BouncyCastle lib as well. Could someone please help me here? The PEM file looks like: -----BEGIN RSA PRIVATE KEY----- MIIEpAIBAAKCAQEAq2eYtnTsEc/qyqS ... ... zY3WG++SA+amcXiO721hJWNC+uTbZ1bzQ== -----END RSA PRIVATE KEY----- I'm using this method public static PrivateKey getPemPrivateKey(String filename) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException { File f = new File(PEMFILES_FOLDER+filename); FileInputStream fis = new FileInputStream(f); DataInputStream dis = new DataInputStream(fis); byte[] keyBytes = new byte[(int) f.length()]; dis.readFully(keyBytes); dis.close(); String temp = new String(keyBytes); //TODO care about the linefeeds String privKeyPEM = temp.replace("-----BEGIN RSA PRIVATE KEY-----\n", ""); privKeyPEM = privKeyPEM.replace("-----END RSA PRIVATE KEY-----", ""); System.out.println("Private key: \n"+privKeyPEM); Base64 b64 = new Base64(); byte [] decoded = b64.decode(privKeyPEM); PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(decoded); KeyFactory kf = KeyFactory.getInstance(RSA); return kf.generatePrivate(spec); } I am getting this error: java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: IOException : algid parse error, not a sequence
upvote count: 3
tagged with: java
has title: Converting a PEM private key file to a JAVA PrivateKey Object
downvote count: 0
type: UnansweredQuestion
tagged with: pem
tagged with: private-key

http://stackoverflow.com/q/21063367
tagged with: rest-client
has comment: http://stackoverflow.com/comment/31674095
downvote count: 0
has comment: http://stackoverflow.com/comment/31675319
tagged with: jackson
has answer: http://stackoverflow.com/a/28615347
has comment: http://stackoverflow.com/comment/31674168
tagged with: android
has answer: http://stackoverflow.com/a/41176461
favorite count: 0
has body: I have this POJO : public class JsonObj { private String id; private List&lt;Location&gt; location; public String getId() { return id; } public List&lt;Location&gt; getLocation() { return location; } @JsonSetter("location") public void setLocation(){ List&lt;Location&gt; list = new ArrayList&lt;Location&gt;(); if(location instanceof Location){ list.add((Location) location); location = list; } } } the "location" object from the json input can be either a simple instance of Location or an Array of Location. When it is just one instance, I get this error : Could not read JSON: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token I've tried to implement a custom setter but it didn't work. How could I do to map either a Location or a List depending on the json input?
type: UnansweredQuestion
score: 16
has comment: http://stackoverflow.com/comment/31674274
upvote count: 16
has comment: http://stackoverflow.com/comment/111734625
linked to: http://stackoverflow.com/q/8305565
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/31674356
linked to: http://stackoverflow.com/q/39041496
type: Question
has comment: http://stackoverflow.com/comment/31674373
answer count: 2
linked to: http://stackoverflow.com/q/21064003
has title: Jackson mapping Object or list of Object depending on json input

http://stackoverflow.com/a/21022154
upvote count: 26
downvote count: 1
has comment: http://stackoverflow.com/comment/31599997
has comment: http://stackoverflow.com/comment/31599774
has comment: http://stackoverflow.com/comment/31599632
has comment: http://stackoverflow.com/comment/31599578
has comment: http://stackoverflow.com/comment/31599217
has comment: http://stackoverflow.com/comment/31598941
has comment: http://stackoverflow.com/comment/31598796
has comment: http://stackoverflow.com/comment/31599346
has comment: http://stackoverflow.com/comment/31599711
answers question: http://stackoverflow.com/q/21022012
has body: Simply put : Thanks to Marko Topolnik for this... Dependency occurs when one object "is dependent" on another. It can occur with or without a relation between the 2 objects. Actually, one object might not even be knowing that another exists, yet they might be dependent. Example : The Producer-Consumer problem. The producer need not know that the consumer exists, yet it has to do wait() and notify(). So, "NO" , dependency is not a subset of association. Composition : Is a type of association in which the "child" object cannot exist without the parent class. i.e, if the child object exists, then it MUST BE IN THE parent Object and nowhere else. EG: A Car(Parent) has Fuel injection system(child). Now, it makes no sense to have a Fuel Injection system outside a car (it will be of no use). i.e, Fuel injection system cannot exist without the car. Aggregation : Here, the child object can exist outside the parent object. A Car has a Driver. The Driver CAN Exist outside the car.
type: Answer
has comment: http://stackoverflow.com/comment/31599961
has comment: http://stackoverflow.com/comment/84469526
has comment: http://stackoverflow.com/comment/31599164
score: 25
has comment: http://stackoverflow.com/comment/31598831
has comment: http://stackoverflow.com/comment/31598889

http://stackoverflow.com/a/21138945
answers question: http://stackoverflow.com/q/21054036
has body: The problem was with cargo.remote.port. It should actually be cargo.glassfish.admin.port. Changing name of that property fixed everything.
accepted answer of: http://stackoverflow.com/q/21054036
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/q/21094586
has comment: http://stackoverflow.com/comment/31731552
has answer: http://stackoverflow.com/a/21094826
tagged with: swing
tagged with: jbutton
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31731465
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31731797
type: Question
tagged with: actionlistener
accepted answer: http://stackoverflow.com/a/21094826
has comment: http://stackoverflow.com/comment/31731382
answer count: 2
has title: JButton - How to connect?
tagged with: user-interface
has body: I found this code online and modified it and it stopped working. I'm thinking it has something to do with when I added the Jpanel but what I am doing works best with a JPanel. How do I make it that the events in the action performed if statements work? import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.*; import javax.swing.*; public class GUI extends JFrame implements ActionListener { static JPanel panel = new JPanel(new GridLayout(5, 5, 1, 1)); public GUI() { setDefaultCloseOperation(EXIT_ON_CLOSE); //setSize(100, 100); //setLocation(100, 100); //Button 1 JButton button1 = new JButton("1"); button1.addActionListener(this); panel.add(button1); //Button 2 JButton button2 = new JButton("2"); button2.addActionListener(this); panel.add(button2); //Button 3 JButton button3 = new JButton("3"); button3.addActionListener(this); panel.add(button3); //Button 2 JButton button4 = new JButton("4"); button4.addActionListener(this); panel.add(button4); //Button 2 JButton button5 = new JButton("5"); button5.addActionListener(this); panel.add(button5); //Button 2 JButton button6 = new JButton("6"); button6.addActionListener(this); panel.add(button6); //Button 2 JButton button7 = new JButton("7"); button7.addActionListener(this); panel.add(button7); //Button 2 JButton button8 = new JButton("8"); button8.addActionListener(this); panel.add(button8); //Button 2 JButton button9 = new JButton("9"); button9.addActionListener(this); panel.add(button9); panel.setVisible(true); } public static void main(String[] args) { new GUI(); JFrame f = new JFrame("Calc"); f.setContentPane(panel); f.setSize(1000, 1000); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); } ArrayList numbers = new ArrayList(); @Override public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command.equals("button1")) { myMethod(); numbers.add(1); System.out.println("1"); } if (command.equals("button1")) {…
possible better answer: http://stackoverflow.com/a/21094964
has answer: http://stackoverflow.com/a/21094964

http://stackoverflow.com/a/21043399
type: Answer
answers question: http://stackoverflow.com/q/21043362
score: 2
downvote count: 0
has body: There is no way to pass anything but string, because in command line you in fact can type only strings.
upvote count: 2

http://stackoverflow.com/a/21271096
has body: First at all, please use Java Naming Conventions (see https://stackoverflow.com/tags/java/info). About your method design there is something that I find a little strange, first you split the message: String[] args = msg.split(" "); but then you try to match your regex with the whole message, for each word in your message: Matcher hnre = plugin.hostnamePattern.matcher(msg.toString()); I think you can simplify all doing something like: //remove ^ and $ to find the pattern in any position in your message. I assume the correctness of the pattern Pattern hostnamePattern = Pattern.compile("(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])"); //Let msg a annoying message String msg = "ereh un enfermo, ereh un enfermo, ereh un enfermo de ciberseso me pone loh cuenno " + "me pone lo cuenno www.tiahbuena.com esto vida mia eh un infienno"; Matcher m = hostnamePattern.matcher(msg); boolean hnrematch = m.find(); if(hnrematch){ //cancel what you want } Hope it helps
answers question: http://stackoverflow.com/q/21168525
score: 0
type: Answer

http://stackoverflow.com/a/29125544
score: 2
downvote count: 0
has body: I found a workaround that is "good enough" for me and I need jaxb1 so replacing xjc was not possible From the GrammarLoader source: if(opt.strictCheck &amp;&amp; !SchemaConstraintChecker.check(opt.getGrammars(), errorReceiver, opt.entityResolver)) From Options.java source: if(args[i].equals("-nv")) { strictCheck = false; return 1; } From the command line parameter documentation -nv : do not perform strict validation of the input schema(s) => using &lt;xjc .../&gt; &lt;arg value="-nv" /&gt; &lt;/xjc&gt; disables the SchemaConstraintChecker.check(...) that results in the NPE
has comment: http://stackoverflow.com/comment/46663605
upvote count: 2
answers question: http://stackoverflow.com/q/21100096
has comment: http://stackoverflow.com/comment/46915785
type: Answer

http://stackoverflow.com/comment/31756043
type: Comment
has text: Then the only option is to kill java process instead of stopping Tomcat using native way.
comment on: http://stackoverflow.com/a/21089681
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31795816
has text: Sorry, my poor English. It should be getting length of the image byte array.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21128912

http://stackoverflow.com/q/21084194
has answer: http://stackoverflow.com/a/21084259
answer count: 2
has body: Getting a NullPointer Exception when I Run the program. Please help !! Code here: import java.util.Hashtable; import javax.naming.Context; import javax.naming.NamingEnumeration; import javax.naming.directory.Attributes; import javax.naming.directory.DirContext; import javax.naming.directory.InitialDirContext; import javax.naming.directory.SearchControls; import javax.naming.directory.SearchResult; public class LdapTest { public static void main(String[] args) throws Exception { final String PROVIDER_URL = "http://localhost:1389/dc=vysbank,dc=com"; //Enter LDAP URL here final Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, PROVIDER_URL); try { DirContext ctx = new InitialDirContext(env); String filter = "(uid=1234)"; // Enter User ID here. String[] attrIDs = {"uid","cn","mail"}; // Enter list of attributes to retrieve from LDAP here SearchControls ctls = new SearchControls(); ctls.setSearchScope(SearchControls.SUBTREE_SCOPE); ctls.setReturningAttributes(attrIDs); NamingEnumeration answer = ctx.search("ou=People", filter, ctls); SearchResult searchResult = null; String cn=null; String uid=null; String mail=null; while (answer.hasMore()) { searchResult = (SearchResult) answer.next(); Attributes attr = searchResult.getAttributes(); cn=attr.get("cn").get(0).toString(); uid=attr.get("uid").get(0).toString(); mail=attr.get("mail").get(0).toString(); System.out.println("Name: "+cn); System.out.println("User ID: "+uid); System.out.println("E-mail Address: "+mail); } } catch (Exception e) { e.printStackTrace(); } } }
has title: NullPointerException in java program for ldap connection
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/31712993
has answer: http://stackoverflow.com/a/21084328
favorite count: 0
upvote count: 1
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31713020
tagged with: java
accepted answer: http://stackoverflow.com/a/21084328
possible better answer: http://stackoverflow.com/a/21084259
type: Question

http://stackoverflow.com/a/42158736
has body: apt autoremove eclipse* --purge apt autoremove libosgi* --purge If you have, then remove this bloatware too: apt autoremove libmaven* --purge apt autoremove libsisu* --purge And then install back: apt install eclipse-cdt You will get C++ indexer as well.
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21129773

http://stackoverflow.com/comment/31641952
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21046252
type: AnswerComment
has text: Busy-waiting is usually an anti-pattern.

http://stackoverflow.com/a/52342411
downvote count: 0
score: 1
has body: Instead of Java it is best to have some XML knowledge as you will mostly deal with XML/XPath mapping. If you want to use extensive java code you better should start doing that right-away. You "van" integrate "special purpose" code in BW process but you will not be able to debug into your java code so you really should why you can't do that using XML/XPath mappings. There are particular areas (very special formatting, hash maps instead of shared vars, ...) but try to keep them small.
answers question: http://stackoverflow.com/q/21095139
upvote count: 1
type: Answer

http://stackoverflow.com/comment/31872660
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21170953
has text: @Amogh How you gonna store answer or option selected by student? Have you considered Question or option having images means i have seen some online exam portal where question or answer are in image format,in such scenario how you will store images in `session`. I don't think question and options are small object as like `user obj` to store in `session`.
type: QuestionComment

http://stackoverflow.com/a/21086904
has comment: http://stackoverflow.com/comment/32720421
has comment: http://stackoverflow.com/comment/32719879
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31737747
has comment: http://stackoverflow.com/comment/31730675
has comment: http://stackoverflow.com/comment/31741006
answers question: http://stackoverflow.com/q/21081598
type: Answer
has comment: http://stackoverflow.com/comment/31738832
has comment: http://stackoverflow.com/comment/31738753
has comment: http://stackoverflow.com/comment/31730403
accepted answer of: http://stackoverflow.com/q/21081598
score: 34
upvote count: 34
has body: Try this once and make sure you are not getting any error in project Structure saying that "ComGoogleAndroidGmsPlay not added" Open File &gt; Project Structure and check for below all. If error is shown click on Red bulb marked and click on "Add to dependency". This is a bug in Android Studio and fixed for the next release(0.4.3)

http://stackoverflow.com/comment/31792304
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21127253
has text: @yuyang Without a custom `Stack` class, this code compiles and runs fine, regardless of which import statement is used. Are you sure you don't have your own `Stack` class, even some old `Stack.class` file somewhere in your classpath?
type: QuestionComment

http://stackoverflow.com/comment/129380916
type: Comment
comment on: http://stackoverflow.com/a/61496153
has text: `PDPageContentStream` implements `AutoClosable` so `contentStream.close();` is automatically called in the try-with-resources block
type: AnswerComment
score: 1

charts
tags question: http://stackoverflow.com/q/21027297
type: Tag
tags question: http://stackoverflow.com/q/21177533
tag name: charts
tags question: http://stackoverflow.com/q/21133796

http://stackoverflow.com/comment/31732824
type: Comment
comment on: http://stackoverflow.com/q/21094816
score: 0
has text: I keep editing and confusing everyone sorry
type: QuestionComment

http://stackoverflow.com/comment/53543062
type: AnswerComment
has text: what does cassandra return when Mutation fails?
comment on: http://stackoverflow.com/a/21152073
type: Comment
score: 0

http://stackoverflow.com/a/21067129
answers question: http://stackoverflow.com/q/21066918
score: 0
has body: You can use Calendar class to calculate this for you, something like: Calendar c = Calendar.getInstance(); double millis = 1.25 * 31557600 * 1000; long l = (long) millis; c.setTimeInMillis(l); System.out.println(c.get(Calendar.YEAR) + " Year"); System.out.println(c.get(Calendar.MONTH) + " months"); System.out.println(c.get(Calendar.WEEK_OF_MONTH) + " weeks"); System.out.println(c.get(Calendar.DAY_OF_MONTH) + " days"); System.out.println(c.get(Calendar.HOUR) + " hours"); System.out.println(c.get(Calendar.MINUTE) + " minutes"); System.out.println(c.get(Calendar.SECOND) + " seconds"); Output: 1971 Year 3 months 1 weeks 2 days 7 hours 0 minutes 0 seconds Calendar defaults the starting year to 1970, you can further manipulate year and months to weeks if need be.
type: Answer

http://stackoverflow.com/q/21100067
tagged with: apache
type: UnansweredQuestion
type: Question
has title: swedish character corrupted when running from command line
answer count: 2
has answer: http://stackoverflow.com/a/21147115
has comment: http://stackoverflow.com/comment/31744285
score: 0
tagged with: java
has body: I have a simple java program: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import org.apache.commons.exec.CommandLine; import org.apache.commons.exec.DefaultExecuteResultHandler; import org.apache.commons.exec.DefaultExecutor; import org.apache.commons.exec.ExecuteException; import org.apache.commons.exec.LogOutputStream; import org.apache.commons.exec.PumpStreamHandler; public class test { public static void main(String[] args) { CommandLine commandLine = new CommandLine("c:/echo.bat"); /*CommandLine commandLine = new CommandLine("cmd.exe "); commandLine.addArgument("/c"); commandLine.addArgument(" echo Båt"); */ DefaultExecutor executor = new DefaultExecutor(); try { LogOutputStream output = new LogOutputStream() { @Override protected void processLine(String line, int level) { System.out.println(line); } }; PumpStreamHandler streamHandler = new PumpStreamHandler(output); executor.setStreamHandler(streamHandler); executor.setExitValue(0); DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler(); executor.execute(commandLine, resultHandler); } catch (ExecuteException ex) { ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } } } If I run this from the batch file which contains "echo Båt", the output shows correctly: C:>echo Båt Båt But if I run it with "cmd /c echo Båt", the output is corrupted: B†t Anyone has any idea? Thanks. I did more testing by using ‘-Dfile.encoding=’ setting after seeing comments from Jouni Aro(Thanks!). And here are the results: 1) No setting (use system default): Charset is: windows-1252 C:>echo Båt Båt Charset is: windows-1252 B†t 2) ‘-Dfile.encoding=UTF8’: Charset is: UTF-8 C:>echo Bï¿½t Bï¿½t Charset is: UTF-8 Bï¿½t 3) ‘-Dfile.encoding=ISO-8859-1’: Charset is: ISO-8859-1 C:>echo Båt Båt Charset is: ISO-8859-1 B†t so looks the charset is not helping here?
has answer: http://stackoverflow.com/a/34737632

http://stackoverflow.com/comment/51596417
comment on: http://stackoverflow.com/a/30198528
score: 0
type: AnswerComment
has text: After an Android Studio update, same problem, same perfect solution.
type: Comment

http://stackoverflow.com/q/21140767
favorite count: 0
has body: I have CXF Interceptor that checks field in SOAP header. I want to skip this check for a single method. Is it possible to do it without parsing soap and checking for method name (for example, annotation). Thank you!
upvote count: 1
tagged with: web-services
accepted answer: http://stackoverflow.com/a/21169317
type: AnsweredQuestion
tagged with: cxf
score: 1
tagged with: java
type: Question
answer count: 2
has title: Skip CXF interceptor for one of the methods in webservices
downvote count: 0
has answer: http://stackoverflow.com/a/21169317
possible better answer: http://stackoverflow.com/a/21141213
has answer: http://stackoverflow.com/a/21141213

http://stackoverflow.com/a/21077013
has comment: http://stackoverflow.com/comment/68909146
score: 4
type: AcceptedAnswer
downvote count: 1
accepted answer of: http://stackoverflow.com/q/21052027
has body: When you call an EJB you should not use the remote-naming project, but the remote EJB-invocation as described in https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI Your JNDI name will look like: context.lookup("ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName) appName and distinctName are empty in your case (no EAR). See the example in the provided link.
answers question: http://stackoverflow.com/q/21052027
upvote count: 5
type: Answer

http://stackoverflow.com/a/21066437
answers question: http://stackoverflow.com/q/21063393
has comment: http://stackoverflow.com/comment/31679871
has comment: http://stackoverflow.com/comment/31679791
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31679724
type: Answer
has comment: http://stackoverflow.com/comment/31679743
has body: I think you need a ShutdwonHook final Thread mainThread = Thread.currentThread(); Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { //close mainThread.join(); } }); Or if you are using Swing you might be interested in using a WindowListener.
accepted answer of: http://stackoverflow.com/q/21063393
has comment: http://stackoverflow.com/comment/31680181

http://stackoverflow.com/q/21118831
has comment: http://stackoverflow.com/comment/31776344
tagged with: compiler-warnings
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/31776495
has body: I am novice at Java programming, and I'm trying to add a list of files to a crude little media player. Seemingly I've succeeded in achieving what I want with this: public class MusicPlayerGUI implements ActionListener { private static JFileChooser fileChooser = new JFileChooser(System.getProperty("user.dir")); private JList tracklist; private MusicPlayer player; private FileOrganizer organizer; private List&lt;String&gt; tracks; private JFrame frame; public MusicPlayerGUI() { player = new MusicPlayer(); organizer = new FileOrganizer(); tracks = organizer.listAllFiles(); makeFrame(); } //Some methods omitted public void play() { int fileToPlay = tracklist.getSelectedIndex(); String filenameToPlay = organizer.getFile(fileToPlay); player.play(filenameToPlay); } public void setupList() { tracks = organizer.listAllFiles(); String[] fileList = listAllTracks(tracks); tracklist.setListData(fileList); } public String[] listAllTracks(List&lt;String&gt; tracks) { int numTracks = tracks.size(); String[] fileList = new String[numTracks]; for(int i = 0; i &lt; numTracks; i++) { String field = tracks.get(i).toString(); fileList[i] = field; } return fileList; } But when I compile, even if it does compile, it gives me an error stating: [pathname]/classname.java uses unchecked or unsafe operations. Recompile with Xlint:unchecked for details And everything in my player works, except it won't play the files, so I'm thinking that there might be a connection between the compiler warning I get, and the fact that the files won't play. Can anyone spot what I'm getting wrong?
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31776248
has answer: http://stackoverflow.com/a/21118961
favorite count: 0
linked to: http://stackoverflow.com/q/197986
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31776394
has answer: http://stackoverflow.com/a/21119093
duplicate of: http://stackoverflow.com/q/197986
has title: "Unchecked or unsafe operations" error when compiling
has answer: http://stackoverflow.com/a/21118960
tagged with: java
has comment: http://stackoverflow.com/comment/31776719
type: Question

http://stackoverflow.com/comment/70728215
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/38273868
type: Comment
has text: Why this was voted down? (it is currently the working solution in my app)

http://stackoverflow.com/comment/91087217
has text: There would not be compilation error unless you are using APIs provided by the embedded tomcat. If you want to use APIs provided by embedded tomcat use it with provided scope.
comment on: http://stackoverflow.com/a/36467101
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/31688031
type: AnswerComment
comment on: http://stackoverflow.com/a/21070266
has text: That's precisely what this does. By adding the type parameter, the code will not compile because MyPage does not extend AbstractLayout.
score: 0
type: Comment

http://stackoverflow.com/a/21090156
has body: private String prepareImage() { if (tempPath == null ) { return ""; } BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = Bitmap.Config.ARGB_8888; Bitmap bitmap = BitmapFactory.decodeFile(tempPath, options); bitmap = Bitmap.createScaledBitmap(bitmap, 50, 50, true); ByteArrayOutputStream baos = new ByteArrayOutputStream(); //bitmap.compress(Bitmap.CompressFormat.PNG, 50, baos); bitmap.compress(Bitmap.CompressFormat.JPEG, 50, baos); byte[] byteArray = baos.toByteArray(); String imageString = com.size4u.utils.Base64 .encodeBytes(byteArray); bitmap = null; System.gc(); Runtime.getRuntime().gc(); return imageString; }
has comment: http://stackoverflow.com/comment/31724090
has comment: http://stackoverflow.com/comment/31724096
answers question: http://stackoverflow.com/q/21089129
has comment: http://stackoverflow.com/comment/31723721
has comment: http://stackoverflow.com/comment/31723264
has comment: http://stackoverflow.com/comment/31723240
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31723224

http://stackoverflow.com/comment/31747910
has text: Ooh, I bet I've got it: calls are occurring in different contexts, and the call that asks for the JNLP to be built is coming locally, so it doesn't use an explicit port. When I component-tested earlier, I was calling the PHP that generates the JNLP directly (that is, giving an explicit browser URL). I'm not sure how I'm going to make this work, because the callback from Java almost certainly needs to do this with an explicit port, but that was the essence of it. If you want to, you can write something up that I can accept as an answer.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21102073
type: Comment

http://stackoverflow.com/comment/31626520
type: Comment
type: QuestionComment
has text: @SBerg413 i think its not. but thanks.
comment on: http://stackoverflow.com/q/21037117
score: 0

http://stackoverflow.com/comment/31758966
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21108927
has text: I've thoroughly experimented with these dialogs, and they provided more problems then solutions. The size of the dialogs (bigger than my stage) and the way they pop up on screen are the two main ones. I suppose this seems nitpicky, but I believe that the way an app looks is crucial to its success.
score: 0

http://stackoverflow.com/q/21181795
has title: Speeding up webcam access in Java OpenCV
has answer: http://stackoverflow.com/a/21181982
answer count: 1
has body: I am porting part of my C++ OpenCV-based code to Java OpenCV. I am using the Java wrappers prepared by Willow Garage, i.e., the group behind c++ OpenCV. I am not using javacv (hosted at googlecode). Part of this code accesses the video stream of the webcam and processes it. With C++ I am able to show the webcam video in 'real-time': if I wave my hand, the video on the screen shows me waving a hand. With Java if I wave my hand the video (taken from the webcam) is not able to keep my pace: the frame rate is incredibly slow. What I do is: I read the frame of the webcam video using OpenCV, it is a Mat object named frame; I access the byte array of the frame and use it to build a BufferedImage; The image is shown in a JPanel inside its paint method. I am using java version 1.7 and OpenCV 2.4.8 on OS X 10.8.5. Do you have any suggestion on how I might speed up the whole process? Regards
score: 0
accepted answer: http://stackoverflow.com/a/21181982
has comment: http://stackoverflow.com/comment/31919012
tagged with: opencv
type: AnsweredQuestion
tagged with: video
tagged with: java
has comment: http://stackoverflow.com/comment/31906757
type: Question

http://stackoverflow.com/comment/31813365
type: AnswerComment
comment on: http://stackoverflow.com/a/21139410
type: Comment
has text: Yes, that would be appropriate.
score: 0

http://stackoverflow.com/q/21129844
tagged with: java
tagged with: switch-statement
type: Question
has comment: http://stackoverflow.com/comment/31796792
score: 3
has title: Java: How to implement switch on Class?
has comment: http://stackoverflow.com/comment/32425572
has comment: http://stackoverflow.com/comment/31796701
has comment: http://stackoverflow.com/comment/31796658
has answer: http://stackoverflow.com/a/21130129
has comment: http://stackoverflow.com/comment/31796710
tagged with: class
has answer: http://stackoverflow.com/a/21129915
upvote count: 3
linked to: http://stackoverflow.com/q/5579309
has body: How do I implement the following pseudocode in Java? Object getInstance(Class&lt;?&gt; type) { switch (type) { case A.class: return createA(param1, param2); case B.class: return createB(param3, param4, param5); default: throw new AssertionError("Unknown type: " + type); } } I know I can probably implement this using a Map&lt;Class&lt;?&gt;, Callable&lt;Object&gt;&gt; (mapping classes to a method that returns an object) but is there a more efficient/readable way to do this? UPDATE: I'm sorry for the misleading pseudo code. I did not mean to imply that the classes have no-arg constructors. Each class is constructed differently. I know if-else works but it is not great from an efficiency point of view. It is O(n).
has answer: http://stackoverflow.com/a/21129896
has comment: http://stackoverflow.com/comment/31796793
has answer: http://stackoverflow.com/a/21129907
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31866853
answer count: 4
downvote count: 0

http://stackoverflow.com/a/55869404
answers question: http://stackoverflow.com/q/21083170
score: 14
downvote count: 0
upvote count: 14
has body: By default spring boot app start with embedded tomcat server start at default port 8080. spring provides you with following different customization you can choose one of them. NOTE – you can use server.port=0 spring boot will find any unassigned http random port for us. 1) application.properties server.port=2020 2) application.yml server: port : 2020 3) Change the server port programatically 3.1) By implementing WebServerFactoryCustomizer interface - Spring 2.x @Component public class MyTomcatWebServerCustomizer implements WebServerFactoryCustomizer&lt;TomcatServletWebServerFactory&gt; { @Override public void customize(TomcatServletWebServerFactory factory) { // customize the factory here factory.setPort(2020); } } 3.2) By Implementing EmbeddedServletContainerCustomizer interface - Spring 1.x @Component public class CustomizationBean implements EmbeddedServletContainerCustomizer { @Override public void customize(ConfigurableEmbeddedServletContainer container) { // customize here container.setPort(2020); } } 4) By using command line option java -jar spring-boot-app.jar -Dserver.port=2020
type: Answer

http://stackoverflow.com/comment/31772615
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21115509
has text: So what are you wanting? Dates at the bottom? The fancy bars? The missing key to the right?
score: 0

http://stackoverflow.com/q/21124530
has title: java.lang.NoClassDefFoundError: Could not initialize class javax.mail.internet.InternetAddress
tagged with: jakarta-mail
has answer: http://stackoverflow.com/a/34686664
has comment: http://stackoverflow.com/comment/31787261
has answer: http://stackoverflow.com/a/21125296
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/31787576
favorite count: 0
has comment: http://stackoverflow.com/comment/31787331
linked to: http://stackoverflow.com/q/16807758
answer count: 3
has comment: http://stackoverflow.com/comment/31787205
has comment: http://stackoverflow.com/comment/31787961
has answer: http://stackoverflow.com/a/21128827
has comment: http://stackoverflow.com/comment/31787653
type: UnansweredQuestion
has body: I am trying to send an email using the JavaMail API. Here is my code on the servlet: package com.lsp.web; import com.lsp.service.Mailer; import javax.ejb.EJB; import javax.mail.MessagingException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @WebServlet(name = "contact", urlPatterns = {"/contact"}) public class ContactServlet extends SpringInjectedServlet { @EJB private Mailer emailBean; @Override public void init() throws ServletException { } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doPost(req, resp); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String customerEmail = req.getParameter("email"); String subject = req.getParameter("subject"); String body = req.getParameter("message"); String error = null; String succMess = null; try { javax.mail.internet.InternetAddress ia = new javax.mail.internet.InternetAddress(customerEmail); ia.validate(); emailBean.send(customerEmail, subject, body); req.setAttribute("succMessage", succMess); req.getRequestDispatcher("sent.jsp").forward(req, resp); } catch (javax.mail.internet.AddressException ae) { error = "您指出的邮箱地址不存在"; req.setAttribute("errorMessage", error); req.getRequestDispatcher("contact.jsp").forward(req, resp); } catch (MessagingException mex) { error = "发送失败"; req.setAttribute("errorMessage", error); req.getRequestDispatcher("contact.jsp").forward(req, resp); } } } At the line where I check for the user address where: javax.mail.internet.InternetAddress ia = new javax.mail.internet.InternetAddress(customerEmail); ia.validate(); I got an exception. java.lang.NoClassDefFoundError: Could not initialize class javax.mail.internet.InternetAddress In pom.xml, I added these lines: javax.mail javax.mail-api 1.5.1 jav…
upvote count: 1
tagged with: tomcat7
has comment: http://stackoverflow.com/comment/31787377
has comment: http://stackoverflow.com/comment/31788295
has comment: http://stackoverflow.com/comment/31787267
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31787460
tagged with: servlets
type: Question

http://stackoverflow.com/comment/31836525
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21151604
has text: If it's private, you can't use it so it doesn't matter. Presumably it's something the developers created while they were working on a JTable bug. It shouldn't have been javadoc'd at all.
type: Comment

http://stackoverflow.com/comment/31600221
type: QuestionComment
comment on: http://stackoverflow.com/q/21022794
has text: Do you mean you want to preserve the indicies like that? If so, you shouldn't be using an array, at least not a one dimensional array.
score: 0
type: Comment

http://stackoverflow.com/comment/31596377
score: 1
comment on: http://stackoverflow.com/a/21020328
has text: Thanks for your answer. So I'll have to define all dependencies in the `<modules>` nodes? There's nothing to do this automatically?
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31859665
comment on: http://stackoverflow.com/a/21159195
has text: Thanks. Yest that's it. But How can I initiate `AuthenticationUserDetailsService` before `PreAuthenticatedAuthenticationProvider`?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31659397
score: 0
type: AnswerComment
has text: So frameworks do HTML, CSS, and javascript to the point where you don't actually need to know the language?
type: Comment
comment on: http://stackoverflow.com/a/21054736

http://stackoverflow.com/comment/31657057
type: Comment
has text: @netuser please edit your question and post those informations in it properly formated, also post your directory tree and point from where you start the program.
type: AnswerComment
comment on: http://stackoverflow.com/a/21051786
score: 0

http://stackoverflow.com/comment/31787765
has text: A little piece of code here would be nice to see!
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21124781

http://stackoverflow.com/a/21074537
has comment: http://stackoverflow.com/comment/31694645
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31695221
answers question: http://stackoverflow.com/q/21074409
has comment: http://stackoverflow.com/comment/31694544
has body: On OnDragListener() private final class MyDragListener implements OnDragListener { @Override public boolean onDrag(View v, DragEvent event) { switch (event.getAction()) { case DragEvent.ACTION_DRAG_STARTED: getResources().getDrawable(android.graphics.Color.TRANSPARENT); break; .... } return true; } } This should work. Good luck!

http://stackoverflow.com/a/21147424
upvote count: 4
has body: ArrayList is a Collection, so modules will return true if it is changed upon insertion (as stated here). If you receive true, something was added. public void addModule(String naamModule, int modulenr, int aantalUren, int weekBegin, int weekEind, String opleiding, int opleidingJaar){ boolean dataAdded = false; try { dataAdded = modules.add(new ModuleData(naamModule, modulenr, aantalUren, weekBegin, weekEind, opleiding, opleidingJaar)); } catch (Exception e) { // handle exception } if( dataAdded ){ // notify user about success } } Or you can rewrite the addModule() method to return dataAdded and handle the response outside.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21147347
score: 4

http://stackoverflow.com/a/21097735
score: 1
downvote count: 0
has body: what should I do for get all value selected ? You should make a select tag to accept multiple options. This is done via multiple="true" in struts select tag. Then you interceptor stack is incomplete because multiselect interceptor is missing. You should add <interceptor-ref name="multiselect"/> to your interceptor stack after fileUpload interceptor reference.
accepted answer of: http://stackoverflow.com/q/21048136
upvote count: 1
answers question: http://stackoverflow.com/q/21048136
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/31681994
type: QuestionComment
type: Comment
has text: You might want to flush or close `out2` before trying to read it. Better yet, you could accumulate your random `char`s onto a `StringBuilder` and count the `"END"`s on that instead of involving the file-system.
comment on: http://stackoverflow.com/q/21067453
score: 0

http://stackoverflow.com/comment/31767477
score: 0
type: Comment
has text: ok.. I figured out that the described problem appears when there are two frames with setAlwaysOnTop(true) invoked. So removing one invocation of this method solved the problem for me. I wonder if I got -2 points for bad English or for a stupid question :)
type: AnswerComment
comment on: http://stackoverflow.com/a/21113956

http://stackoverflow.com/a/21144202
upvote count: 2
answers question: http://stackoverflow.com/q/21143952
has comment: http://stackoverflow.com/comment/31823656
downvote count: 0
has body: The best way to do this, is to have an After method in the class that all your tests extend. For example: Class A extends T Class B extends T Class T { WebDriver driver; @After public void tearDown() { driver.quit(); } } Now when your A#testMethod1 finished, it will perform tearDown() from the inherited @After method. Also as far as your pages go, do as @CeilingGecko stated and use only 1 webdriver instance. You could do it like this: Class A extends T { LoginPage loginPage = new LoginPage(driver); @Test public void testMethod1() { loginPage.login("username", "password"); } } Class LoginPage { WebDriver driver; public LoginPage(WebDriver driver) { this.driver = driver; } public void login(String user, String password) { // driver.doStuff() } }
has comment: http://stackoverflow.com/comment/31823593
type: Answer
score: 2

http://stackoverflow.com/comment/31659863
type: Comment
has text: No, because weeks numbers are fixed - it's no matter if you run it on Friday or Monday - week 1 always starts the same day
type: AnswerComment
comment on: http://stackoverflow.com/a/21055151
score: 0

http://stackoverflow.com/a/21123316
accepted answer of: http://stackoverflow.com/q/21122999
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: In insert(), the first and second else if never update the height. I think you want to move root.avlNodeHeight = max(height(root.leftChild), height(root.rightChild)) + 1; out of the else. There could be other bugs...
answers question: http://stackoverflow.com/q/21122999

http://stackoverflow.com/comment/31862996
comment on: http://stackoverflow.com/q/21166204
has text: I wrote this application without taking any consideration to threads, so I did not intentionally run the database on a different thread. So instead of making a method call I should do the operations instead (in place of the methods)?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31855463
has text: I have added few points at the end of queestion above.Please look at it.
type: AnswerComment
comment on: http://stackoverflow.com/a/21162521
score: 0
type: Comment

fedora20
tags question: http://stackoverflow.com/q/21134508
type: Tag
tag name: fedora20

http://stackoverflow.com/q/21037633
possible better answer: http://stackoverflow.com/a/21037752
tagged with: input
has title: Accept only unique input in java
has answer: http://stackoverflow.com/a/21037731
has answer: http://stackoverflow.com/a/21037823
accepted answer: http://stackoverflow.com/a/21037731
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21037752
has answer: http://stackoverflow.com/a/21037697
has answer: http://stackoverflow.com/a/21037736
tagged with: java
answer count: 6
has answer: http://stackoverflow.com/a/21037668
type: Question
score: 0
has body: I have following java code, which accepts 10 string input. i need to accept only the unique input . By this i mean to say that if 1st device address is "123" and 2nd device address is also "123" then it should display an error. This is the sample code and i have shorten it. InputStreamReader istream = new InputStreamReader(System.in) ; BufferedReader bufRead = new BufferedReader(istream) ; for (int i=0; i&lt;10; i++) { try { System.out.println("Device Address: "); String DevAdd = bufRead.readLine(); System.out.println("Device address:" + DevAdd); } catch (IOException err) { System.out.println("Error reading line"); } catch(NumberFormatException err) { System.out.println("Error Converting Number"); } }
tagged with: validation
has comment: http://stackoverflow.com/comment/31627251

http://stackoverflow.com/q/21041126
tagged with: java
has body: Just following Spring Guides http://spring.io/guides#gs I took gs-rest-service and gs-accessing-data-jpa. Now I want to combine them in one application, and that is where like more understanding of new org.springframework.boot.SpringApplication is needed. In gs-rest-service config looks emazing, that is almost absent @ComponentScan @EnableAutoConfiguration public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } } gs-accessing-data-jpa is more like Spring XML JavaConfig based app. @Configuration @EnableJpaRepositories public class CopyOfApplication { @Bean public DataSource dataSource() { return new EmbeddedDatabaseBuilder().setType(H2).build(); } // 2 other beans... @Bean public PlatformTransactionManager transactionManager() { return new JpaTransactionManager(); } public static void main(String[] args) { AbstractApplicationContext context = new AnnotationConfigApplicationContext(CopyOfApplication.class); CustomerRepository repository = context.getBean(CustomerRepository.class); //... } } How to combine them? Does it mean that I need to re-write SpringApplication.run now on more detailed level ?
tagged with: spring-java-config
type: Question
has comment: http://stackoverflow.com/comment/31636901
accepted answer: http://stackoverflow.com/a/21044365
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31633263
has title: Combine 2 Spring boot application
has comment: http://stackoverflow.com/comment/31672946
tagged with: spring
type: AnsweredQuestion
tagged with: spring-boot
has answer: http://stackoverflow.com/a/21044365

http://stackoverflow.com/a/21127652
accepted answer of: http://stackoverflow.com/q/21127530
has body: Maybe you are looking for something like myString = myString.replaceAll("(?m)^([\\s\\d:,]|--&gt;)+$", ""); This regex will search for lines (character between start of line ^ and end of line $) that are either \\s spaces \\d digits : , or --&gt; (?m) is "multiline" flag used to let ^ and $ be start or end of each line, instead of entire string.
answers question: http://stackoverflow.com/q/21127530
upvote count: 3
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/31792823
downvote count: 0
score: 3

http://stackoverflow.com/q/21139126
has title: How to create a random string to be used as a password in java
type: Question
has body: What I'm trying to do is create a number of random numbers to be used for passwords. The format I'm trying to achieve is some like 3794093 Y. I have code to do this already but it involves creating a random int and a random char and combining the two. This would be alright but I would like the program to ask the user to enter their code. Should they enter their code and it matches it lets them access the program. What I'm look for is a way to turn the random number and char into one string or something similar. Here is code I currently have. I don't want the code done for me as I'd like to try and do it myself, just need advice on where I'm going wrong/what I'm missing. Random r = new Random(); String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; for (int i = 0; i &lt; 50; i++) { int ppsn[]=new int[50]; //Array for student number ppsn[i] = 3700000 + (int)(Math.random() * ((3800000 - 3700000) + 1)); System.out.println(ppsn[i]+" " +alphabet.charAt(r.nextInt(alphabet.length()))); }
tagged with: java
score: -1
tagged with: random
downvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21139241
has comment: http://stackoverflow.com/comment/31812605
linked to: http://stackoverflow.com/q/2860943
upvote count: 0

http://stackoverflow.com/comment/31903215
type: QuestionComment
comment on: http://stackoverflow.com/q/21162677
has text: they want the formular to open 21th march, despite that's less than a whole month. They store the difference in days between the operation day and the day the formular should open to display it, but they don't store that date but the real date when the formular is opened... don't ask me why, and I can't change that... so what I should do is what they pay me for... and it is to calculate that.
score: 0
type: Comment

http://stackoverflow.com/a/68501016
has body: To save the full private key into a file, say, priv.pem, try adding the following line to Pres J K Polk's answer var benc = Base64.getEncoder().encodeToString(priv.getEncoded))); var bpk = "-----BEGIN PRIVATE KEY-----\n"; var epk = "\n-----END PRIVATE KEY-----\n"; var pemk = bpk + benc.replaceAll("(.{64})", "$1\n") + epk; var fw = new FileWriter("priv.pem"); fw.write(pemk); fw.close();
type: Answer
answers question: http://stackoverflow.com/q/21166352
score: 0

http://stackoverflow.com/comment/31678559
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21065686
type: Comment
has text: I posted the LogCat results and initialized the canvas

http://stackoverflow.com/comment/31809945
has text: Parsing Posted Code : Beep: Error: Some code missing
score: 4
comment on: http://stackoverflow.com/q/21137595
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31850065
comment on: http://stackoverflow.com/a/21158947
type: AnswerComment
score: 0
type: Comment
has text: Yes, the Atlas is the Texture. And yes, the TextureRegion is only the coordinates and size (a rectangle) referencing to it. Dont worry, the Texture isnt copied. Its only one, doesnt matter how many sprites you create from it :)

http://stackoverflow.com/comment/31889787
type: Comment
has text: Hi, thanks for the suggestion. Can you please elaborate more how to make those images available as URL? Not that much of dev experience here. Really appreciated.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21181439

compression
tags question: http://stackoverflow.com/q/21018980
tags question: http://stackoverflow.com/q/21090747
tag name: compression
type: Tag

http://stackoverflow.com/q/21150190
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/21150252
favorite count: 0
has body: Hi I need to print process of factorial calculation. E.g. If the user's input is 5, the system should print out "5 * 4 * 3 * 2 * 1 = 120" I have this code: public static void factorial() { Scanner sc = new Scanner(System.in); int factorial = 1; int count; System.out.println(me+", This is option 2: Calculate a factorial"); System.out.print("Enter your number: "); int number = sc.nextInt(); System.out.println(); if (number&gt;0) { for (count=1; count&lt;=number; count++) factorial = factorial*count; System.out.println(" = "+factorial); System.out.println(); } else { System.out.println("Enter a positive whole number greater than 0"); System.out.println(); } } I have tried insert this code: System.out.print(count+" * "); But the output is "1 * 2 * 3 * 4 * 5 * = 6". So the result is wrong too. How can I change the code? Thanks
has answer: http://stackoverflow.com/a/21150228
accepted answer: http://stackoverflow.com/a/21150228
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/31834253
has comment: http://stackoverflow.com/comment/31834078
type: AnsweredQuestion
tagged with: if-statement
has answer: http://stackoverflow.com/a/21150252
has answer: http://stackoverflow.com/a/21150319
tagged with: java
has comment: http://stackoverflow.com/comment/31835199
type: Question
has comment: http://stackoverflow.com/comment/31834043
has title: print factorial calculation process in java
tagged with: factorial

http://stackoverflow.com/q/21139066
score: -2
has comment: http://stackoverflow.com/comment/31812512
has title: How to update value in jdbc?
accepted answer: http://stackoverflow.com/a/21139113
downvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/21139113
favorite count: 0
tagged with: jdbc
type: AnsweredQuestion
upvote count: 0
tagged with: java
has body: I am getting exception java.lang.illegalargumentexception when I try to update the value of date field. I have a SQL database which have 2 timestamp field format (0000-00-00 00:00:00). Here is my HTML code: &lt;%=stade%&gt;=2014-01-19 21:43:20.0 &lt;%=edate%&gt;=2014-08-31 01:45:03.0 StartDate&lt;/span&gt; &lt;input type="text" name="sdate" maxlength="25" size="25"id="demo2" value="&lt;%=sdate%&gt;"&gt;&lt;a href="javascript:NewCal('demo2','ddmmmyyyy',true,24)"&gt;&lt;/a&gt; ExpireDate &lt;input type="Text" id="demo1" name="edate"maxlength="25" size="25" value="&lt;%=edate%&gt;"&gt;&lt;a href="javascript:NewCal('demo1','ddmmmyyyy',true,24)"&gt;&lt;/a&gt; &lt; I want that if I donot make any change in these field then actual value of edade and sdate insert otherwise updated value inserted updade.jsp &lt;% String edate=request.getParameter("edate"); String sdate=request.getParameter("sdate"); try { String s1; String s2; Format formatter; Date d2=new Date(sdate); Date d1 = new Date(edate); Date date = new Date(); formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); s = formatter.format(date); s1 = formatter.format(d1); s2=formatter.format(d2); out.println("\n"+s1); out.println("\n"+s2); psmnt= cn.prepareStatement("update Councel set StartDate=?,ExpireDate=? where CouncelRegNo=?"); psmnt.executeUpdate(); out.println("Student updated successfully"); } catch(Exception e) { out.print("try not allowed"+e); } %&gt;
type: Question

proguard
tags question: http://stackoverflow.com/q/21024421
tag name: proguard
tags question: http://stackoverflow.com/q/21055185
type: Tag

http://stackoverflow.com/comment/31713194
type: Comment
comment on: http://stackoverflow.com/q/21083856
type: QuestionComment
score: 0
has text: @Shehan.W try this `SELECT DIARYCODE FROM LOGBOOKTABLE WHERE (STUDENTUSERNAME=? OR SUPERVISORUSERNAME=?) AND PROJECT_APPROVE_STATUS=?)`

http://stackoverflow.com/a/21170802
upvote count: 1
answers question: http://stackoverflow.com/q/21170743
has comment: http://stackoverflow.com/comment/31870693
score: -1
has comment: http://stackoverflow.com/comment/31870715
has body: You can't use a digit as the first letter in variable/method/class names. for more variable naming rules Click Here public class ImageComparator implements Comparator&lt;Obj&gt; { @Override public int compare(obj obj1, obj obj2) { return ((obj)obj1).Id - ((obj)obj2).Id; } }
downvote count: 2
type: Answer

http://stackoverflow.com/comment/39731462
has text: For me it only worked when I used C:\Program Files\Java\jdk1.8.0_xx where "xx" is the update number without the \; at the end
type: Comment
score: 8
comment on: http://stackoverflow.com/a/24077997
type: AnswerComment

http://stackoverflow.com/comment/31775995
comment on: http://stackoverflow.com/q/21118680
score: 1
has text: It does not like that, I get an error "Required List<MyClass> but found List<MyClassA>"
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31786895
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21124310
type: QuestionComment
has text: How did you "convert" it?

http://stackoverflow.com/q/21171888
has answer: http://stackoverflow.com/a/21172129
has answer: http://stackoverflow.com/a/21171963
has answer: http://stackoverflow.com/a/21172070
score: 0
answer count: 3
has body: I'm trying to make a Minecraft Server control panel, and I want to get a list of all online players, each username in it's own String. The way you get the users is typing /list and it returns a string. the returned string looks like: [HH:MM:SS] INFO: username1, username2, username3, and username4 so, how would i extract each username into it's own string? I've googled this, and looked as similar questions, and I cant find a useful answer. I thought about string.replaceAll(); but i cant seem to get that to work. Any suggestions?
tagged with: string
tagged with: extract
has title: how to extract unknown names out of a string
possible better answer: http://stackoverflow.com/a/21172070
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31872791
accepted answer: http://stackoverflow.com/a/21171963
type: Question

http://stackoverflow.com/comment/31646785
type: Comment
comment on: http://stackoverflow.com/a/21031621
has text: Oh how could I miss that switch semantic! Thanks. Btw would this work with the method call wrapped in a loop?
type: AnswerComment
score: 0

http://stackoverflow.com/q/21141984
has comment: http://stackoverflow.com/comment/31821732
has comment: http://stackoverflow.com/comment/31823964
has comment: http://stackoverflow.com/comment/31820037
tagged with: jtabbedpane
score: 0
has body: I want to use image in the place of tab. Want to modify tab of jtabbedpane. don'w want to use third party look and feel. Sun provides this type of tabs But i want it like Is that possible? Also want to now that how to create own look and feel like nimbus which is provided with java. i have searched on google but didn't find any solution. There is only third party solution.
has comment: http://stackoverflow.com/comment/31821374
answer count: 0
type: UnansweredQuestion
tagged with: look-and-feel
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/31863225
has comment: http://stackoverflow.com/comment/31823215
has title: How to replace tabs with image in jtabbedpane
tagged with: java

http://stackoverflow.com/q/21111649
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: In my app, before upgrading to jsf 2, when doing a custom redirect I used to manually put a request parameter with a specific value in external context like this: FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap() .put(CmwNavigationControllerBean.PARAM_DISPLAY_TARGET_POPUP, "true"); Now this line, throws an exception because it seems that this map is no longer allowed to be modified: at java.util.Collections$UnmodifiableMap.put(Unknown Source) [rt.jar:1.7.0] Isn't really no other way to bypass this exception? I'm doing refactoring because of upgrade and I try to keep the changes at minimal level.
accepted answer: http://stackoverflow.com/a/21111732
type: Question
tagged with: jsf-2
has answer: http://stackoverflow.com/a/21113053
answer count: 2
linked to: http://stackoverflow.com/q/3605238
has answer: http://stackoverflow.com/a/21111732
tagged with: jsf-1.2
upvote count: 1
has title: How to add request parameter in jsf2?
favorite count: 0
possible better answer: http://stackoverflow.com/a/21113053
linked to: http://stackoverflow.com/q/11194112

http://stackoverflow.com/a/21113871
answers question: http://stackoverflow.com/q/21113404
has comment: http://stackoverflow.com/comment/31768994
has comment: http://stackoverflow.com/comment/31767666
has comment: http://stackoverflow.com/comment/31769975
score: 0
has comment: http://stackoverflow.com/comment/31767868
has comment: http://stackoverflow.com/comment/31767920
has comment: http://stackoverflow.com/comment/31768226
has comment: http://stackoverflow.com/comment/31769063
has comment: http://stackoverflow.com/comment/31767741
has body: You seem to be misusing the ImageIO API (correct me if I misunderstood): You can use ImageIO.read with 3 different inputs: URL File InputStream If you have a file to load - just pass it like so: bImageFromConvert = ImageIO.read(new File("someFile.jpg")); Or like this if it is within your application: bImageFromConvert = ImageIO.read(this.getClass().getClassloader().getResourceAsStream("com/myapp/images/someFile.jpg")); If you are getting the data as bytes from an outside source - try using a byte[] instead of List&lt;Byte&gt; which I assume you are using as it is more fitting to the problem you are trying to solve. Also, note that you allocated only 4K for the image - and this might not be enough for loading your image - which (should) cause ImageIO.read to fail. I'm not adding anything about using a URL - but I assume it is obvious. If this does not answer your question please add more relevant inputs.
type: Answer

http://stackoverflow.com/a/21037518
score: 1
answers question: http://stackoverflow.com/q/21036410
has comment: http://stackoverflow.com/comment/31628325
type: Answer
has body: Since you are stuck with DateFormat, it does not seem to be as flexible as SimpleDateFormat option. Still, you can use it to suit your cause like below: Assumption: You are using import java.text.DateFormat; Your modified code: @Override public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) { mDateButton = (Button)v.findViewById(R.id.crime_date); mCrime.setDate(DateFormat.getDateInstance(DateFormat.FULL)); mDateButton.setText(mCrime.getDate().format(new Date())); mDateButton.setEnabled(false); ... EDIT: Since, your DataFormat is of type android.text.format.DateFormat change your code to following: @Override public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) { mDateButton = (Button)v.findViewById(R.id.crime_date); mDateButton.setText(android.text.format.DateFormat.format("EEEE, MMM dd yyyy", new java.util.Date())); mDateButton.setEnabled(false); ...
has comment: http://stackoverflow.com/comment/31627555
has comment: http://stackoverflow.com/comment/31627625
has comment: http://stackoverflow.com/comment/31627355
has comment: http://stackoverflow.com/comment/31628482
has comment: http://stackoverflow.com/comment/31627634
upvote count: 1
has comment: http://stackoverflow.com/comment/31628041
has comment: http://stackoverflow.com/comment/31628182
has comment: http://stackoverflow.com/comment/31627820
has comment: http://stackoverflow.com/comment/31628868
has comment: http://stackoverflow.com/comment/31628847
has comment: http://stackoverflow.com/comment/31628746
accepted answer of: http://stackoverflow.com/q/21036410
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31628230

http://stackoverflow.com/a/21025107
score: 0
type: Answer
has body: "( n cannot be resolved to variable) " n isn't within the scope. of the paint method. You need to move it be a class member String n; &lt;-------- public void ustaw() { Scanner input = new Scanner(System.in); n = input.next(); input.close(); } Beside that, there's one thing you should understand about GUI programs. It's event driven. components fire event which are listener for by other components. Say a button is pressed. That pressed of a button fires an event to the listener, and the listener provides some action to perform whenever an event is fired. So if you wanted to get input from a user, you would want something like a text field. You need to register a listener to that text field and the listener will say what action to perform. See this example below, I just used that example of a text field, that you input to, and when you press Enter, the panel get painted with the String import java.awt.BorderLayout; import java.awt.Dimension; 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.JTextField; import javax.swing.SwingUtilities; import stackoverflow.Bucky.DrawPanel; import templates.GUI; public class BuckyGUI { String n = "Hello"; JTextField jtf = new JTextField(15); BuckyPanel panel = new BuckyPanel(); public BuckyGUI() { JFrame frame = new JFrame(); frame.add(panel, BorderLayout.CENTER); frame.add(jtf, BorderLayout.NORTH); frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationByPlatform(true); frame.setVisible(true); jtf.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { n = jtf.getText(); panel.repaint(); } }); } public class BuckyPanel extends JPanel{ private static final int D_W = 250; private static final int D_H = 250; protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawString(n, 125, 125); } public Dimension getPreferredSize() { return new Dime…
answers question: http://stackoverflow.com/q/21024996

http://stackoverflow.com/q/21147204
tagged with: eclipse
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/21147256
has title: Type safety: The method.. belongs to the raw type.. refs to generics should be parameterized
score: 8
favorite count: 0
upvote count: 8
accepted answer: http://stackoverflow.com/a/21147256
type: AnsweredQuestion
has body: Eclipse gives me the warning (in the title) using just the following code in a working project with nothing in it but a dummy class and a main method: List a = new ArrayList(); List&lt;Integer&gt; b = new ArrayList&lt;Integer&gt;(); int x = 19; a.add(x); The last line triggers the warning. I'm not sure what I am doing wrong here, or really, what I am even doing. I am a Java student following a dubious tutorial and I am attempting to understand generics. Supposedly, variable x doesn't illustrate type safety. I tried casting it to the Object type (which I think does nothing because it already is) and it didn't work. How might I resolve this warning?
tagged with: java

http://stackoverflow.com/comment/31855647
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21162573
type: Comment
has text: @RuchiraGayanRanaweera Yes, it's enough. However, in my case it's easier to strip off the error message.

http://stackoverflow.com/a/21179768
has body: StartJCal = new JDateChooser(); JTextFieldDateEditor dateEditor = (JTextFieldDateEditor)StartJCal.getComponent(1); dateEditor.setHorizontalAlignment(JTextField.RIGHT); StartJCal.setDateFormatString("yyyyMMdd"); StartJCal.setFont(new Font("Dialog", Font.PLAIN, 11)); StartJCal.setSize(new Dimension(105, 0)); try this. it will solve your problem
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21179145
answers question: http://stackoverflow.com/q/21179145
score: 1
upvote count: 1

http://stackoverflow.com/q/21120003
has comment: http://stackoverflow.com/comment/31778796
has answer: http://stackoverflow.com/a/21120376
has comment: http://stackoverflow.com/comment/31778960
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31778466
has comment: http://stackoverflow.com/comment/31778775
accepted answer: http://stackoverflow.com/a/21120376
score: 0
has body: I want to correctly validate a method regardless of the parameter ordering. Therefore, snippet 1 and 2 should both pass the test case in snippet 3. (snippet 1) public Integer compute_speed(Integer distance, Integer time) { return distance/time; } (snippet 2) public Integer compute_speed(Integer time, Integer distance) { return distance/time; } You can assume the two snippets as different code submissions by two students. And you can assume that the number of parameters can be as large as 10. In the test case, I wrote, (snippet 3) return compute_speed(3, 1).equals(3); This validates snippet 1 but fails for 2. How can I make it such that both snippets pass the test case? If only there was something like, return compute_speed(distance = 3, time = 1).equals(3); Thanks in advance...
tagged with: unit-testing
type: Question
tagged with: testing
has comment: http://stackoverflow.com/comment/31778735
possible better answer: http://stackoverflow.com/a/21120066
tagged with: java
has answer: http://stackoverflow.com/a/21120066
has title: Java: test methods of different parameter orderings
answer count: 2
has comment: http://stackoverflow.com/comment/31778776
has comment: http://stackoverflow.com/comment/31778508

http://stackoverflow.com/a/21108786
answers question: http://stackoverflow.com/q/21096412
score: 0
has body: I asked the same kind of question, Its about NHibernate and .NET MVC but you can get idea of DAO and ResultTransformer Question
type: Answer
has comment: http://stackoverflow.com/comment/31759285

http://stackoverflow.com/q/21107894
tagged with: netbeans
answer count: 0
has comment: http://stackoverflow.com/comment/31774645
type: UnansweredQuestion
has title: NetBeans Applet Web Start with (use project Main class)
has comment: http://stackoverflow.com/comment/31771581
has comment: http://stackoverflow.com/comment/31773014
type: Question
has comment: http://stackoverflow.com/comment/31773160
tagged with: java
tagged with: java-web-start
has body: So I followed this tutorial to create an applet that can run online. (I got it to work on a web host.) Integrating an Applet in a Web Application. Under the tutorial they made a descriptor under the applet called org.me.Hello.MyApplet, that is specifically used for the "code" tag in thefor the web applications index.html My question is, I never made a urlpath.FunGame for my applet in the web start descriptor, so I am not sure what to put as the code tag for the index file in the web application folder. Under Web Start of the project it says "applet descriptor (use project main class)" Here is how my index file looks right now, I made "GameGUI.class" the code base as I am unsure of how to fully use this example snippet. My main class is located in the class GameGUI of project FunGame. TODO supply a title Thank you, -Austin EDIT: The error I get is GameGUI.class not found, as I do not know how to specify the main as my codebase Trying variations of "main.GameGUI", "main.GameGUI.class", and "main" still no luck. Anymore hints would be appreciated
tagged with: applet
has comment: http://stackoverflow.com/comment/31773506
has comment: http://stackoverflow.com/comment/31776300
score: 0
has comment: http://stackoverflow.com/comment/31774573
has comment: http://stackoverflow.com/comment/31773433
has comment: http://stackoverflow.com/comment/31775268

http://stackoverflow.com/comment/31736748
type: QuestionComment
comment on: http://stackoverflow.com/q/21097316
has text: Possible dupe of http://stackoverflow.com/questions/1741364/efficient-cartesian-product-algorithm?rq=1
score: 0
type: Comment

http://stackoverflow.com/q/21069753
answer count: 7
has answer: http://stackoverflow.com/a/21069784
has title: Why Is This Method Invalid?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21069774
has answer: http://stackoverflow.com/a/21069777
has answer: http://stackoverflow.com/a/21069794
tagged with: java
has comment: http://stackoverflow.com/comment/31686534
type: Question
linked to: http://stackoverflow.com/q/2574276
has comment: http://stackoverflow.com/comment/31686357
has answer: http://stackoverflow.com/a/21069779
has body: It says that public user number is an invalid method. It states that the part of the code is invalid and requires a return type. public UserNumber(){ super(); randy = new java.util.Random(); } //======================= What do I do to fix it?
tagged with: bluej
has comment: http://stackoverflow.com/comment/31686284
has answer: http://stackoverflow.com/a/21069786
score: 0
has comment: http://stackoverflow.com/comment/31686412
has answer: http://stackoverflow.com/a/21069859

http://stackoverflow.com/a/21038589
answers question: http://stackoverflow.com/q/21036239
score: 12
type: AcceptedAnswer
upvote count: 12
type: Answer
has body: Selenium webdriver is a tool used to Automate tests on web based applications,which means even human interactions are automated. An implicit wait is to tell WebDriver to poll the DOM for a certain amount of time when trying to find an element or elements if they are not immediately available. This means you cannot use this to wait for human interactions. But you can assume that the user is waiting for some link to appear and call click(). This can be achieved using Explicit wait. An explicit waits is code you define to wait for a certain condition to occur before proceeding further in the code. WebDriverWait wait = new WebDriverWait(driver, 30); WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.linkText("some_link"))); element.click(); The above code waits for 30 secs for the link to appear and to be clickable. Refer to the documentation for more info.
accepted answer of: http://stackoverflow.com/q/21036239
downvote count: 0

http://stackoverflow.com/q/21135850
has body: I have a Java program that originates a call to a client and, upon answer, connects it to an extension in the dialplan. That extension in turn runs an AGI script to do some interactions with the client. If the client keeps the line until the end, everything is perfect. But if he hangsup in the middle, the AGI script continues running. I would like it to stop at the moment the client hangsup. Here is an extract of the originating java program: OriginateAction originateAction; ManagerResponse originateResponse; originateAction=new OriginateAction(); originateAction.setChannel(phoneNumber); originateAction.setExten("700"); originateAction.setContext("users"); originateAction.setPriority(new Integer(1)); //connect to Asterisk and login ManagerConnectionFactory factory = new ManagerConnectionFactory("localhost","******","******"); managerConnection = factory.createManagerConnection(); managerConnection.login(); //send the originate action and wait for a maximum of 30 seconds to get a response originateResponse=managerConnection.sendAction(originateAction, 30000); An extract from the dialplan exten =&gt;700,1,Agi(agi://localhost/message.agi,${var1},${var2},${var3},${var4}); script to play And an extract from the agi script public void service(AgiRequest arg0, AgiChannel arg1) throws AgiException { setVariable("missedSteps","4"); verbose(" -------------- missed steps: 4 ----------------", 3); // Answer the channel and welcome answer(); streamFile("silence/1"); streamFile("welcome"); setVariable("missedSteps","3"); verbose(" -------------- missed steps: 3 ----------------", 3); //Read the file streamFile(fileName); setVariable("missedSteps","2"); verbose(" -------------- missed steps: 2 ----------------", 3); .......... .......... setVariable("missedSteps","1"); verbose(" -------------- missed steps: 1 ----------------", 3); .......... .......... setVariable("missedSteps","0"); verbose(" -------------- missed steps: 0 ----------------", 3); //hangup hangup(); So as you can …
tagged with: asterisk
tagged with: java
tagged with: terminate
type: Question
tagged with: agi
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21161377
has answer: http://stackoverflow.com/a/21140540
type: UnansweredQuestion
has title: How to stop an AGI script when other party hangsup

http://stackoverflow.com/comment/32509267
type: Comment
has text: @Springrbua - The `enum` must only maintain constant data. You will need `class Player { final Car vehicle = Car.Lamborghini;` or similar. No you cannot sub-class `Car` or `Lamborghini` for similar reasons. Yes the two cars would be the same - even to the point that `player1.vehicle == player2.vehicle` will work as expected
score: 0
comment on: http://stackoverflow.com/a/21046785
type: AnswerComment

http://stackoverflow.com/q/21177062
has comment: http://stackoverflow.com/comment/31882875
has answer: http://stackoverflow.com/a/21183133
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31882787
has comment: http://stackoverflow.com/comment/31887140
type: Question
has comment: http://stackoverflow.com/comment/31882621
accepted answer: http://stackoverflow.com/a/21183133
has comment: http://stackoverflow.com/comment/31883225
tagged with: servlets
has title: How to generate table dynamically from the Map of String and List<String> using JSP and Servlet?
has comment: http://stackoverflow.com/comment/31883072
tagged with: html-table
has comment: http://stackoverflow.com/comment/31882470
downvote count: 0
answer count: 1
tagged with: jsp
favorite count: 0
has body: I have my response Object as which contains getter and setters for the Map - public class DataResponse { private Map<String, List<String>> attributes = new LinkedHashMap<String, List<String>>(); public Map<String, List<String>> getAttributes() { return attributes; } public void setAttributes(Map<String, List<String>> attributes) { this.attributes = attributes; } } In the above object, I have a Map of String and List<String>. In the map, keys are my table header and the value in the map is the table data for that header. Suppose if this is the value in the map - FirstName is the Key in the same Map DAVID, RON, HELLO are the values in the map as the List for that key. Similarly, LastName is the Key in the same Map JOHN, PETER, TOM are the values in the map as the List for the `LastName` key. Then my Table should look like this FirstName LastName David JOHN RON PETER HELLO TOM I need to generate my above table dynamically as am passing my dataResponse object to my JSP page as mentioned below - DataResponse dataResponse = some_code_here; req.setAttribute("data", dataResponse); WebUtil.forward(req, resp, this, "/admin/test.jsp"); And below is my table in JSP in which I am using my above object to generate the table in the above format <c:forEach var="h" items="${data.attributes}"> ${h.key} </c:forEach> //iterate again <c:forEach var="h" items="${data.attributes}"> //h.value is ArrayList so we can iterate with c:forEach <c:forEach var="headers" items="${h.value}"> ${headers} </c:forEach> </c:forEach> But somehow my tables are not getting shown in the way I am trying to show in my above example. All the keys are getting shown properly in the Table Headers but all the values are getting shown only in first column. And size of the list will be same for all the keys. Any thought how this can be done? UPDATE:- <c:forEach var="h" items="${data.attributes}"> ${h.key} </c:forEach> //iterate again <c:forEach var="h" items="${data.attributes}"> <c:forEach var="headers" items="${h.v…

http://stackoverflow.com/comment/31682940
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21068040
has text: Did you read the description in google-geocoder tag? It gives a pointer on where you should look.

http://stackoverflow.com/a/21105467
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/31753527
upvote count: 4
has body: Based on the documentation you provided this would be the best solution since you are likely wanting the type information to lookup the correct page. public &lt;T extends Page&gt; T getPage(Class&lt;T&gt; pageClass) You would then use it like this: MyPage page = myClass.Page(MyPage.class); This design is due to Java's implementation of generics being based around type erasure, so you'll need to pass in the desired type as a parameter to get around it.
accepted answer of: http://stackoverflow.com/q/21105165
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21105165

http://stackoverflow.com/comment/31641329
type: QuestionComment
has text: I think you'll have to rephrase your question a bit: what exactly would you like this code to do that it is not doing now?
comment on: http://stackoverflow.com/q/21045820
score: 0
type: Comment

http://stackoverflow.com/q/21177018
has title: Unable to detect spaces or punctuation marks
favorite count: 0
has answer: http://stackoverflow.com/a/21177692
has body: Code basically doubles something like abc123 to abc246. Now the problem here is that it won't detect spaces or punctuation marks and it'll give me an error for the line int i = Integer.parseInt(sentence);. Any ideas? Thanks Edit: This code asks for a user input sentence through Scanner. else { String woah = sentence; sentence = sentence.replaceAll("\\D", ""); int i = Integer.parseInt(sentence); int j = i * 2 ; woah = woah.replaceAll("" + i, "" + j); System.out.println(woah); }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31882455
upvote count: 2
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/31882427
has answer: http://stackoverflow.com/a/21177550
type: Question
has comment: http://stackoverflow.com/comment/31882453
has comment: http://stackoverflow.com/comment/31882330
has answer: http://stackoverflow.com/a/21177272
score: 0
answer count: 3

http://stackoverflow.com/comment/31655668
comment on: http://stackoverflow.com/a/21053397
type: AnswerComment
score: 0
type: Comment
has text: it didnt work.. initially it said that it was already declared and after i commented out my old constructor it said constructor cannot be appled to given types required : no arguements found string

http://stackoverflow.com/a/21180579
downvote count: 0
answers question: http://stackoverflow.com/q/21180518
type: Answer
score: 2
upvote count: 2
has body: Integer[] temp = {3,9,15,21,27,33,39}; HashSet&lt;Integer&gt; set= new HashSet&lt;Integer&gt;(Arrays.asList(temp)); System.out.println(set.contains(3));

http://stackoverflow.com/q/21103621
has body: I'm new in programming for Android so maybe my question will be very easy to solve but still. I'm trying to make an array of different data types : I have to add there : int number string name int number_2 int time int total And my question now is how to implement it in easiest way, and how to get data from it. In case that I have to get a different records for this variables and store it into list . So maibe array in array will be good solution but still - how to do it ?
type: Question
has answer: http://stackoverflow.com/a/21103751
tagged with: arrays
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/21103708
possible better answer: http://stackoverflow.com/a/21103693
tagged with: android
has answer: http://stackoverflow.com/a/21103693
has title: Insert different types of data to array - Android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21103708
tagged with: java

currency
tag name: currency
type: Tag
tags question: http://stackoverflow.com/q/21114180
tags question: http://stackoverflow.com/q/21144290

http://stackoverflow.com/q/21120093
downvote count: 0
accepted answer: http://stackoverflow.com/a/21120190
has body: in Java, we´ve got methods like hashCode() and equals() which are used by the map to identify each object. C++ doesn´t have such basic methods, each object implements by default. How can a map now use custom objects as the key value? Edit: No duplicate because it´s especially aiming towards those java specific interface methods, someone who has nothing done before with C++ would look for
favorite count: 0
has answer: http://stackoverflow.com/a/21120185
tagged with: dictionary
has answer: http://stackoverflow.com/a/21120252
tagged with: c++
linked to: http://stackoverflow.com/q/3417636
tagged with: equals
possible better answer: http://stackoverflow.com/a/21120183
has title: Understanding Map in C++ as a Java developer
has answer: http://stackoverflow.com/a/21120183
upvote count: 7
duplicate of: http://stackoverflow.com/q/3417636
linked to: http://stackoverflow.com/q/2258449
type: Question
has answer: http://stackoverflow.com/a/21120190
type: AnsweredQuestion
tagged with: hashcode
has answer: http://stackoverflow.com/a/21120229
tagged with: java
score: 7
has answer: http://stackoverflow.com/a/21120268
answer count: 6

http://stackoverflow.com/comment/32207642
has text: I don't have a problem with writing singleton code, but since I'm using dependency injection, it makes sense to adopt it across the board for the entire app. It seems it was even simpler than I thought if you take a look at stenrs answer.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21168366

http://stackoverflow.com/comment/31681393
comment on: http://stackoverflow.com/a/21067217
has text: Calling Swing commands (except for repaint) from within a background thread == dangerous code.
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21045927
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21043215
has body: It's not possible to ensure this at compile time. At runtime you have 2 options. One is to pass actual objects and compare concrete classes (which is in an answer already here). The other one requires use of reflection. Let's say someone declares class as this: class MyConverter&lt;T,V&gt; extends Converter&lt;T,V&gt; In case someone then instantiates an object like this: MyConverter&lt;Number, String&gt; m = new MyConverter&lt;Number, String&gt;(); or Converter&lt;Number, String&gt; m = new Converter&lt;Number, String&gt;(); It is impossible to write a function that figures out the actual type of converter. However if a class is declared such as this: class MyConverter extends Converter&lt;Number, String&gt; it is possible to figure out that it's a Number to String converter using reflection.

http://stackoverflow.com/a/21084234
type: AcceptedAnswer
has body: Annotate your LoggingAspect class with @Component so a bean can be generated @Aspect @Component public class LoggingAspect { and registered. Alternatively, add a &lt;bean&gt; element in the context file for LoggingAspect.
type: Answer
accepted answer of: http://stackoverflow.com/q/21084168
answers question: http://stackoverflow.com/q/21084168
downvote count: 0
score: 3
upvote count: 3

http://stackoverflow.com/comment/31711575
type: AnswerComment
score: 0
has text: how to i pass the URL in the intent to the video class, i thought intent only took a string like "com.program.stuff" and no other parameter.
type: Comment
comment on: http://stackoverflow.com/a/21083160

http://stackoverflow.com/q/21075418
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31696272
has comment: http://stackoverflow.com/comment/31696179
tagged with: android
answer count: 1
accepted answer: http://stackoverflow.com/a/21075622
tagged with: regex
upvote count: 1
has title: Speed improvement using pre-compiled regex patterns
has comment: http://stackoverflow.com/comment/31696258
has body: I am writing a parser and tokens are identified by regex. I use the regexes for each input line, though each regex is in itself short and the matching strings are short as well (a few characters, at most 10). In this post there is a regex speed comparison test for browsers using javascript, showing speed improvements from 0% to 20%. What is the situation with java and android? Will it make my scanning significantly faster to pre compile my regexes? (I know it will not make them any slower) Is there a minimum number of matches that I have to run on the same regex to see any difference at all?
type: AnsweredQuestion
tagged with: performance
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31696312
has comment: http://stackoverflow.com/comment/31696347
has answer: http://stackoverflow.com/a/21075622
type: Question

http://stackoverflow.com/comment/31726745
score: 0
comment on: http://stackoverflow.com/q/21090648
type: Comment
type: QuestionComment
has text: What is the intended use of you analysis of the COBOL programs? Unless you stick to that, you'll end up having to mimic the compiler (which will be silly and non-trivial) or make use of the compiler. So, what is the intended use...?

http://stackoverflow.com/q/21022463
upvote count: 3
tagged with: spring
tagged with: spring-mvc
downvote count: 0
has answer: http://stackoverflow.com/a/21023774
type: UnansweredQuestion
tagged with: java
type: Question
score: 3
has title: Spring Security concurrent session control max-session in Cluster Environment
answer count: 1
has body: I am using Spring framework 4.0 Release version, along with Spring Security 3.2 Release version. I came across a situation where it is required to use feature to restrict number of active session of a same user id. By reading Spring Security document, I learned that Spring Security provides this type of feature. I've tried implementing it that way. It is working fine (on single system). I've used custom UserDetailsService class with custom UserDetails class. Now a question arise is that, how can I achieve this behavior in clustered environment? I am having a cluster environment with sticky session mechanism.
tagged with: spring-security
favorite count: 0

http://stackoverflow.com/a/56766604
downvote count: 0
score: 1
upvote count: 1
has body: server.port = 0 for random port server.port = 8080 for custom 8080 port
type: Answer
answers question: http://stackoverflow.com/q/21083170

http://stackoverflow.com/comment/31895196
score: 0
type: Comment
has text: Thank you for your guidance. So far it looks like the only way I have to do this is by using the `SynthLookAndFeel` and defining the Font, since what I need is to change the entire application's default font into a custom font of my preference, or else I still have to learn more about this. I will update my progress as it happens. Thanks again. I would definitely +1 this but I lack the 15 reputation to do so.
comment on: http://stackoverflow.com/a/21182655
type: AnswerComment

http://stackoverflow.com/comment/31727776
has text: @Eugene You kind of copied my comment there :p
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21092588

http://stackoverflow.com/q/21145659
accepted answer: http://stackoverflow.com/a/21146189
score: 2
downvote count: 0
tagged with: jcomponent
possible better answer: http://stackoverflow.com/a/21145955
tagged with: swing
has answer: http://stackoverflow.com/a/21145955
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: keylistener
upvote count: 2
answer count: 2
has title: For what component should I add KeyListener?
has body: I have a GUI. This GUI class extends JFrame. In top of the screen there is a JLabel with some text. In the center of the screen there is a JPanel, and n x n JButtons were added to this JPanel. I need a KeyListener to react if I press a key. For what component (JFrame, JLabel, JPanel, JButtons) should I add the KeyListener to work my program normally?
tagged with: awt
favorite count: 0
has answer: http://stackoverflow.com/a/21146189

http://stackoverflow.com/comment/31793483
type: AnswerComment
type: Comment
has text: Yeah it is all pretty wonky... I've played with this stuff before and been fine, so I was kind of freaking out... but either way thank you!
comment on: http://stackoverflow.com/a/21128054
score: 0

http://stackoverflow.com/q/21168432
has title: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/discovery/tools/DiscoverSingleton
has answer: http://stackoverflow.com/a/57569952
has answer: http://stackoverflow.com/a/32603383
type: Question
score: 5
has comment: http://stackoverflow.com/comment/31867015
has comment: http://stackoverflow.com/comment/31866761
has comment: http://stackoverflow.com/comment/31866636
has comment: http://stackoverflow.com/comment/31866545
has answer: http://stackoverflow.com/a/23696687
has comment: http://stackoverflow.com/comment/31867195
favorite count: 0
upvote count: 5
has body: here i am trying to make call using webservices via wsdl, while running code getting following exception. showing the testing code as well, please help me out. Thanks. import org.apache.axis.client.Service; import org.apache.axis.client.Call; import org.apache.commons.codec.binary.Base64; import javax.xml.namespace.QName; import java.net.URL; public class WebTest { Service service = null; String endpoint = "http://mytest.com/test/Signup.jws"; String userName = "globel"; String userPw = new String(Base64.decodeBase64("Z23fG46732345FG=".getBytes()));; public WebTest() { try { service = new Service(); System.out.println("*** executed successfully "); } catch (Exception e) { System.out.println("Exception - " + e.getMessage()); } } public void testWeb(String f1, String f2, String f3, int itemcode, String f4){ try { Call call = (Call)service.createCall(); call.setTargetEndpointAddress(new URL(endpoint)); call.setOperationName(new QName("emp")); call.setUsername(userName); call.setPassword(userPw); Object[] params = new Object[5]; params[0] = new String(f1); params[1] = new String(f2); params[2] = new String(f3); params[3] = new Integer(itemcode); params[4] = new String(f4); call.invoke(params); } catch (Exception e) { System.out.println("Exception - " + e.getMessage()); } } public static void main(String[] args) { String orderDate = "03-Jan-2013"; WebTest webtest= new WebTest() ; webtest.testWeb("rayban","aviator",orderDate,82724,"113000") ; } } getting following error - Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/discovery/tools/DiscoverSingleton at org.apache.axis.components.logger.LogFactory$1.run(LogFactory.java:45) at java.security.AccessController.doPrivileged(Native Method) at org.apache.axis.components.logger.LogFactory.getLogFactory(LogFactory.java:41) at org.apache.axis.components.logger.LogFactory.(LogFactory.java:33) at org.apache.axis.handlers.BasicHandler.(BasicHandler.java:43) at org.apache.axis.client.Service.getAxisClient…
type: UnansweredQuestion
tagged with: web-services
answer count: 4
has answer: http://stackoverflow.com/a/21168779
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/31694779
has text: Have you tried something?? Post your attempt
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21074616
type: Comment

http://stackoverflow.com/a/22619871
type: Answer
has body: You need to open the camera first then set it. I tried it before camera.open(0) and it just returns to standard settings, but when try setting after camera.open(0) it works. so do this in your code v.open(1) boolean wset = v.set(Highgui.CV_CAP_PROP_FRAME_WIDTH, 1280); boolean hset = v.set(Highgui.CV_CAP_PROP_FRAME_HEIGHT, 800);
downvote count: 0
score: 5
answers question: http://stackoverflow.com/q/21066329
upvote count: 5

http://stackoverflow.com/comment/31873318
comment on: http://stackoverflow.com/q/21170551
score: 0
type: Comment
type: QuestionComment
has text: FileInputStream inputStream = new FileInputStream(filePath);

http://stackoverflow.com/comment/31708039
has text: Not always but there could be situation where it makes sense to have if else instead of multiple if.
type: Comment
comment on: http://stackoverflow.com/q/21081558
score: 0
type: QuestionComment

http://stackoverflow.com/a/21144515
answers question: http://stackoverflow.com/q/21130292
score: 2
downvote count: 0
has body: if you are using twitter4j.properties, you can also set it there. http.useSSL=true
type: Answer
upvote count: 2

http://stackoverflow.com/q/21121841
possible better answer: http://stackoverflow.com/a/21122046
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21126370
has comment: http://stackoverflow.com/comment/31782117
tagged with: svn
tagged with: java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21126370
type: Question
has answer: http://stackoverflow.com/a/21122046
has body: I have a fairly new small team project with a new team and we have tried a few different approaches and had a few significant iterations in design. We have some classes laying around that should not be used and a few classes that have such messes as ClassStuff and ClassStuffImproved. We have SVN but I don't think nuking all the junk and making people dig manually in the history is productive. Some things may need to be re implemented properly and the previous poor implementation would provide a reference. I do however want to break anything that depends on junk. I also want the project to build even if these junk files are broken. Is there a folder convention? Should i put all nuked content in a textfile so at least its easily searchable when someone wonders where a class went? What is the typical convention here?
has comment: http://stackoverflow.com/comment/31782037
has title: What is the convention for keeping old code for reference?
has comment: http://stackoverflow.com/comment/31781905

http://stackoverflow.com/q/21171301
has comment: http://stackoverflow.com/comment/31873020
has answer: http://stackoverflow.com/a/21171446
has comment: http://stackoverflow.com/comment/31872315
score: 0
tagged with: out-of-memory
tagged with: memory-leaks
has body: We have developed a java application, whose primary objective is to read a file(input file), process it and convert it into set of output files. (I have given a generic description of our solution, to avoid irrelevant details). This program works perfectly fine when the input file is of 4 GB, with memory settings of -Xms4096m -Xmx16384m in a 32 GB RAM Now we need to run our application with the input file of size 130 GB. We used a linux box with 250GB RAM and with memory setting of -Xms40g -Xmx200g (also tried couple of other variations) to run the application and hit OutOfMemory Exception. At this stage of our project it's very hard to consider redesigning the code to accommodate hadoop ( or someother large scale data processing framework), also the current hardware configuration which we can afford is 250GB of RAM. Can you please suggest us ways to avoid OutOfMemory Exceptions, what is the general practise when developing these kind of applications.? Thanks in advance
has comment: http://stackoverflow.com/comment/31874847
has title: How to avoid OutOfMemory exception in a memory intensive application in Java?
has comment: http://stackoverflow.com/comment/31905514
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31874639
has answer: http://stackoverflow.com/a/21171335
tagged with: java
type: Question
tagged with: hadoop
answer count: 2
has comment: http://stackoverflow.com/comment/31873668

http://stackoverflow.com/q/21096412
type: AnsweredQuestion
has title: Getting list of lists in Hibernate
possible better answer: http://stackoverflow.com/a/21171686
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/21277947
type: Question
upvote count: 4
downvote count: 0
score: 4
has body: In my project I have two entities: Race and RaceDriver, which has-a Race in it: class RaceDriver { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "race", nullable = false) private Race race; ... @Column(name = "starting_nr") private Integer startingNr; ... @Column(name = "disqualified", nullable = false) private boolean disqualified; } Now, what I wanted is to get the list of the startingNrs of the disqualified RaceDrivers in a Race, which looked like this: public List&lt;Integer&gt; findDisqualifiedDriversStartingNumbers(Integer raceId) { ProjectionList projection = Projections.projectionList() .add(Projections.property("startingNr").as("startingNr")); return getSession() .createCriteria(RaceDriver.class) .setProjection(projection) .add(Restrictions.eq("race.id", raceId)) .add(Restrictions.eq("disqualified", true)) .list(); } The thing is that now I need the same, but for the few Races. How can I achieve this without making a separate DAO calls? Because I've heard that it is better to make as much as possible in a single database call. My idea is to simply get the list of the drivers which are disqualified in the given races, and then parse it in the Java code, which I think will require few loops, and make some map of disqualified RaceDriver's starting numbers, where the key would be Race.id. The DAO attempt looks like that: public List&lt;RaceDriver&gt; findDisqualifiedDriversInRaces(List&lt;Integer&gt; raceIds) { return getSession() .createCriteria(RaceDriver.class) .add(Restrictions.in("race.id", raceIds)) .add(Restrictions.eq("disqualified", true)) .list(); } The problem is that I will get that big objects, instead of some map or list of the only data I need (startingNr and race.id). So the question is - can I do it somehow using only Hibernate?
has comment: http://stackoverflow.com/comment/31757700
has comment: http://stackoverflow.com/comment/31824920
has comment: http://stackoverflow.com/comment/31766391
has answer: http://stackoverflow.com/a/21108786
has answer: http://stackoverflow.com/a/21182082
has answer: http://stackoverflow.com/a/21277947
answer count: 4
favorite count: 0
linked to: http://stackoverflow.com/q/12720470
has answer: http://stackoverflow.com/a/21171686

opencv
type: Tag
tags question: http://stackoverflow.com/q/21141120
tags question: http://stackoverflow.com/q/21175336
tags question: http://stackoverflow.com/q/21141169
tags question: http://stackoverflow.com/q/21135673
tags question: http://stackoverflow.com/q/21107610
tags question: http://stackoverflow.com/q/21050499
tags question: http://stackoverflow.com/q/21080722
tags question: http://stackoverflow.com/q/21107486
tags question: http://stackoverflow.com/q/21181795
tags question: http://stackoverflow.com/q/21133461
tags question: http://stackoverflow.com/q/21030160
tag name: opencv
tags question: http://stackoverflow.com/q/21161449
tags question: http://stackoverflow.com/q/21054685
tags question: http://stackoverflow.com/q/21073888
tags question: http://stackoverflow.com/q/21135080
tags question: http://stackoverflow.com/q/21041853
tags question: http://stackoverflow.com/q/21066875
tags question: http://stackoverflow.com/q/21066329
tags question: http://stackoverflow.com/q/21113970
tags question: http://stackoverflow.com/q/21157972
tags question: http://stackoverflow.com/q/21113190
tags question: http://stackoverflow.com/q/21182444

http://stackoverflow.com/q/21128287
type: Question
has comment: http://stackoverflow.com/comment/31793877
has title: How do I write basic Doubly Linked List functions in Java?
tagged with: java
score: -1
upvote count: 0
has body: My first assignment in my programming class is about writing code for a Doubly Linked List, which includes writing an add, remove, size, iterator first, iterator last, and iterator find functions. I have spent 3 hours and gotten no where in understanding this. I understand what happens if I can see it in a picture. But my problem is translating it to code. This is what I have so far: public class DoublyLinkedList&lt; G &gt; { public class node { G data; node next; node prev; public node(G data, node next, node prev) { this.data = data; this.next = next; this.prev = prev; } } node header; node footer; public DoublyLinkedList() { header = new node(null, null, null); footer = new node(null, header, null); header.next = footer; } public void add(G data) { header.next = new node(data, footer.prev, footer); } public int size() { node current = header.next; int quanity = 0; if (current == null) { return 0; } while (current != null) { current = current.next; quanity++; } return quanity; } public static void main(String args[]) { DoublyLinkedList&lt;Integer&gt; test = new DoublyLinkedList&lt;Integer&gt;(); //test.add(new Integer(2)); //test.add(new Integer(22)); //test.add(new Integer(222)); System.out.println(test.size()); } } As you can see, I've been using the main() to test everything. From what I've been told by my teacher, my constructor and node class look fine. However I know either my add and size are not right because when I test this, when there is no nodes in the list, it displays nothing, but it should display 0 right? I mean, assuming my size code is right, which I'm not sure of. And whenever I add a node, no matter how many I add, it always displays 1. So either both add and size are broken, or both are. I have not written the other functions as it makes no sense until I figure these ones out. Please someone help me understand this! Thank you.
favorite count: 0
has answer: http://stackoverflow.com/a/21128317
has comment: http://stackoverflow.com/comment/31794132
answer count: 4
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21128759
has answer: http://stackoverflow.com/a/21128431
has answer: http://stackoverflow.com/a/21131529
downvote count: 1

http://stackoverflow.com/q/21123610
has comment: http://stackoverflow.com/comment/31809496
has answer: http://stackoverflow.com/a/21150328
type: Question
score: 3
has comment: http://stackoverflow.com/comment/31833670
answer count: 1
tagged with: spring-security
favorite count: 0
upvote count: 3
has title: Why isn't Spring Security Java Config AntMatcher blocking this url?
tagged with: spring
tagged with: spring-mvc
has body: Using Spring Boot and Spring Security I configure a super simple application and add security based on URLs but it isn't respected. For example, if I log in as a 'scout' and hit an admin URL like /api/leaders, I can still see it. I've tried many permutations of the URLs, even trying anyRequest().denyAll() and the scout user can still access it. @Configuration @EnableAutoConfiguration @ComponentScan(basePackages = {"com.ssoward.scouts"}) public class MainConfiguration { public static void main(String[] args) throws Exception { SpringApplication.run(MainConfiguration.class, args); } //security @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) static class WebSecurityConfiguration extends WebSecurityConfigurerAdapter { @Override @Bean public AuthenticationManager authenticationManagerBean() throws Exception { return authenticationManager(); } @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/api/leaders*").hasRole("ADMIN") //url level security .antMatchers("/api/scouts*").hasRole("USER"); //url level security } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication() .withUser("leader").password("password").roles("USER", "ADMIN").and() .withUser("scout").password("password").roles("USER"); } } } The entire project is on Github: https://github.com/ssoward/scouts
downvote count: 0
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/21144287
has title: What version of Maven is heroku using?
possible better answer: http://stackoverflow.com/a/25827588
favorite count: 0
has answer: http://stackoverflow.com/a/25827588
tagged with: maven
type: AnsweredQuestion
tagged with: heroku
score: 2
downvote count: 0
tagged with: java
has body: I'm attempting to use a Maven plugin that requires version 3.0+ : http://davidb.github.io/scala-maven-plugin/index.html But I receive this error : [ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.1.6:add-source (scala-compile-first) on project spring-hibernate-template: The plugin net.alchim31.maven:scala-maven-plugin:3.1.6 requires Maven version 3.0.4 -&gt; [Help 1] Is Heroku using an older version of Maven? If so can I update it for my app?
type: Question
accepted answer: http://stackoverflow.com/a/21146360
has answer: http://stackoverflow.com/a/21146360
upvote count: 2
answer count: 2

http://stackoverflow.com/q/21165706
score: 0
has comment: http://stackoverflow.com/comment/31861564
has body: I want to extract some groups from command-like strings with the form: foo(bar,1). > need 'foo', 'bar' and '1' foo(bar,1.1). > need 'foo', 'bar' and '1.1' foo(bar-{foo,bar},1.1). > need 'foo', 'bar-{foo,bar}' and '1.1' So a comma can be present in the first argument! Since the second argument is always beginning with a digit, I could match for the first argument commas which are not followed by a number, but I just can't do it with lookahead :( Here is my tries so far: (\w+)\(([a-zA-Z0-9_\-\{\}~]+)(,(\d+(\.\d+)?))?\)\. ... but example 3 won't match this one. (\w+)\(([a-zA-Z0-9_\-\{\}~\,(?!\d)]+)(,(\d+(\.\d+)?))?\)\. ... this one won't let me catch the groups > 2 (negative lookahead doesn't affect the first comma) Here's the Debuggex example Any help will be appreciated! Many thanks in advance :)
has answer: http://stackoverflow.com/a/21165942
possible better answer: http://stackoverflow.com/a/21166025
has title: Regex: Matching comma not followed by a number
has answer: http://stackoverflow.com/a/21166025
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31861295
tagged with: java
accepted answer: http://stackoverflow.com/a/21165942
type: Question
answer count: 2
tagged with: regex-lookarounds
has comment: http://stackoverflow.com/comment/31863265
has comment: http://stackoverflow.com/comment/31863236

http://stackoverflow.com/comment/31748155
has text: You do realise that the frame is using a `BorderLayout` by default?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21102957

http://stackoverflow.com/comment/31752288
score: 2
comment on: http://stackoverflow.com/q/21105156
has text: Yeah, programs often give you the wrong output. Or at least what you think is "wrong" -- in virtually all cases they are doing what you told them to do.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31683204
has text: comment here the line 19 of your main activity! i'll update my reply and post you the final solution!
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21068029

http://stackoverflow.com/q/21162383
has title: Deploy JavaFX on Ubuntu server without display
tagged with: ubuntu
linked to: http://stackoverflow.com/q/10165761
type: Question
has answer: http://stackoverflow.com/a/21162967
type: AnsweredQuestion
tagged with: ssh
tagged with: x11
favorite count: 0
has body: I'm developing a JavaFX application using jdk1.7.0_51 on Mac OS X (10.9.1) in Netbeans. I can run it without a problem and after a clean build I can also launch the jar from the dist/ folder. Now I want to deploy this on a 64 bit Ubuntu 13.04 server. I've had a lot of issues doing this but have finally set up the server to have the correct JRE, fonts and libraries. Running the jar resulted in errors going way deeper than my code (going to UnsatisfiedLinks to native libraries where MACOS was mentioned) so I figured it would be best to package my app on Ubuntu itself. I ended up installing NetBeans to make a new (native) JavaFX project and uploaded the src/ and lib/ folders from my machine using sftp. Running the code through the reconstructed project in NetBeans works fine, though I get a warning in the console during run: libGL error: failed to load driver: swrast libGL error: Try again with LIBGL_DEBUG=verbose for more details. Prism-ES2 Error : GL_VERSION (major.minor) = 1.4 Regardless, the application DOES run. After a clean build, I can similarly run the jar from the dist/ folder. The same warning appears in the terminal but then the application launches. However, if I ssh to the server without the -X flag and try to run the application, I get the following: Failed in XOpenDisplay (java:29341): Gtk-WARNING **: cannot open display: However, my application does not have a UI. It simply uses JavaFX for the WebEngine (this is required and can not be changed). I was wondering if anyone knows if (and if so, how) it's possible to launch my JavaFX jar without a display (to just run as a daemon on the server). Kind regards, Warkst EDIT: I've tried some things described here: Java Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable You need to specify the -Djava.awt.headless=true parameter at startup time. (Assuming I'm doing it right with the command java -Djava.awt.headless=true -jar MyApp.jar), this yielded no results (the sam…
has answer: http://stackoverflow.com/a/74060792
answer count: 3
score: 5
accepted answer: http://stackoverflow.com/a/21162967
has answer: http://stackoverflow.com/a/37736517
upvote count: 5
tagged with: java
tagged with: javafx
possible better answer: http://stackoverflow.com/a/37736517
downvote count: 0

http://stackoverflow.com/a/21057225
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/21057191
downvote count: 0
has body: BufferedImage does not have a "format" Once the bytes have been translated into a BufferedImage the format of the source file is completely lost, the contents represent a raw byte array of the pixel information nothing more. Solution You should use the Tika library to determine the format from the original byte stream before the BufferedImage is created and not rely on file extensions which can be inaccurate.
score: 8

http://stackoverflow.com/a/21141676
upvote count: 1
has body: These are the problems: In your Coins class, you have attempted to wrap everything inside the main method. You need to declare your method and variables separately, and then call them in the main method. Instead of making a main method in your Coins class, it should be in your tester class. When you declare a method with parameters, you need to specify the type. So instead of public void CoinsToChange(TotalCoins) it should be public void CoinsToChange(int TotalCoins). Finally, in your tester class, you were calling money.CoinsToChange(changeMoney) before you declared and assigned changeMoney in int changeMoney = kybd.nextInt(). You need to put that line after it instead of before it. Making as few changes as possible, I got your code to work like so: public class Coins { private int quarters, dimes, nickels, pennies; public void CoinsToChange(int TotalCoins) { quarters = (int) (TotalCoins / 25); TotalCoins %= 25; dimes = (int) (TotalCoins / 10); TotalCoins %= 10; nickels = (int) (TotalCoins / 5); TotalCoins %= 5; pennies = (int) (TotalCoins / 1); TotalCoins %= 1; System.out.println("Quarters = " + quarters + "\nDimes = " + dimes + "\nNickels = " + nickels + "\nPennies = " + pennies); } } Tester class: import java.util.Scanner; public class CoinsTester { public static void main(String[] args) { Coins money = new Coins(); Scanner kybd = new Scanner(System.in); int changeMoney = kybd.nextInt(); money.CoinsToChange(changeMoney); // This line needs to be at the bottom } } NOTE: Some of the other answers also give you good suggestions having to do with better variable names and use of String formatting. It would be good to take their advice. I specifically wanted to address the compiler errors.
downvote count: 0
answers question: http://stackoverflow.com/q/21141191
type: Answer
score: 1

http://stackoverflow.com/comment/31872681
score: 0
has text: so there is no need Container cp = getContentPane(); even after adding actionLisner
type: Comment
comment on: http://stackoverflow.com/a/21171544
type: AnswerComment

http://stackoverflow.com/a/21079828
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21079795
type: Answer
answers question: http://stackoverflow.com/q/21079795
has comment: http://stackoverflow.com/comment/31704617
has comment: http://stackoverflow.com/comment/31704863
upvote count: 3
score: 3
has body: Because the short -1 gets promoted to a int with value -1, which is : 1111 1111 1111 1111 1111 1111 1111 1111 After shifting it 10 bits to the right, you have: 0000 0000 0011 1111 1111 1111 1111 1111 To fix it, you have to take the appropriate part of the int: short x = (short)((-1 &amp; 0xFFFF) &gt;&gt;&gt; 10); This way, the (-1 &amp; 0xFFFF) is already an int, so it doesn't contain the leading 1's.
has comment: http://stackoverflow.com/comment/31704542
type: AcceptedAnswer

http://stackoverflow.com/q/21066209
possible better answer: http://stackoverflow.com/a/21066307
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21066231
accepted answer: http://stackoverflow.com/a/21066231
has comment: http://stackoverflow.com/comment/31679325
tagged with: java
has answer: http://stackoverflow.com/a/21066262
score: -1
upvote count: 1
has comment: http://stackoverflow.com/comment/31679321
type: Question
has answer: http://stackoverflow.com/a/21066260
has body: A method takes a class cls as parameter and I need to instantiate a cls object. Something as follows: private void foo(Class&lt;?&gt; cls){ cls bar = new cls(); ... } For example, let's say cls is Integer.class (but solution should work for any class). How can I instantiate an Integer inside that method?
linked to: http://stackoverflow.com/q/75175
has answer: http://stackoverflow.com/a/21066307
has comment: http://stackoverflow.com/comment/31679299
has comment: http://stackoverflow.com/comment/31679320
has title: Construct an object of generic type
tagged with: generics
favorite count: 0
downvote count: 2

http://stackoverflow.com/q/21157438
downvote count: 1
tagged with: jgraph
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/21157882
score: -1
has title: What are the improvements of JGraphX vs JGraph 5
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21157882
has body: I read on a lots of posts saying that JGraphX corresponds to version 6 of JGraph. They changed the name because they rewrote all the code from scratch....Ok ! I'm using JGraph 5 and I downloaded JGraphX and I looked a little bit the "new" code but for me it look the same as the JGraph 5 code.... So my question is : What are the improvements of JGraphX vs JGraph 5 ? For what reasons/issues they rewrite all the codes ? Thx for your answers !
tagged with: swing
type: AnsweredQuestion
tagged with: java
tagged with: jgraphx

jdesktop
tag name: jdesktop
tags question: http://stackoverflow.com/q/21029604
type: Tag

http://stackoverflow.com/comment/31704264
type: Comment
score: 1
has text: @assylias I fixed it for him :)
type: AnswerComment
comment on: http://stackoverflow.com/a/21079676

http://stackoverflow.com/a/21100876
score: 1
accepted answer of: http://stackoverflow.com/q/21100694
answers question: http://stackoverflow.com/q/21100694
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
has body: The schema definition of the payload element should look like the following to get the JAXB class you are looking for. You will need to fix how you are generating the XML schema from your XML document. <xsd:attribute name="source" type="xsd:string" /> <xsd:attribute name="version" type="xsd:string" /> For More Information http://blog.bdoughan.com/2011/06/jaxb-and-complex-types-with-simple.html

http://stackoverflow.com/a/21183396
has comment: http://stackoverflow.com/comment/31893520
type: Answer
accepted answer of: http://stackoverflow.com/q/21183302
has comment: http://stackoverflow.com/comment/31893412
upvote count: 1
has body: Use shutdown hooks: When the virtual machine begins its shutdown sequence it will start all registered shutdown hooks in some unspecified order and let them run concurrently. When all the hooks have finished it will then run all uninvoked finalizers if finalization-on-exit has been enabled. Finally, the virtual machine will halt. That is, a shutdown hook keeps the JVM running until the hook has terminated (returned from the run()-method. You will have to extend Jetty code with this functionality.
score: 1
answers question: http://stackoverflow.com/q/21183302
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31629490
type: QuestionComment
comment on: http://stackoverflow.com/q/21038779
score: 0
type: Comment
has text: @kai see my comment above

http://stackoverflow.com/comment/73026983
type: AnswerComment
comment on: http://stackoverflow.com/a/39026744
type: Comment
has text: Do you know why `message.max.bytes` needs to be smaller than `replica.fetch.max.bytes`?
score: 2

http://stackoverflow.com/comment/31705538
type: AnswerComment
type: Comment
has text: Thanks for the specifics. It seems as if the authors of Intuit missed a lot of things. I find the Intuit Partner Platform to be extremely buggy. Anyway, I circumvented the problem altogether by writing my own query strings without the aid of GenerateQuery.
comment on: http://stackoverflow.com/a/21077215
score: 0

http://stackoverflow.com/comment/31785639
type: Comment
comment on: http://stackoverflow.com/q/21111869
type: QuestionComment
has text: Thanks Andrew for the corrections regarding english language, it's not my first language. But i think the title is ambiguous now, since the core of the question (how to rearrange objects in java) has nothing to do with Minecraft or NBT - that was just the idea behind it.
score: 0

http://stackoverflow.com/comment/31766306
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21113568
type: AnswerComment
has text: But will the standard API return the first element contain the particular String?

http://stackoverflow.com/a/37814853
has body: As Perryn Fowler wrote, you should declare a configuration and dependencies section. Here is an example I found: https://github.com/openbakery/gradle-common-plugins/blob/master/webdav.gradle
type: Answer
answers question: http://stackoverflow.com/q/21175597
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/a/21060590
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21059555
answers question: http://stackoverflow.com/q/21059555
type: Answer
has body: Try this: SELECT c.name,c.created_date, u.users, uls.unique_logins, cr.recognitions, 0 AS licences, i.store_items, s.awards, uls2.last_login, c.id AS id, c.is_live AS live FROM company c LEFT JOIN (SELECT u.company_id, COUNT(u.id) users FROM user u GROUP BY u.company_id ) AS u ON u.company_id = c.id LEFT JOIN (SELECT uls.company_id, COUNT(DISTINCT uls.user_id) unique_logins FROM user_login_status uls WHERE uls.date BETWEEN '2013-11-18' AND '2014-01-10' GROUP BY uls.company_id ) AS uls ON uls.company_id=c.id LEFT JOIN (SELECT cr.company_id, COUNT(cr.id) recognitions FROM cash_receiving cr WHERE cr.created_date BETWEEN '2013-11-18' AND '2014-01-10' GROUP BY cr.company_id ) AS cr ON cr.company_id = c.id LEFT JOIN (SELECT i.company_gid, COUNT(i.id) store_items FROM inventory_item i GROUP BY i.company_gid ) AS i ON i.company_gid = c.id LEFT JOIN (SELECT a.company_gid, COUNT(a.id) awards FROM award a GROUP BY a.company_gid ) AS a ON a.company_gid = c.id LEFT JOIN (SELECT uls2.company_id, MAX(uls2.date) last_login FROM user_login_status uls2 GROUP BY uls2.company_id ) AS uls2 ON uls2.company_id=c.id ORDER BY c.name

http://stackoverflow.com/a/21039180
type: Answer
has comment: http://stackoverflow.com/comment/31638127
has body: it is not very clear what you want to accomplish, but do not use dynamic ids. maybe this? <p:tree id="tree" value="#{bean.root}" var="node" dynamic="true" cache="false" animate="true" selectionMode="single" selection="#{bean.selectedNode}"> <p:ajax event="select" process="@form" update="@form"/> <p:treeNode>#{node}</p:treeNode> </p:tree> <h:panelGroup id="details"> <p:panel header="details1" rendered="#{bean.selectedNode.data.type == 'hw'}"> i am an hardware: #{bean.selectedNode.data} </p:panel> <p:panel header="details2" rendered="#{bean.selectedNode.data.type == 'sw'}"> i am a software: #{bean.selectedNode.data} </p:panel> </h:panelGroup>
has comment: http://stackoverflow.com/comment/31635621
answers question: http://stackoverflow.com/q/21036846
score: 0

http://stackoverflow.com/a/21074273
has comment: http://stackoverflow.com/comment/31694759
has comment: http://stackoverflow.com/comment/31694628
has comment: http://stackoverflow.com/comment/31694281
has comment: http://stackoverflow.com/comment/31694252
has comment: http://stackoverflow.com/comment/31694191
has body: Never do this: actionLog.setPreferredSize(new Dimension(500, 300)); Since by doing this you artificially restrict the size of the JTextArea causing the effect that is currently vexing you. Note also that it's generally a good idea to avoid setting preferred sizes on anything. Instead set the column and row counts of the JTextARea. This can be done via setter methods or via a simple constructor call: JTextArea myTextArea = new JTextArea(rows, columns); As an aside: I wonder if a JList will work better for you. MCVE Example: import javax.swing.*; import javax.swing.text.DefaultCaret; public class Main2 { private static void createAndShowGUI() { JPanel mainPanel = new ControlPanel(); JFrame frame = new JFrame("Main2"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(mainPanel); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } } class ControlPanel extends JPanel { private static final int LOG_ROWS = 15; private static final int LOG_COLS = 40; private JButton resetButton = new JButton("Reset"); private JPanel logPanel = new JPanel(); private JLabel actionLogsLabel = new JLabel("Action Log"); private JLabel pointsLogsLabel = new JLabel("Points Log"); private JTextArea actionLog = new JTextArea(); private JTextArea pointsLog = new JTextArea(); private JScrollPane actionScroll; private JScrollPane pointsScroll; public ControlPanel() { init(); this.add(resetButton); this.add(logPanel); } private void init() { this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.setAlignmentX(LEFT_ALIGNMENT); this.logPanel.setLayout(new BoxLayout(logPanel, BoxLayout.Y_AXIS)); this.logPanel.setAlignmentX(LEFT_ALIGNMENT); // !! actionLog.setPreferredSize(new Dimension(500, 300)); // !! actionLog.setMaximumSize(actionLog.getPreferredSize()); actionLog.setRows(LOG_ROWS); // !! actionLog.setColumns(LOG…
has comment: http://stackoverflow.com/comment/31694397
has comment: http://stackoverflow.com/comment/31694116
answers question: http://stackoverflow.com/q/21074259
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31694398
score: 4
has comment: http://stackoverflow.com/comment/31694159
type: Answer
has comment: http://stackoverflow.com/comment/31694475
accepted answer of: http://stackoverflow.com/q/21074259
has comment: http://stackoverflow.com/comment/31694827

http://stackoverflow.com/comment/31820014
comment on: http://stackoverflow.com/a/21140951
has text: That sounds good. I will try it and I will come back. Thanks.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31701410
comment on: http://stackoverflow.com/q/21078049
type: Comment
type: QuestionComment
score: 1
has text: related: check line 42 for objects that might be null - and fix them :-)

http://stackoverflow.com/comment/31848304
comment on: http://stackoverflow.com/a/21129280
has text: Well, my problem is that I can't figure out how to retrieve the status from the getStatus() method. I see it's return type is MediaPlayer.Status and I get it's a static field called PLAYING that I should somehow retrieve, but I can't figure out how. (I should underline that I'm an absolute novice)
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/21101229
score: 0
has body: Are you using a connection pool? According to the javadoc, this transaction manager requires one. You could be hitting the connection pool maximum limit in production, try increasing it.
has comment: http://stackoverflow.com/comment/32235572
answers question: http://stackoverflow.com/q/21099393
type: Answer
has comment: http://stackoverflow.com/comment/32236998

http://stackoverflow.com/comment/31704225
has text: The first line will print `a`...
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/21079676
type: Comment

http://stackoverflow.com/a/76992172
has body: This issue is mostly due to the request is being blocked by the application in our system that protect us from the cyberattacks. In my case, I tried accessing a trusted API service so I just resolved it by adding the zscaler certicate to the lib/security/cacerts file of my jdk 17, which is being used in the IDE by executing the below keytool command in the cmd. keytool -keystore "C:\dev\java\jdk-17.0.7\lib\security\cacerts" -import -alias zscalarCert -file "C:\Users\theri\Documents\zscalar-cert.crt" password:- changeit
score: 5
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/21076179
downvote count: 1

http://stackoverflow.com/q/21175148
tagged with: junit4
upvote count: 20
has comment: http://stackoverflow.com/comment/31879058
tagged with: intellij-idea
linked to: http://stackoverflow.com/q/9288107
has comment: http://stackoverflow.com/comment/31879139
has body: I wrote a performance test class marked as @Ignore because it takes a very long time to run and I don't normally need to run it. I'd like to be able to right click one of the @Tests and say "run" but when I do that in intellij it doesn't run the test because the class is marked as ignored. I don't want to comment out the @Ignore because it's too easy to accidentally commit the file with the @Ignore removed. But I feel that if I explicitly tell Intellij to run a test it should run it regardless of the @Ignore. Keep in mind, if I run a group of classes (eg: all in a package) I still would want this test class to be ignored. Is it possible to get this functionality in Intellij?
has answer: http://stackoverflow.com/a/21175569
has comment: http://stackoverflow.com/comment/31879111
tagged with: junit
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21175569
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31879367
tagged with: java
type: Question
has title: Can I force Intellij-IDEA to run an ignored test?
score: 20
has comment: http://stackoverflow.com/comment/55581719

http://stackoverflow.com/q/21088703
type: Question
tagged with: automation
score: 0
accepted answer: http://stackoverflow.com/a/21089431
answer count: 1
tagged with: junit
has answer: http://stackoverflow.com/a/21089431
has title: maven not running all subset of tests I ask it to when using #
tagged with: maven
tagged with: selenium-webdriver
has body: I am trying to run a couple of tests from different classes, my command line is: mvn -Dtest=com.MyComp.Selenium.SelTests.SomeTests1#XTest,com.MyComp.Selenium.SelTests.SomeTests1#YTest,com.MyComp.Selenium.SelTests.SomeTests2#ZTest When I run this I would expect it to run XTest and YTest from the class SomeTests1 and ZTest from SomeTests2 but instead it just runs XTest and ZTest and skips YTest. If I just tell it to run YTest or if I tell it to run all tests in SomeTests1 it works. Please can somebody see what I'm doing wrong? I don't want to run all the tests in each class I just want a subset.
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/21154809
has comment: http://stackoverflow.com/comment/31842158
has comment: http://stackoverflow.com/comment/31842105
tagged with: checksum
type: Question
has comment: http://stackoverflow.com/comment/31842107
has comment: http://stackoverflow.com/comment/31842445
has comment: http://stackoverflow.com/comment/31842098
has comment: http://stackoverflow.com/comment/31842100
has comment: http://stackoverflow.com/comment/31842088
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/31842139
has body: The user has to enter 9 integers. The sum of the integers is calculated by "ckSum" in the code. According to the nine integers the user enters, if the "cksum" is equal to 10 then the output should be ISBN number with X. IF not then the output should be , the ISBN number and the value of the cksum. For example, if you enter 013031997 , and ckSum would be 10 then the final result should be 013031997X. import java.util.Scanner; public class mendfa { public static void main(String[] args ){ Scanner input = new Scanner (System.in); System.out.println("Enter the ten numbers"); int number = input.nextInt(); int number9 = number%10; number = number/10; int number8 = number%10; number = number/10; int number7 = number%10; number = number/10; int number6 = number%10; number = number/10; int number5 = number%10; number = number/10; int number4 = number%10; number = number/10; int number3 = number%10; number = number/10; int number2 = number%10; number = number/10; int number1 = number% 10; double ckSum = (number1 * 1 + number2 *2 +number3 * 3 +number4 * 4 +number5*5 +number6 * 6 +number7 * 7 + number8 * 8 +number9 * 9)%11; if (ckSum == 10){ System.out.println("The ISBN 10 number is " + number + "X"); } else{ System.out.println("The ISBN 10 number is " + number + ckSum); } } }
type: UnansweredQuestion
has title: How to get the data
tagged with: integer
tagged with: java
has answer: http://stackoverflow.com/a/21155167

http://stackoverflow.com/q/21155120
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31843852
has comment: http://stackoverflow.com/comment/31844062
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/31842675
has comment: http://stackoverflow.com/comment/31844901
has comment: http://stackoverflow.com/comment/31844941
has comment: http://stackoverflow.com/comment/31843973
has answer: http://stackoverflow.com/a/21161898
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/31843834
type: Question
has body: Used JFrame and split pane to display the difference between a two large content. It shows the difference and coloring the difference. So It looks like a table with colored difference. Is it possible to save it as HTML file? JEditorPane and HTMLEditorKit are using only text content to save it in a file. do I need to manually do the difference and color it again in the HTML? Is there a way to copy the table content from Swing to HTML? private void saveToHTML(File selectedFile){ ConfigurationDiffUtil util = new ConfigurationDiffUtil(previous.getRuRO().getContent(), latest.getRuRO().getContent()); JEditorPane yourEditorPane = new JEditorPane(); yourEditorPane.setContentType("text/html"); yourEditorPane.setText(util.getLeftEditor().getText()); if (selectedFile.isDirectory()) { String deviceFolderName = selectedFile.getPath() + File.separator + escapeFileName(deviceId.getName()); File deviceFolder = new File(deviceFolderName); if ( (deviceFolder.exists() &amp;&amp; confirmOverwrite(deviceFolderName)) || deviceFolder.mkdir()) { String saveFileName = escapeFileName(deviceId.getName())+"."+ "html"; File dataFile = new File (deviceFolder, saveFileName); try { BufferedWriter out = new BufferedWriter(new FileWriter(dataFile)); HTMLWriter hw = new HTMLWriter(out, (HTMLDocument) yourEditorPane.getDocument()); hw.write(); out.flush(); out.close(); } catch (FileNotFoundException e) { Log.error(this, "ExportCredentials:credentials file not found",e); } catch (BadLocationException e) { Log.error(this, "ExportCredentials:credentials file not found",e); } catch (IOException e) { Log.error(this, "ExportCredentials:unable to read the file",e); } } } } Now I have created this code snippet. Here I am setting the left pane content. yourEditorPane.setText(util.getLeftEditor().getText()); It is saving it in a html file. Here I could save only text in the html. The look and feel from swing (left and right contents in a table and show the highlight difference), not able to get it in HTML. Only…
has comment: http://stackoverflow.com/comment/31845305
has comment: http://stackoverflow.com/comment/31842895
score: 0
answer count: 1
has title: Swing JFrame content save to html file
has comment: http://stackoverflow.com/comment/31842867
has comment: http://stackoverflow.com/comment/31850210
has comment: http://stackoverflow.com/comment/31843779
has comment: http://stackoverflow.com/comment/31842722

http://stackoverflow.com/q/21060519
has title: Remove whitespaces from string in one jsp page and get again that space in another jsp page
type: UnansweredQuestion
has body: I have a jsp page in which their is a string that have some spaces between them. On that jsp page i remove that space by replaceAll() method than when i pass these string on another jsp page, then i want that space again for checking with it a properties file that have same string with all spaces. How can i do it ?
tagged with: java
has answer: http://stackoverflow.com/a/21060551
type: Question
answer count: 1
tagged with: string
score: 0

http://stackoverflow.com/comment/31778100
has text: Lord. Complete the following: I tried to parse the string `________` as an integer but it threw a number format exception.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21119052

http://stackoverflow.com/q/21162775
has title: Testing with a supertest
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21163090
tagged with: superclass
tagged with: testing
tagged with: java
score: -1
type: Question
has body: I'm new to java and i need to make 2 test classes with a SuperTest class. Right now i've got the following: This is my supertest class. What i want to do here is putting the results in it should give. public class SuperTest { public void test (Zoeker zoeker) { assertArrayEquals(new int[] {21, 27}, zoeker.zoek("AC")); assertArrayEquals(new int[] {5, 9}, zoeker.zoek("GC")); assertArrayEquals(new int[] {0, 11, 15}, zoeker.zoek("AT")); } } This is one of my test classes. Here i would like to make an object to test the Algoritme1 class using the method of the supertest class. public class Test1 extends SuperTest { Zoeker zoeker; @Test public void Algoritme1() { SuperTest algoritm1 = new SuperTest(); algoritm1.test(zoeker); } } At the moment i get a null pointer exception.
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/comment/77832955
has text: You can use label.applyCss(); instead of l.impl_processCSS(true); It works for me with l.prefWidth(-1). Thanks!
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21075734
score: 0

processbuilder
tags question: http://stackoverflow.com/q/21151476
tag name: processbuilder
tags question: http://stackoverflow.com/q/21157331
type: Tag

http://stackoverflow.com/q/21018688
tagged with: java
tagged with: coordinates
type: Question
tagged with: imageview
has answer: http://stackoverflow.com/a/21018775
has answer: http://stackoverflow.com/a/21018835
linked to: http://stackoverflow.com/q/2537238
upvote count: 2
answer count: 2
has title: How to add zoom feature without loosing the x and y layout coordinates
favorite count: 0
tagged with: zooming
has body: I have an image which shows different toasts when touched in different sections. Here is the code. public class MainActivity extends Activity implements OnTouchListener { String xcoordinate, ycoordinate; Integer xint, yint; Double xdoub, ydoub; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final View touchView = findViewById(R.id.lyt); touchView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { xcoordinate = String.valueOf(event.getX()); ycoordinate = String.valueOf(event.getY()); xdoub = Double.valueOf(xcoordinate); ydoub = Double.valueOf(ycoordinate); xint = xdoub.intValue(); yint = ydoub.intValue(); Toast.makeText(getApplicationContext(), "Touch coordinates : " + String.valueOf(event.getX()) + "x and " + String.valueOf(event.getY()) + "y", Toast.LENGTH_SHORT).show(); LaunchPopup(); return true; } }); } public void LaunchPopup() { if(xint &gt; 243 &amp;&amp; xint &lt; 307 &amp;&amp; yint &gt; 315 &amp;&amp; yint &lt; 410) { Toast.makeText(getApplicationContext(), "Center", Toast.LENGTH_SHORT).show(); } else if(xint &gt; 330 &amp;&amp; xint &lt; 394 &amp;&amp; yint &gt; 24 &amp;&amp; yint &lt; 122) { Toast.makeText(getApplicationContext(), "Manual 68 Section", Toast.LENGTH_SHORT).show(); } else if(xint &gt; 330 &amp;&amp; xint &lt; 394 &amp;&amp; yint &gt; 154 &amp;&amp; yint &lt; 250) { Toast.makeText(getApplicationContext(), "Manual 79 Section", Toast.LENGTH_SHORT).show(); } else if(xint &gt; 330 &amp;&amp; xint &lt; 394 &amp;&amp; yint &gt; 314 &amp;&amp; yint &lt; 410) { Toast.makeText(getApplicationContext(), "Manual 17 Section", Toast.LENGTH_SHORT).show(); } else if(xint &gt; 330 &amp;&amp; xint &lt; 394 &amp;&amp; yint &gt; 458 &amp;&amp; yint &lt; 554) { Toast.makeText(getApplicationContext(), "Manual 45 Section", Toast.LENGTH_SHORT).show(); } else if(xint &gt; 330 &amp;&amp; xint &lt; 394 &amp;&amp; yint &…
type: UnansweredQuestion
tagged with: android
score: 2
has comment: http://stackoverflow.com/comment/31592700
downvote count: 0

http://stackoverflow.com/comment/31701427
score: 0
type: QuestionComment
type: Comment
has text: Yes, the arguments are always the same. the subclassess with only one possible enum value, for example EntityArrow above, omit the enum value, but I could allow them to take it if necessary.
comment on: http://stackoverflow.com/q/21077993

http://stackoverflow.com/comment/31758981
comment on: http://stackoverflow.com/q/21109349
score: 0
type: Comment
type: QuestionComment
has text: Maven is very good build tool. Is there any specific reason to look for new tool?..

http://stackoverflow.com/comment/31708711
type: QuestionComment
has text: Code on SO must be indented by four spaces. If your IDE can tab multiple lines, pasting it here is easy. Select all -> tab -> copy -> paste it here -> undo the extra tab in your IDE.
type: Comment
comment on: http://stackoverflow.com/q/21081865
score: 0

http://stackoverflow.com/q/21117636
tagged with: java
has answer: http://stackoverflow.com/a/26058621
tagged with: caching
type: Question
upvote count: 27
answer count: 8
has answer: http://stackoverflow.com/a/23668899
tagged with: algorithm
downvote count: 0
score: 27
has comment: http://stackoverflow.com/comment/31780782
has answer: http://stackoverflow.com/a/26584910
has answer: http://stackoverflow.com/a/55624839
has title: How to implement a Least Frequently Used (LFU) cache?
has answer: http://stackoverflow.com/a/69819225
favorite count: 0
accepted answer: http://stackoverflow.com/a/23668899
has comment: http://stackoverflow.com/comment/31774116
has answer: http://stackoverflow.com/a/54516986
has answer: http://stackoverflow.com/a/21119870
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26058621
has answer: http://stackoverflow.com/a/61963145
has body: Least Frequently Used (LFU) is a type of cache algorithm used to manage memory within a computer. The standard characteristics of this method involve the system keeping track of the number of times a block is referenced in memory. When the cache is full and requires more room the system will purge the item with the lowest reference frequency. What would be the best way to implement a most-recently-used cache of objects, say in Java? I've already implemented one using LinkedHashMap(by maintaining the no. of times objects are accessed) But I'm curious if any of the new concurrent collections would be better candidates. Consider this case : Suppose cache is full and we need to make space for another one. Say two objects are noted in cache which are accessed for one time only. Which one to remove if we come to know that other(which is not in cache)object is being accessed for more than once ? Thanks!

http://stackoverflow.com/a/36708834
type: Answer
has body: The following can be added to the Response and it can prevent CORS issues: Response.status(200) .header("Access-Control-Allow-Origin", request.getHeader("Origin")) .header("Access-Control-Allow-Headers", "origin, content-type, accept, authorization") .header("Access-Control-Allow-Credentials", "true") .header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS, HEAD") .header("Access-Control-Max-Age", "1209600") .entity(applicationSyncService.buildApplicationData()) .build(); Response is of type : HttpServletRequest. It can be a security breach though. You can make the call from jquery like this: $.ajax({ xhrFields: { withCredentials: true }, type: 'GET', url: server + '/hello', dataType: 'json', async: true, success: function(data){ if(data.connected){ //your code }, error: function(a, b, c){ } }); This is a much simpler solution without the use of filters.
score: 0
answers question: http://stackoverflow.com/q/21178823

http://stackoverflow.com/comment/31605932
has text: On first glance I don't see anything which could cause an `INVALID_OPERATION` here, so I suspect your problem lies somewhere else, probably in your texture uploading code. However, there are a few unrelated issues that you might want to fix: `glClear(GL_DEPTH_BUFFER_BIT);` is unnecessary since depth testing is already disabled. Generally you only want to have 1 `glClear` per frame, at the beginning of the frame. Also `glViewport(0, 0, width, height);` should be called when the window is resized, not every frame. It's a good idea to get in the habbit of only changing state when you need to
comment on: http://stackoverflow.com/q/21020437
score: 0
type: Comment
type: QuestionComment

web-services
type: Tag
tags question: http://stackoverflow.com/q/21139992
tags question: http://stackoverflow.com/q/21123694
tags question: http://stackoverflow.com/q/21140767
tags question: http://stackoverflow.com/q/21167527
tags question: http://stackoverflow.com/q/21171428
tags question: http://stackoverflow.com/q/21114354
tags question: http://stackoverflow.com/q/21143126
tags question: http://stackoverflow.com/q/21132508
tags question: http://stackoverflow.com/q/21088225
tags question: http://stackoverflow.com/q/21054392
tags question: http://stackoverflow.com/q/21179098
tags question: http://stackoverflow.com/q/21025489
tags question: http://stackoverflow.com/q/21064886
tags question: http://stackoverflow.com/q/21120264
tags question: http://stackoverflow.com/q/21165733
tags question: http://stackoverflow.com/q/21167564
tags question: http://stackoverflow.com/q/21115205
tags question: http://stackoverflow.com/q/21093543
tags question: http://stackoverflow.com/q/21041934
tags question: http://stackoverflow.com/q/21168432
tags question: http://stackoverflow.com/q/21094726
tags question: http://stackoverflow.com/q/21162267
tags question: http://stackoverflow.com/q/21140111
tags question: http://stackoverflow.com/q/21069666
tags question: http://stackoverflow.com/q/21108070
tags question: http://stackoverflow.com/q/21156929
tags question: http://stackoverflow.com/q/21098936
tags question: http://stackoverflow.com/q/21163962
tags question: http://stackoverflow.com/q/21021837
tags question: http://stackoverflow.com/q/21146651
tags question: http://stackoverflow.com/q/21026095
tags question: http://stackoverflow.com/q/21088029
tags question: http://stackoverflow.com/q/21112767
tags question: http://stackoverflow.com/q/21102704
tag name: web-services
tags question: http://stackoverflow.com/q/21061163
tags question: http://stackoverflow.com/q/21052204
tags question: http://stackoverflow.com/q/21079103
tags question: http://stackoverflow.com/q/21141864
tags question: http://stackoverflow.com/q/21095535
tags question: http://stackoverflow.com/q/21167456
tags question: http://stackoverflow.com/q/21175823
tags question: http://stackoverflow.com/q/21150962
tags question: http://stackoverflow.com/q/21111216
tags question: http://stackoverflow.com/q/21156280
tags question: http://stackoverflow.com/q/21086287
tags question: http://stackoverflow.com/q/21117215
tags question: http://stackoverflow.com/q/21159184

http://stackoverflow.com/comment/79688983
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25881592
has text: This worked excellent, I was trying to set the property on Constructor, but it didn't work. Static block solved.

http://stackoverflow.com/q/21150949
upvote count: 1
accepted answer: http://stackoverflow.com/a/22417198
type: Question
has title: How to test or call a java method using fitnesse?
tagged with: selenium-fitnesse-bridge
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22417198
tagged with: fitnesse
has answer: http://stackoverflow.com/a/21166377
has body: My requirement is to test or call a java method directly through fitnesse tool. I have used this tool for REST testing, but never for calling java methods directly. Also googled , but no solution. Any help would be appreciated. Thanks
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/64270624
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/21166377

http://stackoverflow.com/comment/31822347
type: Comment
type: QuestionComment
has text: @MikeB I added the code I have at the moment. This just replaces N with M and vice versa. However during the testing I realised that there are scenarios where the characters arent changed. Not sure if i am exaplining it well.
comment on: http://stackoverflow.com/q/21144132
score: 0

http://stackoverflow.com/q/21163223
upvote count: 1
has comment: http://stackoverflow.com/comment/32106232
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/32062321
has answer: http://stackoverflow.com/a/22453013
tagged with: java
possible better answer: http://stackoverflow.com/a/32340511
has answer: http://stackoverflow.com/a/32340511
has body: I can create a google calendar in my Java app. I can assign it to a particular user in my Google domain: AclRule rule = new AclRule(); Scope scope = new Scope(); scope.setType("user"); scope.setValue("user1@mydomain.com"); rule.setScope(scope); rule.setRole("reader"); and the created calendar appears in user1's calendars. Yet when I try to assign some other calendar to a group (which said user1 belongs to): AclRule rule = new AclRule(); Scope scope = new Scope(); scope.setType("group"); scope.setValue("group1@mydomain.com"); rule.setScope(scope); rule.setRole("reader"); user1 couldn't see the created calendar in his calendar list. But the calendar is created successfully. Is this correct functionality? Or should I just add Acl rule per group user? Or I am doing something wrong and there is other way to assign some calendar to all the users in a group?
type: Question
has comment: http://stackoverflow.com/comment/31995462
answer count: 2
tagged with: api
downvote count: 0
has title: Assigning Google Calendar access to all users in a group (Java)
accepted answer: http://stackoverflow.com/a/22453013
score: 1
favorite count: 0
tagged with: acl
has comment: http://stackoverflow.com/comment/32102313
has comment: http://stackoverflow.com/comment/32060730
tagged with: google-groups
tagged with: google-calendar-api

http://stackoverflow.com/q/21152913
has comment: http://stackoverflow.com/comment/31839055
has answer: http://stackoverflow.com/a/21153032
score: -1
type: Question
downvote count: 2
upvote count: 1
tagged with: arrays
has answer: http://stackoverflow.com/a/21153040
answer count: 3
favorite count: 0
has body: Given several lists/array of integers ..need to find out the K highest sums picking only one element from each list.Each list/array contains integers in a non-increasing sequence. For example, given the input: [5,4,3,2,1] [4,1] [5,0,0] [6,4,2] [1] and if the value of K is 5 i.e 5 highest sums. The result will be : [21,20,19,19,18] example of the input method might look something like this : List&lt;Integer&gt; fetchHighestSums(int[][] lists,int n){ } Can somebody please help with java code for the above.
has comment: http://stackoverflow.com/comment/31838897
has title: Finding K Highest Sums from multiple integer lists
has comment: http://stackoverflow.com/comment/31843190
type: UnansweredQuestion
tagged with: algorithm
has answer: http://stackoverflow.com/a/21153841
tagged with: java

http://stackoverflow.com/q/21040951
has comment: http://stackoverflow.com/comment/31634427
answer count: 2
has comment: http://stackoverflow.com/comment/31642472
downvote count: 0
has comment: http://stackoverflow.com/comment/31639010
has comment: http://stackoverflow.com/comment/35810238
has answer: http://stackoverflow.com/a/31207337
tagged with: hateoas
has answer: http://stackoverflow.com/a/25505826
favorite count: 0
has title: How to enable HAL rendering without using @EnableHypermediaSupport with spring hateoas?
has comment: http://stackoverflow.com/comment/31638795
has body: With @EnableHypermediaSupport(type = HypermediaType.HAL) Spring hateoas provides a simple and convenient way to enable HAL rendering. The annotations triggers some configuration magic which is explained here: https://github.com/spring-projects/spring-hateoas#enablehypermediasupport However if you are working on a given xml-config based spring application, it is not easy to integrate @EnableHypermediaSupport. I tried a lot of different ways to enable HAL rendering but no single solution was working correctly: Including a configuration class in existing mvc servlet xml configuration. Using different versions of spring hateos (0.70.0, 0.80.0, 0.9.0.BUILD-SNAPSHOT), hoping that 0.90.0 will produce HAL out of the box, since, according to a jira issue, it should become the default rendering (at least for spring data rest). Using a custom MappingJackson2HttpMessageConverter to register a new Jackson2HalModule() also did not work. Although the converter was used for rendering (for example to render Dates), the output was not rendered in HAL. Therefore my question: How can I enable HAL rendering without using EnableHypermediaSupport? I intentionally left out any code snippets, because I don't think that it would help much.
type: UnansweredQuestion
score: 6
tagged with: spring
upvote count: 6
has comment: http://stackoverflow.com/comment/32367093
tagged with: spring-mvc
tagged with: java
tagged with: spring-hateoas
has comment: http://stackoverflow.com/comment/31640949
type: Question

http://stackoverflow.com/comment/97326555
type: AnswerComment
has text: I recommend to use min priority queue for the data structure. It helps me to speed up algorithm to 6X.
type: Comment
comment on: http://stackoverflow.com/a/21162021
score: 0

http://stackoverflow.com/a/21077887
answers question: http://stackoverflow.com/q/21074013
type: Answer
has body: Define your Application public class MyApplication extends ResourceConfig { public MyApplication() { register(new FacadeBinder()); register(JacksonFeature.class); register(MyEndpoint.class); } Configure injection public class FacadeBinder extends AbstractBinder { @Override protected void configure() { bind(MyManager.class).to(MyManager.class); } } Inject configured classes in your endpoint @Path("/jersey") public class MyEndpoint { @Inject MyManager myManager; ... }
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/31754364
downvote count: 0
has comment: http://stackoverflow.com/comment/31963192

http://stackoverflow.com/comment/31653628
comment on: http://stackoverflow.com/q/21028942
has text: There is an implementation of [CMA-ES for Java](https://www.lri.fr/~hansen/cmaes_inmatlab.html#java). Also there exist other metaheuristics for optimizing real-values: Particle Swarm Optimization is another one. And there also exist real-coded genetic algorithms if it really has to be a genetic algorithm.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21093129
favorite count: 0
has comment: http://stackoverflow.com/comment/31728749
tagged with: buildpath
has comment: http://stackoverflow.com/comment/62296974
has answer: http://stackoverflow.com/a/29024473
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2030064
has body: I am having trouble setting up the build path of my java project. I am currently in a Co-Op IT position so I am somewhat new to all this. My background is mostly in C++ and I am learning java on the fly. I am also somewhat new to Eclipse (Kepler service release 1). I am working on a bug on an existing program and need to get the program to build so I can work on it. When I add all of the external .jar files that I know for a fact are the right ones, I am getting this error on two of them : "Archive for required library: '(location of file)' cannot be read or is not a valid ZIP file" Two of the other full time guys on my team have gotten the program to run with those exact same .jar files, one running Eclipse Indigo and the other running the same Kepler version as myself. I also was able to open the two .jar files manually and everything appears to be there. After every trial trying to fix this, I have refreshed, cleaned and restarted eclipse. The two other full time guys said they have never seen this error. I would like to get some insight on this from anyone who has any similar experiences so that I don't have to use up much more of their time.
has answer: http://stackoverflow.com/a/25816559
tagged with: java
tagged with: archive
tagged with: eclipse
has title: Error: Archive for required library cannot be read or is not a valid ZIP file.
has comment: http://stackoverflow.com/comment/31730911
score: 9
type: Question
upvote count: 9
has comment: http://stackoverflow.com/comment/31730072
has answer: http://stackoverflow.com/a/46935683
has comment: http://stackoverflow.com/comment/55448931
tagged with: jar
has answer: http://stackoverflow.com/a/47731886
has answer: http://stackoverflow.com/a/27807543
has comment: http://stackoverflow.com/comment/31729999
has answer: http://stackoverflow.com/a/50069167
has answer: http://stackoverflow.com/a/53036902
has answer: http://stackoverflow.com/a/34206665
downvote count: 0
answer count: 10
linked to: http://stackoverflow.com/q/8857985
has answer: http://stackoverflow.com/a/23240644
has answer: http://stackoverflow.com/a/26995083

http://stackoverflow.com/a/21056682
answers question: http://stackoverflow.com/q/21056311
type: AcceptedAnswer
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/21056311
has body: Server side you're expecting a Base64 encoded string, which you're then converting to a byte array: Dim plaintext() As Byte= Convert.FromBase64String(encrypted_password) You should be doing the opposite of this on Android (converting the byte array to a Base64 string). Instead you're just calling toString on a byte[], which definitely won't give you what you want. You can get the Base64 encoded string from your byte array as follows: String resp = Base64.encode(cipherText, Base64.DEFAULT); You can have a look at the Base64 docs for more information. You may have to play around with the flags supplied. Another thing to consider is the fact that you're expecting everything to be in ASCII encoding. String.getBytes() returns characters encoded using the systems default charset. Passwords may be input using non-ASCII characters, such as é or ¥, and this could introduce subtle bugs. I'd recommend switching everything over to UTF-8 - server-side and client side (that means changing getBytes() to getBytes("UTF-8"), and Encoding.ASCII to Encoding.UTF8). As an aside, creating a String from a byte array in Java is done using new String(someByteArray, "UTF-8") - or whatever the encoding you're using is.

http://stackoverflow.com/a/21138211
has body: Well, I look for you in the documentation of Joda Time and SimpleDateFormat. As you can see there, the pattern definitions are unfortunately not the same. If you translate from SimpleDateFormat to Joda-DateTimeFormat, then you have to note following items: Change Y to x (so called week-year). Change y to Y (year-of-era) and maybe changing the chronology, too (from ISO to Gregorian/Julian) W is not supported in Joda Time (week of month), hence no replacement! F is not supported in Joda Time (day of week in month), hence no replacement! Change u to e (day number of week - ISO order, not localized), available since Java 7. The symbol S is handled differently (I suppose in Joda Time better because of correct zero padding). The zone symbol z is in Joda Time not allowed for parsing (maybe this is the current cause of your problems - you have not shown your pattern format or your exception yet). The zone/offset symbol Z is handled better in Joda Time, for example allows colons in offset etc. If you need latter you can use X in SimpleDateFormat which has the replacement Z in Joda Time. Some tests added: Following sample code demonstrates the different handling of format symbol S. String s = "2014-01-15T14:23:50.026"; DateTimeFormatter dtf = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSSS"); DateTime instant = dtf.parseDateTime(s); System.out.println(dtf.print(instant)); // 2014-01-15T14:23:50.0260 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSS"); Date date = sdf.parse(s); System.out.println(sdf.format(date)); // 2014-01-15T14:23:50.0026 (bad!) Another test for format symbol z (is that your problem???): String s = "2014-01-15T14:23:50.026PST"; DateTimeFormatter dtf = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSSz"); DateTime instant = dtf.parseDateTime(s); System.out.println(dtf.print(instant)); // abort Exception in thread "main" java.lang.IllegalArgumentException: Invalid format: "2014-01-15T14:23:50.026PST" is malformed at "PST" at or…
type: Answer
score: 13
upvote count: 13
has comment: http://stackoverflow.com/comment/66473010
answers question: http://stackoverflow.com/q/21136858
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/66480469
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21136858

http://stackoverflow.com/q/21054171
has comment: http://stackoverflow.com/comment/31657666
has answer: http://stackoverflow.com/a/23213680
downvote count: 0
has comment: http://stackoverflow.com/comment/31657542
has body: Almost every spring project uses spring-beans.xsd (refers to it to be more precise). However, if you look at the file, http://www.springframework.org/schema/beans/spring-beans.xsd, you'll see that it is version 3.2 and doesn't have a definition for the attribute "local". What's even more interesting, is that http://www.springframework.org/schema/beans/spring-beans-3.2.xsd does actually define "local". Also since the file is pulled out of the jar (org/springframework/beans/factory/xml/spring-beans-3.2.xsd) due to spring.schema, I don't think any project will have compile or runtime issues. Eclipse's xml validator on the other hand, I think, uses only the internet link and shows an xml error, more specifically : "cvc-complex-type.3.2.2: Attribute 'local' is not allowed to appear in element 'ref'" Is this is a bug? Edit: As per request, this is my spring header: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:batch="http://www.springframework.org/schema/batch" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" 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/batch http://www.springframework.org/schema/batch/spring-batch.xsd"&gt; Edit 2: here is where I'm using local &lt;bean id="bar" class="org.springframework.batch.item.support.CompositeItemWriter"&gt; &lt;property name="delegates"&gt; &lt;list&gt; &lt;ref local="foo" /&gt; &lt;/list&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="foo" class="java.lang.String" /&gt;
has answer: http://stackoverflow.com/a/21055291
has answer: http://stackoverflow.com/a/21055327
score: 21
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/31657229
has title: spring-beans.xsd does not define "local". Why?
answer count: 5
has answer: http://stackoverflow.com/a/21880645
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/34640470
has comment: http://stackoverflow.com/comment/31657438
tagged with: spring
linked to: http://stackoverflow.com/q/2868412
has comment: http://stackoverflow.com/comment/31657331
tagged with: java
upvote count: 21
tagged with: eclipse
type: Question

http://stackoverflow.com/a/21154363
answers question: http://stackoverflow.com/q/21143768
has comment: http://stackoverflow.com/comment/31864783
accepted answer of: http://stackoverflow.com/q/21143768
upvote count: 1
type: AcceptedAnswer
has body: I think you want to render to a texture, convert the texture to a Pixmap, and then parse the pixmap to draw your ASCII characters to the real screen. First, to render to a texture (offscreen buffer) in LibGDX, use a FrameBufferObject: fbo = new FrameBuffer(); fbo.begin(); // draw your stuff // ... fbo.end(); Second, to get bytes that the CPU can use, you can use the [ScreenUtils class](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/utils/ScreenUtils.html ). You can either get a Pixmap or a raw byte[]. For example, replace the // ... above with: Pixmap p = ScreenUtils.getFrameBufferPixmap(0, 0, width, height); Now you can wander over the pixmap checking out pixels (using [Pixmap.getPixel](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/Pixmap.html#getPixel(int, int))).
type: Answer
has comment: http://stackoverflow.com/comment/31964141
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/32782770
has comment: http://stackoverflow.com/comment/31989423

http://stackoverflow.com/comment/31705779
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21080404
has text: Can you post all the code is before of this?

http://stackoverflow.com/comment/40073195
has text: Everything is explained in the article, what I would say would be an annoying repetition!
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25646116

http://stackoverflow.com/q/21150928
score: 2
type: AnsweredQuestion
tagged with: paint
has answer: http://stackoverflow.com/a/21150966
upvote count: 2
tagged with: java
tagged with: swing
type: Question
tagged with: image
accepted answer: http://stackoverflow.com/a/21150966
has title: Java: repaint() method, why is it being temperamental?
downvote count: 0
answer count: 1
has body: I have this piece of code for a pretty basic 2d platform game I'm working on that I just can't get to work. The game itself is working fine but for some reason the title screen won't appear. I managed to pin this down to the fact that the repaint() method wasn't doing anything when called from the title() method. No matter how I try to invoke it, causing an event/setting up another timer, the paintComponent method isn't doing anything, not even the window appears. Despite this the level() method, which seems pretty similar to me, does cause the window to appear and the paintComponent method to carry out. I'm sorry about how ugly the code is, this is a bit of an experiment for me so it's a bit untidy at the moment. Any help on how to solve this problem would be much appreciated. This is the code for the JPanel class, where I'm getting the problem. public class Screen extends JPanel implements ActionListener{ int currentScreen; Image title; Image background; Image ship; Image black; private Timer timer; private Level lvl; public Screen(){ addKeyListener(new TAdapter()); setFocusable(true); setBackground(Color.BLACK); setDoubleBuffered(true); title(); level(); } public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D)g; if(currentScreen == 0) { g2d.drawImage(title, 0, 0, this); } else if(currentScreen == 1){ g2d.drawImage(background, 0, 0, this); g2d.drawImage(lvl.getAvImage(), lvl.getAvX(), lvl.getAvY(), this); g2d.setFont(new java.awt.Font("SansSerif", Font.PLAIN, 12)); for(int i=0;i&lt;4;i++) for(int j=0; j&lt;4; j++){ g2d.drawImage(lvl.getPlijImage(i,j), lvl.getPlijX(i,j), lvl.getPlijY(i,j), this); g2d.drawString(Integer.toString(lvl.getPlijCurrent(i,j)), lvl.getPlijX(i,j)+64, lvl.getPlijY(i,j)+16); } g2d.drawImage(spaceship, 0, 0, this); g2d.drawImage(black, 0, 736, this); g2d.setColor(Color.WHITE); g2d.drawString(lvl.getSqDisplay(), 450, 32); } Toolkit.getDefaultToolkit().sync(); g.dispose(); } public void title(){ ImageIcon…
favorite count: 0
tagged with: event-dispatch-thread

http://stackoverflow.com/comment/31598733
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21019227
has text: @Kamlesh_Arya What will be the return of postJSONData
type: AnswerComment

http://stackoverflow.com/comment/31777845
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21119626
has text: use shared Preferences ?
type: Comment

http://stackoverflow.com/q/21029384
upvote count: 1
tagged with: swing
tagged with: emoji
type: Question
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/21029438
answer count: 2
favorite count: 0
tagged with: sockets
has answer: http://stackoverflow.com/a/21029905
type: AnsweredQuestion
has body: I want to add emoji for a java swing chat application.But I couldn't success yet. Anyone helps me.Thank you.
has title: How to add smiles for java chat application
has answer: http://stackoverflow.com/a/21029438
possible better answer: http://stackoverflow.com/a/21029905
downvote count: 2

http://stackoverflow.com/comment/31695982
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21063410
has text: Fabian, Thank your for your demonstration. I understand the problem now.
score: 0

http://stackoverflow.com/a/21064141
has comment: http://stackoverflow.com/comment/31676058
type: AcceptedAnswer
downvote count: 0
score: 7
type: Answer
accepted answer of: http://stackoverflow.com/q/21064035
answers question: http://stackoverflow.com/q/21064035
has body: The Servlet Specification chapter on Session Timeouts states By definition, if the time out period for a session is set to -1, the session will never expire. So GlasshFish seems to have that covered. I can't find any reference in the specification that says that the same should be true for a value of 0 with setMaxInactiveInterval(). However it does say The session-config defines the session parameters for this Web application. The sub-element session-timeout defines the default session time out interval for all sessions created in this Web application. The specified time out must be expressed in a whole number of minutes. If the time out is 0 or less, the container ensures the default behavior of sessions is never to time out. If this element is not specified, the container must set its default time out period.
upvote count: 7

http://stackoverflow.com/comment/31682597
score: 1
has text: int toAdd = 1; int curr = 0; for(int l = 0; l < valueList.size(); l++) { curr += toAdd; toAdd++; resultList.add(curr); }
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21067844

http://stackoverflow.com/comment/31694213
type: QuestionComment
comment on: http://stackoverflow.com/q/21074318
has text: I want to read from both of list row by row concurrently
score: 0
type: Comment

http://stackoverflow.com/a/21148684
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21145450
type: Answer
downvote count: 0
has body: Try: public String getGmtMillis(Date time) { if (time == null) { return ""; } DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZZZ"); df.setTimeZone(TimeZone.getTimeZone("GMT")); return df.format(time); }
score: 1
answers question: http://stackoverflow.com/q/21145450
upvote count: 1

http://stackoverflow.com/comment/31608341
type: QuestionComment
comment on: http://stackoverflow.com/q/21026904
has text: 1) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve). 2) 'Java' is to 'JavaScript' as 'Car' is to 'Carpet'.
score: 0
type: Comment

http://stackoverflow.com/a/21163416
upvote count: 10
type: Answer
downvote count: 0
has body: SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(KEY_NAME, contact.getName()); values.put(KEY_DATE, contact.getDate()); // updating row return db.update(TABLE_CONTACTS, values, KEY_ID + " = ?", new String[] { String.valueOf(contact.getID()) });
score: 10
answers question: http://stackoverflow.com/q/21163313

http://stackoverflow.com/q/21170644
tagged with: java
has title: Is it currently possible to enable the mac's integrated graphics chip in a Java application?
type: Question
has body: Is there a way to get a Java application to use the integrated, rather than the discrete, GPU on a mac? (I'm interested in ways to ship an app that won't push the user's Mac laptop into discrete mode, rather than ways to lock in integrated mode on my own laptop for all applications, like gfxCardStatus does.)
has answer: http://stackoverflow.com/a/40442206
has answer: http://stackoverflow.com/a/40193683
has answer: http://stackoverflow.com/a/21320952
answer count: 3
possible better answer: http://stackoverflow.com/a/40193683
downvote count: 0
tagged with: macos
favorite count: 0
tagged with: gpu
score: 11
accepted answer: http://stackoverflow.com/a/21320952
upvote count: 11
type: AnsweredQuestion

http://stackoverflow.com/comment/31686539
comment on: http://stackoverflow.com/a/21069421
score: 0
type: Comment
type: AnswerComment
has text: That looks like a valid point. I've provided thread-safe version as well for the OP to choose the most suitable one

http://stackoverflow.com/q/21179880
has body: I was wondering if there is a way to specify that a subclass should get the qualifier of the container class. For example: @Blue @Default public class Container { @Inject MyClass c; } Now if I inject the Container class using the @Bluequalifier, is there any way to tell that also the MyClass instance should be injected using the same qualifier? If not, it requires me to create a producer for each such case, and a constructor in the class Container...
has comment: http://stackoverflow.com/comment/31983194
type: Question
answer count: 1
has title: Get qualifier from container class
score: 0
accepted answer: http://stackoverflow.com/a/21250721
has comment: http://stackoverflow.com/comment/31904286
tagged with: cdi
has answer: http://stackoverflow.com/a/21250721
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/21119276
has comment: http://stackoverflow.com/comment/31777302
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31777327
score: 1
has body: String[] sarray = getResources().getStringArray(R.array.notifications_string_array); Now you could pass this array to the constructor of adapter class and use it there I want to put a custom icon next to the list item. You need a custom layout with a textview and imageview. Inlflate the custom layout in getView and update textview and imageview appropriately. I also want to be able to click every item You can set listeners for textview and imageview. If you want to click listener for rows then use setOnItemClickListener. listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1,int arg2, long arg3) { TextView tv = (TextView)arg1.findViewById(R.id.text_notification); String text = tv.getText().toString(); Intent i = new Intent(ActivityName.this,SecondActivity.class); i.putExtra("key",text); startActivity(i); } }); For the drawables int [] mydrawable ={R.drawable.icon1,R.drawable.icon2}; // pass this to the constructor of you adapter class
has comment: http://stackoverflow.com/comment/31777468
has comment: http://stackoverflow.com/comment/31777419
has comment: http://stackoverflow.com/comment/31777635
downvote count: 0
answers question: http://stackoverflow.com/q/21119197

http://stackoverflow.com/comment/31835926
has text: Each node can have a `Set` of `Node` as children. Just find a matching node, intersect the sets and recurse into the remaining children.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21150516
score: 1

http://stackoverflow.com/comment/31868417
type: Comment
type: AnswerComment
has text: I managed to get it working vertically but I am still having issues with the diagonal check as it doesn't recognize 4 in a row.
comment on: http://stackoverflow.com/a/21147667
score: 0

http://stackoverflow.com/q/21129138
accepted answer: http://stackoverflow.com/a/21129165
tagged with: paintcomponent
tagged with: repaint
tagged with: paint
score: 1
upvote count: 1
tagged with: graphics
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21129165
tagged with: java
has title: Difference between Graphics object of getGraphics and paintComponent
type: Question
has body: If I'm working with a JPanel, what's the difference between the Graphics object returned by getGraphics, and the Graphics object that is passed in paintComponent method?
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/31664817
type: Comment
comment on: http://stackoverflow.com/a/21058198
score: 3
has text: That is definitely using another data structure. :-)
type: AnswerComment

http://stackoverflow.com/comment/31818002
type: Comment
has text: i did't give the repair part of this .. i was totally mess up..
comment on: http://stackoverflow.com/q/21141508
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31841929
has text: Have a look on this link http://docs.oracle.com/javase/tutorial/java/javaOO/nested.html
type: QuestionComment
comment on: http://stackoverflow.com/q/21154670
score: 1
type: Comment

http://stackoverflow.com/comment/31637740
has text: Well considering that the validation handler is actually configured on the Unmarshaller ... not the JAXBContext. So what exactly is the problem again?
comment on: http://stackoverflow.com/q/21044007
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21094924
favorite count: 0
tagged with: maven
has title: Test behavior of assembled jar
type: AnsweredQuestion
tagged with: java
tagged with: maven-failsafe-plugin
tagged with: maven-assembly-plugin
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21095274
answer count: 1
downvote count: 0
has body: I would like to write an Integration Test which test if the created jar behaves like expected. For that I have to know the path to the jar as well the name, but how to I get this Information. I do not like the idea of hard coding this. Is there a way to get the Information from maven? Or what is the best practice for that?
score: 1
accepted answer: http://stackoverflow.com/a/21095274

http://stackoverflow.com/comment/31761024
type: QuestionComment
comment on: http://stackoverflow.com/q/21108160
score: 0
has text: so how can i trace debug this error. or what can be possible reason for this error.
type: Comment

http://stackoverflow.com/q/21139542
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34481807
has answer: http://stackoverflow.com/a/36619828
has title: GridBagLayout shrink the menubar
has body: Im using GridBagLayout just in the "contentPanel" to add the Menubar, CentralPanel and the StatusBar(Red in the end) but after i add a scrollbar in another cardlayout that are added in the CentralPane, i dont know why, but it hide the menubar, there is a way to deal with it or another LayoutManager that i can do like the correct image?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31813448
has answer: http://stackoverflow.com/a/22640733
tagged with: java
type: Question
tagged with: gridbaglayout

http://stackoverflow.com/comment/31710583
comment on: http://stackoverflow.com/q/21082817
score: 0
type: QuestionComment
type: Comment
has text: Where in the frame is the graphics displayed? in the `paint` method? in the `paintComponent` method?

http://stackoverflow.com/q/21150122
upvote count: 1
tagged with: python
tagged with: java
has title: Stripe - Can a successful synchronous Charge later fail through a charge.failed event?
type: Question
downvote count: 0
score: 1
tagged with: payment
tagged with: stripe-payments
favorite count: 0
has body: I am looking to integrate with Stripe and wanted to know if I need to take care of the following behavior: 1 - Successfully created a charge 2 - At some later point in time could that charge be failed through the charge.failed webhook event? Thanks
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/43850055
type: QuestionComment
type: Comment
has text: I know it's not what you asked about, but this is done easily with [JMockit](http://jmockit.github.io/).
comment on: http://stackoverflow.com/q/21105403
score: 0

http://stackoverflow.com/a/21114540
type: Answer
score: 2
downvote count: 0
has body: You can try the following. It would return true if the property is multi-valued, else returns false. Property myProp = myPage.getProperties().get("myProperty"); boolean result = myProp.isMultiple(); We can then get the value of the property and then check its type. if(result) { Value[] values = myProp.getValues(); for(Value value : values) { value.getString(); } }
answers question: http://stackoverflow.com/q/21113452
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21113452
type: AcceptedAnswer

http://stackoverflow.com/q/21073420
tagged with: spring
type: Question
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31692645
has answer: http://stackoverflow.com/a/21073539
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/21073592
has answer: http://stackoverflow.com/a/21073592
answer count: 2
has comment: http://stackoverflow.com/comment/31692610
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/21073539
tagged with: rest
has body: I am following a simple Spring MVC REST example. On PUT request, I am getting following exception: org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Unrecognized field "property" (Class domain.Property), not marked as ignorable at [Source: org.apache.catalina.connector.CoyoteInputStream@75280b93; line: 1, column: 14] (through reference chain: domain.Property["property"]); nested exception is org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "property" (Class domain.Property), not marked as ignorable at [Source: org.apache.catalina.connector.CoyoteInputStream@75280b93; line: 1, column: 14] (through reference chain: domain.Property["property"]) I am receiving following JSON {"property": { "name":"name", "age":"22" } } Following is my REST method: @RequestMapping(method = RequestMethod.PUT, value = "/{id}") public ResponseEntity&lt;Property&gt; updateProperty(@RequestBody Property property, @PathVariable String id) { final ResponseEntity&lt;Property&gt; response = new ResponseEntity&lt;Property&gt;(property, HttpStatus.OK); return response; } The Property is standard POJO with getter/setter for name and age. How can I resolve this exception?
score: 2
has title: Spring MVC REST Json Conversion exception
upvote count: 2

http://stackoverflow.com/a/21119238
downvote count: 0
score: 4
has body: After your edit it is clear that your custom comparator is the culprit. What you actually want to achieve is collecting the keys of the ten highest values in the map. But, your approach is needlessly roundabout, if I may say. You already have some map m, which is your starting point. So what you need is just collect its entrySet, sort it by value, and take the first ten elements: import java.util.Map.Entry; final List&lt;Entry&lt;Integer,Integer&gt;&gt; list = new ArrayList&lt;&gt;(m.entrySet()); Collections.sort(list, new Comparator&lt;Entry&lt;Integer, Integer&gt;&gt;() { @Override public int compare(Entry&lt;Integer, Integer&gt; o1, Entry&lt;Integer, Integer&gt; o2) { return o1.getValue().compareTo(o2.getValue()); }}); final StringBuilder b = new StringBuilder(); String delimiter = ""; for (Entry&lt;Integer, Integer&gt; e : list.subList(0, 10)) { b.append(delimiter).append(e.getKey()); delimiter = ","; } System.out.println(b); Note that a one-shot sort is more efficient than inserting elements one by one into a binary search tree. I am also using StringBuilder, which is again more efficient than recreating a full String in each step.
has comment: http://stackoverflow.com/comment/31778510
answers question: http://stackoverflow.com/q/21119011
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/31777486
has comment: http://stackoverflow.com/comment/31777393

http://stackoverflow.com/comment/31781573
score: 0
type: Comment
has text: @texasbruce The `.class` files contain the byte code for the methods. I believe it's up to the JVM to cache them or look them up every time. Depends on implementation (but let's be real).
comment on: http://stackoverflow.com/a/21121477
type: AnswerComment

http://stackoverflow.com/comment/31643347
score: 0
type: AnswerComment
type: Comment
has text: @user3182091 the sub classes could have fixed values yes, if you had private variables that contained those values and return them with `@getTopSpeed()`
comment on: http://stackoverflow.com/a/21046734

http://stackoverflow.com/comment/31840730
comment on: http://stackoverflow.com/q/21153933
type: QuestionComment
has text: tomcat location is `/usr/share/tomcat7/apache-tomcat-7.0.42` and I am starting the `startup.sh` with `sudo`. Because without `sudo` it was not starting. Is it because of that?
score: 0
type: Comment

http://stackoverflow.com/comment/31844922
type: QuestionComment
has text: I have created a runnable jar of my project. I dont want to output to a txt file.I need a screen showing the messages.
comment on: http://stackoverflow.com/q/21154417
score: 0
type: Comment

http://stackoverflow.com/q/21112703
score: 13
linked to: http://stackoverflow.com/q/9632880
has answer: http://stackoverflow.com/a/27753178
has answer: http://stackoverflow.com/a/54852431
has body: I am trying to run an web app. In the beginning it was going well, but I had to delete some jars from the project folder. I didn't delete the jars using eclipse. So, I started to get these errors: Publishing failed with multiple errors Could not delete C:/Users/maniceto/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/fj21-tarefas/WEB-INF/lib. May be locked by another process. Could not delete C:/Users/maniceto/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/fj21-tarefas/WEB-INF. May be locked by another process. I tried to delete my whole project and code it again. But it doesn't work. I also deleted the Tomcat server but again it doesn't work. Then I realized that to "fix" this problem I have to delete this folder: C:/Users/maniceto/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/fj21-tarefas/WEB-INF. And clean the server and the project. But when I close eclipse and open again I get the same error, then I have to do this process. Anyone here knows how to fix this kind of tomcat bug?
has title: Could not delete /.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/appname/WEB-INF/lib. May be locked by another process
has answer: http://stackoverflow.com/a/47349728
has answer: http://stackoverflow.com/a/21112995
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/71059562
has answer: http://stackoverflow.com/a/57424681
has answer: http://stackoverflow.com/a/34908268
tagged with: tomcat
tagged with: locked-files
favorite count: 0
upvote count: 14
has answer: http://stackoverflow.com/a/39871477
has answer: http://stackoverflow.com/a/50308044
downvote count: 1
has answer: http://stackoverflow.com/a/43490617
has answer: http://stackoverflow.com/a/21114227
has answer: http://stackoverflow.com/a/53770910
answer count: 15
linked to: http://stackoverflow.com/q/43931383
has answer: http://stackoverflow.com/a/21115388
has answer: http://stackoverflow.com/a/38630464
has answer: http://stackoverflow.com/a/57483920
type: UnansweredQuestion

http://stackoverflow.com/comment/31703883
comment on: http://stackoverflow.com/q/21079307
score: 0
has text: What's the layout of your project? Does it conform to Maven conventions?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31753531
comment on: http://stackoverflow.com/a/21105977
score: 0
type: AnswerComment
has text: @user3013480 The only other way without import or the `java.util.List` is to create your own list or copy the code and compile it yourself. Do not do either of those. Either import or use the `java.util.List` or (best) continue with you array.
type: Comment

http://stackoverflow.com/a/21073236
has comment: http://stackoverflow.com/comment/31692567
has comment: http://stackoverflow.com/comment/31692317
has comment: http://stackoverflow.com/comment/31692276
type: Answer
answers question: http://stackoverflow.com/q/21073024
score: 1
has comment: http://stackoverflow.com/comment/31692299
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/31692713
has body: If you'd like to achieve good performance and send object then you definitely should use Google Protobuf It allows you to define messages in simple .proto files. Then you use bundled compiler to generate Java classes which will be serialized and sent. Also better idea is to use Netty over plain Java sockets. This prevent you from writing a lot of boilerplate code and define simple serialization/deserialization pipelines. Take a look at user-guide.

http://stackoverflow.com/a/21079010
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31704966
has comment: http://stackoverflow.com/comment/31702929
has comment: http://stackoverflow.com/comment/31703071
answers question: http://stackoverflow.com/q/21078993
has body: Since v is an object and not a primitive type, the == comparison compares object locations in memory, rather than testing for equality. Instead, you need to modify your test to use the .equals method: if (v.equals(yes_button)) { ... } else { } Also, if there's really only two alternatives, you can, as I have above, omit a test to see if the press was on the "no" button.
downvote count: 0

http://stackoverflow.com/q/21168063
has body: I have millions of documents with the following fields: name (string), start version (int), end version (int). I need to query efficiently all records which answers the query: Select all documents where version >= "start version" and version&lt;="end version" Running the above query took 50-100 ms while similar query by tagging each version took only 15 ms. My question is how efficient can Solr handle such queries? Any alternate solutions will be welcomed. The fields values / types can be changed if needed.
has answer: http://stackoverflow.com/a/21201249
tagged with: solr
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/31913514
tagged with: interval-tree
score: 0
has title: Range query in Solr
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/31607650
comment on: http://stackoverflow.com/q/21026484
score: 0
type: Comment
has text: @CodeChimp : So let's say there is a method getX() in a bean.The method checks : IF x==null then the bean is fetched using applicationContext. So in this case using an applicationContext to get the bean is a good idea rather than just autowiring bean ?
type: QuestionComment

http://stackoverflow.com/q/21051991
downvote count: 1
type: Question
tagged with: intellij-idea
has title: Importing jar file into IntelliJ Idea?
tagged with: jsp
tagged with: servlets
upvote count: 22
has body: I want to use methods in Java Mail API, so I am trying to import its jar into my project on IntelliJ IDEA. How do I import or download this new jar? I am not new to IntelliJ IDEA, but haven't imported new jar in two months now. Also, do I need other setup in order to use Java Mail API?
answer count: 2
has answer: http://stackoverflow.com/a/21052192
tagged with: email
score: 21
favorite count: 0
has comment: http://stackoverflow.com/comment/31700780
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21052192
possible better answer: http://stackoverflow.com/a/21052230
tagged with: java
has answer: http://stackoverflow.com/a/21052230

http://stackoverflow.com/a/21179208
has body: In general when it comes to J2ME development, you should always test your app on multiple real devices. Emulators can't be trusted. Also, J2ME is very fragmented, and various devices have various bugs and behaves differently with the same code. This will affect any app on many areas. One area being audio playback. For example, some devices requires that you use the realize() and prefetch() methods, while other devices will crash if you use prefetch(). The only possible solution (if you wish to support as many devices as possible) is to use multiple try/catch blocks. See this link for a detailed explanation and other tips'n'tricks on audio playback with MIDP2.0 http://indiegamemusic.com/help.php?id=1
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21171238
has comment: http://stackoverflow.com/comment/31891713

http://stackoverflow.com/comment/31649063
has text: Check what value you get by using the below code, String val=inp.readLine(); System.out.println("Value: "+val); String[] s1 = inp.readLine().split(" ");
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21049527
score: 0

http://stackoverflow.com/comment/31731758
comment on: http://stackoverflow.com/a/21092755
score: 0
type: AnswerComment
has text: System is meant to send the `String` no matter what the value is. It can send the same `String` for over 30seconds or send complete different each 200ms. Message can be changing even 20 times per seconds, I am supposed to catch one right after the 200ms pass and send it.
type: Comment

http://stackoverflow.com/comment/31619822
type: AnswerComment
score: 0
type: Comment
has text: `player1` and `player2` need to be defined as static in the second example as well as `combatPhase()` (in both versions) or you create a new instance of the class that is hosting the code
comment on: http://stackoverflow.com/a/21033235

http://stackoverflow.com/comment/31667848
comment on: http://stackoverflow.com/a/21059104
has text: I copied your code and made a test project.. I get this error "multi-catch statement is not supported in -source 1.6 (use -source 7 or higher to enable multi-catch statement)" at the UIManager try and catch.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31680480
comment on: http://stackoverflow.com/a/21066534
score: 0
type: AnswerComment
has text: Yes I thought about that. When pressed enter on JTextArea, write (for example) #. And then replace all # chars with \n. It may disturb user but if I can't found another way out I have to do this. Can we add a new line to JTextArea and a character by pressing enter? User needs to see new line, I have to add a character. Do you know any way to do this?
type: Comment

http://stackoverflow.com/a/21147242
type: Answer
answers question: http://stackoverflow.com/q/21095025
upvote count: 4
has body: Well, I've found the answer here: Setting GradientDrawable through RemoteView I created an Imageview filling the whole widget, then created a bitmap using my gradientDrawable, then setted the bitmap to the imageview: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/widget_layout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/style_widget" android:padding="0dip" &gt; &lt;ImageView android:id="@+id/bck_image" android:layout_width="fill_parent" android:layout_height="fill_parent" android:scaleType="fitXY" /&gt; and then in my Service: GradientDrawable gradientDrawable = new GradientDrawable( GradientDrawable.Orientation.LEFT_RIGHT, colors); float dpi = getBaseContext().getResources().getDisplayMetrics().xdpi; float dp = getBaseContext().getResources().getDisplayMetrics().density; Bitmap bitmap = Bitmap.createBitmap(Math.round(288 * dp), Math.round(72 * dp), Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); gradientDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); gradientDrawable.setCornerRadius(5 * (dpi/160)); gradientDrawable.draw(canvas); remoteViews.setImageViewBitmap(R.id.bck_image, bitmap); (I'm very new to Android so I don't know if the code is well formed but for me it works, in case it can help anyone.)
downvote count: 0
score: 4

http://stackoverflow.com/comment/31851455
type: Comment
comment on: http://stackoverflow.com/q/21160212
has text: That is no problem, you just need to do Garbage Collection yourself
score: 0
type: QuestionComment

http://stackoverflow.com/a/21143273
has comment: http://stackoverflow.com/comment/31820588
has comment: http://stackoverflow.com/comment/31846513
accepted answer of: http://stackoverflow.com/q/21137200
type: Answer
answers question: http://stackoverflow.com/q/21137200
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/31847381
has comment: http://stackoverflow.com/comment/31854611
type: AcceptedAnswer
has body: This is a known Java bug affecting all version from 7u25 to 7u45: https://bugs.java.com/bugdatabase/view_bug?bug_id=8027405 Only solution is to upgrade to 7u45 7u51 or set the java security slider to 'Medium'. [Edit] corrected fix version according to bug report
downvote count: 0

http://stackoverflow.com/comment/31685264
type: Comment
type: QuestionComment
has text: I know I look rather clueless, as I am. But, I'm learning it. Slowly but steadily. It seems a bit too complex for me, but nonetheless I will attempt to do it anyway.
score: 0
comment on: http://stackoverflow.com/q/21069204

http://stackoverflow.com/a/21158835
has body: Here's the code which might solve your problem. I tried the same. public class example { public static void main(String[] args) throws IOException { // Directory path here String path = "C:\\"; SimpleDateFormat sdf = new SimpleDateFormat("MMM/dd/yyyy HH:mm:ss"); File folder = new File(path); File[] listOfFiles = folder.listFiles(); File file = new File("report.txt"); if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); long size; int limit = 2; for (File f : listOfFiles) { size = f.length() / 1000 / 1000; if (size &gt;= limit) { System.out.println("File:" + f.getAbsoluteFile() + " " + size + "MB Last Modified Date: " + sdf.format(f.lastModified())); bw.write("File:" + f.getAbsoluteFile() + " " + size + "MB Last Modified Date: " + sdf.format(f.lastModified())); } } bw.close(); } }
answers question: http://stackoverflow.com/q/21158142
type: Answer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/36075232
comment on: http://stackoverflow.com/q/21086669
type: QuestionComment
has text: Sure. As far as my research goes I am trying to fiddle with JQuery's jstree plugin but looking at your solution would definitely help me to achieve my result faster. Thanks
score: 0
type: Comment

http://stackoverflow.com/a/21176153
has comment: http://stackoverflow.com/comment/31912658
has comment: http://stackoverflow.com/comment/31913261
has comment: http://stackoverflow.com/comment/31912737
has comment: http://stackoverflow.com/comment/31881485
has comment: http://stackoverflow.com/comment/31881169
has comment: http://stackoverflow.com/comment/31882340
has comment: http://stackoverflow.com/comment/31911823
score: 2
has comment: http://stackoverflow.com/comment/31904203
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31880952
has comment: http://stackoverflow.com/comment/31881094
has comment: http://stackoverflow.com/comment/31884894
type: Answer
has comment: http://stackoverflow.com/comment/31884380
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21176122
has body: If a member variable is private you cannot directly access it outside of it's own class like you have tried here point2.pointY(13); You must use the public setters/getters you wrote to accomplish this. point2.setPointY(13); Also, in your PointClass you have a method getPoints(int x, int y) which is actually SETTING the variables. The method name should be changed to setPoints(int x, int y). Also, you have overridden the toString() method of your PointClass. Because of this you do not have to explicitly call toString(). System.out.println(point1.toString()); // Unneeded System.out.println(point1); //Better Edit Once you have removed import java.awt.point; you will need to add a constructor to your PointClass. public class PointClass { private int pointX; //set instance variables private int pointY; // //This is your new constructor // public PointClass(int x, int y) { this.pointX = x; this.pointY = y; } Now you can create instances of this class like this Point point1 = new Point(11, 24); // Old way - Incorrect PointClass point1 = new PointClass(11, 24) // Better - This will make objects of your class. Edit #2 Here's the final classes I wrote for you: PointClass public class PointClass { //Set instance variables private int pointX; private int pointY; //Default Constructor - Starts at (0, 0) public PointClass() { this.pointX = 0; this.pointY = 0; } //Constructor with specified values public PointClass(int x, int y){ this.pointX = x; this.pointY = y; } //Setters public void setPointX(int x) { this.pointX = x; } public void setPointY(int y) { this.pointY = y; } //Getters public int getPointX() { return this.pointX; } public int getPointY() { return this.pointY; } //toString for use with System.out.println() public String toString() { return "x = " + this.pointX + " y = " + this.pointY; } } PointTest public class PointTest { public static void main(String[] args){ System.out.println("Lab1 Point"); System.out.println("January 17, 2014"); System.out.println(); PointClass …
answers question: http://stackoverflow.com/q/21176122

http://stackoverflow.com/comment/31914299
type: AnswerComment
has text: @Amogh: What is the total amount of data you need? You have 4 GB, that's enough for maybe thousands of images. If the memory doesn't suffice, maybe the disk is fast enough to serve the images as needed (a latency of 1 second should be OK and a cheap disk throughput is some hundreds of MB/s).
score: 0
comment on: http://stackoverflow.com/a/21172597
type: Comment

http://stackoverflow.com/q/21138137
has title: Adding Uniqe ID (UUID) to an object
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/21138200
has body: In order to create a client object with a unique ID i was thinking of doing this (see below). Will this newly created object be assigned with a randomly generetad String and added to the object, and then the List? Will I be able to access it later? (Sorry for the incompetence). Have no way of testing as of yet. List&lt;Client&gt; newCli = new ArrayList&lt;Client&gt;(); String uniqueID = UUID.randomUUID().toString(); Client Client = new Client(name1, name2, addrName, addrNumber, post, city, uniqueID); newCli.add(Client); Client refers to a Class with variables and a constructor with the parameters as seen below. Thanks a bunch!
favorite count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/31810951
tagged with: object
type: AnsweredQuestion
tagged with: uuid
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21138200
has answer: http://stackoverflow.com/a/21138452
type: Question
tagged with: bank
answer count: 2
possible better answer: http://stackoverflow.com/a/21138452
downvote count: 0

http://stackoverflow.com/a/21161998
type: Answer
has body: So some tips to you 1 - Use equalsIgnoreCase instead of equals("Y")||!yOn.equals("y") 2 - remove the middle while you logic should be like follow main { read option do { process read option } while (continue ?) // validate here }
answers question: http://stackoverflow.com/q/21161816
has comment: http://stackoverflow.com/comment/31897641
score: 0

http://stackoverflow.com/q/21141508
tagged with: jpanel
has comment: http://stackoverflow.com/comment/31818002
has comment: http://stackoverflow.com/comment/31817067
has comment: http://stackoverflow.com/comment/31819077
score: 0
has body: how could i pass a String to JTextField() to search and from the console output show in the JPanel ?? Please help if any idea here.... Here is my code and i;m stuck doing show in the JPanel IO ... i ve tried many way to convert JTextField() to string to do so but didn't work .. Please help ... import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.net.URL; import java.net.URLEncoder; import java.util.List; import com.google.gson.Gson; public class test2 { public static void main(String[] args) throws IOException { for (int i = 0; i &lt; 20; i = i + 4) { String address = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&amp;start="+i+"&amp;q="; String query = "Programcreek"; String charset = "UTF-8"; URL url = new URL(address + URLEncoder.encode(query, charset)); Reader reader = new InputStreamReader(url.openStream(), charset); GoogleResults results = new Gson().fromJson(reader, GoogleResults.class); // Show title and URL of each results for (int m = 0; m &lt;= 3; m++) { System.out.println("Title: " + results.getResponseData().getResults().get(m).getTitle()); System.out.println("URL: " + results.getResponseData().getResults().get(m).getUrl() + "\n"); } } } } class GoogleResults{ private ResponseData responseData; public ResponseData getResponseData() { return responseData; } public void setResponseData(ResponseData responseData) { this.responseData = responseData; } public String toString() { return "ResponseData[" + responseData + "]"; } static class ResponseData { private List&lt;Result&gt; results; public List&lt;Result&gt; getResults() { return results;} public void setResults(List&lt;Result&gt; results) { this.results = results; } public String toString() { return "Results[" + results + "]"; } } static class Result { private String url; private String title; public String getUrl() { return url; } public String getTitle() { return title; } public void setUrl(String url) { this.url = url; } public void setTitle(St…
has comment: http://stackoverflow.com/comment/31819170
has comment: http://stackoverflow.com/comment/31819617
has title: How could i pass a String to JTextField() to search and from the console output show in the JPanel
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31819752
type: Question
tagged with: java

http://stackoverflow.com/q/21104454
has title: How to give Java input from python during runtime?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31750916
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31751102
tagged with: runtime
accepted answer: http://stackoverflow.com/a/21104548
score: 0
has comment: http://stackoverflow.com/comment/31750922
tagged with: communication
answer count: 1
has comment: http://stackoverflow.com/comment/31750938
has body: Lets say I have a java program which is running something. And then I run a python program, from java, what is the fastest way to give input back to java? I know that Jython can do what I am describing in a better way, but for the actual application I am working on I would rather not use Jython, if I can avoid it. Note: I have a text file based system working. I'm just curious if there is a faster way?
tagged with: python
has answer: http://stackoverflow.com/a/21104548

http://stackoverflow.com/a/21045136
has body: Thanks to mKorbel the new correct getHeaderTable method: public JTable getHeaderTable() { DefaultTableModel model = new DefaultTableModel() { private static final long serialVersionUID = 1L; @Override public int getColumnCount() { return 1; } @Override public boolean isCellEditable(int row, int col) { return false; } @Override public int getRowCount() { return table.getRowCount(); } @Override public Class&lt;?&gt; getColumnClass(int colNum) { switch (colNum) { case 0: return String.class; default: return super.getColumnClass(colNum); } } }; JTable headerTable = new JTable(model); for (int i = 0; i &lt; table.getRowCount(); i++) { headerTable.setValueAt((i + 1), i, 0); } headerTable.setPreferredScrollableViewportSize(new Dimension(40, 0)); headerTable.setRowHeight(20); return headerTable; }
has comment: http://stackoverflow.com/comment/31641532
answers question: http://stackoverflow.com/q/21041837
score: -1
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/31640748
upvote count: 0
has comment: http://stackoverflow.com/comment/31640273
has comment: http://stackoverflow.com/comment/31639983
has comment: http://stackoverflow.com/comment/31640071

http://stackoverflow.com/a/21039360
type: Answer
has comment: http://stackoverflow.com/comment/31655094
has comment: http://stackoverflow.com/comment/31656273
answers question: http://stackoverflow.com/q/21035283
has body: &lt;f:selectItems var="group" value="#{myBean.groups}" itemLabel="#{group.name}" itemValue="#{group.name}" /&gt; you can't specify selectItems this way. translation has to be bidirectional. use a converter! &lt;f:selectItems var="group" value="#{myBean.groups}" itemLabel="#{group.name}" itemValue="#{group}" converter="groupConverter"/&gt;
has comment: http://stackoverflow.com/comment/31649112
score: 0

http://stackoverflow.com/comment/31751879
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21103900
score: 0
has text: Ok I feel dumb now... I did what everyone said and turns out it worked... (originally I tried it but it didn't work, I don't know why :P)

http://stackoverflow.com/q/21125182
tagged with: swing
type: Question
tagged with: gridbaglayout
has body: I am making an IRC client, and I'm using a GridBagLayout so that when the window is resized, the JTextArea that displays messages will resize too. But whenever I try and alter the numbers, the components are always off one side of the screen (picture: https://i.sstatic.net/8HLWT.jpg). Here's the code: setSize(750, 550); setLocationRelativeTo(null); contentPane = new JPanel(); contentPane.setBackground(Color.LIGHT_GRAY); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); GridBagLayout gbl_contentPane = new GridBagLayout(); gbl_contentPane.columnWidths = new int[]{15, 680, 40, 15}; gbl_contentPane.rowHeights = new int[]{15, 480, 25, 30}; gbl_contentPane.columnWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE}; gbl_contentPane.rowWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE}; contentPane.setLayout(gbl_contentPane); The picture is a bit unclear, but the JTextArea, JButton and JTextField are all partly outside of the window. BTW I am using the windowbuilder plugin to make the GUI.
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21125323
accepted answer: http://stackoverflow.com/a/21125323
has title: Java GridBagLayout - components fall off the side
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: windowbuilder

http://stackoverflow.com/q/21058395
has comment: http://stackoverflow.com/comment/31669103
has comment: http://stackoverflow.com/comment/31665226
has comment: http://stackoverflow.com/comment/31665317
linked to: http://stackoverflow.com/q/5621338
tagged with: jscrollpane
has comment: http://stackoverflow.com/comment/31668608
has comment: http://stackoverflow.com/comment/31668740
accepted answer: http://stackoverflow.com/a/21058433
has comment: http://stackoverflow.com/comment/31670239
has comment: http://stackoverflow.com/comment/31668906
downvote count: 0
has comment: http://stackoverflow.com/comment/31668863
has comment: http://stackoverflow.com/comment/31665687
tagged with: layout-manager
has comment: http://stackoverflow.com/comment/31668465
has body: I have been trying to get a scroll bar on my JTextArea for days, I've tried every way to do it as I could find. I am making a Chat Client and I have the JPanel setup with a null layout. I've tried using the Layout Managers but I don't understand how to get it to look the way I want. I just want a scroll bar on the text area. I'm a beginner and for what I've read it isn't possible to have one with a null layout? I'm open to help changing the layout if that's easier also. package guiserver; import com.apple.eawt.Application; import java.awt.Canvas; import java.awt.Color; import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.Image; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.WindowConstants; public class GUIserver extends JFrame implements ActionListener { JFrame login = new JFrame(); JPanel panel = new JPanel(); JPanel main = new JPanel(); JFrame accept = new JFrame(); JPanel acpt = new JPanel(); JPanel buttonpanel = new JPanel(); JButton acceptinvite = new JButton("Accept Invite"); JButton denyinvite = new JButton("Deny Invite"); JLabel acceptlabel = new JLabel(); JLabel acceptname = new JLabel(); JPanel loginpanel = new JPanel(); JTextArea chat = new JTextArea(" Waiting to Start Client..."); JSplitPane chatsplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT); JTextField input = new JTextField(); JScrollPane pane = new JScrollPane(chat); JButton send = new JButton("Send"); JLabel …
has comment: http://stackoverflow.com/comment/31668915
has comment: http://stackoverflow.com/comment/31668815
answer count: 3
has comment: http://stackoverflow.com/comment/31668342
has answer: http://stackoverflow.com/a/21058434
has answer: http://stackoverflow.com/a/21059104
has comment: http://stackoverflow.com/comment/31665234
has comment: http://stackoverflow.com/comment/31666344
has comment: http://stackoverflow.com/comment/31668051
favorite count: 0
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
possible better answer: http://stackoverflow.com/a/21058434
has comment: http://stackoverflow.com/comment/31670300
tagged with: null-layout-manager
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/31665707
has comment: http://stackoverflow.com/comment/31668974
has title: How do I add a scroll bar in a null layout?
type: Question
has comment: http://stackoverflow.com/comment/31668005
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21058433
has comment: http://stackoverflow.com/comment/31668581

http://stackoverflow.com/comment/31918309
type: Comment
comment on: http://stackoverflow.com/a/21150073
has text: @user3200294 Your praise is all I need. :)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/77559440
has text: since java is not a daemon and runs on demand, how to restart jvm?
type: Comment
score: 2
comment on: http://stackoverflow.com/a/36427118
type: AnswerComment

http://stackoverflow.com/comment/32916943
comment on: http://stackoverflow.com/a/21090891
score: 0
type: AnswerComment
has text: Thanks Denis, that was indeed the issue, the profiler attached properly once I configured Eclipse to launch with java.exe.
type: Comment

http://stackoverflow.com/a/21157111
score: 4
answers question: http://stackoverflow.com/q/21156992
has body: You can use the Eclipse compiler from IntelliJ IDEA. Enable the Eclipse compiler from Settings -> Compiler -> Java Compiler: "Use compiler:" (change from Javac to Eclipse). update: Here's my compilation times for a full rebuild, using IntelliJ IDEA 13 on a fairly large project: Using javac 1.7.0_45 to compile java sources Compilation completed successfully with 60 warnings in 27 sec Using eclipse compiler to compile java sources Compilation completed successfully with 652 warnings in 26 sec So there seems to be something strange with your setup.
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/31698790
type: Comment
has text: But... but... what? I went to the effort of writing out some code that I thought might help determine where the problem is, and all you can say is 'I did try it, but...', and leave me guessing at what actually happened. **By not answering the questions I'm asking you you are making it very difficult to help you.**
comment on: http://stackoverflow.com/a/21076013
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31956550
comment on: http://stackoverflow.com/q/21146290
has text: Yes, it was checked. I just restarted the server manually and SSL worked. Thanks for your answer.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21059979
type: Question
accepted answer: http://stackoverflow.com/a/21060023
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21060023
tagged with: windows
has comment: http://stackoverflow.com/comment/31667804
has body: I wonder how windows cuts a file into another location ? does it change the file path only? or transfer the whole file data? can you write a program in java to cut files in a fast way ?
has comment: http://stackoverflow.com/comment/31667877
tagged with: file
has comment: http://stackoverflow.com/comment/31667808
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31667797
has title: how windows cuts a file, change path or transfer full data

http://stackoverflow.com/a/21045295
upvote count: 1
downvote count: 1
type: AcceptedAnswer
has body: For PreferenceActivity (deprecated with Fragment), try: ListPreference lp = (ListPreference) this.findPreference(this.getString(R.string.my_key)); lp.getValue(); Where my_key is the key value assigned to this ListPreference. Note: This value is defined in strings.xml. If you have hard-coded your key with a literal string, then substitute my_key with whichever string you've given for the android:key tag. So, in your case, the codes will be: ListPreference lp = (ListPreference) this.findPreference("interval"); lp.getValue();
type: Answer
has comment: http://stackoverflow.com/comment/71585548
accepted answer of: http://stackoverflow.com/q/21044126
answers question: http://stackoverflow.com/q/21044126
score: 0

http://stackoverflow.com/comment/31781658
type: AnswerComment
has text: @user3194834 The instruction link was incorrect. My apologies. The correct link has been updated in my answer.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21121092

http://stackoverflow.com/q/21019585
tagged with: java
has comment: http://stackoverflow.com/comment/31594596
tagged with: mysql
type: Question
score: 0
has comment: http://stackoverflow.com/comment/31594176
tagged with: jdbc
has comment: http://stackoverflow.com/comment/31595043
has body: I have a problem with connecting to online database with JDBC. This is a list of what I have done up to now: I have created a data base, I have created a data base user, I have add this user to database with all privileges, After that I fill my data base with data using Import option and .sql file: http://www41.zippyshare.com/v/70987939/file.html When I want to connect to my database I get an error: Access denied for user 'user_name'@'xx.xx.xx.xxx' (using password: YES) . Where xx.xx.xx.xxx is IP adress Here is a code of my connecting method: public String connectWithDataBase(int type) throws SQLException { String user = DB.login.getLoginData(type).getLogin(); String password = DB.login.getLoginData(type).getPassword(); String result = null; connectionStatus = false; if (connection == null || connection.isClosed()) { try { Class.forName(DB.baseConfig.DATA_BASE_DRIVER_NAME).newInstance(); connection = DriverManager.getConnection( DB.baseConfig.DATA_BASE_ONLINE_URL, user, password); operation = connection.createStatement(); result = "Connecting succesfull!"; connectionStatus = true; } catch (ClassNotFoundException e) { result = "Driver error."; } catch (SQLException e) { result = "Can't connect to database."; System.out.println(e.getMessage()); e.printStackTrace(); } catch (InstantiationException | IllegalAccessException ex) { result = "Conection error."; } } return result; } A body of class with Config: // Name public final String DATA_BASE_ONLINE = "xxx_zzz"; // Config data public final String ONLINE_DATA_BASE_PORT = "xxx.yyy.pl:3306"; public final String ONLINE_DATA_BASE_TYPE = "mysql"; public final String ONLINE_DATA_BASE_DRIVER_NAME = "com.mysql.jdbc.Driver"; public final String ONLINE_DATA_BASE_ENCODING = "?useUnicode=true&amp;characterEncoding=utf8"; // B. WAŻNE!!! // Online base URL: public final String DATA_BASE_ONLINE_URL = "jdbc:" + ONLINE_DATA_BASE_TYPE + "://" + ONLINE_DATA_BASE_PORT + "/" + DATA_BASE_ONLINE + ONLINE_DATA_BASE_ENCODING; And class with Log…
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31594196
has comment: http://stackoverflow.com/comment/31595040
has comment: http://stackoverflow.com/comment/31595091
has title: Java - JDBC - Access denied for user

http://stackoverflow.com/comment/31861141
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21165208
has text: MyLib.jar is added to MyApplication project that is built into .war file. I don't add A.jar and B.jar to this project.

http://stackoverflow.com/comment/31863060
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21166025
has text: This does work indeed, but I'm not sure I'll be able to catch the different groups (using Java)! Thank you for your answer ClasG :)

toast
tags question: http://stackoverflow.com/q/21075484
tag name: toast
type: Tag

algorithm
tags question: http://stackoverflow.com/q/21058411
tags question: http://stackoverflow.com/q/21139851
tag name: algorithm
tags question: http://stackoverflow.com/q/21067844
tags question: http://stackoverflow.com/q/21150516
tags question: http://stackoverflow.com/q/21067473
tags question: http://stackoverflow.com/q/21034597
tags question: http://stackoverflow.com/q/21117636
tags question: http://stackoverflow.com/q/21134720
tags question: http://stackoverflow.com/q/21173541
tags question: http://stackoverflow.com/q/21032867
tags question: http://stackoverflow.com/q/21117671
tags question: http://stackoverflow.com/q/21149149
tags question: http://stackoverflow.com/q/21132816
tags question: http://stackoverflow.com/q/21154670
tags question: http://stackoverflow.com/q/21111070
tags question: http://stackoverflow.com/q/21078789
tags question: http://stackoverflow.com/q/21061667
type: Tag
tags question: http://stackoverflow.com/q/21142847
tags question: http://stackoverflow.com/q/21161416
tags question: http://stackoverflow.com/q/21056457
tags question: http://stackoverflow.com/q/21023506
tags question: http://stackoverflow.com/q/21070506
tags question: http://stackoverflow.com/q/21097316
tags question: http://stackoverflow.com/q/21174683
tags question: http://stackoverflow.com/q/21096363
tags question: http://stackoverflow.com/q/21167899
tags question: http://stackoverflow.com/q/21152913
tags question: http://stackoverflow.com/q/21147921
tags question: http://stackoverflow.com/q/21023348
tags question: http://stackoverflow.com/q/21077776
tags question: http://stackoverflow.com/q/21024296
tags question: http://stackoverflow.com/q/21046446
tags question: http://stackoverflow.com/q/21151191
tags question: http://stackoverflow.com/q/21162580
tags question: http://stackoverflow.com/q/21057827
tags question: http://stackoverflow.com/q/21058575
tags question: http://stackoverflow.com/q/21098413

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/21078092
type: Tag
tags question: http://stackoverflow.com/q/21113348

http://stackoverflow.com/comment/31874773
score: 0
type: AnswerComment
type: Comment
has text: what is not ideal here? The second message is when test **should fail**! :) This is simply beautiful!
comment on: http://stackoverflow.com/a/21172873

http://stackoverflow.com/a/21798413
score: 1
upvote count: 1
has body: The issue turned out to be the native-file watcher being out-of-date. IntelliJ was re indexing my whole drive it seems. Was fixed by uninstalling the version gotten from Canonical's ppa and installing directly from JetBrain's own webpage.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21163869
type: Answer
accepted answer of: http://stackoverflow.com/q/21163869

http://stackoverflow.com/a/21110544
answers question: http://stackoverflow.com/q/21110512
has body: Use the Temporal annotation: @Temporal(TemporalType.DATE) private Date date; There are also TIME and TIMESTAMP TemporalTypes. TIMESTAMP is the default. EDIT. You can also use one of the appropriate SQL types: java.sql.Date, java.sql.Time or java.sql.Timestamp. The DB mapping is identical, whether you use java.util.Date with annotations or java.sql.* Using java.util.Date gives you a consistent interface regardless of the physical DB mapping while sql types may make your intent clearer.
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/21110512
downvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/59915784
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/59916624
has comment: http://stackoverflow.com/comment/59922740

http://stackoverflow.com/comment/31823887
type: Comment
comment on: http://stackoverflow.com/a/21127658
has text: Well, the comment section isn't probably long enough for me to describe another full solution. Based on what you are saying, it seems you need to change your ArrayList to: `public List<Double> products = new ArrayList<Double> ()` And then, instead of adding a Product you add it's price: `products.add(p.getPrecio())`
type: AnswerComment
score: 0

http://stackoverflow.com/a/21069394
type: Answer
has body: Well, first thing that comes into my mind is that others don't have to work on Foo class. They should subclass it, so they will be forced to use your public final void setBarOnlyOnce(Bar bar) method, for setting private Bar bar;.
score: 0
answers question: http://stackoverflow.com/q/21069340

http://stackoverflow.com/comment/31672841
has text: @HotLicks: there is 0 reason to transform anything. The ViewDepartment object should be passed as attribute to the model. There's no need to pass each of its fields independently.
score: 0
comment on: http://stackoverflow.com/q/21062625
type: QuestionComment
type: Comment

http://stackoverflow.com/a/21048499
upvote count: 2
answers question: http://stackoverflow.com/q/21048182
type: Answer
has body: If you'd define the groups and items like this, it should get you a step farther: abstract class Group&lt;I extends Item&lt;? extends Group&lt;I&gt;&gt;&gt; abstract class Item&lt;G extends Group&lt;? extends Item&lt;G&gt;&gt;&gt; This should result in the following: class AGroup extends Group&lt;AItem&gt;{} class AItem extends Item&lt;AGroup&gt;{} //doesn't work since the item could only be added to MixedGroup instances //but MixedGroup only accepts AItem instances class MixedItem extends Item&lt;MixedGroup&gt;{} //works since the item might be added to any AGroup class MixedItem2 extends Item&lt;AGroup&gt;{} //works, since AItem can be added to any AGroup (and MixedGroup is a Subclass) class MixedGroup extends Group&lt;AItem&gt; {}
score: 2
downvote count: 0

program-entry-point
tags question: http://stackoverflow.com/q/21043362
tags question: http://stackoverflow.com/q/21105449
tag name: program-entry-point
tags question: http://stackoverflow.com/q/21070181
tags question: http://stackoverflow.com/q/21075444
tags question: http://stackoverflow.com/q/21046193
tags question: http://stackoverflow.com/q/21038521
type: Tag
tags question: http://stackoverflow.com/q/21143028
tags question: http://stackoverflow.com/q/21034182

http://stackoverflow.com/comment/31784096
score: 1
has text: @ the OP - Try posting some more code for us to see, including where this class is being instantiated, etc. It may provide clues as-to where the problem lies.
comment on: http://stackoverflow.com/q/21122851
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21086175
has comment: http://stackoverflow.com/comment/31717635
type: Answer
has body: You have to differentiate between the logical level and the implementation level. From a logical point of view, the variable is not really 'created' or 'destroyed', but that's how you could probably imagine it. The variable is simply declared within some scope, so it's guaranteed to exist (you can assign to it and read its value), it's initialized at the beginning of the block (so it has the value 0) and it isn't visible outside the code block. Thats what the language definition says. In C++, if you omit the initialization (i.e. the =0 part), the language doesn't make any assumption about what the value is (so the compiler is free to "reuse" the memory location). In Java, afair, the initialization is implicit, so a will also be set to zero, if you omit the initialization. At implementation level, the compiler is more or less free to do whatever it wants, as long as it fulfills the above specifications. So in practise, it will most likely reserve some space on the stack and use this same memory for every iteration to store the value of a. Since you've used an initializer, the value 0 will be written to this location at the beginning of every loop. Note, that if a isn't used within the scope, the compiler is also free to simply optimize it away. Or, if possible, it can assign it to a CPU register. However, theoretically, a compiler could also reserve a "new" memory location for a in every iteration and clear all of them at the end of the loop (although this could result in StackOverflow (!) for long loops...). Or use garbage-collected dynamic memory allocation (which would result in poor performance...).
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/21085963
answers question: http://stackoverflow.com/q/21085963
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21042882
has body: You should use em.createNamedQuery("query name") ...
has comment: http://stackoverflow.com/comment/31635849
has comment: http://stackoverflow.com/comment/31636867
type: Answer
accepted answer of: http://stackoverflow.com/q/21042843
answers question: http://stackoverflow.com/q/21042843
has comment: http://stackoverflow.com/comment/31635922
has comment: http://stackoverflow.com/comment/31636019
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/32389217
has text: @Springrbua OK, no problem i will in a second.
score: 0
comment on: http://stackoverflow.com/q/21068027
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31852739
type: QuestionComment
has text: Look into the `Matcher` class. You will a two relevant methods to be used here.
score: 1
comment on: http://stackoverflow.com/q/21160895
type: Comment

http://stackoverflow.com/a/21108196
has body: You need to add the relevant object to an existing paragraph, or a new paragraph. To do that, add it to the relevant content list. Please read docx4j's Getting Started on how to do that, then update your question with what you've tried if you have difficulties. As to the relevant object, you can upload a short docx containing the relevant field to webapp.docx4java.org/OnlineDemo/PartsList.html then click through to see the XML, and code to generate it. Note, in this case you'll want the run containing field "start", through to the field "end". If you have problems, you can update your question to show the XML, and the generated code.
upvote count: 1
has comment: http://stackoverflow.com/comment/31841120
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21107327

http://stackoverflow.com/comment/31793735
score: 0
comment on: http://stackoverflow.com/q/21128119
type: QuestionComment
type: Comment
has text: ["some", null, "string", "like", "elements"]

http://stackoverflow.com/a/21022082
type: Answer
score: 3
downvote count: 0
has body: I prefer this idiom for (String curLine; (curLine=reader1.readLine()) != null;) { System.out.println(curLine); } it's good because curLine var is needed only inside loop
upvote count: 3
answers question: http://stackoverflow.com/q/21021915

http://stackoverflow.com/a/25971924
score: 0
has comment: http://stackoverflow.com/comment/40687236
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21166567
has comment: http://stackoverflow.com/comment/40666891
accepted answer of: http://stackoverflow.com/q/21166567
has body: An HTTP error of 500 to 599 (although only very few numbers are actually used) is different from the more known 4xx errors. The 4xx errors indicate that YOU as the client have done something wrong and you should modify your request, so that the server can fulfill ist - the most prominent error is 404 web page not found (more precise object not found). A 5xx error on the other hand indicates a server error. That means, you probably did everything right, but the server is unable to handle your request. With 4xx errors you could continue issuing your request till the end of all days, it won't work. With 5xx errors it could, at some point, work - examples include heavy load on the server typically resulting in a 500 (internal server error).

porting
tags question: http://stackoverflow.com/q/21137547
tag name: porting
type: Tag

http://stackoverflow.com/a/21098691
has comment: http://stackoverflow.com/comment/31739571
has comment: http://stackoverflow.com/comment/31742697
has comment: http://stackoverflow.com/comment/31759055
has comment: http://stackoverflow.com/comment/31739493
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21096276
has comment: http://stackoverflow.com/comment/31739444
downvote count: 0
has body: Others have mentioned that the loop does not end because you are not changing the value of s, so the loop never ends. This may be what your professor intended, and it may not be. Bad code is bad practice, as a rule, but there are other reasons why this is bad practice. What jumped out to me as being bad practice here, and what the professor could have intended, is the use of a for loop here. As my professor told me, "For loops are for when you know when you want the code to end, while loops are for when you don't know when you want the code to end." So if you have an iterable i such as this code: for(i = 0; i&lt;100; i++) { ... } In this code, you know that you want to iterate i from 0 to 100. A while loop is what you would want to use in the situation your professor is discussing. int counter; while(*(str+counter)) counter++; You have no idea when the loop is going to end, because you don't know how long the str is, but you know that sometime it will get to the null pointer, and the loop will terminate. This generally what is best practice. So for the code your professor posted, you may want it to look like this: Scanner in = new Scanner(System.in); int i = 0; while(!s.equals("end")) { i++; String s = in.next(); System.out.println("The value of i is: " + i + " and you entered " + s); }

http://stackoverflow.com/a/21112099
answers question: http://stackoverflow.com/q/21112050
downvote count: 0
has comment: http://stackoverflow.com/comment/31763496
has comment: http://stackoverflow.com/comment/31763571
has comment: http://stackoverflow.com/comment/31763537
has body: You only have to use modulu and edit your cases: switch (dayNumber%7) { case 1: return "Sunday"; case 2: return "Monday"; case 3: return "Tuesday"; case 4: return "Wednesday"; case 5: return "Thursday"; case 6: return "Friday"; case 0: //change case 7 to case 0 return "Saturday"; default: return "N/A"; }
upvote count: 3
has comment: http://stackoverflow.com/comment/31763542
has comment: http://stackoverflow.com/comment/31763534
type: Answer
score: 3

http://stackoverflow.com/a/21066221
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21064030
has body: You need to do the following inside of the while loop: while (some condition is not met) // 1) Compute the gradient using theta0 and theta1 // 2) Use the gradient to compute newTheta0 and newTheta1 values // 3) Set theta0 = newTheta0 and theta1 = newTheta1 You can use several different criteria for terminating the gradient descent search. For example, you can run gradient descent For a fixed number of iterations Until the gradient value at (theta0, theta1) is sufficiently close to zero (indicating a minimum) Each iteration you should get closer and closer to the optimal solution. That is, if you compute the error (how well your theta0, theta1 model predicts your data) for each iteration it should get smaller and smaller. To learn more about how to actually write this code, you can refer to: https://www.youtube.com/watch?v=CGHDsi_l8F4&amp;list=PLnnr1O8OWc6ajN_fNcSUz9k5gF_E9huF0 https://www.youtube.com/watch?v=kjes46vP5m8&amp;list=PLnnr1O8OWc6asSH0wOMn5JjgSlqNiK2C4
downvote count: 0
type: Answer

http://stackoverflow.com/q/21073313
has comment: http://stackoverflow.com/comment/31692443
has answer: http://stackoverflow.com/a/21073559
has comment: http://stackoverflow.com/comment/31693212
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31692470
tagged with: button
has comment: http://stackoverflow.com/comment/31692453
linked to: http://stackoverflow.com/q/7702697
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/31692873
type: Question
has body: I'd like to make a grid in a JPanel full of buttons, then i want to create them in a loop because i've aproximatly 100 buttons. Each button created must have an id differents see my picture to understand better :s I think I have to create a method like this but I don't know how to proceed : public Button(String text , int id){ //code } And then add it to a loop to create the grid :) if anyone can help me it would be very appreciated ! ;)
downvote count: 2
tagged with: swing
tagged with: java
has comment: http://stackoverflow.com/comment/31692500
upvote count: 1
tagged with: loops
answer count: 1
tagged with: grid
has title: Java Grid with button + id to each button

http://stackoverflow.com/comment/31754639
has text: I have a question that is very similar to this here: http://stackoverflow.com/questions/21106626/how-are-the-appropriate-methods-of-mousemotionlistener-in-java-swing
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21104884
type: Comment

http://stackoverflow.com/comment/31652138
comment on: http://stackoverflow.com/q/21049914
score: 0
type: Comment
type: QuestionComment
has text: device=vs980 (That's the vzw model)

http://stackoverflow.com/a/21171699
type: Answer
has body: The Amazon t1.micro instance has only 0.6xx GiB memory so choose permgen size carefully and you need a very strict memory management. The "-XX:MaxPermSize=512m" is a bit big, but you can play with the settings in smaller steps. In java 7 permgen is storing the loaded classes, so you don't need to specify too high value for them (except you created a gigantic app :) ). The default size is 64m, but it looks like not enough to you. Increase it in 32m steps to find the proper size. When it stable and runs properly add an extra 32m to leave some extra space for longer run.
answers question: http://stackoverflow.com/q/21170458
score: 1
has comment: http://stackoverflow.com/comment/31872732
has comment: http://stackoverflow.com/comment/31873498
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/21082363
tagged with: java
type: Question
answer count: 1
tagged with: applet
has body: I just finished making a Java applet and it works on my localhost server, however, I want to upload it to my blog on wordpress. How should I go about doing that? I've never done it before, it's my first time, so help is greatly appreciated. Do I upload my .class files to wordpress, or do I upload them somewhere else and link them in my HTML file? If I do upload them to a different server, I'm not sure how to link to them. If anyone knows of a tutorial or is willing to tell me how to go about doing this it would be much appreciated.
score: 0
tagged with: deployment
has answer: http://stackoverflow.com/a/21107111
type: UnansweredQuestion
tagged with: wordpress
has title: Applet on wordpress blog

http://stackoverflow.com/q/21174637
has comment: http://stackoverflow.com/comment/31878578
possible better answer: http://stackoverflow.com/a/21174747
type: AnsweredQuestion
upvote count: 0
accepted answer: http://stackoverflow.com/a/21175394
has answer: http://stackoverflow.com/a/21174747
has comment: http://stackoverflow.com/comment/31878044
has comment: http://stackoverflow.com/comment/31878680
favorite count: 0
has body: I want to get some values from a JSON using this url:http://api.bitcoincharts.com/v1/markets.json. Im using quick-json to parse it the problem is i don't know how to do it since JSON is very confusing to me in JAVA. I want to get the values that you get here http://api.bitcoincharts.com/v1/markets.json and put them in Hashmap... so i can retrieve them by keys using quick-json for parsing ... can anyone help me tell me how should i proceed using the following code? import com.json.parsers.JSONParser; import com.json.parsers.JsonParserFactory; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.Map; import sun.org.mozilla.javascript.internal.json.JsonParser; public class Restfultest { public static float [] lastprice = new float[5000]; public static float [] amounttraded = new float[5000]; public static String allvalue; public static int value = 0; public static String [] s = new String[4]; public static void main(String[] args) { try { URL url = new URL("http://api.bitcoincharts.com/v1/markets.json"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setRequestProperty("Accept", "application/json"); if (conn.getResponseCode() != 200) { throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode()); } /* BufferedReader br = new BufferedReader(new InputStreamReader( (conn.getInputStream())));*/ JsonParserFactory factory=JsonParserFactory.getInstance(); JSONParser parser=factory.newJsonParser(); Map jsonData=parser.parse(conn.getInputStream()); /*Gives error because of conn.getInputStream*/ /* parsing... */ conn.disconnect(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } the error i get in that line its because the object i put in parse i…
type: Question
has comment: http://stackoverflow.com/comment/31878312
has comment: http://stackoverflow.com/comment/31878092
has comment: http://stackoverflow.com/comment/31878584
score: -1
has comment: http://stackoverflow.com/comment/31878362
answer count: 3
has answer: http://stackoverflow.com/a/21175394
has comment: http://stackoverflow.com/comment/31878222
has title: Java JSON connection and parsing
downvote count: 1
has answer: http://stackoverflow.com/a/21174732
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/31878162
linked to: http://stackoverflow.com/q/309424

http://stackoverflow.com/q/21138079
type: Question
tagged with: javacard
linked to: http://stackoverflow.com/q/4157303
has comment: http://stackoverflow.com/comment/32073972
tagged with: batch-file
duplicate of: http://stackoverflow.com/q/4157303
has comment: http://stackoverflow.com/comment/31819528
has comment: http://stackoverflow.com/comment/31856814
has comment: http://stackoverflow.com/comment/31847945
downvote count: 0
answer count: 1
tagged with: shell
has comment: http://stackoverflow.com/comment/31880002
has answer: http://stackoverflow.com/a/21300596
has comment: http://stackoverflow.com/comment/31858698
favorite count: 0
has comment: http://stackoverflow.com/comment/31985610
has comment: http://stackoverflow.com/comment/31893985
has comment: http://stackoverflow.com/comment/31851914
type: AnsweredQuestion
has body: I am trying to create a desktop application (created in java) which will internally run jcshell (tool from NXP which is used to interact with secure element SD card from computer) and produce the output. In jcshell I will be running script file. So this desktop application also should start jcshell internally and run the script file. I have executed JCOP shell commands which will communicate to secure element SD card through JCOP shell tool (jcshell.bat) provided by JCOP(NXP). Now I need to create a windows desktop application through which I should be able to run JCOP shell commands through jcshell.bat. Process processObj = Runtime.getRuntime().exec("cmd /C dir"); The above code will return same output from command prompt as well as from my custom java desktop application with details of the directory. I am looking for something similar , but could not get jcshell.bat running from my JavaDesktopApplication. Any help on the above will be really appreciated I have tried to work with ProcessBuilder also in the following way, but could not get the expected output.In the following arraylist, first element is the path of my batch file and second element is the location of script file.My intention is to run the script file through windows application which is jcshell.bat which I used to run with the tool given by JCOP.Following is the code using ProcessBuilder. ArrayList commandList = new ArrayList&lt;String&gt;(); commandList.add("C:\\Program Files\\NXP Semiconductors\\JCShell\\jcshell.bat"); commandList.add("./scripts/javatest.jcsh");‌​‌​ ProcessBuilder pb = new ProcessBuilder(commandList); pb.redirectErrorStream(true); Process p = pb.start(); String s; BufferedReader stdout = new BufferedReader(new InputStreamReader(p.getInputStream())); while ((s = stdout.readLine()) != null &amp;&amp; !isCancelled()) { publish(s); System.out.println("OUTPUT == " + s); } if (!isCancelled()) { status = p.waitFor(); } p.getInputStream().close(); p.getOutputStream().close(); p.destroy();
has title: How to start JCOPShell (jcshell.bat) which is an NXP product from a custom Java Desktop Application
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/21300596
upvote count: 1
tagged with: swing

http://stackoverflow.com/q/21142031
answer count: 6
has answer: http://stackoverflow.com/a/21142166
has answer: http://stackoverflow.com/a/21142692
has title: Generate an array of random integers with non-uniform distribution
tagged with: random
has answer: http://stackoverflow.com/a/21142406
has comment: http://stackoverflow.com/comment/31818545
tagged with: probability-density
favorite count: 0
has answer: http://stackoverflow.com/a/21145356
has answer: http://stackoverflow.com/a/21142305
has comment: http://stackoverflow.com/comment/31818786
upvote count: 2
accepted answer: http://stackoverflow.com/a/21142166
possible better answer: http://stackoverflow.com/a/21142305
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21142311
score: 1
tagged with: java
tagged with: non-uniform-distribution
linked to: http://stackoverflow.com/q/977354
type: Question
has body: I want to write Java code to produce an array of random integers in the range [1,4]. The array's length is N, which is provided at run time. The problem is that the range [1,4] is not uniformly distributed: It means that if I create arrays with N=100, the number '1' will appear averagely 40 times in an array, number '2' 10 times, and so on. For now I am using this code to generate uniform-distributed random numbers in range [1,4]: public static void main(String[] args) { int N; System.out.println(); System.out.print("Enter an integer number: "); N = input.nextInt(); int[] a = new int[N]; Random generator = new Random(); for(int i = 0; i &lt; a.length; i++) { a[i] = generator.nextInt(4)+1; } } How do I implement it with a the non-uniform distribution as shown in the graph above?
tagged with: arrays

http://stackoverflow.com/comment/31697702
score: 0
type: Comment
type: QuestionComment
has text: You can consume Content only at once from an Entity. But you have `yourEntity.consumeContent();` and this `return yourEntity.getContent();` and more. So i guess that is why the excpetion
comment on: http://stackoverflow.com/q/21076207

http://stackoverflow.com/comment/31629313
has text: @aut_silvia Still you are getting the same error? and what is logInfo in your code?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21038384
score: 0

http://stackoverflow.com/q/21182126
has answer: http://stackoverflow.com/a/21183412
tagged with: chat
score: 0
has comment: http://stackoverflow.com/comment/31892162
answer count: 1
type: UnansweredQuestion
tagged with: sockets
has title: Reset Socket input stream in Java
tagged with: reset
has comment: http://stackoverflow.com/comment/31892225
tagged with: java
tagged with: stream
has comment: http://stackoverflow.com/comment/31892180
has comment: http://stackoverflow.com/comment/31892916
has comment: http://stackoverflow.com/comment/31891918
type: Question
has comment: http://stackoverflow.com/comment/31892607
has body: I am developing chat application in Java, allowing more users to connect to server. I managed to establish communication between clients, but the problem is when client sends message for the first time server recieves it and send it to destination client. But when the same client sends message for second time (and so on) server recieves message it receieved for the first time, so destination client is recieving the same message over and over again... I send object of type Message which I defined in another class.. I googled a little bit, and found out, that the problem is in stream and it should be reseted after each data had gone through stream. Output stream is possible to reset, but it doesent help. When I try to reset input stream I get an error. I runned out of ideas, has anybody got one?

http://stackoverflow.com/q/21022554
has comment: http://stackoverflow.com/comment/31599748
has answer: http://stackoverflow.com/a/21022750
tagged with: audio
has body: The smallest unit of a digital image is a pixel. What is the smallest unit of digital sound? what can be considered to be a pixel for sound? How can we use java to manipulate it?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21022950
has comment: http://stackoverflow.com/comment/31599706
tagged with: java
has title: Audio manipulation with Java
has comment: http://stackoverflow.com/comment/31601326
type: Question
linked to: http://stackoverflow.com/q/7782721
has comment: http://stackoverflow.com/comment/31599999
score: 4
accepted answer: http://stackoverflow.com/a/21022950
upvote count: 4
answer count: 3
has comment: http://stackoverflow.com/comment/31599648
has comment: http://stackoverflow.com/comment/31604780
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31601956
tagged with: javasound
possible better answer: http://stackoverflow.com/a/21022977
has comment: http://stackoverflow.com/comment/31606216
has comment: http://stackoverflow.com/comment/31606514
has answer: http://stackoverflow.com/a/21022977

http://stackoverflow.com/q/21135426
has title: reading empty rows between data using apache poi
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21155168
has comment: http://stackoverflow.com/comment/31806481
has answer: http://stackoverflow.com/a/21136115
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/31806512
tagged with: apache-poi
has body: my excel sheet has following data 1234556 gold 1234456 silver null null 4455455 platinum how will i read this entire empty rows using missing cellpolicies? i tried coding using missing cellpolicy but couldn't get the required output. for (int rowNum = rowStart; rowNum &lt; rowEnd; rowNum++) { List cellTempList = new ArrayList(); Row r = hssfSheet.getRow(rowNum); int lastColumn = Math.max(r.getLastCellNum(), 2); if(r.getRowNum()==0||r.getRowNum()&lt;=i){ continue; //just skip the rows if row number is 0 or 1 } for (int cn = 0; cn &lt; lastColumn; cn++) { Row row = hssfSheet.getRow(rowNum); Cell cell = row.getCell(cn, Row.CREATE_NULL_AS_BLANK); // Cell cell = row.getCell(cn, Row.RETURN_NULL_AND_BLANK); //if(row.getCell(cn)==null){ //cellTempList.add("Null"); if(cell.getCellType()==cell.CELL_TYPE_NUMERIC &amp;&amp; cell.getColumnIndex()==0 ) {//call phone number validation method DecimalFormat df = new DecimalFormat("#"); String cellValue=df.format(cell.getNumericCellValue()); cellTempList.add(cellValue.toString()); logger.debug("Adding cell having string to "+cellTempList); } else if(cell.getCellType()==Cell.CELL_TYPE_STRING) {//call string validation method cellTempList.add(cell.toString()); logger.debug("Adding cell having string to "+cellTempList); } else{cellTempList.add(cell.toString()+"-"); //errorList.add(cell.getErrorCellValue()); errorList.add(cell.getRowIndex() + "$" + cell.getColumnIndex()+ "$" ); System.out.println(errorList); } }cellDataList.add(cellTempList); } } System.out.println(cellDataList); using this code its printing only 2 rows above empty row leaving 4th row to print..? help me
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21158540

amazon-elastic-beanstalk
tag name: amazon-elastic-beanstalk
tags question: http://stackoverflow.com/q/21095991
type: Tag

http://stackoverflow.com/q/21181533
has title: Remove Object from ArrayList based on User Input
has body: I have an object that looks like this: Account account = new Account (0, fName, sName, adr, city, pos, uniqueID); I then put that object, via user input, to an ArrayList: List&lt;Account&gt; newAcc = new ArrayList&lt;Account&gt;(); Here's the problem. I need a slick way to remove that object based on user input. This is what I've tried: System.out.print("1. Client with Accounts.\n2. Client with Savings Accounts.\n3. Remove all Accounts.\n"); int inputRmv = in.nextInt(); case 1: for (Iterator i = newAcc.iterator(); i.hasNext(); ) { if (i.equals(rmvID)) { newAcc.remove(i); This doesn't work. The object isn't removed this way. Basically: is there a way to use user input and then iterate through the list to see if any object contains a string equivalent to any part of the object? I am in dire need, so any help to send me in the right direction is immensely appreciated! Cheers.
possible better answer: http://stackoverflow.com/a/21181862
has answer: http://stackoverflow.com/a/21181862
tagged with: object
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31890375
tagged with: java
has answer: http://stackoverflow.com/a/21181556
accepted answer: http://stackoverflow.com/a/21181556
type: Question
tagged with: iterator
answer count: 2
tagged with: arraylist
score: 0

http://stackoverflow.com/comment/31656564
score: 0
type: Comment
has text: I'm not sure I understand what you are saying. Obviously OP doesn't know Spring very well, but this answer does not help.
comment on: http://stackoverflow.com/a/21051598
type: AnswerComment

http://stackoverflow.com/comment/31662570
score: 0
type: Comment
type: QuestionComment
has text: Tested using a simple gradient filled png and works fine for me. It's possible I'm also missing something, but wouldn't `Color#getRGB` do the same packing as you are doing?
comment on: http://stackoverflow.com/q/21056840

http://stackoverflow.com/comment/31705713
comment on: http://stackoverflow.com/q/21080408
score: 2
has text: The code doesn't compile... Add an import for the `java.io. FileNotFoundException`.
type: QuestionComment
type: Comment

code-generation
tag name: code-generation
type: Tag
tags question: http://stackoverflow.com/q/21115063
tags question: http://stackoverflow.com/q/21164901

http://stackoverflow.com/comment/31789377
has text: @Avempace: Went back to add links, and thought...hmmm, don't seem to have started it. :-)
type: Comment
comment on: http://stackoverflow.com/a/21125753
score: 0
type: AnswerComment

http://stackoverflow.com/q/21112733
tagged with: if-statement
tagged with: java
has comment: http://stackoverflow.com/comment/31765071
has body: I have a string array String[] weekDays weekDays represents days of week. for eg {1, 2, 4} means Monday, Tuesday, Thusday {2,5,6,7} means Tuesday, Friday, Saturday, Sunday I have seven boolean representing 7 days of week and have to set true or false on the basis of weekDays. My code private static void setWeekDays(final Object object, final String[] weekDays) { for (String day : weekDays) { if( day.equalsIgnoreCase("1")) { object.setMonday(true); } else if( day.equalsIgnoreCase("2")) { object.setTuesday(true); } else if( day.equalsIgnoreCase("3")) { object.setWednesday(true); } else if( day.equalsIgnoreCase("4")) { object.setThrusday(true); } else if( day.equalsIgnoreCase("5")) { object.setFriday(true); } else if( day.equalsIgnoreCase("6")) { object.setSaturday(true); } else if( day.equalsIgnoreCase("7")) { object.setSunday(true); } } } But it has so many if else statements and before performing this i explicitly set all booleans to be false. Is there any other simple way to do the same thing? Any suggestion ??
type: Question
has comment: http://stackoverflow.com/comment/31764728
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/31764839
tagged with: string
has comment: http://stackoverflow.com/comment/31764894
favorite count: 0
tagged with: logic
has title: String array to multiple objects
has answer: http://stackoverflow.com/a/21113260
has answer: http://stackoverflow.com/a/21113018
has comment: http://stackoverflow.com/comment/31764877
answer count: 4
has answer: http://stackoverflow.com/a/21113381
upvote count: 2
type: UnansweredQuestion
score: 2
has answer: http://stackoverflow.com/a/21113027

http://stackoverflow.com/a/21174039
has body: You can send a message using the onStop() or onPause() methods, depending on what you want to do. For example, you can verify if you want to send a notification only if your app is running in background, or really when the user closes the app. To understand better about these two methods, I recommend you to see the specifications here: http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle
answers question: http://stackoverflow.com/q/21173914
downvote count: 0
has comment: http://stackoverflow.com/comment/31877258
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/31650589
type: AnswerComment
comment on: http://stackoverflow.com/a/21050704
score: 0
type: Comment
has text: [Works for me](http://meta.stackexchange.com/questions/118992/are-works-for-me-answers-valid) are not really answers but comments. Also use comment if you want to ask OP question. Answers are for solutions, not questions.

http://stackoverflow.com/comment/31668805
type: Comment
has text: You will want to exercise and improve your Google skills. If you already searched and found something, and it's not working, then you will want to do debugging -- test to see what isn't working, and then ask a question with information gained from your debugging, or specific question about information that you searched on, but don't understand.
score: 0
comment on: http://stackoverflow.com/q/21060220
type: QuestionComment

http://stackoverflow.com/a/21118918
score: 1
has comment: http://stackoverflow.com/comment/31780227
answers question: http://stackoverflow.com/q/21116617
upvote count: 1
has body: One simple way is to include multiple URL's in the existing url property separated by a unique character. I chose "|" (pipe) in this example because it's highly unlikely to see a pipe in a normal url. Java identifies methods by name and parameter signature. We can use that to our advantage by adding a String url parameter to the existing process method and creating a new process(String request) method that will split and iterate over the url's. The only downside is that it will only return the last response to the DQServer class. public String process(String request) throws Exception { String response; for (String u : url.split("\\|")) { response = process(request, u); } return response; } public String process(String request, String url) throws Exception { long processStart = System.currentTimeMillis(); String response = null; for (int i=0; i&lt;=retries; i++) { try { response = send(request, url); if (response!=null) break; } catch (Exception e) { log.warn("Error processing: " + e.getMessage()); if (i&lt;retries) { log.warn("Trying again (retry " + (i+1) + "..."); } else { log.error("Giving up on this transaction."); break; } } } long processFinished = System.currentTimeMillis(); log.info("Request was processed in " + (processFinished-processStart) + "ms."); return response; } The complete sample is available on GitHub Gist.
has comment: http://stackoverflow.com/comment/31779531
type: Answer
downvote count: 0

http://stackoverflow.com/comment/31599236
has text: Yes, after iteration i.hasNext() return false
type: QuestionComment
comment on: http://stackoverflow.com/q/21022336
type: Comment
score: 0

android-asynctask
tags question: http://stackoverflow.com/q/21020457
tags question: http://stackoverflow.com/q/21053702
tags question: http://stackoverflow.com/q/21166329
tags question: http://stackoverflow.com/q/21034646
type: Tag
tags question: http://stackoverflow.com/q/21130482
tag name: android-asynctask
tags question: http://stackoverflow.com/q/21104756
tags question: http://stackoverflow.com/q/21135391
tags question: http://stackoverflow.com/q/21058870
tags question: http://stackoverflow.com/q/21050334
tags question: http://stackoverflow.com/q/21101352
tags question: http://stackoverflow.com/q/21029246
tags question: http://stackoverflow.com/q/21064257

http://stackoverflow.com/q/21090612
upvote count: 1
has comment: http://stackoverflow.com/comment/125649759
type: AnsweredQuestion
score: 1
has title: Can not deserialize instance of models.PublisheDataList out of START_ARRAY token
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has body: I am trying to parse json using jackson api with the following details. but I'm getting error. Please find the following details for code and stacktrace. JSON [{"id":1001,"cyPerReffe":1200,"distPercentage":"0"},{"id":1002,"cyPerReffe":1000,"distPercentage":"10"},{"id":1003,"cyPerReffe":800,"distPercentage":"20"},{"id":1004,"cyPerReffe":750,"distPercentage":"10"},{"id":1005,"cyPerReffe":700,"distPercentage":"10"},{"id":1006,"cyPerReffe":650,"distPercentage":"10"},{"id":1007,"cyPerReffe":600,"distPercentage":"20"},{"id":1008,"cyPerReffe":300,"distPercentage":"5"},{"id":1009,"cyPerReffe":333,"distPercentage":"7"},{"id":1010,"cyPerReffe":"32","distPercentage":"8"}] Controller class ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); PublisheDataList publisheDataList = mapper.convertValue(json, PublisheDataList.class); the following class is my bean class. PublisheData.java private Long id; private Long cyPerReffe; private String distPercentage; // with setter and getters PublisheDataList.java List&lt;PublisheData&gt; publisheDataList; //with setter and getters I am getting the following error. java.lang.IllegalArgumentException: Can not deserialize instance of models.PublisheDataList out of START_ARRAY token at [Source: N/A; line: -1, column: -1] at org.codehaus.jackson.map.ObjectMapper._convert(ObjectMapper.java:2502) at org.codehaus.jackson.map.ObjectMapper.convertValue(ObjectMapper.java:2468) at controllers.RYSController.publishReferenceYield(RYSController.java:79) at Routes$$anonfun$routes$1$$anonfun$applyOrElse$22$$anonfun$apply$62.apply(routes_routing.scala:318) at Routes$$anonfun$routes$1$$anonfun$applyOrElse$22$$anonfun$apply$62.apply(routes_routing.scala:318) at play.core.Router$HandlerInvoker$$anon$6$$anon$2.invocation(Router.scala:175) at play.core.Router$Routes$$anon$1.invocation(Router.scala:355) at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:50) at play.GlobalSettings$1.call(…
has answer: http://stackoverflow.com/a/21091207
downvote count: 0
tagged with: jackson
linked to: http://stackoverflow.com/q/10719729
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21091207

http://stackoverflow.com/q/21148503
accepted answer: http://stackoverflow.com/a/21166034
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31831153
favorite count: 0
type: AnsweredQuestion
tagged with: fitnesse
has title: Using ArrayFixture with a list of objects containing nested non-primitive objects
upvote count: 1
has answer: http://stackoverflow.com/a/21166034
type: Question
has body: I am using ArrayFixture to verify lists of non-primitive objects that contain other non-primitives. I have a simple setup like this: public class Car { public String getName(); public Details getDetails(); ... } public class Details { public String getMake(); ... } With ArrayFixture, all you need to do is call setActualCollection(yourListOfObjects) in the constructor of the class. How do I reference the elements in the object's non-primitive variables? This is how my Fitnesse test looks: |Verify Cars| |name | details Make | ... | |Taurus | Ford | ... | |... | ... | ... | I have been able to easily use the ArrayFixture when the object in the list contains primitive objects, but I haven't found any documentation on how to handle non-primitive elements.
score: 1
tagged with: java

http://stackoverflow.com/comment/31693896
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/21066624
type: Comment
has text: The @Override is a [Java annotation](http://en.wikipedia.org/wiki/Java_annotation). The override annotation in my example is optional, it just let's the compiler check that I am actually overriding the mouseClicked() method of the MouseListener class. Most IDE's add these annotations automatically. The getSource() method returns the Object that triggered the event, in my example would that be the JPanel that got clicked by your mouse.

http://stackoverflow.com/a/21162855
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/31855946
answers question: http://stackoverflow.com/q/21162803
accepted answer of: http://stackoverflow.com/q/21162803
score: 4
has comment: http://stackoverflow.com/comment/31856017
type: AcceptedAnswer
has body: It's nothing to do with Java and the JVM. Any language has the same problems and solutions for this sort of situation. The thing you need to talk to has to provide you a way to talk to it. You need to talk to it using that way. Methods include pipes, custom network protocols, SOAP and Restful web services, etc.

http://stackoverflow.com/a/21104919
upvote count: 5
has body: I got this by digging into the CandlestickRenderer class source First, make a subclass public class MyCandlestickRenderer extends CandlestickRenderer { @Override public Paint getItemPaint(int row, int column) { //determine up or down candle XYDataset dataset = getPlot().getDataset(); OHLCDataset highLowData = (OHLCDataset) dataset; int series = row, item = column; Number yOpen = highLowData.getOpen(series, item); Number yClose = highLowData.getClose(series, item); boolean isUpCandle = yClose.doubleValue() &gt; yOpen.doubleValue(); //return the same color as that used to fill the candle if (isUpCandle) { return getUpPaint(); } else { return getDownPaint(); } } } Then set your chart to use it chart.getXYPlot().setRenderer(new MyCandlestickRenderer()); Result:
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21103801
answers question: http://stackoverflow.com/q/21103801
has comment: http://stackoverflow.com/comment/31754168
score: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/46515904

http://stackoverflow.com/a/21169000
type: Answer
score: 1
answers question: http://stackoverflow.com/q/21168879
has body: You are using the right pattern, but apply it a bit wrong: Your Runflag will only be checked after 1000 seconds, because it will only be checked after the for loop finished. Change your code to the following: public void run(){ while(Run){ for(int i=0;(i&lt;1000) &amp;&amp; (Run == true);i++){ System.out.println("Starting Counter:"+i); try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } Please note you will have to completely remove the while loop if you don't want your for loop to be executed endlessly effectively.
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/31703754
score: 1
comment on: http://stackoverflow.com/q/21076086
has text: How does your question differ from the previous one you linked to? If it's the same question, you can put a bounty on it to get more attention to it. If you have enough reputation.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31763651
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21112051
has text: is there no problem in Indigo ? and what about Juno . just i saw a problem with some releases .
score: 0

http://stackoverflow.com/a/21130896
has body: It can be used to avoid code repetition. Let's put an example: public class Test { int a; int b; public Test(int a) { this.a = a; } public Test(int a, int b) { this(a); this.b = b; } public static void main(String args[]) { Test t1 = new Test(1); Test t2 = new Test(1,2); System.out.println(t1.a + &quot; &quot; + t1.b); System.out.println(t2.a + &quot; &quot; + t2.b); } } Here the two-parameter constructor calls the one-parameter constructor to initialize the field a, so you don't have to repeat all the code in the one-parameter constructor inside the two-parameter constructor. Of course with this little example, it looks like it is unuseful, but imagine that you have a lot of fields you want to initialize. It will be very useful. Regarding this() question: According to Java Docs: Within an instance method or a constructor, this is a reference to the current object... From within a constructor, you can also use the this keyword to call another constructor in the same class. Doing so is called an explicit constructor invocation. So this() is used to call the constructor (without parameters in this case) of the class Constructor_chaining.
type: Answer
answers question: http://stackoverflow.com/q/21130748
upvote count: 4
score: 4
downvote count: 0

http://stackoverflow.com/a/21148939
has body: Check if this works for you for(int i = 0; i &lt; 10; i++ ) { int rand = (int)(Math.random() * 3) + 1; if (rand == 1){ hand.takeCard(one); } else if (rand == 2){ hand.takeCard(two); } else if (rand == 3){ hand.takeCard(three); } }
answers question: http://stackoverflow.com/q/21148766
score: 0
type: Answer

http://stackoverflow.com/q/21128797
tagged with: java
possible better answer: http://stackoverflow.com/a/21128936
accepted answer: http://stackoverflow.com/a/21297878
tagged with: javax.sound.sampled
has title: AudioInputStream is not working
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
upvote count: 2
tagged with: javasound
has answer: http://stackoverflow.com/a/21297878
answer count: 2
has body: I'm trying to play a .wav sound every time the user presses a button, but an exception gets thrown: Exception in thread "Thread-0" java.lang.IllegalArgumentException: Invalid format at org.classpath.icedtea.pulseaudio.PulseAudioDataLine.createStream(PulseAudioDataLine.java:142) at org.classpath.icedtea.pulseaudio.PulseAudioDataLine.open(PulseAudioDataLine.java:99) at org.classpath.icedtea.pulseaudio.PulseAudioDataLine.open(PulseAudioDataLine.java:283) at org.classpath.icedtea.pulseaudio.PulseAudioClip.open(PulseAudioClip.java:402) at org.classpath.icedtea.pulseaudio.PulseAudioClip.open(PulseAudioClip.java:453) at Uber.play(Uber.java:534) at Uber$5.run(Uber.java:340) at java.lang.Thread.run(Thread.java:724) Here's the code: //Play Audio File public void play(String file) throws LineUnavailableException, UnsupportedAudioFileException, IOException { AudioInputStream inputStream = AudioSystem.getAudioInputStream(new File(file)); Clip clip = AudioSystem.getClip(); clip.open(inputStream); clip.start(); }
has answer: http://stackoverflow.com/a/21128936
tagged with: audio

http://stackoverflow.com/q/21024371
score: 2
has comment: http://stackoverflow.com/comment/31603849
upvote count: 2
has answer: http://stackoverflow.com/a/21024422
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31603360
has title: How to apply css border around text
tagged with: image
tagged with: browser
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21024516
favorite count: 0
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has body: I am using http://code.google.com/p/java-html2image/ to convert HTML to image. How to apply border around text ? In browser, HTML works fine and we can see the border (plz see snapshot). With current approach HTML2Image API is not able to apply border when HTML becomes image. Or is there any trick to apply border when HTML converted into image ?
tagged with: css

http://stackoverflow.com/q/21175794
score: 1
tagged with: opengl-es
favorite count: 0
has comment: http://stackoverflow.com/comment/31880403
type: Question
answer count: 2
tagged with: android
has title: Reduce memory in android OpenGL camera
has answer: http://stackoverflow.com/a/21177087
has body: I am using GPUImage library for taking screenshots/effects. However, on my Acer Liquid Express with Gingerbread 2.3 it works only for 1280x720 max. Trying to set 1600x1200 cause bitmap size exceeds VM budget and VM won't let us allocate 7680000 bytes. Diving into the code I found the following: IntBuffer ib = IntBuffer.allocate(mWidth * mHeight); IntBuffer ibt = IntBuffer.allocate(mWidth * mHeight); mGL.glReadPixels(0, 0, mWidth, mHeight, GL_RGBA, GL_UNSIGNED_BYTE, ib); // Convert upside down mirror-reversed image to right-side up normal // image. for (int i = 0; i &lt; mHeight; i++) { for (int j = 0; j &lt; mWidth; j++) { ibt.put((mHeight - i - 1) * mWidth + j, ib.get(i * mWidth + j)); } } mBitmap = Bitmap.createBitmap(mWidth, mHeight, Bitmap.Config.ARGB_8888); mBitmap.copyPixelsFromBuffer(ibt); As you can see, it creates 2 buffers, 7680000 bytes each (1600x1200*4) and reverse it because of different 0,0 coordinates in OpenGL and Java. What I want is to remove second buffer (to save memory) and keep functionality. Is it possible? If I simply remove ibt and for loops it creates upside down image without OutOfMemory exception. Also, it will be good to save RGB_565 bitmap, but I am not familar with OpenGL absolutely. Please advice.
tagged with: java
upvote count: 1
tagged with: bitmap
has comment: http://stackoverflow.com/comment/31881060
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21175926
downvote count: 0

http://stackoverflow.com/q/21148084
has title: How do I draw an arc based on two given points and a given height describing a circle segment?
has body: I'm trying to draw an arc based on two given points and a given height describing a circle segment. To acomplish this I would use the following method from java.awt.Graphics. drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) First I observe that the x, y, width and height values describes a rectangle containing the circle. The center of the arc is the center of the rectangle whose origin is (x, y) and whose size is specified by the width and height arguments. (http://docs.oracle.com/javase/7/docs/api/java/awt/Graphics.html) So first I start by calculating the x,y,width and height values. The picture below describes how I would do this. The first picture shows what values I've already got. The arc in the first picture is exactly what I'm trying to draw. In picture number two I calculate the lenght of a line between the two points. My code to perform this step would look like this: int dx = p1.x- p2.x; int dy = p1.y - p2.y; double len = Math.sqrt(Math.pow((double)dx, 2) + Math.pow((double)dy, 2)); As shown in picture three I can now calculate the radius of the circle by using the following function. radius = h/2 + len^2 / 8h The first problem I encounter is to calculate the CenterPoint of the circle. This is partly where I need help. If I was to calculate the Center Point I can then easily find the x, y, whith and height coordinates. x = centerPoint.x - radius; y = centerPoint.y - radius; width = radius * 2; height = radius * 2; The last part is to calculate the startAngle and arcAngle based on the values we already calculated. TL;DR I need help with calculating the angles and the center point. Thanks in advance!
tagged with: trigonometry
has comment: http://stackoverflow.com/comment/31829988
favorite count: 0
tagged with: geometry
has answer: http://stackoverflow.com/a/21148558
tagged with: graphics
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31831406
tagged with: segment
has comment: http://stackoverflow.com/comment/31830115
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/21148558
answer count: 1
downvote count: 0
score: 4

http://stackoverflow.com/a/21079769
has comment: http://stackoverflow.com/comment/31704431
type: AcceptedAnswer
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/21079636
type: Answer
accepted answer of: http://stackoverflow.com/q/21079636
upvote count: 4
has comment: http://stackoverflow.com/comment/31704408
has body: The problem is that your orientation is horizontal: android:orientation="horizontal" but your TextView takes up whole space: android:layout_width="fill_parent" As a result, your ImageView is placed "right" of the device screen. Switch your orientation to vertical: android:orientation="vertical" and you'll see it. Cheers!

http://stackoverflow.com/comment/31696399
type: Comment
comment on: http://stackoverflow.com/a/21075386
has text: Thanks for the answer. However, I already have this in my code (see my edit in the question) and it still behaves like I described...
score: 0
type: AnswerComment

http://stackoverflow.com/comment/79135934
has text: @EJoshuaS It shouldn't have the entry tag, which I have removed.
type: AnswerComment
comment on: http://stackoverflow.com/a/21106730
type: Comment
score: 1

http://stackoverflow.com/q/21078785
has comment: http://stackoverflow.com/comment/31702437
has body: I wrote a hangman game in java and it works fine as an application, but now I'm trying to make it into an applet. I followed a tutorial for how to change an application to an applet but when I embed the code into an html and run it on my localhost server, it asks me to run the applet, and start loading Java, but then it's just blank. The code for my GUI class is below, please let me know what needs to be fixed, thank you! import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.applet.*; import java.net.*; public class HangmanGui extends Applet { //String to hold userinput from the south text field public static String uInput = "waitingForInput123"; public static boolean startButtonClicked = false; public static boolean invalidGuess = true; public static boolean wordWasGuessed = false; public static boolean correctGuessWasMade = false; public static boolean multipleIncorrectGuess = false; public static boolean incorrectGuessMade = false; public static boolean updateHangmanPicture = false; public static boolean gameIsOver = false; public static boolean gameIsOverNow = false; public boolean waitingForYorNo = false; public static boolean playerWonGame = false; HangmanGame hm = new HangmanGame(); EnterButtonHelper enterListener = new EnterButtonHelper(); EnterFieldHelper enterKeyListener = new EnterFieldHelper(); //Start Screen components JPanel frame = new JPanel(new BorderLayout()); JPanel gamePanel1 = new JPanel(new BorderLayout()); JPanel westPanelForButtons = new JPanel(new GridLayout(10, 1, 1, 1)); JButton startButton = new JButton(new AbstractAction("Start") { public void actionPerformed(ActionEvent e) { buildAfterPressingStart(); hm.startGame(); } }); JButton instructionsButton = new JButton(new AbstractAction("Instructions") { public void actionPerformed(ActionEvent e) { instructionsButtonWindow(); } }); Icon aba = new ImageIcon(getClass().getResource("welcomeToHangman.png")); JLabel picLabel = new JLabel(aba); //After Pressing start button…
tagged with: swing
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21078840
accepted answer: http://stackoverflow.com/a/21078840
upvote count: 1
answer count: 1
tagged with: applet
has title: Java applet is blank
favorite count: 0

http://stackoverflow.com/comment/31599450
score: 0
comment on: http://stackoverflow.com/q/21022462
has text: Most people don't create `abstract` classes unnecessarily. If there is such class it can be a mistake. There is no need for doing that.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31761726
score: 0
type: Comment
type: QuestionComment
has text: Are you injecting/setting the 'test' instance in the 'testClass'? Your thought is probably right as you need to inject the created mock for XFDHandler into the HandleInformation class. How is your HandleInformation class instantiated?
comment on: http://stackoverflow.com/q/21110953

http://stackoverflow.com/comment/31694191
score: 0
type: AnswerComment
has text: @Eugen: no, better a [MCVE](http://stackoverflow.com/help/mcve) then your full code. Please read the link first.
comment on: http://stackoverflow.com/a/21074273
type: Comment

http://stackoverflow.com/a/21073590
has body: The ListView is not refreshing because you are not modifying the contents array of the ArrayAdapter anywhere in your code in the onClick method. Therefore, when notifyDataSetChanged is called, it uses the same old array and shows the same previous contents. Hence no change. Try setting a new array to the adapter in onClick and then call notifyDataSetChanged again. That should solve your problem. :)
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31693001
has comment: http://stackoverflow.com/comment/31693052
upvote count: 1
answers question: http://stackoverflow.com/q/21073514

http://stackoverflow.com/a/21119054
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21117966
type: AcceptedAnswer
type: Answer
has body: It looks as if you are adding the difference between the mouse's current position and the polygon's position to the polygon's new position on each frame. What you want to do is only add the difference between the mouse's new position and its position the last time that mouseDragged() was called. You can do this fairly easily. After your for loop, add the following: xMousePressed = evt.getX(); yMousePressed = evt.getY(); Then the next time mouseDragged() is called, it will update the polygon's position relative to its position in the previous frame.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21117966

http://stackoverflow.com/q/21117967
has answer: http://stackoverflow.com/a/21118345
has body: What does this compile error mean and how can I resolve it? The compiler points the error at line 86 final PiFace piface = new PiFaceDevice(PiFace.DEFAULT_ADDRESS, Spi.CHANNEL_0); and tells me unreported exception java.io.ioexception must be caught or declared to be thrown Is it something to do with it needing a try/catch? As that's the best answer I've found from my searches however I'm not really sure how to implement it i had a go at that and it just produced more errors (you can see it's commented out). The complete code is below: public class Relay1 extends javax.swing.JFrame { public Relay1() { initComponents(); } private void initComponents() { // stuff that doesn't matter... } //try{ final PiFace piface = new PiFaceDevice(PiFace.DEFAULT_ADDRESS, Spi.CHANNEL_0); //}catch(IOException e){ //System.out.println("Something went wrong..."); //} public static void main(String args[]) throws InterruptedException, IOException { 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(Relay1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Relay1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Relay1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Relay1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Relay1().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2…
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21118062
upvote count: 3
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/21118345
has comment: http://stackoverflow.com/comment/31775001
answer count: 2
score: 3
has comment: http://stackoverflow.com/comment/31774654
downvote count: 0
has title: unreported exception java.io.ioexception must be caught or declared to be thrown
favorite count: 0
has comment: http://stackoverflow.com/comment/31774580
tagged with: compiler-errors
has answer: http://stackoverflow.com/a/21118062
has comment: http://stackoverflow.com/comment/31774653

http://stackoverflow.com/q/21117823
tagged with: palindrome
favorite count: 0
has comment: http://stackoverflow.com/comment/31774644
has comment: http://stackoverflow.com/comment/31774762
has comment: http://stackoverflow.com/comment/31775354
has comment: http://stackoverflow.com/comment/31775389
tagged with: singly-linked-list
score: 2
has title: Is combined Strings of LinkedList of strings palindrom?
upvote count: 2
has comment: http://stackoverflow.com/comment/31775879
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21117973
has body: Question is: You have Singly linkedlist which contains String[any no of chars] in its node. Now How to find combined String[no need of building string from linkedlist] is palindrome or not ? Example: ["abc"]-->["d"]-->["ed"]-->["c"]-->["ba"] --> is valid input linkedList combined string would be- abcdedcba This is what I have thought of: 1.Traverse all list by node and compute combined string length-N. 2.take two pointer point to First Node, P1, P2. 3.advance P1 till reach to string length >=N/2.[we have to remember previous total length] now advance char pointer within node string to point to N/2+2th char[if N is odd] or N/2+1th[if N is even]. 4.Start from P2 with char pointer to first char of node string. and perform equal on chars. 5.If P1 reach to end with all char exhausted. then string is palindrome. but in this approach i'm traversing linkedlist 2.5 times. which will be not good if LinkedList will be huge. Can anyone suggest better approach.
has comment: http://stackoverflow.com/comment/31774824
has comment: http://stackoverflow.com/comment/31775644
tagged with: java
tagged with: http://stackoverflow.com/tag/c
type: Question
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/31796998
comment on: http://stackoverflow.com/q/21058476
score: 0
type: Comment
type: QuestionComment
has text: @user1505713. So, if *f* can be of any length, you should implement long arithmetics. Linear time conversion is impossible. And what recursive solution do you mean?

http://stackoverflow.com/q/21179145
downvote count: 0
possible better answer: http://stackoverflow.com/a/23997209
has answer: http://stackoverflow.com/a/23997209
tagged with: swing
has comment: http://stackoverflow.com/comment/31886805
has title: Jdatechooser text alignement to RIGHT
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/21179768
score: 1
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/21179768
tagged with: jdatechooser
has comment: http://stackoverflow.com/comment/31886572
tagged with: alignment
has body: I need to align the text in Jdatechooser text field. It always aligns the text(the selected date) to LEFT but i need at RIGHT side. I have tried this but its not working, StartJCal.setAlignmentX(RIGHT_ALIGNMENT); The setTextAlignment method is not available for Jdatechooser. StartJCal = new JDateChooser(); StartJCal.setDateFormatString("yyyyMMdd"); StartJCal.setFont(new Font("Dialog", Font.PLAIN, 11)); StartJCal.setSize(new Dimension(105, 0)); This is the piece of code am using.How can i align the text please help
upvote count: 1
has comment: http://stackoverflow.com/comment/31886658
favorite count: 0

http://stackoverflow.com/comment/31650290
comment on: http://stackoverflow.com/q/21049914
score: 0
type: Comment
type: QuestionComment
has text: @CommonsWare I have updated my question from some further testing of mine. Do you think it could be the `.compress()` method doing this?

http://stackoverflow.com/a/21057951
has comment: http://stackoverflow.com/comment/31674919
has comment: http://stackoverflow.com/comment/31711155
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: Yes .. you can use Javascript libs in GWT project. Simply import it's lib in your html file or GWT.xml. In your module.xml file as below.. <inherits name='com.google.gwt.user.User'/> <entry-point class='test.Gwt.testingSample.client.TestingProjectEntry'/> <inherits name="com.google.gwt.user.theme.standard.Standard" /> And test in your HTML file.. Have a useful for you... !
answers question: http://stackoverflow.com/q/21053394

http://stackoverflow.com/q/21064404
answer count: 0
tagged with: java
tagged with: eclipse
type: Question
tagged with: google-maps
has body: With Android 4.0.4 Google Maps API V2 shows nothing (blank white screen). It works with Android >4.1, so the API key is correctly configured. There are some Warnings in Logcat, but they also occur on Android >4.1, where everything works fine. 01-11 16:39:03.325: E/GooglePlayServicesUtil(6470): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included. Here is my project's manifest : (eclipse build target is google APIs 19) <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" /> <supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:xlargeScreens="true" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" /> <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" /> <uses-permission android:name="android.permission.READ_CALENDAR" /> <uses-permission android:name="android.permission.WRITE_CALENDAR" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.VIBRATE" /> <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_FINE_LOCATION" /> <uses-feature android:glEsVersion="0x00020000" android:required="true" /> <uses-feature android:name="android.hardware.telephony" android:required="false" /> <provider android:name="de.hska.util.BuildingSuggestionProvider" android:authorities="de.hska.util.BuildingSuggestionProvider.search_suggestion_provider" android:syncable="false" /> <category android:name="android.intent.category.…
score: 0
has title: Android Google Maps V2 Blank Screen
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/31677422
has comment: http://stackoverflow.com/comment/31676137

http://stackoverflow.com/a/21097262
downvote count: 0
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21097065
has body: If you have properly configured for Spring MVC, then it should be something like this, myapp org.springframework.web.servlet.DispatcherServlet 1 myapp /* Now you should have one file myapp-servlet.xml in which you should provide mappings for what to do against the requested URL PATTERN or you can go for annotations based mapping in java files directly. in this case your welcome-file will not play rule as your first request "AppName/" will pass the mvc mapping "/*" and will go for searching mapping in Spring MVC file. you can achieve your need by this way mapping, myapp org.springframework.web.servlet.DispatcherServlet 1 myapp /mvc/* now MVC will come into picture only if pattern follows "/mvc/" otherwise it will work in normal flow.

http://stackoverflow.com/comment/31683261
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21068129
has text: What error are you seeing? What is the expected behavior? What have you tried doing? What makes you suspect it is an issue with statics?
type: Comment

http://stackoverflow.com/a/21235359
has comment: http://stackoverflow.com/comment/32074308
answers question: http://stackoverflow.com/q/21178755
score: 2
has comment: http://stackoverflow.com/comment/32068821
upvote count: 2
has comment: http://stackoverflow.com/comment/32069359
accepted answer of: http://stackoverflow.com/q/21178755
has body: 1) To handle alarm at exact times you have 2 options: a) Set minimum SDK level at 18 and not 19. This will make your app work on kitkat at the exact time b) Use the setExact() method to tell Kitkat to keep your alarm at the exact time specified Source: http://developer.android.com/about/versions/android-4.4.html 2) The boot completed notification is the best way to go. You can set up a Broadcast receiver to get the notification on a reboot. You can store alarms in a Database and retrieve on reboot. 2.1) It is horrible programming practice to do something the user did not want you to do, i.e. set an alarm even though user has not opened the app. 3) As long as you don't create files on the SD card, all application data is removed upon uninstall of the app 4) You should lock/unlock data when writing or reading from it to solve your 12AM problem. If the data is locked, it would not get affected until the user has committed the transaction. If you are using SQLite you can get more information on this from: http://www.sqlite.org/lockingv3.html
has comment: http://stackoverflow.com/comment/32070430
has comment: http://stackoverflow.com/comment/32072036
has comment: http://stackoverflow.com/comment/32069451
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32073104
has comment: http://stackoverflow.com/comment/32072500
has comment: http://stackoverflow.com/comment/32011239
type: Answer

http://stackoverflow.com/q/21050788
tagged with: spring
tagged with: apache-marmotta
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22971017
tagged with: java
accepted answer: http://stackoverflow.com/a/22971017
has title: creating marmotta archetype webapp error(new)
tagged with: eclipse
type: Question
has body: I am a new-bie to spring framework and maven tool. I am trying to create an Maven-archtype-webapp project in Eclipse Kepler New version(Version: Kepler Service Release 1 Build id: 20130919-0819). I created a new workspace, but when I am trying to create a new project, I am getting the following error: creating marmotta archetype webapp has encountered a problem In my case, the project is not created. I looked everywhere to find a solution in my case, but I'm unable to solve it.
score: 0
answer count: 1
tagged with: maven

http://stackoverflow.com/comment/31709311
type: Comment
has text: I did that and now the program returns 0s for all of the letters. Why does that happen?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21082164

http://stackoverflow.com/a/21068219
score: 4
has comment: http://stackoverflow.com/comment/31684589
type: AcceptedAnswer
has body: The FileReader constructor takes a file name as argument. You pass it a relative file name, so Java is looking for it on the file system, in its current directory, which is the directory from which the java command used to start Tomcat was launched. Not only the path is thus incorrect, but you don't even want to use a file, since what you want to read is a resource which is inside the war file, or even inside a jar file inside the war file. You want to use this resource thanks to the class loader, since this resource must be found using the same loading mechanisms, based on wars and jars and packages, as .class files. You thus should use InputStream in = UserList.class.getResourceAsStream("/br/com/servtech/model/json/User.json");
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/21067484
accepted answer of: http://stackoverflow.com/q/21067484

http://stackoverflow.com/q/21072003
has comment: http://stackoverflow.com/comment/31690200
has comment: http://stackoverflow.com/comment/31690218
has title: Android using JSOUP for HTML
accepted answer: http://stackoverflow.com/a/21072288
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/31690162
possible better answer: http://stackoverflow.com/a/21072260
tagged with: html-parsing
type: Question
has answer: http://stackoverflow.com/a/21072288
has answer: http://stackoverflow.com/a/21072260
score: 1
tagged with: java
tagged with: jsoup
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/31690221
has body: I am just completely lost and confused when using JSOUP to parse this html document... I dont mean to just ask for straight up code but if someone has the time or can get me started that would be great... Here is the document: http://radar.weather.gov/ridge/RadarImg/N0R/ILN/ If you view the source I am trying to fetch these lines: &lt;tr&gt;&lt;td valign="top"&gt;&lt;img src="/icons/image2.gif" alt="[IMG]"&gt;&lt;/td&gt;&lt;td&gt;&lt;a href="ILN_20140112_0021_N0R.gif"&gt;ILN_20140112_0021_N0R.gif&lt;/a&gt;&lt;/td&gt;&lt;td align="right"&gt;12-Jan-2014 00:23 &lt;/td&gt;&lt;td align="right"&gt;2.2K&lt;/td&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt; As you notice there are many of these... I need the value in &lt;a href= I also need that value in the first ten of those lines... As i said if anyone has the time to help me out, it would be greatly appreciated!
has answer: http://stackoverflow.com/a/21072274
favorite count: 0

http://stackoverflow.com/a/21020461
type: Answer
score: 3
upvote count: 3
has body: The difference is in scope of variable. Defined inside loop means visible only inside the loop. Defined outside the loop means visible inside and outside the loop. does Java waste many resources creating/deleting objects in loop? if defined inside the loop then it will be re-intialized with every iteration, which means an extra executable statement. If you want to re-intialize it with each iteration then good otherwise move it out to save wasted cpu for that statement.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21020432
answers question: http://stackoverflow.com/q/21020432

junit
type: Tag
tags question: http://stackoverflow.com/q/21135787
tags question: http://stackoverflow.com/q/21115319
tags question: http://stackoverflow.com/q/21165082
tags question: http://stackoverflow.com/q/21141120
tags question: http://stackoverflow.com/q/21148258
tags question: http://stackoverflow.com/q/21108318
tags question: http://stackoverflow.com/q/21172558
tags question: http://stackoverflow.com/q/21030193
tags question: http://stackoverflow.com/q/21110953
tags question: http://stackoverflow.com/q/21128690
tags question: http://stackoverflow.com/q/21075354
tags question: http://stackoverflow.com/q/21053855
tags question: http://stackoverflow.com/q/21182502
tags question: http://stackoverflow.com/q/21122417
tags question: http://stackoverflow.com/q/21109893
tags question: http://stackoverflow.com/q/21175148
tag name: junit
tags question: http://stackoverflow.com/q/21088703
tags question: http://stackoverflow.com/q/21038992
tags question: http://stackoverflow.com/q/21140545
tags question: http://stackoverflow.com/q/21158006
tags question: http://stackoverflow.com/q/21040970
tags question: http://stackoverflow.com/q/21141521
tags question: http://stackoverflow.com/q/21158038
tags question: http://stackoverflow.com/q/21143952
tags question: http://stackoverflow.com/q/21125762
tags question: http://stackoverflow.com/q/21132487
tags question: http://stackoverflow.com/q/21098072
tags question: http://stackoverflow.com/q/21029784
tags question: http://stackoverflow.com/q/21119650
tags question: http://stackoverflow.com/q/21181327
tags question: http://stackoverflow.com/q/21055980
tags question: http://stackoverflow.com/q/21104845
tags question: http://stackoverflow.com/q/21074330
tags question: http://stackoverflow.com/q/21090245
tags question: http://stackoverflow.com/q/21069911
tags question: http://stackoverflow.com/q/21179958

http://stackoverflow.com/a/21156328
has body: With the help of Executor and Futures I think this could help ExecutorService executor = Executors.newCachedThreadPool(); Future&lt;String&gt; future = executor.submit( new Callable&lt;String&gt;() { public String call() throws Exception { return someVeryLengthMethod(); }}); String result = null; try { result = future.get(2, TimeUnit.MINUTES); } catch (InterruptedException e) { // Somebody interrupted us } catch (ExecutionException e) { // Something went wring, handle it... } catch (TimeoutException e) { // Too long time future.cancel(true); } // Continue with what we have... This will wait for the answer a specified time, and if the result is not available within that time the future is cancelled (which may or may not actually stop the execution of that task), and the code can continue.
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21155382
type: Answer
accepted answer of: http://stackoverflow.com/q/21155382

http://stackoverflow.com/a/21092774
type: Answer
answers question: http://stackoverflow.com/q/21092714
score: 2
downvote count: 0
has body: You've likely got a Swing threading issue. When you previously ran the code from the main thread, the long-running bit of code ran on the main thread and not in the Swing thread. Now that your simulation is being started in the Swing thread, the problems are showing since your long-running code is now running in the Swing Event Dispatch Thread or EDT, hogging and effectively freezing this thread and preventing all GUI drawing from occurring since this is the thread that is responsible for all Swing painting and user interaction. Suggestions: Use a SwingWorker or other background thread for all long-running code. Make sure to update Swing objects on the Swing thread only, the EDT. The SwingWorker makes this easier to do. Don't have any of your code logic in your painting methods whatsoever. The paintComponent method should be for drawing and drawing only. For details on Swing threading issues (and as Keven Workman suggests), please have a look at the Concurrency in Swing Tutorial. Also, if these suggestions don't help you, consider telling and showing (code) us more.
has comment: http://stackoverflow.com/comment/31728073
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21092714

http://stackoverflow.com/q/21137683
score: 0
has comment: http://stackoverflow.com/comment/31810906
type: UnansweredQuestion
has title: java 2d game -lagging and collision issue
has comment: http://stackoverflow.com/comment/31810364
has answer: http://stackoverflow.com/a/21138482
has comment: http://stackoverflow.com/comment/31810693
tagged with: java
type: Question
has body: I am designing a simple java 2d game.where an aircraft shoots missiles and they hit alien ships.(pictures are attached for a better understanding). Now I need to detect when the missile hits the alien ship. So as to count the number of total hits. I used the rectangle1.intersects(rec2)method, but instead of giving me an integer 1 as the answer (after the boolean of course) it gives me some funny answer. I guess like how much the two rectangles intersect... Also when adding new aliens in an arraylist I use the following: I add new aliens every two seconds, but this slows down the game very much. So please guide me on these two issues. There is a game class (contains the main frame), board class (the panel on which I draw) alient, missile and craft class. Below I am giving the the actionPerformed() of the panel class which gets called by a timer every 2ms (the rest of the code is below). ///CODE TO BE FOCUSED ON import java.awt.*; import java.awt.event.*; import java.util.ArrayList; import javax.swing.*; public class game extends JFrame { static long z; game() { add(new board()); setBounds(0, 0, 500, 500); setVisible(true); setLayout(null); setLocationRelativeTo(null); setTitle("\t\t...................::::~~~~'S GAME~~~~:::::..............."); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public static void main(String[] args) { new game(); z = System.currentTimeMillis(); } } class board extends JPanel implements ActionListener { Timer t = new Timer(5, this); public ArrayList alien_list; craft craft_list = new craft(); Label l = new Label(); int total_hits = 0; public board() { setFocusable(true); setLayout(null); setDoubleBuffered(true); setBackground(Color.BLACK); addKeyListener(craft_list); l.setBounds(0, 0, 150, 30); l.setBackground(Color.GREEN); add(l); t.start(); alien_list = new ArrayList(); alien_list.add(new alien(0, 100)); alien_list.add(new alien(0, 150)); alien_list.add(new alien(0, 200)); } public void paint(Graphics g) { super.paint(g); Graphics2D g1…
answer count: 1
has comment: http://stackoverflow.com/comment/31810460

http://stackoverflow.com/a/27531649
score: 2
has body: API explanation First, to clarify between "job properties" and "job parameters". The "job parameters" are the Properties passed to the JobOperator#start(String,Properties) and the JobOperator#restart(long,Properties). The "job properties" accessible via JobContext#getProperties() are the children of the /job/properties element. E.g. this job has two properties in the object returned by: JobContext#getProperties() &lt;job&gt; &lt;properties&gt; &lt;property name="initialAmount" value="100" /&gt; &lt;property name="bonusAmount" value="#{jobParameters['bonusAmount']}?:100;" /&gt; &lt;/properties&gt; &lt;/job&gt; So a job parameter is just one possible source of values for a job property definition. As far as accessing parameters, JobOperator.getParameters(long executionId), this probably doesn't help you much since the most natural way to get the current execution id is from the very same context you're having trouble injecting. SE with Guice It sounds like you're referring to the JSR 352 reference implementation (jbatch, included in Glassfish). It's true that we didn't give much thought to SE with Guice dependency injection, and I'm not enough of an expert to know if that even helps to mention. With Weld, in Glassfish we do actually use a technique like this to allow the batch runtime to populate the batch-defined injection points. public class BatchProducerBean { ... @Produces @Dependent public JobContext getJobContext() { ... return JobContextImpl; } } I'd be happy to hear more about Guice integration with jbatch. You could follow up at the home for the project source (no real Wiki yet) on GitHub
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21026323
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21026323
type: Answer

http://stackoverflow.com/comment/31876719
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21171323
has text: What happens if you go to a command prompt, cd into the jre/bin folder, and try to run java directly? If that works, I'd bet there's something wrong with how you're setting the path.
type: AnswerComment

http://stackoverflow.com/comment/31839297
type: Comment
type: QuestionComment
score: 0
has text: like this is also can get errorstream: urlconn.getResponseCode(); urlconn.getErrorStream();
comment on: http://stackoverflow.com/q/21152601

http://stackoverflow.com/a/21097292
has body: In the first case, you are passing by value. So the member variable of the class is never modified. In the second case, you are referencing the class variable itself.
answers question: http://stackoverflow.com/q/21097230
score: 0
type: Answer

http://stackoverflow.com/comment/31602974
type: Comment
has text: @DiegoD it's more work in older version of Java, but still possible - I've added an example. When I've had requirements like this in the past I normally write a MapUtils class containing the variable methods, though more recently Guava offers similar functionality.
comment on: http://stackoverflow.com/a/21021985
type: AnswerComment
score: 0

http://stackoverflow.com/q/21060166
tagged with: textview
tagged with: android
type: AnsweredQuestion
has body: Okay, so I'm trying to insert TableRows into a TableLayout programmatically every time a button is tapped. Each of these rows contain a TextView set to some String. My problem is, that although the TableRow is inserted successfully, the text within the TextView that is itself inside the TableRow won't show up. Here is what I'm doing: //prepare TextView to put inside a TableRow TextView text = new TextView(MyClass.this); text.setText(someString); text.setTextSize(15); text.setTextColor(Color.parseColor("#FF9900")); text.setLayoutParams(new LayoutParams (LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); //Prepare TableRow to be inserted TableRow row = new TableRow(MyClass.this); row.addView(text); row.setPadding(4,4,4,4); row.setGravity(Gravity.CENTER); row.setLayoutParams(new LayoutParams (LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT)); //add row to the table someTableLayout.addView(row); The result: A row is inserted, but I can't see the text (I know the row is inserted since I can see the dividers between each row). I'm guessing it has something to do with the LayoutParams? I'm probably overlooking something very stupid... but I have no idea... Screenshot after I click Roll which should insert a row with the string/TextView: The "Start By Rolling" TextView is the first row which I put in through the XML file. It displays fine, but the rows inserted programmatically don't
tagged with: layoutparams
tagged with: java
has answer: http://stackoverflow.com/a/21060389
has title: Inserting TableRows into TableLayout programmatically - TextView inside TableRow won't display
type: Question
answer count: 2
tagged with: tablelayout
score: 0
has answer: http://stackoverflow.com/a/21060487
accepted answer: http://stackoverflow.com/a/21060487
possible better answer: http://stackoverflow.com/a/21060389
has comment: http://stackoverflow.com/comment/31668304

http://stackoverflow.com/comment/31836609
score: 0
has text: I'm contemplating downvoting this. If you do it this way, you'll get the answer wrong. (1+sqrt(5)/2)^100/sqrt(5) is in fact 354224848179261915075, to the nearest integer. But if you convert the `double` version of this to a `BigInteger` or `BigDecimal`, as described in this solution, you'll get 354224848179263111168. This is the wrong answer. The reason is that not all of the integer values in this range can be represented by a `double`. So by doing this calculation with `double` values, you introduce an error before you even do the conversion.
type: Comment
comment on: http://stackoverflow.com/a/21150938
type: AnswerComment

http://stackoverflow.com/a/21110444
score: 2
has comment: http://stackoverflow.com/comment/31925157
downvote count: 0
upvote count: 2
has body: Bit of a long way round, but you could redirect the program output to a file, capture the return and then grep the output file for the content you want: java -cp $CLASSPATH MetaValidatorMain &gt; /tmp/outfile.txt 2&gt;&amp;1 RETURN_CODE=$? grep -v "useless keyword1" /tmp/outfile | grep -v "useless keyword2" exit RETURN_CODE
type: Answer
answers question: http://stackoverflow.com/q/21110181

http://stackoverflow.com/comment/31815201
type: Comment
has text: We will not do your homework for you. What have you tried? What don't you understand? Are you asking how to read a string? Check equality? Write a loop?
comment on: http://stackoverflow.com/q/21140574
score: 4
type: QuestionComment

http://stackoverflow.com/q/21049953
has comment: http://stackoverflow.com/comment/31649887
has comment: http://stackoverflow.com/comment/31649352
tagged with: java
has comment: http://stackoverflow.com/comment/31649776
type: Question
has comment: http://stackoverflow.com/comment/31649831
answer count: 2
has comment: http://stackoverflow.com/comment/31649630
has answer: http://stackoverflow.com/a/21050493
has comment: http://stackoverflow.com/comment/31649911
has comment: http://stackoverflow.com/comment/31650111
has comment: http://stackoverflow.com/comment/31649863
downvote count: 0
has comment: http://stackoverflow.com/comment/31649999
favorite count: 0
tagged with: binary-search-tree
accepted answer: http://stackoverflow.com/a/21050493
has comment: http://stackoverflow.com/comment/31649743
has comment: http://stackoverflow.com/comment/31649469
has comment: http://stackoverflow.com/comment/31649429
upvote count: 2
possible better answer: http://stackoverflow.com/a/21050194
has answer: http://stackoverflow.com/a/21050194
tagged with: tree
score: 2
type: AnsweredQuestion
has title: Why does my BinarySearchTree implementation always report the inserted element as a duplicate?
has body: I'm working with BST at the moment and I'm having a few problems with my insertion method although it seems quite logical to me. After debugging, I found out that there's a problem with the assignment of the variables I used, like every time I try to insert a node, it gets inserted as a root and therefore it prints out, "duplicates not allowed" . For this , I'm working with 4 classes respectively. The following method is in the BinarySearchTree class that extends the BinaryTree class. In the binary tree class I have a protected BinaryTreeNode and other methods for the tree traversals. Method call from the Main : int value; System.out.println("Number of elements to be inserted: "); value = input.nextInt(); for (int i = 0; i &lt; value; i++) { System.out.print("Enter next element "); num = console.nextInt(); x.setNum(num); tree.insert(x); } Problem was with the method call in the main method and not the inset itself.

http://stackoverflow.com/q/21101593
tagged with: eofexception
tagged with: java
has comment: http://stackoverflow.com/comment/31745401
has comment: http://stackoverflow.com/comment/31745606
tagged with: fileutils
type: Question
has comment: http://stackoverflow.com/comment/31745496
has comment: http://stackoverflow.com/comment/31745996
has comment: http://stackoverflow.com/comment/31745601
score: 0
has comment: http://stackoverflow.com/comment/31812464
has comment: http://stackoverflow.com/comment/31746903
has body: I am executing the below code to pull the .gz file from a URL to a local directory.For small files it goes through fine but for large files it downloads only part of it but does not fail. I get to know the error only when I try to UNZIP it. Can someone throw any light on this on what could be the reason. public boolean downloadFilemethod(String filePath, String url, String decompressFilePath) { if (StringUtils.isNotBlank(filePath) &amp;&amp; StringUtils.isNotBlank(url)) { try { FileUtils.copyURLToFile(new URL(url), new File(SRC_BASE_DIR + filePath), TIMEOUT_IN_MILLIS, TIMEOUT_IN_MILLIS); ingestmethod(filePath,decompressFilePath); downloadSuccess = true; } catch (MalformedURLException e) { LOG.warn("some message"); } catch (IOException e) { LOG.warn("some message); } } return downloadSuccess }
has comment: http://stackoverflow.com/comment/31745752
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31745828
tagged with: apache-commons-io
has title: Error in FileUtils.copyUrlToFile
answer count: 0

http://stackoverflow.com/q/21062427
has answer: http://stackoverflow.com/a/21062474
has answer: http://stackoverflow.com/a/21062489
has comment: http://stackoverflow.com/comment/31672463
has answer: http://stackoverflow.com/a/21062530
has answer: http://stackoverflow.com/a/21062473
tagged with: arrays
has title: java.lang.ArrayIndexOutOfBoundsException:0
favorite count: 0
type: Question
has body: Given the following code package parkinglottest; public class ParkingLotTest { public static void main(String[] args) { ParkingLot p=new ParkingLot(15); System.out.println(p.getMax()); Car c1=new Car(1); Car c2=new Car(2); p.addCar(c1);//at parkinglottest.ParkingLotTest.main(ParkingLotTest.java:14) p.addCar(c2); } } package parkinglottest; public class ParkingLot { private int max; public ParkingLot(int max) { this.max=max; } private Car[] cars=new Car[max];//if instead of "max" i put any other positive integer, it works just fine. int nr=0; public void addCar(Car c) { cars[nr++]=c; //at parkinglottest.ParkingLot.addCar(ParkingLot.java:17) } public int getMax(){ return max; } } i get an ArrayIndexOutOfBoundsException.
has comment: http://stackoverflow.com/comment/31672536
has comment: http://stackoverflow.com/comment/31672668
has answer: http://stackoverflow.com/a/21062472
has answer: http://stackoverflow.com/a/21062610
has comment: http://stackoverflow.com/comment/31672493
has answer: http://stackoverflow.com/a/21062487
score: 0
upvote count: 1
downvote count: 1
answer count: 7
has comment: http://stackoverflow.com/comment/31672403
has comment: http://stackoverflow.com/comment/31672469
has comment: http://stackoverflow.com/comment/31672462
tagged with: java
tagged with: indexoutofboundsexception
type: UnansweredQuestion

http://stackoverflow.com/a/21107742
upvote count: 1
downvote count: 0
has body: This code actually works.Place this code on a button click(feedback) private void sendEmail() { File photo = new File("sdcard/Video Tell Images/" + ViewVideo.saved_image_name); Uri imageuri = Uri.fromFile(photo); Intent send_report = new Intent(Intent.ACTION_SENDTO, Uri.fromParts( "mailto", "youremail@example.com", null)); send_report.setClassName("com.google.android.gm", "com.google.android.gm.ComposeActivityGmail"); send_report.putExtra(Intent.EXTRA_TEXT, "View my image"); send_report.setType("text/plain"); startActivity(send_report); }
type: Answer
answers question: http://stackoverflow.com/q/21107643
score: 1

http://stackoverflow.com/a/21143740
has body: Looks like the Process class has a getOutputStream() method. You could try something like this: OutputStream os = p.getOutputStream(); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os)); bw.write("stop"); bw.newLine(); bw.flush();
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21143234
answers question: http://stackoverflow.com/q/21143234

http://stackoverflow.com/comment/31649618
type: Comment
score: 0
type: QuestionComment
has text: Yes, I see that now, @assylias. Editing to clarify. The code is a bit of a mess. Note that "unclear" means unclear.
comment on: http://stackoverflow.com/q/21049978

http://stackoverflow.com/comment/31868663
comment on: http://stackoverflow.com/q/21169692
score: 0
type: Comment
type: QuestionComment
has text: Tough question to answer, what defines infinite in your case? 10 minutes? 20?

http://stackoverflow.com/comment/31799780
type: Comment
comment on: http://stackoverflow.com/a/21131124
score: 0
type: AnswerComment
has text: @ufis I somewhat agree, but that's why SO asks users to check google before asking a question. The OP in this case seems to have done that, he seems to know how regexes work

http://stackoverflow.com/comment/31869476
type: Comment
type: QuestionComment
has text: @hyde sorry, I put it in a very complicated way, and BTW i am actually started reading LFS last week.
score: 0
comment on: http://stackoverflow.com/q/21168637

http://stackoverflow.com/q/21038791
tagged with: jsoup
answer count: 1
tagged with: javascript
has title: JSoup and JavaScript
accepted answer: http://stackoverflow.com/a/21038982
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/21038982
has body: I am trying to post something on this website: www.omegastrike.co.uk using an Android app I am making. I want to post it in the shoutbox part, wich is using javascript to do this. I tried using JSoup, but it doesn't support JavaScript. I also tried using HTMLUnit, but that doesn't support Android. Is there any other way of doing it? This is the Javascript use for the posting: postShout: function() { message = $("shout_data").value; if (message == "") { return false; } $("shouting-status").value = ShoutBox.lang[0]; postData = "shout_data="+encodeURIComponent(message).replace(/\+/g, "%2B"); new Ajax.Request('xmlhttp.php?action=add_shout', {method: 'post', postBody: postData, onComplete: function(request) { ShoutBox.postedShout(request); }}); }, Can I do something with the Ajax request perhaps? or does anyone have any other ideas to get this done? I do not want to use WebView. Thanks
type: AnsweredQuestion
tagged with: java
type: Question

jcombobox
tags question: http://stackoverflow.com/q/21103394
tags question: http://stackoverflow.com/q/21098931
tags question: http://stackoverflow.com/q/21159151
tags question: http://stackoverflow.com/q/21129365
tags question: http://stackoverflow.com/q/21126216
tags question: http://stackoverflow.com/q/21135983
type: Tag
tag name: jcombobox
tags question: http://stackoverflow.com/q/21166788
tags question: http://stackoverflow.com/q/21160549
tags question: http://stackoverflow.com/q/21066369

http://stackoverflow.com/comment/31821731
type: AnswerComment
type: Comment
has text: sounds impressive. can i generate the diagram from the command line?
comment on: http://stackoverflow.com/a/21142360
score: 0

http://stackoverflow.com/comment/31614321
comment on: http://stackoverflow.com/a/21030209
type: AnswerComment
score: 0
type: Comment
has text: Correction: *English* letter. `Ö` is a letter too and will not be matched by either part of the regex. For example. Still, +1 from me for a succint answer that explains how it works.

http://stackoverflow.com/q/21113706
tagged with: paintcomponent
favorite count: 0
type: UnansweredQuestion
tagged with: swing
tagged with: jbutton
score: 3
has answer: http://stackoverflow.com/a/21145050
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/21115993
type: Question
downvote count: 0
has body: I am trying to create an application (Java) that includes a map. Each County or state, needs to have it's own mouseover, mouseClicked methods and so on. The way I am attempting to do this is by overriding the paintComponent and paintBorder methods within a custom Class that extends JButton. The Code and Resulting screenshot: public class CustomButton extends JButton implements MouseListener { private Polygon shape; private boolean isMouseOver; private Color buttonColor = new Color(100,100,100); public CustomButton (Polygon shape,Color buttonColor) { //this.setText(text); this.buttonColor = buttonColor; this.shape = shape; setContentAreaFilled(false); addMouseListener(this); } @Override public Dimension getPreferredSize() { return (new Dimension(120, 120)); } // Hit detection public boolean contains(int x, int y) { return shape.contains(x, y); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D)g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON); if (isMouseOver &amp;&amp; isEnabled()) { g.setColor(new Color(buttonColor.getRed()+50,buttonColor.getGreen()+50,buttonColor.getBlue()+50)); }else{ g.setColor(buttonColor); } g.fillPolygon(shape); } protected void paintBorder(Graphics g) { Graphics2D g2d = (Graphics2D)g; g2d.setStroke(new BasicStroke(2)); if (isMouseOver &amp;&amp; isEnabled()) { g2d.setColor(new Color(buttonColor.getRed()-50,buttonColor.getGreen()-50,buttonColor.getBlue()-50)); }else{ g2d.setColor(new Color(buttonColor.getRed()-100,buttonColor.getGreen()-100,buttonColor.getBlue()-100)); } g2d.drawPolygon(shape); } The Result: What I would like to Achieve (Edited in Paint): I assume this is because even though I am overriding the paintComponent method. This only modifies what is painted inside the JButton? So the Boundary of the JButton remains rectangular? Is there a way to fix this? Or should I be trying to achieve this in a completely different way? Any Help w…
answer count: 3
has title: Custom JButton paintComponent Method Modifies Shape Visually? Not Actual Button Shape?
has answer: http://stackoverflow.com/a/21122862

http://stackoverflow.com/comment/31972982
type: QuestionComment
comment on: http://stackoverflow.com/q/21182632
score: 0
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/45607/discussion-between-rajavel-d-and-user3200809)
type: Comment

http://stackoverflow.com/comment/31632573
type: Comment
type: QuestionComment
has text: How does your writeLines method looks like?
score: 0
comment on: http://stackoverflow.com/q/21040854

http://stackoverflow.com/a/21028077
has body: Yes, you can. If you change your getIntFromEditText method so that it does not throw an exception, but just returns 0 for an error, you can compress this code. The new method: private int getIntFromEditText (EditText et) { try { return Integer.parseInt(et.getText().toString()); } catch (NumberFormatException numberFormatException) { return 0; } } Now your getEndTimeFromEditTexts method can look more like this: private long getEndTimeFromEditTexts () { int seconds = 0; int minutes = 0; int hours = 0; seconds = this.getIntFromEditText(this.secondsEditText); minutes = this.getIntFromEditText(this.minutesEditText); hours = this.getIntFromEditText(this.hoursEditText); long endTimeMs = System.currentTimeMillis() + (seconds * 1000) + (minutes * 1000 * 60) + (hours * 1000 * 60 * 60); return endTimeMs; } The end result will do exactly what your code already did.
score: 0
answers question: http://stackoverflow.com/q/21027171
type: Answer

http://stackoverflow.com/comment/31881891
comment on: http://stackoverflow.com/a/21176736
type: AnswerComment
score: 0
type: Comment
has text: Yeah, I "kind of" hinted at that in code comment ;), but given the fact that you can execute code in a method, constructor or static block, I was trying to cover my bases - can't please every body ;)

http://stackoverflow.com/q/21161430
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/21303171
score: 1
has title: Render Tapestry page and get it as Stream/String resource
tagged with: java
type: Question
answer count: 2
has body: Is any convinient way to dynamically render some page inside application and then retrieve its contents as InputStream or String? For example, the simplest way is: // generate url Link link = linkSource.createPageRenderLink("SomePageLink"); String urlAsString = link.toAbsoluteURI() + "/customParam/" + customParamValue; // get info stream from url HttpGet httpGet = new HttpGet(urlAsString); httpGet.addHeader("cookie", request.getHeader("cookie")); HttpResponse response = new DefaultHttpClient().execute(httpGet); InputStream is = response.getEntity().getContent(); ... But it seems it must be some more easy method how to archive the same result. Any ideas?
downvote count: 0
tagged with: tapestry
has answer: http://stackoverflow.com/a/21168415

http://stackoverflow.com/q/21074387
type: UnansweredQuestion
tagged with: stringbuilder
tagged with: java
tagged with: ascii
type: Question
answer count: 1
downvote count: 0
has body: I'm trying to read text from a file, pick out all characters and write into another file. Then the words shall be counted. Problem is when ENTER/newline come into picture. if original text is first row second row It become read as first rowsecond row (writing everything on 1 row ok) Original has 4 words, the written has 3 which is incorrect. The probably quite noobish solution that I'm trying to implement is to translate each char into decimal value (ASCII?) by typing e.g. for(int i=0; i&lt; currentStringLine.lengt ; i++) { char curr = currentStringLine.charAt(index); int cc = curr; if( ( cc&gt;=65 &amp;&amp; cc&lt;=90) || ( cc&gt;=97 &amp;&amp; cc&lt;=122)|| cc==228 || cc==229 || cc==196 || cc==197 || cc==246 || cc==214 || cc==32 ) { //stringbuilder etc }//end if }//end forloop Which is basically A-Z, a-z, and ÅÄÖåäö The issue: Im trying to make a corresponding if-statement regarding newlines / "ENTER's" but I cant seem to pull it off. Looking at http://www.asciitable.com/ tried with 13 for "carriage return" and 10 for "NL line feed / newline" (separately) without success.
favorite count: 0
has title: i wide shortIdentify "ENTER" as decimal value
tagged with: char
has comment: http://stackoverflow.com/comment/31694470
has comment: http://stackoverflow.com/comment/31694529
score: 2
has answer: http://stackoverflow.com/a/21074416
upvote count: 2

http://stackoverflow.com/comment/68310975
has text: I checked Java from here: https://jdk9.java.net/download But unfortunately my test app (jdiskreport) runs in an error which I can not debug right now. All I can see the discrete graphics is still activated, so for me it looks like there is no fix within.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/40193683
type: AnswerComment

http://stackoverflow.com/comment/31746414
score: 0
type: Comment
has text: Yeah +1. The whole idea is that there are (were) three methods that where each individually atomic.
comment on: http://stackoverflow.com/a/21101904
type: AnswerComment

http://stackoverflow.com/comment/31642465
comment on: http://stackoverflow.com/a/21045885
score: 0
type: AnswerComment
type: Comment
has text: Try to use [Primefaces Request Context Validation](http://www.primefaces.org/showcase/ui/requestContext.jsf) to test if validation fails

http://stackoverflow.com/a/21058140
answers question: http://stackoverflow.com/q/21058019
has body: The Application without exception when i Commented these lines:if(curr.left==null) break A; if(curr.right==null) break A; my Code is buildTree(new int[]{1,0,1}); and result is 1,no error。Can you provide more detailed information
has comment: http://stackoverflow.com/comment/31664793
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/21058019
type: Answer

http://stackoverflow.com/comment/31798478
type: QuestionComment
has text: I want to convert `BufferedImage` into `Bitmap`. or is there any way to set `java.awt.Image` in `ImageView`?
comment on: http://stackoverflow.com/q/21130705
score: 0
type: Comment

http://stackoverflow.com/comment/31643029
comment on: http://stackoverflow.com/a/21045885
type: AnswerComment
score: 0
type: Comment
has text: With process=":form:display,:form:packages,@this" in commandButton Dialog can be enought to process information you need.

http://stackoverflow.com/q/21028164
has comment: http://stackoverflow.com/comment/31610254
score: 4
upvote count: 4
answer count: 3
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/47769155
has answer: http://stackoverflow.com/a/21028423
accepted answer: http://stackoverflow.com/a/21028423
tagged with: properties
has comment: http://stackoverflow.com/comment/31612298
has body: I have a properties file called configuration.properties, within configuration.properties is the key-value pair: email.recipients = sam@yahoo.com, bob@yahoo.com In my Util.java class I load the configuration.properties file: import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.commons.configuration.ConfigurationException; PropertiesConfiguration config = new PropertiesConfiguration("configuration.properties"); EMAIL_RECIPIENT_STRING = config.getString("email.recipients"); I expected to have EMAIL_RECIPIENT_STRING = "sam@yahoo.com, bob@yahoo.com", but I get EMAIL_RECIPIENT_STRING = "sam@yahoo.com" only. What's the reason for this happening?
type: AnsweredQuestion
tagged with: java
type: Question
has title: Value in properties file split by comma, reading file only loads first element
has answer: http://stackoverflow.com/a/21028412
tagged with: split
has answer: http://stackoverflow.com/a/47769155
has comment: http://stackoverflow.com/comment/31610257

http://stackoverflow.com/a/21131521
type: Answer
answers question: http://stackoverflow.com/q/21131482
score: 0
has body: An abstract method is a method that belongs to an abstract class but has no implementation which means that it has to be implemented (or overridden) by any children of the abstract class.

http://stackoverflow.com/q/21131319
has comment: http://stackoverflow.com/comment/31800043
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31799503
has comment: http://stackoverflow.com/comment/31799119
upvote count: 2
has comment: http://stackoverflow.com/comment/31799431
has body: It seems that dispatcher-servlet unable to perform component scan using. <context:component-scan base-package="abc" /> In my controller file (HelloController.java) under package abc. Code is written as follows: @Controller @RequestMapping("/hello") public class HelloController { @RequestMapping(method = RequestMethod.GET) public String printHello(ModelMap model) { model.addAttribute("message", "Hello Spring MVC Framework!"); return "hello"; //I have already made hello.jsp in web-inf/jsp/ } } My Application name is SpringMiddle. When try url as: http://localhost:8080/SpringMiddle/hello.htm I do have following url pattern in web.xml dispatcher *.htm It shows me error HTTP 404 not found. EDIT: : it shows me warning WARNING: No mapping found for HTTP request with URI [/SpringMiddle/hello.htm] in DispatcherServlet with name 'dispatcher'
has comment: http://stackoverflow.com/comment/31800546
tagged with: url-routing
has answer: http://stackoverflow.com/a/21132223
has answer: http://stackoverflow.com/a/21131679
type: Question
tagged with: spring-mvc
tagged with: java
possible better answer: http://stackoverflow.com/a/21132223
has comment: http://stackoverflow.com/comment/31799630
has comment: http://stackoverflow.com/comment/31799198
has comment: http://stackoverflow.com/comment/31799212
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/21131679
favorite count: 0
has title: Unable to find controller in spring web mvc

ksoap2
type: Tag
tags question: http://stackoverflow.com/q/21087771
tags question: http://stackoverflow.com/q/21026095
tag name: ksoap2

http://stackoverflow.com/a/21033772
score: 4
answers question: http://stackoverflow.com/q/21033735
type: Answer
has body: Future#get blocks until the Callable completes, this means, you are blocking the Event Dispatching Thread until the Callable completes, meaning that UI can no longer respond to events being generated... A better solution would be to use a SwingWorker, which is conceptually the same thing, except that it has functionality for providing feedback into the EDT, specifically, in this case the done method. Which is called when the worker completes, but is called from within the context of the EDT, making it save to update the UI. Take a look at Concurrency in Swing and Worker Threads and SwingWorker in particular...
has comment: http://stackoverflow.com/comment/31664519
has comment: http://stackoverflow.com/comment/31664187
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/21078109
tagged with: java
has title: Inserting data to database in the onClick method
has comment: http://stackoverflow.com/comment/31701893
has comment: http://stackoverflow.com/comment/31701128
has body: MainActivity: public class MainActivity extends Activity implements SensorEventListener, OnClickListener { private SensorManager mSensorManager; private Sensor mAcc; TextView xaxis,yaxis,zaxis,ballxy,gps,statics; public float velocity = 10.6f; public float xPosition,yPosition,zPosition; public static float staticXposition,staticYposition,staticZposition; private Database myDBAdapter; public ContentValues values; public String GPSposition; public SQLiteDatabase db; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); mAcc = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); LocationManager locMgr = (LocationManager)getSystemService(Context.LOCATION_SERVICE); LocationListener locList = new LocationListener() { @Override public void onStatusChanged(String provider, int status, Bundle extras) { // TODO Auto-generated method stub } @Override public void onProviderEnabled(String provider) { // TODO Auto-generated method stub } @Override public void onProviderDisabled(String provider) { // TODO Auto-generated method stub } @Override public void onLocationChanged(Location location) { gps.setText("GPS:"+location.getLatitude()+";"+location.getLongitude()); GPSposition = location.getLatitude() + " " + location.getLongitude(); } }; locMgr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locList); // inicjowanie TextView gps = (TextView) findViewById(R.id.gps); xaxis = (TextView) findViewById(R.id.xaxis); yaxis = (TextView) findViewById(R.id.yaxis); zaxis = (TextView) findViewById(R.id.zaxis); ballxy = (TextView) findViewById(R.id.ballxy); statics = (TextView) findViewById(R.id.statics); Button start = (Button) findViewById(R.id.start); start.setOnClickListener(this); myDBAdapter = new Database(this).open(); //TODO Any database operations myDBAdapter.close(); } public void insertData(){ String time; Ti…
accepted answer: http://stackoverflow.com/a/21078356
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31701474
type: Question
tagged with: android
tagged with: sqlite
score: 0
has answer: http://stackoverflow.com/a/21078356
answer count: 1

http://stackoverflow.com/a/21165636
answers question: http://stackoverflow.com/q/21100364
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/21100364
type: AcceptedAnswer
downvote count: 0
has body: What made it work in Safari is by turning off cookie restriction to accept from Third party. Same is true for the IE as well.The default setting is not to acccept 3rd party cookie. For FF/Chrome the default option is to accept 3rd party cookies. I have used Webscarab tool to debug this issue. The application that was inside of the iframe was on AmazonWebservices the URL pattern was totally different from the origination Site. so that made browser think that these calls are made from/to some external site. So based on the Browser cookie setting the browser severed up the Application inside of the iframe. Also, the 2 URL look like this to the browser. http://one.roses.flowers.org/ http://test-dev.elasticbeanstalk.com/ We added the Alias/cname to the project on the AmazonWebservice(AWS) server in the higher environment(QA/PROD) something shown below. By adding alias to the url browser don't consider the URL coming from 3rd party as both has same domain name. Now the solution is independent of the browser cookie settings. http://test-dev.elasticbeanstalk.com/ ---&gt; http://aws.newsite.flowers.org

http://stackoverflow.com/a/21095916
score: 2
has comment: http://stackoverflow.com/comment/31736687
accepted answer of: http://stackoverflow.com/q/21095602
has comment: http://stackoverflow.com/comment/31738369
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31777224
type: Answer
has comment: http://stackoverflow.com/comment/31737529
answers question: http://stackoverflow.com/q/21095602
upvote count: 2
has body: When constructing the zipfile, explicitly specifying the encoding: file1 = new ZipFile(sZipFileOld, Charset.forName("IBM437")); Zip files doesn't use the default UTF-8 encoding for special characters

http://stackoverflow.com/comment/31637949
type: Comment
has text: What you said may be right in a long time system.But anyway,java is a interpreted programming language,and HotSpot just compiles Hot code.
comment on: http://stackoverflow.com/a/21043597
type: AnswerComment
score: 0

getmethod
tag name: getmethod
tags question: http://stackoverflow.com/q/21176010
type: Tag

http://stackoverflow.com/a/21138103
has body: The documentation states: java.util.Calendar.MONTH MONTH public static final int MONTH Field number for get and set indicating the month. This is a calendar-specific value. The first month of the year in the Gregorian and Julian calendars is JANUARY which is 0; the last depends on the number of months in a year. -> Counting starts at 0 for Calendar.MONTH
accepted answer of: http://stackoverflow.com/q/21137941
type: Answer
answers question: http://stackoverflow.com/q/21137941
score: 3
downvote count: 0
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/31858419
score: 0
has text: @Raghunandan so i should create other ArrayList and fill it with filtered data.. but this new ArrayList where should i create? in MainActivity or in CustomAdapter? because now a fill the original ArrayList with parse xml in MainActivity
comment on: http://stackoverflow.com/q/21164147
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21099526
answer count: 1
has title: How do I create an action when all monsters are dead in maplestory?
has comment: http://stackoverflow.com/comment/31741085
has body: Lets make some code Examples to help you understand me and then I'll write my question in letters, hope you will help me to solve it :). Btw, I'm programming an maplestory source that is based on java for who that know about the game source codes. *For the peoples who know about maplestory source code, I want to create an action that happens when all monsters on the map are dead, the first action is the Summon action its summoning the mobs. So action2() it's the Action that happens when mobCount method is 0. Okay then I got this code for example: private int number; public void action1() { this.number = 1; action2();//it calls action2. } public void action2() { } Now I need action2() to start when numb for example = 0. I already got the get method and the set method and all of that, but when I run action1() Number must stay 1. It has to call action2() because then no one else call it, but I need action2() to action only when number = 0. I'll create the action that set number back to 0 later, but for now I need to make it freeze and wait until number change back to 0 or else the action will not run and when number will be equals 0 then action2() will run the action. I hope I explained myself clear enough to make you guys know what I mean.
has comment: http://stackoverflow.com/comment/31741408
favorite count: 0
has comment: http://stackoverflow.com/comment/31741126
has comment: http://stackoverflow.com/comment/31741176
upvote count: 2
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/31742310
has comment: http://stackoverflow.com/comment/31741288
has comment: http://stackoverflow.com/comment/31741403
has comment: http://stackoverflow.com/comment/31743169
tagged with: java
has comment: http://stackoverflow.com/comment/31741506
has comment: http://stackoverflow.com/comment/31741199
has comment: http://stackoverflow.com/comment/31741587
has comment: http://stackoverflow.com/comment/31741016
type: Question
tagged with: game-engine
score: 0
has answer: http://stackoverflow.com/a/21099726
has comment: http://stackoverflow.com/comment/31741179

http://stackoverflow.com/comment/31662304
comment on: http://stackoverflow.com/q/21056815
score: 0
type: Comment
has text: Yes, I'm sure. Shouldn't the project folder be the 'base folder' for the project? Why is bin the "starting point"?
type: QuestionComment

http://stackoverflow.com/comment/31800420
type: Comment
has text: @JeroenVannevel It's `binarySearch` from the JDK. He's asking about it.
type: QuestionComment
comment on: http://stackoverflow.com/q/21132073
score: 0

http://stackoverflow.com/comment/31713065
comment on: http://stackoverflow.com/q/21084225
score: 0
type: Comment
type: QuestionComment
has text: Can you post how it fails? What exception do you get?

http://stackoverflow.com/comment/31851387
comment on: http://stackoverflow.com/q/21160212
has text: You need to consider memory leaks
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/21069905
linked to: http://stackoverflow.com/q/3177733
has answer: http://stackoverflow.com/a/21069948
answer count: 2
upvote count: 1
has body: Below code is an output.jsp to display the data submitted from submit.jsp in a format. I am fairly new to JSP and would like some guidance in how to pass paramaters firstname/lastname into html tags. Please advise . I have tried couple of approcahes with no success. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" Insert title here <h>The first and last name are</h> <% String firstname = (String) request.getAttribute("firstname"); String lastname = (String) request.getAttribute("lastname"); //out.println(firstname + " " + lastname); %> First Name : <% firstname %> Last Name : <% lastname %> Here is the error that are thrown when running output.jsp. An error occurred at line: 20 in the jsp file: /output.jsp firstname cannot be resolved to a type 17: %> 18: 19: 20: First Name : <% firstname %> 21: 22: 23: Last Name : <% lastname %> An error occurred at line: 23 in the jsp file: /output.jsp lastname cannot be resolved to a type 20: First Name : <% firstname %> 21: 22: 23: Last Name : <% lastname %> 24: 25: 26:
possible better answer: http://stackoverflow.com/a/21070035
has answer: http://stackoverflow.com/a/21070035
tagged with: java
accepted answer: http://stackoverflow.com/a/21069948
type: AnsweredQuestion
downvote count: 0
tagged with: jsp
score: 1
favorite count: 0
type: Question
has title: How to pass String paramaters in jsp?

http://stackoverflow.com/comment/31717443
type: AnswerComment
type: Comment
has text: Please provide code, where and how you create menu at runtime.
comment on: http://stackoverflow.com/a/21086661
score: 0

http://stackoverflow.com/a/50811502
has body: This is how i achieved it, Please suit yourselves if you want a OnetoMany dependency or a ManyToMany dependency User-> Role. So the basic idea is : Create table User &amp; SystemRole in the database and add entries to the static table SystemRole. Ensure that the SystemRole has no constructor to instantiate any Role. Whenever you want to asscociate any Role with a User simply use a method which will take an input as the UserName and return the UserRole Object. Simply use a query to retrieve these details , I havent added these details here since i am using Springboot Application which uses a CrudRepository. Lastly ensure that the dependency(manytomany/onetoMany) doesnt have a cascade type since Systemrole is already saved. User.java: import java.util.Set; import javax.persistence.*; @Entity @Table(name = "User") public class User { public User() { } public User(String name, Set&lt;SystemRole&gt; roles) { this.name = name; this.roles = roles; } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; private String name; private boolean enabled; @ManyToMany private Set&lt;SystemRole&gt; roles; public Set&lt;SystemRole&gt; getRoles() { return roles; } public void setRoles(Set&lt;SystemRole&gt; roles) { this.roles = roles; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Transient public boolean isEnabled() { return enabled; } @Column(name = "ENABLED") public int isEnabledasInt() { return enabled ? 1 : 0; } public void setEnabled(int enabled) { this.enabled = (1 == enabled) ? true : false; } } SystemRole.java : package com.spring.security.model; import javax.persistence.*; @Entity @Table(name = "System_Role") public class SystemRole { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; private String name; private SystemRole() { } public int getId() { return id; } public void setId(int id) { this.id = id; } pu…
answers question: http://stackoverflow.com/q/21136117
type: Answer
score: 0

http://stackoverflow.com/a/21167805
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21167729
has comment: http://stackoverflow.com/comment/31865494
type: AcceptedAnswer
has body: Collection&lt;A&gt; does not extend Collection&lt;Base&gt; even though A extends Base. So it is absolutely normal to see this error at compile time. Given that you cannot change the definition of printBase, here is a possible workaround. import java.util.ArrayList; import java.util.Collection; class Base { } class A extends Base { } public class MyType { public void printBase(Collection&lt;Base&gt; bases) { for (Base base : bases) { System.out.println(base.toString()); } } public &lt;A extends Base&gt; void myMethod(Collection&lt;A&gt; things) { Collection&lt;Base&gt; lst = new ArrayList&lt;Base&gt;(); lst.addAll(things); printBase(lst); } }
has comment: http://stackoverflow.com/comment/31865223
type: Answer
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/21167729

http://stackoverflow.com/comment/31837058
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21151844
has text: Hint: You've already computed `maxCounts`; now write a second loop that goes through `counts`.

http://stackoverflow.com/comment/31833670
comment on: http://stackoverflow.com/q/21123610
has text: No I don't have that filter. I thought the Spring Boot Actuator would have auto configured it.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/32026629
comment on: http://stackoverflow.com/q/21145293
score: 0
type: Comment
has text: Does the same thing in Windows 7 and XP.
type: QuestionComment

http://stackoverflow.com/a/21056797
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21056673
type: Answer
accepted answer of: http://stackoverflow.com/q/21056673
has comment: http://stackoverflow.com/comment/31662575
has comment: http://stackoverflow.com/comment/31740908
has comment: http://stackoverflow.com/comment/31742093
score: 0
has body: int i = 0; boolean valueChanged = false; while(some good condition) { if (i % 100 == 0) { i++; valueChanged = true; } } if(valueChanged) { System.out.println("Changed :D"); }

http://stackoverflow.com/comment/31781275
comment on: http://stackoverflow.com/q/21121256
type: Comment
type: QuestionComment
has text: @chrylis Maybe I wasn't clear. What I meant was that after *every* source has been compiled (so that all that's left to do is run the program), there's no reason for the program to know whether a variable, parameter, or method return type was _declared_ as `Foo`, `Object`, or anything else. That information doesn't need to be retained, as far as I know (unless it's somehow needed for reflection?). I think that's what the OP is getting at, but I could have misunderstood the question.
score: 0

jenkins
tags question: http://stackoverflow.com/q/21137039
tag name: jenkins
tags question: http://stackoverflow.com/q/21109893
tags question: http://stackoverflow.com/q/21116974
tags question: http://stackoverflow.com/q/21110181
tags question: http://stackoverflow.com/q/21130722
tags question: http://stackoverflow.com/q/21093416
tags question: http://stackoverflow.com/q/21177397
tags question: http://stackoverflow.com/q/21134867
type: Tag
tags question: http://stackoverflow.com/q/21086380

http://stackoverflow.com/q/21165179
tagged with: constructor
has title: Constructor is making my code ugly, and making me input irrelevant code , JAVA
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31860122
has answer: http://stackoverflow.com/a/21165504
has comment: http://stackoverflow.com/comment/31860278
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/31860169
has comment: http://stackoverflow.com/comment/31860280
has comment: http://stackoverflow.com/comment/31860539
has answer: http://stackoverflow.com/a/21165381
type: Question
has comment: http://stackoverflow.com/comment/31860602
has comment: http://stackoverflow.com/comment/31860290
has body: the "blah","blah",1,1 is irrelevant since i dont get to use it i just inputted some random string and int because java asks me to do so because of the constructor Pokemon(). btw in this task, we we're not allowed to use static and i needed to do this so i can use "fight"method because i needed to make an instance. i also tried just using a random already-created object like party[0].fight(team1,team2); but its uglier and looks more irrelevant. package pokemon; import java.util.Random; public class PokemonMain { public static void main(String[] args){ Pokemon[] party = new Pokemon[6]; Pokemon[] party2 = new Pokemon[6]; party[0] = new Pokemon("pikachu", "electric", 500, 1); party[1] = new Pokemon("raichu", "electric", 500, 1); party[2] = new Pokemon("charmander", "water", 500, 1); party[3] = new Pokemon("magikarp", "electric", 500, 1); party[4] = new Pokemon("bulbasaur", "electric", 500, 1); party[5] = new Pokemon("kabuto", "electric", 500, 1); party2[0] = new Pokemon("pikachu2", "electric", 500, 1); party2[1] = new Pokemon("raichu2", "electric", 500, 1); party2[2] = new Pokemon("charmander2", "water", 500, 1); party2[3] = new Pokemon("magikarp2", "electric", 500, 1); party2[4] = new Pokemon("bulbasaur2", "electric", 500, 1); party2[5] = new Pokemon("kabuto2", "electric", 500, 1); //Picks random pockemons given an array of pokemons Random randomGenerator = new Random(); int randomInt = randomGenerator.nextInt(6); Pokemon team1 = party[randomInt]; randomInt = randomGenerator.nextInt(6); Pokemon team2 = party2[randomInt]; Pokemon forTheSakeOfTheMethod = new Pokemon("blah","blah",1,1); //the "blah","blah",1,1 is irrelevant since i dont get to use it // i just inputted some random string and int because java asks me to do so //because of the constructor Pokemon(). //btw in this task, we we're not allowed to use static //and i needed to do this so i can use "fight"method because i needed to make an //instance. // i also tried just using a random already-created object like…
score: -3
answer count: 3
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21165301

http://stackoverflow.com/a/21677555
accepted answer of: http://stackoverflow.com/q/21181551
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/78440072
type: Answer
upvote count: 6
score: 6
has body: DataValidation is stored even in HSSF workbook, but it is in Internal Sheet of the library and since it is private so access to it is not given to application programmer. I have used Java Reflection API to access internal sheet. This code is working fine for me. private ArrayList&lt;DVRecord&gt; init(FileInputStream fis) throws InvalidFormatException, IOException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { HSSFWorkbook hWorkbook = (HSSFWorkbook) WorkbookFactory.create(fis); HSSFSheet hSheet = hWorkbook.getSheetAt(1); // sheet on which you want to read data validation Class c = org.apache.poi.hssf.usermodel.HSSFSheet.class; Field field = c.getDeclaredField("_sheet"); field.setAccessible(true); Object internalSheet = field.get(hSheet); InternalSheet is = (InternalSheet) internalSheet; DataValidityTable dvTable = is.getOrCreateDataValidityTable(); Class c2 = org.apache.poi.hssf.record.aggregates.DataValidityTable.class; Field field2 = c2.getDeclaredField("_validationList"); field2.setAccessible(true); Object records = field2.get(dvTable); ArrayList&lt;DVRecord&gt; dvRecords = (ArrayList&lt;DVRecord&gt;) records; return dvRecords; }
answers question: http://stackoverflow.com/q/21181551

http://stackoverflow.com/a/21080275
answers question: http://stackoverflow.com/q/21079482
type: Answer
has body: Have you seen the Jboss Quickstarts? They're not that big, but looking at the parts that interested me certainly helped get my feet wet with JavaEE-6. For JSF, I'd try the Tasks and Tasks-JSF examples.
score: 0

http://stackoverflow.com/comment/31672805
type: QuestionComment
comment on: http://stackoverflow.com/q/21060882
has text: That is fine - you were using grouping in your regex which is why I was wondering if you were wanting to split using regex.
score: 0
type: Comment

http://stackoverflow.com/comment/31700823
has text: @Ashish... included in the question. please reply ASAP
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21076825
score: 0

http://stackoverflow.com/comment/31716009
comment on: http://stackoverflow.com/q/21085705
has text: @JonSkeet : I am using `asm` framework to modify bytecode. And I am using `ASMifier` class to view ASM equivalent output of the bytecode modification. And I am using `MethodVisitor` class to modify bytecode.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31892263
type: QuestionComment
comment on: http://stackoverflow.com/q/21182882
type: Comment
has text: where are you notifying data set changed by the way ?
score: 1

http://stackoverflow.com/q/21123246
score: 0
answer count: 2
tagged with: arrays
has comment: http://stackoverflow.com/comment/31784701
has answer: http://stackoverflow.com/a/21123410
accepted answer: http://stackoverflow.com/a/21123498
has comment: http://stackoverflow.com/comment/31784764
has body: I wrote the following, this is a toString of a Country class that has City class in same package, and _cities is an array represents the cities within my Country: **EDITED:** public String toString(){ String allCitiesData = ""; //must be initialized for(int i=0;this._cities[i] != null;i++)//run all over the cities until reach the end(null cell) { //concat new city to the string and adds a new line between allCitiesData = allCitiesData.concat(this._cities[i].toString()+"\n\n"); } return allCitiesData; }//toString method public String citiesNorthOf(String cityName){ String allCitiesNorthOf = "";// must be initialized for(int i=0; this._cities[i] != null ; i++) { if (this._cities[i].getCityName() == cityName) { Point referenceCityCenter = new Point(this._cities[i].getCityCenter()); } } for(int i=0; this._cities[i] != null ; i++)//we don't need to exclude the comparable city itself because it will give a false { if (this._cities[i].getCityCenter().isAbove(referenceCityCenter)) { allCitiesNorthOf = allCitiesNorthOf.concat(this._cities[i].toString()+"\n\n"); } } }//citiesNorthOf method But, when I run it, it shows a single error only on this line: if (this._cities[i].getCityCenter().isAbove(referenceCityCenter)) And the Eclipse says: "referenceCityCenter cannot be resolved to a variable".. any suggestions ? Thanks !!
has answer: http://stackoverflow.com/a/21123498
has comment: http://stackoverflow.com/comment/31784557
has comment: http://stackoverflow.com/comment/31784599
has title: Java - object existence dilem
has comment: http://stackoverflow.com/comment/31784778
type: AnsweredQuestion
tagged with: object
tagged with: java
has comment: http://stackoverflow.com/comment/31784640
possible better answer: http://stackoverflow.com/a/21123410
type: Question

http://stackoverflow.com/comment/31847436
type: Comment
has text: The 1.7 compiler is fully capable of generating 1.6 compliant bytecode; `-source 1.6 -target 1.6`
comment on: http://stackoverflow.com/a/21157728
type: AnswerComment
score: 0

http://stackoverflow.com/q/21113752
has comment: http://stackoverflow.com/comment/31772568
tagged with: rtf
has comment: http://stackoverflow.com/comment/31771387
score: 3
tagged with: java
has title: Converting RTF to HTML using Java - tweaking for Unicode
type: Question
has comment: http://stackoverflow.com/comment/31773479
has body: I am trying to display .msg files (i.e. Outlook emails) in my Web Application using JSP. I am using the parser http://auxilii.com/msgparser/ which extracts the body content of the email which is stored as RTF (sometimes or always - I haven't checked) The parser itself comes with two converters from RTF to HTML, SimpleRTF2HTMLConverter (which doesn't work at all for me) and JEditorPaneRTF2HTMLConverter (which works but doesn't convert the Hebrew text properly but just displays question marks) Is there anyway of tweaking the JEditorPaneRTF2HTMLConverter code (reproduced below) for UniCode in general (and Hebrew specifically)? public class JEditorPaneRTF2HTMLConverter implements RTF2HTMLConverter { public String rtf2html(String rtf) throws Exception { JEditorPane p = new JEditorPane(); p.setContentType("text/rtf"); EditorKit kitRtf = p.getEditorKitForContentType("text/rtf"); try { StringReader rtfReader = new StringReader(rtf); kitRtf.read(rtfReader, p.getDocument(), 0); kitRtf = null; EditorKit kitHtml = p.getEditorKitForContentType("text/html"); Writer writer = new StringWriter(); kitHtml.write(writer, p.getDocument(), 0, p.getDocument().getLength()); return writer.toString(); } catch (Exception e) { throw new Exception("Could not convert RTF to HTML.", e); } } } As an example. In the original email, there is a telephone number - note the two Hebrew letters which are an abbreviation for טלפון (telephone) טל: 02-9999999 In the RTF that is input to this function it looks like this \pard\qr\plain{\f3\rtlch\lang13\cf2\fs20 \'E8\'EC': 02-9999999}\par In the HTML that is output from this function it looks like this &lt;p class=default&gt; &lt;span style="color: #808080; font-size: 10pt; font-family: Arial"&gt; 鬧: 02-9999999 &lt;/span&gt; &lt;span style="color: #000000; font-size: 12pt; font-family: Times New Roman"&gt; &lt;/span&gt; &lt;/p&gt; The character appearing 鬧 here in StackOverflow appears in NotePad++ as xE8xEC (in inverted characters) whereas in my web applicati…
tagged with: unicode
favorite count: 0
upvote count: 3
has comment: http://stackoverflow.com/comment/31778586
has comment: http://stackoverflow.com/comment/31778550
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: msg

http://stackoverflow.com/a/21076486
score: 2
has comment: http://stackoverflow.com/comment/31703202
has comment: http://stackoverflow.com/comment/31701844
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31701439
type: Answer
has comment: http://stackoverflow.com/comment/31702222
upvote count: 2
has comment: http://stackoverflow.com/comment/31703173
accepted answer of: http://stackoverflow.com/q/21072540
has body: You should not have to do a SVN checkout. You can create a startup project with a maven archetype, type: mvn archetype:generate -DarchetypeRepository=http://maven.onehippo.com/maven2 -DarchetypeGroupId=org.onehippo.cms7 -DarchetypeArtifactId=hippo-archetype-website -DarchetypeVersion=1.07.06 then you can mvn install and to start your project mvn -P cargo.run or to avoid to start from a fresh repository everytime mvn -P cargo.run -Drepo.path=/home/usr/myrepo This is all explained here: http://www.onehippo.org/7_8/trails/developer-trail/hippo-baby-steps.html
answers question: http://stackoverflow.com/q/21072540

onclick
tags question: http://stackoverflow.com/q/21154571
type: Tag
tags question: http://stackoverflow.com/q/21083487
tag name: onclick

http://stackoverflow.com/comment/31966665
score: 0
type: Comment
type: QuestionComment
has text: Can you please provide more details? I suspect the problem may have to do with the CharSets specified when you are doing various operations. Can you please edit your question to provide snippets of code for the client where you are reading the message, where you are converting it to a PDF, where you are uploading it, and where you are downloading it to view?
comment on: http://stackoverflow.com/q/21163962

http://stackoverflow.com/comment/31692591
type: Comment
comment on: http://stackoverflow.com/a/21073179
score: 1
type: AnswerComment
has text: 1. No. It was because you were using multiple streams on the same socket, which only works if none of them is buffered ... but it still isn't a good idea. 2. When you get EOFException it means the peer has closed the connection. There is no more data. There will never be any more data. If you keep reading you will just keep getting EOFException. Don't. Break out of the loop.

http://stackoverflow.com/a/21085886
has comment: http://stackoverflow.com/comment/31749844
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31767811
downvote count: 0
type: Answer
has body: Disclaimer: I think it finishes in O(N) time. I've added to the versatility of the algorithm. Moreover, Negative radixes are IMPRACTICAL The following method converts a number in the decimal base to that mentioned in radix: /** * This method returns an array with precs elements conating the * required fractional part in the base radix * * @param frac A float that contains the fractional part * (and fractional part only!!) in decimal number system. * @param radix The base to which it has to be converted (must be (+) ve). * @param precs The number of digits required i.e. precision. * * @return A int[] that contains the digits(eqivalent). */ public static int[] toRadix(float frac, int radix, int precs) { if(radix < 2) return null; //Only fractional part is accepted here. frac = frac - (long)frac; //Precautionary measure :-) int i, j; int[] res = new int[precs]; //For storing result. for(i = 0; i < precs && frac != 0; i++) { frac *= radix; res[i] = (int)frac; if((long)frac >= 1) frac = frac - (long)frac; } if(flag) return copy(res, i); return res; } The method that converts a number in base radix to decimal -- returns a float. /** * This method returns a float that contains the equivalent of the * fraction in the other base in the parameter array, in decimal. * * @param frac An int[] conatining only the fractional part. * @param radix The base of the fraction entered (must be (+) ve). * * @return The equivalent decimal fraction as a float. */ public static float toDecimal(int[] frac, int radix) { if(radix < 2) return null; float res = 0, fac = 1.0f/radix; int i, p = frac.length; for(i = 0; i < p; i++) { res += frac[i] * fac; //or (float)Math.pow(radix, -i); fac/=radix; //would be fine as well. } return res; } Finally! The `baseChanger()` method public static int[] baseChanger(int[] f, int A, int B, int P) { if(A < 2) return null; if(B < 2) return null; return toRadix(toDecimal(f, A), B, P); } And the copy method: private static int[] copy(int[] a, int index) { index = i…
has comment: http://stackoverflow.com/comment/41795362
accepted answer of: http://stackoverflow.com/q/21058476
has comment: http://stackoverflow.com/comment/31774835
answers question: http://stackoverflow.com/q/21058476
has comment: http://stackoverflow.com/comment/31734681
score: 4
has comment: http://stackoverflow.com/comment/41821300
has comment: http://stackoverflow.com/comment/41835104
has comment: http://stackoverflow.com/comment/31728994
upvote count: 4
has comment: http://stackoverflow.com/comment/31828782
has comment: http://stackoverflow.com/comment/41679231

http://stackoverflow.com/q/21049228
has answer: http://stackoverflow.com/a/21049642
accepted answer: http://stackoverflow.com/a/21102678
type: Question
score: 0
answer count: 2
has title: Drawing multiple circles Android
tagged with: ondraw
tagged with: android
has comment: http://stackoverflow.com/comment/31649632
has body: I have been trying to draw multiple circles in Android but it won't work and I can't see what I'm doing wrong. One circle works just fine when I run it. I have tried to find similar questions but the ones I found seemed to be a little more advanced than what I want in this simple app. public class DrawCharsActivity extends Activity { Paint[] paint; double lon = 30; double lat = 20; int scrWidth; int scrHeight; int x; int y; //String latitudeString[] = new String[]{"30", "20"}; //String longitudeString[]= new String[]{"30", "20"}; String name[] = new String[]{"joseph", "jj"}; Double longitude[] = new Double[]{30.2, 30.2}; Double latitude[] =new Double[]{30.2, 45.2}; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(new Panel(this)); // x = (int) ((scrWidth / 360.0) * (180 + lon)); //y = (int) ((scrHeight / 180.0) * (90 - lat)); scrWidth = getWindowManager().getDefaultDisplay().getWidth(); scrHeight = getWindowManager().getDefaultDisplay().getHeight(); } class Panel extends View { public Panel(Context context) { super(context); } @Override public void onDraw(Canvas canvas) { for (int i = 0; i &amp;lt; name.length; i++) { paint = new Paint[i]; paint[i].setColor(Color.BLACK); paint[i].setStrokeWidth(1); paint[i].setTextSize(20); //longitude[i] = Double.parseDouble(latitudeString[i]); //latitude[i] = Double.parseDouble(longitudeString[i]); x = (int) ((scrWidth / 360.0) * (180 + longitude[i])); y = (int) ((scrHeight / 180.0) * (90 - latitude[i])); canvas.drawColor(Color.WHITE); canvas.drawCircle(x, y, 3, paint[i]); System.out.println(x + "x" + name[i]); System.out.println(y + "y" + name[i]); } // canvas.drawLine(80, 80, 80, 200, paint); // canvas.drawText(""+canvas.getWidth()+", "+canvas.getHeight(), 0, // 200,paint); } } }
type: AnsweredQuestion
tagged with: paint
has answer: http://stackoverflow.com/a/21102678
possible better answer: http://stackoverflow.com/a/21049642
tagged with: java

http://stackoverflow.com/q/21140861
accepted answer: http://stackoverflow.com/a/21349878
type: Question
has body: I change info in my solr.xml and monitor.xml files ,make reindex and see next my cmd: D:\solr-4.6.0\solr-4.6.0\example\exampledocs&gt;java -jar post.jar solr.xml monitor.xml SimplePostTool version 1.5 Posting files to base url http://localhost:8983/solr/update using content-type application/xml.. POSTing file solr.xml SimplePostTool: WARNING: Solr returned an error #400 Bad Request SimplePostTool: WARNING: IOException while reading response: java.io.IOException: Server returned HTTP response code: 400 fo r URL: http://localhost:8983/solr/update POSTing file monitor.xml SimplePostTool: WARNING: Solr returned an error #400 Bad Request SimplePostTool: WARNING: IOException while reading response: java.io.IOException: Server returned HTTP response code: 400 fo r URL: http://localhost:8983/solr/update 2 files indexed. COMMITting Solr index changes to http://localhost:8983/solr/update.. Time spent: 0:00:00.061 After it if I make q=*:* - I don't see new field at these documents. What do I wrong?
score: 0
answer count: 1
has title: Solr returned an error #400 Bad Request when indexing process is executes
has answer: http://stackoverflow.com/a/21349878
has comment: http://stackoverflow.com/comment/31827974
type: AnsweredQuestion
tagged with: java
tagged with: solr

http://stackoverflow.com/a/21046803
has body: "Is lamborghini a subclass of car with fixed values in constructor?" Possibly. Or just a car with values that you set in the constructor and never reset. Or maybe just a car with initial values; damage might reduce that maximum, for example. Depends on the needs of your program and on how/whether you're going to expose this class for manipulation and reuse. "Should i have constants for values of every car in car class or in a file?" One or the other, certainly.
answers question: http://stackoverflow.com/q/21046591
score: 0
type: Answer

http://stackoverflow.com/q/21022462
downvote count: 0
answer count: 7
has comment: http://stackoverflow.com/comment/31599300
score: 1
has title: Why do we create an abstract class even though all the methods of that class are defined?
favorite count: 0
has comment: http://stackoverflow.com/comment/31599450
has body: Why do we create abstract classes even though all methods of that class are already defined? If the answer is to stop the programmer from creating an object of that class, couldn't we achieve the same thing by using a private constructor?
has answer: http://stackoverflow.com/a/21022615
has comment: http://stackoverflow.com/comment/31599362
has answer: http://stackoverflow.com/a/21022655
linked to: http://stackoverflow.com/q/20929967
has answer: http://stackoverflow.com/a/21022547
upvote count: 1
has answer: http://stackoverflow.com/a/21022620
has answer: http://stackoverflow.com/a/21022574
possible better answer: http://stackoverflow.com/a/21022539
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21022539
has comment: http://stackoverflow.com/comment/31599384
has comment: http://stackoverflow.com/comment/31599823
has answer: http://stackoverflow.com/a/21022518
has comment: http://stackoverflow.com/comment/31599375
tagged with: java
linked to: http://stackoverflow.com/q/49002
accepted answer: http://stackoverflow.com/a/21022615
has comment: http://stackoverflow.com/comment/31599660
type: Question

http://stackoverflow.com/comment/31849704
has text: @user3168286 The `selectOneRadio` will show the value matching `nextQuestion.chosen`. Just make sure that's `null` after your call to `save()`.
comment on: http://stackoverflow.com/a/21114577
type: AnswerComment
score: 0
type: Comment

memory-leaks
tags question: http://stackoverflow.com/q/21050334
tags question: http://stackoverflow.com/q/21171301
type: Tag
tags question: http://stackoverflow.com/q/21047701
tags question: http://stackoverflow.com/q/21177580
tags question: http://stackoverflow.com/q/21080522
tag name: memory-leaks
tags question: http://stackoverflow.com/q/21145261
tags question: http://stackoverflow.com/q/21068884

http://stackoverflow.com/comment/96663323
type: AnswerComment
type: Comment
has text: Thank you. Even late answers might help others, so no worries. But if I remember correctly, I tried that and it did not work. But my memory might be wrong.
comment on: http://stackoverflow.com/a/54691700
score: 1

http://stackoverflow.com/a/21155914
score: 0
answers question: http://stackoverflow.com/q/21154295
type: Answer
has body: One of the problems could be due to missing enctype="multipart/form-data" in the form that is submitted. Also in the servlet side this article was helpful while I did a file upload to the server: http://docs.oracle.com/javaee/6/tutorial/doc/glrbb.html

http://stackoverflow.com/a/35331280
has comment: http://stackoverflow.com/comment/111800330
upvote count: 1
answers question: http://stackoverflow.com/q/21081565
has body: For me the only thing worked was add mock Activity with right click on the Flavour package, choose "new->activity>empty activity", choose the fit source set and package name in the dialog, and after the Activity created the problem solved. I deleted the mock activity later and it not brought any problem.
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/21037336
has comment: http://stackoverflow.com/comment/31627148
downvote count: 0
has body: Try the following (pretty straightforward). Read comments in code to see how it works. Code: public static void main(String[] args) { int[] a = { 1, 2, 3 }; int[] b = { 1, 2, 1 }; int[] c = { 1, 2, 2, 1 }; int[] d = { 1, 2, 3, 1 }; int[] e = { 1 }; System.out.println(is_palindrome(a)); System.out.println(is_palindrome(b)); System.out.println(is_palindrome(c)); System.out.println(is_palindrome(d)); System.out.println(is_palindrome(e)); } public static boolean is_palindrome(int[] arr) { for (int i = 0; i &lt; arr.length / 2; i++) { // Check just half times the size of 'arr' // System.out.println(arr[i] + " - " + arr[arr.length - i - 1]); // Debug if (arr[i] != arr[arr.length - i - 1]) // Check 'first' with 'last', 'second' with 'last - 1' ... return false; } return true; } Output: false true true false true
has comment: http://stackoverflow.com/comment/31630731
has comment: http://stackoverflow.com/comment/31626802
has comment: http://stackoverflow.com/comment/31626932
type: Answer
answers question: http://stackoverflow.com/q/21037206
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/31627210
has comment: http://stackoverflow.com/comment/31626894
has comment: http://stackoverflow.com/comment/31627121
has comment: http://stackoverflow.com/comment/31626826
has comment: http://stackoverflow.com/comment/31626987

http://stackoverflow.com/comment/31882052
comment on: http://stackoverflow.com/q/21176659
type: QuestionComment
type: Comment
has text: We'd like to see what you've tried so far
score: 0

http://stackoverflow.com/comment/31844549
type: AnswerComment
has text: I would like to refer you to [HikariCP](https://github.com/brettwooldridge/HikariCP). Disclaimer: I am one of the authors.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21127368

http://stackoverflow.com/a/21082299
accepted answer of: http://stackoverflow.com/q/21082243
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/71828647
has body: Method to check if ct==current-hour public static boolean compareToHour(int arg) { Calendar temp = Calendar.getInstance(); int tempHour = temp.get(Calendar.HOUR_OF_DAY); return arg==tempHour; } To compare the two, run the following method anywhere: compareToHour(ct)
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21082243

http://stackoverflow.com/comment/31825824
has text: message formats vary, depending on the nature of carried information. Your question should be: here is my task, what is the best message format for it?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21145089

http://stackoverflow.com/q/21058066
tagged with: block
favorite count: 0
tagged with: jruby
tagged with: ruby
score: 1
has answer: http://stackoverflow.com/a/21068053
upvote count: 1
tagged with: ruby-on-rails
type: Question
linked to: http://stackoverflow.com/q/19784029
type: AnsweredQuestion
has title: Pass a Ruby block to a Java method
tagged with: java
has body: I need my JRuby method to recieve a report of what is going on in a Java method and act accordingly: def my_long_running_method # ... do stuff ... jObject.count_all_disk_files do |number_of_files| stream.write "#{number_of_files} files found so far." end # ... do more stuff ... end I saw this question but I couldn't understand what I need to do. I've known Ruby for a long time and a little of Java. This project needs to be JRuby because of old Java code that needs to be integrated with new Ruby code.
accepted answer: http://stackoverflow.com/a/21068053
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/31681504
score: 0
has text: @BrianRoach I don't think that's an exact duplicate, while closely related. It concerns the conditional operator as applied to inferred return types from generic method calls, where this is as applied to wildcard-capture generic types.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21065643

http://stackoverflow.com/a/21087088
answers question: http://stackoverflow.com/q/21082867
has body: It does not need to be resolvable. That's good practice for publishing on the web but Jena does not look names up just because you use them.
upvote count: 4
downvote count: 0
score: 4
type: Answer

http://stackoverflow.com/a/21106227
has body: First of all, I think that you shouldn't use Canvas, since, IMO, you shouldn't mix Swing's Components with AWT if it's not necessary (I'm talking in terms of the actual components you place in the GUI - I know Swing is built on top of AWT). You might instead want to use a JPanel and perform custom painting using its paintComponent method. There are many tutorials about this (e.g. Lesson: Performing Custom Painting). Once you figured out how to draw your drawer inside your JPanel (simply using Graphics2D drawing), you'll want to animate it: basically, you'll just need to update some of its properties, most likely some position... Would you like to have some nice easing effects and everything being easily handled and packaged, I would recommend you to have a look to the Universal Tween Engine. I've already used it and could help you with that as well. Once you have your Universal Tween Engine library linked to your project, simply use some call as following: Tween .to(drawerProperties, Type.POSITION, 10.0f) // animate the POSITION property of your drawerProperties on 10.0 units of time .target(100) // set the number of frames of that animation to .ease(Quad.OUT) // set a nice quadratic effect on the animation .start(tweenManager); // launch the animation Then, elsewhere, you just need to have a Thread running that constantly updates your TweenManager using TweenManager#update. Once again, it looks like a lot of work but it actually is very easy to use and the Universal Tween Engine's getting started section is extremely good. Moreover, if you want to really add animation to your project, this could definitely be a great tool to use :) One last point: you might need to update your properties in the Swing's Event Dispatch Thread, depending on how exactly will your solution be implemented. If you don't know so much about that, you could read Lesson: Concurrency in Swing - or just search StackOverflow if you've specific questions :)
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21105701
downvote count: 0
score: 1

http://stackoverflow.com/comment/93758909
type: AnswerComment
has text: i have used the delight - fileupload jar as per GITHUB code base, and it is not working me.. it doesn't parse the data at all and through exceptions
score: 0
type: Comment
comment on: http://stackoverflow.com/a/35618028

http://stackoverflow.com/q/21090578
has body: My main xml file has a FrameLayout, with one fragment defined in the XML. At runtime, I am adding another fragment on top of this, and then a third fragment on top of this. When I add the runtime fragments, I don't give containerIds to attach them to. This is all fine until the orientation changes. After the orientation change, the third fragment has gone beneath the second fragment. But obviously I want the z-order to stay how it was before the orientation change, i.e. the last fragment added should be on top and visible. I've tried using containerIds when adding the fragments, and adding them to the FrameLayout defined in XML, but when I put in containerIds, the runtime fragments simply don't show up at all. So I'm wondering why the fragments added at runtime don't show when I use a containerId. Is it because they are being added to a container which already contains a fragment (the one defined in XML)? How can I get around this? I've tried adding additional containers to the XML to hold the runtime fragments, but this doesn't seem to work. The only way to get the fragments to show is to remove the containerId from the call to FragmentTransaction.add(). Also, is it possible to change the z-order of fragments manually? I've searched Google quite a lot to find this out and haven't found any answers. I've tried using ViewGroup.bringChildToFront() and using the view returned by the fragment's getView() but this hasn't worked. I've also found out that you can nest fragments on Android 4.2+ with getChildFragmentManager(), but I'm supporting older APIs, and this method doesn't seem to be in the support library. Any help greatly appreciated!
tagged with: android
has title: Fragment Z-order changes when orientation changes
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: android-fragments
accepted answer: http://stackoverflow.com/a/21094079
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/21094079
favorite count: 0

http://stackoverflow.com/comment/31708313
comment on: http://stackoverflow.com/a/21081652
score: 0
has text: Why do you repeat yourself with `e.getMessage()`? This is what is bad with this code.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31705476
comment on: http://stackoverflow.com/q/21079932
score: 0
type: QuestionComment
type: Comment
has text: The links you have provided are neither giving results for your code which you gave as comment nor gives any examples as you mentioned in your question.

http://stackoverflow.com/comment/39805614
type: Comment
comment on: http://stackoverflow.com/a/21211336
type: AnswerComment
score: 0
has text: @IsraelG. is this motion blur like this http://tinyurl.com/ojjwv67 ?or just simple blur?

http://stackoverflow.com/a/21168609
answers question: http://stackoverflow.com/q/21168434
score: 0
type: Answer
has body: You could use a model factory class. They can be used to populate and create the model for the controller. e.g: public class CountryModelFactory { public static Country populateCountryModel() { // code to populate the Country model. // then return the Country model. } } The advantage of using a Model Factory type of class is that you can separate the model from the controller through a medium which can then populate a number of similar model depending on the request.

http://stackoverflow.com/comment/31864162
comment on: http://stackoverflow.com/q/21167307
score: 0
has text: Where do you initialize `emf`?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21086592
has body: I have a standalone application written in Java Swing against MySQL via Hibernate, with just one client connected to the database, using HibernateUtils provided by Netbeans example app skeleton. Basically committing each transaction explicitly. Now I need more than one client connected to the same MySQL server instance and I don't know how to manage connections properly. I'm integrating Spring context and entityManager but without an application server ¿How can and have the connections to the database synchronized? I am concerned about the visibility of entities by different threads, so always keep refreshed. EDITED: I've been reading about the patterns related to session managing. In my application i have implemented de transaction-per-operation antipattern, opening and closing the session inside every DAO operation calling 'HibernateUtil'.This ensure that the data is allways updated, but now that I need more users connected, i don't know if I must change to a client-server architecture, or move to a JPA managed session configuration, or maybe keep working whith this anti-pattern.
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31717504
tagged with: spring
has title: Standalone application transactions
has comment: http://stackoverflow.com/comment/31734414
answer count: 0
tagged with: transactions
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/31717181

http://stackoverflow.com/q/21112767
type: Question
has title: When and when not to use webservices?
has answer: http://stackoverflow.com/a/21112976
has answer: http://stackoverflow.com/a/21112868
score: 0
has answer: http://stackoverflow.com/a/21112896
has answer: http://stackoverflow.com/a/21112830
has comment: http://stackoverflow.com/comment/31769502
answer count: 4
favorite count: 0
possible better answer: http://stackoverflow.com/a/21112830
upvote count: 1
tagged with: web-services
downvote count: 1
accepted answer: http://stackoverflow.com/a/21112896
type: AnsweredQuestion
tagged with: performance
tagged with: java
has body: we are creating an appraisal system ,in which there will be a no. of validations and computations. Team leader decided to use web services for most of their logic ,which we are going to write. I am just curious ,when we can moreover when we should web services and when we should avoid using it?

http://stackoverflow.com/q/21104097
tagged with: ejb
tagged with: derby
linked to: http://stackoverflow.com/q/11511805
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31750620
type: UnansweredQuestion
tagged with: jdbc
answer count: 0
score: 1
tagged with: java
upvote count: 1
has title: Derby Database : delete records which their timestamp greater than 2 hours
type: Question
tagged with: jakarta-ee
has body: i tried to write a named query in my Entity Java Bean class , and tried also to write the same query as a native query , its job is to delete records which difference between their timestamp column and current time stamp, are greater than 2 hours. my query : DELETE FROM APP.WEATHER WHERE timestampdiff(SQL_TSI_HOUR,APP.WEATHER.SINCE,CURRENT_TIMESTAMP) &gt; 2; but it failed , and this error message appeared to me : Error code -1, SQL state 42X04: Column 'SQL_TSI_HOUR' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'SQL_TSI_HOUR' is not a column in the target table. Line 1, column 1

http://stackoverflow.com/q/21033614
upvote count: 1
has answer: http://stackoverflow.com/a/21033676
type: Question
has answer: http://stackoverflow.com/a/21034841
tagged with: arrays
has title: Is it possible to store double[][] array in ArrayList<double[][]> in JAVA?
downvote count: 0
accepted answer: http://stackoverflow.com/a/21033669
tagged with: arraylist
answer count: 3
has body: I have been thinking for a while about this issue. I am in need of a class that can take in some double[][] array and then store this array for future usage. The only storage option that I can think of is storing a double[][] in an ArrayList&lt;&gt;() of double[][]'s. I did implement it as follows: public class AddToArray { public String[] parameterNames; public ArrayList&lt;double[][]&gt; parametersToChange; public AddToArray(String[] parameterNames){ this.parameterNames = parameterNames; } public void addToArray(double[][] parametersToChange) throws InsufficientInputException for(int i = 0; i &lt; parametersToChange.length; i++){ if(parametersToChange[i].length != this.parameterNames.length) throw new InsufficientInputException("DATA DIMENSION MISMATCH"); } // This below gives nullpointexception. this.parametersToChange.add(parametersToChange); } I call by this example: double[][] parametersToChange = {{0.005,0.006},{0.007,0.008}}; String[] par = {"SI1","SI2"}; AddToArray abc = new AddToArray(par); abc.addToArray(parametersToChange); System.out.println(abc.parametersToChange.get(0)[0][0]); // this would (in my ideal world) print out 0.005 I receive a null pointer exception for this call and I am thinking that its not possible to make an ´ArrayList´. What other options do I have, I really can't figure this one out?
favorite count: 0
tagged with: double
has answer: http://stackoverflow.com/a/21033669
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/21033676

http://stackoverflow.com/comment/31758798
type: AnswerComment
comment on: http://stackoverflow.com/a/21109172
has text: Sorry, that's not enough information for me to work with. It looks to me like your JFrame has a faulty event listener or something in its init method.
type: Comment
score: 0

jira-rest-java-api
tags question: http://stackoverflow.com/q/21156475
tag name: jira-rest-java-api
type: Tag

http://stackoverflow.com/comment/31840549
score: 0
type: Comment
type: QuestionComment
has text: `doInBackground` in method MUST return a value. You can get this value by calling `SwingWorker#get`, but this is a blocking method, meaning that until `doInBackground` exists, this method (`get`) won't return
comment on: http://stackoverflow.com/q/21153826

http://stackoverflow.com/q/21030642
has title: How to increase curl GET request url size limit?
tagged with: get
has answer: http://stackoverflow.com/a/21030721
answer count: 1
tagged with: url
downvote count: 0
favorite count: 0
tagged with: php
accepted answer: http://stackoverflow.com/a/21030721
tagged with: curl
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/417142
has body: Here is the background of a product architecture i'm working on. I am working on product where front-end is in PHP and back-end is in JAVA. JAVA works as a service and PHP uses curl library to call java services. I'm using GET Request to call java services. It was working perfectly, but i faced an issue when URL is too long (in my case URL is almost 2,00,000 characters long). i searched about curl and i found that there is no limit for url length in curl. also when curl is executed i checked curl error number curl_errno() and it returned 0. curl Returns the error number or 0 (zero) if no error occurred. so i can't figure out what can be the issue, also it is issue at JAVA side or PHP side ? also how can i increase GET request size limit ?
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/a/21164448
score: 1
has body: Problem is resolved. I've added the parsing of log4j.custom.properties property and everything went fine.
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21143749

http://stackoverflow.com/q/21080449
type: Question
has body: 'java.net.SocketTimeoutException: connect timed out' I'm gettting this error after looping after a while. Why am I getting a SocketTimeoutException? And how could I fix this error? @Override public void run() { while (true) { try { URLConnection connection = getURLConnection("http://www.trekpv.com"); BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String s; while ((s = reader.readLine()) != null) { System.out.println(s); } reader.close(); Thread.sleep(5000); } catch (Exception e) { e.printStackTrace(); } } } private URLConnection getURLConnection(String s) throws IOException { URL url = new URL(s); URLConnection urlconnection = url.openConnection(); urlconnection.setConnectTimeout(10000); urlconnection.setReadTimeout(10000); urlconnection.addRequestProperty("Connection", "keep-alive"); urlconnection.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120716 Firefox/15.0a2"); urlconnection.addRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); urlconnection.addRequestProperty("Accept-Language", "en-US,en;q=0.8"); urlconnection.addRequestProperty("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.3"); return urlconnection; }
score: 1
has answer: http://stackoverflow.com/a/21081413
answer count: 2
upvote count: 1
has title: SocketTimeoutException thrown
tagged with: network-programming
tagged with: java
tagged with: timeout
possible better answer: http://stackoverflow.com/a/29198322
accepted answer: http://stackoverflow.com/a/21081413
has answer: http://stackoverflow.com/a/29198322
type: AnsweredQuestion
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/106672281
type: QuestionComment
has text: Yes @Mohan, the database I'm trying to connect is a remote database. And remote database access is not with the database server.
comment on: http://stackoverflow.com/q/21061393
score: 0
type: Comment

http://stackoverflow.com/q/21154295
has answer: http://stackoverflow.com/a/22739354
tagged with: file-upload
accepted answer: http://stackoverflow.com/a/22739354
tagged with: http
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21155914
tagged with: java
tagged with: webserver
tagged with: http-headers
has body: Okay so i am working on a special little project and i require some help. I have started working on a Java webserver written using only java libraries. The aim is to be the simplest webserver written in java around. I have been very successful lately, but recently i have run into a problem with uploading files to the server. The server recieves the headers but i can not see the text from inside the file. Any help would be great! Thank you you can see the website hosted by the webserver here: blends.hopto.org/beta
possible better answer: http://stackoverflow.com/a/21155914
type: Question
has title: file upload http header help or example java
answer count: 2
score: 0

http://stackoverflow.com/q/21129650
type: Question
has answer: http://stackoverflow.com/a/21129673
has body: I want to find that current time falls between x and y time ignoring Date component. My time can fall between next day as well. I want to know the best way of doing this. I want to check that my current time falls between below 2 times. 22 PM - 7 AM(Next Day Morning) I know the way like compare hour part first then minutes but don't know this is best way. I want to know the standard practice people use for this.
score: 0
answer count: 1
favorite count: 0
has title: current time falls between given 2 times java
type: UnansweredQuestion
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31796414
downvote count: 1

http://stackoverflow.com/q/21138421
linked to: http://stackoverflow.com/q/290884
has body: Recently I met with this error "non-static variable cannot be referenced from a static context" where I had initialized all the variables in my main method, which is a static method. But after making all the variables static It compiled without an error. Please Can anyone explain why it happens this way? public class Test2 { String[] mycharset; String chkfor; public static void main(String[] args){ mycharset = new String[5]; chkfor = "k"; mycharset[0] = "a"; mycharset[1] = "b"; mycharset[2] = "c"; mycharset[3] = "d"; mycharset[4] = "e"; } }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21138903
upvote count: 3
tagged with: java
tagged with: static-variables
downvote count: 3
duplicate of: http://stackoverflow.com/q/290884
has title: Why a non-static variable cannot be initialized inside a static method?
type: Question
has comment: http://stackoverflow.com/comment/31811367
has comment: http://stackoverflow.com/comment/31811428
tagged with: variables
has comment: http://stackoverflow.com/comment/31811605
accepted answer: http://stackoverflow.com/a/21138903
score: 0
answer count: 1
tagged with: initialization
favorite count: 0
tagged with: static

http://stackoverflow.com/comment/31653213
has text: @SnakeDoc: I'm sure that they are gorgeous, but I like creating component libraries that can be used and re-used with ease and without breaking the GUI that they are being placed in. This requires extra care to "draw in the lines", but is well worth it in the long run.
comment on: http://stackoverflow.com/q/21051707
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/31675774
has text: When you say continuum, do you mean set?
comment on: http://stackoverflow.com/q/21064253
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21083783
favorite count: 0
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/21093969
has comment: http://stackoverflow.com/comment/31713059
upvote count: 1
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31793206
accepted answer: http://stackoverflow.com/a/21093969
has comment: http://stackoverflow.com/comment/31712215
has body: I'm trying to make a JFrame which checks to see if text placed in a JTextField are the same as the information in a .txt file. Then if that's correct, it checks to see if the information in the JPasswordField match the information in the .txt file. public void actionPerformed(ActionEvent e) { if(e.getSource() == button) { if(!username.getText().equals("") &amp;&amp; passIsGood()) { try { Scanner reader = new Scanner(new File("users.txt")); reader.useDelimiter("\t|\n"); reader.nextLine(); while(reader.hasNextLine()) { if(reader.next().equals(username.getText())) { //Username is correct, now checks for password: System.out.println("Username passed"); if(reader.next().equals(passToString())) { //Username &amp; Password are correct System.out.println("Password passed"); break; } } else if(!reader.hasNextLine()) { wrongInfo(); } else { reader.nextLine(); } } reader.close(); frame.dispose(); } catch(Exception ex) { JOptionPane.showMessageDialog(null, ex); } } else { JOptionPane.showMessageDialog(null, "Please enter a valid Username and Password"); } } } private static String passToString() { String passString = new String(password.getPassword()); return passString; } I get as far as the username passing, but I feel like the .equals(passToString()) may be causing the problem. The text file looks like this: Username Password test thetest test2 thetest3 Note that the spaces in between each field are tabs, hence my delimiter using ("\t|\n");
has title: Why doesn't my String check code work
downvote count: 0
tagged with: string
answer count: 1

http://stackoverflow.com/q/21159231
linked to: http://stackoverflow.com/q/4784789
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31850821
score: 4
has comment: http://stackoverflow.com/comment/31850336
has comment: http://stackoverflow.com/comment/31849889
has title: Dealing with i/o streams while using Runtime.exec
has comment: http://stackoverflow.com/comment/31850355
has body: I am trying to run an scp command within Java. Here is my code, try { Process p = Runtime.getRuntime().exec("scp -P" + PORT + " " + FILEPATH + " " + USERNAME + "@" + HOST + ":somefolder/"); BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(p.getOutputStream())); String line; while ((line=br.readLine()) != null) { System.out.println("LINE: " + line); if (line.contains(USERNAME+"@"+HOST+"'s password:")) { bw.write(PASSWORD); bw.newLine(); } } System.out.println("end of while."); } catch (IOException e) { e.printStackTrace(); } As you can see, I do not want to print the password blindly to the p.getOutputStream(), which is suggested in almost all similar questions. I want to read the prompt and act accordingly. For example, scp may prompt something like "The authenticity of host 'SOME HOST' can't be established...", which prompts for a yes/no. Or something else that I cannot imagine right now. The problem with my code is that it never reads a line, although the scp prompts for password, which is seen on the cli. Any suggestion? EDIT: I changed the code to use ProcessBuilder, with String[] constructor, as Andrew Thompson suggested. Here is the complete code: package scptest; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; public class STest { // args =&gt; filepath, username, host, port, password public static void main(String[] args) { try { ProcessBuilder pb = new ProcessBuilder("scp", "-P", args[3], args[0], args[1] + "@" + args[2] + ":folder/"); Process p = pb.start(); BufferedReader br = new BufferedReader(new InputStreamReader( p.getInputStream())); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter( p.getOutputStream())); String line; bw.write(args[4]); bw.newLine(); bw.flush(); System.out.println("RETURN: " + p.waitFor()); } catch (IOException | Int…
favorite count: 0
type: UnansweredQuestion
tagged with: process
tagged with: java
tagged with: stream
has answer: http://stackoverflow.com/a/21168020
has comment: http://stackoverflow.com/comment/31849847
type: Question
upvote count: 4

http://stackoverflow.com/a/21144890
downvote count: 0
score: 1
has body: see Installed Java 7 on Mac OS X but Terminal is still using version 6 maybe you need to select the java version you want to see.
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21144645
answers question: http://stackoverflow.com/q/21144645
type: Answer

http://stackoverflow.com/a/21021865
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21021786
has body: The way I would do it is to simply write your own layout for your dialog, then load it up when you show the fragment AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // Get the layout inflater LayoutInflater inflater = getActivity().getLayoutInflater(); // Inflate and set the layout for the dialog // Pass null as the parent view because its going in the dialog layout View v = inflater.inflate(R.layout.custom_dialog_layout, null, false); builder.setView(v) // Add action buttons .setPositiveButton(R.string.save_note, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { // do stuff } }) .setNegativeButton(R.string.note_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { //do stuff } });

http://stackoverflow.com/comment/31728462
type: AnswerComment
comment on: http://stackoverflow.com/a/21092016
has text: ya u r correct.I need just a basic logging.What u said may be i will exp it later.lolz..
score: 0
type: Comment

http://stackoverflow.com/q/21149675
has body: Is there a way to auto adjust the text size of a button to be the biggest it can be while stayinh one line, and still fit in the button?
tagged with: android
tagged with: text-size
favorite count: 0
has comment: http://stackoverflow.com/comment/31833348
has title: auto adjust text size to fit a button Android
type: UnansweredQuestion
tagged with: java
score: 10
upvote count: 10
type: Question
tagged with: android-button
has comment: http://stackoverflow.com/comment/60392061
has answer: http://stackoverflow.com/a/71048175
linked to: http://stackoverflow.com/q/5033012
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/31714509
has text: Nothing looks wrong with your example de-serialization code, could be an issue with your code that does the serialization process. Can you post that part as well?
comment on: http://stackoverflow.com/q/21084884
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31606119
comment on: http://stackoverflow.com/q/21026052
score: 6
has text: _"list.isEmpty() checks if a list is empty. What is the ideal opposite of it for java?"_ `!list.isEmpty()` ?`
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31612878
type: AnswerComment
has text: Well I meant the second one you defined. All that stuff is already set above. Would defining the width as a parameter instead of through the field really change it?
comment on: http://stackoverflow.com/a/21023154
type: Comment
score: 0

http://stackoverflow.com/comment/31887111
has text: Yes the above is modified its not wait and start, So I started and gone for wait even the same indefinite wait happens, When I uncomment sysout it runs fine Why what could be reason
comment on: http://stackoverflow.com/a/21164207
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/62064123
type: Comment
comment on: http://stackoverflow.com/a/29818006
type: AnswerComment
has text: When I was customizing the openCV 3 tutorials I had to add the line "modified.release();" right after "Utils.matToBitmap(modified, mCacheBitmap);" in the CameraBridgeViewBase.java file and now all runs stable. I also call System.gc() in onCameraFrame as suggested.
score: 0

http://stackoverflow.com/a/21168791
has comment: http://stackoverflow.com/comment/31867865
upvote count: 1
has body: As mentioned, the problem is that you are comparing this String using the == comparator, not the .equals() method. If you are running on Java 7, my advice, for a cleaner solution, would be also to wrap this in a switch statement: JOptionPane.showMessageDialog(null,"Welcome to the test..."); String input = JOptionPane.showInputDialog("Do you wish to take the tutorial?" + "\n" + "If affirmative, enter 'Yes'"); switch (input) { case "Yes": tutorial(); break; case "'Yes'": JOptionPane.showMessageDialog(null,"Don't actually put apostraphes around you're answer."); tutorial(); break; default: JOptionPane.showMessageDialog(null,"Remember, you can pull up the tutorial at any time with 'T'"); }
answers question: http://stackoverflow.com/q/21168627
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31867220
score: 1

http://stackoverflow.com/a/21025737
has body: The variable tempStat is null! check the values contained in passed array al
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/21025667
upvote count: 1

http://stackoverflow.com/comment/31634525
comment on: http://stackoverflow.com/q/21042124
score: 0
type: QuestionComment
has text: You probably want Ajax. You can use it via JQuery http://api.jquery.com/jquery.ajax/ to create one code which will work in all browsers.
type: Comment

http://stackoverflow.com/comment/31706572
has text: why do you "refresh" your data by destroying the current activity and create new one?
type: Comment
comment on: http://stackoverflow.com/q/21080804
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31804406
type: Comment
comment on: http://stackoverflow.com/q/21133962
type: QuestionComment
score: 0
has text: Yes `getTn()` is null. Why it is not loading the value

jakarta-mail
tags question: http://stackoverflow.com/q/21124530
tags question: http://stackoverflow.com/q/21022426
tag name: jakarta-mail
tags question: http://stackoverflow.com/q/21180966
tags question: http://stackoverflow.com/q/21089347
type: Tag
tags question: http://stackoverflow.com/q/21097567
tags question: http://stackoverflow.com/q/21039309
tags question: http://stackoverflow.com/q/21055641

http://stackoverflow.com/comment/31636897
type: AnswerComment
has text: I mentioned something in bold letters...please read the question before answering if possible. but +1 for clear example of `Static` concept.
type: Comment
comment on: http://stackoverflow.com/a/21037996
score: 0

http://stackoverflow.com/comment/31909384
type: AnswerComment
comment on: http://stackoverflow.com/a/21053023
score: 0
type: Comment
has text: @asaini007 `o` is just a *name*. The actual object is what it *points to*.

http://stackoverflow.com/a/21089599
has body: If HashSet is non-static Create getHashSet() method in your class containing the HashSet. It returns a reference to the hashset. Create a new instance of the class containing HashSet in the class where you wanna access this HashSet. Call instance.getHashSet(); if HashSet is static (Its better to make it public as well..) use ClassContainingHashSet.hashSet to get hashset. EDIT : public class MyFirstClass{ public static Set&lt;YourType&gt; mySet = new HashSet&lt;yourType&gt;(); } class MySecondClass{ public void readHashSet() { HashSet&lt;YourType&gt; hs = MyFirstClass.mySet; } } Note : This is not the exact code.. This is sample code.
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/21089504
has comment: http://stackoverflow.com/comment/31722529
upvote count: 1

http://stackoverflow.com/comment/31694640
has text: Ok this might be a better start. I have added some json examples to my question. Now how would you populate the list or the Location object in both case? And also how to tell jackson to use this parser for the location attribute of my parent object?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/21067873
type: AnswerComment

http://stackoverflow.com/comment/31700681
score: 1
has text: Thx a lot for your answer! Is there another way to implement that?
comment on: http://stackoverflow.com/a/21077840
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21133266
answer count: 2
has answer: http://stackoverflow.com/a/21133479
has title: How to select table column in the add button event?
has answer: http://stackoverflow.com/a/21143270
score: 0
type: UnansweredQuestion
tagged with: swing
has body: https://drive.google.com/file/d/0B3CuRPd4MLwbSVdhZnFNMHN5SUE/edit?usp=sharing I have 2 columns in jtable. If I typed data in each column and click somewhere else inside the table or use the tab button, then only the typed data will be fixed in that column so that I can transfer it to the jTextfield on the lower side of the form by pressing the add button. https://drive.google.com/file/d/0B3CuRPd4MLwbR3hjd1p0cHpGWHc/edit?usp=sharing In the above given image, the second column value can’t be added to the text field below, as the focus is in that column. It will return a nullpointr exception. In this case focus loss events won’t help us in achieving what I want. I expect expert replies on how to solve this error.
tagged with: java
type: Question

http://stackoverflow.com/comment/31846234
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21156461
has text: Yeah, I though of that as an alternative
type: QuestionComment

http://stackoverflow.com/comment/31854688
comment on: http://stackoverflow.com/q/21162106
has text: Do you mean UTF8 ect? If so as far as i've read it is very difficult to accurately detect the encoding of the document.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21114828
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21114760
downvote count: 1
has comment: http://stackoverflow.com/comment/31769967
type: Answer
has body: You have to first create a instance... the invoke the method... like the following example: Beach.java public class Beach { private String name; private String city; public Beach(String name, String city){ this.name = name; this.city = city; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } } Using Beach.java in Jython &gt;&gt;&gt; import Beach &gt;&gt;&gt; beach = Beach("Cocoa Beach","Cocoa Beach") &gt;&gt;&gt; beach.getName() u'Cocoa Beach' &gt;&gt;&gt; print beach.getName() Cocoa Beach You can read more here
has comment: http://stackoverflow.com/comment/31768749
has comment: http://stackoverflow.com/comment/31889295
score: 1
has comment: http://stackoverflow.com/comment/31768827
answers question: http://stackoverflow.com/q/21114760
upvote count: 2
has comment: http://stackoverflow.com/comment/31769266

http://stackoverflow.com/comment/31967418
type: AnswerComment
comment on: http://stackoverflow.com/a/21139645
has text: Not a good answer. Some dates in some time zones have no midnight because of Daylight Saving Time (DST) or other anomalies. See the [correct answer by Wabs](http://stackoverflow.com/a/21139689/642706).
score: 0
type: Comment

http://stackoverflow.com/q/21064180
tagged with: android
answer count: 1
favorite count: 0
tagged with: apache-httpclient-4.x
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
type: Question
has body: I'm trying to use apache httpclient to load images with caching. After request the file is saved but after repeating same request it begins to download again and new file saved as cache. So cached images not reused. And not deleting. File names differ only by hash 1389449846612.0000000000000001-3f1e8b88.localhost.-images-goods-212250-7841874.jpg 1389449952782.0000000000000001-5720e341.localhost.-images-goods-212250-7841874.jpg I want, that image will be loaded once and be able to show cached image even when there is no connection to internet. Here my code RequestConfig config = RequestConfig.custom() .setConnectTimeout(30000) .setSocketTimeout(30000) .setProxy(getProxy()) .build(); CacheConfig cacheConfig = CacheConfig.custom() .build(); CloseableHttpClient client = CachingHttpClientBuilder.create() .setCacheDir(new File("/sdcard/Android/data/com.myapp/cache/")) .setCacheConfig(cacheConfig) .setDefaultRequestConfig(config) .build(); HttpGet request = new HttpGet(imageUri); HttpCacheContext context = HttpCacheContext.create(); CloseableHttpResponse response = client.execute(request, context); This is image response headers Cache-Control:max-age=604800 Connection:keep-alive Content-Length:449512 Content-Type:image/jpeg Date:Sat, 11 Jan 2014 15:03:21 GMT Expires:Sat, 18 Jan 2014 15:03:21 GMT Last-Modified:Tue, 12 Jul 2011 19:40:44 GMT
has answer: http://stackoverflow.com/a/21849373
accepted answer: http://stackoverflow.com/a/21849373
upvote count: 2
has title: Httpclient doesn't correctly caches responses

http://stackoverflow.com/comment/31701923
comment on: http://stackoverflow.com/a/21078512
type: AnswerComment
score: 0
type: Comment
has text: "In that case, the main thread would call wait forever" - seemed as an endless loop to me.

http://stackoverflow.com/comment/84047666
has text: Why do you need a dependency on Robolectric?
type: AnswerComment
comment on: http://stackoverflow.com/a/21064585
score: 0
type: Comment

http://stackoverflow.com/q/21169758
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/31868899
tagged with: jtextarea
has comment: http://stackoverflow.com/comment/31868802
has body: Whenever I run my program my JTextArea does not follow the dimension that I have given it, but if I resize my JFrame it updates and sets its size to what I put. What is the issue? public ControlPanel() { // create our list of players list = new JList(model); // create our scroll panes userspane = new JScrollPane(list); consolepane = new JScrollPane(console); // set sizes userspane.setSize(100, 500); jta.setSize(100, 500); list.setSize(100, 500); consolepane.setSize(100, 500); console.setSize(100, 500); // add to panel panel.add(userspane, BorderLayout.CENTER); panel.add(kick); panel.add(ban); panel.add(info); panel.add(consolepane, BorderLayout.CENTER); // set frame properties setTitle("RuneShadows CP"); setSize(280, 400); //setResizable(false); setDefaultCloseOperation(EXIT_ON_CLOSE); setContentPane(panel); setVisible(true); }
downvote count: 0
answer count: 1
tagged with: layout-manager
has answer: http://stackoverflow.com/a/21170067
favorite count: 0
tagged with: jframe
has title: JTextArea Won't Update Unless I Resize JFrame
score: 2
type: AnsweredQuestion
upvote count: 2
accepted answer: http://stackoverflow.com/a/21170067
tagged with: java

http://stackoverflow.com/q/21153746
tagged with: java
has answer: http://stackoverflow.com/a/21153915
has comment: http://stackoverflow.com/comment/31883825
type: Question
has answer: http://stackoverflow.com/a/33359047
possible better answer: http://stackoverflow.com/a/21154341
has body: So for an assignment we had to write a program that takes two times in military time and shows the difference in hours and minutes between them assuming the first time is the earlier of the two times. We weren't allowed to use if statements as it technically has not be learned. Here's an example of what it'd look like run. In quotes I'll put what is manually entered when it is prompted to. java MilitaryTime Please enter first time: "0900" Please enter second time: "1730" 8 hours 30 minutes (this is the final answer) I was able to quite easily get this part done with the following code: class MilitaryTime { public static void main(String [] args) { Scanner in = new Scanner(System.in); System.out.println("Please enter the first time: "); int FirstTime = in.nextInt(); System.out.println("Please enter the second time: "); int SecondTime = in.nextInt(); int FirstHour = FirstTime / 100; int FirstMinute = FirstTime % 100; int SecondHour = SecondTime / 100; int SecondMinute = SecondTime % 100; System.out.println( ( SecondHour - FirstHour ) + " hours " + ( SecondMinute - FirstMinute ) + " minutes " ); } } Now my question is something wasn't assigned (or I wouldn't be here!) is there's another part to this question in the book that says to take that program we just wrote and deal with the case where the first time is later than the second. This has really intrigued me about how this would be done and has really stumped me. Again we aren't allowed to use if statements or this would be easy we basically have all the mathematical functions to work with. An example would be the first time is now 1730 and the second time is 0900 and so now it returns 15 hours 30 minutes.
has answer: http://stackoverflow.com/a/21154341
accepted answer: http://stackoverflow.com/a/21153915
has comment: http://stackoverflow.com/comment/31840377
has answer: http://stackoverflow.com/a/24303156
has comment: http://stackoverflow.com/comment/54475364
has answer: http://stackoverflow.com/a/33313908
has answer: http://stackoverflow.com/a/33356526
has answer: http://stackoverflow.com/a/21153861
has answer: http://stackoverflow.com/a/21153831
answer count: 9
has answer: http://stackoverflow.com/a/29293185
has comment: http://stackoverflow.com/comment/31840369
tagged with: time
score: 0
has title: time difference in military time in Java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31842647
linked to: http://stackoverflow.com/q/9027317
has comment: http://stackoverflow.com/comment/31840318

http://stackoverflow.com/comment/31708765
has text: Thanks for the ProcessBuilder tip, super helpful! Works great now.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21081924

http://stackoverflow.com/q/21084508
tagged with: java
has comment: http://stackoverflow.com/comment/31718298
type: Question
tagged with: database
has title: processing data from local postgres in play framework 1.2.5
score: 0
tagged with: playframework
has body: I was working on a simple login application using play framwork 1.2.5 and connection to local postgres database was established; the problem is attempting to read from database inorder to verify if login info and user match. the issue is i get a blank page on the url:.../application/signin while an html page rendered from signIn method should output this: TODO write content ps:i have uploaded jdbc driver is lib thanks App/conf # If you need a full JDBC configuration use the following : db.url=jdbc:postgresql:postgres db.driver=org.postgresql.Driver db.user=postgres db.pass=****** # --------------------------------------------- the login page &lt;body&gt; #{form @Application.signIn()} &lt;form&gt; Online ID &lt;input type="text" name ="onlineID" value="${onlineID}"&gt;&lt;br&gt; Passcode &lt;input type="text" name ="passcode" value="${passcode}"&gt; &lt;input type ="submit" value="Sign in"&gt; &lt;/form&gt; #{/form} &lt;/body&gt; --------------------------------------------- controller.App.java public static void signIn(String onlineID, String passcode) { login existing = new login(onlineID,passcode); boolean verify=existing.check(existing.getOnlineID(),existing.getPassCode()); if(verify) render("@Application.account"); } --------------------------------------------- model.login.java import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import play.data.validation.*; import play.db.DB; public class login { @Required public String onlineID; @Required public String passcode; public login(){} public login(String onlineID,String passcode){ this.onlineID=onlineID; this.passcode=passcode; } public void setOnlineID(String onlineID){ this.onlineID=onlineID; } public String getOnlineID(){ return this.onlineID; } public void setPassCode(String passcode){ this.passcode=passcode; } public String getPassCode(){ return this.passcode; } public boolean check(String onlineID,String passcode){ boolean verify=false; Connection c…
answer count: 1
has comment: http://stackoverflow.com/comment/31713818
has comment: http://stackoverflow.com/comment/31741260
tagged with: postgresql
tagged with: playframework-1.x
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21103259

http://stackoverflow.com/comment/31782679
score: 1
has text: No, the simplest solution is to use a `volatile` variable. If you don't use (like in the question) operations with an atomic set-and-get semantic, `AtomicReference` offers no benefit over a `volatile` variable. In fact, it is a wrapped `volatile` variable, with additional operations which are not used here.
comment on: http://stackoverflow.com/a/21109905
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31875189
type: Comment
type: QuestionComment
has text: Perhaps, but I'm a stubborn person and I'll stick to what I've read in cold text & saw with my own eyes in benchmarks. Can a python server hold 64,000 sockets and concurrently keep up with the throughput? I personally doubt it, but I will give those 3 libraries a look & test them myself. I simply don't give too much credit to interpreted languages - to me they're mere tools used for anything minor. Thanks for the input.
comment on: http://stackoverflow.com/q/21171607
score: 0

http://stackoverflow.com/comment/31883221
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21177513
score: 0
has text: heyy, thanks for your responsive reply. I just wanted to know :)

http://stackoverflow.com/comment/31853384
comment on: http://stackoverflow.com/a/21159232
type: Comment
has text: You mean that using Field class, all available fields on the document will get indexed? and Not any things be left without indexing? Please!
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31651431
score: 0
comment on: http://stackoverflow.com/a/21039966
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/44974/discussion-between-mariuszs-and-dave-syer)
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/31760407
score: 0
type: Comment
type: QuestionComment
has text: Hmmm , yes. I am behind a proxy.
comment on: http://stackoverflow.com/q/21093362

http://stackoverflow.com/comment/31734596
score: 0
has text: Wouldn't these questions be better addressed by consulting the AWS documentation?
comment on: http://stackoverflow.com/q/21095991
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21054416
type: UnansweredQuestion
downvote count: 2
tagged with: swing
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31667435
has body: I made a notepad application using java swing and currently it has the following features in it, you can create a new file and save it to the desired location also you can open an existing file, edit it and save it on a new location or update the existing one.Now i want to add the feature that would support the multiple file editing/creating at the same time, just like in notepad++. I have not much idea about how could this be done, please tell me the way to do it.would multi threading help?
upvote count: 0
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/31657558
has comment: http://stackoverflow.com/comment/31657515
has answer: http://stackoverflow.com/a/21054612
favorite count: 0
tagged with: jtabbedpane
has title: how to add multiple tab support feature in my notepad application using java?

http://stackoverflow.com/q/21146727
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
has body: So I'm working on this program and I've created two classes, one class called CreditCard, the other called CreditCardTester.I'm using Eclipse IDE and I keep getting compiling errors such as "The method getBalance(double) in the type CreditCard is not applicable for the arguments ()". I'm not really sure on what I have to fix. This is the first class called CreditCard: public class CreditCard { private String accountNumber; private double creditLimit; private double balance; public void CreditCard(String number, double limit) { accountNumber = number; limit = creditLimit; balance = 0; } public String getAccountNumber() { return accountNumber; } public double getCreditLimit() { return creditLimit; } public double getBalance(double theBalance) { return balance; } public double charge(double amount) { balance = balance + amount; return balance; } This is the second class CreditCardTester: public class CreditCardTester { public static void main(String[] args) { CreditCard card = CreditCard("1234-5678-9012-3456", 1000.00); String formatString = "Credit Card [number = %s, bal = %.2f, limit = %.2f]\n"; System.out.printf(formatString, card.getAccountNumber(), card.getBalance(), card.getCreditLimit()); System.out.println("\nCharging $50.00 to credit card...\n"); card.charge(50.00); System.out.printf(formatString, card.getAccountNumber(), card.getBalance(), card.getCreditLimit()); }
has answer: http://stackoverflow.com/a/21146798
possible better answer: http://stackoverflow.com/a/21146802
type: Question
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/21146802
tagged with: compiler-errors
has title: Java compiling error on Eclipse
accepted answer: http://stackoverflow.com/a/21146798

http://stackoverflow.com/a/21067062
score: 4
answers question: http://stackoverflow.com/q/21066924
type: Answer
has body: 1) You are correct. 2) The Java process' memory will be reclaimed, but you might want to do other cleanup, like delete some temp files. 3) Let's go to the javadoc of Runtime#addShutdownHook(Thread) The Java virtual machine shuts down in response to two kinds of events: The program exits normally, when the last non-daemon thread exits or when the exit (equivalently, System.exit) method is invoked, or The virtual machine is terminated in response to a user interrupt, such as typing ^C, or a system-wide event, such as user logoff or system shutdown. You would have to look into Eclipse's source code, but it would seem like Eclipse terminates the process rather than sending a System.exit(..) or a sending a user interrupt. This probably goes over the JVM which therefore doesn't execute the shutdown hooks. 4) The shutdown hooks you add with Runtime#addShutdownHook(Thread) are added to a static IdentityHashMap in the ApplicationShutdownHooks. This class registers its own shutdown hook with the Shutdown class in a static initializer block shown below static { try { Shutdown.add(1 /* shutdown hook invocation order */, false /* not registered if shutdown in progress */, new Runnable() { public void run() { runHooks(); } } ); hooks = new IdentityHashMap&lt;&gt;(); } catch (IllegalStateException e) { // application shutdown hooks cannot be added if // shutdown is in progress. hooks = null; } } The runHooks() method is static void runHooks() { Collection&lt;Thread&gt; threads; synchronized(ApplicationShutdownHooks.class) { threads = hooks.keySet(); hooks = null; } for (Thread hook : threads) { hook.start(); } for (Thread hook : threads) { try { hook.join(); } catch (InterruptedException x) { } } } So the current thread joins all the other ones. When System.exit(0); gets called, somewhere down the line Shutdown.sequence() gets called which invokes Shutdown.hooks() implemented as private static void runHooks() { for (int i=0; i &lt; MAX_SYSTEM_HOOKS; i++) { try { Runnable hook; syn…
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/21093697
answers question: http://stackoverflow.com/q/21093635
has body: I would take your acceptable characters and place them in a constant. Then take the String your testing and turn it into a character array and go through it character by character and see if it is in your constant. Blow up if not. Successful completion = good String. I don't think there's a shorter way.
type: Answer
score: 0

http://stackoverflow.com/comment/31797383
comment on: http://stackoverflow.com/a/21129583
type: AnswerComment
has text: Make sure you're using `Player.class.getResource("/res/glakon2.png");` and make sure your `res` is directly in the `src`
score: 0
type: Comment

http://stackoverflow.com/comment/31603367
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21022977
has text: @Radiodef *"With PCM a frame refers to a single sample for each channel but since some formats don't have samples (lossy/transform) 'frame' is more generalized."* That actually has a ring of truth to it. I am used to dealing with sampled sound at a higher level as provided by Java Sound, which is why I tend to refer to them as frames.. Thanks for clarifying the difference. E.G. with stereo, a single frame would consist of two samples.
score: 0

http://stackoverflow.com/a/21081080
has comment: http://stackoverflow.com/comment/31733127
score: 1
answers question: http://stackoverflow.com/q/21080598
upvote count: 1
has body: You need to add &lt;mvc:annotation-driven/&gt; to your mvc-dispatcher-servlet.xml. With this configuration (and the component scan), Spring will scan and register your @Controller methods annotated with @RequestMapping. With your current configuration, no such handlers were being registered and there was therefore nothing to handle your request to /.
has comment: http://stackoverflow.com/comment/31730279
downvote count: 0
has comment: http://stackoverflow.com/comment/31730168
type: Answer

http://stackoverflow.com/comment/31691843
type: QuestionComment
type: Comment
has text: It is just the same: Lexical error at line 17, column 46. Encountered: "W" (87), after : "\"\\"
comment on: http://stackoverflow.com/q/21072979
score: 0

http://stackoverflow.com/comment/31782691
has text: Mxyl: *But it will not switch first and second from the main method* Yes, it does
comment on: http://stackoverflow.com/a/21122179
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21183484
downvote count: 0
has comment: http://stackoverflow.com/comment/33088733
type: Answer
has body: We had the same problems with IE11 and new Java. Try to add your site to compatibility view. You can find here how to do it. How to enable compatibility view in Internet Explorer 11 You can try now if it works or not. After that you can remove site from compatibility view and it should also run.
has comment: http://stackoverflow.com/comment/31998914
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/21145293

http://stackoverflow.com/q/21019309
answer count: 2
accepted answer: http://stackoverflow.com/a/21019440
has body: I want to create a database table that should hold lots of unique names, that may be used by other tables with reference. Example: table Country: Germany USA France Should I mark the String of these names as @Id, or introduce another Long id? @Entity class Country { //@Id private Long id; @Id private String name; //eg 'Germany' } @Entity class Address { @ManyToOne private Country country; } I assume that it is better to have the names being referenced by an Id so that the names are not repeated within foreign keys in the Country table? Or does this not matter? Are there any advantages if a new Address is not having a String country field, but just a reference to the country (because the same country name will be reused in several addresses, thus not having dublicate name entries in the address tables). But I could imagine that a drawback might be that I do not have the Country Id before persisting a address. Therefore, I'd first have to check SELECT * FROM Country WHERE name := name, check if ==null and create a new Country entry, then creating the Address. Would you think it is better to use String or Long as Id here?
score: 0
possible better answer: http://stackoverflow.com/a/21019392
has answer: http://stackoverflow.com/a/21019392
has title: Create additional Id for unique names in DB?
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: database
has answer: http://stackoverflow.com/a/21019440
type: Question

http://stackoverflow.com/comment/31692299
type: Comment
has text: Because maybe he don't know any alternative. My solution in much easier to implement and has better performance.
comment on: http://stackoverflow.com/a/21073236
type: AnswerComment
score: 0

http://stackoverflow.com/q/21126994
has answer: http://stackoverflow.com/a/71059086
upvote count: 1
possible better answer: http://stackoverflow.com/a/21127112
favorite count: 0
has answer: http://stackoverflow.com/a/21127112
answer count: 3
accepted answer: http://stackoverflow.com/a/21128905
downvote count: 0
has answer: http://stackoverflow.com/a/21128905
tagged with: swing
type: AnsweredQuestion
score: 1
tagged with: java
has body: I know how to add background image to JPanel (creating ImagePanel class that extends JPanel and overload it's paintComponent() method), BUT this trick with JTextField not working properly: Displays image, but not text. So, how to add background image to JTextField properly?
tagged with: background-image
tagged with: jtextfield
has title: How to add background image to JTextField?
type: Question

http://stackoverflow.com/a/21048862
type: Answer
score: 2
has body: The problem is you're drawing the rectangles starting from the panel's center. Consequently only the right-bottom part of the cross is being drawn. Take a look to Graphics.fillRect() javadoc: public abstract void fillRect(int x, int y, int width, int height) Parameters: x - the x coordinate of the rectangle to be filled. y - the y coordinate of the rectangle to be filled. width - the width of the rectangle to be filled. height - the height of the rectangle to be filled. You haven't also considered the rectangles' thickness and length to center the cross properly. Your implementation should look like as follows: @Override protected void paintComponent(Graphics g) { super.paintComponent(g); int xCenter = getWidth() / 2; int yCenter = getHeight() / 2; int rectThickness = 10; int rectLength = 100; g.setColor(Color.RED); g.fillRect(xCenter - rectLength / 2, yCenter - rectThickness / 2, rectLength, rectThickness); g.fillRect(xCenter - rectThickness / 2, yCenter - rectLength / 2, rectThickness, rectLength); } Off-topic You should avoid the use of setBounds() method and let the layout manager handle the size and positioning of the components: window.setBounds(300, 300, 200, 200); // No! In this case and since the panel is intended to do custom painting you can give a default size to your panel by overriding getPreferredSize() method. For instance: @Override public Dimension getPreferredSize() { return new Dimension(200, 200); }
downvote count: 0
answers question: http://stackoverflow.com/q/21048126
upvote count: 2

http://stackoverflow.com/comment/31670892
comment on: http://stackoverflow.com/q/21050130
type: QuestionComment
type: Comment
has text: @Ali yes it works as expected!! :D Thank you! If you update the answer I can accept it!
score: 0

http://stackoverflow.com/q/21023063
has comment: http://stackoverflow.com/comment/31604041
favorite count: 0
has comment: http://stackoverflow.com/comment/31601272
tagged with: jframe
has comment: http://stackoverflow.com/comment/31602349
tagged with: swing
has comment: http://stackoverflow.com/comment/31600836
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31600830
accepted answer: http://stackoverflow.com/a/21024053
score: 1
tagged with: java
upvote count: 1
has body: So I just found the Netbeans JFrame Form referenced in an online tutorial to help with layout (my textbook hadn't made mention of it in the GUI section, at least that I've seen!) Since I'm having a difficult time with the layout of the program I'm working on (I can't get the text area to behave itself and stay in the center of the window instead of taking up the entire window!) I thought a visual aid might be helpful, however, as you might have guessed I already have a large amount of code sunk into this program. Is it possible to link a new JFrame Form with an existing class? If so, how would I go about doing it? I can provide my code if you need it, but we're talking 500 lines of code in just one of the main three classes. /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package theproblem; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.TextArea; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; /** * * @author Heather */ public class TheProblem { /** * @param args the command line arguments */ public static void main(String[] args) { JFrame window2 = new JFrame(); TextArea battleLogging = new TextArea(3,10); JScrollPane logScrollPane = new JScrollPane(battleLogging); JLabel BattleLog = new JLabel(); JLabel p1HPLabel= new JLabel(); JLabel p2HPLabel= new JLabel(); String attack1ButtonContents = "Just an attack"; String attack2ButtonContents = "Just another attack"; JButton attack1=new JButton(attack1ButtonContents); JButton attack2=new JButton(attack2ButtonContents); window2.setLayout(new BorderLayout()); window2.setSize(400,400); JPanel attackPanel = new JPanel(); attackPanel.add(attack1); attackPanel.add(attack2); // attack1 = new JButton(p1A1); // attack2 = new JButton(p1A2); // attack1.addActionListener(new Attack1()); // attack2.addActionListener(new Attack2()); //window2.add(attackPanel, BorderLay…
has title: Is it possible to add a jframe form to an existing class?
type: Question
linked to: http://stackoverflow.com/q/9554636
tagged with: jtextarea
downvote count: 0
has comment: http://stackoverflow.com/comment/31601760
has comment: http://stackoverflow.com/comment/31604189
has comment: http://stackoverflow.com/comment/31600581
has comment: http://stackoverflow.com/comment/31602269
answer count: 1
has answer: http://stackoverflow.com/a/21024053
tagged with: netbeans-7

http://stackoverflow.com/comment/31792940
score: 2
type: Comment
type: QuestionComment
has text: Usually, you use either an (explicit) stack, OR recursion - you appear to be attempting to use both.
comment on: http://stackoverflow.com/q/21127752

http://stackoverflow.com/q/21133962
has comment: http://stackoverflow.com/comment/31804293
has comment: http://stackoverflow.com/comment/31804059
has body: Here I am reading json value from youtube to java. I am getting values properly except the thumbnail data while getting thumbnail object value i am getting java.lang.NullPointerException public class JsonVideoDetais { public static void main(String... args) { BufferedReader reader = null; StringBuilder buffer = null; try { String link = "https://gdata.youtube.com/feeds/api/videos/" + "aa_wFClyiVE" + "?v=2&amp;alt=jsonc"; URL url = new URL(link); reader = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8")); buffer = new StringBuilder(); int read; char[] chars = new char[1024]; while ((read = reader.read(chars)) != -1) { buffer.append(chars, 0, read); } } catch (Exception e) { } finally { if (reader != null) { try { reader.close(); } catch (IOException ex) { Logger.getLogger(JsonVideoDetais.class.getName()).log(Level.SEVERE, null, ex); } } } videoDetails data; data = new Gson().fromJson(buffer.toString(), videoDetails.class); System.out.println(data.getData().getTitle()); System.out.println(data.getData().getTn().getHqDefault()); System.out.println(data.getData().getTn().getSqDefault()); } } class videoDetails { private Data data; public Data getData() { return data; } public void setData(Data data) { this.data = data; } public String toString() { return String.format("data:%s", data); } } class Data { private String id; private String title; private String description; private int duration; private Thumbnail tn; public Thumbnail getTn() { return tn; } public void setTn(Thumbnail tn) { this.tn = tn; } public int getDuration() { return duration; } public void setDuration(int duration) { this.duration = duration; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String toStri…
has title: java.lang.NullPointerException while reading value from json to java object
type: Question
has comment: http://stackoverflow.com/comment/31803719
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21134803
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/31806079
has comment: http://stackoverflow.com/comment/31804406
answer count: 2
has answer: http://stackoverflow.com/a/21134048
has comment: http://stackoverflow.com/comment/31805238
possible better answer: http://stackoverflow.com/a/21134048
accepted answer: http://stackoverflow.com/a/21134803
score: 0

http://stackoverflow.com/comment/31850521
has text: @Peter Lawrey: Database can handle sequence updates even I have clustered environment. Only concern is about Performance.
comment on: http://stackoverflow.com/q/21159428
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21080594
upvote count: 5
type: Answer
downvote count: 0
has body: split takes a regular expression as its argument. $ is a the meta-character used to match the end of an input String. It needs to be escaped String [] tokens = readFile().split("\\$"); otherwise the split will occur on the last character of the input. Read Special Characters section
score: 5
answers question: http://stackoverflow.com/q/21080585
has comment: http://stackoverflow.com/comment/31706062

http://stackoverflow.com/comment/31877011
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21161816
has text: Guys, the inner do while is for when the user doesn't type a valid answer.

http://stackoverflow.com/a/21182430
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31891671
has comment: http://stackoverflow.com/comment/31897932
score: 0
has comment: http://stackoverflow.com/comment/31893865
has comment: http://stackoverflow.com/comment/31891774
accepted answer of: http://stackoverflow.com/q/21182406
type: Answer
has comment: http://stackoverflow.com/comment/31894101
has comment: http://stackoverflow.com/comment/31893927
has comment: http://stackoverflow.com/comment/31891612
has comment: http://stackoverflow.com/comment/31896283
has body: You should use Jsoup - A JAVA HTML parser library for these operations. Your code works as it should be. As per the documentation, getText() returns the visible (i.e. not hidden by CSS) innerText of this element, including sub-elements, without any leading or trailing whitespace thus, it will return the inner text of the sub-elements. i.e. text of inner span elements. In order to locate only the inner span element with text content, you can subclass By Class and override the protected methods as required, though it is expected that that all subclasses rely on the basic finding mechanisms provided through static methods of this class
has comment: http://stackoverflow.com/comment/31892850
has comment: http://stackoverflow.com/comment/31897777
answers question: http://stackoverflow.com/q/21182406

http://stackoverflow.com/q/21179707
has body: I want to program a search function of the arraylist . Example I search for Simon, name that contains Simon should show up in the Jlist as shown below. The part I couldnt figure is what is the condition should I check for and what should I be adding. Screenshot Main public static ArrayList al = new ArrayList(); al.add("Alica Wonderland"); al.add("Bob Jr"); al.add("Simon Tay"); al.add("Simon Corbell"); al.add("Simon Flyman"); al.add("Simon Jr"); al.add("David Copper"); Button Action private void btnSearchActionPerformed(java.awt.event.ActionEvent evt) { String value = txtSearch.getText(); listModel = new DefaultListModel(); JList ListAll = new JList(listModel); if(al.contains(value)){ listModel.addElement(?Name that contains Simon?); } ListAll.setModel(listModel); }
answer count: 3
has answer: http://stackoverflow.com/a/21179841
has answer: http://stackoverflow.com/a/21179760
favorite count: 0
type: UnansweredQuestion
tagged with: jlist
tagged with: list
has answer: http://stackoverflow.com/a/21179767
tagged with: java
score: 0
upvote count: 1
downvote count: 1
type: Question
has title: Java ArrayList search element and input into Jlist

http://stackoverflow.com/comment/31799135
has text: @avalancha Take only the matched group :) Thats it :)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21131124

ssl
tags question: http://stackoverflow.com/q/21127896
tags question: http://stackoverflow.com/q/21159723
type: Tag
tags question: http://stackoverflow.com/q/21153758
tags question: http://stackoverflow.com/q/21041645
tags question: http://stackoverflow.com/q/21038249
tags question: http://stackoverflow.com/q/21183762
tags question: http://stackoverflow.com/q/21183043
tags question: http://stackoverflow.com/q/21177298
tags question: http://stackoverflow.com/q/21095535
tags question: http://stackoverflow.com/q/21166696
tags question: http://stackoverflow.com/q/21040751
tag name: ssl
tags question: http://stackoverflow.com/q/21067168
tags question: http://stackoverflow.com/q/21067753
tags question: http://stackoverflow.com/q/21154895
tags question: http://stackoverflow.com/q/21160927
tags question: http://stackoverflow.com/q/21025489
tags question: http://stackoverflow.com/q/21135637
tags question: http://stackoverflow.com/q/21120264
tags question: http://stackoverflow.com/q/21173289
tags question: http://stackoverflow.com/q/21146290
tags question: http://stackoverflow.com/q/21098105
tags question: http://stackoverflow.com/q/21047414
tags question: http://stackoverflow.com/q/21162832
tags question: http://stackoverflow.com/q/21156929
tags question: http://stackoverflow.com/q/21174277
tags question: http://stackoverflow.com/q/21034677

http://stackoverflow.com/q/21115056
type: Question
tagged with: recursion
tagged with: java
has comment: http://stackoverflow.com/comment/31769029
score: -1
tagged with: sorting
accepted answer: http://stackoverflow.com/a/21115107
has title: checking a selection sort method for array
linked to: http://stackoverflow.com/q/2752485
answer count: 1
downvote count: 1
tagged with: arrays
has answer: http://stackoverflow.com/a/21115107
favorite count: 0
type: AnsweredQuestion
upvote count: 0
has body: i have this method that i got from a website about selection sort that i need to check how it works : public static void selectionSort(int[] data, int low, int high) { if (low &lt; high) { swap(data, low, findMinIndex(data, low)); selectionSort(data, low + 1, high); } public static void swap(int[] array, int index1, int index2) { int tmp = array[index1]; array[index1] = array[index2]; array[index2] = tmp; } public static int findMinIndex(int[] data, int index) { int minIndex; if (index == data.length - 1) return index; minIndex = findMinIndex(data, index + 1); if (data[minIndex] &lt; data[index]) return minIndex; else return index; } public static void main (String[] args) { int[] numbers = {3, 15, 1, 9, 6, 12, 21, 17, 8}; } my question is how can i run the program in the main?(whats the code to run the program) thanks.

http://stackoverflow.com/q/21112627
has comment: http://stackoverflow.com/comment/31764858
downvote count: 2
has comment: http://stackoverflow.com/comment/31764503
upvote count: 1
accepted answer: http://stackoverflow.com/a/21115894
has answer: http://stackoverflow.com/a/23607399
favorite count: 0
has comment: http://stackoverflow.com/comment/31764924
has comment: http://stackoverflow.com/comment/31765266
tagged with: android
has answer: http://stackoverflow.com/a/21115894
has comment: http://stackoverflow.com/comment/31766710
tagged with: android-studio
has comment: http://stackoverflow.com/comment/31766461
type: AnsweredQuestion
tagged with: onclicklistener
tagged with: java
possible better answer: http://stackoverflow.com/a/23607399
type: Question
has body: I'm trying Android Studio. I've created a simple app with a button with onClickLister() to show a Toast message. I get the message "the application has stopped". -The same code works with Eclipse -I created more projects to try -tried on virtual and real device -Reinstalled Android Studio Any idea? 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:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity$PlaceholderFragment"&gt; &lt;TextView android:text="@string/hello_world" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/textView" /&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="New Button" android:id="@+id/button" android:layout_centerVertical="true" android:layout_centerHorizontal="true" /&gt; &lt;/RelativeLayout&gt; My Activity Class here : public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button mibtn = (Button)findViewById(R.id.button); mibtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(getApplicationContext(),"Apretado", Toast.LENGTH_LONG).show(); } }); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSel…
answer count: 2
score: -1
has comment: http://stackoverflow.com/comment/31764739
has title: Android Studio - the application has stopped
has comment: http://stackoverflow.com/comment/31766635

http://stackoverflow.com/comment/31776944
score: 0
type: QuestionComment
type: Comment
has text: Just an aside, it looks like you could concatenate your two queries into a single query with a join
comment on: http://stackoverflow.com/q/21118779

http://stackoverflow.com/comment/31880126
has text: The expected format (`yyyy-MM-dd HH:mm:ss`) doesn't match the actual value (`01/29/2014`), it's simply unparasable. Try using `MM/dd/yyyy` as the format instead...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21175710
score: 3

http://stackoverflow.com/comment/31728087
has text: Yes, what you have seems fine. Is it working ok? To make it easier for you could use a SlidePagerAdapter for your view pager. So viewPager.setAdapter(new SlidePagerAdapter(activity.getFragmentManager(), fragment1, fragment2, fragment3)
type: AnswerComment
comment on: http://stackoverflow.com/a/21092036
score: 0
type: Comment

http://stackoverflow.com/a/21087402
answers question: http://stackoverflow.com/q/21021619
has body: Fixed; the error appeared due to a third party framework
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/21021619
type: AcceptedAnswer

http://stackoverflow.com/comment/31671639
type: QuestionComment
score: 2
has text: http://netbeanside61.blogspot.ch/2009/02/using-command-line-arguments-in.html
comment on: http://stackoverflow.com/q/21062012
type: Comment

http://stackoverflow.com/comment/31884632
type: Comment
type: QuestionComment
score: 1
has text: boolean mutipleof90 = (angle % 90 == 0);
comment on: http://stackoverflow.com/q/21178268

http://stackoverflow.com/comment/31700764
score: 0
has text: You *might* consider putting the calculations that you have at the bottom *within* the try block. Else you risk doing calculations on dirty numbers. Just a thought.
type: Comment
comment on: http://stackoverflow.com/a/21076113
type: AnswerComment

http://stackoverflow.com/q/21127117
tagged with: multithreading
score: -1
tagged with: java
has comment: http://stackoverflow.com/comment/31791947
answer count: 1
downvote count: 1
type: UnansweredQuestion
has body: I am studying Java and Thread and have a question about inheritance. For example I have a parent class called SuperThread and this thread has LocalThread and NetThread. I would like to use SuperThread's constructor in LocalThread and NetThread. for example: public class SuperThread{ Private String name; Private int size; SuperThread(String name, int size){ this.name = name; this.size = size; } } public class LocalThread extends Thread{ String path = ""; LocalThread(String name, int size, String path){ Super(name, size); this.path = path; } public class NetThread extents Thread{ //Share common constructor from parent class, but it was own part } } However, I know that I have to extend Thread in order to use thread. Is there any way to extend Threads while inheriting constructor from parent's class ?
tagged with: inheritance
has title: Java inheritance and extends Thread
has comment: http://stackoverflow.com/comment/31791836
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21127147
tagged with: constructor
type: Question

http://stackoverflow.com/comment/31889476
has text: just wait a min, let me try this, although above answer seems justified but there should be a way around.
type: Comment
comment on: http://stackoverflow.com/a/21179649
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31651684
type: Comment
score: 0
type: AnswerComment
has text: One question: if i have : "Boolean b = true; Integer i = 10; etc.", those objects are created at that point or as you two say that happens with the String literals ?
comment on: http://stackoverflow.com/a/21048856

http://stackoverflow.com/q/21148766
has answer: http://stackoverflow.com/a/21148939
has comment: http://stackoverflow.com/comment/31831278
has comment: http://stackoverflow.com/comment/31831292
downvote count: 6
score: -5
tagged with: java
has comment: http://stackoverflow.com/comment/31831362
has comment: http://stackoverflow.com/comment/31831288
tagged with: loops
upvote count: 1
has answer: http://stackoverflow.com/a/21148898
type: Question
has body: Not able to get three integers for (int i = 0; i &lt; 10; i++){ Random rand = new Random(3)+1; if (rand == 1){ hand.takeCard(one); } else if (rand == 2){ hand.takeCard(two); } else if (rand == 3){ hand.takeCard(three); } } How do I do it? Thanks.
has comment: http://stackoverflow.com/comment/31831321
has title: Java Random between 1, 2 and 3
tagged with: random
answer count: 3
has comment: http://stackoverflow.com/comment/31831274
has answer: http://stackoverflow.com/a/21148859
favorite count: 0
type: UnansweredQuestion

noclassdeffounderror
tags question: http://stackoverflow.com/q/21047909
tags question: http://stackoverflow.com/q/21022279
tag name: noclassdeffounderror
type: Tag
tags question: http://stackoverflow.com/q/21058778
tags question: http://stackoverflow.com/q/21109983

http://stackoverflow.com/a/21053397
has comment: http://stackoverflow.com/comment/31655668
score: 1
has body: This should make your code work. At least it won't throw a NullPointerException at drawSquare() public class tictac { ... //rest of the code static tictac[] player = { new tictac( "PlayerName1" ), new tictac( "PlayerName2" ), }; ... //more code } EDIT: Ok, perhaps I wasn't as straightforward as I thought. This is the full code for the class tictac that I want you to run import java.util.*; import acm.program.*; public class tictac{ private String name; int [][]table=new int [][]{ {8,1,6}, {3,5,7}, {4,9,2} }; int activePlayer; boolean [][]takenSquare= new boolean [2][2]; int [][]playerTable; //gia tin niki static tictac[] player = { new tictac( "PlayerName1" ), new tictac( "PlayerName2" ), }; private int row; //&lt;--- private int col; //"" public tictac(String name){ this.name=name; playerTable=new int[2][2]; activePlayer=0; } public boolean isValidMove(int row,int col){ return (row&gt;0&amp;&amp;row&lt;4&amp;&amp;col&gt;0&amp;&amp;col&lt;4&amp;&amp;takenSquare[row-1][col-1]==false); }//isValidmove public void setMove (String move){ StringTokenizer tokenizer=new StringTokenizer(move); this.row= Integer.parseInt(tokenizer.nextToken()); this.col= Integer.parseInt(tokenizer.nextToken()); if (isValidMove(row-1,col-1)){ player[activePlayer].takenSquare[row-1][col-1]=true; player[activePlayer].playerTable[row-1][col-1]=table[row-1][col-1]; } activePlayer=1-activePlayer; } public static String drawTable(){ String a=""; a+=(drawSquare(0,0)+"|"); a+=(drawSquare(0,1)+"|"); a+=(drawSquare(0,2)+'\n'); a+=("-----------")+'\n'; a+=drawSquare(1,0)+"|"; a+=drawSquare(1,1)+"|"; a+=(drawSquare(1,2)+'\n'); a+=("-----------")+'\n'; a+=drawSquare(2,0)+"|"; a+=drawSquare(2,1)+"|"; a+=(drawSquare(2,2)); return"a"; } public static String drawSquare(int x,int y){ if (player[0].isTaken(x,y)) { return "O"; } else if (player[1].isTaken(x,y)) return "X"; else return " "; } public boolean isTaken(int x,int y) { return takenSquare[x][y]; } }
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31656027
type: Answer
answers question: http://stackoverflow.com/q/21052726

http://stackoverflow.com/a/21349878
type: AcceptedAnswer
score: -3
type: Answer
accepted answer of: http://stackoverflow.com/q/21140861
downvote count: 3
has body: From the log, its look like you made some changes into solr.xml/monitor.xml file which resides into /solr/example/exampledocs folder. You can just replace that file again with original files from solr.zip
upvote count: 0
answers question: http://stackoverflow.com/q/21140861

http://stackoverflow.com/q/21172466
upvote count: 1
tagged with: parameter-passing
tagged with: pass-by-reference
tagged with: parameters
has answer: http://stackoverflow.com/a/21172604
tagged with: java
linked to: http://stackoverflow.com/q/40480
has title: Understanding how Java handles objects when used as method parameters
has body: I have been playing around with Java and cannot quite understand how java methods work with objects which are passed to them. For example, In the code below i create some "Container" object instances which contains another object and a primitive. When i pass this "Container" object to methods, I can change the object that is held inside the container instance either directly modfying its value or using the new operator to construct a new object and replace its original. These changes are permanent as their values are that of the new objects when examined outside the method. What is confusing me greatly is that although i can change a Containers inner object via methods, I cannot actully change the container itself. By this i mean that if i pass a container to a method and try to alter it via swapping or assignment from the new operator. Below is the code i use to test the modification of an object instances attributes and then modification of the actual instance itself. class InsideRef{ char myChar; InsideRef(char newVal){ myChar = newVal; } } class Container{ InsideRef myInRef = null; int myPrimitive = 0; Container(char innerChar, int innerPrim){ myInRef = new InsideRef(innerChar); this.myPrimitive = innerPrim; } public void myDetails(){ System.out.format("Container.%s =&gt; myPrimitive -&gt; %d || myInRef =&gt; %s -&gt; %c.%n", this.hashCode(),this.myPrimitive,this.myInRef.hashCode(),this.myInRef.myChar); } } class AttribRefModder{ public static void ModObjRefVal(Container toEdit){ toEdit.myInRef.myChar = 'Z'; } public static void ModNewObjReference(Container toEdit){ toEdit.myInRef = new InsideRef('Y'); } } class RefSwapper{ public static void RefSwap(Container A, Container B){ System.out.println("Swapping...."); System.out.print("OBJECT A -&gt; "); A.myDetails(); System.out.print("OBJECT B -&gt; "); B.myDetails(); Container temp = A; A = B; B = temp; System.out.print("SWAPPED A -&gt; "); A.myDetails(); System.out.print("SWAPPED B -&gt; "); B.myDetails(); System.…
has comment: http://stackoverflow.com/comment/31874163
has comment: http://stackoverflow.com/comment/31873956
answer count: 4
has answer: http://stackoverflow.com/a/21177203
has answer: http://stackoverflow.com/a/21172616
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21172561
downvote count: 0
score: 1
tagged with: reference
favorite count: 0
type: Question

http://stackoverflow.com/comment/31615850
has text: Thanks folks, brilliant work. All is working well.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21021694
type: AnswerComment

http://stackoverflow.com/comment/31653790
type: AnswerComment
score: 0
type: Comment
has text: @arshajii: thanks, I'm already working on that List vs. array solution. It's still bizarre that Java supports the above (it works fine) but generates a warning that doesn't appear to be fixable.
comment on: http://stackoverflow.com/a/21051999

http://stackoverflow.com/comment/31756126
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21107641
type: Comment
has text: half of your answer is correct, but half of it wrong. it found that it works now. the fix was to make the class static. but using only the code with the "$" as "MainActivity$JavaCameraImageView" works, however using "MainActivity.JavaCameraImageView" does not work, edit your answer and i will check it at the correct answer.

http://stackoverflow.com/a/21361736
type: Answer
score: 0
has body: I solved it the following way: static Pointer setbooleanArray(boolean [] input) { Pointer output = new Memory(input.length*Native.getNativeSize(Byte.TYPE)); for (int i=0;i&lt;input.length;i++){ output.setByte(i, (byte) (input[i] ? 1:0)); }; return output; }; ... And here I fill the logical table: boolean[] Logic_tableSet = new boolean[] { false, true, false, false, true, true, false, false, true, false, true, true, false, false, false, false }; vh.parameters.Logic_table = setbooleanArray( Logic_tableSet); Thanks, Frank
answers question: http://stackoverflow.com/q/21095957
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21095957

http://stackoverflow.com/comment/31878091
comment on: http://stackoverflow.com/q/21170588
score: 0
type: Comment
type: QuestionComment
has text: I was trying to find something like this have a look in this contenthttp://stackoverflow.com/questions/10781401/switching-between-screens-in-java-swing.see if this helps you any way

http://stackoverflow.com/comment/31623984
has text: Any reason for the requirement that it be enums? Couldn't you just use classes with public static final members?
score: 0
comment on: http://stackoverflow.com/q/21035711
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31762544
has text: You do not need to pass a reference to the object itself to its own methods - this is always done implicitly through `this`
comment on: http://stackoverflow.com/q/21111541
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31869994
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21170372
has text: You need to run the program with at least two arguments on the command line. I'm not familiar with BlueJ so I don't know how to run programs and pass arguments.
type: Comment

http://stackoverflow.com/q/21036326
has body: I am trying to develop an application with the "java-google-translate-text-to-speech". So for that I saw the API and I execute the sample program. Audio audio = Audio.getInstance(); InputStream sound = audio.getAudio("I am a bus", Language.ENGLISH); audio.play(sound); When I execute this code I was able to listen the content. But when I change the Language from ENGLISH to TELUGU I am getting an exception like Exception in thread "main" java.io.FileNotFoundException: http://translate.google.com/translate_tts?q=I%20am%20a%20bus&amp;tl=te at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1610) at com.gtranslate.Audio.getAudio(Audio.java:34) at speech.Play.main(Play.java:15) And also I observed this behaviour for some other languages as well. So how can I solve this issue...??? My second question is, I want to send an automatic email with this audio/content. So when ever the user opens that mail the audio needs to be played. Is it possible with this Google API...??? Can any one help me on these two issues... Thanks &amp; Regards, Amar.
answer count: 3
has answer: http://stackoverflow.com/a/21127651
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/31631000
has answer: http://stackoverflow.com/a/21127543
has title: Java: "java google translate text to speech"
tagged with: java
has answer: http://stackoverflow.com/a/21127472
tagged with: google-translate
type: Question

http://stackoverflow.com/comment/31673132
score: 0
type: AnswerComment
has text: then what should i do ?
comment on: http://stackoverflow.com/a/21062444
type: Comment

http://stackoverflow.com/a/21059204
downvote count: 0
has comment: http://stackoverflow.com/comment/31666486
has comment: http://stackoverflow.com/comment/31666512
has body: somewhere in your code you are parsing a String to int, and it attempts for 1.25 which isn't an int so the error Caused by: java.lang.NumberFormatException: For input string: "1.25"
answers question: http://stackoverflow.com/q/21059187
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/31669990
type: AnswerComment
score: 0
type: Comment
has text: Hat exactly at you trying to achieve and why are either of those options not working?
comment on: http://stackoverflow.com/a/21058902

http://stackoverflow.com/q/21063393
has answer: http://stackoverflow.com/a/21066437
has title: How to close a local field of JDBCConnectionPool
has comment: http://stackoverflow.com/comment/31674197
type: AnsweredQuestion
has body: I have a local field of type JdbcConnectionPool (h2.jdbcx.JdbcConnectionPool) in my object. Since Java lacks an IDisposable Interface as found in .net, how can I ensure having the connection pool closed when the instance of the object is never in use any longer? import java.sql.*; import org.h2.jdbcx.JdbcConnectionPool; public class Test { private JdbcConnectionPool cp= null; private void setupConnectionPool() { JdbcConnectionPool cp = JdbcConnectionPool.create( "jdbc:h2:~/test", "sa", "sa"); } // when to call cp.dispose(); ?? }
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31679511
answer count: 1
accepted answer: http://stackoverflow.com/a/21066437
score: 0
tagged with: jdbc

http://stackoverflow.com/comment/31659188
has text: Ok I put it in the description.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21054576

http://stackoverflow.com/q/21159997
tagged with: mysql
has title: Map Object containing an other object using java reflection
type: Question
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/21345978
has comment: http://stackoverflow.com/comment/31858041
answer count: 1
has body: I try to map an object in my database. It works fine for simple type like int, string ect... However i got a problem about a class containing an other object. For example i got a class order : public class order { int id; Client c; public int getId(); public void setId(int id); } and a class client : public class Client { int id; //some stuff like name ect and getter/setter... } I would like to map order by getting client id. The problem is that when i try to get the package name of field Client it return me java.lang (package of field class...) field.getType().getClass().getPackage().getName().compareTo("fr.javatp.model") == 0 I don't know why it doesn't return the type Client... Any clue ? this is code : public void insertObject(Object instance) throws SQLException, SecurityException, IllegalArgumentException, InstantiationException, IllegalAccessException, IntrospectionException, InvocationTargetException { Connection connection = null; PreparedStatement preparedStatement = null; this.type = instance.getClass(); this.query = createInsertQuery(); try { try { connection = this.getConnexion(); } catch (Exception e) { e.printStackTrace(); } preparedStatement = connection.prepareStatement(query); int i = 0; Class clazz; for (Field field : type.getDeclaredFields()) { System.out.println("PACKAGE NAME : " + field.getType().getClass().getPackage().getName()); if (field.getType().getClass().getPackage().getName().compareTo("fr.javatp.model") == 0) clazz = field.getType(); PropertyDescriptor propertyDescriptor = new PropertyDescriptor( field.getName(), type); Method method = propertyDescriptor.getReadMethod(); Object value = method.invoke(instance); preparedStatement.setObject(++i, value); } preparedStatement.addBatch(); preparedStatement.executeBatch(); } finally { connection.close(); preparedStatement.close(); } } and create Insert query code : private String createInsertQuery() { StringBuilder sb = new StringBuilder(); sb.append("INSERT INTO "); sb.append(type.getSimpleN…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31851051
tagged with: reflection
tagged with: orm

http://stackoverflow.com/comment/31871753
comment on: http://stackoverflow.com/a/21171148
has text: Replace with this: Cursor cursor = db.rawQuery("SELECT * FROM "+TABLE_SETS+" WHERE "+KEY_SET_ID+" = "+ID, null);
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21140887
upvote count: 6
has body: Facts: endx1 can have an initial value between 0 and 319. space can have a value between 0 and 24. x starts at 1000 Once for each x, you decrease endx1 by space, meaning that it can reach values as low as 0 - (1000 * 24) = -24000 or as high as 319 - (1000 * 0). So, in essence, your code is an overly elaborate way to assign endx1 a random value between -24000 and 319. Of course it's going to be negative most of the time.
answers question: http://stackoverflow.com/q/21140734
downvote count: 0
score: 6
type: Answer

outputstream
tags question: http://stackoverflow.com/q/21143234
tags question: http://stackoverflow.com/q/21107666
tags question: http://stackoverflow.com/q/21052227
tags question: http://stackoverflow.com/q/21051354
type: Tag
tags question: http://stackoverflow.com/q/21039471
tag name: outputstream

http://stackoverflow.com/q/21096367
linked to: http://stackoverflow.com/q/2822005
favorite count: 0
has answer: http://stackoverflow.com/a/38932765
type: Question
has answer: http://stackoverflow.com/a/21096525
has answer: http://stackoverflow.com/a/38338277
answer count: 6
has body: How to make the PrintWriter to write UTF-8? pstream = new PrintWriter(csocket.getOutputStream(), true); String res = "some string"; pstream.println(res); // here I want to output string as UTF-8
tagged with: java
tagged with: printwriter
has answer: http://stackoverflow.com/a/39815765
downvote count: 1
type: UnansweredQuestion
score: 54
has answer: http://stackoverflow.com/a/21096438
has title: How to make the PrintWriter to write UTF-8?
upvote count: 55
tagged with: utf-8
has answer: http://stackoverflow.com/a/59706868

http://stackoverflow.com/q/21145066
tagged with: java
downvote count: 4
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/21145146
linked to: http://stackoverflow.com/q/18819066
linked to: http://stackoverflow.com/q/1817625
favorite count: 0
has body: Do u have any ideas how to generate auto number in java? I need to use it for guest ID. Every time I add a new guest, each guest has a unique ID. Help is greatly appreciated Many Thanks
has answer: http://stackoverflow.com/a/21145582
has title: Auto number of unique field
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/31823795
has answer: http://stackoverflow.com/a/21145172
type: Question

int
tags question: http://stackoverflow.com/q/21080166
tags question: http://stackoverflow.com/q/21077151
tags question: http://stackoverflow.com/q/21128400
tags question: http://stackoverflow.com/q/21025225
type: Tag
tags question: http://stackoverflow.com/q/21171737
tags question: http://stackoverflow.com/q/21030282
tags question: http://stackoverflow.com/q/21175473
tags question: http://stackoverflow.com/q/21178615
tag name: int
tags question: http://stackoverflow.com/q/21164921
tags question: http://stackoverflow.com/q/21075215

http://stackoverflow.com/a/21081428
answers question: http://stackoverflow.com/q/21079868
downvote count: 0
type: Answer
upvote count: 1
has body: Your question doesn't make sense. There is no request when the init() method is called. It is called during container initialisation. Do you mean initial parameter? They are available via the ServletContext provided as an argument to init().
score: 1

http://stackoverflow.com/q/21095844
has answer: http://stackoverflow.com/a/21096458
has title: How do you reverse the order of the elements in a queue using one additional queue,no other collection, possibly some variables in JAVA?
tagged with: java
upvote count: 1
tagged with: queue
type: Question
has body: I cannot figure this out for the life of me. Maybe its the fact I have only had two hours of sleep...I dunno. I got my pseudocode to reverse the items of up to three elements inside of a queue, but after three, I draw a blank. Pseudocode is preferred as I'm just learning about this stuff.
answer count: 1
has comment: http://stackoverflow.com/comment/31734290
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31734067
type: UnansweredQuestion
tagged with: reverse

http://stackoverflow.com/comment/31806359
score: 0
type: Comment
type: QuestionComment
has text: During the creation of jtable, you would use a table model. Call the addRow() method of table model to add the new row of data.
comment on: http://stackoverflow.com/q/21135452

http://stackoverflow.com/comment/31858294
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21153210
has text: Exception in thread "main" java.lang.Error: Unresolved compilation problem: The method toURI() is undefined for the type FileReader

http://stackoverflow.com/a/21256259
score: 4
type: AcceptedAnswer
has body: Maybe you can use Apache commons for this. It have utils for both escape and unescape
type: Answer
accepted answer of: http://stackoverflow.com/q/21022240
upvote count: 4
answers question: http://stackoverflow.com/q/21022240
downvote count: 0

http://stackoverflow.com/comment/31785825
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21123780
has text: possible duplicate of [Java /JPA | Query with specified inherited type](http://stackoverflow.com/questions/4884249/java-jpa-query-with-specified-inherited-type)
score: 0

http://stackoverflow.com/comment/130730743
has text: It is possible to inject a request scoped bean into a singleton, see for example https://stackoverflow.com/a/51398651/5226711
comment on: http://stackoverflow.com/a/21026000
type: AnswerComment
score: 0
type: Comment

spring
tags question: http://stackoverflow.com/q/21125628
tags question: http://stackoverflow.com/q/21078747
tags question: http://stackoverflow.com/q/21123852
tags question: http://stackoverflow.com/q/21158564
tags question: http://stackoverflow.com/q/21034485
tags question: http://stackoverflow.com/q/21155010
tags question: http://stackoverflow.com/q/21130209
tags question: http://stackoverflow.com/q/21118477
tags question: http://stackoverflow.com/q/21058482
tags question: http://stackoverflow.com/q/21140773
tags question: http://stackoverflow.com/q/21169413
tags question: http://stackoverflow.com/q/21043646
tags question: http://stackoverflow.com/q/21034018
tags question: http://stackoverflow.com/q/21158038
tags question: http://stackoverflow.com/q/21079857
tags question: http://stackoverflow.com/q/21168556
tags question: http://stackoverflow.com/q/21096854
tags question: http://stackoverflow.com/q/21044912
tags question: http://stackoverflow.com/q/21085510
tags question: http://stackoverflow.com/q/21182230
tags question: http://stackoverflow.com/q/21165135
tags question: http://stackoverflow.com/q/21127666
tags question: http://stackoverflow.com/q/21049827
tags question: http://stackoverflow.com/q/21163355
tags question: http://stackoverflow.com/q/21075319
tags question: http://stackoverflow.com/q/21102480
tags question: http://stackoverflow.com/q/21027943
tags question: http://stackoverflow.com/q/21114164
tags question: http://stackoverflow.com/q/21026619
tags question: http://stackoverflow.com/q/21111394
tags question: http://stackoverflow.com/q/21034351
tags question: http://stackoverflow.com/q/21037574
tags question: http://stackoverflow.com/q/21116513
tags question: http://stackoverflow.com/q/21173101
tags question: http://stackoverflow.com/q/21096862
tags question: http://stackoverflow.com/q/21042851
tags question: http://stackoverflow.com/q/21078826
tags question: http://stackoverflow.com/q/21154368
tags question: http://stackoverflow.com/q/21116719
tags question: http://stackoverflow.com/q/21138295
tags question: http://stackoverflow.com/q/21024889
tags question: http://stackoverflow.com/q/21177838
tags question: http://stackoverflow.com/q/21076023
tags question: http://stackoverflow.com/q/21102704
tags question: http://stackoverflow.com/q/21124762
tags question: http://stackoverflow.com/q/21036943
type: Tag
tags question: http://stackoverflow.com/q/21047104
tags question: http://stackoverflow.com/q/21113979
tags question: http://stackoverflow.com/q/21022240
tags question: http://stackoverflow.com/q/21018896
tags question: http://stackoverflow.com/q/21108160
tags question: http://stackoverflow.com/q/21132487
tags question: http://stackoverflow.com/q/21121891
tags question: http://stackoverflow.com/q/21164381
tags question: http://stackoverflow.com/q/21101250
tags question: http://stackoverflow.com/q/21040198
tags question: http://stackoverflow.com/q/21181431
tags question: http://stackoverflow.com/q/21113154
tags question: http://stackoverflow.com/q/21090889
tags question: http://stackoverflow.com/q/21142408
tags question: http://stackoverflow.com/q/21116902
tags question: http://stackoverflow.com/q/21164451
tags question: http://stackoverflow.com/q/21086592
tags question: http://stackoverflow.com/q/21034548
tags question: http://stackoverflow.com/q/21104504
tags question: http://stackoverflow.com/q/21124326
tags question: http://stackoverflow.com/q/21106109
tags question: http://stackoverflow.com/q/21041126
tags question: http://stackoverflow.com/q/21067559
tags question: http://stackoverflow.com/q/21036750
tags question: http://stackoverflow.com/q/21049638
tags question: http://stackoverflow.com/q/21073420
tags question: http://stackoverflow.com/q/21025848
tags question: http://stackoverflow.com/q/21040970
tags question: http://stackoverflow.com/q/21109187
tags question: http://stackoverflow.com/q/21037756
tags question: http://stackoverflow.com/q/21128089
tags question: http://stackoverflow.com/q/21041980
tags question: http://stackoverflow.com/q/21052753

http://stackoverflow.com/comment/31792494
type: AnswerComment
type: Comment
has text: yes, I've also attempting this via the API, and at the time there was also a limit to the number of requests you could make before it would reject subsequent requests. I can't comment if this is still in place now. But attempts to automate its use failed rather rapidly.
comment on: http://stackoverflow.com/a/21127472
score: 0

http://stackoverflow.com/comment/31704803
has text: Then how would I take this getClass().getRecourseAsStream(String) object and convert it to an ImageIcon?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21079841

http://stackoverflow.com/q/21112086
has body: i use fragment for my application,they are : Fragment A, Fragment B and Fragment C. to move from one fragment to another fragment, I use two buttons, the first button is used to move to the next fragment, and the second button is used to return to the previous fragment. the problems when I move from one fragment to another fragment (such as from A to B and back to A and to B again and to C). all entries in the EditText that is in a fragment is lost and look back empty,it when I go back to the previous fragment, or when I want to go back to the next fragment. I've been using code addToBackStack () when switching to another fragment, indeed EditText that I made not lost when I press the back button on my phone, but it does not affect the buttons (Next And Prev) that I've created. this is Fragment A: public class AFragment extends Fragment { EditText text,text2; public AFragment(){} @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_a, container, false); ImageView next=(ImageView)rootView.findViewById(R.id.next); text=(EditText)rootView.findViewById(R.id.text); text2=(EditText)rootView.findViewById(R.id.text1); next.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { getFragmentManager().beginTransaction().replace(R.id.frame_container, new BFragment()).addToBackStack(null).commit(); } }); return rootView; } this is Fragment B: public class BFragment extends Fragment { EditText cut,cut2; public BFragment(){} @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View Fragment B = inflater.inflate(R.layout.fragment_c, container, false); ImageView next=(ImageView)rootView.findViewById(R.id.next); ImageView prev=(ImageView)rootView.findViewById(R.id.prev); cut=(EditText)rootView.findViewById(R.id.cut); cut2=(EditText)rootView.findViewById(R.id.cut2); next.setOnClickListener(new…
tagged with: android-fragments
tagged with: java
type: Question
answer count: 2
score: 0
tagged with: android
has title: Android how to save all views in Fragment when user click on next and prev button
has answer: http://stackoverflow.com/a/21112389
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21112345

http://stackoverflow.com/a/21080843
has body: Here is code that compiles, but you have a few major problems in your code, I will try to point a few of them out below: import java.util.Scanner; public class Election { public static void main (String[] args) { int votesForPolly = 0; // number of votes for Polly in each precinct int votesForErnest = 0; // number of votes for Ernest in each precinct int totalPolly = 0; // running total of votes for Polly int totalErnest = 0; // running total of votes for Ernest String response = ""; // answer (y or n) to the "more precincts" question Scanner scan = new Scanner(System.in); System.out.println(); System.out.println("Election Day Vote Counting Program"); System.out.println(); // Initializations // Loop to "process" the votes in each precinct System.out.println("Enter Votes? Enter Y or N"); response=scan.next().toUpperCase(); if (response.equals("Y")) { response="Yes"; System.out.println("Enter votes for Polly:"); votesForPolly=scan.nextInt(); totalPolly=totalPolly + votesForPolly; System.out.println ("Enter votes for Ernest:"); votesForErnest=scan.nextInt(); totalErnest=totalErnest + votesForErnest; System.out.println("Enter another District? Enter Y or N"); response=scan.next().toUpperCase(); } else { // int count = 0; &lt;--- see below // while (count == 1) { &lt;--- makes no sense in your context // Print out the results System.out.println("Total votes for Polly is: " + totalPolly); System.out.println("Total votes for Ernest is: " + totalErnest); // } } } } First a few of your variables get never initialized. The compiler will complain about that fact. You missed a lot of braces through your code. Your while statement at the end will never executed because the condition is always false, respective it will never get 1. In your context it seems like this while loop is completely unnecessary, because you only want to print a single vote count. Also I renamed your condition variable there, because you can not assign the same variable name to more then one variable, also…
has comment: http://stackoverflow.com/comment/31707312
has comment: http://stackoverflow.com/comment/31707288
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/31707215
score: 1
has comment: http://stackoverflow.com/comment/31707323
upvote count: 1
answers question: http://stackoverflow.com/q/21080627

http://stackoverflow.com/comment/31650143
comment on: http://stackoverflow.com/q/21050294
has text: Ha... where's my opening `{`? lol... oh geez.
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/31680552
comment on: http://stackoverflow.com/a/21066678
type: AnswerComment
score: 1
type: Comment
has text: Abosolutely---all dynamic languages are distributed by source code (php, python, ruby, javascript). The runtime usually performs a shallow "compilation" of the source code (basically turns it into a binary form of the same thing) and starts optimizing from that. As for the results, nobody is as far ahead as HotSpot and derivatives, but you surely know the tales of V8 and other modern optimizing runtimes.

http://stackoverflow.com/a/21154798
answers question: http://stackoverflow.com/q/21153092
type: Answer
has body: Rather than trying to solve this problem for every possible source datatype you should be just concentrating on constructing your class from a String. Then all you have to do is delegate this method and all the others you haven't done yet to the corresponding String method in each case, take the resulting String, and construct your object with that String.
score: 0

http://stackoverflow.com/a/21063321
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21062586
answers question: http://stackoverflow.com/q/21062586
has body: I think you are confused with context and config. Servlet config object is one per servlet. Context object is one per web-app.(application-scope). that means your context parameters can be accessed in all of your servlets by using... getServletContext().getInitParameter("context-param-name") ; You said...I need to call servlets 1 context parameters ...? thats a wrong statement... Tip: See that your context-param element is not inside any other servlet element in your web.xml file Hope this helps.
type: Answer
has comment: http://stackoverflow.com/comment/31692279

http://stackoverflow.com/a/21081595
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/31709451
accepted answer of: http://stackoverflow.com/q/21081553
upvote count: 6
has comment: http://stackoverflow.com/comment/31708848
answers question: http://stackoverflow.com/q/21081553
has comment: http://stackoverflow.com/comment/31708641
has body: You could do String[] array = student[0].split("(?&lt;=\\G.{7})"); \G is a meta character that matches the last match so (?&lt;=\\G.{7}) matches an empty string followed by any 7 characters IDEOne Demo
has comment: http://stackoverflow.com/comment/31709211
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31709073
has comment: http://stackoverflow.com/comment/31708932
has comment: http://stackoverflow.com/comment/31708064
has comment: http://stackoverflow.com/comment/31708725
has comment: http://stackoverflow.com/comment/31709316
type: Answer
has comment: http://stackoverflow.com/comment/31708076
has comment: http://stackoverflow.com/comment/31709121

http://stackoverflow.com/comment/31631753
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21039959
has text: If I have let's say a NPE having a call stack 20 levels deep and thrown 2000 times on Swing Thread, what effect would this have on the memory consumption.

http://stackoverflow.com/a/67753545
score: 11
downvote count: 0
upvote count: 11
has body: Settings -&gt; Editor -&gt; File and Code Templates -&gt; Includes -&gt; File Header /** * @Author: yourname * @Date: ${DATE} */
answers question: http://stackoverflow.com/q/21160288
type: Answer

http://stackoverflow.com/comment/31880293
type: AnswerComment
comment on: http://stackoverflow.com/a/21175153
type: Comment
score: 0
has text: You would need to determine the users `Locale` for the input `DateFormat`. It looks like you're using a web interface or servlet. You could use [ServletRequest.html#getLocale](http://docs.oracle.com/javaee/7/api/javax/servlet/ServletRequest.html#getLocale())

http://stackoverflow.com/comment/137615374
score: 0
type: AnswerComment
type: Comment
has text: This worked for Mac as well. Thanks!!
comment on: http://stackoverflow.com/a/36427118

size
type: Tag
tags question: http://stackoverflow.com/q/21019458
tag name: size
tags question: http://stackoverflow.com/q/21154689
tags question: http://stackoverflow.com/q/21177382

http://stackoverflow.com/comment/31683063
has text: The packages are as follows: br.com.servtech.servlet.list ==> UserList.java br.com.servtech.model.json ==> User.json
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21067484

http://stackoverflow.com/comment/31840387
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21153502
has text: so according to your link, the File I would use into `final Player p=Manager.createRealizedPlayer(f.toURI().toURL())` would be `fo` ??

http://stackoverflow.com/comment/31845679
comment on: http://stackoverflow.com/q/21156921
score: 0
type: QuestionComment
type: Comment
has text: http://stackoverflow.com/questions/12597277/why-would-someone-use-collections-emptylist-in-java

http://stackoverflow.com/comment/31724914
has text: My mistake, it is actually part of the [`dx`](http://stackoverflow.com/questions/8487268/android-dx-tool) tool which converts a Java `.class` file into Android consumable `.dex` bytecode. If you see an error there you / your Java compiler has created a class file that is not understood by `dx`, maybe you've compiled a Java 7 type `.class` file which `dx` does not understand.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21090923
score: 1

http://stackoverflow.com/a/26860128
type: Answer
answers question: http://stackoverflow.com/q/21119021
has body: Follow @abs solution If you still continue to get the error even after setting the JAVA_HOME variable Copy the studio folder to your C drive and then run the studio.exe or studio64.exe depending upon your java versio
score: 0

http://stackoverflow.com/comment/31711605
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21083386
has text: @MadProgrammer it's a panel in which user can add objects , and he can zoom in/out to see wider area and add more stuff, I need the resizing for the zoom in/out
score: 0

http://stackoverflow.com/comment/31758511
type: Comment
has text: I hope they never incorporate JavaFX into the Java tutorial. Okay, maybe a trail or two. I consider [this](http://docs.oracle.com/javafx/) a very good "tutorial" on the topic. The JavaFX guides is just way too much to include in an already huge "tutorial". Likewise, I hope they keep the API separate. However, I've read somewhere that they plan on merging the API:s too? Anyways, you know you have to make the switch eventually. From [Oracle](http://www.oracle.com/technetwork/java/javafx/overview/faq-1446554.html#6): "**Is JavaFX replacing Swing as the new client UI library for Java SE? Yes.**"
score: 0
comment on: http://stackoverflow.com/q/21106626
type: QuestionComment

http://stackoverflow.com/q/21079208
tagged with: java
has comment: http://stackoverflow.com/comment/31759414
tagged with: apache-storm
type: Question
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/21087427
accepted answer: http://stackoverflow.com/a/21087427
has title: Faster object json convertor
tagged with: jsonserializer
tagged with: serialization
possible better answer: http://stackoverflow.com/a/21081160
has body: I have written a program which inserts in bulk to Elasticsearch in batch of around 3000. The problem is that I need to convert these object to json before executing the bulk insert request. But there is major downside with json convertion and it is becoming a bottle neck of my whole computation. Can any one suggest a super fast way to convert object to json in java. My code looks like this: private String getESValueAsString(ElasticSearchValue elasticSearchValue) throws JsonProcessingException { ElasticSearchValue prevValue = null; if (stateType == StateType.OPAQUE) { prevValue = (ElasticSearchValue) elasticSearchValue.getPrevious(); } elasticSearchValue.setPrevious(null); ObjectMapper om = new ObjectMapper(); Map&lt;String, Object&gt; props = om.convertValue(elasticSearchValue, Map.class); if (stateType == stateType.OPAQUE) { props.put("previous", prevValue); } return om.writeValueAsString(props); }
has answer: http://stackoverflow.com/a/21081160
tagged with: elasticsearch
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31765769

http://stackoverflow.com/a/21105641
type: AcceptedAnswer
score: 1
has comment: http://stackoverflow.com/comment/31758357
has body: Use Window.getWindows() to get reference to all windows, and check if they are visible with Window.isShowing(). Worth to note that windows that have been hidden but not disposed will still prevent Java from exiting. You also could also dispose() these windows and then the JVM should exit by itself (no more need for System.exit()) after the main program finishes executing.
type: Answer
accepted answer of: http://stackoverflow.com/q/21104874
upvote count: 1
answers question: http://stackoverflow.com/q/21104874
downvote count: 0

http://stackoverflow.com/comment/32066878
comment on: http://stackoverflow.com/a/21280285
score: 0
type: Comment
has text: I agree. But, IntentService will run only if the app is running. If the app is closed, it will be terminated automatically.
type: AnswerComment

http://stackoverflow.com/q/21109414
type: Question
has answer: http://stackoverflow.com/a/27808212
tagged with: jaas
answer count: 1
downvote count: 0
has title: What is the meaning of JAAS error Login Failure: all modules ignored
favorite count: 0
has body: I am trying to setup an authentication based on property file using JAAS on jetty. It seems my login module is being loaded and used but i get this Login Failure: all modules ignored ... and i simply do not get it ... what does it means? I have a loginConfig.jaas file jettyLogin { org.eclipse.jetty.plus.jaas.spi.PropertyFileLoginModule required file="credentials.props"; };
type: UnansweredQuestion
tagged with: jetty
upvote count: 1
score: 1
tagged with: java

http://stackoverflow.com/comment/31823384
comment on: http://stackoverflow.com/q/21144739
has text: Recursion *is* a stack/unstack operation, though implicitly.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31870360
has text: You have a 64-bit Eclipse. Any Java that installed by default into "c:\Program Files (x86)" is 32-bit. They need to match. Where is the javaw.exe, and can you paste the contents of the eclipse.ini?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21168350
score: 0

http://stackoverflow.com/q/21178143
has comment: http://stackoverflow.com/comment/31884265
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31884878
has comment: http://stackoverflow.com/comment/31885009
possible better answer: http://stackoverflow.com/a/21178176
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/21178176
tagged with: java
has comment: http://stackoverflow.com/comment/31884435
has comment: http://stackoverflow.com/comment/31884416
has comment: http://stackoverflow.com/comment/31884951
type: Question
has comment: http://stackoverflow.com/comment/31884591
has comment: http://stackoverflow.com/comment/31884235
has comment: http://stackoverflow.com/comment/31884387
tagged with: function
tagged with: nullpointerexception
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/21178277
accepted answer: http://stackoverflow.com/a/21178175
tagged with: textview
has title: getting null pointer exception
favorite count: 0
has comment: http://stackoverflow.com/comment/31884579
has body: I am getting a NullPointerException when I try to access text view which is defined in view class. I am accessing it from setting class. A small part of my code is: view class public class view1 extends menu { public static TextView text1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.view); text1=(TextView)findViewById(R.id.textfile1); text1.setText("product"); } public void small(String mytext) { // this is my method which I want to access text1.setText(mytext); } } setting class public class Setting extends Activity { private Spinner spinner1; private Button apply; TextView small1; private view1 view11; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.setting); //setContentView(R.layout.view); addItemsOnSpinner1(); addListenerOnSpinnerItemSelection(); } public void addItemsOnSpinner1() { spinner1 = (Spinner) findViewById(R.id.spinner1); List&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add("Small"); list.add("Medium"); list.add("Large"); ArrayAdapter&lt;String&gt; dataAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner1.setAdapter(dataAdapter); } public void addListenerOnSpinnerItemSelection() { spinner1 = (Spinner) findViewById(R.id.spinner1); apply = (Button) findViewById(R.id.apply); spinner1.setOnItemSelectedListener(new CustomOnItemSelectedListener()); apply.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String mytext = "Something else"; view11.small(mytext); } Stack trace 01-17 00:11:02.064: E/AndroidRuntime(4191): FATAL EXCEPTION: main 01-17 00:11:02.064: E/AndroidRuntime(4191): java.lang.NullPointerException 01-17 00:11:02.064: E/AndroidRuntime(4191): at com.ramanrayat.notelet.Setting$1.onClick(Setting.java:106) 01-17 00:11:02.064…
has comment: http://stackoverflow.com/comment/31884710
tagged with: android
has answer: http://stackoverflow.com/a/21178175

http://stackoverflow.com/q/21121031
answer count: 1
has title: Tomcat 7 Liferay 6.2 Strange error regarding corrupt database
tagged with: tomcat
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31781297
has comment: http://stackoverflow.com/comment/31792192
has comment: http://stackoverflow.com/comment/31831620
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31798016
tagged with: java
has answer: http://stackoverflow.com/a/21158070
has comment: http://stackoverflow.com/comment/31784918
type: Question
tagged with: liferay
has comment: http://stackoverflow.com/comment/31782703
has body: 18:03:55,526 ERROR [localhost-startStop-1][MainServlet:209] java.lang.IllegalStateException: The database contains changes from a previous upgrade attempt that failed. Please restore the old database and file system and retry the upgrade. A patch may be required if the upgrade failed due to a bug or an unforeseen data permutation that resulted from a corrupt database. java.lang.IllegalStateException: The database contains changes from a previous upgrade attempt that failed. Please restore the old database and file system and retry the upgrade. A patch may be required if the upgrade failed due to a bug or an unforeseen data permutation that resulted from a corrupt database. at com.liferay.portal.tools.DBUpgrader._checkReleaseState(DBUpgrader.java:314) at com.liferay.portal.tools.DBUpgrader.upgrade(DBUpgrader.java:136) at com.liferay.portal.events.StartupAction.doRun(StartupAction.java:160) at com.liferay.portal.events.StartupAction.run(StartupAction.java:68) at com.liferay.portal.servlet.MainServlet.processStartupEvents(MainServlet.java:1238) at com.liferay.portal.servlet.MainServlet.init(MainServlet.java:206) at javax.servlet.GenericServlet.init(GenericServlet.java:160) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5198) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5481) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:634) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:671) at org.apache.ca…
has comment: http://stackoverflow.com/comment/31800780
tagged with: portal
has comment: http://stackoverflow.com/comment/31828863
upvote count: 1
tagged with: apache

http://stackoverflow.com/comment/31738847
has text: That would be strange since the package I'm scanning is only simple POJOs that are used to represent our domain.
type: AnswerComment
comment on: http://stackoverflow.com/a/21082399
score: 0
type: Comment

bluetooth
tags question: http://stackoverflow.com/q/21050452
tag name: bluetooth
tags question: http://stackoverflow.com/q/21166222
type: Tag
tags question: http://stackoverflow.com/q/21097946
tags question: http://stackoverflow.com/q/21072148

http://stackoverflow.com/comment/31880565
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/21175900
type: Comment
has text: Yea that is what I meant. I tried it and ran into several problems.

http://stackoverflow.com/comment/31651424
has text: I have to agree with dasblinkenlight here. Your code looks ok and works as expected when I test it. Are you sure that you are actually testing the posted code and not something else? Which Java version are you using?
score: 0
comment on: http://stackoverflow.com/q/21050912
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21168716
has comment: http://stackoverflow.com/comment/31867017
favorite count: 0
has body: I have searched a lot in google but I didnt get any kind of solution I could use. Suppose input of array is: {3,1,2,4,9,8,7,6,5,10} then output must be like this: {1,2,3,4,5,10,9,8,7,6} by using Basic Java .
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/31867598
has title: Sort an array such a way that First half should be in ascending order Second half should be in descending order in java
has comment: http://stackoverflow.com/comment/31867169
has answer: http://stackoverflow.com/a/21169101
has comment: http://stackoverflow.com/comment/31866972
has comment: http://stackoverflow.com/comment/31866872
has comment: http://stackoverflow.com/comment/31867367
has answer: http://stackoverflow.com/a/35251870
tagged with: java
has comment: http://stackoverflow.com/comment/31866923
has comment: http://stackoverflow.com/comment/31866888
has comment: http://stackoverflow.com/comment/31866957
has answer: http://stackoverflow.com/a/21169423
has comment: http://stackoverflow.com/comment/31866944
has answer: http://stackoverflow.com/a/21169064
answer count: 9
has comment: http://stackoverflow.com/comment/31867448
has comment: http://stackoverflow.com/comment/31867007
tagged with: sorting
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/57977012
has answer: http://stackoverflow.com/a/47472851
has comment: http://stackoverflow.com/comment/31866973
has answer: http://stackoverflow.com/a/21168829
has comment: http://stackoverflow.com/comment/31866869
has comment: http://stackoverflow.com/comment/31867104
has comment: http://stackoverflow.com/comment/31867445
score: 2
has answer: http://stackoverflow.com/a/28193531
has comment: http://stackoverflow.com/comment/31866947
downvote count: 0
has comment: http://stackoverflow.com/comment/31867263
has answer: http://stackoverflow.com/a/21169769

http://stackoverflow.com/q/21131746
type: UnansweredQuestion
has body: For my web app I will loading a few details from the static DB tables which I plan to load when the container starts up on a HolderClass in a singleton bean. I will inject this class wherever I wish to use the static data. So basically I want to avoid loading the static data everytime from DB Current Implementation: public Class CountryHolder(){ List&lt;Country&gt; allCountries; public void init(){ this.countries = loadAllCountries; } public List&lt;Country&gt; loadAllCountries(){ // Perform DB select query using JDBC template } The above implementation works perfectly fine that is the init method loads the list of Countries for my bean. But now I have migrated to Hibernate and Country is a Persisten Entity. Hibernate: @Transactional(readOnly ="true") public List&lt;Country&gt; loadAllCountries(){ return countryDao.findAll(); } Please note I have skipped the code where I am injecting the dao and jdbc template. But the issue is that since I am calling this method in init method Hibernate complains about no session found to this although I have declared it as a readOnly transaction. Please advise
has answer: http://stackoverflow.com/a/21201338
type: Question
score: 0
answer count: 2
tagged with: spring
tagged with: jakarta-ee
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/21132386
has title: Spring + Hibernate populating holder class with values from DB

http://stackoverflow.com/comment/31812076
has text: In my case, I need separate regexp and simply "[ ]" doesn't work for me :/
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21117965

http://stackoverflow.com/a/21059964
type: Answer
score: 0
has body: Instead of arrays I would suggest to use List&lt;List&lt;Integer&gt;&gt; listC = new ArrayList&lt;List&lt;Integer&gt;&gt;(2); a much cleaner way of doing it. you can do all your operations like as follows. public static void main(String args[]) throws Exception { List&lt;Integer&gt; listA = Arrays.asList(0, 1, 2, 3); List&lt;Integer&gt; listB = Arrays.asList(0, 2, 4, 6, 8); List&lt;List&lt;Integer&gt;&gt; listC = new ArrayList&lt;List&lt;Integer&gt;&gt;(2); listC.add(listA); listC.add(listB); System.out.println("Complete List : " + listC); System.out.println("First Element :" + listC.get(0)); listC.remove(1);// removed 2nd element System.out.println("List After Removal : " + listC); } Output: Complete List : [[0, 1, 2, 3], [0, 2, 4, 6, 8]] First Element :[0, 1, 2, 3] List After Removal : [[0, 1, 2, 3]]
answers question: http://stackoverflow.com/q/21059675

http://stackoverflow.com/q/21152793
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/31838865
accepted answer: http://stackoverflow.com/a/21153034
answer count: 1
favorite count: 0
tagged with: serialization
has title: Java Serializable confuse
has comment: http://stackoverflow.com/comment/31838733
has answer: http://stackoverflow.com/a/21153034
type: AnsweredQuestion
has body: Recently, our project has to be redesign. But when I use JAVA's interface Serializable, I spend a lot time. Now, there are two program:A and B. A is offline, it function is transform JSON data to class C. Then Serialize C and store it in redis(now C is an object) B get the object, deserialize it , and transform it to C but it doesn't work. In log information, I found that, the C class in also A and B must have the same dir.That is to say, When I put C in A with the package dir "com.hello.src.a", in B with package dir "com.world.src.b" ,the B program will throw a ClassNotFoundException, because B's JVM find C with the dir "com.hello.src.a"! When I put C in A and B with the same package dir, it works. I want to know that if there's a better way to solve this problem. When I deserializable, I specific the package dir in B program to find the class C(like I tell B's JVM to find C with the package dir "com.world.src.b" )
score: 0
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31838891
has comment: http://stackoverflow.com/comment/31838700
downvote count: 1

http://stackoverflow.com/q/21157331
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21202398
favorite count: 0
tagged with: processbuilder
has title: Android InputStream from ProcessBuilder: readLine() returns null
tagged with: android
has body: I am building an Android app based on: https://code.google.com/p/ics-openvpn/ However, after signing and exporting, some of the original code is not working: private void startOpenVPNThreadArgs(String[] argv, Map&lt;String, String&gt; env) { LinkedList&lt;String&gt; argvlist = new LinkedList&lt;String&gt;(); Collections.addAll(argvlist, argv); ProcessBuilder pb = new ProcessBuilder(argvlist); // Hack O rama String lbpath = genLibraryPath(argv, pb); pb.environment().put("LD_LIBRARY_PATH", lbpath); // Add extra variables for(Entry&lt;String,String&gt; e:env.entrySet()){ pb.environment().put(e.getKey(), e.getValue()); } pb.redirectErrorStream(true); try { mProcess = pb.start(); // Close the output, since we don't need it mProcess.getOutputStream().close(); InputStream in = mProcess.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(in)); while(true) { String logline = br.readLine(); if(logline==null) { System.out.println("logline == null"); return; } etc. I keep getting getting: logline == null, and then the connection is broken. No exceptions The argument env is an Empty Map! This is all original code, and I really don't know where to look, since there is no comment or JavaDoc. Can anyone help me out with this? Thanks
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21202398
upvote count: 1
has comment: http://stackoverflow.com/comment/31928835
downvote count: 1
type: Question
tagged with: null

http://stackoverflow.com/a/21035100
answers question: http://stackoverflow.com/q/21035073
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: draw a=new draw(); isn't what you've added to the frame, you've used frame2.add(new draw()); instead. Try using frame2.add(a); I'd also consider using Key Bindings as it will allow you to overcome the focus issues related to KeyListener

http://stackoverflow.com/a/21036677
score: 0
type: AcceptedAnswer
has body: Yes you are correct. Use volatile or Atomic
accepted answer of: http://stackoverflow.com/q/21036420
answers question: http://stackoverflow.com/q/21036420
has comment: http://stackoverflow.com/comment/31625864
type: Answer
has comment: http://stackoverflow.com/comment/31625964
has comment: http://stackoverflow.com/comment/31626029
has comment: http://stackoverflow.com/comment/31626208

task
type: Tag
tags question: http://stackoverflow.com/q/21148575
tag name: task
tags question: http://stackoverflow.com/q/21083629
tags question: http://stackoverflow.com/q/21088815

http://stackoverflow.com/comment/31624953
type: Comment
type: QuestionComment
has text: Still waiting for the entire first stacktrace. The second one was caused by running with a security manager. It didn't just happen spontaneously.
comment on: http://stackoverflow.com/q/21035597
score: 0

http://stackoverflow.com/comment/31767814
type: QuestionComment
has text: Alright I'll try to do that in the future, I apologize for the incovenience.
comment on: http://stackoverflow.com/q/21078824
score: 0
type: Comment

http://stackoverflow.com/comment/31795708
has text: @Aci89 seems like you're right. I got a `FileNotFoundException`. I don't have much experience with audio. I was just testing out your method. I'm not sure what throws the `IllegalArgumentException`. The only other exception I was able to produce was an `UnsupportedAudioFileType` exception
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21128936

http://stackoverflow.com/comment/32031478
score: 0
has text: Common Annotation, and I want to change basically their content and their position
comment on: http://stackoverflow.com/q/21056928
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31600986
type: Comment
has text: Are you sure your resources directory is being included in the jar? If so, where?
comment on: http://stackoverflow.com/q/21023065
score: 0
type: QuestionComment

http://stackoverflow.com/a/21123967
answers question: http://stackoverflow.com/q/21121213
has body: I think this regex is what you want: (?&lt;!')[...](?!') Replace the ... with the characters you want to match, e.g.: (?&lt;!')[(),;{}.&lt;&gt;+\\-:](?!') You can find an explanation and demonstration here: http://regex101.com/r/qE6nV1.
score: 0
type: Answer

http://stackoverflow.com/comment/31616690
has text: @ElliotFrisch There isn't a word about port sharing in the ServerSocket documentation. It is a Windows feature.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21029708
score: 0

http://stackoverflow.com/comment/31795734
has text: @user2871898 no... if we do that only the first button would work.
comment on: http://stackoverflow.com/a/21128553
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/21166143
type: Answer
answers question: http://stackoverflow.com/q/21165746
score: 0
has body: Let me do a wild guess. Because when you restart, you set it to false again.... It is in onCreate function.

http://stackoverflow.com/q/21177218
tagged with: jakarta-ee
has body: I've already solved this but i'm still curious as to why gradle behaves this way. In my gradle project i have 2 gradle projects, one named app that is configured with the ear plugin and one named core that is deployed in the lib folder of the ear I was getting the following error when trying to build my gradle project: FAILURE: Build failed with an exception. * What went wrong: Could not resolve all dependencies for configuration ':app:earlib'. &gt; Could not find org.slf4j:slf4j-api:1.7.5. Required by: saturn:app:unspecified &gt; saturn:core:unspecified &gt; Could not find commons-io:commons-io:2.4. Required by: saturn:app:unspecified &gt; saturn:core:unspecified &gt; Could not find org.slf4j:slf4j-log4j12:1.7.5. Required by: saturn:app:unspecified &gt; saturn:core:unspecified &gt; Could not find log4j:log4j:1.2.17. Required by: saturn:app:unspecified &gt; saturn:core:unspecified My app build.gradle file is: apply plugin: 'ear' dependencies { earlib project(":core") } and my core build.gradle is: apply plugin: 'java' repositories { mavenCentral() } dependencies { compile 'org.slf4j:slf4j-api:1.7.5' runtime 'org.slf4j:slf4j-log4j12:1.7.5' runtime 'log4j:log4j:1.2.17' testCompile 'junit:junit:4.11' } Temporary Solution: I was able to resolve the issue by adding the mavenCentral repository to my app build.gradle like so: apply plugin: 'ear' repositories { mavenCentral() } dependencies { earlib project(':core') } HOWEVER I'm still curious as to why the depending project needs to know what repository the core project resolves it's dependencies from. this document on dependency management doesn't seem to have a very good explanation.
tagged with: groovy
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21177408
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/21177408
upvote count: 2
tagged with: java
has title: could not resolve all dependencies for configuration X could not find Z required by B > A
tagged with: gradle
type: Question

dicom
tag name: dicom
tags question: http://stackoverflow.com/q/21087778
type: Tag

http://stackoverflow.com/comment/31697626
score: 0
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve). Obviously hard code a short Bengali phrase in Unicode for us to test with.
comment on: http://stackoverflow.com/q/21075481
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21128440
tagged with: file
accepted answer: http://stackoverflow.com/a/21128507
upvote count: 1
downvote count: 1
tagged with: jfilechooser
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31794218
type: Question
score: 0
has body: how to read file that assigned to reference variable selected using JFileChooser package AnimeAid; import java.io.*; import java.util.*; import javax.swing.*; public class ReadFile { private File ourFile; Scanner sc; public ReadFile() { this.sc = new Scanner(new File(ourFile); } }
answer count: 2
favorite count: 0
possible better answer: http://stackoverflow.com/a/21128503
has answer: http://stackoverflow.com/a/21128503
has comment: http://stackoverflow.com/comment/31794296
has title: is there any way to use Variable instead path in java Scanner
has answer: http://stackoverflow.com/a/21128507
tagged with: java.util.scanner

compiler-errors
tags question: http://stackoverflow.com/q/21062587
tags question: http://stackoverflow.com/q/21162576
tag name: compiler-errors
tags question: http://stackoverflow.com/q/21146727
tags question: http://stackoverflow.com/q/21024996
type: Tag
tags question: http://stackoverflow.com/q/21098754
tags question: http://stackoverflow.com/q/21022390
tags question: http://stackoverflow.com/q/21160203
tags question: http://stackoverflow.com/q/21151184
tags question: http://stackoverflow.com/q/21027537
tags question: http://stackoverflow.com/q/21041142
tags question: http://stackoverflow.com/q/21046139
tags question: http://stackoverflow.com/q/21102315
tags question: http://stackoverflow.com/q/21117967
tags question: http://stackoverflow.com/q/21059972
tags question: http://stackoverflow.com/q/21018770
tags question: http://stackoverflow.com/q/21096079
tags question: http://stackoverflow.com/q/21182942

http://stackoverflow.com/comment/31879654
type: AnswerComment
type: Comment
has text: Not java problem at all ... the problem is to find a decent Library for JSON since its such a mess to parse the data into the massive number of fields i have to create to work properly ...
comment on: http://stackoverflow.com/a/21175394
score: 0

fonts
tags question: http://stackoverflow.com/q/21182492
tags question: http://stackoverflow.com/q/21091711
tags question: http://stackoverflow.com/q/21071732
tags question: http://stackoverflow.com/q/21063594
tags question: http://stackoverflow.com/q/21046164
tags question: http://stackoverflow.com/q/21039397
type: Tag
tags question: http://stackoverflow.com/q/21176008
tags question: http://stackoverflow.com/q/21081586
tags question: http://stackoverflow.com/q/21040117
tags question: http://stackoverflow.com/q/21044484
tag name: fonts

http://stackoverflow.com/comment/31933518
score: 0
comment on: http://stackoverflow.com/a/21117392
type: Comment
has text: That solves one half of the problem, but how do I draw a designated section of the newly rotated image? The animations I'm using are long spritesheets laid out in frames. I need to know how to both rotate the image (the spritesheet) and then only draw the section of it that is the frame I want.
type: AnswerComment

http://stackoverflow.com/q/21089558
upvote count: 5
tagged with: java
type: Question
score: 5
downvote count: 0
tagged with: jsp
linked to: http://stackoverflow.com/q/18330001
tagged with: tomcat
has comment: http://stackoverflow.com/comment/31725764
has title: Super dev mode + JSP page in Tomcat
answer count: 1
has body: I have a .jsp page (the main page of my gwt module) and I'm trying to enable super dev mode as I'm migrating to gwt 2.6. Following the explanations I found out on internet, once I launch the codeserver and add the bookmarklets, next I gotta open the page in my browser, so I call the jsp page from my tomcat server. The problem is that nothing happens, and looking at the chrome console it seems it is unable to find my module/module.nocache.js Any idea? EDIT : added .gwt.xml &lt;inherits name="XXX.frontend.gwt.Framework"/&gt; &lt;inherits name="XXX.frontend.gwt.sample.frontend.module.blanc.Module"/&gt; &lt;!-- Specify the paths for translatable code --&gt; &lt;source path='client'/&gt; &lt;source path='shared'/&gt; &lt;!-- Specify the application entry point class --&gt; &lt;entry-point class='XXX.frontend.gwt.client.FrameworkEntryPoint'/&gt; &lt;!-- Compile for specific browser --&gt; &lt;!-- &lt;set-property name="user.agent" value="ie8,ie9,ie10,gecko1_8,safari" /--&gt; &lt;!-- Compile for specific language --&gt; &lt;extend-property name="locale" values="fr" /&gt; &lt;set-property-fallback name="locale" value="fr" /&gt; &lt;set-configuration-property name='xsiframe.failIfScriptTag' value='FALSE' /&gt; &lt;set-configuration-property name="devModeUrlWhitelistRegexp" value="http://(localhost|127\.0\.0\.1)(:\d+)?/.*" /&gt; &lt;add-linker name="xsiframe" /&gt; &lt;set-property name="compiler.useSourceMaps" value="true" /&gt;
favorite count: 0
has answer: http://stackoverflow.com/a/21115447
tagged with: gwt-super-dev-mode
has comment: http://stackoverflow.com/comment/31722799
type: UnansweredQuestion
tagged with: gwt

http://stackoverflow.com/comment/31726116
score: 0
type: Comment
type: QuestionComment
has text: you can use this link [here][1] [1]: http://stackoverflow.com/questions/10087972/receiving-mms-in-android-application/10088262#10088262 maybe it helps you...:)
comment on: http://stackoverflow.com/q/21091611

http://stackoverflow.com/q/21156704
tagged with: shader
accepted answer: http://stackoverflow.com/a/21156941
type: AnsweredQuestion
tagged with: java
type: Question
has title: OpenGL ES 2.0: Vertex Shader compile status result is 0 with no Shader Log Info
answer count: 1
has answer: http://stackoverflow.com/a/21156941
tagged with: compilation
score: 0
has body: Current situation doesn't allow me to use a computer. And it will be like this for a while. I use Android IDE (AIDE) to program on my phone. In my code, I used glGetShaderiv() to get the compile status, and noticed the status value is 0. However, there is no indication to suggest the vertex shader code contains an error or something is wrong with loading the GLSL code from a text file. Below are the codes. Note that I jumbled all the codes together so that the execution of the code is as iterative as possible. Meaning the code doesn't jump around a lot using function calls, for easier debugging. RenderView class: package p.e; import android.opengl.GLSurfaceView; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10; import android.content.Context; import static android.opengl.GLES20.*; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.opengl.GLES20; import android.opengl.GLUtils; import android.opengl.Matrix; public class RenderView extends GLSurfaceView implements GLSurfaceView.Renderer{ private Context context; private Table table; private int texture; private final float[] projectionMatrix=new float[16]; private final float[] modelMatrix=new float[16]; private Shader shader; public RenderView(Context context){ super(context); this.context=context; } @Override public void onSurfaceCreated(GL10 p1, EGLConfig p2) { // TODO: Implement this method glClearColor(1f,0f,1f,1f); this.shader=new Shader(context); this.table=new Table(); final int[] textureID=new int[1]; glGenTextures(1,textureID,0); texture=textureID[0]; BitmapFactory.Options options=new BitmapFactory.Options(); options.inScaled=false; Bitmap bitmap=BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_launcher, options); glBindTexture(GL_TEXTURE_2D, texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_LINEAR); GLUtils.texImag…
tagged with: android
tagged with: opengl-es

http://stackoverflow.com/comment/55125436
comment on: http://stackoverflow.com/q/21047414
score: 0
type: Comment
type: QuestionComment
has text: If you haven't already solved that, please see: http://stackoverflow.com/a/31436459/4261176

http://stackoverflow.com/q/21021206
has answer: http://stackoverflow.com/a/21347730
accepted answer: http://stackoverflow.com/a/21347730
has answer: http://stackoverflow.com/a/21021778
linked to: http://stackoverflow.com/q/21056559
linked to: http://stackoverflow.com/q/3291712
has answer: http://stackoverflow.com/a/21033829
has comment: http://stackoverflow.com/comment/31597217
type: AnsweredQuestion
has title: How to get notified once the browser window closed?
has comment: http://stackoverflow.com/comment/31597065
linked to: http://stackoverflow.com/q/15694567
possible better answer: http://stackoverflow.com/a/21021778
type: Question
tagged with: gwt
tagged with: java
tagged with: javascript
has body: I am opening a new window in a gwt widget with the help of window.open(url, "", ""); Once new window has opened i am doing some editing operation. I want to make some code to be executed in the gwt widget once the user closes the newly opened window. Here(in gwt widget) how can know that the window is closed or not? I think we have some window events, but i do not know how to use them.
linked to: http://stackoverflow.com/q/18381039
score: 0
answer count: 3

http://stackoverflow.com/comment/31806890
comment on: http://stackoverflow.com/a/21133092
has text: Good idea, but unfortunatelly no: 1) I can not replace security manager; 2) `SecurityUtils.getSecurityManager()` returns proxy object which hasn't implementation of methods `getSessionDAO()`. it is actually `WebSecurityManager`; 3) yes, I have a deal with `WebObject`.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31827929
score: 0
comment on: http://stackoverflow.com/q/21146956
type: Comment
type: QuestionComment
has text: ouch. At least learn code formatting. That much is universal.

http://stackoverflow.com/a/21053526
answers question: http://stackoverflow.com/q/21053443
downvote count: 0
has body: Per the the Statement JavaDoc, you can use "RETURN_GENERATED_KEYS" like so - stmt.execute("insert into employee(empName) values('something')", Statement.RETURN_GENERATED_KEYS); ResultSet rs = stmt.getGeneratedKeys(); if (rs.next()) { return rs.getLong(1); // for example. }
upvote count: 2
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/21053443
score: 2

http://stackoverflow.com/comment/31889596
type: QuestionComment
comment on: http://stackoverflow.com/q/21181366
has text: Redundant id's really shouldn't be a concern of yours in a Java application; If your memory budget is that tight, you are probably barking up the wrong tree. @everyoneElse: To clarify, I believe he means that the Product class has an 'id' field, which he'd have to duplicate / auto-box in order to define the Keys in a HashMap
score: 0
type: Comment

http://stackoverflow.com/q/21059430
has body: So I just finished this project I was doing for fun. I have a basic understanding of GUI, but not all to much and haven't actually put it into one of my projects. I am not sure how I would implement this all into my code but can people give me suggestions or at least point me in the right direction? The Game is HangMan. Code: public class HangMan { public static void main(String[] args) { Scanner sc = new Scanner (System.in); String mysteryGuess = "hello"; String userGuess = ""; int wrongGuesses = 0; boolean[] guessed = new boolean[mysteryGuess.length()]; System.out.println("Hello and welcome to Hang Man!"); loop: for(;;){ String[] wordAsArray = convertToStringArray(mysteryGuess); for (int i = 0; i&lt;wordAsArray.length;i++) if(wordAsArray[i].equals(userGuess)) guessed[i]=true; System.out.println("Word so far:" + visibleWord(wordAsArray,guessed)); System.out.println("What is your guess?"); userGuess = sc.next(); boolean guessResult = guess(userGuess,wordAsArray,guessed); if (guessResult==(true)) System.out.println("Correct"); else{ System.out.println("Incorrect"); wrongGuesses++; } if (didWin(guessed)==true) break loop; } System.out.println("Good Job! The word was " + mysteryGuess); System.out.println("You only got " + wrongGuesses + " wrong!"); } //This method creates an array version of the parameter word //For example, if word contained the data "hello", then this method //would return {"h", "e", "l", "l", "o"} //Parameters: word - a single word //Returns: an array containing each letter in word public static String[] convertToStringArray(String word) { String [] pWord = new String [word.length()]; for (int i = 0; i&lt;pWord.length; i++){ pWord[i] = word.substring(i,i+1); } return pWord; } //This method determines whether the player has won the game of HangMan //Parameters: guessed - array of boolean values //Returns: true - if every value in guessed is true // false - if at least one value in guessed is false public static boolean didWin(boolean[] guessed) { boo…
has comment: http://stackoverflow.com/comment/31666803
type: UnansweredQuestion
type: Question
tagged with: java
has title: How can I implement GUI into my code?
score: 0
has comment: http://stackoverflow.com/comment/31666816
tagged with: user-interface
answer count: 1
has answer: http://stackoverflow.com/a/21059482

http://stackoverflow.com/comment/31735576
has text: I got a very simple app - https://gist.github.com/ibuziuk/8351313. After running it and using "sudo pldd [pid] | grep gtk" in the terminal, I got an output with gtk2 libs. What I want to check is, whether javaFx compatible with gtk3?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21096044
type: Comment

http://stackoverflow.com/q/21105449
has answer: http://stackoverflow.com/a/21105792
has answer: http://stackoverflow.com/a/21105635
type: Question
tagged with: exit
has body: It seems this is one way to have a return status code from your main. but I am wondering where does this int go? I tried it on eclipse, But I do not see it on console. how do I get the status code public static void main(String[] args){ int status = 123; System.exit(status); }
score: 1
has comment: http://stackoverflow.com/comment/31752575
tagged with: java
tagged with: system.exit
has answer: http://stackoverflow.com/a/21105512
upvote count: 1
has answer: http://stackoverflow.com/a/21105479
tagged with: program-entry-point
has title: where does the system.exit() goes to in Java?
has answer: http://stackoverflow.com/a/21105545
accepted answer: http://stackoverflow.com/a/21105545
downvote count: 0
favorite count: 0
answer count: 5
linked to: http://stackoverflow.com/q/540396
possible better answer: http://stackoverflow.com/a/21105512
type: AnsweredQuestion

http://stackoverflow.com/comment/31867104
type: QuestionComment
has text: `Arrays.sort(int[] a)` for the whole list, then `Arrays.sort(T[] a, int fromIndex, int toIndex, Comparator<? super T> c)` for the second half. Sorts everything in-place, no splitting & merging needed. Consult the [`java.util.Arrays`](http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html) docs for sorting methods.
score: 0
comment on: http://stackoverflow.com/q/21168716
type: Comment

http://stackoverflow.com/a/21058831
type: Answer
has comment: http://stackoverflow.com/comment/31667697
has comment: http://stackoverflow.com/comment/32815550
has body: Generally speaking, there is no easy (or right) answer to this question. Does overriding getPreferredSize break Liskov Substitution Principle? Yes (based on the available documentation). But doesn't most Object extension? What would be the point of changing the behaviour of a method if it had to adhere strictly to the expectations of the original implementation (yes, there are good examples when you should do this, like hashcode and equals and others where the line is grayed)? In this case, the problem seems to extend from the inappropriate use of setXxxSize and that fact that these methods are actually public. Why are they public? I have no idea, as they are the cause of more problems than just about any other part of the API (including KeyListener). Overriding getPreferredSize is preferred as the change is carried with the object, unlike calling setPreferredSize from outside the object ownership/context Because getXxxSize is suppose to provide sizing hints to the layout manager, there doesn't actually seem to be any reasonably good reason to actually have the setXxxSize methods public as, IMHO, developers shouldn't be messing with them - a component is required to provided the best estimation of the size it needs based on it's own internal requirements. The reason for overriding getXxxSize in this manner would also be to prevent other people from changing the value you've specified, which could be made for particular reasons. On one hand, as you've suggested, we have an expectation of the API, but on the other hand, there are times when we want to control the size and lots of times when you don't want the user to change the value. My personal feeling is to ignore setXxxSize as much as possible (or treat it as protected). One of the reasons for overriding getXxxSize is stop people from changing the size, but equally, you could override setXxxSize and throw a not supported exception. If you were to document the decisions for ignoring setXxxSize would that constitute…
has comment: http://stackoverflow.com/comment/31670827
score: 5
has comment: http://stackoverflow.com/comment/31681247
answers question: http://stackoverflow.com/q/21052894
upvote count: 5
downvote count: 0

http://stackoverflow.com/a/21142843
type: Answer
has body: Be careful how you're using the term "tooltip". I don't think what you're talking about is actually a tooltip, just a message displayed on the screen. If you want to display text in libGDX, you should do the work and use a real font. But for quick-and-dirty rendering, you can use the BitmapFont class. Something like this: BitmapFont font = new BitmapFont(); font.setColor(Color.WHITE); font.setScale(2f); font.draw(batch, "FPS: " + Gdx.graphics.getFramesPerSecond(), 25, 25);
score: 2
has comment: http://stackoverflow.com/comment/31842622
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21142434
type: AcceptedAnswer
downvote count: 1
answers question: http://stackoverflow.com/q/21142434

http://stackoverflow.com/comment/31750195
type: Comment
type: QuestionComment
has text: @NedNowotny, that's the class itself. I don't need that, I need to know which classes use `Inet4Address` class.
comment on: http://stackoverflow.com/q/21085423
score: 0

http://stackoverflow.com/a/21146292
downvote count: 0
answers question: http://stackoverflow.com/q/21145549
score: 1
has body: If you don't want to change the entities then something is going to have to poll them. Either your JMXAgent or the JMX client is going to have to request the beans every so often. There is no way for you to get around this performance hit although since you are calling a bunch of gets, I don't think it's going to be very expensive. Certainly your JMXAgent would be better than the JMX client polling all of the time. But if the client is polling all of the beans anyway then the cost may be exactly the same. You would not need to do the polling if the objects could call the agent to say that they have been changed or if they supported some sort of isDirty() method. In our systems, we have a metrics system that the various components used. Each of the classes incremented their own metric and it was the metrics that were wired into a persister. You could request the metric values using JMX or persist them to disk or the wire. By using a Metric type, then there was separation between the entity that was doing the counting and the entities that needed access to all of the metric values. By going to a registered Metric object type model, your GUI could then query the MetricRegistrar for all of the metrics and display them via JMX, HTML, or whatever. So your entities would just do metric.increment() or metric.set(...) and the GUI would query the metric whenever it needed the value. Hope something here helps.
accepted answer of: http://stackoverflow.com/q/21145549
has comment: http://stackoverflow.com/comment/31826737
type: AcceptedAnswer
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/31826928
has comment: http://stackoverflow.com/comment/31826617

http://stackoverflow.com/a/21107236
upvote count: 1
has comment: http://stackoverflow.com/comment/31755593
has comment: http://stackoverflow.com/comment/31755412
type: Answer
has comment: http://stackoverflow.com/comment/31755404
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21107202
has body: In this String[] arrayInString; double[] arrayInDouble; you are just declaring them, before you use them, you also need to initialize: String[] arrayInString = new String[length1]; double[] arrayInDouble = new double[length2]; where length is the length of the array. PS: There are other ways to initialize them, for example: double[] arrayInDouble = {1.1, 2.2}; // The length of the array will be the number of elements in brackets
has comment: http://stackoverflow.com/comment/31755389

http://stackoverflow.com/a/21115852
has comment: http://stackoverflow.com/comment/31770633
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/21115685
answers question: http://stackoverflow.com/q/21115685
has body: A simple way you can do this would be to make use of the valueOf method of the Enum class. Something like this: String name; ... name = scan.next(); UserClass userClass = UserClass.valueOf(name); In this case, UserClass is the name of your enum, which might look something like this: public enum UserClass{ KNIGHT, MAGE, DRUID, NINJA // other classes as needed } Note that the scanner line assumes that the user typed in the name correctly. If they did not, you get an IllegalArgumentException, which you can catch with a try...catch block. Side note: I'm sure you've seen the messages already, but remember that the java standard is for variable names to begin with a lowercase letter. Otherwise it is hard to determine whether the entity in question is a class (which start with uppercase) or a poorly named variable.
has comment: http://stackoverflow.com/comment/31770484
upvote count: 1
has comment: http://stackoverflow.com/comment/31770709
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/31770632

http://stackoverflow.com/a/21127120
has comment: http://stackoverflow.com/comment/31876977
answers question: http://stackoverflow.com/q/21126905
has comment: http://stackoverflow.com/comment/31798121
has comment: http://stackoverflow.com/comment/31791886
upvote count: 2
has comment: http://stackoverflow.com/comment/31791932
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/31875692
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31818651
accepted answer of: http://stackoverflow.com/q/21126905
downvote count: 0
has comment: http://stackoverflow.com/comment/35759663
has body: You just want to make the Task wait until the first update to the Map has happened before proceeding? public class ClientData { private static final AtomicReference&lt;Map&lt;String, Map&lt;Integer, String&gt;&gt;&gt; primaryMapping = new AtomicReference&lt;&gt;(); private static final CountDownLatch hasBeenInitialized = new CountDownLatch(1); public static Map&lt;String, Map&lt;Integer, String&gt;&gt; getPrimaryMapping() { try { hasBeenInitialized.await(); } catch (InterruptedException e) { throw new IllegalStateException(e); } return primaryMapping.get(); } public static void setPrimaryMapping(Map&lt;String, Map&lt;Integer, String&gt;&gt; map) { primaryMapping.set(map); hasBeenInitialized.countDown(); } } A simpler and more efficient way that doesn't cause synchronization checks and make you deal with stupid InterruptedException being a Checked Exception might be to simply load initial values into the Map before firing up the multi-threaded engines.....

http://stackoverflow.com/comment/31850591
has text: Having done a bit more testing, it appears that the error only occurs if the many-many set contains more than one row. Any ideas?
score: 0
comment on: http://stackoverflow.com/q/21142604
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31880042
type: QuestionComment
comment on: http://stackoverflow.com/q/21175448
has text: Try using `getClass().getResource("/rpg/SpriteSheet.png")` and make sure you are calling `getParameters` so that that resources are actually loaded.
score: 0
type: Comment

http://stackoverflow.com/q/21027048
score: 0
has comment: http://stackoverflow.com/comment/31609032
answer count: 2
has comment: http://stackoverflow.com/comment/31609172
has answer: http://stackoverflow.com/a/22835705
possible better answer: http://stackoverflow.com/a/22835705
has body: Background: I'm using Selenium WebDriver in Java and using Google Chrome as my browser. So I'm not too sure of this one. I know how to figure out if specific text is present on the page, however what if there were more than one instance of the text that I want to find? For instance, if the word "Hello" is on the top of the page, and the word "Hello" also appears upon expanding a element, how would I verify that the second "Hello" is there without completely specifying its xpath? For example: WebDriverWait wait = new WebDriverWait(driver, WAIT_TIME); foundElement = wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[contains(text(),'" + expectedText + "')]"))); ...this will obtain the FIRST instance of the text I'm looking for...but what if I'm looking for another specific instance (3rd, 4th)? Trying to AVOID using something like this: WebDriverWait wait = new WebDriverWait(driver, WAIT_TIME); foundElement = wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("(//*[contains(text(),'" + expectedText + "')])[2]"))); Preferably I would like to try to specify the element it's under. Any ideas folks? I'm not MAJORLY familiar with xpath...but suppose I wanted to do something LIKE this (I already know this is invalid/doesn't work): WebElement foundElement = wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id=\"elementID\"]/[contains(text(),'" + text + "')]"))); I hope that makes sense! Please let me know if any clarification is needed. Small Update: I tried this to no avail: WebElement foundElement = wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id=\"elementID\"]/*/[contains(text(),'" + text + "')]"))); Here is the path that contains the text I'm trying to find: //*[@id="Highchart_chart_property_hot_alerts"]/div[1]/div[1] It is the SECOND occurrence of the text on the page. A possibly acceptable way of finding if it's there is checking that BOTH of the texts are present as opposed to JUST the second o…
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/31608482
has comment: http://stackoverflow.com/comment/31608994
tagged with: selenium-webdriver
tagged with: xpath
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21027961
accepted answer: http://stackoverflow.com/a/21027961
has comment: http://stackoverflow.com/comment/31609697
tagged with: java
tagged with: selenium
has comment: http://stackoverflow.com/comment/31609574
type: Question
has title: How can I verify presence of text under a specific tag using Selenium WebDriver (java) and Chrome?

http://stackoverflow.com/a/21113600
answers question: http://stackoverflow.com/q/21113404
has comment: http://stackoverflow.com/comment/31766296
score: -1
upvote count: 0
type: Answer
has body: If you tried to put byte-arrays into the ArrayList arrays, then you should correct its declaration to: ArrayList&lt;Byte[]&gt; arrays = new ArrayList&lt;Byte[]&gt;(); and fill it with your data.
downvote count: 1

http://stackoverflow.com/a/21176112
downvote count: 0
type: Answer
has body: You can get the necessary code from the dead project Harmony, then change the package name and refractor the project you are porting. This solution assumes you are porting and recompiling the project that requires the awt classes.
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21176008

http://stackoverflow.com/comment/31885292
comment on: http://stackoverflow.com/q/21168247
score: 0
type: Comment
type: QuestionComment
has text: Can you use the information gained from Java Sound in the JMF app.?

http://stackoverflow.com/comment/31612657
has text: @EricB. I'm not quite sure I understand you, but you should always be able to configure `<bean name="handlerMapping" class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping">...`
comment on: http://stackoverflow.com/a/21028103
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31892482
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21179698
type: Comment
has text: ya we can do all aggregations using hive. but to acheive all these things in single hive query results in complexity of query as well as performance. In such case (to achive all aggregations in one with good latency) use mapreduce-refer mapreduce design patterns > summerization patterns.

http://stackoverflow.com/comment/31851606
type: Comment
has text: I've added some more mocks to the answer, this time it should mock the SOAPEnvelope, and the SOAPPart class that is used to get the envelope from the SOAPMessage.
type: AnswerComment
comment on: http://stackoverflow.com/a/21158218
score: 0

http://stackoverflow.com/comment/31719734
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21087709
score: 3
has text: @Shudmeyer This is not an example of how to configure jetty (which normally serves the ActiveMQ web console) but how to set up a reverse proxy with apache httpd which listens on a server which is potentially reachable via a public IP and is configured to forward the requests to your web console. The concrete example uses a private IP for the reverse proxy and assumes that the reverse proxy runs on the same machine as the web console.

http://stackoverflow.com/a/21100788
downvote count: 1
has comment: http://stackoverflow.com/comment/31746682
answers question: http://stackoverflow.com/q/21100666
score: -1
has body: You need to make your JXTreeTable a public variable inside the class that it's in (let's say AwesomeDialog). Then you could access it through the AwesomeDialog's instance with the dot notation e.g. dialog.table Probably check out: http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html
upvote count: 0
type: Answer

http://stackoverflow.com/a/21020528
has body: you can do something like below class MyWebElement implements WebElement { // override functions to define your behaviour @Override public void clear() { // TODO Auto-generated method stub } @Override public void click() { // TODO Auto-generated method stub } @Override public WebElement findElement(By arg0) { // TODO Auto-generated method stub return null; } @Override public List&lt;WebElement&gt; findElements(By arg0) { // TODO Auto-generated method stub return null; } /// MANY MORE ..... } Same for the webdriver
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21020412
accepted answer of: http://stackoverflow.com/q/21020412
has comment: http://stackoverflow.com/comment/31597880
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31601974
type: Answer

http://stackoverflow.com/a/21112668
score: 1
downvote count: 1
accepted answer of: http://stackoverflow.com/q/21112375
answers question: http://stackoverflow.com/q/21112375
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/121120210
type: Answer
has comment: http://stackoverflow.com/comment/38145100
upvote count: 2
has body: If the screen is off (i.e. in standby), the hardware will not register any touch events so what you have asked for (detecting screen gestures) is not possible. When the device goes to standby/asleep, the touch screen is effectively shutdown to conserve battery power. The best you can do is detect an action that does wake the screen, e.g. one of the hardware buttons. Also, if you wanted to detect touch events for your app, the device would need to be on with your activity in the foreground. So again, screen gestures are a non-starter for an SOS type app.
has comment: http://stackoverflow.com/comment/130601216

http://stackoverflow.com/a/21074536
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31698748
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21064509
has body: Reading from sourceforge jfftpack repository You initialize a new fft object via fft = new ComplexDoubleFFT(N); Then you use the forward transform of the fft object with Complex1D X; X.x=new double[N]; X.y=new double[N]; for(k=0;k&lt;N;k++) X.x[k]=x[k]; fft.ft(X); and can then access the absolute values as x=X.x[k]; y=X.y[k]; a=Math.sqrt(x*x+y*y); Optionally divide by N to normalize the FFT. Add appropriate variable declarations. The usual conventions apply, if the signal is sampled with sampling frequency fs, the entry X.(xy)[k] represents the frequency component at k*fs/N for k=N/2 to N-1. You may want to look for a different, better supported FFT implementation that is done in pure java, it is not that complicated to implement the FFT for dyadic lengths. The only complication comes when implementing the transformation in place to get the last speedup factor.
accepted answer of: http://stackoverflow.com/q/21064509
type: Answer
has comment: http://stackoverflow.com/comment/31698194
downvote count: 0

http://stackoverflow.com/comment/31623095
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21034975
has text: There is only one array (nums[]), then this method doesn't use parallel arrays. Here you have an example of parallel arrays: http://mathbits.com/MathBits/Java/arrays/ParallelArrays.htm
type: AnswerComment

http://stackoverflow.com/comment/31757411
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21108509
has text: Write some code, try it out, see what happens, and post any questions you have regarding the results!
score: 4

http://stackoverflow.com/comment/54475364
type: QuestionComment
has text: By the way, this format is known by most people simply as [24-hour clock](https://en.wikipedia.org/wiki/24-hour_clock). Only in the United States and a few other places is the term "military time" used.
comment on: http://stackoverflow.com/q/21153746
score: 0
type: Comment

http://stackoverflow.com/a/25583620
upvote count: 33
has comment: http://stackoverflow.com/comment/41561224
score: 32
type: Answer
answers question: http://stackoverflow.com/q/21070268
has body: Delete all android SDKs from Intellij and add them again. To do this open project structure, in SDK pane, delete all android SDK, click OK. open project structure and add them again.
downvote count: 1

http://stackoverflow.com/comment/31697259
has text: Can you post the whole stacktrace. At the moment the ConcurrentModEx is thrown, you know which line of code it was done on and then you can see which of your java structures is used there.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21075912

atomic
type: Tag
tag name: atomic
tags question: http://stackoverflow.com/q/21084658

http://stackoverflow.com/comment/31647616
has text: @MarkoTopolnik agreed, what I was trying to highlight was that there's trade-offs and that object and heap size should be considered together :-)
comment on: http://stackoverflow.com/a/21043753
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/21069648
has body: I want to call js function by execute this string in vaadin code: String js = "function returnURL{" + "return(window.location.href.replace(/(\\d+)$/, function(str, p1, p2) {" + "return((Number(p1) + 1) + p2);" + "}));" + "}"; how to exacly call this function by this way : Page.getCurrent().getJavaScript().execute(javascript function);
type: Question
tagged with: javascript
tagged with: vaadin
answer count: 1
downvote count: 0
tagged with: url
favorite count: 0
has answer: http://stackoverflow.com/a/21069798
type: UnansweredQuestion
score: 1
tagged with: java
has title: Vaadin and js function
upvote count: 1

http://stackoverflow.com/comment/31778587
has text: No mySQL won't does'nt allow you to create a table called 'order' - it is a preserved word.
comment on: http://stackoverflow.com/a/21119370
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31667449
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21059764
has text: @Basile: If he wants to write a 'generic' java program, reading `/proc/mounts` will be much easier than calling `df` or `mount` from java - seems his program is intended to 'replace' df. Of course, he'll run into trouble with `/proc/mounts` if he wants to use his program on any other kind of unix-ish system.
type: Comment

http://stackoverflow.com/comment/31827949
comment on: http://stackoverflow.com/a/21147006
has text: Thanks mate can't believe I didn't see that your a life saver!
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21176508
downvote count: 0
favorite count: 0
tagged with: serialization
type: Question
score: 3
has answer: http://stackoverflow.com/a/27909033
upvote count: 3
answer count: 2
has title: why serialization proxy pattern is not compatible with classes whose object graph contains circularities
tagged with: java
has answer: http://stackoverflow.com/a/70508463
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31883119
has body: I read 《Effective Java》and I was told that Serialization Proxy Pattern is not compatible with classes whose object graph contains circularities. Actually I don't get it. So I wrote a sample to validate it. As you see: public class A implements Serializable{ private B b; public A(){ } public A(B b){ this.b = b; } } public class B implements Serializable{ private A a; public B(){ } public B(A a){ this.a = a; } } public class C implements Serializable{ private A a; private B b; public C(A a, B b){ this.a = a; this.b = b; } private Object writeReplace(){ return new SerializationProxy(this); } private Object readObject(ObjectInputStream in) throws InvalidObjectException{ throw new InvalidObjectException("Proxy Required!"); } private static final class SerializationProxy implements Serializable{ private final A a; private final B b; SerializationProxy(C c){ this.a = c.a; this.b = c.b; } private Object readResolve(){ return new C(a, b); } } public static void main(String args[]) throws Exception{ C c = new C(new A(), new B()); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(baos); out.writeObject(c); ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray())); c = (C)in.readObject(); } } However, it executed very well. So, can anyone explain it further to me. Thanks a lot.
has comment: http://stackoverflow.com/comment/31881847

http://stackoverflow.com/q/21075501
has body: I' m kind of new to Java, and for homework I got this exercise: write a java program which can take a word from the keyboard and show it reversed ("hello" --&gt; "olleh") And this is how I wrote the program import java.util.*; import java.lang.*; public class Inverti { public static void main(String[] args) { System.out.println("digiti una parola o una frase, essa sara' stampata a video alla rovescia"); Scanner tastiera = new Scanner(System.in); String invertire = tastiera.nextLine(); for (int i = 0; i &lt; invertire.length();) { invertire.replace(invertire.charAt(i), invertire.charAt(invertire.length() - i)); i++; } System.out.print(invertire); } } (I'm Italian, so consider that "tastiera" means "keyboard" and "digiti una parola o una frase, essa sarà stampata a video alla rovescia" means "type a word, it will be shown reversed") The program gets compiled, but then, after typing the word: exception in thread main java.lang.stringindexoutofboundsexception: string index out of bounds: 6 (if string.length() is 6) or 5 (if string.length() = 5). I looked for answers to other similar questions before posting, but nothing helped me, sorry if the question' s format maybe isn't right.
has comment: http://stackoverflow.com/comment/31696436
has title: exception in thread main java.lang.StringIndexOutOfBoundsException
has comment: http://stackoverflow.com/comment/31696326
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21075635
has comment: http://stackoverflow.com/comment/31696474
tagged with: java
has comment: http://stackoverflow.com/comment/31696413
has comment: http://stackoverflow.com/comment/31696348
has answer: http://stackoverflow.com/a/21075605
type: Question
has comment: http://stackoverflow.com/comment/31696602
tagged with: indexoutofboundsexception
score: 0
answer count: 2

http://stackoverflow.com/q/21042240
tagged with: hql
type: Question
has comment: http://stackoverflow.com/comment/31644923
has answer: http://stackoverflow.com/a/21135411
has body: I have a small query something like this: String sqlStr = "select count(*) from MyTable n where primaryKey.userId = :userId and primaryKey.userType = :userType" String[] paramNames = {"userId", "userType" }; Object[] paramValues = {userId, userType}; List myObjects = (List) hibernateTemplate.findByNamedQueryAndNamedParam("objectsToDeleteForUser", paramNames, paramValues); and this works fine. I can make a call with a userid and usertype and get one or more matching records. What I'd like to do now that is have a list of userid's and usertype's and perform the call but not have to iterate over the list but make one call. So basically when userid(0) and usertype(0), userid(1) and usertype(1) ................... Is it possible to do this with one call in HQL. Something like the IN clause (X). Thanks
has title: Hibernate HQL list attributes?
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/21048473
tagged with: eclipse
has comment: http://stackoverflow.com/comment/31646187
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/31646561
has answer: http://stackoverflow.com/a/21048555
answer count: 2
has body: I was using eclipse for coding with C/C++, now my eclipse shows "C/C++ Eclipse platform". I want to configure it to support java, j2ee, but I'm at a loss on how to do. I'm using fedora. Related info about my eclipse is: Eclipse Platform Version: 3.7.1 Build id: R3_7_1 (c) Copyright Eclipse contributors and others 2000, 2011. All rights reserved. Visit http://www.eclipse.org/platform This product includes software developed by the Apache Software Foundation http://www.apache.org/
type: UnansweredQuestion
has title: how to configure eclipse to support java?
has comment: http://stackoverflow.com/comment/31646135
has comment: http://stackoverflow.com/comment/31646371
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/11709683
has answer: http://stackoverflow.com/a/21048695

http://stackoverflow.com/comment/31780921
has text: I think `DecimalFormat` would fit perfectly here :)
type: QuestionComment
comment on: http://stackoverflow.com/q/21121363
type: Comment
score: 1

http://stackoverflow.com/comment/31801475
type: Comment
type: QuestionComment
has text: Work from the constructor instead of the `main`
score: 0
comment on: http://stackoverflow.com/q/21132681

http://stackoverflow.com/q/21076774
answer count: 0
type: Question
has comment: http://stackoverflow.com/comment/31700090
score: 0
tagged with: sockets
has comment: http://stackoverflow.com/comment/31699744
tagged with: http
tagged with: java
has title: Get parameters of POST request
type: UnansweredQuestion
has body: I'm using this code to get the all the headers of a POST request, but I'm not able to get the parameters (the body of the message)... This is the code: BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); BufferedOutputStream out = new BufferedOutputStream(clientSocket.getOutputStream()); String host = null; String url = null; int i=0; String [] headers = new String [100]; String buffer; boolean post = false; while ((buffer = in.readLine()) != null) { headers[i]=buffer; i++; if(buffer.startsWith("GET")) { String[] splitText = buffer.split(" "); url = splitText[1]; post = false; } if(buffer.startsWith("POST")) { String[] splitText = buffer.split(" "); url = splitText[1]; post = true; } if(buffer.startsWith("Host:")) { String[] splitText = buffer.split(" "); host = splitText[1]; } if (buffer.isEmpty()) break; } This is a sample of what I'm getting when I perform a POST: POST http://www.elotrolado.net/ucp.php?mode=login HTTP/1.1 Host: www.elotrolado.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate Referer: http://www.elotrolado.net/ Cookie: phpbb3_eol_u=1; phpbb3_eol_k=; phpbb3_eol_sid=5166ddca49bbeb53d4a407fffecda64a; __utma=71363783.573183633.1389391106.1389491494.1389539722.9; __utmz=71363783.1389391106.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); cw=1; __utmb=71363783.2.10.1389539722; __utmc=71363783 Connection: keep-alive Content-Type: application/x-www-form-urlencoded Content-Length: 77 The last header I get is the Content-Length, but where's the body? Thanks.
tagged with: post

http://stackoverflow.com/comment/31717034
comment on: http://stackoverflow.com/q/21086165
score: 0
type: Comment
type: QuestionComment
has text: yes but how to track selected click items

http://stackoverflow.com/comment/31933062
type: Comment
comment on: http://stackoverflow.com/a/21157404
score: 0
type: AnswerComment
has text: Some suggests to use `ThumbnailResponse` class to deserialize `thumbnail` key in JSON. But then, how do I access ThumbnailResponse if using Map?

http://stackoverflow.com/a/21263543
score: 4
answers question: http://stackoverflow.com/q/21156992
accepted answer of: http://stackoverflow.com/q/21156992
upvote count: 4
has body: Answer from IntelliJ Support: Disable the option to clean output directories on rebuild in the compiler settings.
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/138858093

http://stackoverflow.com/a/21181065
has body: In a comment on RT-20784 Mac: Headless environment issue, MacOSX, which is related to the warning message you have pasted into your question, a developer notes: This indeed requires fixes in JDK. We don't have plans to back port these specific changes to 7uX releases because they are somewhat risky, and we don't want to destabilize the 7uX branch. As Steve suggests, please move to 8. AFAIK, apart from the fact that FX forces the AWT to run in the headless mode, nothing else changes or breaks because of this. So you may assume that the warning printed out to the console is the only side-effect of the missing changes. As long as you don't need to use AWT/Swing in your application, you should be safe. So perhaps your best course of action is to try Java 8 and see if you still have any issues. Update Based on Updated Question Regarding setRoot() What build of Java 8 are you getting FXML errors? According to this Bug Report, this particular "Root hasn't been set" FXML loading error may have been fixed in JavaFX 8b121. Potentially see the related StackOverflow question on setRoot errors. The FXML loading issue is unrelated to the original question of saving an image to the file system, usually unrelated questions are best asked as new questions.
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21178646
downvote count: 0

remote-debugging
tag name: remote-debugging
type: Tag
tags question: http://stackoverflow.com/q/21049455

http://stackoverflow.com/q/21028619
type: Question
tagged with: java-native-interface
tagged with: jar
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/31621701
tagged with: jvm
favorite count: 0
has body: I am trying to call 2 different methods at java from c++ by using JNI my c++ code is: int main() { JavaVM *jvm; JNIEnv *env; JavaVMInitArgs vm_args; JavaVMOption options; options.optionString="-Djava.class.path=try5.jar"; vm_args.version=JNI_VERSION_1_6; vm_args.nOptions=1; vm_args.options=&amp;options; vm_args.ignoreUnrecognized=0; int ret=JNI_CreateJavaVM(&amp;jvm,(void**)&amp;env,&amp;vm_args); jclass cls1=env-&gt;FindClass("hilla1"); jclass cls=reinterpret_cast&lt;jclass&gt;(env-&gt;NewGlobalRef(cls1)); jmethodID constract=env-&gt;GetMethodID(cls1,"&lt;init&gt;","()V"); jobject localobj=env-&gt;NewObject(cls,constract); jobject instance=env-&gt;NewGlobalRef(localobj); jclass input = env-&gt;FindClass("java/lang/Integer"); char* str="hilla"; jstring string1=env-&gt;NewStringUTF(str); int input2[2]={5,4}; jintArray args=(jintArray)env-&gt;NewIntArray(2); int *input1=input2; env-&gt;SetIntArrayRegion(args,0,2,(jint*)input1); jmethodID meth = env-&gt;GetStaticMethodID(cls, "main1", "([ILjava/lang/String;)V"); env-&gt;CallStaticVoidMethod(cls,meth,args,string1); jmethodID meth1= env-&gt;GetStaticMethodID(cls,"main2","(I;)[I"); return 1;} when I call main1 it's works, but when I call main2 it's give me meth1=0 (GetMethodsID failed) main2 is: public static int[] main2(int b)
has answer: http://stackoverflow.com/a/21029082
type: UnansweredQuestion
has title: Using GetMethodID two times at c++
tagged with: c++
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/a/21081990
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/31709236
downvote count: 0
answers question: http://stackoverflow.com/q/21081865
has comment: http://stackoverflow.com/comment/31709235
has body: You have created no fields in the Employee class. Just local variables inside the constructor. So add private Name name; private Address address; ... (Class names always UpperCase) and add getter and setter for those as well. In your main you should then use dbase[j].getName().getFirst() etc...

http://stackoverflow.com/comment/64912022
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21339552
type: AnswerComment
has text: @Roman why we are getting /Smack like username@xmpp-domain/Smack sometimes and number in resource sometimes like this username@xmpp-domain/789522112.

http://stackoverflow.com/comment/31709533
score: 0
comment on: http://stackoverflow.com/q/21039393
type: Comment
type: QuestionComment
has text: Thanks, I did not see the typo. Removed it.

http://stackoverflow.com/q/21074214
has answer: http://stackoverflow.com/a/21074249
type: Question
tagged with: arrays
downvote count: 0
has body: I have an ArrayList which contains some unique Strings sorted alphabetically. I want to store the index of the String in the list, which starts with the character in an array which has 27 slots corresponding to each alphabetic character and one extra for the other characters. For eg. 1 mandown 13 days after between company family far home important live lot mean might national next over same small so still talk though too zachs So when I iterate through this list, If I find a word that starts in char 'a' it should put the index of that word in the list in my array[0].. like that, If I find a word that starts in char 'b' it should put the index of that word in the list in my array[1] and so on till char 'z' in array[25] and if it starts with any other character, it should put the index of that character in array[26]. If it cant find a word in the list which starts in a particular character, use the index of the last found character. So after doing the logic, array[0] = 2 // A array[1] = 3 // B array[2] = 4 // C array[3] = 4 // D, No word for D in the list so taking index of 'c' array[4] = 4 // E, No word for E in the list so taking index of 'c' array[5] = 6 // F array[6] = 6 // G, No word for D in the list so taking index of 'f' . . . array[24] = index of last found word, ie. 't' array[25] = 23 // Z array[26] = 1 // numeric characters The logic I have n my mind is public static int [] calculateIndexForAlphabets(List libList) { int[] array = new int[27]; for (int x = libList.size() - 1; x &gt;= 0; x--) { Item lmi = (Item) libList.get(x); String name = lmi.getName(); //my method to return the name if (name != null) { // Not sure what to do inside // thinking of something like taking the name.toLowerCase().charAt(0) and using that } } return array; } Please provide some insights into this. Thanks, Sen
has comment: http://stackoverflow.com/comment/32803778
tagged with: string
tagged with: arraylist
linked to: http://stackoverflow.com/q/21048966
answer count: 1
favorite count: 0
has title: Storing the index of the words in an arraylist which starts with an alphabet into an array which can store it for each alphabet
has comment: http://stackoverflow.com/comment/31693991
has comment: http://stackoverflow.com/comment/31694012
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/31978176
score: 0
comment on: http://stackoverflow.com/q/21161586
type: Comment
type: QuestionComment
has text: I have now mounted a thorough inspection of all possible errors/warnings that are available in Eclipse Kepler SR1, but are disabled by default. I have discovered both "Resource leak" (enabled by default) and "*Potential resource leak*" (disabled by default). Enabling the latter is essential to reproducing your problem.

http://stackoverflow.com/comment/31847591
type: Comment
has text: Create a class, put the code in an init method (annotated with `@PostConstruct` or using the `InitializingBean` interface). Let y our test configuration load that class... Be done.
type: QuestionComment
comment on: http://stackoverflow.com/q/21158038
score: 2

breakout
type: Tag
tags question: http://stackoverflow.com/q/21153110
tag name: breakout

http://stackoverflow.com/q/21127792
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31793114
has comment: http://stackoverflow.com/comment/31793236
tagged with: swing
tagged with: jbutton
has comment: http://stackoverflow.com/comment/31793541
has title: clarification on inheritance hierarchy for the component class in Java Swing?
tagged with: components
has answer: http://stackoverflow.com/a/21254471
tagged with: java
tagged with: containers
type: Question
answer count: 1
downvote count: 0
has body: I am reading Core Java Volume 1 on Swing. I am having difficulty understanding this paragraph: Firstly, the author says Components can be placed inside containers such as panels. Container can themselves be put inside other containers,so the class container extends Component. Figure 9.8 shows the inheritance hierarchy for Component, Note: Unfortunately, the inheritance hierarchy is somewhat unclean in two respects. First,top-level windows, such as JFrame, are subclasses of container and hence Component, but they cannot be placed inside other containers. Moreover, JComponent is a subclass of Container, not Component. Therefore one can add other components into a JButton (However, those components would not be displayed). To me, both his statements before and after the picture seems contrary. I also could not make a clear sense of what the author is trying to say here. if someone could elaborate with an example or something, that will be useful Thanks
favorite count: 0
has comment: http://stackoverflow.com/comment/31793200
has comment: http://stackoverflow.com/comment/31793504
score: 2

http://stackoverflow.com/q/21130292
tagged with: twitter4j
has comment: http://stackoverflow.com/comment/31797511
has comment: http://stackoverflow.com/comment/31797413
has comment: http://stackoverflow.com/comment/31797414
accepted answer: http://stackoverflow.com/a/21132354
has title: REST API, regarding 403 error code?
downvote count: 0
has body: We are posting Tweets to multiple accounts from same IP address using software application. And in response from twitter , we are getting 403 error code, API used by us is REST API. Is there any limitations on IP address, because surely we are not crossing API post limit mentioned for REST API. We are also not going above 140 characters. Waiting for reply.. Thanks in advance..
has answer: http://stackoverflow.com/a/21144515
favorite count: 0
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/31797380
answer count: 4
has answer: http://stackoverflow.com/a/21130352
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21134302
has answer: http://stackoverflow.com/a/21132354
tagged with: java
tagged with: twitter-oauth
type: Question
possible better answer: http://stackoverflow.com/a/21134302
has comment: http://stackoverflow.com/comment/31797354

http://stackoverflow.com/comment/113415068
comment on: http://stackoverflow.com/a/21038785
has text: To answer @raj240's question, we can inject the entity manager using the respective persistence unit's name @PersistenceContext(unitName = "MiddlewareJPA")
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21036724
has comment: http://stackoverflow.com/comment/31626476
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/21036624
has comment: http://stackoverflow.com/comment/31626782
upvote count: 3
has comment: http://stackoverflow.com/comment/31629197
has comment: http://stackoverflow.com/comment/31626279
has comment: http://stackoverflow.com/comment/31626526
has body: Don't override update, this isn't how painting is achieved in Swing. Attempting to paint directly to a top level container like JFrame is problematic at best. Instead, start with a JPanel and use it's paintComponent method instead. Make sure you call super.paintComponent as well. In fact, you could probably just use a JLabel to display the image instead. Take a look at; Performing Custom Painting How to use labels For more details Updated with example I still think a JLabel would be simpler solution, but what do I know. import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class SeamCarving { public static void main(String[] args) { new SeamCarving(); } public SeamCarving() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class TestPane extends JPanel { private BufferedImage input; private BufferedImage[] toPaint; public TestPane() { try { input = ImageIO.read(new File("C:\\hold\\thumbnails\\2005-09-29-3957.jpeg")); toPaint = new BufferedImage[1]; } catch (IOException ex) { ex.p…
has comment: http://stackoverflow.com/comment/31626377
downvote count: 0
answers question: http://stackoverflow.com/q/21036624
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31627518

http://stackoverflow.com/q/21157853
has answer: http://stackoverflow.com/a/21158007
tagged with: jsp
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31848538
has answer: http://stackoverflow.com/a/21157939
type: Question
has answer: http://stackoverflow.com/a/21158196
has comment: http://stackoverflow.com/comment/31848422
score: 0
has title: How to manage error message in Spring MVC
has body: I am new to spring MVC .My abc page is have one submit button. On click of submit button, abcHandler called which is inside xyzController. Just wondering how to achieve this scenario. -- If some error occurs then it should return some message. -- It should stay in the same page , for me its abc page. I have tried this.The problem I am facing is that , i am getting the alert message as "You must have something...", but it is navigating to error page means a blank page. This is not suppose to happen.I want to show the message and stay in the same page. How can i achieve easily with spring MVC. Please suggest some idea. public class xyzController extends MultiActionController implements InitializingBean { public ModelAndView abcHandler(HttpServletRequest request,HttpServletResponse response)throws Exception { // session HttpSession session = request.getSession(true); String abc = ""; if(abc != ""){ }else{ String error = "You must have xyzzzzzz"; return new ModelAndView("2.0/error", "downloaderror", error); } return new ModelAndView(); } } My error.jsp is like this <c:if test="${not empty downloaderror}"> </c:if>
tagged with: spring
tagged with: spring-mvc
tagged with: java
has answer: http://stackoverflow.com/a/21159141
answer count: 4

http://stackoverflow.com/comment/31877361
comment on: http://stackoverflow.com/q/21173801
score: 0
has text: This code doesn't make sense. You are reading a byte directly from the stream by all appearances, and throwing it away, even if the method returns -1 indicating end of stream. Then you are reading lines from a BufferedReader. Whatever the intention here. it cannot possibly work. You can't mix buffered and unbuffered I/O on the same socket, or two different buffers either. You should log the exception you're catching instead of just assuming it means end of stream. You might get a surprise.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21055809
type: Question
score: 0
answer count: 1
tagged with: android-canvas
tagged with: android
tagged with: path
type: AnsweredQuestion
tagged with: paint
has title: How to draw curves and straight lines in one image?
has answer: http://stackoverflow.com/a/21056308
accepted answer: http://stackoverflow.com/a/21056308
tagged with: java
has body: I'm trying to draw what is basically a rounded rectangle plus, a square at one end of it. Sort of like a battery. I have a few restrictions, and it's basically that it must be done using just one paint object and should be able to support a stroke. This is the code I have so far: int width = 0; int height = 0; @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); // myPath outline Point[] myPath = { new Point(20, 20), new Point(width, 20), new Point(width, height), new Point(20, height), new Point(20, height - 20), new Point(0, height - 20), new Point(0, height - 40), new Point(20, height - 40) }; // Paint Paint paint = new Paint(); int color = 0xffff0000; paint.setColor(color); paint.setAntiAlias(true); // paint.setPathEffect(new CornerPathEffect(15)); paint.setStyle(Paint.Style.FILL); // Path moves Path path = new Path(); path.moveTo(myPath[0].x, myPath[0].y); int j = myPath.length; for (int i = 0; i &lt; j; i++) { path.lineTo(myPath[i].x, myPath[i].y); } path.close(); Bitmap toDrawOn; toDrawOn = Bitmap.createBitmap(getWidth(), getHeight(), Config.ARGB_8888); Canvas ofScreen = new Canvas(toDrawOn); ofScreen.drawPath(path, paint); canvas.drawBitmap(toDrawOn, 0, 0, paint); } This gives me a battery shape that I'm looking for, but I have no idea how to round the first 4 corners without rounding the corners of the little square at the end. Again, I need this to be one shape because I need to apply a stroke to it later on. I also can't use a 9patch because I need to change the color programatically. This is my GOAL:

http://stackoverflow.com/a/21066153
upvote count: 1
has comment: http://stackoverflow.com/comment/31679162
has comment: http://stackoverflow.com/comment/31696454
score: 1
has comment: http://stackoverflow.com/comment/31706871
downvote count: 0
has body: Try using this method: public void ellipse(float x, float y, float width, float height, int segments) because: public void ellipse(float x, float y, float width, float height) will just call the first method and estimate the segments argument. Maybe this step was not optimized.
type: Answer
answers question: http://stackoverflow.com/q/21062942

http://stackoverflow.com/a/23817270
answers question: http://stackoverflow.com/q/21174357
has body: I've just made this ugly example. And it worked, it retrieves all messages including those that have been seen. Properties props = System.getProperties(); props.setProperty("mail.store.protocol", "imaps"); Session session = Session.getDefaultInstance(props, null); try { Store store = App.session.getStore("imaps"); store.connect("imap-mail.outlook.com", "email", "password"); Folder folder = App.store.getFolder("Inbox"); folder.open(Folder.READ_ONLY); Message[] msgs = folder.getMessages(); for (Message msg : msgs) { System.out.println(msg.getSubject()); } }catch(MessagingException e) { System.out.println(e); } Of course you will have to properly retrieve just the mails you need, otherwise if you have an old email account this code will start a very heavy process. I hope this could be helpfull.
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/21176188
type: Answer
score: 1
has body: Summary of comments: The SpriteSheet.png is not located within location that ImageIcon(String) would be able to find it. ImageIcon(String) expects that the String references a File on the file system, but SpriteSheet.png is stored within the application context (src/rpg/SpriteSheet.png), this makes it an embedded resource. Use Class#getResource to load embedded resources, in this case either getClass().getResource("SpriteSheet.png") or getClass().getResource("/rpg/SpriteSheet.png") to be be sure. Use ImageIO.read over ImageIcon. It will at least throw an IOException when the image can not be loaded for some reason, where as ImageIcon can fail silently. Make sure that the instance of GraphicsPanel which is loading the resources is the same instance that is on the screen
upvote count: 1
has comment: http://stackoverflow.com/comment/31880897
downvote count: 0
answers question: http://stackoverflow.com/q/21175448

http://stackoverflow.com/q/21037432
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/31626981
has answer: http://stackoverflow.com/a/21037622
has comment: http://stackoverflow.com/comment/31627053
has body: So , Basically I started on this program where, If a user enters 1 , He can buy the stuff, if he enters 2 he can view his stuff, and if he presses 3, he can update it , Also if he enters 4 he can exit the looping. So far I've done this much import java.util.Scanner; public class ThumbDrives { public static void data() { System.out.print("HD of 512MB (@ 10$ per)"); System.out.print("HD of 512MB (@ 10$ per)"); System.out.print("HD of 512MB (@ 10$ per)"); System.out.print("HD of 512MB (@ 10$ per)"); int i1; } public static void main(String args[]) { int i1,i2,i3,i4,R1,R2,R3,R4; int ch,choi=0; do { Scanner choice = new Scanner(System.in); System.out.println("Enter your Choice -;"); System.out.println("1) Entering the data"); System.out.println("2) Displaying the data"); System.out.println("3) Updating the data"); System.out.println("4) Press 4 to exit"); ch = choice.nextInt(); switch(ch) { case 1: break; case 2: break; case 3: break; case 4: break; default: System.out.print("Your choice isnt appropriate"); } } while(choi!=4); } } But, I want it so that if i get the values entered in the method data, They can be accessed anywhere in the class. Sorry I am new to java any helps will be much appreciated :)
has comment: http://stackoverflow.com/comment/31626971
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31626969
has comment: http://stackoverflow.com/comment/31626978
upvote count: 1
has comment: http://stackoverflow.com/comment/31626980
has comment: http://stackoverflow.com/comment/31626972
type: Question
has comment: http://stackoverflow.com/comment/31626947
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/21037576
answer count: 2
has title: How to pass values of variables that I got from one method, To another method

http://stackoverflow.com/comment/31925275
comment on: http://stackoverflow.com/a/21071816
type: Comment
score: 0
type: AnswerComment
has text: The desktop one will work because it adds the lib when running from eclipse. (if wouldnt work if you export it as Runnable jar). Just add it to the core project.

http://stackoverflow.com/a/23488176
answers question: http://stackoverflow.com/q/21113970
accepted answer of: http://stackoverflow.com/q/21113970
score: 1
has body: I am having similar problem with this. The answer is in this forum (https://groups.google.com/forum/#!msg/javacv/yD99RSl7oCI/KQIRoOIqcK4J) try using javaCV.OpenCVFrameGrabber instead of VideoInputFrameGrabber. Change the line 'FrameGrabber grabber = new VideoInputFrameGrabber(0); // 1 for next camera' to 'FrameGrabber grabber = new OpenCVFrameGrabber(0); // 1 for next camera' now it works for me everytime. Hope it helps!
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/q/21048988
type: Question
has comment: http://stackoverflow.com/comment/31647675
answer count: 1
has comment: http://stackoverflow.com/comment/31647901
score: 0
has comment: http://stackoverflow.com/comment/31648503
tagged with: android
has body: Databasehelp.java package com.example.abc2; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import android.content.Context; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import android.database.sqlite.SQLiteOpenHelper; public class DataBaseHelper extends SQLiteOpenHelper{ //The Android's default system path of your application database. private static String DB_PATH = "/data/data/com.example.abc2/databases/"; private static String DB_NAME = "DB_BusData"; private SQLiteDatabase myDataBase; private final Context myContext; /** * Constructor * Takes and keeps a reference of the passed context in order to access to the application assets and resources. * @param context */ public DataBaseHelper(Context context) { super(context, DB_NAME, null, 1); this.myContext = context; } /** * Creates a empty database on the system and rewrites it with your own database. * */ public void createDataBase() throws IOException{ boolean dbExist = checkDataBase(); if(dbExist){ //do nothing - database already exist }else{ //By calling this method and empty database will be created into the default system path //of your application so we are gonna be able to overwrite that database with our database. this.getReadableDatabase(); try { copyDataBase(); } catch (IOException e) { throw new Error("Error copying database"); } } } /** * Check if the database already exist to avoid re-copying the file each time you open the application. * @return true if it exists, false if it doesn't */ private boolean checkDataBase(){ SQLiteDatabase checkDB = null; try{ String myPath = DB_PATH + DB_NAME; checkDB = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY); }catch(SQLiteException e){ //database does't exist yet. } if(checkDB != null){ checkDB.close(); } return checkDB != null ? true : false; } /** * Copies your database from your loc…
linked to: http://stackoverflow.com/q/14956018
has comment: http://stackoverflow.com/comment/31647289
has comment: http://stackoverflow.com/comment/31648596
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21050483
accepted answer: http://stackoverflow.com/a/21050483
has title: Android Another Activity call Main Activity Databasehelper Function fail
tagged with: java

http://stackoverflow.com/comment/31781644
type: QuestionComment
has text: @Rohit I often have more than 2, but generalising a solution for 2 looks easy enough...
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21121439

http://stackoverflow.com/q/21170343
answer count: 1
tagged with: javascript
has body: I have a SuggestBox with KeyUpHandler attached to it to call the service to fetch suggestions. Now, the problem is, when I type the text and suggestions are displayed, if I press down arrow key, the focus moves back to first suggestion always(due to KeyUp I guess). How can I solve this problem?
score: 0
type: UnansweredQuestion
tagged with: suggestbox
tagged with: gwt
has answer: http://stackoverflow.com/a/21177181
tagged with: java
type: Question
has title: SuggestBox with KeyUp Handler-Arrow keys not working

http://stackoverflow.com/a/21053470
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21053228
has body: Yes your professor is correct you either define all 52 cards in your enum Card specifying suite for each card or you create a class Card. The reason for that the last call to setSuit(Suite suite) will set suite for all Card enum you can read more on enums
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31717581
score: 1
comment on: http://stackoverflow.com/q/21057708
type: Comment
type: QuestionComment
has text: @MagicMan, I agree with Bohemian, but if you really have got that bad data provider, you can preprocess CSV manually. And there you can make you software to assist you. For example, you can introduce preprocess phase, which finds all the fuzzy matches and report about them. And also it should report first about ambigous matches (when both `Mike Thompson` and `Mike Thomas` exist and both are matching to a name from CSV). So you can manually fix these mistakes and run the second phase, that actually alters database.

http://stackoverflow.com/q/21088344
tagged with: java
accepted answer: http://stackoverflow.com/a/21089184
answer count: 1
downvote count: 0
favorite count: 0
score: 2
type: AnsweredQuestion
tagged with: spring-integration
upvote count: 2
has answer: http://stackoverflow.com/a/21089184
has body: I have an application I coded which I am refactoring to make better use of Spring Integration. The application processes the contents of files. The problem (as I see it) is that my current implementation passes Files instead of Messages, i.e. Spring Integration Messages. In order to avoid further rolling my own code, which I then have to maintain later, I'm wondering if there is a recommended structure for constructing Messages in Spring Integration. What I wonder is if there is some recommended combination of channel with something like MessageBuilder that I should use. Process/Code (eventually) I don't yet have the code to configure it but I would like to end up with the following components/processes: Receive a file, remove header and footer of the file, take each line and convert it into a Message&lt;String&gt; (This it seems will actually be a Splitter) which I send on to... Channel/Endpoint sends message to Router Router detects format String in Payload and routes to the appropriate channel similar to Order Router here... Selected channel then builds appropriate type of Message, specifically typed messages. For example I have the following builder to build a Message... public class ShippedBoxMessageBuilder implements CustomMessageBuilder { @Override public Message buildMessage(String input) { ShippedBox shippedBox = (ShippedBox) ShippedBoxFactory.manufactureShippedFile(input); return MessageBuilder.withPayload(shippedBox).build(); } ... Message is routed by type to the appropriate processing channel My intended solution does seem like I've complicated it. However, I've purposefully separated two tasks 1) Breaking a file into many lines of Messages&lt;String&gt; and 2) Converting Messages&lt;String&gt; into Messages&lt;someType&gt;. Because of that I think I need an additional router/Message builder for the second task.
type: Question
has title: How should I build my Messages in Spring Integration?

mongodb
tags question: http://stackoverflow.com/q/21174683
tags question: http://stackoverflow.com/q/21075319
tags question: http://stackoverflow.com/q/21169770
tag name: mongodb
tags question: http://stackoverflow.com/q/21114406
tags question: http://stackoverflow.com/q/21022888
type: Tag
tags question: http://stackoverflow.com/q/21118505
tags question: http://stackoverflow.com/q/21142217
tags question: http://stackoverflow.com/q/21146252
tags question: http://stackoverflow.com/q/21055713
tags question: http://stackoverflow.com/q/21053429
tags question: http://stackoverflow.com/q/21051260
tags question: http://stackoverflow.com/q/21129423
tags question: http://stackoverflow.com/q/21119928

http://stackoverflow.com/a/21101606
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31747578
has body: SHA-1 key is tie to the the software itself (eclipse in this case). If the project runs on a different pc software. I would suspect that the SHA-1 key is different. Change the SHA-1 key refer to your software see if it helps.
answers question: http://stackoverflow.com/q/21101482
accepted answer of: http://stackoverflow.com/q/21101482
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31747874
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31748104

http://stackoverflow.com/comment/31794757
has text: what is the use of hashMap int his solution.
type: Comment
comment on: http://stackoverflow.com/a/21113381
score: 0
type: AnswerComment

http://stackoverflow.com/q/21159295
type: Question
possible better answer: http://stackoverflow.com/a/21160468
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21160468
tagged with: spring-security
has body: actually I'm just starting to play around spring mvc in webapp and I have tumble across spring security which handles the authentication and session. My question is how does it handles session and can I create my own session id reference for spring security to use. I did use spring security but somewhat I feel blinded by it's process. Another thing is that can I add my own session service that I can control more if its implementable can you give me an insight in where can I start.. Furthermore I'm sorry for my English and if it is a duplicate question, though I think that topics concerning with spring security doesn't satisfy what i had in mind... Thanks for the feedback...
has answer: http://stackoverflow.com/a/21216490
accepted answer: http://stackoverflow.com/a/21216490
has title: Spring Security Session handling how does it handle session id
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/21069857
favorite count: 0
has comment: http://stackoverflow.com/comment/31686510
has answer: http://stackoverflow.com/a/21760744
has body: first time making a question. What I want is a way of every time the user presses a key on the console certains actions take place. Like, as he types a word, I want at every keypress for a String formed by all the keys he's already pressed to be printed, concatenated to the newly pressed key. As in: a You typed: a b You typed: ab c You typed: abc d You typed: abcd e You typed: abcde I'm trying to do this with the following code: try (BufferedReader input = new BufferedReader( new InputStreamReader(System.in, "UTF-8"))) { char c = 0; String s = ""; while( (c = (char) input.read() ) != 13) { s += c; System.out.println("You typed: " + s); } } I get what I want, but just after I press the Enter key, not as every key pressed on the console: foobar You typed: f You typed: fo You typed: foo You typed: foob You typed: fooba You typed: foobar Thanks in advance.
upvote count: 4
has title: java read every key pressed on console at a time
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1066318
downvote count: 0
tagged with: java
type: Question
answer count: 1
tagged with: string
score: 4
tagged with: console
tagged with: printing
accepted answer: http://stackoverflow.com/a/21760744

http://stackoverflow.com/comment/31695999
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21074845
has text: Will do. Thank you so much for the help and the links of reference. It really helps a lot.
type: AnswerComment

http://stackoverflow.com/comment/31688185
has text: It is a typo or mis-labeled, it's not 3.2 . Updated my answer to prove it.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21055327

http://stackoverflow.com/a/21050833
has comment: http://stackoverflow.com/comment/31651005
answers question: http://stackoverflow.com/q/21050130
type: Answer
upvote count: 1
downvote count: 1
has body: Here are the results I get. For me (gcc 4.6.3) -O3 -funroll-loops wins. &gt; gcc -o s s.c &gt; time ./s Elapsed time: 13 ./s 13.08s user 0.00s system 99% cpu 13.088 total &gt; gcc -o s s.c -O1 &gt; time ./s Elapsed time: 16 ./s 16.02s user 0.00s system 99% cpu 16.042 total &gt; gcc -o s s.c -O2 &gt; time ./s Elapsed time: 16 ./s 16.06s user 0.00s system 99% cpu 16.076 total &gt; gcc -o s s.c -O3 &gt; time ./s Elapsed time: 7 ./s 7.38s user 0.00s system 99% cpu 7.381 total &gt; gcc -o s s.c -O3 -funroll-loops &gt; time ./s Elapsed time: 6 ./s 6.04s user 0.00s system 99% cpu 6.046 total (Note: "Elapsed time" line excludes the time spent in building the test array -- but it's negligible).
score: 0

http://stackoverflow.com/comment/31749271
comment on: http://stackoverflow.com/q/21103401
has text: It only crashes with the Camera Folder photos, I've my Facebook albums in my gallery and it works fine.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21036765
tagged with: transformer-model
score: 0
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
has body: When I try to transform xml with xslt in my web application, the TransformerConfigurtionException exception is thrown in weblogic 10.3 server. The same web application code works fine in Tomcat 7.0. I have no clue what could be cause for this exception. Exception: javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet ERROR: 'Syntax error in 'format-date($date,'[MNn][D],[Y]','en',(),())'.' FATAL ERROR: 'Could not compile stylesheet' After removing the format-date function in xslt, i got another exception (javax.xml.tranform.TransformerException:java.lang.ArrayIndexOutOfBoundsException Code: TransformerFactory factory = TransformerFactory.newInstance(); try { factory.newTransformer().transform( new StreamSource( new StringReader( xml ) ), new StreamResult( transformResult ) ); Source documentInfoSource = new StringSource( new String( transformResult.toByteArray() ) ); transformResult.reset(); factory.setURIResolver( new URIResolver() { @Override public Source resolve(String href, String base) throws TransformerException { try { return new StreamSource( EcrionDocumentRenderServiceImpl.class.getClassLoader().getResourceAsStream( href ) ); } catch( Exception e ) { throw new TransformerException( e ); } } } ); factory.newTransformer( new StreamSource( Thread.currentThread().getContextClassLoader().getResourceAsStream( "template.xsl" ) ) ).transform( documentInfoSource, new StreamResult( transformResult ) );TransformerFactory factory = TransformerFactory.newInstance(); try { factory.newTransformer().transform( new StreamSource( new StringReader( xml ) ), new StreamResult( transformResult ) ); Source documentInfoSource = new StringSource( new String( transformResult.toByteArray() ) ); transformResult.reset(); factory.setURIResolver( new URIResolver() { @Override public Source resolve(String href, String base) throws TransformerException { try { return new StreamSource( EcrionDocumentRenderServiceImpl.class.getClassLoader().getResourceAsStream( …
has answer: http://stackoverflow.com/a/21039388
has title: TransformerConfigurationException:Could not compile sytlesheet
type: AnsweredQuestion
tagged with: java
tagged with: xslt
type: Question
accepted answer: http://stackoverflow.com/a/21039388

http://stackoverflow.com/comment/31821110
score: 0
comment on: http://stackoverflow.com/q/21142525
type: Comment
type: QuestionComment
has text: I think this example is misleading. `IOAttack<CLIENT extends SomeInterface>` makes more sense, but still does not explain why one would choose generics here instead of simply inheriting from `SomeInterface`.

http://stackoverflow.com/comment/31704287
type: AnswerComment
type: Comment
score: 0
has text: @MarkoTopolnik Fair point, but in this general stated questions (OP asks nothing about printing) they are both equal
comment on: http://stackoverflow.com/a/21079582

http://stackoverflow.com/q/21126221
tagged with: jaxb2
has comment: http://stackoverflow.com/comment/31825519
answer count: 2
has comment: http://stackoverflow.com/comment/31800066
has comment: http://stackoverflow.com/comment/31799947
downvote count: 0
favorite count: 0
tagged with: schemagen
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21221607
has answer: http://stackoverflow.com/a/21223195
upvote count: 4
tagged with: xsd
has comment: http://stackoverflow.com/comment/31961247
linked to: http://stackoverflow.com/q/12307396
tagged with: mojo
has comment: http://stackoverflow.com/comment/31790566
tagged with: java
has title: Generate jaxb Xsd schema for class files from a jar
linked to: http://stackoverflow.com/q/24038802
type: Question
has comment: http://stackoverflow.com/comment/31824326
score: 4
has body: I would like to generate jaxb xsd schema from class files in jar. Currently, I am using jaxb2-maven-plugin to generate schema using java files. org.codehaus.mojo jaxb2-maven-plugin ${maven.plugin.jaxb2} schemagen schemagen process-classes true com/someProject/domain/*.java ${project.build.directory}/schemas true But, I have a use case where I am getting a dependency jar file and would like to generate out of some classes from that jar file. Can anyone suggest how can it be done.

http://stackoverflow.com/q/21163498
tagged with: jcodec
upvote count: 3
has answer: http://stackoverflow.com/a/21163875
downvote count: 0
type: UnansweredQuestion
type: Question
score: 3
has body: I'm trying to decode a H264 raw protocol from a camera but I'm having some problems using the Jcodec H264Decoder. I receive an array of integers with the information from the camera. Below a sample of the data: array: 00 00 01 FD 00 00 14 69 00 00 00 01 61 E4 80 6F D3 5B 76 97 DF 04 3A EF 54 97 0E D9 F5...more The code I'm using is : ByteBuffer bb = ByteBuffer.wrap( Utils.intArrayToByteArray(array, arraySize) ); bb.rewind(); // Create a buffer to hold the output picture which is big enough Picture outBuffer = Picture.create( 1920, 1088, ColorSpace.YUV420 ); Picture pic = _decoder.decodeFrame( bb, outBuffer.getData() ); BufferedImage bufferedImage = JCodecUtil.toBufferedImage( pic ); When I try to run it, I get NullPointerException as follow: Exception in thread "Thread-6" java.lang.NullPointerException at org.jcodec.codecs.h264.H264Decoder$FrameDecoder.decodeFrame(H264Decoder.java:82) at org.jcodec.codecs.h264.H264Decoder.decodeFrame(H264Decoder.java:61) at br.com.grupogiga.security.xm.player.jcodec.JCodecPlayer.test_readNals(JCodecPlayer.java:122) at br.com.grupogiga.security.xm.player.jcodec.JCodecPlayer.processNAL(JCodecPlayer.java:69) at br.com.grupogiga.security.xm.player.XMH264Player$1$2.NALArrived(XMH264Player.java:143) at br.com.grupogiga.security.xm.protocols.ProtocolParser.emitNALArrived(ProtocolParser.java:408) at br.com.grupogiga.security.xm.protocols.ProtocolParser.run(ProtocolParser.java:121) at java.lang.Thread.run(Thread.java:722) What I'm doing wrong ?? How do I decode the data using JCodec ? Thanks in advance.
tagged with: java
has title: Decode H264 From Array of Integers
answer count: 2
tagged with: h.264
has answer: http://stackoverflow.com/a/27584631
favorite count: 0

bufferedwriter
tags question: http://stackoverflow.com/q/21066336
tags question: http://stackoverflow.com/q/21158142
tags question: http://stackoverflow.com/q/21068668
tag name: bufferedwriter
tags question: http://stackoverflow.com/q/21055249
type: Tag

http://stackoverflow.com/a/21051838
has body: Using -jar tells the JVM to ignore any other classpath settings (include CLASSPATH and -cp). You have to give a classpath in your manifest file at that point.
answers question: http://stackoverflow.com/q/21051696
score: 1
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/q/21099645
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/21099685
possible better answer: http://stackoverflow.com/a/21099748
type: Question
has body: I have a method: static &lt;E extends NotesAttached&gt; void deserialise(List&lt;E&gt; list, String type) { String fileName = "C:/temp/SalesModel." + type + ".list.ser"; try { FileInputStream serFile = new FileInputStream(fileName); ObjectInputStream in = new ObjectInputStream(serFile); list = (List&lt;E&gt;) in.readObject(); in.close(); serFile.close(); System.out.println(type + "s deserialised successfully, " + list.size() + " retrieved"); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } I call it like this: List&lt;Deal&gt; deals = new ArrayList&lt;Deal&gt;(); deserialise(deals, "Deal"); System.out.println("Number of deals deserialised: " + deals.size()); The list is populated when its in the method, but when it returns, its empty. I don't understand why, would appreciate it if someone could explain. The output is as follows: Deals deserialised successfully, 2522 retrieved Number of deals deserialised: 0
has answer: http://stackoverflow.com/a/21099748
has answer: http://stackoverflow.com/a/21099688
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/21099685
has title: List passed into method and deserialised becomes empty once method returns
tagged with: generics
tagged with: serialization
tagged with: collections

http://stackoverflow.com/comment/31751296
type: Comment
comment on: http://stackoverflow.com/a/21104429
has text: So in my mergeSort method I added a new LinkedList<E> mergedList to store the merged list of left and right: mergedList = merge(left, right), and then I set the root of list to be the same as the root of this mergedList by list.setRoot(mergedList.getRoot()) and it worked! However, I feel my solution is quite over-complicated (compared to what it would look written in C, for example). Is there something which can be improved in my code? Thanks again! (:
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31659296
type: QuestionComment
comment on: http://stackoverflow.com/q/21055228
score: 0
has text: @Massimo there is no error. The app just basically freezes.
type: Comment

http://stackoverflow.com/comment/31688528
comment on: http://stackoverflow.com/a/21064408
type: Comment
has text: *"..stated "copy, paste, compile and run""* That was succinct, unfortunately it excluded code for which the problem was actually a compiler error, also it did not apply to (for e.g.) HTML/JS problems *"..yet we still got code that we couldn't test."* Heck, I've *already* encountered problems for which the OP either did not visit the MCVE, or could not pay attention for the entire screen full (it almost fits on a single screen view without scrolling, on my current 1920x1080 monitor when FF is full screen height). We can lead a horse to water..
score: 0
type: AnswerComment

http://stackoverflow.com/a/39610825
type: Answer
upvote count: 6
has body: I ran into a similar issue where the program needs to be paused half way through for the human user to enter some 2-step verification information manually. What you can do is to show a message box at the human step. I work in Python, and here is what my code looks like: from tkinter import messagebox messagebox.showinfo(title='2-step verification', message='Finish on screen 2-step verification, and then click OK.') Once the user finish the human step, he/she can click OK, and the rest of the program will run.
score: 6
answers question: http://stackoverflow.com/q/21036239
downvote count: 0

http://stackoverflow.com/q/21182037
answer count: 4
has title: Should serialVersionUID be unique for different classes?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21182084
has answer: http://stackoverflow.com/a/21182084
has answer: http://stackoverflow.com/a/57489138
linked to: http://stackoverflow.com/q/285793
type: Question
score: 28
tagged with: java
has answer: http://stackoverflow.com/a/21182089
has answer: http://stackoverflow.com/a/53920644
linked to: http://stackoverflow.com/q/888335
accepted answer: http://stackoverflow.com/a/21182089
has body: class A implements Serializable{ private static final long serialVersionUID = 5L; ... } and class B implements Serializable{ private static final long serialVersionUID = 6L; ... } then it is necessary to give unique serialVersionUID to both classes. So can I assign serialVersionUID = 5L for both classes? I read following links Why generate long serialVersionUID instead of a simple 1L? What is a serialVersionUID and why should I use it?
downvote count: 0
favorite count: 0
tagged with: serialization
upvote count: 28

http://stackoverflow.com/comment/31735286
type: Comment
score: 2
has text: This would look much cleaner in a `while` loop
type: AnswerComment
comment on: http://stackoverflow.com/a/21096390

http://stackoverflow.com/q/21040166
has answer: http://stackoverflow.com/a/21041780
downvote count: 2
type: AnsweredQuestion
has title: Aggregation in MapReduce
tagged with: java
has answer: http://stackoverflow.com/a/21048751
tagged with: mapreduce
type: Question
tagged with: hadoop
answer count: 2
accepted answer: http://stackoverflow.com/a/21041780
upvote count: 0
score: -2
possible better answer: http://stackoverflow.com/a/21048751
favorite count: 0
has body: How can we find tha maximum and minimum element of a column in a .csv. What should we pass into context.write(key,value) of mapper. Whether it is each column of that csv file? Solution
has comment: http://stackoverflow.com/comment/31631616
has comment: http://stackoverflow.com/comment/31633454

http://stackoverflow.com/comment/31840650
score: 14
comment on: http://stackoverflow.com/q/21150924
has text: @HotLicks Java is an advanced OO programming language, featuring a sophisticated exception-tracking mechanism, inheritance, overloading, strong support for concurrency, bounded polymorphism and subtyping. You expect it to be as fast at simple things as Haskell?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31761866
has text: @Flo Just an FYI, that is absolutely incorrect in Java.
comment on: http://stackoverflow.com/q/21110803
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21091635
upvote count: 0
has comment: http://stackoverflow.com/comment/31726795
tagged with: jsp
favorite count: 0
has body: I am trying to get attribute of spanId and set Attribute by using request. Then I want to pass the output. Although the first input is has value, it still return me null. Below are my codes. Help will be appreciate! :) &lt;input id="spanId" name="spanId"&gt; &lt;% String spanId = request.getParameter("spanId"); request.setAttribute("spanId",spanId); %&gt; &lt;%= request.getParameter("spanId") %&gt;"&gt;
has answer: http://stackoverflow.com/a/21093094
score: -1
type: UnansweredQuestion
tagged with: request
downvote count: 1
tagged with: java
tagged with: scriptlet
has answer: http://stackoverflow.com/a/21091861
type: Question
has title: Pass Value by Using Request.setAttribute
answer count: 2

http://stackoverflow.com/a/21211612
upvote count: 13
has comment: http://stackoverflow.com/comment/31973311
has body: Frankly speaking there are not so many good approaches to make your application modular (I think this is the proper way to rephrase your requirements). Please also note, there were so many discussions, failed attempts and strange designs to simplify development of modular applications, but still we have so many monolithic monsters. I've been supporting enough enterprise systems to be frightened till the end of my life. Initial design is very important and it is not only about basic concepts like interfaces. Please don't get me wrong. Interfaces are important, but I would prefer to use a bit different terminology -- contracts or extension points Let's imagine you've defined extension points properly. What will you do next? I'd say eventually you'll implement some kind of plugin framework. (You can spend an hour to play with JSPF and see how it simplifies development of modular applications and encourages loose coupling). Bad news, this solution might be a bit dangerous for any production system. Mainly because complex class loading strategy (introduced by this approach) might cause memory leaks. So you'll find yourself analyzing memory dumps quite soon. Class-loaders and all related stuff became a bit complex :) Anyway, let's assume you've solved all issues with class loading, but what about plugins/modules life-cycle? In any loosely coupled system you'll need to to strictly define how modules will interact. Plugin framework will not entirely solve this problem. Eventually you'll come up with modules life-cycle in order to define all important aspects. For example: My suggestion is to avoid reinventing the wheel. OSGi might be a good solution for you. Please also note OSGi is good, mature and provides a lot stuff out of the box, but it is also somewhat complex: So you'd definitely need some time to investigate it a bit deeply. Please also check the following : What benefits does OSGi's component system provide you? Another suggestion is to check any existing big soft…
has comment: http://stackoverflow.com/comment/32020508
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21144054
has comment: http://stackoverflow.com/comment/31967585
has comment: http://stackoverflow.com/comment/31975113
has comment: http://stackoverflow.com/comment/31995234
type: Answer
has comment: http://stackoverflow.com/comment/31953470
answers question: http://stackoverflow.com/q/21144054
has comment: http://stackoverflow.com/comment/31976038
score: 13

http://stackoverflow.com/a/21140293
has comment: http://stackoverflow.com/comment/31814810
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: Pass the instance of class A to the method on class B: Class A { public static void main(String[] args) { B newClass = new B(); newClass.testMethod(new A()); } public void someImportantMethod() { } }
answers question: http://stackoverflow.com/q/21140264

http://stackoverflow.com/a/21067537
has comment: http://stackoverflow.com/comment/31682733
has comment: http://stackoverflow.com/comment/31682655
has comment: http://stackoverflow.com/comment/31682694
score: 0
has body: You start by creating a Scool instance and saving it. It becomes associated to the Hibernate session. At this time, the list of students is null, because you neglected to initialize the list to an empty list (this should be the default state of a new school). Then you execute a SQL query, like if Hibernate didn't exist and you were using JDBC. Hibernate doesn't know what this query does. It doesn't know that the query inserts a row to the join table. And it can't magically know that this corresponds to a new association between the student and the school. It can't magically initialize the field of your school in memory and replace it with a list containing the student. Don't bypass Hibernate by using SQL queries. Use the entities: // correct default state of a school: private List&lt;Students&gt; associatedStudents = new ArrayList&lt;&gt;(); ... School school = new School("GeorgiaTech", ....); session.save(school); Student student = new Student("LazyStudent", ....); session.save(student); // now associate the student with the school: school.getAssociatedStudents().add(student); // done. Hibernate will insert the row in the association table for you.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21066818
type: Answer
answers question: http://stackoverflow.com/q/21066818

http://stackoverflow.com/q/21104576
tagged with: java
type: Question
answer count: 2
tagged with: dependency-injection
accepted answer: http://stackoverflow.com/a/21104681
score: 0
possible better answer: http://stackoverflow.com/a/21104672
has body: My question: is there a way to use javax.inject (or any other Java injection framework) for a consumer of a Provider to use multiple implementations at runtime if the number of implementations is unknown at build time? Some background on my need for this: I work on reusable frameworks which, for the most part, combine the use of a factory and a service locator to load implementations. Several of these seem like they could be reworked to use proper dependency injection, at least insofar as removing the service locator, but there are some that require loading all implementations found on the class path. This is achieved through a simple "multi-implementation" implementation which then loads the other implementations, saving the instances off in a collection and looping over them when the API is called.
has answer: http://stackoverflow.com/a/21104672
has comment: http://stackoverflow.com/comment/31751152
has title: Java Dependency Injection with Multiple Implementations
has comment: http://stackoverflow.com/comment/31751155
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21104681

http://stackoverflow.com/comment/109078701
type: Comment
score: 0
type: AnswerComment
has text: WHY should not be used in production?
comment on: http://stackoverflow.com/a/21113195

http://stackoverflow.com/comment/31831474
score: 0
type: AnswerComment
type: Comment
has text: Thank you very much cfred, that helped a ton! The only thing that I'm running into now is that my test board (which has 4 cores), reads a constant 0 for cores 2, 3 and 4. I suppose that this is to the original question, as it is fairly different from when it was when I started.
comment on: http://stackoverflow.com/a/21102261

http://stackoverflow.com/comment/31844957
type: Comment
type: QuestionComment
has text: I am not in control of the database settings and the field has been set up as a TIMESTAMP
score: 0
comment on: http://stackoverflow.com/q/21156431

http://stackoverflow.com/comment/31894415
has text: Thanks Tom for clarifying.
score: 0
comment on: http://stackoverflow.com/a/21181510
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21069191
score: 0
has body: In most other languages / operating system I've worked with, a statement like File f = new File(....); would attempt to open the file, and either create one if it didn't exist, or return an error code if it was missing. So, what happens in java.io? I'd like to understand the mindset of the run time engine. Can I actually get a handle to a non-existent file? Dose the java run time engine hold off on making the file until the 1st time I write to it? If not, shouldn't if(f.exists()) {…} always be “true”? - any comments welcome - Joe
has comment: http://stackoverflow.com/comment/31685260
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31685305
possible better answer: http://stackoverflow.com/a/21069261
has title: Confusion on – File f = new File(....); if(f.exists()) {…}
tagged with: java
accepted answer: http://stackoverflow.com/a/21069230
has answer: http://stackoverflow.com/a/21069261
type: Question
has comment: http://stackoverflow.com/comment/31685350
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/21069230
has comment: http://stackoverflow.com/comment/31685189
has answer: http://stackoverflow.com/a/21069953

http://stackoverflow.com/q/21137536
has title: Android: String class's equals method behave abruptly
has comment: http://stackoverflow.com/comment/31810716
answer count: 1
has comment: http://stackoverflow.com/comment/31809834
has answer: http://stackoverflow.com/a/21228348
has comment: http://stackoverflow.com/comment/31809837
score: 0
has comment: http://stackoverflow.com/comment/31810161
tagged with: sqlite
tagged with: string
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/31811194
has body: I am reading a text file and from that I am inserting a value suppose ID=1s001(String) in the data base. And I am again reading files but this time I want to make sure that I read files if the ID is different in these file, for that I am reterving value from db and comparing with current ID. Like this Id (from deb). equals (current ID) But unfortunatily even if the ID=1s001 equals method returns false. only thing I was able to find is that currentID.length=6 &amp; Id (from deb).length is returning 5. I don't know what is causing this? any Idea? Actual Code: Cursor cursor = database.query(StorageDataBase, allColumns, null, null, null, null, null); int count = cursor.getCount(); if(count&gt;0){ if(cursor.moveToFirst()) { String slsManCode=cursor.getString(cursor.getColumnIndex("sales_man_id")); System.out.println(slsManCode.length()+" "+salesManCode.length()); boolean is=slsManCode.trim().equals(salesManCode.trim()); if(slsManCode.contains(salesManCode)) { return true; } Every coloumn in db is text.
has comment: http://stackoverflow.com/comment/31810701
has comment: http://stackoverflow.com/comment/31810868
tagged with: java
type: Question

http://stackoverflow.com/comment/31812579
type: Comment
comment on: http://stackoverflow.com/a/21139096
type: AnswerComment
has text: I guess the key was the right length when it was generated but became shorter when encryption happened.
score: 0

http://stackoverflow.com/comment/31614139
has text: @Submersed With the code shown, no, but it's never right - there are better (correct) ways to handle application resources and activity elements. All it takes is to come back in 6 months, make a change add a static class field to hold the context or some other element and boom. I guess what I'm saying is you cannot guarantee the life time and scope of a class with static fields or methods and there is never a requirement to pass an activity reference so why do it?
comment on: http://stackoverflow.com/q/21029022
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21085284
score: 1
has comment: http://stackoverflow.com/comment/31717202
tagged with: java
has answer: http://stackoverflow.com/a/21085420
tagged with: jtable
tagged with: preferredsize
downvote count: 0
has answer: http://stackoverflow.com/a/21089058
has answer: http://stackoverflow.com/a/21085444
favorite count: 0
has body: I've a Jtable in which i'm setting data using setDataVector function.It's working fine but suppose if i have changed some column width simply by dragging using mouse and after that new data loads in the same table then the width of that column reset to it's default position.So basically i want to retain that width even if new data loads.
answer count: 3
possible better answer: http://stackoverflow.com/a/21085444
accepted answer: http://stackoverflow.com/a/21085420
has title: Jtable retain column width
type: AnsweredQuestion
tagged with: jtableheader
upvote count: 1
tagged with: swing
type: Question

http://stackoverflow.com/q/21094347
has body: I have run into an annoying crash in my app when the user clicks the back button. In my app, i have 3 relevant activities: MainActivity: shows a list of Persons PersonActivity: shows a list of all the Payments of a Person AddPaymentActivity: has input elements to add a Payment to a Person From MainActivity the user can either tap on a Person's name in the list to go to PersonActivity or use a "+" button next to the Person's name and jump directly into AddPaymentActivity. In PersonActivity there is a "+" button that leads to AddPaymentActivity, too. The Perons data is stored in a Java Person class that implements the Serializable interface. When starting an Activty i forward the Person Object via intent.putExtra(MainActivity.PERSON_MESSAGE, person); When i go from MainActivity directly into AddPaymentActivity (via "+"), the back button works fine. If i however use start AddPaymentActivity from PersonActivity, my application crashes with a null pointer exception. Using the debugger i noticed that PersonActivity.onCreate() is called (again?) when the back button is pressed. Why does this happen when going back form AddPaymentActivity to PersonActivity? And why does that NOT happen when going back from AddPaymentActivity to MainActivity? What can i do to fix the problem? Stack trace: 01-13 10:11:01.423: E/AndroidRuntime(1022): FATAL EXCEPTION: main 01-13 10:11:01.423: E/AndroidRuntime(1022): Process: de.emteg.cashsplit, PID: 1022 01-13 10:11:01.423: E/AndroidRuntime(1022): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.emteg.cashsplit/de.emteg.cashsplit.PersonActivity}: java.lang.NullPointerException 01-13 10:11:01.423: E/AndroidRuntime(1022): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2176) 01-13 10:11:01.423: E/AndroidRuntime(1022): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226) 01-13 10:11:01.423: E/AndroidRuntime(1022): at android.app.ActivityThread.access$700(ActivityThread.java:135) …
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/21094879
favorite count: 0
has comment: http://stackoverflow.com/comment/31731901
has title: Android app crashes when back button is pressed
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/21095619
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31732224
type: Question
has comment: http://stackoverflow.com/comment/31730925
has comment: http://stackoverflow.com/comment/31731790
tagged with: crash
downvote count: 0
has answer: http://stackoverflow.com/a/48317085

http://stackoverflow.com/q/21141521
has comment: http://stackoverflow.com/comment/31817621
has title: Add main/java classes to my test/java directory in intellij
accepted answer: http://stackoverflow.com/a/21141593
tagged with: intellij-idea
downvote count: 0
has answer: http://stackoverflow.com/a/21143555
tagged with: junit
has comment: http://stackoverflow.com/comment/31817927
possible better answer: http://stackoverflow.com/a/21143555
favorite count: 0
has body: I am new to intellij. I am switching from eclispe Kepler. I do not have a maven project, but I do have a maven directory structure. My classes are in src/main/java with my tests in src/test/java. My unit tests are complaining because they can't find the classes from src/main/java. What is the proper way to add this to the build path so that my unit tests can find the source?
upvote count: 2
type: AnsweredQuestion
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/59761715
has answer: http://stackoverflow.com/a/21141593
type: Question
answer count: 2

http://stackoverflow.com/comment/31629751
comment on: http://stackoverflow.com/a/21025841
score: 0
type: Comment
has text: I read the same tutorial. In file stream section is what I am doing. Here: http://poi.apache.org/spreadsheet/quick-guide.html#FileInputStream
type: AnswerComment

http://stackoverflow.com/comment/31885489
comment on: http://stackoverflow.com/a/21163007
score: 1
type: Comment
has text: @MariuszS Your first line confuses me: `You are wrong with JodaTime code.` (a) I don't see how the original poster was wrong with the Joda-Time code. (b) A quick reader might interpret that as you saying the Joda-Time code is incorrect when in fact it is correct. Perhaps you can finesse your answer.
type: AnswerComment

http://stackoverflow.com/a/21171148
downvote count: 0
has comment: http://stackoverflow.com/comment/31871753
has comment: http://stackoverflow.com/comment/31871908
has body: It seems that your SQL statement is not correctly written. Simply change the following line: String query = "SELECT " +KEY_SET_ID+" * FROM "+TABLE_SETS; to: String query = "SELECT " +KEY_SET_ID+" FROM "+TABLE_SETS;
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31871958
answers question: http://stackoverflow.com/q/21171025
type: Answer
accepted answer of: http://stackoverflow.com/q/21171025
has comment: http://stackoverflow.com/comment/31871595
score: 2
has comment: http://stackoverflow.com/comment/31871881

http://stackoverflow.com/comment/31746370
has text: @user886596 Yes, that is your first hint. I believe you can select the `XMLWebApplicationContext` method which will bring you to where that method is blocked. You can check that object's properties for a `location` that will tell you which file it is.
comment on: http://stackoverflow.com/a/21096977
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21069784
upvote count: 1
has body: Constructor name should be identical as your class name! public class UserNumber { public UserNumber() { super(); randy = new java.util.Random(); } } To invoke this special method use: new UserNumber() - this is all :) More: Java: How can a constructor return a value?
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21069753
score: 1

http://stackoverflow.com/comment/31891644
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21180576
has text: It commits because there is no transaction, at least hibernate thinks so. As mentioned it isn't only the datasources you also need to configure hibernate correctly.

google-app-engine
tags question: http://stackoverflow.com/q/21175429
tag name: google-app-engine
tags question: http://stackoverflow.com/q/21052787
tags question: http://stackoverflow.com/q/21128935
type: Tag
tags question: http://stackoverflow.com/q/21145533
tags question: http://stackoverflow.com/q/21158391
tags question: http://stackoverflow.com/q/21036934
tags question: http://stackoverflow.com/q/21129691
tags question: http://stackoverflow.com/q/21052234
tags question: http://stackoverflow.com/q/21052188
tags question: http://stackoverflow.com/q/21059019
tags question: http://stackoverflow.com/q/21131896
tags question: http://stackoverflow.com/q/21104215
tags question: http://stackoverflow.com/q/21148777
tags question: http://stackoverflow.com/q/21139954
tags question: http://stackoverflow.com/q/21025203
tags question: http://stackoverflow.com/q/21182667
tags question: http://stackoverflow.com/q/21089052
tags question: http://stackoverflow.com/q/21095382
tags question: http://stackoverflow.com/q/21057910
tags question: http://stackoverflow.com/q/21093218
tags question: http://stackoverflow.com/q/21111128
tags question: http://stackoverflow.com/q/21164878
tags question: http://stackoverflow.com/q/21021129
tags question: http://stackoverflow.com/q/21116314
tags question: http://stackoverflow.com/q/21085884
tags question: http://stackoverflow.com/q/21176935
tags question: http://stackoverflow.com/q/21086746
tags question: http://stackoverflow.com/q/21160947
tags question: http://stackoverflow.com/q/21091135
tags question: http://stackoverflow.com/q/21043361
tags question: http://stackoverflow.com/q/21047479
tags question: http://stackoverflow.com/q/21021932

http://stackoverflow.com/a/21058680
score: 0
answers question: http://stackoverflow.com/q/21058626
type: Answer
has body: I have not reviewed your code deeply, but there are some issues about your code (and may be there are some more): Most important ones is you are defining guessedinsideforloop, so every time the array is initialized to allfalse`. You are using == for Strings, which won't work, you shall use String.equals() method instead, by the way why didn't you use chars? java.lang.String has a toCharArray() which returns an char[] representing each character, and because char is primitive you can use == operator on it.

http://stackoverflow.com/comment/138317943
type: AnswerComment
score: 0
type: Comment
has text: Clarification: jSerialComm contains native libraries bundled in the jar. The libraries are copied to a temp directory before use.
comment on: http://stackoverflow.com/a/50010831

http://stackoverflow.com/q/21163496
tagged with: mysql
has comment: http://stackoverflow.com/comment/31857324
has answer: http://stackoverflow.com/a/21163605
answer count: 2
tagged with: sql
upvote count: 0
has title: Not unique table/alias 'GPS'
favorite count: 0
accepted answer: http://stackoverflow.com/a/21163605
has answer: http://stackoverflow.com/a/21163898
score: -3
possible better answer: http://stackoverflow.com/a/21163898
type: Question
has body: Here is the creation of my table : "CREATE TABLE GPS ("+ "id int NOT NULL AUTO_INCREMENT,"+ "name VARCHAR(30),"+ "x REAL,"+"y REAL,"+ "PRIMARY KEY (id)"+")"; I hanve this query and when I'm trying to execute it , there is an Exception "Not unique table/alias" I try to change everything but the exception still remains ! "SELECT GPS.ID,GPS.NAME,GPS.X,GPS.Y,POI.ID,"+ "POI.TYPE FROM GPS JOIN POI"+ "ON POI.ID=GPS.ID"+ "WHERE("+ "(X BETWEEN "+xaxis+"-"+sett.getR()+" AND "+xaxis+"+"+sett.getR()+ ") AND (Y BETWEEN "+yaxis+"-"+sett.getR()+" AND "+yaxis+"+"+sett.getR()+"))";
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31857627
downvote count: 3

http://stackoverflow.com/comment/31673407
comment on: http://stackoverflow.com/q/21062787
has text: The only way I see to do something similar to the intended behaviour is to use a custom annotation(with [@Inherited](http://docs.oracle.com/javase/7/docs/api/java/lang/annotation/Inherited.html) and [RetentionPolicy.RUNTIME](http://docs.oracle.com/javase/7/docs/api/java/lang/annotation/RetentionPolicy.html#RUNTIME)). But then reflection has to be used to get `model`.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/21056242
downvote count: 1
has comment: http://stackoverflow.com/comment/31661365
has comment: http://stackoverflow.com/comment/31661247
has comment: http://stackoverflow.com/comment/31664040
has comment: http://stackoverflow.com/comment/31661465
type: Answer
has comment: http://stackoverflow.com/comment/31663431
has comment: http://stackoverflow.com/comment/31663956
has body: http://docs.oracle.com/javase/tutorial/uiswing/events/keylistener.html http://docs.oracle.com/javase/7/docs/api/java/awt/event/KeyEvent.html if (e.getKeyCode() == KeyEvent.VK_A) { //A pressed... }
accepted answer of: http://stackoverflow.com/q/21056188
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31661195
answers question: http://stackoverflow.com/q/21056188
score: 0
upvote count: 1

http://stackoverflow.com/comment/31634325
type: Comment
type: QuestionComment
has text: Also must check that in your manifest file the package name is **com.example.shoppinglist2**
score: 0
comment on: http://stackoverflow.com/q/21041895

http://stackoverflow.com/q/21126983
type: Question
has answer: http://stackoverflow.com/a/21127658
accepted answer: http://stackoverflow.com/a/21127658
has body: I'm a little stuck and would definitely appreciate your help. As the title says I want to store different classes on an array, which is in another class This would be my code The Customer class: public class Customer { public List&lt;Product&gt; products = new ArrayList&lt;Product&gt;(); public void addProduct(Product p){ products.add(p); } } The Product class: public abstract class Product{ } The Ham class: public class Jamon extends Product{ protected String marca; protected int precio; public Jamon(String marca,Double precio){ this.marca=marca; this.precio=precio; } public void setMarca(String marca){ this.marca=marca; } public String getMarca(){ return marca; } public void setPrecio(int precio){ this.precio=precio; } public int getPrecio(){ return precio; } */ public void comprar(){ System.out.println("Se ha comprado el jamon"); } What I want to know is How do i store the Jamon class in the array on the Customer class, i want this because there will be multiple classes like Jamon that extend from Product. Also, if all this classes (Pepino, Jelly, etc) have precios, how can I add all the precios? Thank you, if you have any doubt about my question please ask me (english is not my first language) Nice Day (:
tagged with: arrays
has comment: http://stackoverflow.com/comment/31791633
tagged with: class
score: 0
tagged with: abstract-class
answer count: 2
has comment: http://stackoverflow.com/comment/31792047
possible better answer: http://stackoverflow.com/a/21127077
has answer: http://stackoverflow.com/a/21127077
has title: JAVA Storing 3 or more classes in array
has comment: http://stackoverflow.com/comment/31791629
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31791630

http://stackoverflow.com/comment/31936354
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21101435
has text: I think that this is a syntax issue though not sure.

http://stackoverflow.com/a/21153481
upvote count: 1
answers question: http://stackoverflow.com/q/21153457
has comment: http://stackoverflow.com/comment/31846375
has body: You need to use if, else if and else in your code. Then only the control will execute only one loop which condition turned true at first and ignore the other else if and else loops. Otherwise, the condition test will happen in all the if loops and execute the statements in loop if the conditional test passes, no matter whether a prior loop statements got executed or not
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/31878887
type: QuestionComment
type: Comment
has text: Seems like you're after a unique constraint of product and date. Can add it after the fact or make it part of the create table statement. Doing it after would look like this: `ALTER TABLE evolution ADD CONSTRAINT uc_product UNIQUE (product,date)`
score: 1
comment on: http://stackoverflow.com/q/21175019

http://stackoverflow.com/comment/31721723
comment on: http://stackoverflow.com/q/21089161
score: 0
has text: I guess it's down vote is because this is an ordinal task to do in Android and it should not be asked here. You have to create your own layout for your list item row and provide it to adapter. If the problem is that you don't know how to create such a layout for your row,than you should learn how to create layouts :)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21098798
has body: View v = new View(this); v.setLayoutParams(new LinearLayout.LayoutParams( LayoutParams.MATCH_PARENT, 5 )); v.setBackgroundColor(Color.parseColor("#B3B3B3")); LinearLay.addView(v);
score: 37
accepted answer of: http://stackoverflow.com/q/21098618
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21098618
has comment: http://stackoverflow.com/comment/70959761
upvote count: 37
type: Answer
downvote count: 0

http://stackoverflow.com/comment/31689482
type: Comment
type: QuestionComment
has text: @HotLicks Agree that would be most tedious. In the worst cases, the OP actually inserts a ` ` at the end of ever line! ;)
score: 0
comment on: http://stackoverflow.com/q/21071470

http://stackoverflow.com/comment/31697901
type: Comment
comment on: http://stackoverflow.com/a/21076288
has text: For now i have not used a switch statement. I will learn about it in the near future. The thing it makes this assignment a little tricky is that i cannot use arrays, switches, if/for loops.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31909758
score: 0
comment on: http://stackoverflow.com/q/21051873
type: Comment
type: QuestionComment
has text: Brad: I asked if the JVM can perform garbage collection inside a thread. The answer is an emphatic "NO". The thread is protected from GC until it is joined or terminated. Threads use a stack, not heap memory, hence the name of this site

http://stackoverflow.com/q/21053855
favorite count: 0
type: Question
has title: How to share an ExternalResource between two test classes?
has answer: http://stackoverflow.com/a/21054616
tagged with: junit-rule
has body: I am struggling a bit to understand the benefit of using ExternalResource. The documentation and other posts (How Junit @Rule works?) have all alluded to being able to share code between tests within a class and/or share code between test classes. I am trying to use ExternalResource for a DB connection in a functional/integration test, but I don't see how I can share that connection across classes. In fact, I don't really see the benefit over @Before/@After in this case. Am I using this incorrectly or what am I missing? public class some_IntegrationTest { private static String id; Connection connection = null; //... @Rule public ExternalResource DBConnectionResource = new ExternalResource() { @Override protected void before() throws SQLException { connection = DbUtil.openConnection(); } @Override protected void after() { DbUtil.closeConnection(connection); } }; @BeforeClass public static void setUpClass() throws SQLException { System.out.println("@BeforeClass setUpClass"); cleanup(id); } //I want to do something like this @Test public void test01() { cleanupData(connection, id); // do stuff... } @Test public void test02() { cleanupTnxLog(connection, id); // do stuff... } //... private static void cleanup(String id) throws SQLException { LOGGER.info("Cleaning up records"); Connection connection = null; try { connection = DbUtil.openConnection(); cleanupData(connection, id); cleanupTnxLog(connection, id); } finally { DbUtil.closeConnection(connection); } } private static void cleanupData(Connection connection, String id) throws SQLException { dao1.delete(connection, id); } private static void cleanupTnxLog(Connection connection, String id) throws SQLException { dao2.delete(connection, id); } }
upvote count: 1
has comment: http://stackoverflow.com/comment/31658445
answer count: 1
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/31658293
tagged with: junit4
tagged with: java
accepted answer: http://stackoverflow.com/a/21054616
has comment: http://stackoverflow.com/comment/31658079
linked to: http://stackoverflow.com/q/13489388
type: AnsweredQuestion
tagged with: junit
downvote count: 0
score: 1

http://stackoverflow.com/comment/31759149
score: 0
type: AnswerComment
type: Comment
has text: I want to set the path in a property of a bean. I can't write any code.
comment on: http://stackoverflow.com/a/21097201

http://stackoverflow.com/q/21178268
type: Question
upvote count: 2
tagged with: validation
answer count: 1
has body: Hi I want to check the following scenario in PDFBOx: "Image is rotated over an angle that is not a multiple of 90 degrees". Can anybody please help in this topic. Sample PDF location: https://drive.google.com/file/d/0BzaBYVk1XnP_UkJjMDRBc2owd0E/edit?usp=sharing
has title: How to determine an Image is rotated less than 90 degrees using PDFBOX
has comment: http://stackoverflow.com/comment/45712408
tagged with: pdfbox
has comment: http://stackoverflow.com/comment/32624264
has comment: http://stackoverflow.com/comment/32016116
has comment: http://stackoverflow.com/comment/31884632
tagged with: http://stackoverflow.com/tag/pdf
has answer: http://stackoverflow.com/a/21178623
has comment: http://stackoverflow.com/comment/31892244
accepted answer: http://stackoverflow.com/a/21178623
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/32923626
has comment: http://stackoverflow.com/comment/32207090
has comment: http://stackoverflow.com/comment/32006037
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/31877653
has text: @CarlPalsson No. That's a client option. It's not an essential feature of POP3. You get to choose whether messages stay at or are deleted from the server. What really happens is that the client goes to extra trouble to delete the messages if you select that option.
comment on: http://stackoverflow.com/q/21174357
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/31675330
comment on: http://stackoverflow.com/q/21064023
score: 0
type: Comment
type: QuestionComment
has text: I believe the error message is telling you everything you need to know.

http://stackoverflow.com/comment/31605862
type: AnswerComment
comment on: http://stackoverflow.com/a/21025849
type: Comment
has text: @peeskillet Corrected. But just as a notice, he doesn't necessary have to call `setVisible` in the end of constructor. :)
score: 0

trim
tags question: http://stackoverflow.com/q/21062638
type: Tag
tag name: trim

http://stackoverflow.com/a/21060654
upvote count: 5
answers question: http://stackoverflow.com/q/21059171
score: 4
has body: On searching "XML-less Spring configuration" or Java-based Spring configuration you should have probably figured it out yourself within a couple of minutes. You haven't defined any bean-creatiion method which is hosted by a class that is annotated with @Configuration - so Spring is able to know what you actually want to inject. @Configuration // optional @ComponentScan(basePackages = {"name.your.package.here"} public class AppConfig { @Bean // or @Bean(name = "nameOfYourBean") public ResourcePool getResourcePool() { return new ResourcePool(); } } Within your main method you should then create a Spring context and load your AppConfig in to your context: AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfic.class); HTH
accepted answer of: http://stackoverflow.com/q/21059171
type: AcceptedAnswer
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/34847490

http://stackoverflow.com/q/21183762
tagged with: apache-httpclient-4.x
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/92773109
score: 3
has comment: http://stackoverflow.com/comment/79456042
answer count: 0
upvote count: 3
tagged with: java
tagged with: authentication
type: Question
has title: HttpAsyncClient SSL with client authentication
downvote count: 0
tagged with: ssl
has body: I want to use a HttpAsyncClient using SSL and with Client authentication (in addition to Server auth). I had some problems, but finally I found the right way. I show you how to do it: Generate keystore from PEM (PEM -> PKCS#12 keystore -> JKS keystore) Create PKCS12 keystore from private key and public certificate: sudo openssl pkcs12 -export -name myservercert -in selfsigned.crt -inkey server.key -out keystore.p12 Convert PKCS12 keystore into a JKS keystore: sudo keytool -importkeystore -destkeystore mykeystore.jks -srckeystore keystore.p12 -srcstoretype pkcs12 -alias myservercert List the contents of the JKS keystore: sudo keytool -list -v -keystore mykeystore.jks Your local JVM should trust the server Certificate. If its self-signed, add it to the cacerts (trusted certificates list; its default password is 'changeit'): sudo keytool -import -alias alias_serv_cert -file /var/tmp/CERT_SERVER.cert -keystore /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.25.x86_64/jre/lib/security/cacerts Java code to generate the client and do the POST: char[] keystorePass = "MY PASSWORD".toCharArray(); FileInputStream fis = null; //Loading KEYSTORE in JKS format KeyStore keyStorePci = KeyStore.getInstance(KeyStore.getDefaultType()); try { fis = new FileInputStream(keystoreDirectory + keystoreFilename); keyStorePci.load(fis, keystorePass); } catch (Exception e) { LOG.error("Error loading keystore: " + keystoreDirectory+ keystoreFilename); } finally { if (fis != null) { fis.close(); } } //Setting JKS keystore in SSL Context (I do not reccomend pass a 3rd argument PrivateKeyStrategy!) SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStorePci, keystorePass).build(); //Creating Async HTTP client with SSL CloseableHttpAsyncClient httpclient = HttpAsyncClients.custom().setSSLContext(sslcontext).build(); //Executing POST method try { httpclient.start(); future = httpclient.execute(httppost, new MyCustomAsyncResultManager(transactionId, transactionToken)); HttpResponse response = futur…
has comment: http://stackoverflow.com/comment/31894236
favorite count: 0
tagged with: asynchttpclient

http://stackoverflow.com/comment/39538568
has text: @Jules I updated answer and removed example code from jlibs library as it is really not the key point. Thanks for your comments.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25252425
type: Comment

http://stackoverflow.com/comment/31826483
type: Comment
has text: That's a no-go, too, I'm afraid. I'm told that I cannot make a static reference to a non-static field. It does seem to work if I give it the `static` identifier, though.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21145997

http://stackoverflow.com/comment/31725459
has text: you don't have to extend window anymore, that's also not in mine answer ;)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21038626
type: AnswerComment

http://stackoverflow.com/q/21048962
has comment: http://stackoverflow.com/comment/31647426
favorite count: 0
linked to: http://stackoverflow.com/q/16133264
has comment: http://stackoverflow.com/comment/31647641
has comment: http://stackoverflow.com/comment/31647202
has answer: http://stackoverflow.com/a/21254214
has comment: http://stackoverflow.com/comment/31647802
tagged with: android
has title: Convert Java List to Javascript Array
has answer: http://stackoverflow.com/a/21253695
score: 8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21305747
tagged with: list
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/21388728
accepted answer: http://stackoverflow.com/a/21253613
has body: I have the following java code in my Android application and wanted a way to convert the Java list to an array that can be used in javascript: Java: public void onCompleted(List&lt;GraphUser&gt; users, Response response) { for(int i = 0; i &lt; users.size(); i++) { //add to an array object that can be used in Javascript webView.loadUrl("javascript:fetchFriends(arrObj)"); } } Javascript: //this is how I want to be able to use the object in Javascript function parseFriends(usersObjectFromJava){ var users = []; for (var i = 0; i &lt; usersObjectFromJava.length; i++) { var u = { Id: usersObjectFromJava[i].id + "", UserName: usersObjectFromJava[i].username, FirstName: usersObjectFromJava[i].first_name, LastName: usersObjectFromJava[i].last_name, }; users[i] = u; } } Could some help me with the Java code to create the usersObjectFromJava so that it can be used in javascript?
upvote count: 8
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/21385091
has comment: http://stackoverflow.com/comment/31648539
has comment: http://stackoverflow.com/comment/32018641
possible better answer: http://stackoverflow.com/a/21254214
has comment: http://stackoverflow.com/comment/31647813
tagged with: javascript
has answer: http://stackoverflow.com/a/21253613
has comment: http://stackoverflow.com/comment/31648300
has comment: http://stackoverflow.com/comment/31649127
has answer: http://stackoverflow.com/a/21333816
linked to: http://stackoverflow.com/q/37945432
has comment: http://stackoverflow.com/comment/31750823
tagged with: arrays
has answer: http://stackoverflow.com/a/21253535

http://stackoverflow.com/comment/31900750
has text: You mean, start a JavaFX application from another thread than the JavaFX Application Thread? I would not recommend it. It is clearly stated in the JavaFX documentation on the link that I passed you that the different threads of the Java platform have each its proper purpose. AH! Found it! Check this out: http://docs.oracle.com/javafx/2/swt_interoperability/jfxpub-swt_interoperability.htm
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21164763
type: Comment

http://stackoverflow.com/a/21059828
type: Answer
downvote count: 0
has body: Error is because you have closed your constructor as mentioned here (check the curly braces) Two(One oneInstance, String a, String b, long c, int d, int e) {this.oneInstance = oneInstance; this.a = a; this.b = b; this.c = c; this.d = d; this.e = e;} and executable code outside block/method/constructors are not allowed , hence this line oneInstance.add(this); will throw an error. Move the above line in your constructor like this: Two(One oneInstance, String a, String b, long c, int d, int e) { this.oneInstance = oneInstance; this.a = a; this.b = b; this.c = c; this.d = d; this.e = e; oneInstance.add(this); } Just an advice: Better indentation can help you catch the syntax errors easily.
score: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21059805
answers question: http://stackoverflow.com/q/21059805
upvote count: 3

http://stackoverflow.com/a/21147759
has body: The pulltorefresh-and-loadmore/ inside that repository contains an Android library project. If you download the source code for the project, you can attach it as a library to application projects, such as in Eclipse.
score: 0
answers question: http://stackoverflow.com/q/21147672
type: Answer

http://stackoverflow.com/q/21018923
upvote count: 2
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31593141
possible better answer: http://stackoverflow.com/a/21019057
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/21019057
accepted answer: http://stackoverflow.com/a/21019110
type: Question
answer count: 2
downvote count: 0
tagged with: oracle-database
tagged with: sql
has body: i have used &amp;ls; for named query in .hbm.xml file but i am getting exception is ` org.hibernate.exception.SQLGrammarException: ORA-00920: invalid relational operator at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:122) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110) at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:129) at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81) at $Proxy14.executeQuery(Unknown Source) at org.hibernate.loader.Loader.getResultSet(Loader.java:1962) at org.hibernate.loader.Loader.doQuery(Loader.java:829) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:289) at org.hibernate.loader.Loader.doList(Loader.java:2447) at org.hibernate.loader.Loader.doList(Loader.java:2433) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2263) at org.hibernate.loader.Loader.list(Loader.java:2258) at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:331) at org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:1697) at org.hibernate.internal.AbstractSessionImpl.list(AbstractSessionImpl.java:227) at org.hibernate.internal.SQLQueryImpl.list(SQLQueryImpl.java:156) at com.sme.medialib.report.ReportDAOImpl.getAllDigAudioClipsInfo(ReportDAOImpl.java:79) at com.sme.medialib.report.ReportManagerImpl.getdigAudioClipsInfo(ReportManagerImpl.java:32) at com.sme.medialib.report.ReportManagerImpl$$FastClassByCGLIB$$bb345ddc.invoke(&lt;generated&gt;) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMetho…
has comment: http://stackoverflow.com/comment/31592957
favorite count: 0
has answer: http://stackoverflow.com/a/21019110
has title: How to use Less Then or equal (<= ) in named query in xml file

http://stackoverflow.com/comment/31666958
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21044365
has text: I went for the 1-on-1 copy-paste solution. But instead of these dependencies you could add `spring-boot-starter-data-jpa`.
type: AnswerComment

http://stackoverflow.com/q/21111492
has comment: http://stackoverflow.com/comment/31765117
has comment: http://stackoverflow.com/comment/31763112
has body: I have created a browser using swt Browser, but if I set a URL that is a pdf file it only display a black X in the top left corner. Is there a solution to make the browser display the pdf?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31766202
answer count: 0
has comment: http://stackoverflow.com/comment/31764955
tagged with: java
has comment: http://stackoverflow.com/comment/31765633
tagged with: swt
type: Question
has comment: http://stackoverflow.com/comment/31765162
has comment: http://stackoverflow.com/comment/31765199
tagged with: browser
score: 0
tagged with: http://stackoverflow.com/tag/pdf
has title: How to open pdf files in swt Browser composite

http://stackoverflow.com/q/21137561
tagged with: servlets
has comment: http://stackoverflow.com/comment/31810400
tagged with: jsf-2
answer count: 1
has body: I am trying to create a login application using JSF and servlet filter, but when user logs in nothing happens. It redirects to login page again. Here is the project directory: Here is web.xml <?xml version="1.0" encoding="UTF-8"?> javax.faces.PROJECT_STAGE Development LoginFilter javaeetutorial.guessnumber.filters.LoggedInFilter LoginFilter /secured/* Faces Servlet javax.faces.webapp.FacesServlet 1 Faces Servlet *.xhtml 30 greeting.xhtml Here is LoggedInFilter.java /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package javaeetutorial.guessnumber.filters; import java.io.IOException; import java.util.Enumeration; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import javaeetutorial.guessnumber.TestBean; /** * * @author salih */ public class LoggedInFilter implements Filter { FilterConfig fc; @Override public void init(FilterConfig filterConfig) throws ServletException { fc = filterConfig; //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { Enumeration<String> t = ((HttpServletRequest) request).getSession().getAttributeNames(); while(t.hasMoreElements()) { System.out.println(t.nextElement().toString());} TestBean loginBean = (TestBean) ((HttpServletRequest) request).getSession().getAttribute("testBean"); // For the first application request there is no loginBean in the session so user needs to log in // For other requests loginBean is present but we need to check if user has logged in successfully if (loginBean == …
has comment: http://stackoverflow.com/comment/31810422
linked to: http://stackoverflow.com/q/2633112
has answer: http://stackoverflow.com/a/21138860
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31810488
has comment: http://stackoverflow.com/comment/31810235
tagged with: jsf
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/21138860
has comment: http://stackoverflow.com/comment/31810275
type: Question
has title: Infinite loop when trying to login using Servlet Filter in JSF

http://stackoverflow.com/a/21048856
has body: Because of the statement with the operative word prior: ' prior to the println statement 8 String objects were created before (prior to) the println as you described. Another 2 were created on the println, " " and spring winter spring summer String s1 = "spring "; // "spring" created, reference s1 changed String s2 = s1 + "summer "; // "summer", "spring summer" created, "summer" not saved, reference s2 changed s1.concat("fall "); // "fall", "spring fall" created but not saved s2.concat(s1); // "spring summer spring" created but not saved s1 += "winter "; // "winter", "spring winter" created, reference s1 changed System.out.println(s1 + " " + s2); //" ", "spring winter spring summer" created, " " not saved NOTE: "created" doesn't mean created at this point in the code, just that this piece of code will ask that it be created.
accepted answer of: http://stackoverflow.com/q/21048360
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21048360
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/31651769
has comment: http://stackoverflow.com/comment/31651684
downvote count: 0
has comment: http://stackoverflow.com/comment/31651514
has comment: http://stackoverflow.com/comment/31648493
score: 4

http://stackoverflow.com/comment/32048019
score: 0
has text: Questions asking for code must demonstrate a minimal effort in solving the actual problem, including the attempted code and the encountered issues
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21154593

http://stackoverflow.com/q/21090215
tagged with: sms-gateway
score: 2
answer count: 0
downvote count: 0
tagged with: sms
tagged with: maven
tagged with: smslib
type: Question
has body: I'm trying to send SMS using SMSLib and USB GSM modem. I'm doing this in Maven project and I have following dependencies in pom.xml: org.smslib smslib dev-SNAPSHOT org.rxtx rxtx 2.1.7 commons-net commons-net 3.1 com.googlecode.jsmpp jsmpp 2.1.0 My java code is as follows: Service.getInstance().start(); Modem gateway = new Modem("ZTE", "COM5", "19200", "0000", "0000", "9800005000"); MsIsdn msIsdn = new MsIsdn("9841252521"); gateway.setSmscNumber(msIsdn); try { Service.getInstance().registerGateway(gateway); OutboundMessage outboundMsg = new OutboundMessage(msIsdn.getAddress(), "Hello there!"); Service.getInstance().send(outboundMsg); } finally { gateway.stop(); Service.getInstance().stop(); } The documentation for SMSlib states I need to define a gateway like XYZ g = new XYZ("my-username", "my-password"); From my understanding I believe this should be the Modem that's connected. I'm very new to this so I can't really understand what the parameters for the "Modem" constructor should like in Modem gateway = new Modem(gatewayId, address, port, simPin, simPin2, smscNumber,memoryLocations) OR Modem gateway = new Modem(gatewayId, parms) How do I know about the parameters gatewayId, address, simPin, simPin2 and memroyLocations? Currently, I am getting following errors when running the code: exception java.lang.reflect.InvocationTargetException sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ...... root cause java.lang.NoClassDefFoundError: Could not initialize class org.smslib.Service com.mail.utility.SendSmsUtility.sendSMS(SendSmsUtility.java:11) com.mail.action.SendSmsAction.sendSms(SendSmsAction.java:11) ......
tagged with: java
upvote count: 2
favorite count: 0
has title: How to send SMS using SMSLib
type: UnansweredQuestion

http://stackoverflow.com/comment/31836594
type: AnswerComment
has text: No, no, no!! If `getType` is `A`, and `newValue` is 0, then it will fail the second `if` and throw an exception, which is not what you want. This has a very different effect than the original code, which _never_ gets to the second `if` if `getType` is `A`.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21151601

http://stackoverflow.com/comment/31752650
has text: No, I did not name it with (2) myself. I also just restarted my PC, restarted Eclipse and started the application and it still says (2).
comment on: http://stackoverflow.com/a/21105045
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/21343878
upvote count: 284
accepted answer of: http://stackoverflow.com/q/21020347
has comment: http://stackoverflow.com/comment/52344790
has comment: http://stackoverflow.com/comment/32511728
type: AcceptedAnswer
score: 284
downvote count: 0
has comment: http://stackoverflow.com/comment/101841923
has comment: http://stackoverflow.com/comment/131617667
has comment: http://stackoverflow.com/comment/94419582
has comment: http://stackoverflow.com/comment/101834094
type: Answer
has comment: http://stackoverflow.com/comment/39567417
has comment: http://stackoverflow.com/comment/52364122
has comment: http://stackoverflow.com/comment/62219063
has comment: http://stackoverflow.com/comment/39563125
answers question: http://stackoverflow.com/q/21020347
has comment: http://stackoverflow.com/comment/98472822
has body: You need to adjust three (or four) properties: Consumer side:fetch.message.max.bytes - this will determine the largest size of a message that can be fetched by the consumer. Broker side: replica.fetch.max.bytes - this will allow for the replicas in the brokers to send messages within the cluster and make sure the messages are replicated correctly. If this is too small, then the message will never be replicated, and therefore, the consumer will never see the message because the message will never be committed (fully replicated). Broker side: message.max.bytes - this is the largest size of the message that can be received by the broker from a producer. Broker side (per topic): max.message.bytes - this is the largest size of the message the broker will allow to be appended to the topic. This size is validated pre-compression. (Defaults to broker's message.max.bytes.) I found out the hard way about number 2 - you don't get ANY exceptions, messages, or warnings from Kafka, so be sure to consider this when you are sending large messages.

http://stackoverflow.com/a/21106317
has body: What library are you using for your C++ sockets? You might try flushing the stream?
answers question: http://stackoverflow.com/q/21106256
score: 0
type: Answer

communication
tag name: communication
tags question: http://stackoverflow.com/q/21104454
type: Tag

http://stackoverflow.com/q/21158004
answer count: 5
type: UnansweredQuestion
has title: check whether a number conforms to the template 'ddd-dd-dddd'
has answer: http://stackoverflow.com/a/21158098
tagged with: java
has comment: http://stackoverflow.com/comment/31847411
type: Question
has answer: http://stackoverflow.com/a/21158127
has comment: http://stackoverflow.com/comment/31847450
has body: The question is: Add a static method boolean isValidNumber(String aNumber). Check whether the number conforms to the template 'ddd-dd-dddd', where every 'd' in the template stands for a digit and the '-' for a '-' character. Can please anybody give a hint how to do it?
has answer: http://stackoverflow.com/a/21158152
tagged with: boolean
score: 0
has answer: http://stackoverflow.com/a/21158109
has answer: http://stackoverflow.com/a/21158166

http://stackoverflow.com/q/21096507
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21097932
answer count: 4
has answer: http://stackoverflow.com/a/21099016
has comment: http://stackoverflow.com/comment/31736623
score: 2
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/21100574
has answer: http://stackoverflow.com/a/21098548
type: Question
tagged with: concurrency
tagged with: executor
has comment: http://stackoverflow.com/comment/31736155
downvote count: 0
has body: Summary: I'm trying to parallelize my system using ThreadPoolExecutor and I'm running into a deadlock issue. I know WHY I'm getting the issue, but I'm not very familiar with concurrency in context of java so I'm not sure what classes/methods to use: Simple Example: My code parses a large xml-like tree, and then spawns a thread for the top level instruction. This thread runs; as it executes, it reads more of the xml tree and spawns more threads on the same ThreadPoolExecutor (I use 1 pool because there is a user-defined maximum). This happens until the xml tree is consumed. When enough parent threads end up in the threadpool and all their child threads are still in the queue, they deadlock (because the parent threads are blocked on their children threads, who aren't running). Let's say my tree is Parent thread Child Thread A Child Child Thread A1 Child Child Thread A2 Child Child Thread A3 Child Thread B Child Thread C I will now have the Parent thread, A, B, C, A1, A2, and A3 as threads. Let's assume my max threadpool is 2. This means that in the way it was parsed, P, A are in the thread pool and everything else is in the thread queue. Here, every non leaf node will be blocked on the leaf nodes. Since the leaf nodes were parsed last, they aren't even in the threadpool (and instead in the queue). Thusly the leaf children never run, and the whole system is deadlocked. Question: Is there some method call to kick the parent thread out of the running threadpool as soon as it creates child threads? I'm wary of using callbacks because my system can initiate concurrency optionally, so I don't really want to clutter code on the children classes to call back on a parent thread that may not even exist. Also, how should I go about implementing some sort of thread queue picking algorithm (priority/clock/etc); is ThreadPoolExecutor the right class to be using? Thanks.
favorite count: 0
has title: Deadlocking /w ThreadPoolExecutor

http://stackoverflow.com/a/21084984
has comment: http://stackoverflow.com/comment/31716925
has comment: http://stackoverflow.com/comment/31715148
has comment: http://stackoverflow.com/comment/31714328
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21084940
has comment: http://stackoverflow.com/comment/31714354
answers question: http://stackoverflow.com/q/21084940
type: Answer
downvote count: 0
score: 1
has body: look at this question: Is there a way to find/replace across an entire project in Eclipse? search --> file you can use a regex to search and there's a replace option. as for a regexp that would capture your methods, you could try: Music2.playGeneric2\(context, R\.raw\.([^)]*)\)(.*) that would set the 2nd argument (technically everything after the 1st argument up to the close-bracket as the 1st capture group, and the rest of the line as the 2nd capture group. you could then replace with something like: Music2.playGeneric2(context, "$1")$2 to quote the 2nd argument

http://stackoverflow.com/comment/31922395
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21177186
has text: You should be able to turn off serialization somehow. That's really your only option if you want to use both SDK's at the same time because even if you were to get the flags fields to match with both SDK's then the next issue you would have would be that each language would likely serialize similar types in different way. I can ask around to figure out the best way to handle this. I'll try to post back later.

http://stackoverflow.com/a/21076390
has comment: http://stackoverflow.com/comment/31697999
has comment: http://stackoverflow.com/comment/31698059
has comment: http://stackoverflow.com/comment/31697972
has comment: http://stackoverflow.com/comment/31697948
answers question: http://stackoverflow.com/q/21076274
has body: Seems like your condition is never evaluated at all public static boolean isValidMove( int nRow,int nCol ) { boolean blValid = false; if( ( nRow &gt;= 0 &amp;&amp; nRow &lt; 3 ) &amp;&amp; ( nCol &gt;= 0 &amp;&amp; nCol &lt; 3 ) ) { if ( arTakenSquare[ nRow ][ nCol ] == false ) { blValid = true; } } return blValid; } May be this would help.
score: 0
type: Answer

http://stackoverflow.com/q/21049257
has comment: http://stackoverflow.com/comment/31648215
has comment: http://stackoverflow.com/comment/31648026
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31648174
tagged with: swing
has title: insert values of jtextfield into data base ,
has answer: http://stackoverflow.com/a/21049512
type: Question
has comment: http://stackoverflow.com/comment/31648557
tagged with: java
has body: I am trying to insert what user will write in jtexfield into my database , but my code dosn't work , even it don't show where's the mistake , but i found that gettext() return nothing , please help me import java.awt.BorderLayout; import java.awt.Button; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.Label; import java.awt.Panel; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.sql.SQLException; import java.sql.Statement; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JTextField; public class frame_ajouter extends JFrame { public JTextField T1; public JTextField T2; public JTextField T3; public JTextField T1() { return T1; } public JTextField T2() { return T2; } public JTextField T3() { return T3; } /** * */ public static void afficher() { frame_ajouter jFrame = new frame_ajouter(); Panel p_ajouter = new Panel(); final JTextField T1 = new JTextField(); final JTextField T2 = new JTextField(); final JTextField T3 = new JTextField(); jFrame.setSize(new Dimension(500, 200)); jFrame.setTitle(" /**** AJOUTER ****/"); p_ajouter.setLayout(new GridLayout(4,2)); p_ajouter.add(new Label(" NOM D'ETUDIANT :")); p_ajouter.add(T1); p_ajouter.add(new Label(" PRENOM ETUDIANT :")); p_ajouter.add(T2); p_ajouter.add(new Label(" FILIERE ETUDIANT :")); p_ajouter.add(T3); jFrame.add(p_ajouter, BorderLayout.NORTH ); Panel p_under_ajout = new Panel(); p_under_ajout.setLayout(new FlowLayout()); Button b1 = new Button("AJOUTER"); Button b2 = new Button("ANNULER"); p_under_ajout.add(b1); p_under_ajout.add(b2); jFrame.add(p_under_ajout, BorderLayout.SOUTH ); b1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { req_ajouter cp = new req_ajouter(); cp.ajt(); } }); jFrame.addWindowListener(new WindowA…
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31648325
tagged with: sql
has comment: http://stackoverflow.com/comment/31648263
has answer: http://stackoverflow.com/a/21049412
has comment: http://stackoverflow.com/comment/31648028

http://stackoverflow.com/q/21118547
has comment: http://stackoverflow.com/comment/31777931
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31779490
has body: I'm currently using Eclipse for a project and also the Play! Framework. I wanted to add buttons to this dropdown in Eclipse that say : Play Start myfile1 play stop myfile1 play start myfile2 play stop myfile2 I have it for one project but not a new project I am starting. I'm not setting them up right because i keep getting an error: 'Launching play1 start filename' has encountered a problem. Exception occurred executing command line. I don't know how I'm messing it up. Something to do with where the locations I'm setting? Here is the first screen in configurations that i am trying and it isn't working. Help would be appreciated. Thanks!
has answer: http://stackoverflow.com/a/21118667
tagged with: eclipse
answer count: 2
tagged with: playframework
has answer: http://stackoverflow.com/a/21147156
downvote count: 0
accepted answer: http://stackoverflow.com/a/21147156
tagged with: eclipse-plugin
favorite count: 0
possible better answer: http://stackoverflow.com/a/21118667
type: AnsweredQuestion
score: 1
tagged with: java
has title: Adding Play! Framework play start and stop to eclipse

http://stackoverflow.com/a/21145635
answers question: http://stackoverflow.com/q/21145452
has comment: http://stackoverflow.com/comment/31878996
type: Answer
score: 7
has comment: http://stackoverflow.com/comment/31877728
upvote count: 7
has body: Yes, it's quite possible, and just like that. From the pertinent part of the docs: defprotocol will automatically generate a corresponding interface, with the same name as the protocol, i.e. given a protocol my.ns/Protocol, an interface my.ns.Protocol. The interface will have methods corresponding to the protocol functions, and the protocol will automatically work with instances of the interface. And, to answer your question: A Java client looking to participate in the protocol can do so most efficiently by implementing the protocol-generated interface.
has comment: http://stackoverflow.com/comment/31866833
downvote count: 0

http://stackoverflow.com/comment/31655126
comment on: http://stackoverflow.com/a/21053002
type: AnswerComment
has text: I changed and checked again. But bean creation exception still exists.
score: 0
type: Comment

http://stackoverflow.com/q/21092779
tagged with: 64-bit
downvote count: 1
type: AnsweredQuestion
tagged with: 32bit-64bit
linked to: http://stackoverflow.com/q/20639049
accepted answer: http://stackoverflow.com/a/21092994
score: 1
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/21092956
has title: Will a program run on 32bit OS, when written on 64bit OS?
answer count: 3
favorite count: 0
possible better answer: http://stackoverflow.com/a/21092964
has body: i am currently writing a java program with eclipse on my 64bit Ubuntu laptop. I use a browser from ecplise.swt which has to be 64bit to run in eclipse. Question is: if i export my program, will it run on an 32 bit linux machine? (specific: Raspbian on a Raspberry Pi) (side note: I am still having problems with the browser on my ubuntu. question here )
tagged with: linux
has answer: http://stackoverflow.com/a/21092964
has answer: http://stackoverflow.com/a/21092994
upvote count: 2

http://stackoverflow.com/comment/31710411
score: 0
comment on: http://stackoverflow.com/q/21082536
type: Comment
type: QuestionComment
has text: Thanks for your input. I tried adding try{} finally{} blocks to all the locks, however I was unfortunately able to reproduce the error.

http://stackoverflow.com/q/21127030
has comment: http://stackoverflow.com/comment/31810934
downvote count: 0
linked to: http://stackoverflow.com/q/5827164
tagged with: executable-jar
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31795709
has body: OS: Windows 7 x64 IDE: Eclipse [ latest version ] Eclipse JRE: [ as bellow ] JDK: 1.7.0_51 JRE: 1.7.0_51_b13 [ came with JDK ] Path: C:\Program Files (x86)\Java\jre7\bin\javaw.exe [ established ] The executable jar has been created using Eclipse>Export>Executable Jar>... Manifest-Version: 1.0 Class-Path: . Main-Class: pfp.beta.Main The Main class does actually exist inside package specified in manifest file. I can successfully run the application using CMD with administrative rights, however fail to do so without administrative rights. I've entered manually a new entry into PATH and it didn't work. I've used jarfix in order to fix the problem. The fix has shown no result. I've removed all Java products from the system and installed them clean. I've checked for old versions and removed those as well. I've looked up all the threads here on stackoverflow and none of them fixed my problem. Currently I deploy *.bat file with java -jar NAME_OF_THE_FILE.jar inside the same folder as *.jar file to run the program. I would like to get to the bottom of this issue and run it by double-clicking the icon. The program executes on double-click, however it is my believe - it doesn't locate the main class to progress further.
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Java / Executable Jar works with cmd / doesn't work with double-click

http://stackoverflow.com/a/21169627
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21169200
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21169200
type: Answer
has body: Try setting the caret position at the end of the text: progress.setCaretPosition(progress.getText().length()) The following example works for me: import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.SwingUtilities; public class Test extends JFrame { private JTextArea txtTest; Test() { this.setSize(500, 300); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLayout(new BorderLayout()); JScrollPane pane = new JScrollPane(); txtTest = new JTextArea(); pane.setViewportView(txtTest); this.add(pane, BorderLayout.CENTER); JButton btnAddText = new JButton("Add Text"); btnAddText.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtTest.setText(txtTest.getText() + "\nLorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi sagittis id nibh vel rhoncus. "); String text = txtTest.getText(); txtTest.setCaretPosition(text != null ? text.length() : 0); } }); this.add(btnAddText, BorderLayout.SOUTH); this.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new Test(); } }); } }
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31868591

http://stackoverflow.com/comment/31610070
has text: No, don't do that. Instead make sure that the string is correct in the first place. It has to come from somewhere, using the correct encoding there will do the trick.
type: Comment
comment on: http://stackoverflow.com/a/21028153
score: 0
type: AnswerComment

http://stackoverflow.com/q/21032017
has comment: http://stackoverflow.com/comment/31617598
type: AnsweredQuestion
score: 3
downvote count: 0
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/21032261
has answer: http://stackoverflow.com/a/21032213
has answer: http://stackoverflow.com/a/21032261
has title: Java Class.cast() and Overload
tagged with: overloading
upvote count: 3
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/31618551
has body: I'm trying to code a packet listener for a little server. I'm very new to Java and this is the first time i mess around with networking. The whole idea it's recive the packet, match the packet id with it's class, pass the input stream to the constructor of the packet so it can be constructed and then give it to the packetHander, wich will have an overladed method for each packet. To achive this im using an array that maps the packets ids to the classes of each one, and using a method called decode to construct the packet. The problem it's the overloading of handlePacket it's not behaving as expected. Lets see some code. I've the packet listener running in a thread and the run method looks like this: public void run() { try { int packet_id; while ((packet_id = istream.readInt()) != -1) { plugin.getServer().getConsoleSender().sendMessage("[Comm] Recived packet " + packet_id); Packet packet = decode(packet_id, istream); plugin.getServer().getConsoleSender().sendMessage("[Comm] Packet is " + Class.forName(packet.getClass().getName())); plugin.getServer().getConsoleSender().sendMessage("[Comm] Class is " + Packet00ReqIdentify.class.cast(packet).getClass().getName()); plugin.getServer().getConsoleSender().sendMessage("[Comm] Class is " + Class.forName(packet.getClass().getName()).getName()); handlePacket(packet); } } catch (IOException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | ClassNotFoundException e) { e.printStackTrace(); } } The decode and handlePacket methods looks like this: private void handlePacket(Packet00ReqIdentify packet) throws IOException { plugin.getServer().getConsoleSender().sendMessage("[Comm] Got it!"); } private void handlePacket(Packet packet) { plugin.getServer().getConsoleSender().sendMessage("[Comm] Woops!"); } private Packet decode(int packet_id, PacketInputStream istream) throws NoSuchMethodException, SecurityException, InstantiationExcept…
tagged with: double-dispatch
tagged with: casting
has answer: http://stackoverflow.com/a/21032598
accepted answer: http://stackoverflow.com/a/21032213
tagged with: class

http://stackoverflow.com/comment/31688007
has text: @user2871898 all It is, is a helper method to make the code cleaner. You can use either way, the first code block, or a combination of the second and third.
comment on: http://stackoverflow.com/a/21070630
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31866994
type: Comment
has text: Please explain this sentence "when i am setting the city information I need to set the country name". Where? You want to set the country name in a field of the city?
comment on: http://stackoverflow.com/a/21168602
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31805333
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21133720
type: AnswerComment
has text: Thank you for your time and answer,finally i've solved that with creating an in between class for <UserLists>, i will try your solution later and again i appreciate your help

http://stackoverflow.com/comment/31638520
type: Comment
type: QuestionComment
has text: Have you possibly searched with [query](https://www.google.com/#q=java+8+stream+api+example) on Google? There are quite a number of examples on the first result page!
comment on: http://stackoverflow.com/q/21043924
score: 1

http://stackoverflow.com/comment/31611555
type: QuestionComment
comment on: http://stackoverflow.com/q/21028942
has text: Why do the Strings need to be equal in length? Just because the precision in decimal is the same doesn't mean the binary representation will be.
score: 0
type: Comment

http://stackoverflow.com/comment/31817621
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21141521
has text: I don't think it's a duplicate because adding the junit jar file did not fix this problem.
score: 0

tcp
type: Tag
tags question: http://stackoverflow.com/q/21079435
tags question: http://stackoverflow.com/q/21135673
tags question: http://stackoverflow.com/q/21076554
tags question: http://stackoverflow.com/q/21155026
tags question: http://stackoverflow.com/q/21067551
tags question: http://stackoverflow.com/q/21073024
tags question: http://stackoverflow.com/q/21074336
tags question: http://stackoverflow.com/q/21109382
tag name: tcp

jmf
tags question: http://stackoverflow.com/q/21051901
tags question: http://stackoverflow.com/q/21168247
tag name: jmf
type: Tag
tags question: http://stackoverflow.com/q/21171945

http://stackoverflow.com/q/21066765
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21066882
downvote count: 1
type: Question
has body: I'm kind of new to Java and I'm working on a program with multiple nested loops that display JOPtionPane.showMessageDialog boxes. I want to be able to press a key to stop the whole process(preferably ESCAPE, but if that won't work, I could use any key that will). To test out the idea, I've tried making a simple infinite loop and tried to implement a KeyListener, but I don't know if I'm on the right track. And advice or an example or adding to my code would be so helpful.(I took out all my previously problematic code for the KeyListener) import javax.swing.JOptionPane; public class DBinfinite { public static void main(String[] args) { int x = 0; while (x &gt;= 0) { JOptionPane.showMessageDialog(null, x); x++; } } }
has title: How to exit looping dialog boxes by pressing a key?
tagged with: java
score: -1
upvote count: 0
answer count: 1

http://stackoverflow.com/q/21165915
possible better answer: http://stackoverflow.com/a/21450901
tagged with: xtext
has comment: http://stackoverflow.com/comment/32162749
has answer: http://stackoverflow.com/a/21337397
upvote count: 18
has answer: http://stackoverflow.com/a/21334162
accepted answer: http://stackoverflow.com/a/21334162
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21450901
tagged with: java
has comment: http://stackoverflow.com/comment/32160453
has body: I'm puzzled by this error: java.lang.NoClassDefFoundError: junit/framework/TestCase at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:792) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188) at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClassHoldingLock(ClasspathManager.java:638) ... at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:693) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:429) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62) at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:23) ... Caused by: java.lang.ClassNotFoundException: junit.framework.TestCase cannot be found by org.eclipse.xtext.junit_2.4.3.v201309030823 at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 78 more The exception happens when I run the tests for my Xtext DSL as plugin tests (i.e. when a new Eclipse platform is started internally). This happens before any of my code is executed. When I look at the plugin dependencies, I can see that org.junit_4.11.0.v201303080030.jar is on the classpath and I also see /.../workspace/.metadata/.plugins/org.eclipse.pde.core/.exter…
score: 17
type: Question
has answer: http://stackoverflow.com/a/28561897
tagged with: junit4
tagged with: eclipse
downvote count: 1
has title: ClassNotFoundException: junit.framework.TestCase cannot be found by org.eclipse.xtext.junit_2.4.3.v201309030823
favorite count: 0

http://stackoverflow.com/a/21184048
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21183797
answers question: http://stackoverflow.com/q/21183797
type: AcceptedAnswer
has body: This view can be useful when you would like to use a method requiring a Queue but you need Lifo ordering. The method just wrap the deque argument, so the you can work on an Queue implementations. As you say, the queue is just a stack, but the javadoc of the Stack class say: A more complete and consistent set of LIFO stack operations is provided by the Deque interface and its implementations, which should be used in preference to this class. For example: Deque&lt;Integer&gt; stack = new ArrayDeque&lt;Integer&gt;(); Deque is just more complete than Stack and the method asLifoQueue is just an utility to convert a deque to a stack-like data structure.

http://stackoverflow.com/a/21096957
type: Answer
has comment: http://stackoverflow.com/comment/31736510
score: 1
has body: You need to declare the variable outside the if statement, then assign it inside. String[] menuArray; if(menuList.size != 0){ writeToFile("Menu List", menuList); menuArray = menuList.toArray(new String[menuList.size()]); } else { menuArray = readFromFile("Menu List"); }
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21096929
upvote count: 1
answers question: http://stackoverflow.com/q/21096929
has comment: http://stackoverflow.com/comment/31736950

http://stackoverflow.com/comment/31904417
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21185027
type: AnswerComment
has text: I put the file under `/project/build/classes`, and I tried what you were proposing. I get a `NullPointerException` in this line `File f = new File(url.getPath());`. After that, I tried `System.out.println(url.getPath());` and got the exception as well, so it seems that the class can't access the file. Is it misplaced? Or do I have to change like classpath?

http://stackoverflow.com/comment/61505886
type: Comment
has text: That fixed it for me
type: AnswerComment
comment on: http://stackoverflow.com/a/21138511
score: 0

http://stackoverflow.com/a/21112454
answers question: http://stackoverflow.com/q/21111719
score: 4
type: AcceptedAnswer
has body: You must create a new Hyperlink object every time you want to create a hyperlinked cell. When you call setHyperlink on the Cell object, it sets a reference to itself for a hyperlink. Here's an extract from the org.apache.poi.xssf.usermodel.XSSFCell class (lines 913 - 921 in version 3.9): public void setHyperlink(Hyperlink hyperlink) { XSSFHyperlink link = (XSSFHyperlink)hyperlink; // Assign to us link.setCellReference( new CellReference(_row.getRowNum(), _cellNum).formatAsString() ); // Add to the lists getSheet().addHyperlink(link); } It becomes evident by looking at link.setCellReference(... method call.
type: Answer
accepted answer of: http://stackoverflow.com/q/21111719
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/31752898
has text: @user1988876 Not with this program, it's actually `Integer.parseInt("42")` because `args[0]` will have the `String` value `42`.
comment on: http://stackoverflow.com/a/21105545
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/21116344
score: 0
has answer: http://stackoverflow.com/a/21116985
answer count: 1
tagged with: jquery
type: UnansweredQuestion
tagged with: java
has body: vehicleinfo.js function updateWCPolicyPresentValue(changedValue){ var url = $.url($(this).prop('href')); var id = url.param('id'); alert(id); if(confirm("Change will apply to all vehicles for this policy. Is it okey?")){ $.ajax({ url: '&lt;s:url action="wcPolicyPresentVehicleInformationAction" namespace="/" /&gt;? changedValue='+changedValue+'&amp;keepUrlRegistry=true', cache : false, success : alert(changedValue) }); }else{ $.unblockScreen(); } return false; } Struts-cpp.xml &lt;action name="*VehicleInformationAction" method="{1}" class="com.sbi.fremont.bindexpress.cpp.web.action.VehicleInformationAction"&gt; &lt;result name="input" type="tiles"&gt;vehicleInformationPageCpp&lt;/result&gt; &lt;result name="load" type="redirectAction"&gt;inputVehicleInformationAction?id=${selectedId}&amp;amp;loadType=${loadType}&amp;amp;fleetMessage=${fleetMessage}&lt;/result&gt; &lt;/action&gt; In here, I am trying to call vehicleInformationAction java class via ajax request but it is not calling. I want to check that is there any mistake in ajax format?
type: Question
has title: Not Calling java Action via Ajax in jQuery
has comment: http://stackoverflow.com/comment/31772704
tagged with: struts2

http://stackoverflow.com/comment/31664620
score: 0
type: AnswerComment
has text: I have to wait for two days to accept my own answer. And I couldn't delete it since it has been answered.
type: Comment
comment on: http://stackoverflow.com/a/21058060

http://stackoverflow.com/comment/31672252
score: 1
comment on: http://stackoverflow.com/a/21062098
type: AnswerComment
type: Comment
has text: @user2181194 a word of advice: don't just look at the solution, read the rest of the answer, it'll help you in the future.

http://stackoverflow.com/q/21055807
has comment: http://stackoverflow.com/comment/31661119
has body: I have the following collection: private Map &lt;String, Staff&gt; staff; Implemented as a TreeMap: staff = new TreeMap &lt;String, Staff&gt; (); I need to iterate over the values in this map, but when I try the following code I'm getting an incompatible types compilation error. I can't understand why this is; the values in my map are Staff objects and it.HasNext() should be returning them to be stored in the staffMember variable, which should be fine to my knowledge?? Help much appreciated. Collection &lt;Staff&gt; staffList = staff.values(); Iterator it = staffList.iterator (); while ((isJobAssigned = false) ||it.hasNext()) { Staff staffMember = it.next(); if ((staffMember instanceof Typist) &amp;&amp; (jobType.equalsIgnoreCase("Typist"))) { newJob.setJobState ("Assigned"); staffMember.setState("Working"); return newJon.getJobNo() + " Staff allocated: " + staffMember.getName () + ", ID: " + staffMember.getId(); }
upvote count: 3
has title: Java Iterating Over a TreeMap - incompatible types
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21055829
score: 3
has comment: http://stackoverflow.com/comment/31660679
tagged with: java
tagged with: treemap
type: Question
answer count: 2
tagged with: iterator
has answer: http://stackoverflow.com/a/21055868
downvote count: 0
accepted answer: http://stackoverflow.com/a/21055829
favorite count: 0
tagged with: iteration
possible better answer: http://stackoverflow.com/a/21055868

http://stackoverflow.com/a/51312713
upvote count: 1
has body: Another approach is to change JBOSS logging properties to both rotate log file based on time and size. Below is the way I did it and it works greatly for me. &lt;periodic-size-rotating-file-handler name="FILE" autoflush="true"&gt; &lt;formatter&gt; &lt;named-formatter name="PATTERN"/&gt; &lt;/formatter&gt; &lt;file relative-to="jboss.server.log.dir" path="server.log"/&gt; &lt;suffix value=".yyyy-MM-dd"/&gt; &lt;append value="true"/&gt; &lt;max-backup-index value="4"/&gt; &lt;rotate-size value="10000k"/&gt; &lt;encoding value="UTF-8"/&gt; &lt;/periodic-size-rotating-file-handler&gt;
type: Answer
answers question: http://stackoverflow.com/q/21083960
downvote count: 0
score: 1

http://stackoverflow.com/a/21035896
has body: First of all, you don't install the framework into the IDE -- you use it to program your Java application, which is independent of any IDE like Eclipse. Secondly, Spring doesn't provide an all-in-one download link -- instead, you need to use a build tool like Maven or Gradle. This is so that all of the dependencies, such as the Apache logging library you also downloaded, can be automatically provided. Otherwise you would have to manage all of them yourself, and there are quite a lot!
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21035606

http://stackoverflow.com/a/21059196
type: Answer
upvote count: 2
has body: Not sure why you're trying to use a input dialog. A input dialog will return the value entered into the input field or null if the dialog was dismissed, this doesn't seem to be what you really want... Instead, try using a standard input dialog.... List&lt;String&gt; optionList = new ArrayList&lt;String&gt;(); optionList.add("1"); optionList.add("2"); Object[] options = optionList.toArray(); int value = JOptionPane.showOptionDialog( null, "Please select your encryption Algorithm:(1 or 2)\n 1. Data Encryption Standard(DES) \n 2. Advanced Encryption Standard(AES)", "Pick", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, optionList.get(0)); String opt = optionList.get(value); System.out.println("You picked " + opt);
has comment: http://stackoverflow.com/comment/31667311
answers question: http://stackoverflow.com/q/21059080
has comment: http://stackoverflow.com/comment/31667539
accepted answer of: http://stackoverflow.com/q/21059080
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31667388

http://stackoverflow.com/a/21187030
answers question: http://stackoverflow.com/q/21154400
has body: My solution to this was to reinstall jdk 1.7.45, uninstall netbeans and reinstall it selecting the outdated jdk. Don't know if there is a way to change sdk in NB without reinstalling it but it worked this way.
has comment: http://stackoverflow.com/comment/32436407
has comment: http://stackoverflow.com/comment/34234711
score: 0
has comment: http://stackoverflow.com/comment/31900825
type: Answer

http://stackoverflow.com/comment/31881872
score: 0
type: Comment
type: AnswerComment
has text: PS don't forget to close
comment on: http://stackoverflow.com/a/21176559

http://stackoverflow.com/a/21142175
upvote count: 4
has comment: http://stackoverflow.com/comment/31818297
downvote count: 0
has comment: http://stackoverflow.com/comment/31818509
has comment: http://stackoverflow.com/comment/31820646
type: Answer
has comment: http://stackoverflow.com/comment/31821019
has comment: http://stackoverflow.com/comment/31822368
answers question: http://stackoverflow.com/q/21141965
has body: First step is to write a whole bunch of System.out.println("1"); To narrow down where the problem is happening. It would also be helpful to print out the value of some important variables. As alluded to in other answers, this: boolean done = false; System.out.println("1"); while(done) { System.out.println("2"); ... } System.out.println("3"); outputs this: 1 3 Which should be a pretty big clue.
has comment: http://stackoverflow.com/comment/31818883
score: 4

http://stackoverflow.com/q/21047122
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/31643775
upvote count: 1
tagged with: android
has comment: http://stackoverflow.com/comment/31643646
has comment: http://stackoverflow.com/comment/31643623
has title: Writing an app using more than one language
tagged with: python
has comment: http://stackoverflow.com/comment/31643529
type: AnsweredQuestion
tagged with: java
has body: I'm currently working on an android app and i'm using Eclipse. I know that Eclipse is used for writing java, but if you were creating an app in many different languages, would you have to write the entire program from scratch for each language? If not what would be the same? Plus, what would be the best program to write it in?
type: Question
tagged with: c#
has answer: http://stackoverflow.com/a/21047273
accepted answer: http://stackoverflow.com/a/21047273
answer count: 1
downvote count: 1

http://stackoverflow.com/comment/31707771
has text: only dependency needed for using struts2 is the struts2-core one (org.apache.struts|struts2-core|2.3.16). You could also use a tomcat-maven-plugin for local testing (org.apache.tomcat.maven|tomcat6-maven-plugin|2.2) and then use mvn tomcat:run on your project location. Otherwise there doesn't seem to be anything wrong with your web.xml or your struts.xml and they are in the correct place according to what you post (if there is an index.jsp at src/main/webapp) . Full stacktrace + pom would be handy to see.
comment on: http://stackoverflow.com/q/21080174
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21139098
answer count: 1
favorite count: 0
tagged with: ical4j
has comment: http://stackoverflow.com/comment/31814294
downvote count: 0
type: UnansweredQuestion
score: 1
has body: I want to use ical4j in order to send event to users. When I execute this code : CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_UNFOLDING, true); // Create a TimeZone TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry(); TimeZone timezone = registry.getTimeZone("Europe/Paris"); VTimeZone tz = timezone.getVTimeZone(); I getting this error ; Exception in thread "main" java.lang.NoClassDefFoundError: edu/emory/mathcs/backport/java/util/concurrent/ConcurrentHashMap at net.fortuna.ical4j.util.CompatibilityHints.&lt;clinit&gt;(CompatibilityHints.java:85) at net.fortuna.ical4j.model.Iso8601.&lt;init&gt;(Iso8601.java:78) at net.fortuna.ical4j.model.Date.&lt;init&gt;(Date.java:133) at net.fortuna.ical4j.model.DateTime.&lt;init&gt;(DateTime.java:244) at jconge_batches.TestCalendar.main(TestCalendar.java:106) Caused by: java.lang.ClassNotFoundException: edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap 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) ... 5 more I have added ical4j.jar in my classpath. How I can resolve this error?
tagged with: java
has title: Error when using ical4j.jar Java
tagged with: icalendar
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/21150338
upvote count: 1

http://stackoverflow.com/q/21026793
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/21029513
tagged with: maven
has answer: http://stackoverflow.com/a/21111527
tagged with: signed-applet
type: AnsweredQuestion
score: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/21029513
has comment: http://stackoverflow.com/comment/31827355
tagged with: java
has title: Can Maven re-sign dependencies?
has answer: http://stackoverflow.com/a/21123822
has answer: http://stackoverflow.com/a/21253668
type: Question
accepted answer: http://stackoverflow.com/a/21253668
has body: I'm using maven-jarsigner-plugin to sign a shaded uber-jar of mine. I do need to distribute some dependencies in their own jars though, and want to take those jars from a Maven repo, clear them of any existing signatures, and sign them with my own certificate. Are there any Maven plugins that do this, or would i involve some Ant plugin hackery?
upvote count: 3
tagged with: jar-signing
tagged with: applet
linked to: http://stackoverflow.com/q/2162830

http://stackoverflow.com/a/21066487
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/31705840
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31679842
type: Answer
has comment: http://stackoverflow.com/comment/31679867
accepted answer of: http://stackoverflow.com/q/21066413
has body: When serializing using Gson, you're creating a parse tree and Gson does the writing; unfortunately it does not offer the feature of telling it to pass through a field in your class because it's already JSON. The way you'd have to do it is use the com.google.gson.JsonParser class to give you a JsonElement: JsonElement cachedArray = new JsonParser().parse(src.cachedJson); element.addProperty("names", cachedArray); Because this means you're deserializing the cached JSON so that gson can later write out the whole parse tree, it may make more sense to cache your JSON as a JsonArray instead. Edit to add: Worth mentioning is that the Jackson JSON parser does offer this serialization feature. You can annotate a field or method with @JsonRawValue and it passes it through.
score: 1
answers question: http://stackoverflow.com/q/21066413

http://stackoverflow.com/comment/31640748
score: 0
type: AnswerComment
has text: @kleopatra I think this is what I tried to do in my question example but did not succeed?
type: Comment
comment on: http://stackoverflow.com/a/21045136

http://stackoverflow.com/comment/31657313
comment on: http://stackoverflow.com/a/21053320
has text: The downside of `/lib` is that all `WAR`s in the system will have to use the same version of the JDBC driver. That's one of the big reasons usually cited against using `/lib`, but for JDBC the benefits outweigh the costs.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21111644
score: 5
has comment: http://stackoverflow.com/comment/89922687
type: Answer
answers question: http://stackoverflow.com/q/21105403
has body: To mock static method you should use a Powermock look at: https://github.com/powermock/powermock/wiki/MockStatic. Mockito doesn't provide this functionality. You can read nice a article about mockito: http://refcardz.dzone.com/refcardz/mockito
downvote count: 2
upvote count: 7

http://stackoverflow.com/q/21111779
tagged with: jdbc
duplicate of: http://stackoverflow.com/q/847246
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/31763095
linked to: http://stackoverflow.com/q/4569956
tagged with: java
has answer: http://stackoverflow.com/a/21111947
tagged with: eclipse
duplicate of: http://stackoverflow.com/q/4569956
downvote count: 1
tagged with: servlets
type: Question
has body: Does anyone know if there is a database connection testing utility or database ping utility available? Or is there a JRE component that has certain commands to ping database connections? Our Java servlet connects to Oracle and SQL server databases. We can easily check the connections are okay on development machines as they have Eclipse installed and are within our Firewall. But our Live servlet server is outside the Firewall and we cannot install Eclipse on that machine. Any assistance is appreciated. Thank you in advance
answer count: 1
has title: Ping Database Utility
linked to: http://stackoverflow.com/q/847246
score: 0

http://stackoverflow.com/q/21134593
tagged with: imagej
has title: Coordinate Rotation
score: 0
has body: I need to rotate the coordinates of the pixels of an image (or a matrix). My aim is to calculate, for each point, where it will be positioned after a rotation, and vice versa. I'm currently using this procedure: private void setRot(int i) { this.rot = -i / (180.0 / Math.PI); this.coseno = Math.cos(rot); this.seno = Math.sin(rot); } private Point ruota(int x, int y){ int centerY=h/2; int centerX=w/2; int j = (int) (coseno * (x-centerX) - seno * (y-centerY) + centerX); int i = (int) (seno * (x-centerX) + coseno * (y-centerY) + centerY); return new Point(j,i); } However, if you apply a test, using the method for each pixel, the result is not rotated about the center. private void esegui() { for(int i=0;i&lt;w;i++) for(int j=0;j&lt;h;j++){ Point p = ruota(i,j); //ip : origina image | ip2 destination image ip2.putPixel(p.x, p.y, ip.getPixel(i, j)); } nu.setProcessor(ip); // destination image nu.repaintWindow(); } Would someone help me make a proper rotation in one direction and in the other? this is my Test Class: private int getH(){ //height of destination image return (int) (this.h*Math.abs(coseno) + this.w*Math.abs(seno)); } private int getW(){ return (int) (this.plus.getHeight()*Math.abs(seno) + this.plus.getWidth()*Math.abs(coseno)); } public Test(){ // class test IJ.open(); this.plus = IJ.getImage(); ip = plus.getProcessor(); this.h = this.plus.getHeight(); // height of start image this.w = this.plus.getWidth(); setRot(14); // rotation of 14° dHeight = this.getH(); // dimension of the target image dWidth = this.getW(); System.out.println("h "+h+" gh " + getH()); System.out.println("w "+w+" gw " + getW()); // create an image target this.nu = NewImage.createRGBImage("rotate", getW(), getH(), 1, NewImage.FILL_BLACK); ip2 = nu.getProcessor(); esegui(); nu.setProcessor(ip2); nu.show(); }
tagged with: coordinate
has comment: http://stackoverflow.com/comment/31804772
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31805775
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31806502
has comment: http://stackoverflow.com/comment/31804944
has comment: http://stackoverflow.com/comment/31807455
has comment: http://stackoverflow.com/comment/31809356
type: Question

http://stackoverflow.com/a/21068043
type: Answer
has body: The onclick event handler should look like this @Override public void onClick(View v) { Intent i = new Intent(MainActivity.this, ABOUT.class); startActivity(i); }
score: 0
has comment: http://stackoverflow.com/comment/31683528
answers question: http://stackoverflow.com/q/21067981

http://stackoverflow.com/q/21154381
has title: Spring Batch -Remote partitioning
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/57494990
score: 2
answer count: 1
downvote count: 0
favorite count: 0
tagged with: spring-batch
upvote count: 2
type: UnansweredQuestion
has body: Currently, we are migrating a batch job from java to spring batch. This batch job gets its input from the database and web service. We need to run this job in four servers for increased performance as this job is handling huge data. Is the above scenario achievable through remote partitioning in spring batch?
tagged with: spring

http://stackoverflow.com/comment/31790674
comment on: http://stackoverflow.com/q/21126367
score: 0
type: Comment
type: QuestionComment
has text: The missing code (the initialization of `deck`) may be where the problem lies.

http://stackoverflow.com/a/26548547
score: 5
has comment: http://stackoverflow.com/comment/41787905
has comment: http://stackoverflow.com/comment/41796590
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21161586
has comment: http://stackoverflow.com/comment/41720033
type: Answer
has comment: http://stackoverflow.com/comment/41783585
answers question: http://stackoverflow.com/q/21161586
has comment: http://stackoverflow.com/comment/41734036
has comment: http://stackoverflow.com/comment/41804659
has comment: http://stackoverflow.com/comment/41723747
has body: So why does it work for IOUtils? The eclipse team did something very plain - they hardcoded the methods! In previous versions of eclipse the warning was also there however starting from version 4.3 M4 it was gone since they fixed it: Released for 4.3 M4 via commit 277792ba446c3713bcfdc898c37875d45fc06c18. The fix covers the following well-known methods: - com.google.common.io.Closeables.closeQuietly(Closeable) - com.google.common.io.Closeables.close(Closeable,boolean) - org.apache.commons.io.IOUtils.closeQuietly(Closeable) For details see here - especially at the comments at the end... UPDATE: So what does it mean for you? You have to use one of the obove methods or live with the warning. The check is basically not sophisticated and doesn't check the next level. Update II: They basically hardcoded the file names. Maybe it is easer to understand with source code. Imagine this is the eclipse code checking for the warning: public boolean showResourceWarning(){ //do somestuff to detect whether a potential ressource warning is shown ... if(resourceLeakWarning){ if(this.checkForExceptions()){ return false; } } return resourceLeakWarning; } private boolean checkForExceptions(){ if(name.equals("org.apache.commons.io.IOUtils.closeQuietly(Closeable)"){ return true; } if(name.equals("com.google.common.io.Closeables.close(Closeable,boolean)")){ return true; } if(name.equals("org.apache.commons.io.IOUtils.closeQuietly(Closeable)")){ return true; } // code executed for your method: return false; } => The result is, that you don't have a chance to remove the warning other to directly use close() (not in a sub method!) or to use one of the three methods listed above. Update III: Have a look at the following class TypeConstants.java. Do you see the hardwired names in there? If you want to make it work with your code you need to add your class and method name there and then recompile eclipse. Then look at the class MessageSend.java starting from line 90.
upvote count: 5

http://stackoverflow.com/comment/83805119
has text: I see now https://stackoverflow.com/a/34930831/1520422 shows nicely that it actually works as announced. Yet i still don't understand HOW it works. But i'm fine with "it works". Thanks!
score: 2
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21172732

http://stackoverflow.com/comment/31662404
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21035597
has text: That's two answers to three questions.

http://stackoverflow.com/comment/31893865
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21182430
has text: So you are saying that for the upper span elements if the span elements are not having specific element text, still for them I will be getting the text, which is coming from the inner span element with respect to that upper element,where the inner element is having the specific text of it's own.
type: Comment

http://stackoverflow.com/q/21018694
tagged with: jpa
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: JPA GenerationType.AUTO and setting the field manually
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31593078
type: Question
has body: I have an entity bean which has an id int field declared as GenerationType.AUTO so that the ID is automatically generated: @Entity public class CustomerPool implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; //setters getters } I need however to make sure the first CustomerPool that is inserted has an ID of 0. I thought that setting a CustomerPool with the id of 0 would have had precedence over the directive instead I'm having different behaviours (using JPA over EclipseLink) but mostly the ID that I set is ignored. So is it possible to set an ID as automatically generated if not indicated otherwise to use the specified ID if indicated? Somehow I was used to doing that in PHP and seemed pretty natural behaviour to me.
tagged with: java
has answer: http://stackoverflow.com/a/21023083
tagged with: eclipselink
upvote count: 1

http://stackoverflow.com/a/21097940
accepted answer of: http://stackoverflow.com/q/21096854
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21096854
type: AcceptedAnswer
has body: You have a trailing slash at the end of the regex. You can also remove one of the slashes at the beginning. Try this: /pages/project/[ec].*
type: Answer

http://stackoverflow.com/comment/32035866
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21022240
has text: `defaultHtmlEscape` from spring which escapes html characters. Security team wants us to escape those special characters as well in the output.

http://stackoverflow.com/comment/31700993
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21072357
has text: Perf problems with the PIDE will be ongoing for years; they're more of a bug-type report. From appearances, there's only 1 person who singlehandedly develops Isa/jEdit, which is Wenzel. He also seems to track down problems that aren't necessarily his fault which other devs report, which involve Isa/jEdit. He generally responds on the isa-mail-list for bug-type reports. On the isa-mail-list, I think it's pretty well known that Isa2013-2 didn't get it completely right. I already reported several things which can totally hang the PIDE, but that's part of progress. I take the good with the bad.
score: 0

http://stackoverflow.com/comment/31786846
type: QuestionComment
comment on: http://stackoverflow.com/q/21123972
type: Comment
has text: @Ewald Yes, I inserted some trace outputting and the app doesnt even reach there which assures me that the CPU doesnt schedule the java app at all when the other two apps are running
score: 0

http://stackoverflow.com/comment/31864176
type: Comment
type: QuestionComment
has text: Did you initialize `EntityManagerFactory emf`?
comment on: http://stackoverflow.com/q/21167307
score: 0

http://stackoverflow.com/q/21021368
answer count: 3
has body: I am developing a JavaFX application. When building my project, I noticed that my jar folder can't be opened when I changed its place. I checked my jar folder and i found that my lib folder is missing . How can I fix this problem?
has title: How can a .jar folder be portable?
tagged with: executable-jar
tagged with: jar
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21021687
has comment: http://stackoverflow.com/comment/31597258
tagged with: javafx-2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21022491
has answer: http://stackoverflow.com/a/21021404
score: 0

http://stackoverflow.com/comment/31721966
type: QuestionComment
has text: if you get OOM,is because of your bitmaps, to solve this try to follow the steps from [HERE](http://developer.android.com/training/displaying-bitmaps/display-bitmap.html) also it will be better to use normal ListView instead of card ListVIew (as the creator of the card ListView wrote it can give you OOM bevause it doesn't have recylce mechanism like ListView)
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21089161

http://stackoverflow.com/comment/31629839
score: 0
has text: So u use the same server for Prod as well as DEv?
comment on: http://stackoverflow.com/q/21038355
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21022977
score: 2
has comment: http://stackoverflow.com/comment/31603367
has comment: http://stackoverflow.com/comment/31602170
downvote count: 0
has comment: http://stackoverflow.com/comment/31601695
has comment: http://stackoverflow.com/comment/31601825
has body: The smallest unit of digital sound is a sample -- the signal level at a particular point in time. [But see addendum below.] To use Java to manipulate it: If you have to ask this question, you probably want to go looking for libraries someone else has written. But if you want to know in general what's involved: Read in the sound file. If it was in a compressed format (such as MP3), unpack it. That will give you a very long array/vector of samples. You can cut-and-paste sections of that to edit the recording, or scale it to make it softer or louder (beware of "clipping", which results when you try to exceed the maximum volume). More complicated manipulations are possible, but that's a full course in digital signal processing which I'm not going to try to do here -- websearch that phrase, especially in conjunction with sound or audio or music should find more information. You can also generate your own audio by producing the samples programmatically. A signal which varies sinusoidally from sample to sample produces a pure tone. Other repeating shapes add overtones of various kinds. Varying the frequency of the repetition changes the pitch. Adding several signals together (while watching out for clipping) mixes them into a single signal. And so on. Note that MIDI is not "digital sound" -- it's a digital score. It describes what notes should be played when, but it's up to the synth to turn that into sound. ADDENDUM: I haven't heard the term "frame" before (see Andrew's answer), but I'll believe it. I think of samples because I'm thinking at the hardware layer, but distinguishing that from sample meaning an audio clip is a Good Thing so I'd bet frame is indeed more correct/current.
has comment: http://stackoverflow.com/comment/31601139
upvote count: 2
has comment: http://stackoverflow.com/comment/31601882
type: Answer
has comment: http://stackoverflow.com/comment/31606071
has comment: http://stackoverflow.com/comment/31602041
has comment: http://stackoverflow.com/comment/31600866
answers question: http://stackoverflow.com/q/21022554
has comment: http://stackoverflow.com/comment/31600870
has comment: http://stackoverflow.com/comment/31601190
has comment: http://stackoverflow.com/comment/31601486

http://stackoverflow.com/comment/31727834
has text: You don't happen to use GreenRobots EventBus, do you?
score: 0
comment on: http://stackoverflow.com/q/21092588
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21182942
tagged with: compiler-errors
tagged with: swing
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/21182983
has body: As the topic says, I am having issues with this snippet of code. On last line I get both; Syntax error on token(s), misplaced construct(s) Syntax error on token UpperCaseButton, VariableDeclaratorId expected after this token: static JToggleButton UpperCaseButton = new JToggleButton("Upper Case"); static JToggleButton LowerCaseButton = new JToggleButton("Lower Case"); //ButtonGroup for the Toggelbuttons ButtonGroup group = new ButtonGroup(); group.add(UpperCaseButton); I am a bit confused here, so please help.
tagged with: buttongroup
type: Question
tagged with: jtogglebutton
accepted answer: http://stackoverflow.com/a/21182983
has title: Whats wrong with my ButtonGroup? Compiler error
answer count: 1

http://stackoverflow.com/comment/31708608
has text: Thanks for your reply. The line: font = Font.createFont(Font.TRUETYPE_FONT, getClass().getAsStream("/CUSTOMFONT-MEDIUM.TTF")) won't complile: "The method "getAsStream(String)" is undefined for the type Class<capture#17 [...]" Do you understand what the problem is here?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21081821

http://stackoverflow.com/q/21046671
upvote count: 1
has body: I am working on an application which has a database which stores the data of the user, but due to security reason we decided to encrypt the database. But in my (MFC)application I have launched a program of java(jar file launched form MFC application) which will upload a file on cloud and store the time of upload in database. Before their was no encryption so all went smooth, but now the database is encrypted and my java application fails to read the database. In my java application am using External Jar file names sqlite-jdbc-3.7.15-M1.jar and have done the connection in the following way. Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:IDPWD.idp"); System.out.println("Opened database successfully"); DatabaseMetaData dbm = c.getMetaData(); // check if "employee" table is there ResultSet tables = dbm.getTables(null, null, "FileDwnlTable", null); if (tables.next()) { c.setAutoCommit(false); stmt = c.createStatement(); String sql = "UPDATE FileDwnlTable set DWNL_TIME = '" + LocalSysTime + "' where ID=1;"; System.out.println(sql); stmt.executeUpdate(sql); c.commit(); stmt.close(); c.close(); Now how can I open/read the encrypted database. In C++, MFC I have provided key which can be used and open the database and do the DataBase operations the command used in c++ , mfc is try{ db-&gt;open(DB_NAME); TRACE(_T("database opened")); db-&gt;key((char*)csPassword.GetBuffer(), csPassword.GetLength()); }catch(CppSQLite3Exception e){ return NULL; } by using this we open our encrypted database and then do the operation. So how can I do the same in my Java application? Also the key (SHA1 Key) can be passed to the jar file , so the only question remains how can I open the database in JAVA using this key and do the operation on the same database?
type: Question
tagged with: mfc
has comment: http://stackoverflow.com/comment/31666070
has title: Read Encrypted sqlite3 database in java which is created and encrypted in mfc C++
tagged with: sqlite
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: encryption
has comment: http://stackoverflow.com/comment/31665844
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/31621188
has text: have you tried following documentation? http://docs.oracle.com/javase/7/docs/technotes/guides/net/http-auth.html
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21033787

http://stackoverflow.com/comment/31614556
type: Comment
type: QuestionComment
score: 0
has text: The app is supposed to look like this (scroll down and it the launch button): http://docs.oracle.com/javase/tutorial/uiswing/learn/index.html Instead it looks like this: http://imgur.com/VemmvE5
comment on: http://stackoverflow.com/q/21030400

http://stackoverflow.com/comment/31730714
comment on: http://stackoverflow.com/a/21094124
type: AnswerComment
score: 0
has text: Well in the example, you just added one single object to the array. So the array is redundant as there is only one element in it.
type: Comment

http://stackoverflow.com/a/21597805
score: 63
downvote count: 3
has comment: http://stackoverflow.com/comment/34611973
upvote count: 66
has body: Just Go To *Startmenu >>Java >>Configure Java >> Security >> Edit site list >> copy and paste your Link with problem >> OK Problem fixed :)*
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34479713
has comment: http://stackoverflow.com/comment/64218563
has comment: http://stackoverflow.com/comment/53609964
accepted answer of: http://stackoverflow.com/q/21157450
type: Answer
answers question: http://stackoverflow.com/q/21157450
has comment: http://stackoverflow.com/comment/70610662
has comment: http://stackoverflow.com/comment/51939409

http://stackoverflow.com/a/21157895
has body: public void onClick(View v) { Intent intent = new Intent(A.this, B.class); startActivity(intent); finish(); }
score: 0
answers question: http://stackoverflow.com/q/21157169
type: Answer

android-imageview
tags question: http://stackoverflow.com/q/21061119
type: Tag
tag name: android-imageview

http://stackoverflow.com/a/21072749
upvote count: 2
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/115035106
has comment: http://stackoverflow.com/comment/31691349
has body: First get the appropriate jar, and add it to your class path. Then you can use Class.forName("com.mysql.jdbc.Driver"); DriverManager.getConnection("jdbc:mysql://localhost/test?" + "user=monty&amp;password=greatsqldb"); But you do not use Class.forName("java.sql.DriverManager");.
has comment: http://stackoverflow.com/comment/31691398
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/31691379
accepted answer of: http://stackoverflow.com/q/21072728
answers question: http://stackoverflow.com/q/21072728

http://stackoverflow.com/comment/31874971
type: Comment
type: QuestionComment
score: 0
has text: Actually, I also had to get the Comparator of the TableView manually for the .compareTo() function, but it works now!
comment on: http://stackoverflow.com/q/21171948

http://stackoverflow.com/comment/31746255
has text: Sorry, reading your code more thoroughly... i was going to recommend calling the buffered reader the first time out of the loop, checking while (stringLine.equalsIgnoreCase), then doing another buffered reader call at the end of the while loop. This should work, but it seems you've fixed it! :)
comment on: http://stackoverflow.com/a/21101409
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21223195
has comment: http://stackoverflow.com/comment/119223915
downvote count: 0
answers question: http://stackoverflow.com/q/21126221
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/119224005
upvote count: 1
has body: You can write a program to create a JAXBContext on your domain model and then call the generateSchema method on the JAXBContext to generate the XML Schema. Example import java.io.IOException; import javax.xml.bind.*; import javax.xml.transform.Result; import javax.xml.transform.stream.StreamResult; public class Demo { public static void main(String[] args) throws Exception { JAXBContext jc = JAXBContext.newInstance(PageableResponse.class); jc.generateSchema(new SchemaOutputResolver() { @Override public Result createOutput(String namespaceURI, String suggestedFileName) throws IOException { return new StreamResult(suggestedFileName); } }); } }
has comment: http://stackoverflow.com/comment/32149460

http://stackoverflow.com/comment/31886805
score: 0
comment on: http://stackoverflow.com/q/21179145
type: Comment
type: QuestionComment
has text: I think that there (here are a few versions, by various authors) is JSpinner, search how to align text for this JComponent (see API)

http://stackoverflow.com/comment/31822130
has text: oh. I am sorry. I have edited the post so that it has the entire piece of code. If you take this code and compile it will work exactly how it works for me at the moment. Thanks for clarifying it for me.
comment on: http://stackoverflow.com/a/21122057
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42983930
has text: It's not pointless to 'trust everybody' in some cases http://stackoverflow.com/questions/27255015/mule-https-connectors-that-trust-all-certificates
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21156929
score: 0

http://stackoverflow.com/q/21142168
type: AnsweredQuestion
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/21142300
upvote count: 60
tagged with: persistence.xml
tagged with: jpa-2.1
score: 60
tagged with: jpa
downvote count: 0
answer count: 1
favorite count: 0
has title: How to specify JPA 2.1 in persistence.xml?
accepted answer: http://stackoverflow.com/a/21142300
has body: A quick search on the Net reveals three or four variants how folks have been specifying xmlns and xsi:schemaLocation in persistence.xml. What would be the 'correct' manner to specify JPA version 2.1? I'm using &lt;persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"&gt;
has comment: http://stackoverflow.com/comment/50993735

http://stackoverflow.com/q/21158391
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21158894
type: Question
has title: threads in a servlet Google appengine Java (for serializing data from XML to blob, pipedinput, pipedoutput)
has answer: http://stackoverflow.com/a/21158894
score: 0
answer count: 1
tagged with: google-app-engine
has body: How does one know when a Thread one started in a Google Appengine servlet has completed its assigned tasks. I am using pipedinput and pipedoutput to get information put XML into a Blob. That is the XML Serializer outputs to one end of the pipe. A thread reads the other end of the pipe and puts data into the Blob. I know that one must use the ThreadFactory, newThread function to activate the thread One cannot use the standard technique from Java of calling Thread.start(). T TT; TT = new T(); java.util.concurrent.ThreadFactory TF; TF = com.google.appengine.api.ThreadManager.currentRequestThreadFactory(); TF.newThread(TT); Here is how I declare and create my Runnable: class T implements Runnable { public void run(){ FileWriteChannel writeChannel=null; try { Here is the code to create the Thread. Note that when I declare type T to implement the Thread, I get the security exception below: class T implements Runnable { public void run(){ FileWriteChannel writeChannel=null; try { ... If I start up a class that extends Thread, Google Appengine gives me run time error. If I do a "implements" runnable, that is TT in the example above, is an instance of an ojbect thwt inmpelements Thread, then, I do not have access to the join capability, which is defined in the Thread class, but not the runnable. Thread Error java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThreadGroup") at java.security.AccessControlContext.checkPermission(AccessControlContext.java:375) at java.security.AccessController.checkPermission(AccessController.java:565) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at com.google.apphosting.runtime.security.CustomSecurityManager.checkPermission(CustomSecurityManager.java:56) at com.google.apphosting.runtime.security.CustomSecurityManager.checkAccess(CustomSecurityManager.java:131) at java.lang.ThreadGroup.checkAccess(ThreadGroup.java:315)* I am doing the read from the PipedInputStream in a separate thr…

http://stackoverflow.com/comment/31641322
has text: Could you give some example of what you want to achieve?
score: 0
comment on: http://stackoverflow.com/q/21045820
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31803719
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21133962
has text: And which line is 52?

http://stackoverflow.com/q/21041142
favorite count: 0
has body: I have the following JAVA method implemented due a interface: public String importDocument(ImportSource source, Map&lt;String, ? extends Object&gt; paramMap); When i try to do following, i get an compile warning. Snippet: paramMap.put("Key", "Value"); Error: The method put(String, capture#1-of ? extends Object) in the type Map is not applicable for the arguments (String, String) Why?
has answer: http://stackoverflow.com/a/21041168
type: AnsweredQuestion
has title: Method in the type Map<String,capture#1-of ? extends Object> is not applicable
accepted answer: http://stackoverflow.com/a/21041168
tagged with: compiler-errors
downvote count: 0
tagged with: java
type: Question
score: 31
upvote count: 31
answer count: 1
linked to: http://stackoverflow.com/q/17834145
tagged with: generics

http://stackoverflow.com/q/21039049
has title: SEVERE: ContainerBase.addChild: start:org.apache.catalina.LifecycleException: Failed to start error
has answer: http://stackoverflow.com/a/56265294
tagged with: java
has answer: http://stackoverflow.com/a/49386187
has answer: http://stackoverflow.com/a/30756441
has answer: http://stackoverflow.com/a/24052797
has answer: http://stackoverflow.com/a/48915652
has answer: http://stackoverflow.com/a/36964526
type: Question
tagged with: illegalstateexception
has answer: http://stackoverflow.com/a/67301954
has answer: http://stackoverflow.com/a/70293364
has answer: http://stackoverflow.com/a/41155626
has answer: http://stackoverflow.com/a/31461901
has answer: http://stackoverflow.com/a/39432993
tagged with: tomcat
has answer: http://stackoverflow.com/a/72770200
has answer: http://stackoverflow.com/a/21331295
score: 50
has body: I encountered this error when I tried to run my application in Tomcat. I already checked the version of tomcat and java home. Both use java 6. Is there a missing jar? Or is it my web xml? I'm not using any maven tool. SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ICard]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:650) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1582) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.NoClassDefFoundError: javax/xml/rpc/handler/soap/SOAPMessageContext at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2904) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDecla…
has answer: http://stackoverflow.com/a/34175012
has answer: http://stackoverflow.com/a/36467101
answer count: 21
has answer: http://stackoverflow.com/a/63135223
downvote count: 0
upvote count: 50
has answer: http://stackoverflow.com/a/43903650
favorite count: 0
has answer: http://stackoverflow.com/a/44273304
linked to: http://stackoverflow.com/q/35224311
has answer: http://stackoverflow.com/a/48699972
tagged with: web.xml
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/30802363
has answer: http://stackoverflow.com/a/60725822
has comment: http://stackoverflow.com/comment/99038275

http://stackoverflow.com/a/21096718
accepted answer of: http://stackoverflow.com/q/21089662
has comment: http://stackoverflow.com/comment/31737969
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21089662
has comment: http://stackoverflow.com/comment/31739128
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31757843
has comment: http://stackoverflow.com/comment/31774816
has body: The only real difference is that JRockit is specifically tuned to work with Weblogic so you'll see performance improvements. Memory settings will change when picking one or the other as well. There are two easy ways to guarantee what JVM your server uses when it is started: You can explicitly set the JVM on the 'Server Start' tab for a managed server. This only applies when the server is started via the nodemanager. Set both BEA_JAVA_HOME and SUN_JAVA_HOME in the setDomainEnv.sh file. We set them both to the same value because we always want a particular JVM Like you said, there are other places the value can be set but I think the above 2 options are the easiest way to go.
type: Answer

http://stackoverflow.com/comment/31678805
type: AnswerComment
comment on: http://stackoverflow.com/a/21065778
score: 0
has text: I used just a System.out System.out.println("return test method: " + wordObj.test(wordObj.wordsList));
type: Comment

http://stackoverflow.com/comment/31882835
has text: Yes, that's the default `toString()` returned from a char array. Instead do, `System.out.println(java.util.Arrays.toString(arrays));`
comment on: http://stackoverflow.com/q/21177294
type: QuestionComment
type: Comment
score: 3

http://stackoverflow.com/a/21163453
score: 107
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/82959243
has comment: http://stackoverflow.com/comment/108683666
has comment: http://stackoverflow.com/comment/58942885
type: Answer
has body: This answer is outdated. Continue to Basil Bourque's answer. java.util.Date date; Timestamp timestamp = resultSet.getTimestamp(i); if (timestamp != null) date = new java.util.Date(timestamp.getTime())); Then format it the way you like.
upvote count: 107
accepted answer of: http://stackoverflow.com/q/21162753
has comment: http://stackoverflow.com/comment/82980222
answers question: http://stackoverflow.com/q/21162753
has comment: http://stackoverflow.com/comment/82968080
has comment: http://stackoverflow.com/comment/76563644

http://stackoverflow.com/comment/31843103
has text: CPU first examines store buffer. Only if address is not there then makes a load request, otherwise values from store buffer is loaded.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21150002
type: Comment

http://stackoverflow.com/a/21068632
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/21068440
has comment: http://stackoverflow.com/comment/31754501
has body: Your project has to have a builder set for it. If there is not one Eclipse will default to Ant. Which you can use you have to create an Ant build file, which you can Google how to do. It is rather involved though. This is not required to run locally in Eclipse though. If your class is run-able. It looks like yours is, but we can not see all of it. If you look at your project build path do you have an output folder selected? If you check that folder have the compiled class files been put there? If not the something is not set in Eclpise for it to know to compile. You might check to see if auto build is set for your project.
upvote count: 1
score: 0

http://stackoverflow.com/comment/82579510
has text: Solved problem after following the steps even though selecting SDK for edit shown a message saying "Nothing to do".
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/36132885
type: Comment

http://stackoverflow.com/comment/31719242
comment on: http://stackoverflow.com/q/21087659
has text: That website just use raw text to display the captcha code, not image.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21166352
tagged with: java
tagged with: rsa
has title: Printing an RSA private key doesn't actually return it
accepted answer: http://stackoverflow.com/a/21209113
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/31862373
favorite count: 0
has answer: http://stackoverflow.com/a/68501016
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21166439
has answer: http://stackoverflow.com/a/21209113
upvote count: 3
has answer: http://stackoverflow.com/a/21166439
has body: I'm trying to generate a public/private keypair to use for SSH in Java, this is just a test class to make sure I'm generating the right kind of key. However, when I go to print the private key to console, it doesn't print the full private key. Here's my sourcecode: import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.security.spec.InvalidKeySpecException; public class Crypto { public static void main(String[] args) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeySpecException { KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA"); keyGen.initialize(1024); KeyPair test = keyGen.genKeyPair(); System.out.println(test.getPrivate()); System.out.println(test.getPublic()); } } I'm running Java JDK 1.7_45, this is the full console output when run within eclipse: sun.security.rsa.RSAPrivateCrtKeyImpl@2bd00 Sun RSA public key, 1024 bits modulus: &lt;removed because it's so long&gt; public exponent: 65537 The string after the @ symbol keeps changing, however I don't believe it to actually be the private key. Thanks in advance for any help guys! EDIT: I'm sorry guys I didn't actually ask my question, I simply stated my problem. My full question is: How do I access the private key as a regular String?
type: Question
score: 3

http://stackoverflow.com/a/21062489
has body: If you respected the usual conventions, you would write your class like this: public class ParkingLot { private int max; private Car[] cars = new Car[max];//if instead of "max" i put any other positive integer, it works just fine. int nr = 0; public ParkingLot(int max) { this.max = max; } public void addCar(Car c) { cars[nr++] = c; public int getMax() { return max; } } And it would become more obvious that at the moment the cars array is initialized, the constructor body hasn't been run yet, so max has the default value: 0. You need to initialize the array inside the constructor, after max has been initialized: public class ParkingLot { private int max; private Car[] cars; int nr = 0; public ParkingLot(int max) { this.max = max; this.cars = new Car[max]; } public void addCar(Car c) { cars[nr++] = c; } public int getMax() { return max; } }
upvote count: 1
answers question: http://stackoverflow.com/q/21062427
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/36567405
upvote count: 1
answers question: http://stackoverflow.com/q/21115342
downvote count: 0
type: Answer
has body: The documentation for this plugin is a joke. A workaround is to manually extract the contents from the client jar after it is created like follows: org.jvnet.jax-ws-commons jaxws-maven-plugin 2.3 wsimport -clientjar ${project.build.directory}/wsimport-client.jar https://webservice.com/service.wsdl 2.1 true org.apache.maven.plugins maven-antrun-plugin 1.7 process-resources <unzip src="${project.build.directory}/wsimport-client.jar" dest="${project.build.directory}/classes" /> run taken from here: https://gist.github.com/mpellegrini/5439304
score: 1

http://stackoverflow.com/a/21068899
has comment: http://stackoverflow.com/comment/32064260
has comment: http://stackoverflow.com/comment/32066130
has comment: http://stackoverflow.com/comment/32046380
score: 4
has comment: http://stackoverflow.com/comment/32062721
accepted answer of: http://stackoverflow.com/q/21068483
upvote count: 4
answers question: http://stackoverflow.com/q/21068483
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/32064648
has body: To export a plugin you can use File menu -> Export -> Plugin Development/Deployable plug-ins and fragments. Then select you plugin and it will be exported as a jar. To export a product, there is a product exporting option in .product file. I would suggest you to created a separate plug-in by using "Plug-in from existing JAR archives" option in the "New Project" wizard. If so, then I hope you didn't forget to include it to your run configuration. Also, please check this question for more details. Update: You are neither required, nor forced to convert your jars to bundles, but since your are not creating a pure Java project (you have an OSGI bundle, with its own classloader and lifecycle), you may want to take into consideration some best practices/rules, which could help you creating a good plugin/project. Why you need to convert dependencies to bundles? You already have your third party dependency (log4j, apache commons collections etc.,) as jars and all you need to do is add it to your bundle classpath. This is simple and it works as long as you are developing only one bundle or your bundles do not share common dependencies. But, in reality, you might be creating a bunch of bundles and they all would use common dependencies. The problem here is in the way OSGi classloading works. Each bundle has it's own classloader and so if you have two bundles both using log4j as jar dependency in their classpath, and when you try to reference log4j in each of the bundles, each would try create their own instances of the log4j classes in their respective classloaders. This might cause classloader constraint violation issues or ClassCastExceptions. If you convert these dependencies to OSGi bundles, then these problems would no longer happen. This is because now each of your dependency (say log4j) has it's own classloader and so whenever your Bundle A or Bundle B want to load log4j class, it will load it from log4j bundle classloader. Please refer to this article for more informa…
type: Answer

http://stackoverflow.com/a/67969716
has body: For me temporarily removing the following dependency from the plugin management section solved it for me. org.eclipse.m2e lifecycle-mapping 1.0.0 The previous error message: Execution default-cli of goal org.codehaus.mojo:versions-maven-plugin:2.8.1:display-plugin-updates failed: For artifact {null:null:null:jar}: The groupId can not be empty. -> [Help 1]
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21183418

http://stackoverflow.com/a/21089084
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/31722571
has body: Replace this line- pd = new ProgressDialog(getActivity().getApplicationContext()); with- pd = new ProgressDialog(getActivity()); beacuse you need the progressdialog only in the Activity you are in.
has comment: http://stackoverflow.com/comment/31722294
has comment: http://stackoverflow.com/comment/31722445
has comment: http://stackoverflow.com/comment/31722152
answers question: http://stackoverflow.com/q/21088815
has comment: http://stackoverflow.com/comment/31721713
has comment: http://stackoverflow.com/comment/31721372
has comment: http://stackoverflow.com/comment/31721361
has comment: http://stackoverflow.com/comment/31722012

http://stackoverflow.com/a/21082300
has body: At the moement, based on you example, you should be getting an exception as ... select from customer_details (customer_name,contact_no) where customer_id=? is not a valid query. It should look more like select customer_name, contact_no from customer_details where customer_id=?
type: Answer
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21082268

http://stackoverflow.com/q/21178981
has title: How to add header and footer on each page using ITextRenderer
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: spring-mvc
downvote count: 0
score: 1
tagged with: java
tagged with: itext
has body: I am stuck to the following condition where i need to generate pdf. What i am doing is String A=" Some start html content" String B="here the string is create **dynamic** where this can be of any length" String C=here its end section of html..... " String finalHtml=A+B+C; In my controller in using ITextRenderer in order to generate the PDF. The content of my controller is shown below. @RequestMapping(value="/genratePdf",method=RequestMethod.GET) public void getPdfGenration(HttpServletRequest request,HttpServletResponse response){ response.setContentType("application/pdf"); StringBuffer buf = new StringBuffer(); buf.append(finalHtml); try{ DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = builder.parse(new StringBufferInputStream(buf.toString())); ITextRenderer renderer = new ITextRenderer() renderer.layout(); java.io.OutputStream os = response.getOutputStream(); renderer.createPDF(os); os.flush(); os.close(); }catch (Exception ex) { ex.printStackTrace(); } This works fine and return me pdf but the problem i am facing is to put header content on every page .Any help or suggestion. I am using spring 3.1.and jar i used is iText-paulo-155.jar, itext-2.1.0.jar Thanks in advance.
type: Question
has answer: http://stackoverflow.com/a/21179573

http://stackoverflow.com/q/21091924
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21092036
linked to: http://stackoverflow.com/q/4932462
tagged with: android-fragments
tagged with: java
type: Question
has body: I am new to Android development. I am creating an application with Fragments. Following is the Diagram. Home screen is having the root access to all the other screens. Sales is a ViewPager and all the other screens after sales are part of it. User can slide and access. But I do have a problem. I am planning to use one FragmentActivity for this application. It is the Home. Home screen is a collection of buttons, with images. If the user click on 'Sales' button then the Home screen flips just like ViewPager animation and access Sales screen; if the user click on 'TimeManager' button then the Home screen flips just like ViewPager animation and access TimeManager screen and so on. Following is the code of the HomeScreen public class MainActivity extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.home); } Now imagine I am in Sales screen. As I mentioned earlier, it has sequence of pages (New Lead and EditInfo) where the user can access by sliding. So it should be a ViewPager. Based on the above information, I have to ask 2 questions. While in Home screen, how user can click on the button and make the screen slide to access the next screen? When the user is in next screen (ex: To Do List) I prefer to let him slide right to go back to the Home screen. If this is not possible, at least pressing back button should do the sliding. How can I do this? This contains application only one FragmentActivity and the FragmentActivity class contains the UI of Home screen. So where should I put the ViewPager of Sales screen? Sales is a Fragment and not FragmentActivity. So how can I facilitate it to navigate to NewLead and Edit Info pages via ViewPager? Please help. UPDATE Since I am adviced to use a Fragment for ViewPager I would like to know whether it is best to create a seperate fragment for ViewPager. Below is the code. What is your …
tagged with: android-viewpager
tagged with: android-fragmentactivity
score: 0
has title: Using ViewPager component
tagged with: android
answer count: 1

http://stackoverflow.com/comment/53029774
score: 0
type: Comment
has text: i have used your solution and got one problem it works fine when the pdf contains text but when i have tried with pdf created using image it is not found working gives error on this line Image image = page.getImage(width, height, rect, null, true, true );
type: AnswerComment
comment on: http://stackoverflow.com/a/21071630

multithreading
tags question: http://stackoverflow.com/q/21082875
tags question: http://stackoverflow.com/q/21102759
tags question: http://stackoverflow.com/q/21110803
tags question: http://stackoverflow.com/q/21101407
tags question: http://stackoverflow.com/q/21078476
tags question: http://stackoverflow.com/q/21062167
tags question: http://stackoverflow.com/q/21019656
tags question: http://stackoverflow.com/q/21033735
tags question: http://stackoverflow.com/q/21048510
tags question: http://stackoverflow.com/q/21104223
type: Tag
tags question: http://stackoverflow.com/q/21028117
tags question: http://stackoverflow.com/q/21101864
tags question: http://stackoverflow.com/q/21143996
tags question: http://stackoverflow.com/q/21125717
tags question: http://stackoverflow.com/q/21046111
tags question: http://stackoverflow.com/q/21164732
tags question: http://stackoverflow.com/q/21075173
tags question: http://stackoverflow.com/q/21112739
tags question: http://stackoverflow.com/q/21176667
tags question: http://stackoverflow.com/q/21044357
tags question: http://stackoverflow.com/q/21150180
tags question: http://stackoverflow.com/q/21132736
tags question: http://stackoverflow.com/q/21066910
tags question: http://stackoverflow.com/q/21071519
tags question: http://stackoverflow.com/q/21054060
tags question: http://stackoverflow.com/q/21096212
tags question: http://stackoverflow.com/q/21158165
tags question: http://stackoverflow.com/q/21080162
tags question: http://stackoverflow.com/q/21126905
tags question: http://stackoverflow.com/q/21167628
tags question: http://stackoverflow.com/q/21124277
tags question: http://stackoverflow.com/q/21161449
tags question: http://stackoverflow.com/q/21135870
tags question: http://stackoverflow.com/q/21102592
tags question: http://stackoverflow.com/q/21162491
tags question: http://stackoverflow.com/q/21033511
tags question: http://stackoverflow.com/q/21081333
tags question: http://stackoverflow.com/q/21168811
tags question: http://stackoverflow.com/q/21078366
tags question: http://stackoverflow.com/q/21021657
tags question: http://stackoverflow.com/q/21118276
tags question: http://stackoverflow.com/q/21113399
tags question: http://stackoverflow.com/q/21030146
tags question: http://stackoverflow.com/q/21070703
tags question: http://stackoverflow.com/q/21111305
tags question: http://stackoverflow.com/q/21124355
tags question: http://stackoverflow.com/q/21134056
tags question: http://stackoverflow.com/q/21127255
tags question: http://stackoverflow.com/q/21040321
tags question: http://stackoverflow.com/q/21065624
tags question: http://stackoverflow.com/q/21111671
tags question: http://stackoverflow.com/q/21086379
tags question: http://stackoverflow.com/q/21078466
tags question: http://stackoverflow.com/q/21083301
tags question: http://stackoverflow.com/q/21168879
tags question: http://stackoverflow.com/q/21131552
tags question: http://stackoverflow.com/q/21145558
tags question: http://stackoverflow.com/q/21174345
tags question: http://stackoverflow.com/q/21083629
tags question: http://stackoverflow.com/q/21059526
tags question: http://stackoverflow.com/q/21091228
tags question: http://stackoverflow.com/q/21177931
tags question: http://stackoverflow.com/q/21096507
tags question: http://stackoverflow.com/q/21100542
tags question: http://stackoverflow.com/q/21138198
tags question: http://stackoverflow.com/q/21077472
tags question: http://stackoverflow.com/q/21034883
tags question: http://stackoverflow.com/q/21149139
tags question: http://stackoverflow.com/q/21125821
tags question: http://stackoverflow.com/q/21093911
tags question: http://stackoverflow.com/q/21117948
tags question: http://stackoverflow.com/q/21092701
tags question: http://stackoverflow.com/q/21049861
tags question: http://stackoverflow.com/q/21119629
tags question: http://stackoverflow.com/q/21067286
tags question: http://stackoverflow.com/q/21167005
tags question: http://stackoverflow.com/q/21045669
tags question: http://stackoverflow.com/q/21139580
tags question: http://stackoverflow.com/q/21082074

http://stackoverflow.com/comment/31651798
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21028942
score: 0
has text: Why would you want to use a GA and not an algorithm that was designed to optimize real values like e.g. CMAES?

http://stackoverflow.com/a/21171200
upvote count: 1
type: Answer
has body: Text needs to be drawn on a somewhat Component. So, assuming you're use JApplet (ie swing) you can use Jlavel, Jtextfield, Jtextarea, jtable....it all depends on your gui requirements
downvote count: 0
answers question: http://stackoverflow.com/q/21171099
score: 1

http://stackoverflow.com/a/21057778
accepted answer of: http://stackoverflow.com/q/21057743
type: Answer
answers question: http://stackoverflow.com/q/21057743
has comment: http://stackoverflow.com/comment/31664101
has body: You have to allocate memory to your arrays double particlex[]; double particley[]; double vx[]; double vy[]; That is - allocate memory with the new operator - for instance double[] particlex = new double[10]; // example
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/68174751
has text: try this http://stackoverflow.com/a/9210661/4741746 may be this is your answer
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/21076179

http://stackoverflow.com/comment/31766765
has text: Use [`String#split`](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#split(java.lang.String)) and be happy.
score: 3
comment on: http://stackoverflow.com/q/21113857
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31649550
type: Comment
comment on: http://stackoverflow.com/q/21050164
score: 0
has text: I don't think showing us that piece of code will be much help. I do think you would find it more clear if you wrote your own `TableModel` though. You should create your own [TableCellRenderer](http://docs.oracle.com/javase/7/docs/api/javax/swing/table/TableCellRenderer.html).
type: QuestionComment

http://stackoverflow.com/comment/31768987
has text: Second one tries to match a path of any depth between the two nodes. So it could match many paths if many paths exist. You can still run this as a cypher query via java.
type: AnswerComment
comment on: http://stackoverflow.com/a/21114789
score: 0
type: Comment

http://stackoverflow.com/a/21044622
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: I'm getting the expected result for many older, well-behaved fonts, as shown below. There are a lot of ways for this to go awry. For example, I'm getting java.awt.FontFormatException: Font name not found in createFont() for a lot of the newer .ttf fonts in /Library/Fonts. You might try to validate the font in another context. As tested: import java.awt.EventQueue; import java.awt.Font; import java.awt.FontFormatException; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import javax.swing.JPanel; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYPlot; import org.jfree.data.function.Function2D; import org.jfree.data.general.DatasetUtilities; import org.jfree.data.xy.XYDataset; import org.jfree.ui.ApplicationFrame; import org.jfree.ui.RefineryUtilities; public class Function2DDemo1 extends ApplicationFrame { public Function2DDemo1(String title) { super(title); JPanel chartPanel = createDemoPanel(); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel); setDefaultCloseOperation(EXIT_ON_CLOSE); } private static JFreeChart createChart(XYDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createXYLineChart("Function2DDemo1 ", "X", // x axis label "Y", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); // SET A CUSTOM TITLE FONT try { File f = new File("/Library/Fonts/Microsoft/Perpetua.ttf"); Font customFont = Font.createFont(Font.TRUETYPE_FONT, f); customFont = customFont.deriveFont(36f); chart.getTitle().setFont(customFont); System.out.println(customFont.getFontName()); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (FontFormatException | IOException e) { e.printStackTrace(); } XYPlot plot = (XYPlot) chart.getPlot(); plot.getDomainAxis().setLowerMargin(0.0); plot…
answers question: http://stackoverflow.com/q/21040117

http://stackoverflow.com/a/21713178
answers question: http://stackoverflow.com/q/21163872
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21163872
type: Answer
has comment: http://stackoverflow.com/comment/32872677
score: 1
upvote count: 1
has body: Please file a bug report http://youtrack.jetbrains.com/issues/IDEA and provide your web.xml and dispatcher-servlet.xml files. Thanks.

http://stackoverflow.com/q/21037851
type: Question
answer count: 2
has body: I developed one Android app it's working fine in 4.0 and above but when it comes to version 2.3.4 it giving an exception about Responcecache. I followed according to github:- https://github.com/candrews/HttpResponseCache.I'm getting below an exception running in 2.3.4 and 2.3.6. FATAL EXCEPTION: main java.lang.NoClassDefFoundError: com.jakewharton.DiskLruCache at com.integralblue.httpresponsecache.compat.libcore.net.http.HttpResponseCache.&lt;init&gt;(HttpResponseCache.java:83) at com.geeklabs.footmark.util.HttpResponseUtil.enableHttpResponseCache(HttpResponseUtil.java:41) com.integralblue.httpresponsecache.HttpResponseCache.install(httpCacheDir, httpCacheSize); at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) How to resolve this issue please help me.
has title: NoClassDefFoundError in android 2.3.6 version(HttpResponseCahe)
has comment: http://stackoverflow.com/comment/31627553
tagged with: caching
linked to: http://stackoverflow.com/q/21329326
tagged with: classnotfoundexception
downvote count: 0
has answer: http://stackoverflow.com/a/24140831
favorite count: 0
tagged with: httpresponsecache
has comment: http://stackoverflow.com/comment/31627965
has comment: http://stackoverflow.com/comment/31628124
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/21037990
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/21084393
type: Question
score: 0
has body: I need to do this school project where I would take in a text file, convert it to a pdf file (but also format the text so there are different fonts, colors, etc). I thought it would be a cool addon to my project if I were to make a window that would show a visual of how the text file looked before the conversion, and how the pdf file looked after the conversion. I searched up how to take screenshots using java and I was able to find this code snippet. BufferedImage image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize())); ImageIO.write(image, "png", new File("/screenshot.png")); However, this would only take a screenshot of the screen in its current state. Is there any way that the java program would be able to take a screenshot of the text file I had, and the pdf file I created afterwards without these two files already being opened and displayed on the screen?
has title: How to save a screenshot of a text file in java
has comment: http://stackoverflow.com/comment/31714081
answer count: 0
tagged with: screenshot
type: UnansweredQuestion
tagged with: file
has comment: http://stackoverflow.com/comment/31713362
tagged with: java

http://stackoverflow.com/q/21170953
downvote count: 0
has comment: http://stackoverflow.com/comment/31872660
answer count: 1
favorite count: 0
has title: except session any other option to keep data in spring MVC application
has comment: http://stackoverflow.com/comment/31874676
has comment: http://stackoverflow.com/comment/31871931
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21172597
upvote count: 1
tagged with: spring-mvc
tagged with: performance
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31871649
has comment: http://stackoverflow.com/comment/31873611
has body: I am developing Online Examination software, where thousands of students can give online exam from their college/school at a same time. So considering concurrent hits and server performance i am finding the different and best way to store some exam related data: In application each student will get questions randomly. I am thinking to store student wise questions in session but i am worried about storing such a large (question its options) data in session. Consider an scenario let each student will have 30 ques and in a single slot 10k students are there. Then session object will become too big, isn’t it? Also there are some settings/configurations related to exam which i want to keep ready (i don't want to fetch the configurations from DB each time).
type: Question
has comment: http://stackoverflow.com/comment/31872144
has comment: http://stackoverflow.com/comment/31873902
tagged with: session

https
tags question: http://stackoverflow.com/q/21183043
tags question: http://stackoverflow.com/q/21067168
tags question: http://stackoverflow.com/q/21067753
tags question: http://stackoverflow.com/q/21120264
type: Tag
tags question: http://stackoverflow.com/q/21144526
tags question: http://stackoverflow.com/q/21175842
tags question: http://stackoverflow.com/q/21154895
tag name: https

http://stackoverflow.com/a/21344157
score: 2
has body: Release 1.7-SNAPSHOT fixed this problem. Now from 2 minutes the same query returns in 0.1 seconds!
downvote count: 0
answers question: http://stackoverflow.com/q/21182843
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21182843
upvote count: 2
type: Answer

http://stackoverflow.com/q/21174997
accepted answer: http://stackoverflow.com/a/21175125
downvote count: 0
possible better answer: http://stackoverflow.com/a/21350397
has answer: http://stackoverflow.com/a/21350397
favorite count: 0
tagged with: position
upvote count: 2
has body: I'd like to make a Java panel that creates objects where the user clicks. Since my actual application uses a MVC approach I'd like also for these objects to be able to repaint themselves when a model is changed, and provide menus to change their properties. I think that the best way to control their x and y locations would be to take a canvas based approach whereby the JPanel calls a draw method on these objects from the paintComponent method. This however will only draw the shape on the canvas and does not add the object itself loosing all abilities to control object properties. I'd be very grateful if someone could tell me the best approach for what I want to do. I've created some sample code which can be seen below. When clicked I'd like the circle to change colour, which is implemented using a MouseListener (it basically represents changing the models properties in this small example). Also I'd just like to make sure that zooming in/out still works with any sample code/advice can provide so I've added buttons to zoom the objects in and out as a quick test. import java.awt.*; import java.awt.event.*; import java.awt.geom.*; import javax.swing.*; import java.awt.geom.Ellipse2D; public class Main { public static void main(String args[]) { EventQueue.invokeLater(new Runnable() { @Override public void run() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ExamplePanel panel = new ExamplePanel(); frame.add(panel); frame.pack(); frame.setVisible(true); } }); } //I could not get this to with when it extended JLayeredPane private static class ExamplePanel extends JPanel { private static final int maxX = 500; private static final int maxY = 500; private static double zoom = 1; private static final Circle circle = new Circle(100, 100); public ExamplePanel() { this.setPreferredSize(new Dimension(maxX, maxY)); this.setFocusable(true); Button zoomIn = new Button("Zoom In"); zoomIn.addActionListener(new ActionListener() { public void actionP…
tagged with: swing
has answer: http://stackoverflow.com/a/21175125
score: 2
type: AnsweredQuestion
tagged with: java
has title: How to add MouseListener to item on Java Swing Canvas
type: Question
answer count: 2
tagged with: canvas

http://stackoverflow.com/comment/31606169
has text: One should try to teach oneself the basics of the language first: the question here is not about lists, but about how to negate a boolean...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21026052
score: 2

http://stackoverflow.com/comment/37369745
has text: My log xml configuration file was outside the classpath.
type: Comment
comment on: http://stackoverflow.com/a/21087859
score: 0
type: AnswerComment

http://stackoverflow.com/q/21053429
tagged with: mongodb
answer count: 2
tagged with: morphia
has answer: http://stackoverflow.com/a/21171377
accepted answer: http://stackoverflow.com/a/21171377
score: 0
has body: I have a collection: public class Message { @Id ObjectId id; String group; } I need to count number of messages per each group. Is it possible to avoid iterating through entire collection?
tagged with: nosql-aggregation
has answer: http://stackoverflow.com/a/21054437
type: AnsweredQuestion
has title: How to group by count in morphia?
tagged with: java
possible better answer: http://stackoverflow.com/a/21054437
type: Question

http://stackoverflow.com/comment/31643972
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21046786
has text: Something like that. It can even bring more benefit if you have some scripting in your game. You can refer to these profiles by their names.

http://stackoverflow.com/q/21139992
upvote count: 1
tagged with: web-services
type: Question
has title: Combining a Secured SOAP Header to SOAP request using Java
tagged with: wsdl
downvote count: 0
favorite count: 0
has body: I have this WSDL file that I used wsimport to make this into a JAVA program. After I did this, it causes an issue when I go to make the web request because the SecureSOAPHeader is not attached to the web request. I need help attaching the header to requests. please help! &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://"Place"/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://"Place"/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"&gt; &lt;wsdl:types&gt; &lt;s:schema elementFormDefault="qualified" targetNamespace="http://"Place"/"&gt; &lt;s:element name="Welcome"&gt; &lt;s:complexType /&gt; &lt;/s:element&gt; &lt;s:element name="WelcomeResponse"&gt; &lt;s:complexType&gt; &lt;s:sequence&gt; &lt;s:element minOccurs="0" maxOccurs="1" name="WelcomeResult" type="s:string" /&gt; &lt;/s:sequence&gt; &lt;/s:complexType&gt; &lt;/s:element&gt; &lt;s:element name="List"Service""&gt; &lt;s:complexType&gt; &lt;s:sequence&gt; &lt;s:element minOccurs="0" maxOccurs="1" name="startDate" type="s:string" /&gt; &lt;s:element minOccurs="0" maxOccurs="1" name="endDate" type="s:string" /&gt; &lt;/s:sequence&gt; &lt;/s:complexType&gt; &lt;/s:element&gt; &lt;s:element name="List"Service"Response"&gt; &lt;s:complexType&gt; &lt;s:sequence&gt; &lt;s:element minOccurs="0" maxOccurs="1" name="List"Service"Result"&gt; &lt;s:complexType&gt; &lt;s:sequence&gt; &lt;s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax" /&gt; &lt;/s:sequence&gt; &lt;/s:complexType&gt; &lt;/s:element&gt; &lt;/s:sequence&gt; &lt;/s:complexType&gt; &lt;/s:element&gt; &lt;s:element name="SecureSOAPHeader" type="t…
type: UnansweredQuestion
tagged with: soap
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/31730202
type: AnswerComment
comment on: http://stackoverflow.com/a/21093602
type: Comment
score: 0
has text: I guess in time I'll find that more readable. But for now, I look at that and shudder a little.

http://stackoverflow.com/comment/31705098
score: 0
comment on: http://stackoverflow.com/a/21080049
type: AnswerComment
type: Comment
has text: I solve this problem with using JFormattedTextField with changing formatterFactory property.

http://stackoverflow.com/comment/31697461
type: Comment
comment on: http://stackoverflow.com/a/21076013
has text: What do you mean by 'not working'? Which approaches did you try, and what was the outcome? Were there any error messages? Did the code hang? Have you tried connecting a [StreamGobbler](http://www.javaworld.com/article/2071275/core-java/when-runtime-exec---won-t.html?page=2) to the output stream? Is the return code returned by `waitFor` zero or not?
score: 0
type: AnswerComment

http://stackoverflow.com/q/21067624
tagged with: security
has comment: http://stackoverflow.com/comment/31682632
has comment: http://stackoverflow.com/comment/31682100
has comment: http://stackoverflow.com/comment/31682823
has comment: http://stackoverflow.com/comment/31683188
tagged with: c++
has comment: http://stackoverflow.com/comment/31682211
score: 0
type: UnansweredQuestion
type: Question
has body: Suppose I'm programming a game and I want the option of banning people from it after violating the terms. I can ban them per account, I can also ban their IP but it's not going to ban them from my game forever. They will just have to create a new account and change their IP. Is there something like a machine-ID that is unique for every machine in the world? If there is, is it possible to read it using a program language? Is it possible for the user to change this machine-ID?
tagged with: c#
tagged with: java
has comment: http://stackoverflow.com/comment/31682220
has title: identify a machine not by using IP
has comment: http://stackoverflow.com/comment/31682295
has comment: http://stackoverflow.com/comment/31682168
answer count: 2
has answer: http://stackoverflow.com/a/21067694
has comment: http://stackoverflow.com/comment/31682127
has answer: http://stackoverflow.com/a/21067813
has comment: http://stackoverflow.com/comment/31682714

http://stackoverflow.com/a/21122995
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21121294
has comment: http://stackoverflow.com/comment/31793510
has comment: http://stackoverflow.com/comment/31882846
has body: Your approach is correct but that's not how you print the elements of an array. You have to loop through the array and output the components. To keep this clean, you could create another javascript function like: function getPageNames() { var pageNamesArray = [ &lt;c:forEach var="p" items="${sessionScope.pageNames}" varStatus="status"&gt; ${status.first ? '' : ','} "${p}" &lt;/c:forEach&gt; ]; return pageNamesArray; } then have: &lt;body id="qwer" onload="getPage(getPageNames())"&gt; What I'm doing above is create a Javascript array with the page names, with an output like: function getPageNames() { var pageNamesArray = [ "page1" ,"page2" ,"etc" ]; return pageNamesArray; } I'm using JSTL for that, but you can also use a scriptlet. The idea is to loop through the array.
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21121294
has comment: http://stackoverflow.com/comment/31793402

http://stackoverflow.com/q/21158441
score: 0
tagged with: jsoup
has comment: http://stackoverflow.com/comment/31871422
has body: Is there some unique, inherent attribute of a DOM element that makes it possible to select the same element with both JSoup and Javascript? I currently both render a page with webEngine and extract the DOM-tree using JSoup. I want to associate the offset values from an element in the rendered page, which I get using executeScript on the webEngine, with information that I collect using JSoup. But currently I don't know how to select the same DOM-element with Javascript and JSoup. I'm thinking of maybe using the fact the each element has a unique parent vector if you include the sibling index, but perhaps there is a faster way?
type: UnansweredQuestion
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/31848542
tagged with: javascript
tagged with: dom
has comment: http://stackoverflow.com/comment/31862481
has title: Find same DOM-element with JSoup and JS?

http://stackoverflow.com/a/41668678
type: Answer
answers question: http://stackoverflow.com/q/21167596
downvote count: 0
score: 1
has body: Memory usage may also be something to consider. At least in the C++ version of Box2D, each body takes up a fixed amount of memory just like each fixture does and each shape does. So associating every fixture with its own body will use up more memory than creating multiple fixtures within a single body. The same number of fixtures and shapes will be used in either case, but more bodies are used in the former case. To give an idea of what the memory consumption is, the C++ b2Body uses 184-bytes of memory on the 64-bit platform I just printed out the result of sizeof(b2Body) on.
upvote count: 1

http://stackoverflow.com/comment/40192817
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25651584
has text: If we would use Vim, I would be so happy. But tags seem to work well enough. I'm going to credit this answer because you gave me ammunition in the argument (Java developers use ASCII diagrams too).
type: AnswerComment

http://stackoverflow.com/q/21022169
has body: I need add rows to existing table in docx template. How it make? Please share code.
favorite count: 0
score: 0
has title: DOCX4J: How add rows to existing table in docx template?
has answer: http://stackoverflow.com/a/21031566
answer count: 1
type: UnansweredQuestion
upvote count: 1
downvote count: 1
tagged with: java
type: Question
tagged with: docx4j

http://stackoverflow.com/q/21179794
has title: Serialize Point, PointF Objects
possible better answer: http://stackoverflow.com/a/21180423
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21179859
accepted answer: http://stackoverflow.com/a/21179859
favorite count: 0
tagged with: sockets
tagged with: android
linked to: http://stackoverflow.com/q/95181
has body: I am new to serialization concept and i am trying to serialize PointF class as i need to send it over socket connection (I am using ObjectOutputStream and ObjectInputStream). My problem is while sending no matter what values i have in my PointF object while sending , after receiving i get default value. example if i sent pointF(1.0,4.0) i get (0.0,0.0). Following is my code for implimenting serializable. public class MyPointF extends PointF implements Serializable { /** * */ private static final long serialVersionUID = -455530706921004893L; public MyPointF() { super(); } public MyPointF(float x, float y) { super(x, y); } } Can anybody point out the problem? Also, after searching a little i found that this thing happens to android.canvas.Path class also. Please correct me where I am Wrong.
has answer: http://stackoverflow.com/a/21180423
type: AnsweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java

http://stackoverflow.com/comment/31711906
type: QuestionComment
type: Comment
has text: guys, at least can i have the link direction document to how to run cmd command line. thanks :)
comment on: http://stackoverflow.com/q/21083525
score: 0

http://stackoverflow.com/a/21133476
score: 1
accepted answer of: http://stackoverflow.com/q/21133337
has comment: http://stackoverflow.com/comment/31802885
has comment: http://stackoverflow.com/comment/31803015
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31802918
type: Answer
downvote count: 0
has body: Perhaps you can have a look at the following : http://docs.oracle.com/javase/tutorial/deployment/doingMoreWithRIA/security.html http://www.oracle.com/technetwork/articles/javase/appletwarning-135102.html
has comment: http://stackoverflow.com/comment/31802836
answers question: http://stackoverflow.com/q/21133337

http://stackoverflow.com/comment/31972037
has text: Have any of the answers here helped you? If so, please consider marking this question answered.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21108695

http://stackoverflow.com/comment/31786903
score: 0
has text: What is an ASCII "sign"?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21124310

http://stackoverflow.com/a/57652398
has body: In general, case when you have multiple parentheses' types, you have to use Stack. You have only one mistake: you should keep counter and increase it when you find an open parenthesis and decrease when finding a close one. When the counter is negative at any step of iteration - then it's not balanced`. public static boolean isBalanced(String str) { Deque&lt;Character&gt; stack = new LinkedList&lt;&gt;(); for (int i = 0; i &lt; str.length(); i++) { char ch = str.charAt(i); if (ch == '(' || ch == '[' || ch == '{') stack.push(ch); else { if (stack.isEmpty()) return false; char prv = stack.pop(); if (prv == '(' &amp;&amp; ch != ')') return false; if (prv == '[' &amp;&amp; ch != ']') return false; if (prv == '{' &amp;&amp; ch != '}') return false; } } return stack.isEmpty(); } In case you have only one type of parentheses, then you could have only one counter: public static boolean isBalanced(String str) { int count = 0; for (int i = 0; i &lt; str.length() &amp;&amp; count &gt;= 0; i++) { if (str.charAt(i) == '(') count++; else if (str.charAt(i) == ')') count--; } return count == 0; }
answers question: http://stackoverflow.com/q/21169743
score: 0
type: Answer

http://stackoverflow.com/comment/31605835
type: QuestionComment
has text: @GriffeyDog Datatables are like JQGrid, I know this approach but I prefer that with pagination on html tables. Thanks though for your help
type: Comment
comment on: http://stackoverflow.com/q/21024889
score: 0

http://stackoverflow.com/comment/31733417
has text: @edharned, Thanks! will do for sure. This whole thing by no means to roll my own. I am not that smart :). Was just trying to learning the framework properly via examples.
score: 0
comment on: http://stackoverflow.com/q/21054758
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27584631
type: Answer
answers question: http://stackoverflow.com/q/21163498
has body: Are you certain that you're getting an int array? It would appear to be a byte array from your print-out. I would suggest not doing the array conversion and also not doing a rewind; ByteBuffer.wrap will already put you at position 0 in the buffer. The 00 00 01 is a start of NAL marker and the FD is the NAL type btw.
score: 0

http://stackoverflow.com/comment/31821374
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21141984
has text: means don't want to use available look and feels like nimbus, quaqua etc. want to create my own.

http://stackoverflow.com/a/21125842
has comment: http://stackoverflow.com/comment/31789705
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/31791367
has comment: http://stackoverflow.com/comment/31789657
has comment: http://stackoverflow.com/comment/31789797
has comment: http://stackoverflow.com/comment/31789866
accepted answer of: http://stackoverflow.com/q/21125765
answers question: http://stackoverflow.com/q/21125765
has body: If this is what you mean, then you need to read up on basic Java, I've added your method in the code sample, please read this link to understand more about methods: http://docs.oracle.com/javase/tutorial/java/javaOO/methods.html See Peter's answer for more information too! // Create email text body for student who registered for an AP exam. import java.util.Scanner; class EmailText { public static void main(String args[]) { int numTests, cost; String email, first_name; char ch; Scanner input = new Scanner(System.in); System.out.print("Enter student first name: "); first_name = input.next(); System.out.print("Enter student email: "); email = input.next(); System.out.print("Enter number of tests ordered (1-9): "); numTests = input.nextInt(); if(numTests &lt; 10) { System.out.print("Did student qualify for fee waiver (y/n)? "); ch = input.next().charAt(0); if(ch == 'y') { cost = 5; PrintStuff(numTests, cost, email, first_name, "qualified for a fee waiver, "); } else if(ch == 'n') { cost = 89; PrintStuff(numTests, cost, email, first_name, "did not qualify for a fee waiver, "); } else { System.out.println("Please start again."); } } } public static void PrintStuff(int numTests, int cost, String email, String first_name, String fw_status) { int total = numTests * cost; System.out.println("** COPY/PASTE THIS DRAFT **"); System.out.println("To: " + email); System.out.println("Subject: 2014 AP Test Receipt for " + first_name); System.out.println(); System.out.println("Hi " + first_name + ",\n"); System.out.println("Thank you for registering for the 2014 AP Exams!"); System.out.println("According to our records, you ordered " + numTests + " tests.\n"); System.out.println("Because you stated that you " + fw_status + "each test will cost you $" + cost + "."); System.out.println("Your total cost is $" + cost + " * " + numTests + " = $" + total + ".\n"); System.out.println("Please submit your payment to the Student Store ASAP.\nThank you.\n"); } }
score: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31792451
downvote count: 0

http://stackoverflow.com/q/21147380
has comment: http://stackoverflow.com/comment/31829501
has comment: http://stackoverflow.com/comment/31828588
has comment: http://stackoverflow.com/comment/31829708
has comment: http://stackoverflow.com/comment/31828637
has comment: http://stackoverflow.com/comment/31828586
has comment: http://stackoverflow.com/comment/31828613
has title: Java: Calling a constructor of a class
score: -1
has body: I have an ArrayList that holds objects of possibly different classes, and need to call the classes constructors. ArrayList list = new ArrayList(); list.add(new Child1()); list.add(new Child2()); public void Spawn(){ Class clazz = list.get(0).getClass(); list.add(clazz.getConstructor().newInstance()); } How can I achieve this? The last line in the code returns an error because the clazz.getConstructor().newInstance() returns an object, not an instance of child1. The different list items will all have a common parent, and in fact the items on the list can even all be the same, but i just can't hard-code the class name into the program. Edit: I may have stripped down the example too far. I basically have a class that manipulates ArrayLists and needs to add new instances of the objects already inside, but the list may have different class types inside of it. Edit: Based on everyones responses, this is obviously the wrong way to approach the problem! I think I will try a cloning method for the objects inside the lit, but I'll also look for a different approach entirely. Thanks for the help.
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31828759
has comment: http://stackoverflow.com/comment/31829176
has comment: http://stackoverflow.com/comment/31828558
downvote count: 1
has comment: http://stackoverflow.com/comment/31829620
type: Question
has comment: http://stackoverflow.com/comment/31829132
has comment: http://stackoverflow.com/comment/31829922
has comment: http://stackoverflow.com/comment/31829788
has comment: http://stackoverflow.com/comment/31828610
has comment: http://stackoverflow.com/comment/31828672
has comment: http://stackoverflow.com/comment/31829373
tagged with: class
tagged with: arraylist
has comment: http://stackoverflow.com/comment/31828578
has comment: http://stackoverflow.com/comment/31828569
has answer: http://stackoverflow.com/a/21147530
has comment: http://stackoverflow.com/comment/31833006
upvote count: 0
has comment: http://stackoverflow.com/comment/31828551
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/31829578
has comment: http://stackoverflow.com/comment/31828826
tagged with: constructor

http://stackoverflow.com/comment/31662310
type: AnswerComment
score: 0
type: Comment
has text: When dealing with character data, you have to know the character set and encoding, either explicitly or knowing it is the default. It is unlikely that the data is in the _modified UTF-8_ encoding that `NewStringUTF` assumes. Many encodings are identical for a subset of characters so it _could_ work _sometimes._ The best way is to use a `java.lang.String` constructor using the known information about the data.
comment on: http://stackoverflow.com/a/21054027

http://stackoverflow.com/a/21146180
score: 0
answers question: http://stackoverflow.com/q/21145987
has body: Output should be A B C E G H It should be easy to see why order is A B C. After that you throw an object of Exception. But since you are trying to catch it in a subclass object namely Axception a1, it wont be caught. Hence it won't print D nor it would throw a1. Then finally would be processed no matter what. Hence, a E. Again you try to catch Exception object in a subclass object namely Bxception e, it wont be caught. Hence it wont print F. Next you try to catch it in Exception object hence it will be caught and would print G. Since exception is caught now, method should happily go and print H. Hence A B C E G H. Hope it is clear now.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21145987
has comment: http://stackoverflow.com/comment/31830950
type: Answer
has comment: http://stackoverflow.com/comment/31830750

openstack
tags question: http://stackoverflow.com/q/21105194
tags question: http://stackoverflow.com/q/21171261
tag name: openstack
type: Tag

http://stackoverflow.com/comment/31731734
has text: @oshai Even though it is predictable, you should not assume things while posting questions. Add all the details that you think might be required. The question was not understandable to one person itself proves that it is not at all general requirement.
score: 0
comment on: http://stackoverflow.com/q/21094045
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31805727
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21135183
has text: The Android Framework looks at your Manifest file, instantiates the necessary classes and calls the necessary startup methods.
score: 0

http://stackoverflow.com/comment/31675833
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/21064295
has text: could you be more clear?
type: Comment

http://stackoverflow.com/comment/31692571
has text: @TimB No, my setup for testing is XAMPP 3.2.1 and the java stuff with jstl-1.2 - sry im not an expert on this whole thing i just need to get this to work
score: 0
comment on: http://stackoverflow.com/q/21073081
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21081898
has title: How to Run a Python file from Java using an Absolute Path?
type: Question
has answer: http://stackoverflow.com/a/21081924
possible better answer: http://stackoverflow.com/a/53634362
score: 3
tagged with: java
linked to: http://stackoverflow.com/q/19102989
answer count: 2
downvote count: 0
has body: I want to run a python script called, for example foo. And I have the absoulute path, lets say: /Users/me/pythonscripts/ I have tried running: String cmd="/Users/me/pythonscripts/" String py="foo" Runtime.getRuntime().exec("cd "+cmd); Runtime.getRuntime().exec("python "+py+".py"); But that does run the python file.
accepted answer: http://stackoverflow.com/a/21081924
has comment: http://stackoverflow.com/comment/31708818
favorite count: 0
has comment: http://stackoverflow.com/comment/31708966
tagged with: python
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/53634362
upvote count: 3

http://stackoverflow.com/q/21086112
has comment: http://stackoverflow.com/comment/31716674
has comment: http://stackoverflow.com/comment/31716174
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31735415
has title: SSH-keygen not running properly (java)
answer count: 1
has answer: http://stackoverflow.com/a/21114479
score: 0
tagged with: ssh
tagged with: shell
linked to: http://stackoverflow.com/q/3706177
has body: I want to execute ssh-keygen in my local computer. but when i run the code below, ssh-keygen only run until : Generating public/private rsa key pair. Enter file in which to save the key (/cygdrive/c/Users/USER/.ssh/id_rsa): BUILD SUCCESSFUL (total time: 0 seconds) //ssh-keygen execution stop at here only. Result i want is like this: Generating public/private rsa key pair. Enter file in which to save the key (/cygdrive/c/Users/USER/.ssh/id_rsa): //press enter Enter passphrase (empty for no passphrase): //press enter Enter same passphrase again: //press enter //http://commons.apache.org/proper/commons-exec/tutorial.html import java.io.IOException; import org.apache.commons.exec.CommandLine; import org.apache.commons.exec.DefaultExecutor; import org.apache.commons.exec.ExecuteWatchdog; public class ApacheRunSSHKEygen { public static void main(String[] args) throws IOException { try { String line = "C:\\ExecuteSSH\\ssh-keygen.exe"; // path to ssh-keygen.exe CommandLine cmdLine = CommandLine.parse(line); DefaultExecutor executor = new DefaultExecutor(); //watchdog executor.setExitValue(1); ExecuteWatchdog watchdog = new ExecuteWatchdog(60000); executor.setWatchdog(watchdog); int exitValue = executor.execute(cmdLine); //execute ssh-keygen } catch (Exception exc){ System.out.println("error" + exc);/*handle exception*/} } } What is actually wrong in my code. how can i run the ssh-keygen properly? thank you in advance for the helps.
accepted answer: http://stackoverflow.com/a/21114479

http://stackoverflow.com/a/21108264
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21106626
answers question: http://stackoverflow.com/q/21106626
has body: The long and short of it... The AWT core starts a native "event loop". This loop basically takes in events from the OS and processes them. If the event is of interest to the current application context, the event is processed and added to the Event Queue. The Event Queue is processed by the Event Dispatching Thread, which dispatches the event to the appropriate listener, based on who the event was for. This is a significant simplification of the process. None-the-less, when an event comes into the native "event loop", it's properties are inspected and an appropriate AWT Event is generated. How this is determined comes down a lot to how the OS passes it's event information, but basically, if the OS detects a drag, the MouseEvent has it's ID property set to MouseEvent.MOSUE_DRAGGED, this allows the Component to sift through the events and determine the best listener it should notify, which comes out to be MouseMotionListener.mouseDragged(MouseEvent) For example, this is the processMouseMotionEvent method take from Component protected void processMouseMotionEvent(MouseEvent e) { MouseMotionListener listener = mouseMotionListener; if (listener != null) { int id = e.getID(); switch(id) { case MouseEvent.MOUSE_MOVED: listener.mouseMoved(e); break; case MouseEvent.MOUSE_DRAGGED: listener.mouseDragged(e); break; } } }
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21127690
has body: You should be able to achieve this by using indexOf and subList. Consider reading the linked documentation for more information. Code example: list.subList(0, list.indexOf(searched_string)).clear();
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21127642

http://stackoverflow.com/comment/31798588
type: QuestionComment
comment on: http://stackoverflow.com/q/21131005
has text: concurrentModificationException
score: 0
type: Comment

http://stackoverflow.com/comment/31598266
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21021834
score: 1
has text: 1) Change code of the form `catch (Exception e) { ..` to `catch (Exception e) { e.printStackTrace(); // very informative! ..` 2) For better help sooner, post an [SSCCE](http://sscce.org/). Note the document is being reviewed and discussed on [this question](http://meta.stackexchange.com/q/214955/155831), contributions welcome.

http://stackoverflow.com/comment/31665385
type: Comment
type: QuestionComment
has text: What is the full desired output?
comment on: http://stackoverflow.com/q/21058411
score: 0

http://stackoverflow.com/comment/31846495
type: QuestionComment
comment on: http://stackoverflow.com/q/21157409
has text: @Puce: No, that's irrelevant. This is about the OP using a raw type instead of generics.
score: 0
type: Comment

weblogic
tags question: http://stackoverflow.com/q/21057877
tags question: http://stackoverflow.com/q/21145409
tags question: http://stackoverflow.com/q/21154393
tags question: http://stackoverflow.com/q/21058778
tags question: http://stackoverflow.com/q/21025489
tags question: http://stackoverflow.com/q/21167564
tags question: http://stackoverflow.com/q/21124864
tags question: http://stackoverflow.com/q/21146290
tags question: http://stackoverflow.com/q/21089662
tags question: http://stackoverflow.com/q/21103382
tags question: http://stackoverflow.com/q/21144193
tags question: http://stackoverflow.com/q/21168709
tag name: weblogic
tags question: http://stackoverflow.com/q/21118741
tags question: http://stackoverflow.com/q/21117215
type: Tag

http://stackoverflow.com/q/21060810
type: Question
has title: Display random images from folder to JLabel in Netbeans
downvote count: 0
accepted answer: http://stackoverflow.com/a/21060858
tagged with: random
answer count: 1
tagged with: netbeans-7
favorite count: 0
has comment: http://stackoverflow.com/comment/31669365
has body: My project contains a folder named images containing images. I want to display the images randomly to the JLabel in the frame when a button pressed. I tried the code below: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { Image im=new ImageIcon(this.getClass().getResource("/images/a1.jpg")).getImage(); ImageIcon iconLogo = new ImageIcon(im); jLabel2.setIcon(iconLogo); } This code displays only the image a1. But I need the images randomly (one image at a time).
linked to: http://stackoverflow.com/q/13460705
tagged with: swing
linked to: http://stackoverflow.com/q/19209650
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/21060858
upvote count: 3
tagged with: java
tagged with: image

http://stackoverflow.com/a/21023445
answers question: http://stackoverflow.com/q/21023348
has body: You are using recursion which is not as fast as a loop. You are still O(n) but with faster time to use a loop. Something like: static void reverseArray(int arr[]){ for (int start=0,end=arr.length-1;start&lt;=end;start++,end--) { int temp = arr[start]; arr[start] = arr[end]; arr[end] = temp; } } For something like this you will be better off using methods provided in the Java libraries to do it though.
has comment: http://stackoverflow.com/comment/31601301
has comment: http://stackoverflow.com/comment/31602482
has comment: http://stackoverflow.com/comment/31601587
has comment: http://stackoverflow.com/comment/31605322
has comment: http://stackoverflow.com/comment/31601286
has comment: http://stackoverflow.com/comment/31601460
score: 4
has comment: http://stackoverflow.com/comment/31601519
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/31601596
has comment: http://stackoverflow.com/comment/31601544
upvote count: 5
has comment: http://stackoverflow.com/comment/31606217
has comment: http://stackoverflow.com/comment/31605814

http://stackoverflow.com/a/21027527
type: AcceptedAnswer
upvote count: 14
type: Answer
accepted answer of: http://stackoverflow.com/q/21027434
has comment: http://stackoverflow.com/comment/31608907
answers question: http://stackoverflow.com/q/21027434
downvote count: 0
score: 14
has body: In your xml file string.xml : <?xml version="1.0" encoding="utf-8"?> Good job! The answer was %1$s\n You made %2$s guesses.\n Restart the app to try again. If you want to put an other value in the text, you increment %2$s -> %3$s , etc ... Then you can use it like in java like that : Toast.makeText(MainActivity.this, getString(R.string.correct, comp, guesses), Toast.LENGTH_LONG).show();

http://stackoverflow.com/comment/31670621
comment on: http://stackoverflow.com/a/21061347
score: 0
type: AnswerComment
has text: @akiiddweeber It's better to use existing libraries to generate a table like `DisplayTag` http://demo.displaytag.org/displaytag-examples-1.2/example-nocolumns.jsp
type: Comment

http://stackoverflow.com/q/21098432
accepted answer: http://stackoverflow.com/a/21103700
tagged with: node.js
type: AnsweredQuestion
score: 0
tagged with: java
has body: I'm going to try to make a simple hack that sends continually streaming integers from an Android App to a Node.js server. I want to know how to create such a stream in Android and how to receive it in my Node.js server if I am using express for routing the API calls. If anyone can give me a high level explanation of how this can work that would be great. Specific code examples of creating Node.js ReadStreams from an outside WriteStream would be even better.
has title: Send a stream of integers from Android app and receive it on Node.js express server
type: Question
tagged with: javascript
tagged with: express
has answer: http://stackoverflow.com/a/21103700
answer count: 1
tagged with: android

http://stackoverflow.com/comment/31663028
score: 0
comment on: http://stackoverflow.com/q/21057204
type: Comment
type: QuestionComment
has text: Please post your stack trace.

http://stackoverflow.com/q/21072985
accepted answer: http://stackoverflow.com/a/21086153
tagged with: java
has comment: http://stackoverflow.com/comment/31691791
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/21073011
has answer: http://stackoverflow.com/a/21073011
upvote count: 5
has title: Java: parsing unsigned binary data
has body: I have a well defined binary data and I want to write Java API for it. The file format is like File Signature char[4] 4 bytes File Source ID unsigned short 2 bytes Header Size unsigned long 4 bytes Max double 8 bytes I am using DataInputStream for parsing the data. char is easy to parse, no problem. But unsigned cannot be parsed correctly. I know Java has no unsigned number. How do I convert it? (Please take unsigned long as example). EDIT Here is the code I worte: File file = new File("lidar.las"); DataInputStream in= new DataInputStream(new FileInputStream(file)); in.skipBytes(6); long read = (long) (in.readInt() &amp; 0xFFFFFFFFL); System.out.println("read " + read); the output is read 3288596480 my expected number is 1220 .I do not know the code that wrote this binary record, probably in c. All I want is writing a Java version to read data out. Solved I am not sure I can answer my own question. LOL Anyway, Here is the solutions. private static int getSignedInt( final int unsignedInt ){ ByteBuffer bb=ByteBuffer.allocate(1024*4); bb.putInt(unsignedInt).flip(); int result =bb.order(ByteOrder.LITTLE_ENDIAN).getInt(); bb.clear(); return result; }
answer count: 2
has answer: http://stackoverflow.com/a/21086153
tagged with: binary-data
favorite count: 0
linked to: http://stackoverflow.com/q/1026761
has comment: http://stackoverflow.com/comment/31692162
score: 4
type: AnsweredQuestion

http://stackoverflow.com/comment/31729431
type: QuestionComment
comment on: http://stackoverflow.com/q/21091934
score: 0
has text: @kuporific Ok I see is this proxy able to do switch over without sentinal.
type: Comment

http://stackoverflow.com/a/21149597
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/21149524
has body: This works for me: yum install ftp://rpmfind.net/linux/centos/6.5/os/i386/Packages/java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.i686.rpm Result Setting up Install Process java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.i686.rpm | 27 MB 00:02 Examining /var/tmp/yum-root-19c9mu/java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.i686.rpm: 1:java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.i686 Marking /var/tmp/yum-root-19c9mu/java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.i686.rpm to be installed Resolving Dependencies --&gt; Running transaction check ---&gt; Package java-1.7.0-openjdk.i686 1:1.7.0.45-2.4.3.3.el6 will be installed ... I'm missing something? With JDK 1.7 # yum install java-1.7.0-openjdk OpenJDK is in default updates repository Name : java-1.7.0-openjdk Arch : x86_64 Epoch : 1 Version : 1.7.0.51 Release : 2.4.4.1.el6_5 Size : 26 M Repo : updates Summary : OpenJDK Runtime Environment URL : http://openjdk.java.net/ License : ASL 1.1 and ASL 2.0 and GPL+ and GPLv2 and GPLv2 with exceptions and LGPL+ and LGPLv2 and MPLv1.0 and MPLv1.1 and Public Domain and W3C Description : The OpenJDK runtime environment.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21149524
has comment: http://stackoverflow.com/comment/31832947
upvote count: 3

http://stackoverflow.com/comment/32069042
type: AnswerComment
score: 0
type: Comment
has text: @Ralf : Yes, I did that. if timeOut happens, camel throws an exception.
comment on: http://stackoverflow.com/a/21194330

http://stackoverflow.com/a/21056713
score: 2
has body: Since this is Java, are these variables data members of a class? In that case give them private access and provide getters and setters. Your setter can notify you if you so desire.
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/21056673
type: Answer

http://stackoverflow.com/a/21077436
type: Answer
score: 0
answers question: http://stackoverflow.com/q/21075880
has body: You are getting the exception because of this : for (LogRecord record : recordList) { if (record.isStartPoint()){ recordList.remove(record); &lt;--- This is the cause return record; } } Use an Iterator Instead Iterator&lt;LogRecord&gt; iterator = recordList.iterator(); while(iterator.hasNext()){ LogRecord logRecord = iterator.next(); if(record.isStartPoint()){ iterator.remove(); return logRecord; } Check if this works

http://stackoverflow.com/comment/31786984
type: Comment
type: QuestionComment
has text: http://stackoverflow.com/questions/2164804/from-compilation-to-runtime-how-does-java-string-encoding-really-work
comment on: http://stackoverflow.com/q/21124310
score: 0

http://stackoverflow.com/a/21139103
has comment: http://stackoverflow.com/comment/31813671
downvote count: 0
answers question: http://stackoverflow.com/q/21138996
has comment: http://stackoverflow.com/comment/31813098
type: Answer
has comment: http://stackoverflow.com/comment/31812957
has comment: http://stackoverflow.com/comment/31813387
has comment: http://stackoverflow.com/comment/31813234
score: 1
has comment: http://stackoverflow.com/comment/31812604
has body: If you do not give the value it consider the default value. As in your fourth query q=price means it searches the default searchable field having value "price" That's why you are getting 0 result since no price is of 0 value.
upvote count: 1

http://stackoverflow.com/comment/31851265
type: QuestionComment
comment on: http://stackoverflow.com/q/21160203
has text: Clean and build and try again
score: 0
type: Comment

http://stackoverflow.com/a/21058545
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/21058477
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21058477
has body: The += operator works as so: int x; x += 3; //Expands into: x = x + 3; != is just Logical NOT Equal To: 5 != 6 //True 5 != 5 //False
upvote count: 2

http://stackoverflow.com/comment/31733517
has text: @user3005743 good, Its from the value column on http://en.wikipedia.org/wiki/Code_128#Bar_code_widthshttp://en.wikipedia.org/wiki/Code_128#Bar_code_widths
type: Comment
comment on: http://stackoverflow.com/a/21094613
score: 0
type: AnswerComment

http://stackoverflow.com/q/21168637
score: -1
answer count: 2
possible better answer: http://stackoverflow.com/a/21168782
has comment: http://stackoverflow.com/comment/31867221
has answer: http://stackoverflow.com/a/21168782
downvote count: 1
tagged with: linux-distro
has body: EDIT - I'm sorry that I made this post more complicated than it should. I won't delete this post in case someone with a similar question needs help. I recently became interested in building my own Linux distro(probably just for family and friends). I have researched extensively on whether I should customize an existing distro(eg. Arch Linux, Debian) or build from scratch(LFS). I have come to the conclusion that building from scratch would best fit my needs(Im on no time constraint). My main question is: Would it be possible to build an application that functions as a full OS, and just program the linux distro to run it at launch? Second main question: Would doing this way restrict programs from being installed? Would developers have to make a custom version of their software to run on this mock OS? Problems I see in this: -If I use a language like c#, would that work? or does it require windows natives? -If I use java(probably not), but if I would, would I have to package JRE with the distro? -If I use something like java, can I use libraries like LWJGL(for openGL for stuff like window frames) -Does java or c# use special file system methods? Would I need to make the Linux base build the file system for the VM language to use? Or can I arrange all that in the mock Os itself? -Performance problems with VM languages? -Are there any legal problems with packaging things like JRE or if I find a way to use windows natives? Additional notes: -I have no concern on time, even if just the file system takes me 3 years. -If building this from scratch would not be possible, would I be able to customize a distro in order to function like this? -I understand that I would have to make linux handle stuff like hardware drivers, because communicating with hardware is not something in my ballpark. Would this mean that I have to customize something like Arch Linux? I am very sorry there are so many questions in this, and if I had enough reputation to add a 500 rep bounty I would.
favorite count: 0
has comment: http://stackoverflow.com/comment/31866813
has comment: http://stackoverflow.com/comment/31867222
tagged with: linux
has comment: http://stackoverflow.com/comment/31869285
has title: Building an OS out of an application
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/31869484
has comment: http://stackoverflow.com/comment/31869476
has comment: http://stackoverflow.com/comment/31871047
has answer: http://stackoverflow.com/a/21168754
type: Question
has comment: http://stackoverflow.com/comment/31868091
accepted answer: http://stackoverflow.com/a/21168754
tagged with: c#
tagged with: java

http://stackoverflow.com/a/21183533
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/31911767
score: 3
has body: Change this: [at|@|(at)] to: (?:at|@|\(at\)) and [dot|\\.|dt] to (?:dot|\\.|dt) [...] is a character class, (?:...) is a non capture group. The whole regex will be: ([a-zA-Z0-9.]+)\\s*(?:at|@|\(at\))\\s*(\\w+)\\s*(?:do?t|\\.)\\s*(\\w+{1,3}) If you want to match subdomains: ([a-zA-Z0-9.]+)\\s*(?:at|@|\(at\))\\s*(?:\\w+\\s*(?:do?t|\\.)\\s*)+(\\w+{1,3})
answers question: http://stackoverflow.com/q/21183351
has comment: http://stackoverflow.com/comment/31911967
downvote count: 0
has comment: http://stackoverflow.com/comment/31893517

http://stackoverflow.com/comment/31676346
type: Comment
has text: @jonlee: Dasblinkenlight already does into this specific option but yes, it might. If you only use it to transmit the data once then it won't make a big difference (you construct it and the next call you already retrieve all the values from it, netto you won't have gained much). Usually this is done to easier group a few fields to transfer throughout several method calls. You still have the readability going for it though and it makes it easier to specify new data that relates to the SFTP connection info
comment on: http://stackoverflow.com/a/21064243
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31654160
type: AnswerComment
comment on: http://stackoverflow.com/a/21052530
type: Comment
has text: You should call setArguments also on fragment instances created in SectionsPagerAdapter, otherwise getArguments will return you null pointer. Also I dont think you need this code inside if(savedInstanceState != null){ .... }, fragments should handle configuration changes on itself.
score: 0

http://stackoverflow.com/comment/32298248
comment on: http://stackoverflow.com/a/21383728
type: AnswerComment
has text: the card itself allows getting the certificates without password (see the example with opensc pkcs11-tool in the question). I guess the Java JCA wrapping is the one that is causing it, either because I missconfigured it, or because it does not support such behaviour (the doc says it does, though), or something else that I am not understanding. Maybe the "attributes" section? Do you have a sample code of how to initialize it for such portuguesse cards?
type: Comment
score: 1

filereader
tags question: http://stackoverflow.com/q/21040312
tags question: http://stackoverflow.com/q/21162598
tag name: filereader
tags question: http://stackoverflow.com/q/21090978
type: Tag
tags question: http://stackoverflow.com/q/21072109
tags question: http://stackoverflow.com/q/21068448

http://stackoverflow.com/a/21081399
answers question: http://stackoverflow.com/q/21078760
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31944172
has comment: http://stackoverflow.com/comment/31710748
has comment: http://stackoverflow.com/comment/31943516
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21078760
type: Answer
has comment: http://stackoverflow.com/comment/31710371
has body: You could translate your x,y and then translate the draw loop. This makes it so that you're working with a coordinate system with 0,0 at the center of the screen instead of at the top-left of the screen. Your distance and angle formulas are using 0,0 as the origin, which is not the center of the screen if you use a top-left origin system (like Processing). You could also modify those formulas instead. The below code is an edit of yours to make 0,0 at the center of your screen. float r = 0; //radius float x = 100; // x of the object float y = 100; // y of the object float theta = 0; //angle void setup() { size(800,600); background(0); smooth(); ellipseMode(CENTER); // draw ellipses based on their center // translate the x and y from top-left origin to center origin x -= width/2; y -= height/2; r = sqrt(x*x+y*y); //polar coordinate - distance from x,y to 0,0 on the grid theta = atan(y/x); // angle to 0,0 on the grid } void draw() { translate(width/2, height/2); // translate the whole canvas fill(0,255,0); ellipse(0,0,20,20); // mark the center of the canvas fill(0,0,255); ellipse(x,y,20,20); // mark the start point for the circle // flip the angle if left of the origin int flip = 1; if(x &lt; 0) flip = -1; float x = r * cos(theta) * flip; float y = r * sin(theta) * flip; // Draw an ellipse at x,y noStroke(); fill(255,0,0); ellipse(x, y, 16, 16); if (r&gt;0){ r -= 1; // Decrement the radius theta += 0.01; // Increment the angle } } The below code keeps the top-left origin, but modifies the initialization of the radius and angle to be relative to the center of the screen. float x = 100; // x of the object float y = 100; // y of the object float r = 0; // radius float theta = 0; // angle void setup() { size(800,600); background(0); smooth(); ellipseMode(CENTER); // draw ellipses based on their center // distance between point and center of screen r = dist(x,y,width/2,height/2); // http://stackoverflow.com/a/7586218/1736092 // angle of line between point and center of scr…

http://stackoverflow.com/comment/31823322
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21114520
has text: @AmineMinou you're welcome! No, in this case there's no option. But most of sites and application work in this way, it's pretty standard.

http://stackoverflow.com/q/21173101
has answer: http://stackoverflow.com/a/21173467
type: Question
has title: Spring 3.2.2 property-placeholder not working
tagged with: configuration
has body: I work with Spring 3.2.2 . I want to use db.properties file for DB parameters db.properties db.driver=org.postgresql.Driver db.url=jdbc:postgresql://localhost:5432/test db.user=test db.password=test spring configuration &lt;context:property-placeholder location="classpath:db.properties"/&gt; &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt; &lt;property name="driverClassName" value="${db.driver}"/&gt; &lt;property name="url" value="${db.url}"/&gt; &lt;property name="username" value="${db.user}"/&gt; &lt;property name="password" value="${db.password}"/&gt; &lt;/bean&gt; but I have error PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [${db.driver}] Can anybody help me?
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31876856
tagged with: spring
tagged with: properties
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31887566

http://stackoverflow.com/comment/31738017
has text: Google the tutorial. It's very helpful and is what taught me how to use these.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21067343
score: 0

classloader
tags question: http://stackoverflow.com/q/21022980
tags question: http://stackoverflow.com/q/21110138
tags question: http://stackoverflow.com/q/21168009
tags question: http://stackoverflow.com/q/21042633
tags question: http://stackoverflow.com/q/21032551
tags question: http://stackoverflow.com/q/21048654
tags question: http://stackoverflow.com/q/21102294
tags question: http://stackoverflow.com/q/21162609
tags question: http://stackoverflow.com/q/21138295
tags question: http://stackoverflow.com/q/21062102
tags question: http://stackoverflow.com/q/21099700
type: Tag
tags question: http://stackoverflow.com/q/21124774
tag name: classloader

http://stackoverflow.com/comment/31782345
comment on: http://stackoverflow.com/q/21121875
score: 0
has text: @tagz2712 `price Double;` is the culprit
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21179969
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/31925283
type: Question
has comment: http://stackoverflow.com/comment/31897397
has body: I am working on an optimization problem by using the matlab BONMIN solver (http://www.i2c2.aut.ac.nz/Wiki/OPTI/index.php/Probs/MINLP), which is a third-party optimization toolbox. I worked out a matlab program involving the invocation of the BONMIN solver. In my case, I need to package this program into Java pakcage, thus, I choose to use matlab ja builder to do so. However, I got the following error message: The file 'F:\Documents\MATLAB\OPTI Toolbox\Solvers\bonmin\bonminCplex.mexw64' appears to be a MEX-file. It shadows the MATLAB file 'F:\Documents\MATLAB\OPTI Toolbox\Solvers\bonmin\bonminCplex.m' but will not execute properly at runtime, as it does not export a function named 'mexFunction.' My matlab version is 2012b. Is there anyone who have any idea about this problem? Thanks! ====================================== ant: &lt;mkdir dir="F:\Documents\MATLAB\Optimization\fudan.se.graphmatching.optimization\distrib" /&gt; &lt;mkdir dir="F:\Documents\MATLAB\Optimization\fudan.se.graphmatching.optimization\src" /&gt; mcc -W 'java:fudan.se.graphmatching.optimization,OptimalGraphMatcher' -T link:lib -d F:\Documents\MATLAB\Optimization\fudan.se.graphmatching.optimization\src -w enable:specified_file_mismatch -w enable:repeated_file -w enable:switch_ignored -w enable:missing_lib_sentinel -w enable:demo_license -v 'class{OptimalGraphMatcher:F:\Documents\MATLAB\Optimization\apply_funcs.m,F:\Documents\MATLAB\Optimization\check_validity.m,F:\Documents\MATLAB\Optimization\compute_optimization.m,F:\Documents\MATLAB\Optimization\constraints.m,F:\Documents\MATLAB\Optimization\function_matrix_multiply.m,F:\Documents\MATLAB\Optimization\generate_relation.m,F:\Documents\MATLAB\Optimization\generate_simulated_constraint.m,F:\Documents\MATLAB\Optimization\obj_function.m,F:\Documents\MATLAB\Optimization\transfer_from_vv_to_ve.m}' Compiler version: 4.18 (R2012b) Processing C:\Program Files\MATLAB\R2012b\toolbox\matlab\mcc.enc Processing C:\Program Files\MATLAB\R2012b\toolbox\shared\spc…
has title: matlab ja builder failed with mex file
has comment: http://stackoverflow.com/comment/31888042
tagged with: mex
type: UnansweredQuestion
tagged with: matlab-deployment
has comment: http://stackoverflow.com/comment/31888694
has comment: http://stackoverflow.com/comment/31889215
tagged with: matlab
has comment: http://stackoverflow.com/comment/31921122
answer count: 0

http://stackoverflow.com/comment/31843044
has text: I use them inside Jersery Resources.I inject them fine using @AutoWire annotation.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21155010

http://stackoverflow.com/a/21056903
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21034677
type: Answer
accepted answer of: http://stackoverflow.com/q/21034677
score: 1
has body: I found the solution: HttpClientConnectionManager connectionManager = createConnectionManager(clientConfig, sslContext, getHostnameVerifier(), true); clientConfig.property(ApacheClientProperties.CONNECTION_MANAGER, connectionManager); I roughly copied the following method from ApacheConnector to create the ConnectionManager: private HttpClientConnectionManager createConnectionManager( final Configuration config, SSLContext sslContext, X509HostnameVerifier hostnameVerifier, boolean useSystemProperties) { final String[] supportedProtocols = useSystemProperties ? StringUtils.split( System.getProperty("https.protocols")) : null; final String[] supportedCipherSuites = useSystemProperties ? StringUtils.split( System.getProperty("https.cipherSuites")) : null; if (hostnameVerifier == null) { hostnameVerifier = SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER; } LayeredConnectionSocketFactory sslSocketFactory; if (sslContext != null) { sslSocketFactory = new SSLConnectionSocketFactory( sslContext, supportedProtocols, supportedCipherSuites, hostnameVerifier); } else { if (useSystemProperties) { sslSocketFactory = new SSLConnectionSocketFactory( (SSLSocketFactory) SSLSocketFactory.getDefault(), supportedProtocols, supportedCipherSuites, hostnameVerifier); } else { sslSocketFactory = new SSLConnectionSocketFactory( SSLContexts.createDefault(), hostnameVerifier); } } final Registry&lt;ConnectionSocketFactory&gt; registry = RegistryBuilder.&lt;ConnectionSocketFactory&gt;create() .register("http", PlainConnectionSocketFactory.getSocketFactory()) .register("https", sslSocketFactory) .build(); final PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(registry); if (useSystemProperties) { String s = System.getProperty("http.keepAlive", "true"); if ("true".equalsIgnoreCase(s)) { s = System.getProperty("http.maxConnections", "5"); final int max = Integer.parseInt(s); connectionManager.setDefaultMaxPerRoute(max); connectionManager…

http://stackoverflow.com/a/21055151
type: Answer
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/31660290
has comment: http://stackoverflow.com/comment/31771044
answers question: http://stackoverflow.com/q/21054984
has comment: http://stackoverflow.com/comment/31661037
has comment: http://stackoverflow.com/comment/31659561
has comment: http://stackoverflow.com/comment/31659863
downvote count: 0
has body: You have to instantiate DateTime object for specified week number, and then just reads its month property (using Joda-Time and Google Guava). DateTime dateTime = new DateTime().withWeekOfWeekyear(i).withDayOfWeek(DateTimeConstants.MONDAY); if (dateTime.dayOfMonth().getMaximumValue() - dateTime.dayOfMonth().get() &lt; 3) { dateTime = dateTime.plusMonths(1); } int month = dateTime.monthOfYear().get(); We can also use below function to print all months with belonging to them weeks: public static void main(String[] args) { Multimap&lt;Integer, Integer&gt; monthsWithWeeks = LinkedListMultimap.create(); int weeksInYear = new DateTime().withYear(2014).weekOfWeekyear().getMaximumValue(); for (int i = 1; i &lt;= weeksInYear; i++) { DateTime weekDate = new DateTime().withWeekOfWeekyear(i).withDayOfWeek(DateTimeConstants.MONDAY); if (weekDate.dayOfMonth().getMaximumValue() - weekDate.dayOfMonth().get() &lt; 3) { weekDate = weekDate.plusMonths(1); } int month = weekDate.monthOfYear().get(); monthsWithWeeks.put(month, i); } for (Integer month : monthsWithWeeks.keySet()) { System.out.println(String.format("%d =&gt; [%s]", month, Joiner.on(',').join(monthsWithWeeks.get(month)))); } }

http://stackoverflow.com/a/21113479
has comment: http://stackoverflow.com/comment/31766246
downvote count: 1
answers question: http://stackoverflow.com/q/21113404
has comment: http://stackoverflow.com/comment/31766026
score: -1
has body: The error occurs on line 3 byt = (byte[]) arrays.get(0) ; arrays.get(0) returns a Byte which you then try to cast to a byte[]
upvote count: 0
has comment: http://stackoverflow.com/comment/31766197
type: Answer

http://stackoverflow.com/q/21099118
has comment: http://stackoverflow.com/comment/31740337
type: AnsweredQuestion
has title: Errors on Json deserialize
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31759632
has answer: http://stackoverflow.com/a/21099210
score: -1
has body: i'm trying deserialize my object, but I can not get no error! I'm using gson on android to read json file. My deserialize this is my request class, i using a rest server. public Object getListaSeguradoras(String _codPais, String _tipoPesquisa) { try { HttpClient httpClient = new DefaultHttpClient(); HttpPost post = new HttpPost(Config.WS_PATH); post.setHeader("content-type", "application/json; charset=UTF-8"); post.addHeader("Client-Application","xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); //Make object in JSON format JSONObject dato = new JSONObject(); dato.put("CodPais", _codPais); dato.put("TipoPesquisa", _tipoPesquisa); StringEntity entity = new StringEntity(dato.toString()); post.setEntity(entity); HttpResponse resp = httpClient.execute(post); String respStr = EntityUtils.toString(resp.getEntity()); Gson gson = new Gson(); Type collectionType = new TypeToken&lt;Collection&lt;SeguradoraLista&gt;&gt;(){}.getType(); Collection&lt;SeguradoraLista&gt; ListaSeguradoras = gson.fromJson(respStr, collectionType); return ListaSeguradoras; } catch (Exception e) { e.printStackTrace(); return null; } } My object: This is my getter and setter public class SeguradoraLista{ public String SeguradoraId; public String Nome; public String getSeguradoraId() { return this.SeguradoraId; } public String getNome() { return this.Nome; } public void setSeguradoraId ( String SeguradoraId) { this.SeguradoraId = SeguradoraId; } public void setNome ( String Nome) { this.Nome = Nome; } } My json: this is the json string on my string respStr [{"SeguradoraId":"19","Nome":"AIG Europe"}, {"SeguradoraId":"25","Nome":"AIOI Insurance Co. Of Europe"}, {"SeguradoraId":"28","Nome":"Aktiv Forsikring A/S"}, {"SeguradoraId":"160","Nome":"Enter Forsikring AS"}, {"SeguradoraId":"167","Nome":"Euro Insurances Ltd."}, {"SeguradoraId":"189","Nome":"Försäkrings-AB Volvia"}, {"SeguradoraId":"219","Nome":"Gjensidige NOR Forsikring"}, {"SeguradoraId":"245","Nome":"If Skadeforsikring NUF"}, {"SeguradoraId":"265","Nome…
accepted answer: http://stackoverflow.com/a/21099210
upvote count: 0
answer count: 1
favorite count: 0
tagged with: android

executable-jar
tags question: http://stackoverflow.com/q/21153167
tags question: http://stackoverflow.com/q/21021368
tags question: http://stackoverflow.com/q/21062737
tags question: http://stackoverflow.com/q/21128053
tag name: executable-jar
type: Tag
tags question: http://stackoverflow.com/q/21127030
tags question: http://stackoverflow.com/q/21051696
tags question: http://stackoverflow.com/q/21132569
tags question: http://stackoverflow.com/q/21141794
tags question: http://stackoverflow.com/q/21062421

http://stackoverflow.com/comment/31792683
type: QuestionComment
score: 1
has text: (And keep in mind that "0" has the numeric value 48 and "1" has the numeric value 49.)
type: Comment
comment on: http://stackoverflow.com/q/21127514

http://stackoverflow.com/q/21111701
type: Question
has body: I am using HSQLDB as database in our project. thus My project need 'mydb.script' (original size 7,012 bytes) file (which is bundeled in my project) to connect with the database. It working fine when I deploy it on jboss-eap-6.1 and takes my Database script file from JBOSS_6_HOME/standalone/deployments/myproject.war/WEB-INF/classes/mydb.script location and the size of script file is same as original size i.e. 7,012 bytes. Now when I am deploying the same project on jboss-as-7.1.1.Final which takes my script file from JBOSS_7_HOME/modules/sun/jdk/main/service-loader-resources/mydb.script location which is an incomplete file i.e. size of script file is 1601 bytes and it not taking my script file from JBOSS_7_HOME/standalone/deployments/myproject.war/WEB-INF/classes/mydb.script path,Java Code To get file path of my script file Java Code DBConnectionManager.class.getClassLoader().getResource("").getFile() Can any one help me out Thanks in advance
tagged with: jboss6.x
score: 0
answer count: 1
tagged with: jboss7.x
has title: Switching from jboss-eap-6.1 to jboss-as-7.1.1.Final not able to deploy my complete database file
tagged with: hsqldb
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21158120
tagged with: java
tagged with: jboss

http://stackoverflow.com/a/21112478
upvote count: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21111533
answers question: http://stackoverflow.com/q/21111533
score: 3
type: AcceptedAnswer
has body: Add an index to the field with the 3 letter code: CREATE INDEX index_name ON table_name ( column_name_3_letter_code ) ; See How does database indexing work? for information about DB indexes.
type: Answer

http://stackoverflow.com/a/21150807
has comment: http://stackoverflow.com/comment/31835160
answers question: http://stackoverflow.com/q/21150706
has body: Your registering you ActionListeners within the paint method!! Let's not even worry about the fact that it's un-recommended to override paint Never change or modify the state of the component or any of it's child components within in any paint method, these will be called multiple times during the execution of your application. For example, it's not unusual for a paint method to be called 2-4 times just when the main window is made visible... public void paint(Graphics g) { super.paint(g); /** All this should be done within the constructor // If you are using a layout manager, this is pointless, if your not // then that's another problem super.setSize(new Dimension(560,30)); super.add(replay); super.add(undo); undo.setBorder(new LineBorder(Color.WHITE,3)); replay.setBorder(new LineBorder(Color.WHITE,3)); undo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub Controler.pieces.undo(); Controler.reDraw(); } }); replay.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub System.out.println("Dastiii"); } }); **/ } Take a look at: Performing Custom Painting Painting in AWT and Swing For more details about how and what painting is in Swing
upvote count: 3
has comment: http://stackoverflow.com/comment/31835142
has comment: http://stackoverflow.com/comment/31835312
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21150706

http://stackoverflow.com/comment/31689212
type: QuestionComment
has text: Please edit your question with the full stack trace. Also indicate with line is number `45`.
score: 0
comment on: http://stackoverflow.com/q/21071445
type: Comment

http://stackoverflow.com/q/21109187
has title: Spring security for overlap URL range
has comment: http://stackoverflow.com/comment/31759283
score: 0
has answer: http://stackoverflow.com/a/21942016
accepted answer: http://stackoverflow.com/a/21942016
tagged with: spring
has body: I don't know how to configure spring security to specify different ROLEs for overlaping URLs. &lt;sec:intercept-url pattern="/app/ws**" access="ROLE_WEBSERVICE"/&gt; &lt;sec:intercept-url pattern="/app**" access="ROLE_ADMIN"/&gt; I need to accept user with role ROLE_WEBSERVICE on /app/ws** even if this user does not have user ROLE_ADMIN. Could you point me to the correct place of documentation? I could not find it. Thanks.
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/31758842
tagged with: spring-security
tagged with: spring-security-oauth2

run-configuration
type: Tag
tag name: run-configuration
tags question: http://stackoverflow.com/q/21044160

http://stackoverflow.com/comment/31677336
type: Comment
comment on: http://stackoverflow.com/a/21055962
score: 0
type: AnswerComment
has text: That seems like only static methods can be called back?

http://stackoverflow.com/comment/31674999
has text: I also added the rejects list to see if it would help, it's not necessary to my code
score: 1
comment on: http://stackoverflow.com/a/21058924
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31813716
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21138936
type: Comment
has text: @RichardTingle Why would the difference be more pronounced? It could be *less pronounced*, even, because that's a constant in both approaches. Do you say that it is *faster* to allocate new objects? Because only that way would the ratio be more pronounced.

http://stackoverflow.com/comment/31653921
type: Comment
comment on: http://stackoverflow.com/a/21052185
has text: @DennisMeng I guess I thought that if the input were invalid that it would be discarded and a new value evaluated from command line. If I use `BufferedReader` as @ashokramcse shows I should be able to evaluate the input before actually assigning the value to the `payrate` variable? I will try this. Thanks very much for the help guys. I'll deliver the result.
type: AnswerComment
score: 0

tooltip
tags question: http://stackoverflow.com/q/21146824
tags question: http://stackoverflow.com/q/21142434
type: Tag
tag name: tooltip

http://stackoverflow.com/comment/31804464
has text: Do you mean the whole session is stored in the cookie (i.e. in the user's browser and not on the server) or something else?
comment on: http://stackoverflow.com/q/21134406
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21050652
accepted answer: http://stackoverflow.com/a/21050870
answer count: 1
has body: I am using Selenium Webdriver with Java binding and I'm testing a sorting functionality whereby you have values arranged in an arraylist = {"4"","4.5"","5.5""}. So basically the string contains decimal points as well as double quotation. I have the following code below. The problem is that I keep getting false due to the fact that when it compares the current to previous, it comes with false. Thanks for your help public Boolean checkAscendingOrderScreensize(List&lt;String&gt; list){ if(list == null || list.isEmpty()) return false; if(list.size() == 1) return true; for(int i=1; i&lt;list.size();i++) { String current = list.get(i).toString(); String previous = list.get(i-1).toString(); current = current.replace(",","."); current = current.replace("\"", ""); previous = previous.replace(",","."); previous = previous.replace("\"", ""); if(current.compareTo(previous)&gt;0) return false; } return true; }
has title: How do verify ascending order of string values for an array list?
tagged with: selenium-webdriver
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31650564
has comment: http://stackoverflow.com/comment/31650861
tagged with: java
has answer: http://stackoverflow.com/a/21050870
type: Question
score: 0

http://stackoverflow.com/q/21104344
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/21104370
has title: How to search for files with a specific extention from a specifically given directory and all subdirectories
has answer: http://stackoverflow.com/a/21104370
type: AnsweredQuestion
tagged with: file
type: Question
has body: Just for my own learning, i am trying to find all mp3 files in my music collection and finding all the tracks which do not have id3v2 tags. My code gives me information about the directory i specify, but it doesn't look for the mp3 files in subdirectories. Although i can see that it recognises the directories as i can print them out. Please see my code below. I am very sorry if the formatting of the code is not correct. I am blind and using a screen reader and the formatter on this site is not very accessible to me. public static int numberOfUntaggedTracks(String directory) throws UnsupportedTagException, InvalidDataException, IOException { int untaggedTracks = 0; File f = new File(directory); File l[] = f.listFiles(); for (File x: l) { if (x.isHidden() || !x.canRead()) continue; if (x.isDirectory()) { System.out.println("testing" + x.getPath()); numberOfUntaggedTracks(x.getPath()); } else if (x.getName().endsWith(".mp3")) { Mp3File song = new Mp3File(x.getPath()); if (song.hasId3v1Tag() == false) { untaggedTracks++; } //end of else if checking for .mp3 extension } //end of for loop } return untaggedTracks; }
tagged with: java
has comment: http://stackoverflow.com/comment/31751208

http://stackoverflow.com/comment/31784536
comment on: http://stackoverflow.com/q/21123001
has text: Does the code work with the default pipeline (i.e. without test1Program)? Also just to be safe bind the VAO again before rendering it.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21128564
upvote count: 0
has body: Websearch "depth first tree walk" and/or "breadth first tree walk". The former is more common, but there are applications for the latter. If the tree nodes are doubly-linked (if nodes can reach their parents as well as children), there are depth-first solutions whose only state is the current node. Otherwise, you'll need to maintain a stack (either as a data structure, or by walking recursively) so you can go back up after running out of siblings at a given level of a branch.
score: -2
type: Answer
answers question: http://stackoverflow.com/q/21128452
downvote count: 2

http://stackoverflow.com/a/21094327
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31730918
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21093987
has comment: http://stackoverflow.com/comment/31731049
has body: Replace System.out.println(list.get(factorial(inputBig).intValue())); with System.out.println(list.get(inputBig.intValue())); because You are inserting value to map here: list.put(input.intValue(), output);
answers question: http://stackoverflow.com/q/21093987

http://stackoverflow.com/comment/31748256
type: Comment
has text: A low contention rate is less than one thread using a resource at any given moment. A medium contention rate would be one thread using the a resource on average contention rate but sometimes more. A high contention rate is when more than two thread try to use a resource on average which mean each thread is worse than half the speed it would be. Like I keep telling you there is multiple factors and no black/white answers. You cannot say the results you get will be the same on another machine or another version of Java, or if the code was slightly different, or run for longer.
type: AnswerComment
comment on: http://stackoverflow.com/a/21102677
score: 0

http://stackoverflow.com/comment/31690668
type: QuestionComment
comment on: http://stackoverflow.com/q/21072200
score: 0
has text: Where is your `ArrayList`, and can you not call MySQL through JDBC (Statement has [addBatch](http://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html#addBatch%28java.lang.String%29))?
type: Comment

http://stackoverflow.com/q/21046646
has comment: http://stackoverflow.com/comment/31642761
accepted answer: http://stackoverflow.com/a/21046888
tagged with: listview
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/21046888
possible better answer: http://stackoverflow.com/a/21047250
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21047250
tagged with: java
has comment: http://stackoverflow.com/comment/31642924
has body: I have a listview and I am populating that list view from a ArrayList of custom objects. This is the custom adapter code. @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub final int a=position; FileHolder holder=null; View row = convertView; if(row==null) { LayoutInflater inflater = ((Activity)context).getLayoutInflater(); row = inflater.inflate(textViewResourceId, parent, false); holder=new FileHolder(); holder.file=files.get(position); holder.deleteButton=(ImageButton) row.findViewById(R.id.deleteButton); holder.downloadButton=(ImageButton) row.findViewById(R.id.downloadButton); holder.deleteButton.setTag(holder.file); holder.downloadButton.setTag(holder.file); holder.fileName= (TextView) row.findViewById(R.id.fileName); holder.fileName.setText(holder.file.getFileName()); } else { holder=(FileHolder) row.getTag(); } fPOJO=holder.file; final AsyncCall call=new AsyncCall(); holder.downloadButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub MODE=0; //call.execute(MODE); } }); holder.deleteButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Toast.makeText(getContext(), "Delete File "+(String.valueOf(a))+" "+fPOJO.getFileName(), Toast.LENGTH_LONG).show(); MODE=1; //call.execute(MODE); } }); return row; } public static class FileHolder{ FilesPOJO file; TextView fileName; ImageButton downloadButton; ImageButton deleteButton; } There are two buttons one for file delete and other for file download. I have implemented on click listeners for these two buttons. The problem is when I click any button the fileName in the Toast message is different from the file name that I see on the screen display. For ex: I have 5 files with names delete.png upload.png share.png referesh.png copy.png and now when I click delete button corresponding to referesh.png file the …
type: Question
has title: Buttons in ListView each item layout
answer count: 2

http://stackoverflow.com/comment/31681743
comment on: http://stackoverflow.com/q/21067337
score: 0
type: Comment
type: QuestionComment
has text: What are you expecting?

http://stackoverflow.com/q/21137984
type: Question
has comment: http://stackoverflow.com/comment/31824265
has comment: http://stackoverflow.com/comment/31810826
has title: Access components created on runtime, and add actionListener
has comment: http://stackoverflow.com/comment/31811650
has answer: http://stackoverflow.com/a/21139367
tagged with: awt
score: 0
has comment: http://stackoverflow.com/comment/31811023
has comment: http://stackoverflow.com/comment/31811042
answer count: 1
has body: in my code i am creating components on runtime, like JTextField and JButton, and I want to add actionListener to JButton created during execution of program. Using following code I am only getting static components, but not new components created on runtime. static public &lt;T extends Component&gt; T getComponentByName(Window window, String name) { // loop through all of the class fields on that form for (Field field : window.getClass().getDeclaredFields()) { try { // let us look at private fields, please field.setAccessible(true); // compare the variable name to the name passed in if (name.equals(field.getName())) { // get a potential match (assuming correct &amp;lt;T&amp;gt;ype) final Object potentialMatch = field.get(window); // cast and return the component return (T) potentialMatch; } } catch (SecurityException ex) { } catch(IllegalArgumentException ex) { } catch(IllegalAccessException ex) { // ignore exceptions } } // no match found return null; } In a test code block I am trying to get components like following JLabel tt = new JLabel("testing"); this.jPanel_MainWrap.add(tt); tt.setBounds(20,50,100,30); JLabel txt = Awt1.getComponentByName(this, "jLabel1"); JOptionPane.showMessageDialog(null, "Error :" + txt.getText(), "InfoBox: ", JOptionPane.ERROR_MESSAGE);
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/31815415
has comment: http://stackoverflow.com/comment/31810623
tagged with: java

http://stackoverflow.com/comment/31727976
score: 0
has text: Oh brother, that was silly. Thank you anyway!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21092638

http://stackoverflow.com/a/38667712
has body: Using property server.port=8080 for instance like mentioned in other answers is definitely a way to go. Just wanted to mention that you could also expose an environment property: SERVER_PORT=8080 Since spring boot is able to replace "." for "_" and lower to UPPER case for environment variables in recent versions. This is specially useful in containers where all you gotta do is define that environment variable without adding/editing application.properties or passing system properties through command line (i.e -Dserver.port=$PORT)
downvote count: 0
type: Answer
score: 11
upvote count: 11
answers question: http://stackoverflow.com/q/21083170
has comment: http://stackoverflow.com/comment/91665637

http://stackoverflow.com/q/21183002
tagged with: httpsession
answer count: 1
tagged with: jsp
linked to: http://stackoverflow.com/q/52353
type: UnansweredQuestion
has title: Measure the size of Session Attribute Objects
tagged with: java
type: Question
tagged with: jakarta-ee
has body: I want to measure the size of an object (Serialized or not) when it is set to HttpSession. How can I do this ? Even some supporting questions found, it could not be used.. Any one know how I can do this ? Probably, usage of session listener could be valuable.But how to measure the size of the Object ? For example session.setAttribute("attrName",sessionObj); How to measure the size of this sessionObj ?
has answer: http://stackoverflow.com/a/21183579
tagged with: servlets
score: 0

http://stackoverflow.com/comment/31828723
type: Comment
comment on: http://stackoverflow.com/a/21147354
has text: Yes, thanks a lot. But I am still wondering about the display of the input after changing my code.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31650274
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21050491
has text: On what line did you get the error message? Was it the last line, where you call `getCursor`?

http://stackoverflow.com/comment/31858288
type: Comment
type: QuestionComment
has text: ThreadA t= new ThreadA (); t.setName("Thread Main"); t.start(); System.out.println("Waiting for ThreadA to complete..."+Thread.currentThread().getName()); synchronized (t) { Thread.currentThread().sleep(500);; System.out.println("Finally the Thread is notified ... "+t.getSum()); }
comment on: http://stackoverflow.com/q/21163891
score: 0

http://stackoverflow.com/comment/31757400
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21107718
has text: Hi Anil, thanks this one one worked for me... however there are some issues left but should be minor.

http://stackoverflow.com/a/21044778
downvote count: 0
answers question: http://stackoverflow.com/q/21044696
upvote count: 2
has body: System.out.println always ends the current line. In your code, after println(" " + i) the cursor is already moved to new line. You should print the number with print, then print space character, whatever string you want, and then, end the line. You can do it with println. If you don't want to print anything specific on the same line (e.g. because number is not a multiple of 5), then you still need to end the line with an empty println. Please don't print \n character. Use methods like println to end the line instead, as they are cross-platform compatible. public static void main(String[] args) { for(int i=1 ; i&lt;101; i++) { System.out.print(i); if(i % 2 != 0 &amp;&amp; i % 5 == 0) System.out.println(" This is an odd number and a multiple of 5"); else System.out.println(); } }//main
type: Answer
score: 2

http://stackoverflow.com/comment/31649999
score: 0
has text: @crush I don't get what your trying to say
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21049953

http://stackoverflow.com/comment/31712615
type: QuestionComment
has text: by using `SELECT Diarycode FROM LOGBOOKTABLE WHERE STUDENTUSERNAME=? OR SUPERVISORUSERNAME=? AND PROJECT_APPROVE_STATUS=?)`, are you able to get the `Diarycode`?
comment on: http://stackoverflow.com/q/21083856
score: 0
type: Comment

http://stackoverflow.com/comment/31754497
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21081972
score: 0
has text: *"If you want the full source code to actually run the game,.."* Nobody (worth listening to) wants that. For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) as an [edit to the question](http://stackoverflow.com/posts/21081972/edit).

http://stackoverflow.com/a/44273304
downvote count: 0
has body: My problem was that I had @WebServlet("/route") and the same servlet declared in web.xml
type: Answer
answers question: http://stackoverflow.com/q/21039049
upvote count: 3
score: 3

http://stackoverflow.com/q/21127252
has comment: http://stackoverflow.com/comment/31792193
has body: I have 2 classes for the beginning of a pacman game and I am really confused by how the key listener or keybindings work. I have methods for move up, down, right and left. I have spent hours trying to figure i out and it wont call regular methods and the components are confusing me. Could someone please help to show me how to get the end result of the arrow keys calling methods? i have the code below, but I took out all of my key tests. import java.awt.GridLayout; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class GUI { JPanel myPanel = new JPanel(new GridLayout(50, 50, 1, 1)); int[][] myLabels = new int[50][50]; //Set Game Black public int[][] setBlack(int[][] arrayLabels){ myLabels = arrayLabels; for (int i = 0; i &lt; myLabels.length; i++) { for (int j = 0; j &lt; myLabels[0].length; j++) { JLabel black = new JLabel(new ImageIcon("black-square.jpg"), JLabel.CENTER); myLabels[i][j] = 1; } } return myLabels; } //get panel any time changes are made to array public JPanel getPanel(int[][] arrayLabels){ myLabels = arrayLabels; for (int i = 0; i &lt; myLabels.length; i++) { for (int j = 0; j &lt; myLabels[0].length; j++) { JLabel black = new JLabel(new ImageIcon("black-square.jpg"), JLabel.CENTER); JLabel pacman = new JLabel(new ImageIcon("pacman.png"), JLabel.CENTER); if(myLabels[i][j] == 1){ myPanel.add(black); } if(myLabels[i][j] == 2){ myPanel.add(pacman); } } } return myPanel; } //moves pacman up public int[][] moveUp(int[][] arrayLabels){ myLabels = arrayLabels; for (int i = 0; i &lt; myLabels.length; i++) { for (int j = 0; j &lt; myLabels[0].length; j++) { if(myLabels[i][j] == 2){ myLabels[i][j] = 1; myLabels[i-1][j] = 2; } } } return myLabels; } //========= //moves pacman up public void setLabel(int[][] arrayLabels){ myLabels = arrayLabels; } public int[][] moveUpKey(){ for (int i = 0; i &lt; myLabels.length; i++) { for (int j = 0; j &lt; myLabels[0].length; j++) { if(myLabels[i][j] == 2){…
score: 0
answer count: 1
has title: Pacman Game KeyListener
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21127391
tagged with: pacman
tagged with: java
tagged with: keylistener
type: Question

http://stackoverflow.com/a/34922401
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/21107985
downvote count: 0
type: Answer
has body: atg.service.collections.filter.droplet.CollectionFilter is the class for the component /atg/commerce/collections/filter/droplet/GiftlistSiteFilterDroplet Just invoke the getFilter() method in the class Refer:- https://docs.oracle.com/cd/E23095_01/Platform.93/apidoc/atg/service/collections/filter/droplet/CollectionFilter.html https://docs.oracle.com/cd/E26180_01/Platform.94/ATGCommStoreGuide/html/s1712collectionfilter01.html Thanks

http://stackoverflow.com/q/21050181
linked to: http://stackoverflow.com/q/3672607
answer count: 1
has comment: http://stackoverflow.com/comment/31649633
tagged with: adobe
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21050454
type: Question
has comment: http://stackoverflow.com/comment/31649872
has body: The adobe showing the special Spanish characters as "?". Do I need to fix the issue from adobe life cycle or from Java side? I forward XML to adobe life cycle with UTF-8. Do I need to encode it to something else like ISO-8859-1? What may be the problem here? For example the word Certificación showing in the PDF as Certificaci?n. in the console I see the words looks fine but once I call the adobe to get the PDF, I get the PDF with words like Certificaci?n. I convert the object using public static String obj2Xml(Class&lt;?&gt; className, Object obj) throws ServiceException { try { JAXBContext jaxbContext = JAXBContext.newInstance(className); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); StringWriter writer = new StringWriter(); jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); jaxbMarshaller.marshal(obj, writer); return writer.getBuffer().toString(); } catch (JAXBException jaxbException) { throw new ServiceException(jaxbException); } } i already did use ISO-8859-1 but i tested in HTML and was fine. my issue how can i encode the XML from UTF-8 to ISO-8859-1 as well as adobe life cycle. as i mentioned i pass XML to adobe and we use XSD where i changed as below but still the console showing the XML with UTF-8
has title: PDF showing the special Spanish charters as "?"
tagged with: java
accepted answer: http://stackoverflow.com/a/21050454
score: 0

http://stackoverflow.com/a/21082172
score: 1
has comment: http://stackoverflow.com/comment/31709357
upvote count: 1
has comment: http://stackoverflow.com/comment/31709490
has comment: http://stackoverflow.com/comment/31709425
answers question: http://stackoverflow.com/q/21082129
accepted answer of: http://stackoverflow.com/q/21082129
has body: You could try looping over the file with a while-loop. Replace phrase = inFile.nextLine(); with: while(inFile.hasNextLine()) // While there are lines in the file phrase += inFile.nextLine(); // Add line to 'phrase' Don't forget to initialize String phrase with an empty string: String phrase = ""; Edit: Your final code should look like this, with some changes, listed at the end of this answer. public static void main(String[] args) throws FileNotFoundException { String phrase = ""; // a string of characters int countBlank; // the number of blanks (spaces) in the phrase int length; // the length of the phrase char ch; // an individual character in the string int countA; int countE; int countS; int countT; java.io.File file = new java.io.File("sample.txt"); Scanner inFile = new Scanner(file); while (inFile.hasNextLine()) phrase += inFile.nextLine(); // Add line to 'phrase' length = phrase.length(); // Initialize counts while (true) { countBlank = 0; countA = 0; countE = 0; countS = 0; countT = 0; for (int i = 0; i &lt; length; i++) { ch = phrase.charAt(i); switch (ch) { case 'a': case 'A': countA++; break; case 'e': case 'E': countE++; break; case 's': case 'S': countS++; break; case 't': case 'T': countT++; break; case ' ': countBlank++; break; default: break; } } System.out.println(); System.out.println("Number of blank spaces: " + countBlank); System.out.println(); System.out.println("Number of A's: " + countA); System.out.println(); System.out.println("Number of E's: " + countE); System.out.println(); System.out.println("Number of S's: " + countS); System.out.println(); System.out.println("Number of T's: " + countT); break; } } Changes: Deleted Scanner scan = new Scanner(System.in); since you don't use it. Added the code I suggested above Deleted if (phrase.equalsIgnoreCase("quit")) break; Added switch-case when ch == ' ' Added default-case since it is considered good programming practice.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31709481
downvote count: 0
has comment: http://stackoverflow.com/comment/31709529
has comment: http://stackoverflow.com/comment/31709579
type: Answer

http://stackoverflow.com/a/21034516
upvote count: 2
downvote count: 1
has body: In java, you cannot compare strings using ==. You have to use equals() if (dati.equals("vnod")) ... The == just compare the reference (like a pointer) of equalness and not it's referenced content. See also here.
has comment: http://stackoverflow.com/comment/31622151
score: 1
has comment: http://stackoverflow.com/comment/31622167
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31622051
accepted answer of: http://stackoverflow.com/q/21034059
type: Answer
answers question: http://stackoverflow.com/q/21034059
has comment: http://stackoverflow.com/comment/31661537

http://stackoverflow.com/comment/31872146
has text: Yeah, there's something like Predicates in ZouZou's Java 8 solution (which currently also fails to deal with the case where there are nulls in the array). The point is, you shouldn't try to re-invent the wheel for something so simple. How many times did you end up editing this post? And it's _still_ not perfect. I think that's what @hawk meant with his/her bald comment.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21170652

http://stackoverflow.com/a/21050565
type: AcceptedAnswer
downvote count: 0
has body: Fixed it! For future reference, the code you need is: field.putClientProperty("JTextField.variant", "search");
accepted answer of: http://stackoverflow.com/q/21049945
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/21049945

http://stackoverflow.com/q/21042661
has answer: http://stackoverflow.com/a/21042801
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31635497
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: testing
linked to: http://stackoverflow.com/q/38922754
accepted answer: http://stackoverflow.com/a/21042757
has title: How to test method with Calendar.getInstance()
has comment: http://stackoverflow.com/comment/77499829
has body: I have to calculate the time until the next day at ~ 2:00 AM Following code seems to work fine public static long millisTillNextDay() { Date now = new Date(); Calendar cal = Calendar.getInstance(); cal.set(Calendar.DAY_OF_MONTH, cal.get(Calendar.DAY_OF_MONTH) + 1); cal.set(Calendar.HOUR, 3); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); return cal.getTimeInMillis() - now.getTime(); } However, a few days ago it happened that this method calculated the time until 02:00 PM instead and I do not know why. Because of this I want to create some test scenarios to simulate different values for Calendar.getInstance().
has answer: http://stackoverflow.com/a/21042744
downvote count: 0
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/21042950
has answer: http://stackoverflow.com/a/21056649
linked to: http://stackoverflow.com/q/9625306
possible better answer: http://stackoverflow.com/a/21042801
has answer: http://stackoverflow.com/a/21042757

faceted-search
tag name: faceted-search
type: Tag
tags question: http://stackoverflow.com/q/21132276
tags question: http://stackoverflow.com/q/21115614

http://stackoverflow.com/q/21103363
downvote count: 1
has comment: http://stackoverflow.com/comment/31826406
has comment: http://stackoverflow.com/comment/31833600
has comment: http://stackoverflow.com/comment/31751039
favorite count: 0
has comment: http://stackoverflow.com/comment/31752866
tagged with: uuid
has answer: http://stackoverflow.com/a/65463266
accepted answer: http://stackoverflow.com/a/21103563
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/65463266
has comment: http://stackoverflow.com/comment/31749465
tagged with: java
has answer: http://stackoverflow.com/a/21103563
type: Question
score: 5
has comment: http://stackoverflow.com/comment/31749288
tagged with: encoding
has comment: http://stackoverflow.com/comment/31752756
has title: Base32 encode UUID in Java
has answer: http://stackoverflow.com/a/68900041
upvote count: 6
has body: What is the most time efficient way to create and Base32 encode a random UUID in Java? I would like to use Base32 encoding to store globally unique IDs that are usable in URLs.
has comment: http://stackoverflow.com/comment/31749571
answer count: 3

http://stackoverflow.com/a/21062558
has body: Use this one. Thread thread = new Thread(new Runnable() { @Override public void run() { String result = Utils.httpPost("MyURLHere", SomePostData); if (result != null) { handler.sendEmptyMessage(0); } } }); thread.start(); Handler handler = new Handler() { @Override public void handleMessage(Message msg) { makeIconVisibile(icon); } };
downvote count: 0
answers question: http://stackoverflow.com/q/21061911
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/31801997
type: Comment
type: QuestionComment
has text: @Raghunandan - I added the initialization of the inflater to the question.
comment on: http://stackoverflow.com/q/21132989
score: 0

encoding
tags question: http://stackoverflow.com/q/21178811
tags question: http://stackoverflow.com/q/21061433
type: Tag
tags question: http://stackoverflow.com/q/21102520
tags question: http://stackoverflow.com/q/21166633
tags question: http://stackoverflow.com/q/21028942
tags question: http://stackoverflow.com/q/21118684
tag name: encoding
tags question: http://stackoverflow.com/q/21090083
tags question: http://stackoverflow.com/q/21062644
tags question: http://stackoverflow.com/q/21162106
tags question: http://stackoverflow.com/q/21103363
tags question: http://stackoverflow.com/q/21055249

http://stackoverflow.com/a/21089901
has comment: http://stackoverflow.com/comment/31750787
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/31729983
answers question: http://stackoverflow.com/q/21089596
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/31722802
has body: //Global Declaration private Vector&lt;Vector&lt;String&gt;&gt; data; //used for data from database private Vector&lt;String&gt; header; //used to store data header private int count=0; //Display only header on form load //create header for the table header = new Vector&lt;String&gt;(); header.add("Column1"); header.add("Column2"); ... model=new DefaultTableModel(data,header); table = new JTable(model); //in actionPerformed() public void actionPerformed(ActionEvent ae){ if(ae.getSource()==yourMenuItem){ data=get(); for(int i=0;i&lt;count;i++){ Object[] d={data.get(i).get(0),data.get(i).get(1),data.get(i).get(2)}; model.addRow(d); } } } This will help you to get data from database get(){ Vector&lt;Vector&lt;String&gt;&gt; doublevector = new Vector&lt;Vector&lt;String&gt;&gt;(); Connection conn = dbConnection();//Your Database connection code PreparedStatement pre1 = conn.prepareStatement("select * from Table"); ResultSet rs1 = pre1.executeQuery(); while(rs1.next()) { Vector&lt;String&gt; singlevector = new Vector&lt;String&gt;(); singlevector.add(rs1.getString(1)); singlevector.add(rs1.getString(2)); .... doublevector.add(singlevector); count++ } return doublevector; }

http://stackoverflow.com/q/21182467
has comment: http://stackoverflow.com/comment/31891624
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/21189945
has comment: http://stackoverflow.com/comment/31892261
type: Question
has comment: http://stackoverflow.com/comment/31891710
has comment: http://stackoverflow.com/comment/31892203
tagged with: java
has answer: http://stackoverflow.com/a/21183494
score: 0
has body: I want to split a single string containing normal text as well as html code into array of string. I tried to search on google but not found any suitable suggestion. Consider the following string: blahblahblahblahblahblahblahblahblahblah blahblah First para blahblahblahblah blahblahblahblahblahblahblahblahblahblah hello blahblahblahblahblahblahblahblahblahblah blahblah Second Para lahblahblahblahblah blahblahblahblahblahblahblahblahblahblah this becomes: s[0]=whole first para s[1]=html code s[2]=whole second para Is it possible through jsoup ?. Or I need any other api?
answer count: 2
tagged with: string
has title: separate html coded string and normal string

http://stackoverflow.com/a/21150197
answers question: http://stackoverflow.com/q/21150154
score: 6
has body: According to the JVM specification: In Oracle's implementation of a compiler for the Java programming language prior to Java SE 6, the jsr instruction was used with the ret instruction in the implementation of the finally clause
downvote count: 0
has comment: http://stackoverflow.com/comment/31833981
type: Answer
upvote count: 6

http://stackoverflow.com/q/21082790
has comment: http://stackoverflow.com/comment/31710601
possible better answer: http://stackoverflow.com/a/21082874
has answer: http://stackoverflow.com/a/21082874
has answer: http://stackoverflow.com/a/21082915
has comment: http://stackoverflow.com/comment/31710532
has answer: http://stackoverflow.com/a/21082861
tagged with: android
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31710528
has answer: http://stackoverflow.com/a/21082881
score: 0
tagged with: java
has body: I am creating a Tip calculator app..where I accept inputs from users in terms of total amount. I want add an exception to the code where it would Toast a message if the User does not enter a valid number. I have three buttons and have created different methods for every button. I am pasting the code below for the one of the buttons i.e. 10% tip private void CalculateTipListener(){ BtnTip10.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { try { double amount = Double.parseDouble(etTotalAmount.getText().toString()); double TipAmount=amount/10; tvTipAmount.setText("Tip: $"+TipAmount); } catch(IOException e){ e.printStackTrace(); } } }); Error logs give me a NumberFormatException error. 01-12 20:10:39.872: E/AndroidRuntime(3299): java.lang.NumberFormatException: Invalid double: "gagajgalk" 01-12 20:10:39.872: E/AndroidRuntime(3299): at java.lang.StringToReal.invalidReal(StringToReal.java:63) 01-12 20:10:39.872: E/AndroidRuntime(3299): at java.lang.StringToReal.parseDouble(StringToReal.java:269) 01-12 20:10:39.872: E/AndroidRuntime(3299): at java.lang.Double.parseDouble(Double.java:295) 01-12 20:10:39.872: E/AndroidRuntime(3299): at com.example.tipcalculator.TipCalculatorActivity$2.onClick(TipCalculatorActivity.java:47) 01-12 20:10:39.872: E/AndroidRuntime(3299): at android.view.View.performClick(View.java:4424) 01-12 20:10:39.872: E/AndroidRuntime(3299): at android.view.View$PerformClick.run(View.java:18383) 01-12 20:10:39.872: E/AndroidRuntime(3299): at android.os.Handler.handleCallback(Handler.java:733) 01-12 20:10:39.872: E/AndroidRuntime(3299): at android.os.Handler.dispatchMessage(Handler.java:95) 01-12 20:10:39.872: E/AndroidRuntime(3299): at android.os.Looper.loop(Looper.java:137) 01-12 20:10:39.872: E/AndroidRuntime(3299): at android.app.ActivityThread.main(ActivityThread.java:4998) 01-12 20:10:39.872: E/AndroidRuntime(3299): at java.lang.reflect.Method.invokeNative(Native Method) 01-12 20:10:39.872: E/AndroidRuntime(3299): at j…
accepted answer: http://stackoverflow.com/a/21082861
has comment: http://stackoverflow.com/comment/31710477
type: Question
has comment: http://stackoverflow.com/comment/31710554
has title: Catch IOException for invalid input

http://stackoverflow.com/q/21113168
downvote count: 0
has comment: http://stackoverflow.com/comment/31773486
linked to: http://stackoverflow.com/q/10073695
has title: How to check for unbound request parameters in a Spring MVC controller method?
has comment: http://stackoverflow.com/comment/31773378
favorite count: 0
has comment: http://stackoverflow.com/comment/31766515
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21113472
has body: Given a Spring-MVC controller method: @RequestMapping(value = "/method") public void method(ParamModel params) { /*...*/ } with model class: public class ParamModel { public int param1; } The following two results are as expected/desired: Request with param1=1: method completes successfully. Request with param1=blah: JBWEB000120: The request sent by the client was syntactically incorrect. However... If a request is made with an additional parameter (e.g. nonexistentparam=1), there is no error. Is there a way to ensure the request is validated and rejected if it includes any parameters that aren't part of this API?
has answer: http://stackoverflow.com/a/21113480
tagged with: spring
has answer: http://stackoverflow.com/a/42648661
tagged with: parameters
has comment: http://stackoverflow.com/comment/31770878
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/31766672
type: Question
has answer: http://stackoverflow.com/a/45207318
score: 5
upvote count: 5
tagged with: controller
has answer: http://stackoverflow.com/a/21114315
has comment: http://stackoverflow.com/comment/31771872

http://stackoverflow.com/comment/31899938
type: Comment
score: 1
has text: Running the project compiles and runs the project with any project properties that may be set while Shift+F6 runs the file without the project properties. The project properties is most likely setting the Look and feel to `CrossPlatformLookAndFeel` (the uglier one) whereas running the file defaults to `SystemLookAndFeel` which gets it's properties from the OS it is running on. To make sure you always gets the prettier look add `UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());` as the first command in your main method. This is from the link by boxed.
comment on: http://stackoverflow.com/q/21183527
type: QuestionComment

http://stackoverflow.com/a/21153930
answers question: http://stackoverflow.com/q/21151512
score: 0
has comment: http://stackoverflow.com/comment/31865158
type: Answer
has comment: http://stackoverflow.com/comment/31866958
has body: You can use this approach to get 4 combinations, but not all 8 combinations. Because in this approach when recursion happens the string changes without'?' , but it will update the index in the memory. thats why its giving only four answers. If you increase the number it will give you different combination equals to the number public class Recursion { private static void replaceCharacters(char[] inputString, int stringLength, int characterIndex) { if (characterIndex &lt; stringLength) { if (inputString[characterIndex] == '?') { inputString[characterIndex] = '1'; replaceCharacters(inputString, stringLength, characterIndex + 1); inputString[characterIndex] = '0'; replaceCharacters(inputString, stringLength, characterIndex + 1); } else { replaceCharacters(inputString, stringLength, characterIndex + 1); } } else { System.out.println(new String(inputString)); } } public static void main(String[] args) { String testString = "1???"; replaceCharacters(testString.toCharArray(), testString.length(), 0); } }
has comment: http://stackoverflow.com/comment/31860828

http://stackoverflow.com/q/21040219
answer count: 1
has body: My current project is writing a HTTP-Webserver in Java. The server checks a "deployment-directory" every two seconds and searches for a file named content.jar. If the file was changed the server deployes it. The file contains servlets which will be loaded by an URLClassLoader. On every deployment a new classloader is created. In a different project my servlets are being developed. I wrote an Ant-buildfile that creates the content.jar file and moves it into the server's deployment directory. Unfortunately I get an Ant error: BUILD FAILED [path]\WebServerServlet\Ant\Build.xml:15: Unable to remove existing file [path]\WebServer\web\content.jar I suppose that the file is locked on the filesystem by the JVM - is there a way to tell Ant it should not try to delete and move the file but to overwrite it instead? Otherwise, does anyone have an idea how to avoid the file getting locked by the JVM by changing my deployment system? EDIT I have now found a solution! As discussed in this question the only thing i had to add was URLClassLoader loader = new URLClassLoader(..); //class loading stuff here loader.close() //the line all the trouble was about With this appendix my Ant-buildfile is able to delete the "old" jar in the deployment-directory and move the new one into it.
tagged with: deployment
has title: Webserver deployment issue
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21042146
accepted answer: http://stackoverflow.com/a/21042146
tagged with: java
type: Question
tagged with: locking
tagged with: ant
linked to: http://stackoverflow.com/q/11273303
tagged with: webserver
score: 0

gson
tags question: http://stackoverflow.com/q/21066413
tags question: http://stackoverflow.com/q/21115879
tags question: http://stackoverflow.com/q/21099118
tags question: http://stackoverflow.com/q/21176195
tags question: http://stackoverflow.com/q/21127164
tags question: http://stackoverflow.com/q/21151189
tags question: http://stackoverflow.com/q/21021105
tags question: http://stackoverflow.com/q/21031264
tag name: gson
tags question: http://stackoverflow.com/q/21158432
tags question: http://stackoverflow.com/q/21157309
tags question: http://stackoverflow.com/q/21050346
tags question: http://stackoverflow.com/q/21062727
type: Tag
tags question: http://stackoverflow.com/q/21064418
tags question: http://stackoverflow.com/q/21064740

http://stackoverflow.com/comment/31780322
comment on: http://stackoverflow.com/a/21120983
has text: I think my mistake was in the use of "int" instead of "Integer". Everything worked out perfectly with "Integer" instead. Any idea why this is? Your answer was perfect though! Thank you very much!
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/21096212
has comment: http://stackoverflow.com/comment/31735567
has answer: http://stackoverflow.com/a/21097252
has answer: http://stackoverflow.com/a/21097211
tagged with: concurrency
has comment: http://stackoverflow.com/comment/31735028
has comment: http://stackoverflow.com/comment/31734736
score: 0
answer count: 2
has body: I have a simple application in which I create 3 threads inside a class to ping 3 different websites and note the time taken to do so. I wish to enhance it by seeing which thread out of the 3 executes successfully first and terminating the other two . Which class of the JDK would be helpful in doing so ? and how ? Sample code to ping websites : public static boolean pingUrl(final String address) { try { final URL url = new URL("http://" + address); final HttpURLConnection urlConn = (HttpURLConnection) url.openConnection(); urlConn.setConnectTimeout(1000 * 10); // mTimeout is in seconds final long startTime = System.currentTimeMillis(); urlConn.connect(); final long endTime = System.currentTimeMillis(); if (urlConn.getResponseCode() == HttpURLConnection.HTTP_OK) { System.out.println("Time (ms) : " + (endTime - startTime)); System.out.println("Ping to "+address +" was success"); return true; } } catch (final MalformedURLException e1) { e1.printStackTrace(); } catch (final IOException e) { e.printStackTrace(); } return false; }
possible better answer: http://stackoverflow.com/a/21097211
has title: Parallel execution and termination of multiple threads
accepted answer: http://stackoverflow.com/a/21097252
tagged with: parallel-processing
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
type: Question

http://stackoverflow.com/comment/31729456
comment on: http://stackoverflow.com/q/21093441
has text: Mostly I solve that problem in the same manner as you did. I really would like too see a more elegant way too :-)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21162083
possible better answer: http://stackoverflow.com/a/21162392
tagged with: simpledateformat
tagged with: java
has answer: http://stackoverflow.com/a/21162392
tagged with: date
has comment: http://stackoverflow.com/comment/31854839
type: Question
linked to: http://stackoverflow.com/q/5636491
answer count: 2
downvote count: 1
has title: SimpleDateFormat add some minutes
favorite count: 0
tagged with: android
upvote count: 4
tagged with: parsing
has answer: http://stackoverflow.com/a/21178409
accepted answer: http://stackoverflow.com/a/21178409
has comment: http://stackoverflow.com/comment/31884720
has body: Im trying parse a date from a JSONObject "timcre_not":"2013-12-11 21:25:04.800842+01" and I parse with mDate = new SimpleDateFormat("y-M-d h:m:s.SSSSSSZZ", Locale.ENGLISH).parse(json.getString("timcre_not")); but the mDate value is: Wed Dec 11 21:38:24 CET 2013 What is happening?
type: AnsweredQuestion
score: 3

http://stackoverflow.com/q/21104197
has comment: http://stackoverflow.com/comment/31751038
has comment: http://stackoverflow.com/comment/31751015
linked to: http://stackoverflow.com/q/19840542
has body: This is exactly the same question as Default JDBC date format when reading date as a string from ResultSet, but that question was never actually answered as such; people just offered alternative ways to write the code. I'm specifically asking if anyone knows where the default conversion format is specified, and if it is defined by a JDBC spec somewhere, or just left up to the individual JDBC driver. If the latter, then an additional question of how does Oracle 10g JDBC do this? ** Added 15-Jan: Sorry, I thought the question was sufficiently clear, but apparently not. I am not trying to retrieve a date value from a database, and have no need for suggestions on ways to do that. I do not think this is a duplicate of the referenced question, which is why I asked a separate question here. Whilst the title is the pretty much same, the referenced question (regardless of what the OP intended) has been answered with alternative approaches for retrieving a date value from a database, which is not what I wish to know. Cheers,
type: Question
has title: Where is the date format specified when reading a date as a string from JDBC ResultSet
has comment: http://stackoverflow.com/comment/31785372
possible better answer: http://stackoverflow.com/a/21104225
score: 4
has comment: http://stackoverflow.com/comment/31783913
has answer: http://stackoverflow.com/a/21104225
has answer: http://stackoverflow.com/a/21104390
has comment: http://stackoverflow.com/comment/31785502
answer count: 3
has answer: http://stackoverflow.com/a/21174524
accepted answer: http://stackoverflow.com/a/21174524
favorite count: 0
tagged with: jdbc
upvote count: 4
linked to: http://stackoverflow.com/q/14700962
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/31764278
tagged with: java

http://stackoverflow.com/q/21148149
score: 1
favorite count: 0
tagged with: jframe
tagged with: swing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22620871
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/31830139
type: Question
has title: Accomdations to be made if not extending JFrame?
has comment: http://stackoverflow.com/comment/31830157
has answer: http://stackoverflow.com/a/22620871
answer count: 1
tagged with: user-interface
downvote count: 0
has body: I've been learning Java Swing GUI from YouTube videos, as I don't learn them till around the end of next semester in university, and I find it too interesting to wait. However, although the video maker has made it pretty easy to follow, and I've learned a lot, I can tell that he probably learned it himself as some of his coding practices are a bit different than how we learned in school. (For example, he doesn't care about encapsulation or camel-case.) This makes me worry that everything I'm learning will be useless. All of the projects he does in his videos are all within one class using inner classes implementing ActionListener, MouseListener, etc. So I don't know how to connect what I learned from these videos with the GUI-less multiple classes projects I worked on during school. I'll give a general example of how the projects are: (I just add the private because that's what I'm used to) public class Something extends JFrame { private JPanel topPanel; private JPanel bottomPanel; private JLabel label; private JButton button; public Something() { Container pane = this.getContentPane(); //need help with this topPanel = new JPanel(); topPanel.setLayout(new GridLayout(1,1)); label = new JLabel("x"); topPanel.add(label); pane.add(topPanel); bottomPanel = new JPanel(); bottomPanel.setLayout(new GridLayout(1,1)); button = new JButton("Button"); bottomPanel.add(button); pane.add(bottomPanel); Event e = new Event(); button.addActionListener(e); } public class Event implements ActionListener { } Also, I read another thread on here on why extending JFrame is a bad idea. If I had to accommodate, would I just create a JFrame frame, then do add(frame)? And then just make sure I add the next layer to the frame? What accommodations would I have to do?

http://stackoverflow.com/comment/31692227
type: Comment
comment on: http://stackoverflow.com/a/21073177
has text: You answered better than me. +1 to your answer for the preparedstatement stuff.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/31657614
score: 0
has text: As for the Java, you could take a look at [JSF](http://en.wikipedia.org/wiki/JavaServer_Faces).
comment on: http://stackoverflow.com/q/21054392
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21031312
downvote count: 0
has comment: http://stackoverflow.com/comment/31616702
type: Answer
score: 2
upvote count: 2
has body: The error is telling you exactly what's wrong -- your layout, the GroupLayout isn't serializable, and so this is preventing your object from being serialized. A question and a possible solution: why try to serialize and send a JFrame? Instead why not send the model data or the changed model data, and let the other end recreate or modify its view accordingly?
has comment: http://stackoverflow.com/comment/31616520
answers question: http://stackoverflow.com/q/21031251

http://stackoverflow.com/q/21102871
tagged with: java
has body: I'm trying to use Hive JSON SerDe to put Twitter JSON into Hive tables. I first import the JSON into one table defined by ROW FORMAT SERDE and then import it to another table stored as an RCFile. It works up to a point but then I get a ClassCastException of the following nature: java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while processing row [Error getting row data with exception java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Double at org.apache.hadoop.hive.serde2.objectinspector.primitive.JavaDoubleObjectInspector.get(JavaDoubleObjectInspector.java:40) at org.apache.hadoop.hive.serde2.SerDeUtils.buildJSONString(SerDeUtils.java:259) at org.apache.hadoop.hive.serde2.SerDeUtils.buildJSONString(SerDeUtils.java:307) at org.apache.hadoop.hive.serde2.SerDeUtils.buildJSONString(SerDeUtils.java:354) at org.apache.hadoop.hive.serde2.SerDeUtils.buildJSONString(SerDeUtils.java:354) at org.apache.hadoop.hive.serde2.SerDeUtils.buildJSONString(SerDeUtils.java:354) at org.apache.hadoop.hive.serde2.SerDeUtils.getJSONString(SerDeUtils.java:220) at org.apache.hadoop.hive.ql.exec.MapOperator.process(MapOperator.java:667) at org.apache.hadoop.hive.ql.exec.ExecMapper.map(ExecMapper.java:141) at org.apache.hadoop Here's the schema I'm using to define the SerDe table: CREATE EXTERNAL TABLE gh_raw ( coordinates struct &lt; coordinates: array &lt;double&gt;, type: string&gt;, created_at string, entities struct &lt; hashtags: array &lt;struct &lt;text: string&gt;&gt;, media: array &lt;struct &lt; display_url: string, expanded_url: string, media_url: string, media_url_https: string, sizes: struct &lt; large: struct &lt; h: int, resize: string, w: int&gt;, medium: struct &lt; h: int, resize: string, w: int&gt;, small: struct &lt; h: int, resize: string, w: int&gt;, thumb: struct &lt; h: int, resize: string, w: int&gt;&gt;, type: string, url: string&gt;&gt;, urls: array &lt;struct &lt; display_url: string, expan…
tagged with: hive
type: Question
tagged with: http://stackoverflow.com/tag/json
tagged with: hadoop
answer count: 2
tagged with: cloudera
has answer: http://stackoverflow.com/a/27342130
downvote count: 0
has title: Hive JSON SerDe -- ClassCastException: java.lang.Integer cannot be cast to java.lang.Double
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/38592663
score: 2
upvote count: 2

if-statement
tags question: http://stackoverflow.com/q/21171076
tag name: if-statement
type: Tag
tags question: http://stackoverflow.com/q/21151564
tags question: http://stackoverflow.com/q/21178851
tags question: http://stackoverflow.com/q/21048870
tags question: http://stackoverflow.com/q/21177801
tags question: http://stackoverflow.com/q/21080426
tags question: http://stackoverflow.com/q/21081558
tags question: http://stackoverflow.com/q/21101842
tags question: http://stackoverflow.com/q/21080950
tags question: http://stackoverflow.com/q/21153457
tags question: http://stackoverflow.com/q/21025803
tags question: http://stackoverflow.com/q/21150190
tags question: http://stackoverflow.com/q/21112733
tags question: http://stackoverflow.com/q/21044696
tags question: http://stackoverflow.com/q/21083045
tags question: http://stackoverflow.com/q/21149374
tags question: http://stackoverflow.com/q/21119457
tags question: http://stackoverflow.com/q/21064295
tags question: http://stackoverflow.com/q/21052674
tags question: http://stackoverflow.com/q/21074601

http://stackoverflow.com/comment/31763798
has text: and what about Ubuntu .. !?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21112051
type: AnswerComment

http://stackoverflow.com/a/26375185
score: 0
answers question: http://stackoverflow.com/q/21115621
type: Answer
has body: me too also got the same problem. close the all the opened files inside the loop using fclose() function to throw the error away... have fun M.Santhanakumar

http://stackoverflow.com/a/21125622
answers question: http://stackoverflow.com/q/21125584
downvote count: 0
has body: The problem is that you have writer.close(); inside the while loop. Once it's closed on the first iteration, nothing else can be written, and the exception you saw is thrown. Place the call to close after the while loop. If you are using Java 7+, then use the "try-with-resources" syntax to have it closed when the try ends.
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/31851317
type: Comment
type: QuestionComment
score: 0
has text: @DaveNewton yup thanx for diverting my attention to this issue will have a look at this class execute method as well as others
comment on: http://stackoverflow.com/q/21100153

http://stackoverflow.com/a/21124886
has body: I think the issue is writing out the preorder values of the tree does not guarantee that the tree was originally a BST, thus the output of the initial function should be a stick going down the left side with 5 as the root. 5 3 1 4 8 6 9 This tree has a preorder traversal of [5, 3, 1, 4, 8, 6, 9], it is however not a BST, and therefore not the correct representation of the tree. Joop Eggen appears the correct version(s)
score: 0
answers question: http://stackoverflow.com/q/21122855
type: Answer

http://stackoverflow.com/comment/31707288
type: AnswerComment
score: 0
has text: @user3188303, SO is not the place to do your homework for you, because it defeats the purpose of assigning homework in the first place. If you want it to loop, insert a loop in the correct place (near the comment)
type: Comment
comment on: http://stackoverflow.com/a/21080843

http://stackoverflow.com/comment/31739917
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21051541
has text: @jhadesdev thankx for you response, i followed the way you autowired but both of my transactions seems to have same datasource attached to it. when I autowire the datasource on my daoimpl two different datasources have two different user/password but when i do @Transactional("qualifierName") for both qualifier its getting the same datasource. why would that be? and i made sure the right datasources and entitymanagerfactories are autowired.
score: 0

http://stackoverflow.com/comment/31653730
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21052192
has text: You can help me out if you know about JavaMail API.

http://stackoverflow.com/a/21179765
score: 0
answers question: http://stackoverflow.com/q/21179226
type: Answer
has body: It will generate the byte code of JDK 1.5 instead of JDK 1.6, because Java supports backward compatibility so byte code of JDK 1.5 could easily run on JDK 1.6 JRE.

cocos2d-android
type: Tag
tags question: http://stackoverflow.com/q/21116001
tags question: http://stackoverflow.com/q/21144784
tag name: cocos2d-android

http://stackoverflow.com/comment/31818248
comment on: http://stackoverflow.com/q/21138350
has text: Yes, these apps are not intended to be built against the Android SDK, but only as part of a full system build. My recollection is that the official word is that gettting them cleaned up to build against the SDK using only public APIs would be desirable, but is not considered a priority.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/31835814
type: Comment
comment on: http://stackoverflow.com/a/21147667
type: AnswerComment
score: 0
has text: @user3199712 Hope watery doesn't mind me answering this. The `cell value` means the value at that row and column. In other words, you can think of your `char[]` array as a table. The value at position `row` and `column` is the cell value, similar to your `cell[i][j]`, with `i` being the row and `j` being the column in that row. The `delta` in this case is simply a modifier for the current row and column indexes. To determine a diagonal win, you would start from a cell, and traverse diagonally by adding the delta to the row and column.

http://stackoverflow.com/comment/38610182
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21028438
has text: Ok. Now I know what causes it. It's the `allprojects` (or `subprojects`) clause in the root project. It seems to misbehave: If I say `allprojects { sourceCompatibility = 1.6 }` in the root, the settings does not work correctly in subprojects, *not even* if I redefine it again in the subproject directly. If I remove the `allprojects` clause and *only* set the `sourceCompatibility` in the subproject, it works as expected. It seems like a some kind of bug. If I am able to describe it more specificaly, I am going to report to the developers. Joachim, I can you please verify this in your setup?

http://stackoverflow.com/q/21067790
tagged with: netbeans
has comment: http://stackoverflow.com/comment/31748233
has comment: http://stackoverflow.com/comment/31684299
has comment: http://stackoverflow.com/comment/31745935
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21977743
upvote count: 1
has title: Netbeans Project Transfer 7.1.1 to 7.4
tagged with: netbeans-7.4
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/31745786
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/21067969
tagged with: netbeans-7.1
has body: I cannot get my projects to transfer from my win7 (v7.1.1) and appear on my win 8.1 computer (v7.4). There is no "export" option in 7.1.1 that I can find, and directly copying/pasting the folders from 7.1.1's workspace folder to 7.4's NetBeansProjects folder doesn't make them appear in the project window (I've tried restarted the program, scanning for external changes, and disabling the auto-scan thing) I've tried looking at guides, but either it does not work, or options such as "Export" do not exist. All of my projects are just basic applications (no server or database stuff). The only extremities are image packages which only a few of my programs use. Any help appreciated. -Austin
favorite count: 0
has comment: http://stackoverflow.com/comment/31731002
has comment: http://stackoverflow.com/comment/31732029

http://stackoverflow.com/a/21066427
has body: You can check using the below code. If you pass other than number it would throw NumberFormatException public static boolean checkIfNumber(String input) { try { Integer in = new Integer(input); } catch (NumberFormatException e) { return false; } return true; }
downvote count: 0
has comment: http://stackoverflow.com/comment/31679702
type: Answer
answers question: http://stackoverflow.com/q/21066340
upvote count: 1
score: 1

http://stackoverflow.com/q/21173471
type: Question
has comment: http://stackoverflow.com/comment/31876187
has comment: http://stackoverflow.com/comment/31876470
has answer: http://stackoverflow.com/a/21173492
accepted answer: http://stackoverflow.com/a/21173492
answer count: 2
has comment: http://stackoverflow.com/comment/31875734
tagged with: autoboxing
has answer: http://stackoverflow.com/a/21173543
has title: Java - Pass by Reference for the Byte object
favorite count: 0
tagged with: byte
tagged with: pass-by-reference
score: 2
type: AnsweredQuestion
upvote count: 3
has body: I read some code here: Is Java "pass-by-reference" or "pass-by-value"? public void foo(Dog d) { d.getName().equals("Max"); // true d.setName("Fifi"); } Dog aDog = new Dog("Max"); foo(aDog); aDog.getName().equals("Fifi"); // true Can I perform the same with the Byte object. I am at this point in my code and wondering how to "set" the value of the byte object? If i use the = assignment operator it seems to perform the new Byte() autoboxing?! and therefore the value is not passed back. Any ideas? Regards.
tagged with: java
has comment: http://stackoverflow.com/comment/31875790
possible better answer: http://stackoverflow.com/a/21173543
linked to: http://stackoverflow.com/q/40480
downvote count: 1

http://stackoverflow.com/q/21144645
answer count: 2
has body: This may seem trivial but I haven't been able to find a fix. I've installed the latest Java runtime environment but when I run java -version on the command line, I still get Java(TM) SE Runtime Environment (build 1.7.0_40-b43) However, when I test my Java version in browser, it works fine. How can I get Terminal using the latest java version?
has comment: http://stackoverflow.com/comment/31823086
has comment: http://stackoverflow.com/comment/31823053
tagged with: terminal
score: 0
linked to: http://stackoverflow.com/q/12757558
accepted answer: http://stackoverflow.com/a/21144890
has title: Java runtime environment error
has comment: http://stackoverflow.com/comment/31823074
has comment: http://stackoverflow.com/comment/31823009
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31823979
has comment: http://stackoverflow.com/comment/31822980
tagged with: java
possible better answer: http://stackoverflow.com/a/21144759
has comment: http://stackoverflow.com/comment/31823218
has answer: http://stackoverflow.com/a/21144759
has answer: http://stackoverflow.com/a/21144890
type: Question

http://stackoverflow.com/q/21023623
tagged with: java
possible better answer: http://stackoverflow.com/a/21023674
has answer: http://stackoverflow.com/a/21023674
upvote count: 2
score: 0
downvote count: 2
tagged with: api-design
has answer: http://stackoverflow.com/a/21023768
has body: How can I publish an API with Java? In languages like C or C++ it is really quite easy because you can simply divide headers from code, but in Java this is a complete different story. So I know that there is no real way in Java you can obfuscate your code, even if you "obsfuscate" it, because it can be easily decompiled and analyzed. But if I don't simply can distribute headers to someone, what is the preferred way to publish a API in Java? I don't have special needs because I am in the beginning of the designing process so I am really dynamic and I would like to know all alternatives I have.
accepted answer: http://stackoverflow.com/a/21023768
has comment: http://stackoverflow.com/comment/31601905
has title: How to publish APIs?
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31601813
has comment: http://stackoverflow.com/comment/31602101
favorite count: 0
has answer: http://stackoverflow.com/a/21023748
type: Question
has answer: http://stackoverflow.com/a/21023755

http://stackoverflow.com/comment/31984551
type: Comment
type: AnswerComment
has text: The data files i have can have these kind of discrepancies and problem is data size is huge and can go upto 100gb of data in a single file ... so i cant design a processor as it will run out of memory and i am unable to find a way to handle this while reading
score: 0
comment on: http://stackoverflow.com/a/21182258

http://stackoverflow.com/comment/31868371
score: 0
type: Comment
type: QuestionComment
has text: @csmckelvey It doesn't need one. The no-arg constructor is created automatically.
comment on: http://stackoverflow.com/q/21169539

http://stackoverflow.com/comment/31725246
has text: Your total approach is off. You should not be using Object type at all. Why not use Point instead?
type: Comment
score: 1
comment on: http://stackoverflow.com/q/21091343
type: QuestionComment

http://stackoverflow.com/q/21179663
upvote count: 1
has comment: http://stackoverflow.com/comment/31888927
type: Question
has body: Here is my code, I am wondering why it prints "test" two times!? every command I add in "paintcomponent" performs 2 times. I would appreciate if you could help me please!? import java.awt.geom.*;// For Ellipse2D, etc. import java.util.*; import javax.swing.*; // For JPanel, etc. import java.io.*; import java.awt.*; // For Graphics, etc. import java.lang.Object; import java.util.Random; public class hextopology extends JPanel { public void paintComponent(Graphics g) { super.paintComponent(g); System.out.println("test"); } public static void main(String[] args) throws Exception{ JFrame f = new JFrame(); f.add(new hextopology()); f.setSize(550,550); f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }
has answer: http://stackoverflow.com/a/21180048
has comment: http://stackoverflow.com/comment/31888413
has title: Using JFrame in java
score: -1
has comment: http://stackoverflow.com/comment/31887173
answer count: 2
favorite count: 0
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/31887029
has answer: http://stackoverflow.com/a/21180676
has comment: http://stackoverflow.com/comment/31888946
has comment: http://stackoverflow.com/comment/31887413
tagged with: java
downvote count: 2

http://stackoverflow.com/a/46212279
score: 1
answers question: http://stackoverflow.com/q/21083170
downvote count: 0
has body: In spring boot you can easily configure the service exposing port in application.properties file. server.port=portnumber if you don't set a port specifically, then it will try to open the service with port 80. in case if it is already used, service will not be started on the embedded container.
type: Answer
upvote count: 1

http://stackoverflow.com/a/21923521
score: 3
downvote count: 1
upvote count: 4
answers question: http://stackoverflow.com/q/21154400
has body: I got a bit fed up with Oracle's approach to security lately. They seem to be trying to protect us from ourselves in ways that would be more appropriate to naive users than programmers. My view is that the code I put on my own machine should be able to do whatever it needs to. It's my fault if I put code there that does bad things. Clearly not a universally reliable perspective, but it's worked for me for about 35 years. On that basis, I add this to my /lib/security/java.policy file: grant codeBase "file:/-" { permission java.security.AllPermission; }; note that the file:/- matches any file on the system, and the grant block says, in essence, "if the class is loaded from this file system, then trust it".
type: Answer

http://stackoverflow.com/comment/34709565
comment on: http://stackoverflow.com/q/21111970
type: QuestionComment
has text: @Spire Thanks for the comment, I fixed it in my question.
score: 0
type: Comment

http://stackoverflow.com/q/21171465
tagged with: android
has comment: http://stackoverflow.com/comment/31872336
answer count: 0
tagged with: java
has body: The title should be pretty self explanatory. I'm trying to create a centered view that looks like a table, and within that view there will be two textviews side by side. I need to do it this way because the font colors will be different for the two sets of text, and the latter one will have an onClick event. I can created the two views side by side, but left aligned. I can create them within a relative view, but the text becomes center aligned no matter what I do. Here's what I have so far: public void addTableLink(String s, String s1, int g, LinearLayout L, int fsize, int textColor, int backgroundColor, int lpad, int tpad, final String section, final String selection){ TextView tv = new TextView(this); RelativeLayout rl = new RelativeLayout(c); rl.setGravity(Gravity.CENTER); tv.setText(s); tv.setTextSize(fsize); TextPaint textPaint = tv.getPaint(); int boundedWidth = 360; StaticLayout layout = new StaticLayout(s, textPaint, boundedWidth , Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); int height = layout.getHeight(); tv.setGravity(g); tv.setBackgroundColor(backgroundColor); tv.setLayoutParams(new RelativeLayout.LayoutParams(400, height + 5)); tv.setPadding(lpad, tpad, lpad, 0); tv.setTextColor(textColor); TextView tv1 = new TextView(this); tv.setText(s1); tv.setTextSize(fsize); rl.addView(tv); textPaint = tv1.getPaint(); layout = new StaticLayout(s1, textPaint, boundedWidth , Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); height = layout.getHeight(); tv1.setGravity(g); tv1.setBackgroundColor(backgroundColor); tv1.setLayoutParams(new RelativeLayout.LayoutParams(400, height + 5)); tv1.setPadding(lpad, tpad, lpad, 0); tv1.setTextColor(textColor); tv1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setMainView(section, selection); } }); rl.addView(tv1); L.addView(rl); } Here's what that makes: The second line that says "B. Doe" is made with a different method, and is just one single text view (no font color change is needed, nor a onCl…
type: Question
has title: Android - Creating a centered layout with two side by side left aligned textviews programatically
score: 0
tagged with: android-relativelayout
has comment: http://stackoverflow.com/comment/31872805
tagged with: textview
type: UnansweredQuestion

http://stackoverflow.com/a/21158802
has body: --->An object is serializable only if its class or its superclass implements the Serializable (or Externalizable) interface. --->An object is serializable (itself implements the Serializable interface) even if its superclass is not. However, the first superclass in the hierarchy of the serializable class, that does not implements Serializable interface, MUST have a no-arg constructor. If this is violated, readObject() will produce a java.io.InvalidClassException in runtime. --->The no-arg contructor of every non-serializable superclass will run when an object is deserialized. However, the deserialized objects? constructor does not run when it is deserialized. --->The class must be visible at the point of serialization. --->All primitive types are serializable. --->Transient fields (with transient modifier) are NOT serialized, (i.e., not saved or restored). A class that implements Serializable must mark transient fields of classes that do not support serialization (e.g., a file stream). --->Static fields (with static modifier) are Not serialized. --->If member vairiables of a serializable object reference to a non-serializable object, the code will compile but a RumtimeException will be thrown.
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/31849141
has comment: http://stackoverflow.com/comment/31849698
has comment: http://stackoverflow.com/comment/31849018
answers question: http://stackoverflow.com/q/21158605
downvote count: 0
type: Answer

http://stackoverflow.com/q/21120689
possible better answer: http://stackoverflow.com/a/21128045
tagged with: android
has title: Why Boolean.class is java.lang.Class and String.class is java.lang.String?
type: AnsweredQuestion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/21120817
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31779670
has comment: http://stackoverflow.com/comment/31779628
has answer: http://stackoverflow.com/a/21128045
tagged with: generics
has answer: http://stackoverflow.com/a/21120817
has body: I'm trying to implement a generic method with input type specified (errm.. dirty-hacked) by Class&lt;T&gt;. public static &lt;T&gt; T getSecure(Class&lt;T&gt; type, String name, T def, ....) When requested as: getSecure(String.class, "foo", "", ....); It can be found that type == String.class, type.getClass().toString().compareTo(String.class.toString()) == 0). However, type == boolean.class || type == Boolean.class is always false for any incoming arguments.

http://stackoverflow.com/comment/31681909
has text: @RohitMalish Ah, I got it now. Actually, you don't scale the player position, because you just scale the x and y values. That basically means, you scale the camera *position*. When doing `cameraCopy.scl(Values.BTW);` you scale the camera *viewport*. You probably have to do that, because your camera viewport is initially in box2d units, right? (that means you set it up with width * WTB or width / BTW)
type: AnswerComment
comment on: http://stackoverflow.com/a/21067262
type: Comment
score: 0

http://stackoverflow.com/comment/31686100
has text: All known implementing classes of `java.awt.Shape` have the required `contains()` and `intersects()` implementations.
score: 1
comment on: http://stackoverflow.com/q/21069591
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21103781
type: Answer
downvote count: 0
score: 1
has body: You're not fully understanding the array aspect of this... int rowIndex, colIndex; String[][] input = { { "a", "b", "c" }, { "a", "b", "a" } }; System.out.println(input[rowIndex][colIndex]); //If you want to traverse through the entire 2-D array //all you will need to do is use two for loops
upvote count: 1
answers question: http://stackoverflow.com/q/21103440

http://stackoverflow.com/a/21150661
downvote count: 0
has body: Problem 1 Say the letter of the alphabet (represented by --- etc.) being guessed is "s" (represented by +). The computer will first guess in the middle (let = 13, represented by |). -------------|---+-------- You tell the computer to guess higher. With the code for(int i = let; i &lt; 27; i++) { r += 1; } r /= 2; let += r; r=0; which can be shortened to let += (26 - let) / 2; the computer will guess halfway to the end (let = 19): -------------|---+-|------ So far so good. Now, you tell it to guess lower. The computer knows it's higher than 13 and lower than 19, so it should guess halfway in between. However, the code you have does not do that. let /= 2; makes let be (int)(19 / 2), i.e., 9. ---------|---|---+-|------ What you want is let = 16 -------------|--|-+|------ Problem 2 Let's say you successfully got to -------------|--|-+|------ with the most recent guess being 16. You tell the computer to guess higher. With the code let += (26 - let) / 2; let will become 21. -------------|--|-+|-|---- What you want is let = 18 or 19; Solution In general, a good algorithm should make let go up or down by "13 / 2n" each iteration, where "n" is the iteration number (starting at 0). You should therefore use the code int let = 0; int iteration = 0; //start loop //take input int delta = 13 / Math.pow(2, iteration) + 1; if(n != 0) { //if n == 3 else if(n == 2) { let -= delta; } else if(n == 1) { let += delta; } } iteration++; //end loop and replace the comments with the code you are already using.
answers question: http://stackoverflow.com/q/21149149
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/21119456
upvote count: 1
answer count: 1
tagged with: paintcomponent
favorite count: 0
has comment: http://stackoverflow.com/comment/31777411
has comment: http://stackoverflow.com/comment/31777769
has comment: http://stackoverflow.com/comment/31778517
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/31777856
has comment: http://stackoverflow.com/comment/31777709
has answer: http://stackoverflow.com/a/21120279
has comment: http://stackoverflow.com/comment/31778306
has comment: http://stackoverflow.com/comment/31777970
downvote count: 0
score: 1
tagged with: java
tagged with: jpanel
has comment: http://stackoverflow.com/comment/31777967
type: Question
has body: I'm trying to make go Fish into a GUI version, however whenever I click compile, the card panel doesn't show up. It just brings about a small green and black square. It doesn't actually draw the cards. My code is as followed: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class goFishCards { static int die1 = (int)(Math.random()*6) + 1; static int die2= (int)(Math.random()*6) + 1; static JLabel welcome= new JLabel ("Welcome to Go Fish"); static JLabel rollMessage= new JLabel ("Whoever has the highest roll goes first!"); static JLabel computerMessage= new JLabel ("Your opponent's roll is..."); static JLabel humanMessage= new JLabel ("Your roll is..."); static JLabel outcome= new JLabel ("The person who goes first is "); static boolean computersMove= true; static boolean humanMove=true; static Deck myDeck = new Deck(); static Hand userHand = new Hand (); static Hand computerHand = new Hand (); public static class drawComputerDice extends JPanel { public void paintComponent(Graphics g) { super.paintComponent(g); this.setBackground(new Color(255,192,203)); drawComputerDie(g, die1, 3,3); }//end of paintComponent. void drawComputerDie(Graphics g, int val, int x, int y) { g.setColor(Color.white); g.fillRect(x, y, 35, 35); g.setColor(Color.black); g.drawRect(x, y, 34, 34); if (val &gt; 1) // upper left dot g.fillOval(x+3, y+3, 9, 9); if (val &gt; 3) // upper right dot g.fillOval(x+23, y+3, 9, 9); if (val == 6) // middle left dot g.fillOval(x+3, y+13, 9, 9); if (val % 2 == 1) // middle dot (for odd-numbered val's) g.fillOval(x+13, y+13, 9, 9); if (val == 6) // middle right dot g.fillOval(x+23, y+13, 9, 9); if (val &gt; 3) // bottom left dot g.fillOval(x+3, y+23, 9, 9); if (val &gt; 1) // bottom right dot g.fillOval(x+23, y+23, 9,9); repaint(); }//end of drawDie. }//end of class drawDice. public static class drawHumanDice extends JPanel { public void paintComponent(Graphics g) { super.paintComponent(g); this.setBackground(new Color(255,192,203)); dra…
has comment: http://stackoverflow.com/comment/31777614
has title: Why Doesn't my panel draw the cards?

import
type: Tag
tag name: import
tags question: http://stackoverflow.com/q/21175649
tags question: http://stackoverflow.com/q/21114624
tags question: http://stackoverflow.com/q/21122447
tags question: http://stackoverflow.com/q/21024956

http://stackoverflow.com/comment/31795149
type: QuestionComment
has text: How big is arrayOfWords? are you sure is ok to increase numWordsInArray value? You may be mixing `y` and `numWordsInArray`.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21128957

http://stackoverflow.com/a/21119055
type: Answer
answers question: http://stackoverflow.com/q/21118741
score: 0
has body: Actually yes, it is expected to work because JMS client that you configured should hide from you the gory details of transport and inter-process and inter-computer communication. Just make sure that other side is available and accessible via network. First check ping, then check firewall definition (if there is a firewall between two sides.)
has comment: http://stackoverflow.com/comment/31776832

http://stackoverflow.com/a/21180733
answers question: http://stackoverflow.com/q/21178906
has comment: http://stackoverflow.com/comment/32099824
downvote count: 0
score: 1
has body: Instead of using type="chain" , try the recommended way of using type="redirectAction". Change your current chain action to hello / index.jsp <interceptor-ref name="myDefault"/> /HelloWorld.jsp index.jsp For more details, take a look into the documentation here
upvote count: 1
type: Answer

inheritance
tags question: http://stackoverflow.com/q/21086417
tags question: http://stackoverflow.com/q/21055209
tags question: http://stackoverflow.com/q/21038149
tags question: http://stackoverflow.com/q/21070699
tags question: http://stackoverflow.com/q/21175987
tags question: http://stackoverflow.com/q/21068902
tags question: http://stackoverflow.com/q/21151053
tag name: inheritance
tags question: http://stackoverflow.com/q/21019208
tags question: http://stackoverflow.com/q/21100051
tags question: http://stackoverflow.com/q/21157938
tags question: http://stackoverflow.com/q/21112438
tags question: http://stackoverflow.com/q/21129287
tags question: http://stackoverflow.com/q/21061840
type: Tag
tags question: http://stackoverflow.com/q/21122851
tags question: http://stackoverflow.com/q/21168009
tags question: http://stackoverflow.com/q/21062269
tags question: http://stackoverflow.com/q/21127117
tags question: http://stackoverflow.com/q/21049863
tags question: http://stackoverflow.com/q/21062787
tags question: http://stackoverflow.com/q/21058692
tags question: http://stackoverflow.com/q/21058278
tags question: http://stackoverflow.com/q/21157343

http://stackoverflow.com/comment/31855049
has text: "There is nothing in UDP that helps differentiate between multiple conversations with the same server." But I thought that by convention, outgoing packets have a source port and that their responses come back with this same port in the as the destination (as diagrammed here: http://www.dcs.bbk.ac.uk/~ptw/teaching/IWT/transport-layer/source-destination.gif). Surely this is what DatagramChannel.connect() uses to receive the appropriate appropriate response packets? Perhaps this is possible in theory but that java doesn't provide the means for doing so.
comment on: http://stackoverflow.com/a/21139804
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31823023
type: QuestionComment
type: Comment
has text: @C.B., thanks for the quick response, but I am looking for the Java code for the same with performence optimized way
comment on: http://stackoverflow.com/q/21144598
score: 0

http://stackoverflow.com/q/21030977
score: 0
has comment: http://stackoverflow.com/comment/31616747
has title: Java Component alignment to top left corner
tagged with: jcomponent
has comment: http://stackoverflow.com/comment/31615607
accepted answer: http://stackoverflow.com/a/21032128
has answer: http://stackoverflow.com/a/21032033
upvote count: 1
tagged with: swing
downvote count: 1
type: AnsweredQuestion
has body: I want to align my two of my components to the top left corner of the window. import java.awt.BorderLayout; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.border.EmptyBorder; public class MainFrame extends JFrame { public MainFrame() { JPanel mainPanel = new JPanel(new BorderLayout()); JPanel gridbagPanel = new JPanel(); this.setLayout(new BorderLayout()); gridbagPanel.setLayout(new GridBagLayout()); GridBagConstraints gc = new GridBagConstraints(); JLabel nameLabel = new JLabel(player.getName()); nameLabel.setHorizontalAlignment(SwingConstants.CENTER); nameLabel.setFont(new Font("Serif",Font.PLAIN,24)); mainPanel.add(nameLabel, BorderLayout.NORTH); JLabel money = new JLabel("Pinigai: "+new Integer(player.getMoney()).toString()); gc.gridx = 0; gc.gridy = 0; gc.anchor = GridBagConstraints.PAGE_START; gc.insets = new Insets(2,0,0,2); gridbagPanel.add(money,gc); JLabel job = new JLabel("Darbas: "+new Integer(player.getSkin()).toString()); gc.gridx = 0; gc.gridy = 1; gc.insets = new Insets(2,0,0,2); gc.anchor = GridBagConstraints.LINE_START; gridbagPanel.add(job, gc); mainPanel.setBorder(new EmptyBorder(10,10,10,10)); mainPanel.add(gridbagPanel,BorderLayout.WEST); add(mainPanel); getContentPane().revalidate(); } } It currently looks like this: And I would like the lines with numbers in the top left corner. Note that I'm aware that both JFrame("this" class) and the mainPanel are using BorderLayouts. Another non-related question: When should I create a new GridBagConstraints object? Why can't I just store one in a private instance variable for all usage needed?
tagged with: java
has answer: http://stackoverflow.com/a/21032128
has comment: http://stackoverflow.com/comment/31615591
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/31616036
tagged with: layout
possible better answer: http://stackoverflow.com/a/21032033
favorite count: 0
linked to: http://stackoverflow.com/q/13436787

http://stackoverflow.com/comment/31851663
score: 0
has text: Thanks a lot Matt for the resolution.
comment on: http://stackoverflow.com/a/21160218
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31666716
type: Comment
comment on: http://stackoverflow.com/q/21059328
type: QuestionComment
has text: I don't think you really tried looking at the documentation for enums
score: 1

http://stackoverflow.com/q/21111852
upvote count: 1
has answer: http://stackoverflow.com/a/21112103
has comment: http://stackoverflow.com/comment/31763877
has body: I'm doing an application in which I have to show a sequence of pictures: The sequence is the follow: A red X has to be shown for more or less 400 milliseconds; An image called "Screenshot" has to be shown for more or less 500 milliseconds; An image called "Noise" has to be shown for more or less 50 milliseconds; The "Noise" image disappear to make space for an EditText. The EditText is used to get the user data. Here is my code: public class Step1Training extends Activity { ImageFragment myImageFragment; InputFragment myInputFragment; Drawable cross; ImageView myImageView; EditText myEditText; int i, length; String rating; Handler handler; boolean continueTask; int[] screenshots = { R.drawable.googleplaybooks2, R.drawable.aldiko1, R.drawable.chaton2, R.drawable.cinetrailer1, R.drawable.fanpage1 }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.step1_training); handler = new Handler(); i = 0; length = screenshots.length; initUI(); startThread(); } private void initUI(){ myImageFragment = (ImageFragment)getFragmentManager().findFragmentById(R.id.imageFragment); myInputFragment = (InputFragment)getFragmentManager().findFragmentById(R.id.inputFragment); myImageView = (ImageView)myImageFragment.getView().findViewById(R.id.screenshotImageView); myImageView.setImageResource(R.drawable.cross300x300); myEditText = (EditText)myInputFragment.getView().findViewById(R.id.ratingEditText); myEditText.setVisibility(View.GONE); } private void startThread(){ while(i&lt;length){ handler.postDelayed(new TaskScreenshot(i), 250); handler.postDelayed(new TaskNoise(), 750); handler.postDelayed(new TaskEditText(), 1000); myEditText.setOnKeyListener(new View.OnKeyListener(){ public boolean onKey(View v, int keyCode, KeyEvent event) { if((keyCode == KeyEvent.KEYCODE_ENTER)) { if(myEditText.getText().toString().equals("")){ Toast.makeText(getApplicationContext(), "Inserire un numero da 1 a 9", Toast.LENGTH_SHORT).show(…
accepted answer: http://stackoverflow.com/a/21112303
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/21112103
has answer: http://stackoverflow.com/a/21112119
tagged with: java
type: Question
downvote count: 0
score: 1
answer count: 3
has answer: http://stackoverflow.com/a/21112303
tagged with: android
tagged with: runnable
favorite count: 0
has title: How to loop with runnable in Android

http://stackoverflow.com/q/21138681
has comment: http://stackoverflow.com/comment/31812087
has comment: http://stackoverflow.com/comment/31811855
has body: I have treeset of custom class, which consists of string with its name, which I want to be sorted alphabetically, and another treeset. I want to sort this class, but I have no idea how. I tried something like this, but I have no idea, what should I write in place of "???". Or maybe should it be done completely differently? public class Turniej { Set&lt;Zawody&gt;zaw = new TreeSet&lt;Zawody&gt; ( new Comparator&lt;Zawody&gt;() { public int compare(Zawody z1, Zawody z2) { ??? } } ) ; .... } public class Zawody { String nazwaZawodow; SortedSet&lt;Start&gt; start = new TreeSet&lt;Start&gt; ... }
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21138758
has answer: http://stackoverflow.com/a/21138756
downvote count: 0
accepted answer: http://stackoverflow.com/a/21138756
has title: How to sort alphabetically treeset consisting of custom class objects by one of their fields
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21138759
has comment: http://stackoverflow.com/comment/31811915
upvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/31812150
favorite count: 0
possible better answer: http://stackoverflow.com/a/21138758
has comment: http://stackoverflow.com/comment/31812004

http://stackoverflow.com/comment/31716512
score: 0
type: Comment
has text: @user3164859 please check my update. And if this answer solved your problem then mark the tick beside my answer.
type: AnswerComment
comment on: http://stackoverflow.com/a/21075973

http://stackoverflow.com/a/21056964
score: 1
has body: This is the usual problem with creating an array of a parameterized type. Why you cannot use new to create an array of a parameterized type is a long topic that has been covered many times here; it basically has to do with how arrays perform runtime checks on the element types, but runtime checks cannot check type parameters. Long story short, an unchecked warning of some kind is unavoidable (because it is indeed possible to make it violate the guarantees of the array type). If you don't mind the "unsafeness", the most kosher way to write it is to create the array using a wildcarded type instead of a raw type, and cast it to the proper type of array (yes, this is an unchecked cast): ArrayList&lt;double[]&gt;[] testSamples = (ArrayList&lt;double[]&gt;[]) new ArrayList&lt;?&gt;[] { ... }
answers question: http://stackoverflow.com/q/21051948
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/31599164
type: Comment
has text: @TheLostMind I ctrl+f'd that document and there is no mention of dependency being a general form of aggregation/composition/association?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/21022154

http://stackoverflow.com/a/21177087
type: Answer
has comment: http://stackoverflow.com/comment/31897163
has body: Here is a partial code solution to your problem. I do not usually re-write code when asked, especially in a language I never use like Java, but I was bored. ShortBuffer sb = ShortBuffer.allocate (mWidth * mHeight); // 2 Bytes per-pixel ShortBuffer sbt = ShortBuffer.allocate (mWidth * mHeight); // 2 Bytes per-pixel mGL.glReadPixels (0, 0, mWidth, mHeight, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, sb); // Convert upside down mirror-reversed image to right-side up normal // image. for (int i = 0; i &lt; mHeight; i++) { for (int j = 0; j &lt; mWidth; j++) { sbt.put ((mHeight - i - 1) * mWidth + j, sb.get (i * mWidth + j)); } } sbt.flip (); // Rewind the buffer mBitmap = Bitmap.createBitmap (mWidth, mHeight, Bitmap.Config.RGB_565); mBitmap.copyPixelsFromBuffer (sbt); This will cut the size of both of your buffers in half, but it does not address the issue of flipping the image in-place. If you do that, you can reduce the required storage another 50%. I will leave that to you, datenwolf's answer should give you the necessary info to do that on your own.
score: 0
answers question: http://stackoverflow.com/q/21175794

http://stackoverflow.com/a/21122797
type: Answer
has comment: http://stackoverflow.com/comment/31794357
has comment: http://stackoverflow.com/comment/31784303
score: 1
has comment: http://stackoverflow.com/comment/31783787
has body: Avoid if possible, document if not. Here is the way that Josh Bloch recommends documenting it (Effective Java, 2nd ed, item 26): private ArrayList&lt;Rectangle&gt; rectangles; try { InputStream IS = MyClass.class.getResourceAsStream("file.dat"); ObjectInputStream input = new ObjectInputStream(IS); //The input stream is definitely an ArrayList&lt;Rectangle&gt; //I know this because............... @SuppressWarnings("unchecked") ArrayList&lt;Rectangle&gt; rectangles2 = (ArrayList&lt;Rectangle&gt;) input.readObject(); rectangles = rectangles2; } catch (IOException | ClassNotFoundException ex) { System.out.println(ex); } This localizes the suppression to a couple lines of code, instead of the whole function.
has comment: http://stackoverflow.com/comment/31783714
has comment: http://stackoverflow.com/comment/31784269
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21122563
has comment: http://stackoverflow.com/comment/31799979

http://stackoverflow.com/q/21033926
downvote count: 1
type: Question
tagged with: null
upvote count: 0
tagged with: arrays
answer count: 1
score: -1
has title: The value retrieved has a null value. How to eliminate them?
has body: I already succeed in retrieving the RGB pixel value from compareHexaRGB method. And the output doesn't seem convincing as the output includes with a null character too. How can I eliminate them? Second, when I tried to combine String[][] char 1 + char 2 I get an error stated that it is bad operand for type "+". But I would like to combine the 2 string in order for me to be able to convert it to ASCII character. Here is the code for compareHexaRGB method: public class compareHexaRGB { private static int w; private static int h; private static BufferedImage img; private static BufferedImage img2; private static String[][] check_hex2; private static String[][] check_hex4; private static String[][] message; public static void compareHexaRGB(BufferedImage image, BufferedImage image2, int width, int height) throws IOException { w = width; h = height; img = image; img2 = image2; } public void check() throws IOException { getPixelRGB1 pixel = new getPixelRGB1(); getPixelData1 newPD = new getPixelData1(); int[] rgb; int count = 0; int[][] pixelData = new int[w * h][3]; check_hex2 = new String[w][h]; check_hex4 = new String[w][h]; for(int i = 0; i &lt; w; i++) { for(int j = 0; j &lt; h; j++) { rgb = newPD.getPixelData(img, i, j); for(int k = 0; k &lt; rgb.length; k++) { pixelData[count][k] = rgb[k]; } if(pixel.display_imgHex2()[i][j].equals(pixel.display_img2Hex2()[i][j])) { System.out.println("\nPixel values at position 2 are the same." + "\n" + pixel.display_imgHex2()[i][j] + " " + pixel.display_img2Hex2()[i][j]); } if(pixel.display_imgHex4()[i][j].equals(pixel.display_img2Hex4()[i][j])) { System.out.println("\nPixel values at position 4 are the same." + "\n" + pixel.display_imgHex4()[i][j] + " " + pixel.display_img2Hex4()[i][j]); } if(!pixel.display_imgHex2()[i][j].equals(pixel.display_img2Hex2()[i][j])) { System.out.println("\nPixel values at position 2 are not the same." + "\n" + pixel.display_imgHex2()[i][j] + " " + pixel.display_img2Hex2()[i][j]); check_hex2[i][j] = pi…
has answer: http://stackoverflow.com/a/21034297
favorite count: 0
accepted answer: http://stackoverflow.com/a/21034297
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/21073898
accepted answer of: http://stackoverflow.com/q/21073810
downvote count: 0
has body: Try following: if (temp.startsWith("#")){ String[] splitted = temp.split("="); output += splitted[1] + "\n"; } Explanation: To process lines only starting with desired character use String#startsWith method. When you have string to extract values from, String#split will split given text with character you give as method argument. So in your case, text before = character will be in array at position 0, text you want to print will be at position 1. Also note, that if your file contains many lines starting with #, it should be wise not to concatenate strings together, but use StringBuilder / StringBuffer to add strings together. Hope it helps.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/21073810
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/31594615
type: QuestionComment
has text: You're not very clear about what your problem is? You need to have the tools installed in order to build the package. Most linux distributions will have these available as packages.
comment on: http://stackoverflow.com/q/21019802
score: 0
type: Comment

http://stackoverflow.com/comment/31662424
type: Comment
has text: You can configure Fiddler as a proxy, which will do what you want, I think.
comment on: http://stackoverflow.com/q/21056806
score: 0
type: QuestionComment

http://stackoverflow.com/a/21157946
downvote count: 0
answers question: http://stackoverflow.com/q/21155010
has body: You are configuring things in XML and rely (partially) on annotations. By default spring ignores all annotations like @Autowired, @Inject and the likes. To enable processing of these annotations an instance of the AutowiredAnnotationBeanPostProcessor and CommonAnnotationBeanPostProcessor (the latter is for @Resource and other JSR-250 annotation processing) need to be registered. This can be done manually or by using the namespace. &lt;context:annotation-config /&gt; When using a &lt;context:component-scan /&gt; it is already implied that one wants to use annotations for configuration and as such the functionality of &lt;context:annotation-config /&gt; is already included, so no need to add it again.
score: 4
type: AcceptedAnswer
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/21155010

http://stackoverflow.com/q/21123129
possible better answer: http://stackoverflow.com/a/21123179
upvote count: 22
has answer: http://stackoverflow.com/a/21123176
tagged with: decimalformat
favorite count: 0
type: AnsweredQuestion
downvote count: 0
has title: Stop DecimalFormat with percentage sign from moving the decimal
type: Question
has answer: http://stackoverflow.com/a/21123179
tagged with: java
has body: Is there a way to prevent a DecimalFormat object from automatically moving the decimal place two places to the right? This code: double d = 65.87; DecimalFormat df1 = new DecimalFormat(" #,##0.00"); DecimalFormat df2 = new DecimalFormat(" #,##0.00 %"); System.out.println(df1.format(d)); System.out.println(df2.format(d)); produces: 65.87 6,587.00 % But I'd like it to produce: 65.87 65.87 %
has answer: http://stackoverflow.com/a/47652437
accepted answer: http://stackoverflow.com/a/21123176
score: 22
answer count: 3

http://stackoverflow.com/comment/31787377
type: QuestionComment
has text: Is javamail on your classpath?
score: 0
comment on: http://stackoverflow.com/q/21124530
type: Comment

http://stackoverflow.com/q/21127164
has title: What is the correct configuration to use GSON inside a Applet implementing with eclipse (Kepler)
favorite count: 0
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
tagged with: gson
type: Question
has answer: http://stackoverflow.com/a/21152973
accepted answer: http://stackoverflow.com/a/21152973
tagged with: eclipse
has body: First I want to say I am beginner in Java / Web development (but with great experience in programming and analysis). I search several surveys in several locations, not finding a solution to the problem that I think is configuration. The story: I implemented an Applet that uses javax.smartcardio for the ATR, this works fine without any problems! This applet must "transmit" the collected information to a web page that uses javascript (inside the script of this page), I opted to pass the information in json format and chose Gson for this... Running the applet inside the IDE this works fine!!! Running inside the browser (local IIS 7.5 server) this not work, showme a error: "Uncaught Error: java.lang.InvocationTargetException". In first time I saw that the IIS log showed the following line: 2014-01-14 02:42:35 127.0.0.1 GET /com/google/gson/Gson.class - 80 - 127.0.0.1 Mozilla/4.0+(Windows+7+6.1)+Java/1.7.0_45 404 0 2 2 Looking at the contents of the JAR file I could see that the missing gson jar files... I found that should put the files into WEB-INF \ lib directory of the project, it did not exist and Deployment Assembly also not too ... To fix this, I changed Project Facet (add Dynamic Web Module). Now there is a folder: WebContent \ WEB-INF \ lib I copied and pasted the three files from the explorer windows Gson ... I added the files in deplyment Assembly and now they are in the exported JAR file but the same error keeps happening. Note: There NOT is a security problem, the applet is signed, after removing gson functions and my method return the ATR code (string) directly the applet works fine. Any step by step tutorial to "install" for it??? Thanks in advance! Screen images: RESUMING The applet works fine, all functions work, except the function using GSON... In my local server (IIS 7.5) I create a site, and inside this site I put the files: index.html ; MyApplet.jar ; \scrits\Myscript.js Inside de MyApplet.jar file exists many files .class ; .classpath ; project and…
tagged with: invocationtargetexception
answer count: 1
downvote count: 0
tagged with: applet

http://stackoverflow.com/comment/31851019
has text: Woops, I did not notice that the password and the username are chained in a single string! Well, I think that @sln's answer still qualifies for the Ultimate Regex of Doom. I mean, however clever (wow) it might be, it will sit in the codebase as a magic spell, with very few if any people able to mantain or expand it.
comment on: http://stackoverflow.com/a/21150008
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21064886
has title: Apache HTTP Client Post appears to work but variable not received
tagged with: post
answer count: 1
downvote count: 0
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/21065115
linked to: http://stackoverflow.com/q/3283234
tagged with: apache-commons-httpclient
type: AnsweredQuestion
upvote count: 1
tagged with: web-services
tagged with: php
type: Question
has answer: http://stackoverflow.com/a/21065115
tagged with: java
has body: I have the following code that executes a httpclient post request public void upload() throws Exception{ //HTTP POST Service try{ HttpClient httpclient = HttpClientBuilder.create().build(); URI uri = new URIBuilder() .setScheme("http") .setHost("www.mysite.com") .setPath("/mypage.php") .setParameter("Username", userID) .setParameter("Password", password) .build(); HttpPost httppost = new HttpPost(uri); httpclient.execute(httppost); BasicHttpContext localContext = new BasicHttpContext(); HttpResponse response = httpclient.execute(httppost, localContext); HttpUriRequest currentReq = (HttpUriRequest) localContext.getAttribute(ExecutionContext.HTTP_REQUEST); HttpHost currentHost = (HttpHost)localContext.getAttribute(ExecutionContext.HTTP_TARGET_HOST); String currentUrl = currentHost.toURI() + currentReq.getURI(); System.out.println(currentUrl); System.out.println(response); HttpEntity httpEntity = response.getEntity(); String str = ""; if (httpEntity != null) { str = EntityUtils.toString(httpEntity); System.out.println(str); } }catch (Exception e) { e.printStackTrace(); } } which returns HTTP/1.1 200 OK [Date: Sat, 11 Jan 2014 16:17:22 GMT, Server: Apache, Expires: Thu, 19 Nov 1981 08:52:00 GMT, Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0, Pragma: no-cache, Vary: Accept-Encoding, Keep-Alive: timeout=10, max=30, Content-Type: text/html, Via: 1.1 NDC1-B2-CE01, Connection: keep-alive] As if everything had worked fine but my php script on the other end doesn't seem to pick up the variable. I've tried something as simple as: &lt;?php error_log($_POST["Username"]); ?&gt; But get an index undefined error printed

http://stackoverflow.com/comment/31833600
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21103363
has text: Thanks Glenn. The main data stores involved are graph stores (like Neo4j) with some other messaging and NoSQL systems for ancillary data (sorry Brian, no Riak ;-)). And like I said above, I would only use the UUIDs if I had a need for compliance with the standard, which I do not forsee. It just would have been handy. I was just wondering if anyone had combined in a simple way the way .NET does ToByteArray for GUIDs with variable encodings.
score: 0

http://stackoverflow.com/comment/31664221
score: 0
type: AnswerComment
has text: @boxed__l Oh! I get why that happens, I think so at least. (Possibly due to my polymorphic array in my main class)
type: Comment
comment on: http://stackoverflow.com/a/21057319

http://stackoverflow.com/a/21052192
has comment: http://stackoverflow.com/comment/50929862
score: 38
type: Answer
accepted answer of: http://stackoverflow.com/q/21051991
has comment: http://stackoverflow.com/comment/31653730
answers question: http://stackoverflow.com/q/21051991
upvote count: 39
has comment: http://stackoverflow.com/comment/31653656
has body: 1) You need to create a Project in IntelliJ IDEA. Now you have two options. 2.1.) Open the Project view in the IDE. Then right click on your Project and do Open Module Settings (or press F4). 2.2.) From the File menu just choose Project structure. 3) Then go to Libraries on the left side. Then click the + sign (add new library). Then locate your JAR and select it, this will import it as a library. Note: The JAR you need to have downloaded first on your local machine. Here is a screenshot, with added one JAR to a project I just created. To make an example that works you'll need some mail servers. See for example here. http://www.mkyong.com/java/javamail-api-sending-email-via-gmail-smtp-example/
type: AcceptedAnswer
downvote count: 1
has comment: http://stackoverflow.com/comment/31653813

http://stackoverflow.com/comment/31779211
comment on: http://stackoverflow.com/a/21120427
score: 0
has text: Java has `void main`, so only `System.exit()` for #1. I think #2 is what the OP meant, though that has nothing to do with Java
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/31888372
type: QuestionComment
has text: I am guessing the HttpHost instance you have created should be used as a proxy. See this post - http://stackoverflow.com/questions/6962047/apache-httpclient-4-1-proxy-authentication
score: 0
comment on: http://stackoverflow.com/q/21179686
type: Comment

http://stackoverflow.com/comment/31657260
comment on: http://stackoverflow.com/a/21053320
score: 0
type: AnswerComment
type: Comment
has text: Your link - the other SO question you cited - says, "putting JDBC drivers into Tomcat's lib folder will help prevent memory leaks when you redeploy your web app without restarting Tomcat, e.g. if you just put a new WAR file into Tomcat's webapps folder." So it's pretty much the opposite of what you're saying. Using shared `/lib` will **decrease** chances of memory leaks.

h.264
tags question: http://stackoverflow.com/q/21163498
type: Tag
tag name: h.264

http://stackoverflow.com/a/21128379
type: Answer
has body: I would stick to the GPS data and not worry with the accelerometer. Then you would have to record the position in defined intervals and just add the distance to the last point every time you check. The closer you want to get to the real distance the more frequently you have to check. You could then make the interval dynamic e.g. check less often if you go faster.
answers question: http://stackoverflow.com/q/21128316
score: 0

http://stackoverflow.com/comment/66473010
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/21138211
score: 0
has text: Why this ("Change y to Y (year-of-era)") translation? Lowercase 'y' seems to be an identical symbol (year) between both pattern definitions?

http://stackoverflow.com/q/21051259
has answer: http://stackoverflow.com/a/21053124
type: Question
has comment: http://stackoverflow.com/comment/31651802
answer count: 2
tagged with: jpa
has comment: http://stackoverflow.com/comment/31651623
score: -1
has comment: http://stackoverflow.com/comment/31651619
has comment: http://stackoverflow.com/comment/31651767
downvote count: 1
favorite count: 0
has title: Does Hibernate make sense without Spring?
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/84076586
has body: Some years ago I started "studying" and working with JAVA (I gotta say that I am an embedded developer, so I mostly work in C and C++). Receptly I have started working with Databases so I stumbled on Hibernate. I read couple of starting guides and books about the topic and started to play around with some small projects. Surfing on the Internet (Stackoverflow included) I only have seen projects that include Hibernate/JPA + Spring [+ Struts]. I am designing a quite big personal project. I wanted to do it "step by step" in order to learn all parts that it implies: DB, Hibernate (I wanted to use first hbm.xml and then Annotations), make an easy standalone swing application, and then use Spring + web page. Probably my question is a little stupid but, I will ask it anyway Does Hibernate make sense without Spring? Should I keep playing a little longer with Hibernate while I read up on Spring and then develope the project using both technologies? My only goal in this project is to learn. Nothing more, nothing less. I do not care about the effort. Thanks so much for your opinions! I appreciate!
upvote count: 0
has answer: http://stackoverflow.com/a/21051438
tagged with: java
tagged with: hibernate

http://stackoverflow.com/a/21023723
has body: You could use reflection to modify the underlying char[] array. But that would be a huge hack.
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21023506

http://stackoverflow.com/a/21039460
has body: Go through this tutorial,this might help you understand wild cards and their uses. http://ted-gao.blogspot.co.uk/search/label/Java%20Generics and for difference between List and map :: Java map: An object that maps keys to values. A map cannot contain duplicate keys; each key can map to at most one value. Java list: An ordered collection (also known as a sequence).The user of this interface has precise control over where in the list each element is inserted. The user can access elements by their integer index (position in the list), and search for elements in the list.
type: Answer
answers question: http://stackoverflow.com/q/21039393
score: 0

http://stackoverflow.com/comment/31777042
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21118933
has text: I need to be lenient on namespaces since I have to handle 3rd-party XML instances that are not always XSD valid. I suppose I then have to use `/*[local-name()='a']/*[local-name()='b']` as my XPath expression. That does seem to work regardless of Saxon's presence or not.
type: Comment

http://stackoverflow.com/comment/31824986
score: 0
comment on: http://stackoverflow.com/q/21145630
has text: Make your own method will be O(n).. or build a collection with order (sorting it) then select the first and the last..
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31752162
has text: But the signature you've defined isn't a valid method signature, but would make a instance variable...just curious ;)
comment on: http://stackoverflow.com/a/21105211
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31666965
comment on: http://stackoverflow.com/a/21059482
score: 0
type: Comment
has text: @MadProgrammer that's why I linked the Swing tutorial and said _"semi-gui"_ :)
type: AnswerComment

http://stackoverflow.com/a/21084953
downvote count: 0
has comment: http://stackoverflow.com/comment/31715054
has comment: http://stackoverflow.com/comment/31716059
upvote count: 2
has comment: http://stackoverflow.com/comment/31714940
answers question: http://stackoverflow.com/q/21084755
has comment: http://stackoverflow.com/comment/31715358
has comment: http://stackoverflow.com/comment/31715831
has body: how do i display the other 2 arraylists?? As you did. depotDOListServlet and userAuctionRelDOListServlet are two array lists then same way you can use <c:forEach></c:forEach> to iterate those lists. <c:forEach var="auctionDO" items="${auctionDOListServlet}"> <c:out value="${auctionDO.auctionName}"/> <c:out value="${auctionDO.endDate}"/> <c:out value="${auctionDO.status}"/> <c:forEach var="depotDo" items="${depotDOListServlet}"> <c:out value="${depotDo.depotName}"/> </c:forEach> <c:forEach var="userAuctionRelDo" items="${userAuctionRelDOListServlet}"> <c:out value="${userAuctionRelDo.bidAmt}"/> </c:forEach> </c:forEach> Remember that for every item in list auctionDOListServlet rest two lists will iterate each time.
type: Answer
has comment: http://stackoverflow.com/comment/31715183
score: 2

http://stackoverflow.com/comment/31766926
type: Comment
type: AnswerComment
has text: Please check my edit answer. I pasted my Twitter authentication code. May be it will help for better understanding. I am using TwitterApplication Class as well.
comment on: http://stackoverflow.com/a/21109571
score: 0

http://stackoverflow.com/q/21116794
score: -1
has answer: http://stackoverflow.com/a/21116836
has answer: http://stackoverflow.com/a/21116848
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/31772370
has answer: http://stackoverflow.com/a/25944076
has body: Whenever I input x (number of empoyee) as any number it always short in 1 loop when asking the employee salary. And if i put x as 1 it doesn't ask me. Need help how to fix it. class salary { public static void main(String[] args) { int x = 0; int y; System.out.println("Enter how many employee"); x = EasyIn.getInt(); for (int i = 1; i &lt; x; ++i) { System.out.println("Enter the salary of employee " + i); y = EasyIn.getInt(); if (y &lt; 20000) { System.out.println("This employee Bonus Rate is 7%"); } } } }
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21116888
downvote count: 1
has title: Input loop number missing loop
answer count: 4
tagged with: java

http://stackoverflow.com/a/21099270
has comment: http://stackoverflow.com/comment/31740654
has comment: http://stackoverflow.com/comment/31740500
score: 3
has comment: http://stackoverflow.com/comment/31740661
has comment: http://stackoverflow.com/comment/31740542
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31740635
accepted answer of: http://stackoverflow.com/q/21099262
type: Answer
has comment: http://stackoverflow.com/comment/31740645
answers question: http://stackoverflow.com/q/21099262
has body: You're missing a d. Class.forName("com.mysql.jdbc.Driver"); Note that JDBC 4 compliant Driver implementations don't need to be explicitly loaded with Class.forName(String). The Driver is registered through classpath scanning. Find out if your library is JDBC 4 compliant and remove the call to Class.forName(String) if it is.
upvote count: 3

http://stackoverflow.com/comment/31768497
comment on: http://stackoverflow.com/q/21113865
score: 0
type: Comment
type: QuestionComment
has text: The only reasonable way I could think of needs structured (csv-) file. I.e. each field in the file has a known fixed size. If you have fields of arbitrary length you could start to make a guessed search based on a likelihood. Enjoy the implementation. I would rather suggest to import the csv into a DBS.

http://stackoverflow.com/a/21026854
has body: JavaScript: function Cat(name) { this.name = name; this.talk = function() { alert( this.name + " says meeow!" ); }; } var cat1 = new Cat("Felix"); in Java: public class Cat { private String name; public Cat(String name) { this.name = name; this.talk(); } public void talk() { System.out.println( this.name + " says meeow!" ); } } Cat cat1 = new Cat("Felix");
upvote count: 4
score: 4
answers question: http://stackoverflow.com/q/21026704
has comment: http://stackoverflow.com/comment/31607704
has comment: http://stackoverflow.com/comment/31607915
has comment: http://stackoverflow.com/comment/31607592
downvote count: 0
type: Answer

session-timeout
type: Tag
tags question: http://stackoverflow.com/q/21132508
tags question: http://stackoverflow.com/q/21064035
tag name: session-timeout

http://stackoverflow.com/q/21099508
has body: Alright so I'm having this one problem with an app I'm working on and planning on releasing, but the problem is only occurring on one version of the android SDK (Version 4.1.1 API 16). Can I restrict JUST android version 4.1.1 API 16 from downloading and running my app? I know googlePlay has a restrict certain device list, but the problem is occurring because of the OS version, NOT the device, at least it seems that way from debugging... I also know there's the uses-sdk attributes in the manifest file: &lt;uses-sdk android:minSdkVersion="integer" android:targetSdkVersion="integer" android:maxSdkVersion="integer" /&gt; But setting the android:minSdkVersion to 17 will be way to high and not be available to many users, I also put a lot of work into making the app backwards compatible and works fine on pre 3.0 devices, it's just this android version 4.1.1 API 16 that is causing me trouble... Please help! Thank you! Edit: This is my current uses-sdk in my apps manifest: &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /&gt; Edit with relevant code: //button listener for the number buttons. Each button will display a number 1 - 10 //upon clicking the button the number that is displayed on the button will be //added to what is displayed in the textView // //mCurrentWorkingText is the current expression that is being added updated. View.OnClickListener genericNumberButtonListener = new View.OnClickListener() { @Override public void onClick(View v) { //cast the incoming view to a textView so we can get //the text the button displays TextView textView = (TextView) v; String textFromButton = textView.getText().toString(); if (mCurrentWorkingText.length() == 0) { mWorkingTextView.setText(mWorkingTextView.getText() .toString().concat(textFromButton)); mCurrentWorkingText = textFromButton; } else { // if the working TextView isn't zero we need to // append // the // textFromButton to what is already there. mWorkingTextView.setText(mWorkingTextView.getText() .t…
tagged with: java
possible better answer: http://stackoverflow.com/a/21290183
has comment: http://stackoverflow.com/comment/31742488
type: Question
has comment: http://stackoverflow.com/comment/31744550
has title: Can you restrict a specific Android API version from running/downloading app from googlePlay store?
has comment: http://stackoverflow.com/comment/31741296
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/31744697
has answer: http://stackoverflow.com/a/21290183
has comment: http://stackoverflow.com/comment/31743162
tagged with: android-version
has comment: http://stackoverflow.com/comment/31741077
tagged with: google-play
tagged with: android
tagged with: android-manifest
has answer: http://stackoverflow.com/a/21100068
accepted answer: http://stackoverflow.com/a/21100068
has comment: http://stackoverflow.com/comment/31741017
type: AnsweredQuestion

http://stackoverflow.com/a/21177540
type: Answer
has body: you are mixing desktop technology with web. It is not possible
answers question: http://stackoverflow.com/q/21177513
score: 0
has comment: http://stackoverflow.com/comment/31883241

http://stackoverflow.com/comment/31845703
comment on: http://stackoverflow.com/q/21154043
has text: Please change `int EXIT = 0; while(EXIT == 0) {` to `while(true) {` I get a twitch in my left eye every time I read it. If you set EXIT to 0 and then test for 0 you get true, so may as well just test for true.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/21033199
tagged with: swing
type: Question
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/21033258
favorite count: 0
has answer: http://stackoverflow.com/a/21033258
has title: How do I stop my paint method from repeating twice?
type: AnsweredQuestion
tagged with: paint
downvote count: 0
score: 1
has body: Here is the code for a dice game that I am working on that outputs the results to a window. The paint method repeats twice, which is not good for me because I want the dice to roll once and then move on to the next frame. Please someone help me with this problem. Thank you in advance. import java.awt.*; import java.util.Random; import javax.swing.*; public class Dice extends JApplet { public static int pause(int n) { try { Thread.sleep(n); } catch(InterruptedException e) { } return n; } public void Dice() { JApplet app = new Dice(); JFrame frame = new JFrame("Dice Game"); frame.setBounds(30, 50, 1300, 650); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.add(app); } public void paint(Graphics g) { int width = getWidth(); int height = getHeight(); int num = 0; for (int i = 0; i &lt; 7; i++) { Random generator= new Random(); int number = generator.nextInt(6)+1; g.setColor(Color.WHITE); g.fillRect(0, 0, width, height); g.setColor(Color.BLACK); g.drawRoundRect(550, 150, 200, 200, 50, 50); System.out.println("Test"); if (number == 1) { //Roll one num = 1; g.setColor(new Color (0, 0, 0)); g.fillOval(640, 240, 20, 20); pause(100); } if (number == 2) { //Roll two num = 2; g.setColor(new Color (0, 0, 0)); g.fillOval(590, 290, 20, 20); g.fillOval(690, 190, 20, 20); pause(100); } if (number == 3) { //Roll three num = 3; g.setColor(new Color (0, 0, 0)); g.fillOval(590, 290, 20, 20); g.fillOval(640, 240, 20, 20); g.fillOval(690, 190, 20, 20); pause(100); } if (number == 4) { //Roll four num = 4; g.setColor(new Color (0, 0, 0)); g.fillOval(590, 290, 20, 20); g.fillOval(590, 190, 20, 20); g.fillOval(690, 290, 20, 20); g.fillOval(690, 190, 20, 20); pause(100); } if (number == 5) { //Roll five num = 5; g.setColor(new Color (0, 0, 0)); g.fillOval(590, 290, 20, 20); g.fillOval(590, 190, 20, 20); g.fillOval(640, 240, 20, 20); g.fillOval(690, 290, 20, 20); g.fillOval(690, 190, 20, 20); pause(100); } if (number == 6) { //Roll six num = 6; g.setColor(ne…
tagged with: java

http://stackoverflow.com/comment/31710245
type: QuestionComment
comment on: http://stackoverflow.com/q/21082665
has text: @Quincunx, somehow I'm not getting it. Keep refreshing, but without new content.
score: 0
type: Comment

http://stackoverflow.com/a/36427118
has comment: http://stackoverflow.com/comment/123508602
has comment: http://stackoverflow.com/comment/82864100
has comment: http://stackoverflow.com/comment/87366298
has comment: http://stackoverflow.com/comment/112553290
has comment: http://stackoverflow.com/comment/82858396
has comment: http://stackoverflow.com/comment/91354502
has comment: http://stackoverflow.com/comment/119333347
has comment: http://stackoverflow.com/comment/126172164
has comment: http://stackoverflow.com/comment/120179486
has body: Go to URL in your browser: firefox - click on HTTPS certificate chain (the lock icon right next to URL address). Click "more info" > "security" > "show certificate" > "details" > "export..". Pickup the name and choose file type example.cer chrome - click on site icon left to address in address bar, select "Certificate" -> "Details" -> "Export" and save in format "Der-encoded binary, single certificate". Now you have file with keystore and you have to add it to your JVM. Determine location of cacerts files, eg. C:\Program Files (x86)\Java\jre1.6.0_22\lib\security\cacerts. Next import the example.cer file into cacerts in command line (may need administrator command prompt): keytool -import -alias example -keystore "C:\Program Files (x86)\Java\jre1.6.0_22\lib\security\cacerts" -file example.cer You will be asked for password which default is changeit Restart your JVM/PC. source: http://magicmonster.com/kb/prg/java/ssl/pkix_path_building_failed.html
has comment: http://stackoverflow.com/comment/105644213
has comment: http://stackoverflow.com/comment/91058194
has comment: http://stackoverflow.com/comment/79034058
upvote count: 1199
has comment: http://stackoverflow.com/comment/87360589
has comment: http://stackoverflow.com/comment/77559440
has comment: http://stackoverflow.com/comment/120353163
has comment: http://stackoverflow.com/comment/100615630
has comment: http://stackoverflow.com/comment/72900679
has comment: http://stackoverflow.com/comment/128673265
has comment: http://stackoverflow.com/comment/85312607
has comment: http://stackoverflow.com/comment/77884312
has comment: http://stackoverflow.com/comment/101328868
has comment: http://stackoverflow.com/comment/100407162
has comment: http://stackoverflow.com/comment/120179159
has comment: http://stackoverflow.com/comment/79329814
downvote count: 2
has comment: http://stackoverflow.com/comment/134132196
has comment: http://stackoverflow.com/comment/68015181
has comment: http://stackoverflow.com/comment/137615374
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/89357938
has comment: http://stackoverflow.com/comment/116285877
has comment: http://stackoverflow.com/comment/138544305
score: 1197
accepted answer of: http://stackoverflow.com/q/21076179
has comment: http://stackoverflow.com/comment/90253673
has comment: http://stackoverflow.com/comment/87028348
has comment: http://stackoverflow.com/comment/118171563
has comment: http://stackoverflow.com/comment/82864093
has comment: http://stackoverflow.com/comment/123488013
has comment: http://stackoverflow.com/comment/108977457
has comment: http://stackoverflow.com/comment/94626283
has comment: http://stackoverflow.com/comment/138957977
has comment: http://stackoverflow.com/comment/112873357
answers question: http://stackoverflow.com/q/21076179
has comment: http://stackoverflow.com/comment/139086965
has comment: http://stackoverflow.com/comment/90722595
has comment: http://stackoverflow.com/comment/91058444
has comment: http://stackoverflow.com/comment/68282014
has comment: http://stackoverflow.com/comment/111639230
has comment: http://stackoverflow.com/comment/121117378
has comment: http://stackoverflow.com/comment/112639658
has comment: http://stackoverflow.com/comment/119432887
type: Answer
has comment: http://stackoverflow.com/comment/122003420

http://stackoverflow.com/comment/31831680
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/21120622
type: Comment
has text: I'm not sure why I didn't get a notification that you had responded, but I seemed to have fixed it. Thanks.

http://stackoverflow.com/comment/77672249
has text: Thanks. This also helped in our project which uses EclipseLink instead of Hibernate.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27866835

http://stackoverflow.com/a/21062657
accepted answer of: http://stackoverflow.com/q/21061911
upvote count: 2
type: AcceptedAnswer
has body: You can try something similar to this, using AsyncTask. private void makeIconVisible(ImageView icon) { new MakeIconVisibleTask().execute(icon); } class MakeIconVisibleTask extends AsyncTask&lt;View, Void, Integer&gt; { private View mView; String mResult = null; @Override protected Integer doInBackground(View... arg0) { mView = arg0[0]; mResult = Utils.httpPost("MyURLHere", SomePostData); int success = -1; if(mResult!=null &amp;&amp; !mResult.isEmpty()) { success = 1; } return success; } @Override protected void onPostExecute(Integer res) { if(res &gt;0 ) { mView.setVisibility(View.VISIBLE); } } }
type: Answer
has comment: http://stackoverflow.com/comment/31672753
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21061911

http://stackoverflow.com/q/21172582
has comment: http://stackoverflow.com/comment/31874507
has comment: http://stackoverflow.com/comment/31875472
has comment: http://stackoverflow.com/comment/31874545
type: Question
has body: I have refreshed my project, cleanly rebuilt it, Googled/searched StackOverflow for similar problems, read the jOOQ documentation, examined the build output for potential issues, etc. I added a flag to my pom.xml to generate jOOQ Database Access Objects, since the jOOQ 3.2.0 online manual says "DAO generation can be activated using the daos flag". According to the jOOQ Advanced Codegen documentation setting this flag to true generates not only DAO's, but also relations, records, and POJOs: ... true Prior to adding the flag to my pom, I had auto-generated records and relations but neither POJOs nor DAOs. After adding the daos flag and rebuilding my project, I also have POJOs plus the other two but I still don't have any DAOs. The attached screenshot shows my generated classes. The classes added by the flag are in the blue box. I think there should be a package named something like "daos" with PurchaseDAO and UserDAO classes. The jOOQ DAO documentation doesn't explain any cases where the flag is added but DAOs aren't generated. Part of the point of this project is to learn jOOQ so manually coding DAOs with jOOQ classes won't solve my problem. EDIT: My SQLite 3.7.11 schema from the working and non-working solutions are here.
has comment: http://stackoverflow.com/comment/31875126
tagged with: java
has answer: http://stackoverflow.com/a/21173338
tagged with: eclipse
score: 11
has comment: http://stackoverflow.com/comment/31875380
has comment: http://stackoverflow.com/comment/31874460
has title: jOOQ not generating DAOs with <daos> flag set to true
answer count: 3
has comment: http://stackoverflow.com/comment/31874854
tagged with: sql
tagged with: sqlite
has comment: http://stackoverflow.com/comment/31874310
downvote count: 0
has comment: http://stackoverflow.com/comment/31874905
favorite count: 0
tagged with: jooq
has comment: http://stackoverflow.com/comment/31875212
accepted answer: http://stackoverflow.com/a/21173338
has comment: http://stackoverflow.com/comment/31874434
possible better answer: http://stackoverflow.com/a/48008033
upvote count: 11
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/48008033
has answer: http://stackoverflow.com/a/57606808

http://stackoverflow.com/q/21035326
answer count: 1
tagged with: websocket
favorite count: 0
has answer: http://stackoverflow.com/a/21045261
accepted answer: http://stackoverflow.com/a/21045261
score: 2
type: AnsweredQuestion
has body: I can't figure out from the WebSocketServer.java source which draft it uses. The WebSocketClient.java can use RFC 6455, Hybi 17, Hybi 10, Hixie 76, and Hixie 75 yet defaults to RFC 6455. What draft does java-websocket's WebSocketServer use?
downvote count: 0
tagged with: java
tagged with: java-websocket
has title: What draft does java-websocket's WebSocketServer use?
type: Question
upvote count: 2

http://stackoverflow.com/comment/31726691
has text: Yep, that's right. Handle (try, except) or declare (throws...) The original question is somehow not realy clear, though
comment on: http://stackoverflow.com/a/21091340
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/31604461
type: QuestionComment
has text: Ugh, this is recursive, and shouldn't be.
comment on: http://stackoverflow.com/q/21025074
score: 4
type: Comment

http://stackoverflow.com/q/21115205
has comment: http://stackoverflow.com/comment/31820938
type: Question
has answer: http://stackoverflow.com/a/21117706
accepted answer: http://stackoverflow.com/a/21117706
has comment: http://stackoverflow.com/comment/31769769
tagged with: spring-boot
upvote count: 6
has title: spring-boot with spring-ws -SOAP Endpoint not accessable
answer count: 1
linked to: http://stackoverflow.com/q/19053388
has comment: http://stackoverflow.com/comment/31774040
favorite count: 0
has comment: http://stackoverflow.com/comment/31769353
tagged with: soap
tagged with: spring
type: AnsweredQuestion
has body: I am playing around with spring-boot and i run into a problem. To create RESTful webservices is quite easy. But i am not able to run an soap service with spring-boot. Actually my Project hast the spring-boot-starter-web dependency. Is there an extra sprint-boot-starter needed that does not yet exist? What are some workarounds? If i have a web.xml for the SOAP service can i include it somehow in the initialization process? I know that a similar question already exists, but it did not solve my problem because the question there is based on spring-web. So i think my Problem is somewhere else. The Endpoint of my soap-webservice looks like this one: @Endpoint public class MyEndpoint { @PayloadRoot(localPart = "myRequest", namespace = "my.ns") @ResponsePayload public TResponse logRequest(@RequestPayload final TRequest request) { //some code } //more methods } The endpoint is weird together in an xml which is loaded by spring-boot via the ImportResource annotation. So my starter class looks like this: @Configuration @EnableAutoConfiguration @ImportResource({ "classpath:/my/pack/app.xml" }) //soap-endpoint is configured here. public class Example { public static void main(final String[] args) { SpringApplication.run(Example.class, args); } } The configuration of the endpoint <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:web-services="http://www.springframework.org/schema/web-services" xmlns:mvc="http://www.springframework.org/schema/mvc" 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/web-services http://www.springframework.org/schema/web-s…
downvote count: 0
tagged with: java
score: 6
tagged with: web-services

http://stackoverflow.com/comment/31692025
score: 0
type: Comment
has text: @peter.petrov: sorry, reading it as long does not work, it give me negative. I am confused that long take 8 bytes but the header size is 4 bytes, Dose that mean I added 4 extra bytes?
comment on: http://stackoverflow.com/a/21073011
type: AnswerComment

http://stackoverflow.com/q/21074397
has title: How to create a (unknown) number of ArrayLists within an ArrayList?
has body: I have a problem that I'm trying to Solve. I want to create an ArrayList of unknown number of elements, and in that ArrayList place other ArrayLists. For example: A hospital queue, and within this queue I want to have different queues based in the priority of the patient. System.out.println("whats the maximum priority?"); int maxPriority = Scan.nextInt(); //Trying to create a new ArrayList in every ArrayList index. for(int k=0; k&lt;maxPriority;k++){ queues[k] = new Arraylist(); } //trying to create a "patient"-object with a name and priority public static patient(String name, int priority){ this.name=name; this.priority=priority; } // trying to get the priority of a patient// public static getPriority(){ return priority; } // Trying to add the patient last in the correct "priority queue" public static placePatient()){ queues.add(patient.getPriority) }
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/21074480
type: UnansweredQuestion
score: 3
upvote count: 3
tagged with: java
type: Question
downvote count: 0
tagged with: arraylist

http://stackoverflow.com/comment/31651802
score: 0
has text: Both are stronger technology in there field but you can merge them too.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21051259

http://stackoverflow.com/a/21140350
has body: http://jsoup.org/ It's all I have to say :) hope that helps
answers question: http://stackoverflow.com/q/21140284
score: 3
accepted answer of: http://stackoverflow.com/q/21140284
has comment: http://stackoverflow.com/comment/31815834
upvote count: 3
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/31814842
has comment: http://stackoverflow.com/comment/31815770
downvote count: 0

http://stackoverflow.com/q/21165207
type: Question
has title: Search Youtube api using Proxy, per connection and not system wide
tagged with: youtube
has body: I have a Java code using youtube-api to search videos. Until now I was using the system configuration to set the proxy (http and https) and everything is working fine that way. But now I have a new requirement regarding the way we use proxy on the server. As we have other services running on the very same server, they asked me to not configure the proxy using system wide approach, because this affect all the services using JVM. System.setProperty("https.proxyHost", httpsProxyHost); System.setProperty("https.proxyPort", httpsProxyPort); I want to do something like this: YouTubeService service = new YouTubeService(clientID); logger.info("proxyHost for youtube updated :"+this.parameters.getProxyHost() ); logger.info("proxyPort for youtube updated :"+this.parameters.getProxyPort() ); logger.info("before youtube constructor " ); service.setConnectTimeout(timeout); // millis YouTubeQuery query = new YouTubeQuery(new URL(YOUTUBE_URL)); logger.info("afer youtube constructor " ); query.setOrderBy(YouTubeQuery.OrderBy.VIEW_COUNT); query.setFullTextQuery(textQuery); query.setSafeSearch(YouTubeQuery.SafeSearch.NONE); query.setMaxResults(maxResults); VideoFeed videoFeed = service.query(query, VideoFeed.class); List&lt;VideoEntry&gt; videos = videoFeed.getEntries();
tagged with: java
upvote count: 1
tagged with: youtube-api
type: UnansweredQuestion
tagged with: gdata-api
downvote count: 0
answer count: 0
score: 1
favorite count: 0
tagged with: proxy

http://stackoverflow.com/comment/31696029
has text: If you wanted to do this without making a mock Graphics object as the accepted answer suggests, I would do it using a BufferedImage, whose createGraphics() method always returns a valid Graphics object.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21069972
score: 1

recaptcha
tag name: recaptcha
tags question: http://stackoverflow.com/q/21122528
type: Tag

http://stackoverflow.com/q/21038384
has comment: http://stackoverflow.com/comment/45244168
has body: I want to know how I can name a variable dynamically. If there are 3 items in a list then it should create 3 different object for each item. Like: ArrayList&lt;String&gt; list1; ArrayList&lt;String&gt; list2; ArrayList&lt;String&gt; list3; So it should count up or anything like that. if there are 4 items in a list it should create 4 variables. How can I achieve that? Edit: I tried this but it says me an error that I can't create a generic array of Info. ArrayList&lt;Info&gt; listForLg[] = new ArrayList&lt;Info&gt;[]; for (int i = 0; i &lt; sizeOfKfzList; i++) { listForLg[i] = new ArrayList&lt;Info&gt;(); listForLg[i].add(logInfo); } Can you help me?
tagged with: variables
has comment: http://stackoverflow.com/comment/31629252
has answer: http://stackoverflow.com/a/21038489
answer count: 3
has answer: http://stackoverflow.com/a/21038427
tagged with: android
downvote count: 1
duplicate of: http://stackoverflow.com/q/1200621
upvote count: 4
has comment: http://stackoverflow.com/comment/31629313
favorite count: 0
has title: How to name a variable dynamically? - Java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31629191
score: 3
linked to: http://stackoverflow.com/q/5662394
tagged with: java
has comment: http://stackoverflow.com/comment/31629396
has answer: http://stackoverflow.com/a/21038548
type: Question

http://stackoverflow.com/q/21124310
has comment: http://stackoverflow.com/comment/31787077
tagged with: arrays
has comment: http://stackoverflow.com/comment/31786984
downvote count: 0
has answer: http://stackoverflow.com/a/21124501
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/21124537
has comment: http://stackoverflow.com/comment/31786895
accepted answer: http://stackoverflow.com/a/21124501
has answer: http://stackoverflow.com/a/21124581
answer count: 4
type: AnsweredQuestion
score: 3
linked to: http://stackoverflow.com/q/2164804
upvote count: 3
tagged with: java
has body: As java doc states it: char: The char data type is a single 16-bit Unicode character. It has a minimum value of '\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive). But when I have a String (just containing ASCII-signs) and convert it to a byte array, every sign of the String is stored in one byte, which is less than the 16 bit as java docs states it. How does it work? I could imagine that the java compiler/interpreter uses just one byte per char for an ASCII sign for performance issues. Furthermore, what happens if I've got a String with just ASCII signs and one UTF-16 sign and convert it to a byte array. Every sign of the String uses 2 bytes now?
has title: Size of a char in a byte array
possible better answer: http://stackoverflow.com/a/21124416
has answer: http://stackoverflow.com/a/21124416
has comment: http://stackoverflow.com/comment/31786903
type: Question
tagged with: casting

http://stackoverflow.com/a/21133788
has comment: http://stackoverflow.com/comment/31806716
type: Answer
has comment: http://stackoverflow.com/comment/31820846
score: 2
has body: Decode the file as jpeg and see if it throws an Exception or returns an image? You can use JDK ImageIO to do this (http://docs.oracle.com/javase/6/docs/api/javax/imageio/ImageIO.html). Start by obtaining ImageReader for jpeg, then let that reader attempt to read the image.
downvote count: 0
has comment: http://stackoverflow.com/comment/31803712
answers question: http://stackoverflow.com/q/21133581
has comment: http://stackoverflow.com/comment/31804021
upvote count: 2

http://stackoverflow.com/comment/31909151
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21161743
has text: @BartoszWyględacz It's good idea put each Student in [ThreadPool](http://www.javacodegeeks.com/2013/01/java-thread-pool-example-using-executors-and-threadpoolexecutor.html)

http://stackoverflow.com/comment/31632251
comment on: http://stackoverflow.com/q/21040600
score: 2
type: Comment
has text: An example of `seconds` value which gives a weird result would help!
type: QuestionComment

http://stackoverflow.com/a/21234552
type: Answer
has body: thank you for your time... The problem has been resolved by deleting the following line: inputStream = null; It was a Thread problem, I create multiple Threads and i was initializing inputstream var while other Threads where running... Thanks for your help and suggestions guys!
score: 0
answers question: http://stackoverflow.com/q/21167005

http://stackoverflow.com/q/21036530
has answer: http://stackoverflow.com/a/21036818
type: AnsweredQuestion
has body: How to prevent duplication in dropdownlist using JSTL . <c:forEach items="${model.abc}" var="folder" varStatus="status"> ${folder} </c:forEach> Suppose my model object abc is having some data like : Folder :"abc" , "bcd", "abc" How to prevent abc to be populated in dropdown multiple times?
tagged with: java
has answer: http://stackoverflow.com/a/21036689
type: Question
tagged with: jstl
has comment: http://stackoverflow.com/comment/31625893
accepted answer: http://stackoverflow.com/a/21036689
tagged with: jsp
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/21036610
has answer: http://stackoverflow.com/a/21036610
has title: How to prevent duplication in dropdownlist using JSTL

http://stackoverflow.com/q/21131125
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21133720
accepted answer: http://stackoverflow.com/a/21133720
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/4740934
has body: i'm deserializing a Xml file which is : <?xml version="1.0" encoding="utf-8"?> Salesman1 123 4 with this line that throws me the Exception : org.simpleframework.xml.core.ValueRequiredException: Unable to satisfy @org.simpleframework.xml.ElementList(data=false, empty=true, entry=user, inline=true, name=, required=true, type=void) on field 'user' public java.util.List azdad.pos.android.UserList.user for class azdad.pos.android.UserList at line 2 my entity class is : import java.util.List; import org.simpleframework.xml.Element; import org.simpleframework.xml.ElementList; import org.simpleframework.xml.Path; import org.simpleframework.xml.Root; @Root(name="UserList",strict=false) public class UserList{ @ElementList(entry="user", inline=true) public List<UserInfo> user; public List<UserInfo> getUsrs(){ return user; } } I've used strict to ignore the Tag According to this link : How to ignore unused XML elements while deserializing a document? but it doesn't work , does anybody know how can i ignore tag for deserializng
score: 0
tagged with: xml-parsing
has title: Xml deserialization ValueRequiredException
answer count: 1
tagged with: xml-serialization
tagged with: simple-framework
tagged with: android

http://stackoverflow.com/comment/31676560
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21064740
score: 0
has text: A_1 and B_1 are equivalent? What do you mean by that? Since they are in the same class how does that help? Did you maybe mean A_1 and A_2? Also field D is not present in your example (I assume you mean field E). Can you give an example of what you mean by the merge of TypeA and TypeB? I can guess, but it's hard to really judge.

http://stackoverflow.com/comment/31818891
comment on: http://stackoverflow.com/a/21117706
score: 0
type: AnswerComment
type: Comment
has text: @Dave Syer I tried that code snipped out, added the context config location but i don't see that any wsdl url is mapped now. @M. Denium can you provide a code sample? I had some code with `WebApplicationInitializer` but i remember the `onStartup` method was never called

http://stackoverflow.com/a/21177866
type: AcceptedAnswer
upvote count: 5
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/31883738
score: 5
answers question: http://stackoverflow.com/q/21177801
has body: The problem is that nextInt() doesn't consume (doesn't read) the new-line character (that you input when you press [Enter]). One way to solve this is calling nextLine() after each nextInt(): //Enter first number System.out.println("Please enter the first number: "); int num1 = numInput.nextInt(); numInput.nextLine(); // Add this //Enter the second number System.out.println("Please enter the second number: "); int num2 = numInput.nextInt(); numInput.nextLine(); // Add this Another way to solve this, would be reading the numbers with nextLine() (which returns a String) and then parsing it to a int: int num1 = Integer.parseInt(numInput.nextLine()); You won't need to add an extra nextLine() because the new-line character is being consumed by the nextLine() already called. Also, as @sotondolphin suggested, you may want to check your * and / operations.
accepted answer of: http://stackoverflow.com/q/21177801

http://stackoverflow.com/q/21119096
upvote count: 5
has comment: http://stackoverflow.com/comment/31777139
has answer: http://stackoverflow.com/a/21119294
downvote count: 2
type: AnsweredQuestion
has body: I am getting this error: java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff] Here is my java code: &lt;% int reg; String sdate = request.getParameter("sdate"); //Timestamp ts=request.get //out.println(sdate); String text = "0000-00-00 00:00:00"; Timestamp ts = Timestamp.valueOf(text); // Timestamp ts1=Timestamp.valueOf(sdate); // Timestamp ts2=Timestamp.valueOf(edate); try{ String s; Format formatter; Date date = new Date(sdate); //out.println(date); formatter = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss"); s = formatter.format(date); out.println(s); PreparedStatement ps=cn.prepareStatement("insert into c1 values(?)"); // ps.setString(1,ts); ps.setTimestamp(1,ts); int i=ps.executeUpdate(); if(i==1) { pw.println("record inserted"); } else { pw.println("not iNSERTED"); } //cn.close(); } catch(Exception e) { out.println(e.toString()); } %&gt; Any Suggestions?
score: 3
has comment: http://stackoverflow.com/comment/31776913
possible better answer: http://stackoverflow.com/a/21119177
tagged with: java
has comment: http://stackoverflow.com/comment/31777221
accepted answer: http://stackoverflow.com/a/21119176
type: Question
has answer: http://stackoverflow.com/a/21119177
has answer: http://stackoverflow.com/a/21119176
linked to: http://stackoverflow.com/q/1363527
answer count: 3
tagged with: jdbc
has title: how to insert Timestamp in database?
has comment: http://stackoverflow.com/comment/31776824
favorite count: 0

http://stackoverflow.com/q/21033928
type: AnsweredQuestion
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/6885269
tagged with: file
favorite count: 0
type: Question
has body: I need not last modification time and not last file accessed time, but file creation time. I have not found information about this. Maybe some libs? Path p = Paths.get(f.getAbsoluteFile().toURI()); BasicFileAttributes view = null; try { view = Files.getFileAttributeView(p, BasicFileAttributeView.class).readAttributes(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } FileTime creationTime = view.creationTime(); In this code creation time is not valid and return today date. Operation System: Windows 7 Java: SE-1.7
score: 10
has answer: http://stackoverflow.com/a/21033978
answer count: 3
possible better answer: http://stackoverflow.com/a/32771920
upvote count: 10
has answer: http://stackoverflow.com/a/32771920
has answer: http://stackoverflow.com/a/21034012
accepted answer: http://stackoverflow.com/a/21034012
linked to: http://stackoverflow.com/q/14842195
has title: How to get proper file creation date of file?

http://stackoverflow.com/comment/31678116
type: QuestionComment
has text: 1) Make sure chooseSkin() is a method of return-type 'String' and also include the code in order for us to help you. 2) Try this before setting the LookAndFeel: `System.out.println(chooseSkin());` you could also try doing this: `System.out.println(chooseSkin() =="com.jtattoo.plaf.aluminium.AluminiumLookAndFeel");` (should print out "true" if it is correct) printing out variables is great for debugging. Alternatively you can try using `chooseSkin().toString();`, in some cases it will work.
comment on: http://stackoverflow.com/q/21065103
score: 0
type: Comment

tomcat7
tags question: http://stackoverflow.com/q/21166584
tags question: http://stackoverflow.com/q/21044502
tags question: http://stackoverflow.com/q/21124530
tags question: http://stackoverflow.com/q/21079193
tags question: http://stackoverflow.com/q/21118368
tags question: http://stackoverflow.com/q/21094477
tags question: http://stackoverflow.com/q/21180766
tags question: http://stackoverflow.com/q/21089231
tags question: http://stackoverflow.com/q/21148414
tags question: http://stackoverflow.com/q/21082692
tags question: http://stackoverflow.com/q/21020819
type: Tag
tags question: http://stackoverflow.com/q/21030729
tags question: http://stackoverflow.com/q/21052186
tags question: http://stackoverflow.com/q/21082413
tags question: http://stackoverflow.com/q/21029708
tags question: http://stackoverflow.com/q/21134629
tag name: tomcat7
tags question: http://stackoverflow.com/q/21099710

http://stackoverflow.com/comment/31789893
type: AnswerComment
comment on: http://stackoverflow.com/a/21126014
type: Comment
has text: @Kalec Example of what? I said the leading slash makes it absolute... so to make it relative... remove the leading slash.
score: 0

http://stackoverflow.com/a/21072288
type: Answer
has comment: http://stackoverflow.com/comment/31690759
has body: First you need to store the contents of the HTML into a Document (explained more here): String url = "http://radar.weather.gov/ridge/RadarImg/N0R/ILN/"; Document doc = Jsoup.connect(url).get(); Next select the Elements from the Document that you want (see here). In the following line, it will select all &lt;a&gt; elements with a href attribute that contains the String "gif": Elements links = doc.select("a[href]:contains(gif)"); Then to print out the value from the first ten, you could just use a loop. The attr() method allows you to extract only the value of a certain attribute, rather than the complete HTML or its text: for (int i=0;i&lt;10;i++) { System.out.println(links.get(i).attr("href")); } The output is: ILN_20140112_0221_N0R.gif ILN_20140112_0227_N0R.gif ILN_20140112_0232_N0R.gif ILN_20140112_0237_N0R.gif ILN_20140112_0242_N0R.gif ILN_20140112_0248_N0R.gif ILN_20140112_0253_N0R.gif ILN_20140112_0258_N0R.gif ILN_20140112_0303_N0R.gif ILN_20140112_0308_N0R.gif This is essentially the basic methodology for most of the parsing you will do in Jsoup. You should have a go at extracting some other Elements from the page (use this page for reference).
accepted answer of: http://stackoverflow.com/q/21072003
has comment: http://stackoverflow.com/comment/31690693
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/21072003
has comment: http://stackoverflow.com/comment/31690732
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/31876647
comment on: http://stackoverflow.com/q/21173835
score: 0
type: Comment
type: QuestionComment
has text: Have you tried it without the leading `/` ?

http://stackoverflow.com/comment/89274196
score: 2
comment on: http://stackoverflow.com/a/39336431
type: AnswerComment
type: Comment
has text: I can't find a tools.jar in jdk-10.0.1.

http://stackoverflow.com/a/21043413
score: 2
upvote count: 2
has body: To my knowledge, you can only pass to the main knowledge in String format. This is because things passed to the main method come from System.in, either through random user input or things like piping, whereby you pass Strings from one Java program to another. That being said, what you could do is that you create a method in your object class to parse a String form of that object to recreate the original version of that object. For example: public class myRectangle { private int length; private int width; public myRectangle(int inLength, int inWidth) { this.length = inLength; this.width = inWidth; } // the rest of your class public String toString() { return "[" + length + ", " + width + "]"; } public static Rectangle parseString(String input) { int firstBracketIndex; int commaIndex; int lastBracketIndex; firstBracketIndex = 0; commaIndex = input.indexOf(","); lastBracketIndex = input.length() - 1; String aWidth = input.substring(firstBracketIndex, (commaIndex - 1)); String aLength = input.substring((commaIndex + 2), lastBracketIndex); return new Rectangle(Integer.parseInt(aWidth), Integer.parseInt(aLength)); } } Something like this could solve your problem. (There may be some off by one errors in my code and I wrote it out really long so it would be clear, but you get the idea!) The point is, that you create a parsing method that is the inverse of your toString method, so that you can take copies of your class off the command line.
accepted answer of: http://stackoverflow.com/q/21043362
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21043362
type: Answer

http://stackoverflow.com/comment/31680477
type: Comment
comment on: http://stackoverflow.com/a/21066752
type: AnswerComment
has text: I don't understand the point of checking if the table was created. I might be misunderstanding you
score: 0

http://stackoverflow.com/a/21042207
answers question: http://stackoverflow.com/q/21041242
score: 0
has comment: http://stackoverflow.com/comment/31635102
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31635251
type: Answer
has comment: http://stackoverflow.com/comment/31634830
accepted answer of: http://stackoverflow.com/q/21041242
has comment: http://stackoverflow.com/comment/31638316
has comment: http://stackoverflow.com/comment/31635668
has comment: http://stackoverflow.com/comment/31635434
has body: You need to attribute the object with the DataContract attribute and every property (!) that should be passed to the client with the DataMember attribute. While I wrote above it needs to be a property, it could be it works with public variables also, but I'm not sure.

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/21162598
tags question: http://stackoverflow.com/q/21130677
type: Tag
tags question: http://stackoverflow.com/q/21072109
tags question: http://stackoverflow.com/q/21158142

http://stackoverflow.com/comment/31878223
comment on: http://stackoverflow.com/q/21174574
score: 0
type: Comment
type: QuestionComment
has text: Shaking my head and voting to close.

http://stackoverflow.com/q/21115659
score: 0
has body: I make chessboard, where alone king will walk according to the rules of chess. Below it's method to make, it called for 2 times for i and j coordinate of King, I Made input variable String to check if this King's coordinates already exist. Than I try to convert it to integer, seems something wrong with this conversion. import java.util.*; public class King { int move(String iK){ Random rand = new Random(); Integer coordinateKing = Integer.valueOf(iK); if (iK == null){ coordinateKing = rand.nextInt(8); }else{ int caseI; switch(caseI = rand.nextInt(2)){ case 0: if (coordinateKing &lt; 8){ coordinateKing++; } else {caseI = rand.nextInt(2);} break; case 1: if (coordinateKing &gt; 0){ coordinateKing--; } else {caseI = rand.nextInt(2);} break; default: break; } } return coordinateKing; } } I have problem like this: Exception in thread "main" java.lang.NumberFormatException: null at java.lang.Integer.parseInt(Integer.java:454) at java.lang.Integer.valueOf(Integer.java:582) at chess_engine.King.move(King.java:6) at chess_engine.MainClass.main(MainClass.java:12) Thanks in advance!
has answer: http://stackoverflow.com/a/21115715
has comment: http://stackoverflow.com/comment/31770113
has title: Something wrong with string to integer conversion
has answer: http://stackoverflow.com/a/21116381
has comment: http://stackoverflow.com/comment/31770090
has answer: http://stackoverflow.com/a/21115714
answer count: 4
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/21115745
type: Question
possible better answer: http://stackoverflow.com/a/21115715
has answer: http://stackoverflow.com/a/21115745

http://stackoverflow.com/q/21019833
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/21019976
accepted answer: http://stackoverflow.com/a/21019976
type: AnsweredQuestion
has title: Iterator - java.util.NoSuchElementException in Spring MVC Controller
score: 1
upvote count: 1
type: Question
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/31594627
tagged with: java
has comment: http://stackoverflow.com/comment/31594760
tagged with: iterator
has body: I have Java spring MVC application. Through AngularJS. from I client I am uploading a single file and with some other data I am posting to server. My Java Controller class @Controller public class FileUploadController { @RequestMapping(value="/fileUpload", method = RequestMethod.POST) public void UploadFile(MultipartHttpServletRequest request, HttpServletResponse response) { System.out.println(request.getFileNames()); Iterator&lt;String&gt; itr=request.getFileNames(); System.out.println(itr.hashCode()); MultipartFile file=request.getFile(itr.next()); String fileName=file.getOriginalFilename(); System.out.println(fileName); } } When I am running this I get first two lines printed and then getting exception. java.util.LinkedHashMap$KeyIterator@471164ef 1190767452 Error java.util.NoSuchElementException at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(LinkedHashMap.java:396) at java.util.LinkedHashMap$KeyIterator.next(LinkedHashMap.java:405) at com.uploaddemo.web.FileUploadController.UploadFile(DocumentUploadController.java:21) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686) at org.springframewor…

http://stackoverflow.com/comment/31781646
has text: It sounds like you just need `File#listFiles()`.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/21121765
type: Comment

http://stackoverflow.com/comment/31673028
type: QuestionComment
comment on: http://stackoverflow.com/q/21062787
score: 0
has text: I need it to be static because the `model` object needs to exist only once per subclass. My problem is how having one static model per subclass, while still ensuring it is defined in the parent class.
type: Comment

http://stackoverflow.com/comment/31866421
type: QuestionComment
comment on: http://stackoverflow.com/q/21168524
score: 7
has text: Strings are immutable. It should be `sentence = sentence.replaceAll("\\D", "");`
type: Comment

http://stackoverflow.com/comment/31819102
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21142467
has text: +1 I learned something new today.
score: 0

http://stackoverflow.com/comment/31905859
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21163424
has text: Do **not** use that Sun classes. They are private.
type: QuestionComment

http://stackoverflow.com/a/21066624
type: Answer
accepted answer of: http://stackoverflow.com/q/21066323
has comment: http://stackoverflow.com/comment/31687953
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/31693896
downvote count: 0
has body: You have to add a listener to each clickable object. Here is a working example: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class TestFrame extends JFrame{ public TestFrame(int size){ JPanel content = new JPanel(new GridLayout(size, size)); JPanel[] panel = new JPanel[size * size]; PanelListener listener = new PanelListener(); for(int i = 0; i &lt; panel.length; i++){ panel[i] = new JPanel(); panel[i].setBackground(Color.white); panel[i].addMouseListener(listener); content.add(panel[i]); } this.add(content); } // MouseListener offers the method mouseClicked(MouseEvent e) private class PanelListener implements MouseListener { @Override public void mouseClicked(MouseEvent event) { /* source is the object that got clicked * * If the source is actually a JPanel, * then will the object be parsed to JPanel * since we need the setBackground() method */ Object source = event.getSource(); if(source instanceof JPanel){ JPanel panelPressed = (JPanel) source; panelPressed.setBackground(Color.blue); } } @Override public void mouseEntered(MouseEvent arg0) {} @Override public void mouseExited(MouseEvent arg0) {} @Override public void mousePressed(MouseEvent arg0) {} @Override public void mouseReleased(MouseEvent arg0) {} } public static void main(String[] args){ TestFrame theGUI = new TestFrame(8); theGUI.setTitle("Grid"); theGUI.setVisible(true); theGUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); theGUI.setSize(400,400); } }
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/21066323

http://stackoverflow.com/a/21347730
downvote count: 0
has body: I figured out how to be notified when child window closes. In gwt we can do it by using JSNI. Below method is a jsni to get the reference of the newly opened window. private static native BodyElement getNewWindowRef(String url) /*-{ var childWindow = window.open(url, "_blank", "height=800px width=300px location=no"); return childWindow; }-*/; To tell whether the window is closed or not, we can use following jsni code, passing the variable received from the above. private static native boolean getNewWindowStatus(BodyElement childWin) /*-{ var ret = false; if (childWin.closed) { ret = true; } return ret; }-*/;
type: Answer
accepted answer of: http://stackoverflow.com/q/21021206
answers question: http://stackoverflow.com/q/21021206
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/21070503
answers question: http://stackoverflow.com/q/21070500
type: Answer
has body: You'll need to pass a String representation of counter to setText(). Either of the following lines would work: txtCounter.setText(String.valueOf(counter)); Or: txtCounter.setText(counter + "");
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/21070500

http://stackoverflow.com/q/21176754
has answer: http://stackoverflow.com/a/21181943
type: Question
score: 4
has title: how can I convert an image to grayscale without losing transparency?
tagged with: bufferedimage
tagged with: java
type: UnansweredQuestion
tagged with: image
upvote count: 4
answer count: 4
has answer: http://stackoverflow.com/a/49137990
tagged with: grayscale
has answer: http://stackoverflow.com/a/21176863
has answer: http://stackoverflow.com/a/21176938
downvote count: 0
has body: I am having problems converting a colored image with some transparent pixels to grayscale. I have searched and found related questions on this website but nothing I have been able to use to solve my problem. I have defined a method "convertType" as follows: /*------------------------------ attempts to convert the type of the image argument to the chosen type for example: BufferedImage newImage= ImageUtilities.convertType(oldImage, BufferedImage.TYPE_3BYTE_BGR); 11/28/2013 WARNING-it remains to be seen how well this method will work for various type conversions ------------------------------*/ public static BufferedImage convertType (BufferedImage image,int newType){ if (image.getType() == newType){ return (image); }else { int w= image.getWidth(); int h= image.getHeight (); BufferedImage modifiedImage = new BufferedImage( w,h,newType); Graphics2D g = ( Graphics2D)modifiedImage.getGraphics(); g.drawImage( image, null, 0,0); g.dispose(); return (modifiedImage); } } I start with a BufferedImage of type TYPE_4BYTE_ABGR named "result", then: result= convertType (result, BufferedImage.TYPE_BYTE_GRAY);//transparency is lost result=convertType (result, BufferedImage.TYPE_INT_ARGB);//pixels will now support transparency For colored opaque pixels in the original image the above sequence works fine: for example, (32, 51, 81, 255)-> (49, 49, 49, 255) However, transparent pixels in the original image are turned opaque: for example, (0, 0, 0, 0)-> (0, 0, 0, 255) I understand what is happening and I can work around the problem if I can make use of the Java algorithm used to convert to grayscale. I have downloaded the source code and poked around but have not been able to locate the algorithm. I would greatly appreciate it if someone could either: tell me what class contains the grayscale conversion algorithm or suggest an alternative way to accomplish what I am trying to do.
favorite count: 0

http://stackoverflow.com/a/21102247
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31767091
has comment: http://stackoverflow.com/comment/31771822
has body: In Eclipse go to Help -> Install New Software Type in this URL: http://download.jboss.org/jbosstools/updates/development/indigo/ Hit add, and you should then be able to add all of the things you need.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/21102172

http://stackoverflow.com/q/21117671
has body: I'm implementing a throttling mechanism to limit the amount of web requests sent to a server. If there are too many submissions for a request then the extra requests are queued until the resource becomes available. There seems to be many throttling options and im not sure which one to choose. So far im tempted to implement the token bucket algorithm as described at http://en.wikipedia.org/wiki/Token_bucket . There is Python code associated with this at What&#39;s a good rate limiting algorithm? so should be straightforward to implement a Java/Scala version. Guava has what looks like a nice implementation described at http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/util/concurrent/RateLimiter.html Also Akka seems to implement throttling using the Throttler trait described at : http://doc.akka.io/api/akka/2.1.2/index.html#akka.contrib.throttle.Throttler I would like to implement my own but don't like re-inventing the wheel if there is a solution already available. Are there advantages to using the token bucket algorithm over using the options already provided by Guava &amp; Scala ? Out of the three options which is most recommended ?
tagged with: algorithm
score: 7
tagged with: java
linked to: http://stackoverflow.com/q/667508
tagged with: akka
downvote count: 0
favorite count: 0
tagged with: throttling
has title: Which throttling implementation to use?
has comment: http://stackoverflow.com/comment/31774335
answer count: 0
tagged with: scala
type: UnansweredQuestion
upvote count: 7
type: Question

http://stackoverflow.com/comment/31732815
type: QuestionComment
has text: `for (int i = 0; i <= length; i++) {` or for `(int i = 0; i < length; i++) {` doesn't make a difference
comment on: http://stackoverflow.com/q/21094816
score: 0
type: Comment

http://stackoverflow.com/q/21057743
has comment: http://stackoverflow.com/comment/31664099
accepted answer: http://stackoverflow.com/a/21057778
favorite count: 0
has body: Does anyone see my error? When I take all of the array stuff out, it works. LogCat says my error is on the first line of the first FOR loop (where particlex[z] = random.nextInt(400);) This is in Java on the Android platform //initialized double particlex[]; double particley[]; double vx[]; double vy[]; boolean firstRun = true; int pari = 5; double f; //method c.save(); c.drawColor(0xff000000); Paint p = setShapeColor(); speed=1; if(firstRun){ for (int z = 0; z&lt;pari; z++){ particlex[z] = random.nextInt(400); particley[z] = random.nextInt(400); vx[z] = random.nextInt(4) -4; vy[z] = random.nextInt(4) -4; } firstRun = false; } // for (int z = 0; z&lt; pari; z++){ f = 1 / Math.sqrt( (float)Math.pow((particlex[z]-mCenterX),2) + (float)Math.pow((particley[z]-mCenterY),2) ); vx[z] += (particlex[z]-mCenterX) * f; vy[z] += (particley[z]-mCenterY) * f; particlex[z] -= vx[z]; particley[z] -= vy[z]; c.drawCircle(mCenterX,mCenterY,50,p); c.drawCircle((float)particlex[z],(float)particley[z],25,p); } c.restore(); if(shape!=8) endShape(); Here's my log output 01-10 21:09:22.147: D/AndroidRuntime(4403): Shutting down VM 01-10 21:09:22.147: W/dalvikvm(4403): threadid=1: thread exiting with uncaught exception (group=0x416c1d40) 01-10 21:09:22.148: E/AndroidRuntime(4403): FATAL EXCEPTION: main 01-10 21:09:22.148: E/AndroidRuntime(4403): Process: come.ClarkMU.Michael.LWP, PID: 4403 01-10 21:09:22.148: E/AndroidRuntime(4403): java.lang.NullPointerException 01-10 21:09:22.148: E/AndroidRuntime(4403): at com.ClarkMU.Michael.LWP.output.DrawShapes$CubeEngine.gravitySim(DrawShapes.java:588) 01-10 21:09:22.148: E/AndroidRuntime(4403): at com.ClarkMU.Michael.LWP.output.DrawShapes$CubeEngine.drawFrame(DrawShapes.java:204) 01-10 21:09:22.148: E/AndroidRuntime(4403): at com.ClarkMU.Michael.LWP.output.DrawShapes$CubeEngine.onSurfaceChanged(DrawShapes.java:146) 01-10 21:09:22.148: E/AndroidRuntime(4403): at android.service.wallpaper.WallpaperService$Engine.updateSurface(WallpaperService.java:693) …
possible better answer: http://stackoverflow.com/a/21057788
downvote count: 2
has answer: http://stackoverflow.com/a/21057788
tagged with: android
upvote count: 1
has title: Casting Error in Java program?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31664065
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21057778
score: -1
has answer: http://stackoverflow.com/a/21057797
answer count: 3

http://stackoverflow.com/q/21080710
has title: Audio Stream error in java while trying to play a .wav file
has comment: http://stackoverflow.com/comment/31748898
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31726463
tagged with: audio
has comment: http://stackoverflow.com/comment/31770865
has comment: http://stackoverflow.com/comment/31763316
tagged with: java
has body: When i try to play a sound in java, the compiler throws an error saying that "java.io.IOException: could not create audio stream from input stream" I tried testing it with many different types of wav, but still seems like doesn't want to work. package music; import sun.audio.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.*; import javax.swing.JButton; import javax.swing.JFrame; public class music { static AudioPlayer amp = AudioPlayer.player; static AudioStream strm; static AudioData adata; static ContinuousAudioDataStream loop = null; @SuppressWarnings("deprecation") public static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(200, 200); JButton button = new JButton("Test"); frame.add(button); button.addActionListener(new AL()); frame.show(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public static class AL implements ActionListener{ @Override public final void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub playmusic(); }} public static void playmusic() { try { strm = new AudioStream(new FileInputStream("C:\\Users\\smashed\\Desktop\\GameaudioTest\\omnidirectionalgunsound.wav")); adata = strm.getData(); loop = new ContinuousAudioDataStream(adata); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } amp.start(loop); } }
has comment: http://stackoverflow.com/comment/31747391
type: Question
has comment: http://stackoverflow.com/comment/31765820
has comment: http://stackoverflow.com/comment/31709150
has comment: http://stackoverflow.com/comment/31754821
tagged with: wav
has comment: http://stackoverflow.com/comment/31707291
score: 0

http://stackoverflow.com/comment/31655465
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/44980/discussion-between-net-user-and-girishlalwani2010)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21051985
type: AnswerComment

http://stackoverflow.com/q/21083589
has answer: http://stackoverflow.com/a/21083739
has answer: http://stackoverflow.com/a/21083694
tagged with: java
tagged with: methods
type: Question
has body: I'm supposed to create methods a-j, and then use them on an array list. I've created all them methods, and they should be working correctly, but whenever I try too use them, it gives me a cannot find symbol. I'm sure it's something obvious, but I'm just not seeing it. Any help would be greatly appreciated, thanks Here's the code: //Ian G //AList-Asg2: ArrayLists Bk Program import java.util.ArrayList; class Bell { private int studentId; public Bell( int id ) {studentId = id;} public int id() {return studentId;} public void setId(int newId) {studentId = newId;} public int compareTo( Bell otherBell ) {return this.studentId - otherBell.studentId;} public String toString() { return ""+studentId;} } class BellTester_Granger { public ArrayList&lt;Bell&gt; rayList; public static void main(String[] args) { ArrayList&lt;Bell&gt; rayList = new ArrayList&lt;Bell&gt;(); Bell student1 = new Bell((int)(Math.random() * 1000) + 216000); Bell student2 = new Bell((int)(Math.random() * 1000) + 216000); Bell student3 = new Bell((int)(Math.random() * 1000) + 216000); Bell student4 = new Bell((int)(Math.random() * 1000) + 216000); Bell student5 = new Bell((int)(Math.random() * 1000) + 216000); Bell student6 = new Bell((int)(Math.random() * 1000) + 216000); Bell student7 = new Bell((int)(Math.random() * 1000) + 216000); Bell student8 = new Bell((int)(Math.random() * 1000) + 216000); Bell student9 = new Bell((int)(Math.random() * 1000) + 216000); Bell student10 = new Bell((int)(Math.random() * 1000) + 216000); rayList.add(student1); rayList.add(student2); rayList.add(student3); rayList.add(student4); rayList.add(student5); rayList.add(student6); rayList.add(student7); rayList.add(student8); rayList.add(student9); rayList.add(student10); /** Here i'm trying to use one of the method's that i created, but it's giving me the error */ rayList.swapFL(); } //a public void swapFL() { int f= (rayList.get(0)).id(); int l= (rayList.get(rayList.size()-1)).id(); (rayList.get(0)).setId(l); (rayList.get(r…
has comment: http://stackoverflow.com/comment/31712589
tagged with: arraylist
score: 0
answer count: 4
has answer: http://stackoverflow.com/a/21083627
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21083610
has title: Array List won't use the methods I've created

http://stackoverflow.com/a/21105622
has body: I'm not sure if this will help any, as I am using annotations in this example, but here is a sample servlet that uploads a file and saves it to the file system: https://www.openshift.com/forums/openshift/how-to-upload-and-serve-files-using-java-servlets-on-openshift
answers question: http://stackoverflow.com/q/21105432
score: 0
has comment: http://stackoverflow.com/comment/31773154
type: Answer
has comment: http://stackoverflow.com/comment/31773832
has comment: http://stackoverflow.com/comment/31767893

http://stackoverflow.com/a/34908268
type: Answer
answers question: http://stackoverflow.com/q/21112703
score: 0
has body: Eclipse Juno running Tomcat 7 on Win7; kept getting the publish error on a javascript file. Tried renaming the file but that did not work. I deleted my existing Tomcat server, as recommended by Vikash Mudliar, and added a new server instance. That worked and I was able to publish successfully.

http://stackoverflow.com/a/21209113
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/21166352
has body: You can cast the private key to the correct implementing type, in this case RSAPrivateKey (and even RSAPrivateCrtKey) and then extract the individual BigInteger components and format them in any way you need. Example: KeyPair test = keyGen.genKeyPair(); RSAPrivateKey priv = (RSAPrivateKey) test.getPrivate(); System.out.println(priv.getModulus()); System.out.println(priv.getPrivateExponent());
answers question: http://stackoverflow.com/q/21166352
downvote count: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/31857000
type: QuestionComment
has text: You're looking for the "The Reflection API"... probably.
comment on: http://stackoverflow.com/q/21163397
score: 0
type: Comment

http://stackoverflow.com/q/21168709
tagged with: java
has comment: http://stackoverflow.com/comment/31869710
type: Question
tagged with: weblogic
has answer: http://stackoverflow.com/a/21171920
score: 0
has comment: http://stackoverflow.com/comment/31868401
has title: Weblogic Inserting Teradata PERIOD datatype
answer count: 1
tagged with: teradata
has body: I've been having issues inserting / updating a period column. According to a sample from the Teradata website located here, you should be able to create your own java.sql.Struct implmentation which you then provide as a parameter. I've done this, and once I actually hit the database, Weblogic throws an error stating my implementation of the Struct failed to be loaded (ClassNotFoundException) Do I have to I have to inject this into the Weblogic class loader somehow? Any help would be much appreciated!
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31867516

http://stackoverflow.com/a/21061426
type: Answer
has body: Using guava Multiset for counting final StringBuilder out = new StringBuilder(); final Multiset&lt;String&gt; count = HashMultiset.create(arrayList); // your arraylist for (final String key : count.elementSet()) { out.append(key).append('[').append(count.count(key)).append("],"); } // we need to remove a possible trailing comma System.out.println(out.length() &gt; 0 ? out.substring(0, out.length() - 1) : ""); output: lee[2],rebok[2]
answers question: http://stackoverflow.com/q/21061337
score: 0

http://stackoverflow.com/a/21114858
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/21109349
has body: If you want to measure code coverage you should use Jacoco. It allows measuring for unit tests and integration tests as well. All you have to do is to add dependecy: org.jacoco org.jacoco.core 0.6.2.201302030002 test and add jacoco-maven-plugin. Please note that if you won't use Sonar then you have to replace ${sonar.jacoco.reportPath} properties with raw file paths org.jacoco jacoco-maven-plugin 0.6.2.201302030002 prepare-unit-tests prepare-agent ${sonar.jacoco.reportPath} prepare-integration-tests prepare-agent pre-integration-test ${sonar.jacoco.itReportPath} itCoverageAgent If you want also to use sonar, then specify such properties: <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin> <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis> <sonar.jacoco.reportPath>${project.basedir}/target/jacoco-unit.exec</sonar.jacoco.reportPath> <sonar.jacoco.itReportPath>${project.basedir}/../target/jacoco-it.exec</sonar.jacoco.itReportPath> You can find more details on http://www.kubrynski.com/2013/03/measuring-overall-code-coverage-in.html

http://stackoverflow.com/q/21035508
has body: I am using CentOS and Postgresql as my database. According to this thread SQL Developer can now support Postgresql. So I manage to download the requirement such as SQL Developer 4.0 and Postgresql jdbc connector. Is there a step by step procedure how to install the jdbc connector to sql developer? I tried to follow the PostgreSQL documentation but with no luck. I tried to extract/install the jar file using java -jar postgresql-9.3_1100.jdbc41.jar the return is no main manifest attribute in postgresql-9.3_1100.jdbc41.jar my java version is: 1.7.0_45
linked to: http://stackoverflow.com/q/7592519
has title: How to install latest Postgresql JDBC jar in SQL Developer 4.0
has comment: http://stackoverflow.com/comment/31628232
tagged with: centos6
has answer: http://stackoverflow.com/a/21039648
answer count: 1
downvote count: 0
favorite count: 0
tagged with: oracle-sqldeveloper
accepted answer: http://stackoverflow.com/a/21039648
tagged with: postgresql-8.4
has comment: http://stackoverflow.com/comment/31623898
tagged with: jdbc
has comment: http://stackoverflow.com/comment/31627548
has comment: http://stackoverflow.com/comment/31628210
score: 1
tagged with: java
upvote count: 1
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31624655

http://stackoverflow.com/comment/42900980
type: Comment
score: 1
type: AnswerComment
has text: This won't change the window size. In fact, if the aspect ratio isn't the same (getWidth()/getHeight()), you'll just get a distorted viewport.
comment on: http://stackoverflow.com/a/21086071

class
tags question: http://stackoverflow.com/q/21147527
tags question: http://stackoverflow.com/q/21023486
tags question: http://stackoverflow.com/q/21104283
tags question: http://stackoverflow.com/q/21046591
tags question: http://stackoverflow.com/q/21021294
tags question: http://stackoverflow.com/q/21128209
tags question: http://stackoverflow.com/q/21151829
tags question: http://stackoverflow.com/q/21083045
tags question: http://stackoverflow.com/q/21121439
tags question: http://stackoverflow.com/q/21046206
tags question: http://stackoverflow.com/q/21050106
tags question: http://stackoverflow.com/q/21024810
tags question: http://stackoverflow.com/q/21153092
tags question: http://stackoverflow.com/q/21142109
tags question: http://stackoverflow.com/q/21027030
tags question: http://stackoverflow.com/q/21049930
tags question: http://stackoverflow.com/q/21062425
tags question: http://stackoverflow.com/q/21028434
tags question: http://stackoverflow.com/q/21067147
tags question: http://stackoverflow.com/q/21104380
tags question: http://stackoverflow.com/q/21122838
tags question: http://stackoverflow.com/q/21126248
tags question: http://stackoverflow.com/q/21129844
tags question: http://stackoverflow.com/q/21140264
tags question: http://stackoverflow.com/q/21086113
tags question: http://stackoverflow.com/q/21148860
tags question: http://stackoverflow.com/q/21052136
type: Tag
tags question: http://stackoverflow.com/q/21132681
tags question: http://stackoverflow.com/q/21163301
tags question: http://stackoverflow.com/q/21072691
tags question: http://stackoverflow.com/q/21147380
tags question: http://stackoverflow.com/q/21112770
tags question: http://stackoverflow.com/q/21176122
tags question: http://stackoverflow.com/q/21123675
tags question: http://stackoverflow.com/q/21126983
tags question: http://stackoverflow.com/q/21139539
tag name: class
tags question: http://stackoverflow.com/q/21126432
tags question: http://stackoverflow.com/q/21092532
tags question: http://stackoverflow.com/q/21066340
tags question: http://stackoverflow.com/q/21030861
tags question: http://stackoverflow.com/q/21122576
tags question: http://stackoverflow.com/q/21169958
tags question: http://stackoverflow.com/q/21032017
tags question: http://stackoverflow.com/q/21067337
tags question: http://stackoverflow.com/q/21059216
tags question: http://stackoverflow.com/q/21106744
tags question: http://stackoverflow.com/q/21124676
tags question: http://stackoverflow.com/q/21111565
tags question: http://stackoverflow.com/q/21071317

http://stackoverflow.com/a/21037502
upvote count: 2
answers question: http://stackoverflow.com/q/21037406
score: 0
downvote count: 2
type: Answer
has body: Any Static member can be accessed by Directly class name as TestClass1.a no need of instance for it System.out.println(TestClass1 .a); output: 10
has comment: http://stackoverflow.com/comment/31636885

http://stackoverflow.com/comment/31848146
has text: I have tried, i am getting this error now : ModelAndView [ModelAndView: materialized View is [null]; model is {error=true}] neither contains a view name nor a View object in servlet with name 'XXXXX'
type: AnswerComment
comment on: http://stackoverflow.com/a/21158007
score: 0
type: Comment

http://stackoverflow.com/q/21150568
downvote count: 0
has body: I have an Android client making HTTPS request to a server. The firewall logs have entries for CONNECT request methods which are not desired. When would the CONNECT request get sent out and how can I prevent it from being sent? I expect only a GET request. My understanding is that the call to openConnection() does not actually make a request and that the GET request would go on the call to getResponseMessage(). How can I disable the http client from attempting to establish a proxy tunnel? Here is how I sent up my connection and make the call: URL url = new URL("https://some.server.com"); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); connection.setConnectTimeout(CONNECT_TIMEOUT); connection.setReadTimeout(REAT_TIMEOUT); connection.setRequestProperty(ACCEPT_CHARSET, UTF8_CHARSET); connection.setRequestProperty(CONTENT_TYPE_HEADER, contentType); setCustomRequestProperties(connection); connection.setRequestMethod("GET"); //create response connection.getResponseMessage(); connection.getResponseCode(); connection.getContentType(); connection.getContent(); EDIT: Here is the Firewall Log entry that I am trying to prevent: CONNECT someURL.domain.com:443 HTTP/1.1 Host: someURL.domain.com User-Agent: CustomUserAgent;1.0.0(Android 4.3;Nexus 4;T-Mobile) Proxy-Connection: Keep-Alive X-SSL-Secure: true X-CS-Source-IP: 10.3.3.3 X-Forwarded-For: 10.3.3.3 I thought this was proxy related because of the "Proxy-Connection" header
tagged with: android
tagged with: httpurlconnection
accepted answer: http://stackoverflow.com/a/21294604
possible better answer: http://stackoverflow.com/a/21151690
favorite count: 0
has title: How to prevent CONNECT method call from HttpsURLConnection
has answer: http://stackoverflow.com/a/21151690
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/21294604
answer count: 2

http://stackoverflow.com/q/21092007
has body: message = new String(("round " + id).getBytes("UTF-8")); conn = DriverManager.getConnection("jdbc:mysql://" + host + "/" + db + "?useUnicode=true&amp;characterEncoding=UTF-8&amp;" + "user=" + login + "&amp;password=" + password); When I make an insert into the database which encoding is UTF-8 CI, get something like this �������������������� 179, the java file encoding is utf-8, what I'am doing wrong? +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+
score: 4
has answer: http://stackoverflow.com/a/21092384
tagged with: java
tagged with: mysql
type: Question
tagged with: character-encoding
upvote count: 4
has title: Why java strings are not saved as UTF-8 in MYSQL?
answer count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21092100

http://stackoverflow.com/comment/31810229
has text: @Voo But my point is, JMM's rules apply *everywhere* and without those precise rules, the JIT compiler would never have the entitlement to hoist a static variable load out of the loop. So it's actually the reverse: precisely *due* to JMM's rules is this optimization granted. I know you and I understand that; I am writing this for the greater public reading the discussion.
type: Comment
comment on: http://stackoverflow.com/a/21135976
score: 2
type: AnswerComment

http://stackoverflow.com/a/21105545
has comment: http://stackoverflow.com/comment/31752867
has comment: http://stackoverflow.com/comment/31753058
downvote count: 0
has comment: http://stackoverflow.com/comment/31752965
has comment: http://stackoverflow.com/comment/31752892
has comment: http://stackoverflow.com/comment/31753135
has comment: http://stackoverflow.com/comment/31752847
has comment: http://stackoverflow.com/comment/31752898
accepted answer of: http://stackoverflow.com/q/21105449
score: 4
answers question: http://stackoverflow.com/q/21105449
has comment: http://stackoverflow.com/comment/31752979
has comment: http://stackoverflow.com/comment/31752820
has comment: http://stackoverflow.com/comment/31752829
type: AcceptedAnswer
has body: That value is known as the exit status The exit status or return code of a process in computer programming is a small number passed from a child process (or callee) to a parent process (or caller) when it has finished executing a specific procedure or delegated task. Here's a little Java test to demonstrate it import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; public class Foo { public static void main(String[] args) throws Exception { if (args.length != 0) System.exit(Integer.parseInt(args[0])); ProcessBuilder builder = new ProcessBuilder(Arrays.asList("java", "Foo", "42")); Process process = builder.start(); System.out.println(process .waitFor()); } } compile and run this program without any arguments. It will print 42 This java program starts a child process. When that process ends, it returns the value that was passed to it in System.exit(?) to its parent process which it then prints out.
has comment: http://stackoverflow.com/comment/31753065
has comment: http://stackoverflow.com/comment/31753028
type: Answer
upvote count: 4

http://stackoverflow.com/q/21093218
has body: I have an internal webservice that allows calls only from particular AppEngine application. I'm extracting AppId from User-Agent string however it looks like when I add it multiple times only one will be fixed by Google. Is there a better way to recognize Appengine application? My WS is hosted in my network, not at Google.
type: UnansweredQuestion
has title: Appengine spoof User-Agent string
has answer: http://stackoverflow.com/a/21095906
tagged with: urlfetch
tagged with: java
type: Question
score: 0
answer count: 1
tagged with: google-app-engine

http://stackoverflow.com/comment/31721787
type: QuestionComment
has text: @lakshman is there another way to log crashes without having to add a try and catch check on everything that might crash?
comment on: http://stackoverflow.com/q/21089278
score: 0
type: Comment

http://stackoverflow.com/comment/31885573
score: 0
comment on: http://stackoverflow.com/q/21178802
type: Comment
type: QuestionComment
has text: Just figured that display.addListener(SWT.Close,new Listener() { @Override public void handleEvent(Event event) {} }); works !

http://stackoverflow.com/a/21136552
answers question: http://stackoverflow.com/q/21136402
score: 5
has comment: http://stackoverflow.com/comment/31808493
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/31808717
has comment: http://stackoverflow.com/comment/31808583
has comment: http://stackoverflow.com/comment/31808162
has body: You can move FileInputStream position with FileInputStream.getChannel.position(long). Skip is for streams, it is different from positioning, you cannot go back with it, it's for random access devices (HDD)
upvote count: 5

http://stackoverflow.com/comment/31613249
comment on: http://stackoverflow.com/q/21029751
type: Comment
type: QuestionComment
has text: Why exactly you want to do this with method chaining?
score: 0

http://stackoverflow.com/comment/31637471
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21043753
has text: Not size of objects, no. Just number of objects and number of references

http://stackoverflow.com/comment/31861961
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/21165595
type: Comment
has text: They are the same ...

http://stackoverflow.com/a/21125756
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/31891527
downvote count: 0
answers question: http://stackoverflow.com/q/21118444
accepted answer of: http://stackoverflow.com/q/21118444
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31883683
score: 1
has comment: http://stackoverflow.com/comment/32431131
has body: Although I'd generally recommend to construct XPath expressions on your own (as you can better exploit things to mach against like class attributes), probably the most reasonable and convenient automatic way to determine XPath expressions for selenium is to use either Firebug's or Chrome Developer Tool's "Find XPath" feature. They both at least use @id attributes to shorten XPath expressions. If you want to write some code yourself, eg. for embedding in other tools you use, you might want to have a look at the answers of "PHP XML - Find out the path to a known value" which solves the problem in PHP, or another one with answers for Javascript: "Javascript get XPath of a node". If you're using any tools not working on the DOM (Selenium/Firebug/Chrome Dev' Tools/JavaScript will do), watch out for the problems I described in "Why does my XPath query (scraping HTML tables) only work in Firebug, but not the application I&#39;m developing?".

http://stackoverflow.com/comment/31841484
comment on: http://stackoverflow.com/a/21127640
score: 0
type: AnswerComment
has text: After using the 2.0.0 release version the JSON error is resolved. However I get a “java.lang.IllegalStateException: Result not yet available, please finish the transaction first.” when I try to use nested transaction like below .. `try ( Transaction tx1 = db.beginTx(); ) //… some work try ( Transaction tx2 = db.beginTx(); ) { result = engine.query(query, null); tx2.success(); } for(Map<String, Object> row :result) { //exception is thrown here retNode = (Node)row.get(columnName); } //.. some work tx1.success(); }` This works fine with embedded,just not rest
type: Comment

http://stackoverflow.com/q/21168276
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/21168482
accepted answer: http://stackoverflow.com/a/21168482
tagged with: java
score: -1
type: Question
answer count: 2
downvote count: 1
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/31866279
has comment: http://stackoverflow.com/comment/31866249
has body: Can somebody tell me the changes should be made in String class API (we can't do that I know) so that following program should print "Earth" ? OR How can we stop printing "Sun" ? How to stop hacking ? public class StringAPI { public static void main(String[] args) throws IllegalAccessException, NoSuchFieldException { Field value = String.class.getDeclaredField("value"); value.setAccessible(true); value.set("Earth", "Sun".toCharArray()); System.out.println("Earth"); // prints "Sun" } }
tagged with: immutability
upvote count: 0
possible better answer: http://stackoverflow.com/a/21168502
tagged with: reflection
has answer: http://stackoverflow.com/a/21168502
linked to: http://stackoverflow.com/q/14639753
has title: How to protect string from hacking
has comment: http://stackoverflow.com/comment/31866242

http://stackoverflow.com/a/21133764
accepted answer of: http://stackoverflow.com/q/21133581
upvote count: 8
type: Answer
score: 8
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/21133581
has body: It should be relatively easy to do some naive checking to separate a JPEG from a PNG. According to Wikipedia, JPEG files always start with FF D8. PNGs however seem to start with 89 50, so one can easily distinguish between the two from just reading a byte or two from the file. I would recommend looking up the file formats of the most important image types just to make sure there isn't some other mainstream one starting with FF D8. It seems unlikely however. Edit: JPEG, PNG, GIF, BMP and TIFF all seem to have magic values at the start of the files to tell them apart form other types.
has comment: http://stackoverflow.com/comment/31803791

http://stackoverflow.com/q/21028507
upvote count: 12
has answer: http://stackoverflow.com/a/21035495
downvote count: 0
has comment: http://stackoverflow.com/comment/53123508
has title: libGDX project can't load library liblwjgl.dylib
favorite count: 0
has comment: http://stackoverflow.com/comment/34559260
tagged with: macos
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23457345
type: Question
tagged with: libgdx
tagged with: java
score: 12
has comment: http://stackoverflow.com/comment/31619613
has body: A new libGDX project can't load the library liblwjgl.dylib when running the desktop project. Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /var/folders/4l/nsj9j4xj51g8h_6y_ndpnmc80000gn/T/libgdxChristian/3741154320/liblwjgl.dylib at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1798) at java.lang.Runtime.load0(Runtime.java:809) at java.lang.System.load(System.java:1080) at org.lwjgl.Sys$1.run(Sys.java:70) at java.security.AccessController.doPrivileged(Native Method) at org.lwjgl.Sys.doLoadLibrary(Sys.java:66) at org.lwjgl.Sys.loadLibrary(Sys.java:95) at org.lwjgl.Sys.&lt;clinit&gt;(Sys.java:112) at org.lwjgl.openal.AL.&lt;clinit&gt;(AL.java:59) at com.badlogic.gdx.backends.openal.OpenALAudio.&lt;init&gt;(OpenALAudio.java:70) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.&lt;init&gt;(LwjglApplication.java:80) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.&lt;init&gt;(LwjglApplication.java:64) at com.foxhat.test.Main.main(Main.java:14) Update: I'm running Java 1.8 on OSX 10.9. The same error appears not only with an own project, but also with foreign JARs built with libGDX. The folder mentioned in the error, where liblwjgl.dylib is searched, contains: liblwjgl.jnilib openal.dylib Renaming liblwjgl.jnilib to .dylib does work for the foreign application, but not for my own.
answer count: 2

http://stackoverflow.com/q/21113777
tagged with: jface
has title: Eclipse : DialogCellEditor class.. how to always show the button?
tagged with: java
tagged with: swt
type: Question
has comment: http://stackoverflow.com/comment/31766833
linked to: http://stackoverflow.com/q/14464611
tagged with: eclipse
has answer: http://stackoverflow.com/a/21114002
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/21113941
duplicate of: http://stackoverflow.com/q/14464611
type: UnansweredQuestion
has body: I'm extending DialogCellEditor to make a cell in a table looks like this but the button appears only when I set focus to that cell (ie. when I click on the cell) How could I always show this button even before setting focus ?

http://stackoverflow.com/comment/31687390
type: Comment
type: QuestionComment
has text: I've removed my comment as it was probably a bit ambiguous. I'm not really sure if your design is very ... clever or good. Why should `getMainPage()` return an `AbstractLayout` - furthermore as it is not linked to a page in any way (in your design)? Does the `MainPage` serve any real purpose (includes methods?). If you don't restrict the generics to a type you can fill in any class - so `UI<T>` and defining `public T getMainPage()` will therefore return any type you specify with a concrete class.
comment on: http://stackoverflow.com/q/21070048
score: 0

http://stackoverflow.com/comment/53501320
type: Comment
has text: @user2953113 I believe there will be two transactions, yes. But there might only be one `Session`.
comment on: http://stackoverflow.com/a/21067380
score: 1
type: AnswerComment

http://stackoverflow.com/a/21088150
downvote count: 0
has comment: http://stackoverflow.com/comment/36022000
score: 3
has comment: http://stackoverflow.com/comment/31719992
upvote count: 3
has comment: http://stackoverflow.com/comment/31802626
has comment: http://stackoverflow.com/comment/67963156
has body: Jboss 7 (AS) has support to either periodic-rotating-file-handler or size-rotating-file-handler but not both. I get some reference(JBoss 7 Custom File Handler) to support periodic and size rotating. It is writing the Custom File Handler. JBoss 7 Custom File Handler is used to create daily rotating size limited log. But, I update the source some part of original PeriodicSizeHandler.java for my requirement. My updated source : PeriodicSizeHandler.java import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.text.SimpleDateFormat; import java.util.Date; import java.util.logging.ErrorManager; import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.LogRecord; public class PeriodicSizeHandler extends Handler { private int count = 1; protected static Long calculatedBytes; private String maxBytes = "2g"; private String logFileName = "server.log"; private static String logDirPath; private File logFile; private FileOutputStream outputStream; static { logDirPath = System.getenv("JBOSS_HOME") + "\\standalone\\log"; } public enum Bytes { Byte("b", 1l), KiloBytes("k", (Byte.bytes * 1024)), MegaBytes("m", (KiloBytes.bytes * 1024)), GigaBytes("g", (MegaBytes.bytes * 1024)), ; private Bytes(String byteAcronym, Long bytes) { this.byteAcronym = byteAcronym; this.bytes = bytes; } private String byteAcronym; private Long bytes; public static long getBytes(String maxBytesRep) throws Exception { if (maxBytesRep == null && "".equals(maxBytesRep)) { throw new Exception( "The max bytes representation cannot be empty or null"); } String uByteRepresentation = maxBytesRep.toLowerCase(); for (Bytes b : values()) { if (uByteRepresentation.endsWith(b.byteAcronym)) { String strNumVal = uByteRepresentation.substring(0, uByteRepresentation.indexOf(b.byteAcronym)); try { return …
type: Answer
answers question: http://stackoverflow.com/q/21083960

http://stackoverflow.com/comment/32592798
score: 0
comment on: http://stackoverflow.com/a/21576753
has text: This is nice. Can you call a `@CompileStatic` method from a data table in spock? (http://docs.spockframework.org/en/latest/data_driven_testing.html#data-tables) ? This is what I'd be satisfied with!
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/31934715
comment on: http://stackoverflow.com/a/21176303
score: 0
type: Comment
type: AnswerComment
has text: I added the function from the C++ code. I'm surprised it did not make it into the Java code base...it is something of a fundamental operation...

http://stackoverflow.com/comment/139328087
has text: Remember when stubbing `mockedStatic.when(() -> StaticClass.methodTakesClassArg(any(Class.class))).thenReturn(myValue);` that `any(Class.class)` will not match if the class argument is ever `null` during your test. You'll need to assure that `null` is not passed to the static interceptor in that case.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/62860455
score: 1

http://stackoverflow.com/comment/31890463
score: 0
comment on: http://stackoverflow.com/q/21181614
type: Comment
type: QuestionComment
has text: The only thing you store there is `editor.putString("log", "log")`.

http://stackoverflow.com/a/21054805
answers question: http://stackoverflow.com/q/21054524
score: 0
has comment: http://stackoverflow.com/comment/31658876
type: Answer
has body: to add to what have been said about Splitter, you can do something of this sort: String str = "john - &amp; + $ ? . @ boy"; Iterable&lt;String&gt; ttt = Splitter.on(Pattern.compile("\\W")).trimResults().omitEmptyStrings().split(str);

http://stackoverflow.com/q/21162832
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/21162951
tagged with: tomcat
tagged with: android
has body: This project located here was completed with SSL. Now I need to do to this without SSL. I want to design it for a desktop (html5, websocket). Currently I am getting this error type : http://www.guj.com.br/java/261352-reconfigurar-ssl-default-java in the android app... Before this error explain that this type took two lines: httpsurlconnection.setSSLSocketFactory(GarageSSLSocketFactory.getSSLSocketFactory(application)); and I had this error: "Javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x74f61128: Failure in SSL library, usually a protocol erro erro:140770FCSSL routines:SS23_GET_SERVER_HELLO:unknown protocol(external/openssl/ssl/s23_clnt.c:7660x7449ad5c:0x0000000)" Now I'm getting the error: can not be cast to com.android.okhttp.internal.http.HttpURLConnectionImpl javax.net.ssl.HttpsURLConnection What should I do?
type: AnsweredQuestion
tagged with: java
tagged with: ssl
accepted answer: http://stackoverflow.com/a/21162951
has title: Remove SSL certificate from a project with tomcat 7
type: Question

http://stackoverflow.com/q/21141120
tagged with: load
favorite count: 0
tagged with: snakeyaml
linked to: http://stackoverflow.com/q/61312690
tagged with: opencv
type: AnsweredQuestion
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/21159813
upvote count: 7
has title: Load .yml file into hashmaps using snakeyaml (import junit library)
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/21157954
has answer: http://stackoverflow.com/a/21157954
downvote count: 0
has body: I am trying to load opencv's .yml file into arrayLists mean, projection and labels. I ve create those three arraylists and I am trying to parse into them the elements from the .yml file. I ve found snakeYAML documentation . However I didnt find a way to do so properly. I am trying to use final String fileName = "train.yml"; opencvmatrix mat = new opencvmatrix(); Yaml yaml = new Yaml(); try { InputStream ios = new FileInputStream(new File(fileName)); // Parse the YAML file and return the output as a series of Maps and Lists Map&lt;String,Object&gt; result = (Map&lt;String,Object&gt;)yaml.load(ios); System.out.println(result.toString()); Collection&lt;Object&gt; file = result.values(); } catch (Exception e) { e.printStackTrace(); } } I am receiving as an error the following: Exception in thread "main" while scanning a directive in 'reader', line 1, column 1: %YAML:1.0 ^ expected alphabetic or numeric character, but found :(58) in 'reader', line 1, column 6: %YAML:1.0 ^ at org.yaml.snakeyaml.scanner.ScannerImpl.scanDirectiveName(ScannerImpl.java:1269) at org.yaml.snakeyaml.scanner.ScannerImpl.scanDirective(ScannerImpl.java:1221) at org.yaml.snakeyaml.scanner.ScannerImpl.fetchDirective(ScannerImpl.java:614) at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:306) at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:226) at org.yaml.snakeyaml.parser.ParserImpl$ParseImplicitDocumentStart.produce(ParserImpl.java:195) at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158) at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:143) at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:104) at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:120) at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:481) at org.yaml.snakeyaml.Yaml.load(Yaml.java:412) at projectCV.main(projectCV.java:33) Java Result: 1 EDIT1: I ve noticed that my problems stands for assertEquals whi…
accepted answer: http://stackoverflow.com/a/21159813
tagged with: junit

http://stackoverflow.com/a/21034297
type: Answer
has body: You are getting lots of nulls as the pixels at these positions are the same. In your check() method, when the pixels are the same you do not add anything to the array at that position - so it remains null. Add a place holding character at these points like - or something. Your print method is printing each element on a line also, it would be more readable if you printed the 2D array like a matrix. You can do this by modifying your method to this for (int i = 0; i &lt; inn.length; i++) { for(int j = 0; j &lt; inn[i].length; j++) { System.out.print(inn[i][j] + " "); } System.out.println(); } Another helpfull method you might be interested in is Arrays.deepToString(Array), but this creates a single string and would require manipulation to print on multiple lines would be easier to do the following for(String[] arr : inn) System.out.println(Arrays.toString(arr)); You get the error when trying to add the arrays as you simply cannot do that - add two arrays together without looping the contents. You will need a loop similar to above char1 = hexRGB.getCheck_hex2(); char2 = hexRGB.getCheck_hex4(); //assuming char1 and char2 are the same size and symmetrical String[][] combine = new String[char1.length][char1[0].length] for (int i = 0; i &lt; char1.length; i++) { for(int j = 0; j &lt; char1[i].length; j++) { // This will only concatenate the strings though, // If you want the numerical addition you will have to // convert them to ints first combine[i][j] = char1[i][j] + char2[i][j]; } }
has comment: http://stackoverflow.com/comment/31629626
accepted answer of: http://stackoverflow.com/q/21033926
answers question: http://stackoverflow.com/q/21033926
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/31731091
has text: Is there a reason why you can't use a program like [awk](http://en.wikipedia.org/wiki/AWK) for parsing output? If you need to do something with it in Java, you can still use awk to find the information before passing it to your program.
type: Comment
comment on: http://stackoverflow.com/q/21094375
score: 0
type: QuestionComment

http://stackoverflow.com/comment/31745248
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21101407
has text: Recommended reading: http://www.amazon.com/Java-Concurrency-Practice-Brian-Goetz/dp/0321349601/

http://stackoverflow.com/comment/32060878
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21269278
has text: Great you got it. Unfortunately you had not posted that part of the code to begin with, otherwise the issue might have been identified earlier. That been said, you should also work on the minor issues identified in the comments above (signing-time attribute conflicting with **ETSI.CAdES.detached**, duplicate certificate entries...).

http://stackoverflow.com/q/21049375
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
has comment: http://stackoverflow.com/comment/31647893
type: Question
tagged with: database
downvote count: 0
has title: What if EntityManager is not closed due to Exception?
has comment: http://stackoverflow.com/comment/31648773
tagged with: entitymanager
has comment: http://stackoverflow.com/comment/31647873
favorite count: 0
has body: What happens if an EntityManager in a JavaSE app optained through EntityManagerFactory is not closed, eg due to any Exception that terminate the method before em.close() is reached? Will em be closed automatically after a timeout?
type: UnansweredQuestion
answer count: 0

http://stackoverflow.com/comment/31697049
has text: I suspect that `"convert -crop 312x312+0-10 image1.jpg new_image1.jpg"` should be separated parameters. Also it seems that directory should not be part of command. Maybe add it later using `pb.directory(new File("put path here"))`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21075853

http://stackoverflow.com/comment/73071269
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/39026744
type: Comment
has text: Ugh. I just realized that your link points to an article written by Gwen, who _also_ works for Confluent. So we seem to have an odd disagreement here. I'll post on the kafka-users mailing list and see what's going on. I'll update this thread with my findings.

http://stackoverflow.com/q/21101407
has answer: http://stackoverflow.com/a/21101428
tagged with: java
possible better answer: http://stackoverflow.com/a/21101480
tagged with: concurrency
has comment: http://stackoverflow.com/comment/31745248
has title: Thread pool not accepting new tasks
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/21101428
favorite count: 0
type: AnsweredQuestion
upvote count: 2
tagged with: multithreading
downvote count: 2
has answer: http://stackoverflow.com/a/21101480
has body: I feel like my java concurrency knowledge is getting rusty, I am trying to figure out why the thread pool doesn't accept more tasks in the following code: ExecutorService e = Executors.newFixedThreadPool(aNumber); // Task 1 for (int i=0; i&lt;n; i++) e.submit(new aRunnable()); while (!e.isTerminated()); System.out.println("Task 1 done"); // Task 2 for (int i=0; i&lt;n; i++) e.submit(new anotherRunnable()); while (!e.isTerminated()); System.out.println("Task 2 done"); It never gets to start Task 2, the thread "freezes" when the last task from Task 1 one is run like if it was waiting for something else to finish. What's wrong?
type: Question

http://stackoverflow.com/a/21132017
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/21131836
has body: If a is true, then run code. If b is true, then run code. If both a and b is true, then do NOT run code. This isn't NAND - this is XOR, and ^ is the XOR operator // When one operand is true and the other is false, exclusive-OR // returns True. Console.WriteLine(true ^ false); // When both operands are false, exclusive-OR returns False. Console.WriteLine(false ^ false); // When both operands are true, exclusive-OR returns False. Console.WriteLine(true ^ true);
type: Answer

http://stackoverflow.com/comment/55506393
type: Comment
score: 1
has text: problem is Uppercase Lowercase output string, when using a case-insensitive filesystem
comment on: http://stackoverflow.com/a/21103563
type: AnswerComment

http://stackoverflow.com/a/21130238
has body: If you using csvreader you can use this line.get("field3"); http://javacsv.sourceforge.net/com/csvreader/CsvReader.html#get(java.lang.String) http://javacsv.sourceforge.net
downvote count: 0
answers question: http://stackoverflow.com/q/21130213
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/a/21138652
upvote count: 2
has body: What's your primary keyboard layout. Make sure it's English and not Russian. Try adding -Dide.non.english.keyboard.layout.fix=true into your idea.properties file. Actual ticket for further reference: http://youtrack.jetbrains.com/issue/IDEA-80613
has comment: http://stackoverflow.com/comment/132048731
answers question: http://stackoverflow.com/q/21135661
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/21135661
score: 2

http://stackoverflow.com/comment/40941054
type: Comment
has text: Could you please see and help? https://stackoverflow.com/questions/26122306/call-java-class-from-extjs-ajax-call
type: QuestionComment
comment on: http://stackoverflow.com/q/21083926
score: 0

http://stackoverflow.com/comment/73349871
type: Comment
comment on: http://stackoverflow.com/a/41259084
has text: I directly imported certs I needed into the JRE/lib/security/cacerts using keytool, but it changed nothing for me :( still getting the same error, I also added them via the IDE, or even into the classpath and added a Bean to specify the keystore location !! It's crazy AF !
type: AnswerComment
score: 0

http://stackoverflow.com/a/21274837
score: 2
has body: we need to use <entry key="java.util.Locale" value="org.test.beans.LocalePropertyEditor"/> The Spring will take care itself the instantiation of bean.
downvote count: 0
answers question: http://stackoverflow.com/q/21086491
upvote count: 2
accepted answer of: http://stackoverflow.com/q/21086491
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/21124833
has comment: http://stackoverflow.com/comment/31818362
has comment: http://stackoverflow.com/comment/31788264
answers question: http://stackoverflow.com/q/21124475
has comment: http://stackoverflow.com/comment/31789832
upvote count: 1
has comment: http://stackoverflow.com/comment/31820052
has comment: http://stackoverflow.com/comment/31789103
has comment: http://stackoverflow.com/comment/31788383
has comment: http://stackoverflow.com/comment/31820444
score: 1
has comment: http://stackoverflow.com/comment/31788570
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/31788420
has comment: http://stackoverflow.com/comment/31818191
has comment: http://stackoverflow.com/comment/31788689
type: Answer
has body: One problem with your code is your specified Algorithms for Cipher and SecretKeySpec instances are not the same. You are mixing 2 different algorithms up. As in the reference example, keep it same for both the instances: Incorrect lines: SecretKeySpec KS = new SecretKeySpec(KeyData, "Blowfish"); Cipher cipher = Cipher.getInstance("AES"); You can consider reading AES vs Blowfish here. EDIT: As indicated, strictly AES would be used throughout the solution. Hence, the key which you are setting isn't a valid AES key - AES keys are 128, 192 or 256 bits (as evident from your exception as well). That would mean your current key should be of 16, 24 or 32 bytes (though testkey is 7). Consider the following: Follow the reference and change the algorithm to Blowfish which would accept your key Try changing your key to a 16 byte (example: ThisSecurityKey1). There can be considerations of your character encoding (UTF-8, UTF-16) but since you're using plain text, it should work. Lookup KeyGenerator class, useful to generate symmetric keys. This class provides the functionality of a secret (symmetric) key generator. Also, try and refer to a better encryption example of AES - the reference you've selected is full of non-compliant Java coding standards.
accepted answer of: http://stackoverflow.com/q/21124475

http://stackoverflow.com/a/21177852
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21177788
type: Answer
has body: Just don't init your array via new T[] {}. String[][][] ns = new String[10][3][3]; for (int i = 0; i &lt; ns.length; i++) { for (int j = 0; j &lt; ns[i].length; j++) { for (int k = 0; k &lt; ns[i][j].length; k++) { ns[i][j][k] = ""; } } } ns[0][0][0] = "52"; ns[0][0][1] = "14"; ns[0][1][0] = "90"; ns[0][1][1] = "34"; ns[0][3][0] = "89"; ns[0][4][0] = "67"; ns[0][4][1] = "78";
answers question: http://stackoverflow.com/q/21177788

http://stackoverflow.com/comment/31796318
has text: This would be simpler if you apply a loop rather than using recursion...
score: 1
comment on: http://stackoverflow.com/q/21129687
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/31752252
comment on: http://stackoverflow.com/q/21104756
type: Comment
has text: @user3183582 Run the program again and see what the log says for the exception. That is why you usually want to take some action when you catch an exception (display a message, initialize a variable maybe, something).
score: 0
type: QuestionComment

http://stackoverflow.com/a/21176891
score: 0
has body: It can be done. but, with pointer indirection. Lets say you have a class someClass class someClass { someClass *someClsPtr; public: someClass(someClass *someClsPtrTemp):someClsPtr(someClsPtrTemp) { } someClass* operator=(someClass *someClsPtrTemp) { this-&gt;someClsPtr = someClsPtrTemp-&gt;someClsPtr; return this; } //now over load operator -&gt; and operator *. Thats it. };
type: Answer
answers question: http://stackoverflow.com/q/21176103

http://stackoverflow.com/comment/31684817
type: Comment
type: QuestionComment
has text: Feel free to show how.
comment on: http://stackoverflow.com/q/21068902
score: 0

http://stackoverflow.com/a/21114485
type: AcceptedAnswer
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/21114335
has body: This should work for you: getValueAsString() Return the value tracked by this form item. So the code would be: String name = firstName.getValueAsString();
answers question: http://stackoverflow.com/q/21114335

http://stackoverflow.com/q/21089161
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/31722526
has comment: http://stackoverflow.com/comment/31723271
type: Question
has comment: http://stackoverflow.com/comment/31721845
has body: I am bit more concern of OOM on having a heavy UI on each item of a listview, example I have 100 items. Below is the image that I wanted to practice and copy the UI layout. What would be the possible layout or how can I implement this type of UI. Each items are scrollable until the bottom, with separate contents but same layout. Please see my update below. Update: I am planning to use card ListVIew, please guide me.
has comment: http://stackoverflow.com/comment/31721966
has answer: http://stackoverflow.com/a/21089419
score: 0
answer count: 2
tagged with: user-interface
favorite count: 0
has answer: http://stackoverflow.com/a/21090089
has comment: http://stackoverflow.com/comment/31721487
tagged with: out-of-memory
tagged with: android-listview
type: UnansweredQuestion
tagged with: android
has title: Adding Heavy UI in in each ListView Item
has comment: http://stackoverflow.com/comment/31721723
has comment: http://stackoverflow.com/comment/31722679
upvote count: 2

http://stackoverflow.com/comment/31602612
comment on: http://stackoverflow.com/a/21023980
type: AnswerComment
has text: Yeah, the interviewer was probably dumb. Asking him to reverse a `java.lang.String` without using anything af the API. Well, that is just bullshit. Even reflection is part of the API.
score: 0
type: Comment

http://stackoverflow.com/comment/31972647
type: Comment
comment on: http://stackoverflow.com/a/21178275
has text: Thanks bro, I have also readed your blog.
type: AnswerComment
score: 0

http://stackoverflow.com/q/21090664
favorite count: 0
linked to: http://stackoverflow.com/q/39131955
type: UnansweredQuestion
has body: While starting the application through maven in eclipse it creating java.exe (application) and also javaw.exe. on clicking terminate button in console only javaw.exe is getting stopped, but java.exe (i.e actual application) is not getting stopped. so each time I have to kill that process manually in task manager. Is there any better way to stop the application completely ?? Thanks in advance..
has comment: http://stackoverflow.com/comment/31795416
tagged with: maven
upvote count: 1
has comment: http://stackoverflow.com/comment/74209622
score: 1
tagged with: java
tagged with: m2e
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/31724938
has comment: http://stackoverflow.com/comment/31724203
has comment: http://stackoverflow.com/comment/70886882
downvote count: 0
has comment: http://stackoverflow.com/comment/31795306
has answer: http://stackoverflow.com/a/76552274
answer count: 1
has title: How to stop the application for maven projects in eclipse - m2e

http://stackoverflow.com/comment/31784193
score: 3
has text: Work through [Java `Swing` tutorial](http://docs.oracle.com/javase/tutorial/uiswing/start/index.html) first.
comment on: http://stackoverflow.com/q/21122990
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/31799167
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21131124
type: AnswerComment
has text: Ah so we were thinking the same thing! I think an answer should provide information about the grouping, though.

http://stackoverflow.com/comment/31807982
comment on: http://stackoverflow.com/q/21136402
score: 1
has text: InputStream does not have seek()
type: QuestionComment
type: Comment

http://stackoverflow.com/q/21052051
favorite count: 0
tagged with: linux
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31653830
has title: install 32bit Java JDK on CentOS 6.5 32bit
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/21052151
score: 1
tagged with: java
tagged with: hadoop
tagged with: centos6
has body: I am trying to wget to install 32bit JDK on 32bit CentOS 6.5. CentOS is running on a vmware player VM inside Windows. Next step is to set the System Environment Variables. I am building a small Hadoop cluster on CentOS VMs for testing purposes. When I type wget http://download.oracle.com/otn-pub/java/jdk/6u25-b06/jdk-6u25-linux-i586-rpm.bin into my CentOS 6.5 Terminal, I get the following error: ERROR: certificate common name “www.oracle.com” doesn’t match requested host name “edelivery.oracle.com”. To connect to edelivery.oracle.com insecurely, use ‘--no-check-certificate’. How do I install JDK via CentOS Terminal? Thanks.
answer count: 1
downvote count: 0

http://stackoverflow.com/a/21114609
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/21114144
accepted answer of: http://stackoverflow.com/q/21114144
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: This isn't possible. The API for Process and ProcessBuilder don't allow you to create Process instances for existing processes; you can always only create new child processes with them.

http://stackoverflow.com/q/21026486
answer count: 1
tagged with: jackson
favorite count: 0
has comment: http://stackoverflow.com/comment/31606914
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21026780
downvote count: 0
score: 1
has title: Json manipulation on top of Jackson
has comment: http://stackoverflow.com/comment/31618722
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: Jackson is great for translating between POJO and json strings. But it's a pain to use it for manipulating a json string. I find myself doing stuff like: ObjectMapper mapper = new ObjectMapper(); JsonNode node = mapper.readTree(ReadFile("testObj.json")); ((ObjectNode)node).put("testField", "newTestValue"); TestObject obj = mapper.readValue(mapper.writeValueAsString(node), TestObject.class); And this is the simple example. It gets more complicated if you want to add a new object or an array of things. Is there a better way to do this?
upvote count: 1

http://stackoverflow.com/q/21139954
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/21141030
answer count: 1
has body: I am trying to set up a appengine backend. I configured a backend in the "backends.xml" like that: <?xml version="1.0" encoding="utf-8"?> B1 I can see this backend in my backend like that: But if I click on it, the url http://order-backend.myapp.appspot.com returns a 500 Error. I thougt I maybe need to call a servlet with the backend instance so I tried with a servlet, which is running under "test" like that: http://order-backend.myapp.appspot.com/test Whats am I doing wrong here?
score: 0
type: UnansweredQuestion
tagged with: google-app-engine
has title: Appengine backends -> 500 Error
tagged with: java

http://stackoverflow.com/a/21099021
has comment: http://stackoverflow.com/comment/31743045
has body: One of the biggest benefits of interfaces is that you can use the interface in the method arguments and return type. For example, you can write: public List join (List list1, List list2) { // some complicated stuff using list1.size() and list2.get() etc }
answers question: http://stackoverflow.com/q/21098901
score: 0
type: Answer

http://stackoverflow.com/a/63464317
upvote count: 2
score: 1
downvote count: 1
answers question: http://stackoverflow.com/q/21163108
has body: Here is how I set the max thread count flag mentioned above programatically and a code sniped to verify that the parameter is honored System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism", "2"); Set<String> threadNames = Stream.iterate(0, n -> n + 1) .parallel() .limit(100000) .map(i -> Thread.currentThread().getName()) .collect(Collectors.toSet()); System.out.println(threadNames); // Output -> [ForkJoinPool.commonPool-worker-1, Test worker, ForkJoinPool.commonPool-worker-3]
type: Answer

http://stackoverflow.com/q/21133124
type: Question
accepted answer: http://stackoverflow.com/a/21133215
duplicate of: http://stackoverflow.com/q/902922
has comment: http://stackoverflow.com/comment/31802231
has answer: http://stackoverflow.com/a/21133272
tagged with: access-modifiers
has comment: http://stackoverflow.com/comment/31802133
has title: Which Java access modifier allows a member to be accessed only by the subclasses in other package?
linked to: http://stackoverflow.com/q/215497
has body: I had to shorten the title a bit. Here's the full question: In Java which access modifier allows a member to be accessed only by the subclasses in other package or any class within the package of that member's class? I am thinking protected but my office mate says the answer is private.
has answer: http://stackoverflow.com/a/21133564
has answer: http://stackoverflow.com/a/21133315
favorite count: 0
has answer: http://stackoverflow.com/a/21133215
possible better answer: http://stackoverflow.com/a/21133315
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31802251
upvote count: 2
score: 0
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/59419237
linked to: http://stackoverflow.com/q/902922

http://stackoverflow.com/comment/41735669
comment on: http://stackoverflow.com/a/23803545
score: 0
type: Comment
has text: For the future, you may want to explain what you have. Simply giving somebody the code isn't actually all that useful.
type: AnswerComment

response-time
tags question: http://stackoverflow.com/q/21127255
tag name: response-time
type: Tag

http://stackoverflow.com/comment/106699275
score: 0
comment on: http://stackoverflow.com/a/41644686
type: Comment
has text: You need to include powermock-api-mockito maven arterfact.
type: AnswerComment

http://stackoverflow.com/comment/31882996
has text: @developercorey - I don't know what OP wants, only that he doesn't want the default `toString()` behavior. (Incidentally, using `new String(arrays)` will produce exactly the same output as your code.)
type: Comment
comment on: http://stackoverflow.com/a/21177326
type: AnswerComment
score: 0

http://stackoverflow.com/comment/31866833
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/21145635
has text: Where can I find the generated class file or Java source file of the interface?
score: 0

http://stackoverflow.com/q/21038464
downvote count: 1
has comment: http://stackoverflow.com/comment/31630979
has comment: http://stackoverflow.com/comment/31629425
type: Question
has answer: http://stackoverflow.com/a/21038782
tagged with: jtable
answer count: 2
has title: NetBeans JTable without Scroll Pane, Keep Header
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21038789
tagged with: jtableheader
tagged with: swing
tagged with: netbeans
score: 0
tagged with: java
upvote count: 1
has body: I'm attempting to add a JTable with NetBeans GUI builder. The table is inside a panel which already has a scroll bar. Netbeans automatically creates all JTables inside of a JScrollPane. However, I want the table to scroll as part of a larger page. I do not need two scroll bars. My problem is: if I get rid of the scroll pane, I lose the header. Is there a way to have a table with a header inside the Netbeans GUI builder?

http://stackoverflow.com/a/21136386
has comment: http://stackoverflow.com/comment/31811376
has comment: http://stackoverflow.com/comment/31809784
has comment: http://stackoverflow.com/comment/31812383
has comment: http://stackoverflow.com/comment/31812564
score: 0
has body: What do you expect the JFrame to paint, when you're setting a transparent background color? Of course it doesnt "reset". From your description I still fail to see for what you would need any transparency at all. If your goal is to make the entire JFrame transparent with respect to the desktop, your approach is meaningless. You need to explicitly make the frame transparent, which is easily found using google: http://docs.oracle.com/javase/tutorial/uiswing/misc/trans_shaped_windows.html
has comment: http://stackoverflow.com/comment/31809768
answers question: http://stackoverflow.com/q/21135930
has comment: http://stackoverflow.com/comment/31811166
type: Answer

http://stackoverflow.com/comment/80735115
comment on: http://stackoverflow.com/a/21172732
type: Comment
has text: submit return `ForkJoinTask`. To imitate `parallel()` `get()` is needed: `stream.parallel().forEach(soSomething)).get();`
score: 3
type: AnswerComment

http://stackoverflow.com/comment/87559293
has text: With big payloads is not possible to extract payload... The result is an empty String: any idea on how to manage this?
comment on: http://stackoverflow.com/a/21116852
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21200106
has comment: http://stackoverflow.com/comment/54254414
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/118261982
has body: The error seems not have impact on GAE since I can run the app and store data into storage. I guess it's a bug in IntelliJ IDEA and you can simply ignore it.
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/21059451
downvote count: 0
answers question: http://stackoverflow.com/q/21059451
score: 1

http://stackoverflow.com/a/21482014
answers question: http://stackoverflow.com/q/21132276
type: Answer
has body: Facet boundaries, and I am going to assume you mean "Ranges" in the terminology used in hybris, are pushed into SOLR if using a default hybris Accelerator site. To make these "dynamic" you will probably need to implement https://issues.apache.org/jira/browse/SOLR-1581 and integrate this via the solrfacetsearch extension.
score: 0

http://stackoverflow.com/a/21141933
has comment: http://stackoverflow.com/comment/31819652
upvote count: 1
answers question: http://stackoverflow.com/q/21141459
has comment: http://stackoverflow.com/comment/31819549
type: Answer
has body: There are a few things wrong here. First, you are creating your BaseClient object yourself, so Spring cannot add the @Transactional behavior. BaseClient mailServiceClient = new BaseClient(getAgencyRepository(), getSessionFactory(), sessionId); Instead, you should let Spring create a bean of that type for you. Use prototype scope. Second, you need to carefully read this entry in the Spring documentation about Spring's proxying mechanism. Unfortunately, you cannot expect any transactional behavior when invoking a @Transactional method from a non-transactional method within the same class, which is what you do here @Override public void run() { sendemailreport(); } @Transactional public void sendemailreport() { sendemailreport is invoked on this reference, which is the object itself, not the proxy. It will therefore not have any transactional behavior. Consider looking into the @Async annotation alongside asynchronous execution.
has comment: http://stackoverflow.com/comment/31827190
downvote count: 0
score: 1

http://stackoverflow.com/comment/36216572
has text: I thought scrollview can only have 1 child? like textview is consider as 1 child..
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21172872

http://stackoverflow.com/a/21187210
has comment: http://stackoverflow.com/comment/31900519
score: 1
answers question: http://stackoverflow.com/q/21180907
has body: For cross-platform use, RazorSQL relies on the host platform's available Java installation. See Using Headless Mode in the Java SE Platform for details about why the GUI throws HeadlessException in the absence of an X window client. Some alternatives are discussed here.
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/31707989
type: Comment
score: 1
comment on: http://stackoverflow.com/a/21081448
has text: +1. Note that even if `java.util.Iterator` did specify something like that, it wouldn't actually be a binding requirement. It happens pretty often that a class doesn't actually conform to the contracts of its interfaces. (For example, the JDK's `java.util.IdentityHashMap` completely, intentionally, and documentedly violates the general contract of `java.util.Map`.)
type: AnswerComment

http://stackoverflow.com/a/21075220
upvote count: 1
has comment: http://stackoverflow.com/comment/31695793
has comment: http://stackoverflow.com/comment/31695869
answers question: http://stackoverflow.com/q/21075173
downvote count: 0
has body: At maximum there will be 2 threads executing simultaneously (2 cores), but many more may be scheduled for execution (waiting for cpu)
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/31695905

http://stackoverflow.com/comment/31609635
has text: Did you check out the enconding on you eclipse workspace?
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/21027937

http://stackoverflow.com/comment/93569869
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21175450
has text: Your question is my answer, thanks.

jquery
tags question: http://stackoverflow.com/q/21027486
tags question: http://stackoverflow.com/q/21157957
tags question: http://stackoverflow.com/q/21019630
type: Tag
tags question: http://stackoverflow.com/q/21171750
tags question: http://stackoverflow.com/q/21053394
tags question: http://stackoverflow.com/q/21036846
tags question: http://stackoverflow.com/q/21178823
tags question: http://stackoverflow.com/q/21048136
tags question: http://stackoverflow.com/q/21026538
tags question: http://stackoverflow.com/q/21040312
tags question: http://stackoverflow.com/q/21153000
tags question: http://stackoverflow.com/q/21134590
tags question: http://stackoverflow.com/q/21068389
tags question: http://stackoverflow.com/q/21137098
tags question: http://stackoverflow.com/q/21048081
tag name: jquery
tags question: http://stackoverflow.com/q/21168938
tags question: http://stackoverflow.com/q/21123539
tags question: http://stackoverflow.com/q/21116799
tags question: http://stackoverflow.com/q/21043873
tags question: http://stackoverflow.com/q/21066182
tags question: http://stackoverflow.com/q/21077683
tags question: http://stackoverflow.com/q/21108160
tags question: http://stackoverflow.com/q/21062014
tags question: http://stackoverflow.com/q/21131264
tags question: http://stackoverflow.com/q/21157938
tags question: http://stackoverflow.com/q/21063349
tags question: http://stackoverflow.com/q/21116344

http://stackoverflow.com/q/21087970
has answer: http://stackoverflow.com/a/21088137
has title: A polymorphic method for creating a list of new objects
answer count: 2
has comment: http://stackoverflow.com/comment/31719814
downvote count: 0
favorite count: 0
has body: What is the best way to write a method that given a type T and integer n, returns a list of n newly created objects of type T. Is it possible to pass a constructor as argument or will I have to accomplish this in some other way? Was thinking something like this public &lt;T&gt; ArrayList&lt;Object&gt; generate(T type, int amount){ ArrayList&lt;Object&gt; objects = new ArrayList(); for (int i = 0; i &lt; amount; i ++){ objects.add(new bla bla)... }
has comment: http://stackoverflow.com/comment/31720118
has comment: http://stackoverflow.com/comment/31719616
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: object
has answer: http://stackoverflow.com/a/21088101
has comment: http://stackoverflow.com/comment/31719508
has comment: http://stackoverflow.com/comment/31719692

http://stackoverflow.com/comment/31663159
score: 0
type: QuestionComment
type: Comment
has text: Catch Throwable below catch (InputMismatchException e) (Don't do it in production code) and just print the message.
comment on: http://stackoverflow.com/q/21057204

http://stackoverflow.com/q/21092627
score: 0
tagged with: java
tagged with: jpanel
tagged with: bufferedimage
type: Question
answer count: 1
tagged with: compositing
has title: JPanels Flickering during overlap
has comment: http://stackoverflow.com/comment/31728848
has comment: http://stackoverflow.com/comment/31755508
has answer: http://stackoverflow.com/a/21096801
type: UnansweredQuestion
has body: I am trying to make a program that randomly displays JPanels at the top of the screen. These JPanels contain a PNG BufferedImage of a smiley face (by overriding PaintComponent). Unfortunately, whenever I run the program and the panels are drawn in locations with any overlap at all, the images will begin flickering (seemingly to try and display themselves at the same time instead of compositing). I did some research and tried to fix the problem but it did not work. my code is below: public class MainScreen extends JFrame{ public MainScreen ms; private Smiley smileyPanel; private int randomPosition; public AlphaComposite ac; private Graphics2D graphicsPane; //main method public static void main (String[] args){ MainScreen ms = new MainScreen(); } //this is my attempted fix to the program protected void Paint (Graphics g){ Graphics2D graphicsPane = (Graphics2D) g; ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER); graphicsPane.setComposite(ac); super.paint(g); } //this creates the main frame and also starts creating smileys at the top public MainScreen(){ super("Main Screen Window"); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setSize(500,800); this.getContentPane().setBackground(Color.black); this.setLayout(null); createSmiley(); createSmiley(); createSmiley(); createSmiley(); createSmiley(); createSmiley(); this.setVisible(true); } //random number generator used to place an image at the top public void setRandomPosition(){ Random generator = new Random(); randomPosition = generator.nextInt(473); } //this is the method to create an image at a random location at the top public void createSmiley(){ smileyPanel = new Smiley(); this.add(smileyPanel); setRandomPosition(); smileyPanel.setBounds(randomPosition, 0, 28, 29); } } and my other class: public class Smiley extends JPanel{ private BufferedImage smileyFace; private Dimension smileyPosition; private File smileyFile; public Smiley() { //this is the code to retrieve the smiley file try{ smileyFile = new Fi…
tagged with: swing

http://stackoverflow.com/a/21787133
has comment: http://stackoverflow.com/comment/71916537
has comment: http://stackoverflow.com/comment/84464519
upvote count: 52
has comment: http://stackoverflow.com/comment/71917496
has comment: http://stackoverflow.com/comment/71921179
score: 52
has comment: http://stackoverflow.com/comment/71920592
type: Answer
has comment: http://stackoverflow.com/comment/84550962
has comment: http://stackoverflow.com/comment/84549330
downvote count: 0
answers question: http://stackoverflow.com/q/21120043
has body: Normally when you look into optimistic locking you also use a library like Hibernate or an other JPA-Implementation with @Version support. Example could read like this: public class Person { private String firstName; private String lastName; private int age; private Color favoriteColor; @Version private Long version; } while obviously there is no point of adding a @Version annotation if you are not using a framework which supports this. The DDL could then be CREATE TABLE people ( person_id PRIMARY KEY AUTO_INCREMENT, first_name VARCHAR(100) NOT NULL, last_name VARCHAR(100) NOT NULL, # } I realize these column defs are not valid but this is just pseudo-code age INT NOT NULL, color_id FOREIGN KEY (colors) NOT NULL, # Say we also have a colors table and people has a 1:1 relationship with it version BIGINT NOT NULL ); What happens with the version? Every time before you store the entity, you check if the version stored in the database is still the version you know. If it is, store your data with version incremented by one To get both steps done without risking an other process changing data between both steps it is normally handled through a statement like UPDATE Person SET lastName = 'married', version=2 WHERE person_id = 42 AND version = 1; After executing the statement you check if you updated a row or not. If you did, nobody else changed the data since you've read it, otherwise somebody else changed the data. If somebody else changed the data you will normally receive an OptimisticLockException by the library you are using. This exception should cause all changes to be revoked and the process of changing the value to be restarted as the condition upon which the entity was to be updated may no longer be applicable. So no collision: Process A reads Person Process A writes Person thereby incrementing version Process B reads Person Process B writes Person thereby incrementing version Collision: Process A reads Person Process B reads Person Process A writes Person thereb…

self-signed
type: Tag
tags question: http://stackoverflow.com/q/21157450
tags question: http://stackoverflow.com/q/21139384
tag name: self-signed

http://stackoverflow.com/a/21240573
answers question: http://stackoverflow.com/q/21149561
has body: OK. Got it. It is all administrators job to 1) Allow you connect to queue manager 2) Allow you put/get messages to queue(s) From the application point of view nothing related to security is required. Application need to write code to connect, send/receive messages. There are number of samples shipped with MQ. You can find them under Tools/wmqjava/samples folder on a Windows machine. There are both Java and Java/JMS samples. To start with you can look at MQSample.java sample. Edit Sample code for setting userID from application using USER_ID_PROPERTY Hashtable props = new Hashtable(); props.put(CMQC.HOST_NAME_PROPERTY, "mymq.server.com"); props.put(CMQC.PORT_PROPERTY, 1414); props.put(CMQC.CHANNEL_PROPERTY, "SYSTEM.DEF.SVRCONN"); props.put(CMQC.USER_ID_PROPERTY, "myusername";) MQQueueManager qMgr = new MQQueueManager(qManager, props);
score: 0
has comment: http://stackoverflow.com/comment/32217125
has comment: http://stackoverflow.com/comment/32006457
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/32034898
type: Answer
accepted answer of: http://stackoverflow.com/q/21149561

http://stackoverflow.com/comment/31846442
type: Comment
score: 0
type: AnswerComment
has text: +1 for pointing out the class has grown too large - and moving `create` into a separate class sounds like the ideal approach (for testability, readability, and the fact it gives you a clean slate on which to refactor the `create` method into smaller, less complex pieces)
comment on: http://stackoverflow.com/a/21157219

conflict
tag name: conflict
type: Tag
tags question: http://stackoverflow.com/q/21032551

http://stackoverflow.com/a/21067568
score: 0
answers question: http://stackoverflow.com/q/21067453
type: Answer
upvote count: 1
downvote count: 1
has body: Just make a new int variable like int count = 0; then if (x.contains("END)) { count++; } Everytime you find a "END" increment your variable and afterwards just print your variable.
has comment: http://stackoverflow.com/comment/31686010

collision-detection
tags question: http://stackoverflow.com/q/21109340
tags question: http://stackoverflow.com/q/21089057
tags question: http://stackoverflow.com/q/21081972
tags question: http://stackoverflow.com/q/21153110
type: Tag
tags question: http://stackoverflow.com/q/21069591
tag name: collision-detection

http://stackoverflow.com/q/21119197
has comment: http://stackoverflow.com/comment/31777038
tagged with: string
linked to: http://stackoverflow.com/q/4691706
type: UnansweredQuestion
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/21119273
type: Question
has title: How to load Android strings array into ListView?
tagged with: arrays
has body: I'm trying to build my very first ListView in Android, and for this I'm building a custom ListAdapter. So I created a class called NotificationsAdapter which extends the BaseAdapter. Since I want to be able to translate the strings into other languages, I created a string-array in strings.xml: The first item The second item Number three Numero four Next to dislaying the items in this list, I also want to be able to click every item. This should create an intent to get the user to the next screen (always the same) with which I have to give a putextra so that I know in the next activity which item the user clicked. Furthermore, I want to put a custom icon next to the list item. In my Adapter I've got a constructor in which I load the notifications_string_array as follows: int theStringArray = R.array.notifications_string_array; This is however, just the id of the string array. So first question; how do I load the whole array? I then need to load the array in the view, which I try to do like so: @Override public View getView(final int position, View convertView, ViewGroup viewGroup) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.list_item_notifications, viewGroup, false); TextView textView = (TextView) rowView.findViewById(R.id.text_notification); textView.setText(theStringArray[position]); } This goes horribly wrong, because "theStringArray" is not a string array at all, but just an int referring to a string array. I guess this is solved with an answer to my first question. From this point on however, I wouldn't know how to add an intent which I can give a .putextra dependent on the item on which the user clicks. And lastly, how to give every item his own icon? Where should I store this list of icons and how do I map it to the correct item? If anybody could enlighten me I would be very grateful!
tagged with: listview
has answer: http://stackoverflow.com/a/21119276
score: 0
answer count: 2

http://stackoverflow.com/comment/31759198
comment on: http://stackoverflow.com/a/21109003
score: 1
has text: @PeterLawrey But then you won't be able to add or remove in O(1), as you would have to copy every node (if my code is naively extended with a new `Node previous`)
type: AnswerComment
type: Comment

http://stackoverflow.com/q/21134629
tagged with: java
accepted answer: http://stackoverflow.com/a/21168096
type: Question
answer count: 2
has body: I have the following stack for a REST API Jersey 2/JAX RS 2.0 Tomcat 7.0.47 Jackson 2 My goal is to have a custom response body when an error occurs. I want to be able to send the client an explanation what exactly went wrong for easier debugging. First I tried to use @Context HttpServletResponse and set the http status code there, but it was ignored by jersey (which is the normal behaviour but this is beyond my understanding) Then I tryed to use WebApplicationException like this: @GET @Path("/myapi") public BaseResponse getSomething() { BaseResponse b = new BaseResponse(); if(error) { b.setStatusDescription("reason for error"); throw new WebApplicationException(Response.status(Response.Status.CONFLICT).entity(b).build()); } //add content to BaseReponse return b } But Tomcat returns me somthing like this: Apache Tomcat/7.0.47 - Error report <!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22p Which is the standard Tomcat html output capped by the contet-length of response body I wanted to return (.entity(b) - the length of b). So it is recognized but Tomcat just overwrites it with its own error page. As a side note I also tried to just return the Response with the same outcome: return Response.status(Response.Status.CONFLICT).entity(b).build() So how do I tell Tomcat to leave me alone and let my own responses through?
has title: Prevent Tomcat from interfering with Jersey/JAX-RS 2 Response Body on HTTP Error Status 4xx or 5xx
tagged with: rest
downvote count: 0
tagged with: jersey-2.0
tagged with: jax-rs
has answer: http://stackoverflow.com/a/21168096
favorite count: 0
has comment: http://stackoverflow.com/comment/66312064
possible better answer: http://stackoverflow.com/a/33963160
score: 6
has answer: http://stackoverflow.com/a/33963160
tagged with: tomcat7
upvote count: 6
type: AnsweredQuestion

http://stackoverflow.com/comment/125696449
has text: I read the link and Author/s suggesting to Use 1) HashMap 2) LinkedList for storing/connecting items sorted frequency 3) LinkedList for storing elements of the same frequency
score: 0
comment on: http://stackoverflow.com/a/55624839
type: AnswerComment
type: Comment

http://stackoverflow.com/a/21108041
downvote count: 0
has comment: http://stackoverflow.com/comment/31941472
has body: Ok, I found the answer for this, I don't know why I don't think about it before. This is the new code : @Override public void surfaceCreated(SurfaceHolder arg0) { try { camera = Camera.open(); parameters = camera.getParameters(); parameters.setFlashMode(Parameters.FLASH_MODE_TORCH); parameters.setFocusMode(Parameters.FOCUS_MODE_AUTO); camera.setParameters(parameters); camera.setPreviewDisplay(holder); camera.startPreview(); camera.autoFocus(new AutoFocusCallback() { @Override public void onAutoFocus(boolean success, Camera camera) { } }); recorder = new MediaRecorder(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
score: 2
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/21107610
answers question: http://stackoverflow.com/q/21107610
type: Answer

maven
tags question: http://stackoverflow.com/q/21094498
tags question: http://stackoverflow.com/q/21059706
tags question: http://stackoverflow.com/q/21088976
type: Tag
tags question: http://stackoverflow.com/q/21081780
tags question: http://stackoverflow.com/q/21037326
tags question: http://stackoverflow.com/q/21114211
tags question: http://stackoverflow.com/q/21052186
tags question: http://stackoverflow.com/q/21083768
tags question: http://stackoverflow.com/q/21040948
tags question: http://stackoverflow.com/q/21058453
tags question: http://stackoverflow.com/q/21140168
tags question: http://stackoverflow.com/q/21160947
tags question: http://stackoverflow.com/q/21141960
tags question: http://stackoverflow.com/q/21134429
tags question: http://stackoverflow.com/q/21078110
tags question: http://stackoverflow.com/q/21160551
tags question: http://stackoverflow.com/q/21019086
tags question: http://stackoverflow.com/q/21125894
tags question: http://stackoverflow.com/q/21039703
tags question: http://stackoverflow.com/q/21141509
tags question: http://stackoverflow.com/q/21130696
tags question: http://stackoverflow.com/q/21090915
tags question: http://stackoverflow.com/q/21108328
tags question: http://stackoverflow.com/q/21088703
tags question: http://stackoverflow.com/q/21100900
tags question: http://stackoverflow.com/q/21108953
tags question: http://stackoverflow.com/q/21175259
tags question: http://stackoverflow.com/q/21023065
tags question: http://stackoverflow.com/q/21020258
tags question: http://stackoverflow.com/q/21157308
tags question: http://stackoverflow.com/q/21043777
tags question: http://stackoverflow.com/q/21088880
tags question: http://stackoverflow.com/q/21173835
tags question: http://stackoverflow.com/q/21115619
tags question: http://stackoverflow.com/q/21119583
tags question: http://stackoverflow.com/q/21041673
tags question: http://stackoverflow.com/q/21098976
tags question: http://stackoverflow.com/q/21056239
tags question: http://stackoverflow.com/q/21180337
tags question: http://stackoverflow.com/q/21106044
tags question: http://stackoverflow.com/q/21085877
tags question: http://stackoverflow.com/q/21138165
tags question: http://stackoverflow.com/q/21183758
tags question: http://stackoverflow.com/q/21054036
tags question: http://stackoverflow.com/q/21082413
tags question: http://stackoverflow.com/q/21141296
tags question: http://stackoverflow.com/q/21115342
tags question: http://stackoverflow.com/q/21049467
tags question: http://stackoverflow.com/q/21042330
tags question: http://stackoverflow.com/q/21101454
tags question: http://stackoverflow.com/q/21127666
tags question: http://stackoverflow.com/q/21124864
tags question: http://stackoverflow.com/q/21113136
tags question: http://stackoverflow.com/q/21072378
tags question: http://stackoverflow.com/q/21042115
tags question: http://stackoverflow.com/q/21112722
tags question: http://stackoverflow.com/q/21029364
tags question: http://stackoverflow.com/q/21154368
tags question: http://stackoverflow.com/q/21072540
tags question: http://stackoverflow.com/q/21177198
tags question: http://stackoverflow.com/q/21080174
tags question: http://stackoverflow.com/q/21076023
tags question: http://stackoverflow.com/q/21155362
tags question: http://stackoverflow.com/q/21155541
tags question: http://stackoverflow.com/q/21183805
tags question: http://stackoverflow.com/q/21020755
tags question: http://stackoverflow.com/q/21087841
tags question: http://stackoverflow.com/q/21076910
tags question: http://stackoverflow.com/q/21021485
tags question: http://stackoverflow.com/q/21028961
tags question: http://stackoverflow.com/q/21144287
tags question: http://stackoverflow.com/q/21109502
tags question: http://stackoverflow.com/q/21089936
tags question: http://stackoverflow.com/q/21073123
tags question: http://stackoverflow.com/q/21160187
tags question: http://stackoverflow.com/q/21079307
tags question: http://stackoverflow.com/q/21040970
tags question: http://stackoverflow.com/q/21156073
tags question: http://stackoverflow.com/q/21099072

http://stackoverflow.com/comment/31796347
has text: sorry Didn't get you, what do you want to say ?
comment on: http://stackoverflow.com/a/21129578
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/21143173
has comment: http://stackoverflow.com/comment/31823779
score: 0
has comment: http://stackoverflow.com/comment/31820214
type: Answer
has comment: http://stackoverflow.com/comment/31820381
has comment: http://stackoverflow.com/comment/31820526
has body: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="fill_parent" android:paddingTop="5dp" android:paddingBottom="5dp" android:background="#ECEBE7"&gt; &lt;RelativeLayout android:id="@+id/rankView" android:layout_width="40dp" android:layout_height="fill_parent" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:background="#5C5C5C"&gt; Try this.
answers question: http://stackoverflow.com/q/21143045
has comment: http://stackoverflow.com/comment/31820920
has comment: http://stackoverflow.com/comment/31820322
has comment: http://stackoverflow.com/comment/31820563
has comment: http://stackoverflow.com/comment/31820863
has comment: http://stackoverflow.com/comment/31820594
has comment: http://stackoverflow.com/comment/31820311
has comment: http://stackoverflow.com/comment/31820189

http://stackoverflow.com/comment/31694778
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21074643
type: AnswerComment
has text: Can you define a whole number is it greater than 0 or greater or equal to 0?? @user2441860

http://stackoverflow.com/comment/31817054
type: Comment
has text: @gwpark, the guy you talked to is correct, although some operations have total accuracy with some inputs, like, e.g., `*` and `/` with powers of 2, or `*` of two integers whose total number of digits is less than the significant digits of a floating point number (most probably as in your case for `M * 100`). But you started with a wrong statement, because, e.g., `(double)(M * 100) / N` and `(double)M * 100 / N` have an integer `*` the first and an FP `*` the second, but practically always yield the same result - it's not having the `/` last that can give a different result
type: AnswerComment
comment on: http://stackoverflow.com/a/21133104
score: 0

http://stackoverflow.com/comment/31811171
comment on: http://stackoverflow.com/q/21137049
score: 0
type: Comment
type: QuestionComment
has text: How can I do this? I think you mention about ds.xml Which paramaters I will use?

http://stackoverflow.com/comment/112019006
type: AnswerComment
has text: @Vishwanathgowdak The root cause likely is just that the newer JRE came with newer certificates built-in, which did not exist at the time the older version was released.
score: 0
comment on: http://stackoverflow.com/a/21507568
type: Comment

http://stackoverflow.com/a/21159753
upvote count: 9
answers question: http://stackoverflow.com/q/21159711
score: 9
downvote count: 0
has body: "xxx" is defined as a String literal by the specification of the language* and is a String object. So you can write: String s = "abc"; //ok we got it Object o = "abc"; //a String is an Object CharSequence cs = "abc"; //a String is also a CharSequence But a String is not a StringBuilder... *Quote from the JLS: "A string literal is always of type String"
type: Answer

http://stackoverflow.com/a/21036135
type: Answer
has comment: http://stackoverflow.com/comment/31625454
downvote count: 0
has comment: http://stackoverflow.com/comment/31625773
score: 1
accepted answer of: http://stackoverflow.com/q/21036049
answers question: http://stackoverflow.com/q/21036049
has comment: http://stackoverflow.com/comment/31625632
has comment: http://stackoverflow.com/comment/31624997
has comment: http://stackoverflow.com/comment/31625095
upvote count: 1
has comment: http://stackoverflow.com/comment/31625732
has comment: http://stackoverflow.com/comment/31625299
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/31625198
has body: Matrices and Arrays don't really have any inherent sense of direction. Their direction is entirely determined by the order in which you choose to display the information. Depending on how you structure your loop, the contents of the array will be outputted differently. If you want to store elements from the "bottom" to the "top," what that actually means is that your print out loop should be structured in an opposite direction from your assignment loop. So for example (assuming an NxN array), for (int i = 0; i &lt; arr.length; i++) { for (int j = 0; j &lt; arr.length; j++) { arr[i][j] = &lt;some value here&gt;; } } Say for simplicity's sake you think of vertex (0,0) being in the top left corner, where columns increase as you move right and rows increase as you move down. Then to print from the bottom up, you would want to start from the last row and move to the first row. for (int i = arr.length - 1; i &gt;= 0; i--) { // Note the &gt;= 0, which was incorrect // in the code you posted for (int j = 0; j &lt; arr.length; j++) { System.out.print(arr[i][j]+" "); } System.out.println(); } That would start from the bottom row and print out its contents from the first to last column, then move up to the second to last row, etc. all the way up to the first (top) row. So there is no inherent directionality in arrays at all, but because we are printing in the opposite order from the one used in the value assignment, the values will appear to be printed from the "bottom up." If you wanted to also invert the columns, printing the last one first, you could do this: for (int i = arr.length - 1; i &gt;= 0; i--) { for (int j = arr.length - 1; j &gt;= 0; j--) { System.out.print(arr[i][j]+" "); } System.out.println(); } I hope that explanation was clear. Best of luck~! PS. As there is no inherent directionality in arrays, you should not necessarily be storing the values in the direction you want to print them. You should store the values in the way that makes the most sense to you and…
has comment: http://stackoverflow.com/comment/31625539

http://stackoverflow.com/comment/31839888
type: AnswerComment
score: 0
type: Comment
has text: The code you gave me works .I have seen another code , which has used only the if and it works .. do u know why ?
comment on: http://stackoverflow.com/a/21153482

http://stackoverflow.com/comment/31860000
type: Comment
comment on: http://stackoverflow.com/q/21165135
type: QuestionComment
has text: With Spring 3.2+, you should be able to define it in a `@ControllerAdvice` annotated class.
score: 1

http://stackoverflow.com/comment/31767910
comment on: http://stackoverflow.com/q/21114165
type: Comment
type: QuestionComment
score: 0
has text: Usually, to lay things out on a percentage basis, you use `LinearLayout` and `android:layout_weight`: https://github.com/commonsguy/cw-omnibus/tree/master/Containers/LinearPercent

http://stackoverflow.com/q/21113073
type: Question
has title: Maintaining the data in a jar file
score: 0
answer count: 2
tagged with: jar
has comment: http://stackoverflow.com/comment/31766292
linked to: http://stackoverflow.com/q/5052311
type: UnansweredQuestion
has body: I'm trying to develop a password manager. My initial thought was to create a file to store the data and Build a jar so that it can be portable. After searching in google i came to know that we cannot write to a file in the .jar file. So now is there any other way to develop the application in the way i wanted to (I mean portable jar) ?
duplicate of: http://stackoverflow.com/q/5052311
has answer: http://stackoverflow.com/a/21113192
has comment: http://stackoverflow.com/comment/31765763
tagged with: java
has answer: http://stackoverflow.com/a/21113412

http://stackoverflow.com/a/21067550
accepted answer of: http://stackoverflow.com/q/21034423
upvote count: 1
has body: What you need to do is persist data. You can use two solutions: 1) The SharedPreferences framework for saving key-value pairs without any effort. See here to see how to save a list Store a List or Set in SharedPreferences 2) use SQL database. (custom solution) In case 1 you would persist the blacklisted strings and in case 2 you would be best to create a table with all strings and have a boolean as to whether its blacklisted or not. I recommend the shared preferences one since it should take you 5 min to do whereas, unless you are familiar with databases, the database solution will take you a while to work out.
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/21034423
score: 1

http://stackoverflow.com/comment/31820632
comment on: http://stackoverflow.com/a/21101435
score: 0
type: AnswerComment
has text: Thank you Sir, no problem with the crash anymore :)
type: Comment

http://stackoverflow.com/comment/31810906
type: QuestionComment
comment on: http://stackoverflow.com/q/21137683
score: 0
has text: umm..rechecked it with continue and break statements.still the same issue.it is incrementing the total are that is intersected i guess.. and yes double-buffering is set to true.the issue lies in addition of new alien ships.can u please provide me some insight on how to add alien ships randomly without slowing the game
type: Comment

http://stackoverflow.com/q/21112217
score: 0
has comment: http://stackoverflow.com/comment/31766253
has comment: http://stackoverflow.com/comment/31877543
has comment: http://stackoverflow.com/comment/31765931
tagged with: java
type: UnansweredQuestion
tagged with: jfreechart
has comment: http://stackoverflow.com/comment/31767415
has title: JFreeChart Gantt Chart zooming issue
answer count: 0
has comment: http://stackoverflow.com/comment/31765796
tagged with: gantt-chart
has comment: http://stackoverflow.com/comment/31766134
type: Question
has body: I think there is a bug in JFreeChart's Gantt chart. When I'm zooming in finally I get something like this... and if I zoom a little bit more ... Is there any workaround for that behaviour?
has comment: http://stackoverflow.com/comment/31876679

http://stackoverflow.com/a/21086246
downvote count: 0
answers question: http://stackoverflow.com/q/21086103
has body: I believe the difference is the padding, not the actual encrypted data. Have you tried to decrypt the strings? I believe they will show up as the same. Why is the padding different? because they are either implementing it differently, or because one is provided a file, while the other a string, which in the end, when you read them, they are not the same thing (one has an EoF marker, for example). BTW: Since it is CBC, Cipher Block Chaining, the whole last block is affected by this padding difference
upvote count: 3
type: Answer
score: 3

http://stackoverflow.com/comment/31633150
type: QuestionComment
comment on: http://stackoverflow.com/q/21041087
has text: no this older post converte rgb to 3 number of color
score: 0
type: Comment

http://stackoverflow.com/q/21056179
has comment: http://stackoverflow.com/comment/31661042
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/31661018
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/21056235
score: 0
tagged with: nullpointerexception
tagged with: android
has title: java.lang.NullPointerException with Android Java
has body: Apparently the problem is with line 62.If you comment that out then line 63 and so on. I also tried a non array and it worked. I cant see that any of the variables are nulled either. Logcat says the problem is: java.lang.NullPointerException. Here is my code so far: package com.zxz.zxcdnd; import java.util.Random; import android.os.Bundle; import android.app.Activity; import android.widget.*; public class MainActivity extends Activity { //Player statistics int playerStatistics[]; //Room statistics String roomStatistics[]; int type = 1; //Player inventory int inventorySlot = 1; int playerInventoryNumbers[]; String playerInventoryNames[]; String playerInventoryAffectedStats[]; //Index representation variables int name = 1,roomsConquered = 2,goldCoins = 3,stamina = 4,damage = 5,luck = 6,difficulty=3; //Random generator Random r = new Random(); int dice; //List of available items int itemNumbers[] = {1,1,2,2,3,3,4,4,5,5}; String itemAffectedStats[] = {"stamina","damage", "luck","damage", "stamina","damage", "damage","luck", "damage","stamina"}; String itemNames[] = {"lemon","app", "ist","Bms", "Hateech","Lasacsyrup", "Picagger","Hompa", "Bori","Offipenser"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Initialize important player variables startUp(); //Create room initializeRoom(); } void startUp() { //Initialize stamina, damage and luck playerStatistics[stamina] = r.nextInt(7-1) + 1; //LINE 62 playerStatistics[damage] = r.nextInt(7-1) + 1; //LINE 63 playerStatistics[luck] = r.nextInt(7-1) + 1; //Initialize player inventory playerInventoryNumbers[inventorySlot] = itemNumbers[r.nextInt(11-1) + 1]; playerInventoryNames[inventorySlot] = itemNames[r.nextInt(11-1) + 1]; playerInventoryAffectedStats[inventorySlot] = itemAffectedStats[r.nextInt(11-1) + 1]; playerStatistics[damage] = playerStatistics[damage] + playerInventoryNumbers[inventorySlot]; inventorySlot++; } Thanks in advanc…
accepted answer: http://stackoverflow.com/a/21056235

http://stackoverflow.com/comment/31921220
comment on: http://stackoverflow.com/a/21151214
type: AnswerComment
has text: @user2221125 you're welcome! Well now that you have solved your original problem and based on your comment you're probably facing the `SQLException` I was talking about. See my update to get rid of this.
score: 0
type: Comment

http://stackoverflow.com/q/21023486
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/21023847
tagged with: oop
score: 0
has title: Displaying elements inside the array in the Vector Class
tagged with: java
has body: This is my Vector Class public class SimpleVector { private double []vector; public SimpleVector(int length) { this.vector = new double[length]; } public SimpleVector(int length, double vals) { this(length); Arrays.fill(vector,vals); } public SimpleVector(double[] vector) { this.vector = new double[vector.length]; System.arraycopy(vector,0,this.vector,0,vector.length);//arraycopy(Object src, // int srcPos, Object dest, int destPos, int length) } public final int getLength() { return this.vector.length; } public void print() { System.out.print("Type = Vector , "); System.out.print("numRows = "+vector.length); for (int i = 0; i &lt; vector.length; i++) { System.out.println(vector[i]); } When I create an object using my vector class and call my print method it doesn't display all the element in my vector and the number of rows is wrong. But when I call my getLength method its properly displays the number of rows in my vector public static void main(String[] args) { double[] array = new double[] {1,2}; SimpleVector o = new SimpleVector(array); o.print(); } Output: Type = Vector , numRows = 21 2.0
type: Question
tagged with: object
tagged with: arrays
has comment: http://stackoverflow.com/comment/31601909
tagged with: class
answer count: 1

http://stackoverflow.com/comment/31603123
comment on: http://stackoverflow.com/q/21024421
type: Comment
type: QuestionComment
has text: Are those `this.a` or `this.c`?
score: 0

http://stackoverflow.com/comment/31790872
has text: Could you paste your hibernate setup?
score: 0
comment on: http://stackoverflow.com/q/21125628
type: Comment
type: QuestionComment

http://stackoverflow.com/a/21084392
has comment: http://stackoverflow.com/comment/31713309
type: Answer
has body: you can do this: JSONObject jsonObject = new JSONObject(); JSONArray array = new JSONArray(); for(int i=0;i&lt;10;i++){ JSONObject obj = new JSONObject(); obj.put("engine", "mkyong.com"); obj.put("browser", i); obj.put("platform", i); //if you are using JSON.simple do this array.add(obj); //and if you use json-jena array.put(obj); } jsonObject.put("MyArray" , array); System.out.print(jsonObject);
has comment: http://stackoverflow.com/comment/31713379
has comment: http://stackoverflow.com/comment/31713543
upvote count: 2
has comment: http://stackoverflow.com/comment/31713455
score: 2
has comment: http://stackoverflow.com/comment/31713519
accepted answer of: http://stackoverflow.com/q/21084279
answers question: http://stackoverflow.com/q/21084279
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/21134266
has body: Use this to read all files from a directory File folder = new File("/Users/you/folder/"); File[] listOfFiles = folder.listFiles(); Iterate over the listOfFiles and check with isDirectory() if the item is a directory. If yes you can use the same procedure to look into the sub-folders.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/21134172

http://stackoverflow.com/q/21158193
has answer: http://stackoverflow.com/a/21333913
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
downvote count: 0
tagged with: libreoffice
favorite count: 0
tagged with: http://stackoverflow.com/tag/docx
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has body: In order to convert docx-files to pdf (or pdf-a to be precise), we are using JodConverter along with LibreOffice. This has been working fine for a week or so, but then suddenly all letters were representet as squares (usually indicating some control-sign) in the converted pdf (the word-file looked fine). After restarting the service for LibreOffice, things went back to normal, and letters were output just fine. But we were left worried, as we have no guarantee that it won't happen again. I also have no idea why this happened, we had some troubles in the environment prior to this, but none on the server doing the docx-to-pdf convertion in particular. Has anyone else encountered this problem, or a theory as to why it occured?
has title: JodConverter with LibreOffice outputs all letteres as squares after docx-to-pdf conversion
tagged with: jodconverter

http://stackoverflow.com/comment/31739929
score: 1
type: QuestionComment
has text: Well you compare objects equality with `equals`.. `==` just compares reference if they pointing to the same object
type: Comment
comment on: http://stackoverflow.com/q/21098931

http://stackoverflow.com/comment/31597761
has text: Do you know Spock framework? It has some crazy features that simply wont work when compiled statically, they actually wont compile at all :-(
score: 0
comment on: http://stackoverflow.com/a/21020717
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/31781877
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21121859
has text: What's the actual problem? What doesn't work about this?

http://stackoverflow.com/a/21096547
has body: If the question is "why rewrite it" the answer is basically as others have pointed out, that it's currently an infinite loop, and also that it's not very readable as it stands. Personally I'd rewrite it as a while loop, which several others have already pointed out how to do, as it makes your intentions a little more clear than a for loop with a counter that's counting up to infinity. Someone unfamiliar with how the code is supposed to work could easily confuse an infinite increment to be an oversight by the programmer who wrote it.
answers question: http://stackoverflow.com/q/21096276
type: Answer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/31784661
type: QuestionComment
has text: *"create windows without the frame"* The same way you can create a chicken without the egg. It seems that you might want an undecorated frame (`JFrame`) or a `JWindow`.
comment on: http://stackoverflow.com/q/21122990
score: 0
type: Comment

http://stackoverflow.com/q/21024455
accepted answer: http://stackoverflow.com/a/21024841
type: AnsweredQuestion
score: 2
tagged with: key-bindings
tagged with: paint
upvote count: 2
tagged with: java
tagged with: swing
has title: Using keybinding to make sprite continue to move and Snake body
type: Question
has answer: http://stackoverflow.com/a/21024841
has body: It's the same game that I'm working on and I've come to a problem that I can't understand again. I'm using Key Bindings to move my sprite and it's working great! but since it's a snake game I need the sprite to keep moving without stopping and change direction and keep moving after the player types a key. I know it's possible with KeyListener, but I really don't want to have to change my program entirely. I just need to know what code needs to change, if possible. On top of that I'm also working on two arrays for the x and y co-ordinates for the snake body so that squares will follow behind the head, but I can't get it to paint. and how to display an integer for the score. import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.Random; import java.util.ArrayList; public class Snake2 extends JFrame { /* Sprite: snake head co-ordinates */ int x = 400; int y = 450; int width = 10; int height = 10; /* Sprite: snake body */ int length = 0; ArrayList &lt;Integer&gt; bodyX = new ArrayList &lt;Integer&gt;(); ArrayList &lt;Integer&gt; bodyY = new ArrayList &lt;Integer&gt;(); /* Score */ int point = 0; /* Sprite: mouse co-ordinates */ Random rand = new Random(); int addx = (rand.nextInt(10))*10; int addy = (rand.nextInt(10))*10; int mx = ((rand.nextInt(5)+1)*100) + addx; int my = ((rand.nextInt(6)+2)*100) + addy; DrawPanel drawPanel = new DrawPanel(); public Snake2() { addMouseListener(new MouseListener()); System.out.print(mx + " " + my); /* move snake up */ Action upAction = new AbstractAction(){ public void actionPerformed(ActionEvent e) { y -=10; if (y &gt;= my &amp;&amp; y &lt;= my+9 &amp;&amp; x &gt;= mx &amp;&amp; x &lt;= mx+9) { addx = (rand.nextInt(10))*10; addy = (rand.nextInt(10))*10; mx = ((rand.nextInt(5)+1)*100) + addx; my = ((rand.nextInt(6)+1)*100) + addy; point += 100; length++; bodyY.add(0, y); } if (y &lt;99) { new GameOver(); dispose(); } drawPanel.repaint(); } }; /* move snake down */ Action downAction = new AbstractAction(){ pu…
tagged with: awt
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/31659680
has text: @Algeroth Declaration and initialization are two different things. You should read this : http://docs.oracle.com/javase/tutorial/java/javaOO/objectcreation.html
type: AnswerComment
comment on: http://stackoverflow.com/a/21055343
score: 0
type: Comment

http://stackoverflow.com/comment/31668303
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21060220
has text: Nice code formatting.

http://stackoverflow.com/q/21074512
has comment: http://stackoverflow.com/comment/31695099
has comment: http://stackoverflow.com/comment/31694985
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31694809
has title: export libGDX desktop jar file
tagged with: libgdx
tagged with: java
type: Question
has body: I want to export the game i did in libgdx. Well i went into the build path of the game and ticked everything. When i export the jar and double click on it it opens and exists immediately. It looks like it can't even get to the render method, which means the problem is before. Any ideas? am i missing something? Main.java package com.me.mygdxgame; import java.awt.Dimension; import java.awt.Toolkit; import com.badlogic.gdx.backends.lwjgl.LwjglApplication; import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; public class Main { public static void main(String[] args) { System.out.println("Initializing the Window!"); LwjglApplicationConfiguration cfg; cfg = new LwjglApplicationConfiguration(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); cfg.title = "My GDX Game"; cfg.useGL20 = true; cfg.width = (int) 1280; cfg.height = (int) 720; //cfg.width = (int) screenSize.getWidth(); //cfg.height = (int) screenSize.getHeight(); cfg.resizable = false; cfg.fullscreen = false; System.err.println("The Window has Initialized"); System.out.println("Calling the Game!"); new LwjglApplication(new MyGdxGame(), cfg); } } MyGdxGame.java package com.me.mygdxgame; import com.badlogic.gdx.Game; import com.me.mygdxgame.screen.GameScreen; public class MyGdxGame extends Game { public GameScreen game_screen; @Override public void create() { System.out.println("Initializing the game screen!"); game_screen = new GameScreen(this); setScreen(game_screen); } } Thanks in advance! if you need more info, no problem just tell me.
score: 0
tagged with: android

http://stackoverflow.com/q/21108890
has comment: http://stackoverflow.com/comment/31758318
linked to: http://stackoverflow.com/q/14935016
has answer: http://stackoverflow.com/a/21109453
has comment: http://stackoverflow.com/comment/31758711
has answer: http://stackoverflow.com/a/21109324
score: -2
has comment: http://stackoverflow.com/comment/31758413
possible better answer: http://stackoverflow.com/a/21109063
answer count: 4
has body: I am using the Java Mysql connector and I have a problem with extracting results: This is the query and prepared statement that needed to be executed: String statement1 = " select sentence from sentences ; "; PreparedStatement preparedstatement = conn.prepareStatement(statement1); ResultSet res = preparedstatement.executeQuery(); Now I try to get the results in an array, so I use: Array temp = res.getArray("sentence"); //(1) String[] temp2 = (String[])temp.getArray(); //(2) (1) returns a mysql.array which contains a locator, which is a logical pointer to the SQL ARRAY on the server, and (2) should do a typecast of temp and return a String[], however I am getting this error java.sql.SQLFeatureNotSupportedException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at java.lang.Class.newInstance(Class.java:374) at com.mysql.jdbc.SQLError.notImplemented(SQLError.java:1342) at com.mysql.jdbc.ResultSetImpl.getArray(ResultSetImpl.java:1226) at com.mysql.jdbc.ResultSetImpl.getArray(ResultSetImpl.java:1243) at wikiparse.Wikiparse3.running(Wikiparse3.java:62) // this where I wrote (1) in my java file at wikiparse.ActivateWikiparse3.main(ActivateWikiparse3.java:27) Any ideas?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/31758363
has answer: http://stackoverflow.com/a/21109063
has comment: http://stackoverflow.com/comment/31758433
downvote count: 3
tagged with: mysql
has title: casting mysql.Array to String[]
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/31758075
has answer: http://stackoverflow.com/a/21108986
has comment: http://stackoverflow.com/comment/31758752
has comment: http://stackoverflow.com/comment/31758628
tagged with: java
has comment: http://stackoverflow.com/comment/31758405
has comment: http://stackoverflow.com/comment/31758276
has comment: http://stackoverflow.com/comment/31758591
has comment: http://stackoverflow.com/comment/31758444
has comment: http://stackoverflow.com/comment/31758232
accepted answer: http://stackoverflow.com/a/21108986
has comment: http://stackoverflow.com/comment/31758392
favorite count: 0

http://stackoverflow.com/comment/31627053
comment on: http://stackoverflow.com/q/21037432
type: QuestionComment
type: Comment
score: 1
has text: I think you best start with a tutorial Object Oriented java programming.

http://stackoverflow.com/comment/31624653
score: 0
type: QuestionComment
type: Comment
has text: Even after I have added Win32com.dll and Javax.comm.properties file in my Eclipse directory and also in my JRE/Lib/ext then also portlist is not getting enumerated and it keep getting false.
comment on: http://stackoverflow.com/q/21035472

http://stackoverflow.com/comment/31758405
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/21108890
score: 0
has text: @kolonel but... mysql did not support `array` type...it will not implement it!

http://stackoverflow.com/a/21135620
score: 0
type: AcceptedAnswer
has body: The problem solved by this way: for (int i=0; i&lt;twitterTrendsJPAs.size(); i++) { EntityManager em = EMF.get().createEntityManager(); try { System.out.println("=&gt; " + i + " - " + twitterTrendsJPAs.get(i).toString()); em.persist(twitterTrendsJPAs.get(i)); // store current one } finally { if (em != null) em.close(); } } I believe this is horrible way since I'm making "em" several time and mark it to be garbage collected. However, previous idea which was a better way didn't work. Any better idea would be appreciated. Thanks. =========================== Update: Thanks to DataNucleus. I changed first code based on what he said and it's now working fine. System.out.println("Try to store into database..."); EntityManager em = EMF.get().createEntityManager(); try { for (int i=0; i&lt;twitterTrendsJPAs.size(); i++) { System.out.println("=&gt; " + i + " - " + twitterTrendsJPAs.get(i).toString()); em.getTransaction().begin(); em.persist(twitterTrendsJPAs.get(i)); // store current one em.getTransaction().commit(); } } finally { em.close(); } System.out.println("wow. Finished.");
type: Answer
has comment: http://stackoverflow.com/comment/31806549
accepted answer of: http://stackoverflow.com/q/21131896
answers question: http://stackoverflow.com/q/21131896

http://stackoverflow.com/comment/108683666
score: 0
type: Comment
comment on: http://stackoverflow.com/a/21163453
type: AnswerComment
has text: To overcome the problem mentioned in 2nd comment, I recommend to use `resultSet.getTimestamp(i, Calendar.getInstance(TimeZone.getTimeZone("GMT")));`

http://stackoverflow.com/comment/31597217
has text: Thanks for your response but i need to be get notified in the gwt-widget after closed the window.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/21021206
type: QuestionComment

http://stackoverflow.com/q/21094834
score: 0
has answer: http://stackoverflow.com/a/38382517
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/31732435
tagged with: selenium
type: Question
tagged with: settimeout
has body: I'm having some issues on my page load, as the page loads some asynchronous stuff, I would like to interrupt the page load to proceed with the next steps of my test. 1- The driver.get(url) this throws timeoutException after 1800 sec loading. 2- I have added driver.manage().timeouts().implicitlyWait(TEST_WAIT, TimeUnit.SECONDS); it didn't change anything. I did driver.manage().timeouts().setScriptTimeout(time, unit) no change too 3- The last try was the following JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScript("return window.stop()"); this didn't work How can I solve this?
tagged with: java
answer count: 2
tagged with: firefox
has answer: http://stackoverflow.com/a/21095846
has title: set an implicit timeout on webdriver.get(url)

cors
type: Tag
tag name: cors
tags question: http://stackoverflow.com/q/21178823

session
tags question: http://stackoverflow.com/q/21131329
tags question: http://stackoverflow.com/q/21099710
tags question: http://stackoverflow.com/q/21091414
tags question: http://stackoverflow.com/q/21134406
tags question: http://stackoverflow.com/q/21116658
tags question: http://stackoverflow.com/q/21182660
tags question: http://stackoverflow.com/q/21034606
tags question: http://stackoverflow.com/q/21182521
type: Tag
tags question: http://stackoverflow.com/q/21100364
tags question: http://stackoverflow.com/q/21169205
tags question: http://stackoverflow.com/q/21064035
tags question: http://stackoverflow.com/q/21040142
tags question: http://stackoverflow.com/q/21164899
tags question: http://stackoverflow.com/q/21170953
tags question: http://stackoverflow.com/q/21090022
tags question: http://stackoverflow.com/q/21087613
tag name: session
tags question: http://stackoverflow.com/q/21067130
tags question: http://stackoverflow.com/q/21162620