http://stackoverflow.com/q/24367469
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24367633
has comment: http://stackoverflow.com/comment/37681180
type: Question
downvote count: 4
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37681007
favorite count: 0
tagged with: arraylist
has comment: http://stackoverflow.com/comment/37681224
has title: JAVA Print list and getWriter() 1 line
has answer: http://stackoverflow.com/a/24367633
has body: I have 4 Array lists and I would to display everything in the same line for (int i= 0; i &lt; listAttraction.size(); i++){ resp.getWriter().println("\""+listCities.get(cptCity)+"\";\""+listAttraction.get(i)+"\";\""+listMainCategory.get(i)+"\";\""+listCategory.get(i)+"\";"); } for i = 0; 1; and 2, I will have: "Cologne Germany";"Cologne Cathedral (Dom)";"Religious Sites";" Architectural Buildings; Historic Sites"; "Cologne Germany";"TeamEscape";"";""; "Cologne Germany";"Kolner Philharmonie";"Off road/All Terrain Vehicle Trails";" Architectural Buildings; Concerts"; I would like to have 1 city with all attractions in just 1 line. [EDITED] Please, note that all the lists have the same size. Thanks for your help!
score: -4

http://stackoverflow.com/q/24334093
has comment: http://stackoverflow.com/comment/37617445
favorite count: 0
has answer: http://stackoverflow.com/a/31083250
answer count: 3
has answer: http://stackoverflow.com/a/24334276
has answer: http://stackoverflow.com/a/24334374
tagged with: http://stackoverflow.com/tag/csv
accepted answer: http://stackoverflow.com/a/24334374
possible better answer: http://stackoverflow.com/a/24334276
downvote count: 0
has body: I have an Arraylist of String Arrays called NewArray. ArrayList&lt;String[]&gt; NewArray = new ArrayList&lt;String[]&gt;(); The data in NewArray looks somewhat like [Vial1,Dest1] [Vial2,Dest1] [Vial3,Dest2] [Vial4,Dest2] I want to save this data, in this format (without the brackets) to a CSV/text file (with headers). The ideal output format would be: VialNo,DestinationNo (these are the headers) Vial1,Dest1 Vial2,Dest1 Vial3,Dest2 Vial4,Dest2 How would I use something like FileWriter to obtain that desired output in a txt/CSV file? I've tried something like FileWriter writer = new FileWriter("output.txt"); for(String[] str: NewArray) { writer.write(str); } writer.close(); But I'm getting the error "The method write(int) in the type OutputStreamWriter is not applicable for the arguments (String[])"
has comment: http://stackoverflow.com/comment/37617333
type: AnsweredQuestion
tagged with: bufferedwriter
has title: Write Array of String Arrays to File (txt,csv, etc)
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37617314
type: Question
has comment: http://stackoverflow.com/comment/37617388
upvote count: 1
tagged with: arrays

http://stackoverflow.com/comment/38704227
has text: @bluefeet Bumping the question was recommended by this highly-upvoted answer: http://meta.stackexchange.com/a/7054 (I am also slowly building up reputation, but I am finding it hard to answer questions that still require answering. All in due time, I guess.)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24403448

http://stackoverflow.com/comment/37598350
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24321312
has text: @Reddy please be aware that the presentation of X,XX,XXX number format is highly usual around here. Using the westerners format of XXX,XXX increases readability.

http://stackoverflow.com/q/24403463
has body: I am new to android. and In my project I have three java class. and third java class is Notification.java(which is not main java)and here I am trying to display content of text file using text view,but is does not display anything. but when I take it as example project where Notificaion.java is main java file,then it is able to display textfile content. I know I am missing some small logical thing. Notification.java package com.example.alarmnotification; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Calendar; import android.os.Bundle; import android.widget.ImageView; import android.widget.TextView; import android.app.Activity; import android.graphics.drawable.Drawable; public class NotificationView extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /*int[] quoteArray_june = { R.raw.june, R.raw.june };*/ setContentView(R.layout.notification); TextView QuoteTxt = (TextView)findViewById(R.id.quoteTxt); QuoteTxt.setText(readTxt()); } private String readTxt(){ InputStream inputStream = getResources().openRawResource(R.raw.june); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); int i; try { i = inputStream.read(); while (i != -1) { byteArrayOutputStream.write(i); i = inputStream.read(); i--; } inputStream.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return byteArrayOutputStream.toString(); } } and notification.xml is &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;ImageView android:id="@+id/prabhupada_Quote" android:layout_width="fill_parent" android:layout_height="fill_parent" /&gt; &lt;TextView android:id="@+id/quoteTxt" android:layout_width="fill_parent" android:layout_height="fill_parent"…
type: Question
has answer: http://stackoverflow.com/a/24404222
has comment: http://stackoverflow.com/comment/37748994
tagged with: java
score: 0
answer count: 1
has title: textfile content is not visible in non-main java file but visible in main java
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/24334319
type: UnansweredQuestion
tagged with: jdbc
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/24334502
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24334693
upvote count: 0
tagged with: database
score: -1
has title: Communications link failure when connecting to remote MySQL database
answer count: 2
has body: I'm trying to make a Java program communicate with a MySQL server hosted with A Small Orange. The IP and port they provided me with are 129.121.106.234:3306. The user has been given full permissions to the database, and in my CPanel I've allowed all remote hosts to connect to the MySQL database by adding the access host "%". I'm using Eclipse, and I've downloaded and added the JDBC driver to the build path. As near as I can tell, the user I'm trying to use has full permissions to the database, and the MySQL server is open to any request from any IP. I've also tried my admin MySQL credentials, with the same error, so I'm decently confident the issue is with my code. Not absolutely sure though, since I'm not hosting the MySQL server myself. My code: package com.package.IPBounce; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; public class Main { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub /* * Isaac the Support Ninja says: The MySQL port is 3306. The IP you use * is 129.121.106.234. */ URL whatismyip; String IP; try { whatismyip = new URL("http://checkip.amazonaws.com"); BufferedReader in = new BufferedReader(new InputStreamReader( whatismyip.openStream())); IP = in.readLine(); System.out.println(IP); Connection con = null; Statement st = null; ResultSet rs = null; //this is just testing code until I get the connection working String url = "jdbc:mysql://129.121.106.234:3306/db_name"; String user = "user_name"; String password = "small_password"; Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection(url, user, password);//error is on this line st = con.createStatement(); rs = st.executeQuery("SELECT VERSION()"); if (rs.next()) { System.out.println(rs.getString(1)); } } catch (Exception e) { // TODO Auto-generated catch block e.printSta…
has comment: http://stackoverflow.com/comment/37618165
favorite count: 0

http://stackoverflow.com/comment/39971534
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25460867
has text: The Excel file i placed on Dropbox was not the correct one. Here is the [UPDATE](https://www.dropbox.com/s/v9yvp6p6wevijqg/ss1%20with%20macro%20%2831%20Aug%29.xls?dl=0) Unfortunately in the PDF output from PrimoPDF, the 3rd page is chopped off at the right, probably in the same way as reported by @PalinDrome555. A way to create multiline text that is not aligned with rows and avoids wrapping/merging is to create the text in a separate range and then using *paste as image* to the target location. For details see [this Excel tip](http://j-walk.com/ss/excel/usertips/tip039.htm)
type: AnswerComment

http://stackoverflow.com/q/24335853
has answer: http://stackoverflow.com/a/27431056
upvote count: 2
answer count: 5
type: UnansweredQuestion
tagged with: android
tagged with: android-edittext
has body: I've got the following code which fires every time my "redTime" EditText is touched. redTime.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { Log.i("click", "onMtouch"); redTime.setSelection(redTime.getText().length()); return false; } }); It is meant to keep the cursor on the right side of the EditText upon every touch. The problem is that the line containing the "setSelection" method doesn't work upon the FIRST touch of the control. That is, if another control has focus, and I touch the "redTime" control for the first time, the method is fired, but the cursor remains at the location I touched (not the right side). How do I know the listener fires? The "Log.i" call works, but not the cursor change. I suspect the "setSelection" call is working, but some later event is negating it. I tried a few things. I tried consuming the event by returning TRUE in the listener. Didn't work. I tried repeating the "setSelection" call in OnTouchListener, and OnFocusChanged as well. Still doesn't work. I almost forgot. Here is the XML for the control in question.
has answer: http://stackoverflow.com/a/47955709
has comment: http://stackoverflow.com/comment/37647054
has comment: http://stackoverflow.com/comment/37624811
tagged with: java
type: Question
has title: EditText, OnTouchListener and setSelection doesn't work on first touch
downvote count: 0
has answer: http://stackoverflow.com/a/24335955
score: 2
tagged with: user-interface
favorite count: 0
has answer: http://stackoverflow.com/a/35732074
has answer: http://stackoverflow.com/a/35044949

http://stackoverflow.com/comment/37992889
comment on: http://stackoverflow.com/q/24361779
score: 0
type: Comment
type: QuestionComment
has text: @Because it already does what you are want to do **AND** is available in the standard java library

http://stackoverflow.com/a/24364209
downvote count: 0
has body: First a bit cleaning up: g2.setColor(Color.WHITE); g2.fillRect(0, 0, grafikBreite, grafikHoehe); g2.setColor(Color.BLACK); drawStuff(g2); g2.dispose(); // TODO Dispose after createGraphics. Then one could try the more generic, portable ImageIO class. The parametrising for antialiasing and such goes a bit different, but then JPEG is a lossy format anyway. Just to try a different angle. ImageIO.write(image, "jpg", baos); baos.close(); imageInByte = baos.toByteArray(); And then I did the closing first. (It has no effect by javadoc.) One could try .png and a another type, ABGR. I think ImageIO does the trick, or your code with ABGR.
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/24363671
score: 2
accepted answer of: http://stackoverflow.com/q/24363671
has comment: http://stackoverflow.com/comment/37675752
type: AcceptedAnswer

java
tags question: http://stackoverflow.com/q/24270232
tags question: http://stackoverflow.com/q/24321861
tags question: http://stackoverflow.com/q/24316830
tags question: http://stackoverflow.com/q/24277472
tags question: http://stackoverflow.com/q/24356687
tags question: http://stackoverflow.com/q/24422121
tags question: http://stackoverflow.com/q/24327834
tags question: http://stackoverflow.com/q/24395270
tags question: http://stackoverflow.com/q/24345766
tags question: http://stackoverflow.com/q/24386008
tags question: http://stackoverflow.com/q/24361325
tags question: http://stackoverflow.com/q/24387704
tags question: http://stackoverflow.com/q/24298810
tags question: http://stackoverflow.com/q/24361397
tags question: http://stackoverflow.com/q/24354273
tags question: http://stackoverflow.com/q/24364599
tags question: http://stackoverflow.com/q/24401066
tags question: http://stackoverflow.com/q/24388809
tags question: http://stackoverflow.com/q/24420411
tags question: http://stackoverflow.com/q/24271939
tags question: http://stackoverflow.com/q/24369092
tags question: http://stackoverflow.com/q/24390882
tags question: http://stackoverflow.com/q/24395623
tags question: http://stackoverflow.com/q/24414024
tags question: http://stackoverflow.com/q/24304467
tags question: http://stackoverflow.com/q/24302165
tags question: http://stackoverflow.com/q/24391540
tags question: http://stackoverflow.com/q/24365704
tags question: http://stackoverflow.com/q/24378270
tags question: http://stackoverflow.com/q/24327860
tags question: http://stackoverflow.com/q/24342489
tags question: http://stackoverflow.com/q/24336819
tags question: http://stackoverflow.com/q/24351864
tags question: http://stackoverflow.com/q/24361690
tags question: http://stackoverflow.com/q/24276609
tags question: http://stackoverflow.com/q/24279362
tags question: http://stackoverflow.com/q/24335820
tags question: http://stackoverflow.com/q/24273835
tags question: http://stackoverflow.com/q/24363173
tags question: http://stackoverflow.com/q/24284013
tags question: http://stackoverflow.com/q/24336835
tags question: http://stackoverflow.com/q/24285636
tags question: http://stackoverflow.com/q/24293488
tags question: http://stackoverflow.com/q/24324384
tags question: http://stackoverflow.com/q/24272162
tags question: http://stackoverflow.com/q/24397112
tags question: http://stackoverflow.com/q/24346109
tags question: http://stackoverflow.com/q/24389595
tags question: http://stackoverflow.com/q/24371940
tags question: http://stackoverflow.com/q/24273627
tags question: http://stackoverflow.com/q/24427451
tags question: http://stackoverflow.com/q/24283613
tags question: http://stackoverflow.com/q/24337300
tags question: http://stackoverflow.com/q/24324386
tags question: http://stackoverflow.com/q/24341444
tags question: http://stackoverflow.com/q/24354288
tags question: http://stackoverflow.com/q/24287049
tags question: http://stackoverflow.com/q/24326119
tags question: http://stackoverflow.com/q/24307039
tags question: http://stackoverflow.com/q/24423081
tags question: http://stackoverflow.com/q/24348950
tags question: http://stackoverflow.com/q/24295815
tags question: http://stackoverflow.com/q/24325598
tags question: http://stackoverflow.com/q/24354471
tags question: http://stackoverflow.com/q/24347160
tags question: http://stackoverflow.com/q/24348674
tags question: http://stackoverflow.com/q/24278389
tags question: http://stackoverflow.com/q/24360375
tags question: http://stackoverflow.com/q/24323480
tags question: http://stackoverflow.com/q/24401333
tags question: http://stackoverflow.com/q/24305851
tags question: http://stackoverflow.com/q/24381972
tags question: http://stackoverflow.com/q/24317766
tags question: http://stackoverflow.com/q/24315269
tags question: http://stackoverflow.com/q/24373261
tags question: http://stackoverflow.com/q/24286755
tags question: http://stackoverflow.com/q/24280146
tags question: http://stackoverflow.com/q/24289772
tags question: http://stackoverflow.com/q/24278179
tags question: http://stackoverflow.com/q/24367313

http://stackoverflow.com/comment/37571164
comment on: http://stackoverflow.com/q/24309495
score: 0
type: Comment
type: QuestionComment
has text: Are you really intending the getAll method to be static? Static methods are not overridden with inheritance.

http://stackoverflow.com/comment/37690142
score: 1
has text: onSavedInstance state is not getting fired on close of the activity. So onRestoreInstanceState is not getting called and if fired also the saved instance state is null.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24372294

bufferedreader
tags question: http://stackoverflow.com/q/24401160
tags question: http://stackoverflow.com/q/24331518
tags question: http://stackoverflow.com/q/24327835
tags question: http://stackoverflow.com/q/24275377
tags question: http://stackoverflow.com/q/24329748
tags question: http://stackoverflow.com/q/24372626
tags question: http://stackoverflow.com/q/24278311
tags question: http://stackoverflow.com/q/24308794
tags question: http://stackoverflow.com/q/24371084
tag name: bufferedreader
tags question: http://stackoverflow.com/q/24269891
tags question: http://stackoverflow.com/q/24414509
type: Tag

http://stackoverflow.com/comment/37594687
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24321183
has text: so its not at all possible to have recover from jvm restarts? Can we utilize shutdown hook..?

http://stackoverflow.com/q/24267845
has title: SQL Query to retrive Data as Column1 associated with Column 2
type: Question
accepted answer: http://stackoverflow.com/a/24268125
has body: I stuckup with a sql query where column1 and column2 are associated in way their pair should be unique. Sample Database: ID Version Desc update Date --- -------- -------- ------- 1234 1 xoyz 10/12/2014 1234 2 ixyz 10/12/2014 1235 1 iuiu 10/12/2014 1235 2 popo 10/12/2014 1234 3 xypz 10/12/2014 1235 3 xyiz 10/12/2014 1236 1 xyzu 10/12/2014 1235 4 xyzr 10/12/2014 1236 2 xyze 10/12/2014 1235 5 xyrz 10/12/2014 I need a query to retrieve records from the table as follows.. ID Version Desc UpdatedDate 1234 3 xypz 10/12/2014 1235 5 xyrz 10/12/2014 1236 2 xyze 10/12/2014 In simple words.. 1. ID , version are integer. Desc, Date are Strings 2. In result (ID,Version) is unique. I need records as..., ID and It's associate Max Version with DESC and UPDATE DATE Thanks.
tagged with: associations
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/24268122
has comment: http://stackoverflow.com/comment/37491708
has answer: http://stackoverflow.com/a/24268122
has comment: http://stackoverflow.com/comment/37491468
tagged with: java
type: AnsweredQuestion
tagged with: sql
has answer: http://stackoverflow.com/a/24268125

http://stackoverflow.com/a/24290602
accepted answer of: http://stackoverflow.com/q/24290452
has comment: http://stackoverflow.com/comment/37536849
upvote count: 7
answers question: http://stackoverflow.com/q/24290452
has comment: http://stackoverflow.com/comment/37536962
has comment: http://stackoverflow.com/comment/37536629
has body: Map.replace was first declared in Java 1.8 (see the "since: 1.8" at the bottom). You must be compiling against the 1.8 JDK (even if you're compiling in 1.6 mode). It's possible to do this in an IDE, for instance: to set the language compatibility mode to one version, but compile against the JDK of another version. I've done this on accident a couple times. Your friend is compiling on "normal" 1.7, which doesn't have that method declared.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 7

http://stackoverflow.com/a/24441575
type: Answer
upvote count: 1
score: 1
has body: The available wiggle room may be in the ambiguity of the requirement that ths ordering is consistent with its getDelay method. What does consistent mean? Can it mean using the getDelay values as the primary ordering, and allowing use of other attributes as a secondary ordering, to break ties for objects that have equivalent getDelayvalues? If so, you would be OK if the equals method requires equality of the getDelay values and all the attributes that the compareTo method uses for tie breaking, but does not require equality of any other attributes. This really means that the Delayed class must have value semantics.
answers question: http://stackoverflow.com/q/24353212
downvote count: 0

caliper
tags question: http://stackoverflow.com/q/24408828
tags question: http://stackoverflow.com/q/24304433
type: Tag
tag name: caliper

http://stackoverflow.com/a/24351300
has body: No you can not access any javacode from css
has comment: http://stackoverflow.com/comment/37652121
upvote count: 1
has comment: http://stackoverflow.com/comment/37650536
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24350971
score: 1
has comment: http://stackoverflow.com/comment/37675386
answers question: http://stackoverflow.com/q/24350971
has comment: http://stackoverflow.com/comment/37650715
has comment: http://stackoverflow.com/comment/37650647
type: Answer

http://stackoverflow.com/q/24295903
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: java-native-interface
has title: Infinite loop into a native JNI mthod
has comment: http://stackoverflow.com/comment/37545256
linked to: http://stackoverflow.com/q/8579657
has comment: http://stackoverflow.com/comment/37545457
downvote count: 0
favorite count: 0
has body: I need to call a JNI method that runs a infinite native loop inside, but it stops my java UI. Java code: FraMain.java: public class FraMain extends javax.swing.JFrame { public FraMain() { initComponents(); setExtendedState(java.awt.Frame.MAXIMIZED_BOTH); System.out.println("here starts"); new Thread(new Runnable() { @Override public void run() { new JNIEyes().iniciar(new XYListener() { @Override public void onFramePrecesed(double x, double y) { System.out.println(String.format("POINT %f - %f", x,y)); } }); } }).run(); System.out.println("continue charging UI"); } } JNIEyes.java: public class JNIEyes { static { System.load("/home/sparkler/NetBeansProjects/OpenEyes/dist/openeyes.so"); } public native void iniciar(XYListener listener); } XYListener.java is an interface with the method: void onFramePrecesed(double x, double y); and C++ code: JNIEXPORT void JNICALL Java_jnieyes_JNIEyes_iniciar (JNIEnv *env, jclass clase, jobject listener) { jclass objclass = env-&gt;GetObjectClass(listener); jmethodID methodID = env-&gt;GetMethodID(objclass,"onFramePrecesed", "(DD)V"); if(methodID == 0){ printf("\error\n"); return; } while (true) { Point point = process_image(); env-&gt;CallVoidMethod(listener,methodID,point.x,point.y); } } The loop itś working fine, and I am getting the x, y values into java onFramePrecesed method, but the UI never shows and the "continue charging UI" message is never printed. Thanks!
has comment: http://stackoverflow.com/comment/37545603
type: UnansweredQuestion
tagged with: multithreading
tagged with: c++
answer count: 0

http://stackoverflow.com/a/24343938
has comment: http://stackoverflow.com/comment/62137465
has comment: http://stackoverflow.com/comment/87902061
score: 74
upvote count: 74
has comment: http://stackoverflow.com/comment/88055606
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24338108
has comment: http://stackoverflow.com/comment/88009225
answers question: http://stackoverflow.com/q/24338108
has comment: http://stackoverflow.com/comment/62141252
type: Answer
has body: These openssl commands in the shell create an RSA key pair and write the public and private keys to DER formatted files. Here, the private key file is not password-protected (-nocrypt) to keep things simple. $ openssl genrsa -out keypair.pem 2048 Generating RSA private key, 2048 bit long modulus ............+++ ................................+++ e is 65537 (0x10001) $ openssl rsa -in keypair.pem -outform DER -pubout -out public.der writing RSA key $ openssl pkcs8 -topk8 -nocrypt -in keypair.pem -outform DER -out private.der Now that you have the DER files, you can read them in Java and use KeySpec and KeyFactory to create PublicKey and PrivateKey objects. public byte[] readFileBytes(String filename) throws IOException { Path path = Paths.get(filename); return Files.readAllBytes(path); } public PublicKey readPublicKey(String filename) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException { X509EncodedKeySpec publicSpec = new X509EncodedKeySpec(readFileBytes(filename)); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); return keyFactory.generatePublic(publicSpec); } public PrivateKey readPrivateKey(String filename) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException { PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(readFileBytes(filename)); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); return keyFactory.generatePrivate(keySpec); } With the public and private keys, you can encrypt and decrypt small amounts of data (that fit within your RSA modulus.) I recommend OAEP padding. public byte[] encrypt(PublicKey key, byte[] plaintext) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException { Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPWithSHA1AndMGF1Padding"); cipher.init(Cipher.ENCRYPT_MODE, key); return cipher.doFinal(plaintext); } public byte[] decrypt(PrivateKey key, byte[] ciphertext) throws NoSuchAlgorithmException, NoSuchPaddingException, Inv…
has comment: http://stackoverflow.com/comment/62136810

inheritance
tags question: http://stackoverflow.com/q/24273929
tags question: http://stackoverflow.com/q/24377273
tags question: http://stackoverflow.com/q/24331646
tags question: http://stackoverflow.com/q/24384547
tags question: http://stackoverflow.com/q/24404873
tag name: inheritance
tags question: http://stackoverflow.com/q/24298851
tags question: http://stackoverflow.com/q/24347304
tags question: http://stackoverflow.com/q/24281968
tags question: http://stackoverflow.com/q/24378375
tags question: http://stackoverflow.com/q/24289070
type: Tag
tags question: http://stackoverflow.com/q/24361610
tags question: http://stackoverflow.com/q/24346310
tags question: http://stackoverflow.com/q/24386459
tags question: http://stackoverflow.com/q/24310632
tags question: http://stackoverflow.com/q/24354386
tags question: http://stackoverflow.com/q/24361134
tags question: http://stackoverflow.com/q/24347939
tags question: http://stackoverflow.com/q/24291008
tags question: http://stackoverflow.com/q/24390287
tags question: http://stackoverflow.com/q/24280406
tags question: http://stackoverflow.com/q/24418722
tags question: http://stackoverflow.com/q/24333645
tags question: http://stackoverflow.com/q/24418660

http://stackoverflow.com/q/24325626
has comment: http://stackoverflow.com/comment/37605527
score: 7
tagged with: java
linked to: http://stackoverflow.com/q/48680399
has comment: http://stackoverflow.com/comment/63768344
has title: How to identify page breaks in a .docx document using Apache POI?
type: Question
has comment: http://stackoverflow.com/comment/37618808
upvote count: 7
has body: I am trying to locate page breaks in a .docx document using Apache POI. I am doing that in order to be able to find the page number of a paragraph. The code that I am using is : for (XWPFRun run : paragraph.getRuns()) { List&lt;CTBr&gt; brList = run.getCTR().getBrList(); if (brList != null &amp;&amp; !brList.isEmpty()) { for (CTBr br : brList) { if (br.getType() == STBrType.PAGE) { //page break detected } } } else { List&lt;CTEmpty&gt; lastRenderedPageBreakList = run.getCTR().getLastRenderedPageBreakList(); if (lastRenderedPageBreakList != null) { for (CTEmpty lastRenderedPageBreak : lastRenderedPageBreakList) { //page break detected } } } } The code works fine for most of the pages but not for all of them. Does anyone have any idea of what I am still missing?
tagged with: ms-word
favorite count: 0
tagged with: parsing
tagged with: http://stackoverflow.com/tag/docx
tagged with: apache-poi
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37619078
downvote count: 0
has comment: http://stackoverflow.com/comment/84975232

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/24382457
tags question: http://stackoverflow.com/q/24361750
tags question: http://stackoverflow.com/q/24294279
tags question: http://stackoverflow.com/q/24380752
tags question: http://stackoverflow.com/q/24329963
tag name: jfreechart
tags question: http://stackoverflow.com/q/24323150

http://stackoverflow.com/q/24378455
has title: Do you need import statements in non-driver classes?
type: AnsweredQuestion
has body: I am starting to learn how to use Netbeans so I can learn to create GUIs, but I saw that in the classes of my program the java.util classes throw a "could not find symbol" error in Netbeans. That makes me wonder: do I need to import java.util (and other APIs like javax.swing or java.io) in all classes of the program, or just the driver class?
tagged with: netbeans
score: 1
tagged with: java
upvote count: 1
tagged with: import
type: Question
has answer: http://stackoverflow.com/a/24378465
tagged with: class
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24378465

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

http://stackoverflow.com/q/24371485
has body: I'm trying to develop an ecore diagram from which code will be generated. I know that I want a particular variable to be static in the generated code so how do i denote that said variable needs to be static, in the ecore diagram?
has answer: http://stackoverflow.com/a/24372170
upvote count: 1
tagged with: ecore
answer count: 1
favorite count: 0
tagged with: static
has comment: http://stackoverflow.com/comment/37950158
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: eclipse-emf-ecore
has title: Denoting static variables in Ecore diagrams
type: Question
tagged with: emf

http://stackoverflow.com/comment/37784221
comment on: http://stackoverflow.com/q/24421065
score: 0
type: Comment
type: QuestionComment
has text: Don't know if I'm using the right one but just followed an example on custom on custom Iterator, but MyIterator it = cart.iterator() is required to use it. So it's the same problem as calling Node current = cart.getHead(); Both Node and MyIterator are inline classes.

http://stackoverflow.com/comment/37733604
has text: Would you try doing a command such as `create-turtles 5` and let us know if that works? `breed` statements are declarations, not commands, and can't be run by `command`.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24390853
type: QuestionComment

http://stackoverflow.com/q/24281702
tagged with: java
has title: Business Logic in Netty?
has answer: http://stackoverflow.com/a/24283949
has answer: http://stackoverflow.com/a/24283670
type: Question
tagged with: network-programming
score: 0
answer count: 2
has body: I'm developing a server based on the Netty libraby and I'm having a problem with how to structure the application with regards to business Logic. currenty I have the business logic in the last handler and that's where I access the database. The thing I can't wrap my head around is the latency of accessing the database(blocking code). Is it advisable to do it in the handler or is there an alternative? code below: public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { super.channelRead(ctx, msg); Msg message = (Msg)msg; switch(message.messageType){ case MType.SIGN_UP: userReg.signUp(message.user);// blocking database access break; } }
type: UnansweredQuestion
tagged with: netty

http://stackoverflow.com/q/24415338
answer count: 1
favorite count: 0
tagged with: android
type: AnsweredQuestion
downvote count: 0
score: 1
has body: My question for anyone that can answer concerns the generated resource IDs in android projects. I am familiar with what they are and that they are automatically created for me. I am wondering if any particular resource number, that is, the actual integer value, will be consistent across all devices when an android app is published in the marketplace. My assumption would be yes, the resources are just that: definitive (public static final) numbers that the device uses to map and track resources. As such, it would then seem that the number values should be the same across every installation (and also will never change). For example, if I have: public static final int button1=0x7f020011; in R.java, will this number be consistent across every device that installs the app from the marketplace? Or might each particular device have its own uniquely defined integer value that is used to refer to the resource "button1"? If anyone could offer me clarification or more information on this it would be very much appreciated. Thanks.
tagged with: java
has title: Resource IDs and Devices
type: Question
tagged with: r.java-file
has answer: http://stackoverflow.com/a/24415393
accepted answer: http://stackoverflow.com/a/24415393
upvote count: 1

http://stackoverflow.com/comment/37551628
has text: @John - I think they are an enumeration, and *not* a bit mask value.
type: AnswerComment
comment on: http://stackoverflow.com/a/24299345
type: Comment
score: 0

http://stackoverflow.com/comment/37559525
type: AnswerComment
comment on: http://stackoverflow.com/a/24303539
type: Comment
has text: And what are those error? Infact it doesnt showing any error for me
score: 0

http://stackoverflow.com/comment/37512674
type: QuestionComment
comment on: http://stackoverflow.com/q/24278868
score: 0
has text: Which package the class from?
type: Comment

freeze
tags question: http://stackoverflow.com/q/24342387
type: Tag
tag name: freeze

http://stackoverflow.com/comment/37523898
comment on: http://stackoverflow.com/q/24284559
score: 0
type: Comment
type: QuestionComment
has text: So how can you - or even can you - use `DecimalFormat` for simple input format validation? I'm pretty sure you can because (a long, long time ago) I seem to remember doing so in conjunction with `JFormattedTextField`.

http://stackoverflow.com/a/24373270
downvote count: 1
score: 0
answers question: http://stackoverflow.com/q/24373153
type: Answer
has body: This is Because Spring is not finding bean by opmanimpl, use @Autowired(required=true) @Qualifier("operationManagerImpl") private OperationManager opmanimpl ; DOC
upvote count: 1

http://stackoverflow.com/q/24282383
tagged with: java
has comment: http://stackoverflow.com/comment/37519240
type: Question
has title: Producer-Consumer multi threads syncing problems
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/37519310
has comment: http://stackoverflow.com/comment/37519573
tagged with: arraylist
downvote count: 2
has body: Hello All (first post)! Let me first say I'm still relatively new to programming in Java (C++ is my strong point) If this has already been answered please point me in the right direction, but my search skills have yet to yield what I am looking for. My problem I am running into is syncing between my consumer threads and not between my Producer/Consumer My assignment consists of finding prime number candidates from the producer thread than using multiple consumer threads to check the validity of each candidate: Using multiple threads, 1 producer thread that puts 'candidates' into an arraylist (has to be arraylists) called prime_candidates, the consumers than grab from the arraylist and check Consumers check, if it is a prime, than they put the prime into their own arraylist prime_list After 60 seconds the prime_list is written to file and continues I have successfully Synchronized the prime_candidates with the consumer (check) threads. But I cannot for the life of me figure out how to Sync the ArrayLists that the consumer threads produce. They all make their own and using the synchronized methods that I used from the Producer/Consumer doesn't work. PRODUCER THREAD import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.math.BigInteger; import java.util.ArrayList; import java.util.Date; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; public class GenerateThread implements Runnable{ // MAIN ARRAY LIST THAT STORES THE NUMBERS WHICH COULD BE CONSIDERED PRIME CANDIDATES private final ArrayList&lt;PrimeCandidate&gt; prime_candidates = new ArrayList(); private boolean alive = true; // MAIN VARIABLE THAT WILL CONTINUE TO RUN THE THREAD private boolean toggle = true; // VARIABLE THAT PAUSES THE PRODUCER // START: FOR PANEL LAYOUT // JPanel genPanel = new JPanel(); JPanel lastPane = new JPanel(); JLabel lastOutput = new JLabel(); JPanel queuePane = new JPanel…
has answer: http://stackoverflow.com/a/24282904
tagged with: synchronization
favorite count: 0
upvote count: 0
type: UnansweredQuestion
tagged with: multithreading

http-post
tags question: http://stackoverflow.com/q/24281737
type: Tag
tags question: http://stackoverflow.com/q/24366502
tags question: http://stackoverflow.com/q/24408942
tags question: http://stackoverflow.com/q/24299653
tags question: http://stackoverflow.com/q/24368531
tags question: http://stackoverflow.com/q/24418118
tags question: http://stackoverflow.com/q/24371297
tags question: http://stackoverflow.com/q/24404296
tag name: http-post

http://stackoverflow.com/q/24284447
has title: Java applet Security Warning checkbox
tagged with: security
has answer: http://stackoverflow.com/a/29371946
downvote count: 0
answer count: 1
tagged with: applet
favorite count: 0
accepted answer: http://stackoverflow.com/a/29371946
has body: Loading an applet after installing JRE 7 update 55 I get a "Security Warning" dialog. I check the checkbox for "Do not show this again for this app and web site" and click on "Allow". The applet loads. ![Security Warning window][https://i.sstatic.net/NN2Cx.png] However if i navigate away from the applet and load it again, the dialog comes up again. It is as if it does not remember the checkbox option. The Caller-Allowable-Codebase is set to * in the applets manifest file because the app needs to be deployed on any server designated by our client. Is this a jre u55/u60 bug? or is there something that needs to be done to make that checkbox functional? Additional information: The applet runs with no problem (displaying the warning window just once), I have the problem with repetetive displaying just on one environment. The main difference is, that it runs on Windows Server 2012 R2, IIS 8.5 I have checked the lap file where the choice is saved (in c:\Users\"user_name"\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\ search in subfolders for files containing "js.allowed.codebases=") and for other environment I have: js.allowed.codebases=https//trial.domain.com\:443 but for that one problematic, for the first time allowing, it creates the same, and with every other allowing, it saves the same web in the parameter as follows: js.allowed.codebases=https//trial.domain.com\:443/thttps//trial.domain.com\:443 next loop: js.allowed.codebases=https//trial.domain.com\:443/thttps//trial.domain.com\:443/thttps//trial.domain.com\:443 When I put the domain name into the Caller-Allowable-Codebase manifest parameter, the security window does not show up. And one more thing - when I load the page/applet on localhost (on that server), it works properly. It seems, that the problem could be also connected somehow with the access via domain? ...any idea? Thanks
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/39119947

http://stackoverflow.com/q/24355607
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/37660847
has title: java android display current time in multiple time zones
tagged with: java
tagged with: date
linked to: http://stackoverflow.com/q/2891361
duplicate of: http://stackoverflow.com/q/2891361
score: 0
has body: I am trying to write an app that will display the current time in the devices default timezone, and then display the time in different time zones, namely the current time in Kabul, Afghanistan where a good friend is stationed in the Army. Here is what I have thus far in my java code: Date dateLocal = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("HH:MM a"); String local = sdf.format(dateLocal); Date dateKabul = new Date(); TextView localTime = (TextView) rootView.findViewById(R.id.textView); localTime.setText(local); This will display the current device time just fine, although I might want standard time not military time. I need to find a way to display the different time zones using this general setup. The time zone I am looking to show is 8.5 hours ahead of EST. Any idea how I might be able to do this?
tagged with: android
has comment: http://stackoverflow.com/comment/37659092
answer count: 0
tagged with: time

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

http://stackoverflow.com/comment/37793752
comment on: http://stackoverflow.com/a/24427289
score: 0
type: Comment
has text: And webpage did open normally? If yes, that you set it wrong, if no eg. timeout, than you should show us some code sir.
type: AnswerComment

android
tags question: http://stackoverflow.com/q/24325135
tags question: http://stackoverflow.com/q/24344610
tags question: http://stackoverflow.com/q/24367435
tags question: http://stackoverflow.com/q/24353559
tags question: http://stackoverflow.com/q/24372679
tags question: http://stackoverflow.com/q/24399043
tags question: http://stackoverflow.com/q/24356008
tags question: http://stackoverflow.com/q/24267082
tags question: http://stackoverflow.com/q/24364273
tags question: http://stackoverflow.com/q/24307061
tags question: http://stackoverflow.com/q/24280823
tags question: http://stackoverflow.com/q/24379226
tags question: http://stackoverflow.com/q/24275653
tags question: http://stackoverflow.com/q/24353793
tags question: http://stackoverflow.com/q/24362281
tags question: http://stackoverflow.com/q/24276336
tags question: http://stackoverflow.com/q/24303468
tags question: http://stackoverflow.com/q/24371919
tags question: http://stackoverflow.com/q/24413547
tags question: http://stackoverflow.com/q/24284611
tags question: http://stackoverflow.com/q/24305220
tags question: http://stackoverflow.com/q/24364878
tags question: http://stackoverflow.com/q/24360845
tags question: http://stackoverflow.com/q/24396620
tags question: http://stackoverflow.com/q/24413686
tags question: http://stackoverflow.com/q/24351575
tags question: http://stackoverflow.com/q/24289592
tags question: http://stackoverflow.com/q/24399111
tags question: http://stackoverflow.com/q/24401209
tags question: http://stackoverflow.com/q/24293026
tags question: http://stackoverflow.com/q/24316520
tags question: http://stackoverflow.com/q/24337026
tags question: http://stackoverflow.com/q/24372932
tags question: http://stackoverflow.com/q/24317288
tags question: http://stackoverflow.com/q/24416459
tags question: http://stackoverflow.com/q/24289364
tags question: http://stackoverflow.com/q/24343668
tags question: http://stackoverflow.com/q/24398912
tags question: http://stackoverflow.com/q/24424830
tags question: http://stackoverflow.com/q/24384557
tags question: http://stackoverflow.com/q/24327031
tags question: http://stackoverflow.com/q/24306816
tags question: http://stackoverflow.com/q/24320077
tags question: http://stackoverflow.com/q/24398569
tags question: http://stackoverflow.com/q/24344485
tags question: http://stackoverflow.com/q/24361245
tags question: http://stackoverflow.com/q/24366219
tags question: http://stackoverflow.com/q/24418961
tags question: http://stackoverflow.com/q/24312016
tags question: http://stackoverflow.com/q/24347396
tags question: http://stackoverflow.com/q/24296911
tags question: http://stackoverflow.com/q/24338999
tags question: http://stackoverflow.com/q/24298301
tags question: http://stackoverflow.com/q/24419211
tags question: http://stackoverflow.com/q/24285532
tags question: http://stackoverflow.com/q/24400243
tags question: http://stackoverflow.com/q/24275533
tags question: http://stackoverflow.com/q/24374294
tags question: http://stackoverflow.com/q/24410886
tags question: http://stackoverflow.com/q/24293969
tags question: http://stackoverflow.com/q/24321841
tags question: http://stackoverflow.com/q/24399571
tags question: http://stackoverflow.com/q/24357981
tags question: http://stackoverflow.com/q/24339332
tags question: http://stackoverflow.com/q/24279606
tags question: http://stackoverflow.com/q/24362029
tags question: http://stackoverflow.com/q/24319333
tags question: http://stackoverflow.com/q/24379909
tags question: http://stackoverflow.com/q/24352923
tags question: http://stackoverflow.com/q/24334934
tags question: http://stackoverflow.com/q/24322758
tags question: http://stackoverflow.com/q/24383597
tags question: http://stackoverflow.com/q/24281737
tags question: http://stackoverflow.com/q/24341287
tags question: http://stackoverflow.com/q/24340296
tags question: http://stackoverflow.com/q/24404497
tags question: http://stackoverflow.com/q/24392132
tags question: http://stackoverflow.com/q/24287522
tags question: http://stackoverflow.com/q/24308255
tags question: http://stackoverflow.com/q/24308603

http://stackoverflow.com/q/24278311
accepted answer: http://stackoverflow.com/a/24278453
answer count: 3
has comment: http://stackoverflow.com/comment/37511915
has comment: http://stackoverflow.com/comment/37511452
has answer: http://stackoverflow.com/a/24278478
type: AnsweredQuestion
tagged with: java
has body: So I have this Void function that is suppose to read integers from a .txt file and it works for the most part except it only reads the first two lines I've tried everything to my power and nothing seems to work public static void load(Player p) { String line = ""; String token = ""; String token2 = ""; String[] token3 = new String[3]; boolean EndOfFile = false; BufferedReader characterfile = null; boolean File1 = false; try { characterfile = new BufferedReader(new FileReader("./cache/Player.txt")); File1 = true; } catch (FileNotFoundException fileex1) { } if (File1) { // new File ("./characters/"+playerName+".txt"); } else { System.out.println("character file not found."); } try { line = characterfile.readLine(); } catch (IOException ioexception) { System.out.println(": error loading file."); } while (EndOfFile == false &amp;&amp; line != null) { line = line.trim(); int spot = line.indexOf("="); if (spot &gt; -1) { token = line.substring(0, spot); token = token.trim(); token2 = line.substring(spot + 1); token2 = token2.trim(); token3 = token2.split("\t"); if (token.equals("Difficulty")) { Player.setDifficulty(Integer.parseInt(token2)); } else if (token.equals("Player Health")) { //System.out.println(token2); System.out.println("debug"); Player.setHealth(Integer.parseInt(token2)); } else if (token.equals("Player Strength")) { //System.out.println(token2); Player.setStrength(Integer.parseInt(token2)); } try { line = characterfile.readLine(); } catch (IOException ioexception1) { System.out.println("sent"); EndOfFile = true; } } try { characterfile.close(); } catch (IOException ioexception) { } } } this is my save method which functions as intended. public void save(Player p) { BufferedWriter characterfile = null; try { characterfile = new BufferedWriter(new FileWriter("./cache/Player.txt")); characterfile.write("Player Strength = "); characterfile.write(Integer.toString(Player.getStrength())); characterfile.newLine(); characterfile.write("Player Health = "); characterf…
type: Question
has title: Java BufferedReader reads two lines only
possible better answer: http://stackoverflow.com/a/24278408
has comment: http://stackoverflow.com/comment/37511473
tagged with: bufferedreader
has answer: http://stackoverflow.com/a/24278408
score: 0
has answer: http://stackoverflow.com/a/24278453

http://stackoverflow.com/q/24371204
tagged with: java
has title: Is it better to use a TreeSet or ArrayList when using a custom comparator
tagged with: set
type: Question
has body: I have implemented a graph. I want to sort a given subset of vertices with respect to their degrees. Therefore, I've written a custom comparator named DegreeComparator. private class DegreeComparator implements Comparator&lt;Integer&gt; { @Override public int compare(Integer arg0, Integer arg1) { if(adj[arg1].size() == adj[arg0].size()) return arg1 - arg0; else return adj[arg1].size() - adj[arg0].size()); } } So, which one of the below is more efficient? Using TreeSet public Collection&lt;Integer&gt; sort(Collection&lt;Integer&gt; unsorted) { Set&lt;Integer&gt; sorted = new TreeSet&lt;Integer&gt;(new DegreeComparator()); sorted.addAll(unsorted); return sorted; } Using ArrayList Collections.sort(unsorted, new DegreeComparator()); Notice that the second approach is not a function, but a one-line code. Intuitively, I'd rather choose the second one. But I'm not sure if it is more efficient.
accepted answer: http://stackoverflow.com/a/28604361
downvote count: 0
tagged with: sorting
tagged with: arraylist
answer count: 3
possible better answer: http://stackoverflow.com/a/24371295
has answer: http://stackoverflow.com/a/24371582
upvote count: 11
has answer: http://stackoverflow.com/a/24371295
favorite count: 0
has comment: http://stackoverflow.com/comment/37688849
has answer: http://stackoverflow.com/a/28604361
has comment: http://stackoverflow.com/comment/37688775
score: 11
type: AnsweredQuestion
tagged with: performance

http://stackoverflow.com/a/24274991
upvote count: 12
type: Answer
accepted answer of: http://stackoverflow.com/q/24274976
has comment: http://stackoverflow.com/comment/37505415
downvote count: 0
answers question: http://stackoverflow.com/q/24274976
has body: I'm looking at an MSDN page (http://msdn.microsoft.com/en-us/library/6a71f45d.aspx) that indicates that C# is just like Java. &amp;&amp; takes precedence over ||. It may be that your book is mistaken. (h/t Robert Harvey for updated link.)
score: 12
type: AcceptedAnswer

http://stackoverflow.com/q/24419489
accepted answer: http://stackoverflow.com/a/24419701
has comment: http://stackoverflow.com/comment/37779743
has body: I have written this code inside the run() method of the Reducer class in Hadoop @Override public void run(Context context) throws IOException, InterruptedException { setup(context); ConcurrentHashMap&lt;String, HashSet&lt;Text&gt;&gt; map = new ConcurrentHashMap&lt;String, HashSet&lt;Text&gt;&gt;(); while (context.nextKey()) { String line = context.getCurrentKey().toString(); HashSet&lt;Text&gt; values = new HashSet&lt;Text&gt;(); for (Text t : context.getValues()) { values.add(new Text(t)); } map.put(line, new HashSet&lt;Text&gt;()); for (Text t : values) { map.get(line).add(new Text(t)); } } ConcurrentHashMap&lt;String, HashSet&lt;Text&gt;&gt; newMap = new ConcurrentHashMap&lt;String, HashSet&lt;Text&gt;&gt;(); for (String keyToMerge : map.keySet()) { String[] keyToMergeTokens = keyToMerge.split(","); for (String key : map.keySet()) { String[] keyTokens = key.split(","); if (keyToMergeTokens[keyToMergeTokens.length - 1].equals(keyTokens[0])) { String newKey = keyToMerge; for (int i = 1; i &lt; keyTokens.length; i++) { newKey += "," + keyTokens[i]; } if (!newMap.contains(newKey)) { newMap.put(newKey, new HashSet&lt;Text&gt;()); for (Text t : map.get(keyToMerge)) { newMap.get(newKey).add(new Text(t)); } } for (Text t : map.get(key)) { newMap.get(newKey).add(new Text(t)); } } } //call the reducers for (String key : newMap.keySet()) { reduce(new Text(key), newMap.get(key), context); } cleanup(context); } my problem is that even if my input is too small it takes 30 minutes to run epsecially because of the newMap.put() call. If I put this command in comments then it runs quickly without any problems. As you can see I use ConcurrentHashMap. I didn't want to use it because I think that run() is called only once at each machine (it doesn't run concurrently) so I would not have any problem with a simple HashMap but if I replace the concurrentHashMap with the simple HashMap I am getting an error (concurrentModificationError). Does anyone have an idea about how to make it wor…
tagged with: java
has comment: http://stackoverflow.com/comment/37797711
has comment: http://stackoverflow.com/comment/37780075
type: Question
tagged with: hadoop
has comment: http://stackoverflow.com/comment/37779176
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37779134
has answer: http://stackoverflow.com/a/24419701
favorite count: 0
has title: how to avoid ConcurrentHashMap usage
upvote count: 2
has comment: http://stackoverflow.com/comment/37781112
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/37697215
has text: In the Class Constructor: public class TaskQueryClass { Connection conn = null; ResultSet rs = null; PreparedStatement pst = null; Statement stmt = null; private final String vehicleID
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24375795
type: Comment

http://stackoverflow.com/q/24318385
accepted answer: http://stackoverflow.com/a/24318462
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24318462
tagged with: spring
has body: I recently started learning Spring. As I am new to Spring several question comes to mind of mine. One of them is this: As stated here " All beans are instantiated as soon as the spring configuration is loaded by a container. org.springframework.context.ApplicationContext container follows pre-loading methodology." LINK 1 - Does this mean that all objects created with Spring ApplicationContext are Singletons ? I created this simple test @Component public class HelloService { private ApplicationContext context; public HelloService() { } @Autowired public HelloService(ApplicationContext context) { this.context = context; } public String sayHello() { return "Hi"; } } public class HelloApp { public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); Injector injector = Guice.createInjector(new AbstractModule() { @Override protected void configure() { } }); HelloService helloService1 = context.getBean(HelloService.class); System.out.println(helloService1); HelloService helloService2 = context.getBean(HelloService.class); System.out.println(helloService2); HelloService helloService3 = injector.getInstance(HelloService.class); System.out.println(helloService3); HelloService helloService4 = injector.getInstance(HelloService.class); System.out.println(helloService4); } } The out put was foo.bar.HelloService@191e8b08 // same instance foo.bar.HelloService@191e8b08 // same instance foo.bar.HelloService@6ba67ab5 // different instance foo.bar.HelloService@7ec23849 // different instance <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/sprin…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37587592
tagged with: java
type: Question
tagged with: dependency-injection
has title: Spring vs Guice instantiating objects
tagged with: guice
has comment: http://stackoverflow.com/comment/37587621

http://stackoverflow.com/a/24379410
score: 1
answers question: http://stackoverflow.com/q/24379332
has comment: http://stackoverflow.com/comment/37704349
has comment: http://stackoverflow.com/comment/37706447
has body: Column TRegnNo can not be null. You have to assign a (unique) value to this row.
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/37703931
has comment: http://stackoverflow.com/comment/37705786
has comment: http://stackoverflow.com/comment/37703729
downvote count: 0

http://stackoverflow.com/a/31733703
downvote count: 0
has body: I have this problem with version 3.0.7 , But was solved by changing to version 3.0.5 You should revert to 3.0.5 being the downloadable jar from this link : https://osmdroid.googlecode.com/files/osmdroid-android-3.0.5.jar https://code.google.com/p/osmdroid/issues/detail?id=289#c9
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24310756
answers question: http://stackoverflow.com/q/24310756
score: 2
type: AcceptedAnswer

http://stackoverflow.com/a/24358905
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24358864
type: Answer
has body: You can assign values like this t[10] = "ten"; t[11] = "eleven"; It is better to use ArrayList so there is no need of initializing the size first and it is dynamic too.
score: 1

http://stackoverflow.com/comment/37571060
score: 0
type: Comment
type: QuestionComment
has text: In objective-c it depends if you are using ARC or not. If you are, then removing all strong references to an object will immediately release it.
comment on: http://stackoverflow.com/q/24309549

http://stackoverflow.com/a/24352781
has body: There is a distinction between what is required at the Java language level and what is required at the bytecode level, which is much laxer. At the Java language level, you must have a constructor call as the first statement, but the compiler will insert one implicitly if you leave it out. At the bytecode level, the only requirement is that there is exactly one constructor call along every code path that returns normally, plus there are restrictions on what you can do with the this value prior to initialization. In particular, this means that The constructor call does not have to appear at the beginning of the method You can choose between calling different constructors based on conditional logic You can have exception handlers in a constructor, including catching exceptions thrown by the superclass constructor You can have no constructor calls at all if every code path throws an exception or goes into an infinite loop. The first option actually appears in Javac generated code, because in Java, you can pass an expression as argument to the constructor call, and the code to calculate that expression obviously has to happen before the constructor is called. But the rest of those options are impossible to accomplish in Java. Note that if you violate these restrictions, which is what will happen if you remove the constructor call from an ordinary Java constructor that returns normally, the constructor will now be invalid because it returns but has no ctor call. Thus, attempting to load the class will fail at runtime with a VerifyError. For completeness, here is what you can do with an uninitialized this value: compare it against null, and store (but not read) fields defined in the same class. Not much, right? But the ability to store fields defined in the same class prior to the ctor call is actually used by the Java compiler. There is no notion of inner classes at the bytecode level, so when you reference the outer class in the inner class, the compiler generates a hidd…
downvote count: 0
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/24349944

http://stackoverflow.com/comment/37793051
type: QuestionComment
comment on: http://stackoverflow.com/q/24425935
score: 0
has text: Yes but i have not found explicit examples concerning chats and I'm still not flexible with java.
type: Comment

http://stackoverflow.com/comment/37708987
type: AnswerComment
comment on: http://stackoverflow.com/a/24381782
type: Comment
has text: Yes, MappingJackson2HttpMessageConverter. I test it with PostMan, it works well.
score: 0

http://stackoverflow.com/q/24303006
score: 1
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: amazon-s3
tagged with: java
tagged with: ssl
type: Question
has title: javax.net.ssl.SSLPeerUnverifiedException: No peer certificate during amazons3 multipart upload
downvote count: 0
has body: I'm using Simpl3r, a simple high level Android API for file uploads using the Amazon S3 service, to upload media files to my bucket. On some uploads, I'm getting a SSLException error. Here's the code where the exception is thrown: 2014-06-12 20: 24: 86I/AmazonHttpClient(30949): Unable to execute HTTP request: No peer certificate 2014-06-12 20: 24: 87I/AmazonHttpClient(30949): javax.net.ssl.SSLPeerUnverifiedException: No peer certificate 2014-06-12 20: 24: 89I/AmazonHttpClient(30949): at org.apache.harmony.xnet.provider.jsse.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:137) 2014-06-12 20: 24: 90I/AmazonHttpClient(30949): at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:93) 2014-06-12 20: 24: 91I/AmazonHttpClient(30949): at org.apache.http.conn.ssl.SSLSocketFactory.createSocket(SSLSocketFactory.java:381) 2014-06-12 20: 24: 92I/AmazonHttpClient(30949): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:165) 2014-06-12 20: 24: 93I/AmazonHttpClient(30949): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164) 2014-06-12 20: 24: 94I/AmazonHttpClient(30949): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119) 2014-06-12 20: 24: 95I/AmazonHttpClient(30949): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360) 2014-06-12 20: 24: 97I/AmazonHttpClient(30949): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555) 2014-06-12 20: 24: 98I/AmazonHttpClient(30949): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487) 2014-06-12 20: 24: 100I/AmazonHttpClient(30949): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465) 2014-06-12 20: 24: 102I/AmazonHttpClient(30949): at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:295) 2014-06-12 20: 24: 107I/AmazonHttpC…
has answer: http://stackoverflow.com/a/24317638
linked to: http://stackoverflow.com/q/12095758
has comment: http://stackoverflow.com/comment/52119526
tagged with: android
answer count: 1

http://stackoverflow.com/comment/98366001
has text: Oh no! That must be very recent, because this workflow was working for me when I did it on my personal laptop just a couple weeks ago.
comment on: http://stackoverflow.com/a/46566569
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24360875
has comment: http://stackoverflow.com/comment/37669491
type: Answer
has comment: http://stackoverflow.com/comment/37669650
has comment: http://stackoverflow.com/comment/37669444
has comment: http://stackoverflow.com/comment/37669401
has body: Some important mistakes: First: you need to create a layout to define how is going to look this screen. Something like this (It is going to be called "activity_list_view_android_example.xml"): NOTE : When creating Listview with ListActivity then two things are MUST contain a ListView with the android:id attribute set to @android:id/list ( NOT android:id="@+id/list" ). if you will defined ListView with the android:id attribute set to @+id/list then it will give error. After you will need to inflate this xml file like your screen layout: super.onCreate(savedInstanceState); setContentView(R.layout.activity_list_view_android_example); Second error: in the xml that you define for each row of the list (in your code is called activity_main.xml) you have to define your row, not how the full list activity is going to look. So, you can't to have each row with the max hight of the screen, right? Fix it please: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="40dp" android:background="@drawable/mybackground" >
has comment: http://stackoverflow.com/comment/37669708
has comment: http://stackoverflow.com/comment/37669460
has comment: http://stackoverflow.com/comment/37669400
has comment: http://stackoverflow.com/comment/37669377
has comment: http://stackoverflow.com/comment/37669579
answers question: http://stackoverflow.com/q/24360686
score: 0
has comment: http://stackoverflow.com/comment/37669175
has comment: http://stackoverflow.com/comment/37669268
has comment: http://stackoverflow.com/comment/37669331

http://stackoverflow.com/comment/37650690
type: Comment
type: QuestionComment
has text: @CapsLock The line is a simple assignment. However, if you edit the question to explain what you do and don't understand about that line, it will be easier for us to help you.
score: 0
comment on: http://stackoverflow.com/q/24351426

http://stackoverflow.com/q/24277884
type: Question
has comment: http://stackoverflow.com/comment/37510596
score: -1
has answer: http://stackoverflow.com/a/24277962
downvote count: 2
answer count: 3
linked to: http://stackoverflow.com/q/40480
upvote count: 1
accepted answer: http://stackoverflow.com/a/24277916
possible better answer: http://stackoverflow.com/a/24277929
favorite count: 0
duplicate of: http://stackoverflow.com/q/40480
has answer: http://stackoverflow.com/a/24277929
has body: public class SubiectLicentaTrei { public static void main(String args[]) { double d = 12.34; ScadeUnitate su = new ScadeUnitate(); su.scadeUnitate(d); System.out.println(d); } } class ScadeUnitate { public void scadeUnitate(double d) { d = d - 1.0; } } Outputs 12.34 when I expect 11.34.
has answer: http://stackoverflow.com/a/24277916
type: AnsweredQuestion
tagged with: java
has title: Why doesn't this change the value

http://stackoverflow.com/q/24338927
has comment: http://stackoverflow.com/comment/37626194
has title: How should I fix this
accepted answer: http://stackoverflow.com/a/24339057
has comment: http://stackoverflow.com/comment/37626310
answer count: 1
has comment: http://stackoverflow.com/comment/37626235
has comment: http://stackoverflow.com/comment/37626232
has body: Ok guys Im stuck with this getting 10 errors, can someone help me? These errors are asking about identifier and stuff. Im stuck on this for quite a while now and just dont know where i went wrong? Did I not setup the variables right or what? This the errors: DemoSquare.java:36: error: expected public Square(Height, Width) ^ DemoSquare.java:36: error: expected public Square(Height, Width) ^ DemoSquare.java:36: error: ';' expected public Square(Height, Width) ^ DemoSquare.java:39: error: expected square_width= width; ^ DemoSquare.java:42: error: class, interface, or enum expected public int getheight() ^ DemoSquare.java:47: error: class, interface, or enum expected } ^ DemoSquare.java:48: error: class, interface, or enum expected public int getwidth(){ ^ DemoSquare.java:50: error: class, interface, or enum expected } ^ DemoSquare.java:51: error: class, interface, or enum expected public int computeSurfaceArea() ^ DemoSquare.java:54: error: class, interface, or enum expected surfaceArea = (getheight() * getwidth()); ^ DemoSquare.java:55: error: class, interface, or enum expected return surfaceArea; ^ DemoSquare.java:57: error: class, interface, or enum expected } ^ 12 errors Tool completed with exit code 1 `import java.util.Scanner; public class DemoSquare { public static void main(String args[]) { Scanner input = new Scanner(System.in); //Prints asking for Square user input System.out.println("Please enter square height: "); int square_height = input.nextInt(); System.out.println("Please enter square width: "); int square_width = input.nextInt(); //Prints asking for Cube user input System.out.println("Please enter cube height: "); int cube_height = input.nextInt(); System.out.println("Please enter cube width: "); int cube_width = input.nextInt(); System.out.println("Please enter cube depth: "); int cube_depth = input.nextInt(); //Prints for Square Area :) Square aSquare = new Square(square_height, square_width); System.out.println("Square Area is: "+ square.computeSur…
has answer: http://stackoverflow.com/a/24339057
score: -6
favorite count: 0
has comment: http://stackoverflow.com/comment/37626251
has comment: http://stackoverflow.com/comment/37626265
has comment: http://stackoverflow.com/comment/37626205
has comment: http://stackoverflow.com/comment/37626198
downvote count: 6
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37626212
has comment: http://stackoverflow.com/comment/37626324
type: Question
has comment: http://stackoverflow.com/comment/37626218
has comment: http://stackoverflow.com/comment/37626399
has comment: http://stackoverflow.com/comment/37626252
upvote count: 0

http://stackoverflow.com/q/24386621
type: AnsweredQuestion
tagged with: java
tagged with: aop
has comment: http://stackoverflow.com/comment/37719400
type: Question
has title: What is load-time weaving?
answer count: 1
downvote count: 1
favorite count: 0
has body: I am using load-time weaving for a spring (2.5.x) project but I don't know what it is the purpose of it in general. I tried little googling but didn't find the upcoming pages useful. The only thing I understood is that it is something about AOP. I noticed that it is used for older spring versions also wondering why is that?
has comment: http://stackoverflow.com/comment/37717171
has comment: http://stackoverflow.com/comment/37719150
has answer: http://stackoverflow.com/a/24387356
accepted answer: http://stackoverflow.com/a/24387356
upvote count: 12
has comment: http://stackoverflow.com/comment/37716972
score: 11
tagged with: spring
has comment: http://stackoverflow.com/comment/37718578

http://stackoverflow.com/comment/37836697
type: Comment
has text: @logoff the link you sent describes more or less the same problem, and doesn't provide a solution.
score: 0
comment on: http://stackoverflow.com/q/24403997
type: QuestionComment

http://stackoverflow.com/a/26581517
score: 0
has body: If you use Eclipse to add in DisplayMessageActivity.java then it derives from ActionBarActivity and adds in all the support code related to that for you. However if you are following the tutorial using commandline tools, then the ActionBarActivity stuff is not set up yet. They get to that in the next part of the tutorial. Instead, you can use the following code for DisplayMessageActivity.java: package com.example.yourname; import android.app.Activity; import android.os.Bundle; import android.content.Intent; import android.widget.EditText; import android.widget.TextView; public class DisplayMessageActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get the message from the intent Intent intent = getIntent(); String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE); // Create the text view TextView textView = new TextView(this); textView.setTextSize(40); textView.setText(message); setContentView(textView); } } You will also need to add into MainActivity.java when you are doing the step "Start the Second Activity": import android.view.View;
type: Answer
answers question: http://stackoverflow.com/q/24382959
accepted answer of: http://stackoverflow.com/q/24382959
type: AcceptedAnswer

http://stackoverflow.com/comment/37684477
type: QuestionComment
has text: Can you add your Android Manifest? [Edit] it into the post. Also, what version of Android are you running and compiling under?
type: Comment
comment on: http://stackoverflow.com/q/24369296
score: 0

http://stackoverflow.com/comment/37691316
type: AnswerComment
has text: @user3764748 I would avoid using Object Streams if you can, otherwise it looks ok to me.
type: Comment
comment on: http://stackoverflow.com/a/24371787
score: 0

annotations
tags question: http://stackoverflow.com/q/24420718
type: Tag
tags question: http://stackoverflow.com/q/24363663
tags question: http://stackoverflow.com/q/24307106
tags question: http://stackoverflow.com/q/24287552
tags question: http://stackoverflow.com/q/24393422
tags question: http://stackoverflow.com/q/24426083
tags question: http://stackoverflow.com/q/24391258
tags question: http://stackoverflow.com/q/24368555
tags question: http://stackoverflow.com/q/24416869
tags question: http://stackoverflow.com/q/24376216
tags question: http://stackoverflow.com/q/24273085
tags question: http://stackoverflow.com/q/24367384
tags question: http://stackoverflow.com/q/24370799
tags question: http://stackoverflow.com/q/24405094
tag name: annotations
tags question: http://stackoverflow.com/q/24326066
tags question: http://stackoverflow.com/q/24277473
tags question: http://stackoverflow.com/q/24382865
tags question: http://stackoverflow.com/q/24383781
tags question: http://stackoverflow.com/q/24400557
tags question: http://stackoverflow.com/q/24296326
tags question: http://stackoverflow.com/q/24382031

http://stackoverflow.com/a/24373537
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/37693433
upvote count: 1
has body: It's not. @Valid doesn't apply to @RequestParam annotated parameters. You can create a custom HandlerMethodArgumentResolver to do this or do the validation yourself in the method.
accepted answer of: http://stackoverflow.com/q/24372562
answers question: http://stackoverflow.com/q/24372562
has comment: http://stackoverflow.com/comment/37694489
type: AcceptedAnswer

http://stackoverflow.com/q/24270803
favorite count: 0
type: UnansweredQuestion
downvote count: 2
tagged with: multithreading
upvote count: 1
tagged with: java
has title: intrinsic lock via synchronized still allowing object's attributes to be modified.
has body: In below example, we have 3 threads. StartConsole thread runs first (since the other 2 threads are sleep for a bit). StartConsole takes control of the intrinsick lock of myObject. But it immediately relinquishes that intrinsic lock with the wait() invocation. That wait() invocation allows other threads to use that object. That means tcpResponder, which waited a second via Thread.sleep, can increment the values of myObject. What happens next is udpResponder begins execution after 2 seconds and it takes control of intrinsic lock via synchronized and until user types input, then it invokes notify() and hands over control back to startConsole where it then prints out “Received ack from unit”. Question: how come startService can continue to modify myObject when udpResponder took control of its intrinsic lock? I tested this example and the value of myObject's list attribute was being incremented the whole time. import java.util.Random; import java.util.Scanner; public class WaitNotifyThreads { MyObject myObject = new MyObject(); // notifier public void udpResponder() throws InterruptedException{ Scanner scanner = new Scanner(System.in); Thread.sleep(2000); synchronized (myObject) { System.out.println("Send ACK to socket server"); scanner.nextLine(); System.out.println("Return key pressed."); myObject.notify(); } scanner.close(); } public void startConsole() throws InterruptedException{ synchronized (myObject) { myObject.wait(); } System.out.println("Received ack from unit."); } public void tcpResponder() throws InterruptedException{ // Test if we can modify myObject // while startConsole has invoked wait() on it. Thread.sleep(1000); Random random = new Random(); while(true){ Thread.sleep(1000); myObject.add(random.nextInt(1000)); System.out.println("object size: " + myObject.list().size()); } } public void startService() { Thread udpResponder = new Thread(new Runnable(){ public void run() { try { udpResponder(); } catch (InterruptedException e) { e.printStackTrace(); } } …
type: Question
score: -1
has answer: http://stackoverflow.com/a/24271693
has comment: http://stackoverflow.com/comment/37497925
answer count: 1

http://stackoverflow.com/q/24299793
has title: Network related sample app in java
tagged with: java
type: Question
tagged with: tomcat
score: 0
has comment: http://stackoverflow.com/comment/37552294
answer count: 0
has body: I am testing one new build of jdk , against the network related aspects to check the performance of this build , so I needed any java sample application which does some I/O related stuff or like network related stuff for eg: video streaming which will be hosted on tomcat server. I am absolutely novice in java programming, so any links to the sample application would be very much helpful.
type: UnansweredQuestion
tagged with: tomcat7
has comment: http://stackoverflow.com/comment/37552440
has comment: http://stackoverflow.com/comment/37552311

http://stackoverflow.com/q/24363621
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24364163
has answer: http://stackoverflow.com/a/24364404
has comment: http://stackoverflow.com/comment/37677044
tagged with: java
has comment: http://stackoverflow.com/comment/37674182
has comment: http://stackoverflow.com/comment/37674389
type: Question
has comment: http://stackoverflow.com/comment/37674060
has comment: http://stackoverflow.com/comment/37674523
has comment: http://stackoverflow.com/comment/37674285
has answer: http://stackoverflow.com/a/24363799
has body: I know that the title is quite vague but I'm gonna explain what I'm looking for. I have to analyze a lot of data from various sources and I'd like to check if a value can be interpreted as a numeric value. I know there are regex and all but, the thing is that I have a lot of number formatted in various way, depending on where they come from : english number : 123,456.123 french number : 123 456,123 spanish number : 123.456,123 swiss number : 123'456.123 I'm looking for a library able to analyze those String and return either the numeric value or the corresponding pattern. It would save me a lot of time ! Thank's
score: 0
has comment: http://stackoverflow.com/comment/37673894
answer count: 3
linked to: http://stackoverflow.com/q/5888987
has title: Java library to analyze String and extract numbers
has comment: http://stackoverflow.com/comment/37673829
has comment: http://stackoverflow.com/comment/37674262
accepted answer: http://stackoverflow.com/a/24364163
tagged with: regex
possible better answer: http://stackoverflow.com/a/24363799

http://stackoverflow.com/comment/37616903
type: QuestionComment
comment on: http://stackoverflow.com/q/24333645
has text: "Each test method slightly varies"... sometimes the [Template method pattern](http://en.wikipedia.org/wiki/Template_method) can deal with duplication of that nature.
score: 0
type: Comment

http://stackoverflow.com/a/24313535
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37577938
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24313442
downvote count: 0
answers question: http://stackoverflow.com/q/24313442
has body: statement.executeUpdate("INSERT INTO my_table " + "VALUES("+myClass.getValue() + ", 'abcd',now())"); Your get-call was interpreted as a String because of the missing ' " '. Take a look at prepared statements, they are easy to read and use and you don't have to struggle with these problems. Prepared Statement Version (also a lot more secure because they are preventing SQL Injection): PreparedStatement pst = yourconnection.prepareStatement("INSERT INTO my_table VALUES(?,?,now())"; pst.setString(1,myClass.getValue()); pst.setString(2,"abcd"); pst.executeUpdate();

http://stackoverflow.com/q/24274224
tagged with: http-redirect
has answer: http://stackoverflow.com/a/24275528
type: Question
linked to: http://stackoverflow.com/q/2793150
tagged with: automation
tagged with: java
has comment: http://stackoverflow.com/comment/37506435
score: 0
has title: Automating URL page redirects and verifying the redirected page
answer count: 1
has body: I have more than 100's of URL's which will be redirecting (301 redirects) to a new page. Since i do not want to manually verify each link redirection, is there a way any tool/api or script that would aid me in automating these steps. Takes input URL, checks for expected URL and gives me the correct HTTP status. I did try to write a Java webdriver script which reads excel file to fetch Test URL, Expected URL &amp; Actual URL on execution. Script opens the browser and checks for the page redirection. Sometimes i need to login into the page to check redirection. I felt the entire program was taking more time to execute for 100's of URL's since its browser(GUI) based... Any script that can help me check for redirection and HTTP status would be great! Any feedback greatly appreciated. Cheers
type: UnansweredQuestion

http://stackoverflow.com/a/24421980
score: 1
answers question: http://stackoverflow.com/q/24421946
has body: if(s.matches("=\\s*\\d+")){ return true; } You should be use * that means "zero or more". Check this link
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/q/24269081
has answer: http://stackoverflow.com/a/24269287
tagged with: java
has comment: http://stackoverflow.com/comment/37493919
tagged with: eclipse
has title: Endorsed directory is missing
accepted answer: http://stackoverflow.com/a/24269287
has body: In eclipse I receive this error: "Endorsed directory ... is missing. You may need to perform a Maven command line build to create it." It seems to be related to this plugin in my pom: org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.7 1.7 ${project.build.directory}/endorsed The project builds successfully on the command line. I did a clean build in Eclipse but still have this error. What is wrong with my setup?
type: AnsweredQuestion
score: 2
downvote count: 0
favorite count: 0
type: Question
upvote count: 2
tagged with: maven
answer count: 1

http://stackoverflow.com/comment/37691088
comment on: http://stackoverflow.com/q/24372178
score: 0
has text: Then, why you can't add code to your worker `run()` which will check if `await()` returned 0 (last to arrive, hence barrier is released) and if it's 0, then worker will check whether all items were processed?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24341368
has comment: http://stackoverflow.com/comment/37630710
type: Question
upvote count: 3
duplicate of: http://stackoverflow.com/q/1939656
has title: Java Compile Error (HelloWorldApp); It shows "Error while writing" and "Access Denied"
downvote count: 1
has answer: http://stackoverflow.com/a/24341418
answer count: 1
tagged with: cmd
has comment: http://stackoverflow.com/comment/37630591
favorite count: 0
has comment: http://stackoverflow.com/comment/37630572
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37630767
has comment: http://stackoverflow.com/comment/37630638
linked to: http://stackoverflow.com/q/1939656
has comment: http://stackoverflow.com/comment/37630590
score: 2
tagged with: java
has body: I use Windows 7 and recently installed JDK (jdk1.8.0_05). (I've also installed JRE) As I'm new to Java, I complied the Hello World Java code given on Official Java Website: class HelloWorldApp { public static void main(String[] args) { System.out.println("Hello World!"); // Display the string. } } I saved the file as C:\HelloWorldApp.java And then in command prompt, I typed javac HelloWorldApp.java I got the following message: C:/HelloWorldApp.java:5: error: error while starting HelloWorldApp: C:\HelloWorldApp.class (Access is denied) class HelloWorldApp{ ^ 1 error PS: I even tried making the class public. Also, I've specified PATH variable as C:\Program Files\Java\jdk1.8.0_05\bin What may be the solution?
has comment: http://stackoverflow.com/comment/37630610

http://stackoverflow.com/a/30125361
has comment: http://stackoverflow.com/comment/75860506
downvote count: 1
has body: You can use with magic method $: &lt;T&gt; Predicate&lt;T&gt; $(Predicate&lt;T&gt; p) { return p; } Arrays.asList("1", "2", "3").stream().filter( $(e -&gt; e=="1").or(e -&gt; e=="2") ).count();
has comment: http://stackoverflow.com/comment/82917791
upvote count: 10
type: Answer
has comment: http://stackoverflow.com/comment/66358116
has comment: http://stackoverflow.com/comment/69681499
answers question: http://stackoverflow.com/q/24396544
score: 9
has comment: http://stackoverflow.com/comment/82918633

http://stackoverflow.com/q/24395913
tagged with: java
tagged with: hibernate
has body: I have two entities, topics and posts respectively. Here's many posts for one topics. So i had set up topics to OneToMany: class topics implements Serializable { ... @OneToMany(fetch = FetchType.EAGER, mappedBy = "topic") @OrderBy("date DESC") private List&lt;posts&gt; postsList; public List&lt;posts&gt; getPostsList() { return this.postsList; } } In posts entity are not any specific settings for topic field, just typical Integer. So problem is i can't fetch this postsList with EAGER fetch type, it will stay LAZY anyway: topics theTopic = (topics) session.load(topics.class, topic); List&lt;posts&gt; postsOfTopic = theTopic.getPostsList(); ... the List contains one object now, but it's full of nulls. Any ideas how to fix?
has comment: http://stackoverflow.com/comment/37736267
has comment: http://stackoverflow.com/comment/37736114
type: Question
has title: Hibernate @OneToMany EAGER doesn't work
has comment: http://stackoverflow.com/comment/37735415
score: 0
tagged with: relationship
answer count: 1
has comment: http://stackoverflow.com/comment/37736378
has comment: http://stackoverflow.com/comment/37735966
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24396972
accepted answer: http://stackoverflow.com/a/24396972

http://stackoverflow.com/q/24288508
accepted answer: http://stackoverflow.com/a/24288680
possible better answer: http://stackoverflow.com/a/24289065
tagged with: java
type: AnsweredQuestion
has title: Understanding the Builder/Factory Pattern
has answer: http://stackoverflow.com/a/24288680
type: Question
has body: I'm trying to clean up some code I have written for reading data. I have two sources of data: a database and a file. Both currently have separate classes and both classes have optional, non common, parameters in the constructors provided (at the moment traditional telescoping constructors).Both classes Implement interface MyData and when I instantiate the objects I always instantiate a MyData object. I want to merge these classes into a single class and make the instantiation as clean as possible but I can't figure out how. Im certain its a mixture of builder and factory patterns.The user should never have to see the underlying type MyDatabaseData and MyFileData, just MyData. Can someone help me by sketching out a similar example just to set me off in the right direction
tagged with: builder
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24289065
tagged with: design-patterns
tagged with: factory

http://stackoverflow.com/comment/37496260
score: 0
type: AnswerComment
has text: I added it... David. 298 is contentPane.add(textPane, BorderLayout.CENTER);
comment on: http://stackoverflow.com/a/24269250
type: Comment

http://stackoverflow.com/comment/37751208
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24403929
has text: i havn't a word longer than 11 , 11 just an example

http://stackoverflow.com/comment/37629314
comment on: http://stackoverflow.com/q/24338150
score: 0
type: Comment
type: QuestionComment
has text: If the method is `@Transactional`, returning from the method commits the transaction. So why not just return from the method?

http://stackoverflow.com/q/24318405
possible better answer: http://stackoverflow.com/a/30336529
type: Question
accepted answer: http://stackoverflow.com/a/24319175
tagged with: spring-boot
upvote count: 20
score: 20
has answer: http://stackoverflow.com/a/77233350
has answer: http://stackoverflow.com/a/24318687
tagged with: spring-data-rest
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24319175
has body: I have been trying to add spring validators to a spring-data-rest project. I followed along and setup the "getting started" application via this link: http://spring.io/guides/gs/accessing-data-rest/ ...and now I am trying to add a custom PeopleValidator by following the documents here: http://docs.spring.io/spring-data/rest/docs/2.1.0.RELEASE/reference/html/validation-chapter.html My custom PeopleValidator looks like package hello; import org.springframework.validation.Errors; import org.springframework.validation.Validator; public class PeopleValidator implements Validator { @Override public boolean supports(Class&lt;?&gt; clazz) { return true; } @Override public void validate(Object target, Errors errors) { errors.reject("DIE"); } } ...and my Application.java class now looks like this package hello; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration; @Configuration @EnableJpaRepositories @Import(RepositoryRestMvcConfiguration.class) @EnableAutoConfiguration public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Bean public PeopleValidator beforeCreatePeopleValidator() { return new PeopleValidator(); } } I would expect that POSTing to the http://localhost:8080/people URL would result in an error of some kind since the PeopleValidator is rejecting everything. However, no error is thrown, and the validator is never called. I have also tried manually setting up the validator as shown in section 5.1 of the spring-data-rest documentation. What am I missing?
answer count: 5
has answer: http://stackoverflow.com/a/31852256
tagged with: spring-validator
tagged with: spring
has answer: http://stackoverflow.com/a/30336529
type: AnsweredQuestion
has title: Spring-Data-Rest Validator
tagged with: java

http://stackoverflow.com/a/24378425
has body: Your answer is right, because java doesn't support multiple inheritance from classes. Java supports multiple inheritance from interfaces, and there is no any other inheritance. But you can use composition of classes, but that's another story.
has comment: http://stackoverflow.com/comment/37701697
has comment: http://stackoverflow.com/comment/37701628
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/37701659
score: 1
has comment: http://stackoverflow.com/comment/37701779
upvote count: 2
answers question: http://stackoverflow.com/q/24378375

http://stackoverflow.com/q/24397459
downvote count: 0
favorite count: 0
tagged with: scala
upvote count: 1
type: AnsweredQuestion
tagged with: playframework-2.0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am having a harder time than I would like to admit understanding the JSON documentation. I would like to convert this JSON result to Scala, but I'm pretty lost. I have tried a lot of things, but I'm still learning Scala as well, so none of it is really worth posting as I'm not even sure if it makes sense. I am using the Anorm ORM in Scala. The id is a Pk[Long] public static Result checkName(String clubname){ ObjectNode jresult = Json.newObject(); if (Club.clubExists(clubname)) { jresult.put("error", "Club Name Exists"); return status(409, jresult); // 409 - Conflict } else { jresult.put("status", "OK"); return ok(jresult); } } clubExists in the model: public static boolean clubExists(String name) { Club club = find.where().eq("club_name", name).findUnique(); return (club != null); } The rest of the model is pretty basic: @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "club_seq") public Long clubId; @Column(unique=true, length = 50) public String clubName; public Long creator; public DateTime created; public Club(String clubName, Long creator) { this.clubName = clubName; this.creator = creator; this.created = new DateTime(); } public static Finder&lt;Long, Club&gt; find = new Finder&lt;Long, Club&gt;(Long.class, Club.class); public static Club create(String name, Long creator) { Club club = new Club(name, creator); club.save(); return club; }
has title: Java JSON Controller to Scala?
type: Question
accepted answer: http://stackoverflow.com/a/24398124
answer count: 1
has answer: http://stackoverflow.com/a/24398124

http://stackoverflow.com/comment/37532690
comment on: http://stackoverflow.com/q/24289391
has text: `x.multiply(new BigDecimal(10));`
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/24367633
has body: I am not sure if you are targeting for this result but try this: resp.getWriter().print("\""+listCities.get(cptCity)+"\";"); for (int i= 0; i &lt; listAttraction.size(); i++){ resp.getWriter().print("\""+listAttraction.get(i)+"\";\""+listMainCategory.get(i)+"\";\""+listCategory.get(i)+"\";"); } resp.getWriter().println();
has comment: http://stackoverflow.com/comment/37681382
answers question: http://stackoverflow.com/q/24367469
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37681850
accepted answer of: http://stackoverflow.com/q/24367469
has comment: http://stackoverflow.com/comment/37681537
has comment: http://stackoverflow.com/comment/37681619
has comment: http://stackoverflow.com/comment/37681298
type: Answer
has comment: http://stackoverflow.com/comment/37681446

http://stackoverflow.com/comment/37741978
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24398544
has text: Why would it happen any other way? Until you exit the method, the EDT can't process all the new events to get your UI up to speed

manifest
tags question: http://stackoverflow.com/q/24306534
tags question: http://stackoverflow.com/q/24276390
tag name: manifest
type: Tag

http://stackoverflow.com/comment/37709119
type: Comment
has text: @FabianCook I don't say, that smth not working for me. It's my own opinion about static fields. I think it's not practice discussion, but ideology discussion. Author ask for better way, I suggest the way, which I prefer. I think there are a lot of patterns that somebody likes and don't likes.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24379951

http://stackoverflow.com/a/24287876
has body: You forgot to add ; at the end of the line. String url ="jdbc:sqlserver://cvdserver07\\sql2005r2:3333;databaseName=YES_dev;integratedSecurity=true";
answers question: http://stackoverflow.com/q/24287775
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37529402
has comment: http://stackoverflow.com/comment/37529481
accepted answer of: http://stackoverflow.com/q/24287775

http://stackoverflow.com/q/24395089
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24395518
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24395518
has answer: http://stackoverflow.com/a/24395180
possible better answer: http://stackoverflow.com/a/24395203
has title: Regex not valid when trying to invalidate alpha's and non-zeros
has body: Wrote a method which takes in a String and checks to see the follow conditions: If String is "quit", it will terminate the program. If the String is any value other than an integer, it should return "Invalid input ". Any negative integers and also 0 should return "Invalid input". However, when I passed in 10, it returned as "Invalid input"? Please advise: public static String validate(String input) { Pattern pattern = Pattern.compile(".*[^1-9].*"); StringBuilder results = new StringBuilder(); if (input.equals("quit")) { System.exit(1); } else if (!pattern.matcher(input).matches() == false) { results.append("Invalid input "); results.append("'"); results.append(input); results.append("'"); } return results.toString(); } What's wrong with what I am doing?
has answer: http://stackoverflow.com/a/24395203
linked to: http://stackoverflow.com/q/7036324
has comment: http://stackoverflow.com/comment/37733614
has comment: http://stackoverflow.com/comment/37733397
tagged with: regex
has comment: http://stackoverflow.com/comment/37733240
type: AnsweredQuestion

http://stackoverflow.com/q/24277738
tagged with: archive
type: Question
favorite count: 0
has title: Log4j not archiving all rolling file
tagged with: rollingfileappender
upvote count: 1
tagged with: log4j
answer count: 0
type: UnansweredQuestion
tagged with: logging
downvote count: 0
score: 1
has body: I am using Log4j for rolling and archiving old logs. My configuration is as below: log4j.appender.DAILY=org.apache.log4j.rolling.RollingFileAppender log4j.appender.DAILY.File=fas-pdp.log log4j.appender.DAILY.MaxFileSize=100KB log4j.appender.DAILY.MaxBackupIndex=500 log4j.appender.DAILY.rollingPolicy=org.apache.log4j.rolling.TimeBasedRollingPolicy log4j.appender.DAILY.rollingPolicy.activeFileName=myapp-pdp.log log4j.appender.DAILY.rollingPolicy.fileNamePattern=myapp-pdp.log.%d{yyyy-MM-dd}.gz I want to roll-over after 100 KB and maximum 500 back up file before log getting deleted. So when log size reaches 100 KB, log files are created as expected appending .1 and.2 in main file log. like:myapp-pdp.log.1 and myapp-pdp.log.2 etc. but at the end of day only one log file which is the latest one i.e myapp-pdp.log is getting archived as myapp- pdp.log.2014-06-17.gz. only. Backup index log files are not getting archived.
tagged with: java

http://stackoverflow.com/comment/37676815
comment on: http://stackoverflow.com/a/24365093
has text: have you tried to execute the query directly in sql*plus or in the database server
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37566823
type: AnswerComment
comment on: http://stackoverflow.com/a/24282155
score: 0
type: Comment
has text: @Andremoniy There are more function call in case of `dis.readByte()`. But you're right that they all can be inlined and they indeed do. OTOH, a long method body could prevent inlining or reduce loop unrolling. That said, even with Alexander's answer, it's still rather unclear what's going on.

http://stackoverflow.com/q/24381762
has answer: http://stackoverflow.com/a/24711109
has comment: http://stackoverflow.com/comment/37936042
has answer: http://stackoverflow.com/a/51341457
has comment: http://stackoverflow.com/comment/37716714
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38156009
tagged with: vaadin7
has comment: http://stackoverflow.com/comment/37718156
has comment: http://stackoverflow.com/comment/37722327
downvote count: 0
tagged with: session
tagged with: java
tagged with: vaadin
has comment: http://stackoverflow.com/comment/37712180
type: Question
answer count: 2
has body: I see this exception in Vaadin project. However, functionality does not really break. The code in run() method does what it is intented to complete, but this exception appears. E 140619 124701.131 [Thread-2] MainUI - Uncaught throwable: java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:188) at com.vaadin.server.VaadinSession$FutureAccess.get(VaadinSession.java:123) at com.vaadin.server.VaadinService.runPendingAccessTasks(VaadinService.java:1802) at com.vaadin.server.VaadinSession.unlock(VaadinSession.java:1012) at com.vaadin.server.VaadinService.ensureAccessQueuePurged(VaadinService.java:1763) at com.vaadin.server.VaadinService.accessSession(VaadinService.java:1729) at com.vaadin.server.VaadinSession.access(VaadinSession.java:1402) at com.vaadin.ui.UI.access(UI.java:1372) happens here ui.acccess(new Runnable() { @Override public void run() { //code here } } What I am supposed to do? Can I just catch exception and ignore it or somewhere there is a bug in my code? It uses @Push annotation for MainUI extends UI and there is code like: @Override protected void init(VaadinRequest request) { WrappedSession wrappedSession = request.getWrappedSession(); final String id = wrappedSession.getId(); log.info("Created new UI for session id {}", id); VaadinSession.getCurrent().setErrorHandler(new DefaultErrorHandler() { @Override public void error(com.vaadin.server.ErrorEvent event) { super.error(event); log.error("Uncaught throwable: ", event.getThrowable()); } }); ... } Another Example [This section added by a different author] I, Basil Bourque, am getting what seems to be the same exception in the same usage. The exception is thrown in production use (not development). Using Vaadin 7.1.3 with Push with Tomcat 8.0.12 on Java 8 Update 20 on Mac OS X Mountain Lion. Exception: Nov 04, 2014 4:45:50 AM com.vaadin.server.DefaultErrorHandler doDefa…
score: 4
favorite count: 0
tagged with: exception
has title: Vaadin UI.access() throws ExecutionException
has comment: http://stackoverflow.com/comment/37711522
upvote count: 4

http://stackoverflow.com/comment/37590318
has text: Are you *sure* that the gc even ran?
comment on: http://stackoverflow.com/q/24319914
score: 0
type: Comment
type: QuestionComment

hadoop
tags question: http://stackoverflow.com/q/24309747
tags question: http://stackoverflow.com/q/24346354
tags question: http://stackoverflow.com/q/24310049
tags question: http://stackoverflow.com/q/24419489
tag name: hadoop
tags question: http://stackoverflow.com/q/24353092
tags question: http://stackoverflow.com/q/24370338
tags question: http://stackoverflow.com/q/24279007
tags question: http://stackoverflow.com/q/24354054
tags question: http://stackoverflow.com/q/24274636
tags question: http://stackoverflow.com/q/24320115
type: Tag
tags question: http://stackoverflow.com/q/24417007
tags question: http://stackoverflow.com/q/24361094
tags question: http://stackoverflow.com/q/24358536
tags question: http://stackoverflow.com/q/24365596
tags question: http://stackoverflow.com/q/24333920
tags question: http://stackoverflow.com/q/24367527
tags question: http://stackoverflow.com/q/24349042
tags question: http://stackoverflow.com/q/24378545
tags question: http://stackoverflow.com/q/24390492
tags question: http://stackoverflow.com/q/24283803
tags question: http://stackoverflow.com/q/24277966
tags question: http://stackoverflow.com/q/24329735
tags question: http://stackoverflow.com/q/24359296
tags question: http://stackoverflow.com/q/24427122
tags question: http://stackoverflow.com/q/24316830
tags question: http://stackoverflow.com/q/24388829
tags question: http://stackoverflow.com/q/24387984
tags question: http://stackoverflow.com/q/24274281
tags question: http://stackoverflow.com/q/24293018
tags question: http://stackoverflow.com/q/24371062
tags question: http://stackoverflow.com/q/24280415
tags question: http://stackoverflow.com/q/24414469
tags question: http://stackoverflow.com/q/24370552
tags question: http://stackoverflow.com/q/24289535
tags question: http://stackoverflow.com/q/24354650

http://stackoverflow.com/q/24389295
tagged with: java
has title: NullPointerException FATAL EXCEPTION: Thread-5023 error
upvote count: 1
type: Question
answer count: 2
downvote count: 0
has body: I am trying to create a xmpp/jabber client on android, I am using the open source code of "conversations" and now I am running into the following error. I have tried searching but came to different answers, I do know that the value isn't null as I printed it to screen just before the crash, I am still very new in the android / java scene and not familiar with the thread error. What I have read is that it could be due to the thread updating the ui but cannot find the exact problem. Logcat: 06-24 16:13:27.287 9388-9415/com.test E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-5023 Process: com.test, PID: 9388 java.lang.NullPointerException at com.test.entities.MucOptions.processPacket(MucOptions.java:131) at com.test.parser.PresenceParser.parseConferencePresence(PresenceParser.java:35) at com.test.services.XmppConnectionService$5.onPresencePacketReceived(XmppConnectionService.java:275) at com.test.xmpp.XmppConnection.processPresence(XmppConnection.java:414) at com.test.xmpp.XmppConnection.processStream(XmppConnection.java:303) at com.test.xmpp.XmppConnection.processStream(XmppConnection.java:244) at com.test.xmpp.XmppConnection.switchOverToTls(XmppConnection.java:516) at com.test.xmpp.XmppConnection.processStream(XmppConnection.java:236) at com.test.xmpp.XmppConnection.connect(XmppConnection.java:175) at com.test.xmpp.XmppConnection.run(XmppConnection.java:219) at java.lang.Thread.run(Thread.java:841) MucOptions:131 item = packet.findChild("x","http://jabber.org/protocol/muc#user").findChild("item"); Complete MucOptions.java: public void processPacket(PresencePacket packet, PgpEngine pgp) { String[] fromParts = packet.getFrom().split("/"); if (fromParts.length&gt;=2) { String name = fromParts[1]; Log.i("MUC packet", packet.toString()+""); String type = packet.getAttribute("type"); Element item; if (type==null) { User user = new User(); item = packet.findChild("x","http://jabber.org/protocol/muc#user").findChild("item"); user.setName(name); user.setAffiliation(item.getAttribu…
has answer: http://stackoverflow.com/a/24389565
possible better answer: http://stackoverflow.com/a/24389422
has answer: http://stackoverflow.com/a/24389422
score: 1
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/24389565
has comment: http://stackoverflow.com/comment/37722164
type: AnsweredQuestion

http://stackoverflow.com/q/24372685
has answer: http://stackoverflow.com/a/24372737
type: AnsweredQuestion
has title: Rounding a double to the nearest of two doubles
has comment: http://stackoverflow.com/comment/37691011
favorite count: 0
has comment: http://stackoverflow.com/comment/37690980
type: Question
upvote count: 2
answer count: 1
accepted answer: http://stackoverflow.com/a/24372737
has body: Is there a method to round a double the nearest of two doubles? e.g.: I want to round numbers to the nearest between 3.3 and 3.7.. so: 3.4 --&gt; 3.3 3.472 --&gt; 3.3 3.5 --&gt; 3.7 3.573 --&gt; 3.7 And so on... Is there a method to do that?
tagged with: math
tagged with: java
tagged with: rounding
has comment: http://stackoverflow.com/comment/37690978
downvote count: 5
score: -3

http://stackoverflow.com/comment/37743011
type: Comment
type: QuestionComment
has text: Thanks @NotSoOldNick. Guess by "best" I mean cleanest, easiest to maintain, and of course as efficient as possible. @MadProgrammer using reverse() is out of the question, since javadoc says "This method runs in linear time." , meaning it iterates over a sorted Collection to sort it in reverse. That's not efficient at all, if I can just sort my Collection in reverse order from the start. Comparing o2 with o1 instead of o1 with o2 does sound nice. Will it do the job? Creating a `Comparator` with `o2.getMyField().compareTo(o1.getMyField())` instead of the one I proposed.
comment on: http://stackoverflow.com/q/24400175
score: 0

http://stackoverflow.com/comment/37600984
comment on: http://stackoverflow.com/q/24325598
score: 0
has text: Note that you can remove `.{0}` that is useless since it matches an empty string.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37512028
comment on: http://stackoverflow.com/q/24278648
type: Comment
type: QuestionComment
has text: Use "Comic Sans" or "Calibri" instead of "Serif".
score: 0

http://stackoverflow.com/comment/37791364
has text: @shmosel I will write a custom `keySet()` method as well.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24426329

http://stackoverflow.com/q/24353628
score: -1
has body: I'm writing a java Server(multithreaded)/Client chat for educational purposes. What is the best way to list all the connections (ip) from Server side? My Java knowledge is pretty basic :) Thank you
has comment: http://stackoverflow.com/comment/37655026
answer count: 2
has comment: http://stackoverflow.com/comment/37655085
downvote count: 1
tagged with: list
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24353679
has answer: http://stackoverflow.com/a/24353699
upvote count: 0
has title: Java - List all connections
favorite count: 0
type: Question
tagged with: connection

http://stackoverflow.com/a/24287116
type: Answer
answers question: http://stackoverflow.com/q/24286752
upvote count: 3
score: 3
has body: A very simple way: FileUtils.copyFile(screenshot, new File("d:\\pic\\report_" + System.currentTimeMillis() + ".jpg"); I just hope you don't do a screenshot every milliseconds. ;-) You can improve the readability by using a timestamp. java.text.SimpleDateFormat sdf = new SimpleDateFormat("YYYYMMDD'T'HHMMSSsss"); String newFileName = "d:\\pic\\report_" + sdf.format(new java.util.Date()) + ".jpg"; FileUtils.copyFile(screenshot, newFileName); Another solution might be to use a static counter in an helper class. private static int count = 0; public static void doScreenshot() { count++; String newFileName = "d:\\pic\\report_" + count + ".jpg"; FileUtils.copyFile(screenshot, newFileName); }
downvote count: 0

http://stackoverflow.com/a/24303179
type: Answer
has comment: http://stackoverflow.com/comment/37584370
has comment: http://stackoverflow.com/comment/37597676
score: 0
has body: Just following Jon Skeet's advice from the comments (reduce the code to a short but complete program) and using the answer from Rod_Algonquin, I'm left with a program that has no problem. Add more code and keep testing after each change to see when the program breaks so you can find what code is giving you trouble. public class NetworkObjectString { public static void main(String[] args) { Socket s = null; try { new Thread(new TcpServer()).start(); // Wait for socket server to start Thread.sleep(500); // TcpClient s = new Socket(InetAddress.getLocalHost(), 54321); RequestPacket rp = new RequestPacket(); rp.port = 123; rp.query = "dummy query"; ObjectOutputStream oos = new ObjectOutputStream(s.getOutputStream()); oos.writeObject(rp); oos.flush(); System.out.println("Client send rp.query: " + rp.query); DataInputStream dis = new DataInputStream(s.getInputStream()); String sq = dis.readUTF(); System.out.println("Client received query: " + sq); } catch (Exception e) { e.printStackTrace(); } finally { try { s.close(); } catch (Exception ignored) {} } } static class TcpServer implements Runnable { public void run() { ServerSocket ss = null; Socket s = null; try { s = (ss = new ServerSocket(54321)).accept(); ObjectInputStream ois = new ObjectInputStream(s.getInputStream()); RequestPacket rp = (RequestPacket) ois.readObject(); System.out.println("Server received rp: " + rp); String sq = rp.query + " from server"; DataOutputStream dos = new DataOutputStream(s.getOutputStream()); dos.writeUTF(sq); dos.flush(); System.out.println("Server send query: " + sq); } catch (Exception e) { e.printStackTrace(); } finally { try { ss.close(); } catch (Exception ignored) {} try { s.close(); } catch (Exception ignored) {} } } } // TcpServer static class RequestPacket implements Serializable { private static final long serialVersionUID = 1082443947105396312L; public String query; public int port; public String toString() { return port + " - " + query; } } }
has comment: http://stackoverflow.com/comment/37584080
answers question: http://stackoverflow.com/q/24299600
has comment: http://stackoverflow.com/comment/37588780

http://stackoverflow.com/a/24299538
upvote count: 10
downvote count: 0
answers question: http://stackoverflow.com/q/24280605
has body: Can you build the array as an object before writing it, rather than bothering with all the individual pieces? ObjectMapper mapper = new ObjectMapper(); ArrayNode array = mapper.createArrayNode(); int i = 0; while (i &lt; 6) { array.add(mapper.createArrayNode().add("" + i++).add("" + i++)); } System.out.println(array); Results in: [["0","1"],["2","3"],["4","5"]] If you're not dealing with several megabytes of data or very tight memory constraints, this might turn out to be more maintainable as well.
type: Answer
score: 10

http://stackoverflow.com/a/24330818
has comment: http://stackoverflow.com/comment/37610740
has body: You can probably use this regex : &lt;[\/]?ROOMS&gt;
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37611054
has comment: http://stackoverflow.com/comment/37610833
has comment: http://stackoverflow.com/comment/37610997
answers question: http://stackoverflow.com/q/24330677
has comment: http://stackoverflow.com/comment/37610786

http://stackoverflow.com/q/24363397
answer count: 1
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24363497
has body: Can I know how to display the name of item from database with checkbox beside which enable the users to delete the item when the checkbox is ticked. I have gone through several articles that mentioned about this but most of the articles are not displaying the data from database. They mentioned about the adapter but I am not very sure how does it function. Can anybody explain to me: how does the adapter work between listview, textview and checkbox how to detect and delete the selected item when the checkbox is ticked Below are the two different .xml that I have done::: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/wishlistln" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:padding="10dp" &gt; &lt;CheckBox android:id="@+id/wishlistcb" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="" /&gt; &lt;TextView android:id="@+id/wishlist" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_marginLeft="10dp" android:textSize="16sp" /&gt; &lt;/LinearLayout&gt; &lt;ListView android:id="@android:id/list" android:layout_width="wrap_content" android:layout_height="400dp" /&gt; Thank you.
has title: Display data from database in listview and delete checked item
tagged with: java
type: Question
tagged with: android-layout
has comment: http://stackoverflow.com/comment/37673433
score: 0
tagged with: android-checkbox

http://stackoverflow.com/a/45419730
upvote count: 1
answers question: http://stackoverflow.com/q/24335535
downvote count: 0
type: Answer
has body: Using the Google Cloud Java client libraries: import com.google.cloud.datastore.Datastore; import com.google.cloud.datastore.DatastoreOptions; import com.google.cloud.datastore.Entity; import com.google.cloud.datastore.Key; import com.google.cloud.datastore.KeyFactory; Datastore datastore = DatastoreOptions.getDefaultInstance().getService(); KeyFactory keyFactory = datastore.newKeyFactory().setKind("myKind"); Key key = keyFactory.newKey("myKey"); Entity entity = Entity.newBuilder(key) .set("name", "Jane Doe") .set("age", 40) .build(); datastore.put(entity); You can view the API documentation here, and don't forget you need to setup authentication correctly.
score: 1

http://stackoverflow.com/comment/37698907
score: 0
has text: Final Same error!! I change the MainActivity to ShowMap activity and I get stopped app
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24376864

http://stackoverflow.com/comment/37531622
score: 6
has text: Why not define a custom `Comparator<String>` and use `Collections.sort()`?
type: Comment
comment on: http://stackoverflow.com/q/24288908
type: QuestionComment

http://stackoverflow.com/q/24312853
tagged with: stringbuffer
has title: Why equals() is true after using StringBuffer.reverse?
has body: p.equals(w) is always coming true. Why ? http://ideone.com/JqLCDi import java.io.*; import java.util.Scanner; class TestClass { public static void main(String args[] ) throws Exception { Scanner s=new Scanner(System.in); int t=s.nextInt(); while(t--&gt;0){ String k=s.next(); StringBuffer p=new StringBuffer(k); int c=0; StringBuffer w=p.reverse(); if(p.equals(w)){ System.out.print(p.equals(w)); for(int i=0;i&lt;p.length();i++) { if(p.charAt(i)=='1'||p.charAt(i)=='0'||p.charAt(i)=='8') { c++;} } } if(c==p.length())System.out.println("YES"); else System.out.println("NO"); } } }
has comment: http://stackoverflow.com/comment/37576881
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/24312958
favorite count: 0
tagged with: reverse
score: 2
type: AnsweredQuestion
tagged with: equals
has comment: http://stackoverflow.com/comment/37576815
upvote count: 2
accepted answer: http://stackoverflow.com/a/24312958
possible better answer: http://stackoverflow.com/a/24312904
has answer: http://stackoverflow.com/a/24312904
type: Question
tagged with: stringbuilder
has answer: http://stackoverflow.com/a/24313006
tagged with: java

http://stackoverflow.com/q/24366785
has answer: http://stackoverflow.com/a/24375096
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/37679914
type: AnsweredQuestion
upvote count: 5
has comment: http://stackoverflow.com/comment/37680511
tagged with: java
linked to: http://stackoverflow.com/q/49002
accepted answer: http://stackoverflow.com/a/24367375
tagged with: caching
type: Question
answer count: 2
score: 5
has body: When designing java classes, what are the recommendations for achieving CPU cache friendliness? What I have learned so far is that one should use POD as much as possible (i.e. int instead of integer). Thus, the data will be allocated consecutively when allocating the containing object. E.g. class Local { private int data0; private int data1; // ... }; is more cache friendly than class NoSoLocal { private Integer data0; private Integer data1; //... }; The latter will require two separate allocations for the Integer objects that can be at arbitrary locations in memory, esp. after a GC run. OTOH the first approach might lead to duplication of data in cases where the data can be reused. Is there a way to have them located close to each other in memory so that the parent object and its' containing elements will be in the CPU cache at once and not distributed arbitrarily over the whole memory plus the GC will keep them together?
downvote count: 0
has comment: http://stackoverflow.com/comment/37987460
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/38125211
has answer: http://stackoverflow.com/a/24367375
has title: Tweaking java classes for CPU cache friendliness
possible better answer: http://stackoverflow.com/a/24375096
has comment: http://stackoverflow.com/comment/37695701

http://stackoverflow.com/comment/37837328
has text: Thanks. No clue for `path`, but I guess that `org.nlogo.api.ModelReader.emptyModelPath()` is for providing a trivial model. I `System.out.println`ed the result and saw what could be the content of a `.nlogo` file.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24410230

http://stackoverflow.com/comment/37805052
comment on: http://stackoverflow.com/a/24417758
score: 1
type: AnswerComment
type: Comment
has text: You can look in the DEBUG logs for messages related to application contexts. There is the root app context that gets created. And there is the web app context that has as a parent the root context. In logs you should see the bean names that one app context contains listed as a single line with commas. You can spot both app contexts in logs and look for the beans created. If you see the same controller defined in both these contexts then you know your app is in trouble.

http://stackoverflow.com/a/24294881
answers question: http://stackoverflow.com/q/24294540
score: 0
has body: This is just complicated code for no reason.. public class Sort { public static void calc(ArrayList&lt;Book&gt; bookList) { for (i = 0 ; i &lt; bookList.size() ; i++) { for (j = i+1; j &lt; bookList.size() ; j++) { if (bookList.get(i).getRating() &gt; bookList.get(j).getRating()) { Collections.swap(bookList, i, j); } System.out.println(bookList.get(out).getTitle() + " " + bookList.get(out).getRating()); } } } } Hope that helps
type: Answer
has comment: http://stackoverflow.com/comment/37543702

http://stackoverflow.com/q/24322564
tagged with: cryptography
tagged with: php
type: AnsweredQuestion
tagged with: java
type: Question
has body: I am using serpro's Android-PHP-Encrypt-Decrypt project to encrypt images with PHP and decrypt them with JAVA. The encryption and decryption is working if solely done in PHP but I am getting an error when I try to use java to encrypt that says 'java.lang.Exception: [encrypt] Input length not multiple of 16 bytes' and when I try to decrypt the image encrypted by php I get : 'java.lang.Exception: [decrypt] For input string: "nu"' Here is my code: Mcrypt php class by serpro: &lt;?php class MCrypt { private $iv = 'fedcba9876543210'; private $key = '0123456789abcdef'; function __construct() { } function encrypt($str, $isBinary = false) { $iv = $this-&gt;iv; $str = $isBinary ? $str : utf8_decode($str); $td = mcrypt_module_open('rijndael-128', ' ', 'cbc', $iv); mcrypt_generic_init($td, $this-&gt;key, $iv); $encrypted = mcrypt_generic($td, $str); mcrypt_generic_deinit($td); mcrypt_module_close($td); return $isBinary ? $encrypted : bin2hex($encrypted); } function decrypt($code, $isBinary = false) { $code = $isBinary ? $code : $this-&gt;hex2bin($code); $iv = $this-&gt;iv; $td = mcrypt_module_open('rijndael-128', ' ', 'cbc', $iv); mcrypt_generic_init($td, $this-&gt;key, $iv); $decrypted = mdecrypt_generic($td, $code); mcrypt_generic_deinit($td); mcrypt_module_close($td); return $isBinary ? trim($decrypted) : utf8_encode(trim($decrypted)); } protected function hex2bin($hexdata) { $bindata = ''; for ($i = 0; $i &lt; strlen($hexdata); $i += 2) { $bindata .= chr(hexdec(substr($hexdata, $i, 2))); } return $bindata; } } My Php class to encrypt images: &lt;?php require_once('MCrypt.php'); $file = file_get_contents($argv[1]); $mcrypt = new MCrypt(); $encrypted = $mcrypt-&gt;encrypt($file, true); //true to set is as binary file_put_contents($argv[1], $encrypted); serpro JAVA class: import java.security.NoSuchAlgorithmException; import javax.crypto.Cipher; import javax.crypto.NoSuchPaddingException; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; public…
possible better answer: http://stackoverflow.com/a/57216543
has answer: http://stackoverflow.com/a/24322834
has answer: http://stackoverflow.com/a/57216543
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/24322834
tagged with: mcrypt
has title: Encrypt with PHP decrypt with JAVA
tagged with: encryption

http://stackoverflow.com/q/24395090
tagged with: java
has answer: http://stackoverflow.com/a/24395145
downvote count: 2
has answer: http://stackoverflow.com/a/24395104
type: Question
accepted answer: http://stackoverflow.com/a/24395104
score: -2
answer count: 3
upvote count: 0
has body: As I was preparing for an interview about OOP, I came across this question. A inherits form B. B inherits from C. Will initializing A invoke constructor of C? What I know is that a constructed is not inherited. We have to use the super keyword to refer to the parent's constructor. Am I right?
has title: A inherits from B, B inherits from C. Will initializing A invoke constructor of C?
favorite count: 0
tagged with: constructor
has comment: http://stackoverflow.com/comment/37733179
has answer: http://stackoverflow.com/a/24395169
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24395145
tagged with: oop

http://stackoverflow.com/a/42305586
has comment: http://stackoverflow.com/comment/83332623
type: Answer
has body: Java JsonPath API found at jayway JsonPath might have changed a little since all the above answers/comments. Documentation too. Just follow the above link and read that README.md, it contains some very clear usage documentation IMO. Basically, as of current latest version 2.2.0 of the library, there are a few different ways of achieving what's been requested here, such as: Pattern: -------- String json = "{...your JSON here...}"; String jsonPathExpression = "$...your jsonPath expression here..."; J requestedClass = JsonPath.parse(json).read(jsonPathExpression, YouRequestedClass.class); Example: -------- // For better readability: {"store": { "books": [ {"author": "Stephen King", "title": "IT"}, {"author": "Agatha Christie", "title": "The ABC Murders"} ] } } String json = "{\"store\": { \"books\": [ {\"author\": \"Stephen King\", \"title\": \"IT\"}, {\"author\": \"Agatha Christie\", \"title\": \"The ABC Murders\"} ] } }"; String jsonPathExpression = "$.store.books[?(@.title=='IT')]"; JsonNode jsonNode = JsonPath.parse(json).read(jsonPathExpression, JsonNode.class); And for reference, calling 'JsonPath.parse(..)' will return an object of class 'JsonContent' implementing some interfaces such as 'ReadContext', which contains several different 'read(..)' operations, such as the one demonstrated above: /** * Reads the given path from this context * * @param path path to apply * @param type expected return type (will try to map) * @param &lt;T&gt; * @return result */ &lt;T&gt; T read(JsonPath path, Class&lt;T&gt; type); Hope this help anyone.
answers question: http://stackoverflow.com/q/24412511
score: 14
upvote count: 14
downvote count: 0

android-activity
tags question: http://stackoverflow.com/q/24372294
tags question: http://stackoverflow.com/q/24388150
tags question: http://stackoverflow.com/q/24268198
tags question: http://stackoverflow.com/q/24269858
tags question: http://stackoverflow.com/q/24332395
tags question: http://stackoverflow.com/q/24300694
tags question: http://stackoverflow.com/q/24378768
tags question: http://stackoverflow.com/q/24306372
tag name: android-activity
tags question: http://stackoverflow.com/q/24353834
tags question: http://stackoverflow.com/q/24340276
tags question: http://stackoverflow.com/q/24391933
tags question: http://stackoverflow.com/q/24315451
tags question: http://stackoverflow.com/q/24267082
tags question: http://stackoverflow.com/q/24327031
tags question: http://stackoverflow.com/q/24339332
tags question: http://stackoverflow.com/q/24379909
tags question: http://stackoverflow.com/q/24354489
tags question: http://stackoverflow.com/q/24316420
tags question: http://stackoverflow.com/q/24344610
type: Tag

http://stackoverflow.com/q/24379372
possible better answer: http://stackoverflow.com/a/24379605
tagged with: java
has comment: http://stackoverflow.com/comment/37703408
has comment: http://stackoverflow.com/comment/37703476
downvote count: 1
has answer: http://stackoverflow.com/a/24379834
type: Question
has comment: http://stackoverflow.com/comment/37703539
tagged with: max
has answer: http://stackoverflow.com/a/24379567
has title: How to find i maximum values from a file
has comment: http://stackoverflow.com/comment/37704638
score: 0
has answer: http://stackoverflow.com/a/24405347
has answer: http://stackoverflow.com/a/24380245
has comment: http://stackoverflow.com/comment/37703428
accepted answer: http://stackoverflow.com/a/24379567
answer count: 7
has comment: http://stackoverflow.com/comment/37703422
has comment: http://stackoverflow.com/comment/37703568
favorite count: 0
has answer: http://stackoverflow.com/a/24379887
has answer: http://stackoverflow.com/a/24379605
has answer: http://stackoverflow.com/a/24379660
upvote count: 1
has body: I am having a file content like this id value 1 56 2 5 3 90 4 12 5 234 6 90 I am trying to find max value from the file. for eg: i=2 Then my result should be 234,90.I should be able to return 2 maximum values. How to do this basically max can be identified by if (value &lt; min) { min = value; } if (value &gt; max) { max = value; } Along with this loop am I able to get 4 max values?
type: AnsweredQuestion

http://stackoverflow.com/a/24401007
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24400827
accepted answer of: http://stackoverflow.com/q/24400827
score: 0
has body: Your code is working well. Please check Class Path setting of your project in Eclipse.

http://stackoverflow.com/comment/37646476
type: QuestionComment
comment on: http://stackoverflow.com/q/24349379
has text: Read the documentation for Hashtable to see how it handles duplicates.
score: 0
type: Comment

http://stackoverflow.com/comment/37591747
has text: am not using eclipse IDE. but i wrote a sample program for regular exp practice but its seems nightmare.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24320607
score: 1

http://stackoverflow.com/a/24409178
answers question: http://stackoverflow.com/q/24409124
downvote count: 0
has comment: http://stackoverflow.com/comment/37761174
type: Answer
upvote count: 1
score: 1
has body: ServletRequest.getServerName() ServletRequest.getServerPort()

http://stackoverflow.com/a/24291718
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24291517
has body: Remove the \" and replace it with '. However, you don't actually have an id attribute so that isn't going to work. Try: "//input[@tabindex='5']" If the tab index is actually set there should only be one that has 5 in there. If there is more than one for some reason you can use the full xpath, but it is really not a good idea to utilize the entire xpath with numbered indexes. If anything changes these might break easily.

http://stackoverflow.com/comment/37777327
score: 1
has text: Oh, yes, sorry, I meant to write `%32s`. Brain fart.
type: Comment
comment on: http://stackoverflow.com/a/24418149
type: AnswerComment

generics
tags question: http://stackoverflow.com/q/24377454
tags question: http://stackoverflow.com/q/24294782
tags question: http://stackoverflow.com/q/24294907
tags question: http://stackoverflow.com/q/24404847
tags question: http://stackoverflow.com/q/24297541
tags question: http://stackoverflow.com/q/24396441
tags question: http://stackoverflow.com/q/24396654
tags question: http://stackoverflow.com/q/24280768
tags question: http://stackoverflow.com/q/24284897
tags question: http://stackoverflow.com/q/24338511
tags question: http://stackoverflow.com/q/24302535
tags question: http://stackoverflow.com/q/24397112
tags question: http://stackoverflow.com/q/24377475
tags question: http://stackoverflow.com/q/24318024
tags question: http://stackoverflow.com/q/24398476
tags question: http://stackoverflow.com/q/24340006
tags question: http://stackoverflow.com/q/24279645
tags question: http://stackoverflow.com/q/24309495
tags question: http://stackoverflow.com/q/24394491
tags question: http://stackoverflow.com/q/24289320
type: Tag
tags question: http://stackoverflow.com/q/24390991
tags question: http://stackoverflow.com/q/24421040
tags question: http://stackoverflow.com/q/24403976
tags question: http://stackoverflow.com/q/24273835
tags question: http://stackoverflow.com/q/24284013
tags question: http://stackoverflow.com/q/24350495
tags question: http://stackoverflow.com/q/24334953
tags question: http://stackoverflow.com/q/24310247
tags question: http://stackoverflow.com/q/24318434
tags question: http://stackoverflow.com/q/24420455
tags question: http://stackoverflow.com/q/24425791
tags question: http://stackoverflow.com/q/24382343
tags question: http://stackoverflow.com/q/24423598
tags question: http://stackoverflow.com/q/24366220
tags question: http://stackoverflow.com/q/24292827
tags question: http://stackoverflow.com/q/24359359
tags question: http://stackoverflow.com/q/24391123
tags question: http://stackoverflow.com/q/24269367
tags question: http://stackoverflow.com/q/24393245
tags question: http://stackoverflow.com/q/24380930
tags question: http://stackoverflow.com/q/24314650
tag name: generics
tags question: http://stackoverflow.com/q/24308408
tags question: http://stackoverflow.com/q/24328989
tags question: http://stackoverflow.com/q/24379283
tags question: http://stackoverflow.com/q/24379678

http://stackoverflow.com/comment/37573663
has text: You should NOT invoke any fireXXX() method. That is the job of the TableModel.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24311168

http://stackoverflow.com/comment/37826863
type: Comment
comment on: http://stackoverflow.com/a/24382137
has text: was successful in configuring the SSL ,here's the link to do it. http://tomcat.apache.org/tomcat-8.0-doc/ssl-howto.html
type: AnswerComment
score: 0

http://stackoverflow.com/q/24390456
type: Question
has comment: http://stackoverflow.com/comment/37724724
has comment: http://stackoverflow.com/comment/37725135
downvote count: 0
has comment: http://stackoverflow.com/comment/37725079
has comment: http://stackoverflow.com/comment/37724825
has comment: http://stackoverflow.com/comment/37725434
has comment: http://stackoverflow.com/comment/37724335
has title: Will an object in a List be garbage collected?
has comment: http://stackoverflow.com/comment/37724932
answer count: 1
has comment: http://stackoverflow.com/comment/37725787
has comment: http://stackoverflow.com/comment/37724754
has body: I have a class that looks something like this: public class MyClass() { private List&lt;Thread&gt; threads = new ArrayList&lt;&gt;(); ... public MyClass() { for (int i = 0; i &lt; 10 ; i++) { Thread t = new Thread(); threads.add(t); t.start(); } } } In my service, there is a single instance of MyClass that hangs around for the duration that the service runs. Via JConsole, I have observed the 10 threads get created and start doing their processing, so I know that this set up works -- to some extent. My problem comes up when the system gets under load. When I send several thousand large objects to the service, the above threads spontaneously die. (As I observe in JConsole.) Since there's no logic defined to actually tear down the threads and/or clear the threads List, I'm wondering if it's possible that Java has garbage collected the actual objects from inside of the threads List and just left some kind of weak reference behind. Questions: Under heavy load, is it possible that Java garbage collects the contents of the threads List? Is there another way that the contents of the threads List could spontaneously go away? Eg. that the threads could somehow get stopped without any explicit code ever calling some kind of cleanup logic. (Yes, I know this is poorly designed code, but it is legacy code and I'm just trying to figure out what is currently happening before I go try and fix the implementation.)
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/24393339
accepted answer: http://stackoverflow.com/a/24393339
has comment: http://stackoverflow.com/comment/37725547
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/37725906
has comment: http://stackoverflow.com/comment/37725015
has comment: http://stackoverflow.com/comment/37725076
has comment: http://stackoverflow.com/comment/37725483
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37725719

http://stackoverflow.com/q/24394638
tagged with: tree-traversal
downvote count: 0
answer count: 0
favorite count: 0
type: Question
has title: Best sorting and formatting algorithm for flat data to directed graph tree
score: 1
tagged with: parsing
has comment: http://stackoverflow.com/comment/54493797
upvote count: 1
has comment: http://stackoverflow.com/comment/37733412
has comment: http://stackoverflow.com/comment/37737181
has body: Given flat data like this: 01001, Butter, salted 01002, Butter, whipped, with salt 01145, Butter, without salt 04601, Butter, light, stick, with salt 04602, Butter, light, stick, without salt What's the best approach to convert into this: Butter (01001, 01002, 01145, 04601, 04602) -&gt; salted (01001) -&gt; whipped (01002) -&gt; with salt (01002) -&gt; without salt (01145) -&gt; light (04601, 04602) -&gt; stick (04601, 04602) -&gt; with salt (04601) -&gt; without salt (04602) I was thinking of recursive sorting first, but I realized there may be a lot of string comparisons to be efficient.
tagged with: algorithm
has comment: http://stackoverflow.com/comment/37760526
tagged with: java
type: UnansweredQuestion
tagged with: graph

http://stackoverflow.com/a/24286826
downvote count: 0
answers question: http://stackoverflow.com/q/24286546
has comment: http://stackoverflow.com/comment/37527410
upvote count: 2
has body: If you want Spring to manage MyViewService you have to tell Spring how to create an instance of it. If you're using XML configuration: &lt;bean id="myViewService" class="org.membersound.MyViewService"&gt; &lt;constructor-arg index="0" ref="ref_to_list" /&gt; &lt;constructor-arg index="1" ref="ref_to_object" /&gt; &lt;/bean&gt; If you're using Java configuration then you'd call the constructor yourself in your @Beanannotated method. Check out the Spring docs on this topic. To address a comment you made to another answer, you can create a List bean in XML as shown in the Spring docs. If the list data isn't fixed (which it's probably not) then you want to use an instance factory method to instantiate the bean. In short, the answers you seek are all in the Spring docs :)
accepted answer of: http://stackoverflow.com/q/24286546
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/37527935
has comment: http://stackoverflow.com/comment/37527674
type: AcceptedAnswer

http://stackoverflow.com/q/24358819
has body: I have made a few MC plugins, and would like to know if this is possible. If so, would you mind helping me a bit? If I need to provide more info, please don't hesitate to ask &lt;3
has answer: http://stackoverflow.com/a/24371033
tagged with: plugins
favorite count: 0
score: -1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37686323
downvote count: 1
tagged with: java
tagged with: bukkit
has title: Is there a way to add code to make the dev of a plugin have all of the commands by default?
has comment: http://stackoverflow.com/comment/37861749
type: Question
upvote count: 0
answer count: 1
tagged with: minecraft

http://stackoverflow.com/q/24423617
has body: I want to select items with keywords facebook and twitter in it. But the problem is the first item which is "aggregator" always gets selected. Can anyone tell me what is wrong in the code. Thanks. int j=0; jList1.setModel(listmodel); for (int i=0;i&lt;listmodel.size();i++){ if (listmodel.getElementAt(i).toString().indexOf("facebook")!=-1||listmodel.getElementAt(i).toString().indexOf("twitter")!=-1){ a[j]=i; j++; } } jList1.setSelectedIndices(a);
tagged with: swing
has comment: http://stackoverflow.com/comment/37786485
has answer: http://stackoverflow.com/a/24424045
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37786518
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24424598
has answer: http://stackoverflow.com/a/24423780
type: Question
has comment: http://stackoverflow.com/comment/37786423
tagged with: listbox
has title: First item getting selected in listbox
possible better answer: http://stackoverflow.com/a/24423780
accepted answer: http://stackoverflow.com/a/24424045
answer count: 3
tagged with: jlist
tagged with: applet
has comment: http://stackoverflow.com/comment/37786436

http://stackoverflow.com/comment/37666923
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24359679
type: Comment
has text: @user3685048, there is no return statement at end of the method. You must put return statement at end of the method

http://stackoverflow.com/comment/37513161
type: Comment
score: 4
comment on: http://stackoverflow.com/q/24279192
has text: Unary operators, perhaps? See [here](https://stackoverflow.com/questions/22009916/how-does-different-spacing-affect-the-unary-operator)
type: QuestionComment

http://stackoverflow.com/q/24384508
tagged with: httprequest
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/24384634
accepted answer: http://stackoverflow.com/a/24384634
has title: Detect the end of an HTTP Request in Java
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37713252
linked to: http://stackoverflow.com/q/4824451
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has body: Im trying to design a Java proxy program, but my java program has issues reading an entire HTTP request. I used the InputStream object isObj to try to obtain data: isObj.read(byteBuff) But this often results in the data not getting read completely. i.e in case of a POST request, sometimes, the HTTP headers alone are read while the POST data is not read. So, I tried to use the below to read the data fully. ByteArrayOutputStream baos=new ByteArrayOutputStream(); while((len=isObj.read(tempBuff))&gt;0){ baos.write(tempBuff,0,len); } byte[] byteBuff=baos.toByteArray(); However, this method also blocked at the isObj.read(tempBuff) function. Tried another method using the DataInputStream like: DataInputStream dis=new DataInputStream(isObj); byte[] byteBuff=new byte[8196]; dis.readFully(byteBuff); This also blocked at the readFully() function. I read through and came across this Detect end of HTTP request body which indicates that the reason is that there is no way we can identify when the data will get over(unless it is for a response). And it asks us to use the Content-Length header to detect the final length. Is this absolutely the only way to read HTTP Requests? Or is there any other library which does this automatically?
tagged with: http

http://stackoverflow.com/q/24422319
has answer: http://stackoverflow.com/a/24422986
upvote count: 1
answer count: 1
has body: I have a java source code which would be compiled at runtime. I'm compiling the source code (present as a string) and loading it to a class as below : JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); compiler.run(null, null, null, sourceFile.getPath()); // Load and instantiate compiled class. URLClassLoader classLoader = URLClassLoader.newInstance(new URL[] { root.toURI().toURL() }); Class&lt;?&gt; cls = Class.forName("TakeAdvantageOftMapComponents", true, classLoader); This class contains a method which I need to call named runJob. Normally I'd do it like: TakeAdvantageOftMapComponents c = new TakeAdvantageOftMapComponents(); c.runJob(new string[]); Now this same method is present in the class which I compile at runtime. But how do I call it ?
has comment: http://stackoverflow.com/comment/37784224
favorite count: 0
has title: Calling custom method of a class compiled at runtime
linked to: http://stackoverflow.com/q/160970
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/37562754
comment on: http://stackoverflow.com/q/24305418
has text: ...and change the password asap
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24367799
type: AnsweredQuestion
has title: Is it possible to detect a button clicked inside a table cell?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37715266
linked to: http://stackoverflow.com/q/11176480
type: Question
linked to: http://stackoverflow.com/q/5555938
answer count: 2
accepted answer: http://stackoverflow.com/a/24369563
possible better answer: http://stackoverflow.com/a/24368133
downvote count: 0
has answer: http://stackoverflow.com/a/24368133
favorite count: 0
tagged with: jtable
tagged with: tablecelleditor
has body: I a swing application in which i have a table inside it i'm putting a panel that can contain a button.The code is follow public class MyCellDataRenderer implements TableCellRenderer, TableCellEditor { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { MyCellData myCellData = (MyCellData) table.getValueAt(row, column); JPanel panel = GridBagHelper.createPanel(); if (myCellData.isATableHeader()) { panel.setBackground(myCellData.getCellBackgroundColor()); panel.add(myCellData.getContenant(), GridBagHelper.createGridBagConstraints(0, 0, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH)); return panel; } boolean condition=true; if (condition==true) { panel.setBackground(myCellData.getCellBackgroundColor()); panel.add(myCellData.getContenant(), GridBagHelper.createGridBagConstraints(0, 0, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH)); return panel; } panel.setBackground(myCellData.getCellBackgroundColor()); panel.add(myCellData.getContenant(), GridBagHelper.createGridBagConstraints(0, 0, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH)); return panel; } My question is can i detect a click on a button that contains inside the panel or not? I'm asking about if it's possible technically or not? Thanks
has comment: http://stackoverflow.com/comment/37683306
has answer: http://stackoverflow.com/a/24369563
upvote count: 1
tagged with: swing
tagged with: jbutton

http://stackoverflow.com/q/24376075
type: AnsweredQuestion
has body: I am trying to implement push notifications in my existing android app using PushBots (http://www.pushbots.com) I have followed all the steps mentioned checked and rechecked the steps. But when I run the app it suddenly crashes but never shows any error. I am sure about the keys in the MainActvitiy.java they are correct. I have simply added the .jar into the libs folder ![enter image description here][1] MainActivity.java ---------------- public class MainActivity extends Activity { private String SENDER_ID = "1017942666064"; private String PUSHBOTS_APPLICATION_ID = "53a8a9d71d0ab1c1428b4569"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Pushbots.init(this, SENDER_ID,PUSHBOTS_APPLICATION_ID); setContentView(R.layout.activity_main); } @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; } } Manifest.xml <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> <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.WAKE_LOCK" /> <uses-permission android:name="android.permission.DISABLE_KEYGUARD"/> <permission android:name="com.example.pushboss.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="com.example.pushboss.permission.C2D_MESSAGE" /> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="com.example.pushboss.MESSAGE" /> <category android:name="android.intent.category.DEFAULT" /> <action android:name="com.google.android.c2dm.intent.…
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24376631
tagged with: eclipse
tagged with: push-notification
answer count: 1
accepted answer: http://stackoverflow.com/a/24376631
has title: how to add push notifications in my existing android app using pushbots
tagged with: android

http://stackoverflow.com/comment/37741273
comment on: http://stackoverflow.com/a/24399296
has text: i know foreach acts like the for loop but my question is whether (i)-> System.out.print(ints.get(i-1)) is acting like for loop cuz in this code Integer maxInt = ints.stream() .max(Comparator.comparing(i -> i)) .get(); does i->i acts like the for loop? cuz as you see there is no foreach in the line.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37629240
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24340643
score: 0
has text: It's simple there is no item in the `list1`. It's empty.

http://stackoverflow.com/comment/83919113
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24316377
has text: If you can convert GRIB file in other plain format like csv, tsv. You can use dbis to migrate without single line of code. Check detail https://dbisweb.wordpress.com/

http://stackoverflow.com/comment/37672156
has text: Check out my answer below
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24361591

http://stackoverflow.com/comment/42420021
has text: @Aborted If you are on a NTFS file-system (like Windows) you can't have colons in file names, maybe that's why (i may be wrong)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24280712

http://stackoverflow.com/comment/37511285
score: 0
type: Comment
has text: Wouldn't it also work to overload constructor ```public MyClass(int value) { this(new AnotherClass(value));}``` ?
comment on: http://stackoverflow.com/a/24278228
type: AnswerComment

http://stackoverflow.com/q/24312200
tagged with: quaternions
tagged with: java
has body: Quaternion can describe not only rotation, but also an orientation, i.e. rotation from initial (zero) position. I was wishing to model smooth rotation from one orientation to another. I calculated start orientation startOrientation and end orientation endOrientation and was wishing to describe intermediate orientations as startOrientation*(1-argument) + endOrientation*argument while argument changes from 0 to 1. The code for monkey engine update function is follows: @Override public void simpleUpdate(float tpf) { if( endOrientation != null ) { if( !started ) { started = true; } else { fraction += tpf * speed; argument = (float) ((1 - Math.cos(fraction * Math.PI)) / 2); orientation = startOrientation.mult(1-argument).add(endOrientation.mult(argument)); //orientation = startOrientation.mult(1-fraction).add(endOrientation.mult(fraction)); log.debug("tpf = {}, fraction = {}, argument = {}", tpf, fraction, argument); //log.debug("orientation = {}", orientation); rootNode.setLocalRotation(orientation); if( fraction &gt;= 1 ) { rootNode.setLocalRotation(endOrientation); log.debug("Stopped rotating"); startOrientation = endOrientation = null; fraction = 0; started = false; } } } } The cosine formula was expected to model smooth accelerating at the beginning and decelerating at the end. The code works but not as expected: the smooth rotation starts and finishes long before fraction and argument values reach 1 and I don't understand, why. Why the orientation value reaches endOrientation so fast?
accepted answer: http://stackoverflow.com/a/24316128
type: Question
has title: Smooth rotation with quaternions
tagged with: rotation
tagged with: 3d
upvote count: 5
answer count: 1
downvote count: 0
tagged with: jmonkeyengine
favorite count: 0
has answer: http://stackoverflow.com/a/24316128
score: 5
type: AnsweredQuestion

http://stackoverflow.com/q/24404795
type: Question
possible better answer: http://stackoverflow.com/a/24404893
downvote count: 0
answer count: 6
has comment: http://stackoverflow.com/comment/37751473
has comment: http://stackoverflow.com/comment/37751997
has answer: http://stackoverflow.com/a/24404901
has answer: http://stackoverflow.com/a/24404877
has comment: http://stackoverflow.com/comment/37751350
has comment: http://stackoverflow.com/comment/37751629
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/24405038
tagged with: design-patterns
has answer: http://stackoverflow.com/a/24405107
has title: Classes that implement an interface have more methods
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/24404877
has answer: http://stackoverflow.com/a/24405089
tagged with: java
has body: I have an interface: public interface IUser { public boolean login(); } and two classes that implement this interface: public class UserA implements IUser{ public boolean login() { System.out.println("login"); } public void update() { System.out.println("update"); } } public class UserB implements IUser { public boolean login() { System.out.println("login"); } public void delete() { System.out.println("delete"); } } My question is if I create a user: IUser user = new UserA(); user object doesn't have access to update() however it is recommended to create object using interface, I was wondering if there is a best practice or design pattern I can use (rather than casting it)?
has answer: http://stackoverflow.com/a/24404893

http://stackoverflow.com/comment/37597512
type: Comment
comment on: http://stackoverflow.com/a/24323745
type: AnswerComment
has text: But i dont have 2 object's, I have a JSP page of HTML form, for add i used the above logic. I just want the same to show existing data, Means i retrieve the data from the Database and get it inside the Employee object then i want to show the values in the JSP. Here my name and ID properties are all starts with "em.". How can i map it.?
score: 0

http://stackoverflow.com/a/24335918
downvote count: 0
answers question: http://stackoverflow.com/q/24335752
type: Answer
score: 2
upvote count: 2
has body: Answering your question: You are trying to perform a cast operation on a boolean value, which I don't think is what you want (and it's irrelevant anyway). So, I think that what you are trying to do is this: sql = "delete from demo.question " + "where QUESTION_ID = cast('" + question + "', int)" Some comments on this: Your question variable can be parsed to an integer value in your code before passing it to the query... that would remove the need for your cast function. What would you do if your question variable holds the value "abc"? Consider that scenario. Your query is quite vulnerable to SQL Injection attacs. Consider using prepared statements. Update Since you are using Java, and reinforcing my third observation, you should take a look to the Java tutorial on the topic (and also to this). I insist, instead of passing a string and casting it in your query, parse it in your Java code as an integer and free yourself of your problem.

http://stackoverflow.com/comment/37695166
comment on: http://stackoverflow.com/q/24371617
has text: but how can I put that all in the onCreate
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37517788
has text: http://tomcat.apache.org/maven-plugin-trunk/tomcat7-maven-plugin/run-mojo.html.
comment on: http://stackoverflow.com/q/24281528
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/24383939
has answer: http://stackoverflow.com/a/24383974
favorite count: 0
accepted answer: http://stackoverflow.com/a/24383974
answer count: 5
tagged with: match
has answer: http://stackoverflow.com/a/24384068
downvote count: 1
tagged with: string-matching
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24384084
has answer: http://stackoverflow.com/a/24384238
upvote count: 3
has body: I have a String like this: String a = "Barbara Liskov (born Barbara Jane Huberman on November 7, 1939" +" in California) is a computer scientist.[2] She is currently the Ford" +" Professor of Engineering in the MIT School of Engineering's electrical" +" engineering and computer science department and an institute professor" +" at the Massachusetts Institute of Technology.[3]"; I would like to replace all of these elements: [1], [2], [3], etcetera, with a blank space. I tried with: if (a.matches("([){1}\\d(]){1}")) { a = a.replace(""); } but it does not work!
tagged with: java
has answer: http://stackoverflow.com/a/24384084
has answer: http://stackoverflow.com/a/24384035
type: Question
score: 2
has title: String matching and replace in Java
tagged with: string

http://stackoverflow.com/comment/37613818
comment on: http://stackoverflow.com/a/24332078
score: 0
type: AnswerComment
has text: I tried Thread.sleep() from creed's run method ,but still it is pausing Main Thread
type: Comment

http://stackoverflow.com/comment/37737287
score: 4
has text: First rule of Swing, you don't control the paint process. Painting can occur for any number of reasons many of which you don't/can't control. Never try and control the state of the output from within the `paintComponent` method itself. Instead, define some kind of controlling mechanism which is independent of paint process. And yes, paint may be called a number of times when window is first made visible...
type: QuestionComment
comment on: http://stackoverflow.com/q/24397178
type: Comment

http://stackoverflow.com/comment/37790661
type: AnswerComment
comment on: http://stackoverflow.com/a/24425847
type: Comment
has text: The change in `Enemy` class constructor solved my problem. Why is it necessary to change my sprite's position in the `update(fload delta)` method? `x` and `y` are modified only in the `reset()` method.
score: 0

http://stackoverflow.com/comment/37621727
score: 0
has text: As long as I can pass the value that the Servlet received back in my JSF context in order to use it in my Beans, I can call my verification method in the Bean either from the servlet or not. Basically what I am trying to achieve here is a 2 factor authentication. Once the user logs in with his credentials, a third party will interact with the user and then post back the result of that interaction to the servlet. Depending on the result, I need to either log the user in or send him back to authentication step 1. So basically I just need to pass the value back to the servlet and finish the job.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24319378

http://stackoverflow.com/a/24369483
type: Answer
has comment: http://stackoverflow.com/comment/37707795
has body: Create an activity extending "ExpandableListActivity", follow for example this tutorial Initialize your data private ArrayList&lt;String&gt; groups = new ArrayList&lt;String&gt;() ; private ArrayList&lt;ArrayList&lt;String&gt;&gt; children; private NewAdapter mNewAdapter = null; public void onCreate(Bundle savedInstanceState) { // .... groups.add("Summer Fruit"); groups.add("Winter Fruit"); groups.add("Hard fruit"); groups.add("Watery Fruit"); children = new ArrayList&lt;ArrayList&lt;String&gt;&gt;(); ArrayList&lt;String&gt; a = new ArrayList&lt;String&gt;(); a.add("Lychy"); a.add("Mango"); children.add(a); a = new ArrayList&lt;String&gt;(); a.add("Banana"); children.add(a); a = new ArrayList&lt;String&gt;(); a.add("Pomy Granade"); children.add(a); a = new ArrayList&lt;String&gt;(); a.add("pani Fruit"); children.add(a); mNewAdapter = new NewAdapter(groups, children); mNewAdapter.setInflater((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE),this); getExpandableListView().setAdapter(mNewAdapter); int cpt = mNewAdapter.getGroupCount(); for(int i = 0; i &lt; cpt; i++ ){ getExpandableListView().expandGroup(i); } } Then be sure to overwrite the following method into your activity @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { // Do here what you need to do when a child is selected return true; } Add finally add your adapter class NewAdapter extends BaseExpandableListAdapter{ public LayoutInflater minflater; public Activity activity; public ArrayList&lt;String&gt; groups; public ArrayList&lt;ArrayList&lt;String&gt;&gt; points; public NewAdapter(ArrayList&lt;String&gt; groups, ArrayList&lt;ArrayList&lt;String&gt;&gt; points){ this.groups = groups; this.points = points; } public void setInflater(LayoutInflater mInflater, Activity act) { this.minflater = mInflater; activity = act; } @Override public void notifyDataSetChanged() { super.notifyDataSetChanged(); } @Override public Object g…
has comment: http://stackoverflow.com/comment/37710906
score: 0
answers question: http://stackoverflow.com/q/24367877

format
tags question: http://stackoverflow.com/q/24350023
tag name: format
tags question: http://stackoverflow.com/q/24410152
type: Tag
tags question: http://stackoverflow.com/q/24294117

http://stackoverflow.com/comment/37739739
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24397717
has text: Welcome to Stack Overflow! Refrain from use `null` layouts. You do not control the factors that affect the size requirements/decisions for components that will change their sizes on different platforms/os's

http://stackoverflow.com/comment/37552730
comment on: http://stackoverflow.com/a/24299830
type: Comment
has text: Exception in thread "main" java.io.EOFException at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2601) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1319) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371) at TCPServer.main(TCPServer.java:38)
score: 0
type: AnswerComment

spring
tags question: http://stackoverflow.com/q/24350186
tags question: http://stackoverflow.com/q/24385902
tags question: http://stackoverflow.com/q/24371342
tags question: http://stackoverflow.com/q/24278425
tags question: http://stackoverflow.com/q/24355188
tags question: http://stackoverflow.com/q/24412968
tags question: http://stackoverflow.com/q/24310609
tags question: http://stackoverflow.com/q/24315643
tags question: http://stackoverflow.com/q/24287191
tags question: http://stackoverflow.com/q/24297798
tags question: http://stackoverflow.com/q/24386100
tags question: http://stackoverflow.com/q/24309655
tags question: http://stackoverflow.com/q/24415964
tags question: http://stackoverflow.com/q/24372562
tags question: http://stackoverflow.com/q/24370911
tags question: http://stackoverflow.com/q/24310987
tags question: http://stackoverflow.com/q/24406772
tags question: http://stackoverflow.com/q/24365116
tags question: http://stackoverflow.com/q/24305848
tags question: http://stackoverflow.com/q/24310881
tags question: http://stackoverflow.com/q/24276145
tags question: http://stackoverflow.com/q/24407369
tags question: http://stackoverflow.com/q/24289331
tags question: http://stackoverflow.com/q/24368901
tags question: http://stackoverflow.com/q/24290228
tags question: http://stackoverflow.com/q/24271518
tags question: http://stackoverflow.com/q/24340800
tags question: http://stackoverflow.com/q/24326875
tags question: http://stackoverflow.com/q/24413595
tags question: http://stackoverflow.com/q/24324620
tags question: http://stackoverflow.com/q/24289698
tags question: http://stackoverflow.com/q/24390322
tags question: http://stackoverflow.com/q/24392004
tags question: http://stackoverflow.com/q/24308474
tags question: http://stackoverflow.com/q/24406645
tags question: http://stackoverflow.com/q/24403325
tags question: http://stackoverflow.com/q/24414146
tags question: http://stackoverflow.com/q/24375588
tags question: http://stackoverflow.com/q/24386621
tags question: http://stackoverflow.com/q/24379386
tags question: http://stackoverflow.com/q/24282138
tags question: http://stackoverflow.com/q/24333784
tags question: http://stackoverflow.com/q/24272239
tags question: http://stackoverflow.com/q/24422678
tags question: http://stackoverflow.com/q/24361392
tags question: http://stackoverflow.com/q/24408887
tags question: http://stackoverflow.com/q/24327802
tags question: http://stackoverflow.com/q/24376216
tags question: http://stackoverflow.com/q/24348294
tags question: http://stackoverflow.com/q/24373237
tags question: http://stackoverflow.com/q/24284955
tags question: http://stackoverflow.com/q/24279699
tags question: http://stackoverflow.com/q/24384814
tags question: http://stackoverflow.com/q/24276155
tags question: http://stackoverflow.com/q/24418742
tags question: http://stackoverflow.com/q/24389505
tags question: http://stackoverflow.com/q/24342533
tags question: http://stackoverflow.com/q/24322329
type: Tag
tags question: http://stackoverflow.com/q/24415983
tags question: http://stackoverflow.com/q/24278139
tags question: http://stackoverflow.com/q/24379035
tags question: http://stackoverflow.com/q/24413420
tags question: http://stackoverflow.com/q/24380364
tags question: http://stackoverflow.com/q/24360910
tags question: http://stackoverflow.com/q/24278659
tags question: http://stackoverflow.com/q/24348548
tags question: http://stackoverflow.com/q/24350785
tags question: http://stackoverflow.com/q/24336386
tags question: http://stackoverflow.com/q/24419873
tags question: http://stackoverflow.com/q/24293945
tags question: http://stackoverflow.com/q/24367252
tags question: http://stackoverflow.com/q/24392551
tags question: http://stackoverflow.com/q/24408945
tags question: http://stackoverflow.com/q/24269523
tags question: http://stackoverflow.com/q/24330297
tags question: http://stackoverflow.com/q/24302956
tags question: http://stackoverflow.com/q/24271705
tags question: http://stackoverflow.com/q/24338150
tags question: http://stackoverflow.com/q/24355603

http://stackoverflow.com/q/24391123
has title: Object vs Class<T> (vs Class<?>?) in java?
has body: I'm very new to Java. This is probably a stupid question--but i can't find the answer anywhere. If you wanted to declare a method that would take in an unknown object and do something with it (copy it, for example), what would be the difference between something like: &lt;T&gt; T func(Class&lt;T&gt; cls){ //do something } Object func(Object o){ //do something } Are they comparable? Is there anything you could/would do with one of the above methods and not the other? And where does Class&lt;?&gt; fit in?
score: 12
downvote count: 0
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/24391161
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24391192
has answer: http://stackoverflow.com/a/24391323
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24391443
upvote count: 12
has answer: http://stackoverflow.com/a/24391169

http://stackoverflow.com/comment/37771939
score: 0
type: Comment
has text: @Ordous I dont want to fix it :) And its good if you are able to see race condition. I am running this code on ideone.com and it was giving me race condition with 2 threads accessing an un-synchronized method. I will download eclipse and run it on my machine then. And keep you posted.
comment on: http://stackoverflow.com/a/24415245
type: AnswerComment

http://stackoverflow.com/q/24271518
tagged with: gradle
type: Question
has body: I am coding a small command line tool to maintain a database. As an start point, I am reducing the problem to one table. Basically I perform CRUD operations over it. The input is an xml file. I have created a spring application, is the first time I use it out of a web application context. For building I am using gradle 1.11. I have a test class. One of the tests is very simple: read a test xml file from the classpath and unmarshall it. This is the server.xml file: <?xml version="1.0" encoding="UTF-8"?> <xs2:server xmlns:xs2="http://www.opsource.net/simpleapp"> <xs2:id>5</xs2:id> <xs2:name>Server_5</xs2:name> </xs2:server> This is the method that unmarshalls the xml: @Autowired private Unmarshaller unMarshaller; public ServerType unMarshallServerType(InputStream is) throws XmlMappingException, IOException{ ServerType server = (ServerType) unMarshaller.unmarshal(new StreamSource(is)); return server; } In the application context I defined my jaxb2Marshaller: com.mangrar.jaxb.ServerType I have checked already that the content of the InputStream is right, and the Unmarshalling is not throwing any exception, but, the 2 properties inside the ServerType instance, are null. This is the ServerType class: @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "serverType", propOrder = { "id", "name" }) @XmlRootElement(namespace = "http://www.opsource.net/simpleapp", name = "server" ) public class ServerType { @XmlElement(required = true) protected String id; @XmlElement(required = true) protected String name; } The weirdest thing is that if I run 'gradle test', the tests are working, but not with the IDE. I have tried with IDEA and Eclipse, latest versions, and still getting null. I have created a support request to Jetbrains, and for then, is not working with gradle either. Any idea what it could be not working?
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
score: 2
upvote count: 2
has title: I get null fields Unmarshalling a xml with spring-oxm
tagged with: java
has answer: http://stackoverflow.com/a/24271816
tagged with: jaxb

http://stackoverflow.com/a/24290095
answers question: http://stackoverflow.com/q/24288467
has comment: http://stackoverflow.com/comment/37553204
has body: This might not be quite what you're looking for, but I would consider breaking the two apis apart. One for humans and one for web services. We have our human interface right off the root context: http(s)://your.website.com/... We then have our web service interface off of the api context: http(s)://your.website.com/api/v1/... This makes it easy to handle the two different types of security you're looking for with spring.
score: 0
type: Answer

http://stackoverflow.com/q/24359240
tagged with: eclipse
duplicate of: http://stackoverflow.com/q/3566146
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/24359814
tagged with: apache
downvote count: 0
answer count: 1
score: 4
tagged with: tomcat
has comment: http://stackoverflow.com/comment/37666117
favorite count: 0
has answer: http://stackoverflow.com/a/24359814
has comment: http://stackoverflow.com/comment/65458012
has body: I am getting an error while running apache tomcat server in ecllipse and the error description is"Server apache-tomcat-7.0.54 at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor". After getting this message i have increased the time for server to start but the same message i am getting again. Console prints error is Jun 23, 2014 11:05:20 AM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:example' did not find a matching property. Jun 23, 2014 11:05:20 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] Jun 23, 2014 11:05:20 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-bio-8009"] Jun 23, 2014 11:05:20 AM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 868 ms Jun 23, 2014 11:05:20 AM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Jun 23, 2014 11:05:20 AM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.54 Jun 23, 2014 11:05:21 AM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-8080"] Jun 23, 2014 11:05:21 AM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-bio-8009"] Jun 23, 2014 11:05:21 AM org.apache.catalina.startup.Catalina start INFO: Server startup in 458 ms
has title: Getting error "Tomcat was unable to start within 45 seconds."
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3566146
tagged with: java

http://stackoverflow.com/comment/129952982
type: AnswerComment
type: Comment
has text: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
score: 1
comment on: http://stackoverflow.com/a/73539627

http://stackoverflow.com/comment/37785816
type: Comment
has text: Sadly this answer is not solving my problem.
comment on: http://stackoverflow.com/a/24410049
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37851325
type: AnswerComment
comment on: http://stackoverflow.com/a/24458004
type: Comment
score: 1
has text: I will answer your questions above

http://stackoverflow.com/q/24368984
has comment: http://stackoverflow.com/comment/37684168
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24369035
has comment: http://stackoverflow.com/comment/37683986
tagged with: timer
has title: java - timer execution
type: UnansweredQuestion
has body: I want to implement a sort of timer in java. I exaplain: my code should run for 10 seconds; I have 3 different integers (a, b and c, all of them are initialized to 0) and I want to increase and decrease them in different time intervals: From 0 to 3 seconds a = 1, b = 0 and c = 0. From 3 to 6 seconds a = 0, b = 1 and c = 0. From 6 to 10 seconds a = 0, b = 0 and c = 1. Here is my code: int a = 0; int b = 0; int c = 0; a = 1 Thread.sleep(3000); b = 1; a = 0; Thread.sleep(3000); b = 0; c = 1; It works but it's very ugly!! How can I improve this code? Should I use a stopwatch? (I read some solutions which use swing timer, I'm not using swing components so I don't need it)
tagged with: java
type: Question

http://stackoverflow.com/comment/37545327
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24295955
score: 0
has text: What should i swap static with?

http://stackoverflow.com/comment/37786191
score: 3
has text: You can't extend from multiple classes because Java doesn't support multiple inheritance of classes, period. This isn't a generics problem.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24423598

http://stackoverflow.com/q/24387984
tagged with: hadoop
downvote count: 0
type: UnansweredQuestion
has body: I'm new at Hadoop. I use hadoop 2.3.0 and hbase 0.98.3 . I'm trying to extract data from text file and write to hbase table in hadoop by using MapReduce. Altough i set outputKeyClass and outputValueClass'es of job, i get classCastException. Can anyone help me ? Here's my code. public static void main(String[] args) { Configuration config = HBaseConfiguration.create(); Job job; try { job = new Job(config, "LogBulkLoader"); job.setJarByClass(Main.class); job.setMapperClass(LogMapper.class); job.setOutputFormatClass(TableOutputFormat.class); job.getConfiguration().set(TableOutputFormat.OUTPUT_TABLE, "fatih"); job.setOutputKeyClass(ImmutableBytesWritable.class); job.setOutputValueClass(Put.class); FileInputFormat.addInputPath(job, new Path(userActionsTestFile)); job.setNumReduceTasks(0); job.waitForCompletion(true); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } public static class LogMapper extends TableMapper&lt;ImmutableBytesWritable, Put&gt; { @Override protected void setup(Context context) throws IOException, InterruptedException { } @Override protected void map(ImmutableBytesWritable key, Result value, Context context) throws IOException, InterruptedException { try { String[] l = value.toString().split(","); String[] t = l[4].split(" "); String[] date = t[0].split("-"); String[] time = t[1].split(":"); GregorianCalendar gc = new GregorianCalendar( Integer.parseInt(date[0]), Integer.parseInt(date[1]), Integer.parseInt(date[2]), Integer.parseInt(time[0]), Integer.parseInt(time[1]), Integer.parseInt(time[2])); Put put = new Put(Bytes.toBytes(l[0])); put.add(Bytes.toBytes("song"), Bytes.toBytes(l[1]), gc.getTimeInMillis(), Bytes.toBytes(l[6])); put.add(Bytes.toBytes("album"), Bytes.toBytes(l[1]), gc.getTimeInMillis(), Bytes.toBytes(l[5])); put.add(Bytes.toBytes("album"), Bytes.toBytes(l[2]), gc.getTimeInMillis(), Bytes.toBytes(l[5])); put.add(Bytes.toB…
has comment: http://stackoverflow.com/comment/37724479
favorite count: 0
type: Question
has title: java.lang.ClassCastException: org.apache.hadoop.io.LongWritable cannot be cast to org.apache.hadoop.hbase.io.ImmutableBytesWritable
tagged with: hbase
answer count: 1
score: 4
tagged with: java
has answer: http://stackoverflow.com/a/24401233
tagged with: mapreduce
upvote count: 4

http://stackoverflow.com/comment/37499108
type: Comment
type: QuestionComment
has text: Which line? That would help us to tell you why this happened. But something is null and is being used in your code which needs to get an object that has a value.
comment on: http://stackoverflow.com/q/24271743
score: 1

http://stackoverflow.com/q/24279913
tagged with: java
has comment: http://stackoverflow.com/comment/37514564
score: 0
has comment: http://stackoverflow.com/comment/37514805
has comment: http://stackoverflow.com/comment/37514468
answer count: 1
tagged with: jsp
tagged with: tomcat
has comment: http://stackoverflow.com/comment/37515654
has answer: http://stackoverflow.com/a/24281387
type: UnansweredQuestion
has title: Web Application not working after deploying on Tomcat Server 7.0.39
has body: We are able to login into the application, but unable to load Header.jsp Here is the browser exception: org.apache.jasper.JasperException: An exception occurred processing JSP page /user/../layout/Header.jsp at line 36 33: } 34: &lt;/style&gt; 35: &lt;!-- &lt;script type="text/javascript"&gt; 36: var secondsBeforeExpire = ${pageContext.session.maxInactiveInterval}; 37: var timeToDecide = 15; // Give client 15 seconds to choose. 38: var initialSessionTimeoutMessage = 'Your session is about to timeout in 5 minutes.Please save your work now!'; Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
type: Question

http://stackoverflow.com/comment/37574169
type: Comment
comment on: http://stackoverflow.com/q/24311478
score: 0
has text: Write your own class extends JPanel, override the paint method (which passes a Graphics object) and use that to render stuff.
type: QuestionComment

http://stackoverflow.com/q/24370338
tagged with: java
has answer: http://stackoverflow.com/a/24763885
type: Question
tagged with: hadoop
has title: FileNotFoundException with Pig
has comment: http://stackoverflow.com/comment/37688563
answer count: 2
has answer: http://stackoverflow.com/a/28847215
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37724021
type: UnansweredQuestion
has body: I am running shell script with pig command pig -param_file some-filename but I am getting following exception : FileNotFoundException. I checked and that file exists at the given location. What could cause the problem ? Error before Pig is launched ERROR 2997: Encountered IOException. File some-file.properties does not exist java.io.FileNotFoundException: File some-file.properties does not exist at org.apache.hadoop.fs.RawLocalFileSystem.getFileStatus(RawLocalFileSystem.java:520) at org.apache.hadoop.fs.FilterFileSystem.getFileStatus(FilterFileSystem.java:398) at org.apache.pig.impl.io.FileLocalizer.fetchFilesInternal(FileLocalizer.java:791) at org.apache.pig.impl.io.FileLocalizer.fetchFile(FileLocalizer.java:735) at org.apache.pig.Main.fetchRemoteParamFiles(Main.java:756) at org.apache.pig.Main.run(Main.java:408) at org.apache.pig.Main.main(Main.java:157) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
upvote count: 1
tagged with: apache-pig
score: 1

http://stackoverflow.com/a/24424532
has comment: http://stackoverflow.com/comment/117902312
has comment: http://stackoverflow.com/comment/37852591
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24397647
has comment: http://stackoverflow.com/comment/37853168
has comment: http://stackoverflow.com/comment/37828919
type: Answer
has body: I tested it with an exception mapper like below: import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.ext.ExceptionMapper; import javax.ws.rs.ext.Provider; import com.fasterxml.jackson.core.JsonProcessingException; @Provider public class JsonProcessingExceptionMapper implements ExceptionMapper&lt;JsonProcessingException&gt;{ public static class Error { public String key; public String message; } @Override public Response toResponse(JsonProcessingException exception) { Error error = new Error(); error.key = "bad-json"; error.message = exception.getMessage(); return Response.status(Status.BAD_REQUEST).entity(error).build(); } } and it worked. Update: changed JsonParseException to JsonProcessingException (more general) Update2: In order to avoid registering the unwanted mappers replace register(org.glassfish.jersey.jackson.JacksonFeature.class); with register(com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider.class); Look at the source code of JacksonFeature and you'll understand what's happening.
upvote count: 35
downvote count: 0
has comment: http://stackoverflow.com/comment/37810218
has comment: http://stackoverflow.com/comment/37914354
has comment: http://stackoverflow.com/comment/38094829
has comment: http://stackoverflow.com/comment/37811730
has comment: http://stackoverflow.com/comment/78827723
has comment: http://stackoverflow.com/comment/37960291
has comment: http://stackoverflow.com/comment/37964621
answers question: http://stackoverflow.com/q/24397647
has comment: http://stackoverflow.com/comment/38152957
score: 35
has comment: http://stackoverflow.com/comment/37963021

design-patterns
tags question: http://stackoverflow.com/q/24363422
tags question: http://stackoverflow.com/q/24287393
tags question: http://stackoverflow.com/q/24371540
tags question: http://stackoverflow.com/q/24278021
tag name: design-patterns
tags question: http://stackoverflow.com/q/24281968
tags question: http://stackoverflow.com/q/24335343
tags question: http://stackoverflow.com/q/24288508
tags question: http://stackoverflow.com/q/24352052
type: Tag
tags question: http://stackoverflow.com/q/24270643
tags question: http://stackoverflow.com/q/24416579
tags question: http://stackoverflow.com/q/24332599
tags question: http://stackoverflow.com/q/24404795
tags question: http://stackoverflow.com/q/24326910
tags question: http://stackoverflow.com/q/24312680
tags question: http://stackoverflow.com/q/24278945

http://stackoverflow.com/comment/134193906
type: AnswerComment
has text: On M2 mac, : `Error: openjdk@8: An unsatisfied requirement failed this build.` popped
comment on: http://stackoverflow.com/a/65957215
type: Comment
score: 1

http://stackoverflow.com/comment/37669160
type: QuestionComment
has text: We cannot invoke java method directly instead we can call Java stored procedures from any PL/SQL block, subprogram, or package.
score: 0
comment on: http://stackoverflow.com/q/24360492
type: Comment

http://stackoverflow.com/q/24402963
tagged with: xpath
has comment: http://stackoverflow.com/comment/37748685
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24411310
has comment: http://stackoverflow.com/comment/37749551
has title: XPath for complexType wrapper in element
tagged with: java
tagged with: jaxb
has comment: http://stackoverflow.com/comment/37749774
type: Question
has comment: http://stackoverflow.com/comment/37762400
has body: I have following element defined in XSD schema &lt;xs:element name="MainType"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="InnerType"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element ref="OtherType" maxOccurs="unbounded"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; I want to write binding for OtherType, but I have problems with XPath. I wrote this XPath for addresing of OtherType. //xs:element[@name='MainType']//xs:complexType//xs:element[@name='InnerType']//xs:complexType//xs:element[@name='OtherType'] I tried to skip complexType between elements in XPath, but it also doesn't work. JAXB plugin returns this error om.sun.istack.SAXParseException2: XPath evaluation of ... results in empty target node
has comment: http://stackoverflow.com/comment/37748149
score: 0
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/37747967

http://stackoverflow.com/a/24296872
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37583903
type: Answer
has comment: http://stackoverflow.com/comment/37547891
has body: The short answer is don't. The reasons for this is you'll end having to expose the parent container and CardLayout to ALL your sub components, which not only exposes portions of your application to potential mistreatment, it tightly couples the navigation making it difficult to add/remove steps in the future... A better solution would be to devise some kind of controller interface, which defines what each view could do (for example showHome, nextView, previousView), you would then pass an implementation of this interface to each view. Each view would then use this interface to request a change as the needed to. The controller would know things like, the current view, the home view and how to move between certain views (next/previous) as required. Updated with simple example import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Component; import java.awt.Container; import java.awt.EventQueue; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; import java.awt.event.ContainerAdapter; import java.awt.event.ContainerEvent; import java.awt.event.HierarchyEvent; import java.awt.event.HierarchyListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class AllYouViewBelongToMe { public static void main(String[] args) { new AllYouViewBelongToMe(); } public AllYouViewBelongToMe() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException…
has comment: http://stackoverflow.com/comment/37547176
has comment: http://stackoverflow.com/comment/37570923
accepted answer of: http://stackoverflow.com/q/24296505
upvote count: 5
answers question: http://stackoverflow.com/q/24296505
score: 5

http://stackoverflow.com/comment/37649132
type: Comment
type: QuestionComment
has text: Disable the submit button by default and enable it on click of any rating button.
comment on: http://stackoverflow.com/q/24350745
score: 5

http://stackoverflow.com/comment/37517170
type: QuestionComment
has text: I checked. The author did not give a link to an implementation. However, someone had implemented the first using C++. Yes, I am starting to come to the conclusion that this may not be a very easy task.
comment on: http://stackoverflow.com/q/24280152
score: 0
type: Comment

http://stackoverflow.com/q/24275397
tagged with: java
type: Question
answer count: 1
has title: Creating a .jar file which includes other .jar files?
tagged with: jar
has body: I'm trying to make a .jar file (this is my first time) and I'm confused. I understand how to use command prompt to create a simple jar file, but for my program I import the JavaMail API and another library which I created (called ArrayLibrary filled with sorting methods). How would I create these all in one jar file? I've read about jarSplice, but is that the right tool to be using for this problem?
linked to: http://stackoverflow.com/q/16764834
has comment: http://stackoverflow.com/comment/37506331
has answer: http://stackoverflow.com/a/24275610
has comment: http://stackoverflow.com/comment/37506311
type: UnansweredQuestion
score: 0

http://stackoverflow.com/a/24314714
upvote count: 1
has comment: http://stackoverflow.com/comment/37605920
type: Answer
answers question: http://stackoverflow.com/q/24312001
score: 1
has body: JRebel can monitor the jars, though it is not super efficient. In rebel.xml configuration file you can specify a &lt;jar&gt; tag pointing to the location of the dependency in the file system. A better approach would be to actually work with sources, so that you deploy the dependency with rebel.xml that points to the location where the compiled classes are, and then work with the dependency as with source, doing pull/update from version control when needed and compiling the changes. If your compiler is incremental, then it would compile only the changed classes and JRebel wouldn't have to reload too many classes at once, but only the changes.
downvote count: 0

http://stackoverflow.com/q/24366220
has comment: http://stackoverflow.com/comment/37678798
tagged with: functional-programming
has body: I want to write kind of function factory. It should be a function, which is called once which different strategies as parameters. It should return a function, which selects one of this strategies dependent on the parameter, which is to be fulfilled by a predicate. Well, better look at condition3 for better understanding. The problem is, that it is not compiling. I think because the compiler can't figure out, that the functional interface H can be realized by the implementation. Without generics it is working fine. @FunctionalInterface public interface Finder&lt;T, S&gt; { Stream&lt;S&gt; findBest (T t); // Valid code static &lt;P, Q&gt; Finder&lt;P, Q&gt; condition1 () { return p -&gt; null; } // Valid code, but selects just one of the H's when the method is invoked static &lt;P, Q, H extends Finder&lt;P, Q&gt;&gt; H condition2 (Pair&lt;Predicate&lt;P&gt;, H&gt;... hs) { return hs[0].getRight (); } // Should return a method, which selects the appropiate H // whenever it is invoked with an P // Compiler complain: // The target type of this expression must be a functional interface static &lt;P, Q, H extends Finder&lt;P, Q&gt;&gt; H condition3 (Pair&lt;Predicate&lt;P&gt;, H&gt;... hs) { return p -&gt; stream (hs).filter (pair -&gt; pair.getLeft ().test (p)) .findFirst () .map (Pair::getRight) .map (h -&gt; h.findBest (p)) .orElseGet (Stream::empty); } } So what's the problem here? Can I solve it and if it's possible with Java: how?
has answer: http://stackoverflow.com/a/24366514
tagged with: generics
favorite count: 0
tagged with: java-8
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24366514
has title: Return generic functional interface in Java 8
tagged with: java
type: Question
upvote count: 4
answer count: 1
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/37679045

http://stackoverflow.com/q/24271432
upvote count: 2
has answer: http://stackoverflow.com/a/24271480
tagged with: webview
has title: Webview Opening Browser even with override
type: Question
accepted answer: http://stackoverflow.com/a/24271480
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
has body: I implemented a webview into my parse notification app, but when the webview opens it opens a browser. I then added the "shouldoverrideURL" but still the same problem exists, any one have any ideas. Any help would be much appreciated. Thankyou import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.support.v4.content.LocalBroadcastManager; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Button; import android.widget.Toast; import com.parse.ParseInstallation; import com.parse.ParsePush; import com.parse.ParseQuery; import com.parse.PushService; public class MainActivity extends Activity implements OnClickListener { private Button push; private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Toast.makeText(getApplicationContext(), "onReceive invoked!", Toast.LENGTH_LONG).show(); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); PushService.setDefaultPushCallback(this, MainActivity.class); WebView wv = (WebView) findViewById(R.id.webView); WebSettings webSettings = wv.getSettings(); webSettings.setBuiltInZoomControls(true); webSettings.setJavaScriptEnabled(true); wv.loadUrl("http://www.homedepot.com"); push = (Button)findViewById(R.id.senPushB); push.setOnClickListener(this); } private class Callback extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { return(true); } } @Override public void onPause() { super.onPause(); LocalBroadcastManager.getInstance(this).unregiste…
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/37705710
type: Comment
has text: @KickButtowski it's almost too simple to see what point there is in it being there. It is hard to find the purpose of something effectively does nothing by design.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24378684

http://stackoverflow.com/comment/37674888
type: QuestionComment
type: Comment
has text: You can use Logcat to track your codes....like Log.e("running block =","main method or something else you can write here !");
comment on: http://stackoverflow.com/q/24364273
score: 0

http://stackoverflow.com/q/24282820
tagged with: swing
has comment: http://stackoverflow.com/comment/37523408
has comment: http://stackoverflow.com/comment/37522947
downvote count: 1
has comment: http://stackoverflow.com/comment/37519921
has comment: http://stackoverflow.com/comment/37550993
has title: Java - UIManager.setLookAndFeel isn't working
tagged with: java
has comment: http://stackoverflow.com/comment/37598067
tagged with: uimanager
type: Question
tagged with: awt
has body: I'm trying to get look and feel to work with no success. I'm creating a Frame and painting an Applet inside it. No exceptions are thrown when I execute the program. AppScreen &lt; Applet: public class AppScreen extends Applet implements Runnable { protected AppFrame frame; protected Graphics appGraphics; public void createFrame(int width, int height) throws Exception { UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceRavenGraphiteGlassLookAndFeel"); frame = new AppFrame(this, width, height); appGraphics = getAppComponent().getGraphics(); startThread(this, 1); } public void startThread(Runnable runnable, int i) { final Thread thread = new Thread(runnable); thread.start(); thread.setPriority(i); } public Component getAppComponent() { if (frame != null) return frame; else return this; } } AppFrame &lt; Frame: public final class AppFrame extends Frame { private final AppScreen screen; public AppFrame(AppScreen screen, int width, int height) { this.screen = screen; setBounds(500, 500, width, height); setResizable(false); setVisible(true); toFront(); } @Override public final void update(Graphics g) { screen.update(g); } @Override public final void paint(Graphics g) { screen.paint(g); } } For instance, I call createFrame(width, height) method.
score: 0
has comment: http://stackoverflow.com/comment/37520073
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: look-and-feel
upvote count: 1

http://stackoverflow.com/q/24318137
has comment: http://stackoverflow.com/comment/37588126
has comment: http://stackoverflow.com/comment/37587088
has comment: http://stackoverflow.com/comment/37587540
upvote count: 3
tagged with: java
downvote count: 3
has body: I've been assigned a project where I have to create a login system in java, using filein to write the accounts to an array, and using that array to log in by confirming the input username is the same as a username in the array. My usernames and passwords are on the same line in the .txt file that's being read, so I'm trying to pull the substring from the beginning of the string to the first space, and it results in this when user input is in: EDIT: When trying to isolate, I somehow fixed it. When adding the infile and array back in, it results in the error again. EDIT: I've added an accountCounter so that it only loops through as many times as there are array values that aren't null. Unfortunately I'm still running into the error. java.lang.NullPointerException at zamp.main(zamp.java:38) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at edu.rice.cs.drjava.model.compiler.JavacCompiler.runCommand(JavacCompiler.java:272) In all instances of trying to grab the substring (printing it, delegating it to a separate string) it results in that. Here's my code! import java.io.*; import java.util.Scanner; //import java.net.*; //handles the network protocols public class zamp { public static void main(String[] args) throws IOException { Scanner yiff = new Scanner(System.in); BufferedReader infile = new BufferedReader (new FileReader("passwords.txt")); String searchuser; int f; int i; int accountnumber=0; String modernPass="i"; String[] accounts = new String[5]; String searchpass; String line = infile.readLine(); for(i=1; i&lt;11; i++){ if (line!=null) { accounts[i]=line; System.out.println(""+accounts[i]); line=infile.readLine(); accountnumber++; } } System.out.println("Enter your username."); searchuser=yiff.nextLine(); for (f=0; f&lt;(accountnumber); f++) { modernPass=(""+(accounts[f…
has comment: http://stackoverflow.com/comment/37587850
has comment: http://stackoverflow.com/comment/37587285
tagged with: substring
has comment: http://stackoverflow.com/comment/37587173
has comment: http://stackoverflow.com/comment/37587072
type: Question
has answer: http://stackoverflow.com/a/24318755
has comment: http://stackoverflow.com/comment/37587430
has comment: http://stackoverflow.com/comment/37588169
tagged with: string
has comment: http://stackoverflow.com/comment/37587584
has comment: http://stackoverflow.com/comment/37587261
has comment: http://stackoverflow.com/comment/37587688
score: 0
has title: Pulling substring results in Nullpointer
answer count: 3
has comment: http://stackoverflow.com/comment/37587487
has comment: http://stackoverflow.com/comment/37587029
has comment: http://stackoverflow.com/comment/37587242
has comment: http://stackoverflow.com/comment/37587915
accepted answer: http://stackoverflow.com/a/24318755
has comment: http://stackoverflow.com/comment/37587763
has comment: http://stackoverflow.com/comment/37587519
has comment: http://stackoverflow.com/comment/37587834
favorite count: 0
has comment: http://stackoverflow.com/comment/37587101
has comment: http://stackoverflow.com/comment/37587119
has comment: http://stackoverflow.com/comment/37588286
has comment: http://stackoverflow.com/comment/37587803
has comment: http://stackoverflow.com/comment/37587901
has answer: http://stackoverflow.com/a/24318403
possible better answer: http://stackoverflow.com/a/24318184
has comment: http://stackoverflow.com/comment/37587882
has answer: http://stackoverflow.com/a/24318184
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37587960
has comment: http://stackoverflow.com/comment/37587780
has comment: http://stackoverflow.com/comment/37587686

recursion
type: Tag
tags question: http://stackoverflow.com/q/24386020
tags question: http://stackoverflow.com/q/24295470
tags question: http://stackoverflow.com/q/24351311
tags question: http://stackoverflow.com/q/24293084
tags question: http://stackoverflow.com/q/24281340
tags question: http://stackoverflow.com/q/24289758
tag name: recursion
tags question: http://stackoverflow.com/q/24267834
tags question: http://stackoverflow.com/q/24357631
tags question: http://stackoverflow.com/q/24358625
tags question: http://stackoverflow.com/q/24284257
tags question: http://stackoverflow.com/q/24295180
tags question: http://stackoverflow.com/q/24379252
tags question: http://stackoverflow.com/q/24375848
tags question: http://stackoverflow.com/q/24335148
tags question: http://stackoverflow.com/q/24324909

http://stackoverflow.com/a/24308451
type: Answer
has body: Use Calendar instead of Date. Anyways the below solution of converting a date to Calendar and back to Date is not efficient. If you can get the day, month, year etc. seperately, its better to use cal.set() TimeZone tz = TimeZone.getTimeZone("US/Alaska"); SimpleDateFormat sdf = new SimpleDateFormat( "EEE, d MMM yyyy HH:mm:ss z"); String date = "Sun, 9 Mar 2014 02:00:00 EST"; Date d = null; try { Calendar cal = Calendar.getInstance(); cal.setTime(sdf.parse(date)); cal.setTimeZone(tz); System.out.println("date is " + cal.getTime()); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); }
score: 0
answers question: http://stackoverflow.com/q/24307570

http://stackoverflow.com/q/24340970
has answer: http://stackoverflow.com/a/75884084
type: Question
tagged with: java
has body: I have tried this...gives me a java.lang.IllegalArgumentException: Invalid Proxy. The getters populate the proxy and port from a text file. //Imports import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.net.*; import java.util.ArrayList; import org.apache.commons.net.whois.WhoisClient; public void whoisCheck(String host) { SocketAddress addr = new InetSocketAddress(getProxy(), getPort) Proxy useProxy = new Proxy(Proxy.Type.HTTP, addr); WhoisClient whoisClient = new WhoisClient(); whoisClient.setProxy(useProxy); whoisClient.connect(IANA_WHOIS_SERVER, WHOIS_PORT); tmpStr = whoisClient.query(host); whoisClient.disconnect(); }
has comment: http://stackoverflow.com/comment/37631794
has comment: http://stackoverflow.com/comment/37632028
has comment: http://stackoverflow.com/comment/37630101
score: 0
answer count: 1
has title: Whois lookup via a proxy server: java.lang.IllegalArgumentException: Invalid Proxy
tagged with: proxy
type: UnansweredQuestion
tagged with: whois

http://stackoverflow.com/comment/37730127
has text: You shouldn't be using JSON for data sets that are too large to parse. Use a managed data base. If it will fit in memory use option 2 and a proper JSON parser.
comment on: http://stackoverflow.com/q/24393405
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/37498228
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24271313
score: 0
has text: Define *best* and perhaps the question would be a bit better. What is *best* depends a lot on what you want to do with that list. It's highly likely that the answer is `ArrayList`, but if you want to go to an early index and then remove a bunch of elements (admittedly a rare use case), then maybe `LinkedList` would be better.

http://stackoverflow.com/comment/37591969
type: QuestionComment
has text: Wait. Looks like I declared a WebElement object vs a WebDriver object. This does not seem to work for my WebElement object. Perhaps I should do some reading between the differences. Looks like what you told me does work though! Thanks!
score: 0
comment on: http://stackoverflow.com/q/24319526
type: Comment

http://stackoverflow.com/comment/41354185
type: QuestionComment
has text: Did you happen to come up with a solution? I am in the same situation, and instead of doing pooled direct buffers, I am considering just using a unpooled direct buffer instead and allocate it once.
comment on: http://stackoverflow.com/q/24390184
score: 0
type: Comment

http://stackoverflow.com/a/65044939
type: Answer
score: 2
downvote count: 0
has body: spring: jpa: properties: hibernate: default_schema: your_schema_name
answers question: http://stackoverflow.com/q/24278659
upvote count: 2

memory
tags question: http://stackoverflow.com/q/24302375
tag name: memory
tags question: http://stackoverflow.com/q/24379630
tags question: http://stackoverflow.com/q/24312499
tags question: http://stackoverflow.com/q/24398562
tags question: http://stackoverflow.com/q/24371483
type: Tag
tags question: http://stackoverflow.com/q/24377840
tags question: http://stackoverflow.com/q/24367442
tags question: http://stackoverflow.com/q/24425470

http://stackoverflow.com/a/24329966
answers question: http://stackoverflow.com/q/24297681
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
has body: I believe you need to set sessionTransacted to true for the DefaultMessageListenerContainer: ... <property name="sessionTransacted" value="true"/> You can find here relevant reference documentation.
accepted answer of: http://stackoverflow.com/q/24297681
type: Answer

authentication
tags question: http://stackoverflow.com/q/24304752
tags question: http://stackoverflow.com/q/24364435
tags question: http://stackoverflow.com/q/24324168
tag name: authentication
tags question: http://stackoverflow.com/q/24389381
type: Tag
tags question: http://stackoverflow.com/q/24287195
tags question: http://stackoverflow.com/q/24270421
tags question: http://stackoverflow.com/q/24368901
tags question: http://stackoverflow.com/q/24298916
tags question: http://stackoverflow.com/q/24310881
tags question: http://stackoverflow.com/q/24386904
tags question: http://stackoverflow.com/q/24313932

http://stackoverflow.com/q/24361996
score: 2
has body: I want to develop an android app in which user will be authenticated through bio-metric device.I stackoverflowed and found this link, but could not get any guidance to proceed. I don't know which android devices support USB host. Again, I found this, but it does not give me any result. Please tell me that Is it possible to achieve this? Biometric devices which support android Android device requirement I don't know how to proceed. Looking for prompt reply. Thanks
upvote count: 2
has answer: http://stackoverflow.com/a/24422975
type: Question
type: AnsweredQuestion
has title: External biometric device connected to Android Device
tagged with: java
tagged with: usb-hostcontroller
tagged with: fingerprint
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/24422975
favorite count: 0
tagged with: android
linked to: http://stackoverflow.com/q/11423875

http://stackoverflow.com/comment/37770460
comment on: http://stackoverflow.com/q/24415013
has text: Should `10.4` also be placed before `10.10`?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37499427
type: QuestionComment
has text: Can you create a more complete [MVCE](http://stackoverflow.com/help/mcve) of a sample `.g` file and test harness? But don't just copy-paste all your code because that would clearly be too much.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24271503

http://stackoverflow.com/comment/62784257
score: 0
comment on: http://stackoverflow.com/q/24406883
type: Comment
type: QuestionComment
has text: Seems to be still happening in Java 1.8/Windows 7.

http://stackoverflow.com/q/24325135
has title: How to take rating value from user in a dialog box in android?
has comment: http://stackoverflow.com/comment/37600034
tagged with: ratingbar
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24325253
has answer: http://stackoverflow.com/a/24325253
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24325765
answer count: 2
score: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/24325765
has body: I had the query of how can we take the rating value from the user . I have know the onratingbarlistener . But since the code below is used while prompting user with the dialog box. I would appreciate to hear valuable feedbacks or suggestions. @Override public void onCompleted(Exception e, ImageView result) { spinner.setVisibility(View.GONE); drivername.setTypeface(tf); vehiclenumber.setTypeface(tf); info.setVisibility(View.VISIBLE); ratingBar.setRating(4.5f); } Solution : public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromTouch) { final int numStars = ratingBar.getNumStars(); ratingBar.getRating() ; final float ratingBarStepSize = ratingBar.getStepSize(); }

http://stackoverflow.com/q/24408984
has title: Convert ByteArray to UUID java
downvote count: 0
tagged with: uuid
accepted answer: http://stackoverflow.com/a/24409153
upvote count: 28
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24409153
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/24409076
has answer: http://stackoverflow.com/a/58056827
has answer: http://stackoverflow.com/a/24409088
has body: Question is How do I convert ByteArray to GUID. Previously I converted my guid to byte array, and after some transaction I need my guid back from byte array. How do I do that. Although irrelevant but conversion from Guid to byte[] is as below public static byte[] getByteArrayFromGuid(String str) { UUID uuid = UUID.fromString(str); ByteBuffer bb = ByteBuffer.wrap(new byte[16]); bb.putLong(uuid.getMostSignificantBits()); bb.putLong(uuid.getLeastSignificantBits()); return bb.array(); } but how do I convert it back?? I tried this method but its not returning me same value public static String getGuidFromByteArray(byte[] bytes) { UUID uuid = UUID.nameUUIDFromBytes(bytes); return uuid.toString(); } Any help will be appreciated.
tagged with: arrays
favorite count: 0
score: 28
answer count: 4
has answer: http://stackoverflow.com/a/24409076

http://stackoverflow.com/q/24328698
tagged with: spring
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: spring-data
has answer: http://stackoverflow.com/a/24340575
has body: Is it possible to use a full text search using Spring Data Elastic Search? I can't seem to find examples in the documentation
type: Question
has title: Full Text Search with Spring Data ElasticSearch
answer count: 2
accepted answer: http://stackoverflow.com/a/24340575
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/24338556
upvote count: 2
has answer: http://stackoverflow.com/a/24338556
tagged with: elasticsearch

http://stackoverflow.com/a/24389127
type: Answer
has comment: http://stackoverflow.com/comment/37723609
answers question: http://stackoverflow.com/q/24385613
has comment: http://stackoverflow.com/comment/37723832
has body: I haven't played with LS2J much, but it looks to me like the constructor of your Java class takes a LogWSDTO object as an argument, but you are calling classJava.CreateObject without any arguments. I believe you should be passing a JNI signature string and the argument, as shown in doc here.
has comment: http://stackoverflow.com/comment/37750877
score: 0

http://stackoverflow.com/a/24300580
has body: I do have the permissions set. i found the fix. my sdcard has memory 200Mb which may be too much. changed it to 20Mb and it's working now.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24291428
answers question: http://stackoverflow.com/q/24291428
type: Answer

http://stackoverflow.com/q/24374189
tagged with: arrays
downvote count: 0
accepted answer: http://stackoverflow.com/a/24374471
tagged with: memory-visibility
favorite count: 0
has answer: http://stackoverflow.com/a/24374537
linked to: http://stackoverflow.com/q/2236184
score: 4
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/13688697
has body: Consider the code snippet class A { private Map&lt;String, Object&gt; taskMap = new HashMap&lt;&gt;(); private volatile Object[] tasksArray ; // assume this happens on thread1 public void assignTasks() { synchronized(taskMap){ // put new tasks into map // reassign values from map as a new array to tasksArray ( for direct random access ) } } // assume this is invoked on Thread2 public void action(){ int someindex = &lt;init index to some value within tasksArray.length&gt;; Object[] localTasksArray = tasksArray; Object oneTask = localTasksArray[someindex]; // Question : is the above operation safe with respect to memory visibility for Object oneTask ? // is it possible that oneTask may appear null or in some other state than expected ? } } Question : is the operation Object oneTask = localTasksArray[someindex]; safe with respect to memory visibility for Object oneTask ? is it possible that oneTask may appear null or in some other state than expected ? My thoughts are these : It is possible that thread2 may see oneTask as null or in some state other than expected. This is because , even though the taskArray is volatile , and a read of this array will ensure proper visibility of the array itself , this does not ensure the visibility of the state internal to the object oneTask.
type: Question
has answer: http://stackoverflow.com/a/24374471
possible better answer: http://stackoverflow.com/a/24374596
has comment: http://stackoverflow.com/comment/37694055
has answer: http://stackoverflow.com/a/24374596
tagged with: java
tagged with: thread-safety
has title: Volatile array - memory visibility of the elements
has comment: http://stackoverflow.com/comment/37694114
has comment: http://stackoverflow.com/comment/37694006
upvote count: 4
answer count: 3
tagged with: volatile

http://stackoverflow.com/a/24319946
accepted answer of: http://stackoverflow.com/q/24319853
has comment: http://stackoverflow.com/comment/37592826
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24319853
type: Answer
has body: You need to use cascade @OneToMany(cascade={CascadeType.ALL}) There are different cascade type. You can select the one that fits your requirement.

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

http://stackoverflow.com/a/24294456
upvote count: 3
has body: Your approach is correct. On host (desktop), open a socket and listen on port 80 (or another port if you wish) and listen. It doesn't need to be a full web server. On client (Android), to start with send an http request to the desktop' ip address. Desktop responds with a simple web page. That's how you get the two communicating. Then you can start POSTing data to the desktop and returning data in the web page. Then you can move to communicating using JSON rather than web pages. You can program both the host and client using Qt. You can develop both on the desktop and move the client to Android (or iPad) when you have got it working.
has comment: http://stackoverflow.com/comment/37574271
accepted answer of: http://stackoverflow.com/q/24293488
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 3
answers question: http://stackoverflow.com/q/24293488
has comment: http://stackoverflow.com/comment/37853524

http://stackoverflow.com/a/38320603
score: 0
downvote count: 1
type: Answer
has body: And the short answer is - gbc.gridwidth is the parameter that allows a component to span more than one column. For example, if you have 3 columns and 4 rows and you want a label to occupy the complete top row, then you need to assign the first cell for the label. and set gbc.gridwidth = 3;
answers question: http://stackoverflow.com/q/24425355
upvote count: 1

http://stackoverflow.com/comment/37722627
has text: @Musich87 RDF/XML is not designed to be a human readable or human writable syntax. It's almost always preferable to look at the data in the TTL/N3 format (or sometimes N-Triples) because it shows the data much more clearly. RDF/XML is an attempt to exploit XML processing tools by defining an encoding scheme for RDF that targets XML. It's got lots of little edge cases, and the same data can be represented in lots of different ways. View your data in another syntax and it'll be much clearer what your data is.
type: AnswerComment
comment on: http://stackoverflow.com/a/24385916
type: Comment
score: 0

http://stackoverflow.com/comment/37905375
comment on: http://stackoverflow.com/q/24299584
score: 0
has text: Please remember to upvote all useful answers. And "check" the answer that best solved your question.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37553421
score: 0
type: Comment
type: QuestionComment
has text: Could it be that you have a memory overwrite in your native code. This could accidentally corrupt the memory block headers used by dlmalloc. Which in it turn could cause a crash like this
comment on: http://stackoverflow.com/q/24300291

http://stackoverflow.com/comment/37790002
has text: I do not see the "Search for reference" option in IDEA 13. [Screenshot](http://oi61.tinypic.com/qpgs1u.jpg)
comment on: http://stackoverflow.com/a/24425084
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24287378
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24287118
has body: I do not know all requirements for this task, but I recommend to convert the whole expression to postfix notation, then parse it using stack to evaluate the result.

http://stackoverflow.com/q/24335820
has comment: http://stackoverflow.com/comment/37647761
type: UnansweredQuestion
tagged with: hashtable
has comment: http://stackoverflow.com/comment/37620595
has title: pairs of numbers that have a difference of K
tagged with: java
has comment: http://stackoverflow.com/comment/37621374
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/37699561
has answer: http://stackoverflow.com/a/24971832
has comment: http://stackoverflow.com/comment/37644966
has answer: http://stackoverflow.com/a/24336135
has comment: http://stackoverflow.com/comment/37620575
has answer: http://stackoverflow.com/a/24340349
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/37621507
has body: This was my online interview question, and I already submitted the answer. However, the compilation was terminated due to time so I just submitted. Could I get feedback from you? Thanks in advance. Problem: Given N numbers , [N&lt;=10^5] we need to count the total pairs of numbers that have a difference of K Input Format: 1st line contains N &amp; K (integers). 2nd line contains N numbers of the set. All the N numbers are assured to be distinct. Output Format: One integer saying the no of pairs of numbers that have a diff K. Sample Input #00: 5 2 1 5 3 4 2 Sample Output #00: 3 My code: import java.io.* import java.util.*; public class DiffNumbers { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line1 = in.readLine(); String line2 = in.readLine(); int n = Integer.parseInt(line1.split(" ")[0]); int diff = Integer.parseInt(line1.split(" ")[1]); Hashtable table = new Hashtable(); int[] arr = new int[n]; for(in i=0; i&lt;n; i++) { arr[i] = Integer.parseInt(line2.split(" ")[i]); table.put(Integer.parseInt(line2.split(" ")[i])); } int count = 0; for(in i=0; i&lt;n; i++) { if(table.containsKey(arr[i]+diff) { count++; } } system.out.println(count); } }

http://stackoverflow.com/a/24372984
type: Answer
answers question: http://stackoverflow.com/q/24372932
has comment: http://stackoverflow.com/comment/37707422
has body: Windows uses \r\n as its line separator, unlike UNIX which uses just \n So,try to use String log = "\n" + "blablabla"; or String log = "\r\n" + "blablabla"; instead of String log = System.getProperty("line.separator") + "blablabla";
score: 0

http://stackoverflow.com/comment/37627124
has text: `ThreadLocal` allows you to have each MyClass instance per each thread. If thread modifies MyClass object then the same thread will have modified MyClass object for subsequent `threadLocal.get()`
score: 0
comment on: http://stackoverflow.com/q/24339080
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24350777
has answer: http://stackoverflow.com/a/24367577
has comment: http://stackoverflow.com/comment/37678382
tagged with: apache-poi
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/15934650
tagged with: excel
tagged with: java
type: Question
tagged with: apache
answer count: 1
has comment: http://stackoverflow.com/comment/37668250
has body: I'm trying to open all the files that are linked in an Excel Sheet using Apache POI. This is what I've got: FileInputStream inputstream = new FileInputStream(file); workbook = new HSSFWorkbook(inputstream); HSSFSheet sheet = workbook.getSheetAt(0); log("Processing Sheet: " + sheet.getSheetName()); Iterator rowIterator = sheet.iterator(); while (rowIterator.hasNext()) { HSSFRow row = (HSSFRow) rowIterator.next(); Iterator cellIterator = row.cellIterator(); while (cellIterator.hasNext()) { HSSFCell cell = (HSSFCell) cellIterator.next(); if(cell.getHyperlink() != null){ HSSFHyperlink hyperlink = cell.getHyperlink(); log("Hyperlink found: " + hyperlink.getAddress()); try{ FileInputStream fs = new FileInputStream(hyperlink.getAddress()); }catch(Exception ex){ log(ex.getMessage()); } } } } But hyperlink.getAddress() doesn't return the correct path, it looks like it returns the relative path but without ../. I also tried using the getDirectoryRoot() method on the workbook. But that just returns /. I have the path to my Excel file but without the base path that the excel uses or the ../'s in the attachments path, I'm not able to get the correct path.
score: 0
has title: Unable to open hyperlinked files in Excel with JAVA using Apache POI

http://stackoverflow.com/a/35327982
type: Answer
score: 22
answers question: http://stackoverflow.com/q/24350150
has body: If using Apache's HttpClient, you can create a custom DNS resolver to detect the host you'd like to redirect, and then provide a substitute IP address. Note: Just changing the Host header for HTTPS requests doesn't work. It will throw "javax.net.ssl.SSLPeerUnverifiedException", forcing you to trust bad certificates, stop SNI from working, etc., so really not an option. A custom DnsResolver is the only clean way I've found to get these requests to work with HTTPS in Java. Example: /* Custom DNS resolver */ DnsResolver dnsResolver = new SystemDefaultDnsResolver() { @Override public InetAddress[] resolve(final String host) throws UnknownHostException { if (host.equalsIgnoreCase("my.host.com")) { /* If we match the host we're trying to talk to, return the IP address we want, not what is in DNS */ return new InetAddress[] { InetAddress.getByName("127.0.0.1") }; } else { /* Else, resolve it as we would normally */ return super.resolve(host); } } }; /* HttpClientConnectionManager allows us to use custom DnsResolver */ BasicHttpClientConnectionManager connManager = new BasicHttpClientConnectionManager( /* We're forced to create a SocketFactory Registry. Passing null doesn't force a default Registry, so we re-invent the wheel. */ RegistryBuilder.&lt;ConnectionSocketFactory&gt;create() .register("http", PlainConnectionSocketFactory.getSocketFactory()) .register("https", SSLConnectionSocketFactory.getSocketFactory()) .build(), null, /* Default ConnectionFactory */ null, /* Default SchemePortResolver */ dnsResolver /* Our DnsResolver */ ); /* build HttpClient that will use our DnsResolver */ HttpClient httpClient = HttpClientBuilder.create() .setConnectionManager(connManager) .build(); /* build our request */ HttpGet httpRequest = new HttpGet("https://my.host.com/page?and=stuff"); /* Executing our request should now hit 127.0.0.1, regardless of DNS */ HttpResponse httpResponse = httpClient.execute(httpRequest);
upvote count: 22
downvote count: 0

http://stackoverflow.com/q/24372295
type: Question
has comment: http://stackoverflow.com/comment/37690474
tagged with: java
has title: Efficient way to implement Likes features in a video application
score: 0
answer count: 1
tagged with: javascript
tagged with: ajax
has comment: http://stackoverflow.com/comment/37690697
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37704944
tagged with: social-media-like
has comment: http://stackoverflow.com/comment/37704996
has answer: http://stackoverflow.com/a/55425088
has body: I have a video based project.In this project I want to implement Likes features. That is there is a hyperlink on each video with the total like count and when user clicks on that hyperlink after then hyperlink is to be hidden and only show Liked text with total count of that video. I have write this code in JavaScript with Ajax but main problem is that in one session if a user likes 5 videos then 5 times db will be hit. Is there any efficient way to implement it? &lt;div id="status${video.id}"&gt;&lt;a href="javascript:callLike('${video.id}');"&gt; Like- &lt;/a&gt; &lt;/div&gt;&lt;a id="like1${video.id}" style="color:#ffffff;"&gt;${video.likesCount}&lt;/a&gt; function callLike(id) { document.getElementById("like"+id).innerHTML='300'; var postData = '?Id='+id; var url =protocol+'//'+host+'/xxx/getLike'+postData; // alert("url:"+url); if (window.XMLHttpRequest) { req = new XMLHttpRequest(); } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } req.onreadystatechange = likesres; req.open("POST", url, true); req.send(null); } function likesres() { if (req.readyState == 4) { if (req.status == 200) { response = req.responseText; document.getElementById("like1"+id).innerHTML=response; document.getElementById("status"+id).innerHTML='Liked--'; } } }

http://stackoverflow.com/a/24282155
upvote count: 0
has comment: http://stackoverflow.com/comment/37566823
has comment: http://stackoverflow.com/comment/37553439
answers question: http://stackoverflow.com/q/24280485
type: Answer
downvote count: 1
score: -1
has body: The answer has been in the test. the extra cost is owe to function invocation. commonly we encourage to write short and clean functions instead of long functions and consider function invocation has very low cost. but the invocation cost is still larger than direct memory access. in this case, for testloop, we can estimate a memory read costs ~3 ns ( includes integer operations, e.g. i++, c + ) for others, there's 2 additonal layers of function invocations.so each function calls is ~15 ns. actuality we can say function call is very fast. the only point is that there's 2 000 000 000 functions calls in each process, that's really a large number. there's another test case to prove the function call costs: do not use any stream, just read bytes with additional function calls: add below function, public final long getByte( long c, byte value, int dep ) { if ( dep &gt; 0 ) { return getByte( c, value, dep - 1); } return c + value; } then invoke in testLoop like: c = getByte( c, bytes[i], 2); then the final cost increase to the same level: Loop: 4044010718 -499870245 Dis: 5182272442 -499870245 My Dis: 5228065271 -499870245 Via method: 655108198 -499870245

http://stackoverflow.com/comment/37727244
type: Comment
comment on: http://stackoverflow.com/a/24390541
type: AnswerComment
has text: Yes, but how do you know there's no pixel enforcement?
score: 0

http://stackoverflow.com/q/24367913
tagged with: endianness
favorite count: 0
linked to: http://stackoverflow.com/q/10166011
has comment: http://stackoverflow.com/comment/70331098
has comment: http://stackoverflow.com/comment/37682395
answer count: 1
has comment: http://stackoverflow.com/comment/37682988
has answer: http://stackoverflow.com/a/24369707
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37682366
type: Question
upvote count: 4
linked to: http://stackoverflow.com/q/14792968
has comment: http://stackoverflow.com/comment/37682548
has title: FileChannel doesn't write anything
accepted answer: http://stackoverflow.com/a/24369707
downvote count: 0
has body: I have to write an integer in little endian order. So I've created a class (this class does not extend anything) with a FileChannel attribute and some write methods. But there's a problem: only one method works, the other not! Here is the working method (dis is the FileChannel): public void writeBuffer(ByteArrayOutputStream t) throws IOException { ByteBuffer buffer=ByteBuffer.wrap(t.toByteArray()); dis.write(buffer); } And this is one of the write methods that doesn't work: public void writeInt(int t) throws IOException { ByteBuffer buffer=ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN); buffer.putInt(t); dis.write(buffer); } I debugged the program and dis.write(buffer) returns 0, so what's wrong? Does anyone know an alternative method for writing 4 byte integers in little endian?
score: 4

http://stackoverflow.com/q/24361652
has title: How to Java cache in-Memory by group/tag data?
downvote count: 1
type: Question
has body: I read about Java Cache in-Memory, and see almost solutions are [ key => value ]. But it's not enough when we need manipulate more pieces data. Example: { key: "book1", //1 is book id value: { id: 1, name: "Book's name", author: "Book's author", } }, { key: "book2", value: { id: 2, name: "Book's name", author: "Book's author", } }, { key: "book3", value: { id: 3, name: "Book's name", author: "Book's author", } } How do I get all of theme without know exactly id to build the key : "book"+id. Is there any way to tag item, and we can get all by tag name. { key: "book3", tag: "recentBook" value: { id: 3, name: "Book's name", author: "Book's author", } } I expect you to offer any solutions organization structure for cache data OR a library support to work with tag/group data. Thanks!
tagged with: data-structures
tagged with: caching
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24363379
favorite count: 0
tagged with: ehcache
type: UnansweredQuestion
tagged with: java
upvote count: 1

http://stackoverflow.com/q/24418660
has comment: http://stackoverflow.com/comment/37777446
tagged with: inheritance
has answer: http://stackoverflow.com/a/24418792
favorite count: 0
has answer: http://stackoverflow.com/a/24419205
tagged with: static-methods
tagged with: static
has comment: http://stackoverflow.com/comment/37777549
linked to: http://stackoverflow.com/q/2223386
has answer: http://stackoverflow.com/a/24419351
answer count: 4
has comment: http://stackoverflow.com/comment/37777544
has title: Overriding "static" method/field with "non-static" method/field
upvote count: 2
score: 0
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/24418897
duplicate of: http://stackoverflow.com/q/2223386
has body: Here if I try to override a static method without using static in the subclass it gives me an error.. while this is not a case with static variable. Why? class A { static int a; static void a() { System.out.println("in A"); } } class B extends A { int a=9;/*this does not give an error*/ void a()/*this statement gives an error*/ { System.out.println("In B"+(A.a)); } } class Test { public static void main(String []args) { B b1=new B(); b1.a(); } }
tagged with: java
type: Question

http://stackoverflow.com/comment/37679003
has text: @UweAllner Thank you for the response. I have removed `@JoinColumn(name = "call_detail", nullable=false)`. However the exception is still thrown.
comment on: http://stackoverflow.com/q/24366204
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/24401460
has comment: http://stackoverflow.com/comment/37752933
has body: You are trying to assign String value to int variable: state = random; Instead get random int value and use this in your code: int random = new Random().nextInt(STATE_YELLOW) + 1; state = random; For cleaner code have a min and max constant for color defined and use them: private static final int MIN_STATE_COLOR = STATE_RED; private static final int MAX_STATE_COLOR = STATE_YELLOW; int random = new Random().nextInt(MAX_STATE_COLOR - MIN_STATE_COLOR + 1) + MIN_STATE_COLOR;
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/24401362
type: Answer
answers question: http://stackoverflow.com/q/24401362

http://stackoverflow.com/a/24338655
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24338467
type: Answer
has body: Double check if you followed step 3 correctly
downvote count: 0

http://stackoverflow.com/a/24339453
has body: -d '{ "name": "PhoneName", "description": "Phone Description!", "details": { "imeiNumber": "123456789123456", "phoneNumber": "9999999999"}}' \ pushes the input json into POST request payload. And you CANNOT simply unmarshall the input json attributes using their names and hence you get System.out.println("Name : " + request.getParameter("name")); //gives null null values for such statements. You need to read the POST request payload from your HttpServletRequest object and then should use json parser to parse it to get the attribute values. You can read the entire POST request payload like this: try { InputStream inputStream = request.getInputStream(); if (inputStream != null) { bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); char[] charBuffer = new char[128]; int bytesRead = -1; while ((bytesRead = bufferedReader.read(charBuffer)) &gt; 0) { stringBuilder.append(charBuffer, 0, bytesRead); } } else { stringBuilder.append(""); } } catch (IOException ex) { throw ex; } finally { if (bufferedReader != null) { try { bufferedReader.close(); } catch (IOException ex) { throw ex; } } } body = stringBuilder.toString(); Now you should get your input json in variable body. Now use a json parser to get the attribues value, for example like this: JsonParser parser = new JsonParser(); JsonObject obj = parser.parse(body).getAsJsonObject(); String name = obj.get("name").toString();
downvote count: 0
score: 6
upvote count: 6
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24339371
answers question: http://stackoverflow.com/q/24339371
type: Answer

http://stackoverflow.com/a/24340505
accepted answer of: http://stackoverflow.com/q/24315567
type: Answer
score: 0
has body: When you are using an HTTP proxy server, the DNS lookup of domain names of all web requests is handled by the proxy. More than likely, when you are on a network that requires a proxy server, the network blocks all other internet traffic not going through the proxy, including access to DNS port 53. Hence, only web browser and apps using HTTP libraries works. Apps using socket libraries typically fail to work. I suspect that your network requiring a proxy setting is at work while your network without a proxy setting is at home. Enterprise firewall configurations with such proxies, such as those in the work place, typically restrain network traffic to "web only".
answers question: http://stackoverflow.com/q/24315567
type: AcceptedAnswer

http://stackoverflow.com/comment/37532173
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24288887
has text: @juanchopanza Sorry, I specified that that's only when declared in a function. Is that correct?
type: Comment

http://stackoverflow.com/comment/94894473
score: 4
has text: I think the question refers only to the component **Text** and not to **TextField**.
type: Comment
comment on: http://stackoverflow.com/a/51566616
type: AnswerComment

http://stackoverflow.com/q/24300694
has answer: http://stackoverflow.com/a/24300819
score: 1
tagged with: java
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/37553916
tagged with: contacts
tagged with: android
answer count: 1
tagged with: android-activity
favorite count: 0
type: UnansweredQuestion
has title: Android Open Contacts List in Same Activity
upvote count: 1
has body: In my android application .. I am using tab layout and I have three tabs .. and one tab needs to open the contacts page when clicked.. but the contacts page is opening outside the activity. But I need to open it inside the tab. I am giving my code.. if anyone knows how t do please help. private static final int PICK_CONTACT = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.contacts_activity); Intent i= new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI); startActivityForResult(i, PICK_CONTACT);

http://stackoverflow.com/comment/37668990
has text: try this tutorial :http://www.vogella.com/tutorials/AndroidListView/article.html
comment on: http://stackoverflow.com/q/24360686
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24349534
has comment: http://stackoverflow.com/comment/37647169
has comment: http://stackoverflow.com/comment/37646949
has comment: http://stackoverflow.com/comment/37646847
has comment: http://stackoverflow.com/comment/37649890
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37670034
has comment: http://stackoverflow.com/comment/37646907
has comment: http://stackoverflow.com/comment/37646809
answer count: 0
has comment: http://stackoverflow.com/comment/37646855
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37646938
has title: JTextField not displaying super/subscript
has comment: http://stackoverflow.com/comment/37646832
upvote count: 1
tagged with: swing
tagged with: jtextfield
has comment: http://stackoverflow.com/comment/37647557
type: Question
has comment: http://stackoverflow.com/comment/37646883
has comment: http://stackoverflow.com/comment/37646870
has comment: http://stackoverflow.com/comment/37649909
has body: import java.awt.*; import javax.swing.*; public class practice9 { public static void main(String[] args) { JButton b = new JButton(); b.setBounds(10, 10, 150, 150); JLabel l = new JLabel("ell"); l.setText(" +ax2+bx2+c "); b.add(l); JTextField t = new JTextField(); t.setBounds(10, 300, 150, 150); t.add(l); JFrame f = new JFrame(""); f.setVisible(true); f.setLayout(null); f.setBounds(10, 10, 500, 500); f.add(b); f.add(t); } } I was working on a calculator and wanted to display superscripts. I was successful in doing so on a label using the HTML, but failed to repeat it on a text field. Is it impossible to do it in a text field (i.e. display sub/superscript) or is there a way?
has comment: http://stackoverflow.com/comment/37646932
has comment: http://stackoverflow.com/comment/37647824
has comment: http://stackoverflow.com/comment/37646934
linked to: http://stackoverflow.com/q/10075147
has comment: http://stackoverflow.com/comment/37646866
downvote count: 0

http://stackoverflow.com/a/24300355
has body: You have got a little issue with your code this might help you public static void printWord(char[] array) { Random random = new Random(); int[] letters = new int[array.length]; for(int index = 0; index &lt; array.length; index++) { letters[index] = random.nextInt((122+1) - 97) + 97; System.out.println((char)letters[index]); } System.exit(0); } please refer for more information
score: 0
answers question: http://stackoverflow.com/q/24300063
type: Answer

http://stackoverflow.com/q/24294619
tagged with: android
tagged with: sqlite
answer count: 1
accepted answer: http://stackoverflow.com/a/24294761
has body: I have the following code to connect the sqlite database to the Android app,and the public class TestAdapter doesn't work. When I compile the app I receive the following error: The public type TestAdapter must be definied " My Code import java.io.IOException; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.util.Log; public class TestAdapter { protected static final String TAG = "DataAdapter"; private final Context mContext; private SQLiteDatabase mDb; private DataBaseHelper mDbHelper; public TestAdapter(Context context) { this.mContext = context; mDbHelper = new DataBaseHelper(mContext); } public TestAdapter createDatabase() throws SQLException { try { mDbHelper.createDataBase(); } catch (IOException mIOException) { Log.e(TAG, mIOException.toString() + " UnableToCreateDatabase"); throw new Error("UnableToCreateDatabase"); } return this; } public TestAdapter open() throws SQLException { try { mDbHelper.openDataBase(); mDbHelper.close(); mDb = mDbHelper.getReadableDatabase(); } catch (SQLException mSQLException) { Log.e(TAG, "open &gt;&gt;"+ mSQLException.toString()); throw mSQLException; } return this; } public void close() { mDbHelper.close(); } public Cursor getTestData() { try { String sql ="SELECT * FROM myTable"; Cursor mCur = mDb.rawQuery(sql, null); if (mCur!=null) { mCur.moveToNext(); } return mCur; } catch (SQLException mSQLException) { Log.e(TAG, "getTestData &gt;&gt;"+ mSQLException.toString()); throw mSQLException; } } } public class DataAdapter { } What should I do?Thanks!
type: AnsweredQuestion
has title: Eclipse complie error
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24294761
score: 0

http://stackoverflow.com/q/24306473
accepted answer: http://stackoverflow.com/a/24314061
has comment: http://stackoverflow.com/comment/37564925
type: Question
has title: Populate model with default attributes
answer count: 1
has comment: http://stackoverflow.com/comment/37565001
has body: I am building a website using the Spring-MVC framework. In the template I want to include some 'generic' information. Generic in the way that this is not specific to the current controller, but used on every page. This can be something like a generated menu, the number of minutes a user is logged in or the current temperature on the north pole. What I am currently doing I've made an abstract class with a method to populate the model with the default values. My controllers extend this class and I call this method in every (@RequestMapping-ed) method, which is a downside. It feels kinda hacky and is not very flexible. @Component public abstract class AbstractBaseController { @Autowired private SomeService someService; protected void populateModel(Model model) { model.addAttribute("value", someService.getGenericValue()); } } @Controller public class HomeController extends AbstractBaseController { @RequestMapping("/") public String index(Model model) { populateModel(model); return "home"; } } My question How should I provide these generic attributes to my view. Is there a better way than what I am doing now? (I am using Spring/Spring-MVC 4, JavaConfig, Thymeleaf with thymeleaf-layout-dialect)
has answer: http://stackoverflow.com/a/24314061
has comment: http://stackoverflow.com/comment/37564817
score: 0
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/24376373
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24377258
has body: I'm using Caldroid Lib to create a custom calendar inside my Android App, i need to load data from my Web Server, i have an asynctask that fills a HashMap and then i put that data inside an arraylist like this: class Asistencia extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected Void doInBackground(Void... params) { arraylist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); // Retrieve JSON Objects from the given URL address jsonobject = JSONfunctions .getJSONfromURL("http://www.gettford.net/comunidad/api/calendario.php?usuarioID=" + usuarioID); if (jsonobject != null &amp;&amp; jsonobject.length() &gt; 0) { try { // Locate the array name in JSON jsonarray = jsonobject.getJSONArray("datos"); for (int i = 0; i &lt; jsonarray.length(); i++) { HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); jsonobject = jsonarray.getJSONObject(i); // Retrive JSON Objects map.put("title", jsonobject.getString("title")); map.put("dtstart", jsonobject.getString("dtstart")); map.put("dtend", jsonobject.getString("dtend")); map.put("color", jsonobject.getString("color")); arraylist.add(map); } } catch (JSONException e) { Log.e("Error", e.getMessage()); e.printStackTrace(); } } else { errores = "conexion"; } return null; } @Override protected void onPostExecute(Void args) { } } Now after doing the asynctask, i need to set the events on the calendar and set the background color of the cell. How can i achieve that? I think that maybe can be done here: private void setCustomResourceForDates() { new Asistencia().execute(); Calendar cal = Calendar.getInstance(); // Min date is last 7 days cal.add(Calendar.DATE, -11); Date redDate = cal.getTime(); // Max date is next 7 days cal = Calendar.getInstance(); cal.add(Calendar.DATE, 2); Log.e("fecha", "" + redDate); Date orangeDate = cal.getTime(); if (caldroidFragment != null) { caldroidFragment.setBackgroundResourceForDate(R.color.red, redDate); caldroidFragment.setBackgroundResourceForDate( R.color.orange, o…
tagged with: android-asynctask
type: Question
accepted answer: http://stackoverflow.com/a/24377258
tagged with: android
tagged with: android-calendar
score: 0
tagged with: java
answer count: 1
tagged with: hashmap
has title: Android How to fill the calendar with data from an asynctask in Caldroid Lib

zeromq
tags question: http://stackoverflow.com/q/24398309
type: Tag
tags question: http://stackoverflow.com/q/24329007
tag name: zeromq

http://stackoverflow.com/comment/37796123
has text: Now that I think more, I remember we used to have a problem like that. The problem was that the json was not parsed correctly, it was cached but only part of it. So when we tried to parse it our memory went crazy. We had to deactivate the cache in some cases... let me know if this could be the case and I can write more..
score: 0
comment on: http://stackoverflow.com/q/24425470
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37681984
type: Comment
type: QuestionComment
has text: @NathanHughes I've checked: the appearance of "Creating CGLIB proxy" in the log is proof that *proxy-target-class* is the active proxying strategy.
comment on: http://stackoverflow.com/q/24367503
score: 0

http://stackoverflow.com/comment/37532572
score: 6
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24289070
has text: There's nothing wrong with a protected static field, as long as it's `final`. A mutable static field shared across classes is definitely cause for worry. Multiple classes updating a static field is not likely to be reliable or easy to follow, especially since the presence of any protected field or method implies that the class is meant to be extended by classes in other packages, possibly classes not under the control of the author of the class containing the protected field.

http://stackoverflow.com/a/24382461
type: Answer
accepted answer of: http://stackoverflow.com/q/24382034
score: 2
answers question: http://stackoverflow.com/q/24382034
upvote count: 2
has body: Use the H2 in TCP server mode. In one of your VMs start it like so: Server server = Server.createTcpServer(args).start(); Other VM can connect using JDBC: JDBC driver class: org.h2.Driver Database URL: jdbc:h2:tcp://localhost/~/test
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24310097
score: -1
has body: For example I have this one line in a text file Additional_Cost_utilities=(out.Utilities.Ener.Steam_cons.Value*0.056 + out.Utilities.Ener.Elec_cons.Value*0.09 + (STRING_NEW1*STRING_NEW2*0.003)); I need a regex to replace the tokens of STRING_NEW1 and STRING_NEW2 with some new strings. What regex could I use so that nothing else is edited in the line other than these two strings? Edit: The strings to be replaced are different each time. So I just cant use replace. A stable regex is required to modify the STRING_NEW1 and STRING_NEW2 tokens independently of their content, which will be float numbers The code I am trying to use to replace the strings in the specific line of a big coding part is the following. The regex needs to recognize the line and the tokens of the strings to be replaced. I hope this helps try { Path path = Paths.get("read.m"); Charset charset = StandardCharsets.UTF_8; String content = new String(Files.readAllBytes(path), charset); content = content.replace("STRING_1_IN_THE_LINE", "new string1") .replace("STRING_2_IN_THE_LINE", "new string2"); Files.write(path, content.getBytes(charset)); } catch (IOException e) { //Simple exception handling, replace with what's necessary for your use case! throw new RuntimeException("Generating file failed", e); }
has comment: http://stackoverflow.com/comment/37572284
has comment: http://stackoverflow.com/comment/37595813
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37595493
has comment: http://stackoverflow.com/comment/37596417
tagged with: java
has answer: http://stackoverflow.com/a/24310341
tagged with: replace
has answer: http://stackoverflow.com/a/24310586
answer count: 3
has answer: http://stackoverflow.com/a/24310728
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37593991
has comment: http://stackoverflow.com/comment/37572043
type: UnansweredQuestion
has title: Regex for replacing two strings in the same line
tagged with: regex

http://stackoverflow.com/comment/37620909
type: Comment
type: QuestionComment
score: 2
has text: @alexvii That is not a syntax error in Java.
comment on: http://stackoverflow.com/q/24335911

http://stackoverflow.com/comment/37788478
score: 0
type: Comment
has text: This would have worked - but I have no control over the source. It's being generated by an external program. But up-voting for the detailed answer.
comment on: http://stackoverflow.com/a/24422986
type: AnswerComment

http://stackoverflow.com/q/24306761
has body: I cant generate MANIFEST file using maven... I try everything and I didnt find the solution. The jar file is generate correct, but manifest is missing. This is the part of my pom.xml: org.apache.maven.plugins maven-jar-plugin 2.4 <useDefaultManifestFile> true </useDefaultManifestFile> <!-- archive> net.menago.core.main.Menago </archive --> <!-- archive> true true development ${project.url} value </archive--> As you can see there are some commented codes which does not work too. I've tried mvn clean install, compile, package... Thanks for any advice!
has answer: http://stackoverflow.com/a/31273468
has title: maven-jar-plugin does not generate MANIFEST
has comment: http://stackoverflow.com/comment/37573365
has answer: http://stackoverflow.com/a/72217833
tagged with: maven-3
tagged with: manifest.mf
has answer: http://stackoverflow.com/a/44030358
has comment: http://stackoverflow.com/comment/37866868
upvote count: 1
has comment: http://stackoverflow.com/comment/37565477
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/37565287
has answer: http://stackoverflow.com/a/24307118
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/37662951
has text: Like @FrankieTheKneeMan said, we should at least see your import statements. That is what you meant by "import," right? And *exactly* what are the error messages you're seeing?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24357354
type: QuestionComment

http://stackoverflow.com/comment/37578011
comment on: http://stackoverflow.com/a/24307211
type: Comment
has text: I am guessing the OP wants to know how to create a relationship between two nodes, not how to find two related nodes. But... as I commented under the question, it's actually unclear what's being asked, so I can be completely wrong about that... :)
type: AnswerComment
score: 0

hibernate
tags question: http://stackoverflow.com/q/24326442
tags question: http://stackoverflow.com/q/24427103
tags question: http://stackoverflow.com/q/24269717
tags question: http://stackoverflow.com/q/24301683
tags question: http://stackoverflow.com/q/24314724
tags question: http://stackoverflow.com/q/24422993
tags question: http://stackoverflow.com/q/24370667
tags question: http://stackoverflow.com/q/24286483
tags question: http://stackoverflow.com/q/24325277
tags question: http://stackoverflow.com/q/24382506
tags question: http://stackoverflow.com/q/24278810
tags question: http://stackoverflow.com/q/24351162
tags question: http://stackoverflow.com/q/24288255
tags question: http://stackoverflow.com/q/24299965
tags question: http://stackoverflow.com/q/24338629
tags question: http://stackoverflow.com/q/24399211
tags question: http://stackoverflow.com/q/24292026
tags question: http://stackoverflow.com/q/24426738
tags question: http://stackoverflow.com/q/24387453
tags question: http://stackoverflow.com/q/24411535
tags question: http://stackoverflow.com/q/24411401
tags question: http://stackoverflow.com/q/24348174
tags question: http://stackoverflow.com/q/24405293
tags question: http://stackoverflow.com/q/24410741
tags question: http://stackoverflow.com/q/24388702
tags question: http://stackoverflow.com/q/24343943
tags question: http://stackoverflow.com/q/24279660
tags question: http://stackoverflow.com/q/24353347
tags question: http://stackoverflow.com/q/24340957
tags question: http://stackoverflow.com/q/24410326
tags question: http://stackoverflow.com/q/24303996
tags question: http://stackoverflow.com/q/24292362
tags question: http://stackoverflow.com/q/24322728
tags question: http://stackoverflow.com/q/24321280
tags question: http://stackoverflow.com/q/24406662
tags question: http://stackoverflow.com/q/24332599
tags question: http://stackoverflow.com/q/24277652
tags question: http://stackoverflow.com/q/24373551
tags question: http://stackoverflow.com/q/24353307
tags question: http://stackoverflow.com/q/24341533
tags question: http://stackoverflow.com/q/24276196
tags question: http://stackoverflow.com/q/24386659
tags question: http://stackoverflow.com/q/24389721
tags question: http://stackoverflow.com/q/24410635
tags question: http://stackoverflow.com/q/24364629
tag name: hibernate
tags question: http://stackoverflow.com/q/24337300
tags question: http://stackoverflow.com/q/24341444
tags question: http://stackoverflow.com/q/24373261
tags question: http://stackoverflow.com/q/24289772
tags question: http://stackoverflow.com/q/24282091
tags question: http://stackoverflow.com/q/24322073
tags question: http://stackoverflow.com/q/24283036
tags question: http://stackoverflow.com/q/24286475
tags question: http://stackoverflow.com/q/24413377
tags question: http://stackoverflow.com/q/24304781
tags question: http://stackoverflow.com/q/24314829
tags question: http://stackoverflow.com/q/24373153
tags question: http://stackoverflow.com/q/24291170
tags question: http://stackoverflow.com/q/24318447
tags question: http://stackoverflow.com/q/24283317
tags question: http://stackoverflow.com/q/24372073
tags question: http://stackoverflow.com/q/24350186
tags question: http://stackoverflow.com/q/24286524
tags question: http://stackoverflow.com/q/24289858
tags question: http://stackoverflow.com/q/24414132
tags question: http://stackoverflow.com/q/24287191
tags question: http://stackoverflow.com/q/24302925
tags question: http://stackoverflow.com/q/24380846
tags question: http://stackoverflow.com/q/24395913
tags question: http://stackoverflow.com/q/24310987
tags question: http://stackoverflow.com/q/24345891
tags question: http://stackoverflow.com/q/24417635
tags question: http://stackoverflow.com/q/24338467
tags question: http://stackoverflow.com/q/24276782
tags question: http://stackoverflow.com/q/24345189
tags question: http://stackoverflow.com/q/24385403
tags question: http://stackoverflow.com/q/24364924
tags question: http://stackoverflow.com/q/24366204
tags question: http://stackoverflow.com/q/24340800

http://stackoverflow.com/q/24361805
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37675031
has comment: http://stackoverflow.com/comment/37681550
tagged with: matlab
answer count: 0
has comment: http://stackoverflow.com/comment/37680839
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37672077
type: Question
has comment: http://stackoverflow.com/comment/37673039
has title: Should I instantiate MatlabControl from withing Matlab or Java?
has comment: http://stackoverflow.com/comment/37677061
has body: It is not obvious from here http://www.cs.virginia.edu/~whitehouse/matlab/JavaMatlab.html, how to use MatlabControl class. On one hand it is given an example: First, instantiate a MatlabControl object MatlabControl mc = new MatlabControl(); On the other hand it is said Snag 1: MatlabControl objects must be instantiated from within your Matlab session! (or by other java objects that were instantiated by your matlab session). This is because Matlab runs its own JVM, and you need to run MatlabControl in the same JVM that matlab is using. (this is why you need to make sure that MatlabControl is in your matlab classpath.) More specifically, if your program is defined in "mypackage/MyClass.java", you need to type mypackage.MyClass.main({'param1','param2',...}) What is correct? Where to execute MatlabControl mc = new MatlabControl(); ? In my java code? Or at matlab command prompt?
has comment: http://stackoverflow.com/comment/37676748

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/24322484
tags question: http://stackoverflow.com/q/24335866
type: Tag
tags question: http://stackoverflow.com/q/24394911
tags question: http://stackoverflow.com/q/24311781
tags question: http://stackoverflow.com/q/24303444
tags question: http://stackoverflow.com/q/24422612
tags question: http://stackoverflow.com/q/24374970
tags question: http://stackoverflow.com/q/24289450
tags question: http://stackoverflow.com/q/24396933
tags question: http://stackoverflow.com/q/24397178
tags question: http://stackoverflow.com/q/24314353
tags question: http://stackoverflow.com/q/24376122

http://stackoverflow.com/comment/37674523
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24363621
has text: @Scooter yes, here in Brazil our number formats is 1.456,60 which is 1k 465 plus 60 fraction. An American format it would be wrong format because the comma would be after the dot.
score: 0

http://stackoverflow.com/comment/37503475
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24273929
has text: You can test this yourself using instanceof e.g. `if (foo instanceof Bar) System.out.println("foo is Bar")`

http://stackoverflow.com/comment/37559858
has text: Is JAXB outputting that XML? If so how are you populating your object model to get that output? I don't see an `xmlns:xsi` namespace delaration is there more XML document that you are not showing?
score: 0
comment on: http://stackoverflow.com/q/24303474
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37726357
score: 0
has text: It's not really duplicated because I'm not using hbase shell but rather the Java API. Also, when I use `hbase-0.98.3-hadoop2` I don't see this exception but the thread is blocked.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24388829

http://stackoverflow.com/comment/37692747
type: Comment
comment on: http://stackoverflow.com/a/24373126
has text: Java to native compiler? => Yes an no. There was a project (Gnu Java Compiler) but it never became important, because of the HotSpot JIT in Java. Java is really good for long running processes. If you need a fast start time, use another tool. Or try http://martiansoftware.com/nailgun/ (I haven't tried it yet, because I write heavy Java Server application. Startup time is not that important to me)
score: 0
type: AnswerComment

network-programming
tags question: http://stackoverflow.com/q/24337223
tags question: http://stackoverflow.com/q/24292960
tags question: http://stackoverflow.com/q/24386255
tags question: http://stackoverflow.com/q/24382441
tags question: http://stackoverflow.com/q/24329883
tags question: http://stackoverflow.com/q/24328186
type: Tag
tag name: network-programming
tags question: http://stackoverflow.com/q/24322630
tags question: http://stackoverflow.com/q/24325784
tags question: http://stackoverflow.com/q/24281702
tags question: http://stackoverflow.com/q/24312125

http://stackoverflow.com/comment/37700965
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24377542
has text: Thanks - I had seen that one already. I have made some changed in my original post… Thanks
score: 0

http://stackoverflow.com/a/33304378
downvote count: 0
has comment: http://stackoverflow.com/comment/54414647
has body: Reason: This happens because every time you install the application on a (same) device, parse will create a new record in the 'Installation' class, thus deviceToken gets duplicated. Solution: You can solve this by finding for the duplicate entry and avoid the insertion in 'beforeSave' function for 'Installation' Class. It's better to write this section in javascript and move to the CloudCode. Hence the communication between client (android) device and the server can be reduced. Parse.Cloud.beforeSave(Parse.Installation, function(request, response) { if(!request.object.isNew()) { // Old Obj - Updating response.success(); } else { // New Obj - Inserting Parse.Cloud.useMasterKey(); var query = new Parse.Query(Parse.Installation); query.equalTo("deviceToken", request.object.get("deviceToken")); query.first().then(function(duplicate) { if (typeof duplicate === "undefined") { console.log("New installation .."); response.success(); } else { console.log("Duplicate exist .."); response.error(); } }, function(error) { console.warn(error.code + error.message); response.error(); }); } }); You can use either 'deviceToken' or your custom field like 'userID' for checking duplicates or both as per your needs. Update: In the above code, I've just avoided the duplicate entry. But it is good practice to remove the existing and insert the new one (as below). Parse.Cloud.beforeSave(Parse.Installation, function(request, response) { if(!request.object.isNew()) { // Old Obj - Updating response.success(); } else { // New Obj - Inserting Parse.Cloud.useMasterKey(); var query = new Parse.Query(Parse.Installation); query.equalTo("deviceToken", request.object.get("deviceToken")); query.first().then(function(duplicate) { if (typeof duplicate === "undefined") { console.log("New installation .."); response.success(); // Allows Insertion } else { console.log("Duplicate exist .."); duplicate.destroy(); // Removes old response.success(); // Allows new insertion } }, function(error) { console.warn(err…
type: Answer
answers question: http://stackoverflow.com/q/24393027
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/54471169

http://stackoverflow.com/comment/37755203
score: 0
comment on: http://stackoverflow.com/q/24406890
type: Comment
type: QuestionComment
has text: I know, not an answer, but consider abandoning Ant and going with Maven or Gradle: so much more convenient in combination with Android.

http://stackoverflow.com/comment/37503293
comment on: http://stackoverflow.com/q/24273872
type: Comment
type: QuestionComment
score: 0
has text: `private GOPlayer paddle = new GOPlayer();` maybe? I can't see that you're initializing `paddle`.

http://stackoverflow.com/q/24375998
tagged with: java
tagged with: sharedpreferences
has comment: http://stackoverflow.com/comment/37697869
has comment: http://stackoverflow.com/comment/37697241
type: Question
score: 0
has comment: http://stackoverflow.com/comment/37697419
has title: SharedPreference long not translating to a String when using .valueOf()
has comment: http://stackoverflow.com/comment/37697234
has body: I am not sure why but for some strange reason this long is not converting to a string to be used to programatically fire off a message to the desired .valueOf(constants.myNumber) Here is the code I am using: shortMessageManager.sendTextMessage(String.valueOf(constants.myNumber), null, "Hey there Tom its Bob from the office down the hall.", null, null); Here is the code used to save the number - Set with in an onClickListener: String num1String = num1.getText().toString(); Long longNum1 = Long.parseLong(num1String); SharedPreferences.Editor editor = prefs.edit(); prefs.edit().putLong(constants.myNumber, longNum1).commit(); here is the code I am trying to pull from: import android.content.SharedPreferences; public class constants { public static String PREF_NAME = "sharedString"; public static String myNumber = "myNumber"; SharedPreferences prefs; } I get the feeling I am missing something silly in here and maybe a second set of eyes looking at it can help. Any ideas?
has comment: http://stackoverflow.com/comment/37697817
has comment: http://stackoverflow.com/comment/37697738
tagged with: android
has comment: http://stackoverflow.com/comment/37697936
has comment: http://stackoverflow.com/comment/37697281
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37697591
has comment: http://stackoverflow.com/comment/37697455

http://stackoverflow.com/q/24385102
type: Question
has comment: http://stackoverflow.com/comment/37714829
has body: I have a war file which I had deployed in tomcat server - window and able to access it. Now in unix I installed tomcat and deployed the same war. Configured server.xml file providing ip on these places where localhost were present. &lt;Engine name="Catalina" defaultHost="aaa.bb.cc.dd"&gt; &lt;Host name="aaa.bb.cc.dd" appBase="webapps" unpackWARs="true" autoDeploy="true"&gt; I tried http://aaa.bb.cc.dd:8080/MY_APP and my browser says could not connect to the latter. What did I do wrong in this? Anything I missed out? Thanks.
has comment: http://stackoverflow.com/comment/37713978
tagged with: apache
tagged with: tomcat
score: 0
has comment: http://stackoverflow.com/comment/37714901
has comment: http://stackoverflow.com/comment/37714848
has title: Not able to access tomcat from unix
tagged with: unix
has comment: http://stackoverflow.com/comment/37728344
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37714051
tagged with: web-applications
has comment: http://stackoverflow.com/comment/37714788
tagged with: java
has comment: http://stackoverflow.com/comment/37714564
has comment: http://stackoverflow.com/comment/37714107
has comment: http://stackoverflow.com/comment/37715131
has comment: http://stackoverflow.com/comment/37715088

http://stackoverflow.com/q/24270546
favorite count: 0
tagged with: openoffice.org
has answer: http://stackoverflow.com/a/24995176
has comment: http://stackoverflow.com/comment/37775006
has comment: http://stackoverflow.com/comment/37919990
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37772815
has comment: http://stackoverflow.com/comment/37662204
has comment: http://stackoverflow.com/comment/37653095
has answer: http://stackoverflow.com/a/25460867
has comment: http://stackoverflow.com/comment/37925254
answer count: 4
has comment: http://stackoverflow.com/comment/38849449
tagged with: java
has comment: http://stackoverflow.com/comment/37919935
has comment: http://stackoverflow.com/comment/37656665
upvote count: 10
has comment: http://stackoverflow.com/comment/37870937
has comment: http://stackoverflow.com/comment/37773538
type: Question
has comment: http://stackoverflow.com/comment/37836855
has comment: http://stackoverflow.com/comment/37689307
tagged with: jodconverter
has comment: http://stackoverflow.com/comment/37773201
has answer: http://stackoverflow.com/a/25088769
has comment: http://stackoverflow.com/comment/37727338
has body: I have created an application using JodConverter and Open-Office for converting an excel(.xlsx) to PDF, The application works fine but i am facing two problems The pages of output PDF is in the form of A4 size, since because of that certain worksheet content have been sliced off. since i want each worksheet of the excel as complete as in one page what ever the size. The no of worksheets were missing, say if my excel has 8 worksheet i am getting only two or three within the PDF output Even if we tried to convert to pdf directly from open-office, its giving the above similar issues Excel File - ss1.xlsx Output PDF - work.pdf can anyone please tell me some solution for this My code is as given below public class MyConverter { public static void main(String[] args) throws ConnectException { File inputFile = new File("C:/Users/Work/Desktop/ss1.xlsx"); File outputFile = new File("C:/Users/Work/Desktop/work.pdf"); // connect to an OpenOffice.org instance running on port 8100 OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100); connection.connect(); // convert DocumentConverter converter = new OpenOfficeDocumentConverter(connection); converter.convert(inputFile, outputFile); // close the connection connection.disconnect(); }
has answer: http://stackoverflow.com/a/25472883
has comment: http://stackoverflow.com/comment/37743849
tagged with: http://stackoverflow.com/tag/xlsx
has comment: http://stackoverflow.com/comment/37958759
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/37642894
has comment: http://stackoverflow.com/comment/37661754
downvote count: 0
score: 10
has comment: http://stackoverflow.com/comment/37958699
has title: Missing worksheets and page size issue when excel (.xlsx) convert to pdf (.pdf) using open office

http://stackoverflow.com/a/24295964
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/37545365
has comment: http://stackoverflow.com/comment/37545386
has comment: http://stackoverflow.com/comment/37545425
has comment: http://stackoverflow.com/comment/37545345
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37545401
answers question: http://stackoverflow.com/q/24295887
has body: You're mixing two different things here. Javascript is a client-side language for website scripting, and Java is a generic OO language that's useful for several projects and it works server-side. Now you want to define this in Java. You do this using a class: public class Player { private int x; private int y; private boolean cloned; public Player (int x, int y, boolean cloned) { this.x = x; this.y = y; this.cloned = cloned; } public void move (int x, int y) { this.x = x; this.y = y; } public Point getCoordinates() { return new Point(x, y); } } And then you instantiate as new Player(32, 32, false);. This is a very rough example and can indeed be improved but it's basically like this.
has comment: http://stackoverflow.com/comment/37545397

http://stackoverflow.com/comment/42180665
type: AnswerComment
has text: thanks! great idea, so far it works great for me in IE in chrome and FF it doesn't I also tried to make it work in FF and Chrome like the last comment here suggests without success https://stackoverflow.com/questions/21871623/pdf-object-messagehandler-onmessage-not-working-in-ie/26803677#26803677
type: Comment
comment on: http://stackoverflow.com/a/24774116
score: 0

http://stackoverflow.com/a/24912113
has body: I don't believe that this is possible with the Java Build pack that you listed. It's designed to deploy one WAR file as one application on CF. If you have multiple applications, you would simply push multiple separate application to CF. If you insist on pushing multiple WAR files into a single CF application, you'll need to customize or create your own build pack.
accepted answer of: http://stackoverflow.com/q/24365749
answers question: http://stackoverflow.com/q/24365749
has comment: http://stackoverflow.com/comment/38865832
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/comment/37548932
comment on: http://stackoverflow.com/a/24297656
has text: @user3580294 That simply is not true. Consider the following options: `Map<Integer, ?> arg1; Map map = arg1; map.put(3, "5");` or `Map<Integer, ?> arg1; Map map = arg1; Map<String, String> castedMap = (Map<String, String> map; map.put("4", "8");`
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24320109
linked to: http://stackoverflow.com/q/18387993
has title: How to integrate Spring and JSF
has answer: http://stackoverflow.com/a/24326458
has answer: http://stackoverflow.com/a/24320605
has answer: http://stackoverflow.com/a/24322777
accepted answer: http://stackoverflow.com/a/24320605
tagged with: jsf-2
has comment: http://stackoverflow.com/comment/37653413
possible better answer: http://stackoverflow.com/a/24322777
favorite count: 0
has comment: http://stackoverflow.com/comment/37656486
duplicate of: http://stackoverflow.com/q/18387993
tagged with: spring
answer count: 4
type: AnsweredQuestion
score: 2
tagged with: jsf
has comment: http://stackoverflow.com/comment/37649276
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/37653184
has answer: http://stackoverflow.com/a/25259571
downvote count: 1
type: Question
has body: How to integrate Spring and JSF? I followed Spring documentation (which is sparse on this subject) and googled some more and currently I found two working ways: JSF Managed Bean will be Spring @Component / @Named (but there doesn't seem to work JSF scopes, but only Spring scopes): @Component @Scope("request") public class ItemController { @Autowired private ItemService itemService; } I will use @ManagedBean, JSF scopes work, but I cannot autowire Spring bean using @Autowired, the bean must contain setter and I'm not sure if this is best practice: @ManagedBean @RequestScoped public class ItemController { @ManagedProperty("#{itemService}") private ItemService itemService; public void setItemService(ItemService itemService) { this.itemService = itemService; } } Something else?

http://stackoverflow.com/comment/37729828
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24392507
has text: Thank you so much for the help Mike, I really appreciate it. I'll get to the bottom of this eventually.
score: 0

http://stackoverflow.com/comment/37703038
has text: @MadProgrammer OH! So that makes so much more sense than anything on that link you sent. I think they were just too smart for me! OK, i'll jump on taking those out and ensuring my SpringLayouts and CardLayout do the job instead! I appreciate the heads up on that. :) Soon as I fix this stupid setIcon issue.. :(
comment on: http://stackoverflow.com/q/24378404
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37941465
score: 0
type: AnswerComment
type: Comment
has text: Sorry I tried something, but my class extands WebPage and not httpServlet. If I create a WebRequest or a requestcycle i got a problem: it is not a httpservletrequest and it is not multipart. So it is impossible...
comment on: http://stackoverflow.com/a/24407904

http://stackoverflow.com/comment/37535669
score: 0
comment on: http://stackoverflow.com/q/24276145
type: Comment
has text: Could you provide an example of how I would change the above to support that?
type: QuestionComment

http://stackoverflow.com/comment/37780467
type: QuestionComment
score: 2
has text: Please add the code where you draw the bitmaps on the canvas, otherwise it's impossible to help.
comment on: http://stackoverflow.com/q/24420238
type: Comment

http://stackoverflow.com/q/24304752
has answer: http://stackoverflow.com/a/49296204
tagged with: java
has comment: http://stackoverflow.com/comment/37567009
has comment: http://stackoverflow.com/comment/37564055
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/60008470
has comment: http://stackoverflow.com/comment/37570690
has comment: http://stackoverflow.com/comment/37570880
has body: I'm trying to handle authentication popup using the code below: FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("network.http.phishy-userpass-length", 255); profile.setPreference("network.automatic-ntlm-auth.trusted-uris", "x.x.x.x"); driver = new FirefoxDriver(profile); baseUrl="http://" + login + ":" + password + "@" + url; driver.get(baseUrl + "/"); When I execute the test, the page shows the authentication popup and still loading for a until I click cancel button. A that moment, I can access to the next page ,this mean that the authentication success but still always show the authentication popup
downvote count: 0
upvote count: 55
has answer: http://stackoverflow.com/a/31197377
has comment: http://stackoverflow.com/comment/78236491
favorite count: 0
has comment: http://stackoverflow.com/comment/118995247
linked to: http://stackoverflow.com/q/50834002
score: 55
linked to: http://stackoverflow.com/q/17066382
has title: How to handle authentication popup with Selenium WebDriver using Java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/39904257
has answer: http://stackoverflow.com/a/35918342
tagged with: selenium
tagged with: authentication
has answer: http://stackoverflow.com/a/24305626
has answer: http://stackoverflow.com/a/65517590
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/25945253
tagged with: popup

http://stackoverflow.com/q/24393985
type: Question
tagged with: drools
score: 0
has answer: http://stackoverflow.com/a/24394377
accepted answer: http://stackoverflow.com/a/24394377
answer count: 1
tagged with: static
has comment: http://stackoverflow.com/comment/37732544
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37731752
has body: I wish to make a reference to a static field present in a java class from within the when clause of a drool. I don't want to insert a fact representing this value, because the value is related to our system rather than our business logic. Specifically, it is for logging purposes. The link below seems to suggest that referring to a static variable from within a drl file is possible. Obviously this will work from the then clause. Is it possible to also refer to this value in a when clause? Keep in mind I prefer not to use eval statements as I understand they are a tool of last resort. http://drools.46999.n3.nabble.com/Access-a-static-variable-from-Java-file-to-DRL-File-td4023641.html UPDATE: Below is the code I need to fit the static call into. Basically, the drool should only fire if the log level is of a certain value. Java class: public class LoggingUtilities{ public static LogLevel logLevel = LogLevel.NONE; } drl file: import com.myproject.LoggingUtilities; rule "MyRule" when MyFact() then Log.writeOut("Some Stuff"); end
tagged with: java
has title: Drools reference static field
tagged with: mvel

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/24272610
tags question: http://stackoverflow.com/q/24405059
tags question: http://stackoverflow.com/q/24306682
tags question: http://stackoverflow.com/q/24347402
tags question: http://stackoverflow.com/q/24292908
tags question: http://stackoverflow.com/q/24406509
tags question: http://stackoverflow.com/q/24321568
tags question: http://stackoverflow.com/q/24313063
tags question: http://stackoverflow.com/q/24384050
tags question: http://stackoverflow.com/q/24319577
tags question: http://stackoverflow.com/q/24416888
tags question: http://stackoverflow.com/q/24407360
tags question: http://stackoverflow.com/q/24304242
tags question: http://stackoverflow.com/q/24277513
tags question: http://stackoverflow.com/q/24353871
tags question: http://stackoverflow.com/q/24412567
tags question: http://stackoverflow.com/q/24365242
tags question: http://stackoverflow.com/q/24415313
tags question: http://stackoverflow.com/q/24357633
tags question: http://stackoverflow.com/q/24407943
tags question: http://stackoverflow.com/q/24394326
tags question: http://stackoverflow.com/q/24415129
tags question: http://stackoverflow.com/q/24402963
tags question: http://stackoverflow.com/q/24314518
type: Tag
tags question: http://stackoverflow.com/q/24350740
tags question: http://stackoverflow.com/q/24426073
tags question: http://stackoverflow.com/q/24325690
tags question: http://stackoverflow.com/q/24369337
tags question: http://stackoverflow.com/q/24381676
tags question: http://stackoverflow.com/q/24339486
tags question: http://stackoverflow.com/q/24267162
tags question: http://stackoverflow.com/q/24312770
tags question: http://stackoverflow.com/q/24296878
tags question: http://stackoverflow.com/q/24426092
tags question: http://stackoverflow.com/q/24391570
tags question: http://stackoverflow.com/q/24318328
tags question: http://stackoverflow.com/q/24391258
tags question: http://stackoverflow.com/q/24405840
tags question: http://stackoverflow.com/q/24362044
tags question: http://stackoverflow.com/q/24313360
tags question: http://stackoverflow.com/q/24416869
tags question: http://stackoverflow.com/q/24342833
tags question: http://stackoverflow.com/q/24364936
tags question: http://stackoverflow.com/q/24271518
tags question: http://stackoverflow.com/q/24402110
tags question: http://stackoverflow.com/q/24361562
tags question: http://stackoverflow.com/q/24401009
tags question: http://stackoverflow.com/q/24325724
tags question: http://stackoverflow.com/q/24391051
tags question: http://stackoverflow.com/q/24312025
tags question: http://stackoverflow.com/q/24392403
tags question: http://stackoverflow.com/q/24396319
tags question: http://stackoverflow.com/q/24411956
tags question: http://stackoverflow.com/q/24370760
tags question: http://stackoverflow.com/q/24392235
tags question: http://stackoverflow.com/q/24385553
tags question: http://stackoverflow.com/q/24363231
tags question: http://stackoverflow.com/q/24416554
tags question: http://stackoverflow.com/q/24277188
tags question: http://stackoverflow.com/q/24336920
tags question: http://stackoverflow.com/q/24344298
tags question: http://stackoverflow.com/q/24281388
tags question: http://stackoverflow.com/q/24302956
tags question: http://stackoverflow.com/q/24282862
tags question: http://stackoverflow.com/q/24305686
tags question: http://stackoverflow.com/q/24379730
tags question: http://stackoverflow.com/q/24311866
tags question: http://stackoverflow.com/q/24322234
tags question: http://stackoverflow.com/q/24416905
tags question: http://stackoverflow.com/q/24421678
tags question: http://stackoverflow.com/q/24379909
tags question: http://stackoverflow.com/q/24303555
tag name: xml
tags question: http://stackoverflow.com/q/24310407
tags question: http://stackoverflow.com/q/24335039
tags question: http://stackoverflow.com/q/24268039
tags question: http://stackoverflow.com/q/24278810
tags question: http://stackoverflow.com/q/24270025
tags question: http://stackoverflow.com/q/24378497

http://stackoverflow.com/comment/37776899
comment on: http://stackoverflow.com/a/24407918
type: Comment
has text: There is no reference to any files in schema.xml. And it's not a problem while interpreting the file, it's just the parser stops at the first line because the file is not correct. Could you share a code sample to upload schema and solrconfig into DSE search, please ? (And maybe a piece of code to load schema or solrconfig file blob in cassandra table ?
type: AnswerComment
score: 0

http://stackoverflow.com/a/24368614
has comment: http://stackoverflow.com/comment/37781467
has comment: http://stackoverflow.com/comment/37711648
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24362841
score: 1
has body: This is slow for two reasons: (1) You don't have an efficient way to look up a node given an ID. For a graph of this size I'd recommend building a Map as you populate the graph, and using that map to implement findNode(). (2) Once you have your two nodes and you want to get the edge that connects them (if any), just use Graph.findEdge(). (1) is by far the biggest reason that your code is slow. (2) will not help as much, but it will also make your code easier to read and more elegant.
answers question: http://stackoverflow.com/q/24362841
has comment: http://stackoverflow.com/comment/37707850
has comment: http://stackoverflow.com/comment/37683710
has comment: http://stackoverflow.com/comment/37781453
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/24409920
has title: How to Get SelectOneRadio Value in Oracle ADF withour Value Change listener
tagged with: selectoneradio
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/24419746
favorite count: 0
tagged with: oracle-database
tagged with: oracle-adf
has answer: http://stackoverflow.com/a/24417168
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has body: I want to get the selected value in the SelectOneRadio in Oracle ADF jsff. The problem is that i dont want to refer each and every click to a ValueChangeListener. That creates a lot of server load. is there any way to get the value selected in the radio button and display it in an output text by partially updating it and all.. I have tried multiple Blogs all referring to use of BackingBean. Thanks in advance
possible better answer: http://stackoverflow.com/a/24417168
accepted answer: http://stackoverflow.com/a/24419746

http://stackoverflow.com/a/24418799
upvote count: 1
answers question: http://stackoverflow.com/q/24418743
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24418743
type: Answer
has body: Code injection is not prevented, instead code is prevented from bypassing the security manager, injected or not. You don't have access to raw memory (unless your SecurityManager lets you get access to Unsafe), so you can't mess with internals in pure Java.
score: 1

http://stackoverflow.com/comment/37591576
has text: Totally Gridbag: http://madbean.com/anim/totallygridbag/
comment on: http://stackoverflow.com/q/24320436
score: 0
type: QuestionComment
type: Comment

algorithm
tags question: http://stackoverflow.com/q/24291768
tags question: http://stackoverflow.com/q/24346805
tag name: algorithm
tags question: http://stackoverflow.com/q/24278630
tags question: http://stackoverflow.com/q/24328307
tags question: http://stackoverflow.com/q/24340844
tags question: http://stackoverflow.com/q/24316804
tags question: http://stackoverflow.com/q/24359234
tags question: http://stackoverflow.com/q/24280989
tags question: http://stackoverflow.com/q/24276341
tags question: http://stackoverflow.com/q/24315316
tags question: http://stackoverflow.com/q/24351240
tags question: http://stackoverflow.com/q/24286065
tags question: http://stackoverflow.com/q/24372387
tags question: http://stackoverflow.com/q/24417551
tags question: http://stackoverflow.com/q/24275296
type: Tag
tags question: http://stackoverflow.com/q/24343214
tags question: http://stackoverflow.com/q/24377067
tags question: http://stackoverflow.com/q/24394638
tags question: http://stackoverflow.com/q/24340967
tags question: http://stackoverflow.com/q/24317685
tags question: http://stackoverflow.com/q/24293821
tags question: http://stackoverflow.com/q/24317360
tags question: http://stackoverflow.com/q/24269147
tags question: http://stackoverflow.com/q/24276657
tags question: http://stackoverflow.com/q/24362335
tags question: http://stackoverflow.com/q/24372142
tags question: http://stackoverflow.com/q/24373922
tags question: http://stackoverflow.com/q/24368791

http://stackoverflow.com/comment/37563210
has text: probably you have messed up your xml file. Are there any errors in xml file? And if there is `import android.R` then delete it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24305683
score: 0

http://stackoverflow.com/a/24336155
has body: I might be leaving out details I am unfamiliar with myself. But as far as I know specifying the specific exception type, allows you to get more detailed info on the error in the log. Also eclipse and other ide's usually show a warning when it's "proper" to use try/catch blocks. Hope it answers the question to some extent
has comment: http://stackoverflow.com/comment/37621467
has comment: http://stackoverflow.com/comment/37621250
has comment: http://stackoverflow.com/comment/37621384
answers question: http://stackoverflow.com/q/24336123
type: Answer
has comment: http://stackoverflow.com/comment/37624130
has comment: http://stackoverflow.com/comment/37621305
score: 0

http://stackoverflow.com/comment/37546223
type: AnswerComment
comment on: http://stackoverflow.com/a/24296393
score: 0
type: Comment
has text: What I tried Object source = e.getSource(); System.out.println(source); It printed out a line of information but not the String. Can you explain the difference?

http://stackoverflow.com/a/45508525
has body: Instead of putting params along a request, try with the third parameter of the JsonObjectRequest object, which is a JSON object (jsonobj in my code). Something like: JsonObjectRequest jsObjRequest = new JsonObjectRequest(Request.Method.POST, URL, jsonobj, new Response.Listener&lt;JSONObject&gt;() { @Override public void onResponse(JSONObject response) { System.out.println("onResponse()"); ... } }); Check my answer here.
score: 0
answers question: http://stackoverflow.com/q/24414652
type: Answer

http://stackoverflow.com/comment/37678732
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24363580
has text: Try-with-resources remains a simpler and cleaner solution.

http://stackoverflow.com/q/24374986
score: 4
upvote count: 4
has answer: http://stackoverflow.com/a/56966255
answer count: 3
possible better answer: http://stackoverflow.com/a/24380379
has answer: http://stackoverflow.com/a/24379011
downvote count: 0
favorite count: 0
has title: Where Annotation in hibernate with date as clause
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24379011
tagged with: java
tagged with: hibernate
has body: I was wondering if there was a way to use the @Where(clause="") to bind a Set of things where is_active=1 AND expires_date &lt;= new Date() in a @OneToMany relationship. Something like this @Where(clause="is_active=1 AND expires_date &lt;=" + new Date()) Or can you only do it with constants? This code will not work just looking for a work around or if there is a way to do this. Thanks ahead.
type: Question
has answer: http://stackoverflow.com/a/24380379

http://stackoverflow.com/comment/37505550
comment on: http://stackoverflow.com/a/24275072
has text: To reformat your code, assuming you're using eclipse, see: http://stackoverflow.com/questions/15655126/how-to-auto-format-code-in-eclipse (then update your post so it's more readable)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37695356
type: Comment
score: 0
type: AnswerComment
has text: Where is this "TBA" stored? You need to post more of your code, and be more clear in your requirement.
comment on: http://stackoverflow.com/a/24374760

http://stackoverflow.com/comment/37690211
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24371965
type: AnswerComment
has text: @InfiniTech see my edited answer ,i.e. rewrite onclick function as in my answer.

http://stackoverflow.com/q/24381302
tagged with: java
accepted answer: http://stackoverflow.com/a/24381343
type: Question
score: 12
has comment: http://stackoverflow.com/comment/37707161
tagged with: callable
answer count: 1
downvote count: 0
has title: Callable<Void> as Functional Interface with lambdas
favorite count: 0
has comment: http://stackoverflow.com/comment/66629723
tagged with: void
upvote count: 12
has body: I am just learning about new java8 features. And here is my question: Why is it not allowed to use Callable&lt;Void&gt; as a functional interface for lambda expressions? (Compiler complains about returning value) And it is still perfectly legal to use Callable&lt;Integer&gt; there. Here is the sample code: public class Test { public static void main(String[] args) throws Exception { // works fine testInt(() -&gt; { System.out.println("From testInt method"); return 1; }); testVoid(() -&gt; { System.out.println("From testVoid method"); // error! can't return void? }); } public static void testInt(Callable&lt;Integer&gt; callable) throws Exception { callable.call(); } public static void testVoid(Callable&lt;Void&gt; callable) throws Exception { callable.call(); } } How to explain this behavior?
has comment: http://stackoverflow.com/comment/61873266
tagged with: lambda
tagged with: java-8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24381343

http://stackoverflow.com/comment/37774086
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24416772
type: Comment
has text: post your entire asynTask

http://stackoverflow.com/q/24366178
has answer: http://stackoverflow.com/a/24367000
answer count: 1
tagged with: shell
tagged with: unix
type: UnansweredQuestion
tagged with: spring
score: 0
tagged with: java
has body: I did a java project using spring framework. The project uses a properties file to read in jdbc properties. It also uses log4j properties file where I made logging configurations. How do I refer to these properties file in a shell script and run the .jar file. Can someone please also suggest a good directory structure for scripts, jar file, logs, properties file etc for this instance ?
tagged with: classpath
type: Question
has title: Shell Script for jar releases

http://stackoverflow.com/comment/37712721
comment on: http://stackoverflow.com/a/24383884
type: Comment
has text: I did it. not working.means when i got OK response,i start thread,but still the code in second class in not executing
score: 0
type: AnswerComment

http://stackoverflow.com/a/24376559
upvote count: 1
has body: You can do bit manipulations on signed bytes--they produce the same results you'd expect. The one thing you have to watch for is &gt;&gt;; this will fill in the leftmost bits with 1 if the signed byte is negative, but if you use &gt;&gt;&gt; (three &gt; signs), it will always fill the leftmost bits with 0, which in essence treats it like an unsigned byte even though it's signed. If you want the integer value of a byte and you want a value from 0 to 255: int value = ((int)yourByte) &amp; 0xFF; Or, in Java 8, you can use Byte.toUnsignedInt. [Actually, the cast isn't necessary, because yourByte and 0xFF will automatically get promoted to int before the &amp; is applied. However, I never remember that rule without looking it up, so the explicit cast is helpful to me.] If you want to do an ordered comparison of two bytes (or one byte and an integer literal) and treat them as unsigned, you can convert them both to int using one of the above methods and compare the ints.
has comment: http://stackoverflow.com/comment/37699674
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24376426
type: Answer

http://stackoverflow.com/comment/37749578
comment on: http://stackoverflow.com/q/24403796
score: 0
type: Comment
type: QuestionComment
has text: @Pablo the query, in particular the predicate

http://stackoverflow.com/comment/37592277
type: AnswerComment
has text: I wouldn't have to make a change would I? The only use of UpdatedGameElement is to signal that there exists an update() method inside of the extending object that can be called. What that method does is defined within each individual class.
type: Comment
comment on: http://stackoverflow.com/a/24320674
score: 0

http://stackoverflow.com/comment/37680044
has text: @axtavt, I get error during redirect and error message now looks like this "Request method 'DELETE' not supported". And I don't know how convert request type from delete to redirect.
type: QuestionComment
comment on: http://stackoverflow.com/q/24366069
score: 0
type: Comment

http://stackoverflow.com/q/24400827
has comment: http://stackoverflow.com/comment/37743966
answer count: 1
has answer: http://stackoverflow.com/a/24401007
has comment: http://stackoverflow.com/comment/37744035
has comment: http://stackoverflow.com/comment/37744321
has comment: http://stackoverflow.com/comment/37744349
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37744115
accepted answer: http://stackoverflow.com/a/24401007
has body: I am trying to parse an XML file into java class. But it is giving me an Error saying Could not find or load main class The XML file which i am parsing is in same directory as the PretechDOMReader.java file import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class PretechDOMReader { public static void main(String[] args) { try { File fXmlFile = new File("PretechDOM.xml"); DocumentBuilderFactory dbFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(fXmlFile); doc.getDocumentElement().normalize(); System.out.println("Order Details" + doc.getDocumentElement().getNodeName()); NodeList nList = doc.getElementsByTagName("Ordernumber"); for (int temp = 0; temp < nList.getLength(); temp++) { Node nNode = nList.item(temp); if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element eElement = (Element) nNode; Node orderedItem1 = (Node) (NodeList) eElement .getElementsByTagName("OrderedItem1").item(0) .getChildNodes().item(0); System.out.println("OrderedItem1 :" + orderedItem1.getNodeValue()); Node orderitemPrice = (Node) (NodeList) eElement .getElementsByTagName("OrderitemPrice").item(0) .getChildNodes().item(0); System.out.println("OrderitemPrice :" + orderitemPrice.getNodeValue()); Node orderitemTax = (Node) (NodeList) eElement .getElementsByTagName("OrderitemTax").item(0) .getChildNodes().item(0); System.out.println("OrderitemTax :" + orderitemTax.getNodeValue()); Node orderDiscount = (Node) (NodeList) eElement .getElementsByTagName("OrderDiscount").item(0) .getChildNodes().item(0); System.out.println("OrderDiscount :" + orderDiscount.getNodeValue()); } } } catch (Exception e) { e.printStackTrace(); } } } Here is my XML file <?xml version="1.0" encoding="UTF-8" standalone="no"?> <Order> Pepsi 10 10 20 Cocacola 11 11 22
type: Question
has comment: http://stackoverflow.com/comment/37743975
has comment: http://stackoverflow.com/comment/37744183
tagged with: java
has comment: http://stackoverflow.com/comment/37744187
tagged with: domparser
score: 0
has title: Error: Could not find or load main class while parsing an XML file
tagged with: xml-parsing

http://stackoverflow.com/q/24375047
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: scenebuilder
tagged with: javafx
accepted answer: http://stackoverflow.com/a/24376476
type: Question
answer count: 1
downvote count: 0
has title: JavaFX 8 SceneBuilder LineChart data type
has answer: http://stackoverflow.com/a/24376476
favorite count: 0
has body: It seems like when I create a LineChart in SceneBuilder it defaults to "String". That is: LineChart&lt;String, String&gt;. When I load it in code then try to add some data I get: Exception in thread "JavaFX Application Thread" java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.String It works fine if I create the chart in code instead: val chart = new LineChart[Number, Number]( new NumberAxis(), new NumberAxis()) I don't see any option in SceneBuilder that allows me to choose "Number" as the type of data the chart will have. What am I missing here?
upvote count: 1
tagged with: java-8

http://stackoverflow.com/comment/37542611
has text: The browser test is working for me so I am not sure why it fails for you.
type: Comment
comment on: http://stackoverflow.com/q/24293951
score: 0
type: QuestionComment

http://stackoverflow.com/q/24279722
answer count: 3
tagged with: keytool
possible better answer: http://stackoverflow.com/a/24282437
has title: Java/Spring UnrecoverableKeyException with SSL
has body: Please note: although this specific question involves the Ldaptive library, I strongly believe that it is purely a Java keytool/SSL/Spring question at heart. I am using Ldaptive on my Java (Spring) app server for authenticating users against an LDAP/AD server. When I deploy the WAR to Tomcat and start it up, I get the following exception: (Large stack trace above this, below is the root exception) ... 70 more Caused by: java.security.UnrecoverableKeyException: requested entry requires a password at java.security.KeyStoreSpi.engineGetEntry(KeyStoreSpi.java:459) at java.security.KeyStore.getEntry(KeyStore.java:1290) at org.ldaptive.ssl.KeyStoreUtils.getEntry(KeyStoreUtils.java:129) at org.ldaptive.ssl.KeyStoreSSLContextInitializer.createTrustManagers(KeyStoreSSLContextInitializer.java:116) at org.ldaptive.ssl.AbstractSSLContextInitializer.getTrustManagers(AbstractSSLContextInitializer.java:41) at org.ldaptive.ssl.AbstractSSLContextInitializer.initSSLContext(AbstractSSLContextInitializer.java:84) at org.ldaptive.ssl.TLSSocketFactory.initialize(TLSSocketFactory.java:68) at org.ldaptive.provider.jndi.JndiProvider.getJndiStartTLSConnectionFactory(JndiProvider.java:162) ... 83 more The error is coming from this Spring bean: &lt;bean id="sslConfig" class="org.ldaptive.ssl.SslConfig"&gt; &lt;property name="credentialConfig"&gt; &lt;bean class="org.ldaptive.ssl.KeyStoreCredentialConfig" p:keyStore="file:/etc/myapp/keys.jks" p:keyStorePassword="password" p:keyStoreType="JKS" p:keyStoreAliases="kw-dj93d3j9-29kd-dj9k-dkow-dk3jd93jsjs8" /&gt; &lt;/property&gt; &lt;/bean&gt; As you can see, I'm telling Ldaptive to look on my local file system, under /etc/myapp, to find a Java KeyStore called keys.jks. In this keystore is a key named "kw-dj93d3j9-29kd-dj9k-dkow-dk3jd93jsjs8". When I use keytool to inspect this key: cd /etc/myapp keytool -list -keystore keys.jks Enter keystore password: password Keystore type: JKS Keystore provider: SUN Your keystore contains 1 entry kw-dj93d3j9-29k…
tagged with: spring
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24282800
type: Question
has answer: http://stackoverflow.com/a/24315462
tagged with: ssl
accepted answer: http://stackoverflow.com/a/24315462
score: 0
has answer: http://stackoverflow.com/a/24282437

http://stackoverflow.com/q/24311496
has comment: http://stackoverflow.com/comment/37575604
type: Question
linked to: http://stackoverflow.com/q/1545501
has answer: http://stackoverflow.com/a/24311552
upvote count: 5
has body: I have this confusing code: public class Confusing { private Confusing(Object o){ System.out.println("Object"); } private Confusing(double[]dArray){ System.out.println("double array"); } public static void main(String[] args){ new Confusing(null); } } When "compiled" and run the program displays "double array" why arrays precede Object? Is there any other constructor situation where such confusing behavior will occur?
answer count: 2
score: 5
has title: why constructors with array as parameter precede constructors with Object in parameter [java]?
downvote count: 0
linked to: http://stackoverflow.com/q/12057333
favorite count: 0
possible better answer: http://stackoverflow.com/a/24311609
tagged with: constructor
accepted answer: http://stackoverflow.com/a/24311552
has answer: http://stackoverflow.com/a/24311609
duplicate of: http://stackoverflow.com/q/1545501
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37574294

http://stackoverflow.com/q/24412899
answer count: 1
has answer: http://stackoverflow.com/a/24416795
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37766678
has title: Java Web Start Eclipse from Java Application
tagged with: java-web-start
accepted answer: http://stackoverflow.com/a/24416795
tagged with: jnlp
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
upvote count: 1
tagged with: plugins
has body: I created a Java GUI Application: it's ok! Now I want to create a JNLP from my project with Eclipse: is it possible? How? I try the "Java Web Start Plugin" but I can't install it (Eclipse say "don't find the jar file"). Any suggestion?

http://stackoverflow.com/comment/100162936
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24320811
has text: The link "you are looking for second one" is not working .

http://stackoverflow.com/comment/37527401
comment on: http://stackoverflow.com/a/24283982
score: 0
type: AnswerComment
has text: yeah it uses the arity engine. Actually many calculator apps use that library. I edited the answer for more info
type: Comment

http://stackoverflow.com/comment/37603236
comment on: http://stackoverflow.com/q/24315436
type: Comment
type: QuestionComment
has text: get 10 items in my list
score: 0

http://stackoverflow.com/q/24341853
answer count: 1
has comment: http://stackoverflow.com/comment/37635277
has title: Alpha blending not working on Android libgdx but works on Desktop
tagged with: java
has answer: http://stackoverflow.com/a/24346791
tagged with: libgdx
has comment: http://stackoverflow.com/comment/37635257
downvote count: 0
type: UnansweredQuestion
has body: I'm having a weird problem with alpha blending in libgdx. What I'm doing is drawing a background picture, drawing a mask (done using ShapeRenderer) and then drawing the foreground. The mask works fine on my Desktop but not on my Android devices (Galaxy S2, Lenovo ideaTab A2109). I really have no idea what's going on. Could someone help me out? Or at least give me a hint on what's going on. Thanks Result on my Desktop: Result on my phone: My Render function: Gdx.gl.glClearColor(0f, 0f, 0f, 0); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.setProjectionMatrix(camera.combined); camera.zoom = 1f; camera.update(); batch.begin(); drawBackground(batch); batch.end(); frameBuffer.begin(); line.drawMask(false); frameBuffer.end(); fboRegion.setTexture(frameBuffer.getColorBufferTexture()); batch.begin(); drawMask(batch); drawForeground(batch) batch.end(); draw functions: private void drawBackground(SpriteBatch batch){ batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); page1.draw(batch); page2.draw(batch); batch.flush(); } private void drawMask(SpriteBatch batch){ Gdx.gl.glColorMask(false, false, false, true); batch.setBlendFunction(GL20.GL_ONE, GL20.GL_ZERO); batch.draw(fboRegion, 0, 0); batch.flush(); } private void drawForeground(SpriteBatch batch){ Gdx.gl.glColorMask(true, true, true, true); batch.setBlendFunction(GL20.GL_DST_ALPHA, GL20.GL_ONE_MINUS_DST_ALPHA); page3.draw(batch); batch.flush(); } Edit: How about using shaders instead of an Alpha Mask? e.g. replace all white pixels from ShapeRenderer with foreground image pixels. Is it a good idea?
tagged with: blending
score: 2
favorite count: 0
type: Question
upvote count: 2
tagged with: opengl-es-2.0
tagged with: android

http://stackoverflow.com/q/24414509
has comment: http://stackoverflow.com/comment/37769369
has comment: http://stackoverflow.com/comment/37771409
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37770707
has comment: http://stackoverflow.com/comment/37775060
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37769821
has title: Java Converting from String to int/dbl with Buffered Reader
tagged with: switch-statement
type: Question
has comment: http://stackoverflow.com/comment/37769350
has body: I am using buffered reader to read variables from a csv and calculate new variables. In this case REG is an int and DEP is a double. I need to make my calculation based on the value of REG. But it seems importing the String variable won't allow me to make the calculation. public class CalcTest { static String REG; static String DEP; static String TEMP; public static void main(String[] args) { String csvFile = "M:\\MandNDrives\\mwallace\\JAVA for NEMS\\EORModule\\NEMSEORDBEX1.csv"; BufferedReader br = null; String line = ""; String cvsSplitBy = ","; try { br = new BufferedReader(new FileReader(csvFile)); br.readLine(); while ((line = br.readLine()) != null) { String [] reservoir = line.split(cvsSplitBy); REG = reservoir[3]; DEP = reservoir[4]; } }catch (FileNotFoundException e) { }catch (IOException e) { } } //calculate variables not found in WLOIL public void varCalc(){ switch (REG){ case 1: TEMP = 0.107*DEP+61.065; break; case 2: TEMP = 0.0123*DEP+80.302; break; } System.out.println(TEMP);
has comment: http://stackoverflow.com/comment/37775872
tagged with: bufferedreader
score: 0
has comment: http://stackoverflow.com/comment/37772832
tagged with: string

http://stackoverflow.com/a/24406436
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24403747
has body: I had the same problem. Ajay's answer works good for me. Steps I followed: double click on 'Tomcat at localhost' (or whatever name) in 'servers' view. In server options tick the check box of 'serve modules without publishing.' REF: Technical details of serve modules without publishing in Eclipse WTP and Tomcat?

http://stackoverflow.com/q/24299724
score: 1
tagged with: java
tagged with: scenebuilder
tagged with: javafx
has answer: http://stackoverflow.com/a/24311291
type: Question
has comment: http://stackoverflow.com/comment/37552616
has comment: http://stackoverflow.com/comment/37560315
has comment: http://stackoverflow.com/comment/37553706
accepted answer: http://stackoverflow.com/a/24311291
has comment: http://stackoverflow.com/comment/37560046
favorite count: 0
has comment: http://stackoverflow.com/comment/37553559
has comment: http://stackoverflow.com/comment/37561596
tagged with: javafx-8
answer count: 1
has title: Switch between tabs in tabpane
has body: Is it possible to switch between tabs in tab pane with delay in JavaFX? For example I want to when I change selection tab to tab2 I see a transition on the tab that is selected and then tab2 will be shown .
has comment: http://stackoverflow.com/comment/37561709
has comment: http://stackoverflow.com/comment/37553404
has comment: http://stackoverflow.com/comment/37553644
tagged with: javafx-2
upvote count: 2
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/37546443
comment on: http://stackoverflow.com/a/24292784
score: 0
type: AnswerComment
type: Comment
has text: I need to know if I access non annotated fields is it a bad practice

http://stackoverflow.com/q/24312147
tagged with: inputstream
answer count: 2
possible better answer: http://stackoverflow.com/a/24312316
has title: BufferedWriter/PrintWriter/OutputStreamWriter don't flush buffer until .close() is called (over socket outputstream)
upvote count: 1
tagged with: outputstream
favorite count: 0
has body: Whenever I call .flush() on any of the writers in the title (who are wrapping an OutputStreamWriter), the flushed data is not sent; however, when .close() is called on the writer, it flushes and the server can read the data. I don't know if I am calling .write() or .readLine() incorrectly, or if, since the read operation has already blocked, that is the problem? I need to find a way to flush the data without closing the socket (I'll be using this in another program). In both of the SSCCE's I have, there are System.out.println()'s for debugging. In the client, it will go to "check 4" and loop on nothing (it does more read and writing in the actual program, just can't have it close in the example). In the server, it gets to "check 2" and blocks at reader.readLine(). I've read around on SO, but all I've come up with is that readLine() isn't a good idea for network programs, and that I should implement my own protocol; however none of the posts point to a good tutorial site, or anything else with good network coding tutorials. Here are the SSCCEs: Client SSCCE package testClient; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.net.Socket; import java.net.UnknownHostException; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.spec.InvalidKeySpecException; import java.security.spec.KeySpec; import java.util.Random; import javax.crypto.Cipher; import javax.crypto.CipherOutputStream; import javax.crypto.NoSuchPaddingException; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.PBEKeySpec; import javax.crypto.spec.SecretKeySpec; public class Client { public static void main(String[] args) { try { Socket s = new Socket("127.0.0.1",48878); System.out.println("check 1"); PrintWriter pw = new PrintWriter(new OutputStreamWriter…
has answer: http://stackoverflow.com/a/24312316
tagged with: flush
tagged with: sockets
type: AnsweredQuestion
downvote count: 0
type: Question
has answer: http://stackoverflow.com/a/24312271
accepted answer: http://stackoverflow.com/a/24312271
score: 1
tagged with: java

http://stackoverflow.com/comment/37672981
comment on: http://stackoverflow.com/a/24363011
type: AnswerComment
has text: @HenrikPaul most likely it's a widgeset config issue which he'd encounter with other add-ons as well if not resolved. +1 for the update on the refresher integration. membersound I think Paul is referring to https://vaadin.com/wiki/-/wiki/Main/Using+polling
type: Comment
score: 2

http://stackoverflow.com/q/24292307
accepted answer: http://stackoverflow.com/a/24292656
type: Question
tagged with: database
downvote count: 0
answer count: 1
score: 1
favorite count: 0
has body: Considering this INFO 8/4/12 7:16 AM:liquibase: Successfully acquired change log lock INFO 8/4/12 7:16 AM:liquibase: Creating database history table with name: `DATABASECHANGELOG` INFO 8/4/12 7:16 AM:liquibase: Reading from `DATABASECHANGELOG` INFO 8/4/12 7:16 AM:liquibase: Reading from `DATABASECHANGELOG` INFO 8/4/12 7:16 AM:liquibase: ChangeSet db.changelog.xml::1::shameer ran successfully in 74ms INFO 8/4/12 7:16 AM:liquibase: Successfully released change log lock Liquibase Update Successful I am not sure if liquibase needs to write to database in order to Successfully acquired change log lock The reason is that temporarily I do not have read-write password, but just read-only password with me, to deploy to production I wanted to check if liquibase will be able to lock the database. P.S. Since the database state has not changed, it is not needed to apply any new changesets
has answer: http://stackoverflow.com/a/24292656
type: AnsweredQuestion
tagged with: java
has title: Does Liquibase needs write permission to acquire lock?
upvote count: 1
tagged with: liquibase

google-app-engine
tags question: http://stackoverflow.com/q/24343466
tags question: http://stackoverflow.com/q/24282297
tag name: google-app-engine
tags question: http://stackoverflow.com/q/24348542
type: Tag
tags question: http://stackoverflow.com/q/24287195
tags question: http://stackoverflow.com/q/24332490
tags question: http://stackoverflow.com/q/24339247
tags question: http://stackoverflow.com/q/24404679
tags question: http://stackoverflow.com/q/24337194
tags question: http://stackoverflow.com/q/24401006
tags question: http://stackoverflow.com/q/24343546
tags question: http://stackoverflow.com/q/24279897
tags question: http://stackoverflow.com/q/24373019
tags question: http://stackoverflow.com/q/24403951
tags question: http://stackoverflow.com/q/24349328
tags question: http://stackoverflow.com/q/24276238
tags question: http://stackoverflow.com/q/24311824
tags question: http://stackoverflow.com/q/24330518
tags question: http://stackoverflow.com/q/24387855
tags question: http://stackoverflow.com/q/24295593
tags question: http://stackoverflow.com/q/24310654
tags question: http://stackoverflow.com/q/24354870
tags question: http://stackoverflow.com/q/24400578
tags question: http://stackoverflow.com/q/24323194
tags question: http://stackoverflow.com/q/24344485
tags question: http://stackoverflow.com/q/24378419
tags question: http://stackoverflow.com/q/24334680
tags question: http://stackoverflow.com/q/24343731
tags question: http://stackoverflow.com/q/24412246
tags question: http://stackoverflow.com/q/24319938
tags question: http://stackoverflow.com/q/24345249
tags question: http://stackoverflow.com/q/24396055
tags question: http://stackoverflow.com/q/24405634
tags question: http://stackoverflow.com/q/24321175
tags question: http://stackoverflow.com/q/24309172
tags question: http://stackoverflow.com/q/24339432
tags question: http://stackoverflow.com/q/24381283
tags question: http://stackoverflow.com/q/24341540
tags question: http://stackoverflow.com/q/24331044
tags question: http://stackoverflow.com/q/24323269
tags question: http://stackoverflow.com/q/24307484
tags question: http://stackoverflow.com/q/24388217

string
tags question: http://stackoverflow.com/q/24423019
tags question: http://stackoverflow.com/q/24401008
tags question: http://stackoverflow.com/q/24369433
tags question: http://stackoverflow.com/q/24408727
tags question: http://stackoverflow.com/q/24325494
tags question: http://stackoverflow.com/q/24387775
tags question: http://stackoverflow.com/q/24366622
tags question: http://stackoverflow.com/q/24273925
tags question: http://stackoverflow.com/q/24312480
tags question: http://stackoverflow.com/q/24279310
tags question: http://stackoverflow.com/q/24350023
tags question: http://stackoverflow.com/q/24364465
tags question: http://stackoverflow.com/q/24308606
tags question: http://stackoverflow.com/q/24313932
tags question: http://stackoverflow.com/q/24300482
tags question: http://stackoverflow.com/q/24323548
tags question: http://stackoverflow.com/q/24364355
tags question: http://stackoverflow.com/q/24277307
tags question: http://stackoverflow.com/q/24410152
tags question: http://stackoverflow.com/q/24398828
tags question: http://stackoverflow.com/q/24316461
tags question: http://stackoverflow.com/q/24327888
tags question: http://stackoverflow.com/q/24362335
tags question: http://stackoverflow.com/q/24323722
tags question: http://stackoverflow.com/q/24397661
tags question: http://stackoverflow.com/q/24395364
tags question: http://stackoverflow.com/q/24298913
tags question: http://stackoverflow.com/q/24320304
tags question: http://stackoverflow.com/q/24301857
tag name: string
tags question: http://stackoverflow.com/q/24294638
tags question: http://stackoverflow.com/q/24267448
tags question: http://stackoverflow.com/q/24349085
tags question: http://stackoverflow.com/q/24376072
tags question: http://stackoverflow.com/q/24403340
tags question: http://stackoverflow.com/q/24324271
tags question: http://stackoverflow.com/q/24324909
tags question: http://stackoverflow.com/q/24363050
tags question: http://stackoverflow.com/q/24337645
tags question: http://stackoverflow.com/q/24370456
tags question: http://stackoverflow.com/q/24414509
tags question: http://stackoverflow.com/q/24310221
tags question: http://stackoverflow.com/q/24425237
tags question: http://stackoverflow.com/q/24316561
tags question: http://stackoverflow.com/q/24309781
type: Tag
tags question: http://stackoverflow.com/q/24417234
tags question: http://stackoverflow.com/q/24380515
tags question: http://stackoverflow.com/q/24280665
tags question: http://stackoverflow.com/q/24328693
tags question: http://stackoverflow.com/q/24357115
tags question: http://stackoverflow.com/q/24401222
tags question: http://stackoverflow.com/q/24359461
tags question: http://stackoverflow.com/q/24376980
tags question: http://stackoverflow.com/q/24382878
tags question: http://stackoverflow.com/q/24312643
tags question: http://stackoverflow.com/q/24346310
tags question: http://stackoverflow.com/q/24295487
tags question: http://stackoverflow.com/q/24348098
tags question: http://stackoverflow.com/q/24354273
tags question: http://stackoverflow.com/q/24325598
tags question: http://stackoverflow.com/q/24344792
tags question: http://stackoverflow.com/q/24356765
tags question: http://stackoverflow.com/q/24396200
tags question: http://stackoverflow.com/q/24395994
tags question: http://stackoverflow.com/q/24300238
tags question: http://stackoverflow.com/q/24364139
tags question: http://stackoverflow.com/q/24353071
tags question: http://stackoverflow.com/q/24383939
tags question: http://stackoverflow.com/q/24324761
tags question: http://stackoverflow.com/q/24314917
tags question: http://stackoverflow.com/q/24304091
tags question: http://stackoverflow.com/q/24402585
tags question: http://stackoverflow.com/q/24300566
tags question: http://stackoverflow.com/q/24318137
tags question: http://stackoverflow.com/q/24286400
tags question: http://stackoverflow.com/q/24349598
tags question: http://stackoverflow.com/q/24349101
tags question: http://stackoverflow.com/q/24401478
tags question: http://stackoverflow.com/q/24325690

http://stackoverflow.com/q/24392463
tagged with: http
type: Question
has comment: http://stackoverflow.com/comment/37728904
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24392507
tagged with: java
tagged with: forms
has body: I hope that the title of my question accurately describes the problem I'm having, but in case it doesn't... I'm using HttpPost to submit a form to log-in to a website (my schools'), and am testing to see what happens if I put in bogus information into the username/ password fields; for example, if for my username I input "Kioop", and for my password, "jukli", I want to read that HttpResponse. I've looked at the source code for what happens when I login successfully and when I don't login successfully, and when I don't successfully login it displays a little error message: "Couldn't login..." However, when I try to read that using an InputStream, I only get the original source code of the URL. Sorry if that's a terrible explanation, but here's the code I'm using: DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httpost = new HttpPost("https://web.wm.edu/studenthappenings/preview.php?"); try { List&lt;NameValuePair&gt; nvps = new ArrayList&lt;NameValuePair&gt;(); nvps.add(new BasicNameValuePair("user", username)); nvps.add(new BasicNameValuePair("pass", password)); httpost.setEntity(new UrlEncodedFormEntity(nvps)); } catch (UnsupportedEncodingException e) { // writing error to Log e.printStackTrace(); } try { HttpResponse response = httpclient.execute(httpost); InputStream input = response.getEntity().getContent(); // writing response to log BufferedReader in = new BufferedReader(new InputStreamReader(input)); String inputLine; while ((inputLine = in.readLine()) != null){ System.out.println(inputLine); } in.close(); } catch (ClientProtocolException e) { // writing exception to log e.printStackTrace(); } catch (IOException e) { // writing exception to log e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/37730075
tagged with: apache
answer count: 1
has title: Read HttpResponse of URL after using HttpPost to submit form log-in
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/24392507

http://stackoverflow.com/q/24267677
type: Question
has body: Is there a way to save where a drag and drop image button was placed by the user so that the next time the app is started, the imagebutton will be in the place it was left last? I am assuming shared preferences would work, but I have heard that when the app is updated, shared preferences are forgotten so I would like to save the coordinates if possible in my database. I just have no idea how to get the coordinates I need to be able to save them. The thing I would like best is to just be able to save the x and y coordinates if possible. Thanks for any help.
tagged with: java
tagged with: database
has answer: http://stackoverflow.com/a/27914884
accepted answer: http://stackoverflow.com/a/27914884
tagged with: mobile
answer count: 1
tagged with: imagebutton
score: 0
has title: Saving the position of a Drag and drop ImageButton
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/a/24405686
has comment: http://stackoverflow.com/comment/37753444
has comment: http://stackoverflow.com/comment/37753570
has comment: http://stackoverflow.com/comment/37753238
type: Answer
has body: First check if the file exists (File.Exists) if so try to open for write within try and catch block, if exception is generated then it is used by another process. However finding something through exception is not the best way! You can try this : protected virtual bool IsFileLocked(FileInfo file) { FileStream stream = null; try { stream = file.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.None); } catch (IOException) { //the file is unavailable because it is: //still being written to //or being processed by another thread //or does not exist (has already been processed) return true; } finally { if (stream != null) stream.Close(); } //file is not locked return false; }
downvote count: 2
has comment: http://stackoverflow.com/comment/37753361
answers question: http://stackoverflow.com/q/24405595
upvote count: 0
score: -2

http://stackoverflow.com/comment/37709270
type: Comment
has text: Low level Api only.., not any JDO or JPA
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24381283

http://stackoverflow.com/a/24298113
type: Answer
has body: The broadcast intent also includes the call state (idle, ringing, offhook). You can read it with the key Telephony.EXTRA_STATE, then compare it with the possible values. For example: String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE); if (TelephonyManager.EXTRA_STATE_RINGING.equals(state)) { String phoneNumber = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER); // call your asynctask ... }
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24297077
answers question: http://stackoverflow.com/q/24297077
score: 0

http://stackoverflow.com/q/24373981
tagged with: serialization
type: UnansweredQuestion
upvote count: 2
has title: Serializing ECJ GP Individual for later execution
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/29684522
has body: Using Genetic Programming with ECJ 21, I'm looking for suggestions on how to serialize a ec.Individual (after successful(?) evolution). The trick is, I then need to deserialize this GP at a later stage, and execute it...preferably outside of the ECJ framework (there seems to be a LOT of scaffolding involved in "executing" a GP while working in the ECJ framework, since that is actually aimed at EVOLVING the thing, not "running" it). I have sorta something almost there with this: public static void main (String [] args) { File f = new File("./my.params"); if (!f.exists() ) { throw new InvalidParameterException(f.getName() + " does NOT exist"); } ParameterDatabase pd = new ParameterDatabase(f, new String []{f.getCanonicalPath()}); Output output = ec.Evolve.buildOutput(); EvolutionState evs = ec.Evolve.initialize(pd, 0,output); evs.run(EvolutionState.C_STARTED_FRESH); Individual [] individuals = ((SimpleStatistics)evs.statistics).getBestSoFar(); String bestIndividStr = ""; for (Individual individual : individuals) { bestIndividStr = printToLog(evs, individual); } Species s = individuals[0].species; s = new GPSpecies(); Individual gpInd = s.newIndividual(evs, new LineNumberReader(new StringReader(bestIndividStr))); } private static String printToLog(EvolutionState evs, Individual individual) { String bestIndividStr; ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintWriter pw = new PrintWriter(baos); individual.printIndividual(evs, pw); pw.append(System.lineSeparator()); pw.close(); bestIndividStr = baos.toString(); LoggerFactory.getLogger(Evolve.class).info("Best Dude: \n{}",bestIndividStr); return bestIndividStr; } Ok, some of the problems with this: How do I now feed in some variables and evaluate the gpInd? In this sample situation, I have the original Individual available, so I can get the Species reference from that (which is then used to create a new individual from the output of the original). In my real situation, I won't have that. Writing my own pa…
tagged with: genetic-programming
score: 2
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/24280970
has answer: http://stackoverflow.com/a/24281242
type: Question
tagged with: google-maps
answer count: 1
tagged with: javascript
tagged with: google-maps-api-3
score: 0
has title: How to select Markers from Google map change some values is DB for selected markers
type: UnansweredQuestion
has body: Hi im having an req that i need select some markers and call some action to change DB value for Egg. if im displaying 4 markers on map and i want to change some value of 2 markers in DB now i'm able to display markers but im not getting how to do above task can any one please help me let me know if u want much more info below is my code &lt;div id="LangLat" style="display: none;"&gt; &lt;s:property value="content" /&gt; &lt;/div&gt; &lt;script type="text/javascript"&gt; var loc = document.getElementById("LangLat").innerHTML; y = loc.replace(new RegExp("&amp;quot;", "g"), "\""); locations = JSON.parse(y); var ini_loc = new String(locations[1]); var lonLati = ini_loc.split(","); var map = new google.maps.Map(document.getElementById('map'), { zoom : 13, center : new google.maps.LatLng(lonLati[1], lonLati[0]), mapTypeId : google.maps.MapTypeId.ROADMAP }); var infowindow = new google.maps.InfoWindow(); var marker, i; for (i = 0; i &lt; locations.length; i++) { marker = new google.maps.Marker({ position : new google.maps.LatLng(locations[i][1], locations[i][0]), map : map, icon : locations[i][2] }); google.maps.event.addListener(marker, 'click', (function(marker, i) { return function() { infowindow.setContent(locations[i][0]); infowindow.open(map, marker); } })(marker, i)); } &lt;/script&gt; above code display's all markers now i want to bring up an check box to select some markers and an submit action which changes some value in DB for selected marker Thanks in advance Manju
tagged with: java

http://stackoverflow.com/q/24365704
type: Question
has title: How convert curl call into java HttpPostcall
has body: I have curl command: curl -k -f --header "Authorization: bearer cb084803-xxxx-xxxx-xxxx-2a275e112c38 " --header "Content-Type:multipart/form-data" --header "X-PartnerUserId:login01" --form "title=fileName" --form "tag=mytag" --form "archive=@test.pdf;type=application/pdf" -X POST https://api.EXAMPLEAPI.com/api/v2.0/doc And I want to create HTTP Request in Java API which will do the same thing But i don't know how can'i do for the param (--form ....) Map&lt;String, String&gt; mapResponse = new HashMap&lt;String, String&gt;(); String resourceURL = config.getProperty(OAuthConstants.RESOURCE_SERVER_URL_UPLOAD); OAuth2Details oauthDetails = createOAuthDetails(config); HttpPost httpPost = new HttpPost(resourceURL); httpPost.setHeader(OAuthConstants.AUTHORIZATION, getAuthorizationHeaderForAccessToken(oauthDetails.getAccessToken())); httpPost.setHeader(OAuthConstants.CONTENTE_TYPE, OAuthConstants.ENCODED_CONTENT_DATA); httpPost.setHeader(OAuthConstants.PARTNERUSERID, login); //------------------------------------------------------------------------ httpPost.set... // add: --form "title=fileName" httpPost.set... // add: --form "tag=mytag" httpPost.set... // add: --form "archive=@test.pdf;type=application/pdf" //------------------------------------------------------------------------ DefaultHttpClient httpClient = new DefaultHttpClient(); HttpResponse response = null; int code = -1; try { response = httpClient.execute(httpPost); code = response.getStatusLine().getStatusCode(); Any help appreciated.
has comment: http://stackoverflow.com/comment/37678027
score: 0
linked to: http://stackoverflow.com/q/2304663
has comment: http://stackoverflow.com/comment/37678999
tagged with: curl
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37678919
tagged with: http-headers
has comment: http://stackoverflow.com/comment/37677658

http://stackoverflow.com/q/24338073
answer count: 2
has body: Can someone tell me what I need to do to get ImageObserver to work. I thought this would work. I'd like it to print a message when the image loads but it doesn't... What am I doing wrong? This can probably be answered easily. import java.awt.Graphics; import java.awt.Image; import java.awt.image.BufferedImage; import java.awt.image.ImageObserver; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.JFrame; import javax.swing.JPanel; public class ImageTest extends JPanel implements ImageObserver { @Override public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) { if((infoflags &amp; ALLBITS) == 0) { System.out.println("Processing still"); return true; } else { System.out.println("Done processing"); return false; } } public void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(img, 0, 0, this); } BufferedImage img; public ImageTest (){ try { img = ImageIO.read(new File("res/soccer-ball.jpg")); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void main(String args[]) { JFrame f = new JFrame(); f.setContentPane(new ImageTest()); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(1000, 1000); f.setVisible(true); } }
upvote count: 1
has comment: http://stackoverflow.com/comment/37625536
tagged with: java
tagged with: image
accepted answer: http://stackoverflow.com/a/24338146
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
score: 1
possible better answer: http://stackoverflow.com/a/24338170
has answer: http://stackoverflow.com/a/24338170
has title: ImageObserver not working
has answer: http://stackoverflow.com/a/24338146

http://stackoverflow.com/comment/37567164
comment on: http://stackoverflow.com/q/24307440
has text: Thanks for the answer and sorry, perhaps my comment was confusing. In the first code snippet I could just make $numberOfTires$ public. But I follow the second snippet in my code now for the reasons explained above. If I have an instance of Bike at hand I could still make $numberOfTires$ public and access it. But if I operate on a set of Vehicle, I only can access the info via the abstract method (or after an ugly checked cast on Bike).
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24426738
has comment: http://stackoverflow.com/comment/37791975
possible better answer: http://stackoverflow.com/a/24428411
type: Question
has answer: http://stackoverflow.com/a/24428411
tagged with: transactions
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/37793294
upvote count: 4
has answer: http://stackoverflow.com/a/24428917
has comment: http://stackoverflow.com/comment/37792412
has answer: http://stackoverflow.com/a/24429186
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/37792863
favorite count: 0
has comment: http://stackoverflow.com/comment/37794391
has comment: http://stackoverflow.com/comment/37796040
has body: I want to use a transaction manager in my application using Hibernate and JPA. I started by configuring applicationContext.xml (I also want to use c3p0 but i'll configure it later): <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:component-scan base-package="dao,business" /> com.mysql.jdbc.Driver validate org.hibernate.dialect.MySQL5Dialect thread true <!-- <prop key="hibernate.cache.provider_configuration_file_resource_path" value="classpath:ehcache.xml --> <tx:annotation-driven /> </beans> My DAO look like this: package dao.impl; import dao.CategoryDao; import entity.Category; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; @Repository @Transactional public class CategoryDaoJpa implements CategoryDao { @PersistenceContext private EntityManager em; @Override public int save(Category entity) { em.persist(entity); return entity.getId(); } @Override public void remove(Category entity) { em.remove(entity); } @Override public void remove(int id) { em.createQuery("DELETE FROM Category WHERE id=:id").setParameter("id", id).executeUpdate(); } @Override public void update(Category entity) { em.merge(entity); } @Override public Category load(int id) { return em.find(Category.class, id); } @Override public List<Category> loadAll() { return em.createQuery…
has comment: http://stackoverflow.com/comment/37793633
tagged with: spring
has answer: http://stackoverflow.com/a/24431089
answer count: 4
score: 4
type: AnsweredQuestion
has title: Unable to perform insert/update/delete
has comment: http://stackoverflow.com/comment/37793674
accepted answer: http://stackoverflow.com/a/24431089

http://stackoverflow.com/comment/37699834
has text: It still has not shown up is the problem still in onCreateOptionsMenu?
type: Comment
comment on: http://stackoverflow.com/a/24377230
score: 0
type: AnswerComment

http://stackoverflow.com/q/24377153
type: UnansweredQuestion
tagged with: android-actionbar
has body: In my android app, I am trying to add icons to the ActionBar in my FragmentActivity; however, it remains blank. I want to actionbar to have two icons from block.xml &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context=".SetupActivity" &gt; &lt;item android:id="@+id/action_overflow" android:title="@string/action_settings" android:orderInCategory="100" android:icon="@drawable/ic_action_overflow" app:showAsAction="always" /&gt; &lt;item android:id="@+id/action_search" android:title="@string/search" android:orderInCategory="200" android:icon="@drawable/ic_action_search" app:showAsAction="always" /&gt; &lt;/menu&gt; I am trying to follow this: onCreateOptionsMenu not being called on FragmentActivity when run on phone version Here is my BlockActivity class which extends FragmentActivity. I am unsure why the ActionBar is unable to be edited in spite of having the onCreateOptionsMenu method. package com.spicycurryman.getdisciplined10.app; import android.annotation.TargetApi; import android.app.FragmentTransaction; import android.os.Build; import android.os.Bundle; import android.app.ActionBar; import android.support.v4.app.FragmentActivity; import android.support.v4.view.ViewPager; import android.view.Menu; import android.view.MenuInflater; import info.androidhive.tabsswipe.adapter.TabsPagerAdapter; // /** * Created by Spicycurryman on 6/17/14. */ public class BlockActivity extends FragmentActivity implements ActionBar.TabListener { private ViewPager viewPager; private TabsPagerAdapter mAdapter; private ActionBar actionBar; // Tab titles private String[] tabs = {"Installed", "System", "Custom"}; @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.block_apps); // Initilization viewPager = (ViewPager) findViewById(R.id.pager); act…
tagged with: android-fragments
tagged with: java
linked to: http://stackoverflow.com/q/6936842
type: Question
score: 0
answer count: 1
has title: Editing the ActionBar with a FragmentActivity that implements ActionBar.TabListener
has answer: http://stackoverflow.com/a/24377230
tagged with: android
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/37701622
has text: You might also like to have a read through [Should I avoid the use of set(Preferred|Maximum|Minimum)Size methods in Java Swing?](http://stackoverflow.com/questions/7229226/should-i-avoid-the-use-of-setpreferredmaximumminimumsize-methods-in-java-swi)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24378404
type: Comment

http://stackoverflow.com/a/24374736
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37694997
has comment: http://stackoverflow.com/comment/37695699
has comment: http://stackoverflow.com/comment/37694940
has comment: http://stackoverflow.com/comment/37695183
has body: You can't override static variables (see Is there a way to override class variables in Java?), and assigning a value to a protected static variable from a static block of a subclass won't work as you want either: class Base { protected static String value = "Base"; public static String getValue() { return value; } } class Derived extends Base { static { value = "Derived"; } } class Main { public static void main(String[] args) throws Exception { // Make sure we run static initializer for Derived class Class.forName("Derived"); System.out.println(Derived.getValue()); System.out.println(Base.getValue()); } } This will print: Derived Derived That is probably not what you want. For the same reason your current code will have listeners set shared across different subclasses. If you are fine with having addListener and removeListener non-static, you can go with something like this: // AbstractEvent.java public abstract class AbstractEvent&lt;T extends AbstractEvent.EventListener&gt; { public interface EventListener { } protected static Map&lt;Class&lt;? extends AbstractEvent&gt;, Set&lt;EventListener&gt;&gt; listeners = new HashMap&lt;&gt;(); public final boolean addListener(T listener) { Set&lt;EventListener&gt; eventListeners = listeners.getOrDefault(getClass(), new HashSet&lt;&gt;()); if (!listeners.containsKey(getClass())) { listeners.put(getClass(), eventListeners); } return eventListeners.add(listener); } public final boolean removeListener(T listener) { Set&lt;EventListener&gt; eventListeners = listeners.get(getClass()); if (eventListeners != null) { return eventListeners.remove(listener); } return false; } } // SomeEvent.java public class SomeEvent extends AbstractEvent&lt;SomeEvent.SomeEventListener&gt; { public interface SomeEventListener extends AbstractEvent.EventListener { void someMethod(); } } If you want to have addListener and removeListener static, then generics are not going to help you because you can't reference type parameters from static methods. In…
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/37695333
accepted answer of: http://stackoverflow.com/q/24374029
answers question: http://stackoverflow.com/q/24374029

http://stackoverflow.com/q/24379035
tagged with: spring-mvc
has title: In spring tiles configuration file there is a configuration like /{1}.jsp
tagged with: java
has body: I have a spring tiles configuration file, that contains following lines of code. Can anyone help me in understanding these lines. Also please guide me how to get this path ("/WEB-INF/jsp/contents/{1}.jsp") &lt;definition name="template-main" template="/WEB-INF/jsp/layouts/main.jsp"&gt; &lt;put-attribute name="header-content" value="/WEB-INF/jsp/sections/header.jsp" /&gt; &lt;put-attribute name="banner-content" value="/WEB-INF/jsp/sections/banner.jsp" /&gt; &lt;put-attribute name="footer-content" value="/WEB-INF/jsp/sections/footer.jsp" /&gt; &lt;/definition&gt; &lt;!-- anything that doesn't start with a slash is considered a definition here. --&gt; &lt;definition name="*" extends="template-main"&gt; &lt;put-attribute name="primary-content" value="/WEB-INF/jsp/contents/{1}.jsp" /&gt; &lt;/definition&gt;
type: Question
tagged with: jakarta-ee
downvote count: 0
answer count: 1
score: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24379693
upvote count: 1
tagged with: spring

http://stackoverflow.com/q/24289331
has comment: http://stackoverflow.com/comment/37534315
score: 0
has comment: http://stackoverflow.com/comment/37533717
has title: Spring: Not able to load bean reference file
has body: My web.xml looks like this: parentContextKey app.context there is a file with the name beanRefContext.xml at bin/target/projectName/WEB-INF/classes folder. Content of beanRefContext is standard. It lists other configuration files under the bean name app.context. Error org.springframework.beans.factory.access.BootstrapException: Unable to return specified BeanFactory instance: factory key [app.context], from group with resource name [classpath*:beanRefContext.xml]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'app.context' is defined 10:49:54,686 INFO [stdout] (ServerService Thread Pool -- 54) at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:402) ~[spring-beans-3.2.2.RELEASE.jar:3.2.2.RELEASE]
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/37535038
has comment: http://stackoverflow.com/comment/37534457
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37532888
has comment: http://stackoverflow.com/comment/37534320
has comment: http://stackoverflow.com/comment/37532986

http://stackoverflow.com/q/24333695
upvote count: 1
has body: I've got a need to run a NativeQuery insert command, without using my Hibernate entities. But I have concerns how this will affect any caching (L1 / L2) that may be done. From what I've read in blogs/etc it appears that Hibernate automatically flushes all caches as soon as it encounters any NativeQuery calls. Is this true? Knowing which tables I am manipulating with the native sql calls, am I able to disable Hibernate's automatic flushing and control specifically what to flush and what to maintain? Can this be done via annotation, or must it be done through calls to the EntityManagerFactory.getCache().evict()? Ex: entityManager.createNativeQuery( "INSERT INTO JOIN_TABLE (CONTRACT_ID, ATTACHMENT_ID ) VALUES( ?, ? )" .setParameter(1, 13) .setParameter(2, 25) .executeUpdate(); By default, it appears that hibernate is flushing my caches whether I request it or not. 2014-06-20 15:00:56,964 [http-bio-8880-exec-3] [127.0.0.1-5385277c1ecbbf5a] INFO org.hibernate.engine.internal.StatisticalLoggingSessionEventListener - Session Metrics { 70000 nanoseconds spent acquiring 1 JDBC connections; 0 nanoseconds spent releasing 0 JDBC connections; 2731000 nanoseconds spent preparing 21 JDBC statements; 11467000 nanoseconds spent executing 21 JDBC statements; 0 nanoseconds spent executing 0 JDBC batches; 0 nanoseconds spent performing 0 L2C puts; 0 nanoseconds spent performing 0 L2C hits; 0 nanoseconds spent performing 0 L2C misses; 28387000 nanoseconds spent executing 2 flushes (flushing a total of 18 entities and 17 collections); 674000 nanoseconds spent executing 2 partial-flushes (flushing a total of 2 entities and 2 collections) }
type: Question
tagged with: jpa
tagged with: caching
has title: How does Hibernate handle caching with NativeSQL calls?
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24335333
score: 1
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/37670096
score: 0
type: Comment
type: QuestionComment
has text: @MuthuramuPeriyaiah First of all, update the XSD references in your Spring XML configuration. Second, are you absolutely sure that you don't have any Spring 2.5 jars on the classpath? Third, post the code of `AppController` please
comment on: http://stackoverflow.com/q/24361392

eof
tags question: http://stackoverflow.com/q/24328545
type: Tag
tag name: eof

alignment
tags question: http://stackoverflow.com/q/24315757
tags question: http://stackoverflow.com/q/24407190
tag name: alignment
type: Tag

http://stackoverflow.com/q/24279405
favorite count: 0
type: Question
has body: Sorry for this noob question but I really don't know what to search and how to solve it.I have a table structure like this: This is only a part of my table. budget_cost has 1000000000.1 literal I tried to fetch the values while( result.next() ) { ProjectBean projectBean = new ProjectBean(); ... projectBean.setBudgetCost( result.getDouble( "budget_cost" ) ); ... } my model has setter and getter of each variables public class ProjectBean { ... private double profitRate; private double vatRate; private double fees; private double budgetCost; private String dateDeadline; ... } I tried to print the budgetCost and it prints 1.0E9 I need it to display 1000000000.1 what am I doing wrong?
has answer: http://stackoverflow.com/a/24279553
has comment: http://stackoverflow.com/comment/37513515
upvote count: 1
has comment: http://stackoverflow.com/comment/37513616
has title: Fetching large value from the database
answer count: 1
tagged with: java
tagged with: mysql
accepted answer: http://stackoverflow.com/a/24279553
type: AnsweredQuestion
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/3730019

http://stackoverflow.com/q/24282091
has title: why webappclassloader is not garbage collected ?
score: 4
has comment: http://stackoverflow.com/comment/37526214
answer count: 1
linked to: http://stackoverflow.com/q/7683434
tagged with: tomcat
favorite count: 0
type: UnansweredQuestion
tagged with: memory-leaks
upvote count: 4
has answer: http://stackoverflow.com/a/24304896
downvote count: 0
tagged with: java
tagged with: hibernate
tagged with: garbage-collection
type: Question
has body: I have a web service developped by spring/hibernate, and when I do deployment and undeployment on Tomcat 7 many times, I get an outOfMemoryError PermGen Memory leak. By using java VisualVM, I noticed that the previous webappClassLoader are still kept in JVM, so they are not garbage collected. What can be the reasons of this problem ? How can I detect which objects still have reference to the application class loader or any object loaded by it ? Thanks,

http://stackoverflow.com/a/24393832
answers question: http://stackoverflow.com/q/24361066
has body: If you want to go from ActiveMQ to a browser, take a look at enabling just Websockets within ActiveMQ and using the STOMP over Websockets javascript library. The body of the message will be a friendly text object. The links are at my answer here: Best way to display dynamic data in a webpage
has comment: http://stackoverflow.com/comment/37751846
type: Answer
score: 0

http://stackoverflow.com/comment/37783377
score: 0
type: QuestionComment
type: Comment
has text: @NikhilTalreja: that's not the problem. Point already has a toString. The issue is with the data he's adding to the list.
comment on: http://stackoverflow.com/q/24421820

http://stackoverflow.com/q/24405768
tagged with: java
has title: in jsp,button onclick not working
tagged with: servlets
type: Question
tagged with: jsp
tagged with: javascript
tagged with: ajax
score: 0
has body: I have a this java class: import java.io.*; public class sqlldrIam{ public static void chargement(){ try{ String sqlldrCmd="SQLLDR userid=scott/tiger control=C:\\Users\\imrane\\descktop\\imrane.ctl"; System.out.println("operateur sqlldr started"); Runtime.getRuntime().exec(sqlldrCmd); System.out.println("operateur sqlldr ended"); } catch(Exception e){ e.printStackTrace(); }}} and I have this jsp page: &lt;%@page import="dao.sqlldrIam"%&gt; &lt;%@page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transactional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt; &lt;title&gt;Reconciliation&lt;/title&gt; &lt;style type="text/css"&gt; @import url(yassir.css); @import url(imrane.css); &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;img src="C:\Users\imrane\Desktop\logo230.png"/&gt; &lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt; &lt;center&gt; &lt;h4&gt; Données opérateur&lt;/h4&gt; &lt;input type="submit" value="Chargement opérateur" onclick="&lt;%dao.sqlldrIam.chargement();%&gt;"&gt; &lt;/br&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;img src="C:\Users\imrane\Desktop\logo400.png"/&gt; &lt;/body&gt; &lt;/html&gt; the problem is that the onclick expects Javascript and me I give him java, then the waiter treats the code before I click on the short prop the solution is to make a function javascipt which calls on a servlet with ajax, and in the servlet one calls the method java. but one tried several times to do that without arriving at the good code. Thank you to give me the code.
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24407336

http://stackoverflow.com/q/24379056
has comment: http://stackoverflow.com/comment/37703557
has comment: http://stackoverflow.com/comment/37703534
tagged with: java
has title: how to get window title which is currently maximized means opened?
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5767104
has body: I am making an application to track record of currently opened windows on a pc. I copied this code from stack overflow. I implemented it and make it executed in every 15 seconds with threads.I am making an application in which i want to get only top window title means title of window which is currently maximized. ============================================================================= final List&lt;WindowInfo&gt; inflList=new ArrayList&lt;WindowInfo&gt;(); final List&lt;Integer&gt; order=new ArrayList&lt;Integer&gt;(); int top = User32.instance.GetTopWindow(0); while (top!=0) { order.add(top); top = User32.instance.GetWindow(top, User32.GW_HWNDNEXT); } User32.instance.EnumWindows(new WndEnumProc() { public boolean callback(int hWnd, int lParam) { if (User32.instance.IsWindowVisible(hWnd)) { RECT r = new RECT(); User32.instance.GetWindowRect(hWnd, r); if (r.left&gt;-32000) { byte[] buffer = new byte[1024]; User32.instance.GetWindowTextA(hWnd, buffer, buffer.length); String title = Native.toString(buffer); if (m.length == count) { // expand list m = Arrays.copyOf(m, m.length + arrayGrowth); } m[count]=Native.toString(buffer); System.out.println("title===="+m[count]); count++; inflList.add(new WindowInfo(hWnd, r, title)); } } return true; } }, 0); Collections.sort(inflList, new Comparator&lt;WindowInfo&gt;() { public int compare(WindowInfo o1, WindowInfo o2) { return order.indexOf(o1.hwnd)-order.indexOf(o2.hwnd); } }); for (WindowInfo w : inflList) { System.out.println(w); } } public static interface WndEnumProc extends StdCallLibrary.StdCallCallback { boolean callback (int hWnd, int lParam); } public static interface User32 extends StdCallLibrary { final User32 instance = (User32) Native.loadLibrary ("user32", User32.class); boolean EnumWindows (WndEnumProc wndenumproc, int lParam); boolean IsWindowVisible(int hWnd); int GetWindowRect(int hWnd, RECT r); void GetWindowTextA(int hWnd, byte[] buffer, int buflen); int GetTopWindow(int hWnd); int GetWindow(int hWnd, i…
has comment: http://stackoverflow.com/comment/37706846
answer count: 0
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37702943
type: Question
score: 3
has comment: http://stackoverflow.com/comment/37702973
upvote count: 3

http://stackoverflow.com/q/24335975
tagged with: texture2d
has body: I was working on a project, and for that project I had to walk through a book called "OpenGL ES 2 For Android: A quick start guide". So when I got to texturing, I got the error of: 'texture2D' : No matching overloaded function found ...when I compile the shader. The shader code: // Fragment shader precision mediump float; uniform sampler2D u_TextureUnit; varying vec4 v_TextureCoordinates; void main() { gl_FragColor = texture2D(u_TextureUnit, v_TextureCoordinates); } // Vertex shader uniform mat4 u_Matrix; attribute vec4 a_Position; attribute vec4 a_TextureCoordinates; varying vec4 v_TextureCoordinates; void main() { gl_Position = u_Matrix * a_Position; v_TextureCoordinates = a_TextureCoordinates; } I tried the same shaders for my project and for exactly the same code as in the book but it still gives me the same error when I compile the shader, and the viewport on the android device is blank, just the clear color I set is shown.
answer count: 1
tagged with: opengl-es
accepted answer: http://stackoverflow.com/a/24336183
favorite count: 0
tagged with: android
type: AnsweredQuestion
tagged with: glsl
tagged with: java
score: 9
type: Question
has answer: http://stackoverflow.com/a/24336183
upvote count: 9
downvote count: 0
has title: 'texture2D' : No matching overloaded function found OpenGL ES2?

http://stackoverflow.com/a/24402896
accepted answer of: http://stackoverflow.com/q/24402516
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24402516
type: AcceptedAnswer
upvote count: 1
type: Answer
has body: The reason for NullPointerException, is that in case you have no such login in DB. then the unique result will return null. To solve that you can just check that result is not null return null != crit.uniqueResult();

http://stackoverflow.com/q/24319978
has comment: http://stackoverflow.com/comment/37590608
has comment: http://stackoverflow.com/comment/37590783
has body: Here i need a solution for my problem. I have a table that contain 2 million records related with geo coordinates. To get a perticular row from the table, query execution time will be 24 seconds. Here i want a selection of above 500 records for my application aspects. So any one kindly suggest any solutio n for making my query faster. Query SELECT * FROM myProject.MAP where start_ip&lt;=419297593 and end_ip&gt;=419297593; Table structur Field,Type,Null,Key,Default,Extra start_ip,"int(10) unsigned",YES,MUL,NULL, end_ip,"int(10) unsigned",YES,MUL,NULL, country_id,int(11),NO,,NULL, lat,double,YES,,NULL, lng,double,YES,,NULL, id,int(11),NO,PRI,NULL,auto_increment
answer count: 3
possible better answer: http://stackoverflow.com/a/24320199
tagged with: sql
has answer: http://stackoverflow.com/a/24320199
score: 1
has answer: http://stackoverflow.com/a/24320340
has answer: http://stackoverflow.com/a/24321760
favorite count: 0
has comment: http://stackoverflow.com/comment/37590821
upvote count: 2
has comment: http://stackoverflow.com/comment/37590583
type: AnsweredQuestion
tagged with: mysql-workbench
tagged with: java
has comment: http://stackoverflow.com/comment/37590634
accepted answer: http://stackoverflow.com/a/24320340
has comment: http://stackoverflow.com/comment/37590428
tagged with: mysql
has comment: http://stackoverflow.com/comment/37590628
downvote count: 1
tagged with: hql
has comment: http://stackoverflow.com/comment/37590969
has comment: http://stackoverflow.com/comment/37590662
type: Question
has title: How to make my query selection faster over a 2 million records

http://stackoverflow.com/q/24278938
has comment: http://stackoverflow.com/comment/37512631
has comment: http://stackoverflow.com/comment/37512808
has title: Multi-threading -- a faster way?
has comment: http://stackoverflow.com/comment/37512899
tagged with: time
has comment: http://stackoverflow.com/comment/37512987
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/24279178
has answer: http://stackoverflow.com/a/24281311
has answer: http://stackoverflow.com/a/24279199
has body: I have a class with a getter getInt() and a setter setInt() on a certain field, say field Integer Int; of an object of a class, say SomeClass. The setInt() here is synchronized-- getInt() isn't. I am updating the value of Int from within multiple threads. Each thread is getting the value Int, and setting it appropriately. The threads aren't sharing any other resources in any way. The code executed in each thread is as follows. public void update(SomeClass c) { while (&lt;condition-1&gt;) // the conditions here and the calculation of // k below dont have anything to do // with the members of c if (&lt;condition-2&gt;) { // calculate k here synchronized (c) { c.setInt(c.getInt()+k); // System.out.println("in "+this.toString()); } } } The run() method is just invoking the above method on the members updated from within the constructor by the params passed to it: public void run() { update(c); } When I run this on large sequences, the threads aren't interleaving much-- i see one thread executing for long without any other thread running in between. There must be a better way of doing this. I can't change the internals of SomeClass, or of the class invoking the threads. How can this be done better? TIA. //===================================== EDIT: I'm not after manipulating the execution sequence of the threads. They all have the same priority. It`s just that what i see in the outcome is suggesting that the threads aren't sharing the execution time evenly-- one of them, once takes over, executing on. However, I can't see why this code should be doing this.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24279320
accepted answer: http://stackoverflow.com/a/24279320
tagged with: java
has answer: http://stackoverflow.com/a/24279352
type: Question
has answer: http://stackoverflow.com/a/24279178
answer count: 6
has answer: http://stackoverflow.com/a/24279033
score: 0
has comment: http://stackoverflow.com/comment/37513138
has comment: http://stackoverflow.com/comment/37512928

http://stackoverflow.com/comment/37778809
score: 0
type: QuestionComment
type: Comment
has text: What do you mean by "*right now this is returning all of the values as one*"? `List<String> values = entry.getValues();` looks like it returns you list of values. Can you be more precise what you have now and what you want to achieve?
comment on: http://stackoverflow.com/q/24419297

enums
tags question: http://stackoverflow.com/q/24383445
tags question: http://stackoverflow.com/q/24389533
tags question: http://stackoverflow.com/q/24336162
tags question: http://stackoverflow.com/q/24322414
tags question: http://stackoverflow.com/q/24381744
tags question: http://stackoverflow.com/q/24368555
tags question: http://stackoverflow.com/q/24278315
tags question: http://stackoverflow.com/q/24273746
tags question: http://stackoverflow.com/q/24313266
tag name: enums
tags question: http://stackoverflow.com/q/24308936
tags question: http://stackoverflow.com/q/24341117
tags question: http://stackoverflow.com/q/24411535
type: Tag
tags question: http://stackoverflow.com/q/24404706
tags question: http://stackoverflow.com/q/24296059
tags question: http://stackoverflow.com/q/24267799
tags question: http://stackoverflow.com/q/24276404
tags question: http://stackoverflow.com/q/24340958
tags question: http://stackoverflow.com/q/24338629
tags question: http://stackoverflow.com/q/24308194
tags question: http://stackoverflow.com/q/24416784
tags question: http://stackoverflow.com/q/24272804

http://stackoverflow.com/q/24306463
tagged with: lucene
upvote count: 3
answer count: 1
has answer: http://stackoverflow.com/a/24322824
accepted answer: http://stackoverflow.com/a/24322824
favorite count: 0
tagged with: multi-tenant
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
tagged with: hibernate
has body: The database I am working on has a multi-tenant design. I want to implement hibernate search on my application however I want hibernate search to index a certain tenant only. How do I achieve that?
type: Question
tagged with: hibernate-search
has title: Hibernate Search Indexing a single tenant

http://stackoverflow.com/q/24343955
type: UnansweredQuestion
score: -3
answer count: 4
has comment: http://stackoverflow.com/comment/37635822
has body: I tried to sort the string array in ascending order but I don't know exactly how to store the sorted elements into another string array. below is the code: String [] names= {"amazon", "apple", "facebook", "android", "sony"}; String[] sort= new String[names.length]; int i, j; String temp=null; for ( i = 0; i &lt; names.length - 1; i++ ) { for ( j = i + 1; j &lt; names.length; j++ ) { if ( names [ i ].compareToIgnoreCase( names [ j ] ) &gt; 0 ) { // ascending sort temp = names [ i ]; names [ i ] = names [ j ]; // swapping names [ j ] = temp; } } sort [i]= names[j]; } for ( int k = 0; k &lt; names.length; k++ ) System.out.println( sort [ k ] ); }
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/37636106
type: Question
has answer: http://stackoverflow.com/a/24344207
has comment: http://stackoverflow.com/comment/37635821
has comment: http://stackoverflow.com/comment/37636028
tagged with: arrays
has comment: http://stackoverflow.com/comment/37635889
has answer: http://stackoverflow.com/a/24344111
has answer: http://stackoverflow.com/a/24344122
has answer: http://stackoverflow.com/a/24344285
upvote count: 0
favorite count: 0
has title: sorting of string array

http://stackoverflow.com/a/24278408
answers question: http://stackoverflow.com/q/24278311
type: Answer
upvote count: 1
score: 1
downvote count: 0
has body: Call to br.readLine() will only read one line at a time.You can loop until br.readLine() not return null. String line=null; while((line=br.readLine())!=null){ //Do your stuff }

http://stackoverflow.com/a/24329612
type: Answer
has comment: http://stackoverflow.com/comment/37610408
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24328949
has body: If I understand your requirements correctly you should use the mock like this: when(myServiceMock.doSomeDoggyStuff(eq(1), any(Toy.class))).thenReturn(myObj); The way you have written your code, the mock will return myObj only when called with the Toy object which you instantiated it with, which is never since Spring will instantiate the class on it's own. The problem doesn't have anything to do with the number of arguments. If however you want to test for a specific Toy and not just any instance of it, you will need to add an equals (and to be correct with the spec, a hashCode) method so mockito can match the Toys. In the absence of any equals method, the references are checked and of couse those are not equals because the instances are not the same.
has comment: http://stackoverflow.com/comment/37608882
accepted answer of: http://stackoverflow.com/q/24328949
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37608716

http://stackoverflow.com/a/24336103
has body: You can use LambdaJ sorting feature like this: List&lt;Integer&gt; list = sort(list, on(Integer.class).getItem()); and then you can also use the old friend Apache common: String str = StringUtils.join(list); Or using Guava: String str = Joiner.on("").join(list); Or LambdaJ: String result = join(list, "");
type: Answer
answers question: http://stackoverflow.com/q/24335906
score: 0

http://stackoverflow.com/q/24319188
has comment: http://stackoverflow.com/comment/37589139
has comment: http://stackoverflow.com/comment/39461880
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/25316334
has title: ProgressBar(s) (Horizontal) not showing progress of (int)long
favorite count: 0
has comment: http://stackoverflow.com/comment/37589109
tagged with: android
has body: I have an app on the market and am adding a few horizontal ProgressBars. The first bar updates and displays correctly, no problems with it whatsoever. The second bar (identical code) is there, but showing no progress despite setting max and progress. I have tried invalidating (and postInvalidate()) the views with no luck. Here is some snippage: Layout.xml: &lt;TableRow android:layout_width="match_parent" android:gravity="center" &gt; &lt;TextView android:id="@+id/tvStorageAName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="0" android:layout_weight="1" android:padding="3dp" android:text="@string/storage_a" /&gt; &lt;TextView android:id="@+id/tvStorageA" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="1" android:layout_weight="1" android:padding="3dp" android:text="N/A" /&gt; &lt;ProgressBar android:id="@+id/progBarStorageA" style="?android:attr/progressBarStyleHorizontal" android:layout_width="0dp" android:layout_height="8dp" android:layout_column="2" android:layout_weight="2" android:background="@drawable/progbar_bg" android:indeterminate="false" android:indeterminateOnly="false" android:progressDrawable="@drawable/progbar_bg" /&gt; &lt;/TableRow&gt; &lt;TableRow android:layout_width="match_parent" android:gravity="center" &gt; &lt;TextView android:id="@+id/tvStorageBName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="0" android:layout_weight="1" android:padding="3dp" android:text="@string/storage_b" /&gt; &lt;TextView android:id="@+id/tvStorageB" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_column="1" android:layout_weight="1" android:padding="3dp" android:text="N/A" /&gt; &lt;ProgressBar android:id="@+id/progBarStorageB" style="?android:attr/progressBarStyleHorizontal" android:layout_width="0dp" android:layout_height="8dp" android:layout_column="2" android:layout_weight="2" a…
downvote count: 0
tagged with: android-progressbar
type: UnansweredQuestion
score: 1
tagged with: java
type: Question
tagged with: android-layout

http://stackoverflow.com/comment/37703436
comment on: http://stackoverflow.com/q/24379132
type: Comment
type: QuestionComment
has text: time constraint . as i haven't used JDBCTemplate previously it requires a learning curve.
score: 0

http://stackoverflow.com/q/24367252
tagged with: spring
accepted answer: http://stackoverflow.com/a/24370483
type: AnsweredQuestion
score: 0
type: Question
tagged with: jndi
tagged with: java
tagged with: hibernate
has title: Jboss JNDI name not found in hibernate configuration with Spring MVC
tagged with: jboss
has answer: http://stackoverflow.com/a/24370483
answer count: 1
has body: I recently migrated from Struts 1.2 to Spring MVC. I am trying to deploy ear in Jboss 7.1.1, and starting application from Scratch instead of using Action classes from Struts. I am using Hibernate as ORM tool for application. Earlier in Struts application, JNDI datasource lookup by hibernate configuration was no issue. But for some reason, the same configuration does not seem to work with Spring. I am getting following error again and again: Caused by: javax.naming.NameNotFoundException: env/oraclePool -- service jboss.naming.context.java.module.ExecEngine."ExecEngine.war".env.oraclePool The datasource in Jboss is configured in following way: ........ And hibernate configuration being used in hibernate.cfg.xml is: java:comp/env/oraclePool The name of the ear which I am trying to deploy is ExecEngine.ear having war and jar with the same name. The structure of this ear is: META-INF folder having MANIFEST.MF and application.xml lib folder ExecEngine.jar ExecEngine.war having WEB-INF folder which contains spring-servlet.xml and web.xml.

http://stackoverflow.com/q/24369540
type: Question
has title: Searching using Apache Lucene
answer count: 1
has answer: http://stackoverflow.com/a/24370038
tagged with: lucene
favorite count: 0
upvote count: 0
has body: I am using Apache lucene to search for a string within a file . What kind of parsing of does lucene use. If I search for obama it doesn't return results with Presobama while it returns results for #Obama. Can anyone tell me why? I am using TextField. StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_44); // Code to create the index Directory index = new RAMDirectory(); IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_44, analyzer); IndexWriter w = new IndexWriter(index, config); addDoc(w, finalstep); w.close(); String querystr = search; // The \"title\" arg specifies the default field to use when no field is explicitly specified in the query Query q = new QueryParser(Version.LUCENE_44, "title", analyzer).parse(querystr); // Searching code int hitsPerPage = 10; IndexReader reader = DirectoryReader.open(index); IndexSearcher searcher = new IndexSearcher(reader); TopScoreDocCollector collector = TopScoreDocCollector.create(hitsPerPage, true); searcher.search(q, collector); ScoreDoc[] hits = collector.topDocs().scoreDocs;
downvote count: 1
type: AnsweredQuestion
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/24370038

http://stackoverflow.com/q/24329395
has title: App hangs up or "Not on FX application thread" occurs during app activity
type: AnsweredQuestion
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/24333097
has body: The application reacts on actions which occur on gamepad. When button is pressed something happens on UI. But I ran at the issue with app hangs up or "java.lang.IllegalStateException: Not on FX application thread" exception. In order to fix it I tried the following approaches: Platform.runLater() and Task usage. But it didn't help. Here is the problem code: public class GamepadUI extends Application{ private static final int WIDTH = 300; private static final int HEIGHT = 213; private Pane root = new Pane(); private ImageView iv1 = new ImageView(); private boolean isXPressed = false; @Override public void start(Stage stage) throws Exception { initGUI(root); Scene scene = new Scene(root, WIDTH, HEIGHT); stage.setScene(scene); stage.setResizable(false); stage.show(); } public void pressBtn() { if(!isXPressed) { iv1.setVisible(true); isXPressed = true; } } public void releaseBtn() { if(isXPressed) { iv1.setVisible(false); isXPressed = false; } } private void initGUI(final Pane root) { Image image = new Image(Props.BUTTON); iv1.setImage(image); iv1.setLayoutX(198); iv1.setLayoutY(48); iv1.setVisible(false); root.getChildren().add(iv1); runTask(); } public void runTask() { Task task = new Task&lt;Void&gt;() { @Override protected Void call() throws Exception { initStubGamepad(); return null; } }; new Thread(task).start(); } public static void main(String[] args) { launch(args); } public void initStubGamepad() { Random rnd = new Random(); try { while (true) { if (rnd.nextInt(30) == 3) { pressBtn(); } else if (rnd.nextInt(30) == 7) { releaseBtn(); } } } catch (Exception ex) { System.out.println("Exception: " + ex); } } } initStubGamepad() emulates gamepad buttons activity polling. When user presses any button (rnd.nextInt(30) == 3) - an image appears on the UI. When user releases that button (rnd.nextInt(30) == 7) - an image disappears from the UI. In case above java.lang.IllegalStateException: Not on FX application thread occurs. If you change runTask() to something like th…
score: 12
type: Question
upvote count: 12
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24333097
favorite count: 0

http://stackoverflow.com/q/24426329
has comment: http://stackoverflow.com/comment/37791386
has comment: http://stackoverflow.com/comment/37792325
has answer: http://stackoverflow.com/a/24426838
has comment: http://stackoverflow.com/comment/37809829
tagged with: dictionary
has comment: http://stackoverflow.com/comment/37809742
has comment: http://stackoverflow.com/comment/37791245
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24426486
score: 0
tagged with: java
tagged with: set
accepted answer: http://stackoverflow.com/a/24426838
type: Question
has comment: http://stackoverflow.com/comment/37791316
has answer: http://stackoverflow.com/a/24426554
has body: I need a HashMap with the signature HashMap&lt;Integer, Double&gt; map; But I encapsulated two values like: class CustomKV { Integer key; Double value; } Hence, the Map&lt;&gt; becomes Set&lt;CustomKV&gt; customMap; If I were to use Map, when I wanted to iterate on the keys, map.keySet() would be sufficient. However, if I use the second, I have to iterate on the objects of CustomKV and then add all the keys, add them in a set, then return it. My question is: does Java have an optimization for this? Or each time I call keySet(), is it going to iterate on the objects? Edit: Here, I write the difference of two iterations: for(Integer i : map.keySet()) for(CustomKV kv : customMap()) it seems they are identical. But what I ask is, if I keep calling for(CustomKV kv : customMap) int key = kv.getKey(); Would it slow me down, or does Java recognize this and treat customMap as a map?
has title: Time Complexity of keySet() for encapsulated Map<> values
has comment: http://stackoverflow.com/comment/37791364
answer count: 3
possible better answer: http://stackoverflow.com/a/24426554
tagged with: time-complexity

http://stackoverflow.com/q/24331042
accepted answer: http://stackoverflow.com/a/24331079
tagged with: mocking
tagged with: mockito
tagged with: junit
downvote count: 0
favorite count: 0
has body: I am trying to Mock a method contained in the Main class of an application. I'd like to test that when all parameters are submitted successfully, the application calls the correct method, uploadFiles. The when - thenReturn pair is shown below: NrClient nrClient = (NrClient)Mockito.mock(NrClient.class); Mockito.when(nrClient.uploadFiles("DF49ACBC8", anyList(), "dl")).thenReturn(""); This shows as a runtime exception: "The method anyString() is undefined for the type MainTest." I have the imports: import org.mockito.Mockito; import org.mockito.Matchers; So why would this method be undefined? Is there an issue in my implementation? I have also tried anyString() and anyInt() with the same result.
has title: Mockito Matcher parameters showing as undefined
type: AnsweredQuestion
score: 1
upvote count: 1
possible better answer: http://stackoverflow.com/a/68672339
type: Question
has answer: http://stackoverflow.com/a/68672339
tagged with: java
has answer: http://stackoverflow.com/a/24331079
answer count: 2

http://stackoverflow.com/a/24378816
answers question: http://stackoverflow.com/q/24378709
type: Answer
has body: Just do One change. Initialize your this array out side of Constructor. Instrumento[] repInst = new Instrumento[20]; or initialize it with Object of that.
score: 0

http://stackoverflow.com/comment/37645734
type: QuestionComment
has text: ... 2) Java GUIs might have to work on a number of platforms, on different screen resolutions & using different PLAFs. As such they are not conducive to exact placement of components. To organize the components for a robust GUI, instead [use layout managers](http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html), or [combinations of them](http://stackoverflow.com/a/5630271/418556), along with layout padding & borders for [white space](http://stackoverflow.com/q/17874717/418556).
comment on: http://stackoverflow.com/q/24348854
score: 0
type: Comment

http://stackoverflow.com/q/24385281
has comment: http://stackoverflow.com/comment/37714640
has comment: http://stackoverflow.com/comment/37714593
has comment: http://stackoverflow.com/comment/37714372
accepted answer: http://stackoverflow.com/a/24385549
has title: Mocking a method which takes String as a parameter Mockito
has body: I am trying to mock a method which takes String as a parameter, Based on the string value i wanted to return different values, below is my Sample code when(mockVariableResolver.resolveVariable( (FacesContext)anyObject(), Mockito.eq(ProgramConstants.SRCH_PROC_DATA_BEAN))). thenReturn(searchProcedureCodeDataBean); The resolveVariable metjos takes an object and a string, Object might be anything but the second argument must match, The above one did not worked. EDIT: Signature for resolveVariable metod is fc.getApplication().getVariableResolver().resolveVariable(fc, "#{" + ProgramConstants.SRCH_PROC_DATA_BEAN + "}") Please help me on this.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37714789
has comment: http://stackoverflow.com/comment/37714606
score: 1
has comment: http://stackoverflow.com/comment/37714681
tagged with: java
possible better answer: http://stackoverflow.com/a/24385536
has answer: http://stackoverflow.com/a/24385549
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/24385536
answer count: 2
tagged with: mockito
has comment: http://stackoverflow.com/comment/37714620
has comment: http://stackoverflow.com/comment/37714603
has comment: http://stackoverflow.com/comment/37714440
downvote count: 1
favorite count: 0

http://stackoverflow.com/q/24347396
has body: i am trying to extract SIFT features from an image using JavaCV and OpenCV here is my code import java.io.File; import com.googlecode.javacv.cpp.opencv_core.CvMat; import com.googlecode.javacv.cpp.opencv_features2d.DescriptorExtractor; import com.googlecode.javacv.cpp.opencv_features2d.FeatureDetector; import com.googlecode.javacv.cpp.opencv_features2d.KeyPoint; import static com.googlecode.javacv.cpp.opencv_highgui.cvLoadImageM; import static com.googlecode.javacv.cpp.opencv_highgui.CV_LOAD_IMAGE_GRAYSCALE; public class test { static FeatureDetector featureDetector; static DescriptorExtractor descriptorExtractor; public static void main(String[] args) { featureDetector = FeatureDetector.create("SIFT"); descriptorExtractor=DescriptorExtractor.create("SIFT"); File file=new File("C:\\temp\\305.jpg"); CvMat image= cvLoadImageM(file.getAbsolutePath(),CV_LOAD_IMAGE_GRAYSCALE); if(image==null) System.out.println("image is null"); KeyPoint keypoints = new KeyPoint(null); featureDetector.detect(image,keypoints,null); CvMat featurs = new CvMat(null) ; descriptorExtractor.compute(image, keypoints, featurs); System.out.println(featurs); } } but the above code shows a NullPointerException on the line featureDetector.detect(image,keypoints,null); the image gets loaded successfully,i have checked. can anyone help me?
tagged with: javacv
score: 0
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/37642892
has answer: http://stackoverflow.com/a/24358834
type: UnansweredQuestion
has title: NullPointerException in javacv
tagged with: opencv
tagged with: sift
tagged with: java
has comment: http://stackoverflow.com/comment/37642925
type: Question

http://stackoverflow.com/comment/37747307
score: 0
comment on: http://stackoverflow.com/a/24402527
type: Comment
has text: that was just a typing mistake here only , thanks anyway
type: AnswerComment

http://stackoverflow.com/comment/116429994
comment on: http://stackoverflow.com/a/45945200
has text: Works fine for me on Windows 10. Openssl isn't strictly required if you use the `-rfc` option to `keytool -exportcert`, which exports using PEM format.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24296205
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/37546217
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24295357
has body: It might help you. Make the class or interface Generic rather than a method as shown below: public class RunnableRequest&lt;T extends ApiResponse&gt; implements Runnable { private Class&lt;T&gt; apiResponse; private Callback&lt;T&gt; callback; public RunnableRequest(Class&lt;T&gt; apiResponse, Callback&lt;T&gt; callback) { this.callback = callback; this.apiResponse = apiResponse; } @Override public void run() { String exampleResponse = "{\"result\":\"Success\",\"message\":\"Hello World\",\"error\":\"0\"}"; callback.apiRequestProcessFinished(new Gson().fromJson(exampleResponse, apiResponse)); } } public interface Callback&lt;T extends ApiResponse&gt; { public void apiRequestProcessFinished(T apiResponse); } static &lt;T extends ApiResponse&gt; RunnableRequest&lt;T&gt; createRequestRunnable(Class&lt;T&gt; apiResponse, Callback&lt;T&gt; callback) { return new RunnableRequest&lt;T&gt;(apiResponse, callback); }
answers question: http://stackoverflow.com/q/24295357
has comment: http://stackoverflow.com/comment/37546497
has comment: http://stackoverflow.com/comment/37546559

http://stackoverflow.com/a/24424574
has comment: http://stackoverflow.com/comment/91092917
type: Answer
answers question: http://stackoverflow.com/q/24424094
has body: You need to add the base template in your tiles definition. It should either extend a template or you must mention the path attrib at your defintion &lt;definition name="/error/generic_error" path= "{your-path}"&gt;
score: 4
upvote count: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24424094
downvote count: 0

http://stackoverflow.com/comment/37618139
type: Comment
type: QuestionComment
has text: Right now the predicate needs to be dynamic enough so that i can do a like query on either contact name or contact number and return a paged result.
comment on: http://stackoverflow.com/q/24317997
score: 0

http://stackoverflow.com/a/24322946
has body: The Button with ID messageButton is in fragment_main.xml. With findByViewById() you are accessing to activity_main.xml (setContentView(R.layout.activity_main);. You can add an attribute Button to the class and link the element in the onCreateView method of PlaceholderFragment. Then you can access to this button from anywhere in the activity.
accepted answer of: http://stackoverflow.com/q/24322758
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24322758
has comment: http://stackoverflow.com/comment/37600418

http://stackoverflow.com/q/24361283
has title: After ajax call redirect the response to another jsp
tagged with: jsp
tagged with: javascript
tagged with: jquery
has answer: http://stackoverflow.com/a/24361398
has body: I have an ajax call from a jsp page where it sends request to the ModelandView class in the controller. Ajax call in test.jsp function currentposition(l1, l2) { var url="home/test"; var data= 'lat1=' + l1 + '&amp;lat2=' + l2; $.ajax({ type:"POST", url:url, data:data, dataType:"json", success:function(responseJSON){ alert(responseJSON); } }); } Controller public ModelandView gettest(@Context HttpServletRequest request) { ModelandView responseView = new ModelandView(new JsonView()); //some code here if (somecondition) { response.addObject("JSONdata", vehicleID); } else { System.out.println("Not present"); } return responseView; } I am getting response from the controller to test.jsp and I am getting the desired results. But I want to redirect the results to another.jsp where the result should appear in the drop down list as follows. another.jsp &lt;select class="test" id="vehicle-id"&gt; &lt;option&gt;...&lt;/option&gt; &lt;/select&gt; How do I do this?
tagged with: ajax
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/37669730
has comment: http://stackoverflow.com/comment/37669763
linked to: http://stackoverflow.com/q/13621998
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24362772
tagged with: java
has answer: http://stackoverflow.com/a/33390235
has comment: http://stackoverflow.com/comment/37669681
type: Question

gwt
tags question: http://stackoverflow.com/q/24316976
tags question: http://stackoverflow.com/q/24298380
tags question: http://stackoverflow.com/q/24358356
tags question: http://stackoverflow.com/q/24313668
tag name: gwt
tags question: http://stackoverflow.com/q/24409109
tags question: http://stackoverflow.com/q/24345245
tags question: http://stackoverflow.com/q/24310654
type: Tag
tags question: http://stackoverflow.com/q/24316915
tags question: http://stackoverflow.com/q/24295895
tags question: http://stackoverflow.com/q/24425723
tags question: http://stackoverflow.com/q/24278347
tags question: http://stackoverflow.com/q/24291592
tags question: http://stackoverflow.com/q/24331335
tags question: http://stackoverflow.com/q/24406541
tags question: http://stackoverflow.com/q/24321175
tags question: http://stackoverflow.com/q/24277813
tags question: http://stackoverflow.com/q/24314319
tags question: http://stackoverflow.com/q/24289929
tags question: http://stackoverflow.com/q/24388490
tags question: http://stackoverflow.com/q/24358112
tags question: http://stackoverflow.com/q/24278468
tags question: http://stackoverflow.com/q/24384028
tags question: http://stackoverflow.com/q/24295858
tags question: http://stackoverflow.com/q/24405210
tags question: http://stackoverflow.com/q/24398826
tags question: http://stackoverflow.com/q/24397105
tags question: http://stackoverflow.com/q/24345920
tags question: http://stackoverflow.com/q/24334759
tags question: http://stackoverflow.com/q/24403634
tags question: http://stackoverflow.com/q/24406327

http://stackoverflow.com/a/24405175
has body: You must send EOL character. Without it, the line is not completed and readLine will not return it. Also, you take a look at NanoHTTPD which is HTTP server implementation that works smooth on Android and so you have not to do all the work from the scratch.
upvote count: 1
has comment: http://stackoverflow.com/comment/37755662
has comment: http://stackoverflow.com/comment/37773112
has comment: http://stackoverflow.com/comment/37773018
has comment: http://stackoverflow.com/comment/37759492
has comment: http://stackoverflow.com/comment/37783738
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24404497
has comment: http://stackoverflow.com/comment/37770265

http://stackoverflow.com/a/24402922
accepted answer of: http://stackoverflow.com/q/24402847
type: Answer
score: 0
has body: Make the message field static: static String message; Your main class is static (as it has to be). This means you don't have an instance of your class. But the field message is currently not static, this means it only exists as part of an instance. Since you don't have an instance you can't access it. As a side note: I strongly suggest you get someone to code review this code. There is a lot to learn. Consider submitting it to Code Review.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24402847

http://stackoverflow.com/comment/37577821
has text: Could you post a sample of the code that you would use in Java?
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24313411

http://stackoverflow.com/a/24305635
has comment: http://stackoverflow.com/comment/37566103
has body: I am not sure if this will work, just try the code : public boolean sendMail(final String senderEmail, final String password, String recipientEmail, String ccEmail, String bccEmail) { Properties props = System.getProperties(); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.port", "25"); Session session = Session.getInstance(props, null); try { MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(senderEmail)); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipientEmail)); if (ccEmail.length() &gt; 0) { message.setRecipients(Message.RecipientType.CC, InternetAddress.parse(ccEmail)); } if(bccEmail.length() &gt; 0){ message.setRecipients(Message.RecipientType.BCC, InternetAddress.parse(bccEmail)); } message.setSubject(this.subject); message.setSentDate(new Date()); message.setText(this.textMessage, "utf-8"); SMTPTransport t = (SMTPTransport) session.getTransport("smtps"); t.connect("smtp.gmail.com", senderEmail, password); t.sendMessage(message, message.getAllRecipients()); t.close(); System.out.println("Message sent successfully to '" + recipientEmail + "; " + ccEmail + "'."); return true; } catch (MessagingException e) { System.out.println("Message not sent to '" + recipientEmail + "; " + ccEmail + "'."); e.printStackTrace(); return false; } }
answers question: http://stackoverflow.com/q/24305418
score: 0
has comment: http://stackoverflow.com/comment/37598066
has comment: http://stackoverflow.com/comment/37567876
type: Answer
has comment: http://stackoverflow.com/comment/37590776
has comment: http://stackoverflow.com/comment/37596508
has comment: http://stackoverflow.com/comment/37568217

http://stackoverflow.com/a/33115693
type: Answer
has body: I had this issue for years and accidentally solved it by setting the width and packing the label twice. Note that multiline labels were never intended to figure out their own width, so you have to set them externally, preferably from it's parent. public Label createLabel() { // Create label and set wrap Label label = new Label("Some long string here...", skin); label.setWrap(true); // Pack label label.pack(); // This might not be necessary, unless you're changing other attributes such as font scale. // Manual sizing label.setWidth(textWidth); // Set the width directly label.pack(); // Label calculates it's height here, but resets width to 0 (bug?) label.setWidth(textWidth); // Set width again return label; } LibGDX version used: 1.6.4
upvote count: 7
score: 7
answers question: http://stackoverflow.com/q/24276180
downvote count: 0

http://stackoverflow.com/q/24291428
has answer: http://stackoverflow.com/a/24300580
has body: I am trying to download xml from a url. But I am getting java.io FileNotFound sdcard.cellofest.xml Permission Denied. Last line is generating the error. I have checked Google and found a lot of fixes, but none solved my problem. I do have the Write External Storage permission in the AndroidManifest. URL url = new URL("http://test.com/itsp/events/celloFest.xml"); // Create the new connection HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); // Set up some things on the connection... urlConnection.setRequestMethod("GET"); urlConnection.setDoOutput(true); // and connect! urlConnection.connect(); // Set the path where we want to save the file. // In this case, save it on the root directory of the // SD card "\" Log.d("xml download," , "just before downloading"); File SDCardRoot = Environment.getExternalStorageDirectory(); // Create a new file, specifying the path, and the filename, // Chich we want to save the file as. Log.d("xml download" , "Sd card root found"); File file = new File(SDCardRoot,"cellofest.xml"); Log.d("xml download" ,"fest.xml created."); //this will be used to write the downloaded data into the file we created FileOutputStream fileOutput = new FileOutputStream(file);
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/37540927
accepted answer: http://stackoverflow.com/a/24300580
has comment: http://stackoverflow.com/comment/37540687
answer count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/37537767
type: Question
linked to: http://stackoverflow.com/q/4506612
type: AnsweredQuestion
tagged with: android
has title: file not found exception android fileoutput stream
score: 1
has answer: http://stackoverflow.com/a/24291766
has answer: http://stackoverflow.com/a/24301389
favorite count: 0
possible better answer: http://stackoverflow.com/a/24291766
has comment: http://stackoverflow.com/comment/37540819
upvote count: 1
has answer: http://stackoverflow.com/a/24300352

http://stackoverflow.com/comment/56586059
comment on: http://stackoverflow.com/q/24413102
has text: This old question is unfortunately far too broad, so I am voting to close.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24367590
score: 0
has body: The new operator instantiates a class by allocating memory for a new object and returning a reference to that memory. So instantiating a class means the same thing as creating an object, When you create an object, you are creating an instance of a class, therefore "instantiating" a class.
type: Answer
answers question: http://stackoverflow.com/q/24367472

http://stackoverflow.com/q/24328840
has answer: http://stackoverflow.com/a/50640391
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24329031
type: Question
upvote count: 4
has body: So, I set my timer: timer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { ... } }, 5, 5); so I want to trigger this run() for testing something, not wait until it gets triggered. Is there a way?
downvote count: 0
accepted answer: http://stackoverflow.com/a/50640391
score: 4
answer count: 3
possible better answer: http://stackoverflow.com/a/24328869
linked to: http://stackoverflow.com/q/409932
has answer: http://stackoverflow.com/a/24328869
has title: Trigger a run() method of Timer of Java manually
favorite count: 0

http://stackoverflow.com/a/24352786
downvote count: 1
has comment: http://stackoverflow.com/comment/37653236
upvote count: 4
answers question: http://stackoverflow.com/q/24352597
has comment: http://stackoverflow.com/comment/37653442
has body: You can use this Collections.max(arrayList); To know more about read Javadoc for Collection.max
has comment: http://stackoverflow.com/comment/37653275
has comment: http://stackoverflow.com/comment/37653198
type: Answer
score: 3

http://stackoverflow.com/comment/37777271
has text: It depends on the timers. Swing timer do their processing on the EDT, making them convenient, as they can manipulate Swing objects. If each basic processing is small, they don't block the EDT (so, with Swing timer, each call to the timer should move the card a bit). A nice source on the subject is http://filthyrichclients.org
type: Comment
score: 2
comment on: http://stackoverflow.com/q/24306591
type: QuestionComment

http://stackoverflow.com/comment/73563815
comment on: http://stackoverflow.com/a/43246818
score: 0
type: Comment
has text: Can you explain your answer a bit
type: AnswerComment

http://stackoverflow.com/comment/37499481
type: Comment
has text: @user3749843 Ok, I forgot to add two braces. I added now, so use the latest answer.
comment on: http://stackoverflow.com/a/24271480
type: AnswerComment
score: 0

http://stackoverflow.com/q/24279709
has answer: http://stackoverflow.com/a/24279740
accepted answer: http://stackoverflow.com/a/24279740
has body: I am designing a e-Diary application in which the user can store textual data EVERY DAY. I thought of using a database but now I am looking for other alternatives , thought of encrypted files , but what if they get deleted ? Could someone provide me ways of doing this. BTW, I am using Java.(If this is important). EDIT: Currently I am using files for acheiving this, for login I am using a file in which the username, password are stored in the format username:password, This is not a good approach, so I am looking for some secure approaches.
linked to: http://stackoverflow.com/q/41233
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/134492
type: AnsweredQuestion
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/37514002
has comment: http://stackoverflow.com/comment/37513999
has title: What is the best way to store data when a database could not be used?
type: Question
has comment: http://stackoverflow.com/comment/37514007
has comment: http://stackoverflow.com/comment/37514305
tagged with: database

crash
tags question: http://stackoverflow.com/q/24414359
tag name: crash
type: Tag

http://stackoverflow.com/comment/37561150
type: Comment
has text: then, probably better to go with Shiro
comment on: http://stackoverflow.com/a/24302821
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37704749
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24379922
type: Comment
has text: @EJP: I think it is not unlikely at all. Every Oracle connection usually gets its own server process. So maybe every connection also gets their own JVM (with effectively just one user thread in it), and you need some inter-process locking for synchronization to work.

http://stackoverflow.com/comment/37638372
comment on: http://stackoverflow.com/q/24345165
has text: There's nothing in the standard library, but the Spring type-conversion system has interfaces for these operations and support classes for handling conversions.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24320006
type: UnansweredQuestion
type: Question
has title: JBoss EAP 6.2GA Managed Domain Exploded-Deployment
tagged with: java
has answer: http://stackoverflow.com/a/30659420
tagged with: jboss
has comment: http://stackoverflow.com/comment/38618914
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/49381347
favorite count: 0
has body: Is there a way to deploy exploded war file for Web Application in JBoss EAP 6.2 GA Domain manage mode. Since I looked through its contents folder inside tmp folder.There is extracted content of my web skeleton,When I changed something it never affected to my site. I'm currently develop on JDK 7 with Netbean 7.4 and Windows 7
score: 2
upvote count: 2

http://stackoverflow.com/q/24271544
has comment: http://stackoverflow.com/comment/37499320
favorite count: 0
has answer: http://stackoverflow.com/a/24271986
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24271635
has comment: http://stackoverflow.com/comment/37499238
upvote count: 2
tagged with: java
has body: I am struggling with android location api in getting constant updates of my device's current location. What am I doing wrong here? import android.location.Criteria; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.util.Log; import android.widget.Toast; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesClient; import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.GoogleMapOptions; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; public class ViewMapActivity extends FragmentActivity implements LocationListener, GooglePlayServicesClient.ConnectionCallbacks, GooglePlayServicesClient.OnConnectionFailedListener { public static final Long LOCATION_MIN_TIME = 1000L; public static final float LOCATION_MIN_DISTANCE = 10f; private static GoogleMap googleMap; private LocationManager locationManager; private Criteria criteria; private String provider; public ViewMapActivity() { } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i("ViewMap"," Map created"); setContentView(R.layout.map); GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext()); GoogleMapOptions mapOptions = new GoogleMapOptions(); mapOptions.mapType(GoogleMap.MAP_TYPE_NORMAL); mapOptions.zoomGesturesEnabled(true); mapOptions.zoomControlsEnabled(true); googleMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mapfragment)) .getMap(); googleMap.setMyLocationEnabled(true); locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); criteria = new Criteria(); provider = locationManager.getBestProvider(criteria, false); //Log.d("ViewMap", provider.toString()…
downvote count: 1
type: Question
has title: Android Location API does not show mock locations onLocationChanged
answer count: 2
tagged with: google-maps
score: 1

http://stackoverflow.com/comment/37533748
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24288255
type: QuestionComment
has text: Yes, I granted them. I tried to log as this user both from the console and DBInspect?

http://stackoverflow.com/a/24286114
has comment: http://stackoverflow.com/comment/37530496
upvote count: 6
downvote count: 0
has body: This is the problem: public Date(int day, int month, int year) { } Your constructor completely ignores its parameters, leaving your fields with their default values. For int fields, that's 0. Instead, it should save the values, e.g. public Date(int day, int month, int year) { this.day = day; this.month = month; this.year = year; } or perhaps call your properties: public Date(int day, int month, int year) { setDay(day); setMonth(month); setYear(year); } I'd also strongly recommend that: You make the type immutable (remove the setters, make the class final, make the fields final) You try to think "year month day" rather than "day month year" (so reorder the parameters) You validate the parameters You follow Java naming conventions (change DisplayDate to displayDate, or separate the concern of formatting from writing to the console, by just overriding toString instead) You avoid creating your own date type entirely, and instead use the types in java.time (if you're on Java 8) or Joda Time otherwise.
has comment: http://stackoverflow.com/comment/37526555
has comment: http://stackoverflow.com/comment/37564101
type: Answer
score: 6
answers question: http://stackoverflow.com/q/24286082

http://stackoverflow.com/comment/37736775
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24396969
has text: You can't *return* the information. You *can* accept a lambda (in Java 8) or interface-typed object with a method that you'll call back when the information is available.
score: 0

http://stackoverflow.com/comment/37686886
score: 2
comment on: http://stackoverflow.com/q/24370313
has text: @DavidConrad: No, as long as happens-before relationship between `cancel()` and `isDone()` is not guaranteed. There is no such guarantee in javadoc.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24323674
type: AnsweredQuestion
tagged with: primary-key
tagged with: java
type: Question
tagged with: database
has title: How to make the primary key in JDBC MYSQL case sensitive?
possible better answer: http://stackoverflow.com/a/24400206
has comment: http://stackoverflow.com/comment/37597786
accepted answer: http://stackoverflow.com/a/24324403
score: 0
answer count: 2
tagged with: sql
has comment: http://stackoverflow.com/comment/37597344
has answer: http://stackoverflow.com/a/24324403
has body: I have a primary key defined as a string value. So two tuples with primary keys as "Hello" and "hello" cant exist because the primary key is case insensitive. What will be the sql statement to create a table whose primary key is case insensitive?
tagged with: jdbc
has answer: http://stackoverflow.com/a/24400206

classloader
tags question: http://stackoverflow.com/q/24290500
tags question: http://stackoverflow.com/q/24353593
tags question: http://stackoverflow.com/q/24340098
tags question: http://stackoverflow.com/q/24394132
tags question: http://stackoverflow.com/q/24286379
tags question: http://stackoverflow.com/q/24307480
type: Tag
tag name: classloader
tags question: http://stackoverflow.com/q/24310105

http://stackoverflow.com/comment/37582196
has text: If i didn't use synchronize block then it gives error i just want to understand that if a thread goes for wait then notify will wakes the thread.
type: Comment
comment on: http://stackoverflow.com/a/24315454
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37612930
has text: put JPanel to JInternalFrame
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24331898
type: QuestionComment

http://stackoverflow.com/q/24372301
linked to: http://stackoverflow.com/q/10382929
tagged with: jdbc
tagged with: neo4j
favorite count: 0
has answer: http://stackoverflow.com/a/24373546
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24373546
tagged with: java
type: Question
has title: Pentaho Kettle + Neo4j jdbc driver error: Unsupported major.minor version 51.0
answer count: 1
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/14806709
tagged with: kettle
has body: I'm trying to use Pentaho Kettle 5.0.1A-stable with the Neo4j JDBC driver but when I try to preview the data of a "Table Input" step I get this error: Failed to execute runnable (java.lang.UnsupportedClassVersionError: org/neo4j/jdbc/Driver : Unsupported major.minor version 51.0) Screenshot: I have these lines in my .zshrc file export JAVA_HOME=`/usr/libexec/java_home -v 1.7` export PENTAHO_JAVA_HOME=`/usr/libexec/java_home -v 1.7` Java version is 1.7.0_60 (I'm using Mac OS X btw) I've cloned the Neo4j-driver and built it using Maven (last commit of the driver was 5430d0454180a which added support to Neo4j 2.1.2) I built the driver with Maven with this command: mvn package I've copied the driver neo4j-jdbc-2.1.2-SNAPSHOT-jar-with-dependencies to the /lib dir in Kettle. Any thoughts? They say that this error usually happens because of a higher JDK during compile time and lower JDK during runtime but I already set PENTAHO_JAVA_HOME so I'm running out of ideas here.

bin
tags question: http://stackoverflow.com/q/24334967
type: Tag
tag name: bin

http://stackoverflow.com/comment/110061628
score: 2
has text: Is this still not supported today on Neo4J 4? I'm trying a similar query and getting the same error.
type: Comment
comment on: http://stackoverflow.com/a/24274528
type: AnswerComment

http://stackoverflow.com/a/24421461
upvote count: 1
has body: It looks to me that a PriorityQueue is exactly what you need: The elements of the priority queue are ordered according to their natural ordering, or by a Comparator provided at queue construction time, depending on which constructor is used. In this case, the natural ordering would be by score. Easy. As to your point: I can't provide a "comparator" since it will compare Tracks, and I can't calculate their score on a "compareTo method". The key here is that you don't use the compareTo() method to calculate the score. It's the other way around. You use the score in the implementation of compareTo(). You have a few ways to implement this: Make Track implements Comparable&lt;Track&gt;, and implement compareTo(Track t) compare the scores you scored, so higher score --> "larger" object. The PriorityQueue will take care of the rest. Implement a Comparator&lt;Track&gt; that does basically the same thing as compareTo() does for option 1. Option 2 is better if you might sort using different criteria later in the program, as you don't commit yourself to having Tracks only sort by score. Ideally, for both options you would store the score inside Track, as the score will only need to be calculated once; however, you'll have to make sure that this score is set before inserting into the PriorityQueue. That shouldn't be an issue though. Alternatively, can calculate the score on the fly inside the comparing methods, if you know the score won't change over time; this can get somewhat expensive over time, though, if lots of comparisons have to be made. I wouldn't recommend this if you know the score won't change. Alternatively, if Track objects are ignorant about their scores (which makes sense), you can use a Map with Tracks as the key and scores as the value to associate a Track with a score: HashMap&lt;Track, Integer&gt; scoreMap = new HashMap&lt;&gt;(); for (Track track : tracks) { // Copied from question, slightly altered int score = 0; for (Rule rule : rules) { score += rule.app…
type: Answer
has comment: http://stackoverflow.com/comment/37782847
has comment: http://stackoverflow.com/comment/37783035
downvote count: 0
answers question: http://stackoverflow.com/q/24420984
has comment: http://stackoverflow.com/comment/37782914
score: 1
has comment: http://stackoverflow.com/comment/37782961
has comment: http://stackoverflow.com/comment/37784472
has comment: http://stackoverflow.com/comment/37782866
has comment: http://stackoverflow.com/comment/37782960

http://stackoverflow.com/q/24282815
has answer: http://stackoverflow.com/a/24282849
accepted answer: http://stackoverflow.com/a/24282849
tagged with: regex
type: AnsweredQuestion
upvote count: 1
type: Question
has title: Regex: Numeric Range java
score: 1
tagged with: java
has body: I have a little generator which allows me to create a string out of a regex-expression. For something like a German license plate it is pretty easy to do. ([A-Z]{1,3}[- ][A-Z]{1,2}[0-9]{1,4}) -> e.g. "CD-B802" public String generate() { String forReturn = null; for (String rule : Generator.read(fileRegexConfig)) { try { Xeger generator = new Xeger(rule); forReturn = generator.generate(); } catch (Exception e) { System.err.println(rule + ':' + e.getMessage()); } } return forReturn; } public static String[] read(String str) { List<String> list = new ArrayList<String>(); try { BufferedReader in = new BufferedReader(new FileReader(str)); String zeile = null; while ((zeile = in.readLine()) != null) { if (zeile != null && zeile.trim().length() > 0) list.add(zeile); } in.close(); } catch (Exception e) { e.printStackTrace(); } return (String[]) list.toArray(new String[0]); } The Problem I have is, how can I build a regex for a range of int. For example I try to find a way to describe an area of validity like [37-78]. according to http://www.regular-expressions.info/numericranges.html it is easy to describe [0-x] but I can't find a way to solve my problem.
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/q/24271234
has comment: http://stackoverflow.com/comment/37498293
type: UnansweredQuestion
has title: Runtime.exec Error but works in cmd line
linked to: http://stackoverflow.com/q/7112259
has body: I am using the following very simple code to open outlook using the cmd line: Start OUTLOOK.EXE When I type it into the Windows Command Processor it works fine but when I use: Runtime.exec(String[]{"Start ", "OUTLOOK.EXE"}); or Runtime.exec("Start OUTLOOK.EXE); or Runtime.exec(String[]{"Start", " ", "OUTLOOK.EXE"}); In java it does not work (I get this error: Cannot run program "Start": CreateProcess error=2, The system cannot find the file specified) why ? I have read about spaces and runtime but I cannot get it working. Thanks Ulrich Ok so with some more googling I got it working: Runtime.getRuntime().exec("cmd.exe /c start OUTLOOK.EXE"); That will open it, I hope people find this because I have been searching for some hours trying to figure out how to open a program I do not know the file path to.
upvote count: 1
score: 1
tagged with: java
type: Question
tagged with: outlook
tagged with: runtime
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24271410

http://stackoverflow.com/a/24350201
answers question: http://stackoverflow.com/q/24349894
type: AcceptedAnswer
has body: Your problems are here: 0=deposit+Balance; and here: 0=withdraw-Balance; When assigning values to variables in Java, the right hand side is evaluated and the result is stored in the left hand side, e.g. result = things+to+add; But your code attempts to calculate something and store the result in 0, a literal number, this cannot work, it needs to be a variable. Also, you functions to withdraw and deposit - how much are you withdrawing or depositing? The deposit function needs to know how much to deposit, and the withdraw function needs to know how much to withdraw. You need to add an argument to each to provide this information: Here's a possible deposit function: public void deposit(double amount) { balance = balance+amount; }
type: Answer
upvote count: 2
score: 1
accepted answer of: http://stackoverflow.com/q/24349894
downvote count: 1

http://stackoverflow.com/comment/37557899
has text: Ok I will take care of camelCase.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24302861

http://stackoverflow.com/a/24335455
score: 4
has comment: http://stackoverflow.com/comment/94134286
has body: Joshua Bloch talks about using an enum as a singleton to avoid this specific issue in Effective Java. Check out this article: Why Enums are Better Singletons -or- read it directly from Bloch here.
answers question: http://stackoverflow.com/q/24335343
type: Answer
has comment: http://stackoverflow.com/comment/37620127
upvote count: 4
has comment: http://stackoverflow.com/comment/94141289
downvote count: 0

http://stackoverflow.com/q/24282209
tagged with: jasper-reports
has comment: http://stackoverflow.com/comment/37788071
has title: Problems displaying barcode font
score: 0
has comment: http://stackoverflow.com/comment/37572434
has body: I am creating labels with bar codes EAN13. I do not want to use the barcode4j lib for reasons of processing speed. Using iReport I added the font FF EAN, and a custom function for the barcode translation. Because I run the report in java (in eclipse ide), I exported the font in a jar file, and I added it into my java project. Using the PDF preview iReport barcode can be seen properly, but running it in java barcodes are not displayed. The font exporting procedure runs well, because I had already integrated the font Times New Roman, not available by default. Why the font FF EAN is ignored?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/89877008
tagged with: barcode
answer count: 0
tagged with: fonts
tagged with: java
type: Question

http://stackoverflow.com/comment/37600273
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24323600
has text: Thanks! That does NOT give any compilation errors :-) Can you please post your comment as an answer?
type: AnswerComment

http://stackoverflow.com/comment/37701096
type: QuestionComment
has text: Where do you need to directly use those classes?
score: 0
comment on: http://stackoverflow.com/q/24378005
type: Comment

http://stackoverflow.com/a/24280376
score: 29
has body: You can invoke an inherited interface default method using InterfaceName.super. The rules are the same as for other super method invocations: You can invoke the inherited method that you have overridden, but you can’t directly invoke the method which the inherited method might have overridden. E.g. interface A { void foo(); default void toOverride() { System.out.println("A"); } } interface B extends A { default void toOverride() { A.super.toOverride(); System.out.println("B"); } } interface C extends B { default void toOverride() { A.super.toOverride();// does not work B.super.toOverride(); System.out.println("B"); } } class D implements B { public void toOverride() { } public void foo() { D.this.toOverride(); B.super.toOverride(); A.super.toOverride(); // does not work! } } But if each overriding method invokes its super method you have a chain of invocations. However, keep in mind that we are talking about interfaces. An implementation can always override a default method without invoking super at all.
answers question: http://stackoverflow.com/q/24273694
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 29
accepted answer of: http://stackoverflow.com/q/24273694

http://stackoverflow.com/comment/37767439
has text: @CommuSoft the content below horizon is very helpful, by the way how do I iterate through stack? also using Iterator method? But it seems I only get package class name @ hashcode
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24412377
type: Comment

http://stackoverflow.com/a/24398729
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24375673
has body: I have two separate threads for receiving file and messages. Why? The problem is how to specify which thread should receive packet that is coming. Your first problem is that there are no 'packets' in the TCP API. It provides a bytestream. Any packetising is entirely up to you at both ends. Your second problem is that the thread that entered read() first will get the next data that arrives (or has already arrived). now is it better to have just one thread for both operations? Definitely. If yes how can I recognize the received packet type? As I said above, if there are to be 'packets' in this application, you will have to define them. That will almost certainly include a length word and it may as well include a type word as well.

http://stackoverflow.com/q/24273493
has title: Make a moving platform in java
has comment: http://stackoverflow.com/comment/37502738
answer count: 1
has comment: http://stackoverflow.com/comment/37502583
favorite count: 0
has body: I have tried many different things, but I just cant get this to work. I want to make a moving platform, that moves slowly left to right and then right to left. I got the left to right part, but not the right to left. Here is what I use for left to right : public int centerX = 650; public int centerY = 382; private int speedX = 2; if(centerX + speedX &gt;= 765){ centerX = 650; speedX = -2; }else{ centerX += speedX; } This makes the platform go back to the beginning , directly. Why ? How and what can I add to make it go back slowly ?
has answer: http://stackoverflow.com/a/24274325
has comment: http://stackoverflow.com/comment/37502586
upvote count: 1
accepted answer: http://stackoverflow.com/a/24274325
type: AnsweredQuestion
score: 0
tagged with: java
downvote count: 1
type: Question

http://stackoverflow.com/a/24697671
has comment: http://stackoverflow.com/comment/38300844
answers question: http://stackoverflow.com/q/24379386
score: 0
type: Answer
has body: I would suggest that you forgo writing unit tests for the database interaction altogether. This and this blog posts explain why. When you are using Spring, it's so easy to just use an in-memory database in the testing environment and then proceed to write meaningful integration tests. In your use case where you want to write a unit test for BankServiceImpl, there is no need to get Spring involved at all. All you need to do is create that service on your own and inject the relevant mocks into it. Writing such a test will spare you from having to mock Spring-related services (like transaction management) and will also make the test a heck of a lot quicker, since no spring context will ever need to be created.
has comment: http://stackoverflow.com/comment/38301140
has comment: http://stackoverflow.com/comment/38300423
has comment: http://stackoverflow.com/comment/38301280

http://stackoverflow.com/comment/37613577
has text: @TokTok123 Read my comment clearly. The last sentence, specficially. You are combining both concept together, which will _not_ work. Examine both of them and look for the difference. You should be able to spot what you're doing wrong
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24288955
score: 0

http://stackoverflow.com/comment/37600570
has text: Do you want to convert it from a `String` to a `double`?
comment on: http://stackoverflow.com/q/24325410
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27268640
answers question: http://stackoverflow.com/q/24365154
upvote count: 8
has comment: http://stackoverflow.com/comment/43193897
has comment: http://stackoverflow.com/comment/55167379
downvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43204526
has comment: http://stackoverflow.com/comment/43204464
type: Answer
has body: Hi I found the workaround with the another library. I used Selinium WebDriver (org.openqa.selenium.WebDriver) library to extract the dynamic content. Here is the sample code. public class CollectUrls { private WebDriver driver; public CollectUrls() { this.driver = new FirefoxDriver(); this.driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } protected void next(String url, List&lt;String&gt; argUrlsList) { this.driver.get(url); String htmlContent = this.driver.getPageSource(); } Here the "htmlContent" is the required one. Please let me know if you face any issues...??? Thanks, Amar
accepted answer of: http://stackoverflow.com/q/24365154
score: 6

http://stackoverflow.com/a/24287389
has body: Thank you for the response. The problem is I've added tabbedpane to splitpane where the bounds was set manually. when i removed that bounds to let the layout manager to find out the preferred size. Things are working fine
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24268308
type: Answer
accepted answer of: http://stackoverflow.com/q/24268308

http://stackoverflow.com/a/24329744
type: Answer
answers question: http://stackoverflow.com/q/24329542
has body: String[] options = { "night","n" }; if (Arrays.asList(options).contains(input)) { direction = Cardinals.NORTH; }
score: 0

http://stackoverflow.com/comment/37719123
has text: I think you have to call the method `setEchoChar(char c)` on password_id
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24387680

http://stackoverflow.com/q/24391570
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/51730581
has body: I have a class that I am serializing/deserializing from/to both JSON, XML using Jackson. public class User { Integer userId; String name; Integer groupId; ... } I want to ignore groupId when doing xml processing, so my XMLs won't include it: &lt;User&gt; &lt;userId&gt;...&lt;/userId&gt; &lt;name&gt;...&lt;/name&gt; &lt;/User&gt; But the JSONs will: { "userId":"...", "name":"...", "groupId":"..." } I know that @JsonIgnore will work in both, but I want to ignore it only in the xml. I know about the mix-in annotations that can be used to do this (https://stackoverflow.com/a/22906823/2487263), but I think there should be a simple annotation that does this, but cannot find it. Jackson documentation (at least for me) is not as good as I would like when trying to find these kind of things.
type: Question
score: 10
tagged with: jackson
has title: Equivalent of @JsonIgnore but that works only for xml field/property conversion using Jackson
answer count: 2
possible better answer: http://stackoverflow.com/a/51730581
linked to: http://stackoverflow.com/q/22903258
favorite count: 0
upvote count: 10
has comment: http://stackoverflow.com/comment/37727650
has answer: http://stackoverflow.com/a/24395451
accepted answer: http://stackoverflow.com/a/24395451
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/37749942
score: 0
type: Comment
type: AnswerComment
has text: but the idea of generics is to strict containing data type. I need `String` and `Double` only. `Object` doesn't imply any restrictions on input type
comment on: http://stackoverflow.com/a/24404059

http://stackoverflow.com/a/24297065
has comment: http://stackoverflow.com/comment/37548543
has comment: http://stackoverflow.com/comment/37582550
has comment: http://stackoverflow.com/comment/37587626
has comment: http://stackoverflow.com/comment/37548609
has comment: http://stackoverflow.com/comment/37548589
has comment: http://stackoverflow.com/comment/37548572
answers question: http://stackoverflow.com/q/24293213
score: 15
upvote count: 15
has comment: http://stackoverflow.com/comment/37548561
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37548615
type: Answer
has body: Yes, this is possible. You can either use a MapMessage, which is supported by the map (or K) conversion pattern of PatternLayout: an example layout pattern would be "%-5p [%t]: %m %map%n". Logging a MapMessage looks like this: Map&lt;String,String&gt; myMap = getMyMap(); Logger.debug(new MapMessage(myMap)); Another way to do this is to use the ThreadContext map. This is supported by the mdc (or X) conversion pattern of PatternLayout. Example pattern: "%-5p [%t]: %m %mdc%n". A common usage is putting a user ID in the Thread Context Map when a user logs in, and having this user ID shown in all log messages emitted by that thread until the user logs out. Instead of logging the whole map you can also log specific keys only by specifying the key in the layout pattern: e.g. "%-5p [%t]: %m %mdc{userID}%n".
has comment: http://stackoverflow.com/comment/37555654
has comment: http://stackoverflow.com/comment/37548569
accepted answer of: http://stackoverflow.com/q/24293213
has comment: http://stackoverflow.com/comment/37586895
has comment: http://stackoverflow.com/comment/37582564

http://stackoverflow.com/q/24331402
has comment: http://stackoverflow.com/comment/37612436
has body: Summary I'm trying to find the bounding box of a shape that is transformed between to transformation anchors. The goal is to encapsulate an animation of a rectangle so that none of the rectangle is ever outside the rendered area. I am using these three java classes: java.awt.Rectangle java.awt.geom.AffineTransform Anchor (custom class) Currently What I Have Here's how the anchor class is defined: public class Anchor { public double deltaX = 0, deltaY = 0; public double scaleX = 1, scaleY = 1; public double degrees = 0; } In my real application, I have a set of anchors that are attached to a time, and as the animation progresses the shape is interpolated between the two neighboring "Anchors." But for this question we only need to worry about 2 Anchors. Here's a crude, mostly working implementation of what I want, but I feel like there must be a more accurate, efficient mathematical approach. It's sloooooow thanks to having to make many steps. The more steps I iterate through, the better results, obviously. public static Rectangle getBounds(Anchor leftAnchor, Anchor rightAnchor, int shapeWidth, int shapeHeight) { Rectangle baseShape = new Rectangle(0, 0, shapeWidth, shapeHeight); // the shape we draw in the animation Rectangle globalBounds = null, localBounds; // global bounds is the bounds of the whole animation for(double time = 0;time &lt;= 1;time += 0.001) { // interpolate from one anchor to the next (1000 steps) // Create the transformation and find the finds of the resultant shape AffineTransform transformation = getInterpolatedTransformation(leftAnchor, rightAnchor, shapeWidth, shapeHeight, time); localBounds = transformation.createTransformedShape(baseShape).getBounds(); if(globalBounds == null) // if it's the first step, create the initial bounds globalBounds = localBounds; else // otherwise continue adding bounds globalBounds.add(localBounds); } return globalBounds; // return the global bounds } public static AffineTransform getInterpolatedTransformation(Anc…
upvote count: 1
has answer: http://stackoverflow.com/a/24368320
accepted answer: http://stackoverflow.com/a/24368320
has title: Maximum bounding box of a shape from one AffineTransform to another
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37613864
score: 1
tagged with: math
tagged with: java
possible better answer: http://stackoverflow.com/a/24331844
tagged with: image-processing
type: Question
downvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/24331844
favorite count: 0
tagged with: interpolation
tagged with: geometry
has answer: http://stackoverflow.com/a/24350593

http://stackoverflow.com/a/24368904
has comment: http://stackoverflow.com/comment/37684067
has comment: http://stackoverflow.com/comment/37683826
has body: The 4th parameter is the key length PBEKeySpec(char[] password, byte[] salt, int iterationCount, int keyLength) Constructor that takes a password, salt, iteration count, and to-be-derived key length for generating PBEKey of variable-key-size PBE ciphers.
answers question: http://stackoverflow.com/q/24368807
type: Answer
score: 0

http://stackoverflow.com/comment/37650779
comment on: http://stackoverflow.com/a/24351563
score: 0
type: Comment
has text: Ah, this worked exactly as I wanted. It seem to be a very simple solution, I didn't know it could be fixed like that. Thank you!
type: AnswerComment

http://stackoverflow.com/a/24355292
has comment: http://stackoverflow.com/comment/37659639
has body: Suppose the list provides that functionality directly. That means that when I start iterating, the list must initialize some state to remember where I am in the iteration (1st element, 2nd element, etc.). Then I decide to stop iterating. How does the list know that? How can it dispose this iteration state without me calling some stopIterating() method? Delegating to a separate object is much easier: if I stop iterating, I simply forget about the iterator maintaining the iteration state. The iterator goes out of scope and is garbage collected. Yes, of course. Every time you call list.iterator(), you get back a new instance of the Iterator. Having an inner class Inner declared inside an outer class Outer doesn't mean that the outer class has a field of type Inner. It simply says that the Inner class instances, that must be created using the new operator, have access to the instance of the outer class. The outer class doesn't maintain any association with the inner class instances. That's basically the same thing as if the inner class was a top-level class, with a field of type Outer pointing the the outer class instance. The difference is that the inner class has access to all the private members of the outer class, which is not possible with a top-level class.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24355189
score: 0
answers question: http://stackoverflow.com/q/24355189
type: Answer
has comment: http://stackoverflow.com/comment/37658610

http://stackoverflow.com/a/24443126
type: Answer
accepted answer of: http://stackoverflow.com/q/24341460
answers question: http://stackoverflow.com/q/24341460
score: 0
type: AcceptedAnswer
has body: I have found where the problem is. The problem is that the save method is not in the same session that TeamService provide. I made a mistake. The Dao classes are generated by machine, they extends a fathre class which has a method to generate session. But I also create a class HibernateUtil to generate session. So save method is not in the same session as Service,which lead to failed saving. The answer to this question is to modify the method in Dao. public void save(Classes transientInstance) { log.debug("saving Classes instance"); try { HibernateUtil.getCurrentSession().save(transientInstance); log.debug("save successful"); } catch (RuntimeException re) { log.error("save failed", re); throw re; } }

http://stackoverflow.com/q/24348854
linked to: http://stackoverflow.com/q/17874717
has body: How would I be able to run music in a runnable jar file? My programs runs the music when I compile and run the code. But when I try making it into a runnable jar file through eclipse, it does not run the music for some reason. My code import java.awt.Color; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.border.LineBorder; import sun.audio.*; import java.io.*; public class Birthday { static JFrame bDay = new JFrame(); static JPanel panel = new JPanel(null); public static void main(String[] args) { fillPanel(); bDay.add(panel); panel.setFocusable(true); bDay.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);/ bDay.setSize(325,250); bDay.setLocationRelativeTo(null); bDay.setTitle("Happy Birthday"); bDay.setResizable(true); bDay.setVisible(true); } public static void fillPanel(){ Color fav = new Color(50,190, 189); fav = generatePastelColor(fav); panel.setBackground(fav); JLabel hb = new JLabel("HAPPY BIRTHDAY!!"); hb.setFont(new Font("Verdana", 2,30)); hb.setBorder(new LineBorder(Color.WHITE)); panel.add(hb); hb.setBounds(8, 50, 295, 50); JButton button = new JButton("Click me"); panel.add(button); button.setBounds(50, 150, 200, 50); button.addActionListener(new AL()); } public static class AL implements ActionListener{ public final void actionPerformed(ActionEvent e){ music(); } } public static Color generatePastelColor(Color mix) { int red = 50; int green = 190; int blue = 189; // mix the color if (mix != null) { red = (red + mix.getRed()) / 2; green = (green + mix.getGreen()) / 2; blue = (blue + mix.getBlue()) / 2; } Color color = new Color(red, green, blue); return color; } public static void music(){ AudioPlayer mgp = AudioPlayer.player; AudioStream bgm; AudioData md; ContinuousAudioDataStream loop = null; try { bgm = new AudioStream(new FileInputStream(new File("music\\Birthday.wav"))); md = b…
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/37645729
has comment: http://stackoverflow.com/comment/37645734
type: Question
linked to: http://stackoverflow.com/q/5621338
has answer: http://stackoverflow.com/a/24348872
has title: How to run music in runnable jar file
downvote count: 0
answer count: 1
tagged with: executable-jar
favorite count: 0
type: UnansweredQuestion
tagged with: embedded-resource
tagged with: swing
has comment: http://stackoverflow.com/comment/37645577

http://stackoverflow.com/comment/37652071
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24352163
has text: @indivisible perfect thank you. Going to write some weird stuff now and later find out how to say if user clicks this take this. THANK YOU
type: Comment

http://stackoverflow.com/comment/37671144
has text: Unfortunately I haven't ever used valgrind on android (valgrind yes, android yes, but not together), so I can't help you past that.
comment on: http://stackoverflow.com/a/24301830
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37789363
type: Comment
has text: I don't think you can use short as a variable name.
comment on: http://stackoverflow.com/a/24425333
type: AnswerComment
score: 0

http://stackoverflow.com/q/24305511
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/37562949
answer count: 2
has answer: http://stackoverflow.com/a/24306729
has comment: http://stackoverflow.com/comment/37562875
has title: Ajax request call to the servlet doesn't return anything
tagged with: jquery
has comment: http://stackoverflow.com/comment/37562858
tagged with: ajax
has comment: http://stackoverflow.com/comment/37562948
score: 0
linked to: http://stackoverflow.com/q/19499572
has body: This is my jquery function. It should pass to the servlet two value and get back an update value. I checked if the values are taken correctly and the two variables are filled correctly. Unforuntately I don't get nothing back. $("#passengers").change(function(event){ var passengers = $("#passengers").val(); var price = $("#price").text(); $.getJSON('pricer', {passengers: passengers, price: price}, function(data){ $("#price").html(data); }); }); here is the servlet */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String passengers = request.getParameter("passengers"); String price = request.getParameter("price"); String price_update = new Gson().toJson(this.pricerBean.calculatePrice(Integer.parseInt(passengers), Float.parseFloat(price))); response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); response.getWriter().write(price_update); } The main problem is I don't get any error...even one...the javascript console error is empty and even the servlet doesn't show any errors
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24305629
tagged with: java
has comment: http://stackoverflow.com/comment/37562919

http://stackoverflow.com/q/24349137
tagged with: textview
has comment: http://stackoverflow.com/comment/37646177
tagged with: android
tagged with: http://stackoverflow.com/tag/html
accepted answer: http://stackoverflow.com/a/24353806
linked to: http://stackoverflow.com/q/11363042
type: AnsweredQuestion
tagged with: android-edittext
has comment: http://stackoverflow.com/comment/37646254
possible better answer: http://stackoverflow.com/a/24349205
has comment: http://stackoverflow.com/comment/37646093
tagged with: java
has answer: http://stackoverflow.com/a/24353806
has body: I have a code which retrieves HTML source code of a page. I can retrieve and display the full source code on a TextView without any problem. Then, I want to pass all content of TextView to EditText in order to enable Editing the code. But when I pass source code to EditText, EditText does not show all of the code. The code is broken from random locations. It shows some part of the code. I am totally tilted. Some details: TextView is in another activity and EditText is in another activity, I am passing TextView content to EditText with Intents. Do you have any idea? Thanks in advance. BR, Ali
linked to: http://stackoverflow.com/q/6288898
type: Question
has comment: http://stackoverflow.com/comment/37646043
has title: Android EditText does not show all text
has comment: http://stackoverflow.com/comment/37646933
score: 0
has comment: http://stackoverflow.com/comment/37647502
has answer: http://stackoverflow.com/a/24349205
answer count: 2

http://stackoverflow.com/a/24400397
answers question: http://stackoverflow.com/q/24400242
score: 1
has body: import java.io.*; /** * * @author Ashwin Parmar */ public class myFirstJavaProgram { /** * @param args the command line arguments */ public static void main(String[] args) { try { File file = new File("/home/gk/Hello1.txt"); file.createNewFile(); } catch(IOException e) { System.out.println(e.getMessage()); } // creates a FileWriter Object } } When dealing with any File IO action in Java, it is always best to use a try/catch loop
downvote count: 0
has comment: http://stackoverflow.com/comment/37784289
has comment: http://stackoverflow.com/comment/37743765
has comment: http://stackoverflow.com/comment/37744072
type: Answer
upvote count: 1

http://stackoverflow.com/q/24363671
type: Question
tagged with: java
tagged with: base64
has answer: http://stackoverflow.com/a/24364209
tagged with: image
score: 0
answer count: 1
tagged with: jsp
has title: Java display base 64 byte array in jsp
type: AnsweredQuestion
has body: I have a class called Graphic that creates a new BufferedImage, draws a new Graphics2D and returns this image as base64 encoded String: BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = image.createGraphics(); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // Draw background g2.setColor(Color.decode("#FFFFFF")); g2.fillRect(0, 0, grafikBreite, grafikHoehe); g2.setColor(Color.decode("#000000")); // Draw some rectangles and other stuff... drawStuff(g2); ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] imageInByte = {}; try { JPEGImageEncoder j = new JPEGImageEncoderImpl(baos); j.encode(image); imageInByte = baos.toByteArray(); baos.close(); } catch (IOException e) { e.printStackTrace(); } return javax.xml.bind.DatatypeConverter.printBase64Binary(imageInByte); In my jsp-File I want to display this image using, where graphic is the previously created base64 byte array: &lt;img src="data:image/jpg;base64,&lt;c:out value="${graphic}"/&gt;"/&gt; The image is displayed, but the problem is that the image has red background and the other colors used are also wrong. If I save the created base64 string as jpeg-File on hard disk, all colors are displayed correctly. Has someone an idea why HTML displays the image with strange colors? Thanks for help
tagged with: bufferedimage
accepted answer: http://stackoverflow.com/a/24364209

http://stackoverflow.com/comment/37502322
type: QuestionComment
comment on: http://stackoverflow.com/q/24273328
score: 0
has text: Technically, the only way to traverse or edit a linked list is by iteration. That is the definition of a linked list. Also, if you had null elements in a linked list, you would technically have a broken list.
type: Comment

http://stackoverflow.com/q/24378005
tagged with: sun
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37701211
has title: java API wrapper for com.sun.jersey.spi.container.* and com.sum.jersey.core.* packages
tagged with: java
has body: Are there any java API wrapper for com.sun.jersey.spi.container.* and com.sum.jersey.core.* packages? As Classes in com.sun.* and sun.* packages are considered implementation details, and are not part of the Java API. They can cause problems when moving to new versions of Java because there is no backwards compatibility guarantee.
type: Question
tagged with: jersey
score: 0
has comment: http://stackoverflow.com/comment/37701096

http://stackoverflow.com/a/24298974
answers question: http://stackoverflow.com/q/24298507
has comment: http://stackoverflow.com/comment/37550686
has body: If I have followed you, then what you really want is a generic "Combo Box Builder" that can take a Collection, a selectedIndex and an ActionListener; that is something like private static &lt;T&gt; JComboBox&lt;T&gt; buildComboBox(Collection&lt;T&gt; options, int selectedIndex, ActionListener al) { JComboBox&lt;T&gt; jcb = new JComboBox&lt;T&gt;(); for (T item : options) { jcb.addItem(item); } if (selectedIndex &lt; 0) { selectedIndex = 0; } else if (selectedIndex &gt;= options.size()) { selectedIndex = options.size() - 1; } jcb.setSelectedIndex(selectedIndex); if (al != null) { jcb.addActionListener(al); } return jcb; }
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37550711

http://stackoverflow.com/q/24399195
has answer: http://stackoverflow.com/a/24399214
type: UnansweredQuestion
has body: Hello i'm still kind of new to java.. I get the concept of "this" when it comes to instance variables but when i use it in a constructor with no parameters i get a little confused. So my question is how does something like this work? private double x; private double y; public static final double EPSILON = 1e-5; public static boolean debug = false; public Point(double x, double y){ this.x=x; this.y=y; // Done sets the x,y private types to the x,y type provided in the () } public Point(){ this(0.0,0.0); //Sets, x and y to doubles of 0.0,0.0?? } //How does this work? Would my point() constructor create an origin of (0.0,0.0) by calling the point (x,y) constructor? Any clarification on this would help me out a lot!
has comment: http://stackoverflow.com/comment/37740949
has title: using "this" in java
duplicate of: http://stackoverflow.com/q/285177
tagged with: java
type: Question
score: 9
has answer: http://stackoverflow.com/a/24399218
downvote count: 0
linked to: http://stackoverflow.com/q/285177
answer count: 3
tagged with: this
has answer: http://stackoverflow.com/a/24399250
favorite count: 0
upvote count: 9

http://stackoverflow.com/comment/37594532
type: Comment
has text: @Ravindu So you want to define profiles in `product-core` that affect the build that occurs in `product-core-ws`? If so, can you please explain if there are any dependencies between those two modules? I.e. does `product-core-ws` depend upon `product-core`?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24322062

jboss-eap-6
tags question: http://stackoverflow.com/q/24321209
tag name: jboss-eap-6
type: Tag

http://stackoverflow.com/comment/37781761
score: 2
type: QuestionComment
type: Comment
has text: [`PriorityQueue`](http://docs.oracle.com/javase/8/docs/api/java/util/PriorityQueue.html)?
comment on: http://stackoverflow.com/q/24420984

maven
tags question: http://stackoverflow.com/q/24390788
tags question: http://stackoverflow.com/q/24412246
tags question: http://stackoverflow.com/q/24423117
tags question: http://stackoverflow.com/q/24410789
tags question: http://stackoverflow.com/q/24269081
tags question: http://stackoverflow.com/q/24380470
type: Tag
tags question: http://stackoverflow.com/q/24282453
tags question: http://stackoverflow.com/q/24363663
tags question: http://stackoverflow.com/q/24397494
tags question: http://stackoverflow.com/q/24272901
tags question: http://stackoverflow.com/q/24385245
tags question: http://stackoverflow.com/q/24411088
tags question: http://stackoverflow.com/q/24342668
tags question: http://stackoverflow.com/q/24338302
tags question: http://stackoverflow.com/q/24345920
tags question: http://stackoverflow.com/q/24313519
tags question: http://stackoverflow.com/q/24358536
tags question: http://stackoverflow.com/q/24311247
tags question: http://stackoverflow.com/q/24311476
tags question: http://stackoverflow.com/q/24287024
tags question: http://stackoverflow.com/q/24298447
tags question: http://stackoverflow.com/q/24386306
tags question: http://stackoverflow.com/q/24389721
tags question: http://stackoverflow.com/q/24289186
tags question: http://stackoverflow.com/q/24422121
tags question: http://stackoverflow.com/q/24351864
tags question: http://stackoverflow.com/q/24303005
tags question: http://stackoverflow.com/q/24355374
tags question: http://stackoverflow.com/q/24283057
tags question: http://stackoverflow.com/q/24398197
tags question: http://stackoverflow.com/q/24343546
tags question: http://stackoverflow.com/q/24304203
tags question: http://stackoverflow.com/q/24416067
tags question: http://stackoverflow.com/q/24373019
tags question: http://stackoverflow.com/q/24352826
tags question: http://stackoverflow.com/q/24414683
tags question: http://stackoverflow.com/q/24408563
tags question: http://stackoverflow.com/q/24281528
tags question: http://stackoverflow.com/q/24355188
tags question: http://stackoverflow.com/q/24321274
tags question: http://stackoverflow.com/q/24403691
tags question: http://stackoverflow.com/q/24385346
tags question: http://stackoverflow.com/q/24407583
tags question: http://stackoverflow.com/q/24291299
tags question: http://stackoverflow.com/q/24412401
tags question: http://stackoverflow.com/q/24398953
tags question: http://stackoverflow.com/q/24268092
tags question: http://stackoverflow.com/q/24299865
tags question: http://stackoverflow.com/q/24320726
tags question: http://stackoverflow.com/q/24303820
tags question: http://stackoverflow.com/q/24354884
tags question: http://stackoverflow.com/q/24323176
tags question: http://stackoverflow.com/q/24405275
tags question: http://stackoverflow.com/q/24343820
tags question: http://stackoverflow.com/q/24343254
tags question: http://stackoverflow.com/q/24354451
tags question: http://stackoverflow.com/q/24388758
tags question: http://stackoverflow.com/q/24422230
tags question: http://stackoverflow.com/q/24392403
tags question: http://stackoverflow.com/q/24341234
tags question: http://stackoverflow.com/q/24304242
tags question: http://stackoverflow.com/q/24286379
tags question: http://stackoverflow.com/q/24283666
tags question: http://stackoverflow.com/q/24306189
tags question: http://stackoverflow.com/q/24270831
tags question: http://stackoverflow.com/q/24412567
tags question: http://stackoverflow.com/q/24364418
tags question: http://stackoverflow.com/q/24404820
tags question: http://stackoverflow.com/q/24355016
tags question: http://stackoverflow.com/q/24276677
tags question: http://stackoverflow.com/q/24296800
tags question: http://stackoverflow.com/q/24412796
tags question: http://stackoverflow.com/q/24394104
tags question: http://stackoverflow.com/q/24327420
tags question: http://stackoverflow.com/q/24322965
tags question: http://stackoverflow.com/q/24420252
tags question: http://stackoverflow.com/q/24415677
tags question: http://stackoverflow.com/q/24415698
tags question: http://stackoverflow.com/q/24323115

http://stackoverflow.com/comment/37531940
type: Comment
score: 0
has text: or shouldn't `names.stream().map(name -> { int length = name.getLength(); return new MyClass(length * length, length); }` work, too?
type: AnswerComment
comment on: http://stackoverflow.com/a/24289016

http://stackoverflow.com/comment/37758678
type: QuestionComment
has text: I want the user from session on the server side, i mean in the actual rest method.
comment on: http://stackoverflow.com/q/24408525
score: 0
type: Comment

http://stackoverflow.com/comment/37741280
type: AnswerComment
has text: because the line previous (JSONObject queryJSONOBject = jsonObject.getJSONObject("production_companies"); ) is throwing an exception, so all the code after it that is within the try/catch block will be stepped over. Use the debugger and step through the code to see what is happening
type: Comment
comment on: http://stackoverflow.com/a/24399358
score: 0

http://stackoverflow.com/q/24339448
has comment: http://stackoverflow.com/comment/37724601
upvote count: 1
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37665495
tagged with: ssl
has title: Java Code not posting certificate
tagged with: sslsocketfactory
type: Question
has body: I am using a 2 way ssl authentication to post data securely. The client has given me their certificates which i loaded into the truststore and my server certificate which they generated after i gave them my CSR. I have loaded my server cert into the keystore. My code is accepting their certificates, sending the key but not the server certificate. Code used is as below. Kindly assist; Error: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure. Reason: Empty certificate passed. public static String DoMyPost(String URL, String requestData, String transactID) throws MalformedURLException, Exception { System.out.println("DoMyPost(): Start"); String strResponse = ""; URL url = new URL(URL); try { HostnameVerifier hv = new HostnameVerifier() { @Override public boolean verify(String urlHostName, SSLSession session) { return true; } }; System.setProperty("javax.net.ssl.keyStore", "C:\\Program Files (x86)\\Java\\jre7\\bin\\testserver1.jks"); System.setProperty("javax.net.ssl.keyStorePassword", "wasp123"); System.setProperty("javax.net.ssl.keyStoreType", "JKS"); System.setProperty("javax.net.ssl.trustStore", "C:\\Program Files (x86)\\Java\\jre7\\bin\\testserver1TrustStore"); System.setProperty("javax.net.ssl.trustStorePassword", "wasp123"); System.setProperty("javax.net.debug", "all"); //CertificateFactory factory2 = CertificateFactory.getInstance("X.509"); //Certificate generateCertificate = factory2.generateCertificate(new FileInputStream("C:\\Program Files (x86)\\Java\\jre7\\bin\\testserver1.cer")); KeyStore ks = KeyStore.getInstance("JKS"); InputStream certK = new FileInputStream("C:\\Program Files (x86)\\Java\\jre7\\bin\\testserver1.jks"); ks.load(certK, "wasp123".toCharArray()); //ks.setCertificateEntry("testserver1cert", generateCertificate); KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); kmf.init(ks, "wasp123".toCharArray()); KeyStore truststore = KeyStore.getInstance("JKS"); InputStream truststorex = new FileInputStream("C:\…
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37630528
has comment: http://stackoverflow.com/comment/37756764
favorite count: 0
has comment: http://stackoverflow.com/comment/37749885
has answer: http://stackoverflow.com/a/24347130
has comment: http://stackoverflow.com/comment/37661549
has comment: http://stackoverflow.com/comment/37666470
has comment: http://stackoverflow.com/comment/37665529
has answer: http://stackoverflow.com/a/24497810
has comment: http://stackoverflow.com/comment/37724440
tagged with: netbeans
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/9299133

http://stackoverflow.com/q/24351609
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37650992
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/24351773
tagged with: android
accepted answer: http://stackoverflow.com/a/24351773
has body: I had to repeat this question but non of the solutions are working. I am getting the following error java.lang.RuntimeException: Unable to start activity ComponentInfo{in.wptrafficanalyzer.locationroutedirectionmapv2/in.wptrafficanalyzer.locationroutedirectionmapv2.MainActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment MainActivity.java package in.wptrafficanalyzer.locationroutedirectionmapv2; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.json.JSONObject; import android.graphics.Color; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.util.Log; import android.view.Menu; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.GoogleMap.OnMapClickListener; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.gms.maps.model.PolylineOptions; public class MainActivity extends FragmentActivity { GoogleMap map; ArrayList<LatLng> markerPoints; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Initializing markerPoints = new ArrayList<LatLng>(); // Getting reference to SupportMapFragment of the activity_main SupportMapFragment fm = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map); // Getting Map for the SupportMapFragment map = fm.getMap(); if(map!=null){ // Enable MyLocation Button in the Map map.setMyLocationEnabled(true); // Setting onclick event listener for the map map.setOnMapClickListener(new OnMapClickLi…
has comment: http://stackoverflow.com/comment/37650844
has title: android.view.InflateException Error on MainActivity
tagged with: fragment

http://stackoverflow.com/q/24341443
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37713275
has comment: http://stackoverflow.com/comment/37648894
linked to: http://stackoverflow.com/q/24306875
has comment: http://stackoverflow.com/comment/37630687
has body: I'm writing an application in which I'm monitoring a log file from an external program using the WatchService (http://docs.oracle.com/javase/7/docs/api/java/nio/file/WatchService.html). Whenever an EVENT_MODIFIED is triggered on the file , I read it and check if a certain string is present. My program works fine when I manually enter text and save the file, but when the log file is edited by the external program, the WatchService is not triggered. I've tried a different approach where I use a thread in which I read the file and sleep for a certain amount of time and then repeat. This does the trick, but I'd rather not poll the file every X seconds when it should be possible to just "listen" for the changes. Does anyone know why the WatchServices is not detecting these modifications?
answer count: 0
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37648356
duplicate of: http://stackoverflow.com/q/24306875
favorite count: 0
has comment: http://stackoverflow.com/comment/37648007
has title: Watchservice not being triggered
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/37648702
tagged with: java
tagged with: watchservice

http://stackoverflow.com/a/24424815
has body: Since Narrowing Primitive Conversions(§5.1.3) says that narrowing of int is done into byte, short, or char. So you need to cast the int to byte where you calling the method. Like this : test.sum(1, (byte)2);
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24424686

http://stackoverflow.com/a/24268507
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has body: The basic plan, when you need a recursive solution, is to look for a way to break down the problem so that it contains a smaller problem (or more than one smaller problem) that looks just like the original problem, only smaller. For a 2-D array, this can be tricky. Say your array looks like 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 One's first thought might be to write a recursive function that takes a row and column, and adds a[row][column] to the sum of the rest of the array. The problem is that if, for example, row=0 and column=0, the "smaller problem" you have to solve looks like +---------------------+ 1 | 2 3 4 5 | +---+ | | 6 7 8 9 10 | | 11 12 13 14 15 | +-------------------------+ (please excuse the bad ASCII art). So now your smaller problem doesn't look like an array at all, but some weird polygon. It's still possible to use this approach, by writing a recursive function like int sumOfWeirdShapedSectionOfArray(int[][] array, int firstRow, int firstCol) But that's definitely an abuse of recursion. Better would be to break down the array into the "first row" and "the rest of the rows": 1 2 3 4 5 +-------------------------+ | 6 7 8 9 10 | | 11 12 13 14 15 | +-------------------------+ (Or you could break it into "the last row" and "the rest of the rows".) Now, your smaller problem looks a lot like the original problem, right? So your answer would be that "the sum of the elements in the array is the sum of the first row, plus the sum of the elements in the smaller array starting with the next row". The second part of this is a recursive call. The first part, the sum of the first row, would require that you call a new function to add up a row; and since you're still not allowed to use loops, the "add up a row" function would also be recursive, but that should be easy. Having said all this, nobody would ever use recursion in the real world on this problem. However, if the point is to get familiar with recursion so that you can use it when it's called for, then this s…
has comment: http://stackoverflow.com/comment/37492712
upvote count: 1
answers question: http://stackoverflow.com/q/24267834
accepted answer of: http://stackoverflow.com/q/24267834

http://stackoverflow.com/comment/37550578
has text: the blog you have followed is correct... but you have to import the libraries try `import org.apache.bsf.*;`
comment on: http://stackoverflow.com/q/24273262
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24308148
has body: I am using infinispan 6.0.1 release, I have configured it to use SingleFileStore as loader Configuration is as below <namedCache name="MyCache"> My question is, will this cache survive JVM restarts? I mean lets say my cache is holding {n} entries and my jvm goes down. When JVM starts again will my cache initialized with {n} entries? Thanks in advance!!
type: Question
has answer: http://stackoverflow.com/a/24327477
tagged with: caching
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24321183
type: UnansweredQuestion
tagged with: infinispan
score: 2
has title: Infinispan singleFileStore cache restartability
upvote count: 2
tagged with: java
tagged with: jboss-cache

http://stackoverflow.com/comment/37565261
comment on: http://stackoverflow.com/a/24306612
has text: Refactor what exactly? The item has to be created in the itemFactory class because item has a private constructor, but the methods needing the items are in another package. so I don't see how I can refactor the getItem method to something else.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/37812459
type: Comment
has text: @Marko They can all be in the root context, but be split into many `@Configuration` classes. (Obviously I don't know your application :p)
type: AnswerComment
comment on: http://stackoverflow.com/a/24389655
score: 0

http://stackoverflow.com/q/24284836
tagged with: dependencies
type: AnsweredQuestion
has title: Specify Transitive Dependencies with Ivy
tagged with: transitive-dependency
type: Question
accepted answer: http://stackoverflow.com/a/25156946
tagged with: ant
tagged with: java
tagged with: ivy
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/25156946
has body: Ok, so say I have a module that all of my projects build on, "Module_A", I then have "Module_B" which builds on A and finally I have my top level project which depends on B and so also needs the appropriate version of A. Both Module A and B are being published to Artifactory using Ivy from an ant script. When I come to develop Module B I can use IvyDE to resolve my dependency on Module A. The problem I have is when I come to develop my top level project, I specify that I am dependent on Module B and I want Module A also to be pulled from Artifactory but this doesn't happen and I'm not sure what I need to do to make it happen. So for clarity with the following ivy file I want both Module B and its dependency Module A to appear, as if by magic, on my class path. &lt;dependencies&gt; &lt;dependency org="MY_ORG" name="NAME" rev="latest.integration"&gt; &lt;artifact name="MODULE_B" type="jar" ext="jar" /&gt; &lt;/dependency&gt; &lt;/dependencies&gt; When I look at some of the jars I have resolved, say guava, this has its META-INF directory populated with a pom file. Is there an equivalent for Ivy that I need to create and bundle inside the jar? Thanks. Edit I believe some of the above is incorrect and IvyDE should just be using the ivy file hosted by artifactory to determine the transitive dependencies, not looking inside a jar - when I look at the file held by artifactory it does define the transitive dependencies that I want resolved. When I look at the IvyDE cache it contains a different ivy file with a default configuration that doesn't exist in artifactory and no dependencies! I'm getting towards the point of deciding that either Ivy, IvyDE and/or Artifactory are a waste of time... can someone please suggest what might be going wrong.

http://stackoverflow.com/a/24336834
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24335810
upvote count: 3
has body: DefaultTableModel model; public MyJframeForm() { initComponents(); model = new DefaultTableModel(); jTable1.setModel(model); model.addColumn("OstadName"); model.addColumn("DarsName"); LoadGridData(); } public void LoadGridData() { try { Class.forName("org.apache.derby.jdbc.ClientDriver"); Connection con = DriverManager.getConnection("jdbc:derby://localhost/NewDatabase"); Statement sta = con.createStatement(); java.sql.ResultSet rs = sta.executeQuery("SELECT OSTAD.NAAM || ' ' || OSTAD.NAAMKHANEVADEGI as OstadName," + " DARS.NAAM AS DarsName" + " FROM (OSTAD INNER JOIN OSTAD_DARS ON OSTAD.ID=OSTAD_DARS.OID )" + " INNER JOIN DARS ON OSTAD_DARS.DID=DARS.ID"); while (rs.next()) { model.addRow(new Object[]{rs.getString(1), rs.getString(2)}); } sta.close(); con.close(); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Exception: " + e.getMessage()); } }
answers question: http://stackoverflow.com/q/24335810

http://stackoverflow.com/comment/37552795
has text: Please add paste your code and errors here.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24300094

http://stackoverflow.com/q/24269308
has comment: http://stackoverflow.com/comment/37494174
has answer: http://stackoverflow.com/a/24269761
has body: class Foo { public Foo() { } } class Bar { static Foo foo = new Foo(); // This is legal... public static void main(String[] args) { static int a = 0; // ... But why this is not? } } Why can't we declare a static variable inside of a static function?
has comment: http://stackoverflow.com/comment/37494293
score: 15
has comment: http://stackoverflow.com/comment/37494231
has answer: http://stackoverflow.com/a/64631089
has answer: http://stackoverflow.com/a/24269485
has comment: http://stackoverflow.com/comment/37494337
has comment: http://stackoverflow.com/comment/102979724
has comment: http://stackoverflow.com/comment/114273198
favorite count: 0
has comment: http://stackoverflow.com/comment/37494315
has comment: http://stackoverflow.com/comment/37494364
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37494277
has comment: http://stackoverflow.com/comment/37494304
has answer: http://stackoverflow.com/a/64621715
has title: Unable to declare static variable inside of static method
upvote count: 16
has answer: http://stackoverflow.com/a/24269459
tagged with: java
has comment: http://stackoverflow.com/comment/37494247
downvote count: 1
type: Question

http://stackoverflow.com/q/24276048
type: UnansweredQuestion
tagged with: python
has comment: http://stackoverflow.com/comment/37507595
has comment: http://stackoverflow.com/comment/37507292
tagged with: java
has comment: http://stackoverflow.com/comment/37507779
has comment: http://stackoverflow.com/comment/37507320
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/24276201
has comment: http://stackoverflow.com/comment/37507264
has comment: http://stackoverflow.com/comment/37507304
score: 0
answer count: 2
has body: being new to java after having coded only in languages such as python and javascript, the best way to describe my issue is with an example from one of those two languages. to start with the error i am getting for my java program is when i attempt to create an array directly, such as string[] narray = {{'test',1}, {'test', 2}, {'test', 3}} now doing something like this gave me an illegal initialization error so i changed it to Array[][] narray = {{'test',1}, {'test', 2}, {'test', 3}} yet it is now giving me a "cannot find symbol" error. i am at a bit of a loss as to how to create an array like this directly. in python all i would have to do is narray = [['test', 1], ['test', 2], ['test', 3]]. how would i define an array like this in java? thank you.
has title: java array creation complication
has answer: http://stackoverflow.com/a/24288450
has comment: http://stackoverflow.com/comment/37507269

http://stackoverflow.com/q/24304091
type: Question
tagged with: split
has body: Input string: -;Lokacija;-;Pozicija;Grad;-;-; Code: public static ArrayList&lt;String&gt; sortList = new ArrayList&lt;String&gt;(); //Load String Row = new String("-;Lokacija;-;Pozicija;Grad;-;-;"); String[] RowAsList; RowAsList = Row.split(";"); sortList.add( RowAsList[0] ); // Check StringBuffer minus = new StringBuffer( "-"); String itm = sortList.get(0); if( !itm.contentEquals( minus ) ) // not minus else ..... Problem: this code says there is no minus on first item (0), subsequent minuses are recognized correctly. Anyone has any ideas as to why ? Thanks, Kajko
has comment: http://stackoverflow.com/comment/37560370
score: -2
accepted answer: http://stackoverflow.com/a/24304618
has comment: http://stackoverflow.com/comment/37560955
has comment: http://stackoverflow.com/comment/37560087
possible better answer: http://stackoverflow.com/a/24304176
has answer: http://stackoverflow.com/a/24304315
has answer: http://stackoverflow.com/a/24304176
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/37560723
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/37560376
type: AnsweredQuestion
tagged with: java
downvote count: 2
has title: java split string into string array produce first value wrong
has answer: http://stackoverflow.com/a/24304618

http://stackoverflow.com/a/24344547
type: Answer
has comment: http://stackoverflow.com/comment/37727632
has comment: http://stackoverflow.com/comment/125183680
upvote count: 29
score: 29
answers question: http://stackoverflow.com/q/24344511
accepted answer of: http://stackoverflow.com/q/24344511
has comment: http://stackoverflow.com/comment/125183623
has body: Usually, a RuntimeException indicates a programming error (in which case you can't "handle" it, because if you knew to expect it you'd have avoided the error). Catching any of these general exceptions (including Throwable) is a bad idea because it means you're claiming that you understand every situation which can go wrong, and you can continue on despite that. It's sometimes appropriate to catch Exception (but not usually Throwable) at the top level of the stack, e.g. in a web server - because usually whatever's gone wrong with a single request, you normally want to keep the server up and responding to further requests. I don't normally catch Throwable, as that includes Error subclasses which are normally used to indicate truly catastrophic errors which would usually be best "handled" by terminating the process. Fundamentally, when there's an error you need to be very cautious about continuing with a particular task - you need to really have a pretty good idea about what the error means, as otherwise you could go ahead with a mistaken assumption about the state of the world, and make things worse. In most cases (not all), simply giving up on a request is better than trying to carry on regardless of a mysterious failure. (It does very much depend on context though - you might not care what went wrong when trying to fetch one piece of secondary information, for example.) As for catching Exception not catching RuntimeException - that's simply not true. The only odd thing about RuntimeException is that it (and subclasses) are unchecked exceptions, whereas Exception and all other subclasses of Exception are checked.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37727696

http://stackoverflow.com/comment/37693548
score: 0
comment on: http://stackoverflow.com/q/24335121
type: Comment
type: QuestionComment
has text: Like @JasonPlutext said, what is the content of your `document.xml` file? Because it doesn't look like you have valid fields in there (i.e. `${colour}` and `${ice-cream}`).

http://stackoverflow.com/q/24279606
tagged with: android-emulator
has body: I have three different test applications which are installed in three different emulators and I need to initiate those test at the same time. But am not sure how would I do this. Requirement is to run these test from same machine in different devices/emulators. I am trying to write a script having the adb commands for running tests but am not sure how would I decide which test to run on which device. Here are the commands : ./adb shell am instrument -w com.pb.demo.test1/android.test.InstrumentationTestRunner ./adb shell am instrument -w com.org.demo.test2/android.test.InstrumentationTestRunner ./adb shell am instrument -w com.demo.ec.test3/android.test.InstrumentationTestRunner And I have scheduled this script to run at a particular time. So when this script would trigger, three different test cases should be initiated on three different devices attached to same machine(for e.g. my local). How can I achieve this? How would I change my commands such that they know which emulator to run test on? Is it really feasible? Please guide. PS: I am using genymotion for multiple emulators. These are 192.168.56.101:5555 device 192.168.56.102:5555 device
has answer: http://stackoverflow.com/a/24323127
answer count: 2
tagged with: android-testing
accepted answer: http://stackoverflow.com/a/24323127
score: 0
tagged with: android
has title: Android: Running different test on different Emulators/real devices attached to same machine
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/40014772
tagged with: java
has answer: http://stackoverflow.com/a/40014772

http://stackoverflow.com/a/24382553
downvote count: 0
has comment: http://stackoverflow.com/comment/37710450
answers question: http://stackoverflow.com/q/24382069
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/37709557
score: 2
has body: .../jre/lib/security/java.policy Can you try giving permission to all as below ? grant{ permission java.security.AllPermission; };

http://stackoverflow.com/q/24393391
has answer: http://stackoverflow.com/a/24393781
type: UnansweredQuestion
tagged with: eclipse-kepler
has comment: http://stackoverflow.com/comment/37730419
has title: Integrate Glassfish server with eclipse kepler
tagged with: java
has answer: http://stackoverflow.com/a/30014932
tagged with: eclipse
has body: I am trying to integrate glassfish3 with eclipse kepler. I have downloaded and installed glassfish server. But the problem is with server adapters in eclipse. While downloading additional server adapters in eclipse, it doesn't show glassfish server adapters. Am I doing something wrong or is there any other work-around. Please suggest, any help would be appreciated. Thanks in advance.
type: Question
answer count: 2
tagged with: glassfish
score: 0

http://stackoverflow.com/comment/37641307
score: 2
has text: _SpamClassifier-1.0-SNAPSHOT-jar-with-dependencies.jar_ is compiled by maven right ? and what is runtime can you try checking runtime version, I still doubt its not same
comment on: http://stackoverflow.com/q/24346354
type: Comment
type: QuestionComment

parcelable
tags question: http://stackoverflow.com/q/24373281
type: Tag
tag name: parcelable

http://stackoverflow.com/comment/37692611
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24373288
score: 0
has text: Oh ok. Have you tried without `DesiredCapabilities`? Just try `new PhantomJSDriver();` Then, try adding capabilities one by one until you eventually find the one being the cause of the problem.

http://stackoverflow.com/q/24311866
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
type: Question
score: 5
upvote count: 5
has answer: http://stackoverflow.com/a/24311928
possible better answer: http://stackoverflow.com/a/74005667
has title: Error creating bean with name defined in class path resource [application-context.xml] in spring framework
has answer: http://stackoverflow.com/a/74005667
answer count: 2
has body: <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="${url}"/> <property name="username" value="${username}"/> <property name="password" value="${password}"/> <constructor-arg value="MyDataSource"/> Error creating bean with name 'template' defined in class path resource [application-context.xml]: Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities) I am not sure what I am doing wrong here to get above error? Have all of it defined in properties file correctly with correct variable name. what are the things to check for ?
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24311928

for-loop
tags question: http://stackoverflow.com/q/24271052
tags question: http://stackoverflow.com/q/24296824
tags question: http://stackoverflow.com/q/24335660
tags question: http://stackoverflow.com/q/24393023
tags question: http://stackoverflow.com/q/24387775
tags question: http://stackoverflow.com/q/24358025
tags question: http://stackoverflow.com/q/24398983
tag name: for-loop
tags question: http://stackoverflow.com/q/24300733
tags question: http://stackoverflow.com/q/24419025
tags question: http://stackoverflow.com/q/24317447
tags question: http://stackoverflow.com/q/24422068
tags question: http://stackoverflow.com/q/24304332
tags question: http://stackoverflow.com/q/24396793
type: Tag
tags question: http://stackoverflow.com/q/24297191
tags question: http://stackoverflow.com/q/24366952
tags question: http://stackoverflow.com/q/24287125
tags question: http://stackoverflow.com/q/24360375

http://stackoverflow.com/comment/37513699
type: QuestionComment
has text: Sorry! The initial sample was with `LinkedList`.Now updated the Java sample with `PriorityQueue`.
type: Comment
comment on: http://stackoverflow.com/q/24279465
score: 0

http://stackoverflow.com/q/24415784
has comment: http://stackoverflow.com/comment/37772214
tagged with: io
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/24415959
accepted answer: http://stackoverflow.com/a/24415959
tagged with: java
has comment: http://stackoverflow.com/comment/37772291
type: Question
tagged with: apache-commons
linked to: http://stackoverflow.com/q/1146153
score: -2
has body: So I am trying to copy one file from one place to the other using the solution found here : Copying files from one directory to another in Java My code creates the new directory but cant seem to find the file ,even though the landedtitlesFile is pointing to the proper path and file. I always get my "blast" comment in case you were wondering if my program gets to the end of the method. Thank you for your time and patience. private File landedtitlesFile = new File("C:\\Program Files (x86)\\Steam\\SteamApps\\common\\Crusader Kings II\\common\\landed_titles\\landed_titles.txt"); private String modPath = "C:\\Users\\Bernard\\Documents\\Paradox Interactive\\Crusader Kings II\\mod\\viking"; public void createCopyLandedTitles(Boolean vanilla){ if (vanilla == true) { File dir = new File(modPath + "\\common\\landed_titles"); dir.mkdir(); try{ FileUtils.copyFile(landedtitlesFile,dir); } catch (IOException e ){ System.out.println("blast"); } }
downvote count: 2
has comment: http://stackoverflow.com/comment/37772284
has comment: http://stackoverflow.com/comment/37771979
answer count: 1
has title: What am i doing wrong with copying my file?
has comment: http://stackoverflow.com/comment/37772235
favorite count: 0

http://stackoverflow.com/comment/37581165
score: 0
type: AnswerComment
has text: Thank you very much. I was following [this](http://docs.oracle.com/javase/tutorial/essential/regex/quant.html) tutorial and was in the start, did not know what a greedy quantifier is, but this answer clarified it.
type: Comment
comment on: http://stackoverflow.com/a/24315048

http://stackoverflow.com/a/24288246
downvote count: 0
has comment: http://stackoverflow.com/comment/37535283
has comment: http://stackoverflow.com/comment/37531055
type: Answer
has comment: http://stackoverflow.com/comment/37535077
has body: If you do not want the list to be saved when the parent entity is saved/merged, you should remove or restrict the cascade setting for the relationship: @OneToMany private List&lt;EvaluationSelectionCriteria&gt; evaluationSelectionCriterias or @OneToMany(cascade = CascadeType.REMOVE) // or other values from the enum private List&lt;EvaluationSelectionCriteria&gt; evaluationSelectionCriterias EDIT: If you want to fetch an entity in a transactional method and modify it, you can restrict the scope of the transaction to the fetching only. Then modify the entity outside the transactional method. Later, you can merge the detached entity if needed. Since collection attributes are lazy per default you will either need to access their content while still inside the transactional method - so the collection can be fetched from the DB. Please note that you will have to call a method on the collection that actualy requires it's content to be loaded, like getCriterias().size(). use LEFT JOIN FETCH to load the collection as a side effect of the query. I would not modify the FlushMode for the session - while this would probably work, it feels like a kludge - it does not communicate your intent very well. Explicitly fetching the collection and modifying it outside the transaction expresses your intent better IMO.
answers question: http://stackoverflow.com/q/24287191
upvote count: 2
has comment: http://stackoverflow.com/comment/37535280
score: 2

http://stackoverflow.com/comment/37705128
comment on: http://stackoverflow.com/q/24378747
type: QuestionComment
type: Comment
has text: check this thread http://stackoverflow.com/questions/147181/how-can-i-convert-my-java- program-to-an-exe-file
score: 0

http://stackoverflow.com/comment/37710894
score: 0
type: AnswerComment
type: Comment
has text: if customer doesn't implement AnotationNotFoundException , then what shall I do? is there any way that make customer to implement a custom annotation? like @override?
comment on: http://stackoverflow.com/a/24383123

http://stackoverflow.com/a/24420883
upvote count: 3
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/24420860
answers question: http://stackoverflow.com/q/24420860
downvote count: 0
type: AcceptedAnswer
has body: Press CTRL + 3 then type Problems and hit Enter. This should show a list of all the issues in the project.

http://stackoverflow.com/a/24318821
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24317685
answers question: http://stackoverflow.com/q/24317685
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/37613760
has body: I can't see why you're deep-cloning the data. Does this seem like a case of caching? No, it's the JITC getting better on what you're running. Each non-trivial Java benchmark needs a warmup, during which statistics get gathered and then the relevant part of code (the HotSpot) gets compiled and optimized heavily. A more complex algorithm need more warmup. Can I guarantee that the data is not cached? I can't see any caching there. Who would do it? The JITC can't understand what you're doing. If it knew you're computing the same thing all the time, all the times but one would be zero. If I randomize the Points every time I generate the graphs, I'm betting there would be more control, but then I couldn't be sure that the algorithms are fairly matched. Go for it if you feel like this. I guess you can rather trust your benchmark without doing it. Update after the comment Warmup: The common situation is a server running for many hours (at least) doing mostly the same operations all the time. For such a server measuring the performance during the first minutes would make little sense. Another situation needed a warmup is measuring or optimizing very fast operations like e.g. String.hashCode, which are typically repeated many thousands times. You situation with a single long-taking computation seems to be an exception. Still, what I wrote about the warmup is a plausible explanation for your observations. Anyway, Quickselect was the winner in all runs, so the choice is clear. The fact that it improved later is nice bonus for the winner. The next places are less clear, but 22851 vs 23083 is no real win, as the measurement error is bigger (and so might be the cost for the deep-copy). Re-run you benchmark several times (with a fresh JVM) if you want to know more (1 iteration should suffice).

http://stackoverflow.com/comment/37672398
type: Comment
has text: i think you are in fragment class. just use getActivity() over there
comment on: http://stackoverflow.com/a/24362501
type: AnswerComment
score: 0

http://stackoverflow.com/a/62622983
has comment: http://stackoverflow.com/comment/119077929
answers question: http://stackoverflow.com/q/24342886
type: Answer
score: 25
has body: Please, run the following commands and it will install Java 8 on OS X: brew tap adoptopenjdk/openjdk brew install --cask homebrew/cask-versions/adoptopenjdk8 Note: adoptopenjdk8 has been officially discontinued upstream. It may stop working correctly (or at all) in recent versions of macOS. So, this is working at the moment, but, please, don't use this answer to install Java 8
has comment: http://stackoverflow.com/comment/115452712
downvote count: 1
upvote count: 26

http://stackoverflow.com/a/41771077
has body: Example of how to run your war with cargo & tomcat8 mvn clean verify org.codehaus.cargo:cargo-maven2-plugin:run -Dcargo.maven.containerId=tomcat8x -Dcargo.maven.containerUrl=http://repo1.maven.org/maven2/org/apache/tomcat/tomcat/8.5.9/tomcat-8.5.9.zip If you want to add it to your pom org.codehaus.cargo cargo-maven2-plugin ${cargo.version} tomcat8x http://repo1.maven.org/maven2/org/apache/tomcat/tomcat/8.5.9/tomcat-8.5.9.zip Then to run you war (if your pom is a war) mvn cargo:run To run with debug (memory options not necessary) org.codehaus.cargo cargo-maven2-plugin ${cargo.version} tomcat8x http://repo1.maven.org/maven2/org/apache/tomcat/tomcat/8.5.9/tomcat-8.5.9.zip <!-- <cargo.servlet.port>8200</cargo.servlet.port> --> <cargo.jvmargs>-Xmx2048m -Xms512m</cargo.jvmargs> <cargo.start.jvmargs>-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000</cargo.start.jvmargs> Then you need to create a remote debug configuration in your IDE on port 8000 (port by default if nothing specified) More commands here : https://codehaus-cargo.github.io/cargo/Maven2+plugin.html#Maven2plugin-TheCargoMavenpluginindetail
score: 6
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/24271213
upvote count: 7

http://stackoverflow.com/comment/37665729
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24357248
has text: I am trying to post user's score on facebook in cocos2d-x.I am using Hellofacebook android sample provided by facebook.Now if I make the onClickPostStatusUpdate method static then I would have to make all methods in the sample STATIC because they are linked with each other.Also, it shows some other error on the keyword "this" and getString.Please help.Thanks
type: AnswerComment

http://stackoverflow.com/a/24576964
type: Answer
has body: Compile the app and remove gwt.server query parameter from the URL. A compiled GWT app continues to execute in the browser and you can shut the Dev Mode server and start it up again to see the effect on your app.
score: 0
answers question: http://stackoverflow.com/q/24298380

http://stackoverflow.com/a/24363580
downvote count: 0
score: 1
has body: In your code above, if an exception occurs whilst closing the JDBC Connection, then none of the other JDBC objects or Streams are closed. The finally block exits at that point. Since Java 7, closing Streams and JDBC objects (Connections, Statements, ResultSets etc) can be done in a proper exception handling framework nice and easily, since they all implement a common interface AutoCloseable So you can write a single close() method and handle the exception inside: public void close(AutoCloseable closeable) { try { closeable.close(); } catch (Exception e) { //Just log the exception. there's not much else you can do, and it probably doesn't //matter. Don't re-throw! } } So when closing your JDBC objects, you can do this in the finally block: close(conn); close(ps); close(rs); close(inputStream); close(outputStream); Now if an exception occurs whilst closing any of the objects, it is handled and the following objects are still closed.
accepted answer of: http://stackoverflow.com/q/24304125
has comment: http://stackoverflow.com/comment/37678993
upvote count: 1
answers question: http://stackoverflow.com/q/24304125
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/37678732

http://stackoverflow.com/q/24311583
has answer: http://stackoverflow.com/a/24311795
favorite count: 0
has title: How to convert raw image into signed 32 bit
tagged with: signed
tagged with: hex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37574592
has comment: http://stackoverflow.com/comment/37574730
accepted answer: http://stackoverflow.com/a/24311795
has comment: http://stackoverflow.com/comment/37574894
upvote count: 1
downvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/37574440
tagged with: endianness
score: 0
has body: I have a file created with dd command (raw file). I opened it with bless as shown in the image below: Now I would like to extract the data from this file and get what appears under Signed 32 bit (If you see the image 84 is the number I want). Therefore, I want to convert the following string in this way: 10 00 00 00 --> 84 54 00 00 00 --> 70185301 In order to do this conversion I built the following program which opens the file, decode the line and write the result in a new file. Here is the piece of code that does the extraction (@Duncan Helped me to create it): try { File input = new File(inputFileField.getText()); File output = new File(fileDirectoryFolder.getText() +"/"+ input.getName()); byte[] buffer = new byte[8]; DataOutputStream out = new DataOutputStream(new FileOutputStream(output)); DataInputStream in = new DataInputStream(new FileInputStream(input)); int count = 0; while (count < input.length() - 4) { in.readFully(buffer, 4, 4); String s= Long.toString(ByteBuffer.wrap(buffer).order(ByteOrder.LITTLE_ENDIAN).getLong()); out.writeBytes( s+ " "); count += 4; } } System.out.println("Done"); } catch(FileNotFoundException e1){} However, the result I get is 10 00 00 00 --> 68719476736 54 00 00 00 --> 360777252864 Do you understand where my problem is? Thanks
answer count: 1
tagged with: arrays

http://stackoverflow.com/a/24351666
downvote count: 0
score: 1
has body: First, note that for any position x, if we already have calculated the result putting the last station on yth km, y &lt; x, result from x or right will not depend on the choices of the stations before y. So the state of the DP solution will be [KM][position_of_last_station][station_already_built] Sample code is following: int memo[MAX_KM][MAX_KM][MAX_STATION]; bool seen[MAX_KM][MAX_KM][MAX_STATION]; // if seen[km][pos_of_last_station][station_remaining] is true // then this subproblem has already been solved. No need to solve it again int dp(int KM, int pos_of_last_station, int station_remaining) { if(KM == MAX_KM + 1) { // reached the end int len = (MAX_KM - pos_of_last_station); return 2 * len * len + 3 * len; } if(seen[KM][pos_of_last_station][station_remaining]) { // this sub problem has already been solved return memo[KM][pos_of_last_station][station_remaining]; } int ret = 2e9; // some large value if(station_remaining &gt; 0) { // trying establishing a station on the current position int len = KM - pos_of_last_station; ret = min(ret, dp(KM + 1, KM, station_remaining - 1) + (2 * len * len + 3 * len) + cost[KM] ); // assuming cost[KM] is the cost to establish a station on KMth kilometer } ret = min(ret, dp(KM + 1, pos_of_last_station, station_remaining) ); seen[KM][pos_of_last_station][station_remaining] = true; // sub problem visited memo[KM][pos_of_last_station][station_remaining] = ret; // storing the result for future utilization return ret; } Complexity analysis: Will require O(MAX_KM * MAX_KM * MAX_STATION) time and space Warning: Code's not tested
answers question: http://stackoverflow.com/q/24351240
upvote count: 1
type: Answer

http://stackoverflow.com/a/24383559
type: Answer
has body: make your code as the following: // put the first id in first StringBuilder stringBuilder = new StringBuilder(id.get(0)); // start the loop from the 2nd for (i=1; i &lt; idList.size(); i++) { stringBuilder.append(",").append(id.toString()); } String ids = stringBuilder.toString() hasil = db.getDetailResult(ids); Change the code in getDetailResult() for the query to be something like if(ids.equals("")){ return null; } String sql = "SELECT * FROM...... WHERE ID IN("+ids+")....."; I think this is much faster, all records in 1 hit and no need for a second loop.
answers question: http://stackoverflow.com/q/24380026
score: 0

http://stackoverflow.com/comment/37490216
type: QuestionComment
has text: Have you read the javadoc of `getMethod`? What arguments does it take?
score: 1
comment on: http://stackoverflow.com/q/24267286
type: Comment

http://stackoverflow.com/comment/37730772
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24378684
has text: @Holger see your explanation is so clear that even my mother can understand it. Could you please post up your explanation with enough detail so I can accept as my answer? please explain it in the way that novice programmers in this case can understand the point like compact tutorial :)

http://stackoverflow.com/comment/37570090
has text: Right, I read through all those, so I must be doing something wrong, then. I get an executable jar, but when I double-click it, nothing happens. If I change the "open with" to javaw, or javaws, I get a cmd window to flash on the screen, and as best I can tell is can't find the main class (disappears really quickly). Must be a setting or option I don't have correct in the build process?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24298810

http://stackoverflow.com/q/24301272
score: 0
tagged with: sql
has title: How to locate app server folders from ibatis query
answer count: 1
tagged with: ibatis
type: UnansweredQuestion
tagged with: sql-server-2012
tagged with: java
type: Question
has body: I want to read app server folders from ibatis query. I want to do a BULK INSERT in SQL SERVER for that I am framing one query Iin iBatis which has app server folder location (eg: opt\sasu\import\abc.import)These files are present in app server. How can I write a query in ibatis. Below is the query which i wrote BULK INSERT TABLENAME FROM ${importFilePath} WITH ( FIELDTERMINATOR = '|', FORMATFILE = ${formatFilePath} ); importFilePath and formatFilePath are the app server file location paths. This query is expecting this files should present in database server. Is thier any one to solve this problem.
has answer: http://stackoverflow.com/a/24387033
tagged with: mybatis

http://stackoverflow.com/comment/37683616
type: QuestionComment
has text: @JonSkeet I thought it didn't matter, since it wasn't attached to anything. I assumed that was an entirely separate section of code, and the reuse of the variable name "result" was purely coincidental. Whoops.
score: 0
comment on: http://stackoverflow.com/q/24368458
type: Comment

http://stackoverflow.com/a/75625292
type: Answer
answers question: http://stackoverflow.com/q/24301074
has body: I was also encountering a SpelEvaluationException: Field or property 'xxx' cannot be found on null in the Spring Expression Language (SpEL) of my @Cacheable annotation. I looked in debug mode to ensure that the passed argument was not null, I added a Cacheable condition to ensure its non-nullity, I added @NonNull annotations, so this made no sense that the property was detected as null. For me, the solution was to rename the property in the SpEL of the Cacheable annotation. I then decided to use the lowercase version of the argument's classname instead of some other name. I think that Spring is not reusing the actual argument name as it is written in the method signature, Spring is making its own assumption about the argument name, by turning the classname into lowercase or something similar. This works: @Cacheable(value = FIND_X_BY_Y_CACHE, key = "#myArgument.id") Object findXByY(MyArgument myArgument); This doesn't work: @Cacheable(value = FIND_X_BY_Y_CACHE, key = "#anotherName.id") Object findXByY(MyArgument anotherName);
score: 0

http://stackoverflow.com/a/24305626
has body: Don't use firefox profile and try below code: driver.get("http://UserName:Password@Example.com"); If you're implementing it in IE browser, there are certain things which you need to do. In case your authentication server requires username with domain like "domainuser" you need to add double slash / to the url: //localdomain\user:password@example.com
has comment: http://stackoverflow.com/comment/52576141
has comment: http://stackoverflow.com/comment/62884244
score: 36
has comment: http://stackoverflow.com/comment/118976424
has comment: http://stackoverflow.com/comment/41231352
answers question: http://stackoverflow.com/q/24304752
type: Answer
has comment: http://stackoverflow.com/comment/87119366
has comment: http://stackoverflow.com/comment/73084027
downvote count: 1
upvote count: 37

http://stackoverflow.com/a/24332064
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/24331923
downvote count: 0
has body: rect is marked as private in Object. So it is only visible to instances of your Object class. Even child classes cannot see it in their implementation. You can do two things: 1) Create a getter method for it in Object. This method is public, so any other class, including your Block class, can see it. public Rectangle getMyRect() { return rect; } 2) Or mark it as protected or default (no access modifier). protected Rectangle rect; // this way... Rectangle rect; // ... or this way P.S. Do not name classes Object. It will work if the class is defined in a different package, but the class Object has a special meaning -- the top-most parent class of all classes -- and will confuse people.

http://stackoverflow.com/q/24335343
type: Question
upvote count: 5
answer count: 2
accepted answer: http://stackoverflow.com/a/24335387
has comment: http://stackoverflow.com/comment/37620317
has body: I believe when a singleton object gets serialized and is then deserialized upon a plethora of times in series, there are multiple instances of singletons created. How can you avoid such a situation?
possible better answer: http://stackoverflow.com/a/24335455
linked to: http://stackoverflow.com/q/70689
has answer: http://stackoverflow.com/a/24335455
favorite count: 0
duplicate of: http://stackoverflow.com/q/70689
tagged with: scala
tagged with: singleton
has title: Avoid multiple instances of Singleton?
tagged with: design-patterns
type: AnsweredQuestion
score: 4
tagged with: java
has answer: http://stackoverflow.com/a/24335387
downvote count: 1

http://stackoverflow.com/comment/37624405
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24337898
score: 5
has text: This seems more like something that would go on [Programmers SE](https://programmers.stackexchange.com/), because it doesn't directly deal with code and is more the conceptual side of programming. Perhaps flag your question and ask a mod to migrate it? It's a good question, though, in my opinion.

http://stackoverflow.com/comment/37556304
type: Comment
comment on: http://stackoverflow.com/a/24301933
score: 0
type: AnswerComment
has text: `Arrays.asList` is **of fixed size**. This doesn't change anything apart from access semantics.

http://stackoverflow.com/q/24320304
answer count: 4
type: AnsweredQuestion
tagged with: equals
upvote count: 3
type: Question
possible better answer: http://stackoverflow.com/a/24320352
has answer: http://stackoverflow.com/a/24320352
accepted answer: http://stackoverflow.com/a/24320389
tagged with: java
has body: I am trying to understand the String concatenation with the output of String compare. To be clear, i have the class to compare two strings using == and equals. I am trying to concat the output of == and equals() to a string. The output of equals() concats, but the output of == does not concat. Using boxing feature of java, the boolean concatenated with string will contact. Both equals and == returns boolean to my knowledge. So why is this difference? Can anyone explain on this? public class StringHandler { public void compareStrings() { String s1 = new String("jai"); String s2 = "jai"; String s3 = "jai"; System.out.println("Object and literal compare by double equal to :: " + s1 == s2); System.out.println("Object and literal compare by equals :: " + s1.equals(s2)); System.out .println("Literal comparing by double equal to :: " + s2 == s3); System.out.println("Literal comparing by equals :: " + s2.equals(s3)); } public static void main(String[] args) { StringHandler sHandler = new StringHandler(); sHandler.compareStrings(); } } output false Object and literal compare by equals :: true false Literal compareing by equals :: true Update: Answer Without parenthesis for s1==s2, the JVM compares the string as "Object and literal compare by double equal to :: jai" == "jai" and the result is false. So the actual content in sysout is not printed. When parenthesis is added the JVM compares the string as "jai" == "jai" and the result is Object and literal compare by double equal to :: true
has title: String equals and == with String concatenation
has comment: http://stackoverflow.com/comment/37591149
downvote count: 0
linked to: http://stackoverflow.com/q/18238056
tagged with: string
tagged with: string-concatenation
favorite count: 0
has answer: http://stackoverflow.com/a/24320341
duplicate of: http://stackoverflow.com/q/18238056
has answer: http://stackoverflow.com/a/24320390
score: 3
has answer: http://stackoverflow.com/a/24320389

http://stackoverflow.com/q/24404521
tagged with: datetime
has comment: http://stackoverflow.com/comment/37751050
has body: I'm getting the current datetime and I want to refresh the current datetime on every message but it is not updating in my textview. I'm making a instant messaging application like whatsapp. I want to get the datetime with every text message but my textview shows the same datetime on every message. I think I should make a arraylist and take last datetime but this is not working. datearray.add(dateFormat.format(date).toString()); tarih.setText(datearray.get(datearray.size() - 1));
has comment: http://stackoverflow.com/comment/37750902
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37751445
type: Question
has comment: http://stackoverflow.com/comment/37754273
tagged with: datetime-format
score: 0
tagged with: textview
has title: I taking current date and i want to reveive currenttime everymessage but it coming same in textview
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/37630354
comment on: http://stackoverflow.com/q/24341033
type: Comment
type: QuestionComment
has text: Posted a hacky answer down below. If it makes your head ache, I recommend using LibGDX for your java-based game-programming needs. Doing 3D from scratch requires lots of math.
score: 0

http://stackoverflow.com/q/24319333
tagged with: android
possible better answer: http://stackoverflow.com/a/24319456
has answer: http://stackoverflow.com/a/24319456
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37590559
has comment: http://stackoverflow.com/comment/37613377
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/24420905
has title: arrayList String search: NullPointerException
has comment: http://stackoverflow.com/comment/37593635
tagged with: arraylist
score: 0
has body: I will try to explain this as best I can. (I'm still new with both Java and Android) Issue: I am trying to compare an incoming number string to a Contact object's number string by searching the arrayList. Background: I am able to load Contacts from an arrayList into different views (ListView, textView, etc) so I know the methods and objects are working. It's this new class (RingerService) that I'm having the issue with. Design I have an arrayList of contacts in a class named contactStorage. It works as intended for displaying different views: //constructor with context to access project resources and instantiate from JSONfile to arrayList private ContactStorage(Context appContext){ mAppContext = appContext; mSerializer = new ContactJSONer(mAppContext, FILENAME); try{ mContacts = mSerializer.loadContacts(); }catch (Exception e){ mContacts = new ArrayList<Contact>(); Log.e(TAG, "No contacts available, creating new list: ", e); } } //get method to only return one instance from the constructor public static ContactStorage get(Context c){ if (sContactStorage == null){ sContactStorage = new ContactStorage(c.getApplicationContext()); } return sContactStorage; } //for ringer service to find matching number public Contact getContactNumber(String number){ for (Contact c: mContacts){ if(c.getNumber().replaceAll("[^0-9]", "").equals(number)) return c; } return null; } when I call the get method above in the RingerService class below, that's when things break. To be specific, I am getting a NullPointerException on onCallStateChanged: private Contact mContact; private String number; private Context mContext; @Override public void onCreate(){ mTelephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); mPhoneStateListener = new PhoneStateListener(){ // state change @Override public void onCallStateChanged(int state, String incomingNumber){ if (state == 1 ){ try{ mContact = ContactStorage.get(mContext).getContactNumber(incomingNumber); number = mContact.getNum…
tagged with: nullpointerexception
answer count: 2
has comment: http://stackoverflow.com/comment/37589910
accepted answer: http://stackoverflow.com/a/24420905
tagged with: singleton

http://stackoverflow.com/a/24368893
answers question: http://stackoverflow.com/q/24368243
has body: First Mistake while(in.hasNext()){ String lineToFindDouble=in.next(); NumberRow.start(lineToFindDouble); } You will get Bison when you perform next() at this position . You should change this code as while(in.hasNextLine()){ String lineToFindDouble=in.nextLine(); NumberRow.start(lineToFindDouble); } So you will be passing to NumberRow.start("Bison 7.9 5.9") Next In your numberRow while(findingDoubles.hasNext()) At this moment the scanner cursor points to Bison . You should change to while(findingDoubles.hasNextDouble()) So that scanner will continue to find double and wait at next first double . when you call next() Scanner stops if its find space / double / int or so check documentation for more info.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24368243
type: Answer

http://stackoverflow.com/q/24403649
tagged with: java
has answer: http://stackoverflow.com/a/24403983
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24403756
favorite count: 0
has comment: http://stackoverflow.com/comment/37749292
upvote count: 3
tagged with: file-io
has body: I'm creating a pdf file in my java program. After having it created to a specified Path, I'm opening it with the user's standard application. File myFile = new File("F:/test.pdf"); Desktop.getDesktop().open(myFile); My standard application for pdf files is for example Adobe Reader - so Adobe Reader opens up and displays the file. - So far so good. Is there any way to delete this "test.pdf" after I close the file/my Adobe Reader?
linked to: http://stackoverflow.com/q/1390592
possible better answer: http://stackoverflow.com/a/24403756
accepted answer: http://stackoverflow.com/a/24403983
has title: Deleting a file, opended by an external application, after closing it
type: AnsweredQuestion
score: 3
downvote count: 0

http://stackoverflow.com/comment/37728455
has text: @Ryan It's because Java passes by reference. When you keep reusing the same object, you only have one reference. It's like the wallet analogy - you stored cash in the wallet and then threw the cash out to store the next set of cash in the same wallet. Instead you should be getting multiple wallets to store multiple sets of cash (this is what you achieve by reinitialization). Anyway this is a common misunderstanding by beginners and causes a lot of bugs. Read up on "pass by reference" and "pass by value" in relation to Java.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24391830
type: Comment

http://stackoverflow.com/q/24394750
downvote count: 0
linked to: http://stackoverflow.com/q/11806690
has answer: http://stackoverflow.com/a/24394871
favorite count: 0
type: Question
score: 3
tagged with: android
tagged with: opengl-es
has title: Can't draw a triangle with OpenGL ES 2.0 on android
tagged with: geometry
upvote count: 3
accepted answer: http://stackoverflow.com/a/24394871
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37733131
has body: I was coding along with tutorials from developer.android.com about working with opengl and as I have faced some errors I tried to fix them but it didn't work out. I have created main activity in which when you press the button the intent opens an opengl activity which displays a black screen but it doesn't display the triangle. Can you tell me where the problem is? This is my MainActivity class: package com.eBook.test; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Button button = (Button)findViewById(R.id.button); button.setOnClickListener(new OnClickListener() { public void onClick(View v){ Intent intent = new Intent (MainActivity.this, OpenGLES20Activity.class); startActivity(intent); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup…
has comment: http://stackoverflow.com/comment/37733576
tagged with: draw
type: AnsweredQuestion

http://stackoverflow.com/comment/37599634
type: Comment
has text: @user3464035 Try `System.out.println(Arrays.toString(array));`.
comment on: http://stackoverflow.com/a/24324457
score: 0
type: AnswerComment

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

http://stackoverflow.com/q/24369643
has comment: http://stackoverflow.com/comment/37686427
has comment: http://stackoverflow.com/comment/37685128
upvote count: 0
has body: this is my first post and I hope someone can help. I have been struggling for ages to understand the problem I have and it looks as though I have done everything right yet problem persists. I have written a simple account program and would like to store the new balance after each transaction into an array index. From printing out balance I can see that it is adding and subtracting properly, however it is updating every single array index with the new balance rather than each incremental index. Can anyone spot my mistake. Thank you for any help with this. Richard public class TestAppAccount { public static void main(String args[]) { int count = 0; do { AppAccount.transaction(); AppAccount.storeBalance(); AppAccount.printBalance(); count++; //Account1.printBalance2(); } while (count &lt;= 100); } public class AppAccount { public static double[] currentBalance = new double[100]; static Scanner keyboard = new Scanner(System.in); static double balance; static int transaction; public static void transaction() { System.out.println(" Press 1 to add funds, 2 to withdraw "); transaction = keyboard.nextInt(); if (transaction == 1) { System.out.println("Enter an amount to add "); double amount = keyboard.nextInt(); double newBalance = balance + amount; balance = newBalance; } else { System.out.println("Enter an amount to withdraw"); double amount = keyboard.nextInt(); double newBalance = balance - amount; balance = newBalance; } } public static void storeBalance() { for (int i = 0; i &lt; currentBalance.length; i++) { currentBalance[i] = balance; } } public static void printBalance() { System.out.println("Balance: " + balance); System.out.println("Balance: " + currentBalance[3]);//testing by printing 3rd index } }
has answer: http://stackoverflow.com/a/24369752
favorite count: 0
has comment: http://stackoverflow.com/comment/37685215
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24369973
has answer: http://stackoverflow.com/a/24369811
has answer: http://stackoverflow.com/a/24369770
has answer: http://stackoverflow.com/a/24369778
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37685226
has title: How to store a double in an array incrementally
score: -1

http://stackoverflow.com/q/24306932
tagged with: layout-manager
has body: I am trying to draw a coloured bar, which gets bigger as time goes on. It works when I use the default layoutmanager, but when im trying to implement this with GridBagLayout it wont. I wrote a test project just for testing purposes to investigate what the problem is. I added a few buttons just to have something else apart from the graphics2D object, so it kinda looks like my actual project im working on. But after a couple of days, i have to admit that i dont have a clue, what is going wrong. I hope someone can help me! Just in advance, dont get confused by some words i used in the code. my mother tongue isn't english. import java.awt.*; import javax.swing.*; import java.util.TimerTask; import java.util.Timer; public class FarbBalkenTest extends JPanel { static Timer timer = new Timer (); static TimerTask task ; static int time; public static void main(String[] args) { FarbBalkenTest fbt = new FarbBalkenTest(); fbt.init(); } public static void addComponent(Container cont, GridBagLayout gbl, Component c, int x, int y, int width, int height, double weightx, double weighty ){ GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; gbc.gridx=x; gbc.gridy=y; gbc.gridwidth=width;gbc.gridheight=height; gbc.weightx=weightx;gbc.weighty=weighty; gbl.setConstraints(c,gbc); cont.add(c); } public void init (){ final JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setBackground(new Color(230,230,230)); Container c = frame.getContentPane(); GridBagLayout gbl = new GridBagLayout(); c.setLayout(gbl); ZeichenTest z_test = new ZeichenTest(); addComponent(c,gbl, new Button("top left"), 0,0,1,1,1.0,1.0); addComponent(c,gbl, new Button("top right"), 2,0, 1,1,1.0,1.0); addComponent(c, gbl,z_test, 1,1,1,1,1.0,1.0); addComponent(c,gbl, new Button("down left"),0,2,1,1,1.0,1.0); addComponent(c,gbl, new Button("down right"),2,2,1,1,1.0,1.0); frame.setSize(500,500); frame.setVisible(true); task = new TimerT…
tagged with: graphics2d
answer count: 1
has title: Painting Grahpics2D Object on Frame with GridBagLayout
favorite count: 0
has answer: http://stackoverflow.com/a/24307550
has comment: http://stackoverflow.com/comment/37607240
tagged with: swing
accepted answer: http://stackoverflow.com/a/24307550
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/37565771
upvote count: 3
tagged with: java
type: Question
tagged with: gridbaglayout
downvote count: 0

spring-mvc
tags question: http://stackoverflow.com/q/24278425
tags question: http://stackoverflow.com/q/24412968
tags question: http://stackoverflow.com/q/24354701
tags question: http://stackoverflow.com/q/24315643
tags question: http://stackoverflow.com/q/24366069
tags question: http://stackoverflow.com/q/24406772
tags question: http://stackoverflow.com/q/24276145
tags question: http://stackoverflow.com/q/24407369
tags question: http://stackoverflow.com/q/24368901
tags question: http://stackoverflow.com/q/24279743
tags question: http://stackoverflow.com/q/24326875
tags question: http://stackoverflow.com/q/24392004
tags question: http://stackoverflow.com/q/24403325
tags question: http://stackoverflow.com/q/24414146
tags question: http://stackoverflow.com/q/24393499
tags question: http://stackoverflow.com/q/24361392
tags question: http://stackoverflow.com/q/24362210
tags question: http://stackoverflow.com/q/24376216
tags question: http://stackoverflow.com/q/24403672
tags question: http://stackoverflow.com/q/24284955
tags question: http://stackoverflow.com/q/24342533
tags question: http://stackoverflow.com/q/24379035
tags question: http://stackoverflow.com/q/24348548
tags question: http://stackoverflow.com/q/24336386
tags question: http://stackoverflow.com/q/24405094
tags question: http://stackoverflow.com/q/24312001
tags question: http://stackoverflow.com/q/24322195
tags question: http://stackoverflow.com/q/24417691
tags question: http://stackoverflow.com/q/24311866
tags question: http://stackoverflow.com/q/24418952
tags question: http://stackoverflow.com/q/24327608
tags question: http://stackoverflow.com/q/24357693
tags question: http://stackoverflow.com/q/24320136
tags question: http://stackoverflow.com/q/24312453
tags question: http://stackoverflow.com/q/24402516
tags question: http://stackoverflow.com/q/24400557
tag name: spring-mvc
tags question: http://stackoverflow.com/q/24288467
tags question: http://stackoverflow.com/q/24301114
tags question: http://stackoverflow.com/q/24377087
tags question: http://stackoverflow.com/q/24278520
tags question: http://stackoverflow.com/q/24278365
tags question: http://stackoverflow.com/q/24326340
tags question: http://stackoverflow.com/q/24332618
tags question: http://stackoverflow.com/q/24298728
tags question: http://stackoverflow.com/q/24293341
tags question: http://stackoverflow.com/q/24410655
tags question: http://stackoverflow.com/q/24306473
tags question: http://stackoverflow.com/q/24303903
tags question: http://stackoverflow.com/q/24277678
tags question: http://stackoverflow.com/q/24346722
tags question: http://stackoverflow.com/q/24334288
type: Tag
tags question: http://stackoverflow.com/q/24318857
tags question: http://stackoverflow.com/q/24368090
tags question: http://stackoverflow.com/q/24278868
tags question: http://stackoverflow.com/q/24339990
tags question: http://stackoverflow.com/q/24314886
tags question: http://stackoverflow.com/q/24400299
tags question: http://stackoverflow.com/q/24322085
tags question: http://stackoverflow.com/q/24286483
tags question: http://stackoverflow.com/q/24367503
tags question: http://stackoverflow.com/q/24405364
tags question: http://stackoverflow.com/q/24410666
tags question: http://stackoverflow.com/q/24424094
tags question: http://stackoverflow.com/q/24278208
tags question: http://stackoverflow.com/q/24311570
tags question: http://stackoverflow.com/q/24289858
tags question: http://stackoverflow.com/q/24349219
tags question: http://stackoverflow.com/q/24382915
tags question: http://stackoverflow.com/q/24285394
tags question: http://stackoverflow.com/q/24356841
tags question: http://stackoverflow.com/q/24388702
tags question: http://stackoverflow.com/q/24304496
tags question: http://stackoverflow.com/q/24303141
tags question: http://stackoverflow.com/q/24381570
tags question: http://stackoverflow.com/q/24278197
tags question: http://stackoverflow.com/q/24338734
tags question: http://stackoverflow.com/q/24410395
tags question: http://stackoverflow.com/q/24342687

jgrapht
tags question: http://stackoverflow.com/q/24384223
tag name: jgrapht
type: Tag

http://stackoverflow.com/comment/37593977
type: QuestionComment
type: Comment
has text: @NickolaiAstashonok if you can help me please..
comment on: http://stackoverflow.com/q/24309871
score: 0

http://stackoverflow.com/comment/37543314
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24294744
has text: That fixes the jar problem but how to I make the code discriminate between types?
type: Comment

http://stackoverflow.com/comment/37689878
score: 0
type: QuestionComment
type: Comment
has text: Is this a full XML-valid syntax text or it is a plain text that may contain ` Content `?
comment on: http://stackoverflow.com/q/24372154

http://stackoverflow.com/comment/37666704
type: Comment
has text: Hi Ruediste, thanks for your replies. With arquillian I would have to bundle my tests and deploy them to the server. I would like prevent this and run it from within the IDE. So ideally the extension mechanism does not need a container. I figure there should be other options but it seems the question is not interesting enough for others to provide answers. I will wait till evening CET and then mark it as resolved. If no other answer came up your is the winner ;-).
score: 0
comment on: http://stackoverflow.com/a/24354172
type: AnswerComment

http://stackoverflow.com/comment/37763902
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24411535
has text: Nope, no setters. And you should definitely declare 'a' and 'b' as 'final'!
score: 1

http://stackoverflow.com/a/24299983
has body: 405 is method not allowed error, this mean you have method that causing problem when its being called. Check if you have duplicate path with method in your wsdl. If no duplicate path try open the http://lxxxxxxxxxxxx?wsdl in your browser if you cant, that`s mean something wrong with your web configuration.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24299707
upvote count: 1
type: Answer

http://stackoverflow.com/q/24277513
tagged with: jaxb
type: Question
has comment: http://stackoverflow.com/comment/37510331
has comment: http://stackoverflow.com/comment/37510378
has title: Unmarshalling XML into Java object JAXB
score: 0
has comment: http://stackoverflow.com/comment/37511273
tagged with: unmarshalling
has comment: http://stackoverflow.com/comment/37510712
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/37510777
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37510586
has comment: http://stackoverflow.com/comment/37510270
has comment: http://stackoverflow.com/comment/37510988
has comment: http://stackoverflow.com/comment/37510047
answer count: 0
has body: I am having a XML document as follows, 1 Basic 2 Basic Pin And have classes as follows, @XmlRootElement(name = "Configuration") class ShopConfig { private List shops; @XmlElementWrapper(name = "Configuration", nillable = false) @XmlElement(name = "Shop", nillable = false) public List getShops() { return shops; } public void setShops(List shops) { this.shops = shops; } public void print(){ for(Shop shop: shops){ List<String> l = shop.getItemNames(); for(String s : l){ System.out.println(s); } } } } public class Shop { private String level; private List<String> itemNames; public String getLevel() { return level; } @XmlElement(name = "Level") public void setLevel(String level) { this.level = level; } @XmlElementWrapper(name = "Items", nillable = false) @XmlElement(name = "Item", nillable = false) public List<String> getItemNames() { return itemNames; } public void setItemNames(List<String> itemNames) { this.itemNames = itemNames; } } I unmarshall the xml as follows, private static ShopConfig initShopConfig() throws JAXBException { String configPath = "Config.xml"; File file = new File(configPath); JAXBContext ctx = JAXBContext.newInstance(ShopConfig.class); Unmarshaller um = ctx.createUnmarshaller(); return (ShopConfig) um.unmarshal(file); } But when I am trying to print it gives NPE when I try to call print method saying shops variable is null. It means it didn't unmarshall properly. What wrong am I doing here? public static void main(String args[]){ ShopConfig l = (ShopConfig)ConfigLoader.getInstance().getConfig(); l.print(); } The exception is not informative, Exception in thread "main" java.lang.NullPointerException at config.ShopConfig.print(ShopConfig.java:42) at config.Test.main(Test.java:9) 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.…
tagged with: java
has comment: http://stackoverflow.com/comment/37510214

http://stackoverflow.com/a/24361989
score: 0
type: Answer
has body: Sometimes it's difficult to know where to start, but this question in its parts has been answered many times. However, perhaps to help you, it's best to point you in the right direction. The steps you want are: 1) Get the String which represents the files path from the args array, perhaps something like: String filePath = args[0]; However, you will want to also check that there is an item in the args to prevent the possibility of getting an exception when reading from the args (if nothing was passed from the command line) e.g: String filePath; if(args.length &gt; 0){ filePath = args[0]; }else{ // do something to handle the error, probably exit the program? } For any more details on this, see here: Link to java tutorial 2) Then, you want to make a File object from that string using the File constructor. Link to javadoc File inputFile = new File(filePath); 3) Then you need to read that file, line by line. For that I will point you to another SO answer, as there are many ways to do this: Reading from a file - SO question Hope this helps.
answers question: http://stackoverflow.com/q/24361864

http://stackoverflow.com/a/24302999
score: 0
answers question: http://stackoverflow.com/q/24302834
type: Answer
has body: Would this work for you? public class C { static void myMethod(java.io.PrintStream p) { p.println("Hello!"); } public static void main(String args[]) { myMethod(System.out); } } Unfortunately you can't pass System.out.println directly, because in Java methods (before Java 8) are not first-class objects. All you can do with a method is calling it. As a workaround, you can introduce an interface and create an adapter class.
has comment: http://stackoverflow.com/comment/37558656

http://stackoverflow.com/a/24406519
has body: An easy way to check is just to print it using for example Ideone. Check this link to see a demonstration. That said, the expression evaluates to a boolean. Since &lt; and &gt; have higher precedence than &amp;&amp;, the expression is equivalent to (n &gt; k) &amp;&amp; (k &lt; 0), which is a bit easier to interpret.
accepted answer of: http://stackoverflow.com/q/24406481
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37754623
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24406481

http://stackoverflow.com/comment/37641241
comment on: http://stackoverflow.com/a/24345890
has text: Thank you! Just downloaded it and imported to the project and it's now working. :)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24321312
type: Question
has comment: http://stackoverflow.com/comment/37598350
tagged with: jdbc
has body: We are migrating lot of data from our old database to new database. Presently, both of them are actively[writing/reading] used based on flows/activity as migration is in progress. Here's the real challenge for me now. We have old database table which's still getting used now. Atleast 100,000 new records are getting inserted every day and we need to move six months old data [01-01-2014] to new database. We are using MySQL in both places. The new table to old table need some logical-transformation of data which will be carried through Java-JDBC, as the table structures and functionality is changed. What are the ideal steps that I need to follow and taken care to do this transformation as quick as possible without fail. As per my calculation, we will be migrating at least 20,000,000 records. Some info: Presently index exists only on ID column. creation_date exists without index How to fetch efficiently these records, a better query to fetch?? Efficient way to transform using multi-threading Efficient way to write the data into new database
has title: Transforming Huge Database table to Another Table
has comment: http://stackoverflow.com/comment/37594936
has comment: http://stackoverflow.com/comment/37593028
has answer: http://stackoverflow.com/a/24324924
has comment: http://stackoverflow.com/comment/37593101
upvote count: 2
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/37601225
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/37592923
tagged with: performance
has comment: http://stackoverflow.com/comment/37594322
accepted answer: http://stackoverflow.com/a/24324924
type: AnsweredQuestion
tagged with: sql
has comment: http://stackoverflow.com/comment/37592959
has comment: http://stackoverflow.com/comment/37592976
score: 1
has comment: http://stackoverflow.com/comment/37593127
favorite count: 0
has comment: http://stackoverflow.com/comment/37602100
has comment: http://stackoverflow.com/comment/37602201

http://stackoverflow.com/q/24310632
type: Question
has title: Invoke a method on all subclasses from superclass?
has comment: http://stackoverflow.com/comment/37572673
has answer: http://stackoverflow.com/a/24310700
has answer: http://stackoverflow.com/a/24310778
tagged with: inheritance
has comment: http://stackoverflow.com/comment/37572798
answer count: 5
has comment: http://stackoverflow.com/comment/37578492
has answer: http://stackoverflow.com/a/24311637
tagged with: super
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24310769
has comment: http://stackoverflow.com/comment/37572692
has answer: http://stackoverflow.com/a/24310861
has body: I have recently stubled upon something that has always annoyed me. Whenever I want a method to be invoked in all classes that have a certain interface, or if they are extensions, I would like to have a keyword that does the opposite of the keyword super. Basically, I want the invocation to be passed down (if a class inherits a method, and the method in the superclass is called, it will be called in the subclass as well). Is there anything that resembles what I am asking for? EDIT: The contemporary methods I am using are efficient, but not as efficient as I would like them to be. I am only wondering if there is a way of invoking a method, that has been inherited, from its superclass/superinterface. The last time I was looking for this, I did not find it either. NOTE: All of the subclasses are unknown, hence impossible to utilize. The only known class is the superclass, which is why I can't invoke it. This can be solved using the Reflections API, which I am currently using. However, it does not always comply with what I am searching for.
score: 0
tagged with: java

http://stackoverflow.com/a/24336700
has comment: http://stackoverflow.com/comment/37622327
downvote count: 0
has body: I think the hangup comes from the fact that when you call nextLine() after nextInt(), the newline that wasn't parsed in nextInt() is counted as the end of the line, so the scanner assumes you're done already. A way to alleviate that is to always call nextLine, but parse the resultant String as an Int. I don't think it's a good idea to do this in most cases, but in your case it seems beneficial. public static void addFlower(){ Scanner input = new Scanner(System.in); ... int desiredThorns = Integer.parseInt(input.nextLine()); ... flowerPack.add(new FlowerClass(desiredName, desiredColor, desiredThorns, desiredSmell)); }
has comment: http://stackoverflow.com/comment/37624795
accepted answer of: http://stackoverflow.com/q/24336626
has comment: http://stackoverflow.com/comment/37622306
upvote count: 2
answers question: http://stackoverflow.com/q/24336626
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37624791
has comment: http://stackoverflow.com/comment/37624994
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/37622622

http://stackoverflow.com/comment/120385033
score: 0
type: AnswerComment
has text: Please don't post text in images
type: Comment
comment on: http://stackoverflow.com/a/38530987

http://stackoverflow.com/comment/37549543
score: 0
type: Comment
type: QuestionComment
has text: http://stackoverflow.com/questions/15177049/android-libgdx-swipe-left-and-right-detection-using-gesture-listener
comment on: http://stackoverflow.com/q/24298301

http://stackoverflow.com/comment/37595790
has text: I'd do this with a combination of three layout managers: BorderLayout as the parent layout; the CENTER position is a JPanel with a SpringLayout (using utility code from the Swing tutorial to easily create a grid) for the input fields with labels, the PAGE_END position is a JPanel with a centered FlowLayout for the button(s).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24320436

http://stackoverflow.com/a/24421267
score: 2
accepted answer of: http://stackoverflow.com/q/24421240
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24421240
downvote count: 0
upvote count: 2
type: Answer
has body: You are probably calling terrain = ImageIO.read(getClass().getResource("Arcanus Terrain Tileset.png")); inside a static method. You cannot call getClass() inside a static method since getClass() refers to an instance of a class. In that context you should call: terrain = ImageIO.read(MyClass.class.getResource("Arcanus Terrain Tileset.png"));

http://stackoverflow.com/comment/37541380
comment on: http://stackoverflow.com/q/24292930
has text: Try `MultivaluedHashMap`? I think `MultivaluedMapImpl` is a RestEasy/Jersey-1 thing.
score: 0
type: Comment
type: QuestionComment

object
tags question: http://stackoverflow.com/q/24335782
tags question: http://stackoverflow.com/q/24398558
tag name: object
tags question: http://stackoverflow.com/q/24337786
tags question: http://stackoverflow.com/q/24281038
tags question: http://stackoverflow.com/q/24371587
tags question: http://stackoverflow.com/q/24290535
tags question: http://stackoverflow.com/q/24354471
tags question: http://stackoverflow.com/q/24374533
tags question: http://stackoverflow.com/q/24287393
tags question: http://stackoverflow.com/q/24298851
tags question: http://stackoverflow.com/q/24297404
tags question: http://stackoverflow.com/q/24373281
tags question: http://stackoverflow.com/q/24387291
tags question: http://stackoverflow.com/q/24335378
tags question: http://stackoverflow.com/q/24403019
type: Tag
tags question: http://stackoverflow.com/q/24394765
tags question: http://stackoverflow.com/q/24417558
tags question: http://stackoverflow.com/q/24351982

http://stackoverflow.com/comment/37595434
score: 0
comment on: http://stackoverflow.com/q/24306198
has text: Actually i doing 2 templates, one template able display chinese word, another one not able. The way i implement is same even the content of the template is same. Is that any hidden error caused behind or setting i shld do ?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37563663
has text: possible duplicate of [How to get the caller method information from Around advise](http://stackoverflow.com/questions/5630809/how-to-get-the-caller-method-information-from-around-advise)
comment on: http://stackoverflow.com/q/24305848
score: 0
type: Comment
type: QuestionComment

url
tags question: http://stackoverflow.com/q/24318267
tags question: http://stackoverflow.com/q/24419685
tag name: url
tags question: http://stackoverflow.com/q/24332956
tags question: http://stackoverflow.com/q/24334436
tags question: http://stackoverflow.com/q/24356791
type: Tag
tags question: http://stackoverflow.com/q/24335040

http://stackoverflow.com/a/30214418
type: AcceptedAnswer
upvote count: 9
type: Answer
downvote count: 0
score: 9
has body: GCMV doesn't work on a running JVM. It is used offline after the application finishes. To use it, do the following: Add the following VM argument to your command line to generate a gc log file: -verbose:gc -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:[log file location] From GCMV perspective use File-&gt;Load File... with the file generated in step 1.
accepted answer of: http://stackoverflow.com/q/24328115
answers question: http://stackoverflow.com/q/24328115

http://stackoverflow.com/q/24343707
answer count: 1
downvote count: 0
favorite count: 0
score: 8
upvote count: 8
has answer: http://stackoverflow.com/a/24344008
has comment: http://stackoverflow.com/comment/37635254
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: nashorn
accepted answer: http://stackoverflow.com/a/24344008
has comment: http://stackoverflow.com/comment/37635274
has body: I am using instanceof but it is currently not working as I expect it. I have a variable I retrieve from my java code inside my script. Let's call this variable myObject which is the instance of a MyObject class, as you would expect. if (myObject instanceof Java.type("MyObject")) { //The check doesn't pass; the code here doesn't execute } I could only find vague information on the net about this. What is the definite way of checking if myObject is an instance of the MyObject class as I would easily do in Java? Thanks!
has title: Java nashorn compare if a java objects is of a certain java type

http://stackoverflow.com/a/24381286
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37707090
has body: public static &lt;T extends Question&gt; QuestionListFragment&lt;T&gt; newInstance(Bundle args) { // Create a new instance of QuestionListFragment&lt;? extends Question&gt; QuestionListFragment&lt;T&gt; fragment = new QuestionListFragment&lt;T&gt;(); // Set the arguments fragment.setArguments(args); // Return the Fragment return fragment; } and then to call it: QuestionListFragment.&lt;MultipleAnswerQuestion&gt;newInstance(getIntent().getExtras()‌​);
type: Answer
has comment: http://stackoverflow.com/comment/37707593
has comment: http://stackoverflow.com/comment/37707734
accepted answer of: http://stackoverflow.com/q/24380930
downvote count: 0
answers question: http://stackoverflow.com/q/24380930
score: 7

http://stackoverflow.com/q/24406766
has answer: http://stackoverflow.com/a/29395759
type: AnsweredQuestion
tagged with: java
upvote count: 1
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/37754980
tagged with: jpanel
answer count: 2
has answer: http://stackoverflow.com/a/24411071
downvote count: 0
score: 1
has title: Copying JPanel contents to another JPanel without removing contents of original JPanel
favorite count: 0
has comment: http://stackoverflow.com/comment/37755926
has body: I am new to Java swing coding. I am trying to copy JPanel contents to a new JPanel which uses contents of original JPanel to show. Also, the original JPanel contents are changing as records are changing. I tried the following code but it's totally useless. public void addPanel(JPanel jp) { JPanel jp1=new JPanel(); int count=jp.getComponentCount()-1; for(;i&gt;=0;i--) { jp1.addComponent(jp.getComponent(i); } //after this I am setting bounds of jp1. this.add(jp1); } This doesn't work if I want to make multiple JPanels as original JPanel changes. It overwrites the contents of new 'jp' over 'jp1' if used multiple times, say if used in a for loop. I do not want to remove components of original JPanel. How can I do that?
possible better answer: http://stackoverflow.com/a/29395759
has comment: http://stackoverflow.com/comment/37755616
accepted answer: http://stackoverflow.com/a/24411071

http://stackoverflow.com/q/24280311
linked to: http://stackoverflow.com/q/6493689
tagged with: java
has comment: http://stackoverflow.com/comment/37515385
has comment: http://stackoverflow.com/comment/37515356
type: Question
score: 0
has title: SWT Font Dialog Filtering
answer count: 0
has body: I need to create a SWT Font Chooser dialog that display only those fonts that are monospaced. I know, more or less, how to check if a given font is monospaced or not, but I don't how to filter the list of fonts displayed. Does the FontDialog provided any hook method where I can access the list of availables fonts and apply a filter?
type: UnansweredQuestion
tagged with: swt

http://stackoverflow.com/q/24384624
has body: I am having a an issue with a TextArea (using JavaFX 8). The problem is that when I create a TextArea the text is blurry, I have looked through other posts and cannot find a solution. I thought maybe it is me so I loaded up Scene Builder and created an anchor pane with a TextArea and this still is blurry. My theory is that is may be a bug with JavaFX 8 but im not too sure so I have decided to ask, here is the code I use: SplitPane splitPane = new SplitPane(); VBox vbox = new VBox(); HBox hbox = new HBox(); TextArea note = new TextArea(); note.setPrefHeight(100); vbox.setPadding(new Insets(0, 10, 0, 10)); hbox.setPadding(new Insets(10, 0, 10, 0)); hbox.setSpacing(8); splitPane.setPrefSize(1024, 300); splitPane.setOrientation(Orientation.HORIZONTAL); splitPane.setDividerPosition(0, 0.7); hbox.getChildren().add(new TextField()); hbox.getChildren().add(new TextField()); hbox.getChildren().add(new TextField()); vbox.getChildren().add(hbox); vbox.getChildren().add(note); splitPane.getItems().addAll(vbox, new TextArea()); accountNotesPane.getChildren().add(splitPane); accountNotesPane.setTopAnchor(splitPane, 10.0); accountNotesPane.setLeftAnchor(splitPane, 10.0); accountNotesPane.setRightAnchor(splitPane, 10.0); accountNotesPane.setBottomAnchor(splitPane, 10.0); Here is Screenshot from my app: And here is one from Scene Builder: Any help would be greatly appreciated, Cheers.
type: Question
has comment: http://stackoverflow.com/comment/37774222
linked to: http://stackoverflow.com/q/23728517
upvote count: 2
has comment: http://stackoverflow.com/comment/112186068
favorite count: 0
has comment: http://stackoverflow.com/comment/37713056
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37713017
has comment: http://stackoverflow.com/comment/85007166
score: 2
downvote count: 0
answer count: 0
tagged with: java
tagged with: javafx
has title: JavaFX 8 TextArea Blurry

http://stackoverflow.com/q/24339486
has comment: http://stackoverflow.com/comment/37627191
score: 0
has answer: http://stackoverflow.com/a/24339574
has body: I want to get Values from EditText dynamically.. I have a lot of EditText generated when user press add button..When User presses add Button it generates 3 Edittext each time. I dont know how to get the values from this dynamically generated EdiTtext . Now My question is how can i get the values from The 3 Edittext on each row. ALso I need to verify that if user removed the view or not. Please help I am new android development.This should happen when a user presses on Save Button. Thanks in advance! This is class . public class SecondActivity extends Activity { Button saveBtn,cancelBtn,addBtn; RelativeLayout layout; EditText third,first,second; LinearLayout Container; int counter=0; int all=0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.second_activity); saveBtn=(Button) findViewById(R.id.save); cancelBtn=(Button) findViewById(R.id.cancel); Container=(LinearLayout) findViewById(R.id.container); addBtn=(Button) findViewById(R.id.addBtn); saveBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent=new Intent(SecondActivity.this,MainActivity.class); startActivity(intent); Toast.makeText(SecondActivity.this, "The Result: "+all,Toast.LENGTH_LONG).show(); finish(); } }); cancelBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent=new Intent(SecondActivity.this,MainActivity.class); startActivity(intent); finish(); } }); addBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { LayoutInflater layoutInflater = (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View addView = layoutInflater.inflate(R.layout.row, null); Button buttonRemove = (Button)addView.findViewById(R.id.remove); // EditText ed1=(EditText) findViewById(R.id.editText1); // EditText ed2=(EditText) findViewById(R.id.editText2); // EditText ed3=(EditText) findVi…
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24339574
tagged with: android-edittext
tagged with: java
has comment: http://stackoverflow.com/comment/37627169
type: Question
tagged with: android-layout
has title: Handling EditText Dynamically in Android

http://stackoverflow.com/a/24337864
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24337786
upvote count: 1
has body: You could put your Flower(s) in a Set. But the easiest solution I can think of is to sort your flowers. So first, implement a Comparator&lt;FlowerClass&gt; public static class FlowerComparator implements Comparator&lt;FlowerClass&gt; { @Override public int compare(FlowerClass o1, FlowerClass o2) { return o1.getName().compareTo(o2.getName()); } } Then you can sort with Collections.sort(List, Comparator) FlowerComparator flowerComparator = new FlowerComparator(); Collections.sort(flowerPack, flowerComparator); And then your for loop needs to be something like this (to stop searching for the same flower), String lastName = null; for (int i = 0; i &lt; flowerPack.size(); i++){ FlowerClass flower = flowerPack.get(i); String name = flower.getName(); if (lastName == null || !lastName.equals(name)) { lastName = name; searchFlower(name); // or return the number found, and then add that count to i. } }
has comment: http://stackoverflow.com/comment/37624471
downvote count: 0

http://stackoverflow.com/q/24392602
downvote count: 2
accepted answer: http://stackoverflow.com/a/24399529
score: 16
tagged with: jakarta-ee
type: AnsweredQuestion
tagged with: java
upvote count: 18
type: Question
has answer: http://stackoverflow.com/a/28376968
has body: I can only get to the online version here: http://www.oracle.com/technetwork/java/javaee/documentation/index.html I tried checking the Java EE Downloads page: http://www.oracle.com/technetwork/java/javaee/downloads/index.html But unfortunately, I cannot seem to find a link to download just the Java EE 7 API Documentation. Is there a way to download it in .zip for offline reference?
tagged with: api
has title: How to download Java EE 7 API Documentation (zip)?
possible better answer: http://stackoverflow.com/a/28376968
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/24397245
has answer: http://stackoverflow.com/a/24399529
tagged with: http://stackoverflow.com/tag/zip
tagged with: download
has comment: http://stackoverflow.com/comment/123462253
linked to: http://stackoverflow.com/q/6986993

http://stackoverflow.com/comment/37780451
type: QuestionComment
score: 0
has text: stackoverflow.com/questions/56411/… is about shuffling. Which is a subpart of this question.
comment on: http://stackoverflow.com/q/24420209
type: Comment

http://stackoverflow.com/comment/37513716
type: Comment
has text: read [2D Graphics](http://docs.oracle.com/javase/tutorial/2d/index.html)
score: 3
type: QuestionComment
comment on: http://stackoverflow.com/q/24279502

http://stackoverflow.com/q/24376731
has body: I need to do the following with a Java/Grails GORM application. I have a domain class Item: class Item { int position String name } When I create a list of items I can update the position attribute such that it represents the index of each item in the list: 0,1,2,3,... Each position is unique, i.e., at each position can only be one item. It should be able to change the order of the items. Let's assume I have the following list of items and there positions: A1, A2, A3, A4, A5 1 2 3 4 5 When I want A4 to be at position 2 I have to update the positions of A2, A3 and respectively. This means that I have to update three data base entries A4, A2 and A3. If the list is very long then there are a lot of updates to do. Is there a data structure which handler the repositioning of list elements for me? How can I update the items efficiently?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24376887
linked to: http://stackoverflow.com/q/322715
score: 2
tagged with: java
tagged with: grails-orm
has answer: http://stackoverflow.com/a/24402890
has title: How can I move list Entries with simultaneously updating the index of all Entries?
type: Question
has comment: http://stackoverflow.com/comment/37709358
tagged with: data-structures
tagged with: grails
upvote count: 2
has comment: http://stackoverflow.com/comment/37698668
answer count: 2
tagged with: groovy
has comment: http://stackoverflow.com/comment/37698637
has comment: http://stackoverflow.com/comment/37709405
downvote count: 0
has comment: http://stackoverflow.com/comment/37726163
has comment: http://stackoverflow.com/comment/37730501
favorite count: 0

http://stackoverflow.com/comment/37665899
type: Comment
comment on: http://stackoverflow.com/a/24358889
has text: yes. This is the way.The dialogue comes over the activity. Other wise u have to create a custom dialogue.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37621467
type: Comment
comment on: http://stackoverflow.com/a/24336155
score: 0
type: AnswerComment
has text: So first you think it's a good idea to catch general exceptions to prvent future problems and now your argumenting the opposite? Having a little debate with yourself?

http://stackoverflow.com/q/24294917
has comment: http://stackoverflow.com/comment/37543413
type: Question
accepted answer: http://stackoverflow.com/a/24295003
has title: Driver's license exam weird problems
tagged with: arrays
has comment: http://stackoverflow.com/comment/37543454
score: 0
has body: So, basically I am asked to make a program about this: The local Driver's License Office has asked you to write a program that grades the written portion of the driver's license exam. The exam has 20 multiple choice questions. Here are the correct answers: 1. B 6. A 11. B 16. C 2. D 7. B 12. C 17. C 3. A 8. A 13. D 18. B 4. A 9. C 14. A 19. D 5. C 10. D 15. D 20. A They must have at least 15 correct answers in order to pass. I am also asked to include the following methods: - passed: returns true if the student passed - totalCorrect:returns the total number of correct answers - totalIncorrect: returns the total # of incorrect answers - questionsMissed: returns int array containing the question # that the student missed. So basically, I did the program: import hsa.*; public class DriversLicense { public static void main (String[] args) { char[] correct = {'B', 'D', 'A', 'A', 'C' , 'A', 'B', 'A', 'C', 'D' , 'B', 'C', 'D', 'A', 'D' , 'C', 'C', 'B', 'D', 'A'}; char[] response = new char [20]; int numCorrect; int numIncorrect; int[] QuestMissed; boolean passed; for (int a = 0 ; a &lt; response.length ; a++) { Stdout.print ((a + 1) + ": "); response [a] = Stdin.readChar (); while (response [a] &lt; 'A' || response [a] &gt; 'D') { Stdout.println ("Invalid input. Enter answers with A, B, C, or D only!"); response [a] = Stdin.readChar (); } } Stdout.println (); passed = examPassed (response, correct); numCorrect = totalCorrect (response, correct); numIncorrect = totalIncorrect (response, numCorrect); QuestMissed = questionsMissed (response, correct); if (passed) Stdout.print ("You passed!"); else Stdout.print ("You didn't pass!"); Stdout.println (" Below are the details of your marked exam: "); Stdout.println ("#s of correct questions: " + numCorrect); Stdout.println ("#s of incorrect questions: " + numIncorrect); if (QuestMissed.length &gt; 0) { Stdout.print ("Questions missed: "); for (int a = 0 ; a &lt; QuestMissed.length ; a++) { Stdout.print (QuestMissed [a]); Stdout.pr…
answer count: 1
has comment: http://stackoverflow.com/comment/37543383
favorite count: 0
has answer: http://stackoverflow.com/a/24295003
type: AnsweredQuestion
tagged with: java
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/24292784
answers question: http://stackoverflow.com/q/24292362
type: Answer
has comment: http://stackoverflow.com/comment/37542584
has comment: http://stackoverflow.com/comment/37545701
has body: You should call resultSet.getString method on appropriate element from param array. There is no need to use hardcoded aliases. E.g. resultSet.getString(params[0]); Simple example with mapping: Mapping &lt;property name="propertyName" type="yourUserType"&gt; &lt;column name="columnName1" /&gt; &lt;column name="columnName2" /&gt; &lt;/property&gt; or @Type(type="com.package.usertypes.YourUserType") @Columns(columns = { @Column(name="columnName1"), @Column(name="columnName2") }) private CustomClass propertyName; User type public Object nullSafeGet(ResultSet resultSet, String[] params, Object owner) throws SQLException { resultSet.getString(params[0]); // value of 'columnName1' column resultSet.getString(params[1]); // value of 'columnName2' column // }
score: 0
has comment: http://stackoverflow.com/comment/37546443
has comment: http://stackoverflow.com/comment/37545613
has comment: http://stackoverflow.com/comment/37539891
has comment: http://stackoverflow.com/comment/37545631
has comment: http://stackoverflow.com/comment/37546519

http://stackoverflow.com/comment/37647761
comment on: http://stackoverflow.com/q/24335820
has text: There is not much difference but instead of calling `line2.split(" ")` N times, create String array once and use it. `String[] a = line2.split(" ")`. This is slightly more efficient. Other than that I see nothing to improve, but `MASTER`s might find better ways to improve
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37759421
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24409134
has text: Use ProcessBuilder rather than Runtime.exec. http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html

http://stackoverflow.com/comment/37614359
type: Comment
type: QuestionComment
has text: OpenGL is not software, it is something you use to ***build*** software. Blender and Maya will typically sit on top of OpenGL for hardware accelerated rendering because they are actual pieces of software. So this question does not make a whole lot of sense, that is like asking what the difference between an apple and a carbon atom is.
comment on: http://stackoverflow.com/q/24325141
score: 0

http://stackoverflow.com/comment/37558207
comment on: http://stackoverflow.com/q/24302279
type: Comment
type: QuestionComment
has text: "name NOT EQUALS 'myValue'" ?
score: 0

inetaddress
tags question: http://stackoverflow.com/q/24277032
type: Tag
tag name: inetaddress

http://stackoverflow.com/a/24304390
score: 4
answers question: http://stackoverflow.com/q/24304342
upvote count: 4
has body: User you receive in Invitee constructor is a real instance and you are creating another one. You can not assign one instance in a super constructor, you only can copy it, with a copy constructor.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/37499120
type: QuestionComment
has text: Please post an [mcve](http://stackoverflow.com/help/mcve)
score: 1
comment on: http://stackoverflow.com/q/24271743
type: Comment

http://stackoverflow.com/comment/37666377
type: Comment
type: QuestionComment
score: 3
has text: this is not an `Array`!!!
comment on: http://stackoverflow.com/q/24359461

http://stackoverflow.com/q/24292947
has body: I checked out a project from svn. The project have a folder named as "ws" which contains WebContent folder. But the lib folder is outside the WebContent folder and under another folder under "ws" folder. I found out I have to move the lib folder to WEB-INF folder in WebContent folder, so eclipse can find the libraries I need. Would anyone show me how to manually set the path so eclipse can load the libraries from the original lib without moving the lib to WEB-INF? Thanks
tagged with: web-services
type: Question
accepted answer: http://stackoverflow.com/a/24294142
tagged with: svn
tagged with: java
tagged with: eclipse
has title: Eclipse java web project manual set lib folder in WEB-INF
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/24294142
type: AnsweredQuestion

http://stackoverflow.com/comment/37796319
type: AnswerComment
comment on: http://stackoverflow.com/a/24423409
type: Comment
has text: but I tried to do this and got that error, I wanted to use the same servlet and page to do all the work where the doGet() only creates an ArrayList and put it back to the same page to populate my dropdownlist and my doPost() to process all entry and validate it
score: 0

http://stackoverflow.com/comment/37769344
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24414186
score: 0
has text: Which communcation protocols should I look at ? I am not sure how to implement communication between application that is running on the server and application that is requesting a service.

http://stackoverflow.com/q/24377001
has body: I have a 2nd Thread that i use to send messages using OSC. From the main Thread i add messages, I had a problem with ConcurrentModificationException. What I did to fix it is I made a new List with messages to add. In the 2nd Thread i add those messages to the list i want to send. At the moment it runs without any problems, but i'm wondering is that luck? In other words, could it be that the change to run into a ConcurrentModificationException is still there but is really small now or did i really fix the problem? public void run() { while (running) { toSend.addAll(newMessages); newMessages.clear(); Iterator&lt;OSCPriorityMessage&gt; itr = toSend.iterator(); while (itr.hasNext()) { OSCPriorityMessage msg = itr.next(); oscP5.send(msg, netAddress); itr.remove(); } try { sleep((long)(waitTime)); } catch (Exception e) { } } } Here i add the messages to send: public void send(OSCPriorityMessage msg) { newMessages.add(msg); }
type: Question
has title: Is this solution to ConcurrentModificationException safe?
has comment: http://stackoverflow.com/comment/37699244
has answer: http://stackoverflow.com/a/24377034
accepted answer: http://stackoverflow.com/a/24377034
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37699178
tagged with: concurrentmodification
type: AnsweredQuestion
tagged with: java
tagged with: multithreading

http://stackoverflow.com/comment/37523065
comment on: http://stackoverflow.com/q/24284507
has text: thanks Prasad Kharkar.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/24280381
score: 1
has comment: http://stackoverflow.com/comment/37515510
answers question: http://stackoverflow.com/q/24279007
upvote count: 2
has comment: http://stackoverflow.com/comment/37516630
downvote count: 1
type: Answer
has body: You can try Cloudera Live. It's in beta, but seems to work pretty well.

http://stackoverflow.com/q/24304433
tagged with: caliper
downvote count: 0
has answer: http://stackoverflow.com/a/24312323
has comment: http://stackoverflow.com/comment/37560944
has comment: http://stackoverflow.com/comment/37571714
has comment: http://stackoverflow.com/comment/37563495
answer count: 2
linked to: http://stackoverflow.com/q/14531235
has comment: http://stackoverflow.com/comment/37566646
favorite count: 0
has comment: http://stackoverflow.com/comment/37561502
has comment: http://stackoverflow.com/comment/37562166
accepted answer: http://stackoverflow.com/a/24312323
has answer: http://stackoverflow.com/a/24312408
tagged with: android
has comment: http://stackoverflow.com/comment/37566198
has comment: http://stackoverflow.com/comment/37568086
has comment: http://stackoverflow.com/comment/37561620
has comment: http://stackoverflow.com/comment/37561051
type: AnsweredQuestion
tagged with: performance
possible better answer: http://stackoverflow.com/a/24312408
has comment: http://stackoverflow.com/comment/37560847
score: 7
tagged with: java
upvote count: 7
has comment: http://stackoverflow.com/comment/37560871
has comment: http://stackoverflow.com/comment/37561028
has comment: http://stackoverflow.com/comment/37561015
has title: Why is the short primitive type significantly slower than long or int?
type: Question
has body: I tried to optimize the RAM usage of a Android game by changing int primitives to shorts. Before I did this I was interested in the performance of the primitive types in Java. So I created this little test benchmark using the caliper library. public class BenchmarkTypes extends Benchmark { @Param("10") private long testLong; @Param("10") private int testInt; @Param("10") private short testShort; @Param("5000") private long resultLong = 5000; @Param("5000") private int resultInt = 5000; @Param("5000") private short resultShort = 5000; @Override protected void setUp() throws Exception { Random rand = new Random(); testShort = (short) rand.nextInt(1000); testInt = (int) testShort; testLong = (long) testShort; } public long timeLong(int reps){ for(int i = 0; i &lt; reps; i++){ resultLong += testLong; resultLong -= testLong; } return resultLong; } public int timeInt(int reps){ for(int i = 0; i &lt; reps; i++){ resultInt += testInt; resultInt -= testInt; } return resultInt; } public short timeShort(int reps){ for(int i = 0; i &lt; reps; i++){ resultShort += testShort; resultShort -= testShort; } return resultShort; } } The results of the test surprised me. Test circumstances Benchmark run under the Caliper library. Test results https://microbenchmarks.appspot.com/runs/0c9bd212-feeb-4f8f-896c-e027b85dfe3b Int 2.365 ns Long 2.436 ns Short 8.156 ns Test conclusion? The short primitive type is significantly slower (3-4~ times) than the long and int primitive type? Question Why is the short primitive significantly slower than int or long? I would expect the int primitive type to be the fastest on a 32bit VM and the long and short to be equal in time or the short to be even faster. Is this also the case on Android phones? Knowing that Android phones in general run in a 32bit environment and now the days more and more phones start to ship with 64bit processors.

http://stackoverflow.com/comment/37739732
score: 0
type: QuestionComment
type: Comment
has text: Because it side-effects?
comment on: http://stackoverflow.com/q/24398476

http://stackoverflow.com/q/24381833
has answer: http://stackoverflow.com/a/24381987
type: Question
has comment: http://stackoverflow.com/comment/37708026
upvote count: 0
score: -2
has body: I have created a program regarding LinkedList and here is the code: package consoleapplication; import java.util.Scanner; import java.util.LinkedList; public class Index { static int s, n ,e; public static void main(String[] args) { // LinkedList LinkedList k = new LinkedList(); // input Scanner a = new Scanner(System.in); System.out.println("Size: "); s = a.nextInt(); System.out.println("Element: "); e = a.nextInt(); // process for (n = 0; n &lt; s; n++) { k.add(n); } // output System.out.println("Index of " + e + k); } } Here is the output: Size: 12 Element: 12 Index of 12[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] The program is running. But I want to remove one element. For example, I want to remove 0 or any number in the index of 12. How can I do that?
has comment: http://stackoverflow.com/comment/37708175
possible better answer: http://stackoverflow.com/a/24381987
accepted answer: http://stackoverflow.com/a/24382405
has comment: http://stackoverflow.com/comment/37708229
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/24382000
linked to: http://stackoverflow.com/q/10735288
has comment: http://stackoverflow.com/comment/37708092
has answer: http://stackoverflow.com/a/24382049
linked to: http://stackoverflow.com/q/19920715
downvote count: 2
has comment: http://stackoverflow.com/comment/37708255
type: AnsweredQuestion
tagged with: linked-list
has answer: http://stackoverflow.com/a/24382405
has comment: http://stackoverflow.com/comment/37708155
tagged with: java
has title: Remove the object LinkedList

http://stackoverflow.com/comment/94902554
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26451699
type: AnswerComment
has text: "BTW, what happens when you find a non-thread safe plugin in your development project, and there are no thread safe alternatives, is another question, which is also solvable." could you help to give a detailed explanation how to solve this?

http://stackoverflow.com/q/24300773
tagged with: abstract-class
downvote count: 3
has answer: http://stackoverflow.com/a/24301023
has comment: http://stackoverflow.com/comment/137392568
possible better answer: http://stackoverflow.com/a/24300832
tagged with: constructor
has answer: http://stackoverflow.com/a/24300832
answer count: 5
has comment: http://stackoverflow.com/comment/37554268
has title: Call constructor in an abstract class
has comment: http://stackoverflow.com/comment/37554322
has answer: http://stackoverflow.com/a/24301737
has answer: http://stackoverflow.com/a/24300877
type: AnsweredQuestion
tagged with: oop
has body: Is it possible to call a constructor in a abstract class? I read that this constructor can be called through one of its non-abstract subclasses. But I don't understand that statement. Can anybody explain this with an example?
has comment: http://stackoverflow.com/comment/37554108
linked to: http://stackoverflow.com/q/39864839
tagged with: java
favorite count: 0
has comment: http://stackoverflow.com/comment/37554285
upvote count: 8
type: Question
score: 5
linked to: http://stackoverflow.com/q/260666
has answer: http://stackoverflow.com/a/24300830
has comment: http://stackoverflow.com/comment/37554086
accepted answer: http://stackoverflow.com/a/24300830

http://stackoverflow.com/a/24357941
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37663637
has comment: http://stackoverflow.com/comment/37663424
has body: Yes. Because capital H is before the lower case letters. String theWord = "hello"; Outputs, as you expected (with no other changes to your code) ehllo
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24357922
downvote count: 0
has comment: http://stackoverflow.com/comment/37663491
answers question: http://stackoverflow.com/q/24357922
has comment: http://stackoverflow.com/comment/37663603
upvote count: 2

http://stackoverflow.com/a/24397672
accepted answer of: http://stackoverflow.com/q/24397661
has comment: http://stackoverflow.com/comment/37738493
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/24397661
downvote count: 1
has body: You have to add $0 to your replace expression, you can use: example = example.replaceAll("[,.!?;:]", "$0 "); It will replace your matched regex with that content plus a space. Btw, if you want ensure that you don't have multiple whitespaces you can do: example = example.replaceAll("[,.!?;:]", "$0 ").replaceAll("\\s+", " "); Will convert: This is!just an:example,of a string,that needs?to be fixed.by inserting:a whitespace;after punctuation marks.; To: This is! just an: example, of a string, that needs? to be fixed. by inserting: a whitespace; after punctuation marks.
has comment: http://stackoverflow.com/comment/37738572
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37738257
score: 7
has comment: http://stackoverflow.com/comment/37738584

http://stackoverflow.com/q/24375716
has body: My problem is that i have an image which is X in length, and i want to make it so that the image continually scrolls in the background of my game. In order to do this, and it no be obvious to the player the next background image has to be redrawn at the point at which the previous image ends, this is what i cannot figure out. Currently i can have continuous redrawing of the image, but just as the old image ends the new image is drawn back at (0,0) so it is obvious that the background is being redrawn. I know what the problem is, but the solution is avoiding me. The problem is that when i redrawn the image, i reset location to 0. I can't figure out another way to do this currently so maybe someone could help me in someway. Just a side note the JPanel is 1000 in width. Here is the code so far: package cje.chris.edwards.game; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.*; public class Board extends JPanel implements ActionListener{ Player player; Image background; Timer timer; private int scrollSpeed, location; public Board(){ player = new Player(); this.addKeyListener(new Listener()); setFocusable(true); ImageIcon img_ic = new ImageIcon("map.png"); background= img_ic.getImage(); location = 0; //5 milliseconds scrollSpeed = -2; timer = new Timer(5, this); timer.start(); } @Override public void actionPerformed(ActionEvent e) { //called using timer.start() and its delay repaint(); } public void paint(Graphics g){ super.paint(g); Graphics2D graphics_2d = (Graphics2D) g; //This is the section where my problem lies. if(location != 0 &amp;&amp; Math.abs(location) % (background.getWidth(null) - 1000) == 0){ graphics_2d.drawImage(background, 1000, 0, null); location = 0; } graphics_2d.drawImage(background, location += scrollSpeed, 0, null); graphics_2d.drawImage(player.getImage(), 50, 100,…
type: Question
score: 0
tagged with: imageicon
answer count: 1
has title: Java, redraw scrolling background image at the same point the last image ends
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37697702
tagged with: swing
has answer: http://stackoverflow.com/a/24376942
tagged with: paint
tagged with: java
tagged with: keylistener

http://stackoverflow.com/q/24413054
answer count: 1
has title: Remove input in form breaks play framework (2.3)
favorite count: 0
accepted answer: http://stackoverflow.com/a/24417681
linked to: http://stackoverflow.com/q/7357256
linked to: http://stackoverflow.com/q/9187516
type: AnsweredQuestion
tagged with: playframework-2.0
downvote count: 0
has body: I am building a form where a user can edit some personal details (such as name, location, etc). I am using a custom built field constructor, and I have no problems with this in other places. @form(action = routes.Persons.update(), 'class -> "well well-lg form-horizontal"){ @inputText(updateForm("forname"), '_label -> "First name", 'class -> "form-control") @inputText(updateForm("surname"), '_label -> "Last name", 'class -> "form-control") @inputText(updateForm("email"), '_label -> "Email", 'class -> "form-control") @inputPassword(updateForm("passwordHash"), '_label -> "Password", 'class -> "form-control") Update } This works. I want the user to be able to edit his first name, last name and location, however, and not the email which he is registered with. I first attempted adding 'disabled -> true to the email input, but this broke the form (password, for example, was no longer pre-filled, and I get a [IllegalStateException: No value] error when the form is posted. A similar issue is discussed here, but my issue goes further. I can't simply leave the email field out of the form. The code looks like this: @form(action = routes.Persons.update(), 'class -> "well well-lg form-horizontal"){ @inputText(updateForm("forname"), '_label -> "First name", 'class -> "form-control") @inputText(updateForm("surname"), '_label -> "Last name", 'class -> "form-control") @inputPassword(updateForm("passwordHash"), '_label -> "Password", 'class -> "form-control") Update } When I try this, the form is again broken and I get the same IllegaleStateException when it is posted... the problem is not, I believe, in the controller, as everything works fine as long as the email field is present... My suspicion is that this is caused by the fact that I have a @constraint on email in the model. Can someone confirm this? And how can I bypass this, so that I can have a prefilled form which is linked to an object, but where I can edit just a some of the attributes? Thanks for any help!
score: 1
has answer: http://stackoverflow.com/a/24417681
type: Question
tagged with: constraints
tagged with: java
tagged with: forms
tagged with: illegalstateexception
upvote count: 1

http://stackoverflow.com/q/24374682
has comment: http://stackoverflow.com/comment/37773180
has answer: http://stackoverflow.com/a/24431631
type: Question
has body: I am using Apache POI to generate Excel spreadsheets (.xlsx). Many of my cell styles contain data format strings, but when columns containing such styles are auto-resized the column width is based on the unformatted cell contents. Example: DataFormat format = wb.createDataFormat(); CellStyle dollars_m = wb.createCellStyle(); dollars_m.setDataFormat(format.getFormat("_($* #,##0.0,,\"m\"_);_($* (#,##0.0,,\"m\");_(@_)")); A cell value of 123456789.01 will resize as though the cell contained 12 characters rather than the eight ($ 123.5m) it will actually contain. I am able to force formula's to resolve themselves before auto-resizing, is there a method which will force formats to apply?
accepted answer: http://stackoverflow.com/a/24431631
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37774942
has comment: http://stackoverflow.com/comment/37764386
has title: How can I force Apache POI to use cell formats when auto sizing columns?
tagged with: apache-poi
tagged with: excel
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/24277652
tagged with: jpa
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: Foreign key doesn't have a default value
has answer: http://stackoverflow.com/a/42508788
upvote count: 3
tagged with: mysql
type: Question
score: 3
has answer: http://stackoverflow.com/a/24277980
linked to: http://stackoverflow.com/q/24257449
tagged with: java
tagged with: hibernate
answer count: 3
tagged with: sql
has answer: http://stackoverflow.com/a/24277798
has body: this is my User.java @Entity @Table(name = "user") public class User implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID") private int id; @Column(name = "FIRST_NAME") private String firstName; @Column(name = "LAST_NAME") private String lastName; @Column(name = "EMAIL") private String email; @OneToMany(cascade={CascadeType.ALL}) @JoinColumn(name="USER_ID") private Collection&lt;Address&gt; addresses; } and this is my Address.java @Entity @Table(name = "address") public class Address implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID") private int id; @Column(name = "TOWN") private String town; @Column(name = "DISTRICT") private String district; @Column(name = "COUNTRY") private String country; @ManyToOne @JoinColumn(name = "USER_ID", insertable=false, updatable=false, nullable=false) private User user; } but while I'm trying to persist the object I'm getting this exception javax.servlet.ServletException: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not insert: [com.kpowd.model.Address] javax.faces.webapp.FacesServlet.service(FacesServlet.java:658) root cause javax.faces.el.EvaluationException: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not insert: [com.kpowd.model.Address] javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101) com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:101) javax.faces.component.UICommand.broadcast(UICommand.java:315) javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:798) javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1331) com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81) com.sun.faces.lifecyc…

http://stackoverflow.com/a/24359145
accepted answer of: http://stackoverflow.com/q/24359079
upvote count: 2
type: Answer
has body: You are running a server here. The generic code to "talk HTTP" is already implemented by the library. You just have to plug in the "business logic" (in the form of an HTTPRequestHandler). Your "business logic" gets an instance of HTTPResponse as a parameter. This object has already been created for you by the library. You can set parameters and write data to. When your handler method returns (or even before that as you manipulate the response object), the library takes care of getting the data over the network. Where does the sending of the response back to the client actually happen in this code? As the result of method handle the response object now contains an Entity with your inner class that can write out a file. That code will be called to send the data. It might be instructive (or possibly overwhelming) to put a breakpoint in your code and step through (including the part after handle returns) to see the control flow.
downvote count: 0
has comment: http://stackoverflow.com/comment/37666864
score: 2
answers question: http://stackoverflow.com/q/24359079
type: AcceptedAnswer

http://stackoverflow.com/comment/37788315
comment on: http://stackoverflow.com/q/24424686
score: 0
type: Comment
type: QuestionComment
has text: Possible duplicate of the question http://stackoverflow.com/questions/20442782/implicit-typecasting-not-working-if-passing-integer-value-as-argument-in-java

http://stackoverflow.com/a/24445373
score: 0
type: AcceptedAnswer
type: Answer
has body: The serialization process to JSON is controlled by JSON result, which is a part of the JSON plugin that you used in your project. And you already know that to limit properties used by serializer you should use includeProperties of the json result. There's also root property that you should examine. If not specified the json result uses by default the top object of the value stack. If your action is model driven then model overrides action. So, the regexes you used in the includeProperties apply to the model object, and serializer which is JSONWriter uses BeanInfo to extract properties of the bean. First, these properties are checked for existence of @JSON annotation and if it has serialize=false, then it's skipped, otherwise it's included. This way you can control the serialization process via putting annotations on the properties that you won't serialize to JSON such as @OneToMany properties, etc. Then includeProperties or excludeProperties are checked if they are not empty. At this time you should acknowledge that if you don't have properties that matches to the patterns specified then them won't be serialized. So, lets move to LazyInitializationException, as I said if you have @JSON annotation ever in the model hierarchy you should put serialize=false inside it because by default it's true. @JSON(serialize=false) public Object getBillDetailses(){ return billDetailses; } You said your productList in the action class, then you should configure the result &lt;!-- Result config --&gt; &lt;result type="json"&gt; &lt;param name="includeProperties"&gt; ^productList\[\d+\]\.id, ^productList\[\d+\]\.name, ^productList\[\d+\]\.description &lt;/param&gt; &lt;param name="root"&gt; #action &lt;/param&gt; &lt;/result&gt; Note, that ^ stands for beginning the expression, so only action properties will be included.
answers question: http://stackoverflow.com/q/24301980
accepted answer of: http://stackoverflow.com/q/24301980

http://stackoverflow.com/comment/37561398
has text: How try with `where this.patient_Id = :id`?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24303996

http://stackoverflow.com/q/24423598
has comment: http://stackoverflow.com/comment/37786271
downvote count: 0
has comment: http://stackoverflow.com/comment/37786182
favorite count: 0
has comment: http://stackoverflow.com/comment/37786191
has answer: http://stackoverflow.com/a/24423667
has comment: http://stackoverflow.com/comment/37786253
answer count: 3
has answer: http://stackoverflow.com/a/24423641
has answer: http://stackoverflow.com/a/24423646
tagged with: generics
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/37787819
type: Question
has title: java generics, how to extend from two classes?
has comment: http://stackoverflow.com/comment/37786845
score: 1
tagged with: java
has body: I want to have a Class object, but I want to force whatever class it represents to extend class A and also class B. I can do &lt;T extends ClassA &amp; ClassB&gt; but it is not possible to extend from both classes, Is there a way to do this?

http://stackoverflow.com/comment/94377368
comment on: http://stackoverflow.com/a/24368628
type: AnswerComment
score: 0
type: Comment
has text: where is the real and where is the test Context Configuration class?

http://stackoverflow.com/comment/37671335
score: 0
type: AnswerComment
type: Comment
has text: Sounds good. Let's try that in my real program. I'll let you know.
comment on: http://stackoverflow.com/a/24362101

http://stackoverflow.com/a/24289729
upvote count: 3
answers question: http://stackoverflow.com/q/24289070
type: Answer
downvote count: 0
has body: Protected is used so that it can be used in subclasses. There is no logic in defining a protected static when using in the context of concrete classes as you can access the same variable is a static way.However the complier will give a warning to access the super class static variable in a static way.
score: 3

http://stackoverflow.com/a/57086955
upvote count: 6
downvote count: 1
score: 5
answers question: http://stackoverflow.com/q/24323628
has body: As this OOM happened during compilation, you need to increase compile VM:
type: Answer

http://stackoverflow.com/comment/37605620
type: Comment
type: QuestionComment
has text: @MehulDudhat: How would we know? You haven't given us any information about your DB other than the vendor.
score: 0
comment on: http://stackoverflow.com/q/24328085

http://stackoverflow.com/comment/37649205
has text: Then the values are constants, and defining these values as `static final` at the top of an appropriate class would be the best way forward. Don't forget that `final` does not stop the content of a Collection or Array being modified, so you may need to see the documentation for the [java.util.Collections class](http://docs.oracle.com/javase/8/docs/api/java/util/Collections.html) which offers a set of methods called unmodifiableXxxx which let you create Collection objects that do not allow their contents to be rearranged.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24350761
type: AnswerComment

http://stackoverflow.com/comment/37668500
type: Comment
type: QuestionComment
has text: Reading the documentation, start writing some code and try something would be good starts.
score: 1
comment on: http://stackoverflow.com/q/24360459

http://stackoverflow.com/comment/37803257
has text: @RooneyMUFC, the setLinearVelocity method should be called on the Body (which is the testBody variable in the above example), not on the BodyDef, which is just a temporary convenience class to describe the body properties.
type: AnswerComment
comment on: http://stackoverflow.com/a/24419505
type: Comment
score: 1

http://stackoverflow.com/q/24425355
answer count: 2
has body: I'm building a simple app that I can use to put some questions and their answers in it and saves them to diffrent array lists for later use(Kind of like one of those Quiz Cards that has the question on one side and the answer on the other) while I was building my UI I reached a brick wall that i can't seem to get pass. in the following code I would like the "next" button to span multiple columns and be wider than the text areas but when ever I try to set the widthx variable to multiple columns nothing seems to happen, can some one explain why is this happening and possibly how to fix it? thanks public class FillingCards extends JPanel implements ActionListener { JTextArea question; JTextArea answer; JButton button; ArrayList&lt;String&gt; questions; ArrayList&lt;String&gt; answers; GridBagConstraints gbc; public static void main(String[] args) { FillingCards card = new FillingCards(); card.setupGUI(); JFrame frame = new JFrame(); frame.add(BorderLayout.CENTER, card); frame.pack(); frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE); frame.setVisible(true); frame.setBackground(Color.GRAY); } public FillingCards() { gbc = new GridBagConstraints(); question = new JTextArea(5, 5); answer = new JTextArea(5, 5); button = new JButton("next"); } public void setupGUI() { this.setLayout(new GridBagLayout()); gbc.fill = GridBagConstraints.BOTH; JScrollPane qs = new JScrollPane(question); qs.setPreferredSize(new Dimension(400, 400)); qs.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); qs.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); gbc.gridx = 1; gbc.gridy = 0; this.add(qs, gbc); gbc.gridx = 1; gbc.gridy = 1; this.add(new JLabel("Answer: "), gbc); JScrollPane as = new JScrollPane(answer); as.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); as.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); gbc.gridx = 1; gbc.gridy = 2; this.add(as, gbc); gbc.gridx = 1; gbc.gridy = …
tagged with: user-interface
tagged with: layout-manager
linked to: http://stackoverflow.com/q/14755487
has answer: http://stackoverflow.com/a/24656251
type: UnansweredQuestion
has title: Make a component span multiple cells in GridBagLayout
has comment: http://stackoverflow.com/comment/37790267
tagged with: swing
tagged with: java
has answer: http://stackoverflow.com/a/38320603
has comment: http://stackoverflow.com/comment/37790063
type: Question
tagged with: gridbaglayout
score: 0

http://stackoverflow.com/comment/37592362
comment on: http://stackoverflow.com/q/24320985
type: QuestionComment
has text: How about printing it to console and seeing there ? :)
type: Comment
score: 0

jar
tags question: http://stackoverflow.com/q/24306534
tags question: http://stackoverflow.com/q/24387657
tags question: http://stackoverflow.com/q/24321397
tags question: http://stackoverflow.com/q/24365437
tags question: http://stackoverflow.com/q/24353402
tags question: http://stackoverflow.com/q/24343995
tags question: http://stackoverflow.com/q/24354571
tags question: http://stackoverflow.com/q/24335039
tags question: http://stackoverflow.com/q/24317114
tags question: http://stackoverflow.com/q/24385293
tags question: http://stackoverflow.com/q/24341600
tags question: http://stackoverflow.com/q/24424247
type: Tag
tags question: http://stackoverflow.com/q/24282453
tags question: http://stackoverflow.com/q/24272901
tags question: http://stackoverflow.com/q/24411088
tags question: http://stackoverflow.com/q/24296029
tags question: http://stackoverflow.com/q/24276390
tags question: http://stackoverflow.com/q/24275397
tags question: http://stackoverflow.com/q/24327931
tags question: http://stackoverflow.com/q/24283770
tags question: http://stackoverflow.com/q/24346053
tags question: http://stackoverflow.com/q/24270064
tags question: http://stackoverflow.com/q/24310105
tags question: http://stackoverflow.com/q/24353138
tags question: http://stackoverflow.com/q/24296956
tags question: http://stackoverflow.com/q/24290500
tags question: http://stackoverflow.com/q/24303414
tags question: http://stackoverflow.com/q/24271412
tag name: jar
tags question: http://stackoverflow.com/q/24283803
tags question: http://stackoverflow.com/q/24393725
tags question: http://stackoverflow.com/q/24354921
tags question: http://stackoverflow.com/q/24419685
tags question: http://stackoverflow.com/q/24391540
tags question: http://stackoverflow.com/q/24419859
tags question: http://stackoverflow.com/q/24303607
tags question: http://stackoverflow.com/q/24396349
tags question: http://stackoverflow.com/q/24349763
tags question: http://stackoverflow.com/q/24279388
tags question: http://stackoverflow.com/q/24413746
tags question: http://stackoverflow.com/q/24420713
tags question: http://stackoverflow.com/q/24370281
tags question: http://stackoverflow.com/q/24356809
tags question: http://stackoverflow.com/q/24405787
tags question: http://stackoverflow.com/q/24369934
tags question: http://stackoverflow.com/q/24347360
tags question: http://stackoverflow.com/q/24274409
tags question: http://stackoverflow.com/q/24314826
tags question: http://stackoverflow.com/q/24401597
tags question: http://stackoverflow.com/q/24360100
tags question: http://stackoverflow.com/q/24297053

http://stackoverflow.com/a/24365695
type: Answer
answers question: http://stackoverflow.com/q/24365632
has body: Try, String str="[OM, Sagar,Ravi, Raj]"; String[] arr=str.substring(1, str.length()-1).split(","); or, List&lt;String&gt; arrayList=new ArrayList&lt;&gt;(Arrays.asList(arr)); Note: Use jdk 1.7 or greater for diamond operator &lt;&gt;
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37677690
upvote count: 1

http://stackoverflow.com/comment/37546154
type: AnswerComment
has text: I really like this approach of storing all included blocks as opposed to calculating collisions. Depending on how I store them, editing the stored blocks can be a heavy operation. But editing the volumes is rare and can take a moment or two, no problem. This moves the processing to that step, making the "collision detection" part potentially much faster. I may even be able to store coordinates in a binary-searchable manner to make calculations really fast.
type: Comment
comment on: http://stackoverflow.com/a/24294793
score: 0

http://stackoverflow.com/a/24339089
score: 0
has comment: http://stackoverflow.com/comment/37666608
type: Answer
has body: Well for one thing, you are doing, chk.clear(); in your first page. This will clear all your keys from that HashTable. Keep in mind what you are getting from session, is a reference to the object chk bounded to the key 'hash'. If you clear the keys from that object, you will not retrieve any keys in the second page. Does that make sense ? :)
has comment: http://stackoverflow.com/comment/37666999
answers question: http://stackoverflow.com/q/24338279
has comment: http://stackoverflow.com/comment/37665051

http://stackoverflow.com/comment/37628372
type: QuestionComment
has text: And you should be able to use File#getCanonicalFile to get resolve relative paths to there "direct" path equivalent
score: 1
comment on: http://stackoverflow.com/q/24340098
type: Comment

http://stackoverflow.com/a/24315742
downvote count: 0
has body: Class#forName returns an instance of Class&lt;?&gt;, so in this code: firstOption = Class.forName("com.nim.tools.options." + capitalize(args.get(0)) + "Options"); If the argument you pass in args.get(0) is I and you have IOptions, then firstOption is the same as Class&lt;IOption&gt; and not an instance of an object that implements IOption interface. firstOption variable is actually a Class object and can't be used in an instanceof context and can't be compared with an Interface such as IOptions Yes, your assumption is right.
answers question: http://stackoverflow.com/q/24315704
type: Answer
upvote count: 2
score: 2

http://stackoverflow.com/comment/37564987
comment on: http://stackoverflow.com/q/24305848
type: Comment
score: 0
type: QuestionComment
has text: @KonstantinV.Salikhov Didn't get much from that.

http://stackoverflow.com/a/24397933
downvote count: 0
answers question: http://stackoverflow.com/q/24396897
type: Answer
has comment: http://stackoverflow.com/comment/65496324
upvote count: 17
has body: You need an import for the FXCollections class: &lt;?import javafx.collections.FXCollections ?&gt;
score: 17
accepted answer of: http://stackoverflow.com/q/24396897
type: AcceptedAnswer

powershell
tags question: http://stackoverflow.com/q/24281330
tags question: http://stackoverflow.com/q/24353639
tags question: http://stackoverflow.com/q/24303135
type: Tag
tag name: powershell

http://stackoverflow.com/comment/37527637
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24285640
type: AnswerComment
has text: Well I can't access Notepad++ at the moment (at work and there are no installs allowed on the desktops) but I did resolve the issue by taking OUT the nl2br on every textarea (I did it originally to output on a webpage, but they aren't needed now that I'm outputting to a text area. Any other ideas? I know it is retaining the formatting in the clipboard, but not all applications I paste to read it. Is there a command or something that fixes that? Or is it just the fault of the application I paste to and I'm screwed? Thanks for the quick replies!

http://stackoverflow.com/comment/37654617
has text: well, then the question remains: why doesn't it work ;). The package for the annotation is right, the persist-Method call is removed but the problem remains
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/24324733

orm
tags question: http://stackoverflow.com/q/24286524
tag name: orm
tags question: http://stackoverflow.com/q/24277184
tags question: http://stackoverflow.com/q/24427103
tags question: http://stackoverflow.com/q/24314724
tags question: http://stackoverflow.com/q/24354542
tags question: http://stackoverflow.com/q/24407162
type: Tag
tags question: http://stackoverflow.com/q/24336830
tags question: http://stackoverflow.com/q/24421129
tags question: http://stackoverflow.com/q/24416579
tags question: http://stackoverflow.com/q/24373551
tags question: http://stackoverflow.com/q/24426644

http://stackoverflow.com/q/24320378
has answer: http://stackoverflow.com/a/24320648
has comment: http://stackoverflow.com/comment/37591143
has comment: http://stackoverflow.com/comment/37593553
tagged with: java
tagged with: date
has title: How do I format a java.sql.date into this format: "MM-dd-yyyy"?
type: Question
has answer: http://stackoverflow.com/a/24320793
has comment: http://stackoverflow.com/comment/37591302
downvote count: 2
upvote count: 13
answer count: 6
has answer: http://stackoverflow.com/a/24320480
linked to: http://stackoverflow.com/q/3178690
has body: I need to get a java.sql.date in the following format "MM-dd-yyyy", but I need it to stay a java.sql.date so I can put it into a table as date field. So, it cannot be a String after the formatting, it has to end up as a java.sql.date object. This is what I have tried so far: java.util.Date today=new Date(); String date = formatter.format(today); Date todaydate = formatter.parse(date); java.sql.Date fromdate = new java.sql.Date(todaydate.getTime()); java.sql.Date todate=new java.sql.Date(todaydate.getTime()); String tempfromdate=formatter.format(fromdate); String temptodate=formatter.format(todate); java.sql.Date fromdate1=(java.sql.Date) formatter.parse(tempfromdate); java.sql.Date todate1=(java.sql.Date) formatter.parse(temptodate);
has answer: http://stackoverflow.com/a/24320492
has comment: http://stackoverflow.com/comment/37591207
favorite count: 0
has answer: http://stackoverflow.com/a/47483714
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24320538
has comment: http://stackoverflow.com/comment/37591351
score: 11

http://stackoverflow.com/comment/37500858
type: Comment
type: QuestionComment
has text: It should be `extends JPanel`
comment on: http://stackoverflow.com/q/24272384
score: 0

http://stackoverflow.com/q/24309517
has comment: http://stackoverflow.com/comment/37572926
has comment: http://stackoverflow.com/comment/37588445
has body: I want to add JComboBox into the JFileChooser. I tried to extend JFileChooser and to add the combo box manually. I actually managed to do it but that removed the file navigation panel from the JFileChooser dialog. Code: public class CustomDefinitionJFileChooser extends JFileChooser{ public CustomDefinitionJFileChooser() { JComboBox comboBox = new JComboBox(); comboBox.setModel(new DefaultComboBoxModel(new String[] { "Item 1", "Item 2" })); super.add(comboBox); } } Expected result: Actual result:
type: Question
type: AnsweredQuestion
tagged with: jcombobox
possible better answer: http://stackoverflow.com/a/25226332
has answer: http://stackoverflow.com/a/25226332
linked to: http://stackoverflow.com/q/24290210
has answer: http://stackoverflow.com/a/24323379
answer count: 2
tagged with: swing
has comment: http://stackoverflow.com/comment/37570965
has title: Custom JFileChooser. How to add JComboBox into the JFileChooser
score: 0
tagged with: java
tagged with: jfilechooser
accepted answer: http://stackoverflow.com/a/24323379

http://stackoverflow.com/q/24307231
has comment: http://stackoverflow.com/comment/37719194
has title: Infinite loop thread reading from pipe enters a timed_waiting
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/24461175
has comment: http://stackoverflow.com/comment/37629763
tagged with: java
has body: I need a thread running in the background reading from a pipe but the loop suddenly stops &amp; when I display the thread state I find it in TIMED_WAITING how to prevent it from such a behavior,below the code running within the thread, Thanks in advance. BufferedReader in = null; while (started) { String xml = ""; // char [] buf=new char[250]; try { in = new BufferedReader(new FileReader(pipeName)); while (!in.ready()) { } // in.read(buf,0,buf.length); xml = in.readLine(); // in.close(); } catch (Exception e) { System.out.println("error:" + e.getMessage()); continue; } if (xml != null &amp;&amp; !xml.equals("")) { System.out.println("recieved: " + xml); } } Edit: After using @thomas's link the program runs fine with the print but when I try to parse pr do some functions on the string the data read becomes un stable &amp; incomplete
has comment: http://stackoverflow.com/comment/37655586
has comment: http://stackoverflow.com/comment/37567012
type: Question
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37576752
has comment: http://stackoverflow.com/comment/37718090
tagged with: named-pipes
linked to: http://stackoverflow.com/q/14799945
favorite count: 0
has comment: http://stackoverflow.com/comment/37629949
has comment: http://stackoverflow.com/comment/37566122
has comment: http://stackoverflow.com/comment/37659686
upvote count: 2
tagged with: multithreading
has answer: http://stackoverflow.com/a/24461175

http://stackoverflow.com/comment/37702218
comment on: http://stackoverflow.com/q/24378747
score: 0
type: Comment
has text: Any of them that meet your basic requirements will do...try some and see what you like
type: QuestionComment

http://stackoverflow.com/a/24412482
answers question: http://stackoverflow.com/q/24411770
downvote count: 0
type: Answer
score: 1
has body: Single JSP page may be built from several JSP files. So JSP page is not the same as JSP file.
upvote count: 1
has comment: http://stackoverflow.com/comment/37917136

http://stackoverflow.com/comment/37574161
score: 0
type: Comment
has text: Its been answered so I'll leave this as a comment: this example is simply too unrealistic. See it as Animal animal = new Cow(); then you -know- what the answer is, no need to guess.
comment on: http://stackoverflow.com/q/24311037
type: QuestionComment

http://stackoverflow.com/comment/37723286
comment on: http://stackoverflow.com/a/24388171
score: 0
type: Comment
type: AnswerComment
has text: The code works great! What about if I wanted to use the .getCurrencyInstance? Thank you so much you have no idea how long this has annoyed me.

http://stackoverflow.com/comment/37492144
has text: Have you check in the logcat if there is some warnings related to this?
comment on: http://stackoverflow.com/q/24268198
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24419946
score: 2
upvote count: 3
downvote count: 1
has body: Seems like the error is pretty clear. PowerMockito.when(task, "saveDoPatchFile"); ...is missing a thenReturn, right? E.g. thenReturn() may be missing. Examples of correct stubbing: when(mock.isOk()).thenReturn(true); when(mock.isOk()).thenThrow(exception); doThrow(exception).when(mock).someVoidMethod(); So why is the exception down in your test method? Neither PowerMock nor Mockito can flag a failure to call thenReturn until the next time you interact with (Power)Mockito or a mock. After all, Mockito and PowerMockito aren't notified that your @Before method ends, and have to accept the "waiting for thenReturn" state. (You're allowed to call mock before thenReturn to allow thenReturn(mock(Foo.class)).)
answers question: http://stackoverflow.com/q/24390146
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24390146
has comment: http://stackoverflow.com/comment/37805795

http://stackoverflow.com/q/24327231
has comment: http://stackoverflow.com/comment/37604000
linked to: http://stackoverflow.com/q/9864267
tagged with: paintcomponent
has body: I have added the image in the src and bin directories and cross-checked that the name of the image file is correct Here is the main class import javax.swing.*; public class apples { public static void main(String args[]) { JFrame frame = new JFrame(); MyDrawPanel wid = new MyDrawPanel(); frame.add(wid); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.setSize(300,300); } } and here is the class that does the image adding part import java.awt.*; import javax.swing.*; public class MyDrawPanel extends JPanel { public void paintComponent(Graphics g) { Image image = new ImageIcon("b.png").getImage(); g.drawImage(image,20, 20, this); } }
answer count: 4
favorite count: 0
type: UnansweredQuestion
has title: drawImage() in Java, why isn't the image loading?
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/37604038
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24328163
has answer: http://stackoverflow.com/a/24336748
has comment: http://stackoverflow.com/comment/37603995
tagged with: jpanel
has comment: http://stackoverflow.com/comment/37603944
tagged with: image
has answer: http://stackoverflow.com/a/24327526
has comment: http://stackoverflow.com/comment/37605725
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/24328075

http://stackoverflow.com/q/24368930
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24369269
has title: Are you supposed to run automated integration tests against a QA server?
has body: Are you supposed to run automated integration tests against a QA server or are you supposed to somehow start an application server from your tests? Does anyone do option #2? How are you supposed to start an application server from tests? I'm just running into the dilemma of not knowing where to point my selenium driver to. This is a spring java app.
has answer: http://stackoverflow.com/a/24370310
possible better answer: http://stackoverflow.com/a/24369269
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24370310
tagged with: integration-testing
type: Question

http://stackoverflow.com/comment/37751741
has text: @Dennis.. I have posted the code.. look forward for your answer.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24388554

http://stackoverflow.com/q/24303555
tagged with: android
has comment: http://stackoverflow.com/comment/37559209
has body: I'm using callback method to call method from fragmentActivity to Fragment in a project which contain also another an Activity class.I'm facing a null pointer issue from the method called with callback. This is the logcat traces: 06-19 05:36:42.090: I/Choreographer(888): Skipped 121 frames! The application may be doing too much work on its main thread. 06-19 05:36:42.950: I/Choreographer(888): Skipped 60 frames! The application may be doing too much work on its main thread. 06-19 05:36:43.230: D/gralloc_goldfish(888): Emulator without GPU emulation detected. 06-19 05:36:43.400: I/Choreographer(888): Skipped 39 frames! The application may be doing too much work on its main thread. 06-19 05:37:06.300: I/Choreographer(888): Skipped 31 frames! The application may be doing too much work on its main thread. 06-19 05:37:07.160: D/AndroidRuntime(888): Shutting down VM 06-19 05:37:07.160: W/dalvikvm(888): threadid=1: thread exiting with uncaught exception (group=0xb4af6ba8) 06-19 05:37:07.190: E/AndroidRuntime(888): FATAL EXCEPTION: main 06-19 05:37:07.190: E/AndroidRuntime(888): Process: info.androidhive.tabsswipe, PID: 888 06-19 05:37:07.190: E/AndroidRuntime(888): java.lang.NullPointerException 06-19 05:37:07.190: E/AndroidRuntime(888): at info.androidhive.tabsswipe.MainFragment$1.onClick(MainFragment.java:48) 06-19 05:37:07.190: E/AndroidRuntime(888): at android.view.View.performClick(View.java:4438) 06-19 05:37:07.190: E/AndroidRuntime(888): at android.view.View$PerformClick.run(View.java:18422) 06-19 05:37:07.190: E/AndroidRuntime(888): at android.os.Handler.handleCallback(Handler.java:733) 06-19 05:37:07.190: E/AndroidRuntime(888): at android.os.Handler.dispatchMessage(Handler.java:95) 06-19 05:37:07.190: E/AndroidRuntime(888): at android.os.Looper.loop(Looper.java:136) 06-19 05:37:07.190: E/AndroidRuntime(888): at android.app.ActivityThread.main(ActivityThread.java:5017) 06-19 05:37:07.190: E/AndroidRuntime(888): at java.lang.reflect.Method.invokeNative(Native Method…
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/37560017
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37564047
tagged with: fragment
type: Question
has comment: http://stackoverflow.com/comment/37559907
has comment: http://stackoverflow.com/comment/37559116
tagged with: java
has comment: http://stackoverflow.com/comment/37559123
tagged with: callback
has title: Null pointer when using a FragmentActivity callback
score: 0
has comment: http://stackoverflow.com/comment/37559891

http://stackoverflow.com/a/24333455
accepted answer of: http://stackoverflow.com/q/24333115
answers question: http://stackoverflow.com/q/24333115
type: Answer
score: 0
has body: public BigInteger(int x) this value for int x the input itself would be the limit so you can never go over. Why not just have ? public BigInteger(int x){ bigIntValue = x; } Because that's not the point. You want to be able to create values bigger then the intended int from the input. The better option IMO would be something along the lines of add a String as the input then having an operation that can push int's or something you want into the back or front of the linklist. public BigInteger(String x) { int endLoop = 0; list = new LinkedList&lt;char&gt;(); // have a boolean for negative in your class then multiple by // negative one to your operations if its true. if(x.charAt(0) == '-'){ this.negative = true; endLoop = 1; } list = new LinkedList&lt;char&gt;(); int i = x.length() - 1; while(i &gt;= endLoop) { if(!validNumber(x.charAt(i)) //fail list.push(( x.charAt(i))); i--; } } // this checks if it's a number. boolean validNumber(char n){ for(int i = 48; i =&lt; 57; i++){ if(n = i) return true; } return false; } You can even change the type of your lists to int if you want by writing a converter from char to int.
type: AcceptedAnswer

http://stackoverflow.com/comment/37681953
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24324741
has text: Which is the class of matlabcontrol that executes the .m files? Because I cant find anything relevant.

http://stackoverflow.com/comment/41368931
has text: I believe your example will work same way without priority attribute. The order is not affected by the attribute and will be built based on dependency chain.
type: Comment
comment on: http://stackoverflow.com/a/26341283
type: AnswerComment
score: 0

http://stackoverflow.com/q/24425730
answer count: 3
upvote count: 1
favorite count: 0
has body: Please have a look on following Class, I need to check if there is valid value in the variable. All works fine if there is a proper value in variable instead of null, When it comes null the behaviour is not what I expect (Although it might make sense if Integer a = null; when checked as a instanceof Integer, Can some one guide me how to achieve correct result from following class? package com.mazhar.hassan; public class ValueChecker { public static boolean empty(Integer value) { System.out.println("Integer"); return (value != null &amp;&amp; value.intValue() &gt; 0); } public static boolean empty(Long value) { System.out.println("Long"); return (value != null &amp;&amp; value.longValue() &gt; 0); } public static boolean empty(String value) { System.out.println("String"); return (value != null &amp;&amp; value.length() &gt; 0); } public static boolean empty(Object value) { System.out.println("Object"); return (value != null); } public static void checkAll(Object... args) { for(Object o: args) { if (o instanceof Integer) { empty((Integer)o); } else if (o instanceof Long) { empty((Long)o); } else if (o instanceof String) { empty((String)o); } else { empty(o); } } } public static void main (String[] args) { Integer a = null; Long b = null; String x = null; Object y = null; if (a instanceof Integer) { System.out.println("a is Integer"); } else { System.out.println("a is not Integer"); } System.out.println("/---------------------------------------------------/"); checkAll(a,b,x,y); System.out.println("/---------------------------------------------------/"); empty(a); empty(b); empty(x); empty(y); } } Why I need exact type checking is, I thave to throw erros like "Not valid Integer", "No valid Long" etc. The output of above class is as follows. /-----------------------(Output 1)----------------------------/ a is not Integer /-----------------------(Output 2)----------------------------/ Object Object Object Object /------------------------(Output 3)------------------------…
possible better answer: http://stackoverflow.com/a/24425824
tagged with: overloading
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/24426209
has answer: http://stackoverflow.com/a/24425851
score: 1
accepted answer: http://stackoverflow.com/a/24425851
tagged with: java
type: Question
tagged with: casting
has comment: http://stackoverflow.com/comment/37790959
has title: Java Type Cast, Object Type and overloading Issue
has answer: http://stackoverflow.com/a/24425824

http://stackoverflow.com/comment/37678937
type: Comment
type: QuestionComment
has text: The use case is just to add a new Menu Category, but i want to check for duplicates first. Obviously I can do it simpler ways, but I think this annotation method should work, and give me flexibility in the future if I need to add more logic behind validation.
score: 0
comment on: http://stackoverflow.com/q/24357693

http://stackoverflow.com/a/24423316
type: AcceptedAnswer
has body: Looks like your problem is that the join table has obviously a composite primary key with each column as foregn key to both the tables. However your use case dictates that there may be repetition. In this case, an alternate strategy could be a mapping entity @Entity public class OrderItemMapping { @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @ManyToOne @JoinColumn(name="order") private Order order; @ManyToOne @JoinColumn(name="item") private Item item;
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24422266
accepted answer of: http://stackoverflow.com/q/24422266

http://stackoverflow.com/comment/37526312
has text: @DwB up vote for the apt analogy ;-)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24284902

http://stackoverflow.com/comment/37921547
type: AnswerComment
has text: That's the contents of `empty.nlogo` which is one of the files inside `NetLogo.jar`.
type: Comment
comment on: http://stackoverflow.com/a/24410230
score: 0

http://stackoverflow.com/q/24287833
has comment: http://stackoverflow.com/comment/37553300
has body: Trying to set values in selectCheckboxMenu using primefaces 4.0 / my xhtml code / &lt;p:selectCheckboxMenu value="#{A.b}" label="C" valueChangeListener="#{myValidator.validate}"&gt; &lt;f:selectItems value="#{d.availableItems}"/&gt; &lt;p:ajax update="some_id"/&gt; &lt;/p:selectCheckboxMenu&gt; / myValidator / public void validate(ValueChangeEvent event){ Object[] oldValues = ((Object[]) event.getOldValue()); SelectCheckboxMenu input = (SelectCheckboxMenu)event.getComponent(); input.setSelectedValues(oldValues); } by I get a strange error javax.faces.component.UpdateModelException: java.lang.IllegalArgumentException: Cannot convert [Ljava.lang.Object;@40bb23 of type class [Ljava.lang.Object; to interface java.util.List at javax.faces.component.UIInput.updateModel(UIInput.java:867)
type: AnsweredQuestion
tagged with: jsf
tagged with: primefaces
tagged with: java
has comment: http://stackoverflow.com/comment/37546091
type: Question
accepted answer: http://stackoverflow.com/a/24312504
has comment: http://stackoverflow.com/comment/37552638
has comment: http://stackoverflow.com/comment/37576057
has answer: http://stackoverflow.com/a/24312504
score: 0
has comment: http://stackoverflow.com/comment/37552537
answer count: 1
has title: primefaces set values to selectCheckboxMenu
has comment: http://stackoverflow.com/comment/37553082
has comment: http://stackoverflow.com/comment/37569147
has comment: http://stackoverflow.com/comment/37529656

http://stackoverflow.com/q/24336386
has body: Getting the below severe exception when attempting to run tomcat in Spring Tool Suite: SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.util.Log4jConfigListener java.lang.IllegalStateException: Cannot set web app root system property when WAR file is not expanded at org.springframework.web.util.WebUtils.setWebAppRootSystemProperty(WebUtils.java:143) at org.springframework.web.util.Log4jWebConfigurer.initLogging(Log4jWebConfigurer.java:117) at org.springframework.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:45) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
has title: SEVERE: Exception org.springframework.web.util.Log4jConfigListener
favorite count: 0
tagged with: spring
upvote count: 6
tagged with: spring-mvc
type: AnsweredQuestion
score: 6
possible better answer: http://stackoverflow.com/a/28778925
has answer: http://stackoverflow.com/a/28778925
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24344898
answer count: 2
accepted answer: http://stackoverflow.com/a/24344898
downvote count: 0

http://stackoverflow.com/q/24389184
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/37722127
answer count: 1
has answer: http://stackoverflow.com/a/24389235
has body: hey im making a program in java were you type into a console then it responds back with the computer actually talking(with sound), im using the FreeTTs speech synthesizer. For some reason when i write the following code its output not what i want. import java.util.Scanner; import com.sun.speech.freetts.VoiceManager; import com.sun.speech.freetts.Voice; public class TextToSpeech { public static void main(String args[]){ Scanner input = new Scanner(System.in); String userInput = input.nextLine(); if(userInput == "hi"){ Voice v; VoiceManager vm=VoiceManager.getInstance(); v=vm.getVoice("kevin16"); v.allocate(); v.speak("Hey my name is jarvis"); input.close(); }else System.out.println("you suck try again"); } }
favorite count: 0
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/37721870
has title: my if statement wont work? speech synthesizer
tagged with: java
downvote count: 3
duplicate of: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/37721860
type: Question
has comment: http://stackoverflow.com/comment/37721970
tagged with: if-statement
upvote count: 0
tagged with: speech-synthesis
tagged with: freetts

http://stackoverflow.com/q/24418952
favorite count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
tagged with: java
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/55246247
tagged with: active-directory
score: 4
has answer: http://stackoverflow.com/a/44819165
upvote count: 4
answer count: 3
has body: I'm still learning LDAP / Active Directory so correct me if my terminology is wrong at all :) In our Java Web Application, I'm trying to secure it with Spring Security LDAP. I managed to get Spring Security working with in-memory authentication but we need to tie it to our AD server. I'm going to mask our actual domain with com.test Here is the error I receive when I try to login from my application 13:39:55,701 ERROR ActiveDirectoryLdapAuthenticationProvider:133 - Failed to locate directory entry for authenticated user: johnsmit javax.naming.NameNotFoundException: [LDAP: error code 32 - 0000208D: NameErr: DSID-0310020A, problem 2001 (NO_OBJECT), data 0, best match of: 'CN=Users,DC=ad,DC=test,DC=com' I am using class based configuration with Spring Here is my SecurityConfiguration class @Configuration @EnableWebMvcSecurity public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Bean public ActiveDirectoryLdapAuthenticationProvider activeDirectoryLdapAuthenticationProvider() { provider = new ActiveDirectoryLdapAuthenticationProvider("ad.test.com", "ldap://servername.ad.test.com:389/cn=Users,dc=ad,dc=test,dc=com"); provider.setUseAuthenticationRequestCredentials(true); return provider; } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(activeDirectoryLdapAuthenticationProvider()); } @Override protected void configure(HttpSecurity http) throws Exception { http. authorizeRequests() .anyRequest().authenticated() .and() .formLogin().failureUrl("/login?error") .loginPage("/login") .permitAll() .and() .logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout")).logoutSuccessUrl("/login") .permitAll() .and() .httpBasic(); } } So here is the issue (at least I think)... In our AD server we have our cn,name,sAMAccountName and uid as our username that we login with, johnsmit in my example above. Our userPrincipalName (in our AD server) is our email address so john.smith@test.com. I was…
has answer: http://stackoverflow.com/a/24435531
has title: Spring Security for Active Directory searches by 'userPrincipalName' -- is there a way to change this?
tagged with: spring-security

http://stackoverflow.com/comment/37774256
has text: true that, check my updated query, it should select Users and I revised the joins. I did it in Notepad++ so no compile check for me :)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24413235

http://stackoverflow.com/comment/37512393
type: Comment
comment on: http://stackoverflow.com/a/24278772
score: 1
type: AnswerComment
has text: It seems that I missed this part in guide. I am not sure why ddl-auto is changed by `spring.jpa.hibernate.ddl-auto` but schema is changed by 'spring.jpa.properties.hibernate.default_schema'. Still it works as described in guide, so thank!

http://stackoverflow.com/comment/37729357
score: 0
type: QuestionComment
type: Comment
has text: `currSet` is just an Object. `isEqual` compares if two objects are equal (not the point here). I'm using a normal `Set<>` What happens sometimes is: the values I have in the objects within `leftSet` (UUID, Integer, UUID) are assigned to `currSet` and the values are something like: UUID+1, Random Integer, Random UUID
comment on: http://stackoverflow.com/q/24393023

http://stackoverflow.com/a/24377258
type: Answer
accepted answer of: http://stackoverflow.com/q/24376373
score: 5
has comment: http://stackoverflow.com/comment/37939588
upvote count: 5
has body: I answer myself, for anyone who needs to fill the caldroid, you can do it with this code: protected void onPostExecute(ArrayList&lt;HashMap&lt;String, String&gt;&gt; args) { for (i = 0; i &lt; arraylist.size(); i++) { Calendar cal = Calendar.getInstance(); HashMap&lt;String, String&gt; map = arraylist.get(i); SimpleDateFormat simpleDateFormat = new SimpleDateFormat( "yyyy-MM-dd", Locale.getDefault()); try { Date orangeDate = simpleDateFormat .parse(map.get("dtstart")); // Max date is next 7 days /* * cal = Calendar.getInstance(); cal.add(Calendar.DATE, 2); * Log.e("fecha", "" + redDate); Date orangeDate = * cal.getTime(); */ Log.e("fecha", "" + orangeDate); String color = map.get("color"); if (caldroidFragment != null) { if (color.equals("red")) { caldroidFragment.setBackgroundResourceForDate( R.color.red, orangeDate); caldroidFragment.setTextColorForDate(R.color.white, orangeDate); } if (color.equals("orange")) { caldroidFragment.setBackgroundResourceForDate( R.color.orange, orangeDate); caldroidFragment.setTextColorForDate(R.color.white, orangeDate); } } ArrayList&lt;Date&gt; disabledDates = new ArrayList&lt;Date&gt;(); for (int i = 4; i &lt; 8; i++) { cal = Calendar.getInstance(); cal.add(Calendar.DATE, i); disabledDates.add(cal.getTime()); } caldroidFragment.setDisableDates(disabledDates); caldroidFragment.refreshView(); } catch (ParseException e) { // Insert this block. // TODO Auto-generated catch block e.printStackTrace(); } } }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24376373

http://stackoverflow.com/comment/37523106
type: QuestionComment
comment on: http://stackoverflow.com/q/24283849
score: 0
has text: And i import that code as package in eclipse
type: Comment

http://stackoverflow.com/q/24402847
downvote count: 1
type: Question
tagged with: local
has answer: http://stackoverflow.com/a/24403311
score: 0
answer count: 3
tagged with: non-static
has comment: http://stackoverflow.com/comment/37747863
upvote count: 1
has body: I'm trying to write a piece of code that when I check one of the two checkboxes, it will change the message that appears when I then select the button. import javax.swing.*; import java.awt.*; import java.awt.event.*; public class FirstWindow extends JFrame{ String message; public static void main(String[] args){ //the string to show the message for button 1 message = "goodjob \n"; //all of the main window JFrame frame = new JFrame("heading"); frame.setVisible(true); frame.setSize(600,400); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); //makes seperate panels JPanel panel1 = new JPanel(); JPanel panel2 = new JPanel(); JPanel panel3 = new JPanel(new GridBagLayout()); //set of buttons JButton button1 = new JButton("Button 1"); JButton button2 = new JButton("Button 2"); //makes an ACTION LISTENER, which tells the button what to do when //it is pressed. button1.addActionListener(new ActionListener(){ //the command to button @Override public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, message); } }); //for panel adds buttons panel1.add(button1); panel1.add(button2); //set of checkboxes JCheckBox checkBox = new JCheckBox("Option1"); JCheckBox checkBox2 = new JCheckBox("Option2"); //adds text if the box is checked if (checkBox.isSelected()) { message += "you picked option 1"; } if (checkBox2.isSelected()) { message += "you picked option 2"; } //for panel2 adds checkboxes panel2.add(checkBox); panel2.add(checkBox2); //makes a new label, text area and field JLabel label = new JLabel("This is a label"); JTextArea textArea = new JTextArea("this is a text area"); JTextField textField = new JTextField("text field"); //makes an invisible grid GridBagConstraints grid = new GridBagConstraints(); grid.insets = new Insets(15, 15, 15, 15); //sets the the coordinates 0,0. adds the label, and sets position grid.gridx = 0; grid.gridy = 0; panel3.add(label, grid); //sets the the coordinates 0,1. adds the textArea, an…
favorite count: 0
tagged with: static
accepted answer: http://stackoverflow.com/a/24402922
has answer: http://stackoverflow.com/a/24404785
possible better answer: http://stackoverflow.com/a/24403311
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24402922
has title: non-static variable s cannot be referenced from a static context
tagged with: java

http://stackoverflow.com/a/24372225
has body: I haven't tested this myself, but theres a few things I noticed about your code. First, the line image.preserveRatioProperty(); doesn't actually change any state for the ImageView, all it does is tell you whether or not the ImageView is set to preserve ratios. what you probably want instead is: image.setPreserveRatio(true); which I believe will probably do what you want. If it doesn't it might be because the image has already been loaded, so if this still doesn't work, try putting image.setPreserveRatio(true); before image.setImage(i);
has comment: http://stackoverflow.com/comment/37695642
score: 0
has comment: http://stackoverflow.com/comment/37693918
has comment: http://stackoverflow.com/comment/37690628
type: Answer
has comment: http://stackoverflow.com/comment/37691294
answers question: http://stackoverflow.com/q/24371319

http://stackoverflow.com/comment/37547524
type: QuestionComment
type: Comment
has text: @MadProgrammer it's okay, I did mess up by gettting graphics from the JPanel once, but I corrected My mistakes
comment on: http://stackoverflow.com/q/24293847
score: 0

http://stackoverflow.com/a/24561755
score: 3
answers question: http://stackoverflow.com/q/24377478
downvote count: 0
type: Answer
upvote count: 3
has body: This question is pretty old, but for any future reference i have found this answer that solved my problem. After numerous searchers around the web I found this answer here - thanks to jtal! Just to summaries the problem: Using Ebean i have made a @ManyToOne entity that is not implemented in the database in anyway, even more the join field, in your case blogId is a valid field that has values of its own. when trying to join the column on that field, it will always fail because it creates this sql query: SELECT * FROM blog_comment; select t0.id c0, t0.blog_id c1, t0.content c2, t0.website c3, t0.time_created c4, t0.blog_id c5 &lt;---- notice this duplicate from blog_comment t0 in order to solve this, i tell ebean not to use the second set of properties. your new ebean element should look something like this: @ManyToOne @JoinColumn(name = "blogId", insertable = false, updatable = false) public Blog blog; hope this helps! =)

http://stackoverflow.com/q/24395994
tagged with: arrays
tagged with: string
tagged with: binary-data
linked to: http://stackoverflow.com/q/5409998
has answer: http://stackoverflow.com/a/24396037
accepted answer: http://stackoverflow.com/a/24396037
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/24397040
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37735116
has title: How to convert efficiently binary string to binary byte array in Java?
has answer: http://stackoverflow.com/a/24396111
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37735070
tagged with: java
linked to: http://stackoverflow.com/q/17727310
has comment: http://stackoverflow.com/comment/37735005
has body: As an input I have binary string String a = "100110". As output I need to have binary byte array byte[] b = {1,0,0,1,1,0}. For now I'm using for (int i=0; i&lt;a.length; i++) { b[i]= Byte.parseByte(a.substring(i, i+1)); } But this approach is too slow. Can any one give a better suggestion? Thank you
possible better answer: http://stackoverflow.com/a/24396111
type: Question
upvote count: 2

http://stackoverflow.com/a/24271632
downvote count: 0
has comment: http://stackoverflow.com/comment/37498884
answers question: http://stackoverflow.com/q/24271616
has comment: http://stackoverflow.com/comment/37498850
upvote count: 5
has body: You don't need to override equals, since Collections.sort() will use compareTo(), not equals(). However, it's generally a good idea to override it.
type: Answer
has comment: http://stackoverflow.com/comment/37498870
score: 5

http://stackoverflow.com/q/24424592
has answer: http://stackoverflow.com/a/24425666
has comment: http://stackoverflow.com/comment/37788336
answer count: 2
favorite count: 0
upvote count: 5
possible better answer: http://stackoverflow.com/a/24425666
has title: Screenshot of a panel with opened comboboxes
tagged with: jcombobox
type: AnsweredQuestion
tagged with: popup
downvote count: 0
tagged with: screenshot
tagged with: java
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/24425096
accepted answer: http://stackoverflow.com/a/24425096
has body: I have a JPanel which includes a JComboBox. I am trying to take a screenshot of this panel when JComboBox is open. But I couldn't do it. Any idea? If you run this code then press Alt-P when combo is open, you will see the problem. public class ScreenShotDemo { /** * @param args */ public static void main(String[] args) { final JPanel JMainPanel = new JPanel(new BorderLayout()); JPanel jp = new JPanel(); jp.add(new JComboBox&lt;String&gt;(new String[] { "Item1", "Item2", "Item3" })); final JPanel jImage = new JPanel(); JMainPanel.add(jp, BorderLayout.WEST); JMainPanel.add(jImage, BorderLayout.CENTER); jp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.ALT_DOWN_MASK), "screenshot"); jp.getActionMap().put("screenshot", new AbstractAction() { @Override public void actionPerformed(ActionEvent arg0) { BufferedImage bf = new BufferedImage(400, 400, BufferedImage.TYPE_INT_RGB); JMainPanel.paint(bf.getGraphics()); jImage.getGraphics().drawImage(bf, 0,0,jImage); } }); final JFrame jf = new JFrame(); jf.getContentPane().add(JMainPanel); jf.setSize(500, 500); jf.setVisible(true); } }
score: 5

http://stackoverflow.com/a/24422826
accepted answer of: http://stackoverflow.com/q/24422795
downvote count: 0
answers question: http://stackoverflow.com/q/24422795
upvote count: 3
has comment: http://stackoverflow.com/comment/37785389
type: AcceptedAnswer
has body: keyPressed can (and will be) called repeatedly while the key is pushed. You should put in flag that you can check to see if this a repeated key event... int lastKey = -1; public void keyPressed(KeyEvent arg0) { // TODO Auto-generated method stub int codigo = arg0.getKeyCode(); if (codigo != lastkey) { lastkey = codigo if(codigo == KeyEvent.VK_SPACE) { keyPressedMillis = System.currentTimeMillis(); } } } Of course, in your keyReleased event handler, you should reset this value so you don't end up missing a new key press ;)
type: Answer
score: 3

http://stackoverflow.com/comment/37655678
has text: `final int reasonable_buffer_size = 32 * 1024;` seems pretty nonzero. :-) But I see what you mean; I'll try decreasing to a really tiny buffer when I'm back in the lab and see what happens. The buffer should be empty when `allocate()` returns, and I remember that adding a preemptive call to `clear()` anyhow had no effect.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24317433
type: AnswerComment

http://stackoverflow.com/comment/37775619
has text: @JosefE. Would you prefer "How to make an Android vibrate?" :)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24417324

http://stackoverflow.com/comment/37526917
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24286546
has text: `public(List<String> companies, MyObject obj)` is nonsense. do you actually mean `public MyViewService(List<String> companies, MyObject obj)`?

http://stackoverflow.com/a/24296020
answers question: http://stackoverflow.com/q/24295965
upvote count: 10
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24295965
type: Answer
has body: After copying/pasting your exact text, it shows as an invalid JSON variable. Then, I just copied/pasted the same content into a notepad (using Windows 7) and noted there are strange characters in your string (these characters cannot be seen in this page nor in web editors, so I'm using a blank space instead): {"street_address":"Stone House Lane, Peckforton , Tarporley , London, Cheshire"} ^ ^ here and here I just removed them and worked as expected. Copy/paste it from here: {"street_address":"Stone House Lane, Peckforton, Tarporley, London, Cheshire"} After a more in-depth evaluation, the hexadecimal representation of this char is \u80A8.
downvote count: 0
score: 10
has comment: http://stackoverflow.com/comment/37545566

http://stackoverflow.com/comment/37677349
score: 1
type: AnswerComment
has text: Yes, it has. `public void hello() { A.super.hello(); }`
type: Comment
comment on: http://stackoverflow.com/a/24365407

http://stackoverflow.com/comment/37686049
score: 0
type: Comment
type: QuestionComment
has text: This question has been asked before: http://stackoverflow.com/questions/1517635/save-postgres-sql-output-to-csv-file?rq=1
comment on: http://stackoverflow.com/q/24369864

dst
tags question: http://stackoverflow.com/q/24325171
tag name: dst
type: Tag

http://stackoverflow.com/comment/37602144
comment on: http://stackoverflow.com/q/24324941
type: Comment
type: QuestionComment
has text: @PSIXO: yes its just syntax sugar. The compiler converts a(1,2) to an array {1,2} and then pass that as a([]).
score: 0

http://stackoverflow.com/comment/111524562
comment on: http://stackoverflow.com/a/51681737
has text: @user3562927 Installing [*Homebrew* (package manager)](https://en.wikipedia.org/wiki/Homebrew_(package_manager)) for the single goal of obtaining Java is like building a [landing strip](https://en.wikipedia.org/wiki/Runway) to park your car instead of just using your driveway. If you already have it, fine, use it. But suggesting *Homebrew* to those who simply need Java is poor advice. Apparently you are not the only easily-offended Homebrew fan, given the 5 down-votes left on this Answer without explanation. But I stand by my recommendation.
score: 2
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24271635
type: Answer
answers question: http://stackoverflow.com/q/24271544
has body: Can you update the question with the set of imports for your activity, will edit/remove my answer if its incorrect. Why you always see the current location may be because of the googleMap.setMyLocationEnabled(true); in onCreate() Frankly, the code in question seems a copy-paste from multiple sources without understanding much or the details have been overlooked, not so mildly. Code contains a mix of two methods of obtaining user's location. 1. Using LocationClient, Retrieving the Current Location This implements interfaces from GooglePlayServicesClient The package is com.google.android.gms.location.LocationClient so its this LocationListener. On the link of Testing Using Mock Locations, this one has been used. 2. Using LocationManager with which you would use the method requestLocationUpdates(). Here the package is android.location so its this LocationListener. What that means for your code: 1.1 You have implemented the Listeners for the first method, but you never set, call or use locationClient.connect() so the following part of the code is never called. @Override public void onConnected(Bundle bundle) { // TODO may be add some logs Log.i("ViewMap", "GPS can work now"); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, this); locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1000, 0, this); } @Override public void onDisconnected() { // TODO may be add some logs Log.i("ViewMap", "GPS is disconnected"); } @Override public void onConnectionFailed(ConnectionResult connectionResult) { // TODO may be add some logs Log.e("ViewMap", "Google play connection failed. GPS might not work"); } You should go for this method as you are using Google Play Services anyway. 2.1 locationManager.requestLocationUpdates(provider, 400, 1, this); This is what gets you the location if you have imported the correct LocationListener. You can check in imports, if it is not the android.location package, i don't think the code ever reaches there…
has comment: http://stackoverflow.com/comment/37500988
score: 0

http://stackoverflow.com/q/24276180
has title: Libgdx Label multiline text height
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37510379
has comment: http://stackoverflow.com/comment/37513534
tagged with: libgdx
has body: i have done a small test on LibGdx, on Multi-line Label, it seems that i cant get the wrapped line's height. Following is the code. Theoretically, height for aLebel should be > bLabel. But the result appear the same. code: aLabel.setText("this is a super long long long text that need wrapping."); // line wrapped into 3 lines aLabel.setWrap(true); aLabel.setWidth(470); doLog("aLabel.getHeight(): " + aLabel.getHeight()); bLabel.setText("this is short."); // unwrapped line bLabel.setWrap(true); bLabel.setWidth(470); doLog("bLabel.getHeight(): " + bLabel.getHeight()); result: aLabel.getHeight(): 45.0 bLabel.getHeight(): 45.0 Do anyone have any idea how to get the actual multi-line height in LibGdx? Thanks in advance.
tagged with: label
linked to: http://stackoverflow.com/q/18557448
has answer: http://stackoverflow.com/a/33115693
has comment: http://stackoverflow.com/comment/37509848
has answer: http://stackoverflow.com/a/25843759
has answer: http://stackoverflow.com/a/39794145
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
score: 11
answer count: 4
has answer: http://stackoverflow.com/a/40792287
upvote count: 11

http://stackoverflow.com/comment/37608237
comment on: http://stackoverflow.com/q/24325290
has text: You are right, you cannot make it RequestScoped as Ajax will not work. So I believe your options are manually resetting the bean, or call saveFactura() via the action (not actionListener) and return a redirect to the same page as mentioned here: http://stackoverflow.com/questions/16483214/how-can-i-reload-the-same-page-from-a-managedbean-in-jsf
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/24279743
tagged with: jsp
has body: I want to create a table dynamically in such a way that no of headers and data i can pass from JAVA class and on no. basis, jsp should create a table accordingly. I have controller class in which i am returning model object which is my bean class. In that i have a list attribute in which i have hardcoded some values.These values should be by header names in the JSP table. When i am rendering this model object to jsp then i am not able to retrieve the headers info. Plz suggest. My contrller class loooks like this: @RequestMapping public ModelAndView getHeaders(PortletRequest portlestRequest, PortletResponse portletResponse){ ModelAndView mv = new ModelAndView(); TableDAO dao = new TableDAO(); List&lt;String&gt; headersList = dao.getHeaders(); TableView tableView = new TableView(); tableView.setTableHeaders(headersList); mv.addObject("tableView",tableView); mv.setView("tableView"); return mv; } My jsp: &lt;table&gt; &lt;c:forEach var = "listValue" items = "${tableView.tableHeaders}"&gt; &lt;tr&gt; &lt;%for(int i = 0;i&lt;5;i++){ %&gt; &lt;td&gt; &lt;%=${listValue.get(i)} %&gt; &lt;/td&gt; &lt;%} %&gt; &lt;/tr&gt; &lt;/c:forEach&gt; &lt;/table&gt; Someone plz help me on this.
has answer: http://stackoverflow.com/a/24284750
answer count: 1
has title: How to display TABLE dynamically in JSP using SPRING MVC
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: spring-mvc
score: 2
tagged with: java
type: Question

http://stackoverflow.com/a/24365530
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24363161
has comment: http://stackoverflow.com/comment/37710044
has body: Grails 2.3 and later uses "forked mode" by default, where the JVM running run-app spawns a separate process to run the target application. Therefore, rather than passing the -D options to grails you should configure them in BuildConfig.groovy. Find the grails.project.fork option and add jvmArgs: grails.project.fork = [ run:[...., jvmArgs:['-Dcom.sun.management.jmxremote=true', '-Dcom.sun.management.jmxremote.port=9999', // etc. ]] ] Using the -D options on the command line as you are currently doing will set up the JMX connector in the grails process, not in your application.
downvote count: 0

http://stackoverflow.com/comment/37594458
comment on: http://stackoverflow.com/q/24321975
score: 0
has text: yes @TimCastelijns I agree with you. Just deleting my comment. Sorry.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24347658
has comment: http://stackoverflow.com/comment/37643474
upvote count: 10
tagged with: pathname
downvote count: 0
answer count: 7
has comment: http://stackoverflow.com/comment/37643422
has answer: http://stackoverflow.com/a/41291987
has title: Getting a mp3 file to play using javafx
favorite count: 0
has comment: http://stackoverflow.com/comment/37643531
has body: I have spent hours today looking up how to get some form of audio in eclipse and have had trouble every step of the way. Currently I have something that should work but I get an error: Exception in thread "main" java.lang.IllegalArgumentException: expected file name as argument at com.sun.javafx.css.parser.Css2Bin.main(Css2Bin.java:44) I have basically copied this from someone who had it working. I would like to say that the FX lib is added where it should be. I know this isn't fancy but I was just trying the basics. package b; import java.io.File; import javafx.scene.media.Media; import javafx.scene.media.MediaPlayer; public class test { public static void main(String[] args){ String uriString = new File("C:\\Users\\Mike\\workspace\\b\\src\\hero.mp3").toURI().toString() MediaPlayer player = new MediaPlayer( new Media(uriString)); player.play(); }} I have also tried many different path names in case it was wrong with no luck, I also just tried to copy and paste the path name that i got in eclipse by going to properties ex: /b/src/hero.mp3. Help would be appreciated to get me out of this nightmare.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/64864946
has answer: http://stackoverflow.com/a/62548629
has answer: http://stackoverflow.com/a/65621288
tagged with: javafx
has answer: http://stackoverflow.com/a/44038071
has answer: http://stackoverflow.com/a/24353457
type: Question
has answer: http://stackoverflow.com/a/24347793
tagged with: java
score: 10
has comment: http://stackoverflow.com/comment/37643654
has comment: http://stackoverflow.com/comment/37643589
tagged with: eclipse

http://stackoverflow.com/q/24395879
tagged with: android
has comment: http://stackoverflow.com/comment/49531094
tagged with: webview
type: AnsweredQuestion
tagged with: android-webview
tagged with: java
has body: I am trying to use webView to display an HTML file that is on the device and not the internet. I have my html files in the /Download folder. When I launch the application I get the following error: Webpage not available The webpage at file:///storage/sdcard0/Download/manuals/test/index4.html might be temporarily down or it may have been moved permanently to a new web address. I know the file is there but it will not display it. Here is my code: package com.asstechmanuals.techmanual; import java.io.File; import android.net.Uri; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.KeyEvent; import android.view.Menu; import android.view.Window; import android.webkit.WebView; import android.webkit.WebViewClient; public class MainActivity extends Activity { private WebView mWebView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mWebView = (WebView) findViewById(R.id.webview); mWebView.getSettings().setJavaScriptEnabled(true); File fileStandard = new File("/storage/sdcard0/Download/manuals/test/index4.html"); File fileNewStandard = new File("/storage/sdcard0/Download/manuals/test/index4.html"); File fileKitKat = new File("/storage/sdcard0/Download/manuals/test/index4.html"); if(fileStandard.exists()) mWebView.loadUrl("file:///storage/sdcard0/Download/manuals/test/index4.html"); else if(fileNewStandard.exists()) mWebView.loadUrl("file:///storage/sdcard0/Download/manuals/test/index4.html"); else if(fileKitKat.exists()) mWebView.loadUrl("file:///storage/sdcard0/Download/manuals/test/index4.html"); else mWebView.loadUrl("file:///storage/sdcard0/Download/manuals/test/index4.html"); mWebView.setWebViewClient(new vwClient()); } private class vwClient extends WebViewClient{ @Override public boolean shouldOverrideUrlLoading(WebView webview, String url) { webview.loadUrl(url); if (url.toLowerCase().contains(".pdf")) { Intent intent = new …
has answer: http://stackoverflow.com/a/24395954
accepted answer: http://stackoverflow.com/a/24395954
tagged with: eclipse
type: Question
linked to: http://stackoverflow.com/q/6160165
score: 0
answer count: 1
has title: WebView = Web page not available

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/24304718
tags question: http://stackoverflow.com/q/24424327
tags question: http://stackoverflow.com/q/24295895
tags question: http://stackoverflow.com/q/24370936
tags question: http://stackoverflow.com/q/24419211
tags question: http://stackoverflow.com/q/24278998
tags question: http://stackoverflow.com/q/24331671
tags question: http://stackoverflow.com/q/24287522
tags question: http://stackoverflow.com/q/24355313
tags question: http://stackoverflow.com/q/24322567
tags question: http://stackoverflow.com/q/24334436
tags question: http://stackoverflow.com/q/24342434
tags question: http://stackoverflow.com/q/24334849
tags question: http://stackoverflow.com/q/24315436
type: Tag
tags question: http://stackoverflow.com/q/24366780
tags question: http://stackoverflow.com/q/24349875
tags question: http://stackoverflow.com/q/24388338
tags question: http://stackoverflow.com/q/24291174
tags question: http://stackoverflow.com/q/24405666
tags question: http://stackoverflow.com/q/24293617
tags question: http://stackoverflow.com/q/24270840
tags question: http://stackoverflow.com/q/24349137
tags question: http://stackoverflow.com/q/24303341
tags question: http://stackoverflow.com/q/24298640
tags question: http://stackoverflow.com/q/24292536
tags question: http://stackoverflow.com/q/24277472
tags question: http://stackoverflow.com/q/24388525
tags question: http://stackoverflow.com/q/24380515
tags question: http://stackoverflow.com/q/24319152
tags question: http://stackoverflow.com/q/24333466
tags question: http://stackoverflow.com/q/24377211
tags question: http://stackoverflow.com/q/24417747
tags question: http://stackoverflow.com/q/24382878
tags question: http://stackoverflow.com/q/24313456
tags question: http://stackoverflow.com/q/24300746
tags question: http://stackoverflow.com/q/24326837
tag name: html
tags question: http://stackoverflow.com/q/24359036
tags question: http://stackoverflow.com/q/24273792
tags question: http://stackoverflow.com/q/24373343
tags question: http://stackoverflow.com/q/24361179
tags question: http://stackoverflow.com/q/24321638
tags question: http://stackoverflow.com/q/24361419
tags question: http://stackoverflow.com/q/24328823
tags question: http://stackoverflow.com/q/24293947
tags question: http://stackoverflow.com/q/24327787
tags question: http://stackoverflow.com/q/24327802
tags question: http://stackoverflow.com/q/24392489

http://stackoverflow.com/comment/37809829
comment on: http://stackoverflow.com/q/24426329
type: Comment
type: QuestionComment
has text: There's no significant overhead in calling a getter. And the `keySet` returned by `HashMap` is doing the same thing internally.
score: 0

http://stackoverflow.com/comment/37961755
comment on: http://stackoverflow.com/a/24401269
type: AnswerComment
has text: This is exactly what was happening. A query was taking 193 seconds to execute. I solved the problem by rewriting the extremely inefficient query to take 2 seconds.
type: Comment
score: 1

http://stackoverflow.com/a/24305503
score: 1
answers question: http://stackoverflow.com/q/24294577
upvote count: 1
has body: Get helpdesk to set up the service account and then configure your Tomcat service (via the provided control panel app or via the standard Windows services control panel) to log in as that service.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/37724083
type: QuestionComment
comment on: http://stackoverflow.com/q/24390252
score: 0
has text: Native libraries have to go in the [`LD_LIBRARY_PATH`](http://stackoverflow.com/q/6666696/2970947); not the `CLASSPATH`.
type: Comment

http://stackoverflow.com/comment/37744171
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24400787
score: 0
has text: @ElliottFrisch, As we planned to move away from perl, I don't think 'jerl' is the right way to go. Can you please suggest something for this 'unpack' alone in java ?

http://stackoverflow.com/a/24288372
accepted answer of: http://stackoverflow.com/q/24286420
type: Answer
answers question: http://stackoverflow.com/q/24286420
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37530793
type: AcceptedAnswer
downvote count: 0
has body: It looks like static-Fields are NOT filled anymore my FXMLLoader - why are you using static variables at all?

http://stackoverflow.com/comment/37749774
has text: The whole XPath expression seems pretty over-specific to me. Would `//xs:element[@ref='OtherType']` be enough or does it *really* have to be "*`xs:element[@ref='OtherType']`, only if descendant of `xs:element[@name='InnerType]`, only if descendant of `xs:element[@name='MainType']`, only if descendant of any node in the document"*?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24402963

http://stackoverflow.com/q/24273891
favorite count: 0
has body: I have a flattened multi-map (a list) of objects which I would like to convert to a list where a 'key' attribute / field (e.g. name below) is unique amongst all entries. In the case where multiple entries have the same key (name) the entry with the largest creationDate field should be picked. Example: List&lt;Object&gt; myList = [ {name="abc", age=23, creationDate = 1234L}, {name="abc", age=12, creationDate = 2345L}, {name="ddd", age=99, creationDate = 9999L} ] Should be converted to: List&lt;Object&gt; = [ {name="abc", age=12, creationDate = 2345L}, {name="ddd", age=99, creationDate = 9999L} ] Is there an elegant way (possibly using Guava libraries?) to solve this in Java? I realize I can just try and use a HashMap with name as the key to find all unique entries, but I get the feeling there is a better way to solve this. Thanks!
type: AnsweredQuestion
tagged with: guava
tagged with: java
has answer: http://stackoverflow.com/a/24274201
has title: Elegant solution for filtering a list to be unique for given object attribute
type: Question
has answer: http://stackoverflow.com/a/24274579
score: 4
accepted answer: http://stackoverflow.com/a/24274579
upvote count: 4
answer count: 3
possible better answer: http://stackoverflow.com/a/24274203
downvote count: 0
has answer: http://stackoverflow.com/a/24274203

http://stackoverflow.com/comment/37512131
has text: @user3404907 If you format your code better, you can see it better ;)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24278453
type: AnswerComment

ldap
tags question: http://stackoverflow.com/q/24389689
tags question: http://stackoverflow.com/q/24422280
tags question: http://stackoverflow.com/q/24415309
tags question: http://stackoverflow.com/q/24307517
tag name: ldap
tags question: http://stackoverflow.com/q/24311076
tags question: http://stackoverflow.com/q/24364435
type: Tag
tags question: http://stackoverflow.com/q/24273065

http://stackoverflow.com/a/24299101
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24298077
type: Answer
answers question: http://stackoverflow.com/q/24298077
has body: I'm not clear what value your JavaFileInput provides. However, to test static methods you can look at PowerMock.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37580766
upvote count: 2

http://stackoverflow.com/q/24306458
upvote count: 1
score: 1
tagged with: java
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/49198683
has body: I'm using Java 1.7. I have a class "ItemFactory" inside a .jar that allows other developers to create Item objects (item has a private constructor). The factory requires some user input to create certain items. Recently I added some items which also require input, but all the necessary data is already present in the system. I thought it would be esier for developers to let my "ItemHandler" class automatically create these items. So instead having them type this: ItemFactory factory = new ItemFactory(); Item item = factory.createItem(parameter1, parameter2); ItemHandler handler = new ItemHandler(); handler.doSomethingCool(item); They could simply do this: handler.doSomethingCool() and the doSomethingCool() method will make the item automatically from the factory because all necessary input is already present in the system. My problem is now that the facotry class suddenly has public methods that should not be visible. For example, the public method createItemForSomethingCoolPurposes(), is automatically invoked by the system itself and developers needed worry about it. It's potentially confusing for them to see this method because it's not clear what its purpose is. Adding comments/documentation to express "this method should not be called" seems stupid. Am I wrong on this? Is this a common problem, and are there conventions about it?
tagged with: public
has answer: http://stackoverflow.com/a/24306612
favorite count: 0
has title: Mark methods in class as "should not be invoked because the system already does this automatically"?
type: UnansweredQuestion

http://stackoverflow.com/comment/37687491
type: Comment
type: QuestionComment
score: 2
has text: @Freewind why are you suddenly talking about Scala?
comment on: http://stackoverflow.com/q/24370726

http://stackoverflow.com/comment/39218514
type: Comment
score: 0
has text: i have managed to solve my previous problem. i actually figured out that i do not need to have the output in a string. i have a final problem that i would want you to help me with .im posting it below.@Syam S
type: AnswerComment
comment on: http://stackoverflow.com/a/24310458

http://stackoverflow.com/comment/37664136
type: QuestionComment
comment on: http://stackoverflow.com/q/24358221
score: 0
has text: @user3164187 If I am understanding it correctly, if a number exists as the last element but has a duplicate somewhere in the middle, that number cannot be considered as the solution. So, essentially this means that you are trying to find the last distinct element of the resultset. Is that right?
type: Comment

http://stackoverflow.com/a/25460867
score: 2
has comment: http://stackoverflow.com/comment/40289916
downvote count: 0
has comment: http://stackoverflow.com/comment/40244061
has comment: http://stackoverflow.com/comment/39813265
has body: I'm afraid my previous answer was not clear enough. So here is the essence: All your worksheets except the 3rd have a resolution setting of 600. In the 3rd sheet the resolution is left blank Change the resolution of the 3rd sheet to 600 The PDF file will now be generated normally, containing all sheets. Apparently Excel can only produce PDFs where the page resolutions of all worksheets are the same. If it encounters a sheet with different (of blank) resolution it just stops producing output without giving any warning. IMHO this is a bug in Excel. Fortunately the workaround is easy. Hope this clarifies my previous answer.
upvote count: 2
has comment: http://stackoverflow.com/comment/39964471
has comment: http://stackoverflow.com/comment/39773754
answers question: http://stackoverflow.com/q/24270546
has comment: http://stackoverflow.com/comment/39731812
has comment: http://stackoverflow.com/comment/39763757
has comment: http://stackoverflow.com/comment/39809141
has comment: http://stackoverflow.com/comment/39880178
has comment: http://stackoverflow.com/comment/39933278
has comment: http://stackoverflow.com/comment/39860054
has comment: http://stackoverflow.com/comment/40248814
has comment: http://stackoverflow.com/comment/39971534
type: Answer
has comment: http://stackoverflow.com/comment/39934383
has comment: http://stackoverflow.com/comment/39813609
has comment: http://stackoverflow.com/comment/39774414
has comment: http://stackoverflow.com/comment/39752821

http://stackoverflow.com/q/24320813
type: Question
score: -2
has comment: http://stackoverflow.com/comment/37592176
accepted answer: http://stackoverflow.com/a/24320941
answer count: 3
tagged with: file-io
downvote count: 3
has answer: http://stackoverflow.com/a/24320990
upvote count: 1
has answer: http://stackoverflow.com/a/24320917
has body: I have a situation in which I want to copy the images from a directory to another directory. Also, I want the copied images to be stored with the different names. This is what I have done: public static void main(String []args) { File source = new File("/home/src"); //rest of the code File[] listOfFiles = source.listFiles(); for (int i = 0; i &lt; listOfFiles.length; i++) { File f = new File("/home/src/"+listOfFiles[i].getName()); //I want to copy all the images from src to dest boolean b1 = f.renameTo(new File("/home/dest/"+i+".jpg")); //rest of the code } } Now, the problem is, when I'm running this code, the function renameTo() is renaming the images properly, but it is moving the images from "src" directory to "dest" directory. I don't want that to happen. I want all the images in "src" directory intact. So to achieve this, what I'm currently doing is, I'm using this code as it is and at the end I'm copying all the images back from "dest" to "src" using FileUtils.copyDirectory(). A lot of googling also didn't help. Is there any way of achieving it directly? Or I need to proceed with what I'm currently doing?
has answer: http://stackoverflow.com/a/24320941
has comment: http://stackoverflow.com/comment/38023578
favorite count: 0
has title: Java renameTo() function is moving files from one location to another. How to avoid it?
linked to: http://stackoverflow.com/q/106770
has comment: http://stackoverflow.com/comment/37592360
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37592079
tagged with: java
has comment: http://stackoverflow.com/comment/37592104
possible better answer: http://stackoverflow.com/a/24320917

http://stackoverflow.com/q/24284902
favorite count: 0
has comment: http://stackoverflow.com/comment/37524383
has comment: http://stackoverflow.com/comment/37525516
has title: Why is the need for Java NIOs
score: -4
has comment: http://stackoverflow.com/comment/37652034
has comment: http://stackoverflow.com/comment/37523719
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37523757
has comment: http://stackoverflow.com/comment/37525477
tagged with: java
accepted answer: http://stackoverflow.com/a/24285003
type: Question
has comment: http://stackoverflow.com/comment/37526312
has answer: http://stackoverflow.com/a/24285191
has answer: http://stackoverflow.com/a/24285046
tagged with: nio
possible better answer: http://stackoverflow.com/a/24285191
downvote count: 4
answer count: 3
upvote count: 0
has body: I want to know what was the most promising feature delivered as part of Java NIOs which was not present in the earlier normal IOs. I know the following differences already: Java IO | Java NIOs Stream oriented | Buffer oriented Blocking IO | Non blocking IO Selectors Java NIOs greatly simplifies life in handling multiple read/write threads at the same time but let say if i had multiple CPUs/huge CPU power, then what's the advantage of NIOs over normal IOs. It was asked in one of the interview and i tried explaining it using above points but the answer didn't seem satisfactory to him.
has answer: http://stackoverflow.com/a/24285003

http://stackoverflow.com/comment/37607023
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24328823
has text: This is what databases were created for.
score: 0

http://stackoverflow.com/comment/37580949
has text: Maven dependencies should already be in the .war file under /WEB-INF/lib. The .war file is really just a .zip file, so you could unzip it to verify what you do or don't have.
comment on: http://stackoverflow.com/a/24310919
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24410104
tagged with: unmarshalling
answer count: 1
downvote count: 0
score: 1
favorite count: 0
tagged with: jaxb2
accepted answer: http://stackoverflow.com/a/24410421
type: AnsweredQuestion
has title: JAXB wrap all fields
upvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24410421
has body: Currently I have a simple class setup as: @XmlRootElement (name = "MyRoot") public class MyClass { @XmlElement (name = "String1") private String string1; @XmlTransient public String getString1() { return this.string1; } public void setString1(String string1) { this.string1 = string1; } @XmlElement (name = "String2") private String string2; @XmlTransient public String getString2() { return this.string2; } public void setString2(String string2) { this.string2 = string2; } } I want the output of the class when processed from JAXB to look like: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> ABC XYZ My questions are: Is there any way to do this without creating an inner class that is setup with @XmlRootElement(name = "MyWrapper" on it? Is this a simple limitation of JAXB? Is this a limitation of JAXB? Is is possible to write/implementation a custom marshaling and unmarshalling object of some type to deal with this type of a scenario?
tagged with: marshalling

http://stackoverflow.com/comment/37514162
has text: @m88: the cmd still display :"Could not find or load main class".
comment on: http://stackoverflow.com/q/24279620
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/47150397
comment on: http://stackoverflow.com/a/24289426
has text: I didn't knew the syntax `Foo.<String>bar()`. Is that something new to Java 8?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37529478
has text: How do you time the 100ms in webapp2 (what are the start and end points for measuring)?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24285394
score: 0

http://stackoverflow.com/a/24347985
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24347965
answers question: http://stackoverflow.com/q/24347965
has body: It can be stored as a float (single precision) or double (double precision). Both are used to store numbers with decimal point. It cannot be stored as a long because long is used to store integers. In other words, it's like a "bigger" int. One way to remember it is as "a long integer". Notice that if you want to store it as a float you should add the postfix f or F: float f = 1.3418043127890081341f; double d = 1.3418043127890081341;

http://stackoverflow.com/comment/37618462
score: 1
has text: What's the stack trace?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24333920

http://stackoverflow.com/comment/37630985
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24339574
type: AnswerComment
has text: i dont hv skype my friend, so asked to come online...no issue...see if u could solved from above my code..any help always welcome

http://stackoverflow.com/comment/37615875
type: QuestionComment
comment on: http://stackoverflow.com/q/24333394
score: 1
has text: Once a type is compiled, there is no way to modify it. As such, you can't add functionality in the way you are describing.
type: Comment

http://stackoverflow.com/q/24269798
answer count: 2
has comment: http://stackoverflow.com/comment/37495194
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24269840
has answer: http://stackoverflow.com/a/24269869
tagged with: increment
has title: Java Switch statement with increment operator
possible better answer: http://stackoverflow.com/a/24269869
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has body: int k=0; switch (k++) { case 0: System.out.println("0 is "+k); } Output: 0 is 1 Why 1? It's still in switch operator and must be incremented after exit from it.
tagged with: switch-statement
type: Question
has answer: http://stackoverflow.com/a/24269840

http://stackoverflow.com/a/38572694
answers question: http://stackoverflow.com/q/24356809
score: 1
upvote count: 5
downvote count: 4
has comment: http://stackoverflow.com/comment/64535095
has body: Just Download Servlet.jar file from below link. http://www.java2s.com/Code/Jar/s/Downloadservletapi30jar.htm add this jar file into your project using build path in eclipse.
type: Answer

http://stackoverflow.com/a/24415959
type: Answer
has body: copyFile expects the second parameter to be the destination file, not a destination directory. You need to give it the target name of the file within that directory: FileUtils.copyFile( landedtitlesFile, new File(dir, landedtitlesFile.getName()); Exception objects generally contain some information on the cause. If you print out the exception with e.printStackTrace(); (or rethrow it up the stack with throw new RuntimeException(e);) then you will be able to see what it says.
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37772508
answers question: http://stackoverflow.com/q/24415784
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24415784

http://stackoverflow.com/comment/37792228
type: Comment
comment on: http://stackoverflow.com/a/24425010
has text: I don't know about Ion library, the problem you reffered to is lazy loading and universal image loader is the best solution for it.
score: 0
type: AnswerComment

http://stackoverflow.com/a/24318057
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24317964
downvote count: 0
answers question: http://stackoverflow.com/q/24317964
type: AcceptedAnswer
has body: JTable doesn't have a border, what you're seeing is the border provided by the scroll pane (Without border/with border) This is actually (one of the reasons) why the left side of the table doesn't have a grid line ;) What you could do is apply a MatteBorder to the table Color color = table.getGridColor(); table.setBorder(new MatteBorder(0, 1, 0, 0, color)); (Without border/with border)
type: Answer
score: 3

http://stackoverflow.com/comment/37602541
comment on: http://stackoverflow.com/q/24326373
score: 0
type: Comment
type: QuestionComment
has text: What errors do you get exactly?

http://stackoverflow.com/q/24283849
tagged with: selenium-webdriver
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24286760
has title: After Generating webdriver code ,how and where to modify code
tagged with: java
has comment: http://stackoverflow.com/comment/37522684
upvote count: 1
type: Question
tagged with: testing
has comment: http://stackoverflow.com/comment/37523106
has comment: http://stackoverflow.com/comment/37521945
has comment: http://stackoverflow.com/comment/37522018
has comment: http://stackoverflow.com/comment/37523246
tagged with: eclipse
tagged with: junit
has answer: http://stackoverflow.com/a/24286760
answer count: 1
downvote count: 0
score: 1
has body: I am newbie to selenium test cases, my doubt roam between generated web driver code(java ;j-unit) and how to run that code with some changes in that code and found errors in the project before that may i know where we want to made change in the code ,what we generated already. For Eaxmple : I recorded login form page, Generated Java/Junit 4/webdriver code with verify link button from selenium IDE and i import it as package into eclipse... I add features or changes in that login form and i purpously forget to keep Link button Using selenium test what i generated before as Java/Junit 4/webdriver code , i want to print O/P as"Link button not found" package web; //import java.util.regex.Pattern; import java.util.concurrent.TimeUnit; import org.junit.*; import static org.junit.Assert.*; //import static org.hamcrest.CoreMatchers.*; import org.openqa.selenium.*; import org.openqa.selenium.firefox.FirefoxDriver; //import org.openqa.selenium.support.ui.Select; public class webdriver { private WebDriver driver; private String baseUrl; //private boolean acceptNextAlert = true; private StringBuffer verificationErrors = new StringBuffer(); @Before public void setUp() throws Exception { driver = new FirefoxDriver(); baseUrl = "http://localhost/"; driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); } @Test public void testUntitled() throws Exception { driver.get(baseUrl + "/CRM/Default.aspx"); driver.findElement(By.id("LoginMain_UserName")).clear(); driver.findElement(By.id("LoginMain_UserName")).sendKeys("Admin"); driver.findElement(By.id("LoginMain_Password")).clear(); driver.findElement(By.id("LoginMain_Password")).sendKeys("xxx"); try { assertTrue(isElementPresent(By.id("LoginMain_UserNameLabel"))); } catch (Error e) { verificationErrors.append(e.toString()); } try { assertTrue(isElementPresent(By.id("LoginMain_PasswordLabel"))); } catch (Error e) { verificationErrors.append(e.toString()); } try { assertTrue(isElementPresent(By.id("LoginMain_UserName"))); } catch …
favorite count: 0
has comment: http://stackoverflow.com/comment/37522734
has comment: http://stackoverflow.com/comment/37524292

http://stackoverflow.com/comment/37714188
type: QuestionComment
has text: I really hope for you that you just need `ISOChronology` (the default). Otherwise you get very complex state - see for example [here](http://www.joda.org/joda-time/apidocs/serialized-form.html#org.joda.time.chrono.GJChronology).
comment on: http://stackoverflow.com/q/24384765
score: 0
type: Comment

http://stackoverflow.com/q/24389533
tagged with: enums
has comment: http://stackoverflow.com/comment/37723543
tagged with: java
answer count: 6
accepted answer: http://stackoverflow.com/a/24390332
score: 0
has answer: http://stackoverflow.com/a/24389662
has answer: http://stackoverflow.com/a/24390332
has title: How to load all specific Enums to Collection? (e.g into List)
has answer: http://stackoverflow.com/a/24389948
has comment: http://stackoverflow.com/comment/37722767
has comment: http://stackoverflow.com/comment/37723663
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24389598
has body: I have an Enum: public enum SomeEnum { EXAMPLE_A(0), EXAMPLE_B(1), EXAMPLE_C(2), EXAMPLE_D(3), @Getter private int bit; SomeEnum (int bit) { this.bit= bit; } I will be using in this situation '0110' and e.g EXAMPLE_A will be connected with '0', but I don't thing it changes the answer. Its only represantion of enum. And I'd like to add those Enums from 1-3 (so in this example all exept first but i want to use this range) into some Collection. I assume with some for and ActionType(i) but it doesnt work for me, Ive just started with this kind of enums and probably lack some infos.
has answer: http://stackoverflow.com/a/24389603
type: Question
has answer: http://stackoverflow.com/a/24389604
possible better answer: http://stackoverflow.com/a/24389598

http://stackoverflow.com/q/24304619
tagged with: java
has body: code is as follows &lt; input type="checkbox" wicket:id="dsChk"/> java CheckBox dsChk = new CheckBox("dsChk"); i don't want to use following constructor CheckBox dsChk = new CheckBox("dsChk", new PropertyModel(metaCommentTechSpeedBean, "dsChk")); instead I want to add my Model via method typically something like dsChk .add[.....&lt; add modedl>.................] please help
accepted answer: http://stackoverflow.com/a/24306238
tagged with: apache
answer count: 1
has title: Apache Wicket : How to add PropertyModel to checkbox object
tagged with: wicket-1.5
score: 0
tagged with: wicket
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24306238
type: Question

http://stackoverflow.com/comment/102332000
type: AnswerComment
comment on: http://stackoverflow.com/a/24272919
type: Comment
score: 4
has text: @user666 You are using the constructor that takes a floating point value, which can have rounding errors itself. Use the constructor that takes a `String` instead: `new BigDecimal("4343.33").setScale(2, RoundingMode.DOWN)`

http://stackoverflow.com/comment/37707624
type: AnswerComment
has text: You are wrong on one point : if more than one solution exists for a given Sudoku puzzle, the puzzle is considered "invalid".
type: Comment
comment on: http://stackoverflow.com/a/24381409
score: 0

http://stackoverflow.com/q/24355833
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/37679455
answer count: 1
tagged with: libpcap
has comment: http://stackoverflow.com/comment/57571220
favorite count: 0
has title: OpenJDK 64-Bit Server VM warning: You have loaded library which might have disabled stack guard
has comment: http://stackoverflow.com/comment/37679787
tagged with: debian
tagged with: shared-libraries
score: 8
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/63826164
downvote count: 1
has comment: http://stackoverflow.com/comment/37659426
has comment: http://stackoverflow.com/comment/57557804
has body: can any one help me with this error message . while try to compile project in eclipse using jNetpcap API I followed all the steps mentioned on the website below ,how to setup the environment on Debian distribution http://jnetpcap.com/compile/debian though I still get the following error message choosedevice ... OpenJDK 64-Bit Server VM warning: You have loaded library /usr/lib/libjnetpcap.so.1.3.b0003 which might have disabled stack guard. The VM will try to fix the stack guard now. It's highly recommended that you fix the library with 'execstack -c ', or link it with '-z noexecstack'. Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/lib/libjnetpcap.so.1.3.b0003: /usr/lib/libjnetpcap.so.1.3.b0003: mauvaise classe ELF : ELFCLASS32 (Possible cause: architecture word width mismatch) at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1880) at java.lang.Runtime.loadLibrary0(Runtime.java:849) at java.lang.System.loadLibrary(System.java:1088) at org.jnetpcap.Pcap.(Unknown Source) at main.Main_app.choosedevice(Main_app.java:74) at main.Main_app.main(Main_app.java:273) By the way I tried to execute " execstac -c " it doesn't work at all Also I spent days trying to figure out the solution , the only conclusion i come up with so far , is i need to use libjnetpcap.so (64 bit) since i have 64 bit architecture on my Debian . so is that what i need to do ? PS : I can't find any ".deb" to install this library for 64 bit.
upvote count: 9
has comment: http://stackoverflow.com/comment/37679938

http://stackoverflow.com/a/24330242
has comment: http://stackoverflow.com/comment/37627888
has body: Its a pretty simple ClassNotFoundException. Make sure that the mySQL jar is present in the class-path of the project as well. You can do this by right-clicking the project, configure class-path and from there you can add the particular jar
type: Answer
answers question: http://stackoverflow.com/q/24329558
has comment: http://stackoverflow.com/comment/37633764
score: 0

http://stackoverflow.com/q/24301231
tagged with: java
has comment: http://stackoverflow.com/comment/37556825
has comment: http://stackoverflow.com/comment/37556683
tagged with: servlets
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/24301306
downvote count: 0
has answer: http://stackoverflow.com/a/24301306
has title: Stop Servlet context from initializing in init method
has comment: http://stackoverflow.com/comment/37555010
linked to: http://stackoverflow.com/q/36611392
has body: I have a servlet which is loaded on server startup 1 in the init() method of the servlet I am checking for some parameter from a properties file. If the Parameter is not there, I want to stop the Entire Context from initializing. public void init(){ Readproperty pr = new ReadProperty(); if(!pr.parameterExists()){ //Edit: throw new UnavailableException("Testing Stopping Context") } } What is the best way to do this? I do now want to Move this Code to my Context Listener Class so I am looking for the best way to do it from the `init()' method.
has comment: http://stackoverflow.com/comment/37554941
favorite count: 0
has answer: http://stackoverflow.com/a/24305615
has comment: http://stackoverflow.com/comment/37557191
has comment: http://stackoverflow.com/comment/37555157
upvote count: 1
accepted answer: http://stackoverflow.com/a/24305615
has comment: http://stackoverflow.com/comment/37562203
type: AnsweredQuestion
tagged with: servletcontextlistener
score: 1

http://stackoverflow.com/comment/37714679
type: QuestionComment
comment on: http://stackoverflow.com/q/24385479
has text: what doesn't work properly mean? what is the error you got or unexpected output?
score: 2
type: Comment

http://stackoverflow.com/a/24318624
answers question: http://stackoverflow.com/q/24318024
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: You can add a generic type parameter to ThingAccumulator, use that to move things around so that the only code Java complains about is one simple line that you can prove truly is type-safe, then suppress that warning because you know it is not a problem. Giving a type parameter to ThingAccumulator lets its fields be type checked when used together. You can push the question of "but what's the type?" outside of the constructor by taking a ThingBase&lt;A&gt; instance as the parameter instead of a Thing enum value. Then, a static factory method can handle the object construction: public class ThingAccumulator&lt;A&gt; { private final ThingBase&lt;A&gt; myThing; private SortedMap&lt;Long, A&gt; myMap; public static ThingAccumulator&lt;?&gt; create(Thing thing) { return new ThingAccumulator(ThingFactory.getThing(thing)); } protected ThingAccumulator(ThingBase&lt;A&gt; thing) { myThing = thing; myMap = myThing.getCollectionData(); myMap.put(System.currentTimeMillis(), myThing.doThing()); } } I wish Java would like the create() function. The logic could go something like this: ThingFactory.getThing() returns a ThingBase&lt;?&gt;. That's like a ThingBase&lt;X&gt; for some unknown X. Just because we don't know it doesn't mean it doesn't exist. new ThingAccumulator() can take a ThingBase&lt;X&gt;, for any X, and return a ThingAccumulator&lt;X&gt;. Now we have a ThingAccumulator&lt;?&gt; — an instance with an unknown type parameter. Type safety hasn't been broken. However, Java doesn't like it (at least in my version of Java 1.7.0). But if we like it, we can suppress the warning: @SuppressWarnings("unchecked") public static ThingAccumulator&lt;?&gt; create(Thing thing) { return new ThingAccumulator(ThingFactory.getThing(thing)); } And because all the rest of the code (so far…) is type-safe, no more warnings.
has comment: http://stackoverflow.com/comment/37606177
type: Answer
accepted answer of: http://stackoverflow.com/q/24318024

http://stackoverflow.com/comment/37794223
comment on: http://stackoverflow.com/q/24408537
score: 0
type: Comment
type: QuestionComment
has text: *"`width="0" height="0"`"* It would not surprise me in the least if a 0x0 applet was not launched at all. Increase the size and see if there are any messages in place of (where you expect to see) the applet.

http://stackoverflow.com/a/24338600
type: Answer
answers question: http://stackoverflow.com/q/24338524
score: 1
upvote count: 1
has body: Java will prefer to call the method which is furthest down the inheritance tree. Consider the following situation: class Demo { public void doSomething(ParentClass foo) { //..... } public void doSomething(ChildClass foo) { //..... } public static void main() { Demo demo = new Demo(); demo.doSomething(new ChildClass()); } } In the above situation, the method call can match either of the two methods. However, you can see intuitively that it should match the second method. You can read about the exact behavior in the java spec: http://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.12.2
downvote count: 0

http://stackoverflow.com/a/24303790
type: Answer
upvote count: 2
score: 2
has body: I think you just need to change your || (or) to &amp;&amp; (and). Otherwise, if your xp is 12 which is greater than level1xp (0), your program will set your level to level 2 immediately because of this if statement: else if (userxp &gt;= level1xp || userxp &lt; level3xp) An xp level of 12 will pass these requirements since 12 is greater than 0. Changing || or &amp;&amp; will solve this problem I think. Let me know if you have any other problems after that.
downvote count: 0
answers question: http://stackoverflow.com/q/24303710

http://stackoverflow.com/a/24371019
score: 0
answers question: http://stackoverflow.com/q/24370978
has body: Your replace all is getting rid of anything not a digit or a period. version = line.replaceAll("[^\\.\\d]" , ""); should replace anything not a digit and not a period
type: Answer

http://stackoverflow.com/a/24421958
has body: The class you have displayed, the TwoNumbers class, should have no user input in it as it should encapsulate the concept of two numbers and two numbers only. It should be written in such a way that it can be used with a Scanner program or with a GUI program without having to change it. Thus the UI should be in main or in another class.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24421937
upvote count: 1

http://stackoverflow.com/q/24354054
accepted answer: http://stackoverflow.com/a/24354576
downvote count: 0
answer count: 1
tagged with: sqoop
favorite count: 0
has title: NoSuchMethodError: JobConf.getCredentials()
has body: I am trying to import a table from MySQL to Hive. I tested that I am making the connection properly with MySQL. Now all table data also wrapped in jar. Then after I got this NoSuchMethodError. I am running MySQL on Windows 8 and Hadoop Hive is running in VirtualBox as Horton Sandbox. NoSuchMethodError for org.apache.hadoop.mapred.JobConf.getCredentials() Error: INFO: Initializing JVM Metrics with processName=JobTracker, sessionId= Exception in thread "main" java.lang.NoSuchMethodError: org.apache.hadoop.mapred.JobConf.getCredentials()Lorg/apache/hadoop/security/Credentials; at org.apache.sqoop.mapreduce.db.DBConfiguration.setPassword(DBConfiguration.java:158) at org.apache.sqoop.mapreduce.db.DBConfiguration.configureDB(DBConfiguration.java:144) at org.apache.sqoop.mapreduce.DataDrivenImportJob.configureInputFormat(DataDrivenImportJob.java:171) at org.apache.sqoop.mapreduce.ImportJobBase.runImport(ImportJobBase.java:231) at org.apache.sqoop.manager.SqlManager.importTable(SqlManager.java:600) at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:413) at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:502) at SqoopJavaInterface.importToHive(SqoopJavaInterface.java:66) at SqoopJavaInterface.main(SqoopJavaInterface.java:32) This is my source code:- import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.sqoop.tool.ImportTool; import com.cloudera.sqoop.SqoopOptions; public class SqoopJavaInterface { private static final String JOB_NAME = "Sqoop Hive Job"; private static final String MAPREDUCE_JOB = "Hive Map Reduce Job"; private static final String DBURL = "jdbc:mysql://localhost:3316/db"; private static final String DRIVER = "com.mysql.jdbc.Driver"; private static final String USERNAME = "user"; private static final String PASSWORD = "password"; private static final String HADOOP_HOME = "/home/master/apps/hadoop-1.0.4"; private static final String J…
upvote count: 3
has answer: http://stackoverflow.com/a/24354576
tagged with: hive
type: AnsweredQuestion
score: 3
tagged with: java
tagged with: mysql
type: Question
tagged with: hadoop

http://stackoverflow.com/comment/37754268
comment on: http://stackoverflow.com/q/24404583
has text: Can mention your java code where you want to access the JS value?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24399612
upvote count: 3
downvote count: 1
favorite count: 0
tagged with: super
answer count: 5
has title: super() method not giving error when no parent class is defined
has answer: http://stackoverflow.com/a/24399637
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/24399631
has answer: http://stackoverflow.com/a/24399682
tagged with: java
has answer: http://stackoverflow.com/a/24399643
has comment: http://stackoverflow.com/comment/37741916
accepted answer: http://stackoverflow.com/a/24399628
type: Question
has body: class child { child() { super(); System.out.println("Hello"); } public static void main(String arg[]) { child obj=new child(); } } In this code when I a create an object of class child , the child constructor is called. But why is it not giving error as there is no parent class. What does the super() do here? Whose constructor is the super() keyword calling?
possible better answer: http://stackoverflow.com/a/24399643
has answer: http://stackoverflow.com/a/24399628

http://stackoverflow.com/comment/37779711
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24382497
type: Comment
has text: Slight correction, they are not cast to a functional interface -- they have a target type, and a cast is *one way* to provide a target type for a lambda expression.

http://stackoverflow.com/a/24379480
type: AcceptedAnswer
has body: Try to set the whole bean as managed property. I had the same issues a while ago. This did solve it for me: @ManagedProperty(value="#{treeBean}") private TreeBean treeBean; public String getTreeBean() { return treeBean; } public void setTreeBean(TreeBean treeBean) { this.treeBean= treeBean; } Then you can access all the properties of TreeBean in SomeBean aswell. Good Luck!
type: Answer
accepted answer of: http://stackoverflow.com/q/24369192
has comment: http://stackoverflow.com/comment/37705007
score: 0
answers question: http://stackoverflow.com/q/24369192

http://stackoverflow.com/q/24391649
score: 0
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/37727984
type: UnansweredQuestion
tagged with: android
answer count: 0
has body: I have a simple Android AsyncTask with a long background action: HANDLER.post(new Runnable() { @Override public void run() { new AsyncTask&lt;Context, Integer, GameTypeAdapter&gt;() { @Override protected GameTypeAdapter doInBackground(Context... contexts) { return new GameTypeAdapter(contexts[0]);//Long database action } @Override protected void onPreExecute() { pbWaiter.setVisible(View.VISIBLE); } @Override protected void onPostExecute(GameTypeAdapter gameTypeAdapter) { txtGameName.setText(settings.getGameName()); cmbType.setAdapter(gameTypeAdapter); if (settings.getGamePlugin() != null) { cmbType.setSelection(((GameTypeAdapter) cmbType.getAdapter()).getItemPosition(settings.getGamePlugin())); } sldJoker.setProgress(settings.getJoker()); pbWaiter.setVisible(View.INVISIBLE); } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, getActivity()); } }); If the method onPostExecute is called by thread and the last line (hideWaiter) was called the execution of the UI calls are visible after 1/10 seconds (a half second in debug mode). In this time the UI hangs and the waiter animation stops. Why the UI thread stops? Thanks.
has comment: http://stackoverflow.com/comment/37726953
tagged with: java
has title: Android: AsyncTask: Long execution time after calling onPostExecute
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37727893
type: Question
has comment: http://stackoverflow.com/comment/37728280
has comment: http://stackoverflow.com/comment/37727402

http://stackoverflow.com/q/24421496
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/42401578
has title: Protect and unprotect file to avoid accidental elimination in Android by bugged cleaning apps
linked to: http://stackoverflow.com/q/5694933
tagged with: file-io
answer count: 3
has answer: http://stackoverflow.com/a/26820336
has answer: http://stackoverflow.com/a/24421609
tagged with: file-permissions
upvote count: 11
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/34428469
tagged with: android
score: 11
has body: In my Android App I save some files with some data file using FileOutputStream savedList = new FileOutputStream(Path); in a folder named myApp located in the SD storage Unfortunately I have noticed that some cleaner Apps, not well implemented, also very popular (e.g. CleanMaster) wrongly remove the files every time the user perform a temp\trash file cleaning causing problems. Is there a way to protect (and unprotect for writing) the file programmatically to avoid this? How to change file permissions? Since aren't used the file extensions to recognize the file format, how could I change the metadata of the file that are used to determine the file format so that these file are see as documents by these apps? I suppose that the scan of these Cleaners use some strategy based on Linux file format recognition and remove all object files.
tagged with: java

http://stackoverflow.com/a/24317546
type: Answer
score: 2
upvote count: 2
downvote count: 0
has body: Lets assume the worst situation for integer. We are sure that mid = (low + high)/2 can never give a overflow if we look at the bigger picture. Assuming that low = 2ˆ31 - 1 and high = 2ˆ31 - 1 ( the highest integer values) the total calculation will be [2*(2ˆ31-1)] / 2 = 2ˆ31 - 1. ( the biggest number int can hold) However the way we calculate it matters. If it is calculated using (low + high)/2 it will simply give an overflow in our situation because first it will try to sum low( 2ˆ31 -1 ) and high ( 2ˆ31 -1 ) and BAM. 2*(2ˆ31-1) is an overflow. It can not divide it by two because it can not store this value initially in an int. If it is calculated using low + (high-low)/2 it can not give an overflow . Think it that way, low + (high - low)/2 = (low + x) where x = (high - low)/2. In order to create an overflow we should pick big (in our situation biggest for int) numbers for both sides. However if we pick low the biggest, then x will be the smallest( because we are subtracting low from high in x) and vice versa.
answers question: http://stackoverflow.com/q/24317360

http://stackoverflow.com/comment/37606177
type: AnswerComment
comment on: http://stackoverflow.com/a/24318624
type: Comment
has text: I get a raw types warning on the creating of ThingAccumulator here, but I am basically going to just suppress the warnings. Moving the type parameter up a class for some reason did not really occur to me. Amazing how simple the solutions are in software despite staring at a loss for hours.
score: 0

http://stackoverflow.com/comment/37669904
comment on: http://stackoverflow.com/q/24271063
score: 1
type: QuestionComment
type: Comment
has text: I did some research and test, and H2 should allow multiple connexions as long as they come from same JVM. You should give more details on how you declare you database, and what connection pool you are using, but I allready suspect that Eclipse and Tomcat try to connect the database at the same moment which is not allowed. Could you try to run your app directly under Tomcat **without Eclipse** and stress it (more than one connection !) to see if the problem still occurs.

http://stackoverflow.com/a/24280202
type: Answer
has comment: http://stackoverflow.com/comment/37543062
answers question: http://stackoverflow.com/q/24279986
has body: Java strings are immutable i.e., you cannot change the value of the string. When you add a new string literal to the existing value, Java creates one more new string. Where as StringBuilder/StringBuffer are mutable. Hence in case of String, it creates a new literal in memory containing value "first stringsecond string", where limiting the scope to that specific method. Where in case of StringBulder it appends the string to the existing string. Nevertheless, when you pass int as a parameter, it is pass by value. Thanks, JK
has comment: http://stackoverflow.com/comment/37562196
upvote count: 2
score: 0
downvote count: 2

http://stackoverflow.com/q/24384871
tagged with: android-arrayadapter
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
score: 0
has comment: http://stackoverflow.com/comment/37713525
accepted answer: http://stackoverflow.com/a/24385040
answer count: 1
tagged with: spinner
tagged with: android
has answer: http://stackoverflow.com/a/24385040
has comment: http://stackoverflow.com/comment/37713987
has body: Hello i'm developing an app to android, that use 4 spinners, see the 'pic' below the spinners look like this: ____________________ |_option__________v_| spinner 1 ____________________ |_option__________v_| spinner 2 ____________________ |_option__________v_| spinner 3 ____________________ |_option__________v_| spinner 4 (i can't post images) The question is how can i disable the 2 3 4 spinners and set their values to default if the 1 has your value changed ( for default value ), or how i do the same if the 2 spinner has your value changed?
has title: spinner android with big padding
type: AnsweredQuestion

http://stackoverflow.com/comment/37763336
has text: I assume that you mean "a month is about 720 hours", not ***minutes***. But then, where do you get that 1425 from?
comment on: http://stackoverflow.com/q/24410771
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37780121
type: AnswerComment
comment on: http://stackoverflow.com/a/24416457
type: Comment
has text: Oh, it tries to match the regex against the whole content of your sample text, as one input. So adding $ only works in this case: http://regexr.com/392bo
score: 1

caching
tags question: http://stackoverflow.com/q/24412974
type: Tag
tags question: http://stackoverflow.com/q/24361652
tags question: http://stackoverflow.com/q/24366785
tags question: http://stackoverflow.com/q/24421172
tags question: http://stackoverflow.com/q/24378231
tags question: http://stackoverflow.com/q/24314955
tags question: http://stackoverflow.com/q/24333695
tags question: http://stackoverflow.com/q/24383781
tags question: http://stackoverflow.com/q/24378569
tags question: http://stackoverflow.com/q/24308148
tag name: caching
tags question: http://stackoverflow.com/q/24409575
tags question: http://stackoverflow.com/q/24317685
tags question: http://stackoverflow.com/q/24304943
tags question: http://stackoverflow.com/q/24333539
tags question: http://stackoverflow.com/q/24356008
tags question: http://stackoverflow.com/q/24332598

http://stackoverflow.com/a/24367121
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24366952
has body: Try the following piece of code which will clear the screen of all text before outputting number found / lost. System.out.print("Enter Number to Search: "); String get = br.readLine(); int input = Integer.parseInt(get); for(int i = 0; i &lt; 5; i++) { num[i] = inFile.nextInt(); } for(int j = 0; j &lt; 5; j++) { if(input == num[j]) { system("CLS"); System.out.println("Search number is found!"); break; } else { system("CLS"); System.out.println("Search number is lost!"); } }

http://stackoverflow.com/q/24341447
has answer: http://stackoverflow.com/a/24341500
accepted answer: http://stackoverflow.com/a/24341500
type: Question
score: 0
answer count: 2
favorite count: 0
has body: I have a class like this one: public class IClass{ public void draw(){...}; //is called periodically by the rendering thread public void foo(){...}; //is called asynchronously from another Thread(it could be an onTouchEvent() method for example) } I want the foo() method to wait until the draw method is finished and vice versa. How can I do this in Java? regards
has comment: http://stackoverflow.com/comment/37630716
has comment: http://stackoverflow.com/comment/37632767
possible better answer: http://stackoverflow.com/a/24341657
tagged with: synchronization
has title: Synchronizing two methods in Java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37632792
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/37630742
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24341657
has comment: http://stackoverflow.com/comment/37632362

http://stackoverflow.com/comment/37542380
has text: @MonkeyZeus So I tried just echoing the latitude and longitude variables in the php code, but that didn't display anything either when I tried to access it in my browser. Also, when I first restart the sapache service, it prints out the date and time to the html file even if I'm not sending data from the android app
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24293951
score: 0

http://stackoverflow.com/q/24407451
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/37756151
has answer: http://stackoverflow.com/a/24408212
has answer: http://stackoverflow.com/a/24409417
has body: I'm trying to call web from URL and show it in webview. But I got an error. I already see the logcat, but I still don'tget it what's wrong with my code. Here's My XMl code &lt;WebView android:id="@+id/adBanner1" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" /&gt; And here's my java code. private WebView adsbanner; adsbanner = (WebView) findViewById(R.id.adBanner1); startWebView("http://www.androidexample.com/media/webview/login.html"); private void startWebView(String url) { adsbanner.setWebViewClient(new WebViewClient() { //If you will not use this method url links are opeen in new brower not in webview public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } }); adsbanner.getSettings().setJavaScriptEnabled(true); adsbanner.loadUrl(url); } And here's my logcat 06-25 20:47:04.162: E/AndroidRuntime(2461): FATAL EXCEPTION: main 06-25 20:47:04.162: E/AndroidRuntime(2461): Process: com.indomultimedia.hellobali, PID: 2461 06-25 20:47:04.162: E/AndroidRuntime(2461): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.indomultimedia.hellobali/com.indomultimedia.hellobali.MainHelloballi}: java.lang.NullPointerException 06-25 20:47:04.162: E/AndroidRuntime(2461): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2282) 06-25 20:47:04.162: E/AndroidRuntime(2461): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2340) 06-25 20:47:04.162: E/AndroidRuntime(2461): at android.app.ActivityThread.access$800(ActivityThread.java:157) 06-25 20:47:04.162: E/AndroidRuntime(2461): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247) 06-25 20:47:04.162: E/AndroidRuntime(2461): at android.os.Handler.dispatchMessage(Handler.java:102) 06-25 20:47:04.162: E/AndroidRuntime(2461): at android.os.Looper.loop(Looper.java:157) 06-25 20:47:04.162: E/AndroidRuntime(2461): at android.app.ActivityThread.main(ActivityThread.java:5293) 06…
has comment: http://stackoverflow.com/comment/37756129
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37757307
favorite count: 0
type: Question
answer count: 2
tagged with: android
has comment: http://stackoverflow.com/comment/37761562
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37756131
has title: Android WebView from Url
tagged with: webview

http://stackoverflow.com/q/24399894
tagged with: uri
answer count: 1
has body: I have the following code to load all contacts with their pictures public static void getAllContactWithNumberAndNameAndPhoto(Context context, ArrayList&lt;ContactInfo&gt; mContactList, boolean starred) { ContentResolver cr = context.getContentResolver(); Cursor cur = null; if (starred == true) { cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, "starred=?", new String[] { "1" }, null); } else { cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); } if (cur.getCount() &gt; 0) { while (cur.moveToNext()) { ContactInfo item = new ContactInfo(); String id = cur.getString(cur .getColumnIndex(ContactsContract.Contacts._ID)); String name = cur .getString(cur .getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)); // Uri photo = PhoneUtils.getPhotoUriFromID(context, id); String starredValue = cur.getString(cur .getColumnIndex(ContactsContract.Contacts.STARRED)); boolean isFav = false; if (starredValue.equals("1")) isFav = true; if (Integer .parseInt(cur.getString(cur .getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) &gt; 0) { Cursor pCur = cr.query( ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?", new String[] { id }, null); while (pCur.moveToNext()) { String phoneNo = pCur .getString(pCur .getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); item.addPhone(removeCharactersFromPhoneNumber(phoneNo)); } pCur.close(); // if (photo != null) { // // item.setPhoto(photo.toString()); // } item.setName(name); item.setFavorite(isFav); item.setRecent(false); mContactList.add(item); } } cur.close(); } } and the following code to load contact picture Uri public static Uri getPhotoUriFromID(Context context, String id) { try { Cursor cur = context .getContentResolver() .query(ContactsContract.Data.CONTENT_URI, null, ContactsContract.Data.CONTACT_ID + "=" + id + " AND " + ContactsContract.Data.MIMETYPE + "='" + ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_…
has title: Effective way to load contacts with image in android
type: UnansweredQuestion
tagged with: android
tagged with: java
has answer: http://stackoverflow.com/a/24400611
has comment: http://stackoverflow.com/comment/37742740
type: Question
tagged with: android-contentprovider
tagged with: android-contacts
score: 0

http://stackoverflow.com/q/24398826
type: Question
has answer: http://stackoverflow.com/a/24399188
answer count: 1
score: 0
type: UnansweredQuestion
has title: How to specify com.google.gwt.dev.DevMode as the main class automatically when debug gwt code
has body: when I debug my gwt application code using google eclipse plugin via selected gwt module->debug as->web application, the generated debug configuration always use com.google.gwt.dev.GWTShell as the main class. This makes my debug failed as GWTShell is a deprecated class (GWT program not running). Now I have to manually change the main class to com.google.gwt.dev.DevMode in the "debug configurations" again and again whenever I need to debug. I would like to know how to make google eclipse plugin set the correct main class DevMode automatically. I am using Eclipse J2EE 4.3.2 Kepler and the gwt sdk is version 2.6.0. thanks!
linked to: http://stackoverflow.com/q/16086947
tagged with: gwt
tagged with: java
tagged with: google-eclipse-plugin
tagged with: eclipse

http://stackoverflow.com/q/24272239
has comment: http://stackoverflow.com/comment/37500271
has answer: http://stackoverflow.com/a/24275424
has body: I've been banging my head against this for a while now & have the sinking feeling I am overlooking something stupid. I'm trying to use a transaction manager for a very simple integration test, but can't seem to get it to rollback like I think it should. Class under test: public class JdbcUserDAO implements UserDAO { @Autowired private DataSource dataSource; private static final String TERM_USER_SQL = "UPDATE USER " + "SET TERM_DATE = date('now') " + "WHERE USER_NAME = ?"; @Override public void terminateUser(String userName) { try (Connection conn = dataSource.getConnection()){ PreparedStatement stmt = conn.prepareStatement(TERM_USER_SQL); stmt.setString(1, userName); stmt.executeUpdate(); } catch (SQLException e) { throw new RuntimeException("Caught SQLException in persistence service", e); } } Spring context (applicationContext.xml): <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> <tx:annotation-driven/> <property name="driverClassName" value="org.sqlite.JDBC"/> <property name="url" value="jdbc:sqlite:C:\\development.sqlite3"/> <property name="dataSource" ref="dataSource"/> Test class: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={"/applicationContext.xml"}) @TransactionConfiguration @Transactional public class JdbcUserDAOTest { @Autowired private UserDAO userDAO; @Test public void test_terminateUser() { userDAO.terminateUser("USERNAME"); } } AFAIK, defaultRollback behavior for TransactionConfiguration is "true" and default transactionManager bean name is "transactionManager", so I should be set there. I run this test and expect the "TERM_DATE" column to revert t…
favorite count: 0
has comment: http://stackoverflow.com/comment/37500655
has answer: http://stackoverflow.com/a/24283552
type: Question
answer count: 2
upvote count: 1
tagged with: spring
tagged with: spring-test
tagged with: java
accepted answer: http://stackoverflow.com/a/24283552
has title: Utilizing Spring transactionManager for integration test
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24275424
downvote count: 0
score: 1

http://stackoverflow.com/comment/37923366
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24288890
has text: I'm change a base of api opencv in C++, modify Highgui and all classes to use _wfopen before it was fopen, and convert unicode to UF8.

http://stackoverflow.com/comment/37832174
type: QuestionComment
comment on: http://stackoverflow.com/q/24366224
has text: @jarnbjo but the lead of the replacement date api, is the guy who wrote joda. So I don't think your logic really holds up there.
score: 0
type: Comment

http://stackoverflow.com/q/24353357
has comment: http://stackoverflow.com/comment/37655271
score: 0
has comment: http://stackoverflow.com/comment/37667344
linked to: http://stackoverflow.com/q/2882168
tagged with: file-io
has body: I came across a class somebody else wrote that implements a file-backed FIFO using a RandomAccessFile. The file is segmented into blocks with writes coming in from one thread and reads from another, both sharing the same RandomAccessFile object with locks to keep from trashing each others file pointers and such. This whole design is giving me some serious concerns, but I'm hesitant to redesign code that isn't blatantly failing in the field. 1a - If the code writes a block in from one thread, and immediately reads it out from another, potentially before the write posts to the disk, will the read get the whole contents of the block? 1b - Does it matter whether the file is opened "rw" or "rwd?" 2 - Are there going to be volatility issues with two threads looking at the same RandomAccessFile object such that some members of the object are stale in one thread or the other? TIA - Tim.
has title: RandomAccessFile thread safety
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37656719
tagged with: multithreading
type: Question
tagged with: java

http://stackoverflow.com/comment/37658986
comment on: http://stackoverflow.com/q/24355567
score: 0
has text: @IngoBürk Agreed; I don't see any mechanism for ensuring exclusive access to the list.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37707136
type: Comment
type: QuestionComment
score: 2
has text: Nearly all Java security issues are related to the browser plugin and thus to applets. I don't recall any serious issues when running an application server
comment on: http://stackoverflow.com/q/24381396

http://stackoverflow.com/comment/37714387
has text: Yes, I agree with that. See you another time. :)
comment on: http://stackoverflow.com/a/24347457
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24416614
has body: I would do something like this: public Boolean validEmployeeNum(string num) { if(num.length() != 5) return false; if('num.charAt(0)' &gt;= 48 &amp;&amp; 'num.charAt(0)' &lt;= 57) { if('num.charAt(1)' &gt;= 48 &amp;&amp; 'num.charAt(1)' &lt;= 57) { if('num.charAt(2)' &gt;= 48 &amp;&amp; 'num.charAt(2)' &lt;= 57) { if('num.charAt(4)' &gt;= 65 &amp;&amp; 'num.charAt(4)' &lt;= 77) { return true; } } } } return false; } Of course this is assuming that every employee number is a string that is 5 characters long.
has comment: http://stackoverflow.com/comment/37774917
has comment: http://stackoverflow.com/comment/37773699
score: 0
answers question: http://stackoverflow.com/q/24416200
type: Answer

http://stackoverflow.com/comment/40703616
type: AnswerComment
has text: Hi Braj . currently i am loading the image as `FileSystemResource res = new FileSystemResource(new File("D:/Logo.jpg"));` is it possible to load from my project structure . something like `File(/webappName/images)` ?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24272567

http://stackoverflow.com/a/24317396
upvote count: 1
has body: You can use Selenium WebDriver to: access to the page provide the seat number click on the button wait until is displayed the element that contains the value read it contains However, it is a simple website, so it may be faster to obtain the results using HtmlUnit like is explained in some answers to this question: How to programmatically access web page in java
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/24313658

http://stackoverflow.com/q/24379630
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37704297
has body: This is a homework question in relation to memory management implementation using linked lists. Each memory process requests of a particular size of memory that must be contiguously large enough to fit the memory and then allocate the process.When a job terminates,its allowed memory becomes free. Here's my java code for this: public class PartitionNode{ int beginAddress; int endAddress; boolean holeFree; int processId; PartitionNode next; public PartitionNode(int begin,int end){ beginAddress=begin; endAddress=end; holeFree=true; processId=-1; next=null; } public PartitionNode(){} public PartitionNode(int begin,int end,int i){ beginAddress=begin; endAddress=end; holeFree=false; processId=i; } } public class Partition{ private PartitionNode head; public PartitionNode current; public int begin; public int end; public PartitionNode newPartition; private Partition(int beginAddress,int endAddress){ head=new PartitionNode(beginAddress,endAddress); begin=beginAddress; end=endAddress; current=head; } public void addProcess(int size,int id){ if((current.endAddress-current.beginAddress&gt;=size)&amp;&amp; current.holeFree==true){ newPartition=new PartitionNode(current.beginAddress,current.beginAddress+size-1,id); current.next=newPartition; newPartition.next=refresh(); System.out.println("beginAddress"+newPartition.beginAddress); System.out.println("endAddress"+newPartition.endAddress); } } public void print(){ PartitionNode temp=head; while(temp.next!=null){ System.out.println(temp.processId); temp=temp.next; } } public PartitionNode refresh(){ current=new PartitionNode(newPartition.endAddress+1,end); return current; } public void deleteProcess(int process){ PartitionNode temp=head; PartitionNode temp2=head; while(temp.next!=null){ if(temp.processId==process){ temp2.next=temp.next; break; } temp2=temp; temp=temp.next; } } public static void main (String args[]){ Partition p=new Partition(300,3000); p.addProcess(500,1); p.addProcess(800,2); p.addProcess(400,3); p.deleteProcess(…
has answer: http://stackoverflow.com/a/24391105
tagged with: java
has title: Memory space allocation and deallocation implementation using a linked List
tagged with: memory
has answer: http://stackoverflow.com/a/37582747
type: UnansweredQuestion
tagged with: memory-management
tagged with: linked-list
type: Question

http://stackoverflow.com/q/24361350
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/24361454
has body: I'm trying to parse data from a php script to my Java application with a JSONArray. This is the php output: {"name":"test"} This is my Java code that I got from the JSONSimple documentation: try { String urlParameters = "test"; URL url = new URL("http://localhost:8080/Test"); URLConnection conn = url.openConnection(); conn.setDoOutput(true); OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream()); writer.write(urlParameters); writer.flush(); String line; BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); while ((line = reader.readLine()) != null) { System.out.println(line); Object obj=JSONValue.parse(line); JSONArray array=(JSONArray)obj; System.out.println(array.get(0)); } writer.close(); reader.close(); } catch (IOException e) { System.out.print("ERROR: 1"); return; } It doesn't show any errors in de editor but when I try to run the program I get the following error message: Exception in thread "main" java.lang.ClassCastException: org.json.simple.JSONObject cannot be cast to org.json.simple.JSONArray Does anybody know hot to fix this problem? Any help wil be appreciated.
has answer: http://stackoverflow.com/a/24361454
has answer: http://stackoverflow.com/a/24361421
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/24361504
has title: Java JSONSimple Parser
accepted answer: http://stackoverflow.com/a/24361421
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/comment/37621783
type: Comment
type: QuestionComment
has text: No. Use a class instead, with proper field names, methods and encapsulation.
score: 7
comment on: http://stackoverflow.com/q/24336431

http://stackoverflow.com/comment/37614241
comment on: http://stackoverflow.com/q/24328505
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Oracle: Similar to sysdate but returning only time and only date](http://stackoverflow.com/questions/7604167/oracle-similar-to-sysdate-but-returning-only-time-and-only-date)

http://stackoverflow.com/comment/37552082
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24299334
has text: @user3754645 Thanks for the recommendation, I'll be sure to check that out. I'm a classical fan, but hey, a change of pace might be nice...
score: 0

http://stackoverflow.com/comment/37640517
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24320132
has text: Basically, a single Timer would look through the array and update there positions

http://stackoverflow.com/a/24406081
answers question: http://stackoverflow.com/q/24405848
score: 1
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/37763776
has body: You are using s.next() to read the input, Hello world in which Hello and World are separated by space, which means s.next() will read the Hello token, and the World token hence goes to s.nextDouble(World) , which produces exception. Use s.nextLine() for reading , Hello World
downvote count: 0

http://stackoverflow.com/a/24356869
has body: You have to access the viewport using getViewport() method on JScrollPane then call getView() method on the returned JViewport, the Component returned should be your JTextArea, you will need to cast the component to JTextArea to be able to call setLineWrap on it ((JTextArea) item.getViewport().getView()).setLineWrap(true)
answers question: http://stackoverflow.com/q/24356547
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24356547
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/24295979
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24268457
answers question: http://stackoverflow.com/q/24268457
type: Answer
upvote count: 2
score: 2
has body: The answer is found here at the google group for Vertx: https://groups.google.com/forum/#!topic/vertx/pG7mIo3-03o In short, my JAVA_HOME variable on my windows machine was pointed to JDK 1.7 instead of 1.8.
type: AcceptedAnswer

http://stackoverflow.com/q/24366858
has comment: http://stackoverflow.com/comment/37679867
accepted answer: http://stackoverflow.com/a/24366933
type: AnsweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/37693043
tagged with: java
has answer: http://stackoverflow.com/a/24366933
type: Question
tagged with: c#
tagged with: console-application
has title: Create a Console Application in Java using netbeans?
score: 0
has body: I am .net and java developer but I don't know/remember how to open the windows console in java. What I want is quite simple. Here is the csharp System.Console.WriteLine("Hello C# 6: how is Roselyn?"); and the java System.out.prinln("Hello Java 8: How do you treat lambda expressions?."); I dont want the java program to show this message within netbean console but I want it to prompt me the windows console as c# do.
answer count: 1

http://stackoverflow.com/a/24329449
has body: You are opening the connection in the static initializer block and you are closing it at the end of the block, so whenever your class will loaded, you'll always have your connection initialized and then closed, I think you need to move out the code which you have written in the finally block.
answers question: http://stackoverflow.com/q/24329331
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24329331
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/37616973
score: 0
type: QuestionComment
type: Comment
has text: yes, but I identified it and that is how I managed to get play on my computer
comment on: http://stackoverflow.com/q/24333252

http://stackoverflow.com/comment/37641706
comment on: http://stackoverflow.com/a/24346709
type: AnswerComment
score: 0
type: Comment
has text: look at this:http://stackoverflow.com/questions/10382929/unsupported-major-minor-version-51-0

http://stackoverflow.com/comment/37502313
comment on: http://stackoverflow.com/q/24273328
has text: I don't know of one, nor can I think of how one would work. Linked lists are meant for sequential access, not random, so I believe you'll just have to loop through all items.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24338660
answer count: 1
has comment: http://stackoverflow.com/comment/37625844
favorite count: 0
has body: I'm creating rest service for mobile app in java. For storage process which is best suitable for real time storage (Hibernate , JPA &amp; JDBC). Your valuable answers will put me on right track.
tagged with: jdbc
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24338698
upvote count: 0
tagged with: jpa
has comment: http://stackoverflow.com/comment/37625802
score: -1
accepted answer: http://stackoverflow.com/a/24338698
has comment: http://stackoverflow.com/comment/37626960
has comment: http://stackoverflow.com/comment/37627413
has title: Which database is better to use for rest api

http://stackoverflow.com/q/24341324
answer count: 3
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/37630477
has answer: http://stackoverflow.com/a/24341526
tagged with: android
has body: Can you explain the following code. I do understand classes , methods in JAVA. I am not able to understand this in android. public class MainActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
has title: Understanding android classes and methods
has comment: http://stackoverflow.com/comment/37630835
has answer: http://stackoverflow.com/a/24341402
upvote count: 3
type: UnansweredQuestion
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/24341400
tagged with: java
has comment: http://stackoverflow.com/comment/37630454

http://stackoverflow.com/a/24422592
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/24421358
has comment: http://stackoverflow.com/comment/37785096
has body: Halting a JavaFX thread, will result in freezing the UI ! I hope you are not looking for it ! If you want to prioritize the data collection part, just run it on a different Worker thread(Task), which will run parallel to the JavaFX thread, and once the data collection is completed, use the runLater to update it back to the UI !
has comment: http://stackoverflow.com/comment/37786835
accepted answer of: http://stackoverflow.com/q/24421358
score: 3
has comment: http://stackoverflow.com/comment/37784820
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37784743

http://stackoverflow.com/a/76388703
score: 4
answers question: http://stackoverflow.com/q/24319697
upvote count: 4
has body: After hundreds of test through netbeans unitary test with JUnit, I realized this: if you add libraries - such as Junit and Hamcrest - AFTER creating Testing for existing class, your testing class will get No runnable methods exception in running JUnits. This is because of default imports: import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; Instead, should be: import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*; Hope junior developers with this silly problem as me, could have some peace after my comment...
downvote count: 0
type: Answer

http://stackoverflow.com/a/24373389
type: Answer
has body: Read about polymorphism! You just need to extend the base class.
answers question: http://stackoverflow.com/q/24373315
score: 0

http://stackoverflow.com/comment/37631572
has text: So what goes wrong if you just write `"/Images/tiles/" + i + ".png"` in place of the hard-coded filename?
comment on: http://stackoverflow.com/q/24341753
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37747500
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24384881
has text: @dflemstr Now I get what you need. Unfortunately, I don't know how to do it automatically.

collections
tags question: http://stackoverflow.com/q/24392551
tags question: http://stackoverflow.com/q/24291928
tags question: http://stackoverflow.com/q/24396898
tags question: http://stackoverflow.com/q/24374127
tags question: http://stackoverflow.com/q/24292543
tags question: http://stackoverflow.com/q/24314800
tags question: http://stackoverflow.com/q/24286077
tags question: http://stackoverflow.com/q/24413096
tags question: http://stackoverflow.com/q/24395958
tags question: http://stackoverflow.com/q/24279465
tags question: http://stackoverflow.com/q/24360622
tags question: http://stackoverflow.com/q/24304129
tags question: http://stackoverflow.com/q/24283379
tags question: http://stackoverflow.com/q/24370932
tags question: http://stackoverflow.com/q/24325494
tags question: http://stackoverflow.com/q/24284507
tags question: http://stackoverflow.com/q/24296208
tags question: http://stackoverflow.com/q/24345073
tags question: http://stackoverflow.com/q/24350042
tags question: http://stackoverflow.com/q/24271616
tags question: http://stackoverflow.com/q/24365990
tags question: http://stackoverflow.com/q/24378145
type: Tag
tags question: http://stackoverflow.com/q/24390991
tags question: http://stackoverflow.com/q/24361156
tags question: http://stackoverflow.com/q/24403976
tags question: http://stackoverflow.com/q/24344638
tags question: http://stackoverflow.com/q/24372139
tags question: http://stackoverflow.com/q/24373663
tags question: http://stackoverflow.com/q/24309495
tags question: http://stackoverflow.com/q/24312738
tag name: collections
tags question: http://stackoverflow.com/q/24337786
tags question: http://stackoverflow.com/q/24302925
tags question: http://stackoverflow.com/q/24275415
tags question: http://stackoverflow.com/q/24301970
tags question: http://stackoverflow.com/q/24373256
tags question: http://stackoverflow.com/q/24318202
tags question: http://stackoverflow.com/q/24380433
tags question: http://stackoverflow.com/q/24341307
tags question: http://stackoverflow.com/q/24343981

http://stackoverflow.com/a/24362096
has comment: http://stackoverflow.com/comment/37692541
type: Answer
has comment: http://stackoverflow.com/comment/37699598
has body: setDefaultCloseOperation(EXIT_ON_CLOSE); This is not allowed even in a fully trusted applet. Closing the frame would close the JVM that runs the applet that launched it. That JVM might also be running other applets. Look at it like this. The web page that hosts an applet is like a guest, while the web page is a guest house. For an applet to end the JVM is like the guest burning down the guest house while smashing out all the windows. setDefaultCloseOperation(DISPOSE_ON_CLOSE); Might 'work' (to not produce an AccessControlException), but really, no applet should be launching frames. Use a JDialog instead. As a general tip: Ensure the Java Console is configured to show for applets &amp; JWS apps. If there is no output at the default level, raise it and try again. Without the information contained in it, I doubt it would be possible to successfully develop an applet.
has comment: http://stackoverflow.com/comment/37695462
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37820366
answers question: http://stackoverflow.com/q/24344267
has comment: http://stackoverflow.com/comment/37774482
has comment: http://stackoverflow.com/comment/37740469
has comment: http://stackoverflow.com/comment/37732819
has comment: http://stackoverflow.com/comment/37783216
downvote count: 0

http://stackoverflow.com/q/24355265
has comment: http://stackoverflow.com/comment/37658281
has answer: http://stackoverflow.com/a/24355541
score: 0
downvote count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/37658501
possible better answer: http://stackoverflow.com/a/24355329
has comment: http://stackoverflow.com/comment/37658482
has comment: http://stackoverflow.com/comment/37658569
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/24355341
has answer: http://stackoverflow.com/a/24355329
has title: Kill thread on close
answer count: 4
has answer: http://stackoverflow.com/a/24355563
has comment: http://stackoverflow.com/comment/37658235
has comment: http://stackoverflow.com/comment/37658431
type: AnsweredQuestion
has body: I have a constructor of a JFrame where I have a Thread(t1) which is running thanks to a while(true) I would like to know how to implement my JFrame so it can kill the thread when I close it, because t1 need to be running when the JFrame is active EDIT: Here is the code: public class Vue_Session extends JFrame { private JPanel contentPane; private int idsess; private User u; public Vue_Session(User us, int id) { this.u = us; this.idsess = id; toServ t=new toServ(idsess); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); setBounds((int) screenSize.getWidth() / 2 - 800 + (800 / 2), 90, 800, 600); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(new BorderLayout()); Vue_Idee vueIdee = new Vue_Idee(this.idsess, this.u); contentPane.add(vueIdee, BorderLayout.SOUTH); Vue_IdeeSession vueSess = new Vue_IdeeSession(this.idsess); contentPane.add(vueSess, BorderLayout.CENTER); Thread t1 = new Thread( new Runnable(){ public void run(){ while(true){ try{ Thread.sleep(500); }catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } t.getIdee(); vueSess.act(); revalidate(); } } }); t1.start(); }
tagged with: java
has answer: http://stackoverflow.com/a/24355341
tagged with: jpanel
type: Question
upvote count: 2

http://stackoverflow.com/a/24327506
has comment: http://stackoverflow.com/comment/37611845
accepted answer of: http://stackoverflow.com/q/24324944
has comment: http://stackoverflow.com/comment/37610213
answers question: http://stackoverflow.com/q/24324944
has comment: http://stackoverflow.com/comment/37611943
has body: The fact that the allocation was cleared when you ran GC() just means a legitimate chunk of memory that would eventually have been released. If your heap is large and other allocation requests do not fail, old gen could be deferred for a while. As for the buffer, I would speculate that a JMX notification listener was registered but is not handling emitted notifications in a timely manner, but it's hard to say.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37606847
has comment: http://stackoverflow.com/comment/37608344
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/24301570
tagged with: tomcat
favorite count: 0
type: UnansweredQuestion
has body: I have a project named "test-xxx" in eclipse. When i choose Run as &gt; Run on server, a "test-xxx" folder is created in tomcat webapps folder. I want to change this folder name to deploy my project in a "test" folder, not "test-xxx", and keeping the possibility to debug/publish my application. This project is very particular and I can't rename it in eclipse. Maybe i can make a SYMLINK "test" that point to "test-xxx", but whith this hack, I need tell to tomcat to not deploy the folder "test-xxx", only test Do you have any tips for doing this or is it impossible?
score: 3
downvote count: 0
tagged with: java
has title: Change folder name in webapp when deployin in Tomcat from Eclipse
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/24301727
upvote count: 3
answer count: 1
tagged with: eclipse-wtp

http://stackoverflow.com/q/24407583
has body: I have read about maven parallel build configuration in this. So how I can display all non thread safe plugins? Is there something like "plugin-not-safe-list" command in maven? REM something like that to display all p[lugins without @threadSafe annotation mvn help:plugin-not-safe-list
score: 8
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/26451699
tagged with: java
type: Question
answer count: 2
has title: How see all non threadsafe plugins in maven?
downvote count: 0
tagged with: parallel-builds
has answer: http://stackoverflow.com/a/61231917
favorite count: 0
upvote count: 8

http://stackoverflow.com/comment/37624424
comment on: http://stackoverflow.com/q/24337909
score: 1
has text: @Pang edittext inherits textview but is not a textview
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37716433
score: 1
comment on: http://stackoverflow.com/a/24364311
type: AnswerComment
type: Comment
has text: Thanks for your help. I agree with your answer and I will try to make it work to see which is my best way of doing things.

http://stackoverflow.com/comment/37658898
has text: Just in case someone else come by: don't forget to put setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24355341
type: Comment

http://stackoverflow.com/comment/37743367
score: 0
type: Comment
type: QuestionComment
has text: @GAEfan **In my current application we are using GAE Cloud Endpoint to connect to android and web module. In this application we have seperated the datastore and memcache based on namespace(Multitentant) application. The observation which i found is that for every invocation for android or web module there is a defered queue entry in the log file. This is causing my backend instance hours being consumed. What i am failing to understand is that since i am not using Taskqueue or have made no configuration for the same how/who is triggering the defered queue, also solution**
comment on: http://stackoverflow.com/q/24388217

http://stackoverflow.com/comment/37661323
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24271063
has text: @Serge Ballesta I've confirmed with my server provider that I am not allow to run H2 in server mode, it is incompatible with my conditions.

http://stackoverflow.com/a/24362489
answers question: http://stackoverflow.com/q/24362284
score: 0
type: Answer
upvote count: 1
has body: Only the second approach uses the same synchronization object in all threads. Therefore only the second one delivers the expected results. In your first approach each thread produces its own new Object(). You have to use one central Object - SynchronizedIncrement.class or the static int x for example (possibly refactored to Integer to get an object instead of primitive). The result of your third approach is still somewhat unclear to me. This realy may be caused by printing the result before all threads have terminated.
downvote count: 1

http://stackoverflow.com/q/24358394
has title: Adding two Strings simultaneously
has answer: http://stackoverflow.com/a/24358426
has body: I want to add two strings where the output should be like if string s1="abc"; String s2="xyzwert" the output of the two Strings should be "axbyczwert" Thanks
tagged with: java
has comment: http://stackoverflow.com/comment/37664518
type: Question
score: -9
upvote count: 0
downvote count: 9
has comment: http://stackoverflow.com/comment/37664380
has comment: http://stackoverflow.com/comment/37664820
answer count: 3
has answer: http://stackoverflow.com/a/24358451
favorite count: 0
has comment: http://stackoverflow.com/comment/37664620
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37664456
has answer: http://stackoverflow.com/a/24358701

http://stackoverflow.com/q/24278179
has comment: http://stackoverflow.com/comment/37511243
upvote count: 3
has answer: http://stackoverflow.com/a/24278305
has comment: http://stackoverflow.com/comment/37511293
has comment: http://stackoverflow.com/comment/37511548
downvote count: 1
answer count: 4
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24278228
has answer: http://stackoverflow.com/a/24278281
tagged with: java
has comment: http://stackoverflow.com/comment/37511139
has comment: http://stackoverflow.com/comment/37511256
has answer: http://stackoverflow.com/a/24278275
has body: Please consider the following class: class MyClass extends Parent { private AnotherClass property; public MyClass(int value) { super(new AnotherClass(value)); this.property = new AnotherClass(value); } } class AnotherClass { /* Implementation not shown */ } class Parent { /* Implementation not shown, and may not be changed */ } Without changing the constructor parameters, (example: MyClass(AnotherClass value)), how could I structure this so that new AnotherClass() is not called twice? The following is an example of something that does not work: public MyClass(int value) { AnotherClass anotherClass = new AnotherClass(value); super(anotherClass); this.property = anotherClass; } It raises an error saying that the call to super must be the first line. I'm creating something that requires me to double dispatch, and I may not change how MyClass is instantiated. (new MyClass(0)). I may not touch the super class either. Is it possible to only call AnotherClass once?
has comment: http://stackoverflow.com/comment/37511175
type: Question
has comment: http://stackoverflow.com/comment/37511605
has answer: http://stackoverflow.com/a/24278228
has comment: http://stackoverflow.com/comment/37511177
has title: Unnest methods within super
favorite count: 0
has comment: http://stackoverflow.com/comment/37511219
has comment: http://stackoverflow.com/comment/37511710
possible better answer: http://stackoverflow.com/a/24278305

http://stackoverflow.com/q/24343681
tagged with: keytool
has title: How to convert trust certificate from .jks to .pem?
favorite count: 0
has comment: http://stackoverflow.com/comment/37635426
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37635615
has answer: http://stackoverflow.com/a/45945200
has answer: http://stackoverflow.com/a/40194333
downvote count: 1
score: 19
type: Question
upvote count: 20
tagged with: java
has comment: http://stackoverflow.com/comment/37636030
has body: I have a Java SSL server to which I want my Java SSL client and C++ SSL client to be able to connect. The Java client connects without issues. Now I want to have my C++ SSL client to be able to connect. So for this purpose ,I imagined, that I want to export the serverpub.jks to an .pem file so that my C++ client can load it into its ssl context. But this is not working. Below is a description of how I created the jks keystores for Java client and server and then how I am trying to export the serverpub.jks to .pem file. step 1: Generate the Client and Server Keystores c:\keytool -genkeypair -alias myserverkeys -keyalg RSA -dname "CN=my Server,OU=kl2217,O=kl2217org,L=NYC,ST=NY,C=US" -keypass password -keystore server.jks -storepass password c:\keytool -genkeypair -alias myclientkeys -keyalg RSA -dname "CN=my Client,OU=kl2217,O=kl2217org,L=NYC,ST=NY,C=US" -keypass password -keystore myclient.jks -storepass password step 2: Export the server public certificate and create a seperate keystore c:\keytool -exportcert -alias myserverkeys -file serverpub.cer -keystore myserver.jks -storepass spacex c:\keytool -importcert -keystore serverpub.jks -alias serverpub -file serverpub.cer -storepass password step 3: Export the client public certificate and create a seperate keystore c:\keytool -exportcert -alias myclientkeys -file clientpub.cer -keystore myclient.jks -storepass spacey c:\keytool -importcert -keystore clientpub.jks -alias clientpub -file clientpub.cer -storepass password So far so good. Now here is where I run into problems. step 4: Convert serverpub.jks to .pem format c:\keytool -importkeystore -srckeystore serverpub.jks -destkeystore serverpub.p12 -srcstoretype jks -deststoretype pkcs12 And the reply Enter destination keystore password: Re-enter new password: Enter source keystore password: Problem importing entry for alias serverpub: java.security.KeyStoreException: TrustedCertEntry not supported. Entry for alias serverpub not imported. Do you want to quit the impo…
has comment: http://stackoverflow.com/comment/37635512
tagged with: pem
answer count: 2
has comment: http://stackoverflow.com/comment/78943330
has comment: http://stackoverflow.com/comment/37635549
has comment: http://stackoverflow.com/comment/37635925

http://stackoverflow.com/a/53876370
downvote count: 0
answers question: http://stackoverflow.com/q/24407369
has body: Use use-default-filters on applicationContext.xml and mvc-dispatcher-servlet.xml. applicationContext.xml &lt;context:component-scan base-package="com.companyname"> &nbsp;&nbsp;&lt;context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/> &lt;/context:component-scan> mvc-dispatcher-servlet.xml &lt;context:component-scan base-package="com.companyname" use-default-filters="false"> &nbsp;&nbsp;&lt;context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/> &lt;/context:component-scan> Remove applicationContext.xml and mvc-dispatcher-servlet.xml reference from web.xml At applicationContext, import Security-context.xml
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/q/24287865
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: gxt
has comment: http://stackoverflow.com/comment/37724042
has answer: http://stackoverflow.com/a/24407722
type: Question
has title: GXT3 - ColumnSelectionAppearance ClassCastException
has comment: http://stackoverflow.com/comment/37746626
has body: I have trouble implementing the GridSelectionModel (using CheckBoxSelectionModel as an inspiration). I'd like to create a RadioSelectionModel but I have a ClassCastException when I call my constructor. Here's my class structure (If needed I put some code but I don't think that's necessary). I'm using list and sublist to show the classes and embedded classes : class RadioSelectionModel &lt; M &gt; extends GridSelectionModel&lt; M &gt; interface RadioColumnAppearance &lt; M &gt; class RadioColumnDefaultAppearance &lt; M &gt; interface RadioColumnStyle extends CssResource, ColumnHeaderStyles, GridDataTableStyles interface RadioColumnResources extends ClientBundle The RadioColumnAppearance is link to RadioColumnDefaultAppearance by a gwt.xml file with : &lt;replace-with class="com.app.appearance.RadioColumnDefaultAppearance"&gt; &lt;when-type-is class="com.app.grid.RadioSelectionModel.RadioColumnAppearance" /&gt; &lt;/replace-with&gt; I happened to found that the ClassCastException is when I call GWT.create( RadioColumnAppearance.class ) but I don't know what is exactly the problem and how I can solve it EDIT : Here's the RadioColumnDefaultAppearance code. I believe that the problem is in here because I only have the exception when I call GWT.create. About the error, it's a simple message I get in my browser console Uncaught java.lang.ClassCastException : public class RadioColumnDefaultAppearance &lt; M &gt; implements CheckBoxColumnAppearance&lt; M &gt; { public interface RadioColumnStyle extends CheckBoxColumnStyle { } public interface RadioColumnResources extends ClientBundle { @Source( "/css/RadioColumn.css" ) RadioColumnStyle style(); @Source( "column.png" ) @ImageOptions( repeatStyle = RepeatStyle.Vertical ) ImageResource specialColumn(); @Source( "column_checked.png" ) @ImageOptions( repeatStyle = RepeatStyle.Vertical ) ImageResource specialColumnSelected(); } private final RadioColumnResources resources; private final RadioColumnStyle style; public RadioColumnDe…
accepted answer: http://stackoverflow.com/a/24407722
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 2

http://stackoverflow.com/comment/37706017
type: Comment
type: QuestionComment
has text: Look at `String.endsWith`
comment on: http://stackoverflow.com/q/24375035
score: 0

http://stackoverflow.com/comment/37679568
comment on: http://stackoverflow.com/q/24324761
has text: Space wise and "code" wise.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37715123
comment on: http://stackoverflow.com/q/24384484
type: Comment
type: QuestionComment
has text: @BoristheSpider can u please explain how the serialization and deserialization is done for enums.Also if you could point out some loop holes,it would be of great help.
score: 0

http://stackoverflow.com/q/24331671
has body: I'm working on a desktop application using Swing. I have figured out how to log into a website using a POST request and receiving the HTML response. Now I need to send the received HTML to the default browser. Basically, displaying to the user what the browser is returning to me in the background. I have read a bit about set header, etc. So my question is, how can I post html code from java into a browser in such a manner that it displays as a website and not just text? I would love not to have to use any server (Socket) type code because I feel there is a compatibility risk if the program is run from different computers. // Log Into Website URL objtest = new URL("http://rccpdems01/ems/Login.php/Login.php"); HttpURLConnection con = (HttpURLConnection) objtest.openConnection(); con.setRequestMethod("POST"); String datas = "userid=Gt737326&amp;psword=Test&amp;btnLogin=Login"; con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(datas); wr.flush(); wr.close(); BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close();
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/37613318
has comment: http://stackoverflow.com/comment/37613548
linked to: http://stackoverflow.com/q/17246512
has comment: http://stackoverflow.com/comment/37614748
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37613236
has comment: http://stackoverflow.com/comment/37613029
tagged with: swing
has comment: http://stackoverflow.com/comment/37613389
has comment: http://stackoverflow.com/comment/37612741
has comment: http://stackoverflow.com/comment/37612611
has comment: http://stackoverflow.com/comment/37612789
type: Question
has title: Passing HTML code to browser via java
has comment: http://stackoverflow.com/comment/37612861
has comment: http://stackoverflow.com/comment/37613286
has comment: http://stackoverflow.com/comment/37612651
tagged with: java
has comment: http://stackoverflow.com/comment/37612669
has comment: http://stackoverflow.com/comment/37612546
has comment: http://stackoverflow.com/comment/37612966
has answer: http://stackoverflow.com/a/24332137
score: 0
has comment: http://stackoverflow.com/comment/37612691
has comment: http://stackoverflow.com/comment/37612920
has comment: http://stackoverflow.com/comment/37613132
answer count: 1

http://stackoverflow.com/q/24339247
type: Question
has answer: http://stackoverflow.com/a/30486585
tagged with: google-cloud-storage
answer count: 3
score: 5
has answer: http://stackoverflow.com/a/27286914
has title: Google Cloud Storage: Could not initialize class OauthRawGcsServiceFactory
downvote count: 0
favorite count: 0
upvote count: 5
type: UnansweredQuestion
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/24339348
tagged with: java
has body: I'm trying to do a simple upload and download on Appengine with Google Cloud Storage Client Library. During the execution, it returns these errors: java.lang.NoClassDefFoundError: Could not initialize class com.google.appengine.tools.cloudstorage.oauth.OauthRawGcsServiceFactory at com.google.appengine.tools.cloudstorage.GcsServiceFactory.createRawGcsService(GcsServiceFactory.java:42) at com.google.appengine.tools.cloudstorage.GcsServiceFactory.createGcsService(GcsServiceFactory.java:34) The error points to here: @Override public void doGet( HttpServletRequest request, HttpServletResponse response ) throws IOException { GcsFilename fileName = getFileName( request ); GcsInputChannel readChannel = gcsService.openPrefetchingReadChannel(fileName, 0, BUFFER_SIZE); copy(Channels.newInputStream(readChannel), response.getOutputStream()); } @Override public void doPost( HttpServletRequest request, HttpServletResponse response ) throws IOException { GcsOutputChannel outputChannel = gcsService.createOrReplace( getFileName(request), GcsFileOptions.getDefaultInstance() ); copy( request.getInputStream(), Channels.newOutputStream(outputChannel) ); } How do I solve this?

http://stackoverflow.com/a/24281631
has comment: http://stackoverflow.com/comment/37565829
answers question: http://stackoverflow.com/q/24280999
has comment: http://stackoverflow.com/comment/37560530
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/37565571
has comment: http://stackoverflow.com/comment/37560480
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37560600
has body: The following code should hopefully suffice. It uses long values to ensure we can fully represent the range of positive values that four bytes can represent. Note: this code assumes the hex input is four bytes. You may want to add some more checks and measures in production code. private static long toLong(String hex) { hex = hex.replace(" ", "") + "00000000"; byte[] data = DatatypeConverter.parseHexBinary(hex); return ByteBuffer.wrap(data).order(ByteOrder.LITTLE_ENDIAN).getLong(); } public static void main(String[] args) throws Exception { System.out.println(toLong("54 00 00 00")); System.out.println(toLong("55 F1 2E 04")); System.out.println(toLong("A2 3F 32 01")); System.out.println(toLong("FF FF FF FF")); } Output: 84 70185301 20070306 4294967295 Based on your recent edits, I propose some code such as the following. Note that it assumes your input is a multiple of four bytes in length. Any left-over bytes are ignored: File input = new File("whatever"); byte[] buffer = new byte[8]; List&lt;Long&gt; result = new ArrayList&lt;&gt;(); try (DataInputStream in = new DataInputStream(new FileInputStream(input))) { int count = 0; // Note: any trailing bytes are ignored while (count &lt; input.length() - 4) { in.readFully(buffer, 4, 4); result.add(ByteBuffer.wrap(buffer) .order(ByteOrder.LITTLE_ENDIAN).getLong()); count += 4; } }
accepted answer of: http://stackoverflow.com/q/24280999
type: Answer
has comment: http://stackoverflow.com/comment/37559257
has comment: http://stackoverflow.com/comment/37560659

http://stackoverflow.com/comment/37574305
has text: Can you quantify? Hangs for how long? Have you tried correlating mongostat output to the time in question? Do you have an index on the userid and tweetedAt?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24311262

http://stackoverflow.com/q/24412796
linked to: http://stackoverflow.com/q/24412637
type: Question
answer count: 2
tagged with: maven-3
has title: What classpath does maven set for different goals? Can you provide a link to official docs?
has answer: http://stackoverflow.com/a/24427328
has body: To what does Maven set the classpath for different goals? My issue: I have a project that I am building in Jenkins. It gets checked out form SVN. As the next thing, a different file is checked out into workspace-root/mydir/my.properties Then, maven test is run. In the test, a class loads the file by searching it on the classpath. Why does that work? (I'm new to Jenkins and maven and am trying to figure out how the job I'm looking at works...)
possible better answer: http://stackoverflow.com/a/24412984
accepted answer: http://stackoverflow.com/a/24427328
has answer: http://stackoverflow.com/a/24412984
tagged with: jenkins
score: 0
tagged with: maven
type: AnsweredQuestion
tagged with: java
tagged with: classpath

http://stackoverflow.com/q/24355189
has answer: http://stackoverflow.com/a/24355262
answer count: 2
has answer: http://stackoverflow.com/a/24355292
accepted answer: http://stackoverflow.com/a/24355292
type: AnsweredQuestion
has title: Case for Inner Classes in Java
score: 0
tagged with: java
has body: I am trying to understand the need for inner classes in Java. Author of this book I am reading, cites the following example - A particularly important use of inner classes is to make adapter classes. An adapter class is a “helper” class that ties one class to another in a very specific way. Using adapter classes, you can write your classes more naturally, without having to anticipate every conceivable user’s needs in advance. Instead, you provide adapter classes that marry your class to a particular interface. As an example, let’s say that we have an EmployeeList object: public class EmployeeList { private Employee [] employees = ... ; ... } EmployeeList holds information about a set of employees. Let’s say that we would like to have EmployeeList provide its elements via an iterator. An iterator is a simple, standard interface to a sequence of objects. The java.util.Iterator interface has several methods: public interface Iterator { boolean hasNext(); Object next(); void remove(); } It lets us step through its elements, asking for the next one and testing to see if more remain. The iterator is a good candidate for an adapter class because it is an interface that our EmployeeList can’t readily implement itself. Why can’t the list implement the iterator directly? Because an iterator is a “one-way,” disposable view of our data. It isn’t intended to be reset and used again. It may also be necessary for there to be multiple iterators walking through the list at different points. We must, therefore, keep the iterator implementation separate from the EmployeeList itself. This is crying out for a simple class to provide the iterator capability. But what should that class look like? Before we knew about inner classes, our only recourse would have been to make a new “top-level” class. We would probably feel obliged to call it EmployeeListIterator: class EmployeeListIterator implements Iterator { // lots of knowledge about EmployeeList ... } Here we have a comment representing…
possible better answer: http://stackoverflow.com/a/24355262
type: Question

http://stackoverflow.com/comment/42410937
comment on: http://stackoverflow.com/a/24339461
has text: both refer to the same thing
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37597551
type: Comment
comment on: http://stackoverflow.com/a/24323766
type: AnswerComment
has text: No it will take any no of space
score: 0

http://stackoverflow.com/q/24373663
upvote count: 0
possible better answer: http://stackoverflow.com/a/24373888
has body: I am trying to put map into another but have an error when this goes longer. Map1 Map&lt;String, String&gt; innerMap = new HashMap&lt;String, String&gt;(); Map2 Map&lt;Map&lt;String,String&gt;, List&gt; outerMap = new HashMap&lt;Map&lt;String,String&gt;, List&gt;(); Map3 Map&lt;Map&lt;Map&lt;String,String&gt;, List&gt;, List&gt; returnValueMap = new HashMap&lt;Map&lt;Map&lt;String,String&gt;, List&gt;, List&gt;(); I am trying to put map1 into map2 and then map2 into map3 but the declaration statement gives me an error. Can anyone suggest. Thanks. Map&lt;String, String&gt; innerMap = new HashMap&lt;String, String&gt;(); innerMap.put(key,value); List articleTitleList = new ArrayList(); Map&lt;Map&lt;String,String&gt;, List&gt; outerMap = new HashMap&lt;Map&lt;String,String&gt;, List&gt;(); outerMap.put(innerMap,articleTitleList); List articleList = new ArrayList(); Map&lt;Map&lt;Map&lt;String,String&gt;, List&gt;, List&gt; returnValueMap = new HashMap&lt;Map&lt;Map&lt;String,String&gt;, List&gt;, List&gt;(); returnValueMap.put(outerMap,articleList)
has comment: http://stackoverflow.com/comment/37693034
accepted answer: http://stackoverflow.com/a/24373713
has comment: http://stackoverflow.com/comment/37692963
favorite count: 0
has title: Error using nested MAP structure in Java
tagged with: dictionary
tagged with: collections
downvote count: 1
has comment: http://stackoverflow.com/comment/37693202
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37692992
tagged with: java
has answer: http://stackoverflow.com/a/24373713
score: -1
has answer: http://stackoverflow.com/a/24373888
has comment: http://stackoverflow.com/comment/37692979
has comment: http://stackoverflow.com/comment/37694144
type: Question
has comment: http://stackoverflow.com/comment/37693167
answer count: 2
tagged with: hashmap

opennlp
type: Tag
tags question: http://stackoverflow.com/q/24381095
tag name: opennlp
tags question: http://stackoverflow.com/q/24300973

http://stackoverflow.com/comment/37783084
comment on: http://stackoverflow.com/q/24421678
type: Comment
type: QuestionComment
score: 2
has text: `res` doesn't seem to be an embedded resource, have your tried using `new File("res/xml/lorem_ipsum.xml")` instead of trying to get the `InputStream`?

http://stackoverflow.com/comment/37600034
type: QuestionComment
has text: Unclear what you are asking.
score: 0
comment on: http://stackoverflow.com/q/24325135
type: Comment

http://stackoverflow.com/comment/37684136
type: Comment
comment on: http://stackoverflow.com/a/24368621
has text: you can see my answer, and tell me what I should do
score: 0
type: AnswerComment

http://stackoverflow.com/q/24386306
tagged with: java
tagged with: maven
type: Question
has body: I have downloaded both of these projects, with bitcoinj being rebased to the correct v0.11.3 tag: https://github.com/schildbach/bitcoin-wallet/ https://github.com/bitcoinj/bitcoinj The bitcoin-wallet project gets bitcoinj 0.11.3 as a dependency on a maven repo and it works nicely. Then I changed it to use system to find the local bitcoinj .jar, which I built. Ever since I did this bitcoin-wallet complains with (with errors for each import and use of undefined symbols): [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project wallet: Compilation failure: Compilation failure: [ERROR] /.../bitcoin-wallet/wallet/src/de/schildbach/wallet/util/Crypto.java:[31,31] package org.spongycastle.crypto does not exist This is odd because bitcoinj also imports org.spongycastle.crypto... and yet it builds correctly. I can't find any reference to spongycastle dependencies anywhere in the pom files for each. What is bitcoinj doing that bitcoin-wallet doesn't?
has answer: http://stackoverflow.com/a/24386890
tagged with: spongycastle
score: 0
answer count: 1
has title: "package org.spongycastle.crypto does not exist" on one project, but works fine on another
tagged with: maven-3
type: UnansweredQuestion

http://stackoverflow.com/comment/37517095
comment on: http://stackoverflow.com/q/24280989
score: 0
type: Comment
has text: How do you decide if an element is "on the list"? Does it have something like a primary key? If so, you might be better off with a `Map<Key,Element>` rather than a `List`.
type: QuestionComment

http://stackoverflow.com/a/24270257
downvote count: 0
answers question: http://stackoverflow.com/q/24270184
score: 3
accepted answer of: http://stackoverflow.com/q/24270184
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37496240
has body: extends Specifies a superclass that the generated servlet must extend This means that writing &lt;%@ page extends="Class1" %&gt; is kind of equivalent to class MyClass extends Class1 {} because JSP page is compiled to java class with similar name (depending on container). Since java does not support multiple inheritance writing more than one JSP attribute extends must be illegal.
upvote count: 3
type: Answer

http://stackoverflow.com/comment/37582702
comment on: http://stackoverflow.com/a/24315454
type: AnswerComment
score: 0
type: Comment
has text: @NathanHughes It answers where is the problem and I suggested a different way to solve the same problem using an easier way.

storage
tag name: storage
tags question: http://stackoverflow.com/q/24374526
tags question: http://stackoverflow.com/q/24344730
type: Tag

http://stackoverflow.com/a/24466396
answers question: http://stackoverflow.com/q/24368791
has body: There is extensive work in the field of pattern matching within strongly typed functional languages. The question of what it actually is has even been talked about here, on stackoverflow. The publication page of Luc Maranget contains many articles on the topic in various settings, some of which served as a basis for the OCaml pattern matching algorithm. His paper on compiling pattern matching to good decision trees could be a definitive source of inspiration for your problem. It also provides references for previous articles on the same topic. The basic principle is to describe patten matching sets as integer matrices, along with algebraic operations. I also highly recommend trying ocaml, or any sml implementation, to get a feel of that central feature of the ML language family. It might be also interesting for you to check out scala, which implements similar functionalities.
score: 0
type: Answer

http://stackoverflow.com/q/24392567
has title: How to bind with a different port
has answer: http://stackoverflow.com/a/24394205
type: Question
tagged with: bind
tagged with: rmi
tagged with: java
has answer: http://stackoverflow.com/a/24392732
accepted answer: http://stackoverflow.com/a/24392732
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/24394205
has body: I am trying to bind an object to a name using a different port than default, which is 1099. I am using Naming.bind. Naming.bind("myserver", server); I have tried all these and I always get a java.net.MalformedURLException: Naming.bind("myserver:2020", server); Naming.bind("localhost:2020/myserver", server); Naming.bind("//localhost:2020/myserver", server); How can I do it? I've looked for information everywhere and I am surprised there's nothing said about it.
type: AnsweredQuestion

http://stackoverflow.com/q/24424164
has comment: http://stackoverflow.com/comment/37787338
has comment: http://stackoverflow.com/comment/37788281
score: 0
tagged with: printing
answer count: 1
has title: Java printing dialog with Czech locale
has comment: http://stackoverflow.com/comment/37787332
has comment: http://stackoverflow.com/comment/37789183
has comment: http://stackoverflow.com/comment/37790431
has answer: http://stackoverflow.com/a/24426154
has comment: http://stackoverflow.com/comment/37789086
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17840588
has comment: http://stackoverflow.com/comment/37788888
tagged with: java
accepted answer: http://stackoverflow.com/a/24426154
has comment: http://stackoverflow.com/comment/37789644
has comment: http://stackoverflow.com/comment/37787644
has comment: http://stackoverflow.com/comment/37787565
type: Question
has body: I have problem setting locale in printing dialog in java, specifically setting Czech locale. I found solution for setting locale here and it works but it works for new Locale("es", "ES") but not for new Locale("cs", "CZ"). Can someone help me, please? I tried to set default locale too: Locale.setDefault(new Locale("cs", "CZ")); but with same result, only ES worked :(.
tagged with: locale

http://stackoverflow.com/comment/37548315
type: QuestionComment
comment on: http://stackoverflow.com/q/24296942
has text: @PerryFowler Essentially, the main project is a library and the subproject is an implementation of that library.
score: 0
type: Comment

http://stackoverflow.com/q/24306534
tagged with: java
has answer: http://stackoverflow.com/a/24307390
type: Question
possible better answer: http://stackoverflow.com/a/37325538
has title: Get a JAR File version number
score: 4
tagged with: manifest
has answer: http://stackoverflow.com/a/24307432
accepted answer: http://stackoverflow.com/a/24307432
tagged with: version
tagged with: jar
favorite count: 0
has answer: http://stackoverflow.com/a/37325538
has answer: http://stackoverflow.com/a/24306641
upvote count: 4
answer count: 4
has body: I have an application used in clustering to keep it available if one or more failed and I want to implement a way to check the version of the jar file in java. I have this piece of code to do that (e.g.: in the class MyClass) : URLClassLoader cl = (URLClassLoader) (new MyClass ()) .getClass().getClassLoader(); URL url = cl.findResource("META-INF/MANIFEST.MF"); Manifest manifest = new Manifest(url.openStream()); attributes = manifest.getMainAttributes(); String version = attributes.getValue("Implementation-Version"); When i run the jar as an application it works fine BUT when i use the jar file as a librairie in an other application, i get the version number of the other application. So my question is, how can i get the manifest of the jar where MyClass is contained ? NB : I'm not interested in solution using static constraint like 'classLoader.getRessource("MyJar.jar")' or File("MyJar.jar")
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/24355249
answers question: http://stackoverflow.com/q/24354884
has comment: http://stackoverflow.com/comment/37658498
has body: You need to construct the config inside a constructor or a method as you cannot do this elsewhere. For example: import com.avaje.ebean.config.ServerConfig; public class OrmConfig { private ServerConfig config; public OrmConfig() { config = new ServerConfig(); config.setName("mysql"); } } By the way - which IDE are you using because this is definitely showing up in Intellij. :)
score: 0
type: Answer

http://stackoverflow.com/q/24392324
has title: Glass VoiceListener causes Illegal Argument exception
tagged with: java
tagged with: google-gdk
type: Question
answer count: 1
score: 0
tagged with: google-glass
tagged with: android
has answer: http://stackoverflow.com/a/24394541
has body: So I had the GlassVoice.jar VoiceListener working on Glass until I changed a few things. One was that I upgraded Glass to XE18.11, and the other was that I moved the VoiceListener to its own thread outside of the main activity. Now when I run the code, I get the following error: 06-24 12:46:35.844: E/AndroidRuntime(5425): FATAL EXCEPTION: main 06-24 12:46:35.844: E/AndroidRuntime(5425): Process: com.myapp, PID: 5425 06-24 12:46:35.844: E/AndroidRuntime(5425): java.lang.IllegalArgumentException: Unknown URI type: 1279544898 06-24 12:46:35.844: E/AndroidRuntime(5425): at android.os.Parcel.readException(Parcel.java:1469) 06-24 12:46:35.844: E/AndroidRuntime(5425): at android.os.Parcel.readException(Parcel.java:1419) 06-24 12:46:35.844: E/AndroidRuntime(5425): at com.google.glass.voice.IVoiceService$Stub$Proxy.setConfig(Unknown Source) 06-24 12:46:35.844: E/AndroidRuntime(5425): at com.google.glass.input.VoiceInputHelper.setVoiceConfig(Unknown Source) 06-24 12:46:35.844: E/AndroidRuntime(5425): at com.myapp.voice_recognition.VoiceRecognitionThread$MyVoiceListener.onVoiceServiceConnected(VoiceRecognitionThread.java:183) 06-24 12:46:35.844: E/AndroidRuntime(5425): at com.google.glass.input.VoiceInputHelper.dispatchVoiceServiceConnected(Unknown Source) 06-24 12:46:35.844: E/AndroidRuntime(5425): at com.google.glass.input.VoiceInputHelper.access$400(Unknown Source) 06-24 12:46:35.844: E/AndroidRuntime(5425): at com.google.glass.input.VoiceInputHelper$2.handleMessage(Unknown Source) 06-24 12:46:35.844: E/AndroidRuntime(5425): at android.os.Handler.dispatchMessage(Handler.java:102) 06-24 12:46:35.844: E/AndroidRuntime(5425): at android.os.Looper.loop(Looper.java:149) 06-24 12:46:35.844: E/AndroidRuntime(5425): at android.app.ActivityThread.main(ActivityThread.java:5061) 06-24 12:46:35.844: E/AndroidRuntime(5425): at java.lang.reflect.Method.invokeNative(Native Method) 06-24 12:46:35.844: E/AndroidRuntime(5425): at java.lang.reflect.Method.invoke(Method.java:515) 06-24 12:46:3…
type: UnansweredQuestion
tagged with: voice-recognition

http://stackoverflow.com/q/24380883
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/37706275
has body: Using OpenCSV, I'm trying to write a CSV file in which Text values are surrounded by " quotes. Numerical values are not surrounded by quotes (because they should be treated as numbers, not as strings, by the program that will eventually read the CSV file). Example desired output: Format required by the program that will read the CSV file: "Header 1","Header 2","Header 3" 123.4,234.6,999.8 456456.32,1222.4,2222.2 Attempted solution: My best attempt so far is: CSVWriter csvWriter = new CSVWriter(new FileWriter(csvFile),',','\0'); where the quote char is set to '\0' i.e. the empty char (and the delimiter is left to be , as usual). This puts no quotes around any values. To make up for the lack of " quotes around the text values, I "manually" prepend and append a litteral quote "\"" to each text value (this is quite manageable, because my headers are really only the only things that have text in them). for (int i=0;i&lt;headers.length;++i) { headers[i] = "\"" + headers[i] + "\""; } Actual output: I really thought this would nail it, but the output looks like this: ""Header 1"",""Header 2"",""Header 3"" 123.4,234.6,999.8 456456.32,1222.4,2222.2 Text values are enclosed in double quotes ""! Why? How do I fix this?
type: Question
tagged with: export-to-csv
has comment: http://stackoverflow.com/comment/37706762
answer count: 2
possible better answer: http://stackoverflow.com/a/24381089
has answer: http://stackoverflow.com/a/24381448
has answer: http://stackoverflow.com/a/24381089
has comment: http://stackoverflow.com/comment/37707088
has comment: http://stackoverflow.com/comment/37706869
duplicate of: http://stackoverflow.com/q/14531827
downvote count: 0
tagged with: opencsv
favorite count: 0
accepted answer: http://stackoverflow.com/a/24381448
has comment: http://stackoverflow.com/comment/37707461
tagged with: http://stackoverflow.com/tag/csv
has title: Write CSV with text in quotes, but numerical values without quotes
has comment: http://stackoverflow.com/comment/37706092
type: AnsweredQuestion
score: 3
linked to: http://stackoverflow.com/q/14531827

http://stackoverflow.com/comment/37831742
has text: Version 5.x - this is the branch. Please get the tag from [here](https://github.com/uberfire/uberfire/releases/tag/0.5.0.20140419-M1). Please let me know the results of the pre-built war deployment. And you may face issues with version 5 as well as version 6. 4 is far stable then those versions. You can try the latest tags of all versions [here](https://github.com/uberfire/uberfire/releases)
type: QuestionComment
comment on: http://stackoverflow.com/q/24422230
score: 0
type: Comment

http://stackoverflow.com/comment/37691665
type: QuestionComment
has text: Don't use "fill_parent" use "match_parent", also, padding=0dp is not needed in the LinearLayout (0 is the default). The ListView should match_parent height but without seeing the full XML is hard to tell what your listview is doing. Post a screenshot of the effect.
comment on: http://stackoverflow.com/q/24372535
score: 0
type: Comment

http://stackoverflow.com/q/24322195
answer count: 5
has body: I need to validate some simple forms in my application. In these forms I have one or two input text to validate so I'd like to not create a specific ModelAttribute class for every form. I'd like to use instead plain HTML form and use @RequestParam annotations to handle POST parameters. Is there a way to use Spring form validation in this situation (without using model attribute) or should I implement a backing-form object and a validator for each form?
has answer: http://stackoverflow.com/a/24322774
upvote count: 4
possible better answer: http://stackoverflow.com/a/24322343
has answer: http://stackoverflow.com/a/24322343
has answer: http://stackoverflow.com/a/24323239
has title: Spring form validation for plain HTML form
has answer: http://stackoverflow.com/a/24322400
type: AnsweredQuestion
tagged with: validation
downvote count: 0
accepted answer: http://stackoverflow.com/a/24322774
favorite count: 0
type: Question
tagged with: spring
tagged with: spring-mvc
score: 4
has answer: http://stackoverflow.com/a/24322585
tagged with: java

http://stackoverflow.com/a/24279740
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24279709
answers question: http://stackoverflow.com/q/24279709
type: Answer
has comment: http://stackoverflow.com/comment/37514134
has body: Serialize your Data and store it using flatfiles. But why dont you want to use SQlite? Serializing and storing to the disk is a database aswell. If you want to serialize it there are a few tutorials and code examples around. check How to serialize an object into a string for example. If you want to use a proper database (which is recommend!) you may check different databases and examples at Java and SQLite
has comment: http://stackoverflow.com/comment/37514153

http://stackoverflow.com/comment/37769010
type: QuestionComment
type: Comment
score: 2
has text: The seemingly random use of `save` vs `saveOrUpdate` is not doing you any favours. Without generics, you are also resorting to casting, which introduces runtime type errors. I would seriously consider rewriting this class in a generic way - and if possible using JPA criteria queries. `List` - i.e. the `List` rawtype should never been seen in modern Java.
comment on: http://stackoverflow.com/q/24414132

nullpointerexception
tags question: http://stackoverflow.com/q/24378709
tags question: http://stackoverflow.com/q/24365370
tags question: http://stackoverflow.com/q/24415634
tags question: http://stackoverflow.com/q/24327834
tags question: http://stackoverflow.com/q/24354288
tags question: http://stackoverflow.com/q/24314213
tags question: http://stackoverflow.com/q/24382306
tags question: http://stackoverflow.com/q/24347129
tags question: http://stackoverflow.com/q/24270777
tags question: http://stackoverflow.com/q/24271743
tags question: http://stackoverflow.com/q/24427448
tags question: http://stackoverflow.com/q/24376192
tags question: http://stackoverflow.com/q/24410073
tags question: http://stackoverflow.com/q/24302783
type: Tag
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/24327226
tags question: http://stackoverflow.com/q/24419303
tags question: http://stackoverflow.com/q/24355246
tags question: http://stackoverflow.com/q/24378404
tags question: http://stackoverflow.com/q/24407434
tags question: http://stackoverflow.com/q/24368240
tags question: http://stackoverflow.com/q/24319333
tags question: http://stackoverflow.com/q/24313160
tags question: http://stackoverflow.com/q/24355827
tags question: http://stackoverflow.com/q/24292272
tags question: http://stackoverflow.com/q/24396441
tags question: http://stackoverflow.com/q/24349632
tags question: http://stackoverflow.com/q/24391944
tags question: http://stackoverflow.com/q/24382069
tags question: http://stackoverflow.com/q/24375795
tags question: http://stackoverflow.com/q/24406883
tags question: http://stackoverflow.com/q/24338443
tags question: http://stackoverflow.com/q/24361442
tags question: http://stackoverflow.com/q/24346186
tags question: http://stackoverflow.com/q/24317713
tags question: http://stackoverflow.com/q/24288793
tags question: http://stackoverflow.com/q/24277734
tags question: http://stackoverflow.com/q/24318064
tags question: http://stackoverflow.com/q/24360417
tags question: http://stackoverflow.com/q/24270760
tags question: http://stackoverflow.com/q/24285366
tags question: http://stackoverflow.com/q/24267533

http://stackoverflow.com/a/24382886
type: Answer
accepted answer of: http://stackoverflow.com/q/24382740
score: 0
has body: Don't know why, but after submitting the question, I had a flash: The trailing space in the snipet was the key: &lt;t:inputText value="#{interlocuteur.commercial.nom} " id="pop_out_4365" /&gt; Not a problem for an outputText, but inputText don't like it. Sorry for bothering you.
answers question: http://stackoverflow.com/q/24382740
type: AcceptedAnswer

http://stackoverflow.com/a/24396419
downvote count: 0
answers question: http://stackoverflow.com/q/24395958
type: Answer
score: 2
upvote count: 2
has body: In Java 8, this would probably just be map.merge(key, value, (left, right) -&gt; left.compare(right) &gt; 0 ? left : right);

http://stackoverflow.com/comment/37562062
type: Comment
score: 0
type: AnswerComment
has text: Works, thanks! This would go great in the plugin's README file.
comment on: http://stackoverflow.com/a/24304828

http://stackoverflow.com/q/24400775
has body: I have 3 SelectOneChoice which are not to datacontrol, depending on the value of first SelectOneChoice the other 2 SelectOneChoice should show and hide. I used manged bean and i used valueChangeListener for the first SelectOneChoice to hide and show the other 2 SelectOneChoice based on the selection, and partial in the other 2 SelectOneChoice but it did not work here is the first SelectOneChoice &lt;af:selectOneChoice label="acnt type" id="soc10" valueChangeListener="#{backingBeanScope.JasperBean.hideShowAccounts}" autoSubmit="true" required="true" contentStyle="width:118px"&gt; &lt;af:selectItem label="Cultural Division Accounts" value="CA" id="si12"/&gt; &lt;af:selectItem label="Students Accounts" value="SA" id="si13"/&gt; &lt;/af:selectOneChoice&gt; here are the other 2 SelectOneChoice &lt;af:selectOneChoice label="bb" valueChangeListener="#{backingBeanScope.JasperBean.storeAccount}" id="soc11" autoSubmit="true" partialTriggers="soc10"&gt; &lt;af:selectItem label="Select Account" value="-1" id="si220"/&gt; &lt;f:selectItems value="#{backingBeanScope.JasperBean.accounts}" id="si1"/&gt; &lt;/af:selectOneChoice&gt; &lt;af:selectOneChoice label="aa" valueChangeListener="#{backingBeanScope.JasperBean.storeAccount}" id="soc12" autoSubmit="true" partialTriggers="soc10" rendered="#{backingBeanScope.JasperBean.saShown}"&gt; &lt;af:selectItem label="Select Account" value="-1" id="si221"/&gt; &lt;f:selectItems value="#{backingBeanScope.JasperBean.studentAccounts}" id="si121"/&gt; &lt;/af:selectOneChoice&gt; here is the managed bean code. public void hideShowAccounts(ValueChangeEvent valueChangeEvent) { if(valueChangeEvent.getNewValue().toString().equals("CA")) { ddlCAaccounts.setRendered(true); ddlSAaccounts.setRendered(false); } else if(valueChangeEvent.getNewValue().toString().equals("SA")) { ddlCAaccounts.setRendered(false); ddlSAaccounts.setRendered(true); } } if it can be done using javascript also tell me how, not necessary that is done in managed bean
type: Question
type: AnsweredQuestion
tagged with: java
has title: hide show componant in adf
answer count: 1
has answer: http://stackoverflow.com/a/28343800
score: 0
has comment: http://stackoverflow.com/comment/37935711
tagged with: oracle-adf
tagged with: managed-bean
accepted answer: http://stackoverflow.com/a/28343800

http://stackoverflow.com/q/24356317
has body: What I need to do is to connect to Wikipedia and extract the text in the area above the list with contents, also if possible the information (see picture below). There are some options: JWPL, Bliki, JSoup. I tried Bliki, but couldn't get the information from (see picture) and couldn't change to swedish. JSoup seems fairly easy, however since it's not build specific for wikipedia there isn't any easy way to get the content in the page I'm after. Using JSoup I can get the HTML document very easy, but can't find out how to get only the part I want as plain text. Document doc = Jsoup.connect("http://sv.wikipedia.org/wiki/Stockholm").get(); Element contentDiv = doc.select("div[id=content]").first(); System.out.println(contentDiv.toString()); Using this Bliki code return a document formatted in plain text, which is great, however it doesn't include information from the picture below. And MOST important not in swedish, because I don't know how to change that. String[] listOfTitleStrings = { "Stockholm" }; User user = new User("", "", "http://en.wikipedia.org/w/api.php"); user.login(); List&lt;Page&gt; listOfPages = user.queryContent(listOfTitleStrings); PlainTextConverter p = new PlainTextConverter(); for (Page page : listOfPages) { WikiModel wikiModel = new WikiModel("${image}","${title}"); String text = wikiModel.render(p, page.toString()); System.out.println(text); } Will be running on Android. Edit: Maybe I wasn't clear enough that this must work on all wikipedia pages.
has answer: http://stackoverflow.com/a/24356439
accepted answer: http://stackoverflow.com/a/24356439
has comment: http://stackoverflow.com/comment/37670010
tagged with: android
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jsoup
has title: Connecting to swedish Wikipedia to extract information
tagged with: bliki
score: 0
answer count: 1

http://stackoverflow.com/q/24276404
tagged with: enums
tagged with: java
tagged with: jaxb
upvote count: 4
has comment: http://stackoverflow.com/comment/37508551
has comment: http://stackoverflow.com/comment/50715455
has body: The background problem is when we reflect on a JAXB generated Enum class, toString() is called which without an @override of toString() will return .name() instead of .value(). So, I would like to inject my own toString(). I am unable to inject code into a JAXB generated Enum class. Although, I am able to inject code at the top level complexType and but not in the inline Enum class. Here is the section of the XSD in question seen below (I have tried absolute and relative): &lt;jxb:bindings node="/xs:schema/xs:complexType[@name='QueryPgm']/xs:sequence/xs:element[@name='STATUS']/xs:simpleType"&gt; I use these args: "-verbose -Xinject-code -extension" No errors appear and the output is: parsing a schema... compiling a schema... [INFO] generating code unknown location com/ibm/query/pgm/ObjectFactory com/ibm/query/pgm/QueryPgm com/ibm/query/pgm/package-info Here is the section of the schema in question: &lt;xs:complexType name="QueryPgm"&gt; &lt;xs:sequence&gt; &lt;xs:element name="NAME" type="tns:nameOptions" minOccurs="1" maxOccurs="unbounded" /&gt; &lt;xs:element name="SHOW" minOccurs="0" maxOccurs="unbounded"&gt; &lt;xs:simpleType&gt; &lt;xs:annotation&gt; &lt;xs:appinfo&gt; &lt;jxb:typesafeEnumClass name="showOptions"/&gt; &lt;/xs:appinfo&gt; &lt;/xs:annotation&gt; &lt;xs:restriction base="xs:string"&gt; &lt;xs:enumeration value="ALL" /&gt; &lt;/xs:restriction&gt; &lt;/xs:simpleType&gt; &lt;/xs:element&gt; &lt;xs:element name="STATUS" minOccurs="0" maxOccurs="unbounded"&gt; &lt;xs:simpleType&gt; &lt;xs:annotation&gt; &lt;xs:appinfo&gt; &lt;jxb:typesafeEnumClass name="statusOptions"/&gt; &lt;jxb:bindings node="/xs:schema/xs:complexType[@name='QueryPgm']/xs:sequence/xs:element[@name='STATUS']/xs:simpleType"&gt; &lt;ci:code&gt; @Override public String toString() { return this.value();} &lt;/ci:code&gt; &lt;/jxb:bindings&gt; &lt;/xs:appinfo&gt; &lt;/xs:annotation&gt; &lt;xs:restriction base="xs:string"&gt; &lt;xs:enumeration value="DB-NOTAVL" /&gt; &lt;xs:enumeration va…
downvote count: 0
has comment: http://stackoverflow.com/comment/50762649
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37508520
favorite count: 0
has comment: http://stackoverflow.com/comment/37547168
type: Question
has answer: http://stackoverflow.com/a/55857970
score: 4
has title: JAXB Code Inject into Enum Class
tagged with: xsd
answer count: 1
tagged with: tostring

http://stackoverflow.com/comment/37534752
type: Comment
score: 1
has text: *When a method is not intended to be used polymorphically, and it can be static, then I make it static.* - This will get you in trouble when you start using mock frameworks for unit testing. But this leads us to a different topic ...
type: AnswerComment
comment on: http://stackoverflow.com/a/24289499

http://stackoverflow.com/q/24354884
tagged with: ebean
tagged with: maven
has comment: http://stackoverflow.com/comment/37657466
has comment: http://stackoverflow.com/comment/37657949
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24354914
tagged with: java
downvote count: 1
has title: Cannot create new Object from Maven dependency
type: Question
answer count: 2
upvote count: 0
tagged with: intellij-idea
score: -1
tagged with: class
accepted answer: http://stackoverflow.com/a/24354914
possible better answer: http://stackoverflow.com/a/24355249
favorite count: 0
has body: I'm trying to make an Ebean ServerConfig as explained here: http://www.avaje.org/ebean/getstarted_programmatic.html But, when in my project I create a new ServerConfig object, I cannot access the methods in it. package controller; import com.avaje.ebean.config.ServerConfig; public class ormConfig { ServerConfig config = new ServerConfig(); config.setName("mysql"); } No expection, no hint from the IDE. Only an error from the compiler: "Error:(14, 19) java: &lt;identifier> expected" https://gist.github.com/Szil/f65bc2d7180d2ae49ad5 Included the pom.xml in the Gist. I have no idea where the problem is. A bit newbie in Maven and not exactly expert in Java, but simply creating a new object shouldn't be a problem most of the time.
has answer: http://stackoverflow.com/a/24355249

http://stackoverflow.com/comment/39579607
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25135413
has text: I can't help to get the feeling that Scoreoid is dying... even the Help & Support doesn't work anymore.. Can you or anyone else suggest an alternative online high-score management system for a desktop game? I'd really like to use Google Play Game Services, but unfortunately they are not available for desktop games, as far as I know.

http://stackoverflow.com/a/24342967
has comment: http://stackoverflow.com/comment/37633839
has body: I think this splits the input the way you want it. Spitting on "" treats each digit as a separate String. However, that generates on extra empty String before the first digit. The copyOfRange drops the extra. import java.util.Arrays; public class Test { public static final void main(String[] args) throws InterruptedException { String[] raw = "01234".split(""); String[] strArray = Arrays.copyOfRange(raw, 1, raw.length); System.out.println(Arrays.toString(strArray)); } } prints: [0, 1, 2, 3, 4]
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24342856
type: Answer
answers question: http://stackoverflow.com/q/24342856
downvote count: 0
score: 1

jboss6.x
tag name: jboss6.x
type: Tag
tags question: http://stackoverflow.com/q/24274125

http://stackoverflow.com/comment/37516620
has text: Maybe you should use SQLite to save this data? It's better way to store arrays of data
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24280823
score: 0

http://stackoverflow.com/q/24278647
accepted answer: http://stackoverflow.com/a/24278690
answer count: 4
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
linked to: http://stackoverflow.com/q/5543661
has comment: http://stackoverflow.com/comment/37512160
type: Question
duplicate of: http://stackoverflow.com/q/5543661
has comment: http://stackoverflow.com/comment/37511995
has comment: http://stackoverflow.com/comment/37512035
has answer: http://stackoverflow.com/a/24278679
has body: If I want to calculate 76/266 = 28.57% in Java, what's the best data type to use? So far, I have: int x = 76; int y = 266; float z = (x * 100) / y; But doing this, I get 28.0 as an answer. I need to get an answer rounded to the nearest hundredth place. Thanks.
has answer: http://stackoverflow.com/a/24278690
has title: Calculating percentage in Java
has answer: http://stackoverflow.com/a/24278761
possible better answer: http://stackoverflow.com/a/24278706
has comment: http://stackoverflow.com/comment/37511980
downvote count: 0
has answer: http://stackoverflow.com/a/24278706
favorite count: 0
has comment: http://stackoverflow.com/comment/37512049

http://stackoverflow.com/comment/37711827
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24368738
has text: i cant believe it - this really helped ... thousand thanks!! still not clear why it worked at home then, wouldnt mind if anyone could explain this ... maybe some MMU / MPU issues?

http://stackoverflow.com/comment/37782642
has text: Voting to close this question.
comment on: http://stackoverflow.com/q/24393023
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24335630
has comment: http://stackoverflow.com/comment/37695354
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24337954
has comment: http://stackoverflow.com/comment/37620240
has comment: http://stackoverflow.com/comment/37620159
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24335816
has comment: http://stackoverflow.com/comment/37695277
linked to: http://stackoverflow.com/q/7697213
has comment: http://stackoverflow.com/comment/37620744
tagged with: hash
has title: equals method returns true for two objects hash method returns different value for two objects is that OK
has body: I have an unusual requirement to implement. I need to store several objects in a Set. Let's use this simple class as an example - class Name { String first; String last; String middle; } My business rule is that two Name objects are considered equal if the first, last, and middle fields are all equal OR if first and last fields are equal and one (or both) of the objects has null for the middle field. So in implementing the hash and equals methods for my Name class I could have a use cases where equals returns true for the two objects but the hash for the two objects returns a different value (because one object has a value for middle and the other object has null for middle). The actual Set implementation I use cannot be HashSet because HashSet uses the hash method to determine whether or not to add the object to the Set. In my example the hash method will return a different value for these two objects name1 (first=Bruce, last=Phillips, middle=Allen) and name2 (first=Bruce, last=Phillips, middle=null) even though my equals method will return true for the two objects. My plan is to use TreeSet and have my Name class implement comparable. I don't really care about the order of Name class objects in my TreeSet but by using TreeSet and implementing comparable's compareTo method I can use the equals method in class Name (which checks if one of the objects has null for middle field) to determine if the two object's are equal. Any drawbacks to this approach to solving my requirement? Thank you for the help. Bruce
tagged with: equals
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37695469

http://stackoverflow.com/comment/37502391
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24273064
has text: Your code compiles with me. Try to clean your whole project and rebuild it
type: AnswerComment

http://stackoverflow.com/comment/37767324
type: Comment
type: QuestionComment
has text: I think the answer is yes, but if you are interested in *how*, you should say how exactly you make the difference between dev and prod environments.
score: 0
comment on: http://stackoverflow.com/q/24412968

http://stackoverflow.com/comment/37572330
score: 0
has text: I should say without physically downloading the file and saving to my hard drive.
comment on: http://stackoverflow.com/q/24310407
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24387033
type: Answer
answers question: http://stackoverflow.com/q/24301272
score: 0
has body: Usually this problem is solved by creating some network shared folder which is accessible from both app server and database server. The path of the folder as it is seen by database server is a configuration parameter (store it wherever you store other parameters in you application). The only important thing is that application server should know this path so it can construct correct query. Usually you have some ImportService which responsibility is to import data. It should get file and move or copy file to that shared folder and then invoke mapper. public void import() { copyFileToSharedFolderAccessibleByDatabaseServer(); mapper.importData(); } Before calling mapper method this service should get this configuration parameter and construct correct path and pass it to mapper. In your query either pass full path or path to folder and file name(s) like this: interface MyMapper { void importData(@Param("importFilesFolder") String importFileFolder, @Param("importFile") String importFile, @Param("formatFile") String formatFile); } In MyMapper.xml: BULK INSERT TABLENAME FROM ${imporFilesFolder}\${importFile} WITH ( FIELDTERMINATOR = '|', FORMATFILE = ${imporFilesFolder}\${formatFile} );
has comment: http://stackoverflow.com/comment/37739579

http://stackoverflow.com/comment/37734323
score: 0
type: AnswerComment
has text: Is there a way to tell this pattern instead of replace `-` by an empty string, only remove it if there is two of them together `--` ?
type: Comment
comment on: http://stackoverflow.com/a/24395474

http://stackoverflow.com/a/24367932
type: Answer
has body: It looks like you need to delay running your code to set the window size until after the asynchronous code queued by the e4 WBWRender class has run. As there does not seem to be a suitable event to use you could just schedule a UIJob to run a bit later: UIJob job = new UIJob("set size") { @Override public IStatus runInUIThread(IProgressMonitor monitor) { window.setWidth(800); return Status.OK_STATUS; } }; job.schedule(2000); Two seconds seems about the shortest that works for me - all a bit of a bodge really!
accepted answer of: http://stackoverflow.com/q/24363770
answers question: http://stackoverflow.com/q/24363770
score: 0
has comment: http://stackoverflow.com/comment/37705616
type: AcceptedAnswer

performance-testing
tags question: http://stackoverflow.com/q/24297856
tag name: performance-testing
type: Tag

http://stackoverflow.com/a/24378913
has comment: http://stackoverflow.com/comment/37706525
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/24364936
upvote count: 1
has body: In the constructor for CycleStrategy you can pass in parameters to specify whether to use "id" as the attribute to identitfy elements or something else. Here the exception is caused because it noticed two elements with the same "id". Try this CycleStrategy s = new CyctleStragegy("myid", "myreference") It will work.

http://stackoverflow.com/a/24325482
type: Answer
has body: If you're just forwarding requests and responses you don't have any need to engage in the HTTP protocol at all beyond the first line of the request. If the client knows you're the proxy you will get either a GET request with the full URL or else a CONNECT request ditto. All you have to do is connect to the target and then just copy bytes in both directions simultaneously.
answers question: http://stackoverflow.com/q/24321008
score: 0
has comment: http://stackoverflow.com/comment/37669919

http://stackoverflow.com/a/24374607
has comment: http://stackoverflow.com/comment/37718106
has comment: http://stackoverflow.com/comment/37767521
downvote count: 0
score: 1
has body: I want to post this in a comment but I don't have enough reputation. I tried your method to delete files and it is ok but if you can delete the "output.txt" file should be because there is an object using the file it seems that you close all the streams but checking the code I saw that you use a Scanner object to get the appName maybe that could be the problem because the Scanner object is pointing to your "output.txt" file. Change this: String appName = new Scanner(new File("output.txt")).useDelimiter("\\Z").next(); for something like this: Scanner scanObject = new Scanner(new File("output.txt")); String appName = scanObject.useDelimiter("\\Z").next(); scanObject.close(); I'm not sure about new Scanner(new File("output.txt")); I think the scanObject.close() should close also the File object that you are passing to the Scanner object if not, try to separate that also and close the File object after use the scanner.
answers question: http://stackoverflow.com/q/24340973
upvote count: 1
type: Answer

http://stackoverflow.com/a/29112080
type: Answer
has body: This problem is caused by a bug in java plugin in chrome, it's already reported, i had to restrict my applet on Firefox users only unfortunately. hoping for future NPAPI updates and fixes.
score: 0
answers question: http://stackoverflow.com/q/24318390

http://stackoverflow.com/comment/37716972
score: 5
comment on: http://stackoverflow.com/q/24386621
type: Comment
type: QuestionComment
has text: This is not a good question for SO. This information is readily available on the Internet and should be be researched if you actually want to learn about it (and then more specific questions could be asked as needed). http://www.eclipse.org/aspectj/doc/released/devguide/ltw.html Quickly though...it is AOP, it's application of AOP. If you don't understand AOP then you won't understand LTW.

http://stackoverflow.com/q/24398701
tagged with: java
has title: Concept to Transfer Rater per Second while downloading
type: Question
duplicate of: http://stackoverflow.com/q/24377819
upvote count: 0
score: -2
linked to: http://stackoverflow.com/q/24377819
favorite count: 0
has comment: http://stackoverflow.com/comment/37740048
answer count: 1
has answer: http://stackoverflow.com/a/24398702
has body: i am being given a task from my senior to come out with a function to show size transfer rate per second. I have to download a file from web with my java code and display the transfer rate per second while downloading the file. please note the code below is not totally mine, it was taken from here The code below only can calculate transfer rate after the download has finished, but i currently have no idea how to make the code to display transfer rate every second, any conceptual idea or code suggestion? public static void main(String argc[]) throws Exception { long totalDownload = 0; // total bytes downloaded final int BUFFER_SIZE = 1024; // size of the buffer byte[] data = new byte[BUFFER_SIZE]; // buffer BufferedInputStream in = new BufferedInputStream( new URL( "http://ipv4.download.thinkbroadband.com:8080/5MB.zip" + "") .openStream()); int dataRead = 0; // data read in each try long startTime = System.nanoTime(); // starting time of download while ((dataRead = in.read(data, 0, 1024)) &gt; 0) { totalDownload += dataRead; // adding data downloaded to total data System.out.println(totalDownload); } /* download rate in bytes per second */ float bytesPerSec = totalDownload / ((System.nanoTime() - startTime) / 1000000000); System.out.println(bytesPerSec + " Bps"); /* download rate in kilobytes per second */ float kbPerSec = bytesPerSec / (1024); System.out.println(kbPerSec + " KBps "); /* download rate in megabytes per second */ float mbPerSec = kbPerSec / (1024); System.out.println(mbPerSec + " MBps "); }
downvote count: 2
accepted answer: http://stackoverflow.com/a/24398702
type: AnsweredQuestion

http://stackoverflow.com/comment/37709600
has text: Could be the problem, that I have to many main classes in one package ?
comment on: http://stackoverflow.com/q/24381372
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37534033
has text: Should be noted that bootRun does not stop gracefully in Cygwin works fine with cmd
score: 0
comment on: http://stackoverflow.com/q/24289334
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24424383
answers question: http://stackoverflow.com/q/24424337
downvote count: 0
has comment: http://stackoverflow.com/comment/37792176
has comment: http://stackoverflow.com/comment/37789986
type: Answer
has comment: http://stackoverflow.com/comment/37788844
upvote count: 1
score: 1
has body: It is possible on the OpenJDK without using JNI. (In fact I have an implementation for OpenJDK/HotSPot) But AFAIK, you end up using JNI in some place for in Android as it doesn't use intrincis i.e. the ability to access off heap memory without JNI. Is the JNI on Android really that expensive? I would have thought it takes around a micro-second or less.

http://stackoverflow.com/comment/37598621
score: 0
comment on: http://stackoverflow.com/a/24324333
has text: Well, here I assume that the programmer knows the usernames and the passwords, so he can add them in the program as static variables (ex : password1="dfsfvsvs"). I already said this is hardly a way to do it, but if he can't use a database, this is one of the solutions I thought of, I would like to hear of better solutions, this question intrigued me.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24415634
has body: i have a problem private class SessionStatusCallback implements Session.StatusCallback { @Override public void call(Session session, SessionState state, Exception exception) { if (session.isOpened()) { getProfileInformation(); informDB(); runOnUiThread(new Runnable() { @Override public void run() { } }); } updateView(); } } public void getProfileInformation() { Request.newMeRequest(session, new Request.GraphUserCallback() { // callback after Graph API response with user object @Override public void onCompleted(GraphUser user, Response response) { if (user != null) { // String access_token = session.getAccessToken(); profilePictureView.setProfileId(user.getId()); fbuser = new UserInfo(user.getId().toString(), user .getName().toString(), null, null, null, null, null); name = "dada"; us = user; Toast.makeText(getApplicationContext(), "Name: " + user.getName(), Toast.LENGTH_LONG) .show(); } } }).executeAsync(); Log.e("errorrr", us.getName()); Log.e("errorrr", name); } i have a function getInformation() in which i am trying to create an object UserInfo with args from GraphUser. the problem is that the fbuser become null and i have NullPointerException as you can see i set a variable 'name' which is string but and with this i have the same problem
type: Question
has comment: http://stackoverflow.com/comment/37771964
score: 0
has comment: http://stackoverflow.com/comment/37777366
has title: java.lang.NullPointerException with facebook onCompleted function
tagged with: nullpointerexception
type: UnansweredQuestion
tagged with: android
tagged with: facebook
has comment: http://stackoverflow.com/comment/37771695
has comment: http://stackoverflow.com/comment/37789110
answer count: 0
tagged with: java

http://stackoverflow.com/a/24433916
has comment: http://stackoverflow.com/comment/61330900
answers question: http://stackoverflow.com/q/24401094
has body: I'd recommend to stick to the GSON library for JSON parsing. Here's how a Volley request with embedded JSON processing could look then: import java.io.UnsupportedEncodingException; import com.android.volley.NetworkResponse; import com.android.volley.ParseError; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.Response.ErrorListener; import com.android.volley.Response.Listener; import com.android.volley.toolbox.HttpHeaderParser; import com.google.gson.Gson; import com.google.gson.JsonSyntaxException; /** * Volley GET request which parses JSON server response into Java object. */ public class GsonRequest&lt;T&gt; extends Request&lt;T&gt; { /** JSON parsing engine */ protected final Gson gson; /** class of type of response */ protected final Class&lt;T&gt; clazz; /** result listener */ private final Listener&lt;T&gt; listener; public GsonRequest(String url, Class&lt;T&gt; clazz, Listener&lt;T&gt; listener, ErrorListener errorListener) { super(Method.GET, url, errorListener); this.clazz = clazz; this.listener = listener; this.gson = new Gson(); } @Override protected void deliverResponse(T response) { listener.onResponse(response); } @Override protected Response&lt;T&gt; parseNetworkResponse(NetworkResponse response) { try { String json = new String( response.data, HttpHeaderParser.parseCharset(response.headers)); return Response.success( gson.fromJson(json, clazz), HttpHeaderParser.parseCacheHeaders(response)); } catch (UnsupportedEncodingException e) { return Response.error(new ParseError(e)); } catch (JsonSyntaxException e) { return Response.error(new ParseError(e)); } } } Let's imagine you have a server method located at http://example.com/api/persons/ which returns a JSON array of Person; Person is as follows: public class Person { String firstName; String lastName; } We can call the abovementioned method like this: GsonRequest&lt;Person[]&gt; getPersons = new GsonRequest&lt;Person[]&gt;("http://example.com/api/persons…
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24401094
has comment: http://stackoverflow.com/comment/61330893
upvote count: 41
type: Answer
score: 41
has comment: http://stackoverflow.com/comment/57612353
has comment: http://stackoverflow.com/comment/60150714

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/24391944
type: Tag

http://stackoverflow.com/comment/37636040
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24344083
has text: How are you invoking your methods?
score: 0

http://stackoverflow.com/comment/37540837
type: AnswerComment
comment on: http://stackoverflow.com/a/24292232
score: 0
has text: It doesn't HAS to, but at least this way you are sure you won't reinitialize it. More information here: http://stackoverflow.com/a/15655032/2371161
type: Comment

http://stackoverflow.com/a/24328909
has body: You need to follow .* with a non-greedy quantifier ? and remove the \w before your character class. Also remove the ? quantifier following your range {2,3}, it is not neccessary at all. .*?([A-Z]{2,3}),.* Live Demo I would recommend using the beginning of string ^ anchor and perhaps use a word boundary \b as well. ^.*?(\b[A-Z]{2,3}),.*
upvote count: 2
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24328777
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24328777

http://stackoverflow.com/comment/37625037
comment on: http://stackoverflow.com/q/24337194
score: 0
has text: I changed it back to 0.3.9 for curiosity and now it's working there too. I realized Android Studio has some hick-ups frequently, when new dependencies are added. So probably it was one of those.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24303396
has body: I have an issue in playing of wav files where the player sends RTP stream over the network. The last byte of the wave file that is sent is padded with 00 00 00… to make it a 172 byte packet. These extra padding causes a click sound at the end of file when heard. To avoid this click sound, I need to pad wave files with silence (instead of 00 00 00). Padding needs to be in such a way that it creates a full 160 octet frame at the end of file to avoid player adding zeroes. I need to write a small utility program to do so. I have explored the java sound api and I have pretty much found out to append a wav file with another file or to create a new wav file by writing bits to output stream. I need help on how do i write silence to the end of wav file to make it a full 160 octet frame. Also, I can't pad 0s to add silence should i write 0xff to create silence? Kindly assist? Thanks.
tagged with: java
type: Question
tagged with: wav
score: 0
tagged with: file-io
has title: Padding silence at the end of wav file to 160 octet frame
answer count: 1
tagged with: outputstream
tagged with: javasound
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24325860

http://stackoverflow.com/comment/37725135
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24390456
score: 0
has text: @GermannArlington I didn't. As I noted in a previous comment I accidentally mistyped a single line and user TheLostMind was kind enough to point it out to me. As the rest of the post says, the threads correctly start and run and can be observed in JConsole, so it can be assumed that the problem is not with the *starting* of the threads.

http://stackoverflow.com/comment/37759078
has text: I did not downvote, but I'm pretty sure the twitch got them after seeing "pls help me learn language" instead of specifically asking about outputstream functions.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24409002
score: 3

http://stackoverflow.com/comment/37573557
score: 0
type: AnswerComment
has text: Nevertheless, this seems tho be the root cause of the issue. Could you keep the whole security context in one file or even place all security:intercept-url elements in one security:http element?
comment on: http://stackoverflow.com/a/24303559
type: Comment

http://stackoverflow.com/q/24324066
has body: i'm trying to make a rectangle in Java, done. I can also fill it in with solid colour, done. But I want to actually change the solid colour of the shape itself. I know with Graphics you can use g.setColor(); but I have had my component setup a special way as shown below: public class Design extends JComponent { private static final long serialVersionUID = 1L; private List&lt;Shape&gt; shapesDraw = new ArrayList&lt;Shape&gt;(); private List&lt;Shape&gt; shapesFill = new ArrayList&lt;Shape&gt;(); GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); int screenWidth = gd.getDisplayMode().getWidth(); int screenHeight = gd.getDisplayMode().getHeight(); public void paint(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; for(Shape s : shapesDraw){ g2d.draw(s); } for(Shape s : shapesFill){ g2d.fill(s); } } public void drawRect(int xPos, int yPos, int width, int height) { shapesDraw.add(new Rectangle(xPos, yPos, width, height)); repaint(); } public void fillRect(int xPos, int yPos, int width, int height) { shapesFill.add(new Rectangle(xPos, yPos, width, height)); repaint(); } public void drawTriangle(int leftX, int topX, int rightX, int leftY, int topY, int rightY) { shapesDraw.add(new Polygon( new int[]{leftX, topX, rightX}, new int[]{leftY, topY, rightY}, 3)); repaint(); } public void fillTriangle(int leftX, int topX, int rightX, int leftY, int topY, int rightY) { shapesFill.add(new Polygon( new int[]{leftX, topX, rightX}, new int[]{leftY, topY, rightY}, 3)); repaint(); } public Dimension getPreferredSize() { return new Dimension(screenWidth, screenHeight); } public int getWidth() { return screenWidth; } public int getHeight() { return screenHeight; } } As you can see, instead of just drawing and filling, it uses a list to draw off of that. Is there a way I can change the colour inside the list&lt; shape >? I preferably want the colour to be changeable inside each draw/fill shape. Thanks for the help. Updated …
tagged with: java
has title: Java changing colour of shape
accepted answer: http://stackoverflow.com/a/24324522
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
tagged with: colors
type: Question
tagged with: graphics2d
has comment: http://stackoverflow.com/comment/37598097
has comment: http://stackoverflow.com/comment/37598022
has answer: http://stackoverflow.com/a/24324522
tagged with: paint
upvote count: 1
tagged with: swing
answer count: 1

http://stackoverflow.com/q/24297856
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24887353
accepted answer: http://stackoverflow.com/a/24887353
score: 0
tagged with: tsung
tagged with: performance-testing
answer count: 1
has title: TPS(transactions per second) of Resteasy service waves
tagged with: resteasy
has body: I have one REST service written by resteasy framework deployed to Jetty web container. The TPS performance point calculated by Tsung like below picture I debug some parameter,but not work.note that the code is ok verified by some other team. Thread number of Jetty GC of JVM TCP kernel parameters of OS I do not know why. who can provide some debug parameters or issues raised the result. Many thanks in advance The following is configuration of Tsung <?xml version="1.0"?> <client host="tc-1" maxusers="50000" weight="1"/> <client host="tc-3" maxusers="50000" weight="1"/> <client host="tc-4" maxusers="50000" weight="1"/> <server host="service-ip" port="80" type="tcp"/> <monitor host="tc-1" type="erlang"/> <monitor host="tc-3" type="erlang"/> <monitor host="tc-4" type="erlang"/> <users arrivalrate="700" unit="second"/> <user_agent probability="80"> Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Galeon/1.3.21 </user_agent> <user_agent probability="20"> Mozilla/5.0 (Windows; U; Windows NT 5.2; fr-FR; rv:1.7.8) Gecko/20050511 Firefox/1.0.4 </user_agent> <www_authenticate passwd="pwd" userid="username"/>
tagged with: jetty
has comment: http://stackoverflow.com/comment/37630540
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37594067

http://stackoverflow.com/q/24376016
accepted answer: http://stackoverflow.com/a/24376109
type: AnsweredQuestion
tagged with: stored-procedures
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24376109
has body: I have created a login system that check for tries before blocks an account in case password fails more than three times. The problem is that I need to check if the username exists and if not, print a message saying that the id doesn't exists; but I don't know what to do. I mean, I have the idea of how to do it, but I don't know how to do it on Java. Theese are my stored precedures Login create proc usp_Login @id varchar(50), @pw varchar(50) as select id, pw from Login where id = @id and pw = @pw and lock = 0 and tries &lt; 4 update Login set tries = 0 where id = @id and pw = @pw; Attempts create proc usp_Attempts @id varchar(50) as select id, tries from Login where id = @id and tries &lt; 4 update Login set tries = tries+1 where tries &lt; 4 and id = @id Block user create proc usp_Lock @id varchar(50) as update Login set lock = 1 where id = @id And the java part is like this: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { CallableStatement cStmt = null; ResultSet rs = null; try { cStmt = conn.prepareCall("{call usp_Login(?, ?)}"); cStmt.setString(1, this.txtID.getText()); cStmt.setString(2, this.txtPW.getText()); cStmt.execute(); rs = cStmt.getResultSet(); if (rs.next()) { System.out.println("Login done"); cStmt.close(); rs.close(); conn.close(); } else { cStmt = conn.prepareCall("{call usp_Attempts(?)}"); cStmt.setString(1, this.txtID.getText()); cStmt.execute(); rs = cStmt.getResultSet(); if (rs.next()) { System.out.println("Invalid login"); } else { cStmt = conn.prepareCall("{call usp_Lock(?)}"); cStmt.setString(1, this.txtID.getText()); cStmt.execute(); System.out.println("Login blocked"); cStmt.close(); rs.close(); conn.close(); } } } catch (SQLException ex) { System.out.print(ex); } } I know that maybe this is not the best way to do a login system, but I'm still learning and this is by now the best idea I got about doing it. Hope someone can help me to do the id verification part, thanks in advance.
has comment: http://stackoverflow.com/comment/37697416
has comment: http://stackoverflow.com/comment/37743278
tagged with: sql-server
score: 0
has title: Check if username exists in table with password
answer count: 1
has comment: http://stackoverflow.com/comment/37697277
tagged with: callable-statement

http://stackoverflow.com/a/25114399
upvote count: 1
answers question: http://stackoverflow.com/q/24334156
score: 1
downvote count: 0
has body: You can use VirtualDisplay in combination with Presentation Object. In android AOSP, in cts/tests/tests/display/.. you can find some implementation example as well. The api for creating VirtualDisplay is: createVirtualDisplay() Hope this helps.
type: Answer

http://stackoverflow.com/comment/37528976
type: QuestionComment
has text: Unless you really intended to loop through a single hour over and over, you should probably change `startTime.set` to `startTime.add(Calendar.MINUTE, 5)`.
comment on: http://stackoverflow.com/q/24283245
score: 0
type: Comment

http://stackoverflow.com/comment/37608221
type: AnswerComment
comment on: http://stackoverflow.com/a/24326971
type: Comment
has text: you have to play with the focusablibity dude.
score: 0

http://stackoverflow.com/comment/37783366
type: QuestionComment
comment on: http://stackoverflow.com/q/24421822
has text: @user2864740 can you explain more about it? int[] b = a call new function automatically?
score: 0
type: Comment

http://stackoverflow.com/comment/43193897
type: Comment
has text: @Amar, I tried the same coding and replaced **url** with the dynamic webpage you mentioned ***http://www.sciencedirect.com/science/article/pii/S1568494612005741***; Yet it didn't crawled the popup page; It crawled only the static page; Does your solution require any other additional code?
score: 0
comment on: http://stackoverflow.com/a/27268640
type: AnswerComment

http://stackoverflow.com/a/24422011
upvote count: 1
type: Answer
downvote count: 0
has body: You need to have a constructor in TwoNumbers: public class TwoNumbers { private double firstNumber; private double secondNumber; public TwoNumbers(double firstNumber, double secondNumber){ this.firstNumber = firstNumber; this.secondNumber = secondNumber; } } Then in some other Class, you can have your scanner: public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter firstNumber"); double firstNumber = scanner.nextDouble(); System.out.println("Enter secondNumber"); double secondNumber = scanner.nextDouble(); TwoNumbers obj = new TwoNumbers(firstNumber, secondNumber); //Call methods from TwoNumbers }
score: 1
answers question: http://stackoverflow.com/q/24421937

http://stackoverflow.com/q/24420064
has answer: http://stackoverflow.com/a/25163440
has title: Why WebElement and List<WebElement> are processed not in the similar way via xpath and List is always null?
type: AnsweredQuestion
tagged with: findby
tagged with: xpath
type: Question
score: 0
tagged with: selenium
accepted answer: http://stackoverflow.com/a/25163440
answer count: 1
tagged with: thucydides
tagged with: java
has body: I'm using Thucydides 0.9.229 with Selenium shipped with it. To obtain some webelements I try to get them via List @FindAll({@FindBy(xpath = "//div[text()='Расположение']/../../td[2]//input[@type='text']")}) private List&lt;WebElement&gt; placement; with no result, the placement is returned null, while here @FindBy(xpath = "//div[text()='Расположение']/../../td[2]//input[@type='text']")}) private WebElement placement; there placement is not null, but the correct webelement handled well. As far as I understand, the firs example should return the 1-value list anyway, but even more values if there were some additional elements fitting the criteria. So, what is wrong, why I can't get the list of webelements there?

http://stackoverflow.com/q/24277307
accepted answer: http://stackoverflow.com/a/24277407
possible better answer: http://stackoverflow.com/a/24277417
has comment: http://stackoverflow.com/comment/37509877
has comment: http://stackoverflow.com/comment/37509757
tagged with: java
linked to: http://stackoverflow.com/q/24268924
tagged with: replace
has comment: http://stackoverflow.com/comment/37511641
has comment: http://stackoverflow.com/comment/37509718
has comment: http://stackoverflow.com/comment/37509674
type: AnsweredQuestion
has title: String: How to insert double quotes around all occurrences of a character
tagged with: insert
score: 1
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/24277407
type: Question
has comment: http://stackoverflow.com/comment/37509789
has comment: http://stackoverflow.com/comment/37509724
has comment: http://stackoverflow.com/comment/37510397
tagged with: regex
has comment: http://stackoverflow.com/comment/37509804
has answer: http://stackoverflow.com/a/24277417
has body: I have a string in which : occurs several times. I want each occurance of : to be surrounded by double quotes, like ":" without truncating the data around it. I have tried to use String.replaceAll(":", "\":\""); but it truncates the characters around :. How can I enclose all occurances of : by " without truncating the characters around :? EDIT:- My String:- {key1:value1,key2:value2,key3:{key4:value4,key5:value5,key6:{key7:{key8:value8}}},key9:value9} More readable Form:- { key1:value1, key2:value2, key3:{ key4:value4, key5:value5, key6:{ key7:{ key8:value8 } } }, key9:value9 } What I am doing:- responseString = responseString.replaceAll(":", "\":");// Put " before each occurance of : responseString = responseString.replace(":[^\\Q{\\E]", ":\""); // Put " after each occurence of : except the ones preceded by { Output:- {key1":"alue1,key2":"alue2,key3":{key4":"alue4,key5":"alue5,key6":{key7":{key8":"alue8}}},key9":"alue9}
has comment: http://stackoverflow.com/comment/37510119
has comment: http://stackoverflow.com/comment/37511906
has comment: http://stackoverflow.com/comment/37510325
upvote count: 3
answer count: 2
downvote count: 2

http://stackoverflow.com/q/24309497
answer count: 1
has comment: http://stackoverflow.com/comment/37570726
score: 0
has title: Return Statements in a Finite State Machine
tagged with: state-machine
type: AnsweredQuestion
tagged with: return
has answer: http://stackoverflow.com/a/24309589
type: Question
has body: Could anyone tell me what purpose a return statement in a Finite State Machine's state serves? For example I have this code for a soccer player's state: public class ChaseBall extends State&lt;FieldPlayer&gt; { private static ChaseBall instance = new ChaseBall(); private ChaseBall() { } //this is a singleton public static ChaseBall Instance() { return instance; } @Override public void Enter(FieldPlayer player) { player.Steering().SeekOn(); } } @Override public void Execute(FieldPlayer player) { //if the ball is within kicking range the player changes state to KickBall. if (player.BallWithinKickingRange() &amp;&amp; player.isReadyForNextKick()) { player.GetFSM().ChangeState(KickBall.Instance()); return; } //if the player is the closest player to the ball then he should keep //chasing it if (player.isClosestTeamMemberToBall()) { player.Steering().SetTarget(player.Ball().Pos()); return; } //if the player is not closest to the ball anymore, he should return back //to his home region and wait for another opportunity player.GetFSM().ChangeState(ReturnToHomeRegion.Instance()); } @Override public void Exit(FieldPlayer player) { player.Steering().SeekOff(); } } I was wondering if someone could explain what purpose the the return keywords in the first two if statements of the Execute() method serve? Thanks
tagged with: java
accepted answer: http://stackoverflow.com/a/24309589

http://stackoverflow.com/comment/37554160
score: 0
type: Comment
type: QuestionComment
has text: @RaulRene That will still cause a `ConcurrentModificationException`, because the for-each loop produces its own iterator. You have to use a `while` loop or a regular `for` loop.
comment on: http://stackoverflow.com/q/24300733

http://stackoverflow.com/a/24322714
has comment: http://stackoverflow.com/comment/37600758
has comment: http://stackoverflow.com/comment/37598015
has body: in tomcat 7, under bin directory create set setenv.sh file add following line -D--enableAuthentication=true/false This should work.
score: 0
has comment: http://stackoverflow.com/comment/37600787
type: Answer
answers question: http://stackoverflow.com/q/24322619
has comment: http://stackoverflow.com/comment/37596254
has comment: http://stackoverflow.com/comment/37596012

http://stackoverflow.com/q/24322692
type: UnansweredQuestion
has body: I have an issue with Hibernate as although I am setting following DetachedCriteria timestampFilter = DetachedCriteria.forClass(FormParams.class) .add(Restrictions.eq("id.keyName","DataSetName")) .setProjection(Projections.property("id.keyName")); Session currentSession = sessionFactory.getCurrentSession(); Criteria query = currentSession.createCriteria(FormInstance.class) .add(Property.forName("formParams").eq(timestampFilter)) From which I expect it to do a sensible query based on the keyName, the SQL generated is: batchjobpa4_.FORM_ID where this_.FORM_ID = (select this_.KEY_NAME as y0_ from az_alpha.FORM_PARAMS this_ where this_.KEY_NAME=?) From my understanding this returns the keyName field, and equals it to the FORM_ID field which is the index int, while keyName is a string. How can I make it equal the proper field ?
tagged with: java
tagged with: hibernate
has title: Hibernate Criteria DetachedCriteria
type: Question
has comment: http://stackoverflow.com/comment/37595343
tagged with: criteria
has comment: http://stackoverflow.com/comment/37595479
has comment: http://stackoverflow.com/comment/37595431
score: 0
has comment: http://stackoverflow.com/comment/37595687
tagged with: sql
linked to: http://stackoverflow.com/q/11545664
answer count: 0

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/24385965
type: Tag

http://stackoverflow.com/comment/37588256
has text: @AlonsoGutiérrez if it works for you mind accepting my answer
type: Comment
comment on: http://stackoverflow.com/a/24318563
score: 0
type: AnswerComment

http://stackoverflow.com/a/24806838
type: AcceptedAnswer
score: 0
type: Answer
has body: I still think there are problems if you call the same servlet from different XHR requests but the way to solve the loading problem is by calling the store.load functions in a cascading fashion inside each other's callback function: store1.load({ callback: function() { store2.load(); } }); This way stuff doesn't get in the way of the ajax request. However I still don't know why this is happening, the server is supposed to take care of the multithreading of the servlets...
accepted answer of: http://stackoverflow.com/q/24402674
answers question: http://stackoverflow.com/q/24402674

http://stackoverflow.com/a/24357861
score: 0
type: Answer
has body: I am pretty new to this and I would love for someone to give us an explanation why yours did not work. I thought i/2 by integer math would round down to the nearest integer. but give this a try. public static int[] Separator2() { int counter = 0; for (int i = 0; i &lt; numbersGenerated.length; i++) { if (i % 2 == 1) { numberSet2[counter] = numbersGenerated[i]; counter++; } } return numberSet2;
answers question: http://stackoverflow.com/q/24357608

http://stackoverflow.com/comment/37753824
score: 0
type: Comment
has text: @Aneesh See [What's so bad about building XML with string concatenation?](http://stackoverflow.com/questions/3034611/whats-so-bad-about-building-xml-with-string-concatenation)
type: QuestionComment
comment on: http://stackoverflow.com/q/24402593

http://stackoverflow.com/a/24333524
has comment: http://stackoverflow.com/comment/37664690
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Assuming that you have a pure AcroForm and not a hybrid form as I indicated in my comment, this is how you change the quadding of a field: AcroFields form = stamper.getAcroFields(); AcroFields.Item item; item = form.getFieldItem("fieldLeft"); item.getMerged(0).put(PdfName.Q, new PdfNumber(PdfFormField.Q_LEFT)); item = form.getFieldItem("fieldCenter"); item.getMerged(0).put(PdfName.Q, new PdfNumber(PdfFormField.Q_CENTER)); item = form.getFieldItem("fieldRight"); item.getMerged(0).put(PdfName.Q, new PdfNumber(PdfFormField.Q_RIGHT)); The quadding isn't part of the field flags as you wrongly assumed. It's and entry of the widget annotation dictionary.
answers question: http://stackoverflow.com/q/24301578
accepted answer of: http://stackoverflow.com/q/24301578
score: 4
upvote count: 4

http://stackoverflow.com/a/24387215
answers question: http://stackoverflow.com/q/24384181
score: 0
type: AcceptedAnswer
has body: Thanks for your comments, i found out that i'm using these intents in PendingIntents, and while i set the flag of the PendingIntent to PendingIntent.FLAG_UPDATE_CURRENT and use the same action ... the intent is not updated and it keeps repeating the first intent
accepted answer of: http://stackoverflow.com/q/24384181
type: Answer

http://stackoverflow.com/q/24346148
tagged with: jakarta-ee
tagged with: java
has comment: http://stackoverflow.com/comment/37641170
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/24389917
accepted answer: http://stackoverflow.com/a/24389917
tagged with: jms
has title: No response by the message driven bean from stateful session bean
type: AnsweredQuestion
has body: I'm trying to make work a message driven bean but without any success. Perhaps you could help me. This is the code of my MDB really simple @MessageDriven(mappedName = "jms/bookingProcessorQueueReceiver", activationConfig = {@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"), @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue") }) public class BookingProcessorBean implements MessageListener { @PersistenceContext private EntityManager em; public BookingProcessorBean() { } @Override public void onMessage(Message message) { Reservation reserv = null; if(message instanceof Reservation) { try { System.out.println("Order processing..."); reserv = (Reservation) message; // riceve l'utente UserCredential user = reserv.getUsername(); //estrae l'utente user.getReservationsList().add(reserv); storeInDb(reserv, user); } catch(Exception e) { System.err.println("An error occured during the processing of the order" + e.toString()); } } } private void storeInDb(Reservation r, UserCredential u) { em.persist(r); em.merge(u); } } and this is the Stateful Session bean that call it @Stateful public class BookingBean implements BookingBeanInterface { @Resource(mappedName = "jms/bookingProcessorQueueReceiver") private Queue bookingProcessorQueueReceiver; @Resource(mappedName = "jms/reservationProcessorQueueFactory") private ConnectionFactory reservationProcessorQueueFactory; private Connection connection = null; private Session session = null; private MessageProducer messageProducer; private boolean SUCCESS; @Override public boolean purchase(Route r, UserCredential u, int passengers, int luggages, double price) { Reservation reserv = setReservation(r, u, passengers, luggages, (float) price); try { sendMessageToBookingProcessorBean(reserv); // invia il messaggio contenente la prenotazione SUCCESS = true; } catch(JMSException jmse) { System.err.println("An error occured " + jmse.toString()); return SUCCESS…
type: Question

http://stackoverflow.com/a/24352908
type: Answer
has body: The latest JVM spec says this in the 4.9.2 Structural Constraints section: "Each instance initialization method, except for the instance initialization method derived from the constructor of class Object, MUST call either another instance initialization method of this or an instance initialization method of its direct superclass super before its instance members are accessed." In other words, if you remove the invokespecial &lt;init&gt; instruction sequence corresponding to the constructor's super(...) or this(...) call, then the class file is invalid, and the verifier should detect it. (And according to @Jimmy T's investigations, it does!) The reasoning behind this constraint is explained by other Answers.
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/24349944
downvote count: 0

http://stackoverflow.com/q/24343820
has answer: http://stackoverflow.com/a/24343958
score: 0
answer count: 1
has title: Inject stateful EJB beans in a maven project
type: UnansweredQuestion
tagged with: maven
tagged with: java
type: Question
tagged with: jakarta-ee
has body: I don't understand one thing that I hope someone of you could explain me. I have a maven enterprise project developed with glassfish. I use the insert code netbeans function (right click) to call bean in a servlet and in particular the annotation @EJB I don't understand why when I call a stateful session bean through Insert Code function in netbeans the bean is called through JNDI. Here what I mean private BookingBeanInterface lookupBookingBeanLocal() { try { Context c = new InitialContext(); return (BookingBeanInterface) c.lookup("java:global/it.volaconnoi_volaconnoi-webapp-ear_ear_1.0-SNAPSHOT/it.volaconnoi_volaconnoi-webapp-ejb_ejb_1.0-SNAPSHOT/BookingBean!it.volaconnoi.logic.BookingBeanInterface"); } catch (NamingException ne) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne); throw new RuntimeException(ne); } }` The above function hasn't been wrote by me I can't inject a stateful session bean through EJB?

http://stackoverflow.com/a/62933241
has body: I had similar issue/error while running JunitCore along side with Junit Jupiter(Junit5) JUnitCore.runClasses(classes); after removing @RunWith(SpringRunner.class) and ran with @SpringBootTest @FixMethodOrder(MethodSorters.NAME_ASCENDING) i am able to resolve the issue for my tests as said in the above comments. https://stackoverflow.com/a/59563970/13542839
score: 2
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/24319697

http://stackoverflow.com/comment/37711288
type: Comment
comment on: http://stackoverflow.com/a/24347174
score: 0
type: AnswerComment
has text: Thanks :) i will put sample code in answers or do i have to accept your answer.

http://stackoverflow.com/comment/37770183
comment on: http://stackoverflow.com/q/24398048
score: 0
type: QuestionComment
type: Comment
has text: Nope, and this class does not inherit or implement from any other class. I have a `@Controller` annotation and a class-level `@RequestMapping` set, that's it.

http://stackoverflow.com/a/49547689
downvote count: 1
has body: I may find a important point of your issue. Try to replace private int version to private Long version For the reason that @Version tag may not work with primitive type.Thanks.
score: 0
answers question: http://stackoverflow.com/q/24321280
type: Answer
has comment: http://stackoverflow.com/comment/128113958
upvote count: 1

http://stackoverflow.com/comment/37760526
comment on: http://stackoverflow.com/q/24394638
score: 0
has text: i managed to answer my own question, though only in part. thanks everyone!
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24267082
has answer: http://stackoverflow.com/a/24267108
has title: Getting rid of the Android Action bar.
score: 0
has body: When I create an android app this is generated automatically: How do I get rid of this? Its ugly EDIT WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Point size = new Point(); display.getSize(size); screenWidth = size.x; screenHeight = size.y;
has answer: http://stackoverflow.com/a/24267132
tagged with: android-activity
answer count: 5
has answer: http://stackoverflow.com/a/24267172
tagged with: android
tagged with: android-actionbar
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24267150
tagged with: java
has answer: http://stackoverflow.com/a/24267300
type: Question
has answer: http://stackoverflow.com/a/24267150
possible better answer: http://stackoverflow.com/a/24267172

http://stackoverflow.com/a/79227832
type: Answer
has body: Export all data from the tables you need from Oracle into .csv files and use DBeaver to import these files into your HSQLDB schema
score: 0
answers question: http://stackoverflow.com/q/24427427

http://stackoverflow.com/a/24412575
has comment: http://stackoverflow.com/comment/37790181
score: 2
has comment: http://stackoverflow.com/comment/37766884
upvote count: 2
answers question: http://stackoverflow.com/q/24412536
has comment: http://stackoverflow.com/comment/37766639
has comment: http://stackoverflow.com/comment/37791304
has body: Where are you adding these buttons to the form? You are creating buttons in the method yes, and attaching listeners to these but the buttons themselves aren't being added to the form which is why you cant see them. e.g you should be doing something like: yourForm.add(addBtn); yourForm.add(saveBtn); or add these to a JPanel or something - finally making sure you add this JPanel
downvote count: 0
has comment: http://stackoverflow.com/comment/37767542
type: Answer

http://stackoverflow.com/q/24276879
upvote count: 1
favorite count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/37509049
has body: public static void main(String[] args) { Picture pictObj = new Picture("C:\\caterpillar.jpg"); pictObj.swapRGB(2); pictObj.show(); } public void swapRGB(){ Pixel[] pixelArray = this.getPixels(); Pixel pixel = null; int old_green = 0; int old_blue = 0; int old_red = 0; for(int i = 0; i &lt; pixelArray.length;i++){ pixel = pixelArray[i]; old_green = pixel.getGreen(); old_blue = pixel.getBlue(); old_red = pixel.getRed(); pixel.setRed(old_green); pixel.setGreen(old_blue); pixel.setBlue(old_red); } } public void swapRGB(int numswaps) { Pixel[] pixelArray = this.getPixels(); Pixel pixel = null; int old_green = 0; int old_blue = 0; int old_red = 0; int count = 0; while(count &lt; numswaps) { for(int i = 0; i &lt; pixelArray.length; i++) { pixel = pixelArray[i]; //getting the green, red and blue value of the pixels old_green = pixel.getGreen(); old_blue = pixel.getBlue(); old_red = pixel.getRed(); //Swapping Values of colors pixel.setRed(old_green); pixel.setGreen(old_blue); pixel.setBlue(old_red); pixel = pixelArray[i]; count ++; } } This program changes the color of the pixels in a picture; it swaps the red, green, blue values. My problem is, it just happens once irrespective of the number of the value of numswaps. If I call the function swapRGB() or swapRGB(numswaps) twice it changes colors, but that is not how I want the change in colors to happen, it should chnage according to the the number of numswaps. Both the functions swapRGB() and swapRGB(numswaps) are in the same class. Thank You.
accepted answer: http://stackoverflow.com/a/24277079
has comment: http://stackoverflow.com/comment/37509300
tagged with: loops
has comment: http://stackoverflow.com/comment/37509639
type: AnsweredQuestion
has title: Glitch in the loops. Iterates only once irrespective of the count
has comment: http://stackoverflow.com/comment/37510004
score: 1
has answer: http://stackoverflow.com/a/24277079
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37508814
has comment: http://stackoverflow.com/comment/37508930
answer count: 1

http://stackoverflow.com/q/24371084
has answer: http://stackoverflow.com/a/24371534
answer count: 6
accepted answer: http://stackoverflow.com/a/24371178
score: 0
has comment: http://stackoverflow.com/comment/37687848
has body: I am working on a basic game similar to Break Out and I plan to use a text file to store level data on where various objects should be located when a level is rendered onto the screen. Here is the code: import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class LevelData { public LevelData(){ readFile(); } public void readFile(){ try{ BufferedReader in = new BufferedReader(new FileReader("Levels")); String str; while((str = in.readLine()) != null){ process(str); in.close(); } }catch (IOException e){ System.out.println("File Does Not Exist"); } } private void process(String str){ System.out.println(str); } } This following code, based off of previous research, should access the file "Levels" that is located in the same package as the Java class, but if the program cannot access the file then it should print "File Does Not Exist" to the console. I have created a file called "Levels" that is located in the same package as the Java class but whenever I run this class, it does not read the file properly and it catches the Exception. Does anyone have any ideas on why it cannot access the proper file? I have already looked on various other threads and have found nothing so far that could help me. Thanks in advance
tagged with: bufferedreader
possible better answer: http://stackoverflow.com/a/24371164
has answer: http://stackoverflow.com/a/24371164
has comment: http://stackoverflow.com/comment/37687893
has answer: http://stackoverflow.com/a/24371393
tagged with: filereader
has comment: http://stackoverflow.com/comment/37687925
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24371178
tagged with: java
has comment: http://stackoverflow.com/comment/37688037
tagged with: file
has answer: http://stackoverflow.com/a/24371841
type: Question
has title: Java File Reader not finding appropriate file
has answer: http://stackoverflow.com/a/28954178

http://stackoverflow.com/comment/37533482
has text: Your answer is in the error: "Method testSeleniumRegistrerenKlant should have no parameters." JUnit test methods are not allowed to have parameters.
comment on: http://stackoverflow.com/q/24289090
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24362964
downvote count: 3
has body: /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package cities; import java.util.Scanner; import java.util.Vector; public class Cities { public static void main(String a[]) { Scanner z = new Scanner(System.in); int x; String name, del; Vector&lt;String&gt; vct = new Vector&lt;String&gt;(); vct.add("Los Angeles"); System.out.println(vct); System.out.println("Select : \n1.Add City \n2.Remove City\n3.Display\n"); x = z.nextInt(); switch (x) { case 1: System.out.println("Enter a city name to add :"); name = z.nextLine(); if (vct.contains(name)) { System.out.println("Already Exists."); } else { vct.add(name); System.out.println("Updated Vector :" + vct); break; } case 2: System.out.println("Enter the city name to delete :"); del = z.nextLine(); vct.remove(del); System.out.println("Updated Vector :" + vct); break; case 3: System.out.println(vct); break; default: System.out.println("Please provide a proper input."); break; } } }
type: Question
type: AnsweredQuestion
has title: all statements in case are executed. code without case is working
tagged with: vector
score: -3
has answer: http://stackoverflow.com/a/24363057
upvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24363057
tagged with: java

sql
tags question: http://stackoverflow.com/q/24330456
tags question: http://stackoverflow.com/q/24354812
tags question: http://stackoverflow.com/q/24285672
tags question: http://stackoverflow.com/q/24298195
tags question: http://stackoverflow.com/q/24376541
tags question: http://stackoverflow.com/q/24358122
tags question: http://stackoverflow.com/q/24364081
tags question: http://stackoverflow.com/q/24403576
tags question: http://stackoverflow.com/q/24372286
tags question: http://stackoverflow.com/q/24416683
tags question: http://stackoverflow.com/q/24418096
tags question: http://stackoverflow.com/q/24347315
tags question: http://stackoverflow.com/q/24355404
tags question: http://stackoverflow.com/q/24353217
tags question: http://stackoverflow.com/q/24379332
tags question: http://stackoverflow.com/q/24375795
tags question: http://stackoverflow.com/q/24383597
tags question: http://stackoverflow.com/q/24373063
tags question: http://stackoverflow.com/q/24319978
tags question: http://stackoverflow.com/q/24397408
tags question: http://stackoverflow.com/q/24269641
tags question: http://stackoverflow.com/q/24397088
tags question: http://stackoverflow.com/q/24330791
tags question: http://stackoverflow.com/q/24351162
tags question: http://stackoverflow.com/q/24345086
tags question: http://stackoverflow.com/q/24390179
tags question: http://stackoverflow.com/q/24317713
tags question: http://stackoverflow.com/q/24363050
tags question: http://stackoverflow.com/q/24323733
tags question: http://stackoverflow.com/q/24419994
tags question: http://stackoverflow.com/q/24267845
tags question: http://stackoverflow.com/q/24352070
tags question: http://stackoverflow.com/q/24354187
tag name: sql
type: Tag
tags question: http://stackoverflow.com/q/24361950
tags question: http://stackoverflow.com/q/24321312
tags question: http://stackoverflow.com/q/24396919
tags question: http://stackoverflow.com/q/24323674
tags question: http://stackoverflow.com/q/24322692
tags question: http://stackoverflow.com/q/24373368
tags question: http://stackoverflow.com/q/24277652
tags question: http://stackoverflow.com/q/24411695
tags question: http://stackoverflow.com/q/24422921
tags question: http://stackoverflow.com/q/24284349
tags question: http://stackoverflow.com/q/24276196
tags question: http://stackoverflow.com/q/24411248
tags question: http://stackoverflow.com/q/24402321
tags question: http://stackoverflow.com/q/24315948
tags question: http://stackoverflow.com/q/24278282
tags question: http://stackoverflow.com/q/24390542
tags question: http://stackoverflow.com/q/24320843
tags question: http://stackoverflow.com/q/24364629
tags question: http://stackoverflow.com/q/24381243
tags question: http://stackoverflow.com/q/24396969
tags question: http://stackoverflow.com/q/24338203
tags question: http://stackoverflow.com/q/24377373
tags question: http://stackoverflow.com/q/24275044
tags question: http://stackoverflow.com/q/24339011
tags question: http://stackoverflow.com/q/24320419
tags question: http://stackoverflow.com/q/24372073
tags question: http://stackoverflow.com/q/24267112
tags question: http://stackoverflow.com/q/24353347
tags question: http://stackoverflow.com/q/24283198
tags question: http://stackoverflow.com/q/24285118
tags question: http://stackoverflow.com/q/24276582
tags question: http://stackoverflow.com/q/24337166
tags question: http://stackoverflow.com/q/24379075
tags question: http://stackoverflow.com/q/24364924
tags question: http://stackoverflow.com/q/24386833
tags question: http://stackoverflow.com/q/24360168
tags question: http://stackoverflow.com/q/24310562
tags question: http://stackoverflow.com/q/24333784
tags question: http://stackoverflow.com/q/24369864
tags question: http://stackoverflow.com/q/24293645
tags question: http://stackoverflow.com/q/24409673
tags question: http://stackoverflow.com/q/24268705
tags question: http://stackoverflow.com/q/24341460
tags question: http://stackoverflow.com/q/24337300
tags question: http://stackoverflow.com/q/24279699

http://stackoverflow.com/q/24356585
tagged with: multithreading
has answer: http://stackoverflow.com/a/24358024
type: Question
has comment: http://stackoverflow.com/comment/37660880
tagged with: java
has comment: http://stackoverflow.com/comment/37669929
score: 0
tagged with: jakarta-mail
tagged with: email
answer count: 1
accepted answer: http://stackoverflow.com/a/24358024
has comment: http://stackoverflow.com/comment/37676257
has body: I have to send an email to several recipients. I don't want the header to display the complete list of recipients(i.e. I am not using "Message.RecipientType.CC"). If I use "Message.RecipientType.BCC", there is a probability of the mail being sent to spam. So I am using Message.RecipientType.TO to send an email one at a time. The problem is that this can take a very long time. My question is whether a separate thread can be created for every email to be sent in order to improve performance.
has title: Javamail multiple recepints with multi-threading
type: AnsweredQuestion

http://stackoverflow.com/comment/37574187
has text: I do not call it. Spring call that class as part of authentication. It is set as preAuthenticationProvider in Application-security.xml
type: AnswerComment
comment on: http://stackoverflow.com/a/24304774
type: Comment
score: 0

http://stackoverflow.com/a/24432622
score: 6
has comment: http://stackoverflow.com/comment/37917769
has body: As I already mentioned in the comments, you are wasting memory and processing time by creating a PDF from a data source by creating HTML first and then converting the HTML to PDF. You're also introducing plenty of unnecessary complexity. In your comment, you mention low-level functionality such as moveTo() and lineTo(). It would indeed be madness to draw a table using low-level operations that draw every single line and ever single word. You should use the PdfPTable class. The ArrayToTable example is a very simple POC where the data comes in the form of a List&lt;List&lt;String&gt;&gt;. The code is as simple as this: PdfPTable table = new PdfPTable(8); table.setWidthPercentage(100); List&lt;List&lt;String&gt;&gt; dataset = getData(); for (List&lt;String&gt; record : dataset) { for (String field : record) { table.addCell(field); } } document.add(table); Of course: you are talking about a huge data set, in which case, you may not want to build up the table in memory first and then flush the memory when the table is added to the document. You'll want to add small parts of the table while you are building it. That's what happens in the MemoryTests example. Add this line: table.setComplete(false); And you can add the table little by little (in the example: every 10 rows). When you've finished adding cells to the table, you should do this: table.setComplete(true); document.add(table); This will add the final rows. If you want a table with a repeating header and/or footer, take a look at the tables in this PDF: header_footer_1.pdf The HeaderFooter1 and HeaderFooter2 examples will show you how it's done.
downvote count: 0
answers question: http://stackoverflow.com/q/24414210
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/37917951

http://stackoverflow.com/comment/37517022
type: Comment
has text: i know. i've already took a look at it but i can't find the libraries section.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24281116

http://stackoverflow.com/q/24389499
tagged with: jsf
tagged with: primefaces
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24390668
downvote count: 0
answer count: 1
tagged with: ajax
has body: I'm currently working on a JSF application with Primefaces 5.0 where the content of a panel should be updated dynamically depending on the current SelectOneMenu selection. When the selected item changes, a Java method is called that searches the panel by its ID, removes all current child components and replaces them with new ones. This is all working correctly: The method is called, the panel is found by its ID and the child components are replaced. But for some reason the child widgets never show up on the UI. I've inspected the HTTP response and they're missing there as well. Any ideas? The JSF code looks like this: &lt;p:panel&gt; &lt;p:selectOneMenu id="artikelFilter" value="#{artikelListController.artikelFilter}" converter="omnifaces.SelectItemsConverter"&gt; &lt;p:ajax event="change" update="createFilterPanel" /&gt; &lt;f:selectItem itemLabel="" itemValue="#{null}" /&gt; &lt;f:selectItems value="#{artikelListController.artikelFilterValues}" /&gt; &lt;/p:selectOneMenu&gt; &lt;p:panelGrid id="createFilterPanel" /&gt; &lt;p:commandButton action="#{artikelListController.addArtikelFilter()}" value="Hinzufügen" disabled="#{artikelListController.artikelFilter == null}" style="margin-left: 15px" /&gt; &lt;/p:panel&gt; and the Java code like this: public void setArtikelFilter(final Class&lt;? extends ArtikelFilter&gt; clazz) { PanelGrid createFilterWidget = (PanelGrid) FacesContext.getCurrentInstance().getViewRoot().findComponent("artikelListForm:createFilterPanel"); if (clazz == null) { artikelFilter = null; createFilterWidget.getChildren().clear(); } else if (artikelFilter == null || clazz != artikelFilter.getClass()) { artikelFilter = constructor().in(clazz).newInstance(); createFilterWidget.getChildren().clear(); createFilterWidget.getChildren().addAll(artikelFilter.getCreateFilterWidgets()); } }
score: 1
accepted answer: http://stackoverflow.com/a/24390668
favorite count: 0
has title: Primefaces does not render child components on AJAX update
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/a/24321433
has comment: http://stackoverflow.com/comment/37601545
has comment: http://stackoverflow.com/comment/37598640
downvote count: 0
has comment: http://stackoverflow.com/comment/37600329
has comment: http://stackoverflow.com/comment/37598864
type: Answer
has body: There is a missing comma behind Total_Task.
has comment: http://stackoverflow.com/comment/37600718
has comment: http://stackoverflow.com/comment/37593767
upvote count: 1
answers question: http://stackoverflow.com/q/24319976
score: 1

http://stackoverflow.com/q/24377273
linked to: http://stackoverflow.com/q/9163950
has body: I am new to Java so please bear with me, I tried looking this question up but I'm having trouble since I don't know the underlying terms involved in this question. Assuming: class Parent {} class Child extends Parent {} What is the difference between: Parent c = new Child(); and Child c = new Child(); Thanks in advance for any help you can provide.
has comment: http://stackoverflow.com/comment/37699761
downvote count: 0
tagged with: inheritance
accepted answer: http://stackoverflow.com/a/24377292
possible better answer: http://stackoverflow.com/a/24377375
type: Question
linked to: http://stackoverflow.com/q/4447924
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24377375
favorite count: 0
duplicate of: http://stackoverflow.com/q/4447924
has comment: http://stackoverflow.com/comment/37699805
tagged with: constructor
has comment: http://stackoverflow.com/comment/37699673
has title: What is the difference between "Parent c = new Child()" and "Child c = new Child()"?
score: 4
has answer: http://stackoverflow.com/a/24377292
tagged with: java
linked to: http://stackoverflow.com/q/4454439
upvote count: 4
answer count: 2

http://stackoverflow.com/a/24436172
type: Answer
has body: This worked for me: BaseAdapter baseAdapter = (BaseAdapter) getPreferenceScreen().getRootAdapter(); baseAdapter.notifyDataSetChanged();
accepted answer of: http://stackoverflow.com/q/24373653
answers question: http://stackoverflow.com/q/24373653
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/24315269
has body: I have an AdapterView.OnItemClickListener implemented in a parent Activity that returns if the position if &lt;= to zero. When I subclass this Activity and override the OnItemClickListener, call super, then retrieve the item from my Adapter, an ArrayIndexOutOfBoundsException thrown. But this occurs because the return isn't called before Adapter.getItem is called from my subclass. In other words: This works @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { if (position &lt;= 0) { return; } final Foo foo = mAdapter.getItem(position); } This doesn't work In my parent Activity @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { if (position &lt;= 0) { return; } } In my subclass @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { super.onItemClick(parent, view, position, id); final Foo foo = mAdapter.getItem(position); } But if I log OnItemClickListener.onItemClick in my parent Activity and just leave out Adapter.getItem in my subclass, the Exception isn't thrown and the log prints. So, I suppose I just don't understand why super and return aren't being called beforehand, even though it looks like they should be. Does super just not operate like this? Am I just completely overlooking something here? Just to be clear, the ArrayIndexOutOfBoundsException means nothing in this case. It occurs because I'm using a very customized Adapter.
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/37582236
has title: Return not being called from super in parent Activity
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/37582923
answer count: 0
tagged with: super
type: UnansweredQuestion
tagged with: superclass
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/a/24384667
score: 1
answers question: http://stackoverflow.com/q/24278992
has body: I was trying to implement something like the below one.not sure how did they implement it. (http://testng.org/doc/documentation-main.html) 5.18.2 - Guice dependency injection If you use Guice, TestNG gives you an easy way to inject your test objects with a Guice module: @Guice(modules = GuiceExampleModule.class) public class GuiceTest extends SimpleBaseTest { @Inject ISingleton m_singleton; @Test public void singletonShouldWork() { m_singleton.doSomething(); } } In this example, GuiceExampleModule is expected to bind the interface ISingleton to some concrete class: public class GuiceExampleModule implements Module { @Override public void configure(Binder binder) { binder.bind(ISingleton.class).to(ExampleSingleton.class).in(Singleton.class); } } Refernce: Copied from testng.org
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/37596222
score: 0
type: AnswerComment
has text: Thank you for your reply. Yes this is supposed to be an image file. Can you provide an example for the case using byte[]. Thanks in advance
comment on: http://stackoverflow.com/a/24322834
type: Comment

http://stackoverflow.com/q/24420350
has comment: http://stackoverflow.com/comment/37780710
has body: From what I have read it seems that code like this would require the app to be running in a thread until the notification fires. I need the notification to fire at a later date and time so the user sees the notification just like any other notification and then clicks it and it opens of an activity, passing in some data so the app knows what to do. How can I make this notification fire days later without the app running the whole time? Do I use wait to accomplish this? long millis = 60000; myNotification.wait(millis); Here is my code which fires immediately NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getActivity()) .setSmallIcon(R.drawable.star) .setContentTitle("How was " + me.getString("EventTitle") + "?") .setContentText("Click here to leave your review"); Intent resultIntent = new Intent(getActivity(), SetupActivity.class); PendingIntent resultPendingIntent = PendingIntent.getActivity( getActivity(), 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT ); mBuilder.setContentIntent(resultPendingIntent); int mNotificationId = me.getInt("EventID"); // Gets an instance of the NotificationManager service NotificationManager mNotifyMgr = (NotificationManager) getActivity().getSystemService(getActivity().NOTIFICATION_SERVICE); // Builds the notification and issues it. mNotifyMgr.notify(mNotificationId, mBuilder.build());
accepted answer: http://stackoverflow.com/a/24420677
type: Question
score: 3
has comment: http://stackoverflow.com/comment/37780913
has answer: http://stackoverflow.com/a/24420677
has title: Is it possible to set an Android Notification or a later date and time that will fire when the app is not running?
upvote count: 3
tagged with: notifications
answer count: 1
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/37780847
type: AnsweredQuestion
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/37616855
comment on: http://stackoverflow.com/a/24333624
has text: The for loop should be for(int i=0;i<numNodes;i++)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24394285
downvote count: 0
has body: What a dumb question. Of course Java doesn't support multiple inheritance, and interfaces are not inherited. Inheritance only happens via "extends", not via "implements". When you define a class implements several interfaces you are not saying it will be an extension of those interfaces, but it will have the same behavior, and behavior (at least in Java), doesn't define inheritance. For Java to support multiple inheritance, it would need to support something like public class MI extends Object, MyOtherClass Which Java can't. Well, maybe I wouldn't get the job for calling the interviewer's question dumb :)
answers question: http://stackoverflow.com/q/24378375
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/24321689
upvote count: 1
has comment: http://stackoverflow.com/comment/37593948
has body: You can use the os.name System property to determine what OS you are running on... String os = System.getProperty("os.name"); if (os.startsWith("Mac")) { // Running on Mac } else if (os.startsWith("Windows")) { // Running on Windows } Sorry, don't have a Linux box to test on ;) On Windows, you can try testing the PROCESSOR_ARCHITECTURE environment variable, which when running within a x64 bit process state, should return AMD64
has comment: http://stackoverflow.com/comment/37594186
type: Answer
answers question: http://stackoverflow.com/q/24321622
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37593998
has comment: http://stackoverflow.com/comment/37594140

http://stackoverflow.com/comment/37747235
type: QuestionComment
comment on: http://stackoverflow.com/q/24402540
has text: Never underestimate your code, what you consider to be mess may not be a mess. Just share what u have coded.
score: 0
type: Comment

http://stackoverflow.com/a/24341318
has comment: http://stackoverflow.com/comment/37632138
score: 3
answers question: http://stackoverflow.com/q/24341238
upvote count: 3
has comment: http://stackoverflow.com/comment/37644515
has comment: http://stackoverflow.com/comment/37631803
type: Answer
has comment: http://stackoverflow.com/comment/37631869
downvote count: 0
has body: insert all image id to one list, use AndroidWarriors answer for generate one random number, get that image and remove from list, call more time until size of your list became 0 you can use following code: ArrayList&lt;Integer&gt; imageId = new ArrayList&lt;Integer&gt;(); // insert your id here then: int index ; while (imageId.size() &gt; 0) { index = randomInt(0 , imageId.size()); /// do what you want with this index imageId.remove(index); } and randomInt public int randomInt(int min, int max) { Random randNumber = new Random(); int randomNumber = randNumber.nextInt((max - min) + 1) + min; return randomNumber; }

http://stackoverflow.com/comment/37600418
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24322946
has text: Thank you so much!! That worked I have been stuck trying to figure this out for months :)
type: AnswerComment

http://stackoverflow.com/comment/37742756
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24400138
has text: One note . The problem disappears after restarting A.But that solution is not acceptable to me.Somewhere something is wrong.Please help in diagnosing this.
type: Comment

http://stackoverflow.com/q/24320879
type: Question
tagged with: wsdl
tagged with: soap
score: 1
favorite count: 0
upvote count: 1
tagged with: web-services
tagged with: wsdl2java
answer count: 0
tagged with: java
downvote count: 0
has title: jax-ws-catalog xml in Soap webservice
type: UnansweredQuestion
has body: i have java client service for .net 3.0 server. In client service, i have two types of flow 1)using remote wsdllocation url, i able to fetch the services list from remote. 2)using local wsdl path,i able to fetch the services from local wsdl file and then binding to remote url for response.In that they used jax-ws-catalog xml for mapping local wsdl path for url location My question is 1)at what situation used client service using remote wsdllocation url and local wsdl file? 2)how we generate local wsdl file and jax-ws-catalog xml in META-INF folder? is it manually create or by any commands in tool? i used 'apache-cxf' tool for create class file using command 'wsdl2java -frontend' but it not generate META-INF folder. Thanks

http://stackoverflow.com/q/24390463
tagged with: java-8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/47010883
linked to: http://stackoverflow.com/q/29028980
downvote count: 0
tagged with: java-stream
tagged with: java
has answer: http://stackoverflow.com/a/24391227
type: Question
has title: Java 8 Stream and operation on arrays
has answer: http://stackoverflow.com/a/24391402
tagged with: arrays
score: 218
has answer: http://stackoverflow.com/a/37360435
linked to: http://stackoverflow.com/q/17640754
answer count: 4
favorite count: 0
has body: I have just discovered the new Java 8 stream capabilities. Coming from Python, I was wondering if there was now a neat way to do operations on arrays like summing, multiplying two arrays in a "one line pythonic" way ? Thanks
possible better answer: http://stackoverflow.com/a/24391402
upvote count: 218
accepted answer: http://stackoverflow.com/a/24391227

keystroke
type: Tag
tags question: http://stackoverflow.com/q/24296796
tag name: keystroke

http://stackoverflow.com/comment/37573525
type: QuestionComment
comment on: http://stackoverflow.com/q/24310950
score: 0
type: Comment
has text: Nothing...an empty value

http://stackoverflow.com/a/24401216
answers question: http://stackoverflow.com/q/24400557
type: Answer
score: 0
has body: You can do something like below: eg. class A{ private B b; public setB(B b){ this.b = b; } public Map getMapFromA(){ return b.getMap(); } } class B{ private Map tmp; public void setMap(HashMap t){ tmp.putAll(t); } public HashMap getMap(){ return tmp; } } And in web.xml setB Now spring beans are by default singleton scoped. So you can do the following. function do(){ B b = ctx.getBean("classB"); b.setMap(someMap); A a = ctx.getBean("classA"); a.getMapFromA(); } I havent tried out the code but it will give you an idea I hope so. More details on MethodInvokingFactoryBean : here And if you dont want to do it by Spring and if you want less efforts try using ThreadLocal to pass parameters.

http://stackoverflow.com/q/24421337
has body: I am trying to build Apaches Xerxes 2.11.0 in Java and running into the following compile errors: [xjavac] c:\Program Files\Java\libraries\xerces-2_11_0\build\src\org\apache\html\dom\HTMLFrameElementImpl.java:28: error: HTMLFrameElementImpl is not abstract and does not override abstract method getContentDocument() in HTMLFrameElement [xjavac] public class HTMLFrameElementImpl [xjavac] ^ [xjavac] c:\Program Files\Java\libraries\xerces-2_11_0\build\src\org\apache\html\dom\HTMLIFrameElementImpl.java:28: error: HTMLIFrameElementImpl is not abstract and does not override abstract method getContentDocument() in HTMLIFrameElement [xjavac] public class HTMLIFrameElementImpl [xjavac] ^ [xjavac] c:\Program Files\Java\libraries\xerces-2_11_0\build\src\org\apache\html\dom\HTMLObjectElementImpl.java:28: error: HTMLObjectElementImpl is not abstract and does not override abstract method getContentDocument() in HTMLObjectElement [xjavac] public class HTMLObjectElementImpl [xjavac] ^ Any thoughts on what I might be missing or doing wrong, or better, is there somewhere I can just download a pre-compiled jar for this library? (The "binary distribution" available on the downloads page seems to actually be just documentation and samples.)
score: 0
answer count: 2
has title: compile errors trying to build Apache Xerces in java
possible better answer: http://stackoverflow.com/a/27632551
accepted answer: http://stackoverflow.com/a/24422082
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24422082
tagged with: installation
tagged with: xerces
tagged with: java
has answer: http://stackoverflow.com/a/27632551
type: Question
tagged with: xerces2-j

http://stackoverflow.com/comment/37596729
has text: The error message says it all: class Day is public, should be declared in a file named Day.java
score: 7
comment on: http://stackoverflow.com/q/24323429
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37665521
type: AnswerComment
has text: please check out the question code before you give an answer @jobcrazy,..... bcoz from MyBroadcastReceiver.java You can see the state whether its wifi direct functional or not is tested there. Somethingelse must be forgotten other than that.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24358867

http://stackoverflow.com/q/24410729
tagged with: windows
has answer: http://stackoverflow.com/a/24411446
has body: Problem in running apache ant using java in eclipse on windows. Can anyone suggest me how can I run an ant using eclipse in windows 64 bit operating system. I found that there is no apache ant software for 64 bit os. Can anyone please let me know how? can I run a program using apache ant using eclipse in windows 64 bit os?
score: 0
answer count: 1
tagged with: ant
tagged with: java
has title: How to run a java program using apache ant and eclipse in windows 64 bit OS?
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37763038
tagged with: apache
type: UnansweredQuestion
type: Question

http://stackoverflow.com/comment/37802788
type: Comment
comment on: http://stackoverflow.com/q/24387394
score: 0
type: QuestionComment
has text: No, I added the main class to the question.

http://stackoverflow.com/a/24435307
score: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37830159
has comment: http://stackoverflow.com/comment/37829539
type: Answer
has comment: http://stackoverflow.com/comment/37823163
answers question: http://stackoverflow.com/q/24423142
upvote count: 5
has comment: http://stackoverflow.com/comment/37823972
has comment: http://stackoverflow.com/comment/37831009
has comment: http://stackoverflow.com/comment/37827161
has body: Why do you need Hibernate here? Just use JDBC. You probably want to fire an application-wide event anyways (perhaps to send a websocket msg or bust an ehcache), and if you need to do something w hibernate, subscribe to that event and do something with Hibernate. http://impossibl.github.io/pgjdbc-ng/ is your friend here. No polling required. See http://blog.databasepatterns.com/2014/04/postgresql-nofify-websocket-spring-mvc.html
accepted answer of: http://stackoverflow.com/q/24423142
downvote count: 0
has comment: http://stackoverflow.com/comment/37830295

http://stackoverflow.com/a/24284250
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24284159
score: 1
upvote count: 1
has body: Workbook workbook = Workbook.getWorkbook(new File("d:\\test\\book1.xls")); You should read how it's done before doing it.

http://stackoverflow.com/comment/37560549
type: Comment
comment on: http://stackoverflow.com/q/24304242
score: 0
type: QuestionComment
has text: execute `mvn clean install` in a terminal in your project folder and show us the output.

http://stackoverflow.com/comment/37599256
type: AnswerComment
score: 0
type: Comment
has text: yes sorry, i forgot to tell you that the result is "array". Print "array" and you will have what you want
comment on: http://stackoverflow.com/a/24324457

http://stackoverflow.com/q/24344771
has body: I was successful already inserting and finding objects in jndi directory across apps running in the same JVM with: InitialContext initialContext = new InitialContext(); initialContext.bind("xpto",this); Object obj = initialContext.lookup("xpto"); Still I want to organise the namespace and therefore bind objects like: InitialContext initialContext = new InitialContext(); initialContext.bind("/aaa/xpto",this); Object obj = initialContext.lookup("/aaa/xpto"); And this is failing with javax.naming.NameNotFoundException: aaa is not bound I understand I may need to do something more to create the "aaa" node, but can't find anywhere what it is... most of the jetty documentation refers to statically defined objects which is not what I want. Can someone point me in the right direction ?
has answer: http://stackoverflow.com/a/24349280
type: UnansweredQuestion
tagged with: jetty
has comment: http://stackoverflow.com/comment/37639279
has comment: http://stackoverflow.com/comment/37637474
has comment: http://stackoverflow.com/comment/37645963
tagged with: java
has comment: http://stackoverflow.com/comment/37639862
type: Question
has comment: http://stackoverflow.com/comment/37646634
tagged with: jndi
has comment: http://stackoverflow.com/comment/37647199
has title: How to populate JNDI directory programatically in Jetty?
has comment: http://stackoverflow.com/comment/37645790
has comment: http://stackoverflow.com/comment/37646682
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24349131

http://stackoverflow.com/comment/37725848
has text: In the above note - "ability to measure" read "keep up with".
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24390541

http://stackoverflow.com/q/24333645
answer count: 2
has body: Hello I’m a little rusty on my Java, so please bear with me. I have been tasked with reducing the amount of duplicated code in a research project for my Professor, so I don’t think I’m able to post any of the code on here. But basically I have about 20 cases of generally the same method (test method) in different classes, and I’ve been trying two different ways to solve this problem but I have run into issues with each. The first way I’ve found to reduce the duplication is to remove the initial variables contained in all of the test methods and place them in a separate method (prepare method) inside of a superclass and have it called into the test method. Isn’t the problem with this solution that all of the variables declared in the prepare method will remain local and be erased as soon as the method is called inside of another method? The second idea I had was to just make all of the variables fields of the superclass and have them be inherited by the subclasses. This solution almost worked except for the fact that one of the variables IFile importedFile = importFile(file); which is necessary for creating many of these variables has to have whatever it is contained in throw an Exception, which I do not believe you can do with a class. I was hoping someone could point me in the right direction with one of these solutions or possibly suggest another solution I have been unable to find. Something I forgot to mention is that besides the initial variables, each test method slightly varies in how their test method is written. Edit: If not for this I would have just pulled up the method into a superclass and been done with it. Edit: Here's the test method and the parts of the superclass I am using, // method inside of the subclass public void test() throws Exception { // variables removed and placed in AbstractTest for (int i = 0; i &lt; expectedExitNodeCount; i++) { if (markerFields.peekFirst().equalsIgnoreCase("EXPOSED_EXIT")) { expectedExitNodes.add(new CTrueExitNode()…
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24334488
has comment: http://stackoverflow.com/comment/37616790
has comment: http://stackoverflow.com/comment/37616634
tagged with: oop
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24333712
has comment: http://stackoverflow.com/comment/37616903
has title: Passing variables into a method using another method or inheritence
upvote count: 1
tagged with: methods
type: Question
has comment: http://stackoverflow.com/comment/37618023
tagged with: inheritance

http://stackoverflow.com/q/24282315
has title: Websocket - ServerEndpoint and ClientEndpoint does not exchange messages
has answer: http://stackoverflow.com/a/24284336
has body: I'm currently testing Websockets with Glassfish 4 and the "on board" implementation but cannot send or receive any messages although following tutorials like The Java EE 7 Tutorial - Sending and Receiving Messages or How to build Java WebSocket Applications Using the JSR 356 API. I want to implement a simple client server communication so all I have is a server: @ServerEndpoint("/echotest") public class Server { private static final Logger LOGGER = LoggerFactory.getLogger(Server.class); @OnOpen public void onOpen(Session session) { LOGGER.info("OnOpen invoked by Session '{}'.", session.getId()); try { session.getBasicRemote().sendText("Hello Client!"); } catch (IOException ex) { LOGGER.error("Message delivery failed.", ex); } } @OnClose public void onClose(Session session, CloseReason closeReason) { LOGGER.info("OnClose invoked by Session '{}'; Reason: {}.", session.getId(), closeReason.getReasonPhrase()); } @OnMessage public void onMessage(Session session, String msg) { LOGGER.info("OnMessage invoked by Session '{}'; Message: {}.", session.getId(), msg); } } and a client: @ClientEndpoint public class Client { private static CountDownLatch latch; private static final Logger LOGGER = LoggerFactory.getLogger(Client.class); @OnOpen public void onOpen(Session session) { LOGGER.info("OnOpen invoked by Session '{}'.", session.getId()); try { session.getBasicRemote().sendText("Hello Server!"); } catch (IOException ex) { LOGGER.error("Message delivery failed.", ex); } } @OnClose public void onClose(Session session, CloseReason closeReason) { LOGGER.info("OnClose invoked by Session '{}'; Reason: {}.", session.getId(), closeReason.getReasonPhrase()); } @OnMessage public void onMessage(Session session, String msg) { LOGGER.info("OnMessage invoked by Session '{}'; Message: {}.", session.getId(), msg); } public static void main(String[] args) { latch = new CountDownLatch(1); WebSocketContainer container = ContainerProvider.getWebSocketContainer(); try { container.connectToServer…
accepted answer: http://stackoverflow.com/a/24284336
tagged with: java
tagged with: jsr356
type: Question
type: AnsweredQuestion
tagged with: glassfish
score: 0
answer count: 1
tagged with: websocket

http://stackoverflow.com/comment/37509333
has text: @GPS Yes, instances of wrapper classes are non-primitive, as they are objects. An instance can represent the same value as a given primitive, but that does not make it a primitive.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24277083

http://stackoverflow.com/q/24392603
upvote count: 1
has answer: http://stackoverflow.com/a/24393972
type: Question
has comment: http://stackoverflow.com/comment/37729970
has comment: http://stackoverflow.com/comment/37729916
has answer: http://stackoverflow.com/a/24394093
possible better answer: http://stackoverflow.com/a/24393972
downvote count: 0
has comment: http://stackoverflow.com/comment/37728723
answer count: 3
has comment: http://stackoverflow.com/comment/37730016
has body: Here is a snippet of code that I have. I am trying to bound my object in a circle rather than a square, but there are things wrong with my code that I can't figure out. I have both the rectangle bounds which work and the circle bounds which don't work. // get the pos _touchingPoint.x = (int)event.getX(); _touchingPoint.y = (int)event.getY(); angle = Math.atan2(_touchingPoint.y , _touchingPoint.x); // bound to a box if( _touchingPoint.x &lt; 75){ _touchingPoint.x = 75; } if ( _touchingPoint.x &gt; 225){ _touchingPoint.x = 225; } if (_touchingPoint.y &lt; 300){ _touchingPoint.y = 300; } if ( _touchingPoint.y &gt; 450 ){ _touchingPoint.y = 450; } //bound to a circle if( _touchingPoint.x &lt; 75 * Math.cos(angle)) { _touchingPoint.x = (int) (75 * Math.cos(angle)); } if ( _touchingPoint.x &gt; 225 * Math.cos(angle)) { _touchingPoint.x = (int) (225 * Math.cos(angle)); } if ( _touchingPoint.y &lt; 300 * Math.sin(angle)) { _touchingPoint.y = (int) (300 * Math.sin(angle)); } if ( _touchingPoint.y &gt; 450 * Math.sin(angle)) { _touchingPoint.y = (int) (450 * Math.sin(angle)); } _touchingPoint.x and _touchingPoint.y represent the object (Joystick) that I am trying to constrain. I figured I could try simple trig to constrain the Joystick to a circle, but I guess I was wrong. What would be the best way to set up a circle constraint?
favorite count: 0
accepted answer: http://stackoverflow.com/a/24394093
type: AnsweredQuestion
has title: Bounding Joystick to a Circle
score: 1
tagged with: math
has answer: http://stackoverflow.com/a/24393531
tagged with: java

http://stackoverflow.com/comment/37700882
has text: Purely a direction change was not enough (due to noise on the signal) I ended up looking for a substantial direction change, and this turned out to be relatively accurate.
comment on: http://stackoverflow.com/a/24373964
score: 2
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37626737
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24339130
has text: @Bayant_singh Something like that, except with code contracts you can inspect the values of arguments in addition to their types.
score: 0

http://stackoverflow.com/q/24408864
duplicate of: http://stackoverflow.com/q/18609160
upvote count: 4
has answer: http://stackoverflow.com/a/24414123
answer count: 2
has title: Eclipse returned error message “Java was started but returned exit code= 1”
downvote count: 0
linked to: http://stackoverflow.com/q/18609160
favorite count: 0
has answer: http://stackoverflow.com/a/24409026
tagged with: windows
possible better answer: http://stackoverflow.com/a/24414123
tagged with: java
has body: Ok, so I had tried to install a new jdk / jre and suddenly my eclipse will not open. I have tried uninstalling old forms of java and reinstalling the java that I need, and it refuses to open. I've googled this and tried a dozen answers online but none of them work for me. It's extremely frustrating. ideas?
type: Question
type: AnsweredQuestion
score: 4
has comment: http://stackoverflow.com/comment/37758815
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/24409026
has comment: http://stackoverflow.com/comment/37759066

http://stackoverflow.com/comment/37658550
type: Comment
score: 1
comment on: http://stackoverflow.com/q/24355424
has text: its certainly not undesirable ! ( particularly the `hashCode()`
type: QuestionComment

http://stackoverflow.com/comment/37690427
type: QuestionComment
score: 3
has text: this code cracks the interview because it violates Java code style
comment on: http://stackoverflow.com/q/24372387
type: Comment

http://stackoverflow.com/comment/37568483
comment on: http://stackoverflow.com/a/24308083
type: AnswerComment
score: 0
type: Comment
has text: Usually the JDK is a safe bet. For example if the program you want to use the `tools.jar` (for example scripting), it is better to use JDK. If it works with the JRE only it does not matter too much which you choose.

http://stackoverflow.com/a/65517590
upvote count: 3
type: Answer
score: 3
downvote count: 0
has body: Selenium 4 supports authenticating using Basic and Digest auth . It's using the CDP and currently only supports chromium-derived browsers Java Example : Webdriver driver = new ChromeDriver(); ((HasAuthentication) driver).register(UsernameAndPassword.of("username", "pass")); driver.get("http://sitewithauth"); Note : In Alpha-7 there is bug where it send username for both user/password. Need to wait for next release of selenium version as fix is available in trunk https://github.com/SeleniumHQ/selenium/commit/4917444886ba16a033a81a2a9676c9267c472894
answers question: http://stackoverflow.com/q/24304752

http://stackoverflow.com/comment/37778891
score: 0
type: Comment
type: QuestionComment
has text: @RetoKoradi thanks, I never noticed about such default values before. Good to know!
comment on: http://stackoverflow.com/q/24414222

http://stackoverflow.com/q/24400408
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24410049
downvote count: 0
has title: CordovaWebView messes up with onBackPressed method in android
tagged with: android
answer count: 1
favorite count: 0
tagged with: cordova
upvote count: 2
type: UnansweredQuestion
score: 2
has body: As title says CordovaWebView and onBackPressed in android in combination are giving weird results. I have hybrid app. My main activity has DrawerLayout and CordovaWebView. My onBackPressed: @Override public void onBackPressed(){ if(drawerIsOpen){ //close drawer }else if(webviewIsIn){ //hide webview }else{ super.onBackPressed(); } } When I use android's WebView the overridden method is called as expected. And when I change to CordovaWebView the method wouldn't even get called, instead native onBackPressed would be called instead. I have tried overriding onKeyDown and onKeyUp but it gives me the same result, the methods are just not being called. I'm using Cordova 2.9.0 and testing device is Galaxy Note 2, Android jellybean 4.2.2 DrawerLayout has the close on back pressed functionality I've just disabled it. I hope you guys can understand the problem.

http://stackoverflow.com/q/24356343
tagged with: java
tagged with: jpanel
type: Question
has body: I've got a Hashmap of JPanel components and I'm trying to iterate through and style, i've done this in the past with JButtons on a JPanel but i'm having trouble getting the JLabel-specific attributes. The code i've got: for (Component item : imageAreas.values()) { // Style components item.setBorder(BorderFactory...); } The problem being there is no setBorder() attribute for components, is there any way I can cast the component item to JPanel in the for loop? - I've tried adding (JLabel) in front of everything but it doesn't like that. The imageAreas is the hashmap.
answer count: 2
has answer: http://stackoverflow.com/a/24356372
accepted answer: http://stackoverflow.com/a/24356372
has title: Iterate Through JPanel Components In Hashmap
has answer: http://stackoverflow.com/a/24356381
score: 0
tagged with: swing
possible better answer: http://stackoverflow.com/a/24356381
type: AnsweredQuestion

http://stackoverflow.com/q/24285015
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37524811
has title: Is it possible to create Criteria Query without defining a root?
has comment: http://stackoverflow.com/comment/37525449
tagged with: criteria-api
upvote count: 1
has comment: http://stackoverflow.com/comment/37523982
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24285938
has comment: http://stackoverflow.com/comment/37524252
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37525388
has answer: http://stackoverflow.com/a/24285938
has body: Is it possible to create Criteria Query without defining a root? Or should I always define at least one root? Updated: I've tried to do this and I've had an IllegalStateException - no criteria query roots were specified But I wonder if there are any chances to make a criteria query without defining a root?
tagged with: criteria
tagged with: jpa

http://stackoverflow.com/comment/37703798
score: 0
type: Comment
type: AnswerComment
has text: so I got this, but what is gonna compare to what? isn't i compare to i? why we need to compare i to i when they are the same thing? can u understand my confusion?
comment on: http://stackoverflow.com/a/24378702

http://stackoverflow.com/comment/37557240
has text: Erm, i'm not familiar with OpenGL. If possible, could you guide me into the right direction? I'm somewhat new to Android.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24298383

http://stackoverflow.com/q/24331765
has comment: http://stackoverflow.com/comment/37612915
answer count: 1
has comment: http://stackoverflow.com/comment/37612846
tagged with: postgresql
upvote count: 3
tagged with: sql
accepted answer: http://stackoverflow.com/a/24338159
downvote count: 1
tagged with: jdbc
has body: If I have a statement like: INSERT INTO foo (id, name, description, etc_a, etc_b) VALUES (?, ?, ?, ?, ?); It's passed into a PreparedStatement. Sometimes I want to specify an id, and sometimes I want to use the database's DEFAULT for id, which is the next unused id value. Is there a way I can tell the PreparedStatement (PS) to use DEFAULT for one of the values without having a second PS with DEFAULT in the place of the first ?? I'm using PostgreSQL.
favorite count: 0
has answer: http://stackoverflow.com/a/24338159
has comment: http://stackoverflow.com/comment/37616918
score: 2
type: AnsweredQuestion
has title: Is there something like preparedStatement.setDefault()?
has comment: http://stackoverflow.com/comment/37612943
tagged with: java
has comment: http://stackoverflow.com/comment/37612932
type: Question

http://stackoverflow.com/comment/37664340
score: 0
comment on: http://stackoverflow.com/q/24357693
type: Comment
type: QuestionComment
has text: @SotiriosDelimanolis What about this one - http://docs.spring.io/spring/docs/3.1.x/javadoc-api/org/springframework/validation/beanvalidation/MethodValidationPostProcessor.html / http://stackoverflow.com/questions/19425221/spring-validated-in-service-layer ?

http://stackoverflow.com/q/24420504
tagged with: java
score: 0
answer count: 2
tagged with: mocking
tagged with: mockito
has comment: http://stackoverflow.com/comment/37781255
has body: I have a method like this which I am trying to test using Mockito: public class MiscUtil{ public int getValue(String key){ Properties properties = new Helper().getProperties() //This is the method //I need to mock return properties.get(key) } Here is the test class : public class MiscUtilTest{ public void testGetBooleanValue() { Properties properties = new Properties(); properties.setProperty(MY_SPECIAL_INT_PROPERTY, 10); // Mock Helper Helper mock = Mockito.mock(Helper.class); // mock the method getProperties() Mockito.when(mock.getProperties()).thenReturn(properties); // Assert that the getValue() method Assert.assertEquals(10,MiscUtil.getValue(MY_SPECIAL_int_PROPERTY)); However, the method doesn't get mocked. Do I have to pass the actual mocked instance into the MiscUtil class in order for mocking to take effect? The MiscUtil class doesn't let me pass the Helper object to it. It is very easy to mock a particular method of any class in JMockit even though the upper classes may not have access to it. Is it possible to do this in Mockito?
has answer: http://stackoverflow.com/a/24420716
has answer: http://stackoverflow.com/a/24421166
has comment: http://stackoverflow.com/comment/37780972
type: UnansweredQuestion
tagged with: unit-testing
type: Question
has title: How to mock a class throughout the system using Mockito

http://stackoverflow.com/comment/37693805
type: AnswerComment
comment on: http://stackoverflow.com/a/24374080
score: 0
type: Comment
has text: @TimZ. When i fill the data i instantiate it there.

http://stackoverflow.com/a/24363011
type: Answer
has body: First off, using an Extension in a constant is very dangerous at best, but most probably will flat-out not work. But most importantly, I've deprecated Refresher in favor of UI.setPollInterval() which was introduced in Vaadin 7.1. Vaadin 7.2 (I think) introduced a PollListener, so you now get events for each poll as well. I guess I should make that deprecation explicit now that Refresher is finally 100% integrated into Vaadin.
has comment: http://stackoverflow.com/comment/37673635
has comment: http://stackoverflow.com/comment/37672981
has comment: http://stackoverflow.com/comment/37672823
has comment: http://stackoverflow.com/comment/37672918
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/24362405
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24362405

protocol-buffers
tags question: http://stackoverflow.com/q/24309282
tag name: protocol-buffers
type: Tag

http://stackoverflow.com/comment/37556825
has text: And what if you throw an IllegalStateException?
score: 0
comment on: http://stackoverflow.com/q/24301231
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37706856
comment on: http://stackoverflow.com/a/24377230
type: AnswerComment
score: 0
type: Comment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/56169/discussion-between-xijiaopin-and-rod-algonquin).

http://stackoverflow.com/comment/37699776
type: AnswerComment
has text: @XiJiaopin editted add the above code to your actovoity
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24377230

http://stackoverflow.com/comment/37721949
type: Comment
has text: well both of our solutions are dynamic - and by the time the view is visible, the color is already set (so every time you press it, it will be the same), just like my solution. the conditions that he uses to determine the color in your view can be used in my method just the same way and the result will be identical.
comment on: http://stackoverflow.com/a/24375067
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37712886
type: Comment
has text: it seams authEmail is a string "null" instead of Null Object
type: QuestionComment
score: 4
comment on: http://stackoverflow.com/q/24384557

http://stackoverflow.com/a/24274729
has comment: http://stackoverflow.com/comment/37506891
score: 6
has comment: http://stackoverflow.com/comment/37507467
has comment: http://stackoverflow.com/comment/37506540
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37506948
accepted answer of: http://stackoverflow.com/q/24274432
has body: Here's the implementation of InputStream from ZipFile: /* * Inner class implementing the input stream used to read a * (possibly compressed) zip file entry. */ private class ZipFileInputStream extends InputStream { ... public int read(byte b[], int off, int len) throws IOException { if (rem == 0) { return -1; } if (len &lt;= 0) { return 0; } if (len &gt; rem) { len = (int) rem; } synchronized (ZipFile.this) { ensureOpenOrZipException(); Notice the call to #ensureOpenOrZipException. So the answer to your question is unfortunately no, there is no way to keep the stream open. What you could do instead is wrap and hook the #close on the InputStream to close your zip file: InputStream zipInputStream = ... return new InputStream() { @Override public int read() throws IOException { return zipInputStream.read(); } @Override public void close() throws IOException { zipInputStream.close(); zipFile.close(); } } Another approach would be to buffer it: InputStream myZipInputStream = ... //Read the zip input stream fully into memory byte[] buffer = ByteStreams.toByteArray(zipInputStream); zipFile.close(); return new ByteArrayInputStream(buffer); Obviously this has now all gone into memory, so your data will need to be a reasonable size.
answers question: http://stackoverflow.com/q/24274432
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/37505346

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/24335866
type: Tag
tags question: http://stackoverflow.com/q/24320286

http://stackoverflow.com/q/24400006
possible better answer: http://stackoverflow.com/a/45282838
has title: Talend ETL Job Error in tOracleOutput Component
tagged with: talend
favorite count: 0
accepted answer: http://stackoverflow.com/a/24400991
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/37743990
type: AnsweredQuestion
tagged with: java
tagged with: etl
has body: I am a newbie to TalendETL and am using Talend Open Studio for Big Data version 5.4.1 . I have developed a simple Talend ETL job that picks up data from a csv file and inserts data into my local Oracle Database. Below is how my package looks: The job returns an exception that ArrayIndexOutOfBounds after the last record of the csv file. But I'm uncertain as to why it should return that in the first place? I checked out the solution given on this link: http://www.talendforge.org/forum/viewtopic.php?id=21644 But it doesn't seem to work at all. I have the latest driver for the oracle component and increasing/decreasing the commit size does not seem to affect it. Can someone please help me out on this? Please let me know in case more information is needed. P.S: The complete error log is below:- Starting job Kaggle_Data_Load_Training at 09:31 25/06/2014. [statistics] connecting to socket on port 3957 [statistics] connected Exception in component tOracleOutput_1 java.lang.ArrayIndexOutOfBoundsException: -32203 at oracle.jdbc.driver.OraclePreparedStatement.setupBindBuffers(OraclePreparedStatement.java:2677) at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9270) at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:210) at test.kaggle_data_load_training_0_1.Kaggle_Data_Load_Training.tFileInputDelimited_1Process(Kaggle_Data_Load_Training.java:4360) at test.kaggle_data_load_training_0_1.Kaggle_Data_Load_Training.runJobInTOS(Kaggle_Data_Load_Training.java:4717) at test.kaggle_data_load_training_0_1.Kaggle_Data_Load_Training.main(Kaggle_Data_Load_Training.java:4582) [statistics] disconnected Job Kaggle_Data_Load_Training ended at 09:31 25/06/2014. [exit code=1]
has answer: http://stackoverflow.com/a/45282838
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24400991
downvote count: 0

http://stackoverflow.com/comment/55249584
has text: Sounds great. I'll give it a try. BTW: You should have mentioned that you're the CEO of Boxfuse.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/33695401

http://stackoverflow.com/q/24295965
has body: Anyone know why this JSON is invalid? {"street_address":"Stone House Lane, Peckforton , Tarporley , London, Cheshire"} I'm using Jackson for Java and it's complaining about java.lang.IllegalArgumentException: com.fasterxml.jackson.core.JsonParseException: Unexpected end-of-input: was expecting closing quote for a string value at [Source: java.io.StringReader@6ad16fc1; line: 1, column: 405] I noticed this JSON is considered invalid on this online site as well: http://jsonviewer.stack.hu/ Answer: Thanks, for those who are curious I've removed these unreadable characters using tr -cd '\11\12\15\40-\176' &lt; file > cleanFile
has answer: http://stackoverflow.com/a/24296020
favorite count: 0
has title: Why is JSON invalid when commas in string?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37545381
score: 7
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 1
upvote count: 8
type: Question
tagged with: jackson
accepted answer: http://stackoverflow.com/a/24296020
answer count: 1

http://stackoverflow.com/a/24396972
upvote count: 2
has body: The session.load method typically returns a proxy whereas the session.get method is guaranteed to return the initialized entity and would eagerly fetch collection if marked as such. Also there is option of using eager fetch HQL queries to eager load the associated collection.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24395913
answers question: http://stackoverflow.com/q/24395913
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/q/24373541
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37693553
type: Question
has comment: http://stackoverflow.com/comment/38406535
tagged with: mybatis
score: 0
has title: MyBatis association error
has comment: http://stackoverflow.com/comment/38406746
has body: I have three objects: A, B and C. A contains B and B contains C. I need to load some atributtes from all the three. Bellow is my select: I can successfully load A and B, but when I try to load C (bold lines), I get the following error: "java.lang.RuntimeException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for B" Any idea how I can fix this? I'm using MyBatis 3.1.1 with Spring and Maven &lt;select id="loadA" resultMap="AResult"&gt; SELECT * FROM A a, B b, C c where a.lae_ree_cod=b.ree_cod and b.ree_rea_cod=c.rea_cod &lt;/select&gt; &lt;resultMap id="AResult" type="A"&gt; &lt;id property="A_Cod" column="cod" /&gt; &lt;result property="A_Descricao" column="descricao"/&gt; &lt;result property="A_DataInclusao" column="datainclusao"/&gt; &lt;association property="B_Executada" resultMap="BResult" /&gt; &lt;/resultMap&gt; &lt;resultMap id="BResult" type="B"&gt; &lt;id property="B_cod" column="cod"/&gt; &lt;result property="B_voltou" column="voltou"/&gt; **&lt;association property="C_Executada" resultMap="CResult" /&gt;** &lt;/resultMap&gt; **&lt;resultMap id="CResult" type="C"&gt; &lt;id property="C_cod" column="cod"/&gt; &lt;/resultMap&gt;**
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38455705
tagged with: spring

http://stackoverflow.com/a/24413048
type: Answer
answers question: http://stackoverflow.com/q/24412991
score: 1
upvote count: 1
has body: You can use a GridPane to lay out the data like a table. This will automatically adjust the cell widths to match the longest field.
has comment: http://stackoverflow.com/comment/37767428
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24412991

http://stackoverflow.com/comment/37780395
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24417960
has text: This question appears to be off-topic because it is not about programming. Perhaps [Super User](http://superuser.com/) would be a better place to ask.

http://stackoverflow.com/q/24419224
has title: Using "this" keyword with a Constructor - how does "this" refer to to the Point object?
has comment: http://stackoverflow.com/comment/37778693
linked to: http://stackoverflow.com/q/5185084
answer count: 2
tagged with: this
accepted answer: http://stackoverflow.com/a/24419512
has comment: http://stackoverflow.com/comment/37778719
possible better answer: http://stackoverflow.com/a/24419240
has answer: http://stackoverflow.com/a/24419240
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37778638
has answer: http://stackoverflow.com/a/24419512
type: Question
has body: I'm taking this Oracle online java class and don't understand how the this in this example refers to the origin = new Point(0,0); object. First example of the Rectangle class. public class Rectangle { public int width = 0; public int height = 0; public Point origin; // four constructors public Rectangle() { origin = new Point(0, 0); } public Rectangle(Point p) { origin = p; } public Rectangle(int w, int h) { origin = new Point(0, 0); width = w; height = h; } public Rectangle(Point p, int w, int h) { origin = p; width = w; height = h; } // a method for moving the rectangle public void move(int x, int y) { origin.x = x; origin.y = y; } // a method for computing the area of the rectangle public int getArea() { return width * height; } } Rectangle example using the this keyword. public class Rectangle { private int x, y; private int width, height; public Rectangle() { this(0, 0, 1, 1); } public Rectangle(int width, int height) { this(0, 0, width, height); } public Rectangle(int x, int y, int width, int height) { this.x = x; this.y = y; this.width = width; this.height = height; } ... } Where does the second example refer to the origin = new Point(0,0) object? public class Point { // TODO Auto-generated method stub public int x = 0; public int y = 0; // a constructor! public Point(int a, int b) { x = a; y = b; } }
linked to: http://stackoverflow.com/q/577575

http://stackoverflow.com/q/24295393
has comment: http://stackoverflow.com/comment/37546458
type: Question
tagged with: mina
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37545364
tagged with: android
tagged with: utf-8
has comment: http://stackoverflow.com/comment/37555466
answer count: 0
has comment: http://stackoverflow.com/comment/37563528
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/37555085
has body: I'm working on a client-server application with an Android-client and a Java-server-implementation using Apache mina. The application must be able to handle German "Umlaute" (e.g. 'ä', 'ö', 'ü'). In both parts of the application I'm using UTF-8 for encoding and decoding. But when I send a String containing an umlaut from the client to the server the String on the server has a '?' instead of the umlaut. The weird thing is that if I send a String from the server to the client, all characters are displayed in the right way. Here's my server-code: @Override public void messageReceived(IoSession session, Object message) throws Exception { super.messageReceived(session, message); String mess = (String) message; System.out.println(mess); Gson gson = new Gson(); String command = gson.fromJson(mess, CommandObject.class).getCommand(); JsonParser jParser = new JsonParser(); JsonObject jsonObj = (JsonObject) jParser.parse(mess); jsonObj = jsonObj.getAsJsonObject("object"); String json = jsonObj.toString(); String answer = this.commandMap.get(command).execute(json); session.write(answer); } public static void main(String[] args) throws IOException { IoAcceptor acceptor = new NioSocketAcceptor(1); DefaultIoFilterChainBuilder filterChain = acceptor.getFilterChain(); ProtocolCodecFilter filter = new ProtocolCodecFilter( new TextLineCodecFactory(Charset.forName("UTF-8"))); filterChain.addLast("codec", filter); acceptor.setHandler(new IOHandler()); acceptor.bind(new InetSocketAddress(4630)); } And here is the code I use to send data from the client: private static final Charset ENC_CHARSET = Charset.forName("UTF-8"); public TCPSocket(final Socket socket) throws IOException { this.socket = socket; this.inStream = new BufferedReader(new InputStreamReader( socket.getInputStream(), TCPSocket.ENC_CHARSET)); this.outStream = new BufferedWriter(new OutputStreamWriter( socket.getOutputStream(), TCPSocket.ENC_CHARSET)); } public void sendLine(final String line) throws IOException { this.outSt…
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37555176
has title: UTF-8 decoding doesn't work
has comment: http://stackoverflow.com/comment/37545536

http://stackoverflow.com/q/24386534
upvote count: 2
has body: Can I run a simple webservice like this: @Path("/rs/hello") public class HelloWorldProgram { //path is default @GET @Produces(MediaType.TEXT_HTML) public String sayHello() { return "Hello, World!"; } @GET @Produces(MediaType.TEXT_XML) @Path("/xml") public String sayXMLHello() { return "&lt;?xml version=\"1.0\"?&gt;" + "&lt;hello&gt; Hello" + "&lt;/hello&gt;"; } } on the bundled with the JDK simple web server com.sun.net.httpserver.HttpServer ?
score: 2
has comment: http://stackoverflow.com/comment/37720059
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78769116
has title: Can I run a JAX-RS web service on com.sun.net.httpserver.HttpServer?
tagged with: java
has answer: http://stackoverflow.com/a/36263251
type: Question
accepted answer: http://stackoverflow.com/a/36263251
has comment: http://stackoverflow.com/comment/37716865
possible better answer: http://stackoverflow.com/a/24403942
answer count: 3
has answer: http://stackoverflow.com/a/24403942
downvote count: 0
tagged with: jax-rs
favorite count: 0

opengl-es-2.0
tags question: http://stackoverflow.com/q/24341853
tag name: opengl-es-2.0
tags question: http://stackoverflow.com/q/24417262
tags question: http://stackoverflow.com/q/24308894
tags question: http://stackoverflow.com/q/24318809
type: Tag
tags question: http://stackoverflow.com/q/24370226

http://stackoverflow.com/q/24339990
has answer: http://stackoverflow.com/a/53261156
tagged with: cloudinary
type: Question
has answer: http://stackoverflow.com/a/45729116
has answer: http://stackoverflow.com/a/38281222
tagged with: java
answer count: 11
score: 115
has answer: http://stackoverflow.com/a/37259094
possible better answer: http://stackoverflow.com/a/45729116
has answer: http://stackoverflow.com/a/24340058
has answer: http://stackoverflow.com/a/66598842
downvote count: 0
tagged with: file-upload
upvote count: 115
has comment: http://stackoverflow.com/comment/37628230
favorite count: 0
has answer: http://stackoverflow.com/a/54883124
has answer: http://stackoverflow.com/a/41373452
has body: Can any one tell me what is a the best way to convert a multipart file (org.springframework.web.multipart.MultipartFile) to File (java.io.File) ? In my spring mvc web project i'm getting uploaded file as Multipart file.I have to convert it to a File(io) ,there fore I can call this image storing service(Cloudinary).They only take type (File). I have done so many searches but failed.If anybody knows a good standard way please let me know? Thnx
has answer: http://stackoverflow.com/a/54762645
has answer: http://stackoverflow.com/a/69703083
has title: How to convert a multipart file to File?
has answer: http://stackoverflow.com/a/39572293
tagged with: spring
tagged with: spring-mvc
accepted answer: http://stackoverflow.com/a/24340058
type: AnsweredQuestion

web-services
tags question: http://stackoverflow.com/q/24382600
type: Tag
tags question: http://stackoverflow.com/q/24396008
tags question: http://stackoverflow.com/q/24354881
tags question: http://stackoverflow.com/q/24282982
tags question: http://stackoverflow.com/q/24421036
tags question: http://stackoverflow.com/q/24319819
tags question: http://stackoverflow.com/q/24367178
tags question: http://stackoverflow.com/q/24302055
tags question: http://stackoverflow.com/q/24296485
tags question: http://stackoverflow.com/q/24292947
tags question: http://stackoverflow.com/q/24295378
tags question: http://stackoverflow.com/q/24308617
tags question: http://stackoverflow.com/q/24316421
tags question: http://stackoverflow.com/q/24404449
tags question: http://stackoverflow.com/q/24389381
tags question: http://stackoverflow.com/q/24277043
tags question: http://stackoverflow.com/q/24417687
tags question: http://stackoverflow.com/q/24342751
tags question: http://stackoverflow.com/q/24417029
tags question: http://stackoverflow.com/q/24377430
tags question: http://stackoverflow.com/q/24304496
tags question: http://stackoverflow.com/q/24288059
tags question: http://stackoverflow.com/q/24366814
tags question: http://stackoverflow.com/q/24341490
tags question: http://stackoverflow.com/q/24410333
tags question: http://stackoverflow.com/q/24292798
tags question: http://stackoverflow.com/q/24329643
tags question: http://stackoverflow.com/q/24385206
tags question: http://stackoverflow.com/q/24292387
tags question: http://stackoverflow.com/q/24369934
tags question: http://stackoverflow.com/q/24329327
tags question: http://stackoverflow.com/q/24268686
tags question: http://stackoverflow.com/q/24364157
tags question: http://stackoverflow.com/q/24302793
tags question: http://stackoverflow.com/q/24300912
tags question: http://stackoverflow.com/q/24369113
tags question: http://stackoverflow.com/q/24385603
tags question: http://stackoverflow.com/q/24303185
tag name: web-services
tags question: http://stackoverflow.com/q/24320879
tags question: http://stackoverflow.com/q/24289334
tags question: http://stackoverflow.com/q/24280604
tags question: http://stackoverflow.com/q/24370253
tags question: http://stackoverflow.com/q/24301542
tags question: http://stackoverflow.com/q/24358744
tags question: http://stackoverflow.com/q/24325434
tags question: http://stackoverflow.com/q/24313658
tags question: http://stackoverflow.com/q/24384190
tags question: http://stackoverflow.com/q/24411228

twilio
tag name: twilio
type: Tag
tags question: http://stackoverflow.com/q/24398921

http://stackoverflow.com/q/24327634
has answer: http://stackoverflow.com/a/24328423
tagged with: java
tagged with: c#
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24327907
downvote count: 0
has comment: http://stackoverflow.com/comment/37604737
has comment: http://stackoverflow.com/comment/37604734
has answer: http://stackoverflow.com/a/24327907
accepted answer: http://stackoverflow.com/a/24328423
has body: `I have following array {9, 0, 2, -5, 7} and from this array i need to find the the square pairs &lt;2, 7> and &lt;7, 9> where first element must be less than second. And &lt;-5, 9> and &lt;0, 9> are not square pairs, even though they sum to perfect squares, because both members of a square pair have to be greater than 0. bool ans; int[] number = new int[]{9,0,2,-5,7}; for (int j = 0; j &lt; number.Length; j++) { if (number[j]&lt;number[j+1]) ans = IsPerfectSquares(number[j]+number[j+1]); if(ans) count++; } } public static bool IsPerfectSquares(int input) { long SquareRoot = (long)Math.Sqrt(input); return ((SquareRoot * SquareRoot) == input); } `
has title: Finding square pair form the given array in C#
favorite count: 0
type: Question
score: 1
answer count: 2
upvote count: 1

http://stackoverflow.com/comment/37558039
type: Comment
comment on: http://stackoverflow.com/q/24267660
type: QuestionComment
has text: Ok, I've added an answer - hope it helps :-)
score: 0

http://stackoverflow.com/comment/37581744
type: AnswerComment
type: Comment
has text: How to fix the car started to get the vehicle from the place where you were stopped and out of this where he were without timer?
comment on: http://stackoverflow.com/a/24306692
score: 0

http://stackoverflow.com/q/24334953
has comment: http://stackoverflow.com/comment/37619996
type: UnansweredQuestion
score: 7
tagged with: java
upvote count: 7
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24335019
has body: Prior to Java 7 the syntax below was used to create an ArrayList, ArrayList&lt;Integer&gt; ints = new ArrayList&lt;Integer&gt;(Arrays.asList(1,2,3,4,5,6,7)); But since Java 7 we can omit the generic type in the constructor i.e., ArrayList&lt;Integer&gt; ints = new ArrayList&lt;&gt;(Arrays.asList(1,2,3,4,5,6,7)); But when I tried to do something like, ArrayList&lt;Number&gt; nums = new ArrayList&lt;&gt;(Arrays.asList(1,2,3,4,4,5.5,6.6,7.7)); I get an error, but when I mention the generic type on right side i.e., ArrayList&lt;Number&gt; nums = new ArrayList&lt;Number&gt;(Arrays.asList(1,2,3,4,5.5,6.6,7.7)); The code works perfectly. What could be the reason behind this ? Thanks in Advance.
downvote count: 0
has answer: http://stackoverflow.com/a/24335156
tagged with: generics
favorite count: 0
has title: Using diamond operator in Java 7

http://stackoverflow.com/q/24362405
answer count: 1
has comment: http://stackoverflow.com/comment/37672790
tagged with: vaadin4spring
tagged with: vaadin-refresher
has title: How to use refresher addon in vaadin?
favorite count: 0
linked to: http://stackoverflow.com/q/24363588
has comment: http://stackoverflow.com/comment/37672965
has body: I'm trying to use the refresher addon in vaadin. But the refresh method is never executed. What am I missing? @VaadinUI @PreserveOnRefresh public class RootUI extends UI { @Override protected void init(VaadinRequest request) { REFRESHER.setRefreshInterval(500); REFRESHER.addListener(new ChatRefreshListener()); addExtension(REFRESHER); } public static final Refresher REFRESHER = new Refresher(); public class ChatRefreshListener implements RefreshListener { @Override public void refresh(final Refresher source) { System.out.println("test"); //this is never executed } } } @Configuration @ComponentScan @EnableAutoConfiguration public class MyApp extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(MyApp.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(MyApp.class); } } &lt;vaadin.version&gt;7.4.0.alpha2&lt;/vaadin.version&gt;
tagged with: spring
has comment: http://stackoverflow.com/comment/37671961
score: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/37672275
tagged with: java
tagged with: vaadin
has comment: http://stackoverflow.com/comment/37673139
type: Question
upvote count: 2
accepted answer: http://stackoverflow.com/a/24363011
has comment: http://stackoverflow.com/comment/37672389
has answer: http://stackoverflow.com/a/24363011

http://stackoverflow.com/comment/51121351
type: Comment
has text: While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/31583106

http://stackoverflow.com/comment/37527263
comment on: http://stackoverflow.com/q/24286755
type: QuestionComment
has text: See http://stackoverflow.com/questions/1844770/what-does-list-mean-in-java-generics
type: Comment
score: 3

http://stackoverflow.com/comment/37711283
comment on: http://stackoverflow.com/q/24383637
type: Comment
type: QuestionComment
has text: Nearest tag available, that's why I chose it :/
score: 0

http://stackoverflow.com/a/24372475
answers question: http://stackoverflow.com/q/24372434
has comment: http://stackoverflow.com/comment/37690499
downvote count: 0
has body: You haven't initialized the variable, thus its value is null. private ArrayList&lt;Player&gt; players = new ArrayList&lt;Player&gt;(); That should fix it.
type: Answer
score: 6
upvote count: 6

http://stackoverflow.com/a/24285849
accepted answer of: http://stackoverflow.com/q/24285532
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24285532
has body: The Fish and DatabaseHelper classes should be decoupled in my opinion. The Fish class is part of your model whereas the DatabaseHelper class is responsible for DB access. Hence, changes to the DatabaseHelper class should not have any impact to Fish. Instead, there should be a layer in between which transfers the data from DatabaseHelper to Fish. So, instead of: DatabaseHelper db = ...; int tripID = ...; int fishID = ...; Fish fish = new Fish(db, tripID, fishID); you would have: DatabaseHelper db = ...; int tripID = ...; int fishID = ...; Cursor c = db.getFish(tripID, fishID); String species = c.getString(0); int size = Integer.parseInt(c.getString(1)); Fish fish = new Fish(species, size); By doing this, neither class is aware of each other and changes to either class will only affect the mapping layer in the middle.
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/24369484
answer count: 0
has comment: http://stackoverflow.com/comment/37685339
tagged with: java
has title: How to send a HTTP POST request using HttpClient 4 in Java?
tagged with: http
tagged with: post
type: Question
linked to: http://stackoverflow.com/q/3324717
score: 0
has comment: http://stackoverflow.com/comment/37685116
has comment: http://stackoverflow.com/comment/37685092
has comment: http://stackoverflow.com/comment/37685108
tagged with: file-upload
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37685173
has comment: http://stackoverflow.com/comment/39485271
has body: So I've struggling with this one lately. There are multiple ways to make a HTTP POST request with Java, some of which demonstrate with HttpClient 3.x and the others with HttpClient 4.x I'm assuming that the 4.x line is more advanced, but there are also lacking tutorials with this one. At least for me, I had hard time to find some beginner friendly guides. I'd like to make a POST request with an encoded File object. Some of the tutorials I've followed also mentioned NameValuePair, but for me this class is not available and I don't know how to obtain it. So if you answer, please mention how I can get hold of the imports as well. Please demonstrate a minimal HTTP POST request with HttpClient 4.x
has comment: http://stackoverflow.com/comment/37684959
has comment: http://stackoverflow.com/comment/37685387

http://stackoverflow.com/comment/37502338
has text: @Humdinger Why would `null` elements in a linked list break it? `null` elements are perfectly legal in Java's implementation. Does that mean that Java's implementation is broken?
type: Comment
comment on: http://stackoverflow.com/q/24273328
score: 0
type: QuestionComment

http://stackoverflow.com/a/24338138
answers question: http://stackoverflow.com/q/24337822
downvote count: 0
has comment: http://stackoverflow.com/comment/37739380
type: Answer
has body: I believe you forgot something in your query, String data = "SELECT * from HOURS_WORKED"; should be String data = "SELECT * from HOURS_WORKED FOR UPDATE";
score: 1
upvote count: 1

http://stackoverflow.com/a/24356169
upvote count: 0
has comment: http://stackoverflow.com/comment/37678447
answers question: http://stackoverflow.com/q/24355894
score: -1
downvote count: 1
has comment: http://stackoverflow.com/comment/46777363
has body: The code as written doesn't work concurrently. If there's other concurrency code not shown, that could well be the source timing differences. Other than that, the most likely cause is merely accessing the keys[] array in addition to the values[] array changes memory access patterns. For instance, switching from registers to memory locations, L1 cache to L2 cache, or L3 cache, or main memory. 'False sharing' is an example of a degradation pattern. 'Mechanical sympathy' is a name used for tuning to current hardware architectures.
type: Answer

http://stackoverflow.com/q/24383303
has answer: http://stackoverflow.com/a/24384466
score: -2
has comment: http://stackoverflow.com/comment/37710829
has body: I have login system, and i get NullPointerException after getting response or in process request generation. My login request is: try { if (json.getString(KEY_SUCCESS) != null) { String res = json.getString(KEY_SUCCESS); if(res == "sucess"){ pDialog.setMessage("Loading User Space"); pDialog.setTitle("Getting Data"); UserFunctions logout = new UserFunctions(); logout.logoutUser(getApplicationContext()); Intent upanel = new Intent(getApplicationContext(), Main.class); upanel.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); pDialog.dismiss(); startActivity(upanel); finish(); }else{ pDialog.dismiss(); loginErrorMsg.setText("Incorrect username/password"); } } } And login building is: public JSONArray loginUser(String email, String password, String appkey) { String conc = email + password + appkey; JSONArray json = jsonParser.getJSONFromUrl(loginURL + "?login=" + email + "&amp;password=" + password + "&amp;sign=" + conc); return json; } In the jsonParser i have this code: public class JSONParser { static InputStream is = null; static JSONArray jObj = null; static String json = ""; // constructor public JSONParser() { } public JSONArray getJSONFromUrl(String url) { // Making HTTP request // defaultHttpClient DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader( is, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); json = sb.toString(); // try parse the string to a JSON object jObj = new JSONArray(json); // return JSON String return jObj; } } By the way JSON response of the type: { "status": "success", "message": "", "session_id": "asdasddfcvxgdgfdfv", "user": [{ "company": "company", "last_name": "last_name·", "name": "name", "mi…
tagged with: arrays
has comment: http://stackoverflow.com/comment/37711804
has title: JSONArray error getting
tagged with: android
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 3
has answer: http://stackoverflow.com/a/24383641
type: Question
answer count: 2

http://stackoverflow.com/a/24296804
answers question: http://stackoverflow.com/q/24296783
score: 1
downvote count: 0
type: Answer
upvote count: 1
has body: filePath is a variable that holds the path of the file, so you don't want to enclose it in double quotes. If you do, it is treated as a String, so the program searches for a file with path filePath. PrintWriter out = new PrintWriter(filePath); // no "" The "tester" can run the program the same way you run it: java programName

http://stackoverflow.com/comment/37612455
has text: How do you want inner classes and anonymous inner classes handled?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24331559
score: 0

http://stackoverflow.com/q/24353483
has answer: http://stackoverflow.com/a/24472279
tagged with: c#
tagged with: ikvm
accepted answer: http://stackoverflow.com/a/24433687
possible better answer: http://stackoverflow.com/a/24472279
has body: I'm working on ASP.net with the MPXJ library. The .net version of MPXJ has been created using IKVM. Currently, I have a big problem: After upload a file (Microsoft Project file - .mpp file) to server (I don't need to save it), I want to convert from HttpPostedFileBase to the IKVM version of java.io.InputStream and MPXJ will manipulate them, but I don't know a way to implement this. My code: public ActionResult Upload(HttpPostedFileBase files) { // Todo: Convert from HttpPostedFileBase to Java.Io.InputStream ProjectReader reader = new MPPReader(); ProjectFile projectObj = reader.read(Java.Io.InputStream); }
upvote count: 4
type: AnsweredQuestion
score: 1
tagged with: mpxj
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24433687
has title: How to convert HttpPostedFileBase file to Java.Io.InputStream?
tagged with: java
answer count: 2
downvote count: 3

thread-sleep
tags question: http://stackoverflow.com/q/24279502
type: Tag
tags question: http://stackoverflow.com/q/24280091
tags question: http://stackoverflow.com/q/24392916
tags question: http://stackoverflow.com/q/24332058
tag name: thread-sleep
tags question: http://stackoverflow.com/q/24342387

message-queue
tags question: http://stackoverflow.com/q/24340892
type: Tag
tags question: http://stackoverflow.com/q/24342919
tag name: message-queue

http://stackoverflow.com/q/24279434
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/20269898
favorite count: 0
has title: Simple JasperReport Query
type: Question
has body: Does JasperReports provide some functions in Java which I can use and change my jrxml. Like change the font, add new detail section, add static text, delete something, add charts etc. I want to do them like someObject.setFont("Arial"); and this will set the object's font to Arial and I can also see the respective change in jrxml. I know that iReport does this easily without any function call, but I want this thing with Java functions only as I am building some app. If yes please provide a simple example or sites, links anthing from which I can learn. JasperReports API doc is not so good.
upvote count: 1
has comment: http://stackoverflow.com/comment/37513976
tagged with: java
has answer: http://stackoverflow.com/a/24282228
answer count: 1
tagged with: jasper-reports
has comment: http://stackoverflow.com/comment/37514429
accepted answer: http://stackoverflow.com/a/24282228
type: AnsweredQuestion

http://stackoverflow.com/q/24414185
has comment: http://stackoverflow.com/comment/37781520
tagged with: pdo
favorite count: 0
has comment: http://stackoverflow.com/comment/37800254
has comment: http://stackoverflow.com/comment/37768788
has body: I tried hard to search the solution but I still not manage to solve it. Kindly help. Here my java code : - public class MainActivity extends Activity { String project_id; String id; InputStream is=null; String result=null; String line=null; int code = 0; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final EditText e_id =(EditText) findViewById(R.id.editText1); final EditText e_prjId =(EditText) findViewById(R.id.editText2); Button insert =(Button) findViewById(R.id.button1); id = e_id.getText().toString(); project_id = e_prjId.getText().toString(); insert.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { insert(); } }); } public void insert() { final ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(); nameValuePairs.add(new BasicNameValuePair("id",id)); nameValuePairs.add(new BasicNameValuePair("Project_Id",project_id)); new Thread(new Runnable() { public void run() { try { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://192.168.0.111/insert.php"); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); is = entity.getContent(); Log.e("pass 1", "connection success "); } catch(Exception e){ Log.e("Fail 1", e.toString()); Toast.makeText(getApplicationContext(), "Invalid IP Address", Toast.LENGTH_LONG).show(); } try { BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8); StringBuilder sb = new StringBuilder(); while ((line = reader.readLine()) != null){ sb.append(line + "\n"); } is.close(); result = sb.toString(); Log.e("pass 2", "connection success "); } catch(Exception e){ Log.e("Fail 2", e.toString()); } try { Log.i("tagconvertstr", "["+result+"]"); JSONObject json_data = new JSONObject(result); code=(json_data.getInt("code")); } catch (JSONException e) …
upvote count: 1
tagged with: php
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24414338
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/37800100
answer count: 1
downvote count: 0
has title: JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
accepted answer: http://stackoverflow.com/a/24414338

http://stackoverflow.com/comment/37606465
has text: I don't quite understand what you mean. Edit your question including any new parts, makes it easier to keep track and update my answer
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24298292
type: Comment

http://stackoverflow.com/a/24342593
has body: If you take a look at what document is holding after parsing String testString =" text1 text2 "; you will see text1 text2 As @Rejesh pointed p can't contain other block-level-elements like p itself so Jsoup prevents it by closing such incorrect outer p elements (separate closure for opening tag and closing tag). In your case text will become text1 so your div text1 text2 will be parsed as text1 text2 and as you see there are 4 children (two empty p and two p with text). If you want to turn off this validating mechanism you can use XML parser instead of standard HTML parser with String testString =" text1 text2 "; Document document = Jsoup.parse(testString,"",Parser.xmlParser()); System.out.println(document); Element div = document.select("div").first(); Elements divChildren = div.children(); System.out.println(divChildren.size()); will now print 2.
answers question: http://stackoverflow.com/q/24342434
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/24342434
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24413834
upvote count: 1
has comment: http://stackoverflow.com/comment/87688388
type: Question
tagged with: jboss
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/24548950
linked to: http://stackoverflow.com/q/35717329
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has body: Using Spring Tool Suite, I recently switched servers to JBoss EAP 6.1. Now, my standard output does show up in the console. I've searched for some JBoss configuration changes, but haven't found any yet. As an example, this does not show up in the Console anymore: System.out.println("This is a test."); Is there an easy way to get standard output to show up in the Eclipse Console view when using JBoss?
has title: JBoss standard output does not show up in Eclipse Console view
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24548950
tagged with: java

http://stackoverflow.com/a/62822256
has body: The issue is that your @ExceptionHandler declares ResourceNotFoundException whereas as a parameter to the handleResourceNotFound you expect RuntimeException. The parameter exception and the value of ExceptionHandler should match. So it should be: @ExceptionHandler(value={ResourceNotFoundException.class}) protected ResponseEntity&lt;Object&gt; handleResourceNotFound(ResourceNotFoundException ex, WebRequest request){ }
answers question: http://stackoverflow.com/q/24338734
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/24334693
type: Answer
has body: The only thing I see as a possible issue is the "newInstance()" call. Try remove that and see if that works. From: Class.forName("com.mysql.jdbc.Driver").newInstance(); To: Class.forName("com.mysql.jdbc.Driver");
answers question: http://stackoverflow.com/q/24334319
score: 0

http://stackoverflow.com/comment/37642875
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24344595
has text: `other problems`? Please elaborate
score: 0

http://stackoverflow.com/q/24427409
tagged with: java
has title: Play framework how to set-up a re-usable comments model
type: Question
has comment: http://stackoverflow.com/comment/38305392
answer count: 0
type: UnansweredQuestion
has body: I'm wondering if, using play framework 2.0, is it possible to develop a model to handle every comments in site like what I used to do with rails and a GEM like acts_as_commentable_with_threading. Is there, in play, anything like gem systems.
tagged with: playframework-2.0
has comment: http://stackoverflow.com/comment/37810865
score: 0

http://stackoverflow.com/q/24371069
downvote count: 0
favorite count: 0
has body: I have implemented a very simple class called Enigma which has a symmetric key and two methods: byte[] encryptString(String strToEncrypt) and String decryptBytes(byte[] arrayToDecrypt). I am trying to write some tests for the methods. I have thought of testing that the encrypt and decrypt methods are the inverse of each other, but that says nothing about each of them individually. I wanted to use the methods as they are now to obtain a battery of input-outputs and set that as the tests (I know that is not ideal, but the purpose of these tests is to guarantee that the function behaves in the future as it does today, not that the encryption/decryption are good). However, I do not know how to obtain a representation of the byte array output by byte[] encryptString(String strToEncrypt) so that I can hardcode it in the test class. Any ideas?
has title: Unit testing of encrypt/decrypt
score: 6
linked to: http://stackoverflow.com/q/858980
upvote count: 6
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1769776
tagged with: java
has answer: http://stackoverflow.com/a/24387268
tagged with: unit-testing
type: Question
tagged with: junit4
tagged with: arrays
accepted answer: http://stackoverflow.com/a/24387268
answer count: 1
tagged with: junit

http://stackoverflow.com/comment/37760924
has text: Time is different.I want same time only the difference will be in IST or EST.date and time should be same.
type: Comment
comment on: http://stackoverflow.com/a/24406468
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37667679
type: Comment
type: QuestionComment
has text: And the result of your debug was... at least a stacktrace, maybe?
comment on: http://stackoverflow.com/q/24360168
score: 1

http://stackoverflow.com/comment/37544720
comment on: http://stackoverflow.com/q/24295081
has text: PLEASE POST MORE LINES OF YOUR LOGCAT!!!! This will take ages if you don't.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37763745
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24409673
type: Comment
has text: can you able to telnet to DB server?

http://stackoverflow.com/comment/37786458
type: QuestionComment
comment on: http://stackoverflow.com/q/24423092
score: 0
has text: i am using 6.8.8 version and testNG eclipse plugin 6.8.6. can you try the above code and prove me that it is working as expected?
type: Comment

http://stackoverflow.com/a/24350873
score: 0
answers question: http://stackoverflow.com/q/24350146
type: Answer
has body: I guess that the bottleneck of your method is photo loading. Try to load everything except photos, and then show your activity, concurrently loading photos. Also you can try to create your own app table that contains just the data you need. So you'll do less selects while loading contacts. But you would have to synchronize your table. You can do so concurrently.

http://stackoverflow.com/comment/37740721
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24396996
has text: Try adding a default constructor to TrainingData. And possibly implement Serializable.

http://stackoverflow.com/q/24378497
tagged with: eclipse-plugin
favorite count: 0
has comment: http://stackoverflow.com/comment/37702920
has title: Wizard categorizing in Eclipse plug-in development
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24383262
upvote count: 1
downvote count: 1
type: Question
tagged with: java
tagged with: eclipse
score: 0
has answer: http://stackoverflow.com/a/24383262
answer count: 1
has comment: http://stackoverflow.com/comment/37705324
has body: I am creating an Eclipse plug-in . and create two wizards for creating project and file and put under a catogory event. When I run the plug-in these two comes under other. I need to be there new -> eventproject and new -> eventfile and eventproject wizard should list under Project catogory new -> project -> eventproject and file should list under file catogory new -> file -> eventfile I am adding my plugin.xml file with this <plugin>

http://stackoverflow.com/q/24386107
answer count: 1
accepted answer: http://stackoverflow.com/a/24386353
has title: LuaJ (or any other Java LUA interpreters) - Can you call a LUA script from Java without waiting for it to return?
tagged with: lua
linked to: http://stackoverflow.com/q/14286209
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37766443
has body: I've been writing an RPG game engine for Android, and I've gotten to the point that I think I need to add a scripting language for my Battle Engine. Its just too complex to get by on XML configuration driving the game content, like I've been doing previously. It seems like LUA is the scripting language of choice by the game development community, so I've been doing some research. Since the Engine is written in Java, I'm thinking about using LuaJ as my LUA interpreter, since I found some old threads that indicate it's probably the best Java LUA interpreter, but if anyone has a more current opinion on a better interpreter, I'm all ears. Anyway, I need to be able to call a LUA script from Java, and continue game thread execution without waiting for the script to return. Is this possible with LuaJ or any other popular Java based interpreter? I know I could always put the script call in its own thread, but I could potentially have many scripts active at once, and it's a waste, since I don't need a return value anyway.
type: Question
has answer: http://stackoverflow.com/a/24386353
tagged with: luaj
tagged with: java
score: 0

http://stackoverflow.com/comment/37772155
score: 0
type: Comment
type: QuestionComment
has text: @JigarJoshi Same error, unfortunately
comment on: http://stackoverflow.com/q/24415677

http://stackoverflow.com/comment/37495066
type: Comment
type: QuestionComment
score: 0
has text: i don't get my answer so i have asked
comment on: http://stackoverflow.com/q/24269641

http://stackoverflow.com/comment/37695585
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24374941
has text: Is it returning `null` or are you getting a `NullPointerException`?
score: 0

http://stackoverflow.com/q/24374599
favorite count: 0
has body: Consider a parameterized JUnit test. JUnit provides a way to parameterize such a test using a static method: @Parameterized.Parameters public static Collection&lt;Object[]&gt; parameters(){ Object[][] data = new Object[][] { { 1, 11 }, { 2, 22 }, { 3, 33 }, { 4, 44 } }; return Arrays.asList(data); } However, this is not what I need, because I do not know the parameters at the test class itself. The test class should simply be a test class that can be parameterized with a set of parameters. I do not want to specify such parameters inside the class itself. Consider I have a lot of such classes in a test suite. What I want to be able is to parameterizes the whole test suite from external code. I.e., have some other code that instanciates the suite with a specific set of parameters. The suite itself does not know the parameters with which it will be parameterized. E.g., I have a test suite X consisting of the test classes A, B, and C. All these classes take, e.g., a String and an integer in their constructor as their parameters. Now I want so be able to instanciate X externally (e.g., in another test suite) with a specific String s and int i so that it will instanciate A B and C using s and i in their constructors. How can this be achieved?
type: UnansweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24386896
tagged with: unit-testing
type: Question
tagged with: parameterized-tests
upvote count: 1
tagged with: junit
downvote count: 0
answer count: 1
has title: JUnit parameterized test with varying parameters

http://stackoverflow.com/comment/37556342
type: AnswerComment
has text: i value is to iterate the result set to get the emailaddress from database. How can I remove it? Can you please answer it as full code
type: Comment
comment on: http://stackoverflow.com/a/24301944
score: 0

http://stackoverflow.com/a/24385057
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24384905
upvote count: 1
has body: Better to use Runtime.exec(..) that returns a Process object to you. Process has getOutputStream() method that connected to the normal input of the sub process. A bit trickier to use and detect when your script is done, but gives you more freedom.

http://stackoverflow.com/comment/40248814
comment on: http://stackoverflow.com/a/25460867
score: 0
type: AnswerComment
has text: What I meant is that whether you done those print settings ie 300 dpi and the page size to A4 using microsoft excel....since when I open the particular xls within openoffice I have got a message saying that the file contains macros.....also you have changed xlsx to xls
type: Comment

http://stackoverflow.com/comment/37714379
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24382975
type: Comment
has text: you can consider noun phrases and verb phrases as root nodes. Also you can split VP by CC or , tokens.

http://stackoverflow.com/comment/37692393
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24372535
has text: See the edit, the red marked space is the space I want to remove

http://stackoverflow.com/comment/37731811
type: QuestionComment
type: Comment
score: 2
has text: @user3772508 That's not an equation; it's an expression. See Wikipedia: [Equation](http://en.wikipedia.org/wiki/Equation). Also regular expressions would not be a good solution for matching mathematical expressions--they are far too complicated for regex.
comment on: http://stackoverflow.com/q/24394204

http://stackoverflow.com/q/24321861
has comment: http://stackoverflow.com/comment/37599463
tagged with: spring
tagged with: spring-mvc
answer count: 0
has body: Hi I am using spring security java based config for basic auth and even with correct password and username it gives me 403 error .the config code is as below.Also the same I am getting when i try to access my endpoint which is enabled with method level security with @Secured('USER') @Configuration @EnableGlobalMethodSecurity(securedEnabled = true, prePostEnabled = true) @EnableWebMvcSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { /* * (non-Javadoc) * * @see org.springframework.security.config.annotation.web.configuration. * WebSecurityConfigurerAdapter * #configure(org.springframework.security.config * .annotation.authentication.builders.AuthenticationManagerBuilder) */ @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication().withUser("root").password("hacked").roles("USER"); } /* * (non-Javadoc) * * @see org.springframework.security.config.annotation.web.configuration. * WebSecurityConfigurerAdapter * #configure(org.springframework.security.config * .annotation.web.builders.HttpSecurity) */ @Override protected void configure(HttpSecurity http) throws Exception { http.exceptionHandling().authenticationEntryPoint(digestEndPoint()). // #session creation policy and().sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS). // #Http Basic and().httpBasic().realmName("HF Integration"). // #Add filter and().addFilterAfter(digestAuthenticationFilter(), BasicAuthenticationFilter.class); } /* * (non-Javadoc) * * @see org.springframework.security.config.annotation.web.configuration. * WebSecurityConfigurerAdapter#authenticationManagerBean() */ @Bean @Override public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } /* * (non-Javadoc) * * @see org.springframework.security.config.annotation.web.configuration. * WebSecurityConfigurerAdapter#userDetailsServiceBean() */ @Override @Bean public UserDetailsService …
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37597102
has title: Spring security basic auth gives 403 with correct password also
score: 0
tagged with: spring-security
type: UnansweredQuestion

http://stackoverflow.com/comment/37714302
comment on: http://stackoverflow.com/q/24384681
has text: @ pskink : can you be more precise? as you can see i tried this already, but something is wrong....
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24343412
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24343366
answers question: http://stackoverflow.com/q/24343366
type: Answer
has body: You can do a couple of things mentioned in this answer What I have done is add this config to my web.xml default *.css *.js *.images *.png *.gif *.pdf *.ico

http://stackoverflow.com/a/24335451
has comment: http://stackoverflow.com/comment/37620035
has comment: http://stackoverflow.com/comment/37619957
has comment: http://stackoverflow.com/comment/37620110
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37620720
has comment: http://stackoverflow.com/comment/37620519
accepted answer of: http://stackoverflow.com/q/24335259
has comment: http://stackoverflow.com/comment/37620003
has comment: http://stackoverflow.com/comment/37620612
answers question: http://stackoverflow.com/q/24335259
type: Answer
has comment: http://stackoverflow.com/comment/37620801
has comment: http://stackoverflow.com/comment/37620939
has comment: http://stackoverflow.com/comment/37619944
has comment: http://stackoverflow.com/comment/37620246
has comment: http://stackoverflow.com/comment/37620407
has comment: http://stackoverflow.com/comment/37621108
downvote count: 0
has comment: http://stackoverflow.com/comment/37619882
score: 1
has body: I can't be sure what you are trying to calculate, but if I guess correctly, n would be the size of the array (array.length) and you are required to calculate the average number of statements per each member of the array. Therefore avgStatements = statements/array.length But if you want to count all the statements, you should notice that the inner loop has two statements (not counting the statements++), while the outer loop has three statements. Therefore you should probably count like this : public static int myMethod(int[] array) { int statements = 0; for (int next = 1; next &lt; array.length; next++) { statements+=3; int val = array[next]; int index = next; while (index &gt; 0 &amp;&amp; val &lt; array[index - 1]) { statements+=2; array[index] = array[index - 1]; index--; } array[index] = val; } return statements; }
has comment: http://stackoverflow.com/comment/37620082
has comment: http://stackoverflow.com/comment/37620346
has comment: http://stackoverflow.com/comment/37620446

http://stackoverflow.com/comment/37670442
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24361481
type: Comment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/56091/discussion-between-raghunandan-and-xijiaopin).

http://stackoverflow.com/q/24419685
tagged with: path
possible better answer: http://stackoverflow.com/a/24419708
has answer: http://stackoverflow.com/a/24419708
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24419840
tagged with: file
linked to: http://stackoverflow.com/q/106770
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37779674
score: 1
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/24419840
has title: Copying a file.Finding a path to it
has comment: http://stackoverflow.com/comment/37779464
has body: I want to copy file to another directory.I know this has been asked million times,I read tons of answers about this but I just can't seem to make it work.This is the code I am currently using: copyFile(new File(getClass().getResource("/jars/TurnOffClient.jar").toString()), new File("C:\\Documents and Settings\\All Users\\Start Menu\\Programs\\Startup\\karioc.jar")); And this is the method: public static void copyFile(File sourceFile, File destFile) throws IOException { if(!destFile.exists()) { destFile.createNewFile(); } FileChannel source = null; FileChannel destination = null; try { source = new FileInputStream(sourceFile).getChannel(); destination = new FileOutputStream(destFile).getChannel(); destination.transferFrom(source, 0, source.size()); } finally { if(source != null) { source.close(); } if(destination != null) { destination.close(); } } } This is my dir: Directories http://imageshack.com/a/img820/6418/5g3m.png ////////////////////////////////////////////////////////////////////////////////////////// And this is the exception I get:
downvote count: 0
tagged with: jar
tagged with: url
has comment: http://stackoverflow.com/comment/37779890
favorite count: 0

http://stackoverflow.com/comment/37719865
type: AnswerComment
type: Comment
has text: So what, you would write `AbstractEvent<T extends Object>` instead of `AbstractEvent<T extends EventListener>`? And anyone who extends `AbstractEvent` can specify absolutely anything for `T`?
comment on: http://stackoverflow.com/a/24374654
score: 0

http://stackoverflow.com/q/24289186
has comment: http://stackoverflow.com/comment/37555530
has comment: http://stackoverflow.com/comment/37533512
score: 0
has comment: http://stackoverflow.com/comment/37532397
tagged with: java
tagged with: eclipse
type: Question
has title: How to run Jetty server in a LAN?
has body: I'm running in some troubling deploying my app on a Jetty Server. If i try to access my app using localhost:8080/appName it works just fine. But if I try to use my IP it doesn't work (I mean on the same computer, ip given by the ipconfig tool) I don't really know why, All I know is that I launch my server directly from Eclipse with the Goals set to "-jetty.host=0.0.0.0 -Djetty.port=8080 jetty:run" funny thing is, that even if I forgot or put something else for the jetty.host parameter (like Djetty.host=127.0.0.1) I always have "2014-06-18 16:59:52.238:INFO:oejs.ServerConnector:main: Started ServerConnector@1b79a565{HTTP/1.1}{0.0.0.0:8080}" in my console output. Any idea where I do something wrong ? Thanks !
has comment: http://stackoverflow.com/comment/37533001
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37532685
tagged with: jetty
tagged with: maven

http://stackoverflow.com/comment/85184784
type: Comment
score: 1
has text: brew cask install caskroom/versions/java8
comment on: http://stackoverflow.com/a/32811065
type: AnswerComment

http://stackoverflow.com/q/24416905
tagged with: jaxb
has title: JAXB java code generation base on XSD file
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24417941
upvote count: 1
possible better answer: http://stackoverflow.com/a/24417941
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/25976670
type: AnsweredQuestion
has body: I'm having a problem generating java source code based on XSD file. Please notice that the XSD file was generated based on XML example. XML Example <resposta_importacao> <num_apolice xmlns="compuletra">202476600001</num_apolice> <cod_retorno xmlns="compuletra">651</cod_retorno> Erro de layout de dadosobrigatÃ³rios: cod_cobertura <id_validacao xmlns="compuletra">0</id_validacao> <num_apolice xmlns="compuletra">202476600002</num_apolice> <cod_retorno xmlns="compuletra">651</cod_retorno> Erro de layout de dados obrigatÃ³rios: cod_cobertura <id_validacao xmlns="compuletra">0</id_validacao> </resposta_importacao> Generated XSD <xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:complexType name="RetornoEnvio"> <xsd:sequence> <xsd:element name="num_apolice" type="xsd:integer" xmlns="compuletra" /> <xsd:element name="cod_retorno" type="xsd:int" xmlns="compuletra" /> <xsd:element name="mensagem" type="xsd:string" xmlns="compuletra" /> <xsd:element name="id_validacao" type="xsd:int" xmlns="compuletra" /> </xsd:sequence> </xsd:complexType> <xsd:element name="resposta_importacao"> <xsd:complexType> <xsd:sequence> <xsd:element maxOccurs="unbounded" type="RetornoEnvio" name="RetornoEnvio" /> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> Generated Java Class @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "RetornoEnvio", propOrder = { "numApolice", "codRetorno", "mensagem", "idValidacao" }) public class RetornoEnvio { @XmlElement(name = "num_apolice", required = true) protected BigInteger numApolice; @XmlElement(name = "cod_retorno") protected int codRetorno; @XmlElement(required = true) protected String mensagem; @XmlElement(name = "id_validacao") protected int idValidacao; The problem here is that the XML has the xmlns="compuletra" But the java class don't. I know I can just insert the namespace attribute to the XmlElement annotation but it would be nicer if the code generation …
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25976670

http://stackoverflow.com/comment/37703525
has text: You shouldn't use Spring to unit-test a service. Simply create mock DAOs, instantiate a new BankManagerImpl with the mock DAOs as dependencies, and call the method to test.
comment on: http://stackoverflow.com/q/24379386
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/24368579
answers question: http://stackoverflow.com/q/24367977
type: Answer
has body: Two basic options. a) use ServletConfig.getServletContext() to obtain the currently active servlet context. This can only work IF the code is executed as part of an actual servlet request, otherwise there simply is no active servlet context to speak of. b) actually put the file on the classpath, so that it ends up in WEB-INF/classes or inside a jar in WEB-INF/lib; then you can load it from any class in your application using getClass().getResourceAsStream() or getClass().getClassLoader().getResourceAsStream(), at any time. Option b) has the added benefit of also working in any type of Java application so it is nice and portable. It can also work in a unit test for example.
score: 0

http://stackoverflow.com/comment/37498315
has text: And use ProcessBuilder, not Runtime.exec
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24271410
type: Comment

http://stackoverflow.com/comment/37511316
comment on: http://stackoverflow.com/q/24278021
has text: And I agree the question is too broad
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24376223
answers question: http://stackoverflow.com/q/24375588
has comment: http://stackoverflow.com/comment/37697671
has comment: http://stackoverflow.com/comment/37698251
has body: The default bean name is lower-case. Instead of @Autowired(required=true) @Qualifier("OperationManagerImpl") private OperationManager opmanimpl ; use @Autowired(required=true) @Qualifier("operationManagerImpl") private OperationManager opmanimpl ; Notice the name of the bean is "operationManagerImpl". EDIT: use this type of autowiring for having access in the constructor to opmanimpl @Service public class ConstruireBilanImpl implements ConstruireBilan { private OperationManager opmanimpl ; @Autowired public ConstruireBilanImpl(@Qualifier("operationManagerImpl") OperationManager opmanimpl) { this.opmanimpl = opmanimpl; }
score: 0
has comment: http://stackoverflow.com/comment/37697720
type: Answer

http://stackoverflow.com/a/24401329
type: Answer
has body: You can try adding a Pageable parameter to your getByName method @Query("SELECT dirPar FROM DirectiveParagraph dirPar, Directive dir " + "WHERE dirPar.directive = dir " + "AND dir.txtDirCode = :txtDirCode "); Page&lt;DirectiveParagraph&gt; getByName(@Param("txtDirCode") String name, Pageable page); And here's a sample method call: public void someMethod(){ PageRequest pageR = new PageRequest(10,10); Page&lt;DirectiveParagraph&gt; result = directiveParagraphRepository.getByName("txtDirCode",pageR); List&lt;DirectiveParagraph&gt; resultList = result.getContent(); }
upvote count: 7
score: 7
answers question: http://stackoverflow.com/q/24292026
downvote count: 0

http://stackoverflow.com/a/24417776
has body: I'm not familiar with the system you are using, but in general there is another option: On the textbox "enter" event, update a counter. Assuming you know the total amount of fields needing completed, you can use this counter and that known value to determine the percentage. One problem that can arise from this is that the user presses enter to go to the next one or tabs through it (setting off the event either way) and then comes back to the previous field (by doing something like SHIFT+Tab or clicking on it) and then when they click off it, it updates the counter falsely. So in light of that problem, I instead suggest keeping a map of values. Say each textbox, when you edit it, puts a boolean ("true", for example; the exact value doesn't matter, as long as it's there and not null or false) into a map under the textbox's name. Then you can count how many keys are in the map, and check that against the known total value. Something like this: Map&lt;String, boolean&gt; map = new Map&lt;String, boolean&gt;(); //In the textbox textchanged event: if (textbox.text != null &amp;&amp; ! textbox.text.equals("")){ map.put(textbox.name, true); } else{ //if the user puts something in and then deletes it, //remove this textbox from the map map.remove(textbox.name); } //In the field checker: if (map.getEntrySet().size() &gt;= numberOfFields){ //the number of fields is good } Obviously some of this is pseudo code (such as "textbox.text"), but the idea is there. I use map.getEntrySet(), which I think I spelled correctly, but really any of the map methods that return a list representation of the contents will do, since you're just getting the size of the list and don't really need to see its contents.
type: Answer
has comment: http://stackoverflow.com/comment/37776326
has comment: http://stackoverflow.com/comment/37776634
answers question: http://stackoverflow.com/q/24417468
has comment: http://stackoverflow.com/comment/37776707
score: 0

http://stackoverflow.com/a/52330026
score: 0
type: Answer
has body: If you didn't want to go down the custom assert route, and could access the instances of the characters in the SUT (system under test) in the test, another option could be In the SUT: Character frodo = new Character("Frodo"); characterAges.put(frodo, 34); And in the test MapEntry frodoAge34 = MapEntry.entry(frodo, 34); assertThat(characterAges).contains(frodoAge34);
answers question: http://stackoverflow.com/q/24270228

http://stackoverflow.com/q/24374941
tagged with: junit
possible better answer: http://stackoverflow.com/a/24375010
has title: mocked method is returning Null
has answer: http://stackoverflow.com/a/24375010
favorite count: 0
has answer: http://stackoverflow.com/a/24375428
has comment: http://stackoverflow.com/comment/37695395
has body: I'm attempting to mock a few method calls but unfortunately I keep getting null returned. Can you help me point out where I may be going wrong? I am using the when().thenReturn() and I feel like I mocked the return variable correctly. Many thanks in advance. I'm new to JUnit and Mockito so my apologies if I'm missing anything obvious. ServiceTest.java @IntegrationTest public class ServiceTest extends TransactionalTest { private HistoryService orderHistoryService; private CMSSiteModel website; @Mock protected DefaultWebService orderDetailsServiceWrapper; @Mock protected WebsiteService websiteService; @Before public void setUp() { MockitoAnnotations.initMocks(this); website = mock(CMSSiteModel.class); } @Test public void testFindOrderDetailsByConfirmationNumber() { when(websiteService.getCurrentSite()).thenReturn(website); final ResponseType response = orderHistoryService.findOrderDetailsByConfirmationNumber(OrderTestUtils.CONFIRMATION_NUMBER, OrderTestUtils.LOCATION_NUMBER); Assert.assertEquals("Incorrect Approver Name", OrderTestUtils.APPROVER_NAME, response.getApprovedByName()); } and Service.java public class HistoryService implements OrderHistoryService { @Autowired private WebsiteService websiteService; @Override public OrderDetailsServiceResponseType findOrderDetailsByConfirmationNumber(String confirmationNumber, String locationNumber) { CMSSiteModel test = websiteService.getCurrentSite(); //returning null odsrHeader.setSource(test.getOrderSource()); } }
has comment: http://stackoverflow.com/comment/37695585
has comment: http://stackoverflow.com/comment/37695521
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: integration-testing
type: Question
answer count: 2
tagged with: mockito
accepted answer: http://stackoverflow.com/a/24375428
upvote count: 1
has comment: http://stackoverflow.com/comment/37695323

http://stackoverflow.com/comment/37729053
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24392937
has text: Ah yes thanks for pointing that, I changed it earlier as I had the details in there. Still with the same issue though
type: AnswerComment

http://stackoverflow.com/comment/37553099
comment on: http://stackoverflow.com/q/24300238
has text: there are some other words as well right?? not just that
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37564526
type: QuestionComment
type: Comment
score: 0
has text: You should set system property "viewmode" to production or development before the connection to Couchbase. e.g. System.setProperty('viewmode', 'development'); read more: http://www.javacodegeeks.com/2013/01/couchbase-101-create-views-mapreduce-from-your-java-application.html
comment on: http://stackoverflow.com/q/24306216

http://stackoverflow.com/q/24273792
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24273951
type: Question
answer count: 2
has title: java - selenium - I can get text of element but can't click its link
has body: I am having trouble clicking on a link in a webpage using the selenium webdriver in firefox. Here is a snippet of my code regarding the issue: WebElement option = driver.findElement(By.id("AccNumSpan" + i)); if(option.getText().contains("48494")){ List <WebElement> listOfOptions1 = driver.findElements(By.xpath("//*[@id='row" + i +"']/td[10]/nobr")); for(WebElement option1 : listOfOptions1){ System.out.println(option1.getText()); String id = option1.getAttribute("id"); System.out.println(id); option1.click(); } Here is the html of the link that I am trying to click: View Monthly Invoices When I run the code, it prints "View Monthly Statement" from option1.getText ( so it does find the element), but when I try option1.click() (which is what I want to do) nothing happens except the text gets underlined or whatever but the link isn't opened. Also, it does not print anything for option1.getAttribute("id") or for any attribute using .getAttribute Any way to get around this? All help is appreciated, thanks
has comment: http://stackoverflow.com/comment/37503617
score: 0
tagged with: http://stackoverflow.com/tag/html
possible better answer: http://stackoverflow.com/a/24304384
has answer: http://stackoverflow.com/a/24273951
has answer: http://stackoverflow.com/a/24304384
has comment: http://stackoverflow.com/comment/37503538
tagged with: selenium

http://stackoverflow.com/comment/37550740
type: AnswerComment
comment on: http://stackoverflow.com/a/24298984
type: Comment
score: 1
has text: You know, that's probably one of the better suggestions

http://stackoverflow.com/comment/37618918
has text: Works fine for me using JDK7 on Windows 7. Download and run the demo code from [How to Integrate with the Desktop Class](http://docs.oracle.com/javase/tutorial/uiswing/misc/desktop.html) and paste your URI into the demo for a test. Post your [SSCCE](http://sscce.org/) that demonstrates how you are testing your code and how you build the URI if you still need more help.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24334436
score: 1

http://stackoverflow.com/comment/37622350
comment on: http://stackoverflow.com/q/24336696
has text: You forgot to ask a question.
type: Comment
score: 1
type: QuestionComment

postgresql
tags question: http://stackoverflow.com/q/24386283
tags question: http://stackoverflow.com/q/24423142
tags question: http://stackoverflow.com/q/24331765
tags question: http://stackoverflow.com/q/24330312
tags question: http://stackoverflow.com/q/24390897
tags question: http://stackoverflow.com/q/24272577
tags question: http://stackoverflow.com/q/24417617
tags question: http://stackoverflow.com/q/24316377
tags question: http://stackoverflow.com/q/24336830
tags question: http://stackoverflow.com/q/24314578
tag name: postgresql
tags question: http://stackoverflow.com/q/24397088
tags question: http://stackoverflow.com/q/24330791
tags question: http://stackoverflow.com/q/24351162
tags question: http://stackoverflow.com/q/24358720
type: Tag
tags question: http://stackoverflow.com/q/24350446
tags question: http://stackoverflow.com/q/24337835
tags question: http://stackoverflow.com/q/24361648
tags question: http://stackoverflow.com/q/24341444
tags question: http://stackoverflow.com/q/24418068
tags question: http://stackoverflow.com/q/24418458
tags question: http://stackoverflow.com/q/24369864
tags question: http://stackoverflow.com/q/24281494

http://stackoverflow.com/a/24317507
has comment: http://stackoverflow.com/comment/37593190
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/24317432
has comment: http://stackoverflow.com/comment/37589022
has comment: http://stackoverflow.com/comment/37586188
score: 2
has comment: http://stackoverflow.com/comment/37586160
has body: I noticed these. In your constructor, you forgot a !. Replace if (url.contains("http://")) with if (!url.contains("http://")) In all addArgument methods, replace if(mUrl.indexOf(name)=='?') with if(mUrl.indexOf('?') != -1) Explanation You are adding the http://if it already exists there, not the opposite. ! is logical not, it reverses this. You are trying to find the argument's name in the URL, then comparing the index (or -1) to the numeric value of '?'. Obviously won't work.
downvote count: 0
has comment: http://stackoverflow.com/comment/37586213

http://stackoverflow.com/q/24280836
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24280870
type: Question
answer count: 2
has body: if( (i&lt;1 || i&gt;gridSize) || ( j&lt;1 || j&gt;gridSize ) ) throw new java.lang.IndexOutOfBoundsException ; This is a snippet of code from the program I am writing in which ( this is an excercise ) we are asked to throw java.lang.IndexOutOfBoundsException if the index i is out of the grid . But when I compile it shows the following error . 3 errors found: File: C:\Users\das\Desktop\Percolation.java [line: 19] Error: Syntax error on token(s), misplaced construct(s) How can I correct it ?
has comment: http://stackoverflow.com/comment/37516278
score: 0
tagged with: exception
accepted answer: http://stackoverflow.com/a/24280870
has title: java.langIndexOutOfBoundException
favorite count: 0
has answer: http://stackoverflow.com/a/24281127
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/37516246
possible better answer: http://stackoverflow.com/a/24281127

http://stackoverflow.com/comment/37542016
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24293951
score: 0
has text: You're right, it is not writing to the html file even with static variables

http://stackoverflow.com/q/24396145
tagged with: linux
has title: Is there anyway to mimic or mock a Linux command line in a Java JUnit test
accepted answer: http://stackoverflow.com/a/24397130
possible better answer: http://stackoverflow.com/a/24396397
has comment: http://stackoverflow.com/comment/37735361
has answer: http://stackoverflow.com/a/24396397
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: unit-testing
type: Question
answer count: 2
has body: I have been working recently on a JUnit test for an application. This application is executed in a Linux environment and the arguments, options and other critical information is incorporated into the command line which is then sent to the Java code. I have been trying to find different ways to test certain aspects of the application using JUnit 3.8.1, but I have run across some issues with methods that deal with the command line and arguments passed from it. My question: Is there anyway to set up a mock or psuedo Linux command line prompt or even try hard code a command line that is fed to the test methods? I have been researching for a while but I can't find anything that really answers my question. Any help would be greatly appreciated.
has answer: http://stackoverflow.com/a/24397130
tagged with: junit
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/37786100
score: 0
type: AnswerComment
type: Comment
has text: My snippet was for Cordova 3.4.0, so plain reusing will probably not work on 2.9.0. Please try to check with 2.9.0 sources of the the CordovaWebView to adapt this approach. I can check it by myself later, but I will probably not have a chance to test it anyway.
comment on: http://stackoverflow.com/a/24410049

http://stackoverflow.com/a/24349775
accepted answer of: http://stackoverflow.com/q/24347872
answers question: http://stackoverflow.com/q/24347872
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37647228
has body: An MCVE of a run-time problem should compile cleanly. That shows 3 compilation errors. One is a missing import (easily fixable), but the other two relate to the missing FirstWindow. Nevertheless, once a few tweaks were made, the problem becomes clear. A component can only appear in one place. By adding it to the panel as well (commented out below), it cannot appear in the menu. import java.awt.*; import javax.swing.*; public class TestingClass extends JFrame { public static void main(String[] args) { JFrame fw = new JFrame(); fw.setSize(400, 200); // for screenshot fw.setDefaultCloseOperation(EXIT_ON_CLOSE); JPanel p5 = new JPanel(new GridBagLayout()); p5.setVisible(true); fw.add(p5); JMenu menu = new JMenu("Menu"); //menu.setVisible(true); menu.add("home"); menu.add("about"); menu.add("explore"); JMenuBar menubar = new JMenuBar(); fw.setJMenuBar(menubar); // THE UPDATED LINE OF CODE. //menubar.setVisible(true); menubar.add(menu); //p5.add(menu); // WTF? fw.setVisible(true); //should be done after all components are added } }
type: Answer
has comment: http://stackoverflow.com/comment/37859744
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/37860540

http://stackoverflow.com/q/24422280
has answer: http://stackoverflow.com/a/24488375
tagged with: jboss
type: Question
answer count: 1
tagged with: ldap
score: 0
has body: I was trying to install my custom authentication(required in the application) using JAAS. My standalone.xml looks like &lt;security-domain name="other" cache-type="default"&gt; &lt;authentication&gt; &lt;login-module code="com.app.user.extendedSec.ExtendedLdapExtLoginModule" flag="optional"&gt; &lt;module-option name="java.naming.factory.initial" value="com.sun.jndi.ldap.LdapCtxFactory"/&gt; &lt;module-option name="java.naming.provider.url" value="ldap://app.user.in:389"/&gt; &lt;module-option name="java.naming.security.authentication" value="simple"/&gt; &lt;module-option name="password-stacking" value="useFirstPass"/&gt; &lt;module-option name="principalDNPrefix" value="cn="/&gt; &lt;module-option name="principalDNSuffix" value=",OU=Test,DC=ads,DC=exilant,DC=in"/&gt; &lt;module-option name="rolesCtxDN" value="OU=Test,DC=ads,DC=exilant,DC=in"/&gt; &lt;module-option name="uidAttributeID" value="member"/&gt; &lt;module-option name="matchOnUserDN" value="false"/&gt; &lt;module-option name="roleAttributeID" value="sAMAccountName"/&gt; &lt;module-option name="roleAttributeIsDN" value="true"/&gt; &lt;/login-module&gt; &lt;login-module code="com.app.user.extendedSec.ExtendedUsernamePasswordLoginModule" flag="required"&gt; &lt;module-option name="unauthenticatedIdentity" value="guest"/&gt; &lt;module-option name="password-stacking" value="useFirstPass"/&gt; &lt;module-option name="dsJndiName" value="java:/session-tracking-dataSource-orcl"/&gt; &lt;module-option name="principalsQuery" value="SELECT PASSWORD FROM FUSION_USERS WHERE USERID=? AND LOCKFLAG='false' and (upper(active_ind) != 'N' or active_ind is null)"/&gt; &lt;module-option name="rolesQuery" value="SELECT USERTYPE, 'Roles' FROM FUSION_USER_GROUPS WHERE USERID=?"/&gt; &lt;/login-module&gt; When it is authenticating and authorizing using DB it is working fine. But is not able to authenticate/authorize using ldap server public class ExtendedLdapExtLoginModule extends LdapLoginModule { private static Logger _logger=…
tagged with: jaas
has comment: http://stackoverflow.com/comment/37906245
type: UnansweredQuestion
tagged with: j-security-check
has title: Extending LdapLoginModule is not authorizing user
tagged with: java

http://stackoverflow.com/q/24315550
possible better answer: http://stackoverflow.com/a/24315588
answer count: 2
duplicate of: http://stackoverflow.com/q/14289328
has answer: http://stackoverflow.com/a/24315588
tagged with: this
favorite count: 0
has title: Why does assignment has no effect when formal arguments and instance variables are same?
has comment: http://stackoverflow.com/comment/37582137
has comment: http://stackoverflow.com/comment/37582100
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/24315583
upvote count: 1
downvote count: 1
type: Question
tagged with: java
has body: I am trying a simple example in java: class student{ int id; String name; void stud(int id,String name){ id = id ; name = name; } void display(){System.out.println(id+" "+name);} public static void main(String args[]){ student s1 = new student(); s1.stud(1,"sss"); s1.display(); } } it gives me an o/p as 0 and null and the following program : class student{ int id; String name; void stud(int i,String n){ id = i ; name = n; } void display(){System.out.println(id+" "+name);} public static void main(String args[]){ student s1 = new student(); s1.stud(1,"sss"); s1.display(); } } gives me an output as 1 sss Why does changing the formal parameters to names different from member variables of the class works correctly?
linked to: http://stackoverflow.com/q/14289328
accepted answer: http://stackoverflow.com/a/24315583

http://stackoverflow.com/comment/37756573
has text: If you want to compare the year and month alone, and the format of the string remain same, why couldn't you get the substring and use equals
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24406860

http://stackoverflow.com/comment/37789679
has text: actually, if you want to nitpick, i don't see any real question here..like "how do i avoid the message"
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24425398
type: Comment

http://stackoverflow.com/a/24373363
has comment: http://stackoverflow.com/comment/37692485
type: Answer
answers question: http://stackoverflow.com/q/24373315
has body: You must use a superclass-subclass relation: so: class derived extends base { @Override public void abc() { System.out.print("wad up "); } } In some weakly-typed programming paradigms (like for instance duck-typing), this is indeed not necessary. Java is however strongly typed (well java is not fully strongly typed, but that's another discussion) and only allows assigning extended types and you can only give a new definition to a method using the @Override annotation.
upvote count: 1
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37692578

http://stackoverflow.com/a/24354545
downvote count: 2
score: 2
answers question: http://stackoverflow.com/q/24354507
accepted answer of: http://stackoverflow.com/q/24354507
upvote count: 4
type: AcceptedAnswer
type: Answer
has body: The synchronization over the (shared) queue in WorkerThread.run only allows a single thread to process a task at a time - the effect is effectively a one-worker pool! In this case, Thread 0 "wins" most of the time on obtaining the lock; synchronized lock acquisition is not guaranteed to be fair. A simple fix is to fetch the task from the queue, using the required thread-safe construct, and then process the task outside of the synchronized section. This allows the workers to process the tasks, which are assumed to be independent, concurrently. // e.g. @Override public void run() { while(true){ TheObject objToDealWith; synchronized (queue) { // Only synchronized on queue when fetching task objToDealWith = getTask(queue); } // Process task; independent of queue process(objToDealWith); } } Since one of the threads will be busy processing a task, while the other is obtaining (or has obtained) a lock on the queue, the work distribution will "be fair".

http://stackoverflow.com/comment/37578492
type: Comment
has text: By "unknown" do you mean that you haven't instantiated them??
comment on: http://stackoverflow.com/q/24310632
score: 0
type: QuestionComment

http://stackoverflow.com/a/24488375
has body: Assuming you are extending org.jboss.security.auth.spi.LdapLoginModule, you should not override validatePassword() as it already tries to do a bind operation to the LDAP server. Judging from the source code and comments at the JBoss docs you can just use the vanilla LdapLoginModule#validatePassword() and it will try a login instead of password retrieval. Specifically, these comments from the JBoss source code clarify this: /** Overriden to return an empty password string as typically one cannot obtain a user's password. We also override the validatePassword so this is ok. @return and empty password String */ protected String getUsersPassword() throws LoginException { return ""; } /** Validate the inputPassword by creating a ldap InitialContext with the SECURITY_CREDENTIALS set to the password. @param inputPassword the password to validate. @param expectedPassword ignored */ protected boolean validatePassword(String inputPassword, String expectedPassword)
score: 0
answers question: http://stackoverflow.com/q/24422280
type: Answer

http://stackoverflow.com/comment/37701643
has text: means i should not use the input object here??
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24378271

http://stackoverflow.com/comment/37781832
has text: It probably should be mentioned that the two calls in Vwin's question are not identical. To make them function identically, either the second must pass `"/TestFile.txt"` or the first must pass `MyClass.class.getPackage().getName().replace('.', '/') + "/TestFile.txt"`.
type: AnswerComment
comment on: http://stackoverflow.com/a/24394172
type: Comment
score: 1

http://stackoverflow.com/a/24286497
answers question: http://stackoverflow.com/q/24286379
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24286379
has comment: http://stackoverflow.com/comment/37528130
has comment: http://stackoverflow.com/comment/37526816
upvote count: 3
type: AcceptedAnswer
type: Answer
has body: I think you have three options (EDIT -- more details): load a class from a File on the filesystem, using a URLClassLoader: see this answer; create the class using reflection: you still need the class to be in classpath, or you need to load it through filesystem (option 1), see this. middle way solution: you can add an interface to your standalone product, and then create your implementing class with reflection; I never did this in production, I just tested the code and it works: see this question

http://stackoverflow.com/a/40194333
has body: Unfortunately keytool explicitly will not let you export from a trust store since they are of the opinion that PEM files do not support the concept of trusted certificate. So I would use the keystore of cer files instead. From a cer: openssl x509 -inform der -in serverpub.cer -out serverpub.pem From a keystore: keytool -importkeystore -srckeystore server.jks -destkeystore server.p12 -deststoretype PKCS12 openssl pkcs12 -in server.p12 -nokeys -out server.cer.pem openssl pkcs12 -in server.p12 -nodes -nocerts -out server.key.pem or just try keytool -exportcert -alias myserverkeys -keystore serverpub.jks -rfc -file serverpub.pem
downvote count: 2
score: 25
upvote count: 27
answers question: http://stackoverflow.com/q/24343681
has comment: http://stackoverflow.com/comment/99871806
type: Answer
has comment: http://stackoverflow.com/comment/78943090

http://stackoverflow.com/comment/37720883
type: QuestionComment
comment on: http://stackoverflow.com/q/24388150
type: Comment
score: 0
has text: What have you tried? Show some code. This is a really fundamental problem and there are loads of resources online to help you.

http://stackoverflow.com/comment/37630968
comment on: http://stackoverflow.com/a/24339574
has text: O sorry..i dont see the link now.can you come to skype please.if you have no problem..
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24271153
has comment: http://stackoverflow.com/comment/37498038
favorite count: 0
has comment: http://stackoverflow.com/comment/37497841
has comment: http://stackoverflow.com/comment/37497899
has comment: http://stackoverflow.com/comment/37497851
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37498015
tagged with: jcombobox
upvote count: 0
has title: if statements and math.random
has comment: http://stackoverflow.com/comment/37498082
tagged with: java
has comment: http://stackoverflow.com/comment/37497938
has answer: http://stackoverflow.com/a/24271617
type: Question
tagged with: if-statement
score: -2
has body: I am trying to make an if statement that when a user picks from a combo box and it so happens to be the number that was determined from math.random, it will display a message. I already have the if statement set up. However, this part isnt working. I am unable to tell if it is working or not because I cant test it. This is because I do not know which date is the random number. int RandomDate = (int)Math.ceil(Math.random()*31); Out1.setText(RandomDate); ... ... ... else if(Day.getSelectedItem().equals(RandomDate)) { Out1.setText("This Day is Fully Booked"); } Out1 is a text area Day is the name of my JComboBox Thanks for the help. I probably just made a little mistake and don't know where I went wrong because I am new to Java
downvote count: 2
answer count: 1

applet
tags question: http://stackoverflow.com/q/24279798
tags question: http://stackoverflow.com/q/24387657
tags question: http://stackoverflow.com/q/24311091
tags question: http://stackoverflow.com/q/24408537
type: Tag
tags question: http://stackoverflow.com/q/24393725
tag name: applet
tags question: http://stackoverflow.com/q/24318390
tags question: http://stackoverflow.com/q/24418782
tags question: http://stackoverflow.com/q/24344267
tags question: http://stackoverflow.com/q/24317404
tags question: http://stackoverflow.com/q/24313493
tags question: http://stackoverflow.com/q/24401165
tags question: http://stackoverflow.com/q/24371833
tags question: http://stackoverflow.com/q/24423659
tags question: http://stackoverflow.com/q/24381249
tags question: http://stackoverflow.com/q/24342893
tags question: http://stackoverflow.com/q/24278811
tags question: http://stackoverflow.com/q/24284447
tags question: http://stackoverflow.com/q/24423617

http://stackoverflow.com/comment/37706291
type: Comment
type: QuestionComment
has text: @mystdeim the compareTo should return -1 or 0 or 1. Why are you returning -1? any reason?
score: 0
comment on: http://stackoverflow.com/q/24380433

actionlistener
tags question: http://stackoverflow.com/q/24392916
tags question: http://stackoverflow.com/q/24413851
tags question: http://stackoverflow.com/q/24324740
tags question: http://stackoverflow.com/q/24343949
type: Tag
tags question: http://stackoverflow.com/q/24325790
tag name: actionlistener
tags question: http://stackoverflow.com/q/24422004

http://stackoverflow.com/q/24341490
tagged with: java
linked to: http://stackoverflow.com/q/20066625
upvote count: 1
has comment: http://stackoverflow.com/comment/37631692
has comment: http://stackoverflow.com/comment/37631201
type: Question
tagged with: c#
has comment: http://stackoverflow.com/comment/37631132
downvote count: 0
linked to: http://stackoverflow.com/q/6343166
has comment: http://stackoverflow.com/comment/37631035
has comment: http://stackoverflow.com/comment/37630791
linked to: http://stackoverflow.com/q/20212848
tagged with: android
has comment: http://stackoverflow.com/comment/37630884
favorite count: 0
has comment: http://stackoverflow.com/comment/37631964
has title: Android Not Connecting to WCF service which works in the browser
has comment: http://stackoverflow.com/comment/37631089
has comment: http://stackoverflow.com/comment/37630842
type: UnansweredQuestion
tagged with: wcf
tagged with: web-services
has comment: http://stackoverflow.com/comment/37630976
has comment: http://stackoverflow.com/comment/37630963
has body: I have a WCF Service (working tried it in the browser) the code for it [OperationContract] [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "Login/?username={username}&password={password}")] bool Login(string username, string password); [OperationContract] [WebGet(UriTemplate = "Search/?query={query}&type={type}", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)] List<AndroidBook> Search(string query, int type); EDIT: the web config file: <system.serviceModel> <endpoint address="" binding ="webHttpBinding" contract="??????.IAndroidBridge" behaviorConfiguration="webHttpBehavior"/> <serviceMetadata httpGetEnabled="true"/> <webHttp/> <webHttp automaticFormatSelectionEnabled="true"/> <add scheme="http" binding="webHttpBinding"/> <standardEndpoint helpEnabled="true" automaticFormatSelectionEnabled="true"/> </system.serviceModel> and when testing it in browser i get the following: {"LoginResult":true} which is true but when trying to connect in the android client with this code: try { HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = httpclient.execute(new HttpGet(urls)); StatusLine statusLine = response.getStatusLine(); if(statusLine.getStatusCode() == HttpStatus.SC_OK){ ByteArrayOutputStream out = new ByteArrayOutputStream(); response.getEntity().writeTo(out); out.close(); String responseString = out.toString(); //..more logic } else{ //Closes the connection. response.getEntity().getContent().close(); throw new IOException(statusLine.getReasonPhrase()); } } catch (IOException e) { Log.e("HTTP GET:", e.toString()); } i got an exception of filenotfound or when i get a response with outer codes i got a bad request , i have googled this problem and came across same problems and read the following articles C#/Java - Consuming WCF Service from Android emulator Exposing a service running on localhost to an Android emulator? How to fix android.os.Netwo…
has comment: http://stackoverflow.com/comment/37630857
has comment: http://stackoverflow.com/comment/37630908
answer count: 0
score: 1

http://stackoverflow.com/comment/37601352
type: Comment
comment on: http://stackoverflow.com/a/24325837
has text: The method `getItemAtPosition()` returns the data associated with both the group AND its children. To get the individual group/child object of an `ExpandableListView`, you need a reference to its `Adapter` and then you need to call either `getGroup()` or `getChild()` as the case may be ... :)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37681725
type: AnswerComment
has text: @jewelsea please can u send me sample code for this problem.thanks
type: Comment
comment on: http://stackoverflow.com/a/24320562
score: 0

http://stackoverflow.com/comment/37710139
type: Comment
comment on: http://stackoverflow.com/q/24382506
type: QuestionComment
has text: It may depend on what the `save` operation really does. Can you add it to the question?
score: 0

http://stackoverflow.com/a/24361731
score: 0
type: Answer
has body: I get very strange behaviour on the query explorer too at the moment. Haven't found a way to log in to any of my GA accounts to generate a URI yet..
answers question: http://stackoverflow.com/q/24325936

svn
tags question: http://stackoverflow.com/q/24386172
type: Tag
tags question: http://stackoverflow.com/q/24292947
tags question: http://stackoverflow.com/q/24313519
tag name: svn
tags question: http://stackoverflow.com/q/24415330

http://stackoverflow.com/a/24343571
has body: I found the right term in wiki for event bus is Event_monitoring, now then, I can understand what is event bus. Like a signal system, most of them work in one process, like Guava EventBus dose. Though, they can work as an IPC, but that is not the main purpose. MQ is an message system,most of them got message server, kind of complex,but grant more controls, more options. Some of they got an admin tool too. So, they are kind of same tech to resolve different scale or situation.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24340892

http://stackoverflow.com/q/24300733
has comment: http://stackoverflow.com/comment/37554636
answer count: 1
has comment: http://stackoverflow.com/comment/37554160
has comment: http://stackoverflow.com/comment/37554111
favorite count: 0
linked to: http://stackoverflow.com/q/19511956
has comment: http://stackoverflow.com/comment/37554032
tagged with: android
tagged with: foreach
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/21446414
tagged with: java
has comment: http://stackoverflow.com/comment/37554370
tagged with: loops
linked to: http://stackoverflow.com/q/6866238
has answer: http://stackoverflow.com/a/24301163
downvote count: 1
has comment: http://stackoverflow.com/comment/37554415
has comment: http://stackoverflow.com/comment/37554858
type: Question
tagged with: for-loop
upvote count: 0
accepted answer: http://stackoverflow.com/a/24301163
score: -1
has title: Java for each makes problems
linked to: http://stackoverflow.com/q/6958478
has comment: http://stackoverflow.com/comment/37554121
has comment: http://stackoverflow.com/comment/37554542
has body: I had some trouble using a for each loop for an List at my android project. The error is made by an iterator (or I should better say "the error is made by me - not knowing how to use the iterator"^^). The List is looped through in order to draw bullet objects on a canvas. When one of the bullets leaves the screen I delete this object. Using a "normal" for-loop solved the error: for (int ii = 0; ii &lt; bulletList_P1.size(); ii++) bulletList_P1.get(ii).draw(canvas); this implementation brings errors: for (Bullet bullet : bulletList_P1) bullet.draw(canvas); I found THIS here on stackoverflow. The difference to my problem is that in this case new objects are created - my question is now how to deal with this situation when objects get removed (deleted from list). How massive will be the difference of performance using one or the other implementation?
duplicate of: http://stackoverflow.com/q/6958478

http://stackoverflow.com/a/24379126
has comment: http://stackoverflow.com/comment/37728374
has comment: http://stackoverflow.com/comment/37728719
has comment: http://stackoverflow.com/comment/37728493
answers question: http://stackoverflow.com/q/24378768
has comment: http://stackoverflow.com/comment/37728589
downvote count: 0
has comment: http://stackoverflow.com/comment/37728606
has comment: http://stackoverflow.com/comment/37728655
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/37728673
has body: In the manifest of the second app : &lt;activity android:name=".MainActivitySecondApp" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="com.external.intentReceiver" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; And then place the following code inside the onClickListener of the Button in the first App : Intent intent = new Intent(); intent.setAction("com.external.intentReceiver"); context.startActivity(intent); So, when the button is clicked, an intent of the type com.external.intentReceiver will be fired. The MainActivitySecondApp will then open since it is meant to handle such intents as defined in the Manifest.
has comment: http://stackoverflow.com/comment/37728482

http://stackoverflow.com/q/24323594
has title: Process.execute() throws exception when trying to run command on shell using java
has answer: http://stackoverflow.com/a/24431840
has answer: http://stackoverflow.com/a/24429037
linked to: http://stackoverflow.com/q/24445942
score: 0
has comment: http://stackoverflow.com/comment/37597390
has comment: http://stackoverflow.com/comment/37597365
accepted answer: http://stackoverflow.com/a/24429037
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/18081080
tagged with: java
has body: I have written this code which should execute a command on shell to search pattern ">" in a text file , when I try same command on shell it works fine but when I try execute same command using java , it doesn't work for me as buffered reader returns null.Can somebody tell that what I have done wrong in this. Code: String filename="/home/abhijeet/sample.txt"; Process contigcount_p; String command_to_count="grep \"&gt;\" "+filename+" | wc -l"; System.out.println("command for counting contigs "+command_to_count); contigcount_p=Runtime.getRuntime().exec(command_to_count); contigcount_p.wait(); BufferedReader reader = new BufferedReader(new InputStreamReader(contigcount_p.getInputStream())); System.out.println("chkk buffer"+reader.readLine());
has comment: http://stackoverflow.com/comment/37597916
type: Question
tagged with: jakarta-ee
answer count: 2
possible better answer: http://stackoverflow.com/a/24431840

http://stackoverflow.com/q/24334207
has answer: http://stackoverflow.com/a/24334356
answer count: 3
downvote count: 0
tagged with: shell
favorite count: 0
has title: Get status report from shell script to java code
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
has body: Can any one tell me how to get status report from shell script to java code. Use case : I run a shell script from java code and if I get any error in shell script(while running) then I need to send some message from shell script to my java code. So how I can acheive that.
has answer: http://stackoverflow.com/a/24334246
type: Question
has answer: http://stackoverflow.com/a/24334302
tagged with: linux

date
tags question: http://stackoverflow.com/q/24288908
tags question: http://stackoverflow.com/q/24366224
tag name: date
tags question: http://stackoverflow.com/q/24280665
tags question: http://stackoverflow.com/q/24355607
tags question: http://stackoverflow.com/q/24355259
tags question: http://stackoverflow.com/q/24325171
tags question: http://stackoverflow.com/q/24269755
tags question: http://stackoverflow.com/q/24320378
tags question: http://stackoverflow.com/q/24324149
tags question: http://stackoverflow.com/q/24375885
tags question: http://stackoverflow.com/q/24294304
tags question: http://stackoverflow.com/q/24328505
type: Tag
tags question: http://stackoverflow.com/q/24399846
tags question: http://stackoverflow.com/q/24355504
tags question: http://stackoverflow.com/q/24381619
tags question: http://stackoverflow.com/q/24280261
tags question: http://stackoverflow.com/q/24413867
tags question: http://stackoverflow.com/q/24406322
tags question: http://stackoverflow.com/q/24359239
tags question: http://stackoverflow.com/q/24402321
tags question: http://stackoverflow.com/q/24334313
tags question: http://stackoverflow.com/q/24403915

http://stackoverflow.com/q/24277644
has comment: http://stackoverflow.com/comment/37510195
tagged with: java
has title: How to use a class as a parameter in java?
type: Question
has comment: http://stackoverflow.com/comment/37510232
score: -2
answer count: 1
tagged with: class
has comment: http://stackoverflow.com/comment/37541106
downvote count: 3
upvote count: 1
has body: I,m making a library that can restart any class that calls it's method. It just needs the class to build the command off of. Here's what I have so far: public static void restart(Class a) { final String javaBin = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"; try { File currentJar = new File(a.class.getProtectionDomain().getCodeSource().getLocation().toURI()); /* is it a jar file? */ if(!currentJar.getName().endsWith(".jar")) { return; } /* Build command: java -jar application.jar */ final ArrayList&lt;String&gt; command = new ArrayList&lt;&gt;(5); command.add(javaBin); command.add("-jar"); command.add(currentJar.getPath()); final ProcessBuilder builder = new ProcessBuilder(command); builder.start(); System.exit(0); } catch (URISyntaxException | IOException ex) { Logger.getLogger(a.class.getName()).log(Level.SEVERE, null, ex); } } The problem is that variable 'a' is not being recognized as a parameter. Can anybody help?
favorite count: 0
has comment: http://stackoverflow.com/comment/37510248
has answer: http://stackoverflow.com/a/24278867
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37510211
tagged with: parameter-passing
has comment: http://stackoverflow.com/comment/37510219

http://stackoverflow.com/q/24277891
score: 0
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/57170062
type: Question
has comment: http://stackoverflow.com/comment/37511171
has answer: http://stackoverflow.com/a/24278815
has answer: http://stackoverflow.com/a/24283898
has answer: http://stackoverflow.com/a/63282800
has comment: http://stackoverflow.com/comment/37514163
has comment: http://stackoverflow.com/comment/37510826
answer count: 7
tagged with: drop-down-menu
has answer: http://stackoverflow.com/a/24303385
type: UnansweredQuestion
has title: Find out last Option value in Drop down list Webdriver using Java
has body: How can we select the "Last" Option value in Drop down list find out the html code, this Drop down box items generate dynamically based on the record size in Grid 25 some time it may have 3 items 25 50 100 each execution of my code, it should be select the last option item in that drop down list, let me know how can we proceed for this situation
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/24278059
has answer: http://stackoverflow.com/a/24278378
has comment: http://stackoverflow.com/comment/37510775

http://stackoverflow.com/q/24311076
has title: LDAP java error: adding entry.javax.naming.directory.NoSuchAttributeException
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24364450
has comment: http://stackoverflow.com/comment/37573760
tagged with: java
has comment: http://stackoverflow.com/comment/37573992
has body: I have a problem adding an entry in LDAP, precisely I want to add a user. class AddUser { public static void main(String[] args) { String userName = "manager"; String password = "pass"; Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap://192.168.10.45:389/dc=mydc,dc=local"); env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.SECURITY_PRINCIPAL, new String("mydc" + "\\" + userName)); env.put(Context.SECURITY_CREDENTIALS, password); // env.put(Context.REFERRAL, "follow"); // entry's DN String entryDN = "cn=NewUser, dc=mydc, dc=local"; // entry's attributes Attribute cn = new BasicAttribute("cn", "NewUser"); Attribute sn = new BasicAttribute("sn", "Smith"); Attribute mail = new BasicAttribute("mail", "newuser@foo.com"); Attribute phone = new BasicAttribute("telephoneNumber", "+1 222 3334444"); Attribute uid = new BasicAttribute("uid", "nsmith"); Attribute userPassword = new BasicAttribute("userPassword", "pwd1"); Attribute oc = new BasicAttribute("objectClass"); oc.add("dcObject"); oc.add("person"); oc.add("inetOrgPerson"); DirContext ctx = null; try { // get a handle to an Initial DirContext ctx = new InitialDirContext(env); // build the entry Attributes entry = new BasicAttributes(); entry.put(cn); entry.put(sn); entry.put(mail); entry.put(phone); entry.put(uid); entry.put(userPassword); entry.put(oc); // Add the entry ctx.createSubcontext(entryDN, entry); System.out.println("AddUser: added entry " + entryDN + "."); } catch (NamingException e) { System.err.println("AddUser: error adding entry." + e); } } } I got the following error: AddUser: error adding entry.javax.naming.directory.NoSuchAttributeException: [LDAP: error code 16 - 00000057: LdapErr: DSID-0C090C3E, comment: Error in attribute conversion operation, data 0, v1db1 ]; remaining name cn=NewUser, dc=mydc, dc=local I don't know where is the error. Can be only a bad input about the attributes?
type: Question
tagged with: jndi
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24364450
tagged with: ldap
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37582657

http://stackoverflow.com/comment/37522565
type: QuestionComment
comment on: http://stackoverflow.com/q/24279620
type: Comment
score: 0
has text: In Windows, when you use the normal Windows command prompt, you must use `;` instead of `:` to separate entries in the classpath: `java -classpath jna.jar;. Example`

http://stackoverflow.com/comment/37730421
comment on: http://stackoverflow.com/q/24393099
score: 0
type: Comment
type: QuestionComment
has text: @Pshemo you know people like you love pouncing on other people's mistakes Because it makes them feel better beatin up on someone else. And they're greatful it ain't them thats being humiliated.

http://stackoverflow.com/comment/37494231
has text: Because it's non-sensical and/or redundant at best.
comment on: http://stackoverflow.com/q/24269308
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37542442
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24294327
type: AnswerComment
has text: ok, But now I see that the month name in a spinner, and I have to convert to an integer to make another query. I do this: ` String mese = monthSelector.getSelectedItem().toString(); Calendar cal = Calendar.getInstance(); try { cal.setTime(new SimpleDateFormat("MMMM").parse(mese)); } catch (ParseException e) { e.printStackTrace(); } int monthInt = cal.get(Calendar.MONTH + 1); String monthConverted = ""+monthInt; if(monthInt<10){ monthConverted = "0"+monthConverted; } ` but I get the month as number 23! why?

http://stackoverflow.com/q/24361134
has body: From the pdf of a java course: http://www.ccs.neu.edu/home/riccardo/courses/csu370-fa07/lect4.pdf It says: For those of you that follow at home, let me emphasize that subclassing is not inheritance. We will see inheritance later in the course. Of course, subclassing and inheritance are related. As we will see inheritance is a code reuse mechanism that lets you reuse code easily when defining subclasses. But subclassing makes sense even when you do not have inheritance. (Indeed, some languages have subclassing but no inheritance, at least, not inheritance like Java implements.) Subclassing is a property of classes, and is properly part of the type system of Java. Subclassing is used by Java to determine what methods can possibly be invoked on an object, and to return an error at compile-time when an object does not supply a given method. I want to know which languages have subclassing but no inheritance, at least, not inheritance like Java implements? (Since I'm not quite understand the concepts, so if I can see it in some actual languages, that would make it clearer)
answer count: 1
downvote count: 0
tagged with: inheritance
has comment: http://stackoverflow.com/comment/37669686
favorite count: 0
type: Question
tagged with: subclass
has comment: http://stackoverflow.com/comment/37670380
has comment: http://stackoverflow.com/comment/37669564
score: 5
has title: Which languages "have subclassing but no inheritance"?
has answer: http://stackoverflow.com/a/24361404
upvote count: 5
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37669816

http://stackoverflow.com/comment/37783216
comment on: http://stackoverflow.com/a/24362096
score: 0
type: Comment
has text: *"just that I never heard them before..."* And there you have it. A programmer would have put 'unknown_term define' into a search engine and empowered themselves with new understanding, instead of what you did. It isn't 'lack of knowledge' that makes you not fit to be a programmer, but more 'lack of initiative'.
type: AnswerComment

http://stackoverflow.com/q/24409172
has title: How to capture the contents of graphics as an image
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5853879
tagged with: java
has answer: http://stackoverflow.com/a/24409347
duplicate of: http://stackoverflow.com/q/5853879
type: Question
tagged with: video-capture
score: 0
answer count: 1
has body: I have a transparent jframe that has scrolling text on it, and I need to capture just the jframe and not whats behind it. At first, java.awt.Robot looked promising, but it doesn't capture only the graphics context of the jframe. Maybe somebody knows a portion of the API that could help with this...
accepted answer: http://stackoverflow.com/a/24409347
tagged with: swing

http://stackoverflow.com/comment/37778176
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24419045
has text: Of course. I just have to wait a few minutes before doing so.
score: 0

http://stackoverflow.com/q/24400578
has body: I have not written any code which creates taskqueue in application. still while running application multiple queues are generated in backgraound. This application is Multitenant application and NamespaceManager.set() is called before performing DAO commands like getObjectById, makePersistent. Taskqueue on dashboard- Name ETA Creation Time Method/URL Retries Executions Payload Actions 12914588931600734283 ↓ 2014/06/24 21:41:34 0:01:00 ago 2014/06/24 21:41:34 0:01:01 ago POST /_ah/queue/deferred 1116 bytes 6 Headers Run Now 2741788704643718514 ↓ 2014/06/24 21:40:44 0:01:51 ago 2014/06/24 21:40:44 0:01:51 ago POST /_ah/queue/deferred 892 bytes 6 Headers Run Now 5571553031267592814 ↓ 2014/06/24 21:41:33 0:01:02 ago 2014/06/24 21:41:33 0:01:02 ago POST /_ah/queue/deferred 1041 bytes 6 Headers Run Now 9741325715271053513 ↓ 2014/06/24 21:40:58 0:01:37 ago 2014/06/24 21:40:58 0:01:37 ago POST /_ah/queue/deferred 892 bytes 6 Headers Run Now 9741325715271056707 ↓ 2014/06/24 21:41:34 0:01:01 ago 2014/06/24 21:41:34 0:01:01 ago POST /_ah/queue/deferred 1113 bytes 6 Headers Run Now
has title: How to stop appengine from creating automated multiple default queue?
has answer: http://stackoverflow.com/a/24402611
score: 0
answer count: 1
tagged with: task-queue
tagged with: google-cloud-endpoints
type: UnansweredQuestion
tagged with: multi-tenant
tagged with: google-app-engine
tagged with: java
type: Question

http://stackoverflow.com/comment/37708462
score: 1
has text: I've edited my answer. Hopefully this helps to retrieve your datasets. If it doesn't then it's worth taking a look at XYSeriesCollection for storing and retrieving your series.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24380860

http://stackoverflow.com/q/24376279
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/24421394
has title: Is it possible to call into javascript from a background thread running in a cordova android plugin
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: javascript
answer count: 1
downvote count: 0
has body: I have a Cordova application using a native plugin on Android (other platforms to come). My plugin is loaded at application start (&lt;param name="onload" value="true" /&gt; in plugin.xml) and my native code does some work in the initialize method (overloaded from the CordovaPlugin class). Essentially, the work I do in the initialize method then causes an event to be generated at a later time, and I need to deliver this event to the javascript API. Is there any way I can asynchronously call into the javascript from the native side of the plugin, without first having called into the plugin from the javascript side? (a call from JS->Java would give me a CallbackContext which I could use to issue the callback, I assume). I found this https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/NativeToJsMessageQueue.java but I don't know how to use it and I cannot find any documentation - I'm not even sure if it works or is intended for public use. Can I use webview.loadUrl("javascript: ... "); to call in to the javascript side, or will this disrupt or interfere with the cordova framework running in JS (if any)? Is there a recommended way of acomplishing this, and is it supported across multiple platforms (or are the concepts applicable to other platforms?) Thanks
favorite count: 0
tagged with: cordova

http://stackoverflow.com/q/24331518
type: Question
has answer: http://stackoverflow.com/a/24332781
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37612843
has body: I have client and server server site. Server is working good but client site when i'm trying to read is not. But when I remove this code it works: while((read = br.readLine()) != null){ System.out.println("in reading"); finale += read; output.setText(finale); } br.close(); Here is the complete code: try{ Socket connection = new Socket("localhost",PORT); PrintWriter pw = new PrintWriter(new OutputStreamWriter(connection.getOutputStream())); BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream())); pw.println("hi connection estabilished"); pw.flush(); String str,read = "",finale = ""; while(connection.isConnected()){ System.out.println("start"); if(zapis == true){ str = input.getText(); pw.println(str); pw.flush(); input.setText(""); zapis = false; } System.out.println("top of the reading"); while((read = br.readLine()) != null){ System.out.println("in reading"); finale += read; output.setText(finale); } br.close(); } } catch(IOException e) { System.out.println("error " + e); } This is just class for listenning action of my button class Listener implements ActionListener{ @Override public void actionPerformed(ActionEvent e) { Main.zapis = true; } }
has comment: http://stackoverflow.com/comment/37612957
answer count: 1
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/37612735
favorite count: 0
has comment: http://stackoverflow.com/comment/37612816
has title: After reading from socket can't write
tagged with: sockets
accepted answer: http://stackoverflow.com/a/24332781
upvote count: 2
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37612262
downvote count: 1

http://stackoverflow.com/comment/37621323
comment on: http://stackoverflow.com/q/24336162
has text: I did, I'm just curious!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24270157
type: Question
tagged with: java
tagged with: apache-tomee
answer count: 2
tagged with: openejb
tagged with: jax-rs
has answer: http://stackoverflow.com/a/35450970
score: 0
accepted answer: http://stackoverflow.com/a/24270582
has body: I'm trying to deploy multiple instances of our service on our staging server, all on the same TomEE instance. They all have different context paths (platform_foo, platform_bar). I'm getting an exception: Caused by: org.apache.openejb.DuplicateDeploymentIdException: Application cannot be deployed as it contains deployment-ids which are in use: app: /var/www/apache-tomee-jaxrs-1.6.0/webapps/platform_foo UsersService SessionsService My openejb-jar.xml: cxf.jaxrs.providers = <redacted> I tried everything from setting an ID on the web-app element in web.xml, to setting the deployment-id in the openejb-jar.xml. Nothing seems to work.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24270582
has title: Multiple Deployments of JaxRS App in TomEE causing DuplicateDeploymentIdException
possible better answer: http://stackoverflow.com/a/35450970

http://stackoverflow.com/q/24289282
has title: Change device name on android
tagged with: java
has answer: http://stackoverflow.com/a/24289462
type: Question
answer count: 1
tagged with: bluetooth
score: 0
has body: I tried to change the device name on my tablet but for some reason it does not save. After changing I check and it's still the same, don't really know what's happening. I also have included the permissions too, here is my code: BluetoothAdapter myDevice = BluetoothAdapter.getDefaultAdapter(); myDevice.setName("new device name"); And here are my permissions: &lt;uses-permission android:name="android.permission.BLUETOOTH" /&gt; &lt;uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /&gt;
tagged with: android
type: UnansweredQuestion

http://stackoverflow.com/comment/37776978
has text: From what I can tell from the first line of the exception, your EJBClientInvocationContext doesn't have an EJB receiver for the combination with a modulename of "01_CatalogueEJB". Other than that, I'm clueless. I hope this helps
comment on: http://stackoverflow.com/q/24415700
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37707593
score: 0
has text: Your edit works in QuestionListFragment.class, but I am still having the 'Syntax error on tokens, delete these tokens' Eclipse Error on QuestionListActivity.class, wish it was giving me more info...not even informing me which token
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24381286

http://stackoverflow.com/a/24385161
type: Answer
answers question: http://stackoverflow.com/q/24385050
has body: String splitThis = "Hello, World, There"; arr = splitThis.split(","); This will create a new array and assign it to arr variable overriding the previously initialized array. New array will have three elements arr[0] = "Hello" arr[1] = " World" arr[2] = " There" arr[3] will throw exception.
score: 0

http://stackoverflow.com/comment/37778530
type: Comment
has text: By attempting to explicitly make 10 tests in one `if` statement, you are bound to make a mistake/typo. Shorter is usually better. By cleaning it up like so, you make the code infinitely more readable and, in cases such as this, faster.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24418996

http://stackoverflow.com/a/24333168
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24332596
answers question: http://stackoverflow.com/q/24332596
upvote count: 2
has body: The Scala compiler does create a static main method: $ cat Main.scala object Main { def main(args: Array[String]) = println("hello") } $ scalac Main.scala $ ls *class Main.class Main$.class $ javap -cp . Main Compiled from "Main.scala" public final class Main { public static void main(java.lang.String[]); } $ javap -cp . Main$ Compiled from "Main.scala" public final class Main$ { public static final Main$ MODULE$; public static {}; public void main(java.lang.String[]); } $ java -cp /usr/local/scala/lib/scala-library.jar:. Main hello

http://stackoverflow.com/comment/37658197
has text: Since it is a string yes, I have done it many times. I changed abit the client part and I updated the post with the error. The error is at the end
comment on: http://stackoverflow.com/a/24355020
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37682641
score: 0
type: Comment
type: QuestionComment
has text: Ok, indeed this works for different processes.
comment on: http://stackoverflow.com/q/24367887

http://stackoverflow.com/q/24279983
has title: JFrame Frame Icon Not Displayed Unless Program Run From Terminal
has comment: http://stackoverflow.com/comment/37514956
type: UnansweredQuestion
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/37514742
type: Question
has comment: http://stackoverflow.com/comment/37514893
has comment: http://stackoverflow.com/comment/37515293
tagged with: java
has comment: http://stackoverflow.com/comment/37515001
has comment: http://stackoverflow.com/comment/37515147
has comment: http://stackoverflow.com/comment/37514917
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has body: I finally finished my first real program and have been trying to put some finishing touches on it. One of these finishing touches was packaging it up with icons and everything. The problem is, the icon only shows when I run the jar from the terminal. For example, when I double click the jar to run it I only see the Duke mascot. I am activating the same jar file, but in different ways and getting different results. Example 1 (Terminal). Notice how the icon does show up in my tray. Example 2 (Double Click). Notice how the icon does not show up in my tray. Does anyone know how to fix this or what the problem even is? Thanks so much. Edit 1: Code URL iconURL = getClass().getResource("notebook_builder_icon.gif"); ImageIcon icon = new ImageIcon(iconURL); frame.setIconImage(icon.getImage());
has answer: http://stackoverflow.com/a/24280319
linked to: http://stackoverflow.com/q/9864267

http://stackoverflow.com/comment/37763109
comment on: http://stackoverflow.com/q/24411059
score: 0
type: Comment
type: QuestionComment
has text: you need a `String` in `getResourceAsStream("my.properties")`

http://stackoverflow.com/comment/61407941
score: 1
has text: It's not an answer. The link point to an open issue of the powermock, https://github.com/jayway/powermock/issues/645
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/36877285

http://stackoverflow.com/comment/37657713
type: QuestionComment
type: Comment
has text: I'm going to have to familiarize myself with more of this library to see if I can use it in enough places in my codebase to justify the inclusion of another library. It's an Android project, so I'd like to keep the .apk as lightweight as possible.
comment on: http://stackoverflow.com/q/24354916
score: 0

http://stackoverflow.com/a/24335841
has body: With that change the code looks more 'optimized' to some, but no it will not significantly reduce memory usage.
answers question: http://stackoverflow.com/q/24335782
score: 0
type: Answer

http://stackoverflow.com/comment/37632802
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24342054
has text: I think you can define both OnClickListener and expandableListAdapter in FindItemActivity file. Or as I say you must pass link of activity to your FindItemActivity class.
score: 0

http://stackoverflow.com/a/24409835
has comment: http://stackoverflow.com/comment/37760565
accepted answer of: http://stackoverflow.com/q/24409657
answers question: http://stackoverflow.com/q/24409657
score: 0
type: AcceptedAnswer
has body: Since you also have this problem while running mvn in the shell, this is not related to eclipse, so setting: -vm /usr/lib/jvm/java-7-openjdk-amd64 won't have any effect. This is also unrelated to the execution of goal release:prepare as the error occurs at compilation time. You can probably reproduce the same error by doing mvn compile. Your JAVA_HOME is probably pointing to /usr/lib/jvm/java-6-openjdk-amd64 (as seen in mvn log) while your jdk resides in /usr/lib/jvm/java-7-openjdk-amd64. To change JAVA_HOME and test the new setting, go in a shell and: export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 mvn compile If it works you can add export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 to your ~/.bashrc file so that it gets set everytime.
has comment: http://stackoverflow.com/comment/37765636
type: Answer

http://stackoverflow.com/comment/37621312
has text: @ajb it would be easier and faster to just append the data, then reverse it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24335906
score: 0

http://stackoverflow.com/a/24289475
downvote count: 0
type: Answer
score: 3
has body: BigDecimal's are objects. They don't have normal operators. Instead of a normal multiplication operator like x*10, you need to call the method multiply in BigDecimal: x = x.multiply(new BigDecimal(10)); If you want to store it in a new value: BigDecimal n = x.multiply(new BigDecimal(10)); And to convert that to a primative: double d = n.doubleValue(); int i = n.intValue(); However, if you're trying to use decimals, why not just use a double: double x = 0.0004; double n = x*100;
upvote count: 3
answers question: http://stackoverflow.com/q/24289391
has comment: http://stackoverflow.com/comment/37533532
has comment: http://stackoverflow.com/comment/37532883

http://stackoverflow.com/comment/37666678
score: 0
type: AnswerComment
has text: do I have to import something to get that to work because it doesn't recognize "arrays"
comment on: http://stackoverflow.com/a/24359604
type: Comment

http://stackoverflow.com/q/24366579
tagged with: java
has comment: http://stackoverflow.com/comment/37687540
type: Question
has comment: http://stackoverflow.com/comment/37710067
score: 0
has comment: http://stackoverflow.com/comment/37683084
tagged with: jpa
has body: I have a JPA inheritance with a class ContactDTO that is extended by UserDTO with Single_Table strategy: package ch.ffhs.cryptomess.server.dto; import java.io.Serializable; import java.util.HashSet; import java.util.Set; import javax.persistence.Column; import javax.persistence.DiscriminatorColumn; import javax.persistence.DiscriminatorType; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Inheritance; import javax.persistence.InheritanceType; import javax.persistence.ManyToMany; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.UniqueConstraint; import javax.persistence.Version; import org.springframework.transaction.annotation.Transactional; @Transactional @Entity(name = "ch.ffhs.cryptomess.server.dto.ContactDTO") @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name = "discriminator", discriminatorType = DiscriminatorType.STRING) @DiscriminatorValue(value = "ContactDTO") @Table(name = "user", uniqueConstraints = @UniqueConstraint(columnNames = { "username", "discriminator" })) public class ContactDTO implements Serializable { private static final long serialVersionUID = 7706720499337697645L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "user_id_seq") @SequenceGenerator(name = "user_id_seq", allocationSize = 1, initialValue = 10) @Column(name = "id") protected Long id; @Version protected Long version; @Column(name = "public_key", length = 255) protected String publicKey; @Id @Column(length = 50, updatable = false) protected String username; @ManyToMany(mappedBy = "contacts", targetEntity = CommunicationDTO.class) protected Set&lt;CommunicationDTO&gt; communications = new HashSet&lt;CommunicationDTO&gt;( 0); @Override public boolean equals(final Object obj) { if (this == obj) return true; if (obj == null)…
has title: How to update parent class in a jpa single_table inheritance?
type: UnansweredQuestion
answer count: 0

http://stackoverflow.com/a/24283552
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24272239
answers question: http://stackoverflow.com/q/24272239
has comment: http://stackoverflow.com/comment/37529899
upvote count: 2
type: AcceptedAnswer
has body: If you are using Spring, pleeeeease do not write boilerplate JDBC code. Instead, use Spring's JdbcTemplate which automatically works with the current Spring-managed transaction and eliminates all boilerplate JDBC code. You should replace your entire DAO implementation with something like this: public class JdbcUserDAO { private static final String TERM_USER_SQL = "UPDATE USER " + "SET TERM_DATE = date('now') WHERE USER_NAME = ?"; private final JdbcTemplate jdbcTemplate; @Autowired public JdbcUserDAO(DataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); } public void terminateUser(String userName) { jdbcTemplate.update(TERM_USER_SQL, userName); } } Regards, Sam
type: Answer

http://stackoverflow.com/comment/37721818
has text: @notrix Defining state-list in xml is OK (and indeed simpler) when you know the colors at compile time, but here the OP must deal with colors that are defined dynamically (i.e. as I understand "dynamically" : it means not known at compile time)
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24375067

http://stackoverflow.com/comment/37548112
comment on: http://stackoverflow.com/a/24297434
score: 0
type: AnswerComment
has text: What happens if I try to access the result of `.getApplicationContext()` when the activity is closed?
type: Comment

http://stackoverflow.com/comment/37511702
type: QuestionComment
has text: Obviously, sometimes you do not want to *replace* already existing (key,value) pair.
comment on: http://stackoverflow.com/q/24278474
score: 0
type: Comment

http://stackoverflow.com/comment/37737594
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24397055
has text: @user The action of converting a JSON String to a POJO.
type: AnswerComment

http://stackoverflow.com/comment/37534770
has text: Hi have a look at this [tutorial](http://www.mkyong.com/spring/spring-auto-wiring-beans-with-autowired-annotation/).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24290228
score: 1

http://stackoverflow.com/a/24351274
downvote count: 0
has body: Some Points: Don't use null layout at all instead there are lots of Layout Manager that can be used. Read A Visual Guide to Layout Managers Use a container to add all the component in it and add it finally in the root container of JApplet. Use JPanel and override paintComponent() for custom panting that will eliminate the flickering as well. paint method is a heavy operation that does lots of things in the background. Read Difference between paint, paintComponent and paintComponents in Swing Please have a look at Painting in AWT and Swing that describes it in detail. It's worth reading How paint method works? Swing programs should override paintComponent() instead of overriding paint(). Although the API allows it, there is generally no reason to override paintBorder() or paintComponents() (and if you do, make sure you know what you're doing!). This factoring makes it easier for programs to override only the portion of the painting which they need to extend. Sample code: JPanel panel = new JPanel() { public void paintComponent(Graphics g) { super.paintComponent(g); // custom painting code goes here } }
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/24351184

http://stackoverflow.com/comment/37669377
type: Comment
comment on: http://stackoverflow.com/a/24360875
has text: The one that you use in this line of code (ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.activity_main, R.id.label, raid_list);) activity_main.xml --> it is going to define how look each individual row of your listivew
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37513907
type: Comment
comment on: http://stackoverflow.com/a/24279320
type: AnswerComment
has text: I'd refer to the book `Java Concurrency in Practice`. It's the best resource on this topic and it discusses your questions. As for synch/lock, as of JDK6 there is no difference. If you are literary incrementing an integer, you have to be hitting it with ridiculous load in order for basic concurrency facilities becoming an issue. I'd really look elsewhere for performance improvements if I were you. The book also talks about this.
score: 0

http://stackoverflow.com/q/24392132
has answer: http://stackoverflow.com/a/24392377
has answer: http://stackoverflow.com/a/24392325
tagged with: android
has body: I am trying to wait for a background process to finish and then do some stuff accordingly after it finishes. Basically I have a class TwitterActivity and an inner class CheckInternetConnection which extends AsyncTask. I have also a button mSignin and I set the event handling for it. In addition I have also a boolean hasInternet. My aim is when the mSignin button will be pressed I will call CheckInternetConnection. This is supposed to update my boolean value hasInternet. Then accordingly I expect to do some stuffs. But I want exactly to do inside onClick() method. Is there any way how to achieve it? Thanks. public class TwitterActivity extends Activity { private boolean hasInternet = false; private Button mSignin; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_twitter); mSignin = (Button)findViewById(R.id.login_id); mSignin.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v){ new CheckInternetConnection().execute(); if(hasInternet) //do some stuff else //do some other stuff } }); } class CheckInternetConnection extends AsyncTask&lt;Void, Void, Boolean&gt;{ @Override protected void onPostExecute(Boolean result){ if(result) hasInternet = true; else hasInternet = false; } @Override protected Boolean doInBackground(Void... params) { return true; } } }
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24392309
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24392309
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/24392325
linked to: http://stackoverflow.com/q/18898039
duplicate of: http://stackoverflow.com/q/18898039
answer count: 3
has title: How to wait for a background process to finish in android
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/37716524
comment on: http://stackoverflow.com/a/24385609
type: Comment
score: 1
has text: @milind You can have more than one profile active at once. So you could have both `dev` and `javaproject2` active. As I mentioned, I don't know much about overlays so can't advise I'm afraid.
type: AnswerComment

http://stackoverflow.com/comment/37663082
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24357608
has text: Sorry, I looked at the first few numbers and thought they were all prime and yes now that I see it, I do mean even and odd.

http://stackoverflow.com/q/24407434
tagged with: nullpointerexception
has body: With this little project of mine I created a grid with larger slots on the bottom. I wanted to add in the mouse's current coordinates so in the GridPanel constructor I did: addMouseMotionListener(new MouseMotionAdapter(){ ... mouseMoved and mouseDragged methods ... }); However, doing that causes a nullpointer exception to be thrown in my renderGrid() method. The error is thrown on dbg = dbi.getGraphics(); which I had an error with before, dbi = createImage(1000,1000); was returning null. After changing things around a bit, and then returning it back to how it originally was it start to work. I don't know what caused that change. Here is my full code: Main: package tileWorld; import javax.swing.JFrame; public class Main extends JFrame { private GridPanel grid; public Main() { setVisible(true); setResizable(false); setSize(1000, 1000); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); grid = new GridPanel(); add(grid); } public static void main(String[] args) { Main m = new Main(); } } GridPanel: package tileWorld; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Image; import java.awt.Toolkit; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import javax.swing.JPanel; public class GridPanel extends JPanel implements Runnable{ public static final int GRID_WIDTH = 1000, GRID_HEIGHT = 900, PANEL_WIDTH = 1000, PANEL_HEIGHT = 1000; Dimension panelDim = new Dimension(PANEL_WIDTH, PANEL_HEIGHT); private Image dbi; private Graphics dbg; private boolean running = false; private Thread gridThread; private Grid grid; public GridPanel() { grid = new Grid(); setPreferredSize(panelDim); setVisible(true); startGrid(); // ========= USER INPUTS =============== addMouseMotionListener(new MouseMotionAdapter(){ public void mouseMoved(MouseEvent e) { System.out.println("Moving!!"); } public void mouseDragged(MouseEvent e) { System.out.println("Dragging!!"); } }); } private void paintScreen() { Graphics g; try { g = this.…
has answer: http://stackoverflow.com/a/24407638
type: UnansweredQuestion
tagged with: doublebuffered
tagged with: mousemotionlistener
tagged with: java
has comment: http://stackoverflow.com/comment/37756286
type: Question
score: 0
answer count: 1
has title: Java - MouseMotionListener causes double buffering image to return null

http://stackoverflow.com/q/24274469
has body: I am using a bunch of ConcurrentLinkedQueues in my application and the GC overhead is huge. How do I check if the ConcurrentLinkedQueue is the culprit? Is there a standard way in Java to profile these data structures for memory allocation/deallocation?
has comment: http://stackoverflow.com/comment/37504432
has title: How do I check if ConcurrentLinkedQueue leaves garbage (dereferenced instances) for the GC?
type: Question
linked to: http://stackoverflow.com/q/5349062
has answer: http://stackoverflow.com/a/24274534
has answer: http://stackoverflow.com/a/24274626
answer count: 2
tagged with: profiling
downvote count: 0
score: 1
favorite count: 0
tagged with: memory-management
type: UnansweredQuestion
tagged with: memory-leaks
tagged with: garbage-collection
upvote count: 1
tagged with: java

http://stackoverflow.com/comment/37553912
has text: `nodesPerLevel` could never give `NPE` in this code because its type is primitive type.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24278896

http://stackoverflow.com/q/24384557
has answer: http://stackoverflow.com/a/24384671
has comment: http://stackoverflow.com/comment/37712858
tagged with: sqlite
has comment: http://stackoverflow.com/comment/37712995
favorite count: 0
has comment: http://stackoverflow.com/comment/37712978
has comment: http://stackoverflow.com/comment/37713177
has answer: http://stackoverflow.com/a/24384733
tagged with: android
has body: I have been trying to compare with null in if condition but it's not working and always goes in Else. Following is the code, String authEmail = cursor.getString(cursor.getColumnIndexOrThrow("AUTHOR_EMAIL")); Log.i(gtag, "author email =&gt; " + authEmail); if (authEmail == null ) { Log.i(gtag, "in author check - IF NULL"); } else { Log.i(gtag, "in author check - ELSE "); } Here cursor is the result of querying SQLite database and AUTHOR_EMAIL is name of column. Logcat shows author email as null but still it goes in ELSE. Following is the Logcat: 06-24 15:30:55.307: I/GCA-Abs-Con(1282): author email =&gt; foo@bar.de 06-24 15:30:55.307: I/GCA-Abs-Con(1282): in author check - ELSE 06-24 15:30:55.357: I/GCA-Abs-Con(1282): author email =&gt; null 06-24 15:30:55.357: I/GCA-Abs-Con(1282): in author check - ELSE 3rd line of logcat shows authorEmail is null but still it goes in else. I tried authEmail.equals(null) as well, but that didn't work too. How should I modify the if condition to check for null perfectly ? Thanks in advance.
accepted answer: http://stackoverflow.com/a/24384728
has comment: http://stackoverflow.com/comment/37712919
has comment: http://stackoverflow.com/comment/37724071
answer count: 4
downvote count: 6
has answer: http://stackoverflow.com/a/24384594
type: AnsweredQuestion
upvote count: 3
score: -3
has comment: http://stackoverflow.com/comment/37713105
possible better answer: http://stackoverflow.com/a/24384594
type: Question
has comment: http://stackoverflow.com/comment/37712886
tagged with: java
has comment: http://stackoverflow.com/comment/37712897
has answer: http://stackoverflow.com/a/24384728
has title: Compare with null, not working in java

http://stackoverflow.com/a/24397169
has comment: http://stackoverflow.com/comment/37737282
accepted answer of: http://stackoverflow.com/q/24396620
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24396620
upvote count: 2
has body: The Problem lies within the parsing of the String. In YodaTime the representation of negative values is -HH:-MM so your -0:30 means "minus zero hours, plus 30 minutes" which is the same as 00:30. To solve your problem you can do one of two things: Write negative numbers in the expected format, meaning "-HH:-MM", e.g. "-0:-30" Remove the negative sign before parsing and decide yourself if it should be added or removed.
has comment: http://stackoverflow.com/comment/37737336
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37738133
type: Answer

http://stackoverflow.com/a/24296726
answers question: http://stackoverflow.com/q/24295896
has body: Make sure that nothing is modifying your object, and that you correctly are accessing the objects. The following code I used to test (on the json object you provided) and it worked correctly: public static void main (String args[]) throws JSONException{ String jsonString = "{ \"total\": 247, \"passed\": 247, \"failed\": 0, \"standard_count\": [ \"LINK_SHUT_NOSHUT\", \"LC_RELOAD\", \"VDC_RELOAD\", \"LINK_FLAP\", \"SWOVER\" ], \"submissionFlag\": 2, \"headCount\": 6 }"; JSONObject newMgrObj = new JSONObject(jsonString); JSONArray standard_count = newMgrObj.getJSONArray("standard_count"); System.out.println(standard_count.toString()); } Which gave me the output: ["LINK_SHUT_NOSHUT","LC_RELOAD","VDC_RELOAD","LINK_FLAP","SWOVER"]
score: 0
type: Answer

http://stackoverflow.com/q/24354882
tagged with: vocabulary
downvote count: 0
tagged with: syntax
tagged with: java
score: 10
possible better answer: http://stackoverflow.com/a/24355048
type: Question
has answer: http://stackoverflow.com/a/24355087
has body: Well, all is in the title... I understand that both forms refer to the method, but I don't see what # adds to the other form.
accepted answer: http://stackoverflow.com/a/24355087
has title: What is the meaning of "#" in MyType#myMethod() and the difference with "." as in MyType.myMethod()
answer count: 3
upvote count: 10
has comment: http://stackoverflow.com/comment/37657452
has answer: http://stackoverflow.com/a/24355048
favorite count: 0
has answer: http://stackoverflow.com/a/24355079
type: AnsweredQuestion

http://stackoverflow.com/q/24383892
has comment: http://stackoverflow.com/comment/37719204
has body: I am getting StackOverflow exception only when when I call save() or update() otherwise it works fine. My POM file is 4.0.0 SpringBootApp com.sagar Sample 1.0.0-SNAPSHOT org.springframework.boot spring-boot-starter-parent 1.0.2.RELEASE <relativePath/> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> com.sagar.Application <java.version>1.7</java.version> <cglib.version>3.0</cglib.version> <jackson-mapper-asl.version>1.9.12</jackson-mapper-asl.version> <sqlite-jdbc.version>3.7.2</sqlite-jdbc.version> <mysql-connector-java.version>5.1.30</mysql-connector-java.version> org.springframework.boot spring-boot-starter-data-jpa org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-security org.springframework.boot spring-boot-starter-test test org.hibernate hibernate-validator 5.1.0.Final org.xerial sqlite-jdbc ${sqlite-jdbc.version} mysql mysql-connector-java ${mysql-connector-java.version} commons-fileupload commons-fileupload 1.2.2 org.apache.commons commons-io 1.3.2 sample org.springframework.boot spring-boot-maven-plugin Controller Method: @RequestMapping(value = API.HOME, method = RequestMethod.GET) public String home(HttpServletRequest httpRequest, @CurrentUser CustomUserDetails currentUserDetail) { User user = new User(); user.setUserId("user1"); user.setUserName("user1"); user.setPassword("pass1"); user.setEmailId("user1@company.com"); myRepository.getUserService().save(user); return new "Success"; } I have a JPAConfig.java where I set my dataSource, entityManagerFactory, jpaProperties, jpaVendorAdapter and transactionManager beans and SecurityConfig.java with protected void configure(HttpSecurity http) implemented. Thank you
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24487296
tagged with: spring-security
type: AnsweredQuestion
has title: Getting StackOverflow exception on save() and update() in spring boot app?
tagged with: maven
has answer: http://stackoverflow.com/a/24487296
type: Question
tagged with: spring-boot
tagged with: java

http://stackoverflow.com/comment/37665950
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/24359171
type: Comment
has text: @JigarJoshi Looks like OP created its own `Comparable` interface which collides with `java.lang.Comparable`.

http://stackoverflow.com/comment/37669300
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24361058
has text: @PNS-Your answer doesn;t satisfy his purpose!
type: Comment

http://stackoverflow.com/a/24291893
score: 1
has body: Replace this: Process prog2 = rt.exec("java prog2"); With this: Process prog2 = new ProcessBuilder("java", "prog2").inheritIO().start(); ProcessBuilder is the preferred replacement for the Runtime.exec methods.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24291688
has comment: http://stackoverflow.com/comment/37538898
has comment: http://stackoverflow.com/comment/37538364
type: Answer
accepted answer of: http://stackoverflow.com/q/24291688
upvote count: 1

http://stackoverflow.com/q/24316520
has comment: http://stackoverflow.com/comment/37584273
tagged with: java
has comment: http://stackoverflow.com/comment/37613886
has body: Total beginner here.... :( I am using Eclipse with ADT and Google App Engine plug in. I have built my "awesome" android app, but now I want to save some of the data the app produces onto a cloud service so I can share it between my users. So I am trying to do this with google services. I have incorporated in my project both Cloud Storage API and Google Cloud Datastore API, both using the GDT plug in, but that's as far as I can get :(((( I know I am asking a lot, but I don't even know if it is a lot, it might be a few lines of code, at least that's what I think. So now I need a way, through some Google API to connect to a database that "belongs" to me, and store 5 numbers there from each of my users, and share other user's numbers with each other... Can someone take me by the hand and tell me what I need to import and what not...? I have spend hours reading all documentation about these APIs I could find and I ended up going in circles :( either trying commands that cannot be resolved, like DataStoreService(), or simply not even finding where do I put my info to get to "my" database.... Thank you all.
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/37613118
tagged with: google-cloud-datastore
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/37613141
has title: How to use google cloud storage with ADT?
has comment: http://stackoverflow.com/comment/37610590
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37609823

http://stackoverflow.com/comment/52419141
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24343546
has text: idea allows to set working directory which can be explicitly set in its un configurations dialog
type: Comment

http://stackoverflow.com/comment/37682892
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24368340
type: Comment
has text: I just modified the question. I did check for the method and as you can see it changes. But now I realise that it doesn't even get to the point of checking for getMethod(). The error already occurs at .getNextExtry()...

cloudera
tags question: http://stackoverflow.com/q/24352697
tags question: http://stackoverflow.com/q/24280415
type: Tag
tag name: cloudera

http://stackoverflow.com/a/24308284
type: Answer
has comment: http://stackoverflow.com/comment/37598791
score: 0
accepted answer of: http://stackoverflow.com/q/24307259
answers question: http://stackoverflow.com/q/24307259
has body: Instead of using an event handler, which allows the user to input invalid values and then either ignores them or fixes them, consider subclassing TextField to allow only valid input. import java.util.concurrent.Callable; import java.util.regex.Pattern; import javafx.application.Application; import javafx.beans.binding.Bindings; import javafx.beans.property.IntegerProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.scene.Scene; import javafx.scene.control.IndexRange; import javafx.scene.control.TextField; import javafx.scene.layout.VBox; import javafx.stage.Stage; public class RestrictedTextFieldExample extends Application { @Override public void start(Stage primaryStage) { final TextField restrictedTextField = new TextField() { private final Pattern numberPattern = Pattern.compile("\\d{1,3}"); @Override public void replaceText(int start, int end, String text) { if (valid(start, end, text)) { super.replaceText(start, end, text); } } @Override public void replaceSelection(String text) { IndexRange selectionRange = getSelection(); if (valid(selectionRange.getStart(), selectionRange.getEnd(), text)) { super.replaceSelection(text); } } private boolean valid(int start, int end, String text) { String attemptedText = getText().substring(0, start) + text + getText().substring(end); if (attemptedText.length() == 0) { return true ; } if (numberPattern.matcher(attemptedText).matches()) { int value = Integer.parseInt(attemptedText); if (value &gt;= 0 &amp;&amp; value &lt;= 127) { return true ; } } return false ; } }; IntegerProperty value = new SimpleIntegerProperty(); value.bind(Bindings.createIntegerBinding(new Callable&lt;Integer&gt;(){ @Override public Integer call() throws Exception { String text = restrictedTextField.getText(); if (text.isEmpty()) { return 0 ; } else { return Integer.parseInt(text); } } }, restrictedTextField.textProperty())); value.addListener(new …
type: AcceptedAnswer

http://stackoverflow.com/q/24326488
accepted answer: http://stackoverflow.com/a/24328644
tagged with: java
downvote count: 1
type: Question
tagged with: jakarta-ee
has body: I have already implemented the MVC pattern using the Spring framework. In Spring there are @Controller and @RequestMapping annotations in the controller class and this framework doesn't use any HttpServlet. I want this exact structure in Java EE (but without using any other framework). So my question is: how can I use MVC in Java EE without using other frameworks? Note: I don't want to use HttpServlet class
has comment: http://stackoverflow.com/comment/37608957
has comment: http://stackoverflow.com/comment/37603324
has title: How to use MVC in Java EE 6/7 without using other frameworks?
has answer: http://stackoverflow.com/a/24328593
favorite count: 0
has comment: http://stackoverflow.com/comment/37620978
possible better answer: http://stackoverflow.com/a/24326752
has answer: http://stackoverflow.com/a/24328644
answer count: 4
has answer: http://stackoverflow.com/a/24326752
has answer: http://stackoverflow.com/a/24328629
tagged with: model-view-controller
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/37602971
upvote count: 3

mysql
tags question: http://stackoverflow.com/q/24402022
tags question: http://stackoverflow.com/q/24329331
tags question: http://stackoverflow.com/q/24347465
tags question: http://stackoverflow.com/q/24328085
tags question: http://stackoverflow.com/q/24303185
tags question: http://stackoverflow.com/q/24422266
tags question: http://stackoverflow.com/q/24422239
tags question: http://stackoverflow.com/q/24413102
tags question: http://stackoverflow.com/q/24359661
tags question: http://stackoverflow.com/q/24276366
tags question: http://stackoverflow.com/q/24421176
tag name: mysql
tags question: http://stackoverflow.com/q/24279885
tags question: http://stackoverflow.com/q/24276321
tags question: http://stackoverflow.com/q/24375260
tags question: http://stackoverflow.com/q/24392903
tags question: http://stackoverflow.com/q/24282159
tags question: http://stackoverflow.com/q/24274809
tags question: http://stackoverflow.com/q/24351849
tags question: http://stackoverflow.com/q/24413965
tags question: http://stackoverflow.com/q/24371297
tags question: http://stackoverflow.com/q/24330034
tags question: http://stackoverflow.com/q/24361419
tags question: http://stackoverflow.com/q/24292272
tags question: http://stackoverflow.com/q/24353778
tags question: http://stackoverflow.com/q/24285283
tags question: http://stackoverflow.com/q/24278365
tags question: http://stackoverflow.com/q/24379678
tags question: http://stackoverflow.com/q/24337822
tags question: http://stackoverflow.com/q/24305109
tags question: http://stackoverflow.com/q/24354054
tags question: http://stackoverflow.com/q/24365156
tags question: http://stackoverflow.com/q/24379132
tags question: http://stackoverflow.com/q/24304943
tags question: http://stackoverflow.com/q/24416683
tags question: http://stackoverflow.com/q/24377949
tags question: http://stackoverflow.com/q/24283747
tags question: http://stackoverflow.com/q/24314592
tags question: http://stackoverflow.com/q/24417729
tags question: http://stackoverflow.com/q/24347315
tags question: http://stackoverflow.com/q/24321312
tags question: http://stackoverflow.com/q/24379332
tags question: http://stackoverflow.com/q/24413894
tags question: http://stackoverflow.com/q/24321319
tags question: http://stackoverflow.com/q/24386659
tags question: http://stackoverflow.com/q/24316164
tags question: http://stackoverflow.com/q/24319978
tags question: http://stackoverflow.com/q/24341441
tags question: http://stackoverflow.com/q/24422993
tags question: http://stackoverflow.com/q/24269641
tags question: http://stackoverflow.com/q/24393617
tags question: http://stackoverflow.com/q/24389862
tags question: http://stackoverflow.com/q/24337584
tags question: http://stackoverflow.com/q/24344842
tags question: http://stackoverflow.com/q/24289387
tags question: http://stackoverflow.com/q/24297077
tags question: http://stackoverflow.com/q/24329558
tags question: http://stackoverflow.com/q/24288255
tags question: http://stackoverflow.com/q/24390179
tags question: http://stackoverflow.com/q/24297133
tags question: http://stackoverflow.com/q/24317713
tags question: http://stackoverflow.com/q/24328186
tags question: http://stackoverflow.com/q/24363050
tags question: http://stackoverflow.com/q/24292026
tags question: http://stackoverflow.com/q/24334319
type: Tag
tags question: http://stackoverflow.com/q/24361950
tags question: http://stackoverflow.com/q/24296079
tags question: http://stackoverflow.com/q/24328693
tags question: http://stackoverflow.com/q/24383463
tags question: http://stackoverflow.com/q/24303996
tags question: http://stackoverflow.com/q/24321280
tags question: http://stackoverflow.com/q/24277652
tags question: http://stackoverflow.com/q/24298357
tags question: http://stackoverflow.com/q/24276196
tags question: http://stackoverflow.com/q/24384003
tags question: http://stackoverflow.com/q/24397273
tags question: http://stackoverflow.com/q/24364629
tags question: http://stackoverflow.com/q/24378270
tags question: http://stackoverflow.com/q/24283613

http://stackoverflow.com/a/24290311
has body: In a 32-bit two's complement number, the non-negative integers are 0x00000000 - 0x7fffffff and these convert from hex to deciminal in the ordinary way. The lowest (ie most negative) number is represented in the machine as 0x80000000 (ie the highest-order bit and no other bit is set). What this bit being set really means is add the positive integer indicated by the 31 lower-order bits to the number -(0x80000000). Exercise: What is the number -84 in 32-bit two's complement? Since it is negative, we have to set the high-order bit. So we start with -(0x80000000) = -2147483648. Now you can solve algebraically what the other 31 bits need to be: -2147483648 + x = -84 =&gt; x = 2147483648 - 84 =&gt; x = 2147483564 =&gt; x = 0x7fffffac And it should be obvious that if you take 0x80000000 | 0x7fffffac, you get 0xffffffac. It should also be obvious that 0x7fffffac = (0x7f000000 + 0xff0000 + 0xff00 + 0xac) and the expression in parentheses is equivalent to (2130706432 + 16711680 + 65280 + 172). The fact that the lower-order byte is equivalent to decimal 172 is meaningless without considering the other 3 bytes. Your Comparisons Now you mention that your comparisons are "not what you expect them to be". I don't know what you expect them to be since you haven't explained, but my guess is you want a true return value for IP addresses in the range [240.0.0.0 .. 255.255.255.255) non-inclusive of the right-hand side of the range. This means IP addresses in the range [0xf0000000 .. 0xffffffff) non-inclusive. If those are 32-bit two's complement integers, this is the range [-268435456, -1), so any expression of the form (0xf0000000 &lt;= ip_addr &amp;&amp; ip_addr &lt; 0xffffffff) will give you the correct result. Since your function returns a more convoluted version of the above expression, it gives the correct result. By the way, are you familiar with the boolean type? Is there some reason your method needs to return a boxed primitive (ie Boolean)?
downvote count: 0
has comment: http://stackoverflow.com/comment/37539587
has comment: http://stackoverflow.com/comment/37540980
score: 4
has comment: http://stackoverflow.com/comment/37547881
answers question: http://stackoverflow.com/q/24289647
has comment: http://stackoverflow.com/comment/37540855
has comment: http://stackoverflow.com/comment/37539095
type: Answer
upvote count: 4

http://stackoverflow.com/q/24281987
has title: Setting up SEEK for Android with Samsung Galaxy S3
answer count: 1
favorite count: 0
tagged with: galaxy
tagged with: android
upvote count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37638492
has answer: http://stackoverflow.com/a/24379069
accepted answer: http://stackoverflow.com/a/24379069
type: Question
has body: Here's some background 1st: I'm trying to do a proof-of-concept Android application that will check if I can send some APDU commands to a SIM card applet and process the response. I'm using SEEK for Android as a reference implementation of Open Mobile API. The application should work on Samsung Galaxy S3 smartphone which comes with Open Mobile API, as stated here. I am not allowed to use a custom ROM, nor do any modifications to Android source. What I have done so far: I've downloaded Android API lvl 18 with Open Mobile API and Open Mobile API packages. I've created a sample application that should try to access an applet on my SIM card, as described here. On button click, I'm getting SecurityException 06-23 12:57:15.620: I/HelloSmartcard(5386): creating SEService object 06-23 12:57:15.655: I/SEService(5386): Connected 06-23 12:57:22.525: I/HelloSmartcard(5386): Retrieve available readers... 06-23 12:57:22.530: I/HelloSmartcard(5386): Create Session from the UICC reader... 06-23 12:57:23.275: I/HelloSmartcard(5386): Create logical channel within the session... 06-23 12:57:23.285: E/HelloSmartcard(5386): Error occured: 06-23 12:57:23.285: E/HelloSmartcard(5386): java.lang.SecurityException: Access Control Enforcer: access denied: EF_DIR not found!! 06-23 12:57:23.285: E/HelloSmartcard(5386): at org.simalliance.openmobileapi.SEService.checkForException(SEService.java:234) 06-23 12:57:23.285: E/HelloSmartcard(5386): at org.simalliance.openmobileapi.Session.openLogicalChannel(Session.java:302) 06-23 12:57:23.285: E/HelloSmartcard(5386): at com.example.testsmartcardaccess2.MainActivity$1.onClick(MainActivity.java:81) 06-23 12:57:23.285: E/HelloSmartcard(5386): at android.view.View.performClick(View.java:4475) 06-23 12:57:23.285: E/HelloSmartcard(5386): at android.view.View$PerformClick.run(View.java:18786) 06-23 12:57:23.285: E/HelloSmartcard(5386): at android.os.Handler.handleCallback(Handler.java:730) 06-23 12:57:23.285: E/HelloSmartcard(5386): at android.os.Handler.di…
has comment: http://stackoverflow.com/comment/41884290
has comment: http://stackoverflow.com/comment/37675572
score: 4
has comment: http://stackoverflow.com/comment/37526504
tagged with: open-mobile-api

http://stackoverflow.com/a/75364121
has comment: http://stackoverflow.com/comment/138724479
has body: The above solutions did not work for me. The simplest way to add a dropdown list in Swagger is to update the swagger.json file. "parameters": [ { "name": "status", "in": "query", "type": "string", "default": "available", "enum": [ "active", "inactive", "available" ], "required": true } ], Note: I'm using swagger version 2.0
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24398653

http://stackoverflow.com/q/24317470
answer count: 1
tagged with: drop-down-menu
has body: I have a set of list from a Java drop down menu? how do I get the value of the drop down menu once I have selected one item from the list?
score: 0
has answer: http://stackoverflow.com/a/24317504
type: UnansweredQuestion
has title: how to get a value from jdropdown menu?
type: Question
tagged with: java

http://stackoverflow.com/q/24294712
tagged with: java
has comment: http://stackoverflow.com/comment/37542968
type: Question
has comment: http://stackoverflow.com/comment/37543077
has answer: http://stackoverflow.com/a/24295200
has body: Im currently facing the issue where Links Is being returned from a service I am using. As you can see this is NOT valid html. Does anyone know any tools or regular expressions that can help me remove the inner tag to change it to this: Links EDIT: The service does not always return freeformatter.com website. It could return ANY website
has answer: http://stackoverflow.com/a/24294877
downvote count: 0
has answer: http://stackoverflow.com/a/24294930
tagged with: regex
answer count: 4
has comment: http://stackoverflow.com/comment/37542944
favorite count: 0
accepted answer: http://stackoverflow.com/a/24295200
has answer: http://stackoverflow.com/a/24294817
upvote count: 1
has title: How can i parse this using StringUtils or Regular Expression
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24294817
has comment: http://stackoverflow.com/comment/37543091
score: 1

http://stackoverflow.com/comment/37708323
comment on: http://stackoverflow.com/a/24381843
score: 0
type: AnswerComment
type: Comment
has text: I have not used the result of available() to manipulate how data is read anywhere in the above code. Just read it to see their outputs when the error occurred.

cross-platform
tags question: http://stackoverflow.com/q/24290801
tag name: cross-platform
tags question: http://stackoverflow.com/q/24337516
type: Tag

http://stackoverflow.com/q/24341248
has body: I have following task to do. I have char[] text. I want to check if character which was pressed in JTextField is equal to text[0] = 'a'; I need it to compare two characters even if these characters are spaces. I have started like this ... public void keyPressed(KeyEvent e) { int charcode = e.getKeyCode(); } Then I don't know how to get keyCode of character.
linked to: http://stackoverflow.com/q/616924
has answer: http://stackoverflow.com/a/24341420
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24341298
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/24341298
has title: How to return keyCode of Character
tagged with: swing
tagged with: jtextfield
has comment: http://stackoverflow.com/comment/37630456
type: Question
has comment: http://stackoverflow.com/comment/37630538
has comment: http://stackoverflow.com/comment/37630545
accepted answer: http://stackoverflow.com/a/24341420
has comment: http://stackoverflow.com/comment/37630370
answer count: 2
has comment: http://stackoverflow.com/comment/37630305

http://stackoverflow.com/q/24358878
downvote count: 0
has comment: http://stackoverflow.com/comment/37665595
has body: I am using java to connect with oracle.This is the code which I have used public List&lt;FavouriteShop&gt; getmyfavouriteshop(String username) { List&lt;FavouriteShop&gt; res=null; res = this.getJdbcTemplate().query("select * from(Select tbl_orderdetails.branch_name as myfavourite,tbl_orderdetails.branch_id as branch_id from tbl_orderdetails inner join tbl_ordermaster on tbl_orderdetails.order_master_id=tbl_ordermaster.ordermasterid where tbl_ordermaster.user_id='"+username+"' group by tbl_orderdetails.branch_name,tbl_orderdetails.branch_id order by count(tbl_orderdetails.branch_name) desc) where rownum&lt;=3", new MyFavourite()); return res; } private class MyFavourite implements RowMapper&lt;FavouriteShop&gt; { public FavouriteShop mapRow(ResultSet rs,int i) throws SQLException { FavouriteShop g=new FavouriteShop(); g.setBranch_id(rs.getString("branch_id")); g.setMyfavourite(rs.getString("myfavourite")); return g; } } I tried to execute same query in oracle I am getting output but not here and I am getting only empty result.
tagged with: oracle-database
favorite count: 0
has comment: http://stackoverflow.com/comment/37666746
has answer: http://stackoverflow.com/a/24360669
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37666513
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24358981
accepted answer: http://stackoverflow.com/a/24360669
has title: Query returning only empty value in java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/24358981

http://stackoverflow.com/comment/37726639
type: AnswerComment
type: Comment
has text: Age cannot be null, but I am afraid of it coming across as an empty tag <Age/>. Will this take the default value that I have entered (0).
comment on: http://stackoverflow.com/a/24391542
score: 0

http://stackoverflow.com/comment/37673098
comment on: http://stackoverflow.com/q/24363231
score: 0
type: Comment
type: QuestionComment
has text: To add to what Thilo has said above, it would be much easier to pass the input to a string and work with that.

http://stackoverflow.com/q/24280958
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/7598623
answer count: 1
tagged with: primefaces
has body: I'm developing a Java Web Application using Javaprimefaces. Now I have to insert a custom CSS theme. I'm following the tutorial at this URL, but I don't know where to put the .jar file. It says in the classpath, but where is it or how I create it?
type: AnsweredQuestion
tagged with: themes
has title: Where is the java classpath in netbeans?
has answer: http://stackoverflow.com/a/24281116
type: Question
tagged with: css
accepted answer: http://stackoverflow.com/a/24281116
tagged with: jsf

http://stackoverflow.com/q/24282109
score: 0
has body: here is my problem, someone gave me a function, which, if I understand it well, put some sound samples into an arraylist. I'd like to create a .wav file with this audio track, and I really don't know how to do so. Here is the code, because maybe I just don't understand it at all... public class Track { private ArrayList&lt;Sample&gt; sounds; private AudioFormat audioFormat; TargetDataLine targetDataLine; public Track() { this.sounds = new ArrayList &lt;Sample&gt;(); } /*** Sort the sample on the track by ascending start time ***/ public void sortTrack() { Collections.sort(sounds); } /** * Add a sample to the track. * @param fic location to the audio file. * @param sT set the start time in ms of the sound on the track. */ public void addSound(String fic, long sT) { sounds.add(new Sample(fic, sT)); } /** * Delete a sample to the track. * @param fic location to the audio file. * @param sT set the start time in ms of the sound on the track. */ public void deleteSound(String fic, long sT) { int i; for ( i = 0; i &lt; sounds.size() &amp;&amp;( sounds.get(i).getAudioFile().getName() == fic &amp;&amp; sounds.get(i).getStartTime() == sT); ++i) {} if (i &lt; sounds.size()) sounds.remove(i); } Here is sample, imported in the code above. public Sample (String fileLocation, long sT) { try{ audioFile = new File(fileLocation); istream = AudioSystem.getAudioInputStream(audioFile); format = istream.getFormat(); startTime = sT; timeLenght = (audioFile.length() / (format.getFrameSize() * format.getFrameRate() )) * 1000; } catch (UnsupportedAudioFileException e){ e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
answer count: 1
has comment: http://stackoverflow.com/comment/37519437
has title: convert an arraylist with audio into a .wav file (Java)
type: UnansweredQuestion
tagged with: audio
tagged with: java
has answer: http://stackoverflow.com/a/24282824
type: Question
tagged with: wav
tagged with: arraylist

http://stackoverflow.com/q/24347572
answer count: 1
has body: First time posting on here. I've heard many good things about the community. I'm an amateur programmer and have dabbled in C++ and Java so far. Anywhoo, I've been cracking my head open with this BlackJack game in java I've sort of haphazardly put together over the last few days. Basically, I am having an issue with the creating of my deck. I am using an ArrayList to hold the cards, but I cant figure out a way to correctly add a value to each card. As you can see by my code, I am using parseint to get the value from the String and add it to the card sum but the problem is, when values such as "Ace" and "Jack" "King" "Queen" come up, clearly no int can be parsed from there so when the program runs, everything works fine, unless of course one of the previously mentioned cards are pulled. Then I get an error that reads: (""Exception in thread "main" java.lang.NumberFormatException: For input string: "Queen" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:580) at java.lang.Integer.parseInt(Integer.java:615) at blackjack.Blackjack.getHumanValue(Blackjack.java:110) at blackjack.Blackjack.main(Blackjack.java:27) Java Result: 1 BUILD SUCCESSFUL (total time: 0 seconds)"") . I've tried looking it up online to see if I can spark some inspiration but all I can find is to use Enums or Switch to build my deck, but the problem is I don't fully understand those techniques yet. Any advice will be greatly appreciated. Thanks! public class Blackjack{ ArrayList&lt;card&gt; buildDeck = new ArrayList&lt;card&gt;(); public static void main(String[] args) { Blackjack b = new Blackjack(); // Compares both scores. The largest score wins. if(b.getHumanValue() &lt; b.getRobotValue()) { System.out.println("ROBOT WINS!!!"); } else if(b.getRobotValue() &gt; 21 &amp;&amp; b.getHumanValue() &lt;=21 ) { System.out.println("YOU WIN!!!"); } } public ArrayList&lt;card&gt; buildDeck(ArrayList&lt;card&gt; buildDeck) { String [] su…
type: AnsweredQuestion
tagged with: blackjack
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24347626
accepted answer: http://stackoverflow.com/a/24347626
has title: Card Values in BlackJack Java
tagged with: arraylist

game-engine
tags question: http://stackoverflow.com/q/24326235
type: Tag
tag name: game-engine
tags question: http://stackoverflow.com/q/24395369

http://stackoverflow.com/q/24314840
tagged with: jpanel
has answer: http://stackoverflow.com/a/24315476
tagged with: jtable
score: 0
tagged with: cell
answer count: 1
tagged with: imageicon
accepted answer: http://stackoverflow.com/a/24315476
has title: Changing Content of JTable Cells Individually
type: AnsweredQuestion
tagged with: java
type: Question
has body: So Suppose I create a JTable with a specific number of columns and rows. Is it possible to add a JPanel to a specific cell after the JTable is already initialized? The JTable would be empty at first and then I would change a cell at row X and column Y to instead contain a JPanel which would contain an amount of ImageIcons. I don't have any code to put here really, I just need to know what I would have to use to accomplish this and how. Thank you.

http://stackoverflow.com/a/24365034
has comment: http://stackoverflow.com/comment/37686007
accepted answer of: http://stackoverflow.com/q/24364878
has comment: http://stackoverflow.com/comment/37682232
has comment: http://stackoverflow.com/comment/37682409
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24364878
has body: You can do that easily using SpannableString. See this example: String str= "Hello World"; SpannableString spannable= new SpannableString(str); spannable.setSpan(new RelativeSizeSpan(1.5f), 0, 5, 0); //size spannable.setSpan(new ForegroundColorSpan(Color.CYAN), 0, 5, 0);//Color TextView txtview= (TextView) findViewById(R.id.textview); txtview.setText(spannable); Hope this helps.
has comment: http://stackoverflow.com/comment/37677828
type: Answer
has comment: http://stackoverflow.com/comment/37678477
has comment: http://stackoverflow.com/comment/37682325
score: 1
has comment: http://stackoverflow.com/comment/37678533
upvote count: 1
has comment: http://stackoverflow.com/comment/37683032
has comment: http://stackoverflow.com/comment/37682992
has comment: http://stackoverflow.com/comment/37682261

http://stackoverflow.com/q/24387050
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24387124
has comment: http://stackoverflow.com/comment/37717798
type: Question
accepted answer: http://stackoverflow.com/a/24387124
has title: Wrong output from Java Calendar API
has comment: http://stackoverflow.com/comment/37717709
tagged with: java
has answer: http://stackoverflow.com/a/24387276
has body: Calendar.setTimeInMillis and Calendar.getTime works weird. It returns incorrect date results. Java Code public static void main(String[] args) { Calendar cal = Calendar.getInstance(); final int oneDay = 24 * 60 * 60 * 1000; for(int i=0; i &lt; 30; i++) { cal.setTimeInMillis(System.currentTimeMillis() - i * oneDay); System.out.println(cal.getTime()); } } Output Tue Jun 24 17:50:35 IST 2014 Mon Jun 23 17:50:35 IST 2014 Sun Jun 22 17:50:35 IST 2014 Sat Jun 21 17:50:35 IST 2014 Fri Jun 20 17:50:35 IST 2014 Thu Jun 19 17:50:35 IST 2014 Wed Jun 18 17:50:35 IST 2014 Tue Jun 17 17:50:35 IST 2014 Mon Jun 16 17:50:35 IST 2014 Sun Jun 15 17:50:35 IST 2014 Sat Jun 14 17:50:35 IST 2014 Fri Jun 13 17:50:35 IST 2014 Thu Jun 12 17:50:35 IST 2014 Wed Jun 11 17:50:35 IST 2014 Tue Jun 10 17:50:35 IST 2014 Mon Jun 09 17:50:35 IST 2014 Sun Jun 08 17:50:35 IST 2014 Sat Jun 07 17:50:35 IST 2014 Fri Jun 06 17:50:35 IST 2014 Thu Jun 05 17:50:35 IST 2014 Wed Jun 04 17:50:35 IST 2014 Tue Jun 03 17:50:35 IST 2014 Mon Jun 02 17:50:35 IST 2014 Sun Jun 01 17:50:35 IST 2014 Sat May 31 17:50:35 IST 2014 Sat Jul 19 10:53:23 IST 2014 Fri Jul 18 10:53:23 IST 2014 Thu Jul 17 10:53:23 IST 2014 Wed Jul 16 10:53:23 IST 2014 Tue Jul 15 10:53:23 IST 2014 After "May 31" , It would be "May 30 , May 29 , May 28 &amp; May 27" but it returns incorrect date. Sat May 31 17:50:35 IST 2014 Sat Jul 19 10:53:23 IST 2014 Fri Jul 18 10:53:23 IST 2014 Thu Jul 17 10:53:23 IST 2014 Wed Jul 16 10:53:23 IST 2014 Tue Jul 15 10:53:23 IST 2014 Is this bug in Calendar.getTime()?
has comment: http://stackoverflow.com/comment/37722691
answer count: 3
upvote count: 1
tagged with: calendar
possible better answer: http://stackoverflow.com/a/24387232
has answer: http://stackoverflow.com/a/24387232

http://stackoverflow.com/comment/37594277
has text: how should change my parent pom. are u saying I should create profile just like I mentioned in the question????
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24322062

http://stackoverflow.com/comment/37662842
score: 3
has text: Alternatively run it under debugger and see for yourself.
comment on: http://stackoverflow.com/q/24357631
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37731237
has text: i changed this and took out the call to "sendError" that was mentioned above and i am getting a null pointer now. i have posted part of the stack trace above
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24393980

http://stackoverflow.com/q/24267448
tagged with: arrays
tagged with: string
accepted answer: http://stackoverflow.com/a/24267559
has answer: http://stackoverflow.com/a/24268126
score: 0
has title: Splitting a string into a string array at a character before a specified interval
answer count: 4
has answer: http://stackoverflow.com/a/24267537
possible better answer: http://stackoverflow.com/a/24267537
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24267559
has body: I'm looking to split a string into a String array over an interval, but I don't want the words to be cut in half. For Example: Say the Text is: Lorem Ipsum Sub Rosa Dolores Clairborne. The quick brown fox zipped quickly to the tall yellow fence and hopped to the other side. Interval: 50 Would be split into the following separated[0]: "Lorem Ipsum Sub Rosa Dolores Clairborne. The quick brown" separated[1]: "fox zipped quickly to the tall yellow fence and" separated[2]: "hopped to the other side." I've been trying to figure this out, the best I've come up with is: private static String[] splitMessage(String text, int interval) { char[] splitText = text.toCharArray(); String[] message = new String[(int) Math.ceil(((text.length() / (double)interval)))]; int indexOfSpace = 0, previousIndex = 0, messageCursor = 0, pos = 0; for (int i = 0; i &lt; splitText.length-1; i++) { if (splitText[i] == ' ') { indexOfSpace = i; } if (pos == interval) { message[messageCursor] = text.substring(previousIndex, indexOfSpace); previousIndex = indexOfSpace; messageCursor++; } pos++; } return message; } This ends up only splitting Lorem into the first index. Any suggestions?
tagged with: java
type: Question
tagged with: split
has answer: http://stackoverflow.com/a/24268114

http://stackoverflow.com/comment/37572434
has text: Please help me..! TTF Font file is avaiable here: http://ambizioso.altervista.org/files/FF_EAN13.zip
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24282209
score: 0

http://stackoverflow.com/comment/91069461
has text: It explains almost everything... except: why should this exclude sequentially based reduction. In my case it is IMPOSSIBLE to do it in parallel as my reduction reduces a list of functions into a U by calling each function on the intermediate result of its predecessors result. This cannot be done in parallel at all and there is no way to describe a combiner. What method can I use to accomplish this?
score: 3
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24316429

http://stackoverflow.com/comment/37666870
comment on: http://stackoverflow.com/a/24359587
score: 0
type: AnswerComment
has text: It's not answering the question. It removes a specified word, but not "one frequency of duplicate word", and definitely not duplicate.
type: Comment

http://stackoverflow.com/q/24326368
has title: Failed to start EJB3 on JBoss AS 7
answer count: 1
tagged with: jboss7.x
accepted answer: http://stackoverflow.com/a/24328314
has comment: http://stackoverflow.com/comment/37602291
has comment: http://stackoverflow.com/comment/37602798
tagged with: ejb-3.0
has comment: http://stackoverflow.com/comment/37604393
has answer: http://stackoverflow.com/a/24328314
has comment: http://stackoverflow.com/comment/37605768
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37603265
has comment: http://stackoverflow.com/comment/37605935
type: Question
has comment: http://stackoverflow.com/comment/37602461
has comment: http://stackoverflow.com/comment/37603662
has comment: http://stackoverflow.com/comment/37604160
tagged with: jboss
has body: I have been trying to get these beans to deploy properly to JBoss AS 7 and continually getting errors. The last problem was the actual data source was not being bound and thanks to some help from some of you I was able to make the right changes and get it bind. However, the beans are still not starting. The log shows that it tries to start every bean but then gives this error: 09:31:51,832 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015871: Deploy of deployment "dodsr.ear" was rolled back with no failure message Which tells me nothing. I've looked up the error and have found no answer. I see this as it tries to start it: 09:31:48,792 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015876: Starting deployment of "dodsr.ear" and this: 09:31:48,909 INFO [org.jboss.as.server.deployment] (MSC service thread 1-16) JBAS015876: Starting deployment of "dodsr.jar" But, immediately following the last one I see this: 09:31:48,910 INFO [org.jboss.as.pojo] (MSC service thread 1-3) JBAS017000: Found legacy bean/pojo namespace: urn:jboss:bean-deployer:2.0 - might be missing some xml features (potential exceptions). 09:31:48,908 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-15) MSC00001: Failed to start service jboss.deployment.unit."ejb3-container-jboss-beans.xml".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."ejb3-container-jboss-beans.xml".PARSE: Failed to process phase PARSE of deployment "ejb3-container-jboss-beans.xml" Does this error have anything to do with my problem? This is only one example of the problems I've found: 09:31:49,196 INFO [org.jboss.as.jpa] (MSC service thread 1-12) JBAS011401: Read persistence.xml for DoDSRMGR 09:31:49,214 WARN [org.jboss.modules] (MSC service thread 1-9) Failed to define class org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory in Module "deployment.jboss-local-jdbc.rar:main" from Service Module Loader: java.lang.LinkageError: Failed to link org…
score: 0

http://stackoverflow.com/a/24378720
has body: If you are just going to a fixed 30 days in a month 365 days in a year with no leap year then you can iterate to the number of days in a for-loop and check the modulo of each one from the the user's inputted. sample: for(int i = 1; i &lt; noOfDays+1; i++) { if((i %30) == 0) month++; if((i%7) == 0) week++; if((i%365) == 0) ++year; if((i%1) == 0) days++; } System.out.println("Year: " + year); System.out.println("Month: " + month); System.out.println("Week: " + week); System.out.println("Days: " + days); result: Enter Number of Days: 330 Year: 0 Month: 11 Week: 47 Days: 330
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/37705053
score: 1
has comment: http://stackoverflow.com/comment/37702198
answers question: http://stackoverflow.com/q/24378658
downvote count: 0
has comment: http://stackoverflow.com/comment/37704015
has comment: http://stackoverflow.com/comment/37704992

http://stackoverflow.com/comment/37727048
comment on: http://stackoverflow.com/a/24378684
type: Comment
score: 0
type: AnswerComment
has text: @holger so I got it but can you explain what happen to i inside the function so at the end we end up with i as our return value?

http://stackoverflow.com/q/24415677
has comment: http://stackoverflow.com/comment/37772155
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24417179
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37771843
type: Question
tagged with: maven-shade-plugin
has answer: http://stackoverflow.com/a/30024687
has answer: http://stackoverflow.com/a/28859788
answer count: 3
has comment: http://stackoverflow.com/comment/37772041
has comment: http://stackoverflow.com/comment/37772082
has comment: http://stackoverflow.com/comment/37772621
has title: Unable to shade jar with maven (INVOKESPECIAL/STATIC)
favorite count: 0
possible better answer: http://stackoverflow.com/a/28859788
tagged with: netbeans
score: 6
tagged with: maven
upvote count: 7
accepted answer: http://stackoverflow.com/a/30024687
downvote count: 1
has body: The full error message: Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.3:shade (default) on project --: Error creating shaded jar: INVOKESPECIAL/STATIC on interfaces require ASM 5 -> [Help 1] The jarfile which I am attempting to shade is located in my own remote repository, using sonatype nexus. Here is my pom configuration: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.codelanx phanaticprison 1.0.0 PhanaticPrison jar bukkit-repo http://repo.bukkit.org/content/repositories/public/ codelanx-repo http://repo.codelanx.com/content/repositories/public/ Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode repo org.apache.maven.plugins maven-shade-plugin 2.3 com.codelanx:codelanxlib true package shade . ${basedir}/src/main/resources true ${project.name} org.bukkit bukkit LATEST jar com.codelanx codelanxlib LATEST jar <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> Googling around for the error lead to very few results, the main parts of information that I gathered was that Java 8's static interface methods could cause this, however I haven't been able to find much more. The jarfile I am attempting to shade does indeed have one of these static methods, but even still surely I must be able to use them and shade the jar? I'm not sure what the error means by requiring "ASM 5" (assembly?), so any direction would be appreciated. My effective pom (mvn help:effective-pom): 4.0.0 com.phanaticmc phanaticprison 1.0.0 PhanaticPrison Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode repo <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> org.bukkit bukkit LATEST …

http://stackoverflow.com/a/24301306
upvote count: 0
type: Answer
has body: Just throw any exception there. Initialization will be aborted.
has comment: http://stackoverflow.com/comment/37556600
score: -3
downvote count: 3
answers question: http://stackoverflow.com/q/24301231
has comment: http://stackoverflow.com/comment/37563063

http://stackoverflow.com/q/24372932
has comment: http://stackoverflow.com/comment/37709232
possible better answer: http://stackoverflow.com/a/24372984
tagged with: android
has comment: http://stackoverflow.com/comment/37707091
has answer: http://stackoverflow.com/a/24372984
has body: I use the Apache Commons API to append a new line to a file using the FTPClient class. When I run the following code in Java, a new line is appended to the file on the FTP server. However, when I run the same code in Android, the String is appended to the file without a new line. Why is the new line using - System.getProperty("line.separator") - not transferred via FTP under Android? Also, the new line is correctly displayed in the LogCat but does not work in the txt file on the FTP server. Maybe there is a difference in character encoding between Java and Android? Thank you very much. String log = System.getProperty("line.separator") + "blablabla"; boolean done = ftpClient.appendFile("log.txt", new ByteArrayInputStream(log.getBytes("UTF-8"))); System.out.println("LOG: " + log);
has answer: http://stackoverflow.com/a/24373055
tagged with: ftp
score: 0
tagged with: java
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37708696
has comment: http://stackoverflow.com/comment/37691555
has title: Apache Commons Net - System.getProperty("line.separator") - does not work in Android
has comment: http://stackoverflow.com/comment/37707341
accepted answer: http://stackoverflow.com/a/24373055
answer count: 2
tagged with: apache-commons-net
has comment: http://stackoverflow.com/comment/37707103

http://stackoverflow.com/comment/37634246
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24341460
score: 0
has text: is your Team#id auto_increment in db? is it `<composite-id name="id" class="edu.wzy.model.TeamId">` or `<composite-id name="id" class="edu.wzy.model.Team">`?

http://stackoverflow.com/comment/37632866
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24342333
type: Comment
has text: how to start this giving me some idea to do it

http://stackoverflow.com/q/24298925
favorite count: 0
has comment: http://stackoverflow.com/comment/37551440
downvote count: 0
has answer: http://stackoverflow.com/a/24390560
tagged with: selenium
possible better answer: http://stackoverflow.com/a/24418043
has answer: http://stackoverflow.com/a/24428494
type: Question
type: AnsweredQuestion
score: 21
has title: How to checkif there are pending requests (Ajax and its variants) from browser
tagged with: java
has comment: http://stackoverflow.com/comment/37556295
has body: Some of the sites I deal with have heavy ajax requests. I plan to wait for Ajax request completion before clicking for asserting for element. Currently I use try { if (driver instanceof JavascriptExecutor) { JavascriptExecutor jsDriver = (JavascriptExecutor)driver; for (int i = 0; i&lt; timeoutInSeconds; i++) { Object numberOfAjaxConnections = jsDriver.executeScript("return jQuery.active"); // return should be a number if (numberOfAjaxConnections instanceof Long) { Long n = (Long)numberOfAjaxConnections; System.out.println("Number of active jquery ajax calls: " + n); if (n.longValue() == 0L) break; } Thread.sleep(1000); } } else { System.out.println("Web driver: " + driver + " cannot execute javascript"); } } catch (InterruptedException e) { System.out.println(e); } But it works well for Ajax requests but not for any similar requests with variants of jQuery libraries. Note: document.readyState == 'complete' It doesn't work for Ajax requests or any other similar alternatives. Neither tests are written by me or belong to single webapp. So I can't edit the webapp.
has comment: http://stackoverflow.com/comment/37555864
has comment: http://stackoverflow.com/comment/37556421
has comment: http://stackoverflow.com/comment/37556023
has comment: http://stackoverflow.com/comment/37555808
has answer: http://stackoverflow.com/a/24302050
tagged with: webdriver
has comment: http://stackoverflow.com/comment/37556743
upvote count: 21
has answer: http://stackoverflow.com/a/24418043
has comment: http://stackoverflow.com/comment/37677431
tagged with: jquery
tagged with: ajax
has comment: http://stackoverflow.com/comment/37550792
linked to: http://stackoverflow.com/q/3148225
linked to: http://stackoverflow.com/q/3262473
accepted answer: http://stackoverflow.com/a/24428494
linked to: http://stackoverflow.com/q/9267451
answer count: 4

http://stackoverflow.com/q/24357981
has title: Android application with only one Activity
tagged with: android-view
has body: Is it bad programming if I use only one Activity for a game like pong? I have different classes to do different tasks and handle touches etc. but I only have one main Activity which changes what is drawn on screen based on user input. I currently only have three views. Should I use different Activities for all these views or is one MainActivity fine to handle all of them?
tagged with: main-activity
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24358023
possible better answer: http://stackoverflow.com/a/24358023
tagged with: android
accepted answer: http://stackoverflow.com/a/24358032
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24358032

enumset
tags question: http://stackoverflow.com/q/24370792
tag name: enumset
type: Tag

http://stackoverflow.com/comment/37564055
type: Comment
score: 1
has text: Check this to handle alerts/popups http://stackoverflow.com/questions/17066382/alert-handling-java-webdriver
comment on: http://stackoverflow.com/q/24304752
type: QuestionComment

http://stackoverflow.com/comment/37667597
comment on: http://stackoverflow.com/q/24360100
score: 0
has text: @LuiggiMendoza No, I downloaded the javax.xml.namespace from internet, does that mean I need to find another JAR file for these classes ?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24373932
type: UnansweredQuestion
has title: Disable a line of code in Android app if signature is verified?
has comment: http://stackoverflow.com/comment/37693586
type: Question
has comment: http://stackoverflow.com/comment/37717782
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/37693529
has comment: http://stackoverflow.com/comment/37695238
tagged with: java
has comment: http://stackoverflow.com/comment/37693706
has comment: http://stackoverflow.com/comment/37695659
answer count: 0
has body: I'm trying to disable ads in my app if I detect that another one of my (paid) apps are installed. Here's my code: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); PackageManager manager = getPackageManager(); if (manager.checkSignatures("com.example.appone", "com.example.apptwo") == PackageManager.SIGNATURE_MATCH == false) { AdView adView = (AdView)this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); } else { } // code continues here } However, the ads are always on. I can't get them to turn off - ever. Did I call PackageManager incorrectly? Or am I just way off base with this idea?

http://stackoverflow.com/comment/37716428
score: 0
type: Comment
has text: What if have two profiles, i.e. one for environment e.g. dev or prod and another for above example i.e. javaproject1 or javaproject2. How can I handle this? Can I use overlays in profile?
comment on: http://stackoverflow.com/a/24385609
type: AnswerComment

http://stackoverflow.com/comment/37727862
comment on: http://stackoverflow.com/q/24392123
score: 0
has text: What's your use case exactly? Do you really expect to instantiate more than 2147483647 objects? Also you should read about concurrency because the code above is __not__ thread safe.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37740702
type: Comment
has text: Please describe the problem in more detail. What does "only retrieving the last iteration for the appointed number of times" mean?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24398983

http://stackoverflow.com/a/24307331
answers question: http://stackoverflow.com/q/24307160
has body: tomcat has a jsp compiler, which is wrapped up quite nicely in an ant task that you can just call: https://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/jasper/JspC.html
score: 0
type: Answer

http://stackoverflow.com/q/24418244
has comment: http://stackoverflow.com/comment/37777074
tagged with: wsdl2java
type: Question
tagged with: java
tagged with: apache-axis
has body: I have this on my request soapenv: &lt;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"&gt; I want to remove xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Can I do that from my Service_BindingStub? Maybe can set org.apache.axis.client.Call object with some property... I don't know.
has answer: http://stackoverflow.com/a/42011293
has comment: http://stackoverflow.com/comment/37777529
has comment: http://stackoverflow.com/comment/37777003
answer count: 1
has comment: http://stackoverflow.com/comment/37777278
score: 0
type: UnansweredQuestion
has title: How to remove namespace xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

http://stackoverflow.com/q/24422298
has comment: http://stackoverflow.com/comment/37784118
has answer: http://stackoverflow.com/a/24422733
has comment: http://stackoverflow.com/comment/37784131
linked to: http://stackoverflow.com/q/40480
has body: I have the following code: public class Book { private static int sample1(int i) { return i++; } private static int sample2(int j) { return ++j; } public static void main(String[] arguments){ int i = 0; int j = 0; System.out.println(sample1(i++)); //0 System.out.println(sample1(++i)); //1 System.out.println(sample2(j++));//1 System.out.println(sample2(++j));//2 System.out.println(i);//2 System.out.println(j);//2 } } My expected output is in comments. The actual output is below: 0 2 1 3 2 2 I'm getting confused with the function calls and incemental operator. Can someone kindly explain the actual result?
has answer: http://stackoverflow.com/a/24422590
has answer: http://stackoverflow.com/a/24422421
has title: Java Incremental operator query (++i and i++)
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37784146
tagged with: java
duplicate of: http://stackoverflow.com/q/795160
score: 12
type: Question
linked to: http://stackoverflow.com/q/795160
downvote count: 8
has answer: http://stackoverflow.com/a/24422817
possible better answer: http://stackoverflow.com/a/24422360
accepted answer: http://stackoverflow.com/a/24422817
has comment: http://stackoverflow.com/comment/37784239
has comment: http://stackoverflow.com/comment/37784143
has answer: http://stackoverflow.com/a/24422360
has answer: http://stackoverflow.com/a/24422427
has comment: http://stackoverflow.com/comment/37784145
tagged with: increment
answer count: 7
has comment: http://stackoverflow.com/comment/37784344
favorite count: 0
has answer: http://stackoverflow.com/a/24422392
duplicate of: http://stackoverflow.com/q/40480
upvote count: 20

http://stackoverflow.com/comment/37563208
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24305486
has text: I have already tried this solution but it is giving me the same result.

http://stackoverflow.com/comment/37721387
type: QuestionComment
has text: Thank you. Why do I have downvotes on this question? Are people who are new to programming simply downvoted and discouraged like this to ask any further questions on stackoverflow? I clearly mentioned what my question is along with the code of what I have done so far.
score: 1
comment on: http://stackoverflow.com/q/24388681
type: Comment

http://stackoverflow.com/q/24342005
score: 5
tagged with: intellij-idea
answer count: 1
downvote count: 0
has title: Creation of Gradle based web application in Intellij IDEA
has comment: http://stackoverflow.com/comment/37634004
has comment: http://stackoverflow.com/comment/83272779
favorite count: 0
has body: I'm trying to create a gradle based java project in Intellij IDEA. Steps are below: Opening Intellij IDEA, Community edition > New project... > Gradle > selecting Auto import, create directories for empty content roots and use default gradle wrapper. Now project has been created and added Webapp(inside WEB-INF created) folder to java directory. I need to know the following: What do I need to add in build.gradle? How and where to configure server tomcat? How to run the build.gradle? Please help me finish this.
has comment: http://stackoverflow.com/comment/37632165
has answer: http://stackoverflow.com/a/56644756
type: UnansweredQuestion
type: Question
upvote count: 5
tagged with: java
tagged with: gradle

http://stackoverflow.com/comment/37787104
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24417974
type: Comment
has text: I understand. Well, if the transaction was marked as rollbacked you can't use it any more, the only solution is to start a new one. Because transactions are bound to threads you must let it rollback, exit the transaction boundary and retry from the the nearest outer point of where the transaction boundary starts (usually the @Transactional service). I usually do this with AOP, where I simply retry if the transaction has failed but it's recoverable (e.g. optimistic locking, deadlocks). It's mandatory to investigate what makes your transaction being roll backed.

http://stackoverflow.com/comment/37756360
has text: When the entities contains List, that approach doesn't work. The new lists will never be updated in the dest object, like explained here: http://stackoverflow.com/questions/19312055/beanutils-copyproperties-to-copy-arraylist
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24383527
type: Comment

http://stackoverflow.com/a/24402238
downvote count: 0
score: 1
type: Answer
upvote count: 1
has body: Although the solution posted by Alex is fine, I'd like to provide an alternative that uses Future. It can be used when you want to run any (alien) Runnable, because it does not have to 'know' about the runningBackgroundTask flag: private final ExecutorService executor = Executors.newSingleThreadExecutor(); private Future&lt;?&gt; result; private void runInBackground(Runnable task) { if (result != null &amp;&amp; !result.isDone()) { // This task will be ignored because the thread pool is busy return; } result = executor.submit(task); } (Note that result is not synchronized, so this only works if runInBackground is always called by the same thread, which is true in your case as it is called by the button's event handler.)
answers question: http://stackoverflow.com/q/24397588

http://stackoverflow.com/q/24300400
score: 1
tagged with: httpurlconnection
accepted answer: http://stackoverflow.com/a/24300576
has body: Hi I've started using HttpUrlConnection and I have a question regarding on when the Http Request is actually sent. I read somewhere that the actual request is sent when getInputStream() is called. However, I've written some test code to play around with this for a POST request: In this version I'm calling on getResponseCode() before getInputStream() URL obj = new URL(myUrl); HttpURLConnection httpclient = (HttpURLConnection) obj.openConnection(); httpclient.setRequestMethod("POST"); **int responseCode = httpclient.getResponseCode();** try { inStream = httpclient.getInputStream(); } catch (IOException ie) { inStream = httpclient.getErrorStream(); } System.out.println("response code = " + responseCode); I receive a response code of 200. So this got me thinking that the request is not being sent at getInputStream(), but at an earlier method. Does anyone have any insight on this? Thanks!
answer count: 2
upvote count: 1
has title: Java - HttpUrlConnection
tagged with: java
has answer: http://stackoverflow.com/a/24300576
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/24300554
favorite count: 0
has answer: http://stackoverflow.com/a/24300554
type: Question

http://stackoverflow.com/a/24309573
type: Answer
answers question: http://stackoverflow.com/q/24308936
score: 0
has body: Since by default, the values of ENUMS in Java are ordinal, you can set them with an array like manner. The only change would be to convert this enum back to an integer value. The change I made to your enum class was to add a function to do so: public enum CicloEnum { CL("Ciclo Largo"), CC("Ciclo Corto"), CI("Ciclo Intermedio"); private String descripcion; private CicloEnum(String descripcion) { this.setDescripcion(descripcion); } public String getDescripcion() { return descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } public int toIntForDatabase() { switch (this) { case CL: return 0; case CC: return 1; case CI: return 2; } return -1; } } Then, you can set the enum by calling MyEnum.values()[x] where MyEnum is the name of your enum, and x is the value of the integer that it would represent. For example, CL is 0, CC is 1, CI is 2. An example test that I wrote is: public static void main(String[] args) throws Exception { int i = 1; CicloEnum ce = CicloEnum.values()[i]; System.out.println(ce.getDescripcion()); System.out.println(ce.toIntForDatabase()); } This sets an enum based on an integer "i" (the value from your database), and then converts it back to an integer for the database using the toIntForDatabase() function.

http://stackoverflow.com/comment/37540648
comment on: http://stackoverflow.com/a/24291766
has text: Not needed. new FileOutputStream will create the file.
type: AnswerComment
score: 0
type: Comment

javascript
tags question: http://stackoverflow.com/q/24372295
tags question: http://stackoverflow.com/q/24319420
tags question: http://stackoverflow.com/q/24401165
tags question: http://stackoverflow.com/q/24288145
tags question: http://stackoverflow.com/q/24376279
tags question: http://stackoverflow.com/q/24295887
tags question: http://stackoverflow.com/q/24332247
tags question: http://stackoverflow.com/q/24403672
tags question: http://stackoverflow.com/q/24280970
tags question: http://stackoverflow.com/q/24280423
tags question: http://stackoverflow.com/q/24330199
tags question: http://stackoverflow.com/q/24331559
tags question: http://stackoverflow.com/q/24333922
tags question: http://stackoverflow.com/q/24414461
tag name: javascript
tags question: http://stackoverflow.com/q/24293617
tags question: http://stackoverflow.com/q/24425639
tags question: http://stackoverflow.com/q/24361066
tags question: http://stackoverflow.com/q/24298933
tags question: http://stackoverflow.com/q/24361283
tags question: http://stackoverflow.com/q/24390840
tags question: http://stackoverflow.com/q/24326885
tags question: http://stackoverflow.com/q/24313658
tags question: http://stackoverflow.com/q/24421333
tags question: http://stackoverflow.com/q/24408537
tags question: http://stackoverflow.com/q/24303100
tags question: http://stackoverflow.com/q/24285205
tags question: http://stackoverflow.com/q/24283127
tags question: http://stackoverflow.com/q/24361342
tags question: http://stackoverflow.com/q/24306605
tags question: http://stackoverflow.com/q/24404583
type: Tag
tags question: http://stackoverflow.com/q/24303544
tags question: http://stackoverflow.com/q/24346722
tags question: http://stackoverflow.com/q/24410012
tags question: http://stackoverflow.com/q/24303141
tags question: http://stackoverflow.com/q/24318390
tags question: http://stackoverflow.com/q/24386273
tags question: http://stackoverflow.com/q/24386678
tags question: http://stackoverflow.com/q/24349281
tags question: http://stackoverflow.com/q/24405768
tags question: http://stackoverflow.com/q/24298640
tags question: http://stackoverflow.com/q/24320886
tags question: http://stackoverflow.com/q/24426288
tags question: http://stackoverflow.com/q/24408942
tags question: http://stackoverflow.com/q/24313456
tags question: http://stackoverflow.com/q/24403634
tags question: http://stackoverflow.com/q/24418782
tags question: http://stackoverflow.com/q/24267744
tags question: http://stackoverflow.com/q/24304467
tags question: http://stackoverflow.com/q/24285168
tags question: http://stackoverflow.com/q/24328915
tags question: http://stackoverflow.com/q/24397105
tags question: http://stackoverflow.com/q/24420600
tags question: http://stackoverflow.com/q/24339922
tags question: http://stackoverflow.com/q/24346774
tags question: http://stackoverflow.com/q/24328505
tags question: http://stackoverflow.com/q/24323715
tags question: http://stackoverflow.com/q/24329777
tags question: http://stackoverflow.com/q/24314910
tags question: http://stackoverflow.com/q/24295895
tags question: http://stackoverflow.com/q/24384489
tags question: http://stackoverflow.com/q/24425723
tags question: http://stackoverflow.com/q/24300746
tags question: http://stackoverflow.com/q/24359036
tags question: http://stackoverflow.com/q/24319526
tags question: http://stackoverflow.com/q/24348648

http://stackoverflow.com/q/24394765
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37732732
has answer: http://stackoverflow.com/a/24394975
has comment: http://stackoverflow.com/comment/37732770
tagged with: linked-list
downvote count: 2
has comment: http://stackoverflow.com/comment/37732619
type: AnsweredQuestion
tagged with: object
has comment: http://stackoverflow.com/comment/37732936
score: -2
tagged with: java
has body: Currently, I'm learning how to program in Java, and I'm currently attempting to implement a basic Linked List to further my understanding of how the language differs from C++ that I learned in school. Right now, I'm trying to understand why the word "Object" here is used and what it means. private class ListNode { private Object data; private ListNode next; } I understand that next is of the type ListNode, which I declared, but I'm not sure what the Object type is. Is it found in a library of Java, or is it a default type? I've been researching this and all I've found are pages about primitive data types and such.
accepted answer: http://stackoverflow.com/a/24394975
has title: What does Object mean in this context and why is it defined as such?
type: Question
has comment: http://stackoverflow.com/comment/37732800
has comment: http://stackoverflow.com/comment/37732783

http://stackoverflow.com/a/24480630
has comment: http://stackoverflow.com/comment/37909132
accepted answer of: http://stackoverflow.com/q/24310018
upvote count: 9
score: 9
answers question: http://stackoverflow.com/q/24310018
type: AcceptedAnswer
downvote count: 0
has body: The Guice Injections documentation describes how to invoke an instance method by annotating the method with @Inject. It doesn't mention that the instance can be a Guice module. As such, you can do this: class MyConfigurationModule extends AbstractModule { @Override protected void configure() { requestInjection(this); } @Inject void configureDbi(DBI dbi) { // Do whatever configuration. } }
type: Answer

stroke
tags question: http://stackoverflow.com/q/24415891
tag name: stroke
type: Tag

http://stackoverflow.com/comment/37619803
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24335387
type: AnswerComment
has text: It's best to make the class final and the constructor private, so that no one can create a subclass which allows additional objects of type Singleton to be created.

multithreading
tags question: http://stackoverflow.com/q/24340958
tags question: http://stackoverflow.com/q/24405571
tags question: http://stackoverflow.com/q/24359034
tags question: http://stackoverflow.com/q/24424957
tags question: http://stackoverflow.com/q/24295599
tags question: http://stackoverflow.com/q/24317872
tags question: http://stackoverflow.com/q/24375673
tags question: http://stackoverflow.com/q/24361779
tags question: http://stackoverflow.com/q/24267635
tags question: http://stackoverflow.com/q/24339452
tags question: http://stackoverflow.com/q/24391649
tags question: http://stackoverflow.com/q/24421358
tags question: http://stackoverflow.com/q/24339016
tags question: http://stackoverflow.com/q/24409387
tags question: http://stackoverflow.com/q/24295903
tags question: http://stackoverflow.com/q/24384647
type: Tag
tags question: http://stackoverflow.com/q/24356585
tags question: http://stackoverflow.com/q/24367887
tags question: http://stackoverflow.com/q/24286777
tags question: http://stackoverflow.com/q/24333878
tags question: http://stackoverflow.com/q/24312567
tags question: http://stackoverflow.com/q/24319235
tags question: http://stackoverflow.com/q/24338974
tags question: http://stackoverflow.com/q/24290657
tags question: http://stackoverflow.com/q/24278842
tags question: http://stackoverflow.com/q/24285682
tags question: http://stackoverflow.com/q/24370792
tags question: http://stackoverflow.com/q/24304412
tags question: http://stackoverflow.com/q/24373511
tags question: http://stackoverflow.com/q/24297196
tags question: http://stackoverflow.com/q/24358989
tags question: http://stackoverflow.com/q/24300017
tags question: http://stackoverflow.com/q/24423081
tags question: http://stackoverflow.com/q/24367313
tags question: http://stackoverflow.com/q/24418805
tags question: http://stackoverflow.com/q/24402674
tags question: http://stackoverflow.com/q/24308241
tags question: http://stackoverflow.com/q/24396969
tags question: http://stackoverflow.com/q/24362798
tags question: http://stackoverflow.com/q/24354507
tags question: http://stackoverflow.com/q/24416881
tags question: http://stackoverflow.com/q/24336694
tags question: http://stackoverflow.com/q/24369534
tags question: http://stackoverflow.com/q/24355265
tags question: http://stackoverflow.com/q/24424337
tags question: http://stackoverflow.com/q/24413128
tags question: http://stackoverflow.com/q/24346405
tags question: http://stackoverflow.com/q/24326394
tags question: http://stackoverflow.com/q/24384903
tags question: http://stackoverflow.com/q/24398620
tags question: http://stackoverflow.com/q/24319997
tags question: http://stackoverflow.com/q/24408156
tags question: http://stackoverflow.com/q/24406958
tags question: http://stackoverflow.com/q/24385071
tags question: http://stackoverflow.com/q/24373577
tags question: http://stackoverflow.com/q/24414467
tags question: http://stackoverflow.com/q/24312428
tags question: http://stackoverflow.com/q/24377867
tags question: http://stackoverflow.com/q/24313160
tags question: http://stackoverflow.com/q/24410984
tags question: http://stackoverflow.com/q/24406645
tags question: http://stackoverflow.com/q/24341447
tags question: http://stackoverflow.com/q/24377001
tags question: http://stackoverflow.com/q/24332058
tags question: http://stackoverflow.com/q/24319843
tags question: http://stackoverflow.com/q/24359905
tags question: http://stackoverflow.com/q/24298195
tags question: http://stackoverflow.com/q/24417793
tags question: http://stackoverflow.com/q/24333041
tags question: http://stackoverflow.com/q/24394131
tags question: http://stackoverflow.com/q/24270650
tags question: http://stackoverflow.com/q/24319611
tags question: http://stackoverflow.com/q/24397588
tags question: http://stackoverflow.com/q/24422542
tags question: http://stackoverflow.com/q/24269147
tags question: http://stackoverflow.com/q/24270549
tags question: http://stackoverflow.com/q/24347433
tags question: http://stackoverflow.com/q/24378925
tags question: http://stackoverflow.com/q/24372178

http://stackoverflow.com/comment/37541743
comment on: http://stackoverflow.com/q/24294159
type: Comment
type: QuestionComment
has text: Please show us a minimum working example that reproduces the problem.
score: 0

http://stackoverflow.com/comment/37715364
has text: It really does not matter, just make sure you dont mix both field and method annotation
type: AnswerComment
comment on: http://stackoverflow.com/a/24384122
score: 0
type: Comment

http://stackoverflow.com/comment/37500583
has text: No it's incorrect. Just remove `<jsp-file>` because you have a mapping already defined in your web.xml file. But now in this case the original JSP will never be called. Servlet is solely responsible for the HTML content generation or any further processing. You can redirect it to JSP from the Servlet if needed.
comment on: http://stackoverflow.com/a/24272269
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24312909
type: AcceptedAnswer
downvote count: 0
has body: This should probably work for you. The idea is that the MyReasonerFactory is acting as a way to retrieve a reasoner for your domain. Not only does it register the builtins, but it also gets/sets the rules. public class MyReasonerFactory implements ReasonerFactory { private static final String RULE_LOC = "./prova_rules_M_rdf_7_diffDate.txt"; static { BuiltinRegistry.theRegistry.register(new DiffDateLib()); } @Override public Reasoner create(Resource r) { final GenericRuleReasoner reasoner = new GenericRuleReasoner(this, r); reasoner.setRules(Rule.rulesFromURL(RULE_LOC)); return reasoner; } @Override public Model getCapabilities() { return GenericRuleReasonerFactory.theInstance().getCapabilities(); } @Override public String getURI() { // TODO NOTE this is just a suggestion return "urn:ex:provaRuleReasoner"; } } You did a few redundant things while loading the rules. ie: you set it in the config as well as manually retrieved them and parsed them. I removed the extra stuff. public class tryNoBuiltin { public static void main(String[] args) throws OWLOntologyStorageException, OWLOntologyCreationException, IOException { //Create a configuration model Resource configuration = ModelFactory.createDefaultModel().createResource(); configuration.addProperty(ReasonerVocabulary.PROPruleMode, "hybrid"); MyReasonerFactory MyReas = new MyReasonerFactory(); GenericRuleReasoner reasonerRULE = (GenericRuleReasoner)MyReas.create(configuration); Model modelRULE= FileManager.get().loadModel("./prova_rules_M_rdf.owl"); InfModel infModelRULE = ModelFactory.createInfModel(reasonerRULE, modelRULE); infModelRULE.prepare(); //write down the result in RDFXML form infModelRULE.write(System.out); } }
accepted answer of: http://stackoverflow.com/q/24294566
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24294566

http://stackoverflow.com/comment/37564483
type: QuestionComment
has text: possible duplicate of [Freemarker encoding - question marks in the place of accented characters](http://stackoverflow.com/questions/9559658/freemarker-encoding-question-marks-in-the-place-of-accented-characters)
score: 0
comment on: http://stackoverflow.com/q/24306198
type: Comment

http://stackoverflow.com/comment/37684025
score: 0
has text: I have never worked with that library myself, but any implementation of connection pooling that does not require a container could be used. Your own self developed code or already existing library does not matter.
type: Comment
comment on: http://stackoverflow.com/a/24361174
type: AnswerComment

permissions
tag name: permissions
type: Tag
tags question: http://stackoverflow.com/q/24305861
tags question: http://stackoverflow.com/q/24351255

http://stackoverflow.com/a/24369778
has comment: http://stackoverflow.com/comment/37685398
type: Answer
answers question: http://stackoverflow.com/q/24369643
has body: The problem is here: public static void storeBalance() { for (int i = 0; i &lt; currentBalance.length; i++) { currentBalance[i] = balance; } } That for-loop will step through every element in the array, one by one, and will overwrite each value with whatever the current balance is. There are a couple of ways you could fix this. My first reaction would be to create a variable that tells you the next index to write to: static int nextIndex = 0; and then storeBalance() would look like this: public static void storeBalance() { currentBalance[nextIndex] = balance; nextIndex++; }
score: 0

http://stackoverflow.com/comment/37601049
comment on: http://stackoverflow.com/a/24324924
score: 1
has text: Prepared statements and batch inserts will indeed accelerate the process.
type: AnswerComment
type: Comment

sensors
type: Tag
tags question: http://stackoverflow.com/q/24349939
tag name: sensors

http://stackoverflow.com/q/24400138
has comment: http://stackoverflow.com/comment/37742756
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24400454
type: UnansweredQuestion
has body: I know such kind of questions have been asked before.But my problem is little different. I have 2 services , A and B.A uses methods of B via RMI. B exports itself via below 3 statments:- Remote stub = UnicastRemoteObject.exportObject( rs, port,socketFactory,socketFactory); Registry registry = LocateRegistry.createRegistry( port,socketFactory,socketFactory ); registry.rebind( serviceBindName, stub ); where rs is the remote object implementation. Now A looks up B via below 2 statements :- Registry registry = LocateRegistry.getRegistry( BsIP, BsRMIPort); RemoteServiceRegistry rs = ( RemoteServiceRegistry ) registry.lookup( serviceBindName); Now everything works smoothly.A obtains stub from B via lookup and caches it for all subsequent requests. But problems starts when i restart B.I have mechanism via which whenever B restarts i clear the cache and perform a fresh lookup of B in A.But somehow its not working and throws exceptions in both A and B. I am clueless about this . Please help.Do let me know if you need more information. Exception in A java.rmi.NoSuchObjectException: no such object in table at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255) at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142) at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178) at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132) Exception in B ( after adding a property to JVM ,-Djava.rmi.server.logCalls=true) FINE: RMI TCP Connection(10)-192.168.50.243: [192.168.50.243] exception: java.rmi.NoSuchObjectException: no such object in table at sun.rmi.transport.Transport.serviceCall(Transport.java:135) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790) at sun.rmi.transport.t…
tagged with: rmi
tagged with: java
has title: Getting java.rmi.NoSuchObjectException while invoking a method on remote object
type: Question

http://stackoverflow.com/comment/37714586
score: 1
comment on: http://stackoverflow.com/q/24384681
type: Comment
type: QuestionComment
has text: Intent intent = Intent.parse(uri_string)

http://stackoverflow.com/comment/37679523
type: Comment
has text: @Flash_Back In your Department entity class, map name column with some other names like `dName` so that it will be differ from other name column. Besides does Hibernate generate SQL statements before the exception is thrown?
comment on: http://stackoverflow.com/a/24365584
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37551376
type: Comment
score: 1
type: QuestionComment
has text: What do you mean by 'the game no longer recognises them'?
comment on: http://stackoverflow.com/q/24299286

http://stackoverflow.com/comment/37650040
type: QuestionComment
score: 1
has text: I recognize the discrete capitalization formula, which you are calculating wrong. You should first do `Math.pow(1 + r, i);`, then multiply for `p`.
comment on: http://stackoverflow.com/q/24351179
type: Comment

http://stackoverflow.com/q/24342945
has body: In AS3, there is an event that listens for when an object is added to the stage. This is useful for cases where, for example, some variables are not set until it is added on-screen. By waiting until the object has been added, you can assure that all of those variables are set. Is there an equivalent in swing? For example, I have a function that relies on an objects getWidth function. Obviously, if I try to call this before the object is added on screen, this function will have problems because the width will be zero. I would like this function to be called as soon as the component is added and has a width. In as3, I would do something like: myComponent.addEventListener(Event.ADDED_TO_STAGE, myFunction). How would I do that in Java?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24343025
score: 1
tagged with: java
type: Question
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/24343025
favorite count: 0
has answer: http://stackoverflow.com/a/24343051
accepted answer: http://stackoverflow.com/a/24343051
upvote count: 1
tagged with: swing
has title: Is there a Java.Swing equivalent to AS3's ADDED_TO_STAGE event?

http://stackoverflow.com/q/24311091
has title: Can't run JApplet - Impossible to load library for security problems
tagged with: digital-signature
has comment: http://stackoverflow.com/comment/37787381
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37787207
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24542106
has body: from days i'm trying to reach to launch that project. Is a java project to create a digital signature of a file. what i've done from centos distribution ( 64bit ) is: create certificate using keytool -genkey -keyalg RSA -alias ALIAS -keystore sign_javafirma.keystore -storepass PASSWORD -validity 365 -keysize 2048 edit buildjar.xml changing ALIAS and PASSWORD with the one selected on point 1. install icedtea-web (yum install icedtea-web) make //it will launch ant to generate jar. After that jar is correctly generated and signed, i try applet with this html: &lt;applet code="it.treviso.provincia.freesigner.applet.FreeSignerSignApplet" type="application/x-java-applet" width="500" height="200"&gt; &lt;param name="archive" value="freesignerapplet.jar" /&gt; &lt;!-- file to sign. Result will be on the same directory --&gt; &lt;param name="filename" value="test.pdf" /&gt; &lt;!-- path of the library of the card reader --&gt; &lt;param name="devlib" value="x64/libbit4ipki.so" /&gt; &lt;!-- url called after the completion of the sign, passing the hash of the document as GET parameter --&gt; &lt;param name="callback" value="http://pratiche.prov.tv.local/callback.php?key=blablabla" /&gt; &lt;strong&gt; This browser does not have a Java Plug-in. &lt;/strong&gt; &lt;br /&gt; &lt;a href="http://java.sun.com/products/plugin/downloads/index.html"&gt; Get the latest Java Plug-in here. &lt;/a&gt; &lt;/applet&gt; &lt;/body&gt; &lt;/html&gt; where x64/libbit4ipki.so is a library downloaded from this website. When i try to go to the page which has to load applet, after request to launch an insicure applet, i have message: "Impossible to load library for security problems" and in console i don't have nothing. How can i reach to launch that project? Thanks!!!
score: 0
answer count: 1
tagged with: applet
has comment: http://stackoverflow.com/comment/37787176
accepted answer: http://stackoverflow.com/a/24542106

http://stackoverflow.com/comment/37674659
type: Comment
comment on: http://stackoverflow.com/a/24364028
type: AnswerComment
has text: +1. Quick check - would you consider replacing the string in the code as changing input? I am not quite sure if my answer is within the constraints imposed.
score: 0

http://stackoverflow.com/comment/37753361
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24405686
type: Comment
has text: yes i guess so, i took the answer from http://stackoverflow.com/questions/876473/is-there-a-way-to-check-if-a-file-is-in-use, but i added the option to check existence

http://stackoverflow.com/comment/37704152
comment on: http://stackoverflow.com/a/24378407
has text: For point #3, I add a Thread.sleep(5000) to make it really time consuming. But end up with the same result, and I see both request using the thread id of 1!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37619957
has text: @Consuela The `while` is not counter as one of the three (since the inner loop is counted separately). The third is `array[index] = val`.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24335451
type: Comment

http://stackoverflow.com/q/24294117
accepted answer: http://stackoverflow.com/a/24297085
tagged with: format
tagged with: jtable
has title: Get JTable to print tabular format
score: 0
tagged with: printing
has comment: http://stackoverflow.com/comment/37545362
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24297085
has body: So I have a standard JTable and I want the user to be able to print it out. I used JTable.print() and that's fine for printing out an exact replica of the table, but I was hoping to have it more in a tabular format, with just the column names and then the data beneath them, no grids or anything. I thought this would be simple, but I have no clue what to do! Has anybody done this? If so, can someone provide me with code sample/example? Thank you.
tagged with: swing
has comment: http://stackoverflow.com/comment/37541691
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37544352
tagged with: java
upvote count: 1
downvote count: 1
type: Question

http://stackoverflow.com/comment/37501973
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24273146
type: Comment
has text: The JVM can never optimize away expressions involving method calls because it doesn't know if those method calls have side effects.

http://stackoverflow.com/comment/37697926
type: Comment
type: QuestionComment
has text: The input stream should be closed automatically by the client library (see [MediaHttpUploader.java#425](https://code.google.com/p/google-api-java-client/source/browse/google-api-client/src/main/java/com/google/api/client/googleapis/media/MediaHttpUploader.java?name=1.18.0-rc#425)). Can you check the value of `mediaContent.getCloseInputStream()` in your code?
score: 1
comment on: http://stackoverflow.com/q/24306052

http://stackoverflow.com/comment/37604582
type: QuestionComment
comment on: http://stackoverflow.com/q/24327563
has text: google `cannot be referenced from a static context`
type: Comment
score: 1

http://stackoverflow.com/q/24397571
favorite count: 0
has comment: http://stackoverflow.com/comment/37737935
has answer: http://stackoverflow.com/a/24398178
score: -3
has body: { private static final int StringIndexOutOfBoundsException = 0; //values shared within the class private static int sideA = 0; private static int sideB = 0; //main method public static void main(String [] args) { System.out.println("Usage: Supply 2 integer values as triangle sides."); System.out.println(" A-integer value"); System.out.println(" B-integer value"); System.out.println(" C-attempt a pythagorean calculation"); System.out.println(" Q-quit the program"); String value = null; String side; char c = 0; int s1 =StringIndexOutOfBoundsException; Scanner scanner = new Scanner(System.in); boolean carryOn=true; while(carryOn) //loop until user has finished. { side = JOptionPane.showInputDialog(null, "A or B?"); try { c =side.charAt(0); } catch(NullPointerException NP){ System.out.println("Thanks you are done!"); } switch(c) //which side is the user trying to set { case 'Q': carryOn= false; //quit the program break; case 'A': try{ value = JOptionPane.showInputDialog(null, "Enter A"); sideA = Integer.parseInt(value); } catch(NumberFormatException NF){ System.out.println("Thats not a number. Type in an integer."); break; } if (sideA&lt;=0) { System.out.println("Cannot compute because A is zero. Try another integer"); break; } if(sideA&gt;0) { System.out.println("You've inputed an A value. That value is "+sideA); break; } break; case 'B': try{ value = JOptionPane.showInputDialog(null, "Enter B"); sideB = Integer.parseInt(value); } catch(NumberFormatException NF){ System.out.println("Thats not a number. Type in an integer."); break; } if (sideB&lt;=0) { System.out.println("Cannot compute because B is zero. Try another integer"); break; } if(sideB&gt;0) { System.out.println("You've inputed an B value. That value is "+sideB); break; } break; case 'C': //calculate an answer double temporary = (sideA * sideA) + (sideB * sideB); if(sideA &lt;=0 &amp;&amp; sideB &lt;=0){ System.out.println("You don't have triangle. Try again"); break; } double result = java.lang.Math.sqrt(tem…
has comment: http://stackoverflow.com/comment/37738155
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37738775
tagged with: java
downvote count: 3
has title: Exception, need to learn what is wrong?
type: Question
upvote count: 0
answer count: 1
tagged with: exception
accepted answer: http://stackoverflow.com/a/24398178
has comment: http://stackoverflow.com/comment/37738179

http://stackoverflow.com/comment/37713829
has text: then older version Do support this?
comment on: http://stackoverflow.com/a/24380126
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37531991
comment on: http://stackoverflow.com/a/24286874
type: Comment
score: 0
type: AnswerComment
has text: Hi Joop Eggen, you have found an embarrassing mistake, kindly complete the syntax: String.valueOf(...). Being new to programming it will be a turning point for me. Kindly complete the code.

http://stackoverflow.com/q/24388003
has answer: http://stackoverflow.com/a/24388329
has title: Check if JSONArray is actually integer of boolean array
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/24388329
possible better answer: http://stackoverflow.com/a/24388322
type: AnsweredQuestion
has body: Is it possible to check if JSONArray is actually boolean or integer array. I've searched trough internet for hours but I can't find anything. Thanks.
has answer: http://stackoverflow.com/a/24388322
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question

http://stackoverflow.com/comment/37755529
type: Comment
has text: permissions are fine they are rwxrwxrwx
comment on: http://stackoverflow.com/a/24302797
score: 0
type: AnswerComment

hashtable
tags question: http://stackoverflow.com/q/24335820
tag name: hashtable
tags question: http://stackoverflow.com/q/24299521
tags question: http://stackoverflow.com/q/24279248
tags question: http://stackoverflow.com/q/24389620
tags question: http://stackoverflow.com/q/24338279
type: Tag
tags question: http://stackoverflow.com/q/24315316

http://stackoverflow.com/a/24337820
score: 0
has comment: http://stackoverflow.com/comment/37624511
type: AcceptedAnswer
has body: private void btn_processOrderActionPerformed(java.awt.event.ActionEvent evt) calls add.getState(txt_deliveryState.getText()); which executes throw new UnsupportedOperationException("Not supported yet."); which is excactly the exception that is thrown. (second line in the stack trace should be exactly that line) I think it's that add.getState(txt_deliveryState.getText()); should be changed to add.setState(txt_deliveryState.getText()); and the getter wasn't meant to have an partameter, i guess. BTW: You can get that info from the stack trace. Just take a look at the first line, that is from one of your classes. This helps in most situations. Netbeans should even create a link out of the code line. ((Shipping.java:91) in this case). Just click on that link and NetBeans should jump right to that line.
type: Answer
accepted answer of: http://stackoverflow.com/q/24337584
answers question: http://stackoverflow.com/q/24337584

http://stackoverflow.com/comment/37725717
has text: @JimGarrison Does [`Collections#checkedList()`](http://docs.oracle.com/javase/8/docs/api/java/util/Collections.html#checkedList-java.util.List-java.lang.Class-) work for that? The only problem is that I'm not sure if subclasses would be accepted into that...
type: QuestionComment
comment on: http://stackoverflow.com/q/24390991
score: 0
type: Comment

http://stackoverflow.com/comment/37565143
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24305234
has text: Run package command in the **parent** maven project.

http://stackoverflow.com/comment/37505313
score: 2
comment on: http://stackoverflow.com/a/24274722
type: AnswerComment
has text: I love Harmonic Code +1
type: Comment

http://stackoverflow.com/comment/37615757
has text: Could you post the complete instantiation + registration code? It looks like the problem is outside this small snippet...
type: Comment
comment on: http://stackoverflow.com/q/24333267
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37618793
has text: While it's fine to answer your own question on SO, it still needs to be in the Q&A format. Please split this into a question that can stand on its own (including relevant content) and an answer to it.
type: Comment
comment on: http://stackoverflow.com/q/24333480
type: QuestionComment
score: 0

http://stackoverflow.com/a/24421468
has comment: http://stackoverflow.com/comment/37782988
has comment: http://stackoverflow.com/comment/37783016
has comment: http://stackoverflow.com/comment/37783149
has comment: http://stackoverflow.com/comment/37782901
has comment: http://stackoverflow.com/comment/37782982
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37782745
score: 2
has comment: http://stackoverflow.com/comment/37782913
answers question: http://stackoverflow.com/q/24421379
upvote count: 2
has body: This has nothing to do with Swing and all to do with general OOPs practices and Java: If you need to allow one class to be able to change the state of a 2nd class, give the 2nd class public methods that objects of the first class can call. This can include wrapper methods if need be that call private methods. For a more detailed answer, then you must ask a more detailed question, one that includes pertinent code. Edit Regarding your comment: .the code enters it but actually didn't wirte anything in the textfields "penetration and LNF" which are in the 2nd frame however it display the System.out.println("error") in whatever the case i choose from the combo box in the first frame ...and i think because these are private in the preloaded code so do you know a way to Nah, this has absolutely nothing to do with public or private and all to do with a bug in your code. If it were an access issue, your code wouldn't compile. Your problem is likely here: private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) { Tx_Customize l= new Tx_Customize(); // ********* env_region = jComboBox2.getSelectedIndex(); l.LF(); System.out.println(env_region); } You're creating a completely new Tx_Customize, calling methods on it, and expecting this to magically change likely another Tx_Customize object, one that is displayed, and Java doesn't work this way -- there is no magic. If you want to change the state of the displayed Tx_Customize object, then you must call methods on this very same object, not some new Tx_Customize that you create in this method. Edit 2 Other general problems: Your program should only have one main JFrame. If you absolutely need to display another window that is secondary to the first, it should be a dialog such as a JDialog. You are new to Swing, and because of this, should not use a Swing code generator as it is hampering your ability to learn how the library works. Instead code your Swing by hand, using the tutorials. You will want to study basic Ja…
has comment: http://stackoverflow.com/comment/37783008

http://stackoverflow.com/comment/37537695
type: QuestionComment
comment on: http://stackoverflow.com/q/24289647
has text: @ajb, maybe I'm old-fashioned but I would argue that if you want comparisons to work right the easiest way is to understand what you are comparing...
score: 0
type: Comment

http://stackoverflow.com/q/24331023
tagged with: java
tagged with: memory-fragmentation
has body: I would like to understand on how a memory fragmentation can occur by writing some bad code in the java user space. Please point out me with some ideas which can help me to understand this. In my understanding I was thinking like, java heap fragmentation can only occur because of buggy Garbage collection, but some of my friends argued for the opposite. I just want to understand that Java Heap fragmentation can occur by writing bad java code applications as well. NB: I am looking for code snippets which can demonstrate this argument. UPDATE: Actually the jvm which we have in the embedded device is java 1.3. Thanks, Sen
score: 0
answer count: 1
tagged with: heap-memory
tagged with: heap-fragmentation
has answer: http://stackoverflow.com/a/24331221
type: UnansweredQuestion
has title: A sample test java code which can demonstrate memory fragmentation in heap
type: Question

http://stackoverflow.com/comment/37681029
score: 0
type: Comment
has text: Where would you suggest me to add it?I am new to android.
comment on: http://stackoverflow.com/a/24367492
type: AnswerComment

http://stackoverflow.com/comment/37510826
type: Comment
type: QuestionComment
score: 0
has text: thanks but i want web driver with Java
comment on: http://stackoverflow.com/q/24277891

http://stackoverflow.com/comment/37528870
has text: Just reverse the parameters, like `SYSTIMESTAMP - INTERVAL'15' MINUTE AND SYSTIMESTAMP`
type: AnswerComment
comment on: http://stackoverflow.com/a/24286068
score: 0
type: Comment

http://stackoverflow.com/a/24340575
answers question: http://stackoverflow.com/q/24328698
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24328698
has comment: http://stackoverflow.com/comment/37646861
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37629287
downvote count: 0
has body: As per the answer above yes you can use spring data elasticsearch to accomplish almost everything you can do with elasticsearch. If you are looking for the examples then have a look at spring data elasticsearch sample project which have some basic examples how to create, index and search into elasticsearch using your spring powered application(entities). https://github.com/BioMedCentralLtd/spring-data-elasticsearch-sample-application HTH
type: Answer
score: 2

http://stackoverflow.com/comment/37548289
has text: For some reason, this worked this time. I had tried it before with to no avail, but after restarting my computer and doing this, success! Thank you.
type: AnswerComment
comment on: http://stackoverflow.com/a/24274928
score: 0
type: Comment

http://stackoverflow.com/a/24369699
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24369433
has comment: http://stackoverflow.com/comment/37685286
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37686566
has body: Change Bundle bun = getIntent().getExtras(); To Intent i = getIntent(); String _one = i.getStringExtra("NAMA"); String _two = i.getStringExtra("umur"); will give you the desired result.
type: Answer
answers question: http://stackoverflow.com/q/24369433
has comment: http://stackoverflow.com/comment/37686532
has comment: http://stackoverflow.com/comment/37686434
has comment: http://stackoverflow.com/comment/37686560

http://stackoverflow.com/comment/37679369
score: 0
type: AnswerComment
type: Comment
has text: @Luke, Sorry. I probably should have said that in a comment. My questions still stand though. How is your "application" deployed? Is it a desktop app? A command-line app? Is it deployed in a servlet container? Etc. What does a local user do to start it? What does a remote user do _differently_? You probably won't get any helpful answers until you describe the problem in more detail.
comment on: http://stackoverflow.com/a/24330092

http://stackoverflow.com/a/24338224
downvote count: 0
answers question: http://stackoverflow.com/q/24335518
type: Answer
score: 1
has body: Your code is difficult to understand because Integer.MIN_VALUE is negative, stmt.setFetchSize(Integer.MIN_VALUE); I think you'll find it works much better with stmt.setFetchSize(100); // &lt;-- I also bet this works better then 1. Finally, the Statement.setFetchSize(int) javadoc says (emphasis added), Throws: SQLException - if a database access error occurs, this method is called on a closed Statement or the condition rows >= 0 is not satisfied. So you should be getting a SQLException with your code.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24335518
type: AcceptedAnswer

http://stackoverflow.com/comment/37533342
comment on: http://stackoverflow.com/q/24289572
has text: What the problem you have the Connection connJdbcSqlServer, why not used it ? is there any compile/running time error?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37749292
type: Comment
comment on: http://stackoverflow.com/q/24403649
type: QuestionComment
has text: does Desktop.getDesktop().open(myFile) work in a blocking way? Which means, it stops execution of your application until you close your default pdf reader?
score: 0

http://stackoverflow.com/comment/37637295
has text: Regarding the Content-Encoding header question/assumption. I am not sure to be honest. Here is the link to the JAX-RS javadoc of the WriterInterceptor: https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/ext/WriterInterceptor.html
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24343249

http://stackoverflow.com/comment/138151311
type: AnswerComment
comment on: http://stackoverflow.com/a/24338154
score: 0
type: Comment
has text: hi @JeffBowman thanks, thats why I didnt post an official answer, wanted your recommendation, appreciate it, I actually btw, edited chatgpt answer moderately to remove copyright issues etc

http://stackoverflow.com/comment/37656971
type: Comment
has text: thanxx fr sharing info...!!
comment on: http://stackoverflow.com/a/24354548
score: 0
type: AnswerComment

http://stackoverflow.com/a/68296367
has body: If you are using import org.junit.jupiter.api.Test (Junit 5) and @RunWith(SpringRunner.class), SpringRunner is on Junit4, junit gets confused. Removing public before class name will work as Junit 5 complains about public test classes. From Docs: JUnit5 is more tolerant regarding the visibilities of Test classes than JUnit4, which required everything to be public. In this context, JUnit5 test classes can have any visibility but private, however, it is recommended to use the default package visibility, which improves readability of code.
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/24319697
downvote count: 0
score: 8

http://stackoverflow.com/comment/38939593
type: Comment
score: 0
type: AnswerComment
has text: With an issue, you are pulling the worklog .. Am asking on, how to pull the worklog for a user for the specified date range
comment on: http://stackoverflow.com/a/25033286

http://stackoverflow.com/comment/112924602
score: 0
has text: @UmarTahir perhaps that deserves its own StackOverflow question; can you create a question for this instead of a comment?
type: AnswerComment
comment on: http://stackoverflow.com/a/24276186
type: Comment

http://stackoverflow.com/a/24345990
has comment: http://stackoverflow.com/comment/37654379
type: Answer
answers question: http://stackoverflow.com/q/24340850
upvote count: 1
score: 1
downvote count: 0
has body: The answer by Matt Johnson is correct. When you omit a time zone, the JVM's default time zone is applied. I suggest always specifying a time zone rather than rely on implicit default, even if done by explicitly calling getDefault(). Pure Joda-Time FYI, here is some example code for a better way to do this job. This way uses only Joda-Time. Mixing Joda-Time and java.util.Date/Calendar leads to confusion and pain, as your Questions shows. Furthermore, the java.util.Date, .Calendar, and SimpleDateFormat classes are notoriously troublesome and should be avoided. By the way, no need for that call to getTimeZone and passing a TimeZone object. Joda-Time has a built-in constant for UTC: DateTimeZone.UTC. DateTimeFormatter formatter = DateTimeFormat.forPattern( "dd/MM/yyyy" ); // Usually I specify a Locale as well. But in this case, no need (no names of days or months). DateTimeZone customerTimeZone = DateTimeZone.UTC; String input = "25/05/2014"; DateTime customerDateTime = formatter.withZone( customerTimeZone ).parseDateTime( input ); DateTime customerDateTimeAtFive = customerDateTime.withHourOfDay( 5 ); // Using customerTimeZone. Not sure why you are purposely losing time zone info by converting to LocalDateTime. There is no need to lose time zone if the goal is handling date-time values in UTC on the server. The server-side code should be using DateTime objects explicitly assigned to a time zone of UTC. You can adjust time zones this way: DateTime serverDateTime = customerDateTimeAtFive.withZone( DateTimeZone.UTC ); But anyways, if you insist (same as code in the Question)… DateTimeZone serverTimeZone = DateTimeZone.UTC; LocalDateTime localDateTime = new LocalDateTime( customerDateTimeAtFive, serverTimeZone ); // I don't see the point of using LocalDateTime, but here goes anyways. Dump to console. System.out.println( "customerTimeZone: " + customerTimeZone ); System.out.println( "input: " + input ); System.out.println( "customerDateTime: " + customerDateTime ); System.ou…

http://stackoverflow.com/a/24412523
has comment: http://stackoverflow.com/comment/37917573
has body: Eclipse doesn't deploy the WAR. Instead, it knows how Tomcat works and deploys the exploded WAR. The next step is to look into the webapps/ folder of Tomcat to make sure Eclipse really has deployed something. If that looks ok, you need to look into the Tomcat log to see why it doesn't like the deployed web app. Most of the time, there is old code which is somehow stuck in Tomcat, so Tomcat can't undeploy the old version. If that's the case, stop Tomcat, delete the app manually and try again.
answers question: http://stackoverflow.com/q/24412401
has comment: http://stackoverflow.com/comment/37913158
has comment: http://stackoverflow.com/comment/37914319
has comment: http://stackoverflow.com/comment/37914719
has comment: http://stackoverflow.com/comment/37916710
score: 0
has comment: http://stackoverflow.com/comment/37917489
has comment: http://stackoverflow.com/comment/37904736
has comment: http://stackoverflow.com/comment/37916625
has comment: http://stackoverflow.com/comment/37767321
has comment: http://stackoverflow.com/comment/37917180
has comment: http://stackoverflow.com/comment/37917246
type: Answer
has comment: http://stackoverflow.com/comment/37914667

http://stackoverflow.com/a/24268485
has body: By using below code you can print that want after every second timer.schedule(new TimerTask() { @Override public void run() { System.out.println(Runtime.getRuntime().freeMemory()); } }, 0, 1000); }
type: Answer
has comment: http://stackoverflow.com/comment/37492658
downvote count: 1
answers question: http://stackoverflow.com/q/24268354
score: -1
has comment: http://stackoverflow.com/comment/37492851
upvote count: 0

http://stackoverflow.com/comment/37574618
comment on: http://stackoverflow.com/a/24311194
type: Comment
has text: Yeah, I just saw that one, it is a great answer as well, thanks a lot for the link, and also for your answer, it is completely clear, I really feel I learnt something today.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37558840
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24300746
score: 0
has text: can your share the code what are you doing on button click or how are you redirecting to next page.

http://stackoverflow.com/comment/37684455
score: 0
comment on: http://stackoverflow.com/q/24368807
has text: Yes, a `char` has 65536 possible values. How many of those different values do you expect in a result which is just hex though?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24278489
answers question: http://stackoverflow.com/q/24278398
score: 1
downvote count: 0
has body: contains and equals methods of string returns boolean you cannot cast to String
type: Answer
upvote count: 1

http://stackoverflow.com/a/24283977
type: Answer
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/24283953
has body: Change your code to this: public class ShowTeamsChosen extends ActionBarActivity { //This is the textbox I am populating... @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_show_teams_chosen); TextView txtOne = (TextView) findViewById(R.id.textView1); //here I am setting the text txtOne.setText("test"); readFromFile(); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } }

http://stackoverflow.com/comment/37632049
type: Comment
type: QuestionComment
has text: @keyser ok so with arrays it would be, but how do I give attributes to strings? Do I have to create a class for each plan and then extend that plan to the class "Rainy","Free"..?
score: 0
comment on: http://stackoverflow.com/q/24340214

http://stackoverflow.com/comment/37655420
score: 0
has text: I want to keep calling this function after specified intervals, can i do this with these?
type: AnswerComment
comment on: http://stackoverflow.com/a/24353816
type: Comment

http://stackoverflow.com/q/24285394
linked to: http://stackoverflow.com/q/17277138
has comment: http://stackoverflow.com/comment/37524956
has body: I'm encountering a very bizzare performance discrepency. I'm running a load test on my local machine. 2 different web applications are communicating via restTemplate of spring.(a single tomcat server is running both web apps) Here is the bizzare flow in a "load test" of only 100 concurrent players: A) webapp#1 uses the following call: GameResponseDTO result = template.postForObject( URLS.GAME_SERVER_URL + "/GameServer/game/play/", gameRequestDTO, GameResponseDTO.class); B) webapp#2 controller recieves this rest call and returns a result object after less than 100ms! C) the result returns to webapp#1 after 9000ms even though the handle of webapp#2 took less than 100ms! Questions: 1) Any ideas what can cause this? bear in mind both apps are on the same machine (no real networking duration) 2) Any ideas on what else should i check? 3) is it possible this issue is caused by @Transactional \ marshaling of json response? if so how can i test it? Thanks!
score: 0
answer count: 1
tagged with: load
has comment: http://stackoverflow.com/comment/37529478
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/24286712
tagged with: java
tagged with: resttemplate
type: Question
has title: Spring MVC With RestTemplate - unexplained delay on post (load test)
has comment: http://stackoverflow.com/comment/37558272

http://stackoverflow.com/a/24290197
answers question: http://stackoverflow.com/q/24286713
downvote count: 0
has body: I'm not entirely clear I'm reading your formula correctly: are you summing up integers from 2 to x on the left-hand side of the equals sign, and you want that sum to be equal to the term on the right-hand side? In that case, we could do the following transformation: (Note that the first step might not be what you had in mind.) We can now easily solve this using the quadratic formula to get: Assuming that we're calculating in the reals, note that the root is only defined for non-negative arguments. The result of taking that root yields a non-negative number and substracting that non-negative number from -1 would give something &lt;= -1, i.e., a negative number. Dividing it by 2 won't make it positive, either, but we've assumed from the get-go that our x must be &gt;= 2, or else the very first sum wouldn't make any sense. Therefore we can disregard the - case of the +/- in the formula altogether. Hence: This should be straight-forward to translate into Java code, but note that the result is likely not to be an integer, so you will have to round if you're looking for an upper bound.
has comment: http://stackoverflow.com/comment/37534759
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/24427203
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24426896
answers question: http://stackoverflow.com/q/24426896
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37795708
has body: I think imagebutton maybe better. because you must have a click effect for feedback . if you use background for the image ,you have to write a selector.xml for change the click and unclick effects. so, i think imagebutton may be better.

http://stackoverflow.com/comment/37670785
comment on: http://stackoverflow.com/q/24361648
score: 0
type: Comment
type: QuestionComment
has text: Is there no other solution? The mapping of the email object is quite long

http://stackoverflow.com/q/24413746
answer count: 0
tagged with: java
has title: gradle fails to load dll's from jar during TestNg tests
tagged with: gradle
type: Question
tagged with: dll
tagged with: jar
has comment: http://stackoverflow.com/comment/37793057
has body: I'm trying to run some testNg tests with gradle. We use a third party library which is a single jar file. It contains some classes, but it also contains some dll files. When I run it from eclipse "run as TestNg" it works well, but when I try to run tests with gradle I get java.lang.UnsatisfiedLinkError exception. It certainly sees jar itself, since I have classes from this library in a stacktrace. Here is how my task looks like (the prepare task just copies persistance.xml from resources to classes: task runIntegrationTests(type: Test){ doFirst(){ tasks.prepareForIntegrationTests.execute() } useTestNG() include '**/*IT.class' }
has comment: http://stackoverflow.com/comment/37781990
score: 0
has comment: http://stackoverflow.com/comment/37792892
type: UnansweredQuestion

http://stackoverflow.com/q/24359034
has comment: http://stackoverflow.com/comment/37666160
has comment: http://stackoverflow.com/comment/37668838
has comment: http://stackoverflow.com/comment/138681237
has answer: http://stackoverflow.com/a/24365089
has comment: http://stackoverflow.com/comment/37665952
has comment: http://stackoverflow.com/comment/37665807
has answer: http://stackoverflow.com/a/24360994
has comment: http://stackoverflow.com/comment/37665735
downvote count: 0
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37666729
has comment: http://stackoverflow.com/comment/37679633
has comment: http://stackoverflow.com/comment/37665721
has body: How to create a Thread safe InputStream .During multithreaded operations the inputStream data gets corrupted,so how can i make my inputStream thread safe.will the following code work public class SynchronizedInputStream extends InputStream{ private InputStream in; private SynchronizedInputStream( InputStream in ) { this.in = in; } /* ... method for every InputStream type to use */ public static InputStream createInputStream( InputStream in) { return new SynchronizedInputStream( in); } public static InputStream createPushBackInputStream(InputStream in,int BUFSIZE){ return new SynchronizedInputStream(new PushbackInputStream(in,BUFSIZE)); } /* Wrap all InputStream methods Used */ public int read(){ synchronized (this) { try { return in.read(); } catch (IOException e) { e.printStackTrace(); } } return 0; } @Override public int available() { synchronized( this ) { try { return in.available(); } catch (IOException e) { e.printStackTrace(); } } return 0; } } In the NANOHTTPD file public HTTPSession(TempFileManager tempFileManager, InputStream inputStream, OutputStream outputStream, InetAddress inetAddress) { this.inputStream=(PushbackInputStream) SynchronizedInputStream.createPushBackInputStream(inputStream); /*lines of code..........*/ } Then i call it like this String Data = readStream(session.getInputStream());//session is HTTPSession /*.....code....*/ private String readStream(InputStream in) { synchronized (in) { PushbackInputStream inputStream = (PushbackInputStream) in; StringBuffer outputBuffer = null; try { //Reading the InputStream Here } } catch (IOException ioe) { //error msg } return outputBuffer.toString(); } }
score: 14
has comment: http://stackoverflow.com/comment/37677883
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37677998
has comment: http://stackoverflow.com/comment/37666087
tagged with: java
tagged with: inputstream
possible better answer: http://stackoverflow.com/a/24360994
type: Question
has comment: http://stackoverflow.com/comment/37666479
has comment: http://stackoverflow.com/comment/37665746
answer count: 2
has title: Thread safe InputStream in java
accepted answer: http://stackoverflow.com/a/24365089
has comment: http://stackoverflow.com/comment/37668119
has comment: http://stackoverflow.com/comment/37665707
has comment: http://stackoverflow.com/comment/37665892
favorite count: 0
upvote count: 14

http://stackoverflow.com/a/24395503
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/37734353
answers question: http://stackoverflow.com/q/24395502
has comment: http://stackoverflow.com/comment/37734483
has body: This has to do with how the first round of processing is performed by bash v. exec, but not exactly glob expansion. Remove the ' ' around the filename and it should work. In bash, you use those quotes to prevent bash from expanding the glob. However single quote has no special meaning to exec either, so those are passed raw to the find command too. You want find to see a*. In bash, this means you must type 'a*'. But in exec, it means you must type a* or else find will see 'a*'.
score: 0
upvote count: 1

python
tags question: http://stackoverflow.com/q/24312753
tags question: http://stackoverflow.com/q/24415129
tags question: http://stackoverflow.com/q/24414186
tags question: http://stackoverflow.com/q/24311061
tags question: http://stackoverflow.com/q/24362870
tag name: python
tags question: http://stackoverflow.com/q/24420826
tags question: http://stackoverflow.com/q/24367485
tags question: http://stackoverflow.com/q/24310407
tags question: http://stackoverflow.com/q/24422367
tags question: http://stackoverflow.com/q/24288738
type: Tag
tags question: http://stackoverflow.com/q/24339949
tags question: http://stackoverflow.com/q/24377187
tags question: http://stackoverflow.com/q/24276048
tags question: http://stackoverflow.com/q/24303313
tags question: http://stackoverflow.com/q/24398620
tags question: http://stackoverflow.com/q/24417793
tags question: http://stackoverflow.com/q/24274239

http://stackoverflow.com/q/24352070
tagged with: sql
tagged with: android
has answer: http://stackoverflow.com/a/24352163
has comment: http://stackoverflow.com/comment/37651806
has title: Best way to store content?
has comment: http://stackoverflow.com/comment/37651848
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37651840
tagged with: java
accepted answer: http://stackoverflow.com/a/24352163
has body: First of all I want to thank you for even reading this. I'm a complete noob and I'm trying to learn Android Java. I've made many little "Learn Apps" in which I just try to learn things. Today I want to make another one. I want to have ListView in the MainActivity which contains names of Food like: Pizza Ice Cream Spaghetti Apple Orange ... When the user clicks on one of those a SecondActivity gets called and this SecondActivity contains a two TextViews. One with the name on which the user clicked and one with a description. Example: User clicks on Pizza. SecondActivity looks like this: Pizza Pizza is blah blah blah and if the user clicks Orange: Orange Oranges are fruits blah blah blah I hope you undestand me. My question is now. Which is the easiest way to store this descriptions? An SQLDatabse? Or should I just write them like Strings and say. If user clicks this parse this String to TextView1 and this String to TextView2? I hope you understand me and can help me! Thank you very much!!
has answer: http://stackoverflow.com/a/24352278
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/24352278
tagged with: listview
has comment: http://stackoverflow.com/comment/37651855
score: 0

http://stackoverflow.com/comment/37724671
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24389721
type: QuestionComment
has text: You should rather use JPA provided by JBoss (unless of course you need something especially from 2.1). So better would be to fix dependencies to point to correct jpa rather removing jboss one. Otherwise you will have to pack separate jpa provider with your app, instead of using potentially more tested one.

http://stackoverflow.com/q/24384341
answer count: 0
type: UnansweredQuestion
upvote count: 1
type: Question
tagged with: heroku
has body: I am trying to update Heroku to run with JDK 1.7, from a Windows development environment. In following with the docs here I created a system.properties file in my app's root directory, containing the following: java.runtime.version=1.7 I then manually went into Heroku's config variables and added this: /app/.jdk/bin to the beginning of the path. I committed my change and pushed it to the server. However, the Heroku push logs only say "Installing OpenJDK", and don't mention which version is being installed. My code then results in a Major.Minor 51.0 compile error resulting in compilation with the Heroku standard OpenJDK1.6 For some reason Heroku is not updating the JDK! Any help would be much appreciated.
score: 1
tagged with: java
has title: Issue updating Heroku JDK to 1.7 with Play 2.2.3
tagged with: playframework
downvote count: 0
favorite count: 0
tagged with: playframework-2.2

http://stackoverflow.com/comment/37563862
comment on: http://stackoverflow.com/q/24306088
score: 0
type: Comment
has text: Cvs library..??? can you show me any example of it.
type: QuestionComment

http://stackoverflow.com/a/24336433
answers question: http://stackoverflow.com/q/24325171
has comment: http://stackoverflow.com/comment/37621969
downvote count: 0
has body: UTC is not a format. It's a system of timekeeping. TAI - Measured from precise atomic clocks UT1 - Measured from the imprecise rotation of the Earth UTC - Calculated by adding leap seconds to TAI to align it to within 0.9 seconds of UT1. UTC is the common standard we use in computing. A time in UTC can be expressed in a wide variety of formats, however it is always the same time for everyone. It is not affected by time zones, and it never changes for daylight saving time.
upvote count: 2
has comment: http://stackoverflow.com/comment/37622064
type: Answer
has comment: http://stackoverflow.com/comment/37622018
score: 2
has comment: http://stackoverflow.com/comment/37623169

tdd
tags question: http://stackoverflow.com/q/24380470
type: Tag
tag name: tdd

filewalker
type: Tag
tag name: filewalker
tags question: http://stackoverflow.com/q/24372826

http://stackoverflow.com/a/24306573
type: Answer
accepted answer of: http://stackoverflow.com/q/24306071
answers question: http://stackoverflow.com/q/24306071
has comment: http://stackoverflow.com/comment/39703542
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: "But the strange thing is... Every time i'm maximizing and restoring the frame, the box is moving. Why is this happening?" Because repaint() is called when you resize which update the graphics, which you should be doing, instead of trying to call paint. But... Still many things wrong. Seeing as this is your first animation (package firstanimation;), let me get you started in the right direction. Don't use Canvas. Use JPanel or JComponent instead. When you do, don't override paint but paintComponent instead. Also make sure you call super.paintComponent so you aren't let with any paint artifact during the animation. public class MyCanvas extends JPanel { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); //painting code } } Never use getGraphics on a component to do any painting. You shouldn't ever have to explicitly call paint. The paint[Component] method will be implicitly called for you. A simple call to repaint() will repaint the component. I just realized you're using all AWT components. Don't use them, they're out-dated. Instead use Swing component. The majority of them are just prefixed with a J, like Frame -> JFrame. They are in the javax.swing.* package. For animation use a javax.swing.Timer. You can see more at How to Use Timers. The basic construct is Timer ( int delayInMillis, ActionListener listener ) where delayInMillis is the time to delay between ticks(in this case animations) and the ActionListener listens for "ticks". Each tick, the actionPerformed of the ActionListener is called. There, you can put the code to update any variables you use for animation. I suggest you read the tutorials Performing Custom Painting to see the proper way to paint. Here's a simple example with all the points above mentioned import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Random; import javax.swing.JFrame; import javax.swing.JPa…

http://stackoverflow.com/a/24357598
downvote count: 0
answers question: http://stackoverflow.com/q/24357506
upvote count: 2
type: AcceptedAnswer
has body: Yes. Calling postInvalidate sets up the canvas to the screen and passes it to the onDraw function, as well as various other pieces of logic. Calling onDraw directly only makes sense if you want to draw a view to somewhere other than the screen. In addition, postInvalidate will cause it to redraw after control returns to the looper and combines multiple reasons to redraw into a single redraw. It will not try to draw immediately. Calling onDraw would cause it to draw immediately, which may cause significant performance issues. It will not batch drawing requests, causing it to redraw multiple times. There's others, but the end result is that unless you're trying to draw to a non-standard canvas, don't call onDraw directly- call invalidate or postInvalidate.
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24357506

http://stackoverflow.com/q/24324179
linked to: http://stackoverflow.com/q/7482748
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24324294
type: Question
tagged with: jsoup
upvote count: 5
tagged with: eclipse
has title: Jsoup unable to connect
answer count: 2
possible better answer: http://stackoverflow.com/a/24324358
has answer: http://stackoverflow.com/a/24324358
downvote count: 0
has body: I have downloaded the Jsoup jar and added it in the library. I have added the proxy settings in Eclipse. But when ever I try this in the code: Document doc = Jsoup.connect("http://www.wikipedia.com").get(); it throws the following error: Errorjava.net.ConnectException: Connection refused: connect Can anyone help me figure out a solution? Is there a specific way to set the proxy (in case I am missing something). Attaching screenshot of the same. Any help/guidance will be highly appreciated.
favorite count: 0
has answer: http://stackoverflow.com/a/24324294
score: 5
has comment: http://stackoverflow.com/comment/37598465

http://stackoverflow.com/q/24393023
tagged with: for-loop
has title: Loss of information during a for loop
answer count: 1
has answer: http://stackoverflow.com/a/24393154
favorite count: 0
has comment: http://stackoverflow.com/comment/37782642
has comment: http://stackoverflow.com/comment/37729357
downvote count: 1
upvote count: 0
has comment: http://stackoverflow.com/comment/37729217
tagged with: set
has comment: http://stackoverflow.com/comment/37733109
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37729411
has body: I have a problem with this method: private boolean reflectionEqualsSet(Object left, Object right) { Set leftSet = (Set) left; Set rightSet = (Set) right; if (leftSet == null) { // POF tricks: if set to serialize is null, the deserialized set is empty return rightSet != null &amp;&amp; rightSet.size() == 0; } // check size if (leftSet.size() != leftSet.size()) { return false; } // check values for (Object currLeft : leftSet) { boolean found = false; for (Object currRight : rightSet) { if (isEqual(currLeft, currRight)) { found = true; break; } } if (!found) { return false; } } return true; } The problem is: I have an object with three random filled values in leftSet (2 UUID's and 1 Integer). The values I have in my leftSet change completely in the for loop. While debugging I've found out that in the first iteration currSet already has completely different values and I can't figure out why. In the inner loop with currRight this doesn't happen. I've been debugging for hours and I've found the problem is in that line does anyone have an idea of why the values change? (Not the order, the values). I know this isn't much information about the problem but that's all I can tell, I don't know how to explain it any better, sorry. Thanks
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/24393154

http://stackoverflow.com/q/24426125
has answer: http://stackoverflow.com/a/24429042
accepted answer: http://stackoverflow.com/a/24429042
tagged with: android
tagged with: android-notifications
tagged with: google-cloud-messaging
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/20838415
type: Question
tagged with: java
has body: I am trying to do something that I am not sure is possible or not . I have created my android application "ABC" . I have used GCM to issue notifications from my 3rd party service. Now my client asks that he wants a history of all notifications issued by the 3rd party server . I am sceptical about this . I believe I might be able to show a list of all notifications issued by the server WHICH ARE RESPONDED upon by the user . However I think the notifications on which the user has not responded cannot be recorded by my application . Is this true ? I have this broadcast receiver in my code that responds to GCM messages. &lt;receiver android:name="com.mob.uae.notifications.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" &gt; &lt;intent-filter&gt; &lt;action android:name="com.google.android.c2dm.intent.RECEIVE" /&gt; &lt;category android:name="com.evento.uae" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; Shouldn't this be called regardless of the user's action upon the notification ? . If this is called even when my application is shut down , then I think we do have a way to record all notifications targeted for me . Any idea geniuses ?
score: 0
answer count: 1
has title: Get notification history for android application

http://stackoverflow.com/comment/37512733
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24278398
has text: I don't think that even compiles `String strCondition = something.contains("value") && somethingElse.equals("one");`. As mentioned by others the expression is already a `boolean`

http://stackoverflow.com/a/24332793
type: Answer
answers question: http://stackoverflow.com/q/24321319
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24321319
type: AcceptedAnswer
downvote count: 0
has body: Here is how it works. Boolean.valueOf((List&lt;String&gt;) session.createSQLQuery("SELECT IF (SELECT 1 FROM master.invoices WHERE currency_id = 17879) , 'true', 'false')").list());

http://stackoverflow.com/comment/37707410
has text: Thanks Paul, I've already tried both of your suggestions. The Proxy Authorization Required disappeared once I updated Network Connection settings of eclipse and I've already checked for the dependencies availability on Maven Central.
comment on: http://stackoverflow.com/a/24380549
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/88485391
comment on: http://stackoverflow.com/a/24269485
has text: we dont need `static` in `public static class getNext`, right?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37784701
type: Comment
has text: :) First thanks a lot for introducing me with WMI.I will make programs to work with wmi commands but have you tried your sample program?! I ran the program and it just got struck in 'unknown' nothing else is shown. I waited for almost 10 minutes but still it displays only 'unknown'. but anyways thanks a lot
score: 0
comment on: http://stackoverflow.com/a/24408252
type: AnswerComment

http://stackoverflow.com/comment/37714321
type: QuestionComment
has text: Actually I have to do this without using TransferHandler.. I know that this is stupid, but excercise is to do this 'manually' :/
score: 0
comment on: http://stackoverflow.com/q/24384830
type: Comment

http://stackoverflow.com/q/24287522
has title: how to embed android emulator in HTML page
has comment: http://stackoverflow.com/comment/37578475
type: UnansweredQuestion
tagged with: android
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/56236653
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37578326
type: Question
has comment: http://stackoverflow.com/comment/37537180
has body: i am working on a project that enables a user to have a demo of an application that he is about to download.. something similar to https://www.manymo.com ; but i am struck on how to embed the emulator in the webpage. Any help regarding this is highly appreciated.
score: 9
answer count: 2
favorite count: 0
upvote count: 9
has answer: http://stackoverflow.com/a/56282485

http://stackoverflow.com/a/24406663
upvote count: 2
has comment: http://stackoverflow.com/comment/37757549
has body: After creating receive_task the code returns to final Socket client_socket = server_socket.accept(); So the server throws away the connection as the run() will only grab one message. You would have to made a while loop in run() too.
type: AcceptedAnswer
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24402164
downvote count: 0
has comment: http://stackoverflow.com/comment/37759785
answers question: http://stackoverflow.com/q/24402164

http://stackoverflow.com/comment/37883110
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24413554
has text: well the thing is panel 3 occupies the place for panel 4 and 5 and thus i cannot resize panel 3 to match the one in the picture.

http://stackoverflow.com/q/24411346
score: -1
type: Question
has comment: http://stackoverflow.com/comment/37763517
tagged with: apache-stringutils
upvote count: 0
answer count: 1
tagged with: junit
favorite count: 0
type: UnansweredQuestion
has body: I have function public void foo(final String s) { if(StringUtils.isBlank(s) {//throw error} //rest of the logic } and unit test @Test(//expected exception) public void testFooWithBlankString() { ClassOfFoo.foo(StringUtils.EMPTY); } Is this correct? Should I create a blank variable like BLANK = " " and use that in unit test?
downvote count: 1
has title: Is using StringUtils.EMPTY recommended in unit test where StringUtils.isBlank method is used?
tagged with: unit-testing
has answer: http://stackoverflow.com/a/24411477
tagged with: java

http://stackoverflow.com/comment/37786253
comment on: http://stackoverflow.com/q/24423598
has text: thanks for your answer but i need to extend from two classes not a class and several interfaces.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37934421
type: AnswerComment
has text: That should do it. The error must come from somewhere else. Like i said, it is probably something basic. Try learn the basics first or do a simple tutorial.
type: Comment
comment on: http://stackoverflow.com/a/24361744
score: 0

http://stackoverflow.com/q/24320177
answer count: 1
tagged with: jsp
has body: In my jsp page i have following code snippet. This page is coming recursive way during my flow. I am getting a duplicate bean id error while execution of the jsp in the middle of the flow. Can you anyone help me how to check whether bean id already exist or not for the following code? The full code has been given code.jsp <%@ page language="java" %> <%@ page import="com.ubsw.risk.AUT_Authenticator.*" %> <% String path= System.getProperty("dev_property_path"); System.out.println("dev_property_path----->"+path); %> <jsp:useBean id="orbinfra" scope="session" class="com.ubsw.risk.Creation.web.OrbinfraBean" > <jsp:setProperty name="orbinfra" property="propertiesFile" value="<%=path%>"/> <% System.out.println("B4 init of Orbinfra"); try { orbinfra.init(); System.out.println("after init of Orbinfra"); } catch( Exception ex ) { System.out.println("error in Orbinfra"+ex); ex.printStackTrace(); %> Caught exception while creating orbinfra <%= ex %> <% } %> </jsp:useBean> <jsp:useBean id="security" scope="session" class="com.ubsw.risk.Creation.web.AuthenticatorBean" > </jsp:useBean> <% boolean showLogin; showLogin = true; boolean additionalMessage = false; String message = "Warning - Users login has expired"; boolean hasAdminRights = false; // is there a command being sent String checkcommand = request.getParameter("command"); // does user want to login if( checkcommand != null ) { if( checkcommand.equals("login") ) { try { String authenticatorModuleLookupValue= System.getProperty("authenticatorModuleLookupValue"); String cookieNamevalue= System.getProperty("cookieNamevalue"); System.out.println(request.getParameter("User_Name")); System.out.println(request.getRemoteAddr()); System.out.println(request.getLocalAddr()); System.out.println("hello P"); //HttpSession session1 = request.getSession(true); System.out.println(authenticatorModuleLookupValue+":"+cookieNamevalue); security.setloginInfo(authenticatorModuleLookupValue,cookieNamevalue); security.logon(request.getParameter("Us…
has comment: http://stackoverflow.com/comment/37590830
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37590891
has title: jsp:useBean duplicate id checking
tagged with: tomcat7
has answer: http://stackoverflow.com/a/24320296
has comment: http://stackoverflow.com/comment/37595918
tagged with: java
has comment: http://stackoverflow.com/comment/37593230
has comment: http://stackoverflow.com/comment/37591233
type: Question
has comment: http://stackoverflow.com/comment/37591076

http://stackoverflow.com/q/24325690
has comment: http://stackoverflow.com/comment/37601055
has title: Java/XML: use a string in another string
type: Question
has comment: http://stackoverflow.com/comment/37601702
has answer: http://stackoverflow.com/a/24326330
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24326330
answer count: 1
downvote count: 0
tagged with: string
has comment: http://stackoverflow.com/comment/37601896
favorite count: 0
tagged with: android
linked to: http://stackoverflow.com/q/14927326
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has body: is it possible to use a sting in another string? What I want is: http://www.examplepage.com Go to my Website: "string:"homepage" So, if I have more strings which should show my homepage, how do i deal with this if I not want to change every singel string, just the "homepage" string?
upvote count: 1

http://stackoverflow.com/q/24372365
possible better answer: http://stackoverflow.com/a/24372841
has comment: http://stackoverflow.com/comment/37694025
has comment: http://stackoverflow.com/comment/37694113
upvote count: 3
type: AnsweredQuestion
score: 3
tagged with: oop
tagged with: java
has answer: http://stackoverflow.com/a/24383152
tagged with: struts2
type: Question
answer count: 2
downvote count: 0
has title: how to choose what type of object to instantiate based on form field?
favorite count: 0
has answer: http://stackoverflow.com/a/24372841
has body: i have a struts2 form that takes in a Maintenance object. there are different types of Maintenance - for the sake of brevity let's say there is RemovePart and InstallPart. this form includes fields for both, but the user only sees one - that is based on the user's choice in the first dropdown. what is the correct (best?) way to determine which Maintenance class to instantiate once my Action receives the data? the best i've come up with so far is below, though i can't help thinking there is a better way to do it. EDIT 6/24 14:18 GMT: the RemovedPart and InstalledPart classes have fields that don't correspond to each other. public class Maintenance { private String maintenanceType; private String removedSerialNumber; private String removedPartName; private String removedPartDescription; private String removedPartPosition; private String installedSerialNumber; private String installedPartName; private String installedPartSource; // getters and setters } public class RemovedPart { private String serialNumber; private String partName; private String partDescription; private String partPosition; public static createRemovedPart(Maintenance maintenance) { return new RemovedPart(maintenance.getRemovedSerialNumber(), maintenance.getRemovedPartName(), maintenance.getRemovedPartDescription(), maintenance.getRemovedPartPosition()); } private RemovedPart() { this.serialNumber = serialNumber; this.PartName = partName; this.partDescription = partDescription; this.partPosition = partPosition; } // getters and setters } public class InstalledPart { //similar to RemovedPart } public class MaintAction extends ActionSupport { Maintenance maintenance; public String execute() { if (maintenance.getMaintenanceType().equals("remove")) { RemovedPart removed = RemovedPart.createRemovedPart(maintenance); } else { // you get the idea } // more logic return SUCCESS; }
accepted answer: http://stackoverflow.com/a/24383152

http://stackoverflow.com/q/24378231
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/37778069
tagged with: caching
has answer: http://stackoverflow.com/a/24378613
has body: I'm using CacheBuilder and LocalCache from guava library, but have some performance issues p99.9 latency around 300-400 ms for getAllPresent. Latency for requests almost doubles between p99 and p99.9 (p99 is around 150 ms) The following configuration is used: 120 sec for refreshAfterWrite, maxsize is set to be 2e6 and expiration for 24 hours, initial capacity is 1e6. No removeListener is used and no expireAfterWrite. ConcurrencyLevel 256 (Tried different values). Machine has 12 cores. While cache is in use it has between 8e5 to 1.2e6 entries. Pattern of usage is getAllPresent for around 3k keys on p99.9 and around 100 qps. Key is a complex object for hashCode, Objects.hash method is used with all fields supplied there. I tried different hash function to make sure that distribution is uniform (murmur3 shown similar results). So, the problem is not in collisions. Any pointers on how to tune it to be more performant?
score: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24381673
type: Question
has comment: http://stackoverflow.com/comment/37702562
has comment: http://stackoverflow.com/comment/37743517
has comment: http://stackoverflow.com/comment/37701897
favorite count: 0
has title: LocalCache guava, optimization for higher throughput
answer count: 2
linked to: http://stackoverflow.com/q/24755464
downvote count: 1
tagged with: performance
tagged with: guava

http://stackoverflow.com/a/25038693
accepted answer of: http://stackoverflow.com/q/24332302
score: 2
answers question: http://stackoverflow.com/q/24332302
has body: If you are using then Apache Commons Pool library, the GenereicObjectPool provides two methods: getMaxActive() returns the amount of allowed Connections getNumActive() returns the number of actually used Connections If you check getMaxActive() > getNumActive() you can achive your requirement without catching Exceptions.
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/24370993
type: Answer
answers question: http://stackoverflow.com/q/24370932
score: 0
has body: Map is an association between keys and values. Other (true) collections are ... collections of similar values. It is almost impossible to consolidate so different data structures under the same interface. This is the reason why Collections implement interface Colletion and maps implement interface Map.

http://stackoverflow.com/a/24339743
score: 2
downvote count: 0
upvote count: 2
type: Answer
has body: So, knowing that the upper code produces an exception. Why compiler does just sit and watch? Because the Java Language Specification says it should. The type signature for the format method is format(String format, Object... args), and the JLS says that the if the arguments conform to that signature after application of prescribed conversions then the code is valid. The compiler is NOT ALLOWED to say "compilation error" for your code ... because the code is valid Java code. In fact, the only way that the compiler could "know" that the your code will always produce an exception is if it is coded with special knowledge of what format strings mean. And, in that case, the most that a (hypothetical) compiler with that special knowledge would be allowed to do would be to output a Warning. In reality, this kind of thing is treated as beyond the scope of a typical compiler. Rather it is the problem domain of static analysis tools such as FindBugs and PMD. (Or for the C language, the Lint tool ... which IIRC does check format strings in some versions.)
answers question: http://stackoverflow.com/q/24339130

http://stackoverflow.com/comment/37687925
has text: You could also have your program create the file, then see where it appears to get a sense of what working directory your program is using.
comment on: http://stackoverflow.com/q/24371084
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37491392
score: 0
comment on: http://stackoverflow.com/q/24267286
type: Comment
type: QuestionComment
has text: @SotiriosDelimanolis sorry GUYS :|

http://stackoverflow.com/a/24271130
has comment: http://stackoverflow.com/comment/37498252
type: Answer
has comment: http://stackoverflow.com/comment/37498931
has comment: http://stackoverflow.com/comment/37497932
downvote count: 0
has comment: http://stackoverflow.com/comment/37498055
score: 3
has body: x = i + y; The problem is that i is an Integer object and initializes to null. You can fix this issue by replacing: Integer i; With one of the following: int i; int i = 0; Integer i = 0;
upvote count: 3
answers question: http://stackoverflow.com/q/24271103

http://stackoverflow.com/a/24300068
accepted answer of: http://stackoverflow.com/q/24299707
answers question: http://stackoverflow.com/q/24299707
has body: Response Code 405: method Not Allowed one of the Methods GET/POST is disallowed, and you are using one of them check this
type: AcceptedAnswer
downvote count: 1
type: Answer
upvote count: 4
score: 3

http://stackoverflow.com/comment/37668962
comment on: http://stackoverflow.com/a/24360497
type: AnswerComment
has text: Maybe I am wrong but this is it { "v" : 1, "key" : { "copy" : 1 }, "ns" : "Test.MyCollection", "name" : "copy.url", "dropDups" : false, "sparse" : false }
score: 0
type: Comment

http://stackoverflow.com/q/24398620
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has body: i have made various research on this,plus,i'm using python,which i actually implement java in python script.Somehow,the record is send to the printer(i even got the message about this)but it does not print.can anyone help me on this,i'm stuck on this.thanks. This is the code,i got no error for this. import system import javax.print import java.io from java.lang import Thread filestream = java.io.BufferedInputStream(java.io.FileInputStream("C:/GEEKS.txt")) psInformat = javax.print.DocFlavor.INPUT_STREAM.AUTOSENSE myDoc = javax.print.SimpleDoc(filestream,psInformat,None) aset = javax.print.attribute.HashPrintRequestAttributeSet() aset.add(javax.print.attribute.standard.Copies(2)) services = javax.print.PrintServiceLookup.lookupDefaultPrintService() job = services.createPrintJob() job.print(myDoc, None) Thread.sleep(20000) filestream.close()
tagged with: python
accepted answer: http://stackoverflow.com/a/24398668
type: AnsweredQuestion
has title: The java printing code is working,send to printer but not print anything(java in python)
tagged with: java
tagged with: multithreading
upvote count: 1
type: Question
tagged with: ios
has answer: http://stackoverflow.com/a/24398668
tagged with: printing

http://stackoverflow.com/a/24305550
has comment: http://stackoverflow.com/comment/37569104
type: Answer
has comment: http://stackoverflow.com/comment/37570632
score: 2
accepted answer of: http://stackoverflow.com/q/24305109
has body: Normally if something goes wrong, the procedure would raise an exception. So if the procedure returns without exceptions, it was OK.
answers question: http://stackoverflow.com/q/24305109
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37570125

http://stackoverflow.com/q/24292004
has body: I am learning Slick2D, which perfectly serves my purposes of 2D Java game programming. Unfortunately, I have a problem. I don't think it's Slick2D specific, since I think the same happens with Java Graphics 2D. In Ubuntu (I'm using Ubuntu 12.04), pressing the Alt key shows the "Dash Home", the same as clicking on the top-left icon in the screen (Windows users, "Dash Home" is sort of "Start" menu). When my application runs, Alt key still has this behavior and shows the Dash Home. When my game runs in windowed mode, that's not a big deal, since I can go to a paused state. However, when in fullscreen mode, it is a big problem because the system leaves fullscreen and switching between fullscreen and windowed is time consuming and, roughly speaking, ugly. So, the question is: how can I prevent the Alt keypress to reach the OS, preventing Dash Home to open? In my code I handle keyPresses through the listener provided by Game2D and I don't call any superclass method, so, suposedly the keypress should not be informed to the OS. But... it is. I am not attaching any code as I don't think this is related to Slick2D, but a general Java issue. Any idea? Thanks! Edit: The problem still persists. I have posted the whole source code and binaries of the project here. If it doesn't help to find a solution to this, it may serve as a basic tutorial about Java game programming to other people.
favorite count: 0
answer count: 1
upvote count: 6
tagged with: fullscreen
has answer: http://stackoverflow.com/a/24710540
tagged with: java
tagged with: slick2d
has title: How can I prevent Alt key opening Dash Home while my Java app runs in Ubuntu?
downvote count: 0
type: UnansweredQuestion
score: 6
type: Question

http://stackoverflow.com/comment/37699605
type: Comment
comment on: http://stackoverflow.com/q/24377211
score: 3
has text: If you've done any search on this site on this sort of question, you'll invariably see that most recommend avoiding regex for HTML parsing, that instead you should use a better tool, an HTML parser such as JSoup. So,... why not?
type: QuestionComment

http://stackoverflow.com/a/24384434
answers question: http://stackoverflow.com/q/24383848
has comment: http://stackoverflow.com/comment/37714311
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24383848
score: 1
has comment: http://stackoverflow.com/comment/37713361
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Remove the line .addGap(0, 22, Short.MAX_VALUE) with .addGap(0, 0, Short.MAX_VALUE). Does this solve your problem? EDIT: Comment taken into consideration. I have changed the layout used a bit so that it works correctly. private void initComponents() { createToolBar = new javax.swing.JToolBar(); Help = new javax.swing.JButton(); tabbedPane = new javax.swing.JTabbedPane(); createMenuBar = new javax.swing.JMenuBar(); createMenu = new javax.swing.JMenu(); create = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); createToolBar.setRollover(true); // Commented for testing only - pls uncomment // Help.setIcon(new javax.swing.ImageIcon(getClass().getResource( // "/about.png"))); // NOI18N Help.setToolTipText(create.getText()); Help.setFocusable(false); Help.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); Help.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); createToolBar.add(Help); createMenu.setText("File"); create.setText("Create"); create.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { createActionPerformed(evt); } }); createMenu.add(create); createMenuBar.add(createMenu); setJMenuBar(createMenuBar); javax.swing.GroupLayout layout = new javax.swing.GroupLayout( getContentPane()); layout.setHorizontalGroup( layout.createParallelGroup(Alignment.LEADING) .addComponent(createToolBar, GroupLayout.DEFAULT_SIZE, 405, Short.MAX_VALUE) .addComponent(tabbedPane, GroupLayout.DEFAULT_SIZE, 415, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(createToolBar, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(2) .addComponent(tabbedPane, GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE)) ); getContentPane().setLayout(layout); pack(); }

http://stackoverflow.com/comment/37687648
type: AnswerComment
comment on: http://stackoverflow.com/a/24370950
has text: +1, I could not express this so briefly and so clearly.
score: 0
type: Comment

http://stackoverflow.com/comment/37654797
comment on: http://stackoverflow.com/a/24353098
has text: You should start using explicit `JOIN` syntax rather than the outdated (and fragile) implicit joins in the `WHERE` clause
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37816221
has text: I haven't actually tried any solvers for Java. "Has a solution" means that there is an assignment to the Boolean variables that makes the formula evaluate to true.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24406251

http://stackoverflow.com/q/24401008
answer count: 3
has answer: http://stackoverflow.com/a/24401051
tagged with: long-integer
tagged with: string
favorite count: 0
has body: My String result is: 3.1 I want to convert it into long : I use some code like : String txt_capplot="3.1"; Long.parseLong(String.valueOf(txt_capplot)); After Execute It made some error like: java.lang.NumberFormatException: For input string: "3.1" How to solve this?
score: 0
has answer: http://stackoverflow.com/a/24401175
has title: String to long: error : number format Exception:for Input String "3.1"?
accepted answer: http://stackoverflow.com/a/24401051
possible better answer: http://stackoverflow.com/a/24401081
has answer: http://stackoverflow.com/a/24401081
upvote count: 1
downvote count: 1
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/107041279
has text: better as as a question instead of posting on an existing thread
type: Comment
comment on: http://stackoverflow.com/a/60506779
score: 0
type: AnswerComment

http://stackoverflow.com/a/24302576
type: Answer
has comment: http://stackoverflow.com/comment/37560633
has comment: http://stackoverflow.com/comment/37560834
score: 0
answers question: http://stackoverflow.com/q/24302480
has body: Why not just replace line breaks with spaces, and on top of that, convert it all to lower case? String s = "hello"; String originalString = "Does this contain \n Hello?"; String formattedString = originalString.toLowerCase().replace("\n", " "); System.out.println(formattedString.contains(s)); Edit: Thinking about it, I don't really understand how line breaks make a difference... Edit 2: I was right. Line breaks don't matter. String s = "hello"; String originalString = "Does this contain \nHello?"; String formattedString = originalString.toLowerCase(); System.out.println(formattedString.contains(s));

http://stackoverflow.com/q/24316421
type: AnsweredQuestion
tagged with: soap-client
tagged with: java
tagged with: web-services
type: Question
has title: Websphere 8.x not able to identify axis 1.4 jar in WEB-INF/lib
has body: I have built and deployed a war file in websphere 8.5 server. All axis 1.4 related jars are placed in WEB-INF/lib folder. However when I run the application and try to access the code that calls the webservice I get below error. Same war file works fine in TOMCAT 7 server. I do see that axis.jar exist and contains axisfault.class. Please help. Caused by: java.lang.NoClassDefFoundError: org.apache.axis.AxisFault at java.lang.J9VMInternals.verifyImpl(Native Method) at java.lang.J9VMInternals.verify(J9VMInternals.java:93) at java.lang.J9VMInternals.initialize(J9VMInternals.java:170) at java.lang.Class.forNameImpl(Native Method) at java.lang.Class.forName(Class.java:179) at org.uddi4j.transport.TransportFactory.getTransport(TransportFactory.java:61) at org.uddi4j.client.UDDIProxy.send(UDDIProxy.java:1940) at org.uddi4j.client.UDDIProxy.find_service(UDDIProxy.java:888) at bofasecurity.UDDIHelper.getEndPoint(UDDIHelper.java:70) at bofasecurity.xxxxSecurityWrapper.buildBofASecurityWrapper(BofASecurityWrapper.java:273) at bofasecurity.xxxxSecurityWrapper.&lt;init&gt;(BofASecurityWrapper.java:212) at bofasecurity.xxxxSecurityWrapper$Builder.build(BofASecurityWrapper.java:179) at com.ml.grci.service.impl.SearchACCLServiceImpl.buildSecWrapper(SearchACCLServiceImpl.java:721) at com.ml.grci.service.impl.SearchACCLServiceImpl.searchACCL(SearchACCLServiceImpl.java:160) at com.ml.grci.webapp.action.ACCLSearchAction.execute(ACCLSearchAction.java:233) ... 83 more Caused by: java.lang.ClassNotFoundException: org.apache.axis.AxisFault at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) at java.lang.ClassLoader.loadClass(ClassLoader.java:650)
accepted answer: http://stackoverflow.com/a/24346978
score: 0
tagged with: websphere
tagged with: axis
linked to: http://stackoverflow.com/q/21421916
answer count: 1
has answer: http://stackoverflow.com/a/24346978

http://stackoverflow.com/comment/37666291
score: 0
comment on: http://stackoverflow.com/q/24359399
type: QuestionComment
has text: Have you tried doing any debugging yourself?
type: Comment

http://stackoverflow.com/q/24321175
has answer: http://stackoverflow.com/a/24321253
accepted answer: http://stackoverflow.com/a/24321253
has body: When I checked my GAE logs from Google Console I can see the error below. However my app works find with GWT dev mode and also when deployed in localhost, so I am curious as to what is the issue that is causing this: Uncaught exception from servlet java.lang.NoClassDefFoundError: Could not initialize class org.jboss.errai.jaxrs.ErraiProvider at com.google.appengine.runtime.Request.process-0c118cfa1dca4123(Request.java) 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:33) at org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:132) at org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:1801) at org.jboss.resteasy.spi.ResteasyProviderFactory.addMessageBodyReader(ResteasyProviderFactory.java:681) at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1128) at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1085) at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1029) at org.jboss.resteasy.spi.ResteasyDeployment.registerProvider(ResteasyDeployment.java:508) at org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:316) at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:226) at org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap.contextInitialized(ResteasyBootstrap.java:28) at My config is here: https://community.jboss.org/thread/232585 And the pom.xml have this: org.jboss.errai errai-jaxrs-provider ${version.errai}
score: 0
answer count: 1
has title: Google App Engine - NoClassDefFoundError: Could not initialize class org.jboss.errai.jaxrs.ErraiProvider
tagged with: google-app-engine
tagged with: maven
tagged with: gwt
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: errai

http://stackoverflow.com/a/24321760
upvote count: 0
answers question: http://stackoverflow.com/q/24319978
score: -1
has body: Your query seems wrong: why do you want to compare IP address as numeric value to anything? IP addresses are not something that you can meaningfully compare. However, since you are using map data already (as you have lat, long, etc), that means you should be using spatial extensions. Good news is that spatial index allows you to execute queries of this exact kind very efficiently. You should already have created spatial index on (lat, long) or using (lat, long) as composite type POINT - this allows you to execute coordinate based search quickly. If you still want to compare IP addresses, you can treat tuple (start_ip, end_ip) as spatial POINT and execute search for this point belonging to range you specify. This will give you maximum performance possible. You can read more about spatial extensions here.
downvote count: 1
type: Answer

deserialization
type: Tag
tag name: deserialization
tags question: http://stackoverflow.com/q/24310205
tags question: http://stackoverflow.com/q/24400114
tags question: http://stackoverflow.com/q/24324864

http://stackoverflow.com/q/24385149
accepted answer: http://stackoverflow.com/a/24526458
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: servlets
has answer: http://stackoverflow.com/a/24526458
possible better answer: http://stackoverflow.com/a/24385240
has comment: http://stackoverflow.com/comment/37714084
has answer: http://stackoverflow.com/a/24385240
has comment: http://stackoverflow.com/comment/37833501
has title: getCurrentSession NullPointerException
score: 0
has answer: http://stackoverflow.com/a/24398834
has body: Stacktrace: java.lang.NullPointerException at de.mail.HibernateUtil.getSession(HibernateUtil.java:30) at de.mail.gui.LoginServlet.doPost(LoginServlet.java:55) at javax.servlet.http.HttpServlet.service(HttpServlet.java:641) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) HibernateUtil: public abstract class HibernateUtil extends HttpServlet{ private static final long serialVersionUID = -1850678939342717642L; @Autowired private SessionFactory sessionFactory; /** * Gibt die derzeitige Session zurück * * @return derzeitige Session * @throws HibernateException */ public Session getSession() { return sessionFactory.getCurrentSession(); } } LoginServlet…
answer count: 4
has answer: http://stackoverflow.com/a/24420868
tagged with: tomcat7
tagged with: spring

http://stackoverflow.com/comment/37498870
type: Comment
has text: It is also a good thing to override `hashcode()` in such a case. Josh Bloch provides a very good explanation on this in his Effective Java book.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24271632

http://stackoverflow.com/comment/37735740
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24395611
type: Comment
has text: By constantly transmitting noise only the person receiving the data who already had the OTP could know if a message was even being transmitted. If the volume of noise is sufficient, and the noise to signal rate is sufficiently high an attacker would have to store ALL of the transmitted data if they subsequently came into possession of a key to find the messages that had been sent. I only use the OTP when I'm actually sending a message. If the noise is randomly delayed before transmission to frustrate timing analysis only capture of the OTP and recording of all the data will work.

http://stackoverflow.com/a/24412377
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37765667
has comment: http://stackoverflow.com/comment/37767439
has body: Stack is a generic type, and it only has a constructor with no arguments. You need to push your data on the stack: Stack&lt;Rock&gt; stack = new Stack&lt;Rock&gt;();//use new Stack&lt;&gt;() in Java 7 (diamond inference) stack.push(r1); stack.push(r2); stack.push(r3); This will result in a stack with r3 on top. You can reverse the push instructions if you want r1 on top. The generics (the &lt;&gt; part) specifies the type of elements your stack will contain. If you use Rock (like in the above example), you can only push rocks on the stack. The advantage is however that you are sure that when you pop an element, it's a rock. If you for instance want to create a stack with several elements (String,...) you can use object: Stack&lt;Object&gt; stack = new Stack&lt;&gt;(); stack.push(r1);//rock at the bottom stack.push("Second item"); stack.push(r2); stack.push((Integer) 2); stack.push("Four elements already"); stack.push(r3); The disadvantage of this is of course that you cannot determine at compile time the type of element you will pop from the stack. You can iterate over an Stack using the Stack&lt;T&gt;.iterator method: Stack&lt;Rock&gt; stack = new Stack&lt;Rock&gt;(); stack.push(r1); stack.push(r2); stack.push(r3); Iterator&lt;Rock&gt; iter = stack.iterator(); while(iter.hasNext()) { Rock r = iter.next(); //do something with the current rock } In modern versions of Java (probably since Java 7) you can use a foreach-construct: Stack&lt;Rock&gt; stack = new Stack&lt;Rock&gt;(); stack.push(r1); stack.push(r2); stack.push(r3); for(Rock r : stack) { //do something with the current rock } Notice that an iterator for a stack works top-to-bottom. So r3 will be iterated first.
type: Answer
upvote count: 9
has comment: http://stackoverflow.com/comment/37765550
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24412329
answers question: http://stackoverflow.com/q/24412329
score: 9

http://stackoverflow.com/q/24414722
tagged with: constructor
tagged with: super
has body: I have a quick question regarding how super() is used in a constructor. I know the basics about how it will call a superclass but I recently looked at some code and don't understand how it is being used in this example. Here's the gist of the part that confuses me: public class MyClass implements MyInterface { String myString = null; public MyClass() { super(); } public MyClass(String A) { super(); myString = A; } public interfaceMethod { // this is the method from MyInterface } } I understand how the constructors are being used and all but I just don't see the point to the super() methods in them. Does it have to do with the interface that it's implementing? I thought super() was used if a class extends something? Am I missing some basic knowledge about java here? Any help for a noob would be much appreciated. Thanks!
duplicate of: http://stackoverflow.com/q/3767365
downvote count: 1
type: AnsweredQuestion
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/24414738
type: Question
has answer: http://stackoverflow.com/a/24414895
score: 4
has title: How does super() work in a constructor
favorite count: 0
accepted answer: http://stackoverflow.com/a/24414738
possible better answer: http://stackoverflow.com/a/24414777
has answer: http://stackoverflow.com/a/24415310
has answer: http://stackoverflow.com/a/24414777
answer count: 4
linked to: http://stackoverflow.com/q/3767365

http://stackoverflow.com/comment/37742953
comment on: http://stackoverflow.com/a/24382975
type: AnswerComment
has text: Do you mean this? [gist github](https://gist.github.com/Lybrial/6431ae8a552f63100f5c)
type: Comment
score: 0

http://stackoverflow.com/comment/37545273
comment on: http://stackoverflow.com/q/24295357
score: 0
type: Comment
has text: Under EDIT#3 I have posted code. I have added a few comments and some ??? where I am not sure how to do what I'm trying to do. What I want to do is be able to pass any "Something.class" so Gson can parse it and then have the Callback interface also use that class as the parameter.
type: QuestionComment

http://stackoverflow.com/comment/37803297
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24413938
has text: If you have problems with trunk you should tell the team so it can be fixed. 2.0 will be based on trunk... You are building with "mvn clean install"?

search-engine
type: Tag
tags question: http://stackoverflow.com/q/24417000
tag name: search-engine
tags question: http://stackoverflow.com/q/24411787

jtextfield
tags question: http://stackoverflow.com/q/24375071
tags question: http://stackoverflow.com/q/24341248
tags question: http://stackoverflow.com/q/24344633
tags question: http://stackoverflow.com/q/24349534
tags question: http://stackoverflow.com/q/24346146
tag name: jtextfield
type: Tag

http://stackoverflow.com/q/24421040
favorite count: 0
has answer: http://stackoverflow.com/a/24421086
type: Question
has title: How to write Java generic method with E... elements and return List<E>
tagged with: java
answer count: 2
has body: I want to write a method as follow public static &lt;E&gt; ArrayList&lt;E&gt; newList(E... elements){ ArrayList&lt;E&gt; list = new ArrayList&lt;E&gt;(elements.length); addAll(list,elements); return list; } It works when I use it like this List&lt;String&gt; a = ListUtils.newList("a","b"); But it can't be compile in this case List&lt;Class&gt; c = ListUtils.newList(String.class,Long.class); How can I to fix this problem ? Thank you !
upvote count: 1
has comment: http://stackoverflow.com/comment/37782060
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/37783060
score: 1
tagged with: generics
has answer: http://stackoverflow.com/a/24421089

http://stackoverflow.com/q/24304532
type: Question
tagged with: mongodb
has comment: http://stackoverflow.com/comment/37565559
has answer: http://stackoverflow.com/a/24368572
answer count: 1
has body: I am using MongoJack (2.0.0) to serialize/deserialize objects from MongoDB. According http://mongojack.org/index.html MongoJack should support @javax.persistance.Id. I have annotated object variable with @Id @Id private String id; When I try to save the object with a valid id jacksonDBCollection.save(myEntity); The object is saved as new document instead of updating the existing one. I do use custom deserializer but no serializer in my module: ObjectMapper objectMapper = new ObjectMapper(); SimpleModule module = new SimpleModule("MyModule", Version.unknownVersion()); module.addDeserializer(MyEntity.class, new MyEntityJsonDeserializer()); objectMapper.registerModule(module); return objectMapper; I have debugged some code and see that the id is treated as String instead of ObjectId when calling jacksonDBCollection.save(myEntity). It looks that support for @javax.persistance.Id doesn't work. I have tried to find the source where this is supported but no luck. Can anyone point me the source where this is supported and/or let me know what I am doing wrong? Cheers.
downvote count: 0
favorite count: 0
tagged with: mongojack
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
has title: MongoJack support @javax.persistance.Id doesn't work

http://stackoverflow.com/a/24368750
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24368627
has body: for (int i = 0; i &lt; o; i++) { boolean unique = false; for (int j = 1; j &lt; o; j++) { if (signatureList.get(i).equals(signatureList.get(j))) {// the culprit is here //we find two equals strings, it is unique unique = true; break; } } The above code is giving you problems. signatureList.get(i).equals(signatureList.get(j) will be true atleast one time for all the elements of signatureList. So , all elements are added to your unique List.

http://stackoverflow.com/a/24306692
downvote count: 0
answers question: http://stackoverflow.com/q/24306564
has comment: http://stackoverflow.com/comment/37566682
upvote count: 3
has comment: http://stackoverflow.com/comment/37581790
type: Answer
has comment: http://stackoverflow.com/comment/37581744
has body: Use Swing Timer instead of Thread.sleep() and Java Timer in a Swing application that sometime hangs the Swing applicaion. Read more How to Use Swing Timers Sample code: private Timer timer; ... timer = new javax.swing.Timer(3000, new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { //do what ever you want to do // call timer.stop() when the condition is matched } }); timer.setRepeats(true); timer.start(); EDIT Please have a look at my another post How to fix animation lags in Java?
score: 3
has comment: http://stackoverflow.com/comment/37581052
has comment: http://stackoverflow.com/comment/37581018
has comment: http://stackoverflow.com/comment/37572902

http://stackoverflow.com/q/24358864
has comment: http://stackoverflow.com/comment/37665459
has comment: http://stackoverflow.com/comment/37665424
tagged with: arrays
possible better answer: http://stackoverflow.com/a/24358903
answer count: 6
has body: Let's say we defined an array with 20 elements. is there any way we can add some objects to the array, without any specific order of course and not just once like String[] t= {"one", "two", ..., "twenty"} ? String[] t = new String[20]; //I know this won't work //but something like this: //t = {"one", "two", "three"} //and later, add some more //t = {"four"} ...
has comment: http://stackoverflow.com/comment/37665479
score: 0
has comment: http://stackoverflow.com/comment/37665553
has answer: http://stackoverflow.com/a/24358913
upvote count: 1
has title: add elements to Java Array
has answer: http://stackoverflow.com/a/24359059
accepted answer: http://stackoverflow.com/a/24358908
downvote count: 1
has comment: http://stackoverflow.com/comment/37665438
favorite count: 0
has answer: http://stackoverflow.com/a/24358905
has comment: http://stackoverflow.com/comment/37665369
has answer: http://stackoverflow.com/a/24358908
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37665562
has comment: http://stackoverflow.com/comment/37665352
has comment: http://stackoverflow.com/comment/37665743
has answer: http://stackoverflow.com/a/24358903
has answer: http://stackoverflow.com/a/24358910
type: Question
has comment: http://stackoverflow.com/comment/37665647

http://stackoverflow.com/a/39726456
answers question: http://stackoverflow.com/q/24423092
has comment: http://stackoverflow.com/comment/118498272
has body: All independent methods (that do not have @dependsOnMethods dependency) will be executed first. Then methods with dependency will be executed. If there is ambiguity in execution order even after this ordering, priority comes into picture. This is the ordering scheme: Execute all independent methods (methods without @dependsOnMethods annotation) If there is ambiguity in this ordering use priority to resolve ambiguity for independent methods Execute dependent methods in order of dependency If there is ambiguity in this ordering use priority to resolve ambiguity for dependent methods If there is still ambiguity (due to not using priority or two methods having same priority) order them based on alphabetical order. Now all ambiguity is resolved since no two methods can have the same name.
score: 9
upvote count: 9
has comment: http://stackoverflow.com/comment/118371259
type: Answer
has comment: http://stackoverflow.com/comment/118371158
downvote count: 0

http://stackoverflow.com/q/24377641
answer count: 1
has comment: http://stackoverflow.com/comment/37700425
has title: Java Swing JSplitPane not showing as intended
has answer: http://stackoverflow.com/a/24377785
has comment: http://stackoverflow.com/comment/37700309
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/37700455
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/37700381
has comment: http://stackoverflow.com/comment/37700476
has body: I'm trying to make a program thats based upon 5 Jsplitpanes and internal components, but they don't seem to get along well. Since when I run the application all the split panes are concentrated on the upper left corner The code is really simple: projectExplorer = new ProjectExplorer(); editorExplorer = new EditorExplorer(); favDownload = new FavDownload(); favDownloadExplorer = new FavDownloadExplorer(); //Define the listeners addComponentListener(new ResizeListener()); horTopPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); horTopPane.setLeftComponent(projectExplorer); horTopPane.setRightComponent(editorExplorer); horBotPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); horBotPane.setLeftComponent(favDownload); horBotPane.setRightComponent(favDownloadExplorer); verticalPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); verticalPane.setTopComponent(horTopPane); verticalPane.setBottomComponent(horBotPane); setContentPane(verticalPane); new Timer().schedule(new TimerTask() { @Override public void run() { resizeComponents(); } }, 100); the resizeComponents method is public void resizeComponents(){ int width = getWidth(); int height = getHeight(); horTopPane.setMinimumSize(new Dimension(width, (height/2)+(height/4))); horTopPane.setSize(horTopPane.getMinimumSize()); horBotPane.setMinimumSize(new Dimension(width, (height/8))); horBotPane.setSize(horBotPane.getMinimumSize()); projectExplorer.setMinimumSize(new Dimension(width/8, horTopPane.getHeight())); projectExplorer.setSize(projectExplorer.getMinimumSize()); editorExplorer.setMinimumSize(new Dimension(width/2, horTopPane.getHeight())); editorExplorer.setSize(editorExplorer.getMinimumSize()); favDownload.setMinimumSize(new Dimension(width/8, horBotPane.getHeight())); favDownload.setSize(favDownload.getMinimumSize()); favDownloadExplorer.setMinimumSize(new Dimension(width/2, horBotPane.getHeight())); favDownloadExplorer.setSize(favDownloadExplorer.getMinimumSize()); } it started just as setSize, but for some reason it…
linked to: http://stackoverflow.com/q/7229226
score: 0
tagged with: user-interface

http://stackoverflow.com/comment/89198410
type: AnswerComment
type: Comment
has text: Could you post a code excerpt? Doing as you are but only one transaction ever commits at the end of the test
comment on: http://stackoverflow.com/a/24341843
score: 0

http://stackoverflow.com/a/24297509
has comment: http://stackoverflow.com/comment/37571023
type: Answer
has comment: http://stackoverflow.com/comment/37565424
downvote count: 0
score: 1
has body: For the first question, basically what Alex said. It should not make much of a difference if you choose Java or pthreads. For the second question, you should stash a pointer to the created libraries in your Java code. The easiest way is for your Jni call to return this pointer as a jlong. But since, your jni function never returns, you will have to directly set the value in the native code. Checkout the implementation of the NativeHandle class here http://thebreakfastpost.com/2012/01/26/wrapping-a-c-library-with-jni-part-2/ Then before the main activity exits (I presume in the onDestroy() method) make a call to a jni function to stop libraries from running
answers question: http://stackoverflow.com/q/24295599
has comment: http://stackoverflow.com/comment/37571040
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24295599

http://stackoverflow.com/q/24344316
answer count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37636908
has comment: http://stackoverflow.com/comment/37637115
has comment: http://stackoverflow.com/comment/37636732
accepted answer: http://stackoverflow.com/a/24350489
has comment: http://stackoverflow.com/comment/37636756
has comment: http://stackoverflow.com/comment/37636527
has comment: http://stackoverflow.com/comment/37637155
has comment: http://stackoverflow.com/comment/37636666
type: Question
has comment: http://stackoverflow.com/comment/37636964
has comment: http://stackoverflow.com/comment/37636588
has comment: http://stackoverflow.com/comment/37636553
has body: I have three classes which I need to test. In fact I need to write some unit tests to cover all functionality of this classes. But the problem is I don't know from what point I need to start. In my case It's really important to use Mockito framework. So I would be appriciated for any help. Here is my classes public class Girl extends Father { protected Girl(Info info) { super(info); } public Boy create(String param) { return new Boy(info, param); } } Boy class public class Boy extends Father { private final String param; public Boy(Info info, String param) { super(info); this.param = param; } public void method (){ new RemoteService().invoke(param); } } Info class (this class I don't need to test) public class Info { private Integer accountNumber; public Integer getAccountNumber() { return accountNumber; } public void setAccountNumber(Integer accountNumber) { this.accountNumber = accountNumber; } } And Father class public abstract class Father { protected final Info info; public Father(Info info) { this.info = info; } }
has comment: http://stackoverflow.com/comment/37636601
possible better answer: http://stackoverflow.com/a/24345275
has comment: http://stackoverflow.com/comment/37636837
has comment: http://stackoverflow.com/comment/37636864
has answer: http://stackoverflow.com/a/24345275
tagged with: java
score: 0
has title: How can I use Mockito for unit testing in case with inheritance?
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/37636600
has comment: http://stackoverflow.com/comment/37636541
has comment: http://stackoverflow.com/comment/37636566
has answer: http://stackoverflow.com/a/24350489
has comment: http://stackoverflow.com/comment/37636593
tagged with: mockito
has comment: http://stackoverflow.com/comment/37636811
has comment: http://stackoverflow.com/comment/37636637

http://stackoverflow.com/a/24410607
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24409669
answers question: http://stackoverflow.com/q/24409669
upvote count: 1
score: 1
has body: You need something like this: &lt;constructor-arg ref="#{systemProperties.variable == 'true' ? 'DataSource1' : 'DataSource2'}" /&gt; where "variable" is set like -Dvariable=true.
type: AcceptedAnswer

http://stackoverflow.com/comment/37634050
type: AnswerComment
has text: Not me, I am planning on selecting it as the valid answer as soon as StackOverflow allows me to.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24343011

http://stackoverflow.com/q/24363991
has comment: http://stackoverflow.com/comment/37675499
has title: Add two Integers up to 50 digits
has comment: http://stackoverflow.com/comment/37675249
has comment: http://stackoverflow.com/comment/37675331
has comment: http://stackoverflow.com/comment/37674952
tagged with: java
has body: This is the actual question: Write an interactive program that adds two integers of up to 50 digits each (Represents integer as an array of digits). This is a homework question and the language to be used is Java. I got this far but I don't think it is even close. 1. It is not taking input more than 20 digits but have to work with 50 digits. 2. The method 'integerToDigits' is producing two arrays but i am unable to sort out how to use them and add them in the main method. Help please. package One; import java.util.Scanner; public class AddInt { public static void main(String[] args) { Long x,y; Long a[] = new Long[50]; Long b[] = new Long[50]; System.out.println("Please enter two numbers which have no more than 50 digits: "); Scanner s = new Scanner(System.in); x = s.nextLong(); y = s.nextLong(); System.out.println(x+ "and "+y); integerToDigits(x); integerToDigits(y); } public static Long[] integerToDigits(Long n){ Long digits[] = new Long[50]; Long temp = n; for(int i = 0; i &lt; 50; i++){ digits[49-i] = temp % 10; temp /= 10; } return digits; } }
has comment: http://stackoverflow.com/comment/37675412
possible better answer: http://stackoverflow.com/a/24364364
has comment: http://stackoverflow.com/comment/37675144
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24365201
has answer: http://stackoverflow.com/a/24364364
tagged with: arrays
type: Question
has comment: http://stackoverflow.com/comment/37674480
has comment: http://stackoverflow.com/comment/37678897
has comment: http://stackoverflow.com/comment/37677604
tagged with: integer
has comment: http://stackoverflow.com/comment/37674710
has comment: http://stackoverflow.com/comment/37674409
score: 0
answer count: 2
tagged with: addition
has answer: http://stackoverflow.com/a/24365201

http://stackoverflow.com/comment/37518958
comment on: http://stackoverflow.com/q/24279620
type: Comment
type: QuestionComment
has text: @m88: Thanks for your help. Combining to your advise, i fix my step that: Step 1: gcc -o cSource.dll -shared cSource.c Step 3: java -classpath C:\;C:\jna.jar Example (file jna.rar locate in C drive, and i had consulted [link](http://en.wikipedia.org/wiki/Classpath_%28Java%29#Setting_the_path_of_a_Jar_file))
score: 0

http://stackoverflow.com/comment/37511773
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24278474
has text: @Jigar Joshi - I don't see how my post is unclear to you. R.J. - Got it. Thank you very much.
score: 0

http://stackoverflow.com/a/24292349
answers question: http://stackoverflow.com/q/24291174
accepted answer of: http://stackoverflow.com/q/24291174
type: AcceptedAnswer
type: Answer
has body: The below code should solve your problem with nested tags: Updated code: Document doc = Jsoup.parse(html, "", Parser.xmlParser()); for (Element el : doc.select("*")){ if (!el.ownText().isEmpty()){ for (TextNode node : el.textNodes()) node.remove(); } } System.out.println(doc);
score: 8
downvote count: 0
upvote count: 8

http://stackoverflow.com/a/24336841
has body: UPDATE: This answer is in response to the original question, Does Java SE 8 have Pairs or Tuples? (And implicitly, if not, why not?) The OP has updated the question with a more complete example, but it seems like it can be solved without using any kind of Pair structure. [Note from OP: here is the other correct answer.] The short answer is no. You either have to roll your own or bring in one of the several libraries that implements it. Having a Pair class in Java SE was proposed and rejected at least once. See this discussion thread on one of the OpenJDK mailing lists. The tradeoffs are not obvious. On the one hand, there are many Pair implementations in other libraries and in application code. That demonstrates a need, and adding such a class to Java SE will increase reuse and sharing. On the other hand, having a Pair class adds to the temptation of creating complicated data structures out of Pairs and collections without creating the necessary types and abstractions. (That's a paraphrase of Kevin Bourillion's message from that thread.) I recommend everybody read that entire email thread. It's remarkably insightful and has no flamage. It's quite convincing. When it started I thought, "Yeah, there should be a Pair class in Java SE" but by the time the thread reached its end I had changed my mind. Note however that JavaFX has the javafx.util.Pair class. JavaFX's APIs evolved separately from the Java SE APIs. As one can see from the linked question What is the equivalent of the C++ Pair in Java? there is quite a large design space surrounding what is apparently such a simple API. Should the objects be immutable? Should they be serializable? Should they be comparable? Should the class be final or not? Should the two elements be ordered? Should it be an interface or a class? Why stop at pairs? Why not triples, quads, or N-tuples? And of course there is the inevitable naming bikeshed for the elements: (a, b) (first, second) (left, right) (car, cdr) (foo, bar) etc. One bi…
upvote count: 252
has comment: http://stackoverflow.com/comment/37624699
answers question: http://stackoverflow.com/q/24328679
has comment: http://stackoverflow.com/comment/37686529
has comment: http://stackoverflow.com/comment/109368863
has comment: http://stackoverflow.com/comment/92935182
has comment: http://stackoverflow.com/comment/37707240
accepted answer of: http://stackoverflow.com/q/24328679
has comment: http://stackoverflow.com/comment/37624562
has comment: http://stackoverflow.com/comment/68290643
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37623234
has comment: http://stackoverflow.com/comment/71073562
score: 250
has comment: http://stackoverflow.com/comment/37669777
type: Answer
has comment: http://stackoverflow.com/comment/37624515
downvote count: 2
has comment: http://stackoverflow.com/comment/57400133

http://stackoverflow.com/q/24372599
has body: I am trying to understand how interfaces work. I have read basic interface tutorials online and watched a few videos so i do have a good idea of what a interface is and its advantages. However i came across this piece of code that is utilizing interface feature and am having trouble getting my head around some of it. So i needed someone to just breakdown what exactly is happening. I will also write down what i understand of it so far so if i am wrong you can correct me. Here is the Code. Bank Account Class package Interface; public class BankAccount implements Measurable { private double balance; public BankAccount() { balance = 0; } public BankAccount(double initialBalance) { balance = initialBalance; } public void deposit(double amount) { double newBalance = balance + amount; balance = newBalance; } public void withdraw(double amount) { double newBalance = balance - amount; balance = newBalance; } public double getBalance() { return balance; } public double getMeasure() { return balance; } } Coin Class package Interface; public class Coin implements Measurable { private double value; private String name; public Coin(double aValue, String aName) { value = aValue; name = aName; } public double getValue() { return value; } public String getName() { return name; } public double getMeasure() { return value; } } Interface package Interface; public interface Measurable { double getMeasure(); } Data Set Class package Interface; public class DataSet { private double sum; private Measurable maximum; private int count; public DataSet() { sum = 0; count = 0; maximum = null; } public void add(Measurable x) { sum = sum + x.getMeasure(); if (count == 0 || maximum.getMeasure() &lt; x.getMeasure()) maximum = x; count++; } public double getAverage() { if (count == 0) return 0; else return sum / count; } public Measurable getMaximum() { return maximum; } } Test Class package Interface; public class Test { public static void main(String[] args) { DataSet bankData = new DataSet(); ban…
linked to: http://stackoverflow.com/q/383947
downvote count: 1
type: Question
tagged with: java
has title: How interface works in this code?
score: 0
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/24372767
favorite count: 0
tagged with: interface
has comment: http://stackoverflow.com/comment/37690843
has answer: http://stackoverflow.com/a/24372721
accepted answer: http://stackoverflow.com/a/24372721
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24372767
has comment: http://stackoverflow.com/comment/37691987

http://stackoverflow.com/a/24279744
upvote count: 1
answers question: http://stackoverflow.com/q/24279645
score: 1
downvote count: 0
has body: InnerClass#innerField is not necessary of the same type as OuterClass#outerField, since the inner T parameter is hiding the outer one.
type: Answer

http://stackoverflow.com/a/24324112
type: Answer
answers question: http://stackoverflow.com/q/24323982
has body: NullPointerExcception it causes because using null object or not defining value to object. In Loading.java you have used setContentView(R.layout.loading_main); that don't have button1 add button1 in loading_main.xml it or Change layout in setContentView(R.layout.other_layout);
score: 0

http://stackoverflow.com/a/24412341
downvote count: 0
type: Answer
upvote count: 1
has body: JSP page refers to a "top-level JSP file", which, as defined in JSP.1.1.8: invoked directly by the client or dynamically included by another page or servlet While JSP file may refer to a file which, for example, gets statically included. To illustrate your quote, consider following directory structure: dir/ file1.jsp file2.jsp file2.jsp index.jsp Let's say you have &lt;%@include file="dir/file1.jsp" %&gt; in your index.jsp. If you put &lt;%@include file="file2.jsp" %&gt; in dir/file1.jsp, it will include dir/file2.jsp, while if you put &lt;jsp:include page="file2.jsp" /&gt;, it will include file2.jsp next to index.jsp.
answers question: http://stackoverflow.com/q/24411770
score: 1

http://stackoverflow.com/q/24416199
favorite count: 0
has answer: http://stackoverflow.com/a/24419790
tagged with: android
type: AnsweredQuestion
has title: Communication between Activity to multiple fragments in android
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/24419790
answer count: 2
possible better answer: http://stackoverflow.com/a/24416567
has answer: http://stackoverflow.com/a/24416567
downvote count: 0
has body: I am making a history activity that implements fragments with a For cycle into a linear layout. In that history activity, I have a horizontal scrollbar that when I click a view it returns the index of the view. Then I send it by a listener to a fragment, but the problem is that I have multiple fragments, and only one fragment is getting the response. I want all of the fragments to receive the call. How do I fix this? This is the for that I have in my history activity: OnCustomEventListener mListener; View.OnClickListener myClickListener = new OnClickListener(){ @Override public void onClick(View v) { // here is where I get the index of the scroll bar indexChild = ((ViewGroup) uno.getParent()).indexOfChild(v); // here is where I call the method of the interface mListener.onEvent(indexChild); }}; // here is where i set the fragments to the linear layout for(i = 0; i&lt;cant;i++){ if(Utils.History_Thread == false) { final Fragment Frag = new PlaceholderFragment(); Bundle bundle = new Bundle(); bundle.putInt("dispositivo", dev); bundle.putInt("row",i); Frag.setArguments(bundle); getSupportFragmentManager().beginTransaction() .add(R.id.container, Frag).commit(); try { sleep(150); } catch (InterruptedException e) { e.printStackTrace(); } } else { break; } } This is the fragment: public class PlaceholderFragment extends org.holoeverywhere.app.Fragment implements ScrollViewListener,OnCustomEventListener { private static LinearLayout padre; OnHeadlineSelectedListener mCallback; @Override public void onAttach(Activity activity) { super.onAttach(activity); // This makes sure that the container activity has implemented // the callback interface. If not, it throws an exception try { more.. implementations // here is when i implement the listener of mListener of History Activ. ((History)activity).mListener = this; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " implement headlistener); } } // here I override the method and set the background …

http://stackoverflow.com/comment/37757994
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24408481
has text: What do you mean by elements here? Lines?
score: 0

http://stackoverflow.com/comment/37626693
type: QuestionComment
has text: @Bayant_singh Something like [this](https://research.microsoft.com/en-us/projects/contracts/). There's still research going on about it, but take a look. I don't know much about them because I haven't used them, but I've heard about them and they sound vaguely like what you were expecting.
score: 0
comment on: http://stackoverflow.com/q/24339130
type: Comment

http://stackoverflow.com/comment/37543006
comment on: http://stackoverflow.com/q/24293947
score: 0
type: Comment
type: QuestionComment
has text: As far as I know the website uses javascript to display the result. I'm pretty sure jsoup doesn't execute javascript before parsing. The result div is simply empty when no javascript is executed. I guess you have to investigate the ajax they're using to get the result.

http://stackoverflow.com/comment/37516915
score: 0
has text: Your controller is flawed you are storing state in a singleton controller. What happens when 100 users issue a request to the `MultiCurrencyController`? Never keep state.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24278425

http://stackoverflow.com/q/24319448
score: 0
tagged with: java
tagged with: save
tagged with: filewriter
tagged with: file
type: UnansweredQuestion
type: Question
tagged with: android
has body: Okay, so I've got a couple of data files for an android app. The files contain lists of items and variables for each, so I don't think using the "Key-Value" method would work very well. I originally had the files in the "raw" folder, but then I learned that you can't write to that location and this file does need to be updatable. I now have it reading and writing from (afaik) the root directory of my program's internal storage (File file = new File(getApplicationContext().getFilesDir(), "settings.txt"); ), and that works alright. But what I'd like to be able to do is have a default settings file that is placed when I install/update the app. For example, when I was using the "raw" folder, I could put a file in the "raw" directory on my computer and have it show up when I run the app. Can I get this behaviour with a location my app can also write to, and if so, how? Edit: OK to try and clarify, what I'm looking for is a location that I can a) have my app read and write data to on my phone b) can have a file put in that location when the app is installed/updated, like you can put a file in the raw folder on your PC and have your app able to read it. I just want to know if this is possible.
has title: Where to put a settings file?
has answer: http://stackoverflow.com/a/24319545
answer count: 1

android-gridview
type: Tag
tags question: http://stackoverflow.com/q/24365771
tag name: android-gridview

http://stackoverflow.com/comment/37693600
comment on: http://stackoverflow.com/q/24373877
type: QuestionComment
type: Comment
score: 1
has text: Btw: Type declarations should use the interface (List), not the implementation (ArrayList).

http://stackoverflow.com/q/24353092
score: 2
answer count: 1
downvote count: 0
has title: How many jvm is launched per node in a hadoop cluster if mapred.job.reuse.jvm.num.tasks is set to -1
tagged with: jvm
favorite count: 0
upvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24353623
tagged with: java
has body: I recently saw mapred.job.reuse.jvm.num.tasks property of hadoop. By default it is set to +1 which means a new JVM is launched per map/reduce task. On the contrary, if it is set to -1 then a jvm can be used by unlimited number of tasks. In this case tasks executes serially one after other in order to use the same JVM. So, when the property is set to +1 number of JVM launched per node equals the number of task. There is no confusion.... But, my specific question is, how many JVM is launched per node if I set mapred.job.reuse.jvm.num.tasks to -1. Is it only ONE JVM per node? or something else?
type: Question
tagged with: hadoop
accepted answer: http://stackoverflow.com/a/24353623

http://stackoverflow.com/comment/37774924
comment on: http://stackoverflow.com/q/24416784
type: Comment
type: QuestionComment
score: 0
has text: My goal is to prevent is both unnecessary reference passing and protecting the instantiation. init is meant to be called only once. How am I instantiating more than once?

http://stackoverflow.com/comment/37631165
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24341630
has text: Like this: `static class Fact` (`MyClass.Fact`) and `class EnclosedFact` (`new MyClass().EnclosedFact`).
score: 0

http://stackoverflow.com/a/24385299
has comment: http://stackoverflow.com/comment/37714604
has comment: http://stackoverflow.com/comment/37714718
answers question: http://stackoverflow.com/q/24385198
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37714627
has body: The code for main method should look like this public class Test { public static void main(String[] args) { Wat wat = new Wat("Test"); wat.init(); System.out.println("wat"); } } Simply, run the UI code on the main thread. Use separate threads for long running operations started from UI. See tutorial for SwingWorker.

http://stackoverflow.com/a/24411503
has comment: http://stackoverflow.com/comment/37763896
type: Answer
has comment: http://stackoverflow.com/comment/37764062
has body: The javadoc states that an exception is expected "if there is no transaction when invoked on a container-managed entity manager of that is of type PersistenceContextType.TRANSACTION" Your context is managed by Spring which I don't believe is a Java EE container, and so the same rule does not apply, and the context is probably defaulting to extended so that it holds objects until joined to a transaction. If you want to force an exception when a transaction isn't available, call em.flush() after the persist.
has comment: http://stackoverflow.com/comment/37764842
answers question: http://stackoverflow.com/q/24411401
has comment: http://stackoverflow.com/comment/37766803
has comment: http://stackoverflow.com/comment/37764130
has comment: http://stackoverflow.com/comment/37764430
score: 0

http://stackoverflow.com/q/24271813
has answer: http://stackoverflow.com/a/24271901
type: Question
has answer: http://stackoverflow.com/a/24272807
tagged with: java
has comment: http://stackoverflow.com/comment/37499251
has comment: http://stackoverflow.com/comment/37499372
accepted answer: http://stackoverflow.com/a/24271901
answer count: 5
tagged with: regex
has title: Capturing numbers with regex
possible better answer: http://stackoverflow.com/a/24271887
has answer: http://stackoverflow.com/a/24271924
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24271887
has comment: http://stackoverflow.com/comment/37499456
has body: I have these strings that contain sets of digits. What I need to do is capture every set of digits and create new strings for them. For example, in the string: "60 32 28 Some Characters 0 0 0" I need to capture and place 60, 32, 28, 0, 0, 0 into separate strings. Here is some of the code I have already tried: public class First { public static void main(String[] args) { String one = "60 32 28 Some Characters 0 0 0"; Pattern a = Pattern.compile("[0-9]{2}.*?([0-9]{2}).*?([0-9]{2})"); Matcher b = a.matcher(one); b.find(); String work = b.group(); String work1 = b.group(1); String work2 = b.group(2); System.out.println("this is work: " + work); System.out.println("this is work1: " + work1); System.out.println("this is work2: " + work2); Pattern c = Pattern.compile("([0-9]{2})|([0-9])"); Matcher d = c.matcher(one); d.find(); String work3 = d.group(); System.out.println(work3); } } However, I am unable to capture every digit. I have looked around other tutorials, but I am unable to find what I am doing wrong with my regex, or if there is another solution besides using regex. I have stayed away from using substrings because the text between digits usually vary in length. Any help would be appreciated.
score: 0
has answer: http://stackoverflow.com/a/24271921
has comment: http://stackoverflow.com/comment/37499249

http://stackoverflow.com/comment/37631794
type: QuestionComment
type: Comment
has text: Since `setProxy()` [can't throw](http://grepcode.com/file/repo1.maven.org/maven2/commons-net/commons-net/3.3/org/apache/commons/net/SocketClient.java#822) it's logical that `new Proxy()` throws this (I've to guess since you didn't say where the exception is thrown). Looking into [Proxy's API docs](http://docs.oracle.com/javase/6/docs/api/java/net/Proxy.html#Proxy%28java.net.Proxy.Type,%20java.net.SocketAddress%29) we can see that "`IllegalArgumentException - when the type and the address are incompatible`". What's the address returned by `getProxy()`?
comment on: http://stackoverflow.com/q/24340970
score: 0

http://stackoverflow.com/a/27104969
answers question: http://stackoverflow.com/q/24268477
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: I have found a solution which suits me well: ConditionalFormattingRule rule = sheetCF.createConditionalFormattingRule( ComparisonOperator.EQUAL, "\"" + compareItem + "\"" ); Note that you have to wrap compareItem (the string to be compared with) with additional double quot marks

http://stackoverflow.com/a/42764530
answers question: http://stackoverflow.com/q/24320014
has comment: http://stackoverflow.com/comment/109240864
has comment: http://stackoverflow.com/comment/109241794
has comment: http://stackoverflow.com/comment/100666727
upvote count: 5
has comment: http://stackoverflow.com/comment/102957624
has comment: http://stackoverflow.com/comment/109261453
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/109239829
has comment: http://stackoverflow.com/comment/109181982
has comment: http://stackoverflow.com/comment/139256135
has comment: http://stackoverflow.com/comment/102096934
type: Answer
has body: try this, I tried this and found successful @Override public void start() { super.start(); try { // Because we need to init the JavaFX toolkit - which usually Application.launch does // I'm not sure if this way of launching has any effect on anything new JFXPanel(); Platform.runLater(new Runnable() { @Override public void run() { // Your class that extends Application new ArtisanArmourerInterface().start(new Stage()); } }); } catch (Exception e) { e.printStackTrace(); } }
has comment: http://stackoverflow.com/comment/109220916

http://stackoverflow.com/q/24322630
type: Question
has body: I want to get subnet mask for my network interface in java. My IP Address is 172.16.179.197 Subnet Mask: 255.255.240.0 my code ifa.getAddress().getHostAddress() gives Ip address but ifa.getNetworkPrefixLength() gives -1 in Windows 7/8 but gives 20 in windows xp how to get netprifix or subnet mask for subnet 255.255.240.0 by java
tagged with: network-programming
duplicate of: http://stackoverflow.com/q/1221517
downvote count: 0
has title: getting getNetworkPrefixLength() -1 (incorrect) in Windows 8 and 20 (correct) in windows XP
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/37596002
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/1221517

http://stackoverflow.com/q/24362885
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37672440
tagged with: java
linked to: http://stackoverflow.com/q/24364554
score: -1
has title: Get only class name as string
tagged with: class
has comment: http://stackoverflow.com/comment/37672493
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24362955
has comment: http://stackoverflow.com/comment/37672640
has comment: http://stackoverflow.com/comment/37672446
has comment: http://stackoverflow.com/comment/37672500
favorite count: 0
has comment: http://stackoverflow.com/comment/37672407
has body: I have an interface Fruit which is implemented in Apple and Banana. In my main class, Fruit is called as following: Fruit fruit = new Apple(); How can I retrieve a String of "Apple"? Using fruit.getClass().getName() OR fruit.getClass().getSimpleName() gives a java.lang.NullPointerException I am trying to avoid making a function in Apple and Banana e.g. getClassName() . EDIT: Adding more details/methods, since my simplified question above doesn't seem to point to the problem. Adding more than the below would mean copying the whole code. Again, the below is a simplification. public class Clustering { private DistanceMeasure measure; //Manhattan or Euclidean private ClusterMethod method; //SingleLinkage or CompleteLinkage private Clusterer clusterer; public static void main(String[] args) { new Clustering().start(); } Clustering() { measure = new Manhattan(); method = new SingleLinkage(measure); clusterer = new Clusterer(method); } void start() { clusterer = setMethod(); clusterer.next(); //would use the ClusterMethod to do some calculations; clusterMethod which is saved inside Clusterer class when creating the new class i.e. new Clusterer(method). the nullException occurs here } Clusterer setMethod() { measure = new Euclidean(); if (method.getClass().getSimpleName().equals("SingleLinkage")) { method = new CompleteLinkage(measure); } else method = new SingleLinkage(measure); return new Clusterer(method); } } Does the above seem correct? The nullException occurs when using the clusterer.next() which works fine without using setMethod().
has comment: http://stackoverflow.com/comment/37672492
has comment: http://stackoverflow.com/comment/37672555
downvote count: 1
has answer: http://stackoverflow.com/a/24362955
type: Question

http://stackoverflow.com/a/24333760
has body: The same branch is being taken in both cases. You can verify that by using very different answers for the different branches: if (value == Math.floor(value)) { result = ((int) value * 100); } else { result = value; } and result = value == Math.floor(value) ? ((int) value * 100) : value; In both cases, you'll get 200 or 200.0. Another option to validate that would just be to remove the conditionality by making it constant: boolean condition = true; if (condition) { ... } and result = condition ? ...; However, the difference is that with the conditional operator, the type of the conditional expression is double - the type of the second operand is int (due to the cast), and the type of the third operand is double. The conditional operator can only have one type, so it follows the rules in the JLS and picks double (as int is implicitly convertible to double but not vice versa). That double is then boxed as part of the assignment to result (which is of type Object). So the value of result ends up being a reference to a Double, and printed out as 2.0. With the first approach, the result is an Integer instead, because you're assigning the int directly to result, and it's just getting autoboxed. You can make the conditional operator behave the same way by casting either operand to Object. For example: result = value == Math.floor(value) ? ((int) value) : (Object) value; Now the type of the conditional operator itself is Object, the int is boxed to Integer as part of evaluating the conditional operator.
upvote count: 11
has comment: http://stackoverflow.com/comment/37616890
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24333694
type: Answer
score: 11
accepted answer of: http://stackoverflow.com/q/24333694

http://stackoverflow.com/comment/37781466
score: 1
has text: "What could go possibly wrong here?" Well, the compiler is telling you. The package `org.w3c` does not exist. Or can't be found.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24420819

http://stackoverflow.com/q/24309488
possible better answer: http://stackoverflow.com/a/24309576
score: 1
tagged with: java
type: Question
answer count: 3
has body: I want to check whether any special character exist in given string. I tried following pattern but didn't worked. So it will be helpful if any valid answers. Pattern p = Pattern.compile("[\\*&amp;]"); Matcher m = p.matcher("a*a&amp;a"); boolean b = m.matches(); if (b) { System.out.println("Found"); } else { System.out.println("Not Found"); } Its working in javascript. ie [\*&amp;].
downvote count: 0
has title: java (jdk 1.6) regular expression
favorite count: 0
tagged with: java-6
has answer: http://stackoverflow.com/a/24309577
tagged with: regex
has answer: http://stackoverflow.com/a/24309576
upvote count: 1
has answer: http://stackoverflow.com/a/24309587
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24309577

http://stackoverflow.com/q/24326442
type: Question
answer count: 2
tagged with: jpa
downvote count: 0
has body: i have the problem i have a base abstract Entity Station with Inheritance TABLE_PER_CLASS and three child Tables StationCompany StationAnalysis StationVariant @MappedSuperclass @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS ) public abstract class Station { @Entity public class StationCompany extends Station { @ManyToOne(optional = false, fetch = FetchType.EAGER) @Fetch(FetchMode.SELECT) private Company company; @Entity public class StationAnalysis extends StationCompany { @ManyToOne(optional = false, fetch = FetchType.EAGER) @Fetch(FetchMode.SELECT) private Analysis analysis; @Entity public class StationVariant extends StationAnalysis { @ManyToOne(optional = false, fetch = FetchType.EAGER) @Fetch(FetchMode.SELECT) private Variant variant; public interface IStationCompanyRepository extends JpaRepository&lt;StationCompany, Long&gt; { @Service public class StationService implements IStationService&lt;StationCompany&gt; { @Autowired IStationCompanyRepository stationCompanyRepository; Then i search findAll on StationCompany, hibernate make a query with union select. i will search only for the StationCompany entrys. select x from ( select a from StationCompany union select b from StationVariant union select c from StationAnalysis )
has comment: http://stackoverflow.com/comment/37603873
possible better answer: http://stackoverflow.com/a/24327574
tagged with: table-per-class
has comment: http://stackoverflow.com/comment/37602437
has answer: http://stackoverflow.com/a/24327574
favorite count: 0
has answer: http://stackoverflow.com/a/24359222
upvote count: 1
has comment: http://stackoverflow.com/comment/37603116
type: AnsweredQuestion
score: 1
has title: Hibernate JPA @Inheritance TABLE_PER_CLASS JpaRepository on Child entity union select all tables
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/37603420
accepted answer: http://stackoverflow.com/a/24359222

http://stackoverflow.com/comment/37636493
comment on: http://stackoverflow.com/a/24343483
score: 0
type: AnswerComment
type: Comment
has text: The children of the listview are already rendered from the previous list, adding them to the target won't help creating new ones.

http://stackoverflow.com/comment/37595581
comment on: http://stackoverflow.com/a/24322706
type: AnswerComment
score: 0
type: Comment
has text: Thankyou everyone for the quick help! Loving SO, tried what you did here, and it actually worked exactly as expected! Just need to add more shapes now, one thing though, when I try to execute it, a rectangle is made of 4 lines, only 2 display??

http://stackoverflow.com/q/24420984
type: Question
has comment: http://stackoverflow.com/comment/37781795
has comment: http://stackoverflow.com/comment/37781769
tagged with: data-structures
tagged with: heap
answer count: 1
has title: Custom data structure (element + weight)
has comment: http://stackoverflow.com/comment/37781761
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24421461
has comment: http://stackoverflow.com/comment/37782506
has body: Which data structure should I use to keep elements ordered by a given weight? I need to add elements in a collection where each element generate a specific weight, but this weight is not contained (neither calculated) inside the element itself; it is calculated by someone else outside of the element. Moreover, the weight does not need to be stored (but could be if needed), it is only an insert parameter to put the element at the right position. My specific use case is to sort music tracks. I have a list of tracks and a list of rules to apply on each tracks. I iterate through each track, then the list of rules generate a "score" given the current track. I would like to add the track into a "collection" given the generated score, so I can pick the first track with the highest score. I can't see which data structure to use in Java. Do I have to implement a new one myself? My best guess is a kind of heap data structure, but I can't figure out which one specifically. EDIT: The weight is only calculated once at the beginning. I can't provide a "comparator" since it will compare Tracks, and I can't calculate their score on a "compareTo method". The algorithm could look like: public Track determineNext() { MyStructure&lt;Track&gt; trackScores; for (Track track : tracks) { int score = 0; for (Rule rule : rules) { score += rule.applyScoreOn(track); } trackScores.add(track, score); } return trackScores.first(); } I hope you get the idea.
score: 0
tagged with: java

http://stackoverflow.com/q/24331898
tagged with: java
tagged with: cardlayout
score: 0
has answer: http://stackoverflow.com/a/24332347
tagged with: user-interface
answer count: 1
tagged with: jinternalframe
has comment: http://stackoverflow.com/comment/37612930
type: AnsweredQuestion
has title: How can I get the card layout of an jInternalPane?
accepted answer: http://stackoverflow.com/a/24332347
tagged with: swing
type: Question
has body: I have a jInternalPane within a jDesktopPane. The jDesktopPane is within a jPanel that has the BorderLayout layout. In my internal pane, I am trying to programatically switch cards. I have the following, relevant piece of code that breaks: public void switchCards() { CardLayout cl = (CardLayout)(internalFrame1.getLayout()); cl.show(internalFrame1, "card1"); //Where card1 is a jPanel } However, in the error trace, I can see the following: javax.swing.plaf.basic.BasicInternalFrameUI$Handler cannot be cast to java.awt.CardLayout. Can someone please point me in the right direction to properly handle this error? I would love to learn how to do it! Many thanks in advance.

http://stackoverflow.com/q/24342532
score: 1
tagged with: java
downvote count: 0
answer count: 1
favorite count: 0
has title: How to change url of webview with click of a button?
type: UnansweredQuestion
tagged with: android
has body: So, I'm fairly new to Android development and decided - after some fiddling at first - to make my first complete app an app with a navigation drawer. Ideally I want a WebView of which the url changes if you choose an item in the navigation drawer. E.g.: The navigation drawer consists of the list: Google, Stackoverflow, Facebook and Twitter. If you click on one of them the correct url is pushed to the webview. I started off with code from Google. A sample app with navigation drawer, with images of planets. I changed some stuff around, but the step I'm currently stuck on is the one where you click an item and the webview changes. Below you can see some snippets of the code: fragment_planet.xml &lt;WebView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/image" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#000000" android:gravity="center" android:padding="32dp" /&gt; MainActivity private void selectItem(int position) { // update the main content by replacing fragments Fragment fragment = new PlanetFragment(); Bundle args = new Bundle(); args.putInt(PlanetFragment.ARG_PLANET_NUMBER, position); fragment.setArguments(args); FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit(); // update selected item and title, then close the drawer mDrawerList.setItemChecked(position, true); setTitle(mPlanetTitles[position]); mDrawerLayout.closeDrawer(mDrawerList); } I hope someone can help me out with this, because I can't find any documentation.
tagged with: webview
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24342578

http://stackoverflow.com/comment/37628771
type: QuestionComment
has text: `boolean.class`, `byte.class`, etc. are all valid class literals. To be honest, I haven't run into a case where those would be used, but I suspect that they would find a use for reflection (which I've been lucky enough to not need to use).
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24321182

http://stackoverflow.com/q/24321638
answer count: 4
linked to: http://stackoverflow.com/q/5411538
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24379112
has title: Login based application which produces IllegalStateException
downvote count: 0
has answer: http://stackoverflow.com/a/24325082
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/22999830
tagged with: eclipse
has body: The idea behind this is that i'll be redirecting to a page if the login(correct user+pass) exsists in my database and upon this authentication, they can store a message in a text file.The code is pretty straightforward though I'm not sure as to why I'm getting an IllegalStateException This is my- logininfo.java public class logininfo extends HttpServlet { private static final long serialVersionUID = 1L; //I've hidden all the unused code protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String user= request.getParameter("user"); String pass= request.getParameter("pass"); response.setContentType("text/html"); PrintWriter pw = response.getWriter(); Connection con = null; Statement stmt = null; ResultSet rs = null; try { Class.forName("com.mysql.jdbc.Driver"); con=DriverManager.getConnection("jdbc:mysql://localhost:3306/mayurtest","root","root"); String sql = "SELECT * FROM LOGIN where user=? and pass=?"; //thanks braj stmt = con.prepareStatement(sql); stmt.setString(1, user); stmt.setString(2, pass); rs = stmt.executeQuery(); while(rs.next()) { if((rs.getObject(1).toString().equals(user))&&(rs.getObject(2).toString().equals(pass))) //edited code { pw.println("correct login"); response.sendRedirect("message.HTML"); //request.getRequestDispatcher("message.html").include(request,response); is what I should write instead String message=request.getParameter("message"); //error here???? /*seems to be a problem as now all I get are null values printed*/ testmessage(message); break; } else { pw.println("please check username/password again. "); response.sendRedirect("userlogininfo.HTML");//request.getRequestDispatcher("userlogininfo.html").include(request,response); is what I should write instead break; } } } } catch (SQLException e) { pw.println(e.getNextException()); } catch (ClassNotFoundException e) { pw.println(e.getException()); } finally { try { if (rs != null) { rs.close(); rs = null; } if (stmt != nu…
type: Question
tagged with: servlets
has answer: http://stackoverflow.com/a/24321944
upvote count: 1
tagged with: http://stackoverflow.com/tag/html
possible better answer: http://stackoverflow.com/a/24321944
favorite count: 0
has answer: http://stackoverflow.com/a/24321848
has comment: http://stackoverflow.com/comment/37593576
accepted answer: http://stackoverflow.com/a/24321848

http://stackoverflow.com/q/24351240
has answer: http://stackoverflow.com/a/24351666
type: UnansweredQuestion
has body: Let's say we have some railroad with length L. We need to place K service stations between the first and last kilometer of this railroad. Service stations on 0 and L km's are already build for free. Given are the price of building a service station at every kilometer of this railroad and the equation to calculate the price of service for a given length of railroad. For example, we have 4 km railroad, and get list of prices to build one station at the n'th km of railroad : 5 22 13 also we have equation for service between stations - PRICE(len) = 2 * len*len + 3*len. So, we need to build 1 station, we can do this on: 1st km - it will cost 5 for building and PRICE(1)=5 (service from 0 to 1 km) + PRiCE(3)=27 (service from 1 to 4 km) => 37 2st km - it will cost 22 for building and PRICE(2)=14 (service from 0 to 2 km) + PRiCE(2)=14 (service from 2 to 4 km) => 50 3st km - it will cost 13 for building and PRICE(3)=27 (service from 0 to 3 km) + PRiCE(1)=5(service from 3 to 4 km) => 69 Best option is to build 1 station on first km. What if we need to build 2 stations? |S|_|_|_|F| |S|1|2|_|F| 5+22+PRICE(1)+PRICE(1)+PRICE(2) = 5 + 22 + 5 + 5 + 14 = 51 |S|1|_|3|F| 5+13+PRICE(1)+PRICE(2)+PRICE(1) = 5 + 13 + 5 + 14 + 5 = 42 |S|_|2|3|F| 22+13+PRICE(2)+PRICE(1)+PRICE(1) = 22 + 13 + 14 + 5 + 5 = 59 So, best way is to place two stations at first and third km. My task is to find minimum price for given length, number of stations to build, prices to build station on specific km and equation. My idea was to calculate len table to know cost to maintain specific length. For given example it is table: +------+------+------+------+ | idx0 | idx1 | idx2 | idx3 | +------+------+------+------+ | 0 | 5 | 14 | 27 | +------+------+------+------+ Then I calculate table with cost to build any two stations on specific kilometers: ╔══════╦══════╦══════╦══════╦══════╗ ║ ║ idx0 ║ idx1 ║ idx2 ║ idx3 ║ ╠══════╬══════╬══════╬══════╬══════╣ ║ idx0 ║ ║ ║ ║ ║ ║ idx1 ║ ║ 5 ║ 32 ║ 32 ║ ║ idx2 ║ ║ ║ 22 ║ 40 ║ ║ …
has title: Dynamic programing / Combinations without repetitions and order is not important
score: 2
tagged with: dynamic-programming
downvote count: 0
favorite count: 0
tagged with: combinatorics
type: Question
upvote count: 2
answer count: 1
tagged with: combinations
tagged with: algorithm
tagged with: java

http://stackoverflow.com/comment/37553439
type: Comment
has text: What is wrong in your answer: 1) In both cases: via `dis.readByte()` and local object `readByte()` method calls - "function" call is used, so it doesn't explain the different. 2) Even if the reason relates to "function call", it doesn't explain why JVM optimizes only local method call.
type: AnswerComment
comment on: http://stackoverflow.com/a/24282155
score: 0

http://stackoverflow.com/comment/37635822
has text: `if ( names [ i ].compareToIgnoreCase( names [ j ] ) < 0 )` ? But what about .sort methods?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24343955

http://stackoverflow.com/comment/37526011
type: QuestionComment
has text: Update `%PATH%` or `%JAVA_HOME%`, wherever appropriate.
comment on: http://stackoverflow.com/q/24286137
score: 0
type: Comment

http://stackoverflow.com/comment/37746948
type: AnswerComment
type: Comment
has text: Have you verified this? AFAIK, it does not matter if the quotes are present or not for an INT type of field.
comment on: http://stackoverflow.com/a/24402298
score: 0

http://stackoverflow.com/q/24359868
has comment: http://stackoverflow.com/comment/37667540
has body: I am adding a date in a calendar instance to check dst while adding a date eg 08-03-2014 to 09-03-2014 time zone is changing from EST TO EDT. The day light time is returning false. TimeZone tz = TimeZone.getTimeZone("us/alaska"); Calendar c = Calendar.getInstance(); c.setTimeZone(tz); c.add(Calendar.DAY_OF_MONTH, 1); checkDayLightTime = tz.inDaylightTime(c.getTime()); System.out.println("current get time"+c.getTime()); System.out.println("checkDayLightTime"+checkDayLightTime); 03-08 02:59:58.505: INFO/System.out(12092): current get timeSun Mar 09 03:59:58 EDT 2014 03-08 02:59:58.505: INFO/System.out(12092): checkDayLightTimefalse
score: 0
tagged with: android
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37667973
has comment: http://stackoverflow.com/comment/37668002
has title: adding date in calendar instance time zone is changing from EST TO EDT in android
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24360674

http://stackoverflow.com/a/24336099
accepted answer of: http://stackoverflow.com/q/24335911
has comment: http://stackoverflow.com/comment/37621379
has comment: http://stackoverflow.com/comment/37621249
answers question: http://stackoverflow.com/q/24335911
has body: First, never catch and ignore an exception. Either handle it, rethrow it, or wrap it. If you don't think it should happen, just wrap it in a RuntimeException. } catch(Exception e) { throw new RuntimeException(e); } There was an exception being thrown in your code that you didn't see because of this. The two checks in the for loops are wrong. i &lt;= r.length() j &lt;= r.length() should be i &lt; y.length() j &lt; y.length() This is because length() is never a valid index (length() - 1 is the last valid index), and because y can be shorter than r, because things could be removed. Finally, you may want to think about which character your are removing, why you are removing that character, and how the indexes of all of the characters shift once you have removed it.
has comment: http://stackoverflow.com/comment/37621489
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37621428
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/37621562
score: 2

http://stackoverflow.com/comment/37577397
has text: @KrishnaChaitanya Yes, that would be the general conclusion. If you are doing one or two searches on the same list then linear search is faster. If you are doing three or more searches on the same list, then sort + binary search is faster.
type: Comment
comment on: http://stackoverflow.com/a/24275451
type: AnswerComment
score: 0

http://stackoverflow.com/q/24284509
tagged with: multithreading
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/24284786
tagged with: fork-join
has body: I'm designing a bulk data loader utility that needs to be very fast. The input is one or more files in some format, containing data to be loaded to a high-performance, distributed system. To keep it simple, let’s assume there’s one file, but the idea should be easily generalized to multiple input files on multiple disks. We know that hard disks are serial devices and can only achieve max performance when doing sequential IOs. The backend distributed system is much more powerful and can allow me to load data from multiple disks at the same time. My idea is like this: I have one producer thread per file which reads LARGE blocks, parses the block to identify individual records, and then "re-partition and send" each record to its associated in-memory container. The re-partition will be based on one or more attributes of each record (think of re-partition based on the ID of each person). There are multiple in-memory containers holding the intermediate records. Each container is bounded to a consumer thread, that fetches a record from its container at one time, load it into the backend system. My question is: How to design a function to "re-partition and send" each record to its associated in-memory container? What if each consumer thread SORTs a batch of records in its container, and then loads them in one call? What would be a good data structure for the in-memory container? Please share your expertise. If you could elaborate and provide some pseudo code, that will be even awesome! Thanks.
type: Question
tagged with: iostream
has title: How to re-partition each line in a file in Java
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37523946
favorite count: 0
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/24299678
accepted answer: http://stackoverflow.com/a/24299785
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/37552270
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37552136
has comment: http://stackoverflow.com/comment/37552202
tagged with: java
has body: I have a JTable And I have set Vector into the Header and Vector of Vector as Row content but it has to be add header onclick event. but when i tried to add String into the vector in click event its adding String into the Vector but that vector is not added to the Header so how can i make that i have Used firetablechanged event of model. but its not working some how. here sample code. Vector vector; Vector&lt;Vector&gt; vector_content; table = new javax.swing.JTable(); table.setModel(new DefaultTableModel(vector_content,vector){ private static final long serialVersionUID = 1L; @Override public boolean isCellEditable(int row, int column) { return false; } }); now i have click event like this where m adding data into the Header table of content. vector = new Vector(); vector_content = new Vector&lt;Vector&gt;(); vector.add("Employee Name"); vector.add("Date"); vector.add("Type"); data is added to the Vector i can print data but some how its not set to the table how can i make it? example here its working because i have added Table model using that col vector and row but when i use that in some button click then its not working method name is ![setDate();][1] public class Jtable_Column extends javax.swing.JFrame { public Vector col; public Vector&lt;Vector&gt; row; /** * Creates new form Jtable_Column */ public Jtable_Column() { setData(); initComponents(); } private void initComponents() { jPanel1 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); 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, 0, Short.MAX_VALUE) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE) ); jT…
type: Question
answer count: 2
tagged with: vector
score: -2
has title: JTable Is not Adding Vector on Click Event of Label
possible better answer: http://stackoverflow.com/a/24955180
has answer: http://stackoverflow.com/a/24299785
favorite count: 0
has answer: http://stackoverflow.com/a/24955180
tagged with: jtable
has comment: http://stackoverflow.com/comment/37552297
has comment: http://stackoverflow.com/comment/37552332
tagged with: events
has comment: http://stackoverflow.com/comment/37552177
has comment: http://stackoverflow.com/comment/37552068
has comment: http://stackoverflow.com/comment/37553393
downvote count: 3
has comment: http://stackoverflow.com/comment/37552112

http://stackoverflow.com/comment/84992362
score: 0
comment on: http://stackoverflow.com/a/24347772
type: AnswerComment
has text: @moskito-x Thanks Successfully worked in netbeans 8.2 with jdk 1.8
type: Comment

http://stackoverflow.com/q/24333252
accepted answer: http://stackoverflow.com/a/24378975
has comment: http://stackoverflow.com/comment/37616973
has comment: http://stackoverflow.com/comment/37617395
tagged with: scala
has body: I am new to play framework and have managed to make the activator work on the cmd of Windows. Now that I created my project in Eclipse, I can't modify my index.scala.html file as shown in a tutorial I am following. Any feedback or suggestion on how to manipulate those files will be appreciated, thanks! Note: Does it has something to do with the fact that the page localhost:9000 does not open up for me?
linked to: http://stackoverflow.com/q/24112599
has comment: http://stackoverflow.com/comment/37702638
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37615816
has comment: http://stackoverflow.com/comment/37617141
has comment: http://stackoverflow.com/comment/37616543
tagged with: playframework-2.3
tagged with: java
has comment: http://stackoverflow.com/comment/37616488
has comment: http://stackoverflow.com/comment/37623866
type: Question
has answer: http://stackoverflow.com/a/24378975
has comment: http://stackoverflow.com/comment/37617542
possible better answer: http://stackoverflow.com/a/26111984
has answer: http://stackoverflow.com/a/26111984
has comment: http://stackoverflow.com/comment/37618041
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37617849
has title: Cannot modify my index.scala.html file and cannot connect to localhost:9000 in Play framework
has comment: http://stackoverflow.com/comment/37615917
has comment: http://stackoverflow.com/comment/37616163

http://stackoverflow.com/a/24278104
type: Answer
accepted answer of: http://stackoverflow.com/q/24277775
answers question: http://stackoverflow.com/q/24277775
upvote count: 1
has body: Let's say you could insert it into your updateItem-Method but then it would get called every time the item is updated. This might not be a big Problem with setPrefWidth as nothing changes but imagine you have something like firstInitialize();which is not supposed to be called more than once. Therefore you can use the Initializer Block. Otherwise you would have to add a variable like bool isInitialized where you check first, if the variable is true and in case it's not, you performe your Action. You can also have a look at: Initializing Fields
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37514296
comment on: http://stackoverflow.com/q/24279660
has text: What do you mean? this is the HQL query.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37541503
type: QuestionComment
type: Comment
has text: @Cruncher agreed. Why not just turn the elements into a string and use StringBuilder.reverse() and a good old .equals() comparison?
score: 0
comment on: http://stackoverflow.com/q/24293910

http://stackoverflow.com/comment/37790435
type: Comment
comment on: http://stackoverflow.com/a/24408252
type: AnswerComment
has text: It works fine for me. That might be the issue with runtime. I didn't handle the error stream. Can you try that command in command prompt and see if you have proper privileges?
score: 0

http://stackoverflow.com/q/24294247
has comment: http://stackoverflow.com/comment/37544524
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37541894
type: Question
has comment: http://stackoverflow.com/comment/37546479
has comment: http://stackoverflow.com/comment/37544868
score: 0
has title: Can't create an AVD manager
answer count: 1
has body: I have installed the Android Development Tools and Android SDK but I can't create an AVD Manager. I have tried selecting different options in the Create new Android Device Manager, but when I hit OK nothing happens. Console prints these error messages: [2014-06-18 22:02:23 - SDK Manager] Error: null And this, also: [2014-06-18 22:27:05 - SDK Manager] Warning: Couldn't open file: /Users/eduarddedu/.android/devices.xml (No such file or directory) I have ARM EABI v7a System Image installed and I am not using any spaces in the name field. I have also tried running monitor.bat as someone suggested; the Android Device Manager start-up screen briefly appeared, but then I got an error message saying an error has occurred and 'See the log file: /Users/... I opened the log file and it says: java.io.IOException: The folder "/Users/eduarddedu/.android/monitor-workspace/.metadata" is read-only. This is really weird because there isn't any folder .android in /Users/eduarddedu. I used ls -a to view hidden files. I don't know if this is relevant but I also discovered that the Android SDK Manager log reports these two errors: Failed to fetch URL https://dl-ssl.google.com/android/repository/addons_list-2.xml, reason: File not found Failed to fetch URL https://dl-ssl.google.com/android/repository/repository-9.xml, reason: File not found That's it. Thanks a lot for any suggestions.
has answer: http://stackoverflow.com/a/24342890
tagged with: android
has comment: http://stackoverflow.com/comment/37544387

regex
tags question: http://stackoverflow.com/q/24359234
tags question: http://stackoverflow.com/q/24397661
tags question: http://stackoverflow.com/q/24417394
tags question: http://stackoverflow.com/q/24271813
tags question: http://stackoverflow.com/q/24362040
tags question: http://stackoverflow.com/q/24322234
tags question: http://stackoverflow.com/q/24314471
tags question: http://stackoverflow.com/q/24286278
tags question: http://stackoverflow.com/q/24337657
tags question: http://stackoverflow.com/q/24321679
tags question: http://stackoverflow.com/q/24404997
tags question: http://stackoverflow.com/q/24371462
tags question: http://stackoverflow.com/q/24347431
tags question: http://stackoverflow.com/q/24416660
tags question: http://stackoverflow.com/q/24313499
tags question: http://stackoverflow.com/q/24358310
tags question: http://stackoverflow.com/q/24423856
tags question: http://stackoverflow.com/q/24289304
tag name: regex
tags question: http://stackoverflow.com/q/24363621
tags question: http://stackoverflow.com/q/24348886
tags question: http://stackoverflow.com/q/24414896
tags question: http://stackoverflow.com/q/24273079
tags question: http://stackoverflow.com/q/24364139
tags question: http://stackoverflow.com/q/24267889
tags question: http://stackoverflow.com/q/24374205
tags question: http://stackoverflow.com/q/24365773
tags question: http://stackoverflow.com/q/24308359
tags question: http://stackoverflow.com/q/24294051
tags question: http://stackoverflow.com/q/24309488
tags question: http://stackoverflow.com/q/24278576
tags question: http://stackoverflow.com/q/24319334
tags question: http://stackoverflow.com/q/24320607
tags question: http://stackoverflow.com/q/24314917
tags question: http://stackoverflow.com/q/24304620
tags question: http://stackoverflow.com/q/24404257
tags question: http://stackoverflow.com/q/24321568
tags question: http://stackoverflow.com/q/24377211
tags question: http://stackoverflow.com/q/24304838
tags question: http://stackoverflow.com/q/24310097
tags question: http://stackoverflow.com/q/24305215
tags question: http://stackoverflow.com/q/24358990
tags question: http://stackoverflow.com/q/24354273
tags question: http://stackoverflow.com/q/24325598
tags question: http://stackoverflow.com/q/24302480
tags question: http://stackoverflow.com/q/24394087
tags question: http://stackoverflow.com/q/24415234
tags question: http://stackoverflow.com/q/24395089
tags question: http://stackoverflow.com/q/24304053
tags question: http://stackoverflow.com/q/24289006
tags question: http://stackoverflow.com/q/24294712
tags question: http://stackoverflow.com/q/24402590
tags question: http://stackoverflow.com/q/24315643
tags question: http://stackoverflow.com/q/24300238
tags question: http://stackoverflow.com/q/24370978
tags question: http://stackoverflow.com/q/24343012
tags question: http://stackoverflow.com/q/24274378
tags question: http://stackoverflow.com/q/24373145
tags question: http://stackoverflow.com/q/24286400
tags question: http://stackoverflow.com/q/24311171
tags question: http://stackoverflow.com/q/24281789
tags question: http://stackoverflow.com/q/24413186
tags question: http://stackoverflow.com/q/24330677
tags question: http://stackoverflow.com/q/24394204
tags question: http://stackoverflow.com/q/24424498
tags question: http://stackoverflow.com/q/24321156
tags question: http://stackoverflow.com/q/24331559
tags question: http://stackoverflow.com/q/24282815
tags question: http://stackoverflow.com/q/24328136
tags question: http://stackoverflow.com/q/24326327
tags question: http://stackoverflow.com/q/24395364
tags question: http://stackoverflow.com/q/24328777
tags question: http://stackoverflow.com/q/24362320
tags question: http://stackoverflow.com/q/24325708
tags question: http://stackoverflow.com/q/24342070
tags question: http://stackoverflow.com/q/24293787
tags question: http://stackoverflow.com/q/24343995
tags question: http://stackoverflow.com/q/24388506
tags question: http://stackoverflow.com/q/24310407
tags question: http://stackoverflow.com/q/24349100

http://stackoverflow.com/comment/37728549
comment on: http://stackoverflow.com/q/24392592
score: 0
type: Comment
type: QuestionComment
has text: I have tried it with a tree map and can get the top 2, 3 etc with the highest scores im just not sure how to get the top half based on there scores.

http://stackoverflow.com/comment/37730077
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24374760
has text: `WebElement actualMovie = potentialMovie.findElement(By.xpath("//table[@class='datadisplaytable']"));` should be `WebElement actualMovie = potentialMovie.findElement(By.className("datadisplaytable"));`.

http://stackoverflow.com/a/24313914
has comment: http://stackoverflow.com/comment/37579034
answers question: http://stackoverflow.com/q/24313663
has body: I don't know why it fails, but i can tell you the way i do it in my personal project. I generate and overwrite the context.xml with my configuration using a .ebextensions/*.config file, thus setting my DataSource correctly before the container starts. See: https://github.com/Craftware/Kornell/blob/master/kornell-api/src/main/webapp/.ebextensions/tomcat7.config
upvote count: 1
has comment: http://stackoverflow.com/comment/37579848
has comment: http://stackoverflow.com/comment/37578711
type: Answer
has comment: http://stackoverflow.com/comment/37578773
downvote count: 0
score: 1

http://stackoverflow.com/comment/37642961
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24341843
score: 0
has text: Brilliant. Hadn't thought of that. Have to break up my test method a little bit, which I'm not too thrilled about, but it works great.

http://stackoverflow.com/comment/37675251
has text: What's the actual question here? (I assume you already know that `==` compares string *references*, not string *contents*)?
comment on: http://stackoverflow.com/q/24364465
type: Comment
type: QuestionComment
score: 8

http://stackoverflow.com/q/24383387
linked to: http://stackoverflow.com/q/23653778
duplicate of: http://stackoverflow.com/q/6495898
type: Question
score: 3
linked to: http://stackoverflow.com/q/6495898
has body: I have searched on google as well as StackOverflow. But none of the solutions fixed my problem. findViewById is returning null when it is there in onCreate . But, when i change it to onClick function, it works fine. please help me. i am beginner to android programming. my MainFunction.java public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } final TextView t = (TextView) findViewById(R.id.textView1); t.setText("hi world."); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } } } My fragment_main.xml &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_horizo…
tagged with: java
has title: findViewById returning null (TextView)
has answer: http://stackoverflow.com/a/24383459
accepted answer: http://stackoverflow.com/a/24383459
answer count: 2
duplicate of: http://stackoverflow.com/q/23653778
has comment: http://stackoverflow.com/comment/37710834
downvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/24383434
tagged with: android
tagged with: textview
upvote count: 4
has answer: http://stackoverflow.com/a/24383434
type: AnsweredQuestion

http://stackoverflow.com/comment/37568528
type: QuestionComment
has text: only 05/22/2014 03:22:39.288 type of datetime i need to accept
comment on: http://stackoverflow.com/q/24308359
score: 0
type: Comment

http://stackoverflow.com/a/24363966
type: Answer
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24363847
score: 0
accepted answer of: http://stackoverflow.com/q/24363847
has body: You can implement the toString() method of your objects to get a human friendly view. However, for existing objects like HashMap, you have to unfold its internal structure.

http://stackoverflow.com/comment/37572376
type: Comment
comment on: http://stackoverflow.com/a/24309912
score: 0
type: AnswerComment
has text: So using your code I get the following error: java.lang.ClassCastException: sun.net.www.protocol.http.HttpURLConnection cannot be cast to javax.net.ssl.HttpsURLConnection

http://stackoverflow.com/q/24325203
tagged with: weakhashmap
tagged with: static-methods
score: 0
tagged with: interface
tagged with: android
has title: Android: working with interface and WeakHashMap
has comment: http://stackoverflow.com/comment/37601744
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37601648
has body: After a whole night spent in test (without any luck) I need some support with my interface. I'm working directly on the Android frameworks and I created a class that works as a Binder with a WeakHashMap to control the callbacks. Here is the code: MyCallback: public interface MyCallback { public void fire(); } MyBinder: public static WeakHashMap&lt;String, MyCallback&gt; mCallbacks = new WeakHashMap&lt;String, MyCallback&gt;(); public static void setup(MyCallback callback) { if(mCallbacks.get(callback.getClass().getName()) == null) { mCallbacks.put(callback.getClass().getName(), callback); } } public static void letsgo() { Log.d("size", " " + mCallbacks.size()); // IMPORTANT for (MyCallback cb : mCallbacks.values()) { cb.fire(); } } These 2 classes are written into frameworks so I created 2 test applications with a simple class that implements my interface: public class FirstApp implements MyCallback { public FirstApp() { MyBinder.setup(this); } @Override public void fire() { Log.d("app1", "fired"); } } public class SecondApp implements MyCallback { public SecondApp() { MyBinder.setup(this); } @Override public void fire() { Log.d("app2", "fired"); } } Ok at this point I made another class (all these 3 classes, so the 2 that implements the interface and the following one are written into different packages) In this third class i just call: MyBinder.letsgo(); The issue I'm facing, and that I'm trying to solve since... 8/9 hours is that: If i run letsgo() on the third pack the logs shown 0 for the callbacks WeakHashMap size. if i run letsgo() on the second package it works but it only fires the callback in the same package. the same if i run it on the first package. I tried also with HashMap instead of WeakHashMap since i red that objects must be referenced but without any luck. I wonder if someone can help me and let me go sleep :D Thanks!
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/37602316

http://stackoverflow.com/q/24287776
has comment: http://stackoverflow.com/comment/37530351
has comment: http://stackoverflow.com/comment/37529912
has comment: http://stackoverflow.com/comment/37530170
has title: Same unicode character behaves differently in different IDEs
tagged with: netbeans
has comment: http://stackoverflow.com/comment/37531190
has answer: http://stackoverflow.com/a/24287844
tagged with: java
has comment: http://stackoverflow.com/comment/37529257
has comment: http://stackoverflow.com/comment/37530391
has comment: http://stackoverflow.com/comment/37529744
type: Question
has comment: http://stackoverflow.com/comment/37530465
has answer: http://stackoverflow.com/a/24290294
has comment: http://stackoverflow.com/comment/37530634
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37529599
score: 0
answer count: 2
has body: When I read the following unicode string it reads as differently..When I execute the program using netbeans it is working fine but when I tried using Eclipse / directly from CMD it is not working. After reading it adds ƒÂ these characters Then the string becomes MÃƒÂ½xico String to be read is MÃ½xico...I used the CSVReader with Encoding to read as follows. sourceReader = new CSVReader(new FileReader(soureFile)); List&lt;String[]&gt; data = sourceReader.readAll(); Any suggestions????????
tagged with: unicode
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/csv

http://stackoverflow.com/a/24323002
has body: You can do the following:- public void doSomething(Object arg){ Object[] arr=(Object[])arg; // cast the arg into Object[] array Object obj=arr[0] ;// will return the object String s=(String)arr[1] ;// would return string (add a down-cast to string because that string object when added to array converts to the Object type) System.out.println(obj+" "+s); } If you called it in this way doSomething(new Object[] {this,"aString"}); Ouput would be something like this:- Class@dce1387 aString
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/24322712
score: 2
downvote count: 0

http://stackoverflow.com/comment/38794414
has text: Great sleuthing @LouFranco, regenerating the iOS client code resolved the problem!
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24946715

http://stackoverflow.com/a/73285260
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24376980
score: 1
has body: 2022 UPDATE There is still no answer to what the OP asked - configure IntelliJ to "automatically split those long strings". The most upvoted answer does not work. There is only one way (it's manual) to solve this problem short of someone writing a plugin. This method is guaranteed to work regardless of any other settings and provides 100% control of formatting of any code segment, not just those with long lines of strings. Go to Settings Editor | Code Style | Formatter and enable the formatter on/off markers. Format the code fragment any way you want and surround it with the off/on phrases in code comments. My example code segment: System.out.println("This is a long line of text that includes " + variables() + " and " + some.otherStuff().toString() + ". But don't count on " + this.IDE().toName() + " to format it in " + anIntelligent() + " way. " + this.IDE().toName() + " should add a " + plusSign.Option() + " for long strings like this."); RESULT 1 With settings as described in @mkierc's answer with a hard wrap at 80 per OP: System.out.println( "This is a long line of text that includes " + variables() + " in " + "it and " + some.otherStuff() .toString() + ". But don't count on " + this.IDE() .toName() + " to format it in " + anIntelligent() + " way. " + this.IDE() .toName() + " should add a " + plusSign.Option() + " for long strings like this."); I don't know how this could be worse. The hard wrap was not honored after the second line and the ending semi-colon is at column 300! Honestly, I can't imagine what algorithm led to this mess. My son at 10 years old could do better... RESULT 2 Formatted manually, margin at 80, and using formatter on/off markers: //@formatter:off System.out.println("This is a long line of text that includes " + variables() + " in it and " + some.otherStuff().toString() + ". But don't count on " + this.IDE().toName() + " to format it in " + anIntelligent() + " way. " + this.IDE().toName() + " should add a " + plusSign.Option() + " for long s…

http://stackoverflow.com/comment/37617849
comment on: http://stackoverflow.com/q/24333252
has text: Yes! I am listening to the 0.0.0.0:9000. But then when I try to go, I get a network error! :( I think it has something to do with the proxy but I am 90% that I setted it up properly
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37672565
score: 0
type: AnswerComment
has text: amended to include an example
type: Comment
comment on: http://stackoverflow.com/a/24341084

http://stackoverflow.com/comment/37791195
comment on: http://stackoverflow.com/a/24425010
type: AnswerComment
has text: Now way to do this with ion library ?
score: 0
type: Comment

http://stackoverflow.com/comment/37537686
type: QuestionComment
comment on: http://stackoverflow.com/q/24291412
has text: Nope. We have been instructed to only use port 25 by our client. The other ports are blocked.
score: 0
type: Comment

http://stackoverflow.com/a/24407638
has body: The Javadoc of createImage() says Returns an off-screen drawable image, which can be used for double buffering. The return value may be null if the component is not displayable. This will always happen if GraphicsEnvironment.isHeadless() returns true Check the GraphicsEnvironment.isHeadless() to return true.
answers question: http://stackoverflow.com/q/24407434
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/37757561

android-fragments
tags question: http://stackoverflow.com/q/24275533
tags question: http://stackoverflow.com/q/24327009
tags question: http://stackoverflow.com/q/24348855
type: Tag
tags question: http://stackoverflow.com/q/24358424
tags question: http://stackoverflow.com/q/24270760
tags question: http://stackoverflow.com/q/24388361
tags question: http://stackoverflow.com/q/24365370
tags question: http://stackoverflow.com/q/24310853
tags question: http://stackoverflow.com/q/24295815
tags question: http://stackoverflow.com/q/24347160
tags question: http://stackoverflow.com/q/24361442
tags question: http://stackoverflow.com/q/24359235
tags question: http://stackoverflow.com/q/24377153
tags question: http://stackoverflow.com/q/24337872
tags question: http://stackoverflow.com/q/24315270
tags question: http://stackoverflow.com/q/24394326
tags question: http://stackoverflow.com/q/24310217
tags question: http://stackoverflow.com/q/24380930
tags question: http://stackoverflow.com/q/24337675
tags question: http://stackoverflow.com/q/24325600
tags question: http://stackoverflow.com/q/24317545
tag name: android-fragments
tags question: http://stackoverflow.com/q/24276336
tags question: http://stackoverflow.com/q/24391944

http://stackoverflow.com/comment/37943369
comment on: http://stackoverflow.com/a/24507614
score: 0
type: Comment
has text: As far as I understand, POST over HTTPS is not vulnerable to many of the points that you have mentioned. See http://security.stackexchange.com/a/53621 and http://security.stackexchange.com/a/53605
type: AnswerComment

http://stackoverflow.com/a/24296118
answers question: http://stackoverflow.com/q/24295548
has body: I don't do much android dev so I apologize that I may not fully understand this, but why can't you just use indexOf(Object o)? Wouldn't that be enough for you to get the ID of any given element, as long as you know the element itself? (which, assuming you want to delete it, you would)
score: 0
type: Answer

http://stackoverflow.com/q/24321575
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37608416
has title: Struts forms still empty
tagged with: java
accepted answer: http://stackoverflow.com/a/24391839
tagged with: struts
has body: I am beginner developer and i'm working on a web application in Java whith struts. I have a problem with my struts form which stay empty after user enters informations. I've tried many way to resolve it but nothing worked. Maybe the code lines will help you to help me ;). My Jsp page : État : Tous Actif Inactif Date de début : * Date de fin : * Chargé(e)(s) <% for (Utilisateur u : utilisateurs) {%> <option value="<%=u.getUtilisateurMatricule()%>"><%=u.getUtilisateurNom() + ", " + u.getUtilisateurPrenom()%> <%}%> Activité : <% for (String s : activites) {%> <option value="<%=s%>"><%=s%> <%}%> and my action : public class ActionStatistiques extends DispatchAction { public ActionForward module1(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { FormStatMod1 forms = (FormStatMod1) form; ServiceStatistiques service = new ServiceStatistiques(); String dd = forms.getDateDebut(); String dateDebut = dd.substring(6, 10) + '-' + dd.substring(3, 5) + '-' + dd.substring(0, 2); String df = forms.getDateFin(); String dateFin = df.substring(6, 10) + '-' + df.substring(3, 5) + '-' + df.substring(0, 2); Collection[] collections = service.module1(forms.getChoixEtat(), dateDebut, dateFin); Collection<Flux> listef = collections[1]; String activiteNom = forms.getActiviteNom(); String chargeMatricule = forms.getChargeMatricule(); Hope, someone will see what's wrong. Have a nice day!!
has answer: http://stackoverflow.com/a/24391839
tagged with: jsp
has answer: http://stackoverflow.com/a/24321834
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24342694
has comment: http://stackoverflow.com/comment/37593355
possible better answer: http://stackoverflow.com/a/24321834

http://stackoverflow.com/comment/37865972
score: 0
has text: If you have the same schema in all databases, I suggest you check [Spring's Dynamic DataSource Routing](http://spring.io/blog/2007/01/23/dynamic-datasource-routing/). If not, you need to create 4 datasources and 4 entity managers as pointed out by @vlad-mihalcea
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24405293

http://stackoverflow.com/comment/37595687
has text: This does not solve my issue as I am not getting the error he is, just 0 items returned, and keyName is a word that is not a number so casting will not work, unless I am reading the sql wrong, it is getting the keyName that satisfy the condition and try to find ID that match keyName. I am expecting the sql in the select to be select this. FORM_ID....
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24322692

http://stackoverflow.com/comment/37614873
has text: yes, I'm making rest call. So, the best approach in this case is to to check the result of the call, and if the person has not permission, make a redirect to a non-permission message page?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24332618

http://stackoverflow.com/q/24299865
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37557867
tagged with: maven
answer count: 0
has comment: http://stackoverflow.com/comment/37552435
score: 0
tagged with: java
type: Question
has body: I have a project created with maven. It is responsible for building war file. Is it possible that in some resources maven would change property placeholders ${prop} in some resources to values from another *.properties file.
linked to: http://stackoverflow.com/q/2335431
linked to: http://stackoverflow.com/q/18574025
has title: Is maven capable to replace property placeholder ${prop} with value from .properties file
has comment: http://stackoverflow.com/comment/37561215

http://stackoverflow.com/comment/40702558
type: QuestionComment
comment on: http://stackoverflow.com/q/24381392
has text: You probably need to url-decode the string before base64-decoding (to replace %xx character entities with corresponding characters)
score: 0
type: Comment

http://stackoverflow.com/q/24299653
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37552084
type: Question
has title: Error in Http Post
has comment: http://stackoverflow.com/comment/37552057
has comment: http://stackoverflow.com/comment/37552139
has comment: http://stackoverflow.com/comment/37552069
has answer: http://stackoverflow.com/a/24299738
has answer: http://stackoverflow.com/a/24299765
has comment: http://stackoverflow.com/comment/37552076
score: 0
tagged with: http-post
has comment: http://stackoverflow.com/comment/37552039
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/24299816
has body: I m beginner in android development and I'm using using this code and use it as a method to post data in a url. i call this method from a async task. and show error in HttpResponse error: Caused by: java.lang.IllegalStateException: Target host must not be null, or set in parameters. scheme=null, host=null, path=192.168.56.1/android_connect/get_users.php php code: $username = @$_POST['username']; $password = @$_POST['password']; $mysql_query = mysql_query(" INSERT INTO `android_connect1`.`user` ( `username` , `password` ) VALUES ( '$username', '$password')");
tagged with: android
possible better answer: http://stackoverflow.com/a/24299703
accepted answer: http://stackoverflow.com/a/24299765
tagged with: php
has answer: http://stackoverflow.com/a/24299703
has comment: http://stackoverflow.com/comment/37552113
answer count: 4

http://stackoverflow.com/comment/37793165
comment on: http://stackoverflow.com/q/24427451
has text: Can you make your post more clearer,I read thrice but unable to understand your problem and requirement
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/31197377
has body: I faced this issue a number of times in my application. We can generally handle this with the below 2 approaches. Pass the username and password in url itself You can create an AutoIT Script and call script before opening the url. Please check the below article in which I have mentioned both ways: Handle Authentication/Login window in Selenium Webdriver
has comment: http://stackoverflow.com/comment/92863798
upvote count: 7
answers question: http://stackoverflow.com/q/24304752
score: 7
downvote count: 0
has comment: http://stackoverflow.com/comment/75044342
type: Answer

http://stackoverflow.com/a/24366933
accepted answer of: http://stackoverflow.com/q/24366858
answers question: http://stackoverflow.com/q/24366858
score: 0
type: AcceptedAnswer
type: Answer
has body: That's just Netbeans redirecting the standard output to its console. You can set this up in Visual Studio, too, but it's not by default.

http://stackoverflow.com/a/33869753
answers question: http://stackoverflow.com/q/24276237
has body: &lt;LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"&gt; &lt;ImageView android:layout_width="match_parent" android:layout_height="wrap_content" /&gt; &lt;TextView android:layout_width="match_parent" android:layout_height="wrap_content" /&gt;
type: Answer
score: 0

http://stackoverflow.com/a/24345265
answers question: http://stackoverflow.com/q/24340850
type: Answer
accepted answer of: http://stackoverflow.com/q/24340850
score: 1
upvote count: 1
has body: You haven't set a time zone for the SimpleDateFormat, so it's defaulting to your environment's time zone, which I am guessing is "Africa/Johannesburg", since you have SAST in your result. So when you do this part: SimpleDateFormat sd = new SimpleDateFormat("dd/MM/yyyy"); Date date = sd.parse("25/05/2014"); The date object will be midnight in SAST, which is 10PM the prior evening in UTC. The rest follows from there, since you're working with UTC from that point forward. Also, at the very end, you call toDate, which results in a Date object. When you output that, again the local time zone is influencing the result. You could consider calling setTimeZone on the SimpleDateFormat object. That will at least get the beginning part right. But you should also then use the format method to output the final string. However, a better solution would be to use JodaTime's DateTimeFormatter instead. Then you won't have to use SimpleDateFormat or Date at all.
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37654393

http://stackoverflow.com/q/24375555
tagged with: serialization
score: 0
answer count: 2
has title: Is possible use the same POJO in two different serializations, customizing some properties?
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/24376235
type: UnansweredQuestion
tagged with: jackson
has answer: http://stackoverflow.com/a/24376026
type: Question
has body: I want to use the same DTO but in some cases I need to ignore some properties and in other cases I want to use it, but I don't want to do a duplicate object or custom serialization, exist some way to specify, if the DTO is used on this implementation ignore this properties, and if DTO is used in other implementation don't ignore the properties. I'm using jackson to serialize the DTO public abstract class BaseAuditDto extends BaseIdentifiableDto { private static final long serialVersionUID = -6010447982202996167L; @JsonIgnore private String createdBy; @JsonIgnore private Date createdDate; @JsonIgnore private String updatedBy; @JsonIgnore private Date updatedDate; //getters and setters } Basically I need to use in some cases the createdBy and createdDate but in other cases I don't need it. Thanks.

http://stackoverflow.com/comment/37551801
type: QuestionComment
has text: Thanks Deinum, I did think about that :) But unfortunately, some of my Hibernate objects are defined in some jar libraries. So If I use this approach, I need to hack all those classes in order to input the appropriate tx manager. Unless maybe there is a way to set the default tx manager to one of the bean ?
score: 0
comment on: http://stackoverflow.com/q/24277001
type: Comment

http://stackoverflow.com/comment/37760987
score: 1
comment on: http://stackoverflow.com/q/24403634
type: Comment
type: QuestionComment
has text: As a side note, make DateTimeFormat a static class variable. Currently you create it every time every row is updated, but it is always the same. Or use a DateCell.

http://stackoverflow.com/comment/66839813
type: Comment
comment on: http://stackoverflow.com/a/38281222
score: 0
type: AnswerComment
has text: @Alex78191 What you mean by implicitly save on disk small files (<10240 bytes by default). Is there anyway to increase the limit

http://stackoverflow.com/a/24289000
downvote count: 0
answers question: http://stackoverflow.com/q/24288855
has body: In C++, static is one of the most overloaded keywords of the language. The meaning you're using here is this: A variable which is defined inside a function with the static specifier has static storage duration - it occupies the same space for the entire runtime of the program, and keeps its value between different calls to the function. So you can safely return a reference to it, as the variable is always there to back the reference. A normal (non-static) function-local variable is destroyed when the function call returns, and so the reference becomes dangling - it doesn't refer to anything valid. Using it results in Undefined Behaviour. Java simply doesn't have function-scope static variables (it doesn't have that meaning of the keyword static). That's why you can't declare it there. Both C++ and Java have the "class-scope" meaning of the static keyword. When a member of a class is declared with the static keyword, it means the member is not bound to any instance of the class, but is just a global variable whose identifier lives in the class's scope.
type: Answer
accepted answer of: http://stackoverflow.com/q/24288855
has comment: http://stackoverflow.com/comment/37532306
has comment: http://stackoverflow.com/comment/37532163
score: 22
upvote count: 22
has comment: http://stackoverflow.com/comment/37534566
type: AcceptedAnswer

http://stackoverflow.com/comment/37557447
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24300174
has text: @mKorbel It's contextual, if the data is not been modified, then yes, absolutly. If the data needs to changed on the UI, then it's faster to do the calculation in on the client then do an insert/update and retrival

http://stackoverflow.com/a/24300171
answers question: http://stackoverflow.com/q/24300017
has body: A more typical and scalable approach is one of the following: create a collection (likely an array or list) of N threads to perform the work use a thread pool, e.g. from Executors.newFixedThreadPool(N) You may also wish to use a Producer Consumer pattern in which the threads pull from a common task pool. This allows natural balancing of the work - instead of essentially hard-coding one thread handles 500 tasks and the other the same number. Consider after all what would happen if all of your larger files end up in the bucket handled by the Thread2? The first thread is done/idle and the second thread has to do all of the heavy lifting. The producer/consumer pooling approach would be to dump all of the work (generated by the Producer's) into a task pool and then the Consumers (your worker threads) bite off small pieces (e.g. one file) at a time. This approach leads to keeping both threads occupied for a similar duration.
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/98819498
score: 4
type: AnswerComment
has text: How the thread pool can reuse thread? Why state of thread in thread pool does not change to TERMINATED after the run method exit?
type: Comment
comment on: http://stackoverflow.com/a/24362623

http://stackoverflow.com/a/29687875
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24334759
has body: com.google.gwt.user.client.Window.Location.getHost()
downvote count: 0

http://stackoverflow.com/a/24374654
downvote count: 0
has comment: http://stackoverflow.com/comment/37694980
has comment: http://stackoverflow.com/comment/37695793
type: Answer
has comment: http://stackoverflow.com/comment/37695270
has comment: http://stackoverflow.com/comment/37695131
has comment: http://stackoverflow.com/comment/37695229
answers question: http://stackoverflow.com/q/24374029
score: 2
has comment: http://stackoverflow.com/comment/37727515
has comment: http://stackoverflow.com/comment/37695501
has comment: http://stackoverflow.com/comment/37729634
upvote count: 2
has body: You can accomplish this using generics: public abstract class AbstractEvent&lt;T extends EventListener&gt; { public interface EventListener { } protected static Set&lt;T&gt; listeners = new HashSet&lt;T&gt;(); public final boolean addListener(T listener) { return listeners.add(listener); } public final boolean removeListener(T listener) { return listeners.remove(listener); } } Edit 1: To avoid having to create a separate file for each interface, you may use the following code: public static void main(String[] args) { EventListener anEventListener = new EventListener() { // Any methods that you override for EventListener go in here }; SomeEvent evt = new SomeEvent(); // You can even pass an anonymous one as a parameter. evt.addListener(new EventListener() { }); } You may also do the following: public class SomeClass { // This event listener is a private member of a class private EventListener mEventListener = new EventListener() { // Any methods that you override for EventListener go in here }; }
has comment: http://stackoverflow.com/comment/37695018
has comment: http://stackoverflow.com/comment/37729552
has comment: http://stackoverflow.com/comment/37695081
has comment: http://stackoverflow.com/comment/37720063
has comment: http://stackoverflow.com/comment/37719865
has comment: http://stackoverflow.com/comment/37730444
has comment: http://stackoverflow.com/comment/37695322

http://stackoverflow.com/comment/37755241
has text: not getting anything printed, could this indicate that it's not reading the file properly?
comment on: http://stackoverflow.com/a/24406855
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37756435
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24403839
score: 1
has text: You'd typically make this a `provided` dependency and leave it up to the consumer to choose the Groovy version. Note that major Groovy versions aren't guaranteed to be backwards-compatible, but minor versions are. Instead of `groovy-all`, you could use specific dependencies such as `groovy-core`, `groovy-sql`, etc.

linux
tags question: http://stackoverflow.com/q/24337223
tags question: http://stackoverflow.com/q/24303135
tags question: http://stackoverflow.com/q/24292960
tags question: http://stackoverflow.com/q/24370328
tags question: http://stackoverflow.com/q/24395543
tags question: http://stackoverflow.com/q/24315952
tags question: http://stackoverflow.com/q/24374444
type: Tag
tags question: http://stackoverflow.com/q/24400242
tags question: http://stackoverflow.com/q/24313752
tags question: http://stackoverflow.com/q/24318041
tag name: linux
tags question: http://stackoverflow.com/q/24377630
tags question: http://stackoverflow.com/q/24283803
tags question: http://stackoverflow.com/q/24396145
tags question: http://stackoverflow.com/q/24342263
tags question: http://stackoverflow.com/q/24334207
tags question: http://stackoverflow.com/q/24395746
tags question: http://stackoverflow.com/q/24296800
tags question: http://stackoverflow.com/q/24316881
tags question: http://stackoverflow.com/q/24307982
tags question: http://stackoverflow.com/q/24353639
tags question: http://stackoverflow.com/q/24422542
tags question: http://stackoverflow.com/q/24334156
tags question: http://stackoverflow.com/q/24423816

http://stackoverflow.com/q/24267998
has title: OutOfBounds Exception ; working with Fractions
tagged with: java
tagged with: indexoutofboundsexception
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24268205
has body: I'm writing a program called FractionScaler that takes in a fraction from the user using Scanner, and then manipulates it. I've written a fraction class that handles all the calculations. The user is supposed to enter a fraction like this: "2/3" or "43/65" etc... This part works fine, the problem is when there is space between the integers: " 3 / 4 " or "2/ 5" etc... An "OutOfBoundsException: String index out of range: -1" occurs. Let me explain further. //This is the user inputted fraction. i.e. "2/3" or " 3 / 4" String frac = scan.next(); //This finds the slash separating the numerator from the denominator int slashLocate = frac.indexOf("/"); //These are new strings that separate the user inputted string into two parts on //either side of the "/" sign String sNum = frac.substring(0,slashLocate); //This is from the beginning of string to the slash (exclusive) String sDenom = frac.substring(slashLocate+1,frac.length()); //from 1 after slash to end of string //This trims the white space off of either side of the integers sNum = sNum.trim(); //Numerator sDenom = sDenom.trim(); //Denominator What I thought should be left is just two strings that look like integers, now I need to turn those strings into actual integers. //converts string "integer" into real int int num = Integer.parseInt(sNum); int denom = Integer.parseInt(sDenom); Now that I have two integers for the numerator and the denominator, I can plug them into a constructor for the fraction class I wrote. Fraction fraction1 = new Fraction(num, denom); I doubt this is the best way to go about this, but it is the only way I could think of. When the user inputted fraction has no spaces, EX. "2/3" or "5/6" , the program works fine. When the user input has spaces of any kind, EX. "3 / 4" or " 3 /4" , the following error is shown: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1. The terminal points to line 17 of my code which is this line above: String sNum = frac.s…
score: -1
possible better answer: http://stackoverflow.com/a/24268205
downvote count: 1
tagged with: trim
has answer: http://stackoverflow.com/a/24268107
favorite count: 0
accepted answer: http://stackoverflow.com/a/24268107
has comment: http://stackoverflow.com/comment/37491895
type: AnsweredQuestion
tagged with: fractions
upvote count: 0

http://stackoverflow.com/q/24385613
tagged with: ls2j
has answer: http://stackoverflow.com/a/24404488
has comment: http://stackoverflow.com/comment/37716605
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/31828930
has comment: http://stackoverflow.com/comment/37747847
tagged with: java
tagged with: lotus-domino
type: Question
has body: enter code hereI try to acess a java class by his interface I make a class in Ls2J instead the java interface because i don't know how i do and i have the error : error : LS2J Error: Java constructor failed to execute An idea ? ^^ thanks ! my class java in lotus Class ILogWebService sessionJava As JAVASESSION classJava As JAVACLASS objectJava As JAVAOBJECT methodJava As JAVAMETHOD Public Sub New(logDTO As LogWSDTO) Set sessionJava = New JAVASESSION Set classJava = sessionJava.GetClass("com.pasquier.DAO.WS/ILogWebService") Set objectJava = classJava.CreateObject End Sub Public Sub notesMain() Set methodJava = classJava.GetMethod("notesMain","()V") objectJava.notesMain End Sub End Class my java interface: package com.pasquier.IDAO.WS; import com.pasquier.MesExceptions.ExceptionWS; public interface ILogWebService { void notesMain() throws ExceptionWS; } my java class : public class LogWebService implements ILogWebService { private Session session; private LogWSDTO logDTO = null; public LogWebService(LogWSDTO log) { this.logDTO = log; } public void notesMain() throws ExceptionWS { try { try { session = WebServiceBase.getCurrentSession(); ILogWSDAO ilog = FactoryWS.getInstance().createLogWSDAO(session, logDTO); ilog.ajouterLog(); } finally { UtilMemoire.purgeMemoire(); } } catch (NullPointerException e1) { System.out.println("ERREUR NullPointer sur NotesMain sur LogWebService"); throw new ExceptionWS("ERREUR NullPointer sur NotesMain sur LogWebService", e1, logDTO); } catch (ExceptionWS e) { System.out.println( e.getMessage()); } catch (Exception e2) { System.out.println("ERREUR sur NotesMain sur LogWebService " + e2.getMessage()); throw new ExceptionWS("ERREUR sur NotesMain sur LogWebService " + e2.getMessage(), e2, logDTO); } } my lotuscript : Class LogGetAllDocumentsDAO Private ilog As ILogWebService Private logDTO As LogWSDTO Private docDTO As LogGetAllDocumentsDTO Private utilDt As UtilDate Public Sub New(logWSparam As LogWSDTO, docDTOparam As LogGetAllDocumentsDTO)…
accepted answer: http://stackoverflow.com/a/24404488
has comment: http://stackoverflow.com/comment/37715097
has comment: http://stackoverflow.com/comment/37746968
score: 0
has comment: http://stackoverflow.com/comment/37750941
answer count: 3
possible better answer: http://stackoverflow.com/a/24389127
has title: access to a java interface in lotuscript with LS2J?
has comment: http://stackoverflow.com/comment/37748582
has answer: http://stackoverflow.com/a/24389127

http://stackoverflow.com/q/24356856
tagged with: java
downvote count: 1
type: Question
tagged with: apache-karaf
score: -1
tagged with: blueprint-osgi
upvote count: 0
answer count: 1
has title: @Cacheable annotation not working with osgi blueprint
favorite count: 0
tagged with: ehcache
tagged with: osgi
type: UnansweredQuestion
has body: What is a proper way to turn on ehcache inside the OSGi container with Blueprint. To turn on ehcache for the non-osgi, non-blueprint projects we simply use spring annotation: org.springframework.cache.annotation.Cacheable Inside java: @Cacheable public void method() { } In xml configuration: &lt;beans xmlns:cache="http://www.springframework.org/schema/cache" &lt;cache:annotation-driven/&gt; ... Unfortunately it's not the case inside OSGi and Blueprint because we cannot mix Blueprint with Spring. I've tried and got an exception that the namespace handler was not found. Is this possible with the @Cacheable annotation or should we rather try ehcache without spring support? I use Karaf 2.3.0.redhat-610379, JBoss Fuse 6.1.0
has answer: http://stackoverflow.com/a/24360167

http://stackoverflow.com/comment/37768350
comment on: http://stackoverflow.com/a/24411477
type: Comment
score: 1
type: AnswerComment
has text: good answer. OP should consider using Theories to pass in all values that should cause the exception

http://stackoverflow.com/a/25889099
answers question: http://stackoverflow.com/q/24364136
type: AcceptedAnswer
has body: After using the jar myself for oAuth implementation i must say it's quite good. EVEN TWITTER SUPPORTS THE USAGE OF THIS here's the link, https://dev.twitter.com/overview/api/twitter-libraries to support my claim. About the library: it's pretty good and easy to use. But i just used it for oAuth and tested some of the methods. I works... Here's a tutorial link of the usage http://www.androidhive.info/2012/09/android-twitter-oauth-connect-tutorial/ for the api calls not covered in the twitter4j you can do it on your own
type: Answer
accepted answer of: http://stackoverflow.com/q/24364136
score: 0

http://stackoverflow.com/comment/37522585
has text: Don't try to read lines randomly from the file. Read lines from the file into an array, and _then_ randomly shuffle the lines.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24283238

http://stackoverflow.com/q/24354451
has title: Hibernate mapping annotation skipped by the system
type: Question
has answer: http://stackoverflow.com/a/24360252
has body: I have an issue with the mapping under hibernate. I have an abstract class which implements an interface: @MappedSuperclass @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) public abstract class AbstractPromotion implements IPromotion { } This abstract class is the super class(as you can see with the annotation) and 3 mapped classes with @Entity extend this super class. When i launch a "maven install" i get this failure message inside the console , it says : Caused by: org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class: product.model.Product.promotion[product.promotion.AbstractPromotion] i don't understand it because the class in question is mapped (as the classes which extend it) as above but it's like the annotations are skipped... any help would be really appreciated best regards
score: 0
answer count: 2
tagged with: maven
tagged with: spring
has answer: http://stackoverflow.com/a/24354739
tagged with: java
tagged with: hibernate
type: UnansweredQuestion

http://stackoverflow.com/q/24378824
answer count: 1
has body: Suppose I want to handle patch requests and write code like that: @RequestMapping(value = "/{id}", method = RequestMethod.PATCH) @Consumes("application/json") @Produces("application/json") public SomeResponse updateType(@PathVariable String id, @RequestBody ContactDto contact) throws Throwable { //extract parameters from contact } So the problem is how recognize what parameters are set from patch requests? At first look it is obvious to write like this: if (contact.getHobby() != null) { updateHobby(contact.getHobby()); } But what if I want to set hobby to null via json or delete it from current contact? So I pass a json string without hobby property and upper code does not work. So the problem is - how separate properties that are set to null from those which are not set at all?
tagged with: patch
has title: How separate unset json properties from null json properties in java and PATCH requests?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24378930
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
accepted answer: http://stackoverflow.com/a/24378930
score: 0

http://stackoverflow.com/a/24362743
has body: Here's an algorithm.. If you are not sure that the last ")" would be the one you are looking for. Start from index 0 of the String, for each "(" you encounter, increment the count, and for each ")" decrement the count, replace the ")" with "#".
score: 0
answers question: http://stackoverflow.com/q/24362335
type: Answer

http://stackoverflow.com/comment/37714890
type: Comment
comment on: http://stackoverflow.com/q/24385479
type: QuestionComment
has text: There's no output in fact.
score: 0

http://stackoverflow.com/q/24324974
tagged with: deployment
type: UnansweredQuestion
tagged with: oracle-adf
tagged with: jdeveloper
has body: I have two fusion web applications in oracle adf (jdeveloper): LoginApp InventoryApp To share session between this two applications I have enabled session sharing in both applications. weblogic-application.xml: true Now to share session between the two applications I have found that I needs to create a ear file. So my question is that how to create .ear file containing two applications.
tagged with: java
has answer: http://stackoverflow.com/a/24333510
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24336275
score: 0
has title: how to create ear file in jdeveloper
tagged with: ear

http://stackoverflow.com/q/24353110
has comment: http://stackoverflow.com/comment/37653871
upvote count: 1
has answer: http://stackoverflow.com/a/24353178
tagged with: polymorphism
favorite count: 0
type: UnansweredQuestion
has title: Overloading in subclass not working
tagged with: overloading
has comment: http://stackoverflow.com/comment/37653859
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37654944
type: Question
downvote count: 0
tagged with: overriding
answer count: 1
has body: I have he following scenario: public abstract class Value&lt;T&gt; { public void Value add(Value v) { // Statements } } public class IntValue extends Value&lt;String&gt; { public void IntValue add(IntValue v) { // Statements } } And in another part of the code: public void exec(Value a, Value b) { a.add(b); } My question is, why, knowing that a and b are instances of IntValue, the code executed is from their super class. Thank you very much!

http://stackoverflow.com/q/24369171
type: UnansweredQuestion
has title: How to get Sqoop Server Running URL and Port in Horton Sandbox
tagged with: mapreduce
has answer: http://stackoverflow.com/a/24377781
has comment: http://stackoverflow.com/comment/70696490
score: 2
downvote count: 0
tagged with: sqoop
tagged with: sqoop2
favorite count: 0
has body: I am using sqoop client. And don't know by which URL I have to initialize the SqoopClient Object. I am running horton Sandbox which is preconfigured with everything. I dont know it is having sqoop server running or not. And If it is running then I dnt know the port. And If it is not running how can I run it in Sandbox. I am reading tutorial given at this page: http://devslogics.blogspot.in/2013/09/sqoop-java-client.html This two lines is the focus to initialize with url. String url = "http://192.168.56.102:12000/sqoop/"; SqoopClient client = new SqoopClient(url); Here is my complete code - //Here I am using a table Persons, with columns PersonID and LastName import org.apache.sqoop.client.SqoopClient; import org.apache.sqoop.model.MConnection; import org.apache.sqoop.model.MConnectionForms; import org.apache.sqoop.model.MJob; import org.apache.sqoop.model.MJobForms; import org.apache.sqoop.model.MSubmission; import org.apache.sqoop.validation.Status; /** * @author devan * @date 19-Sep-2013 * @mail msdevanms@gmail.com */ public class SqoopImport { public static void main(String[] args) { String connectionString = "jdbc:mysql://localhost:3316/dw_db"; String username = "openmrs"; String password = "ePM2zeKZOzrL"; String schemaName = "dw_db"; String tableName = "dw_table"; String columns = "locale,name"; //comma seperated column names String partitionColumn = "locale"; String outputDirectory = "/output/Persons"; String url = "http://192.168.56.102:12000/sqoop/"; SqoopClient client = new SqoopClient(url); //client.setServerUrl(newUrl); //Dummy connection object MConnection newCon = client.newConnection(1); //Get connection and framework forms. Set name for connection MConnectionForms conForms = newCon.getConnectorPart(); MConnectionForms frameworkForms = newCon.getFrameworkPart(); newCon.setName("MyConnection"); //Set connection forms values conForms.getStringInput("connection.connectionString").setValue(connectionString); conForms.getStringInput("connection.jdbcDriver")…
type: Question
has comment: http://stackoverflow.com/comment/70696377
upvote count: 2
tagged with: java
answer count: 2
tagged with: hortonworks-data-platform
has answer: http://stackoverflow.com/a/27098527

http://stackoverflow.com/comment/37724837
comment on: http://stackoverflow.com/q/24362732
score: 0
type: Comment
has text: can you post configuration of undertow subsystem? did you configure session sharing or sso?
type: QuestionComment

http://stackoverflow.com/comment/37671918
has text: @EJP Any recommendations how to implement that?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24362335
type: Comment

http://stackoverflow.com/comment/37750043
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24403993
score: 0
has text: please print the exact stacktrace as outputted by your IDE

http://stackoverflow.com/comment/37520420
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24282892
has text: What problem do you have with lowercase?

http://stackoverflow.com/q/24311842
has comment: http://stackoverflow.com/comment/37581131
favorite count: 0
has comment: http://stackoverflow.com/comment/37577808
type: Question
has title: Generic Comparable type for compareTo
accepted answer: http://stackoverflow.com/a/27664845
tagged with: java
has body: I have a method called getMember which may return any Comparable object, String, Integer etc. I can't figure out what to use as type parameter so compareTo will work. Code below is not working Comparable&lt;? extends Comparable&lt;?&gt;&gt; m1 = column.getMember(o1); Comparable&lt;? extends Comparable&lt;?&gt;&gt; m2 = column.getMember(o2); int compareTo = m1.compareTo(m2); In case I wasn't clear, m1 and m2 will always be same type. Comparing without type parameters works fine, I just wanted to know what to put in &lt;>
upvote count: 1
answer count: 1
tagged with: compareto
has comment: http://stackoverflow.com/comment/37578987
has comment: http://stackoverflow.com/comment/37574876
tagged with: comparable
has answer: http://stackoverflow.com/a/27664845
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/comment/37656836
has text: Congratulations, you have just found the importance of **loop** and **function** -- two very important concepts in programming.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24354296

http://stackoverflow.com/comment/37764061
has text: `System.getProperty()` sounds fitting.
comment on: http://stackoverflow.com/q/24411648
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/a/24423555
downvote count: 0
score: 1
has body: With StringTemplate 4 the error listener is informed about an undefined attribute. With a custom error-listener you can handle this as required. For example: ST tmp = new ST("Hello &lt;name&gt;!"); tmp.write(new NoIndentWriter(new StringWriter()), new STErrorListener() { @Override public void runTimeError(STMessage msg) { if(msg.error == ErrorType.NO_SUCH_ATTRIBUTE) System.out.println("Attribute not defined: "+ msg.arg); } @Override public void compileTimeError(STMessage msg) { } @Override public void IOError(STMessage msg) { } @Override public void internalError(STMessage msg) { } });
answers question: http://stackoverflow.com/q/24364355
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/37787728

http://stackoverflow.com/a/24340260
has comment: http://stackoverflow.com/comment/37648467
answers question: http://stackoverflow.com/q/24340116
accepted answer of: http://stackoverflow.com/q/24340116
score: 4
has comment: http://stackoverflow.com/comment/37629754
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Your input is messed up. I would consider unescaping everything into "normal form" with &amp;, &lt;, &gt; unescaped, then escape the result. Using StringEscapeUtils (from Apache Commons lang) it looks like this: String test = "aaa &amp;amp; bbb &amp; ccc &amp;lt; ddd &amp; eee."; test = StringEscapeUtils.escapeXml(StringEscapeUtils.unescapeXml(test)); Result: aaa &amp;amp; bbb &amp;amp; ccc &amp;lt; ddd &amp;amp; eee. If you really want to go ahead with your current solution, I'd recommend using something like: test = test.replaceAll("&amp;(?!.{2,4};)", "&amp;amp;"); Break-down of the regex: &amp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- An &amp; character (?! ___ ) -- Not followed by ___ .{2,4}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Any 2, 3 or 4 characters ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- followed by a ;
has comment: http://stackoverflow.com/comment/37648282

http://stackoverflow.com/q/24399847
duplicate of: http://stackoverflow.com/q/19648240
has answer: http://stackoverflow.com/a/24399912
answer count: 4
has answer: http://stackoverflow.com/a/24399903
has answer: http://stackoverflow.com/a/24400196
type: UnansweredQuestion
type: Question
has body: I am trying to print a multidimensional array filled with *s. here is the code. String[][] star = new String[10][10]; for(String[] row: star) { Arrays.fill(row, "*"); } System.out.println(Arrays.toString(star)); // prints something like 'Ljava.lang.String;@592fa617' But I can't seem to print out what i want...what am I doing wrong?
tagged with: java
has answer: http://stackoverflow.com/a/24399910
has title: Print an array in Java
score: 0
tagged with: arrays
linked to: http://stackoverflow.com/q/19648240

http://stackoverflow.com/comment/37587882
comment on: http://stackoverflow.com/q/24318137
score: 0
type: Comment
type: QuestionComment
has text: Your way of reading lines from file has buggy since you don't fill index `[0]` but you place lines starting in `[1]`. Also since you have only two lines and array of 5 elements some of them will be `null`s which means that in some place `accounts[f].substring(..)` will be same as calling `null.substring(..)` and since `null` doesn't have any fields you are seeing NullPointerExcelption. Instead of arrays you should use `List` which is dynamic structure and can grow each time you will add line to it.

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/24404783
tag name: google-oauth
tags question: http://stackoverflow.com/q/24393228

http://stackoverflow.com/a/24383071
has comment: http://stackoverflow.com/comment/94453096
score: 7
has body: Drag and drop is not a simple process, it's quite complex and involved. With this complexity comes flexibility. Swapping values in this way isn't the same as "moving" per se. When moving something, you take it from the source and place it in the target, here we are swapping values between the source and target, this means we need more information than is generally available via the API. First of all, you're going to need a custom class to hold the data to be exported, because we're moving data, this is going to require some additional information, in particular, the source component... The following is just a simple wrapper. We could export the JTable entirely, but I wanted to demonstrate a basic concept of drag-n-drop... import javax.swing.JTable; public class CellData { private JTable table; public CellData(JTable table) { this.table = table; } public int getColumn() { return table.getSelectedColumn(); } public String getValue() { int row = table.getSelectedRow(); int col = table.getSelectedColumn(); return (String) table.getValueAt(row, col); } public JTable getTable() { return table; } } Next, we need a custom Transferable to manage our data... import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; import java.io.IOException; public class CellDataTransferable implements Transferable { public static final DataFlavor CELL_DATA_FLAVOR = createConstant(CellData.class, "application/x-java-celldata"); private CellData cellData; public CellDataTransferable(CellData cellData) { this.cellData = cellData; } @Override public DataFlavor[] getTransferDataFlavors() { return new DataFlavor[]{CELL_DATA_FLAVOR}; } @Override public boolean isDataFlavorSupported(DataFlavor flavor) { boolean supported = false; for (DataFlavor available : getTransferDataFlavors()) { if (available.equals(flavor)) { supported = true; } } return supported; } @Override public Object getTransferData(DataFlavor flavor) t…
has comment: http://stackoverflow.com/comment/37722740
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37723404
accepted answer of: http://stackoverflow.com/q/24381981
type: Answer
has comment: http://stackoverflow.com/comment/37736045
answers question: http://stackoverflow.com/q/24381981
has comment: http://stackoverflow.com/comment/94462786
has comment: http://stackoverflow.com/comment/47679893
upvote count: 7

http://stackoverflow.com/comment/37626350
type: Comment
comment on: http://stackoverflow.com/a/24338916
score: 0
type: AnswerComment
has text: What internal implementation do you expect from this? Only one vararg is allowed, otherwise, you will run into the problem described in the answer.

http://stackoverflow.com/comment/37769031
type: Comment
type: QuestionComment
has text: Right now I differentiate through a variable in a properties file loaded via a "context:property-placeholder" namespace element.
score: 0
comment on: http://stackoverflow.com/q/24412968

http://stackoverflow.com/comment/37578718
comment on: http://stackoverflow.com/a/24311185
type: AnswerComment
has text: @user3580294: This is more of a language-agnostic question. For Java, yes, `finally` is probably a better better choice. Also, in Java, you don't lose any info this way (The stack trace is generated when you create a new Exception, not when you rethrow it)
score: 0
type: Comment

http://stackoverflow.com/a/24386731
has comment: http://stackoverflow.com/comment/40376790
downvote count: 0
answers question: http://stackoverflow.com/q/24386172
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/38416656
has comment: http://stackoverflow.com/comment/40377482
has comment: http://stackoverflow.com/comment/37717395
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/43789794
accepted answer of: http://stackoverflow.com/q/24386172
score: 2
has body: I've used this tool before to convert SVN to git. https://github.com/nirvdrum/svn2git All the installation and usage details are in the README in the repo. They have 10 example imports but in a nutshell you just: point pass the SVN location to the tool it creates a local git version with all the history intact push it to your new remote git repo (if desired). Edit: Just found a duplicate so I'll flag this question. There's many answers to choose from there.
has comment: http://stackoverflow.com/comment/37717485
has comment: http://stackoverflow.com/comment/38416515

http://stackoverflow.com/comment/37550077
has text: Thank you for the help! I accepted the answer, but am unable to upvote.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24298579

http://stackoverflow.com/a/24366083
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37678828
has body: This looks like a Hibernate thing, rather than strictly a SQL problem. I think addEntity requires all columns to have distinct names, that match the fields in the entity being added. Oracle, alas, has no problem returning results with duplicate problem names, which is why your query works in SQL Developer. Try giving all your columns in the SELECT clause distinct aliases, specifically, aliases that match the field members in your entity.
type: AcceptedAnswer
upvote count: 1
answers question: http://stackoverflow.com/q/24364924
accepted answer of: http://stackoverflow.com/q/24364924
has comment: http://stackoverflow.com/comment/37678599

http://stackoverflow.com/q/24393245
has title: HTTP request with generic class in Java
downvote count: 0
tagged with: generic-handler
tagged with: web
tagged with: generics
linked to: http://stackoverflow.com/q/13819734
favorite count: 0
type: UnansweredQuestion
has body: I have a generic class: BaseResponseDTO&lt;T&gt; { T payload; } I'm making a REST call which returns this object: String url = "http://REST-CALL-LINK"; HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); BaseResponseDTO&lt;UserDTO&gt; requestMap = new BaseResponseDTO&lt;UserDTO&gt;(); HttpEntity&lt;BaseResponseDTO&lt;UserDTO&gt;&gt; reqEntity = new HttpEntity&lt;BaseResponseDTO&lt;UserDTO&gt;&gt;(requestMap, headers); BaseResponseDTO&lt;UserDTO&gt; response = new BaseResponseDTO&lt;UserDTO&gt;(new UserDTO()); ResponseEntity&lt;BaseResponseDTO&lt;UserDTO&gt;&gt; responseUnifiedDTO = restTemplate.exchange(url, HttpMethod.GET, reqEntity, response.getClass()); UserDTO user = responseUnifiedDTO.getBody().getPayload(); This piece of code gives me the error: Type mismatch: cannot convert from ResponseEntity&lt;capture#2-of ? extends BaseResponseDTO&gt; to ResponseEntity&lt;BaseResponseDTO&lt;UserDTO&gt;&gt;
answer count: 0
score: 1
tagged with: java
duplicate of: http://stackoverflow.com/q/13819734
upvote count: 1
tagged with: http
type: Question

http://stackoverflow.com/comment/37665110
has text: I am not good at explaining , but let me try, there will be server code and client code generated on each call to create process on both nodes. (Correct ?) . in each client code do i have to call to same port or each registry will bind itself to new port? Also as stuart suggested now i do have to compile the RMI code only. And then execute the `start rmiregistry` or `rmiregistry` depending on OS. But now another problem is if i generate another server client code on both nodes when `rmiregistry` is already execute state or one of code is already running , do i have execute a seprate TBC...
type: AnswerComment
comment on: http://stackoverflow.com/a/24347174
score: 0
type: Comment

http://stackoverflow.com/q/24401507
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/37749172
tagged with: sqlite
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/24402419
favorite count: 0
has answer: http://stackoverflow.com/a/24402419
score: 2
type: AnsweredQuestion
has title: LIKE is working on BLOB type but = is not working
upvote count: 2
has body: I have table with both fields of BLOB data type. I have used sqlite database. I have to insert only binary text into the table. I have written the program in C. I have inserted successfully. I have inserted into the table using prepared statement When I try to find an entry using '=' it is not working. But LIKE gives INSERT INTO test1 VALUES('^A~T^F�u�(Z&lt;-~K�~A3���H9�~\�~A[�$D~G%~^|�',"^Q'^K^S^H�~Iq�~Or~N)V��~K�"); QUERY Statements SELECT COUNT(*) FROM invalid_cert WHERE issuerId='^A~T^F�u�(Z&lt;-~K�~A3���H9�~\�~A[�$D~G%~^|�'; This statement is giving count as 0 whereas SELECT COUNT(*) FROM invalid_cert WHERE issuerId LIKE '^A~T^F�u�(Z&lt;-~K�~A3���H9�~\�~A[�$D~G%~^|�'; This statement returns the correct count. Why is this happening ? I have even checked the length of string in table and length of the string which is inserted. Both the lengths are same. I have even checked whether there are any '\n' or '\r' appended to the string. No such string is appended.

http://stackoverflow.com/comment/37617792
has text: Sorry i do not understand you. In this way i cannot help you.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24333761
score: 0

http://stackoverflow.com/q/24305788
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24336726
type: AnsweredQuestion
has body: I am trying to grant permission to a group on a folder in Perforce. However, the permission table that is created/updated from Java in Perforce is empty. Following are the steps that I do - //Get the server object. IOptionsServer server = ServerFactory.getOptionsServer("p4java://&lt;ip&gt;:1666", null); server.connect(); server.setUserName("&lt;username&gt;"); // this is a super user server.login("&lt;password&gt;"); //Create a user group and add users. IUserGroup ug = new UserGroup(); String groupName = "&lt;usergroup_somename&gt;; ug.setName(groupName); List&lt;String&gt; userList = new ArrayList&lt;&gt;(); userList.add("&lt;username1&gt;"); userList.add("&lt;username2&gt;"); userList.add("&lt;username3&gt;"); ug.setUsers(userList); server.createUserGroup(ug); //Get the permission table. GetProtectionEntriesOptions gpo = new GetProtectionEntriesOptions(); gpo.setAllUsers(true); List&lt;IProtectionEntry&gt; peList = server.getProtectionEntries(null, gpo); //Create a new Protection entry IProtectionEntry pe = new ProtectionEntry(); pe.setGroup(true); pe.setName(groupName); depotFilePath = "//depottest/Level1/Level2/..."; // the folders exist in Perforce pe.setPath(depotFilePath); pe.setMode("write"); pe.setHost("*"); pe.setPathExcluded(false); pe.setOrder(peList.size()); pe.setType(EntryType.INCLUDE); //Add the new created permission into the fetched Permission table list. peList.add(pe); //Create/Update the Permission table using either of the following methods separately or in combination creates a blank permission table. server.createProtectionEntries(peList); server.updateProtectionEntries(peList); According to the documentation the methods in the end should create/replace/update the Permission table, however, this does not happen and instead the permission table in the Perforce server is deleted/blank. I may be missing something. Can someone please give some suggestions on how to fix this? P.S. I have tried using only the updateProtectionEntries(peList) method …
tagged with: java
upvote count: 1
type: Question
tagged with: p4java
tagged with: perforce
accepted answer: http://stackoverflow.com/a/24336726
has title: Appending perforce permission table through java results in blank permission table
answer count: 1

http://stackoverflow.com/q/24359471
tagged with: java
has answer: http://stackoverflow.com/a/24359636
answer count: 1
tagged with: jpa
has body: THe title can't definitely reflect my question, however I don't know how to express. I have a JPA entity (VatOperatorBalance which has a field saleBalance), lets say I retrieve the entity at the first time, and get a entity (VatOperatorBalance@3d6396f5), its saleBalance is 100.0. Now there are other operations which has modified the saleBalance to 200, now I query from database and get a new entity (VatOperatorBalance@10f8ed), sure the saleBalance of this entity is 200.0. However what make me confused it the saleBalance of the old entity (VatOperatorBalance@3d6396f5) is also 200.0. All these queries and operations are in a single transaction, and the query isn't by EntityManager.find(java.lang.Class&lt;T&gt; entityClass, java.lang.Object primaryKey) which will return entity from cache. Below is my code @Rollback(true) @Test public void testSale_SingleBet_OK() throws Exception { // prepare request ... // query the VatOperatorBalance first VatOperatorBalance oldBalance = this.getVatOperatorBalanceDao().findByOperator("OPERATOR-111"); //this.entityManager.detach(oldBalance); logger.debug("------ oldBalance(" + oldBalance + ")."); // the operation which will modify the oldBalance Context saleReqCtx = this.getDefaultContext(TransactionType.SELL_TICKET.getRequestType(), clientTicket); saleReqCtx.setGameTypeId(GameType.VAT.getType() + ""); Context saleRespCtx = doPost(this.mockRequest(saleReqCtx)); RaffleTicket respTicket = (RaffleTicket) saleRespCtx.getModel(); this.entityManager.flush(); this.entityManager.clear(); // assert vat sale balance VatOperatorBalance newBalance = this.getVatOperatorBalanceDao().findByOperator("OPERATOR-111"); logger.debug("------ newBalance(" + newBalance + ")."); assertEquals(oldBalance.getSaleBalance().add(respTicket.getTotalAmount()).doubleValue(), newBalance .getSaleBalance().doubleValue(), 0); } This testcase will fail, I don't understand why this will happen. JPA entity manager will update all entities of same entity type? The oldBalance …
score: 0
accepted answer: http://stackoverflow.com/a/24359636
has title: JPA entities updated implicitly by new query
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/24367829
favorite count: 0
tagged with: osgi
type: UnansweredQuestion
upvote count: 1
has body: I'm currently working on a backup and restore mechanism for an OSGi (java) based platform and would like to do the following BUNDLE A - Some package: void methodDefinedByInterface(Class1 a, Class2 b){ ... } I'd like to be able to add something like an annotation to this method as follows: @Backup void methodDefinedByInterface(Class1 a, Class2 b){ ... } So that I can gather the class + method information and also the variable data itself in another bundle so I can back that data up, "Method call on class blabla in package blabla with parameters .. .. ..". Is this possible within OSGi? I've read up on AspectJ but most information I found seemed quite dated. Or can I add an implementation to the target platform?
has title: Intercepting method calls in java osgi
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24370296
tagged with: aspectj
tagged with: aspect
answer count: 1
downvote count: 0

http://stackoverflow.com/a/24372060
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24371919
has body: use getText() like so EditText inputView = (EditText) findViewById(R.id.input); String inputValue = inputView.getText().toString(); you should do all of this in the onCreate() method

http://stackoverflow.com/q/24369113
has comment: http://stackoverflow.com/comment/37684309
has comment: http://stackoverflow.com/comment/37685714
has answer: http://stackoverflow.com/a/24371160
tagged with: playframework-2.0
linked to: http://stackoverflow.com/q/9992400
tagged with: scala
type: UnansweredQuestion
has body: I am developing a Play 2 (v2.2.3) Java application (with Java 8) whose task is to fetch data from two web services and return a composed result. From my first WS call I get a JSON array object with let's say job listings. Now for every job in this collection I want to call another WS which gives me something like the stock price of the company offering the job. After all this I expect my action to return this new 'enhanced' JSON array where along with each job listing I also see the stock price. I started putting something together and I managed to get the list of jobs back but somehow the part where I glue the two call together is not working/being called. public static Promise&lt;Result&gt; index() { final Promise&lt;WS.Response&gt; resultPromiseJobs = WS.url("https://jobs.github.com/positions.json?description=java").get(); final Promise&lt;Result&gt; result = resultPromiseJobs.flatMap(response -&gt; { JsonNode jobListings = response.asJson(); // convert jobListings to a collection List&lt;Job&gt; jobs = ... // call map on this collection to fetch stock prices for each element jobs.stream().map(job -&gt; { Promise&lt;WS.Response&gt; resultPromiseStock = WS.url("secondURL?someQuery=job").get()); // this also returns a promise // so let's map it to something // ??? what to map to and how to convert all this to a 'Result' resultPromiseStock.map(); ... }); }); return result; // what is the correct object to return here? } This is basically the same question but about Scala, I am interested in the Java solution
upvote count: 1
tagged with: web-services
has comment: http://stackoverflow.com/comment/37684598
type: Question
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/37685220
has comment: http://stackoverflow.com/comment/37685695
has comment: http://stackoverflow.com/comment/37684472
answer count: 1
downvote count: 0
has title: Multiple WS calls in one Java Play action
has comment: http://stackoverflow.com/comment/37684411
favorite count: 0

http://stackoverflow.com/comment/37691037
type: QuestionComment
has text: Yes of course they are.
comment on: http://stackoverflow.com/q/24372178
score: 0
type: Comment

http://stackoverflow.com/comment/37761445
comment on: http://stackoverflow.com/a/24372254
has text: Sorry, had quite the busy day yesterday. The Tests do not have to be in src/test/java in order to be found, since the testing is done in a separate plug in. I have a simple example that works where the test is in src/some_stuff/more_stuff/test/SimpleJunitTest.java
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24360525
has body: Mail servers generally log the address in the message in the message itself and you can look at that. Issue foo uid fetch x:y body.peek[header.fields (received)] for a set of messages. The first Received field for each message frequently contains a "for" clause. Here's one from my inbox (abbreviated for clarity): Received: from ... by ... with lmtp id ... for arnt@gulbrandsen.priv.no; Sun, 22 Jun 2014 20:52:26 +0000 The address in the "for" clause is generally an address belonging to the IMAP account, if it is present at all. The for clause is optional, so you can't rely on it. Note that for clauses in the second and subsequent Received fields are much less reliable.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24319466
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24319466

http://stackoverflow.com/q/24367994
score: 2
has answer: http://stackoverflow.com/a/24368088
tagged with: java
accepted answer: http://stackoverflow.com/a/24368088
has comment: http://stackoverflow.com/comment/40368217
type: Question
type: AnsweredQuestion
tagged with: hashcode
tagged with: data-structures
answer count: 1
downvote count: 1
has body: I would like to generate a hash-code for the following equals-method. public MyClass class { private int a; private final String b; public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof MyClass)) return false; MyClass myClass = (MyClass) o; return a == myClass.a || (b == null ? myClass.b == null : b.equals(myClass.b)); } @Override public int hashCode() { int result = (int) (a^ (a &gt;&gt;&gt; 32)); result = 31 * result + (b != null ? b.hashCode() : 0); return result; } } The catch is that equals returns true in a single or both of 2 cases: either o1.a == o2.a or o1.b == o2.b. In such a case usual hash won't be the same for: myClass("a", "b") and myClass("a", null)
favorite count: 0
upvote count: 3
tagged with: hash
has title: HashCode for conditional equals

http://stackoverflow.com/q/24361179
tagged with: image
type: Question
has answer: http://stackoverflow.com/a/24361213
accepted answer: http://stackoverflow.com/a/24361213
score: 0
has title: Swing insert image via ContentType("text/html");
tagged with: jtextcomponent
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has body: I have coded the following code: JDialog helpDialog = new JDialog(); helpDialog.setTitle("Help"); helpDialog.setResizable(false); helpDialog.setAlwaysOnTop(true); helpDialog.setSize(393, 43); help.setSize(195,195); help.setEditable(false); help.setFont(new Font("Arial", Font.PLAIN, 24)); String txt = "&lt;b&gt;&lt;big&gt;"+ "Help Page " +"&lt;/big&gt;&lt;/b&gt;" + "&lt;br/&gt;" + " &lt;img src= \" ..\\image.jpg \" alt= \" Logo \" height= \" \" width=\" 42 \"&gt; "; help.setContentType("text/html"); help.setText(txt); help.setCaretPosition(0); helpDialog.add(help); helpDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); helpDialog.pack(); helpDialog.setVisible(true); //Window in center of the display not in the left top corner helpDialog.setLocationRelativeTo(null); This dialog is just to inform the user. I want to add an image via String txt = "&lt;b&gt;&lt;big&gt;"+ "Help Page " +"&lt;/big&gt;&lt;/b&gt;" + "&lt;br/&gt;" + " &lt;img src= \" ..\\image.jpg \" alt= \" Logo \" height= \" \" width=\" 42 \"&gt; ";, however the image does not get displayed even though its in the scr folder. Any recommendations where to put it? I appreciate your answer!
tagged with: swing
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/37665226
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24358784
has text: Post your code what u tried?

http://stackoverflow.com/q/24371695
has comment: http://stackoverflow.com/comment/37689208
has answer: http://stackoverflow.com/a/24371943
linked to: http://stackoverflow.com/q/7697213
score: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24371943
has title: hashCode and compareTo for non-standard equals
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37689058
has body: Given following implementation of equals: public class Test implements Comparable&lt;Test&gt; { private int x, y; @Override public boolean equals(Object obj) { if (obj instanceof Test) { Test other = (Test) obj; return x == other.x || y == other.y; } return false; } @Override public int hashCode() { //implementation? } @Override public int compareTo(Test o) { //implementation? } } What is correct/most performant implementation of hashCode and compareTo? Please note - equals uses OR, not AND
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37689260
has comment: http://stackoverflow.com/comment/37778535
has comment: http://stackoverflow.com/comment/37689146

http://stackoverflow.com/q/24385356
has comment: http://stackoverflow.com/comment/37718637
has title: Docx4j difference between two Word docs
tagged with: ms-word
favorite count: 0
type: UnansweredQuestion
tagged with: diff
answer count: 0
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37718793
tagged with: docx4j
score: 0
has body: I need check the difference between 2 Word docx Files. Iam using docx4j. At first I had to change the SmartXMLFormatter: public SmartXMLFormatter(Writer w) throws IOException { this.xml = new XMLWriterNSImpl(w, false); if (this.writeXMLDeclaration) { this.xml.xmlDecl(); this.writeXMLDeclaration = false; } this.xml.setPrefixMapping("http://schemas.openxmlformats.org/wordprocessingml/2006/main", "w"); this.xml.setPrefixMapping("http://schemas.microsoft.com/office/word/2010/wordml", "w14"); this.xml.setPrefixMapping("http://schemas.microsoft.com/office/word/2012/wordml", "w15"); this.xml.setPrefixMapping("http://schemas.openxmlformats.org/officeDocument/2006/relationships", "r"); this.xml.setPrefixMapping("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", "wp"); this.xml.setPrefixMapping("http://schemas.openxmlformats.org/drawingml/2006/main", "a"); this.xml.setPrefixMapping("http://schemas.openxmlformats.org/drawingml/2006/picture", "pic"); this.xml.setPrefixMapping(Constants.BASE_NS_URI, "dfx"); this.xml.setPrefixMapping(Constants.DELETE_NS_URI, "del"); this.xml.setPrefixMapping(Constants.INSERT_NS_URI, "ins"); } After I had changed my code without russian letters everything works fine. But when I diff 2 docx documents with russian characters the following exception raises: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 10510; Präfix "w14" für Attribut "w14:paraId", das mit Elementtyp "w:p" verknüpft ist, ist nicht gebunden. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentSca…

http://stackoverflow.com/q/24413128
has answer: http://stackoverflow.com/a/24413293
downvote count: 0
has answer: http://stackoverflow.com/a/24416827
favorite count: 0
has answer: http://stackoverflow.com/a/24413902
possible better answer: http://stackoverflow.com/a/24413293
answer count: 5
upvote count: 6
tagged with: immutability
has comment: http://stackoverflow.com/comment/37767639
tagged with: final
has body: I have a case when I want to avoid defensive copies, for data which might nevertheless be modified, but is usually simply read, and not written to. So, I'd like to use immutable objects, with functional mutator methods, which is kind of usual (java lombok is able to do it more or less automatically). The way I proceed is the following: public class Person { private String name, surname; public Person(String name, String surname) {....} // getters... // and instead of setters public Person withName(String name) { Person p= copy(); // create a copy of this... p.name= name; return p; } public Person copy() {....} } So, to get a copy of the person with a different name, I would call p= new Person("Bar", "Alfred"); ... p= p.withName("Foo"); In practice, the objects are rather large (and I ended up using serialization to avoid the burden of writing the copy code). Now, while browsing the web, I see a potential concurrency problem with this implementation, as my fields are not final, and thus, concurrent access might see the returned copy, for instance, without the new name change (as there is no warrantee on the order of operation in this context). Of course, I can't make my fields final, with the current implementation, as I first do a copy, and then change the data in the copy. So, I'm looking for a good solution for this problem. I might use volatile, but I feel it's not a good solution. Another solution would be to use the builder pattern: class PersonBuilder { String name, surname; .... } public class Person { private final String name, surname; public Person(PersonBuilder builder) {...} private PersonBuilder getBuilder() { return new PersonBuilder(name, surname); } public Person withName(String name) { PersonBuilder b= getBuilder(); b.setName(name); return new Person(b); } } Is there any problem here, and above all, is there a more elegant way of doing the same thing ?
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37769160
score: 6
accepted answer: http://stackoverflow.com/a/24416827
has comment: http://stackoverflow.com/comment/37767019
has comment: http://stackoverflow.com/comment/37766934
type: AnsweredQuestion
tagged with: java
has title: Good way to create a immutable class with modifiers (thread-safe)
type: Question
has answer: http://stackoverflow.com/a/24413344
has answer: http://stackoverflow.com/a/24414187
tagged with: volatile

http://stackoverflow.com/comment/37631504
type: QuestionComment
has text: In addition to that, please make sure that your activity is also transparent. http://stackoverflow.com/questions/2176922/how-to-create-transparent-activity-in-android
comment on: http://stackoverflow.com/q/24340180
score: 0
type: Comment

arrays
tags question: http://stackoverflow.com/q/24371069
tags question: http://stackoverflow.com/q/24416960
tags question: http://stackoverflow.com/q/24277734
tags question: http://stackoverflow.com/q/24319939
tags question: http://stackoverflow.com/q/24403019
tags question: http://stackoverflow.com/q/24421820
tags question: http://stackoverflow.com/q/24361864
tags question: http://stackoverflow.com/q/24374037
type: Tag
tags question: http://stackoverflow.com/q/24343955
tags question: http://stackoverflow.com/q/24341768
tags question: http://stackoverflow.com/q/24297191
tags question: http://stackoverflow.com/q/24298507
tags question: http://stackoverflow.com/q/24295470
tags question: http://stackoverflow.com/q/24281886
tags question: http://stackoverflow.com/q/24322712
tags question: http://stackoverflow.com/q/24378709
tags question: http://stackoverflow.com/q/24293084
tags question: http://stackoverflow.com/q/24413007
tags question: http://stackoverflow.com/q/24352597
tags question: http://stackoverflow.com/q/24346300
tags question: http://stackoverflow.com/q/24420411
tags question: http://stackoverflow.com/q/24336835
tags question: http://stackoverflow.com/q/24419830
tags question: http://stackoverflow.com/q/24334093
tags question: http://stackoverflow.com/q/24391646
tags question: http://stackoverflow.com/q/24394087
tags question: http://stackoverflow.com/q/24276048
tags question: http://stackoverflow.com/q/24301427
tags question: http://stackoverflow.com/q/24395994
tags question: http://stackoverflow.com/q/24340603
tags question: http://stackoverflow.com/q/24310205
tags question: http://stackoverflow.com/q/24309781
tags question: http://stackoverflow.com/q/24355348
tags question: http://stackoverflow.com/q/24363991
tags question: http://stackoverflow.com/q/24337462
tags question: http://stackoverflow.com/q/24349159
tags question: http://stackoverflow.com/q/24419641
tags question: http://stackoverflow.com/q/24267834
tags question: http://stackoverflow.com/q/24372403
tags question: http://stackoverflow.com/q/24358864
tags question: http://stackoverflow.com/q/24311891
tags question: http://stackoverflow.com/q/24312499
tags question: http://stackoverflow.com/q/24359399
tags question: http://stackoverflow.com/q/24339922
tags question: http://stackoverflow.com/q/24368243
tags question: http://stackoverflow.com/q/24388681
tags question: http://stackoverflow.com/q/24342856
tags question: http://stackoverflow.com/q/24357608
tags question: http://stackoverflow.com/q/24374189
tags question: http://stackoverflow.com/q/24297404
tags question: http://stackoverflow.com/q/24285471
tags question: http://stackoverflow.com/q/24314574
tags question: http://stackoverflow.com/q/24353172
tags question: http://stackoverflow.com/q/24294917
tags question: http://stackoverflow.com/q/24335660
tags question: http://stackoverflow.com/q/24383303
tags question: http://stackoverflow.com/q/24401478
tags question: http://stackoverflow.com/q/24385050
tags question: http://stackoverflow.com/q/24357794
tag name: arrays
tags question: http://stackoverflow.com/q/24365632
tags question: http://stackoverflow.com/q/24406774
tags question: http://stackoverflow.com/q/24340643
tags question: http://stackoverflow.com/q/24397581
tags question: http://stackoverflow.com/q/24355894
tags question: http://stackoverflow.com/q/24356580
tags question: http://stackoverflow.com/q/24364523
tags question: http://stackoverflow.com/q/24396898
tags question: http://stackoverflow.com/q/24291142
tags question: http://stackoverflow.com/q/24417901
tags question: http://stackoverflow.com/q/24374864
tags question: http://stackoverflow.com/q/24399847
tags question: http://stackoverflow.com/q/24417614
tags question: http://stackoverflow.com/q/24373877
tags question: http://stackoverflow.com/q/24378680
tags question: http://stackoverflow.com/q/24400231
tags question: http://stackoverflow.com/q/24357497
tags question: http://stackoverflow.com/q/24374533
tags question: http://stackoverflow.com/q/24375616

ondraw
type: Tag
tags question: http://stackoverflow.com/q/24357506
tags question: http://stackoverflow.com/q/24398244
tag name: ondraw

http://stackoverflow.com/q/24359461
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37666377
has comment: http://stackoverflow.com/comment/37666502
has comment: http://stackoverflow.com/comment/37668905
has answer: http://stackoverflow.com/a/24361229
possible better answer: http://stackoverflow.com/a/24360481
has comment: http://stackoverflow.com/comment/37666400
has comment: http://stackoverflow.com/comment/37666618
has body: I have a string array String a = "This is a life and our life will be full of fun just like the Benn Steller's Secret life of Walter Mitty."; String a1[]=a.split(" "); for(String temp: a1) { System.out.println(temp); } Here "life" is repeated three times. Now I have to remove only one frequency of duplicate word form array. please guide me.... Thanks.
has comment: http://stackoverflow.com/comment/37666700
accepted answer: http://stackoverflow.com/a/24359587
upvote count: 1
downvote count: 0
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/37666565
has answer: http://stackoverflow.com/a/24359587
has answer: http://stackoverflow.com/a/26072776
has answer: http://stackoverflow.com/a/24360481
has title: Remove only one frequency of duplicate word from String array
has comment: http://stackoverflow.com/comment/37666404
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/comment/38942972
comment on: http://stackoverflow.com/a/24516751
type: Comment
has text: Just saw this comment. Thanks for looking into this we'll keep on using 2.8 in the mean time. Do you know what jersey release is being targeted for the changes? If not we'll just check the release notes periodically and look for the updates.
score: 0
type: AnswerComment

http://stackoverflow.com/q/24318676
downvote count: 0
has title: rxtx fatal EXCEPTION_ACCESS_VIOLATION
favorite count: 0
type: UnansweredQuestion
tagged with: windows
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I'm having a problem with the RXTX library. I was trying to add support to my project for reading/writing to multiple serial ports at a time, and started receiving the following message at runtime. # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000001800071cd, pid=9032, tid=5016 # # JRE version: Java(TM) SE Runtime Environment (7.0_51-b13) (build 1.7.0_51-b13) # Java VM: Java HotSpot(TM) 64-Bit Server VM (24.51-b03 mixed mode windows-amd64 compressed oops) # Problematic frame: # C [rxtxSerial.dll+0x71cd] # # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows # # An error report file with more information is saved as: # C:\Users\Jack\workspace\TestProject\hs_err_pid9032.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. # I've been able to isolate the code which produces this crash, and was hoping someone could provide an explanation as to why it's happening, and/or perhaps verify that this is indeed the expected behavior of rxtx (and not a result of some misconfiguration of my setup. RXTX does complain about the mismatch between my native-lib and jar everytime. native-lib 2.2pre2 and jar version 2.1-7, but I've ignored that to no apparent ill affect so far) The simplest code that produces the error: public static void main(String[] args) throws Exception { CommPortIdentifier com13PI = CommPortIdentifier .getPortIdentifier("COM13"); CommPortIdentifier com1PI = CommPortIdentifier .getPortIdentifier("COM1"); SerialPort com13 = (SerialPort) com13PI.open(main.class.getName(), 400); SerialPort com1 = (SerialPort) com1PI.open(main.class.getName(), 400); com13.close(); //com1.close(); com13PI = CommPortIdentifier.getPortIdentifier("COM13"); com13 = (SerialPort) com13PI.open(main.…
tagged with: rxtx
has answer: http://stackoverflow.com/a/24318727
answer count: 1

http://stackoverflow.com/a/24364724
upvote count: 1
has body: For recognition of multiple ROUND(X), I suggest TreeMap&lt;Integer,Pair&lt;Integer,Integer&gt;&gt; map = new TreeMap&lt;&gt;(); int count = 0; Where we store &lt;start_index, &lt;init_count, end_index&gt;&gt; if ("ROUND(".equals(temp)) { map.put(i, new Pair&lt;Integer,Integer&gt;(count, -1)); count++; } if ("(".equals(temp)) count++; if (")".equals(temp)) { if (count &lt;= 0) { count = 0; // Error: extra closing bracket } else { count--; } int max_i = -1; for (Integer index : map.keySet()) { if (index &gt; max_i &amp;&amp; map.get(index).second() == -1 &amp;&amp; map.get(index).first() == count) { max_i = index; } } if (max_i &gt; -1) map.get(max_i).setSecond(i); }
answers question: http://stackoverflow.com/q/24362335
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37706386
type: Answer
has comment: http://stackoverflow.com/comment/37676442

http://stackoverflow.com/a/65719206
type: Answer
score: 8
downvote count: 0
upvote count: 8
answers question: http://stackoverflow.com/q/24342886
has body: brew cask commands were disabled on 2020-12-21 with the release of Homebrew 2.7.0. Use the below commands to install JDK brew install --cask adoptopenjdk/openjdk/adoptopenjdk8

http://stackoverflow.com/a/24372429
has body: There is a simpler way to override the paintBorder() method in the example by Java42 because the lineColor field is protected. So simply do: @Override public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, final int height) { super.lineColor = color; super.paintBorder(c, g, x, y, width, height); }
type: Answer
upvote count: 6
score: 6
answers question: http://stackoverflow.com/q/24370591
downvote count: 0

http://stackoverflow.com/comment/37633848
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24341540
has text: @zigmandel. Basically I was worried about using Play's built in components for managing sessions, actors, etc. I assumed that because I am using GAE I should use their APIs for that kind of stuff. Does the play plug in link to their apis already?
score: 0

encryption
tags question: http://stackoverflow.com/q/24354445
tags question: http://stackoverflow.com/q/24319534
tags question: http://stackoverflow.com/q/24322564
tags question: http://stackoverflow.com/q/24393682
tags question: http://stackoverflow.com/q/24396870
tags question: http://stackoverflow.com/q/24394873
tag name: encryption
tags question: http://stackoverflow.com/q/24358996
tags question: http://stackoverflow.com/q/24330683
tags question: http://stackoverflow.com/q/24380155
tags question: http://stackoverflow.com/q/24349877
tags question: http://stackoverflow.com/q/24387695
tags question: http://stackoverflow.com/q/24276801
tags question: http://stackoverflow.com/q/24401786
tags question: http://stackoverflow.com/q/24299298
tags question: http://stackoverflow.com/q/24338108
tags question: http://stackoverflow.com/q/24317800
tags question: http://stackoverflow.com/q/24340704
tags question: http://stackoverflow.com/q/24269743
tags question: http://stackoverflow.com/q/24319498
tags question: http://stackoverflow.com/q/24287462
tags question: http://stackoverflow.com/q/24411228
type: Tag
tags question: http://stackoverflow.com/q/24276341

http://stackoverflow.com/a/24297627
answers question: http://stackoverflow.com/q/24297568
has comment: http://stackoverflow.com/comment/37548385
type: Answer
has body: To implement bubble-sort for any type of Object, in that case Book, implements in your object class the interface Comparable and override the methode compareTo to define your desired handling. The method should return a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. As stated in the javadoc : http://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html In your case, the compareto method is already implemented in the String class so you can directly use it on the book's title. Your validation would then look like this : if (bookList.get(in).getTitle().compareTo(bookList.get(in + 1).getTitle()) &lt; 0)
score: 0

http://stackoverflow.com/comment/37521578
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24283613
has text: This is having multi paster only...on a single machine (localhost)

google-calendar-api
tags question: http://stackoverflow.com/q/24277222
tags question: http://stackoverflow.com/q/24397275
tags question: http://stackoverflow.com/q/24311824
type: Tag
tag name: google-calendar-api

http://stackoverflow.com/comment/37743024
type: QuestionComment
comment on: http://stackoverflow.com/q/24400299
has text: explode your .war file and check if this dependency is there in the library
score: 0
type: Comment

http://stackoverflow.com/comment/37542088
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24293766
has text: Thank you. I should mention that NOTE_DATE is a timestamp field and not a varchar field. Your GROUP_CONCAT solution works perfectly on the CONTENT varchar field, but the \n separator doesn't seem to register on the timestamp field. It appends, but it doesn't create a new line. Any suggestions?

http://stackoverflow.com/comment/37672233
type: QuestionComment
has text: can u please explain more..it is not clear what you exactly want
type: Comment
comment on: http://stackoverflow.com/q/24362525
score: 0

http://stackoverflow.com/q/24422153
accepted answer: http://stackoverflow.com/a/24422293
tagged with: class
score: 0
has title: Public class requires public members (when accessing members)?
has comment: http://stackoverflow.com/comment/37783895
has answer: http://stackoverflow.com/a/24422293
tagged with: public
has comment: http://stackoverflow.com/comment/37784022
tagged with: members
has body: I noticed in my Java book, in the section about packages and the private modifier, that the code redundantly used private on the class and the members of the class being accessed outside of the package. package bookpack; public class Book { private String title; private String author; private int pubDate; public Book(String t, String a, int d) { title = t; author = a; pubDate = d; } public void show() { System.out.println(title); System.out.println(author); System.out.println(pubDate + "\n"); } } When I remove the public from show(), Eclipse gives an error stating that the member cannot be accessed (when attempting to do so from another package). I understand that it is because it is not public and therefore cannot be accessed from outside the package. However, since the class is public, I thought that all members of the class would then be public, unless otherwise specified. That would follow the "general specifications here, specific specifications later" style, similar to inheritance. Much like how you cannot call a dynamic object from a static method. So why is the public tag required on the member of a public class? How does a public tag affect accessibility in the context of retrieving a public member of a class
has answer: http://stackoverflow.com/a/24422233
has comment: http://stackoverflow.com/comment/37784038
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37783871
tagged with: java
has comment: http://stackoverflow.com/comment/37783887
has comment: http://stackoverflow.com/comment/37783912
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/24422233

http://stackoverflow.com/q/24423136
tagged with: java
tagged with: bukkit
tagged with: eclipse
answer count: 3
upvote count: 1
has body: Hey so I did look this issue up on multiple sites before I posted this and I did everything correct, but I still get this error when I try to load my plugin, it says error could not invalid plugin.yml, and then just gives a bunch of code lines and stuff (i'm assuming from the code in the bukkit files and whatnot, and yes my plugin.yml is saved in the src folder not a package, and when I export it I do export it as a .jar, anyway here's my plugin.yml file name: ProtHome main: com.yahoo.m1kesanders.ProtHome.ProtHome version: 1.0.0 Description: A simple /home plugin commands: sethome: Description: sets players home home: Description: teleports player to their home and I also did use the 4 spaces and no tab keys were used two spaces after commands: and another two after each command and here's my code for the plugin in eclipse in case you need it just to check name and what not package com.yahoo.m1kesanders.ProtHome; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; public class ProtHome extends JavaPlugin{ public static ProtHome plugin; public File folder = plugin.getDataFolder(); public static File file = new File("Homes.yml"); public static YamlConfiguration Homes = new YamlConfiguration(); public void onEnable(){ if(!folder.exists()){ folder.mkdir(); } if(!file.exists()){ file.mkdir(); } try { Homes.load(file); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvalidConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } } pub…
has answer: http://stackoverflow.com/a/24516131
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/37873743
tagged with: plugins
type: UnansweredQuestion
tagged with: file
has answer: http://stackoverflow.com/a/43579588
downvote count: 1
has title: invalid plugin.yml bukkit plugin error
type: Question
has answer: http://stackoverflow.com/a/29817818

http://stackoverflow.com/q/24283613
accepted answer: http://stackoverflow.com/a/24283880
tagged with: java
tagged with: mysql
linked to: http://stackoverflow.com/q/2839321
type: Question
has comment: http://stackoverflow.com/comment/37521545
has comment: http://stackoverflow.com/comment/37521578
score: 0
has body: How does Java application connect to multi master replicated MySQL Database? I am using com.mysql.jdbc.ReplicationDriver but this is giving exception as: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
has title: Multi master replication
has answer: http://stackoverflow.com/a/24283880
has comment: http://stackoverflow.com/comment/37521422
answer count: 1
linked to: http://stackoverflow.com/q/2983248
type: AnsweredQuestion

http://stackoverflow.com/q/24315451
answer count: 1
downvote count: 1
tagged with: android-activity
favorite count: 0
type: AnsweredQuestion
upvote count: 0
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/37582291
type: Question
accepted answer: http://stackoverflow.com/a/24315489
has title: Method sharing between activities Android
has body: How can i make one method available for multiple activities in android? It's done by inheritance, but since every activity i have extends ActionBarActivity, and multiple inheritance is not possible, i have ran out of options. This is all to avoid having much duplicate code. Thanks in advance,
tagged with: android
has answer: http://stackoverflow.com/a/24315489

http://stackoverflow.com/q/24347301
has body: I have JSP project run on tomcat 6.0.32 and java 6, that suddenly threw this exception java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file com/company/secure/Account java.lang.ClassLoader.defineClass1(Native Method) java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) java.lang.ClassLoader.defineClass(ClassLoader.java:615) java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2818) org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526) org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:128) org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66) java.lang.Class.getDeclaredConstructors0(Native Method) java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) java.lang.Class.getConstructor0(Class.java:2699) java.lang.Class.newInstance0(Class.java:326) java.lang.Class.newInstance(Class.java:308) org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:150) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:338) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) filters.ObjectsCacheFilter.doFilter(ObjectsCacheFilter.java:43) filters.FilterCach.doFilter(FilterCach.java:81) filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:123) note The full stack trace of the root cause is available in the Apache Tomcat/6.0.32 logs. Apache Tomcat/6.0.32
has comment: http://stackoverflow.com/comment/37642753
has comment: http://stackoverflow.com/comment/37642734
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37642709
has title: Class ClassFormatError :Absent-Code-attribute-in-method-that-is-not-native
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/10710090
has answer: http://stackoverflow.com/a/24347392
answer count: 1
tagged with: tomcat
score: 0

http://stackoverflow.com/q/24349894
has comment: http://stackoverflow.com/comment/37676416
has body: public class Account { //===============Properties=================== protected double Balance; protected String Owner; protected double AcctNo; //================Behaviors=============== public void setBalance(double bal) {Balance = bal;} public double getBalance() {return Balance;} public void setOwner(String own) {Owner = own;} public String getOwner() {return Owner;} public void setAcctNo(double an) {AcctNo = an;} public double getAcctNo() {return AcctNo;} //==============Constructors============== public Account() { super(); Balance=0; Owner=""; AcctNo=0; } public Account(double bal, String own, double an) { super(); Balance=bal; Owner=own; AcctNo=an; } public void deposit() { 0=deposit+Balance; } public void withdraw() { 0=withdraw-Balance; } public void display() { System.out.println("Owner = " + getOwner()); System.out.println("Balance = " + getBalance()); System.out.println("Account Number = " + getAcctNo()); } public static void main (String args []) { Account a1; a1 = new Account(); a1.setOwner("Frank"); a1.setBalance(1000); a1.setAcctNo(2222); a1.deposit(100.00); a1.display(); } } The withdraw and deposit has became tricky for me, I thought that, that would be the answer to solving the problem, but it was not. I believe everything else is finished except for the those 2 problems Can I be guided towards the way to understanding the Deposit and Withdrawal concept please? Thanks in advance!
score: -3
has comment: http://stackoverflow.com/comment/37647493
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/24350201
has answer: http://stackoverflow.com/a/24349993
accepted answer: http://stackoverflow.com/a/24350201
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37657745
answer count: 2
possible better answer: http://stackoverflow.com/a/24349993
downvote count: 3
favorite count: 0
has title: How to create the Withdraw and Deposit in my work

http://stackoverflow.com/comment/37622653
type: QuestionComment
type: Comment
has text: For example if the program did not find the webelement "label", it should display the message "label is not displayed" and it will continue to execute the second step.
score: 0
comment on: http://stackoverflow.com/q/24336793

http://stackoverflow.com/q/24409343
tagged with: java
has comment: http://stackoverflow.com/comment/37760534
has comment: http://stackoverflow.com/comment/37799593
score: -1
has comment: http://stackoverflow.com/comment/37759870
type: Question
tagged with: filenotfoundexception
upvote count: 0
has comment: http://stackoverflow.com/comment/37759680
answer count: 1
has title: File not found exception when writing away file in java (android)
favorite count: 0
has comment: http://stackoverflow.com/comment/37759958
has answer: http://stackoverflow.com/a/24409862
accepted answer: http://stackoverflow.com/a/24409862
tagged with: android
has body: I have a problem saving a file in android, the FileOutputStream keeps falling back to a FileNotFoundException and thus won't write the file to the external storage. Yes I do have permission set in the manifest: uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" I've added the code below of the function, can someone explain to me what is going wrong, if it is that it is trying to overwrite an existing file, is there a way to replace that file (the name needs to be static)? (tips on making the code look nicer are welcome as well) Bitmap savebitmap = Bitmap.createBitmap(drawView.getDrawingCache()); File mediaStorageDir = new File(Environment.getExternalStorageDirectory()+"/Android/data/"+getApplicationContext().getPackageName()+"/Files"); if (!mediaStorageDir.exists()){ mediaStorageDir.mkdir(); } File pictureFile = new File(Environment.getExternalStorageDirectory()+"/Android/data/"+getApplicationContext().getPackageName()+"/Files"+File.separator+"Tempsave.png"); try { FileOutputStream fos = new FileOutputStream(pictureFile); savebitmap.compress(Bitmap.CompressFormat.PNG, 100, fos); fos.flush(); fos.close(); } catch (FileNotFoundException e) {} catch (IOException e) {} Kudos to Guillaume and theV0ID for leading me to the most efficient correct answer. Below is the example code editted to the working version. Bitmap savebitmap = Bitmap.createBitmap(drawView.getDrawingCache()); File pictureFile = new File(Environment.getExternalStorageDirectory()+"/Android/data/"+getApplicationContext().getPackageName()+"/Files"+File.separator+"Tempsave.png"); pictureFile.getParentFile().mkdirs(); try { FileOutputStream fos = new FileOutputStream(pictureFile); savebitmap.compress(Bitmap.CompressFormat.PNG, 100, fos); fos.flush(); fos.close(); } catch (FileNotFoundException e) {} catch (IOException e) {}
tagged with: file
has comment: http://stackoverflow.com/comment/37760055
tagged with: bitmap
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/q/24422068
has comment: http://stackoverflow.com/comment/37783755
tagged with: java
has comment: http://stackoverflow.com/comment/37817575
has comment: http://stackoverflow.com/comment/37783874
has comment: http://stackoverflow.com/comment/37792148
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/37784334
has title: Populate an array of objects using hashmap
type: Question
has comment: http://stackoverflow.com/comment/37785507
tagged with: hashmap
has comment: http://stackoverflow.com/comment/37784985
has answer: http://stackoverflow.com/a/24423337
accepted answer: http://stackoverflow.com/a/24423337
tagged with: populate
has comment: http://stackoverflow.com/comment/37784644
has comment: http://stackoverflow.com/comment/37783858
score: 0
tagged with: for-loop
has comment: http://stackoverflow.com/comment/37784042
tagged with: arrays
has comment: http://stackoverflow.com/comment/37785333
answer count: 1
has comment: http://stackoverflow.com/comment/37783911
has comment: http://stackoverflow.com/comment/37785331
favorite count: 0
has body: I am new to hashmaps and even though I was trying to read about it, I couldn't really solve my issue. This is the part of my code where I have this issue. public HeatmapData(HashMap&lt;Node, ArrayList&lt;ODData&gt;&gt; ODs) { /* get all of the origins */ Node [] row = ODs.keySet().toArray(new Node[0]); Node [] column = new Node[row.length]; System.arraycopy(row, 0, column, 0, row.length); ODData [] routes = new ODData[ROUTES_SIZE]; for (int i=0; i&lt;ROUTES_SIZE; i++) { ODData temp = new ODData(); // Node n = row[i]; routes[i] = temp; //routes = (ODData[]) ODs.get(n).toArray(new ODData[0]); } As you can see I can't really find a way that will copy the data from the original hashmap to my array of objects. I basically need to find the first node in array "row", find its values from the hashmpap, populate my array "routes[]", and then do the same with the second node in array "row". It seems like every time I try I have miss match error or a null value. The program reads from two files that look as follows: First: 100001 200002 6 100001 200003 9 ............... Second: 100001 -97.5489 30.5846 100002 -97.6958 30.5986 ............... My node class consists of int ID; double longititude; double lattitude; And my ODData class consists of Node origin; Node destination; double value; Each 10000 number has many 20000 numbers relating to it. Using the hashmap that is being send to the function, I need to populate my ODData routes[] array with these ODData objects so it will look like the original file (the first one). Any idea how it can be done? I'll appreciate any help! Nikita
has comment: http://stackoverflow.com/comment/37784012
has comment: http://stackoverflow.com/comment/37783872
has comment: http://stackoverflow.com/comment/37822951
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37785564

http://stackoverflow.com/a/24320480
has comment: http://stackoverflow.com/comment/37591596
has body: Use below code i have convert today date. learn from it and try with your code Date today = new Date(); //If you print Date, you will get un formatted output System.out.println("Today is : " + today); //formatting date in Java using SimpleDateFormat SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("MM-dd-yyyy"); String date = DATE_FORMAT.format(today); System.out.println("Today in MM-dd-yyyy format : " + date); Date date1 = formatter.parse(date); System.out.println(date1); System.out.println(formatter.format(date1));
upvote count: 3
downvote count: 1
answers question: http://stackoverflow.com/q/24320378
has comment: http://stackoverflow.com/comment/37591798
score: 2
has comment: http://stackoverflow.com/comment/73622020
type: Answer

http://stackoverflow.com/a/24294740
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37543002
upvote count: 2
answers question: http://stackoverflow.com/q/24294638
score: 2
has body: substring takes two indexes, not an index and a length. You need to add lastIndex to packageName.length(), like this: String line = result.substring(lastIndex, lastIndex+packageName.length()); Once you make this change, your code should work. Demo on ideone.
accepted answer of: http://stackoverflow.com/q/24294638
type: AcceptedAnswer

http://stackoverflow.com/comment/37582550
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24297065
has text: good point on Map.clear(), will do that. Using %m gives me what i was expecting. When i use %map or %K, it add a curly bracket in the log. Is there an issue if i use %m ?

http://stackoverflow.com/comment/37640572
type: Comment
has text: NO! A paint event may occur for any number of reasons, may of which you don't control. Generally speaking, you should start the Timer when the game starts and on each tick, update the state as needed. When a "fire" event occurs, update the game state to include a new bullet in the model
comment on: http://stackoverflow.com/q/24320132
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37770862
has text: @stew I don't think so. The Java part expects a array of of `double`'s (primitives), and in Scala `Double` itself is also the primitive double type. So there's no need for the conversion `double2Double`.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24409259
type: AnswerComment

http://stackoverflow.com/q/24405787
has answer: http://stackoverflow.com/a/24405866
tagged with: jar
linked to: http://stackoverflow.com/q/24203671
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37753314
has answer: http://stackoverflow.com/a/24406051
score: 0
tagged with: java
answer count: 2
upvote count: 1
linked to: http://stackoverflow.com/q/24001473
downvote count: 1
has title: java.lang.NoClassDefFoundError while running a jar file on windows 8
tagged with: windows-8
type: UnansweredQuestion
has body: When I am giving the following command java -Xmx1500m -jar myApp.jar %1 %2 %3 %4 %5 %6 %7 %8 %9 I am getting the following error. Throwable Error: java.lang.NoClassDefFoundError: org/supercsv/prefs/CsvPreference Exception in thread "main" java.lang.Error: java.lang.NoClassDefFoundError: org/supercsv/prefs/CsvPreference at bc.c.Util.process(Util.java:135) at bc.m.TabularReader$CSVReader.&lt;init&gt;(TabularReader.java:68) at bc.m.TabularReader.&lt;init&gt;(TabularReader.java:37) at bc.c.Spread2db.main(Spread2db.java:244) Caused by: java.lang.NoClassDefFoundError: org/supercsv/prefs/CsvPreference at bc.m.TabularReader$CSVReader.&lt;init&gt;(TabularReader.java:64) ... 2 more Caused by: java.lang.ClassNotFoundException: org.supercsv.prefs.CsvPreference at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 3 more I guess that this is due to the supercsv which is not getting included properly in the class path. Please help me fixing this error.

sqlite
tags question: http://stackoverflow.com/q/24319976
tags question: http://stackoverflow.com/q/24300094
tags question: http://stackoverflow.com/q/24353597
tags question: http://stackoverflow.com/q/24303779
tags question: http://stackoverflow.com/q/24358221
type: Tag
tags question: http://stackoverflow.com/q/24271251
tags question: http://stackoverflow.com/q/24308995
tags question: http://stackoverflow.com/q/24339599
tags question: http://stackoverflow.com/q/24374815
tags question: http://stackoverflow.com/q/24303564
tags question: http://stackoverflow.com/q/24371617
tags question: http://stackoverflow.com/q/24403190
tags question: http://stackoverflow.com/q/24424696
tags question: http://stackoverflow.com/q/24396489
tags question: http://stackoverflow.com/q/24294304
tags question: http://stackoverflow.com/q/24373332
tags question: http://stackoverflow.com/q/24285334
tags question: http://stackoverflow.com/q/24294619
tags question: http://stackoverflow.com/q/24318414
tags question: http://stackoverflow.com/q/24285532
tags question: http://stackoverflow.com/q/24384681
tags question: http://stackoverflow.com/q/24313631
tags question: http://stackoverflow.com/q/24401507
tag name: sqlite
tags question: http://stackoverflow.com/q/24384557

http://stackoverflow.com/comment/37938868
comment on: http://stackoverflow.com/a/24281890
has text: Thanks greg! It was of great help :)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/24399435
tags question: http://stackoverflow.com/q/24417947
tags question: http://stackoverflow.com/q/24403634
tags question: http://stackoverflow.com/q/24320330
tags question: http://stackoverflow.com/q/24397459
tags question: http://stackoverflow.com/q/24295896
tags question: http://stackoverflow.com/q/24330718
tags question: http://stackoverflow.com/q/24396547
tags question: http://stackoverflow.com/q/24305341
tags question: http://stackoverflow.com/q/24383133
tags question: http://stackoverflow.com/q/24308149
tags question: http://stackoverflow.com/q/24318447
tags question: http://stackoverflow.com/q/24280605
tags question: http://stackoverflow.com/q/24375555
tags question: http://stackoverflow.com/q/24325397
tags question: http://stackoverflow.com/q/24331218
tags question: http://stackoverflow.com/q/24368531
tags question: http://stackoverflow.com/q/24295965
tags question: http://stackoverflow.com/q/24353855
tags question: http://stackoverflow.com/q/24353157
tags question: http://stackoverflow.com/q/24401094
tags question: http://stackoverflow.com/q/24414185
tags question: http://stackoverflow.com/q/24377428
tags question: http://stackoverflow.com/q/24356479
tags question: http://stackoverflow.com/q/24386833
tags question: http://stackoverflow.com/q/24284491
tags question: http://stackoverflow.com/q/24269218
tags question: http://stackoverflow.com/q/24416888
tags question: http://stackoverflow.com/q/24281494
tags question: http://stackoverflow.com/q/24273835
tags question: http://stackoverflow.com/q/24301980
type: Tag
tags question: http://stackoverflow.com/q/24383303
tags question: http://stackoverflow.com/q/24391570
tags question: http://stackoverflow.com/q/24413359
tags question: http://stackoverflow.com/q/24322776
tags question: http://stackoverflow.com/q/24419748
tags question: http://stackoverflow.com/q/24393901
tags question: http://stackoverflow.com/q/24277685
tags question: http://stackoverflow.com/q/24356580
tags question: http://stackoverflow.com/q/24423234
tags question: http://stackoverflow.com/q/24397275
tags question: http://stackoverflow.com/q/24348648
tags question: http://stackoverflow.com/q/24371957
tags question: http://stackoverflow.com/q/24286517
tags question: http://stackoverflow.com/q/24384871
tags question: http://stackoverflow.com/q/24324620
tags question: http://stackoverflow.com/q/24342350
tags question: http://stackoverflow.com/q/24369267
tags question: http://stackoverflow.com/q/24400360
tags question: http://stackoverflow.com/q/24361350
tags question: http://stackoverflow.com/q/24333761
tags question: http://stackoverflow.com/q/24377454
tags question: http://stackoverflow.com/q/24364541
tags question: http://stackoverflow.com/q/24288183
tags question: http://stackoverflow.com/q/24369113
tags question: http://stackoverflow.com/q/24401059
tag name: json
tags question: http://stackoverflow.com/q/24388003
tags question: http://stackoverflow.com/q/24348548
tags question: http://stackoverflow.com/q/24314910
tags question: http://stackoverflow.com/q/24321975
tags question: http://stackoverflow.com/q/24329043
tags question: http://stackoverflow.com/q/24393405
tags question: http://stackoverflow.com/q/24305220
tags question: http://stackoverflow.com/q/24413686
tags question: http://stackoverflow.com/q/24370253
tags question: http://stackoverflow.com/q/24412511
tags question: http://stackoverflow.com/q/24278347
tags question: http://stackoverflow.com/q/24417613
tags question: http://stackoverflow.com/q/24351312
tags question: http://stackoverflow.com/q/24399304
tags question: http://stackoverflow.com/q/24405975
tags question: http://stackoverflow.com/q/24296208
tags question: http://stackoverflow.com/q/24273847
tags question: http://stackoverflow.com/q/24319325
tags question: http://stackoverflow.com/q/24403965
tags question: http://stackoverflow.com/q/24311221
tags question: http://stackoverflow.com/q/24285283
tags question: http://stackoverflow.com/q/24387505

http://stackoverflow.com/q/24323758
tagged with: imageview
answer count: 1
tagged with: adapter
tagged with: android
has answer: http://stackoverflow.com/a/24323824
tagged with: gridview
has comment: http://stackoverflow.com/comment/37597509
type: AnsweredQuestion
has body: When creating a Adapter for a GridView, like following : public class ImageAdapter extends BaseAdapter { private Context mContext; public ImageAdapter(Context c) { mContext = c; } public int getCount() { return mThumbIds.length; } public Object getItem(int position) { return null; } public long getItemId(int position) { return 0; } // create a new ImageView for each item referenced by the Adapter public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView; if (convertView == null) { // if it's not recycled, initialize some attributes imageView = new ImageView(mContext); imageView.setLayoutParams(new GridView.LayoutParams(85, 85)); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setPadding(8, 8, 8, 8); } else { imageView = (ImageView) convertView; } imageView.setImageResource(mThumbIds[position]); return imageView; } // references to our images private Integer[] mThumbIds = { R.drawable.sample_2, R.drawable.sample_3, R.drawable.sample_4, R.drawable.sample_5, R.drawable.sample_6, R.drawable.sample_7 } How does Adapter know how many items it has to display on screen? What if I want several items to display the same picture ? Thanks.
tagged with: java
has title: Android GridView Adapter
accepted answer: http://stackoverflow.com/a/24323824
type: Question
score: 0

http://stackoverflow.com/a/24405705
score: 14
has body: You can download JDK 7 here The Java SDK and JDK are different you can check here difference between them You can download any version of JDK from this oracle archive link, To download older version of JDK please register in the on click on download link
has comment: http://stackoverflow.com/comment/37753396
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/72232307
upvote count: 14
answers question: http://stackoverflow.com/q/24405522
has comment: http://stackoverflow.com/comment/37753251

http://stackoverflow.com/a/24421845
has comment: http://stackoverflow.com/comment/37783746
type: Answer
has comment: http://stackoverflow.com/comment/37783414
downvote count: 0
has comment: http://stackoverflow.com/comment/37783521
score: 1
has comment: http://stackoverflow.com/comment/37783543
has comment: http://stackoverflow.com/comment/37783636
has comment: http://stackoverflow.com/comment/37783637
has body: You can only create toString() method overrides in classes of yours, not in other classes that you're not overriding. ArrayList already has a valid toString() method that is useful. You will just need to make sure that the items held by the List are from a class that also has a valid toString() method. Note you state: which does not seem to be working for me... Because for some reason when i execute mine like this its only printing the first value or object. This suggests that you don't have a toString() problem, but that you actually have another completely different problem with your program, that you're not adding objects to the list correctly. You need to do more debugging and show more pertinent code. Edit I'm guessing that your Point class's contains(...) method is erroneous, that it is returning true when it should be returning false. Please show us the Point class. Edit 3 (deleted edit 2) Your equals is wrong: This is OK: public boolean equals(Object obj) { // this was given to us if (obj instanceof Point) { Point p = (Point) obj; // This method overrides the object equals // method and the calls return equals(p); // the clas's equals(point) method } return false; } But here, you return equals if either x's or y's closely match and that shouldn't be. You should only return true if BOTH closely match: public boolean equals(Point p) { if (Math.abs(this.getX()) - Math.abs(p.x) &lt; EPSILON) { return true; // checks if x - p.x is less than epsilon which covers // the round off } if (Math.abs(this.getY()) - Math.abs(p.y) &lt; EPSILON) { return true; // checks if y-p.y is less than epsilon which covers // the round off } return false; // both these methods test for equality using epsilon, // becuae we are dealing with } // doubles, so roundof can occur Also you're using Math.abs(...) incorrectly. It should go around the subtraction statement, not around each variable.
has comment: http://stackoverflow.com/comment/37783781
has comment: http://stackoverflow.com/comment/37783354
has comment: http://stackoverflow.com/comment/37783482
has comment: http://stackoverflow.com/comment/37783733
answers question: http://stackoverflow.com/q/24421820
upvote count: 1
has comment: http://stackoverflow.com/comment/37783760
has comment: http://stackoverflow.com/comment/37783591
has comment: http://stackoverflow.com/comment/37783343

http://stackoverflow.com/a/24268107
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: Try String frac = scan.nextLine(); I think next() won't get anything after a space.
has comment: http://stackoverflow.com/comment/37492291
type: Answer
accepted answer of: http://stackoverflow.com/q/24267998
score: 1
answers question: http://stackoverflow.com/q/24267998
has comment: http://stackoverflow.com/comment/37491951

http://stackoverflow.com/q/24308479
tagged with: java
accepted answer: http://stackoverflow.com/a/24309494
has title: Dynamic initialization of JTree
answer count: 1
score: 0
tagged with: treemodel
type: AnsweredQuestion
has body: i've been banging my head against a brick wall for days when it comes to JTree! I want to create a JTree which gets its content dynamically at run time, from mp3 tags. So far so good, except im having a massive headache when it comes to populating the JTree. After a lot of experimentation ive finally given up and come for help. Ive been using the class I created below to experiment with ways of adding child nodes to already existing nodes within a JTree. The problem im encountering is within the try block, with the types being incompatible. Error im recieving is: error: incompatible types: `TreeNode` cannot be converted to `MutableTreeNode` treeModel.insertNodeInto requires MutableTreeNode for its second argument. The method im using to get the parent node for the second argument, rootNode.getChildAt() returns TreeNode. Is there anyway around this??? And does anybody now why getChildAt() returns a TreeNode object rather than DefaulMutableTreeNode, the object type rootNode is initialized as??? package jtreeex; import java.util.Enumeration; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeSelectionModel; /** * * @author david */ public class JTreeEx implements Runnable { public JTreeEx() { JFrame jfrm = new JFrame(); JPanel panel = new JPanel(); JTree tree; DefaultMutableTreeNode rootNode; rootNode = new DefaultMutableTreeNode("Audio"); DefaultTreeModel treeModel = new DefaultTreeModel(rootNode); treeModel.addTreeModelListener(new MyTreeModelListener()); tree = new JTree(treeModel); tree.setEditable(true); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.setShowsRootHandles(true); String [] anArray = {"Dogs", "Cats"}; // Inserts new root nodes from anArray for(int i = 0; i &lt; anArray.length; i++) { treeModel.insertNodeInto(new DefaultMutableTreeNode(anArray[i]), rootNode, rootNod…
has answer: http://stackoverflow.com/a/24309494
tagged with: swing
type: Question
tagged with: jtree

android-scrollview
type: Tag
tags question: http://stackoverflow.com/q/24365771
tag name: android-scrollview

http://stackoverflow.com/comment/37550732
has text: Then remove the parts asking for tool suggestions, because those parts are off-topic. In addition, some people might like more detail about the "causing some problems with the current syntax"
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24298933
type: Comment

http://stackoverflow.com/comment/37760324
comment on: http://stackoverflow.com/a/24409092
has text: @user3545458 I think you're right - the underlying stream `out` only seems to be flushed if the string contains a newline.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24365990
has comment: http://stackoverflow.com/comment/37714792
tagged with: collections
has comment: http://stackoverflow.com/comment/37695576
type: Question
has body: I've got 3 main elements at work here. Momentum, Mass, and Momentum rotation. Mass is worked out by: this.mMass = (this.getHeight() + this.getWidth()) / 2.0f; I've created a system that automatically creates polygons around transparent pngs and detects collision perfectly (with high performance) but now I'm stuck on how to apply forces when they collide. I'm using LibsGDX but theres nothing about how to detect collisions using polygons and how to deal with them anywhere (manually without using their world) Only needs to be basic collision forces, when I look online everything seems to be way too complicated! What I have so far.. //Collision detection - loop though all physical objects. for(PhysicalObject physicalObject1 : AllPhysicalObjects) { for(PhysicalObject physicalObject2 : AllPhysicalObjects) { //Check that it's no trying to collide with it-self. if(physicalObject1 != physicalObject2 &amp;&amp; physicalObject1.mIsCurrentlyPhysical) { if(Intersector.overlapConvexPolygons(physicalObject2.mPolygon, physicalObject1.mPolygon)) { //Functions.out("Class:" + eachPhysicalObject.getClass().toString()); //Now the fucking collision detection... //Gonna be hard, but worth it when done right. //Get the amount of momentum from the first physical object. float physicalObject1Momentum = physicalObject1.mMomentum - physicalObject2.mMass; float physicalObject2Momentum = physicalObject2.mMomentum - physicalObject2.mMass; //If the momentum is negative, reverse the direction the object is going in. if(physicalObject1Momentum &lt; 0.0f) { //Reverse the direction of object1. physicalObject1.setMomentumRotationRotation(Functions.getRotationalMaxMinStatic(180f, physicalObject1.getMomentumRotation())); //Decrease the momentum of object2. } else { //Slow down the physical objects 1 momentum. physicalObject1.increaseMomentum(-physicalObject1Momentum); physicalObject2.increaseMomentum(physicalObject1.mMaxMomentum); physicalObject2.setMomentumRotationRotation(Functions.getRotationalMaxMinS…
upvote count: 1
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: physics
tagged with: android
downvote count: 0
has comment: http://stackoverflow.com/comment/37678344
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37678228
has title: 2D Collision, how to transfer forces?

ngrok
tag name: ngrok
tags question: http://stackoverflow.com/q/24329643
type: Tag

http://stackoverflow.com/a/24383459
accepted answer of: http://stackoverflow.com/q/24383387
answers question: http://stackoverflow.com/q/24383387
has body: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); TextView t = (TextView) rootView.findViewById(R.id.textView1); t.setText("hi world."); return rootView; }
score: 4
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/37561347
score: 0
type: Comment
has text: Excuse me hello.. you have added ! before condition so problem occurs otherwise the code running great.
type: AnswerComment
comment on: http://stackoverflow.com/a/24304176

http://stackoverflow.com/comment/37593190
type: AnswerComment
comment on: http://stackoverflow.com/a/24317507
score: 0
type: Comment
has text: Yes. The second problem causes the condition to (almost) never be true, so a new ? is added every time.

http://stackoverflow.com/q/24278842
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37518218
has comment: http://stackoverflow.com/comment/37512758
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
has body: Hi I am using HttpURLConnection to send request for server and the XML inputstream response is converted into java object by javax.xml.bind.Unmarshaller on multiple thread environment. It's working fine. But at some point, (ie) when unmarshalling the inputstream, the thread was blocked. I didn't get any exception at that time. After invoking convertStreamToObject method,the thread is blocked. Please any one help me to fix the issue. The code is below try { url = new URL(requestURL); connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setUseCaches(false); connection.setDoInput(true); connection.setDoOutput(true); connection.setConnectTimeout(1500); connection.setReadTimeout(1500); try { inputStream = connection.getInputStream(); } catch (IOException e) { OPERATION_LOGS.error("IOException in sendRequest()",e); }if(inputStream != null){ T response = convertStreamToObject(inputStream, responseObjType); } } catch(Exception e ) { OPERATION_LOGS.error("Exception in sendRequest()",e); } public &lt;K&gt; K convertStreamToObject(InputStream inputStream, Class&lt;K&gt; type) { try { return (K) XMLUtility.parseXML(inputStream, type); } catch (Exception e) { OPERATION_LOGS.error(EXCEPTION , e); } return null; } public static &lt;T&gt; T parseXML(InputStream inputStream, Class&lt;T&gt; type) { T beanObject = null; Unmarshaller unmarshObj = null; try { JAXBContext context = JAXBContext.newInstance(type); if (context != null) { unmarshObj = context.createUnmarshaller(); } if (unmarshObj != null) { // Converting the xml into corresponding bean beanObject = (T) unmarshObj.unmarshal(inputStream); } OPERATION_LOGS.debug("Response XML:" + encodeXML(beanObject, type)); } catch (JAXBException e) { OPERATION_LOGS.error(e.getMessage(),e); } return beanObject; }
tagged with: java
tagged with: multithreading
tagged with: jaxb
has comment: http://stackoverflow.com/comment/37512606
type: Question
score: 0
linked to: http://stackoverflow.com/q/10949813
has comment: http://stackoverflow.com/comment/37513112
has title: Thread dead lock is occurred on unmarshalling into java object

http://stackoverflow.com/q/24316461
tagged with: string
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37584741
upvote count: 1
has answer: http://stackoverflow.com/a/24316693
type: Question
has title: Android not recognizing string resource
has body: In my android app, I have a string Upload Image in the strings file. Then in a menu file I have navigation_screen.xml <item android:id="@+id/action_upload" android:orderInCategory="100" android:showAsAction="never" android:title="@string/action_upload"/> <item android:id="@+id/action_forward" android:icon="@drawable/ic_action_forward" android:title="@string/action_forward" android:showAsAction="ifRoom" /> However when I try to run it, I get an error saying: [2014-06-19 17:26:18 - ARIN] W/ResourceType( 9060): ResXMLTree_node size 0 is smaller than header size 0x100. [2014-06-19 17:20:26 - ARIN] C:\Users\NAME\Documents\NAME\NAME\ARIN\res\menu\navigation_screen.xml:5: error: Error: No resource found that matches the given name (at 'title' with value '@string/action_upload'). I even tried a Project clean in eclipse, but still problem persists. Does anyone know how to fix it? Thanks
score: 1
tagged with: java
tagged with: adt
has comment: http://stackoverflow.com/comment/37584829
tagged with: eclipse
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/37796546
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24409575
has text: *"the default cache seems to be huge"* Why is that a problem?

http://stackoverflow.com/q/24274919
has comment: http://stackoverflow.com/comment/37515946
downvote count: 0
has comment: http://stackoverflow.com/comment/37505518
tagged with: java
has body: I'm trying to write a code for class that does the following: Asks how many decks to use Program produces a single unused card, from the deck(s) each time enter is pressed Program notifies the user when there are no more cards to deal Program Allows the user to play again Methods are used extensively So far, my code looks like this: import java.util.*; public class IA3 { @SuppressWarnings({ }) public static void play () { } @SuppressWarnings("resource") public static void main(String[] args) { boolean draw = true; boolean pa = true; Scanner console = new Scanner(System.in); // TODO Auto-generated method stub System.out.println("Hello! Please input the number of decks you would like to use:"); int decks = console.nextInt(); int t = decks * 52; System.out.println("Your total amount of cards to use are " +t); int a = 0; do { int[] deck = new int[t]; //declaration of suits and ranks String[] suits = {"Spades", "Hearts", "Diamonds", "Clubs"}; String[] ranks = {"Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King"}; //Initializing of the cards for (int i = 0; i &lt; t; i++) { deck[i] = i; } System.out.println("Press enter to draw a random card : "); //allows player to prompt the system for the next card String input = console.nextLine(); a++; if (input.equals("")) { // Shuffles the cards for (int i = 0; i &lt; 1; i++) { int index = (int)(Math.random() * t); int temp = deck[i]; deck[i] = deck[index]; deck[index] = temp; } for (int i = 0; i &lt; 1; i++) { String suit = suits[deck[i] / 13]; String rank = ranks[deck[i] % 13]; System.out.println(rank + " of " + suit); } if (a&gt;t) { System.out.println ("No more cards available"); break; } System.out.println("Draw another card? (Yes or No) : "); String again = console.nextLine(); if (again.equals("Yes")) { continue; } if (again.equals("No")) { draw = false; System.out.println("Game over!"); } System.out.println("Play again? (Yes or No) : "); String plag = console.nextLine(); if (plag.equals("Yes")) { con…
tagged with: methods
type: Question
linked to: http://stackoverflow.com/q/15655126
accepted answer: http://stackoverflow.com/a/24275006
possible better answer: http://stackoverflow.com/a/24275072
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/24275006
has title: Deck Dealing Java
favorite count: 0
has answer: http://stackoverflow.com/a/24275072
has comment: http://stackoverflow.com/comment/37505682
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/37560480
has text: @QuentinTanioartino Check edit above. This demonstrates how to consume an input stream in four byte chunks and perform the conversion.
type: Comment
comment on: http://stackoverflow.com/a/24281631
score: 0
type: AnswerComment

http://stackoverflow.com/a/32163359
upvote count: 2
answers question: http://stackoverflow.com/q/24271616
has body: Just to elaborate more on this why compareTo() and equals() need to be consistent. The Sorted Set depends on the Object's compareTo() method to know whether a particular element can be added or not in the set and to avoid duplicate elements from being added into the set. So if this is the case , then it leads to ambiguity(copied from the specs):- For example, if one adds two keys a and b such that (!a.equals(b) &amp;&amp; a.compareTo(b) == 0) to a sorted set that does not use an explicit comparator, the second add operation returns false (and the size of the sorted set does not increase) because a and b are equivalent from the sorted set's perspective. To elaborate more, sorted set used compareTo() to check if the two elements a &amp; b are equal or not and if the Class for a &amp; b only overrides compareTo() method and not equals() method , then we could have a scenario where compareTo() method returns 0, but equals() method return false, which is quite weird and inconsistent. Let's say I have a Name class as shown below:- public class Name implements Comparable&lt;Name&gt; { private final String firstName, lastName; public Name(String firstName, String lastName) { if (firstName == null || lastName == null) throw new NullPointerException(); this.firstName = firstName; this.lastName = lastName; } public String firstName() { return firstName; } public String lastName() { return lastName; } /*public boolean equals(Object o) { if (!(o instanceof Name)) return false; Name n = (Name) o; return n.firstName.equals(firstName) &amp;&amp; n.lastName.equals(lastName); } public int hashCode() { return 31 * firstName.hashCode() + lastName.hashCode(); }*/ public String toString() { return firstName + " " + lastName; } public int compareTo(Name n) { int lastCmp = n.lastName.compareTo(lastName); return (lastCmp != 0 ? lastCmp : n.firstName.compareTo(firstName)); } } // Tester class main method has the below code Name n1 = new Name("John", "Smith"); Name n2 = new Name("John", "Smit…
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/37786650
has text: sorry,"Books" is my project name in tomcat.so my page is "http://localhost:80/Books/"
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24423323
type: Comment

http://stackoverflow.com/a/24395761
upvote count: 1
has comment: http://stackoverflow.com/comment/37817494
has comment: http://stackoverflow.com/comment/37816442
answers question: http://stackoverflow.com/q/24395685
has comment: http://stackoverflow.com/comment/37757612
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37787857
type: Answer
has body: One way of doing this faster would be fetching the objects in a lazy way or depending on which are necessary and which are not. Like maybe you only need to show 5 columns in a table, instead of every single object in the hierarchy, so you create DTO to get them. If you need more information on one of them.. lets say the user clicks on a row, then you would bring the whole object hierarchy of it.. It may not apply in your case, but its one way of efficiently getting data.

http://stackoverflow.com/q/24404296
has body: I have been stuck on an issue for the last couple of days and frankly I am out of ideas. What I am trying to do is to host an rest service using Jersey that will accept a post request with stream of audio data in its payload. Issue I have been running into is that that I loose data consistency (I am running CRC check on both client and server) and after 8 reads of with 1024 bytes buffer CRC between data sent and data received becomes inconsistent. It works just fine when I am dealing with text or content of smaller size. Code is attached, can anyone please tell me what I am doing wrong? Server: @POST @Consumes("audio/wav") @Produces(MediaType.TEXT_PLAIN) public String streamCommand(@Context HttpServletRequest request ) throws Exception { CRC32 crc = new CRC32(); InputStream stream = request.getInputStream(); byte[] readBuffer = new byte[1024]; StringBuilder builder = new StringBuilder(); while (stream.read(readBuffer) &gt; -1) { crc.update(readBuffer); builder.append(new String(readBuffer)); System.out.println(crc.getValue()); } return builder.toString(); } Client: static final String SOUND_FILE_NAME = "SoundTest.wav"; @BeforeClass public static void setup() throws Exception { soundStream = classloader.getResourceAsStream(SOUND_FILE_NAME); } @Test public void test() throws Exception { PipedOutputStream stream = new PipedOutputStream(); DataStreamer data = new DataStreamer(stream, soundStream); ExecutorService executor = Executors.newFixedThreadPool(1); HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost("http://localhost:8080/EVAFrontEnd/webapi/users/1/devices/1/command"); post.addHeader(HttpHeaders.CONTENT_TYPE, "audio/wav"); InputStreamEntity requestEntity = new InputStreamEntity(new PipedInputStream((PipedOutputStream) stream), -1); post.setEntity(requestEntity); executor.execute(data); executor.shutdown(); HttpResponse r = client.execute(post); assertNotNull(r); } Data Streamer: public class DataStreamer implements Runnable { OutputStream w…
type: Question
tagged with: jersey
has title: Audio file stream in HTTP Post Jersey using Java
tagged with: http-post
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 2
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/33757063
tagged with: filestream

mockito
tags question: http://stackoverflow.com/q/24331042
tags question: http://stackoverflow.com/q/24294277
tags question: http://stackoverflow.com/q/24390146
tags question: http://stackoverflow.com/q/24400216
tags question: http://stackoverflow.com/q/24271778
tags question: http://stackoverflow.com/q/24396392
tags question: http://stackoverflow.com/q/24418778
tags question: http://stackoverflow.com/q/24301613
tags question: http://stackoverflow.com/q/24335959
tags question: http://stackoverflow.com/q/24295197
tag name: mockito
tags question: http://stackoverflow.com/q/24374941
tags question: http://stackoverflow.com/q/24270503
tags question: http://stackoverflow.com/q/24385281
tags question: http://stackoverflow.com/q/24302535
tags question: http://stackoverflow.com/q/24407433
tags question: http://stackoverflow.com/q/24420504
type: Tag
tags question: http://stackoverflow.com/q/24302867
tags question: http://stackoverflow.com/q/24307737
tags question: http://stackoverflow.com/q/24326425
tags question: http://stackoverflow.com/q/24411708
tags question: http://stackoverflow.com/q/24344316
tags question: http://stackoverflow.com/q/24377238
tags question: http://stackoverflow.com/q/24292225
tags question: http://stackoverflow.com/q/24328949
tags question: http://stackoverflow.com/q/24298077
tags question: http://stackoverflow.com/q/24387558

http://stackoverflow.com/q/24396392
has comment: http://stackoverflow.com/comment/37757487
linked to: http://stackoverflow.com/q/250692
tagged with: white-box
tagged with: java
has body: I am currently testing a method updateIssuesTable(). this method is a private void method. Even worse, inside this method is a call to getConnection(), which returns a Connection, and is dependent on several private variables, which are dependent on an intialization method, which is of course dependent on something else. Long story short, this line of code: Connection conn = getConnection(); I don't want to execute at all, I just need a mocked Connection to continue execution. Belowe is the test method: public void testUpdateIssuesTable() throws Exception { PatchWriterTask task = new PatchWriterTask(); String sql = "update val_issues set PATCH_CREATION_INFO = ? where VAL_ISSUE_ID = ?"; when(task1.getConnection()).thenReturn(conn); when(conn.prepareStatement(sql)).thenReturn(updateStatement); Whitebox.invokeMethod(task, "updateIssuesTable"); } The method I am testing is as follows: private void updateIssuesTable() throws SQLException { PreparedStatement createStatement = null; String sql = "update val_issues set PATCH_CREATION_INFO = ? where VAL_ISSUE_ID = ?"; Connection conn = getConnection(); createStatement = conn.prepareStatement(sql); ... } EDIT: I create a mocked Connection in my test class: private Connection conn = mock(Connection.class);
has comment: http://stackoverflow.com/comment/37735972
type: Question
tagged with: mockito
has comment: http://stackoverflow.com/comment/37757705
has comment: http://stackoverflow.com/comment/37736129
linked to: http://stackoverflow.com/q/440786
score: 0
has answer: http://stackoverflow.com/a/24397025
answer count: 1
tagged with: junit
has comment: http://stackoverflow.com/comment/37735841
linked to: http://stackoverflow.com/q/34571
has comment: http://stackoverflow.com/comment/37757619
has title: Stubbing/Mocking a private method
type: UnansweredQuestion

http://stackoverflow.com/a/24424503
upvote count: 3
has body: MP3SPI is a Java Service Provider Interface that adds MP3 (MPEG 1/2/2.5 Layer 1/2/3) audio format support for Java Platform. It supports streaming, ID3v2 frames, Equalizer etc. It is based on JLayer and Tritonus Java libraries. You can use this library MP3 SPI for Java Sound , and its documentation here. Library reference
answers question: http://stackoverflow.com/q/24422040
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24422040
score: 3

http://stackoverflow.com/comment/37517718
has text: I think there is an other method without using a condition
type: AnswerComment
comment on: http://stackoverflow.com/a/24281651
score: 0
type: Comment

http://stackoverflow.com/comment/37560824
type: QuestionComment
comment on: http://stackoverflow.com/q/24300479
has text: i have tried,,, but when i found document's have a image,, when extraction text, it's very slow, do you have any idea ??
score: 0
type: Comment

http://stackoverflow.com/q/24281330
answer count: 1
tagged with: java
tagged with: powershell-remoting
tagged with: wmi
has answer: http://stackoverflow.com/a/24282167
downvote count: 0
tagged with: powershell
type: UnansweredQuestion
has body: I want to execute Enable-PSRemoting in elevated mode. I am newbie to powershell.I am working in JAVA and excuting WMI command import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import com.hp.hostconfig.windows.ExecuteException; public class testWMI { private static final String ENABLEREMOTING = "powershell -Command \"&amp; {Enable-PSRemoting -force}\""; public static void main(String[] args) throws ExecuteException{ String command =String.format(ENABLEREMOTING); System.out.println("Command ===&gt; " +command ); String commandArray [] = (command.split(" ")); System.out.println("Command Array " + commandArray); Runtime runtime = Runtime.getRuntime(); Process proc; try { proc = runtime.exec(commandArray); proc.getOutputStream().close(); List&lt;Map&lt;String, String&gt;&gt; dataList = readNVPData(proc); System.out.println("Datalist ===&gt; " +dataList); if (dataList == null) { // not single line was read, it could be either an error or no // data has been read. checkForError(proc); // since there is no error (no exception thrown) then there is // no data return ; } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } private static void checkForError(Process proc) throws IOException, ExecuteException { List&lt;String&gt; errorList = readError(proc); if (errorList == null) // nothing was read, there is no data return; System.out.println("ErrorList ===&gt; " + errorList); if (!errorList.isEmpty()) { System.out.println("If some data was read ErrorList ===&gt; " + errorList); // build error line StringBuilder errorLine = new StringBuilder(); for (String line : errorList) { if (!line.startsWith("At line:")) errorLine.append(line); else break; } // it is split by ":" into Command called and error String[] errorTokens = errorLine.toString().split(":", 2); if (errorTokens.length == 2) throw new ExecuteExce…
score: 1
favorite count: 0
has title: Execute wmi command Enable-PSRemoting in elevated mode
type: Question
upvote count: 1

http://stackoverflow.com/a/28801384
has body: The question was also answered here: https://stackoverflow.com/a/22099665/4153207 Like already said, the problem was that the TextArea consists of: TextArea, Scroll-pane and Content. .text-area .scroll-pane .content{ -fx-background-color: black; }
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24279061
downvote count: 0

http://stackoverflow.com/comment/37731707
type: Comment
type: QuestionComment
has text: For example something like this: (1.2*4)+2-(21.2+3)^2
comment on: http://stackoverflow.com/q/24394204
score: 0

http://stackoverflow.com/q/24283767
tagged with: java
type: UnansweredQuestion
tagged with: fuzzy-search
answer count: 0
has title: Java Fuzzy Search for an entity name with typos as well as abbrevations
type: Question
score: 0
has body: I need to implement in Java a Fuzzy Search for an entity name say manufacturer name that will take care of the (a) typos, as well as (b) shortened forms like limited, Ltd, etc Say I need to identify that all the following 1 thru 7 refer to the same entity while 8 thru 9 is another entity : 1) Information System Technlogies 2) Info System Technlogies 3) Info System Techlology Limited 4) Info System Techlology Ltd 5) Information System Technlogies Limited 6) Info System Ltd 7) IS Limited 8) Delivery System Technologies Limited 9) DS Limited Using Lavenshtein Distance, won't 5 and 8 look more similar and 7 and 9 will appear to be more similar when actually its other way round in both the cases. I do not want to have to maintain a pre-defined dictionary for abbreviations as we have big data situation where pre-empting all the possibilities may not be feasible. Any pointers if any single fuzzy method can help here for typos as well as abbreviations or I need to go hybrid and what would be best to use in that case please?
has comment: http://stackoverflow.com/comment/37521900
has comment: http://stackoverflow.com/comment/37522889

http://stackoverflow.com/a/34073321
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24356672
has body: This is how you can do it ,implement logic your self import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.graphics.Pixmap.Format; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; public class MyGdxGame extends ApplicationAdapter { SpriteBatch batch; int i=0; Texture texture,texture2; @Override public void create () { batch = new SpriteBatch(); initTestObjects() ; } @Override public void render () { Gdx.gl.glClearColor(0, 0, 0, 0); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); batch.draw(texture2,100,100,300,20); batch.draw(texture,100,100,i,20); if(i&gt;300) { i=0; } i++; batch.end(); } private void initTestObjects() { int width =1 ; int height = 1; Pixmap pixmap = createProceduralPixmap(width, height,0,1,0); Pixmap pixmap2 = createProceduralPixmap(width, height,1,0,0); texture = new Texture(pixmap); texture2 = new Texture(pixmap2); } private Pixmap createProceduralPixmap (int width, int height,int r,int g,int b) { Pixmap pixmap = new Pixmap(width, height, Format.RGBA8888); pixmap.setColor(r, g, b, 1); pixmap.fill(); return pixmap; } }
downvote count: 0
score: 1

file
tags question: http://stackoverflow.com/q/24316561
type: Tag
tags question: http://stackoverflow.com/q/24386020
tags question: http://stackoverflow.com/q/24384348
tags question: http://stackoverflow.com/q/24423136
tags question: http://stackoverflow.com/q/24380066
tags question: http://stackoverflow.com/q/24312643
tags question: http://stackoverflow.com/q/24419685
tags question: http://stackoverflow.com/q/24408481
tags question: http://stackoverflow.com/q/24350838
tags question: http://stackoverflow.com/q/24367663
tags question: http://stackoverflow.com/q/24303444
tags question: http://stackoverflow.com/q/24299286
tags question: http://stackoverflow.com/q/24311394
tag name: file
tags question: http://stackoverflow.com/q/24339598
tags question: http://stackoverflow.com/q/24367131
tags question: http://stackoverflow.com/q/24299949
tags question: http://stackoverflow.com/q/24366184
tags question: http://stackoverflow.com/q/24409343
tags question: http://stackoverflow.com/q/24382987
tags question: http://stackoverflow.com/q/24285471
tags question: http://stackoverflow.com/q/24300729
tags question: http://stackoverflow.com/q/24398912
tags question: http://stackoverflow.com/q/24319448
tags question: http://stackoverflow.com/q/24417988
tags question: http://stackoverflow.com/q/24279709
tags question: http://stackoverflow.com/q/24371084
tags question: http://stackoverflow.com/q/24291428
tags question: http://stackoverflow.com/q/24388308
tags question: http://stackoverflow.com/q/24372154
tags question: http://stackoverflow.com/q/24356791
tags question: http://stackoverflow.com/q/24364030
tags question: http://stackoverflow.com/q/24334157

http://stackoverflow.com/comment/37613118
type: Comment
has text: That's what I am trying to do, sort of :)
comment on: http://stackoverflow.com/q/24316520
score: 0
type: QuestionComment

http://stackoverflow.com/q/24335464
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24336928
tagged with: java
has answer: http://stackoverflow.com/a/24335887
has title: Regulating step speed in game
type: Question
tagged with: game-physics
has body: I am developing a game and I need to create a method to create a movement. What it needs to do is take x y and target x y values and create a float[] with the movement inside of it defined to a certain time. The movement will be used every frame for a certain amount of frames until it has reached the target in a specific time. Here is what I have so far. public void calculateRoute(int time) { if(x &gt; tx){ movement[0] = -((x - tx) / time); }else if(x &lt; tx){ movement[0] = ((tx - x) / time); }else if(x == tx){ movement[0] = 0; } if(y &gt; ty){ movement[1] = -((y - ty) / time); }else if(y &lt; ty){ movement[1] = ((ty - y) / time); }else if(y == ty){ movement[1] = 0; } } The problem with this is that the farther the target, the quicker the movement is. I want to have the movement regulating to a certain speed but still reach its target. Basically I need to calculate the time variable to a speed that will always be the same, no matter the distance. I tried this with setting the movement to 1 but it would miss its target since x could be 500, and the y could be 700. It would end up being x = 700, y = 700. Any help is appreciated! :) Also some sample code would be nice!
tagged with: math
score: 0

http://stackoverflow.com/q/24278814
has title: Problems executing Bash command over SSH from Java
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37512791
score: 2
has answer: http://stackoverflow.com/a/24279641
downvote count: 0
has comment: http://stackoverflow.com/comment/37512656
has comment: http://stackoverflow.com/comment/37513176
tagged with: java
has comment: http://stackoverflow.com/comment/37513128
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/37513227
answer count: 2
has comment: http://stackoverflow.com/comment/37512537
tagged with: bash
has body: I am having trouble executing commands on a remote GNU/Linux system over SSH from Java. The following commands work fine when executed in the local Bash (of course the user and host are different but the behaviour is unchanged). $ ssh user@host.example.com 'hostname' host $ ssh user@host.example.com 'hostname -f' host.example.com $ ssh user@host.example.com "hostname -f" host.example.com Doing what I think is the same from Java fails for anything more complex than hostname without arguments. import java.io.ByteArrayOutputStream; import java.io.IOException; import org.apache.commons.exec.CommandLine; import org.apache.commons.exec.DefaultExecutor; import org.apache.commons.exec.Executor; import org.apache.commons.exec.PumpStreamHandler; public class SOPlayground { public static void main(String[] args) throws Exception { for (String argument : new String[]{"hostname", "'hostname'", "\"hostname\"", "'hostname -f'", "\"hostname -f\""}) { CommandLine commandLine = new CommandLine("ssh"); commandLine.addArgument("user@host.example.com"); commandLine.addArgument(argument); System.out.println(commandLine); final Executor executor = new DefaultExecutor(); try (ByteArrayOutputStream os = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream()) { executor.setStreamHandler(new PumpStreamHandler(os, err)); int exitcode = executor.execute(commandLine); System.out.println("exitcode=" + exitcode); System.out.println(new String(os.toByteArray(), "UTF-8")); System.err.println(new String(err.toByteArray(), "UTF-8")); } catch (IOException ex) { System.err.println(ex.getMessage()); } } } } The output is: ssh user@host.example.com hostname exitcode=0 host ssh user@host.example.com 'hostname' exitcode=0 host ssh user@host.example.com "hostname" exitcode=0 host ssh user@host.example.com 'hostname -f' Process exited with an error: 127 (Exit value: 127) ssh user@host.example.com "hostname -f" Process exited with an error: 127 (Exit value: 127) As you can see, ex…
has comment: http://stackoverflow.com/comment/37513921
tagged with: ssh
has answer: http://stackoverflow.com/a/24286773

http://stackoverflow.com/q/24275296
has comment: http://stackoverflow.com/comment/37506045
has comment: http://stackoverflow.com/comment/37506038
has title: understanding the flow of a simple dynamic programming
type: Question
tagged with: algorithm
has answer: http://stackoverflow.com/a/24275343
has comment: http://stackoverflow.com/comment/37505985
has comment: http://stackoverflow.com/comment/37506019
has comment: http://stackoverflow.com/comment/37505987
score: 0
tagged with: dynamic-programming
answer count: 1
has body: I just started understanding the concept of dynamic programming. I understand it is used to cache results for future calls and its really efficient in designing complex algorithms that give an exponential runtime. What I don't understand is how the flow would work programmatically. For example to calculate the nth Fibonacci number using dynamic programming as follows. What is the flow like in the program? int[] fibMap = new int[max] int fibo(int i){ if(i == 0) return 0; if(i == 1) return 1; if( fibMap[i] != 0) return fibMap[i]; // return cached result fibMap[i] = fibo(i-1)+fibo(i-2); //Cache result return fibMap[i]; } I found this code from one of the Java reference books that I am using but I am having hard time figuring out how this program would work. Say if we would want to calculate a simple fibo(3) or fibo(5), could someone please explain me how the program would cache result and how the overall flow would work for this problem compared to a normal recursive approach without DP like below? int fibo(int i){ if(i == 0) return 0; if( i == 1) return 1; return fibo(i-1) + fibo(i-2); }
accepted answer: http://stackoverflow.com/a/24275343
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/37624909
has text: For suggestion 2, you can read the DefaultTableModel API. It has a constructor where you provide the column names and data. Then once you create the DefaultTableModel you add it to the existing JTable using the setModel() method. Again read the JTable API for information about that method. There is no need to create a new table or scrollpane. All the code is doing is updating the data in the existing table. You can always search the forum for examples that use the setModel() method.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24337785
type: AnswerComment

google-bigquery
tags question: http://stackoverflow.com/q/24298976
type: Tag
tag name: google-bigquery

http://stackoverflow.com/q/24376768
has comment: http://stackoverflow.com/comment/37698750
favorite count: 0
score: 32
has title: Can java finalize an object when it is still in scope?
has comment: http://stackoverflow.com/comment/37709669
upvote count: 32
has comment: http://stackoverflow.com/comment/68646829
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24380219
has comment: http://stackoverflow.com/comment/37698714
has comment: http://stackoverflow.com/comment/37699601
tagged with: java
has comment: http://stackoverflow.com/comment/37699378
has comment: http://stackoverflow.com/comment/37698879
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/37698774
has comment: http://stackoverflow.com/comment/37698802
type: Question
possible better answer: http://stackoverflow.com/a/24376863
has answer: http://stackoverflow.com/a/24376863
has body: I've been looking into a bug in my code that seems to be caused by some "ugly" finalizer code. The code looks roughly like this public class A { public B b = new B(); @Override public void finalize() { b.close(); } } public class B { public void close() { /* do clean up our resources. */ } public void doSomething() { /* do something that requires us not to be closed */ } } void main() { A a = new A(); B b = a.b; for(/*lots of time*/) { b.doSomething(); } } What I think is happening is that a is getting detected as having no references after the second line of main() and getting GC'd and finalized by the finalizer thread - while the for loop is still happening, using b while a is still "in scope". Is this plausable? Is java allowed to GC an object before it goes out of scope? Note: I know that doing anything inside finalizers is bad. This is code I've inherited and am intending to fix - the question is whether I'm understanding the root issue correctly. If this is impossible then something more subtle must be the root of my bug.
has comment: http://stackoverflow.com/comment/37698830
has comment: http://stackoverflow.com/comment/37698780
has comment: http://stackoverflow.com/comment/37698892
has comment: http://stackoverflow.com/comment/68646883
answer count: 2
has answer: http://stackoverflow.com/a/24380219
downvote count: 0

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/24357218
type: Tag
tags question: http://stackoverflow.com/q/24331023
tags question: http://stackoverflow.com/q/24361647

http://stackoverflow.com/comment/37657516
has text: So it just makes your code more simple? edit: okay, I see what you're saying.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24354916
score: 0

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/24333428
tag name: osx-mavericks

http://stackoverflow.com/comment/37656994
has text: How did you set Eclipse to use JDK8 ?
type: Comment
comment on: http://stackoverflow.com/q/24354649
type: QuestionComment
score: 0

http://stackoverflow.com/q/24426827
has comment: http://stackoverflow.com/comment/37792343
accepted answer: http://stackoverflow.com/a/24427264
tagged with: cpu-usage
tagged with: jprogressbar
has answer: http://stackoverflow.com/a/24427264
type: AnsweredQuestion
has title: How to show the CPU and disk usage in a JProgressBar?
tagged with: java
possible better answer: http://stackoverflow.com/a/24426930
has answer: http://stackoverflow.com/a/24426930
type: Question
answer count: 2
tagged with: disk-access
linked to: http://stackoverflow.com/q/4044726
score: 0
has body: I want to display the current cup usage and disk usage in two separate JProgressBars. And also it should update second by second. How to do it using java? I am quite new to java programming, so please give me some code example. Thanks in advance.

http://stackoverflow.com/q/24365136
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/37676640
tagged with: calculated-field
tagged with: ms-access
favorite count: 0
tagged with: jackcess
has title: Reading an Access calculated field from Java on any OS (not just Windows)
has comment: http://stackoverflow.com/comment/37676871
tagged with: ucanaccess
has body: How can I read calculated fields with UCanAccess or Jackcess (or any Java library that also works on Linux)? I don't care if I can't get the result straightaway, I'll settle for just getting only the function if need be. For simplicity, we'll assume a simple table with two columns: id, and idx2 which returns [id]*2. I want to either query the value (1,2) or anything related to the function.
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24365700
accepted answer: http://stackoverflow.com/a/24365700
score: -1
downvote count: 2

http://stackoverflow.com/q/24295012
has body: i've got a problem adding a jpanel to a jframe, i don't know why it doesn't appear with other layout that is not flowLayout; i don't use FlowLayout because all my swing components can't positioned. This is a picture of how FlowLayout shows my components: And this is how they should show: Can anyone help me please.
tagged with: jframe
upvote count: 1
tagged with: swing
type: AnsweredQuestion
tagged with: java
downvote count: 3
tagged with: jpanel
accepted answer: http://stackoverflow.com/a/24295265
has comment: http://stackoverflow.com/comment/37545992
has comment: http://stackoverflow.com/comment/37546007
type: Question
tagged with: layout
score: -2
has title: Add an existing JPanel to an existing JFrame
answer count: 1
has answer: http://stackoverflow.com/a/24295265
has comment: http://stackoverflow.com/comment/37543611
has comment: http://stackoverflow.com/comment/37543665
has comment: http://stackoverflow.com/comment/37548327
favorite count: 0

http://stackoverflow.com/comment/37705926
has text: so java websockets api wont work all the time. That is the reason socket.io and node.js existed. (to deal with all gracefully degradation). my point 3 seems valid?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24380794

http://stackoverflow.com/a/24420018
upvote count: 4
has comment: http://stackoverflow.com/comment/37780244
has comment: http://stackoverflow.com/comment/37780293
type: AcceptedAnswer
downvote count: 0
has body: The columns don't have a default value and don't support NULL values, so it is impossible to insert data in it if you don't provide any value (as you're currently doing). Define a valid default value for these columns or make it support NULL values.
has comment: http://stackoverflow.com/comment/37780332
has comment: http://stackoverflow.com/comment/37780596
has comment: http://stackoverflow.com/comment/37780226
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/37780571
has comment: http://stackoverflow.com/comment/37780127
answers question: http://stackoverflow.com/q/24419994
has comment: http://stackoverflow.com/comment/37780518
has comment: http://stackoverflow.com/comment/37780334
accepted answer of: http://stackoverflow.com/q/24419994

http://stackoverflow.com/comment/37681381
type: AnswerComment
has text: Sorry, I can't. It will lead to another update, then another, then... please, restart from scratch, maybe following a tutorial from a site that is not 2008 and not roseindia :) What you are asking is very basic, the fact that it's not working is mainly due to the overcomplexity in your code / patterns / work methodology. The "<result> stuff" clearly shows it (*I've tried with both apples and bananas in the dark...*). One step at a time is the only solution here
type: Comment
comment on: http://stackoverflow.com/a/24323745
score: 1

http://stackoverflow.com/comment/37766188
type: QuestionComment
comment on: http://stackoverflow.com/q/24412683
score: 0
has text: You want the Java 7 JRE. jdk1.5.0 is very old and is obsolete.
type: Comment

http://stackoverflow.com/q/24296956
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24297050
has body: After having used NetBeans to create a Java program call it Addition and then having successfully cleaned and built an Executable Jar File in a folder c:\Users\Ben\Doc\NetBeansProjects\Addition\dist WHY is it that when executing, from command prompt, c:\Users\Ben Java -Jar -cp "c:\Users\Ben\Doc\NetBeansProjects\Addition\dist" Addition.jar it does NOT work (i get 'unable to access jarfile Addition.jar) BUT if i use cd to change my current dir to c:\Users\Ben\Doc\NetBeansProjects\Addition\dist and THEN run 'java -jar Addition.jar' from there, the Addition program runs fine
score: 1
upvote count: 3
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/24296980
has title: executing java -jar via classpath vs in the jar file dir
tagged with: classpath
type: Question
answer count: 2
tagged with: jar
favorite count: 0

http://stackoverflow.com/a/24270111
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
has body: To override a method in SceneBuilder, you need to subclass the target control in Java or some other object oriented language and import your subclass into SceneBuilder. FXML (on which SceneBuilder is based), is just a declarative system, it doesn't have constructs like subclassing. Many JavaFX controls have settable event handlers (such as setOnMouseClicked) and are also customizable using CSS. Both of these things can be manipulated in SceneBuilder and FXML. So there is quite a lot of customization you can do without creating a new control or subclass, but sometimes you may want to create custom controls to get the flexibility you desire.
accepted answer of: http://stackoverflow.com/q/24268954
answers question: http://stackoverflow.com/q/24268954
downvote count: 0
has comment: http://stackoverflow.com/comment/37530460

http://stackoverflow.com/a/24376201
answers question: http://stackoverflow.com/q/24375848
has body: Check out this really good implementation of a Binary Search Tree written by the folks at Princeton (as a matter of fact - check out all the really good implementations they've published for all sorts of fundamental algorithms here) I'm a little unclear about what your specific question is, but lets start with this: private static BinarySearchTree&lt;StringItem, String&gt; tree = ... //Does this create a tree with String items as nodes? I think it will help if you think of the BST as being more like a map (with keys of one type mapped to values of another type) rather than a simple list of objects of a single type. If we look at the implementation linked to above, I think this is a bit clearer: public class BST&lt;Key extends Comparable&lt;Key&gt;, Value&gt; { private class Node { private Key key; // sorted by key private Value val; // associated data private Node left, right; // left and right subtrees private int N; // number of nodes in subtree ... } ... private Node put(Node x, Key key, Value val) { if (x == null) return new Node(key, val, 1); int cmp = key.compareTo(x.key); if (cmp &lt; 0) x.left = put(x.left, key, val); else if (cmp &gt; 0) x.right = put(x.right, key, val); else x.val = val; x.N = 1 + size(x.left) + size(x.right); return x; } ... } Note that the type parameters are explicitly named Key and Value here, which should reinforce what I was saying above. Also note that a Node contains both a key and a value - the value is the "payload", the actual data being being stored, while the key is used for sorting and organizing the tree (hence Key must implement Comparable). As an aside, note that instead of add(), the equivalent method here is called put(), which I think is also clearer because we're accustomed to calling put(k, v) on map-like structures and add(t) on lists (I'm wondering whether this might have played a role in your confusion) Like I said though, I'm not entirely sure what you're confused about. I've said what I've said here because it se…
score: 0
has comment: http://stackoverflow.com/comment/37698525
type: Answer

http://stackoverflow.com/q/24326340
upvote count: 1
answer count: 1
has title: spring social connectivity with Facebook and accessing user data
favorite count: 0
tagged with: maven
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24331373
downvote count: 0
accepted answer: http://stackoverflow.com/a/24331373
score: 1
tagged with: java
type: Question
has body: I have started to work with spring social and following the tutorial from here. and pages that follow. My java file looks like this. import org.springframework.boot.autoconfigure.EnableAutoConfiguration; //import org.springframework.boot.SpringApplication; //import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.social.connect.Connection; import org.springframework.social.connect.ConnectionFactory; import org.springframework.social.connect.ConnectionFactoryLocator; import org.springframework.social.connect.support.ConnectionFactoryRegistry; import org.springframework.social.facebook.api.Comment; import org.springframework.social.facebook.api.CommentOperations; import org.springframework.social.facebook.connect.FacebookConnectionFactory; import org.springframework.social.facebook.api.Facebook; import org.springframework.social.facebook.api.impl.FacebookTemplate; import org.springframework.social.oauth2.AccessGrant; import org.springframework.social.oauth2.GrantType; import org.springframework.social.oauth2.OAuth2Operations; import org.springframework.social.oauth2.OAuth2Parameters; //import org.springframework.social.UserIdSource; //import org.springframework.social.connect.ConnectionFactoryLocator; //import org.springframework.social.connect.ConnectionRepository; //import org.springframework.social.connect.web.ConnectController; @Configuration @EnableAutoConfiguration @Import(FacebookConfig.class) @ComponentScan public class App { static private String accessToken = "accesstoken"; static private String secretKey = "secretkey"; static private String clientId = "clientid"; public static void main(String[] args) { FacebookConnectionFactory connectionFactory = new FacebookConnectionFactory(clientId, secretKey); OAuth2Operations oauthOperations = connectionFactory.getOAuthOp…
tagged with: spring-social-facebook

http://stackoverflow.com/comment/37792660
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24426612
has text: @user3619962 use forms ...for that use hidden field then retrieve it in the servlet
score: 0

http://stackoverflow.com/a/24299796
downvote count: 0
has body: 2 ways to do it : Get the session object from request scope using HttpSession session = request.getSession(); and then session.setMaxInactiveInterval(int interval) Second way to do it is specify it in deployment descriptor (web.xml) 15 Difference between them: The setting in the web.xml is global, it applies to all sessions of a given context. Programatically, you can change this for a particular session.
answers question: http://stackoverflow.com/q/24299547
type: Answer
score: 6
upvote count: 6

http://stackoverflow.com/a/24309690
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24309549
answers question: http://stackoverflow.com/q/24309549
has comment: http://stackoverflow.com/comment/37573628
score: -1
has comment: http://stackoverflow.com/comment/37571548
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37571532
type: Answer
has comment: http://stackoverflow.com/comment/37573687
has body: As others have said, the removal of the object from memory itself is out of your control with Java. Your only requirement is to unassign all references to this object so that it becomes eligible for garbage collection, but when GC actually runs is neither determinable nor reliably consistent. There is a System.gc() call which you can read into, but it should probably just be avoided entirely.
downvote count: 2

http://stackoverflow.com/comment/37524117
has text: @Holger `MaskFormatter` looks interesting, I'll read up...
score: 0
comment on: http://stackoverflow.com/q/24284559
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24401005
accepted answer of: http://stackoverflow.com/q/24388787
has comment: http://stackoverflow.com/comment/37785151
type: Answer
has comment: http://stackoverflow.com/comment/37751915
has body: Your Child should be already declared in your Parent object class: public class parent{ private Child child ; //setter getter } then in your parent hbm (varies if using annotation) you map it: &lt;one-to-one cascade="none" name="child" not-null="true" class="com.example.child" column="FOREIGN_KEY" /&gt; Then once you have the parent you can just call: Child child = parent.getChild(); This only applies if you have one to one relationship, varies for one to many, will need to set as list.
score: 1
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37751366
answers question: http://stackoverflow.com/q/24388787
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37767340

http://stackoverflow.com/comment/37712813
has text: It wouldn't make sense. If it were allowed, you could have fields/methods that you'd expect to be there that aren't actually there. If it were allowed, I think the language designers might have been locked away somewhere where they couldn't do any more damage.
score: 1
comment on: http://stackoverflow.com/q/24384547
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37664456
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24358394
score: 0
has text: if you have only 2 Strings you can concatenate them with (+) operator. s1+s2 would produce what you want

http://stackoverflow.com/q/24351311
has answer: http://stackoverflow.com/a/24351418
score: 0
answer count: 1
tagged with: binary-tree
accepted answer: http://stackoverflow.com/a/24351418
tagged with: recursion
type: AnsweredQuestion
has title: Counting the inner nodes (parent nodes) in a binary tree recursively
tagged with: java
type: Question
has body: I need to create a recursive method that takes as a parameter the root node of a binary search tree. This recursive method will then return the int value of the total number of inner nodes in the entire binary search tree. This is what I have so far: int countNrOfInnerNodes (Node node) { if(node == null) { return 0; } if (node.left != null &amp;&amp; node.right != null){ return 1; } return countNrOfInnerNodes(node.left)+countNrOfInnerNodes(node.right) } } Is there a better way? I also stuck to find a iterativ solution.
tagged with: parent-node

http://stackoverflow.com/comment/37705318
type: Comment
score: 1
has text: I have solved my problem, based on your answer. Thank you! @Erwin Bolwidt
type: AnswerComment
comment on: http://stackoverflow.com/a/24349720

http://stackoverflow.com/comment/37649446
has text: one thing else, you just want Name and id from `ContactsContract.Contacts.CONTENT_URI` but you get all columns ( you set null as selection ) so just get two columns.
type: Comment
comment on: http://stackoverflow.com/q/24350146
score: 0
type: QuestionComment

jsr356
tag name: jsr356
tags question: http://stackoverflow.com/q/24380364
tags question: http://stackoverflow.com/q/24282315
type: Tag

http://stackoverflow.com/a/24296393
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37546223
type: Answer
has comment: http://stackoverflow.com/comment/37546278
accepted answer of: http://stackoverflow.com/q/24296096
downvote count: 0
answers question: http://stackoverflow.com/q/24296096
has body: ((JCheckBox)e.getSource()).getText() works fine for me with your code.
score: 3

http://stackoverflow.com/comment/37610213
type: AnswerComment
comment on: http://stackoverflow.com/a/24327506
type: Comment
has text: Yes, right, heap is 1 GiB. Ok I got it, thanks, what about the JMX? I think the JMX is JVM's, not Thrift's, but I don't know how to configure or disable this...
score: 0

http://stackoverflow.com/a/24333510
answers question: http://stackoverflow.com/q/24324974
type: Answer
score: 2
has body: Package one app to be included in the other app. (Read about ADF libraries for this). Then create the EAR from the containing app deployment options.
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/24335265
answers question: http://stackoverflow.com/q/24335126
upvote count: 3
type: Answer
downvote count: 0
has body: The biggest disadvantage is that you may also catch an exception you didn't intend to catch. For instance, let's say you have a method that may throw a NullPointerException, and you can handle that case. (Such a method is probably badly written, but let's say it's a library method and you can't change it.) So, you catch the NPE: void func1() { try { func2(); if (someString.equals("some value") { someOtherFunction(); } } catch (NullPointerException e) { // handle func2()'s NPE somehow } } There are two places a NPE could have been thrown within the try's body: from func2, or from someString.equals if someString is null. This code treats both the same way, which is probably a bug. Generally speaking, in nearly all aspects of programming (variable scope, try-catch blocks, class members, etc), the smaller the scope is, the easier it is to reason about and the less likely you are to write bugs.
score: 3
accepted answer of: http://stackoverflow.com/q/24335126
type: AcceptedAnswer

http://stackoverflow.com/q/24376381
type: UnansweredQuestion
has title: Java SecurityManager to prevent .. directory usage
tagged with: securitymanager
tagged with: spring
score: 2
downvote count: 0
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/27755108
has body: I want to forbid a spring webapp (running in tomcat) from using any file paths that include ".." in them. Obviously the first place to do this is at the points where user information is sanitized before being used in file paths. However, there are hundreds of places in the app that do file access and it would take quite a lot of effort to manually verify that all of them are implemented correctly. I'd like to just do something like add or modify the Java SecurityManager to prevent filenames from having ".." in them. My first attempt was to create my own SecurityManager and override methods like checkRead and checkWrite, but it turns out that's not sufficient. The default implementation of the methods appear to disallow everything anyaway, so I suspect creating one from scratch isn't really the way it's supposed to be done. Another possibility I suppose would be to use aspectj, but if I can make SecurityManager work that seems like a better idea. So, what's the simplest thing I can do to disallow ".." in all filenames? Are there any SecurityManager implementations I can just install and use which are meant to make webapps more secure?
has comment: http://stackoverflow.com/comment/43926011
upvote count: 2
answer count: 1
tagged with: tomcat
favorite count: 0

http://stackoverflow.com/q/24298913
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/8348591
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37551903
accepted answer: http://stackoverflow.com/a/24298984
has title: Convering String to Int array in java
type: Question
has comment: http://stackoverflow.com/comment/37550593
has comment: http://stackoverflow.com/comment/37550606
has answer: http://stackoverflow.com/a/24298990
has answer: http://stackoverflow.com/a/24299122
tagged with: int
possible better answer: http://stackoverflow.com/a/24298964
tagged with: string
has answer: http://stackoverflow.com/a/24298964
answer count: 4
has comment: http://stackoverflow.com/comment/37550752
favorite count: 0
has answer: http://stackoverflow.com/a/24298984
has comment: http://stackoverflow.com/comment/37550813
has comment: http://stackoverflow.com/comment/37550646
upvote count: 2
has comment: http://stackoverflow.com/comment/37550776
has comment: http://stackoverflow.com/comment/37550592
downvote count: 1
has body: I have a "String line " variable in java when I give System.out.println(line); It gives me output as 233 81 335 332 165 56 82 316 123 247 328 348 177 89 86 1 252 228 34 350 116 91 193 106 272 121 56 203 179 259 25 163 101 77 116 135 29 257 254 400 195 192 20 59 270 350 116 92 6 87 22 230 126 207 393 73 399 57 96 93 9 196 172 111 192 234 315 59 35 351 390 239 88 339 145 17 161 330 328 198 47 194 107 231 312 260 118 369 344 114 355 99 117 199 219 5 255 336 124 The above output is 4 separate lines. Now I want to convert this string to int array, such that every location of the integer array will hold these numbers. I tried Tokenizing and parsing it, but when the data is very big nearly 200000 lines of record, it gives me a error. Any Suggestions? Pls Help.

http://stackoverflow.com/a/39794145
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24276180
has body: This could be done by adding a restriction to the cell that contains the Label in the Table: Label label = new Label("Example", new Label.LabelStyle(font, Color.WHITE)); label.setWrap(true); Table table = new Table(); table.add(label).width(WITH); For more information about how to use Table go to: https://github.com/libgdx/libgdx/wiki/Table
downvote count: 0

http://stackoverflow.com/q/24303100
upvote count: 1
answer count: 1
downvote count: 1
tagged with: jakarta-ee
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24323423
tagged with: jsf-2
has title: JSF: Default selection of all values in <h:selectManyListbox/>
linked to: http://stackoverflow.com/q/6650327
tagged with: javascript
favorite count: 0
type: Question
has body: I am working in jsf 2.0. From rich:popup based on user selection i am adding values into h:selectManyListbox using AJAX and then i re-render the enclosing outputPanel to display values from binding list. I am able to do this successfully. Now i want that all the values present in the selectedManyListbox should be selected by default so that user is not suppose to select it again. code for selectManyListBox : &lt;a4j:outputPanel id="groupTablePanel"&gt; &lt;h:selectManyListbox size="3" style="width:190px; height:100px;" id="table" value="#{userCreateBean.selectedGroups}"&gt; &lt;f:selectItems value="#{userCreateBean.assignedGroups}"&gt;&lt;/f:selectItems&gt; &lt;/h:selectManyListbox&gt; &lt;/a4j:outputPanel&gt; I explored the documentation of same, i even tried writing my own javascript code. Looking into firebug, i am not able to see the associated class for selected values in selectManyListbox. Also the onChange event of same gets executed only when we manually make any change in same, or click on it. So i would like to know which event will be appropriate to work with this kind of requirement? Please guide me how i can achieve this functionality. Thanks in advance.
score: 0
has comment: http://stackoverflow.com/comment/37596351

http://stackoverflow.com/comment/37632091
type: QuestionComment
has text: I'm sorry, Ossama, I don't understand what you're asking.
score: 0
comment on: http://stackoverflow.com/q/24341753
type: Comment

http://stackoverflow.com/q/24370760
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has title: How can I add a large profile picture to my navigation drawer?
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24373187
accepted answer: http://stackoverflow.com/a/24373187
tagged with: navigation
score: 0
answer count: 1
has body: So, a couple of days ago I started working on my very first app. It's an app with a navigation drawer where users can set some website shortcuts to be displayed in the navigation drawer. If a user clicks on a website it opens in a webview. Really nothing fancy, but it's a concept I came up with to train my Android knowledge. I finished the basics of this app this morning with some help, but now I want to add a large profile picture to the navigation drawer. (You can see it here on the left: http://www.droid-life.com/wp-content/uploads/2013/12/new-foursquare.jpg) I understand that I should add an <ImageView> to the navigation drawer, but every time I try that the log keeps saying I have junk in my XML... Below you can find the code I already wrote. I hope you guys can help me... Main.java package test.webviewapp; import android.app.Activity; import android.app.ProgressDialog; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.webkit.WebChromeClient; import android.webkit.WebView; import android.webkit.WebViewClient; public class Main extends ActionBarActivity implements NavigationDrawerFragment.NavigationDrawerCallbacks { /** * Fragment managing the behaviors, interactions and presentation of the * navigation drawer. */ private NavigationDrawerFragment mNavigationDrawerFragment; /** * Used to store the last screen title. For use in * {@link #restoreActionBar()}. */ private CharSequence mTitle; // we need a class level references to some objects to be able to modify the // target address outside of onCreate() private WebView myWebView; private ActionBar actionBar; private ProgressDialog progressDialog; // keep the pair of String arra…
tagged with: android

http://stackoverflow.com/comment/37576118
comment on: http://stackoverflow.com/q/24312453
has text: im not sure what im doing wrong or what am i missing, but the file is present in the absolute path.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/24325328
type: Answer
has body: There is a plugin which doest this in a single click. This will Comment / Remove out all System.Out's. Refer this, this and this.
answers question: http://stackoverflow.com/q/24323383
has comment: http://stackoverflow.com/comment/37600730
has comment: http://stackoverflow.com/comment/94519577
score: 0

http://stackoverflow.com/comment/37560353
comment on: http://stackoverflow.com/a/24303606
has text: If under resources image is a subfolder then String file1 = "images/filling.png"; InputStream stream= ClassName.class.getClassLoader().getResourceAsStream(file1); thats what you mean right?? @khmarbaise
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37707481
score: 0
has text: Well, Spring MVC works with controllers (the C of MVC)... You have to define the Spring MVC servlet only once, and then do the mapping within controllers. Better read the [documentation](http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html) before using a framework ;)
comment on: http://stackoverflow.com/q/24381570
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24458314
accepted answer of: http://stackoverflow.com/q/24398921
answers question: http://stackoverflow.com/q/24398921
upvote count: 3
has body: From twilio: Hi Matthew, Thanks for checking with us. It looks like "foursquare-api" is bringing in the "appengine-api-1.0-sdk" dependency. [INFO] +- fi.foyt:foursquare-api:jar:1.0.2:compile [INFO] | +- org.json:json:jar:20090211:compile [INFO] | \- com.google.appengine:appengine-api-1.0-sdk:jar:1.6.5:compile You can try excluding this dependency, however I expect it will probably break the "foursquare-api" library. "twilio-java" does not have a hard dependency on App Engine for this reason. Please let us know if you have any other questions. Alex Chan Twilio Customer Support www.twilio.com Updated pom.xml as follows: fi.foyt foursquare-api 1.0.2 com.google.appengine appengine-api-1.0-sdk
type: AcceptedAnswer
downvote count: 0
score: 3
type: Answer

http://stackoverflow.com/comment/37661154
has text: You need the servlet api. It is generally provided by your servlet container.
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/24356809

http://stackoverflow.com/a/24438091
accepted answer of: http://stackoverflow.com/q/24329842
has body: Even though I posted it in the issue, I completely overlooked the fact that the image was Base64 encoded, meaning it was a string. As is, this value couldn't be used by Jasper, so it had to be decoded. This can be done one of two ways: Change the expression to: new java.io.ByteArrayInputStream(javax.xml.DatatypeConverter.parseBase64Binary($F{ImageField})) or Simply convert the string to binary in the data base. In Sybase, that's the base64_decode function. Once it is converted, you can simply change the type to java.io.InputStream and it'll work.
answers question: http://stackoverflow.com/q/24329842
type: Answer
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24300012
tagged with: isinstance
type: Question
has comment: http://stackoverflow.com/comment/37552775
tagged with: identity
score: 0
has answer: http://stackoverflow.com/a/24300060
accepted answer: http://stackoverflow.com/a/24300060
answer count: 1
has title: What is the right direction of using "*.isInstance"?
has body: I am confused every time I read the Java Documentation again to that. So please try to help me in your own words. List&lt;Parent&gt; list = new ArrayList&lt;Parent&gt;(); //Child extends Parent... list.add(new Child()); ... ... for(Parent p: list){ if(p.getClass().isInstance(Child)){ Child c = (Child) p; c.execFuncNonExistingInParent(); } } Just wanna proof the Objects inheritances from Parent, to avoid Cast Problems. if(p.getClass().isInstance(Child.class)) or if(Child.class.isInstance(p.getClass())) Greatings Oekel
type: AnsweredQuestion
tagged with: java
tagged with: proof
has comment: http://stackoverflow.com/comment/37552808

http://stackoverflow.com/comment/37615300
type: QuestionComment
has text: As I know <c:out > can only be used in JSP/HTML, but I want to access the class objects inside the javascript code. I am new to JavaScript. Could you explain your suggestion in detail ?
comment on: http://stackoverflow.com/q/24330199
score: 0
type: Comment

http://stackoverflow.com/q/24341033
tagged with: java
has comment: http://stackoverflow.com/comment/37630022
tagged with: image-processing
has comment: http://stackoverflow.com/comment/37630354
type: Question
score: 5
has title: Texture deforming, 4 points
has comment: http://stackoverflow.com/comment/37630068
upvote count: 5
has comment: http://stackoverflow.com/comment/37634635
has answer: http://stackoverflow.com/a/24344967
answer count: 2
has comment: http://stackoverflow.com/comment/37630263
downvote count: 0
accepted answer: http://stackoverflow.com/a/24344967
favorite count: 0
has comment: http://stackoverflow.com/comment/37630246
possible better answer: http://stackoverflow.com/a/24341270
has answer: http://stackoverflow.com/a/24341270
has comment: http://stackoverflow.com/comment/37630007
type: AnsweredQuestion
has body: i am writing simple 3d game in Java and i need code / lib for texture deforming. I don't want to use OpenGL. Example: I have got texture: And i need deform it to: I hope everybody can understand me. Thanks!
has comment: http://stackoverflow.com/comment/37635765

http://stackoverflow.com/q/24401597
tagged with: java
has body: I am migrating my project from Weblogic 8.1 to IBM Websphere 8.5. There are lot of classes being used in java files which refers weblogic.jar. Now as migrating to Websphere, these needs to be replaced or changed and so the code. So my question is, can i get the exact or similar replacement jar for weblogic.jar. If not, is there any other method to replace the weblogic classes in the java code with websphere classes. Classes like weblogic.common.T3StartupDef, weblogic.jdbc.oci.Blob,etc are used.
tagged with: websphere-8
tagged with: migration
answer count: 1
has answer: http://stackoverflow.com/a/24402113
tagged with: jar
has title: Weblogic 8.1 to Websphere 8.5 migration
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24402113
score: 0
type: Question
tagged with: weblogic8.x

http://stackoverflow.com/comment/37617289
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24294142
has text: Thanks. But it did not work. I am actually trying to let the eclipse looking for libraries that are supposed to be in WEB-INF/lib from another folder. How would I tell eclipse to do that.
score: 0

http://stackoverflow.com/comment/39456142
has text: It was a user error. I was confused by the fact that both Hibernate Search and Infinispan used JGroups and did not realize that I need two separate configuration for them.
score: 2
comment on: http://stackoverflow.com/q/24314882
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37718757
type: QuestionComment
type: Comment
score: 1
has text: I think the problem is with the way you're building up your `String`... Don't use concatenation. Use `StringBuilder`.
comment on: http://stackoverflow.com/q/24387505

http://stackoverflow.com/comment/37492273
type: AnswerComment
comment on: http://stackoverflow.com/a/24267972
score: 0
type: Comment
has text: I posted the updated code including the main function. Still gives me the error

http://stackoverflow.com/a/24290525
has comment: http://stackoverflow.com/comment/37539411
has comment: http://stackoverflow.com/comment/37534727
has body: The method you are looking for is invertedLists.put(key, postings);. EDIT: According to the Java documentation, replace() is not part of the API for HashMap.
downvote count: 3
has comment: http://stackoverflow.com/comment/37534771
type: Answer
has comment: http://stackoverflow.com/comment/37534738
upvote count: 0
score: -3
answers question: http://stackoverflow.com/q/24290452

http://stackoverflow.com/a/26037079
upvote count: 1
has body: Since a few days ago, Google now allows any user to list users in a domain (also including subdomains). http://googleappsupdates.blogspot.se/2014/09/new-features-in-admin-sdk-custom-user.html However, this has two limitations which mean that this is not something I can benefit from for my particular use case. You still need a (active) username to make a request, and how are you going to get that username if you can't list the users? I might have a username from the signup, but that account may be deleted at any time. Still catch 22. If you are using a non-admin account, you are forced to set viewType to "domain_public", which means you will only be able to see a subset of the available fields. The "suspended" field is not one of them, and you also won't get any suspended users in the response. (documentation available here: https://developers.google.com/admin-sdk/directory/v1/reference/users/list) I could live with the "suspended" limitation, but since I can't get a list of users without already having a user, this is not helping me.
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24305915

http://stackoverflow.com/a/24416962
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/24416683
type: Answer
has body: stmt.executeUpdate("insert into empdetails(first_name,last_name,phone,email,city,state,pin) values(f_name, l_name, phno, email, city, state, pin)"); this executeUpdate method at runtime , expects sql query with values to be inserted. but you have directly mentioned java variables inside values() which is not at all understandable to SQL , because it expects values to be in quotes. so better go with prepared statement to bind those values at runtime like below preparedStmt.setString(1, f_name); preparedStmt.setString(2, l_name); preparedStmt.setString(3, phno); ....... preparedStmt.executeUpdate("insert into empdetails(first_name,last_name,phone,email,city,state,pin) values (?, ?, ?, ?, ?, ?, ?)");
score: 2
has comment: http://stackoverflow.com/comment/37774248

http://stackoverflow.com/a/24386848
answers question: http://stackoverflow.com/q/24386545
score: 0
type: Answer
has body: i don't think you can run it on com.sun.net.httpserver.HttpServer. because JAX-RS is a specification which have been implemented by various vendors like, Apche,jersey,jboss,spring etc. They provide there own server to run the web services which fulfill the desired criteria. Although restful web services runs over http but as per me they can't run on com.sun.net.httpserver.HttpServer. Hope it will help you

http://stackoverflow.com/comment/37649223
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24350684
has text: when i do that when and drag and drop I get the: Internal Error WindowBuilder encountered unexpected internal error. This could be caused by a WindowBuilder bug or by a misconfiguration issue, conflict, partial update, etc. java.lang.Error: new JLabel("New label")
score: 0

http://stackoverflow.com/comment/37709752
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24381372
has text: btw how many main classes do u have in that Pokusy_java project?
score: 0

http://stackoverflow.com/comment/37658396
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24355246
has text: Which entry in the array? first, last, or no pattern to it?

http://stackoverflow.com/comment/37772235
has text: What does your `catch` block catch?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24415784
score: 1

http://stackoverflow.com/comment/37539654
has text: http://docs.oracle.com/javase/7/docs/api/java/lang/ArrayIndexOutOfBoundsException.html
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24293012

http://stackoverflow.com/comment/37620407
comment on: http://stackoverflow.com/a/24335451
type: AnswerComment
has text: @Consuela Try larger n's, to see if it converges.
score: 0
type: Comment

http://stackoverflow.com/a/24331844
answers question: http://stackoverflow.com/q/24331402
has comment: http://stackoverflow.com/comment/37613958
type: Answer
score: 0
has body: From your iterative solution you could derive a one-step solution (it may overestimate the bounding box though, since this will calculate the maximum area covered possible if the most extreme values for rotation were chosen): public static Rectangle getBounds(Anchor leftAnchor, Anchor rightAnchor, int shapeWidth, int shapeHeight) { double size = Math.sqrt((shapeWidth * shapeWidth) + (shapeHeight * shapeHeight)); // find the maximum scale double maxScale = Math.max(leftAnchor.scaleX, leftAnchor.scaleY); maxScale = Math.max(rightAnchor.scaleX); maxScale = Math.max(rightAnchor.scaleY); int maxSize = (int) Math.ceil(maxScale * size); return new Rectangle(0, 0, maxSize, maxSize); } This works using the assumtion that the original Shape can not cover anything outside a circle described by the diagonal of the original rectangle - no matter how you rotate it, it won't leave the circle. By finding the maximum applied scale, the circle is adjusted for scaling.

http://stackoverflow.com/q/24337675
tagged with: android
accepted answer: http://stackoverflow.com/a/24337679
tagged with: java
has body: i am using a imagebutton in a fragment and am trying to open the drawerlayout with the image button nah fragment and activity both have this button and in same places, so i have placed code in both places Activity code probably does not work because fragment covers it public class MainFragment extends Fragment { private ImageButton mImageButton; public MainFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_main, container, false); mImageButton = (ImageButton) getView().findViewById(R.id.qpaper_menu_fragmain); mImageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ((MyActivity)getActivity()).openDrawer(); } }); return view; } } imagebutton inside xml &lt;ImageButton android:id="@+id/qpaper_menu_fragmain" android:layout_width="60dp" android:layout_height="60dp" android:background="@drawable/menu_button_blue" android:contentDescription="@string/description" /&gt; Edit: sorry above it says view i get NullPointerException with GetView view gives error back in eclipse and doesnt work
has title: NullPointerException using Imagebutton in fragment
downvote count: 1
type: Question
type: AnsweredQuestion
tagged with: android-layout
tagged with: android-fragments
score: -1
has answer: http://stackoverflow.com/a/24337679
upvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/q/24403929
downvote count: 1
has answer: http://stackoverflow.com/a/24405953
has comment: http://stackoverflow.com/comment/37751208
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37749866
has comment: http://stackoverflow.com/comment/37749776
has answer: http://stackoverflow.com/a/24404112
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24416161
has title: how to split a String with number of character and the character is white space
type: Question
upvote count: 2
answer count: 5
has comment: http://stackoverflow.com/comment/37750793
has answer: http://stackoverflow.com/a/24404092
tagged with: java
linked to: http://stackoverflow.com/q/8524979
has comment: http://stackoverflow.com/comment/37750340
has body: I want to split a String into lines with a maximum number of characters per line, while splitting only on whitespace. example : if my String is good morning , today is monday good morning , today is monday number of characters : 11 the output should be good morning , today is monday good morning , today is monday this is my code for two rows public String skipRowLettreNumbre(String lettre) { String ret = lettre + "\n"; if (lettre.length() &gt; 36) { String after50 = lettre.substring(36); for (int i = 0; i &lt; after50.length(); i++) { if (after50.substring(i, i + 1).equals(" ")) { String part1 = lettre.substring(0, i + 36); String part2 = lettre.substring(i + 36, lettre.length()); ret = part1 + "\n " + part2; break; } } } return ret + ""; }
has answer: http://stackoverflow.com/a/24405971

http://stackoverflow.com/comment/37540735
score: 0
comment on: http://stackoverflow.com/a/24293164
type: AnswerComment
type: Comment
has text: You just pointed out the problem- you said it is in your `fragment_main`. I asked if it was in `activity_main`. From what I see in your code, the `fragment_main` layout isn't being used at all.

http://stackoverflow.com/comment/37630379
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24341056
type: Comment
has text: Thanks Luanne. Your answers saved my day.

http://stackoverflow.com/a/27286914
has comment: http://stackoverflow.com/comment/65948547
score: 0
answers question: http://stackoverflow.com/q/24339247
type: Answer
has body: Always use tools like Maven or Ivy to resolve dependencies for you. Copying JARs to war/WEB-INF/lib/ directory and editing .classpath file manually will be painful and may not help you always. If you use Eclipse &amp; Google App Engine plugin, use Add Google APIs... as mentioned here - Google Plugin for Eclipse. In my case, adding Cloud Storage API via Google Plugin for Eclipse helped resolve this NoClassDefFoundError.

http://stackoverflow.com/q/24405681
favorite count: 0
has comment: http://stackoverflow.com/comment/37762665
has answer: http://stackoverflow.com/a/24405817
has comment: http://stackoverflow.com/comment/37753395
accepted answer: http://stackoverflow.com/a/24406721
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37753112
type: Question
upvote count: 4
linked to: http://stackoverflow.com/q/4688123
tagged with: runtime
linked to: http://stackoverflow.com/q/4157303
downvote count: 0
has body: I'm developing a Java application that will be run on a Windows computer occasionally. At some point I need to run a Cygwin prompt and performs some commands in it. I've found a topic where the Runtime class is used: http://www.javaquery.com/2011/03/how-to-execute-multiple-command-in.html However it doesn't launch a real cmd.exe window, it's only run in background and the output is just printed on the Eclipse console. I'm looking for a solution to run a real cmd.exe window and I need to pass as many commands as I want to that windows shell. Is this possible?
score: 4
has title: With Java, run multiple commands in the same cmd.exe window
has answer: http://stackoverflow.com/a/24406721
has comment: http://stackoverflow.com/comment/37760650
answer count: 3
tagged with: windows
possible better answer: http://stackoverflow.com/a/24406338
tagged with: cmd
has answer: http://stackoverflow.com/a/24406338

http://stackoverflow.com/q/24365664
score: 0
tagged with: java
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37678674
type: Question
has comment: http://stackoverflow.com/comment/37679554
has comment: http://stackoverflow.com/comment/37677822
favorite count: 0
has comment: http://stackoverflow.com/comment/37677767
has comment: http://stackoverflow.com/comment/37678405
has comment: http://stackoverflow.com/comment/37678045
has title: Dereferencing possible null pointer with BufferedReader
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/37678586
has body: I have this piece of code: ... BufferedReader reader= new BufferedReader(new FileReader(file)); while ((line = reader.readLine()) != null) { // Do stuff... } reader.close(); .... BufferedReader reader2= new BufferedReader(new FileReader(file)); while ((line = reader2.readLine()) != null) { // Here I get a "Dereferencing possible null pointer" warning! // Do stuff... } reader2.close(); ... If I try to execute it, I get a NullPointerException at ((line = reader2.readLine()) != null). The thing that I don't understand is why the declaration of the reader2 is returning null. Does this have to do with the fact that I try to open two BufferedReaders on the same file? Any ideas why this may be happening? EDIT: The full code: BufferedReader brFileToAdjust = new BufferedReader(new FileReader(fileToAdjust)); String line; List&lt;String&gt; customersToAdjust = new ArrayList&lt;String&gt;(); int lineNo = 0; while ((line = brFileToAdjust.readLine()) != null) { if (lineNo != 0) { // Do not do this for the first line.: String[] data = line.split("\t"); if (!customersToAdjust.contains(data[0])) { customersToAdjust.add(data[0]); } } lineNo++; } brFileToAdjust.close(); BufferedReader brFileToAdjust2 = new BufferedReader(new FileReader(fileToAdjust)); for (String customer : customersToAdjust) { boolean newCustomer = true; String customerTransactions[][] = new String[999][6]; String outputCustomerTransactions[][] = new String[999][15]; lineNo = 0; int i = 0; while ((line = brFileToAdjust2.readLine()) != null) { ... } } brFileToAdjust2.close();
has comment: http://stackoverflow.com/comment/37677799
has comment: http://stackoverflow.com/comment/37678393

http://stackoverflow.com/q/24390991
answer count: 2
has comment: http://stackoverflow.com/comment/37725661
downvote count: 0
has comment: http://stackoverflow.com/comment/37725910
favorite count: 0
has answer: http://stackoverflow.com/a/24431234
has body: FI need a collection to contain only one subtype. It does not matter which one but it is important that all elements of the collection are of the same class. The subtype itself is not known at compile time. What I need can be best described by the follwing unit test: import java.util.ArrayList; import java.util.List; import org.junit.Test; public class SingleTypeTest { public static abstract class AbstractFoo { public abstract void someMethod(); } public static class FooA extends AbstractFoo { @Override public void someMethod() {}; } public static class TestB extends AbstractFoo { @Override public void someMethod() {}; } public List&lt;? extends AbstractFoo&gt; myList; @Test public void testFooAOnly() { myList = new ArrayList&lt;FooA&gt;(); myList.add(new FooA()); // This should work! myList.add(new FooB()); // this should fail! } @Test public void testFooBOnly() { myList = new ArrayList&lt;FooB&gt;(); myList.add(new FooB()); // This should work! myList.add(new FooA()); // this should fail! } } This piece of code is acutally not compilable due to type erasure but it best specifies what I want to do. The question is: What other apporaches are available to ensure that all elements are of the same type? Only thing I can thing of is to write a delegate that wraps around the list and checks the objects added to the class are all of the same type but that seems fairly clunky. Any other ideas? Update: I have I have clarified the question and the unit test code.
has comment: http://stackoverflow.com/comment/37725441
has comment: http://stackoverflow.com/comment/37725795
tagged with: generics
has title: Collection containing only one type
score: 2
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37725889
tagged with: collections
has comment: http://stackoverflow.com/comment/37725354
type: Question
has comment: http://stackoverflow.com/comment/37725379
has answer: http://stackoverflow.com/a/24391661
tagged with: java
has comment: http://stackoverflow.com/comment/37725491
has comment: http://stackoverflow.com/comment/37725717

http://stackoverflow.com/q/24337168
type: Question
possible better answer: http://stackoverflow.com/a/24337187
has comment: http://stackoverflow.com/comment/37623225
answer count: 2
has answer: http://stackoverflow.com/a/24337187
accepted answer: http://stackoverflow.com/a/24337337
score: 0
tagged with: reference
has comment: http://stackoverflow.com/comment/37623307
has body: public class Wrapper { public Wrapper(final String name, final String email) { _name= name; _email = email; } private static final Card testCard = new Card(_email, _name); private final static String _name; private final static String _email; } I would like the instantiate this class providing a name and an email. I am getting "Cannot reference a variable before it is defined for (_email, _name) variables on line : private static final Card testCard = new Card(_email, _name); I can make it work by moving the declarations to the top but is there any other way? Thanks
has answer: http://stackoverflow.com/a/24337337
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1746758
has title: Cannot reference a variable before it is defined - Java
tagged with: java
has comment: http://stackoverflow.com/comment/37623343

http://stackoverflow.com/comment/37718625
has text: @jagmohan : I know about this. This is why i have linked line 303 of my library (i have edited this to better understanding). It seems that the layout cannot be found even if i explicitly call the layout with package name.R
score: 0
comment on: http://stackoverflow.com/q/24386940
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24314774
score: 4
has body: There are no other differences. The difference lies purely in the syntax. With IModel&lt;?&gt;, the casting has to be done explicitly (as you noted). However, by using generics, you tell the compiler to cast it to Bar when returning from the getObject() method, so you don't have to cast it yourself. Other than that, the exact same thing happens in both cases.
upvote count: 4
accepted answer of: http://stackoverflow.com/q/24314650
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24314650
type: Answer

http://stackoverflow.com/q/24365581
favorite count: 0
tagged with: jdbc
has comment: http://stackoverflow.com/comment/37677523
type: AnsweredQuestion
tagged with: java
has title: Java JDBC General SQL insert function
tagged with: mysql
has body: I am writing a generic function to insert data into SQLtables and I am wondering how to improve my current implementation. My current function looks like: public void insertIntoDatabase(String table, ArrayList&lt;String&gt; insertRow) { .. } table - Name of the SQL table insertRow - ArrayList of values to insert Some tables also contain other attributes than VARCHARS so I am considering ArrayList&lt;xtable&gt; insertRow But is it necessary to write individual java classes for each database table ? Thanks for your help! M
has answer: http://stackoverflow.com/a/24365686
accepted answer: http://stackoverflow.com/a/24365686
type: Question
linked to: http://stackoverflow.com/q/10872919
tagged with: arraylist
score: 0
tagged with: sql
upvote count: 1
answer count: 1
downvote count: 1

http://stackoverflow.com/a/24318539
answers question: http://stackoverflow.com/q/24318267
type: Answer
has body: Use this: URL url; url = new URL("http://ebid.s3.amazonaws.com/upload_big/9/1/1/1401018425-17770-385.jpg"); url.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20100101 Firefox/19.0"); Image image = null; try { image = ImageIO.read(url); } catch (IOException ex) { Logger.getLogger(baseframe.class.getName()).log(Level.SEVERE, null, ex); } } catch (MalformedURLException ex) { Logger.getLogger(baseframe.class.getName()).log(Level.SEVERE, null, ex); }
score: 0

http://stackoverflow.com/comment/37692766
type: AnswerComment
comment on: http://stackoverflow.com/a/24372786
type: Comment
has text: M.Sharma throws exception from this line Class.forName("org.apache.derby.jdbc.ClientDriver");
score: 0

http://stackoverflow.com/comment/37710884
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24382186
has text: `inline` in programming means the same things as in English. It means to place code or data from one place into another place where it is used, usually for efficiency purposes.

http://stackoverflow.com/comment/37704168
comment on: http://stackoverflow.com/q/24379563
type: Comment
type: QuestionComment
has text: @MadProgrammer make it short. :P but using installer??
score: 0

http://stackoverflow.com/q/24367789
has comment: http://stackoverflow.com/comment/37755360
has title: SonarQube configurable technical debt
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37681866
has comment: http://stackoverflow.com/comment/37682792
has comment: http://stackoverflow.com/comment/37682657
has body: We get a java app source code shipped from a partner, but it doesn't include test code. We want to run sonar qube against the code; but against our standard quality profile (PMD/Findbugs etc) technical debt gets skewed by no test coverage. I tried disabling the coverage rules, or setting the coverage ration to 0 but that just killed everything, no issues, no technical debt or useful feedback on the code. Can anyone suggest a ruleset or mechanism that would allow us to run a sonar report on the code and retain some of the useful feedback relating to technical debt? Other than writing a new plugin....
has comment: http://stackoverflow.com/comment/37755932
favorite count: 0
has comment: http://stackoverflow.com/comment/37755120
has answer: http://stackoverflow.com/a/55787853
has comment: http://stackoverflow.com/comment/37710465
tagged with: code-coverage
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
tagged with: technical-debt
tagged with: sonarqube
type: Question

http://stackoverflow.com/comment/37619030
type: AnswerComment
score: 0
type: Comment
has text: Eclipse: project -> Run As.. -> Run Configurations -> Java Application -> "Arguments" Tab
comment on: http://stackoverflow.com/a/24289874

http://stackoverflow.com/comment/37783149
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24421468
has text: i want to ask a question @HoverCraftFullOfEels what is the main use of the reference because it is the first time for me to hear about it

http://stackoverflow.com/a/24384197
score: 0
accepted answer of: http://stackoverflow.com/q/24384003
answers question: http://stackoverflow.com/q/24384003
type: AcceptedAnswer
has body: You should add @JoinColumn(name = "your_foreign_key_id") to specify where to store the relation
has comment: http://stackoverflow.com/comment/37714273
type: Answer

http://stackoverflow.com/comment/112510550
type: Comment
comment on: http://stackoverflow.com/a/32850177
score: 0
type: AnswerComment
has text: I cannot find this in version 2020.2.1

http://stackoverflow.com/comment/37691644
comment on: http://stackoverflow.com/q/24372971
type: Comment
type: QuestionComment
score: 1
has text: Just making sure... you're talking about a Raspberry Pi, right?

http://stackoverflow.com/a/24322088
has body: For instance have two arrays - one with the display names and one with the names to send. Or use a HashMap, but that is probably overkill. As such: public class Alantic extends ListActivity{ String displayClasses[] = { "City history", "Fort Macon", "example2", "example3", "example4", "example5", "example6"}; String classes[] = { "BEACHCITY", "FORTMACON", "example2", "example3", "example4", "example5", "example6"}; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setListAdapter(new ArrayAdapter&lt;String&gt;(Alantic.this, android.R.layout.simple_list_item_1, displayClasses)); } @Override protected void onListItemClick(ListView l, View v, int position, long id) { // TODO Auto-generated method stub super.onListItemClick(l, v, position, id); String abc = classes[position]; try{ Class ourClass = Class.forName("com.techreviewsandhelp.carteretcountyhistoryguide." + abc); Intent ourIntent = new Intent("Alantic.this, ourClass"); startActivity(ourIntent); }catch (ClassNotFoundException e){ e.printStackTrace(); } } Another option is to create a custom (Array) Adapter and use a custom data class containing both names.
answers question: http://stackoverflow.com/q/24321668
has comment: http://stackoverflow.com/comment/37594573
has comment: http://stackoverflow.com/comment/37595893
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37621597

http://stackoverflow.com/comment/37510284
type: AnswerComment
comment on: http://stackoverflow.com/a/24277412
has text: I always suggest using 32-bit java. But here you have a 64 bit Eclipse so you might want to go with 64 bit version. I suggest finding the correct one by by trial-error method: for 32 bit: C:\Program Files (x86)\Java\jdk1.8.0_05\bin for 64 bit: C:\Program Files\Java\jdk1.8.0_05\bin
type: Comment
score: 0

http://stackoverflow.com/comment/37547446
score: 0
type: AnswerComment
has text: If that is the case then you don't need the do...while
type: Comment
comment on: http://stackoverflow.com/a/24297025

http://stackoverflow.com/a/24830576
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24314792
type: Answer
has body: In case anyone is interested : We went with a java based tool called PDFreactor. It runs on JVM so meets our requirement to deploy on AIX. CSS support is comparable to PrinceXML tool.
accepted answer of: http://stackoverflow.com/q/24314792

http://stackoverflow.com/q/24351326
tagged with: robovm
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24352683
type: Question
tagged with: java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24352683
has body: according to this website https://github.com/libgdx/libgdx/wiki/Admob-in-libgdx I know how to add a admob banner in a libgdx game through robovm, and that worked! Everything works fine when my Iphone is connected to either wifi or grps. However when I turn off wifi and grps, the game would quit immediately after the splash screen. This is because the initializeAds function is not connected to either wifi or gprs. In OBJC there is a file named connection.h to check whether gprs or wifi is connected. After that, we can initialize admob banner according to the status. Is there a way to check connection status by robovm or is there a way to avoid the crash? Thanks!
tagged with: libgdx
tagged with: ios
has title: how to check network connection status in libgdx with robovm?

http://stackoverflow.com/comment/98625421
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24289070
has text: Even I came here from the same question.

http://stackoverflow.com/q/24416480
has comment: http://stackoverflow.com/comment/37774014
has title: How do I convert a java.util.Map to scala.collection.immutable.Map in Java?
type: AnsweredQuestion
tagged with: scala-collections
tagged with: java
type: Question
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/11903167
favorite count: 0
has comment: http://stackoverflow.com/comment/37774280
upvote count: 8
has answer: http://stackoverflow.com/a/24417528
has body: I find lots of people trying to do this, and asking about this but the question is always answered in terms of scala code. I need to call an API that is expecting a scala.collection.immutable.Map but I have a java.util.Map, how can I cleanly convert from the latter to the former in my java code? The compiler disagrees with the sentiment that it is an implicit conversion as it barfs on that when I try it! Thank you!
linked to: http://stackoverflow.com/q/8301947
linked to: http://stackoverflow.com/q/17048601
score: 8
accepted answer: http://stackoverflow.com/a/24417528
tagged with: scala-java-interop
tagged with: scala

http://stackoverflow.com/a/24363159
type: Answer
score: 3
upvote count: 3
has body: All of the above answers add important information to the question but misses on one critical point. The main selling point of EJB architecture was distributed component (apart from all other services such as container managed,transactional, secure etc.). The idea was to enable the business logic to run in distributed environment piggybacking on RMI/IIOP. Although over the years this architectural style proved bad. For distributed computing there were more successfull architecture based on webservices. Distributed components though were made look easy by EJB, had their own share of inherent complexities and performance woes and were later avoided whenever possible. An old but very interesting read on this matter by Martin Fowler can be read here where he is scathing in his attack on the lure of distributed architecture typically being promoted by the likes of EJB. Later people seems to have followed this wisdom and avoided the temptation to jump onto the "distributed architecture" bandwagon. In Java landscape, this was marked by the rise of Spring framework and Rod Johnson's famous book "Expert One-on-One J2EE Development without EJB". People and the likes of me have never missed EJB's since then :-) P.S. To be fair to EJB specs and the guys working hard on it to improve, they certainly have made fair progress in the past decade and they are much modern and developer friendly. However their "distributed" nature has taken a back seat for good
has comment: http://stackoverflow.com/comment/37680408
has comment: http://stackoverflow.com/comment/37679025
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37675267
accepted answer of: http://stackoverflow.com/q/24361573
has comment: http://stackoverflow.com/comment/37682688
answers question: http://stackoverflow.com/q/24361573

http://stackoverflow.com/q/24293910
has comment: http://stackoverflow.com/comment/37542325
score: 0
has comment: http://stackoverflow.com/comment/37542288
has body: I've written a long and complicated method checking if a list of elements in a Queue is a palindrome. I know it can be improved, but my goal right now is to get it to past all the tests in practice-it. I've passed 9 out of 10, but the only test I can't seem to pass is the odd elements/not a palindrome. For example: front [5, 10, -1, 4, 3, 2, 2, 4, -1, 10, 5] back. Expected Output should be FALSE. My Output is TRUE. Also, unlike the other tests, the elements in the Queue aren't being displayed. Unlike the previous questions asked that are similar to this problem, my Queue must be restored to its original state. Here is my code so far: public static boolean isPalindrome(Queue&lt;Integer&gt; q) { Stack&lt;Integer&gt; s = new Stack&lt;Integer&gt;(); int size = q.size(); int extra = 0; if(q.isEmpty()) return true; else if (size % 2 == 0) { for (int i = 0; i &lt; size / 2; i++) { s.push(q.remove()); } while (!s.isEmpty()) { // While Stack is not empty: if (s.peek() != q.peek()) { int first = s.pop(); s.push(q.remove()); s.push(first); while (!q.isEmpty()) s.push(q.remove()); while (!s.isEmpty()) { q.add(s.pop()); } return false; } else { while (!q.isEmpty()) s.push(q.remove()); while (!s.isEmpty()) { q.add(s.pop()); // Restore Queue to original order } return true; } } for (int k = 0; k &lt; size / 2; k++) { q.add(q.remove()); s.push(q.remove()); } for (int l = 0; l &lt; size / 2; l++) s.push(q.remove()); while (!s.isEmpty()) q.add(s.pop()); } return true; } If anyone has a hard time reading this or can suggest a way to make it less convoluted as well, I would appreciate that. Thank you, and sorry again for the bloated code.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37541479
has title: Java palindrome checker using queue AND restoring queue to original state
has answer: http://stackoverflow.com/a/24294136
has comment: http://stackoverflow.com/comment/37541503
tagged with: stack
tagged with: java
tagged with: queue
type: Question
has comment: http://stackoverflow.com/comment/37542359
answer count: 2
has comment: http://stackoverflow.com/comment/37542111
tagged with: palindrome
has comment: http://stackoverflow.com/comment/37591348
has answer: http://stackoverflow.com/a/24348050

http://stackoverflow.com/comment/37612941
comment on: http://stackoverflow.com/q/24327995
type: Comment
has text: Seems to be quite a clear error message. Can you show your userObject String?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37531783
comment on: http://stackoverflow.com/q/24270385
score: 0
type: QuestionComment
has text: @juergend: sorry, but do you know how could I use update for more than one field? (something like the code that I wrote in my question for insert statement.., but for update)
type: Comment

http://stackoverflow.com/a/24348819
upvote count: 5
type: AcceptedAnswer
downvote count: 0
has body: Say you have ten errands you need to do and your sister has ten errands she needs to do, and you only have one car. Do you bring the car back after each errand and switch drivers? Of course not. That would be absurdly inefficient. Each thread basically just needs the output stream. So it would be absurd to interleave them tightly.
accepted answer of: http://stackoverflow.com/q/24348745
type: Answer
answers question: http://stackoverflow.com/q/24348745
score: 5

http://stackoverflow.com/q/24300314
upvote count: 6
has title: Why does Scanner#nextInt inside for loop keep throwing an exception?
tagged with: java.util.scanner
possible better answer: http://stackoverflow.com/a/24300682
score: 6
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24300533
tagged with: java
has answer: http://stackoverflow.com/a/24300790
has body: I have been learning JAVA and i have a small doubt about the code : class apple { public static void main(String[] args) { int[] num = new int[3]; Scanner input = new Scanner(System.in); for (int i = 0; i &lt; num.length; i++) { try { num[i] = input.nextInt(); } catch (Exception e) { System.out .println("Invalid number..assigning default value 20"); num[i] = 20; } } for (int i = 0; i &lt; num.length; i++) { System.out.println(num[i]); } } } I have written small program to handle exception, if user input is not Int throw an exception and assign default value. If i put scanner statement inside for loop, it works fine, but if i take it outside its assign the same value at which exception was thrown i.e i am entering char rather than int. But if i enter all integers it assign correct values in array. Scanner input = new Scanner(System.in); I hope u guys have understood my question.
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/24300533
answer count: 3
has answer: http://stackoverflow.com/a/24300682

http://stackoverflow.com/q/24281571
has comment: http://stackoverflow.com/comment/37517609
tagged with: cell
has body: I have unique situation where I have a dropdown list that has conditional formatting that when I select a contractor it also fill that cell with a particular colour. However I wanted to populate some cells in same row with a set of numbers representing resources, the issue is I wanted to be able to type in any number in this cell to represent the number of resource and this cell will inherit the colour of the cell with the contractor. If the contractor was ACME and the fill colour was Green I want the cells with the resource number to automatically fill as Green. Can this be done??? Help please
score: 0
has comment: http://stackoverflow.com/comment/37517603
tagged with: colors
has title: Format a cell colour based on another cell colour
type: UnansweredQuestion
answer count: 0
tagged with: java
type: Question

http://stackoverflow.com/comment/37681660
has text: possible duplicate of [Running Java gives "Error: could not open \`C:\Program Files\Java\jre6\lib\amd64\jvm.cfg'"](http://stackoverflow.com/questions/6036462/running-java-gives-error-could-not-open-c-program-files-java-jre6-lib-amd64)
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24367809

http://stackoverflow.com/comment/37746953
type: AnswerComment
comment on: http://stackoverflow.com/a/24394742
type: Comment
has text: I changed the methods to true setter methods, it did work! but funnily only for one Role, i get back the "Global Role", but for the "Local Role" i get a null, i wonder if the @XmlElement(name = "Role") for both roles has any negative effect
score: 0

http://stackoverflow.com/a/24339436
answers question: http://stackoverflow.com/q/24339371
upvote count: 1
has comment: http://stackoverflow.com/comment/37627163
downvote count: 1
has body: Any suggestions? Also a better way to get data inside data like "details": { "imeiNumber": "123456789123456", "phoneNumber": "9999999999"} It's a Suggestion, don't treat it as Solution Sorry, I don't have any idea about curl, but I can help you to parse the JSON string using GSON library. Just enclose the above JSON string inside {...} and parse it into Java object as illustrated in below sample code. Sample code: class Details { private String name; private String description; private PhoneNumberDetails details; // getter & setter } class PhoneNumberDetails{ private String imeiNumber; private String phoneNumber; // getter & setter } String json = "{ \"name\": \"PhoneName\", \"description\": \"Phone Description!\", \"details\": { \"imeiNumber\": \"123456789123456\", \"phoneNumber\": \"9999999999\"}}"; Details data = new Gson().fromJson(json, Details.class); System.out.println(new GsonBuilder().setPrettyPrinting().create().toJson(data)); output: { "name": "PhoneName", "description": "Phone Description!", "details": { "imeiNumber": "123456789123456", "phoneNumber": "9999999999" } }
has comment: http://stackoverflow.com/comment/37627665
score: 0
has comment: http://stackoverflow.com/comment/37627132
has comment: http://stackoverflow.com/comment/37627555
type: Answer
has comment: http://stackoverflow.com/comment/37627534

http://stackoverflow.com/q/24425639
has body: var pkg = JavaImporter(org.openqa.selenium) var support_ui = JavaImporter(org.openqa.selenium.support.ui.WebDriverWait) var wait = new support_ui.WebDriverWait(WDS.browser, 5000) **var support_page=JavaImporter(org.openqa.selenium.WebDriver.Timeouts)** **var support_p=new support_page.pageLoadTimeout(30, TimeUnit.SECONDS)** var url = WDS.args[0]; var user = WDS.args[1]; var pwd = WDS.args[2]; WDS.sampleResult.sampleStart() WDS.browser.get(url) var wait=new support_ui.WebDriverWait(WDS.browser,15000) var userName = WDS.browser.findElement(pkg.By.id('Login_txtUserName')).sendKeys([user]) //userName.click() //userName.sendKeys(['pandian']) var userPwd = WDS.browser.findElement(pkg.By.id('Login_txtPassword')).sendKeys([pwd]) //userPwd.click() //userPwd.sendKeys(['1234']) var button = WDS.browser.findElement(pkg.By.id('Login_btnLogin')).click() //button.click() When I try to import WebDriver.Timeouts class it's imported but I am not able to access the Method pageLoadTimeout, when I run jmeter it says Response message: javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "TimeUnit" is not defined. (#5) in at line number 5 Can you please provide me the code for JMETER to access pageLoadTimeout()?
tagged with: selenium-webdriver
tagged with: jmeter
tagged with: selenium
has answer: http://stackoverflow.com/a/24653696
type: AnsweredQuestion
tagged with: java
has title: Couldn't access Methods using Jmeter-Webdriver
accepted answer: http://stackoverflow.com/a/24653696
type: Question
score: 0
answer count: 1
tagged with: javascript

http://stackoverflow.com/comment/37803814
score: 0
type: Comment
has text: @MarkoTopolnik (It kind of is specified, but it's related to the request that the filter has to process, rather than the Servlet that will also handle the request.)
type: AnswerComment
comment on: http://stackoverflow.com/a/24389655

http://stackoverflow.com/q/24402022
answer count: 3
tagged with: jdbc
has answer: http://stackoverflow.com/a/41018692
has answer: http://stackoverflow.com/a/24402128
score: 0
type: UnansweredQuestion
tagged with: socketexception
has comment: http://stackoverflow.com/comment/37746919
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/37746326
has answer: http://stackoverflow.com/a/24402527
type: Question
has comment: http://stackoverflow.com/comment/37746815
has title: Connecting java to MYSQL database in an amazon server
has body: I am trying to connect my java code with mysql DB in amazon rds, i am using this code: try { Class.forName("com.mysql.jdbc.Driver").newInstance(); connection = DriverManager.getConnection( "jdbc:mysql://HOST:port_number/DB_name","DB_username", "DB_pass"); st = connection.createStatement(); rs = st.executeQuery("SELECT * FROM table name WHERE id = 1"); } catch (Exception e) { System.out.println("DB error : " + e); } i am getting this error when i run it : DB error : java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.SocketException: java.net.SocketException: Permission denied: connect ** BEGIN NESTED EXCEPTION ** java.net.SocketException MESSAGE: java.net.SocketException: Permission denied: connect STACKTRACE: java.net.SocketException: java.net.SocketException: Permission denied: connect at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:143) at com.mysql.jdbc.MysqlIO.&lt;init&gt;(MysqlIO.java:225) at com.mysql.jdbc.Connection.createNewIO(Connection.java:1805) at com.mysql.jdbc.Connection.&lt;init&gt;(Connection.java:452) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:411) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at DB.&lt;init&gt;(DB.java:15) at subgroup.main(subgroup.java:72) ** END NESTED EXCEPTION ** any ideas !!
tagged with: sql-server

http://stackoverflow.com/a/24308223
has body: If you use Eclipse, open Project > Properties > Google > App Engine. Check "Use Datanucleus JDO/JPA to access the Datastore". Note that in the left menu you can choose ORM and Validation options under App Engine. Make sure that you included all the necessary jars: https://developers.google.com/appengine/docs/java/datastore/jpa/overview#Enhancing_Data_Classes
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37568216
type: Answer
accepted answer of: http://stackoverflow.com/q/24307484
answers question: http://stackoverflow.com/q/24307484
upvote count: 1

http://stackoverflow.com/a/24393481
has body: If you dont need highly scalable and configurable distributed components with guaranteed delivery over multiple server crashes and automatic enrollment/commit/rollback in various transactions along with dead letter queue management, then yes a simple Queue with custom MessageProducer and MessageConsumer is probably a correct approach. The golden rule: if the complexity of implementing a simple solution using stack X nullifies the benefits of using stack X, don't use it.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24393259
downvote count: 0
answers question: http://stackoverflow.com/q/24393259
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/24289572
type: Question
has answer: http://stackoverflow.com/a/24291547
score: 0
has comment: http://stackoverflow.com/comment/37533526
answer count: 1
tagged with: connection
accepted answer: http://stackoverflow.com/a/24291547
has comment: http://stackoverflow.com/comment/37533342
type: AnsweredQuestion
has body: Apologies for terminilogy used. I have a generic class that I want to use to fill JXComboBoxes. It looks like this: package Fillers; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import org.jdesktop.swingx.JXComboBox; public class ComboBoxFiller { private Connection connConnection; private JXComboBox cboComboBox; private String strComboBoxQuery; public ComboBoxFiller(Connection connUToolDb, JXComboBox cboComboBox, String strComboBoxQuery) throws SQLException { this.connConnection = connUToolDb; this.cboComboBox = cboComboBox; this.strComboBoxQuery = strComboBoxQuery; Fill(); } public void Fill() throws SQLException { ResultSet rsComboBox = null; PreparedStatement prepstmntComboBbox = null; try { prepstmntComboBbox = connConnection.prepareStatement(strComboBoxQuery,ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); rsComboBox = prepstmntComboBbox.executeQuery(); cboComboBox.removeAllItems(); while (rsComboBox.next()) { String ComboBoxItem = rsComboBox.getString(1); cboComboBox.addItem(ComboBoxItem); } } finally { try { rsComboBox.close(); prepstmntComboBbox.close(); } catch (Exception e) { e.printStackTrace(); } } } } The Database I use is a SqlServer database. To connect to the database I use another generic class. It looks like this. package DbConnections; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class JdbcSQLServerConnection { private Connection connJdbcSqlServer; public void Connect(String dbURL) throws ClassNotFoundException { try { //DriverManager.registerDriver(new SQLServerDriver()); Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); setConnJdbcSqlServer(DriverManager.getConnection(dbURL)); System.out.println("Connected to SqlServer"); } catch (SQLException ex) { ex.printStackTrace(); } } public Connection getConnJdbcSqlServer() { return connJdbcSqlServer; } public void setConnJdbcSqlServer(Connection connJd…
tagged with: java
tagged with: eclipse
has title: Connection and SqlServerConnection mismatch

swt
tags question: http://stackoverflow.com/q/24375035
tags question: http://stackoverflow.com/q/24361643
tags question: http://stackoverflow.com/q/24286334
tags question: http://stackoverflow.com/q/24419859
tags question: http://stackoverflow.com/q/24275783
tags question: http://stackoverflow.com/q/24361418
tags question: http://stackoverflow.com/q/24415477
tags question: http://stackoverflow.com/q/24368839
tags question: http://stackoverflow.com/q/24413448
tags question: http://stackoverflow.com/q/24280311
tags question: http://stackoverflow.com/q/24425296
tags question: http://stackoverflow.com/q/24280706
tags question: http://stackoverflow.com/q/24374444
tags question: http://stackoverflow.com/q/24363770
tags question: http://stackoverflow.com/q/24380951
tags question: http://stackoverflow.com/q/24306277
tags question: http://stackoverflow.com/q/24279651
type: Tag
tags question: http://stackoverflow.com/q/24311642
tags question: http://stackoverflow.com/q/24286261
tags question: http://stackoverflow.com/q/24290801
tags question: http://stackoverflow.com/q/24328325
tag name: swt

http://stackoverflow.com/a/24353914
accepted answer of: http://stackoverflow.com/q/24353597
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24353597
has body: You probably need to load the driver class so that it registers itself to the DriverManager using the following code: Class.forName("org.sqlite.JDBC"); Note: this only needs to be called once in your application. This was a standard procedure before the Java included the ServiceLoader API, now the DriverManager uses that API to register the drivers it finds in the classpath, but the drivers need to declare a file named java.sql.Driver containing the name of the driver class in the directory META-INF\services of their jar.
type: Answer
has comment: http://stackoverflow.com/comment/37656039
upvote count: 1
score: 1

http://stackoverflow.com/comment/37626212
type: Comment
type: QuestionComment
has text: Seriously, we can't read your mind and see the compiler errors you're seeing, and playing a guessing game isn't something that a lot of people want to do. Also, read those compiler errors carefully. If you aren't working with generics they should be quite clear.
comment on: http://stackoverflow.com/q/24338927
score: 0

http://stackoverflow.com/q/24296973
has answer: http://stackoverflow.com/a/24297025
upvote count: 0
favorite count: 0
has title: How to make a boolean variable turn true when called in a main method //Java
has answer: http://stackoverflow.com/a/24298633
has comment: http://stackoverflow.com/comment/37548950
has comment: http://stackoverflow.com/comment/37547230
has body: I am making a superHero class where methods are called when Attack the attack method is called, but how can I make the current false boolean switch to true once the method is called? My code: Random random = new Random(); double rand = random.nextDouble(); boolean att = false; public double attack(double AttackDam, double Health, double Stamina, double BlockChance) { do { if(BlockChance == 0.0) { Health = Health - AttackDam; } else { AttackDam = AttackDam - BlockChance; Health = Health - AttackDam%BlockChance; Stamina = Stamina - AttackDam%BlockChance; } att = false; }while(att == true); return Health; }
has comment: http://stackoverflow.com/comment/37547196
type: UnansweredQuestion
score: -5
tagged with: java
has comment: http://stackoverflow.com/comment/37547243
downvote count: 5
type: Question
answer count: 2

http://stackoverflow.com/q/24380084
has title: Howto serialize and deserialize CDI Bean to file
tagged with: weld
has comment: http://stackoverflow.com/comment/37713599
tagged with: java
type: Question
score: 0
has body: I'm building a JSF application. The JSF application contains some CDI beans, which hold the session data. I want to save this session data to a file and load it at a later time. Example 1: @SessionScoped MyBean implements Serializable { private String myValue; //getter and setters } @RequestScoped MyLoadingService { @Inject private MyBean myBean; public void load(byte[] data){ MyBean newMyBean = (MyBean)org.apache.commons.lang3.SerializationUtils.deserialize(data); //this doesn't work, because myBean is a proxy here... //how can I achieve this to work? myBean = newMyBean; } } Example 2: A session scoped bean, which contains another bean, which should be loaded. @SessionScoped AnotherBean implements Serializable { private String otherValue; //getter and setters } @SessionScoped MyBean implements Serializable { @Inject AnotherBean anotherBean; private String myValue; //getter and setters } @RequestScoped MyLoadingService { @Inject private MyBean myBean; public void load(byte[] data){ MyBean newMyBean = (MyBean)org.apache.commons.lang3.SerializationUtils.deserialize(data); //this doesn't work, because myBean is a proxy here... //how can I achieve this to work? myBean = newMyBean; } } Is this possible?
answer count: 1
tagged with: cdi
tagged with: serialization
has answer: http://stackoverflow.com/a/24380149
type: UnansweredQuestion

http://stackoverflow.com/q/24359399
type: Question
has comment: http://stackoverflow.com/comment/37666291
has title: I want to Separate similar value from array In java
linked to: http://stackoverflow.com/q/12919231
answer count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/37666345
score: 0
has body: See my below code and please let me know the correction. i have written my Expected result.. please help me. try { List&lt;String&gt; assocIds= new ArrayList&lt;String&gt;(); List&lt;String&gt; actionids= new ArrayList&lt;String&gt;(); assocIds.add("1"); assocIds.add("2"); assocIds.add("3"); assocIds.add("5"); actionids.add("2"); actionids.add("3"); actionids.add("7"); actionids.add("4"); actionids.add("6"); List&lt;String&gt; matchFromFirstArray= new ArrayList&lt;String&gt;(); List&lt;String&gt; notMatchFromFisrtArray= new ArrayList&lt;String&gt;(); List&lt;String&gt; notMatchFromSecondArray= new ArrayList&lt;String&gt;(); for(int j=0;j&lt;assocIds.size();j++) { for(int i=0;i&lt;actionids.size();i++) { if(assocIds.get(j).equalsIgnoreCase(actionids.get(i))) { matchFromFirstArray.add(assocIds.get(j)); }else { notMatchFromFisrtArray.add(assocIds.get(j)); notMatchFromSecondArray.add(actionids.get(i)); } } } System.out.println("match from first array : "+matchFromFirstArray.toString()); System.out.println("not match from fisrt array : "+notMatchFromFisrtArray.toString()); System.out.println("unmatch form second array : "+notMatchFromSecondArray.toString()); }catch (Exception e) { System.out.println("Error :"+e); } } My Expected Result: match from first array : [2, 3] not match from fisrt array : [1, 5] unmatch form second array : [7, 4, 6] My OUTPUT: match from first array : [2, 3] not match from fisrt array : [1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 5, 5, 5, 5, 5] unmatch form second array : [2, 3, 7, 4, 6, 3, 7, 4, 6, 2, 7, 4, 6, 2, 3, 7, 4, 6]
accepted answer: http://stackoverflow.com/a/24359483
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24359483

http://stackoverflow.com/a/24401798
has comment: http://stackoverflow.com/comment/37747179
accepted answer of: http://stackoverflow.com/q/24401710
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37745917
has comment: http://stackoverflow.com/comment/37746018
type: Answer
score: 1
upvote count: 1
has body: One idea, if it's feasible, would be to make BusinessException a subclass of RuntimeException, which is more in line with Spring philosophy anyway. EDIT: You also asked if there's a way to do this with checked exceptions. One approach you might take is based on rethinking your UserService contract. "Services" (in the service bean sense) are usually higher level domain concepts, so it might actually be more appropriate to declare BusinessException from your UserService contract anyway. Then when there's a lower-level persistence issue, you can either wrap that with the BusinessException (if BusinessException means something generic like "the call to the business service failed"), or else just declare both BusinessException and PersistenceLayerException if you want BusinessException to have a narrow meaning (e.g. validation issues and the like). In this case, you might be using UserService as a Spring Security UserDetailsService, which really is more persistence-oriented. If so then the thoughts above may not apply. But otherwise consider that an option. Having said all that, making BusinessException a RuntimeException is the most consistent with Spring practice, and arguably a best practice for reasons I describe here.
answers question: http://stackoverflow.com/q/24401710
has comment: http://stackoverflow.com/comment/37746065

http://stackoverflow.com/comment/37528666
type: Comment
type: QuestionComment
has text: Are A1, A2, B1 and B2 all instances of X, or instances of A and B respectively? If it's the second case, you can use a static List for A and B.
comment on: http://stackoverflow.com/q/24287393
score: 0

executorservice
type: Tag
tags question: http://stackoverflow.com/q/24269273
tags question: http://stackoverflow.com/q/24375696
tags question: http://stackoverflow.com/q/24327711
tag name: executorservice

http://stackoverflow.com/q/24278576
favorite count: 0
has body: How to a match word in comma separated values (CSV) string with a single space after each comma. Let's say: String = 'abc, def, ghijk, l, mn, opqr, stu'; What would be the regex to match a complete word in the above string? Edit: lets say i want to match ghijk from the given string.
has title: Regex to match a word in CSV
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37511879
upvote count: 1
tagged with: regex
answer count: 4
has comment: http://stackoverflow.com/comment/37511925
tagged with: java
has comment: http://stackoverflow.com/comment/37511942
downvote count: 3
has answer: http://stackoverflow.com/a/24279595
type: Question
has comment: http://stackoverflow.com/comment/37512073
has comment: http://stackoverflow.com/comment/37512101
has comment: http://stackoverflow.com/comment/37511903
score: -2
has comment: http://stackoverflow.com/comment/37511950
has comment: http://stackoverflow.com/comment/37511838
has answer: http://stackoverflow.com/a/24279169
has answer: http://stackoverflow.com/a/24278700
has answer: http://stackoverflow.com/a/24278618

http://stackoverflow.com/q/24271412
has comment: http://stackoverflow.com/comment/37498450
type: Question
has comment: http://stackoverflow.com/comment/37498482
has answer: http://stackoverflow.com/a/24271981
tagged with: eclipse
linked to: http://stackoverflow.com/q/14694512
score: 0
has title: resources visible in eclipse but not in jar
answer count: 1
tagged with: jar
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/17729794
has body: In a java project I have been given, at one point an external file is referenced. This file is held in a folder named resources. In the code, the call is: DHKeyReader d = new DHKeyReader("resources/filename") When run in Eclipse (3.7.2) this executes without failure. However, when exported to a jar, this fails with an IOException. I am hesitant to modify the code, as it was given to me under the pretense that it worked and I was to familiarize myself with it so it could be altered. However, there still could be errors. My question is this: how do I make a folder (held on the root of the .jar) visible within the jar like it is when running in Eclipse?
tagged with: java

http://stackoverflow.com/comment/37693918
score: 0
type: AnswerComment
has text: Yes I've tried removing the lines but can't use the size of the Image. The image is too large and messes up the layout of the program. The ImageView scales it accordingly, that's why I chose to use that size. Is there any easy way to scale the image automatically to fit the canvas size?
type: Comment
comment on: http://stackoverflow.com/a/24372225

http://stackoverflow.com/q/24361562
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
upvote count: 2
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24366598
tagged with: apache-camel
has title: ServiceMix and Camel : How do I create routes?
score: 2
tagged with: blueprint-osgi
answer count: 1
downvote count: 0
has body: This part of the puzzle is my nightmare, I have deployed ServiceMix, and 2 Java apps on 2 different tomcat instances : First app : http://localhost:8080/textmsgClient Second app : http://localhost:8181/textmsgServer Now my two apps need to communicate, though I want that communication to go through ServiceMix, so I can do some logs and everything. I've created a blueprint XML file in the ./deploy directory, but what routes should I put in them? I can't do this : <from uri="http://localhost:8080/textmsgClient"/> <log message="Test log"/> <to uri="http://localhost:8181/textmsgServer"/> so what is the correct thing to do ? by the way, my XML file looks like this : <?xml version="1.0" encoding="UTF-8"?> <from uri="file:camel/input"/> <log message="Moving ${file:name} to the output directory"/> <to uri="file:camel/output"/>
favorite count: 0
has answer: http://stackoverflow.com/a/24366598
tagged with: apache-servicemix

http://stackoverflow.com/q/24339130
has comment: http://stackoverflow.com/comment/37626547
has comment: http://stackoverflow.com/comment/37626583
has comment: http://stackoverflow.com/comment/37626533
possible better answer: http://stackoverflow.com/a/24339743
has answer: http://stackoverflow.com/a/24339743
has comment: http://stackoverflow.com/comment/37626737
has answer: http://stackoverflow.com/a/24339177
favorite count: 0
has comment: http://stackoverflow.com/comment/37626511
has comment: http://stackoverflow.com/comment/37626729
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/37626526
has comment: http://stackoverflow.com/comment/37626563
upvote count: 3
has comment: http://stackoverflow.com/comment/37626799
accepted answer: http://stackoverflow.com/a/24339177
tagged with: java
tagged with: formatting
has comment: http://stackoverflow.com/comment/37626550
has comment: http://stackoverflow.com/comment/37626531
type: Question
has comment: http://stackoverflow.com/comment/37626544
answer count: 2
has body: For example i have the following code class Format{ public static void main(String[] args) { String formated = String.format( "%c",-42); //I have -42 as second argument. System.out.println(formated); } } I know this is very bad as it throws IllegalFormatCodePointException but question that struck to my mind is that why compiler is not complaining here,if it can complain at char c = -42; So,knowing that the upper code produces an exception,Why compiler just sit and watch?
has title: Why exceptions are thrown by format() function instead of compile time error?
has comment: http://stackoverflow.com/comment/37626784
has comment: http://stackoverflow.com/comment/37626532
has comment: http://stackoverflow.com/comment/37626693
downvote count: 0
has comment: http://stackoverflow.com/comment/37626652

http://stackoverflow.com/a/24408797
accepted answer of: http://stackoverflow.com/q/24408682
answers question: http://stackoverflow.com/q/24408682
downvote count: 0
score: 3
has body: You can convert an Integer object into an int primitive or cast an int into a byte but you can't cast all the way from Integer to byte (A step too far for the Java designers) What you can do is player.getInventory().removeItem(new ItemStack( Material.getMaterial(dItemId1), 1, dItemMeta1.byteValue())); Note: this will throw a NullPointerException if dItemMeta1 is null.
upvote count: 3
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/24552131
has body: I have solved it just by setting connection establishment into separate thread. Without separate thread, it blocks the continue of Tomcat startup. Hope it will help one day to somebody.
score: 3
answers question: http://stackoverflow.com/q/24380364
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24380364
type: Answer
upvote count: 3

http://stackoverflow.com/comment/37643735
has text: Did you use `/hero.mp3` instead of `/Kalimba.mp3`?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24347793

http://stackoverflow.com/comment/37668026
score: 0
type: Comment
has text: @WornOutSoles Spring framework **does not** use Singleton pattern, it uses [flyweight pattern](http://en.wikipedia.org/wiki/Flyweight_pattern) because the *singleton* beans have a unique instance **per context**, also you can create a new instance of those *singleton* beans manually, which breaks the concept of Singleton Pattern.
comment on: http://stackoverflow.com/a/24360222
type: AnswerComment

http://stackoverflow.com/comment/68582666
has text: @DrewNoakes but is there a generic approach? Especially for image dimension the only way I found with your library so far is to deal with specific implementation, while I would just like to have something like `Image#getWidth`. It is kind of a pain to have to know that for `jpeg` that is value `3` and for `png` is `1`. Maybe a new question?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24361088
type: AnswerComment

http://stackoverflow.com/q/24381954
tagged with: java
upvote count: 1
type: Question
has body: I created a plugin Cordova for Android (Java) which write into a file in the sdcard, and it works. Now, I wanted to write this file into the temporary space "cdvfile://localhost/temporary" of the plugin Cordova FileSystem. How can I do? Thanks
tagged with: filesystems
downvote count: 0
favorite count: 0
has title: Cordova: write file into cdvfile java
type: UnansweredQuestion
tagged with: plugins
tagged with: cordova
answer count: 0
score: 1

http://stackoverflow.com/q/24393027
type: Question
has comment: http://stackoverflow.com/comment/54297392
linked to: http://stackoverflow.com/q/23293444
has comment: http://stackoverflow.com/comment/54405293
has comment: http://stackoverflow.com/comment/38774768
downvote count: 0
has body: When i send out a push notification, 5 of the same notifications appear on the device. Any reason why? Here are my application.java and manifest: public class Application extends android.app.Application { public Application() { } @Override public void onCreate() { super.onCreate(); Parse.setLogLevel(Parse.LOG_LEVEL_VERBOSE); // Initialize the Parse SDK. Parse.initialize(this, "__REMOVED KEY FOR SECURITY___", "__REMOVED KEY FOR SECURITY___"); // Specify an Activity to handle all pushes by default. PushService.setDefaultPushCallback(this, SplashActivity.class); ParseInstallation.getCurrentInstallation().saveInBackground(); } And my manifest: <uses-feature android:glEsVersion="0x00020000" android:required="true" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.CALL_PHONE" /> <permission android:name="com.bordengrammar.bordengrammarapp.permission.MAPS_RECEIVE" android:protectionLevel="signature" /> <uses-permission android:name="com.bordengrammar.bordengrammarapp.permission.MAPS_RECEIVE" /> <permission android:name="com.bordengrammar.bordengrammarapp.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="com.bordengrammar.bordengramma…
has answer: http://stackoverflow.com/a/33303239
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/42571738
has comment: http://stackoverflow.com/comment/38802892
has comment: http://stackoverflow.com/comment/37729943
tagged with: push-notification
tagged with: android
linked to: http://stackoverflow.com/q/28050986
tagged with: parse-platform
has comment: http://stackoverflow.com/comment/50840095
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/33304378
score: 2
has title: Getting Multiple Notifications Per Push
tagged with: java
has comment: http://stackoverflow.com/comment/37737502
has comment: http://stackoverflow.com/comment/54414569

http://stackoverflow.com/q/24384547
accepted answer: http://stackoverflow.com/a/24384685
has comment: http://stackoverflow.com/comment/37712813
type: Question
tagged with: inheritance
score: 13
answer count: 3
has answer: http://stackoverflow.com/a/24384787
downvote count: 0
has title: In java , can we pass superclass Object to subclass reference?
tagged with: polymorphism
favorite count: 0
has answer: http://stackoverflow.com/a/24384685
has comment: http://stackoverflow.com/comment/37713014
possible better answer: http://stackoverflow.com/a/24384820
has answer: http://stackoverflow.com/a/24384820
has body: In java, can we pass superclass Object to subclass reference ? I know that it is a weird question/practically not viable, but I want to understand the logic behind this Why is it not allowed in java. class Employee { public void met1(){ System.out.println("met1"); } } class SalesPerson extends Employee { @Override public void met1(){ System.out.println("new met1"); } public void met2(){ System.out.println("met2"); } } public class ReferenceTest { public static void main(String[] args) { SalesPerson sales = new Employee(); // line 1 sales.met1(); // line 2 sales.met2(); // line 3 } } What would have happened if Java allowed compilation of line 1? Where would the problem arise? Any inputs/link are welcomes.
upvote count: 13
tagged with: reference
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/37621625
has text: You put "handle the exception" in scare quotes, why? If you want your program to keep on running after an exception happens then you have to _handle_ the exception... Even if that just means writing a message to a log, and moving on to the next item is a list, that's still _handling_ it.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24336123

http://stackoverflow.com/q/24325290
upvote count: 1
has comment: http://stackoverflow.com/comment/37609621
favorite count: 0
linked to: http://stackoverflow.com/q/16483214
has title: ViewScoped ManagedBean is keeping alive after non-ajax post
has comment: http://stackoverflow.com/comment/37608237
tagged with: spring
has comment: http://stackoverflow.com/comment/37609620
has body: I'm using Primefaces 4.0, Spring, Spring Security and Hibernate. I do not know why after making a post in an ajax="false" commandbutton the ViewScoped bean is returning to the form all the old values ​​and not being destroyed. In other ViewScoped Beans it is working fine but this not. I have tried to solve this for quite a while and I can't make it work. the form is quite large, it will simplify to make it clear &lt;h:form id="anadirForm"&gt; &lt;p:panel id="panel" header="Añadir factura"&gt; &lt;h:panelGrid id="grid" columns="2" style="margin-bottom:10px"&gt; &lt;f:facet name="header"&gt; &lt;p:messages id="messages" autoUpdate="true" /&gt; &lt;/f:facet&gt; &lt;h:outputLabel for="justificante" value="Justificante: *" /&gt; &lt;p:inputText id="justificante" value="#{facturaBean.factura.justificante}" required="false" &gt; &lt;p:ajax event="change" listener="#{facturaBean.comprobarJustificante}"/&gt; &lt;/p:inputText&gt; .... &lt;/h:panelGrid&gt; &lt;/p:panel&gt; &lt;p:dataTable style="width: 780px;" id="lineasFacturas" var="facturaLinea" value="#{facturaBean.factura.lineas}"&gt; &lt;p:column&gt; &lt;p:inputText value="#{facturaLinea.contrapartida}" /&gt; &lt;/p:column&gt; &lt;p:column style="width: 90px;"&gt; &lt;p:inputText style="width: 85px;" value="#{facturaLinea.base}" &gt; &lt;p:ajax event="change" process="lineasFacturas" update="lineasFacturas" listener="#{facturaBean.sumarBases}"/&gt; &lt;/p:inputText&gt; &lt;/p:column&gt; ..... &lt;/p:dataTable&gt; &lt;p:commandButton value="Guardar" process="@all" ajax="false" action="#{facturaBean.saveFactura}" &gt; &lt;/h:form&gt; Bean @ManagedBean @ViewScoped public class FacturaBean implements Serializable{ private List&lt;FacturaLinea&gt; facturaLineas; private Factura factura; private FacturaLinea facturaLin; priv .... @PostConstruct public void init(){ facturaLineas = new ArrayList&lt;FacturaLinea&gt;(); factura = new Factura(); factura.n .... } .... public void saveFactura(){ SimpleDateFormat sdf=new SimpleDateFor…
answer count: 0
tagged with: jsf
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37609812
has comment: http://stackoverflow.com/comment/37605942
type: Question
has comment: http://stackoverflow.com/comment/37606726
tagged with: primefaces
tagged with: view-scope
has comment: http://stackoverflow.com/comment/37608291

http://stackoverflow.com/comment/37514420
type: QuestionComment
has text: For anyone else puzzled like I was, here is [FindBugs' link](http://findbugs.sourceforge.net/bugDescriptions.html#CO_ABSTRACT_SELF). Apparently FindBugs thinks compareTo should always take an Object. Personally I have no idea why they think this. Also, as pointed out, there's another problem here.
type: Comment
comment on: http://stackoverflow.com/q/24279691
score: 0

http://stackoverflow.com/comment/37709098
comment on: http://stackoverflow.com/q/24382034
score: 0
type: Comment
type: QuestionComment
has text: Isn't "in-process" and "accessible from multiple VMs" a contradiction?

http://stackoverflow.com/comment/37653817
type: QuestionComment
comment on: http://stackoverflow.com/q/24352822
score: 0
has text: @JB Nizet I have tested it, it works fine. But I am just curious about what might happen in the future.
type: Comment

http://stackoverflow.com/a/28839668
score: 0
has body: You will need: chooser.setMultiSelectionEnabled(true); File selected[] = chooser.getSelectedFiles();
type: Answer
answers question: http://stackoverflow.com/q/24290210

http://stackoverflow.com/comment/37697535
comment on: http://stackoverflow.com/q/24375795
has text: yeah tell that to my instructors who did a "full" course of java in 2 weeks plus SQl and set us this assignment. Thanks for your help
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/71489706
comment on: http://stackoverflow.com/a/24341306
has text: This code has a small bug - it does not work if one of the queues has size equal to one. while (!q2.isEmpty()) { merged.enqueue(q2.dequeue()); } will not be executed, as the only element in q2 was already dequeued. You need to add something like this: if(q2.isEmpty() && e2 != null){ merged.enqueue(e2); }
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24405213
tagged with: android
has comment: http://stackoverflow.com/comment/37752466
has comment: http://stackoverflow.com/comment/37752643
has comment: http://stackoverflow.com/comment/37752237
tagged with: list
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37752470
has comment: http://stackoverflow.com/comment/37753922
type: Question
has body: As shown in the code below, when using mFragList.addthe method add is getting marked by red squiggle. why although I have another project uses the same method to add fragments but eclipse recognizes it? *To Note: * when hover over the red squiggle eclipse says The method add(Fragment) in the type List&lt;Fragment&gt; is not applicable for the arguments (Fragment02). All of `Fragment01(), Fragment02(), Fragment03() extend Fragment Java_Code: import java.util.ArrayList; import java.util.List; import com.example.viewpagerwithactiontabstest00.adapter.MyTabsPagerAdapter; import android.app.Activity; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.view.ViewPager; public class MainActivity extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); List&lt;Fragment&gt; mFragList = new ArrayList&lt;Fragment&gt;(); mFragList.add(new Fragment01()); mFragList.add(new Fragment02()); mFragList.add(new Fragment03()); ViewPager mViewPager = (ViewPager) findViewById(R.id.pager); MyTabsPagerAdapter mPagerAdapter = new MyTabsPagerAdapter(getSupportFragmentManager()); } }
tagged with: java
tagged with: eclipse
score: 0
has title: Why some of the List methods are not recognized by eclipse
has comment: http://stackoverflow.com/comment/37752432
has comment: http://stackoverflow.com/comment/37753737
has comment: http://stackoverflow.com/comment/37752328
tagged with: arraylist

http://stackoverflow.com/q/24304979
favorite count: 0
has comment: http://stackoverflow.com/comment/37561873
type: Question
has answer: http://stackoverflow.com/a/24306775
answer count: 2
tagged with: datetime
upvote count: 1
has comment: http://stackoverflow.com/comment/37561878
downvote count: 6
has comment: http://stackoverflow.com/comment/37561882
tagged with: java
tagged with: calendar
has comment: http://stackoverflow.com/comment/37561900
possible better answer: http://stackoverflow.com/a/24315365
accepted answer: http://stackoverflow.com/a/24306775
has answer: http://stackoverflow.com/a/24315365
has body: I tried to write a code which displays the days of the week for the last 10 dates. Here's a part of the code: Calendar cal = Calendar.getInstance(); for(int i=0; i&lt;=9;i++) { cal.add(Calendar.DATE, -i); Date tday=cal.getTime(); SimpleDateFormat dy = new SimpleDateFormat("EEE"); String d9 = dy.format(tday); System.out.println(d9); } Instead of showing all the last 10 days in an order it is displaying like this: Thu Wed Mon Fri Mon Wed Thu Thu Wed Mon Fri Where did I make the mistake?
has comment: http://stackoverflow.com/comment/37562191
type: AnsweredQuestion
score: -5
has title: processing last 10 working(business) days java

http://stackoverflow.com/q/24330034
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37610528
has answer: http://stackoverflow.com/a/26112185
favorite count: 0
has title: Exporting mysql data to csv file in the home directory ubuntu
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/csv
score: 2
has comment: http://stackoverflow.com/comment/37609535
upvote count: 2
tagged with: java
tagged with: mysql
tagged with: excel
type: Question
has comment: http://stackoverflow.com/comment/37610645
tagged with: ubuntu
has body: I have a table in mysql and now I am trying to export the entire data into a csv file. As per the documentation, a possible way of doing this is with the query: SELECT id, name, email INTO OUTFILE '/tmp/result.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY ‘\\’ LINES TERMINATED BY '\n' FROM users WHERE 1 This works perfectly fine, but it creates the file in my tmp directory of the filesystem. I want the file to be in the project directory in my eclipse workspace (I am using java). So, next, what I tried was copying this file to my destination (using apache commons io) and then deleting the file. But I am not able to delete the file ("java.io.IOException: Unable to delete file:", I am assuming this is because I don't have root access to tmp directory). Is there any other elegant method of doing what I want...or do I have to use a library like apache POI?
has comment: http://stackoverflow.com/comment/37610459
has comment: http://stackoverflow.com/comment/37609411

http://stackoverflow.com/a/24296037
answers question: http://stackoverflow.com/q/24287024
downvote count: 0
score: 9
upvote count: 9
type: Answer
has body: You can use @Order annotation on your configuration classes to define load ordering. But it's strange because Spring should resolve proper order - so please check if you property inject UserRepository in UserDetailsService

http://stackoverflow.com/q/24390997
tagged with: jboss7.x
score: 1
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: java
tagged with: jboss
type: Question
tagged with: ejb
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37726566
has body: Again, many excellent answers from the fine folks here on SO. I am still unable to connect. But I believe Gimby might have had a good suggestion that there may be something wrong with the server or the beans. According to the log file generated when JBoss started, my beans have been deployed. The administrator of the server is unable to run the admin console for vulnerabilities reasons so there is no way to see if the beans are running. Is there a command line tool that I could point him to for testing? Is there a simple test I could write that would check the beans? I have tried most everything I have found and others have suggested and keep getting various errors. most times being: javax.naming.CommunicationException: Could not obtain connection to any of these urls: remote://:4647 I've encountered other errors as I have made changes to various files and code but this one is the most frequent. If the call I make to the bean is right, and that is questionable, then how do I tell if the bean is even running or not>
has answer: http://stackoverflow.com/a/24409662
has title: How do I test if EJB is running on JBoss AS 7 server

http://stackoverflow.com/comment/137118922
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24396070
type: Comment
has text: @gyrogearless There's no standard pathname pattern in FTP. Some can and will use "\". Rebex for example uses whatever the local SO is using.

http://stackoverflow.com/q/24420252
favorite count: 0
accepted answer: http://stackoverflow.com/a/24650664
type: Question
tagged with: maven
upvote count: 3
tagged with: java
tagged with: gradle
answer count: 1
has answer: http://stackoverflow.com/a/24650664
has title: How to use Perf4J with Profiled annotation in Gradle project?
tagged with: perf4j
tagged with: aspectj
type: AnsweredQuestion
score: 3
downvote count: 0
has body: I have a Java Gradle project for which I am trying to use Perf4J. I found some examples of Perf4J only Maven. So, I modified one and ran it. Here is the Java class and Maven build file that works. package com.mycompany.testapplication; import org.apache.log4j.Appender; import org.apache.log4j.ConsoleAppender; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.SimpleLayout; import org.perf4j.aop.Profiled; /** * * @author Ankit Gupta */ public class TestClass { final static Logger myLogger = Logger.getLogger("org.perf4j.TimingLogger"); final static Appender myAppender; static { myLogger.setLevel(Level.ALL); // Define Appender myAppender = new ConsoleAppender(new SimpleLayout()); //myAppender.setLayout(new SimpleLayout()); myLogger.addAppender(myAppender); } public static void main(String[] args) { TestClass test = new TestClass(); test.run(); } @Profiled( tag = "sampleTag" ) private void run() { try { Thread.sleep(5000); } catch (InterruptedException ex) { java.util.logging.Logger.getLogger(TestClass.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } } } and the pom.xml <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.mycompany TestApplication 1.0-SNAPSHOT jar <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.6</maven.compiler.source> <maven.compiler.target>1.6</maven.compiler.target> org.codehaus.mojo aspectj-maven-plugin 1.3 true 1.6 org.perf4j perf4j compile test-compile org.aspectj aspectjrt 1.6.7 org.perf4j perf4j 0.9.13 log4jonly commons-jexl commons-jexl 1.1 log4j log4j 1.2.17 The code above works fine and gives me the expected output. Now, I want to do the same to my gradle project, but I don't know how. Since, I am using @Profiled annotation, I realized that I want AspectJ. I found this plugin and wrote a build.gradle file for the same Java class as follows: apply plugin: 'java' sourceCompatibility = '1.6' if (!hasProperty('mainClass')) { ext.mainClass = 'com.mycompan…

http://stackoverflow.com/q/24307011
has comment: http://stackoverflow.com/comment/37565919
has comment: http://stackoverflow.com/comment/37565749
has title: Loop Nested Maps - Double result
has answer: http://stackoverflow.com/a/24307089
has body: I am new in Java, and trying to understand Nested Maps, exactly how I can filter unnecessary result from loop. Map&lt;String,Map&lt;Integer,Integer&gt;&gt; add = new LinkedHashMap&lt;&gt;(); Map&lt;Integer,Integer&gt; add2 = new LinkedHashMap&lt;&gt;(); for(Map.Entry&lt;String,Map&lt;Integer,Integer&gt;&gt; view: add.entrySet()){ System.out.println("Name: " + view.getKey()); for(Map.Entry&lt;Integer,Integer&gt;view2: add2.entrySet()){ System.out.println("Number: "+ view2.getKey()); System.out.println("ID:"+ view2.getValue()); System.out.println("=================="); } } The result with:Name1,1234 and Name2,2345 is: Name: Name1 Number: 1234 ID:1 Number: 2345 ID:2 ==================== Name: Name2 Number: 1234 ID:1 Number: 2345 ID:2 I want only result for: name 1, number 1, ID1 without Number2 and ID2 on first loop... Or how to iterate this without double number and ID? --> When i put 3 Names, with 3 numbers for each one name, for the first One i get: Name: name1 Number: 111 ID:1 =============== Number: 2222 ID:2 =============== Number: 3333 ID:3 =============== and for others is the same Name: name2 Number: 111 ID:1 =============== Number: 2222 ID:2 =============== Number: 3333 ID:3 =============== should be just Name 1 Number: 111 ID:1 ============ Name 2 Number: 222 ID:2 ============ Name 3 Number: 333 ID:3
type: Question
has comment: http://stackoverflow.com/comment/37565832
tagged with: java
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24307172
tagged with: nested
type: UnansweredQuestion

http://stackoverflow.com/comment/37575944
score: 0
type: Comment
type: QuestionComment
has text: Please append your whole source code and Exception stacktrace, mind reading has not been invented.
comment on: http://stackoverflow.com/q/24312428

http://stackoverflow.com/q/24366876
favorite count: 0
has answer: http://stackoverflow.com/a/24366965
has title: Unexpected end of declaration - in android AIDE
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/63607238
score: -2
answer count: 4
tagged with: aide-ide
has body: I keep getting "Unexpected end of declaration" at the closing brace of the empty constructor. Would someone mind pointing me in the direction of what I'm not understanding? The class is as follows: package info.welltrak.multi.vos; import java.io.Serializable; /** * Value object model for drinking water systems. */ public class WaterSystemVo implements Serializable { /** Empty constructor. */ public WaterSystemVo() { } /** Full constructor. *// public WaterSystemVo(int id, String systemId, String systemName) { mId = id; mSystemId = systemId; mName = systemName; } public static final long serialVersionUID = 1L; private int mId; /** Get record id. */ public int getId(){ return mId; } /** Set record id. */ public void setId(int id){ mId = id; } private String mSystemId; /** Get water system id number. */ public String getSystemId(){ return mSystemId; } /** Set water system id number. */ public void setSystemId(String systemId){ mSystemId = systemId; } private String mName; /** Get water system name. */ public String getName(){ return mName; } /** Set water system name. */ public void setName(String name){ mName = name; } }
tagged with: java
downvote count: 2
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/24366998
has answer: http://stackoverflow.com/a/24366958

http://stackoverflow.com/a/24332885
answers question: http://stackoverflow.com/q/24332649
downvote count: 0
type: Answer
has body: The short answer is that there may be multiple JVMs (multiple mobile devices, multiple servers with a JVM, or any combination thereof). If I understand it correctly, consider the example of a save-game file. Someone has an account with a website and has a save file stored on the site. But the person downloads the game so they can play it offline. The save file at this point becomes a 'detached entity'. It is updated 'offline', and is reattached when the user logs in to the website. Updating the entity that is stored server side may be automatic, or the user may be prompted (do you want to overwrite save data? Presents the user with the two save files and timestamps). Other examples may include health data from mobile devices (updated even when out of range of wireless) game data evernote/similar syncing services backup/restore services
score: 3
upvote count: 3

http://stackoverflow.com/q/24422800
has title: What is the pattern for this date format?
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/24422875
has answer: http://stackoverflow.com/a/24422875
accepted answer: http://stackoverflow.com/a/24422834
answer count: 4
linked to: http://stackoverflow.com/q/24334313
tagged with: java
upvote count: 1
duplicate of: http://stackoverflow.com/q/24334313
has answer: http://stackoverflow.com/a/24422895
has answer: http://stackoverflow.com/a/24422974
tagged with: simpledateformat
has comment: http://stackoverflow.com/comment/37784945
has comment: http://stackoverflow.com/comment/37784980
has answer: http://stackoverflow.com/a/24422834
type: AnsweredQuestion
has body: You can't parse a timestamp without knowing the SimpleDateFormat pattern first and I'm not sure what this would be: 1980/01/30 10:36:42 -0400 I think it would be something like yyyy/MM/dd HH:mm:ss, but I'm not sure about the -0400 part or if I should be capitalizing MM and HH.
downvote count: 0
score: 1

http://stackoverflow.com/a/24289982
answers question: http://stackoverflow.com/q/24289592
has comment: http://stackoverflow.com/comment/37535721
score: 0
has body: In your code you are doing this: View v = null; cva = new CustomViewAdapter(this, 0, apps, Settings.font, Settings.font_color, Settings.font_size, Settings.icon_size, Settings.list_style, mode); orientation = getResources().getConfiguration().orientation; if (Settings.list_style == LIST_STYLE) { lv = (ListView) v; lv.setAdapter(cva); You are setting v to be null, and then casting it to ListView (Does nothing), and then you are trying to access setAdapter method of a null variable, hence, there you have your NullPointerException on line 1207, which is lv.setAdapter(cva);
has comment: http://stackoverflow.com/comment/37534192
has comment: http://stackoverflow.com/comment/37533864
type: Answer
has comment: http://stackoverflow.com/comment/37534602
has comment: http://stackoverflow.com/comment/37534651

http://stackoverflow.com/q/24287984
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37633005
has comment: http://stackoverflow.com/comment/37530077
score: -2
has body: I am creating a database project in java using file handling. The program is working without compiling error. Following points are not working File is storing only first record. (if program is running again it is overwriting file) I want to display all records but the only first record is displaying with Exeception Please offer suggestions.. import java.io.*; public class Student implements Serializable { private int roll; private String name; //To store name of Student private int[] marks = new int[5]; //To store marks in 5 Subjects private double percentage; //To store percentage private char grade; //To store grade public Student() { roll = 0; name = ""; for(int i = 0 ; i &lt; 5 ; i++) marks[i] = 0; percentage = 0; grade = ' '; } public Student(int roll , String name ,int[] marks) { setData(roll,name,marks); } public void setData(int roll , String name ,int[] marks) { this.roll = roll; this.name = name; for(int i = 0 ; i &lt; 5 ; i++) this.marks[i] = marks[i]; cal(); } //Function to calculate Percentage and Grade private void cal() { int sum = 0; for(int i = 0 ; i &lt; 5 ;i++) sum = sum + marks[i]; percentage = sum/5; if(percentage&gt;85) grade = 'A'; else if(percentage &gt; 70) grade = 'B'; else if (percentage &gt;55) grade = 'C'; else if (percentage &gt; 33) grade = 'E'; else grade = 'F'; } public char getGrade() { return grade; } public double getPercentage() { return percentage; } @Override public String toString() { string format = "Roll Number : %4d, Name : -%15s " + "Percentage : %4.1f Grade : %3s"; return String.format(format, roll, name, percentage, grade); } } second file import java.io.*; public class FileOperation { public static void writeRecord(ObjectOutputStream outFile, Student temp) throws IOException, ClassNotFoundException { outFile.writeObject(temp); outFile.flush(); } public static void showAllRecords(ObjectInputStream inFile) throws IOException, ClassNotFoundException { Student temp = new Student(); while(inFile.readObject() != null) { temp …
has answer: http://stackoverflow.com/a/24288164
has title: End of File Error in File Handling Program
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/37632502
type: Question
upvote count: 0
tagged with: file-io
answer count: 1

http://stackoverflow.com/comment/37640528
comment on: http://stackoverflow.com/q/24320132
type: Comment
type: QuestionComment
has text: oh wait, instead of setting up a timer for repaint();. if I set up a timer inside the paintComponent(Graphics g), does that act as one timer or is it still one timer for every button pressed?
score: 0

http://stackoverflow.com/a/24360690
has body: It has a method body in the Entry subclass used by LinkedHashMap (which is a subclass of HashMap). The method exists in the base Entry class in order to be able to use common code in the base HashMap class. But since access record is useless in HashMaps that are not LinkedHashMaps, the method doesn't do anything.
has comment: http://stackoverflow.com/comment/37670724
has comment: http://stackoverflow.com/comment/37670939
has comment: http://stackoverflow.com/comment/37671024
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/37669799
answers question: http://stackoverflow.com/q/24360622
score: 3
upvote count: 3

http://stackoverflow.com/comment/37581927
has text: You need to use the assembly id of core_cli assembly descriptor in the dependency (extd_cli) as classifier done so?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24311476

http://stackoverflow.com/a/26677900
score: 9
answers question: http://stackoverflow.com/q/24292930
downvote count: 0
type: Answer
has body: You can use MultivaluedStringMap class which extends javax.ws.rs.core.MultivaluedHashMap&lt;java.lang.String, java.lang.String&gt;
upvote count: 9

http://stackoverflow.com/a/24273431
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24273085
has body: Your code sample is the declaration of the annotation type. For every method you annotate with your annotation there will be an annotation containing the data from the annotation. You can get the annotation using reflection, e.g. like this: Class&lt;?&gt; annotatedClass = // put some class here int methodIndex = // index of a annotated method // get the annotation // dbOperation is the annotation, DBoperation the type DBoperation dbOperation = annotatedClass.getMethods()[methodIndex].getAnnotation(DBoperation.class); // get data from the annotation String operationDescription = dbOperation.description();

http://stackoverflow.com/q/24306372
has comment: http://stackoverflow.com/comment/37567550
has body: I can't using the following method because my class doesn't extends the Activity class: Is there a unique Android device ID?
answer count: 2
has comment: http://stackoverflow.com/comment/37568581
tagged with: android-activity
favorite count: 0
linked to: http://stackoverflow.com/q/16078269
has comment: http://stackoverflow.com/comment/37564496
has comment: http://stackoverflow.com/comment/37565632
upvote count: 5
type: UnansweredQuestion
tagged with: android
downvote count: 0
has comment: http://stackoverflow.com/comment/37564409
tagged with: java
has answer: http://stackoverflow.com/a/24306593
has answer: http://stackoverflow.com/a/24306826
type: Question
score: 5
linked to: http://stackoverflow.com/q/2785485
has title: How to get android id in java without using of the class Activity?

http://stackoverflow.com/comment/37586713
score: 1
has text: @dalawh The syntax needs to be folder-like. In your case: folder1/folder2/folder3/* for all classes directly in that package, or folder1/folder2/folder3/** for any classes in that package or sub-packages (as just retested in Eclipse). Give it a try :)
comment on: http://stackoverflow.com/a/24297301
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24393682
has comment: http://stackoverflow.com/comment/37732999
linked to: http://stackoverflow.com/q/30350120
has comment: http://stackoverflow.com/comment/43607481
has comment: http://stackoverflow.com/comment/37734445
has comment: http://stackoverflow.com/comment/37732360
has comment: http://stackoverflow.com/comment/37732788
has comment: http://stackoverflow.com/comment/37733107
accepted answer: http://stackoverflow.com/a/24395347
has comment: http://stackoverflow.com/comment/37733101
answer count: 1
downvote count: 0
favorite count: 0
has body: I have this list of enabled and supported ciphers in java -----------SUPPORTED CIPHERS------------- Supported cipher suites: SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA SSL_DHE_DSS_WITH_DES_CBC_SHA SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA SSL_DHE_RSA_WITH_DES_CBC_SHA SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA SSL_DH_anon_EXPORT_WITH_RC4_40_MD5 SSL_DH_anon_WITH_3DES_EDE_CBC_SHA SSL_DH_anon_WITH_DES_CBC_SHA SSL_DH_anon_WITH_RC4_128_MD5 SSL_RSA_EXPORT_WITH_DES40_CBC_SHA SSL_RSA_EXPORT_WITH_RC4_40_MD5 SSL_RSA_WITH_3DES_EDE_CBC_SHA SSL_RSA_WITH_DES_CBC_SHA SSL_RSA_WITH_NULL_MD5 SSL_RSA_WITH_NULL_SHA SSL_RSA_WITH_RC4_128_MD5 SSL_RSA_WITH_RC4_128_SHA TLS_DHE_DSS_WITH_AES_128_CBC_SHA TLS_DHE_RSA_WITH_AES_128_CBC_SHA TLS_DH_anon_WITH_AES_128_CBC_SHA TLS_EMPTY_RENEGOTIATION_INFO_SCSV TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5 TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA TLS_KRB5_EXPORT_WITH_RC4_40_MD5 TLS_KRB5_EXPORT_WITH_RC4_40_SHA TLS_KRB5_WITH_3DES_EDE_CBC_MD5 TLS_KRB5_WITH_3DES_EDE_CBC_SHA TLS_KRB5_WITH_DES_CBC_MD5 TLS_KRB5_WITH_DES_CBC_SHA TLS_KRB5_WITH_RC4_128_MD5 TLS_KRB5_WITH_RC4_128_SHA TLS_RSA_WITH_AES_128_CBC_SHA -----------ENABLED CIPHERS--------------- Enabled cipher suites: SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA SSL_DHE_DSS_WITH_DES_CBC_SHA SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA SSL_DHE_RSA_WITH_DES_CBC_SHA SSL_RSA_EXPORT_WITH_DES40_CBC_SHA SSL_RSA_EXPORT_WITH_RC4_40_MD5 SSL_RSA_WITH_3DES_EDE_CBC_SHA SSL_RSA_WITH_DES_CBC_SHA SSL_RSA_WITH_RC4_128_MD5 SSL_RSA_WITH_RC4_128_SHA TLS_DHE_DSS_WITH_AES_128_CBC_SHA TLS_DHE_RSA_WITH_AES_128_CBC_SHA TLS_EMPTY_RENEGOTIATION_INFO_SCSV TLS_RSA_WITH_AES_128_CBC_SHA However the cipher I need available is TLS_RSA_WITH_AES_256_CBC_SHA. I obtained this info by writing a quick java class which runs getSupportedCipherSuites() and getEnabledCipherSuites(), I have run this on JRE 6 32 and 64 Bit and also on JRE 7 32 and 64 Bit, but …
has comment: http://stackoverflow.com/comment/37731063
tagged with: encryption
has title: Cipher suite not available - how to add/enable? Tomcat SSL
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24395347
type: Question

http://stackoverflow.com/a/24273951
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24273792
score: 2
downvote count: 0
has body: Try clicking on the span element below your nobr: option1.findElement(By.xpath("span")).click(); as that seems to be the clickable element.
answers question: http://stackoverflow.com/q/24273792
has comment: http://stackoverflow.com/comment/37503583
upvote count: 2

http://stackoverflow.com/comment/37574631
score: 0
type: QuestionComment
type: Comment
has text: Just what TheLostMind says. In order to do so, each variable within the object must be final.
comment on: http://stackoverflow.com/q/24311661

http://stackoverflow.com/comment/37713791
comment on: http://stackoverflow.com/q/24384988
type: Comment
score: 1
has text: do you have the hive-jdbc.jar in classpath?
type: QuestionComment

http://stackoverflow.com/a/24380234
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24329728
answers question: http://stackoverflow.com/q/24329728
type: Answer
downvote count: 0
score: 1
type: AcceptedAnswer
has body: It appeared that I wasn't waiting enough time when looking for html elements. I just increased the timeout of my explicit wait method. I'm not talking about switchIframe() but I'm referring to another method used to wait for elements to be present : So, I've increased the timeout from 3 to 6 seconds and it seems to work great now. protected WebElement waitForElementVisible(By by) { WebDriverWait wait = new WebDriverWait(driver,6); WebElement element = null; try { element = wait.until(ExpectedConditions.visibilityOfElementLocated(by)); } catch (TimeoutException e) { //method logging an error error("Timeout : element " + by.toString() + " is not visible"); } return element; }

http://stackoverflow.com/comment/37601225
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24321312
has text: @Tarik I would disagree that multithreadding doesn't help at all. I does help if you bottleneck is seeking time on the database as the DB can seek in more than one thread and thus is presenting the datasets parallelized instead of serially. Also it helps if you have errors in the transformation. Having 29/30 threads succeed means you now only have to redo 1/30th of the overall data the next time.
score: 0

http://stackoverflow.com/q/24293634
has title: Commons exec looking for main class in environment variable value
type: Question
score: 0
tagged with: environment-variables
answer count: 1
has body: I'm trying to launch a script from within a Java application using Apache commons exec, and getting the following error: Error: Could not find or load main class "-DappEnv=te org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:402) at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:164) at TestRunner.runTest(TestRunner.java:37) at TestMain.main(TestMain.java:6) For the following code: String jOpts = "JAVA_OPTS=\"-DappEnv=te -DsetInstance=true -Dinstance=.01\""; String command = "/path/to/bin/script.sh -s argVal"; try { Map&lt;String, String&gt; procEnv = EnvironmentUtils.getProcEnvironment(); EnvironmentUtils.addVariableToEnvironment(procEnv, jOpts); CommandLine cmdLine = CommandLine.parse(command); DefaultExecutor executor = new DefaultExecutor(); executor.setWorkingDirectory(new File("/path/to")); executor.execute(cmdLine, procEnv); } catch (Exception e) { e.printStackTrace(); } The error is throwing me for a loop, because it appears to be splitting a quoted value for an environment variable and looking for a class by that name instead of running the command with the environment variable. For what it's worth, the following executes fine in bash: JAVA_OPTS="-DappEnv=te -DsetInstance=true -Dinstance=.01" /path/to/bin/script.sh -s argVal Can anyone offer some insight as to why that quoted value is being split on whitespace, and/or why it's looking for a main class in the value of JAVA_OPTS? Am I using the environment map properly?
accepted answer: http://stackoverflow.com/a/24294496
tagged with: apache-commons-exec
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24294496
tagged with: java

jaxp
type: Tag
tag name: jaxp
tags question: http://stackoverflow.com/q/24389794

http://stackoverflow.com/a/24425829
answers question: http://stackoverflow.com/q/24425542
type: Answer
has body: Use Swing components instead of AWT components (Label → JLabel; TextField → JTextField, ...) Don't use a null layout manager (setLayout(null)) and setBounds(). Examine Using Layout Managers. Instead of setSize(w, h) use pack() method. full name is not displayed Because you use setBounds() and null layout. matchCase.setBounds(10, 10 + label_h + 10, label_w, label_h) you set not enough space for JCheckBox because of that it shows with '...'. For example your panel with a GridBagLayout: import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; public class TestFrame extends JFrame { JLabel l1; JCheckBox matchCase, MatchWholeWords; JTextField tf; JButton find_next, cancel; public TestFrame() { l1 = new JLabel("Find What: "); matchCase = new JCheckBox(); matchCase.setText("Match Case "); MatchWholeWords = new JCheckBox("Match Whole Words "); tf = new JTextField(30); find_next = new JButton("Find Next"); cancel = new JButton("Cancel"); setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(5, 5, 5, 5); c.gridx = 0; c.gridy = 0; c.anchor = GridBagConstraints.WEST; add(l1, c); c.gridx++; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; add(tf, c); c.fill = GridBagConstraints.NONE; c.weightx = 0; c.gridx++; add(find_next, c); c.gridx = 0; c.gridy = 1; c.gridwidth = 2; add(matchCase, c); c.gridx++; c.gridx++; c.gridwidth = 1; c.fill = GridBagConstraints.HORIZONTAL; add(cancel, c); c.gridy++; c.gridx = 0; c.gridwidth = 2; add(MatchWholeWords, c); setLocationRelativeTo(null); pack(); setVisible(true); } public static void main(String[] args) { new TestFrame(); } }
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37791646
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24425542

http://stackoverflow.com/q/24358221
accepted answer: http://stackoverflow.com/a/24358423
has comment: http://stackoverflow.com/comment/37664136
answer count: 2
has comment: http://stackoverflow.com/comment/37664071
tagged with: sqlite
downvote count: 0
possible better answer: http://stackoverflow.com/a/24358238
favorite count: 0
has answer: http://stackoverflow.com/a/24358238
tagged with: resultset
has comment: http://stackoverflow.com/comment/37664025
has title: SQLite - Reading last element from result set
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24358423
has comment: http://stackoverflow.com/comment/37664159
has comment: http://stackoverflow.com/comment/37664056
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I am using SQLite db to store set of data and i use a query statement to get the result set which contains data (e.g.) like below, 0,3,4,88,6,66,77,4,3,5,88 I use , while(rs.next){ //rs is result set if(!rs.next){ // if last element do something } } By this i can get the last element but every time the loop runs, the result set is incremented twice, once at while and other at if (via rs.next). I cant do rs.previous as SQLite doesn't support it. EDIT: I need to check if the element is last record in result set (not by last record's value because the result set might contain duplicate values also) . Is there any way i can able to achieve this?? Please help.

http://stackoverflow.com/a/24376957
answers question: http://stackoverflow.com/q/24376931
type: Answer
score: 0
has body: Create a variable count that increments every time you call addQuiz(); private int count; //initialize to 0 in constructor public int addQuiz(int score) { totalQuizScore = totalQuizScore + score; ++count; return totalQuizScore; } Now calculating the average is a trivial matter of dividing totalQuizScore by count.

http://stackoverflow.com/comment/38253950
comment on: http://stackoverflow.com/a/24404506
type: AnswerComment
score: 0
type: Comment
has text: yeah. I found that in deployJava.js it checks if 1.7+ is not installed it forces to install it.

http://stackoverflow.com/comment/37636669
type: AnswerComment
type: Comment
has text: Ok, I menaged to do it with defining them in one file. Thanks!
comment on: http://stackoverflow.com/a/24342054
score: 0

http://stackoverflow.com/q/24287774
type: AnsweredQuestion
downvote count: 0
tagged with: hashcode
tagged with: java
has comment: http://stackoverflow.com/comment/37529468
has title: Hashed string in C# is not readable
type: Question
tagged with: c#
has comment: http://stackoverflow.com/comment/37529611
linked to: http://stackoverflow.com/q/5340539
score: 4
has comment: http://stackoverflow.com/comment/37529667
answer count: 1
linked to: http://stackoverflow.com/q/1040868
has body: I'm trying to hash the same string in C# and in Java. C# hash method: public static string hashValue (string value) { byte[] input = null; HashAlgorithm digest = HashAlgorithm.Create("SHA-512"); input = digest.ComputeHash(Encoding.UTF8.GetBytes(value)); return System.Text.UTF8Encoding.UTF8.GetString(input); } The output, in a WPF TextBox, for this is looking like: "՘"�?N[��"��2��D��j��t!z}7�H�p�J����GƼOp�EnBfHڄ�X���" . The same function, in Java, is returning the result: "[B@41e2db20". The Java hash method like this: public static String hashValue(String value) { byte[] input = null; MessageDigest digest; try { digest = MessageDigest.getInstance("SHA-512"); try { input = digest.digest(value.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } catch (NoSuchAlgorithmException e1) { e1.printStackTrace(); } return input.toString(); } Can you please let me know what I'm doing wrong? Why is the result looking that weird in C#?
favorite count: 0
tagged with: hash
duplicate of: http://stackoverflow.com/q/1040868
has answer: http://stackoverflow.com/a/24288017
accepted answer: http://stackoverflow.com/a/24288017
has comment: http://stackoverflow.com/comment/37529923
upvote count: 4

http://stackoverflow.com/q/24287372
answer count: 0
has comment: http://stackoverflow.com/comment/37531304
has comment: http://stackoverflow.com/comment/37530454
tagged with: java
has comment: http://stackoverflow.com/comment/37531528
has comment: http://stackoverflow.com/comment/37531419
type: Question
has comment: http://stackoverflow.com/comment/37528931
tagged with: ejb
has body: I wrote a Java Client Enterprise Application, and it works very good when i run it from Netbeans. please notice that there is a query run on start up of the application which send a query to Entitybean. the problem is when i try to run this JAR Application from windows command line, this error appear to me: java -jar Apps.jar Exception in thread "main" java.lang.NoClas sDefFoundError: javax/persistence/Query at Apps.Main.main(Main.java:75) Caused by: java.lang.ClassNotFoundException: javax.persistence.Query at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 1 more I'm surprised! because it connected successfully between EntityManger and Database, so it used libraries of javax.persistence! .. so Why it don't see the library while trying to send a query?! So how i solve this problem to run the application by command line any where? not from Netbeans only ?! Notes: Windows 8 JDK8 I Set JAVA_HOME and PATH Variables on Windows Thanks,
has title: java.lang.NoClassDefFoundError: javax/persistence/Query when trying to run EE Jar from Windows CMD?
score: 0
tagged with: persistence
has comment: http://stackoverflow.com/comment/37530355
has comment: http://stackoverflow.com/comment/37530584
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/113125963
has comment: http://stackoverflow.com/comment/37530547
has comment: http://stackoverflow.com/comment/37528647
tagged with: netbeans

awt
tags question: http://stackoverflow.com/q/24282820
tags question: http://stackoverflow.com/q/24363902
tags question: http://stackoverflow.com/q/24333267
tags question: http://stackoverflow.com/q/24317404
tags question: http://stackoverflow.com/q/24374970
tags question: http://stackoverflow.com/q/24285623
tags question: http://stackoverflow.com/q/24377528
tag name: awt
tags question: http://stackoverflow.com/q/24306071
tags question: http://stackoverflow.com/q/24293847
tags question: http://stackoverflow.com/q/24293135
tags question: http://stackoverflow.com/q/24314838
tags question: http://stackoverflow.com/q/24322041
tags question: http://stackoverflow.com/q/24383848
tags question: http://stackoverflow.com/q/24344267
type: Tag
tags question: http://stackoverflow.com/q/24425542
tags question: http://stackoverflow.com/q/24313493
tags question: http://stackoverflow.com/q/24360140
tags question: http://stackoverflow.com/q/24381955
tags question: http://stackoverflow.com/q/24294159

http://stackoverflow.com/a/40258923
has body: As I found, the iterating over array with Stream is working much slower (74 slides are not consider such the case). I think that it is not the only performance leaks in lambdas (guess, it will be improved in the future). The example below was running with Java 8 without any options: //Language is an enum Language[] array = Language.values(); System.err.println(array.length); // 72 items long t = System.nanoTime(); for (Language l : array) System.out.println(l.getLanguageName()); System.err.println(System.nanoTime()-t); //nano time 1864724 t = System.nanoTime(); Arrays.stream(array).forEach(v -&gt; System.out.println(v.getLanguageName())); System.err.println(System.nanoTime()-t); //nano time 55812625 (55812625/1864724 = 29.93 times longer) List&lt;Language&gt; list = Arrays.asList(array); t = System.nanoTime(); for (Language l : list) System.out.println(l.getLanguageName()); System.err.println(System.nanoTime()-t); //nano time 1435008 t = System.nanoTime(); list.forEach(v -&gt; System.out.println(v.getLanguageName())); System.err.println(System.nanoTime()-t); //nano time 1619973 (1619973/1435008 = 1.128 times longer)
downvote count: 8
type: Answer
score: -7
has comment: http://stackoverflow.com/comment/67805164
upvote count: 1
answers question: http://stackoverflow.com/q/24294846

http://stackoverflow.com/comment/37600391
score: 2
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24325334

http://stackoverflow.com/comment/37652413
has text: instead of `private String myString;`, try `private String myString = "";` - the difference between **null** and **blank**. So here: `events.add(myString); // Application crashes because of that line` you won't have a null string object, but a string initialized to blank.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24352293

http://stackoverflow.com/q/24373536
tagged with: java
type: Question
tagged with: android-contacts
has body: I am trying to retrieve contacts on an android device that are explicitly saved (i.e. not the ones returned by gmail or Facebook and other apps that save contact-like information). I have been playing around with this code block from the PhoneGap contacts plugin: Cursor idCursor = mApp.getActivity().getContentResolver().query(ContactsContract.Data.CONTENT_URI, new String[] { ContactsContract.Data.CONTACT_ID }, whereOptions.getWhere(), whereOptions.getWhereArgs(), ContactsContract.Data.CONTACT_ID + " ASC"); I modified various arguments and tried querying based on ContactsContract.RawContacts.ACCOUNT_TYPE with no luck. How can I modify the code block above to achieve what I need?
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24435361
tagged with: cordova-plugins
tagged with: cordova
type: UnansweredQuestion
tagged with: android
has title: Only get android contacts that are saved to the phone or sim

http://stackoverflow.com/comment/37516864
score: 0
type: AnswerComment
type: Comment
has text: @roam You are not calling getInt from within setInt. You are passing the results of a call to getInt as a parameter to setInt. The line you have in your code is identical in function to the one I posted using tmp and should show clearly why you do need the synchronized block.
comment on: http://stackoverflow.com/a/24281076

http://stackoverflow.com/comment/37740687
type: Comment
comment on: http://stackoverflow.com/a/24346978
has text: Thanks! Yes, it was jar file conflict and got it working with parent last. But finally I ended up coding it to use the AXIS jars that were available on the WAS 8.5.
type: AnswerComment
score: 0

http://stackoverflow.com/q/24409387
has comment: http://stackoverflow.com/comment/51069032
score: 9
type: Question
answer count: 2
has body: QUESTION How do I scale to use more threads if and only if there is free cpu? Something like a ThreadPoolExecutor that uses more threads when cpu cores are idle, and less or just one if not. USE CASE Current situation: My Java server app processes requests and serves results. There is a ThreadPoolExecutor to serve the requests with a reasonable number of max threads following the principle: number of cpu cores = number of max threads. The work performed is cpu heavy, and there's some disk IO (DBs). The code is linear, single threaded. A single request takes between 50 and 500 ms to process. Sometimes there are just a few requests per minute, and other times there are 30 simultaneous. A modern server with 12 cores handles the load nicely. The throughput is good, the latency is ok. Desired improvement: When there is a low number of requests, as is the case most of the time, many cpu cores are idle. Latency could be improved in this case by running some of the code for a single request multi-threaded. Some prototyping shows improvements, but as soon as I test with a higher number of concurrent requests, the server goes bananas. Throughput goes down, memory consumption goes overboard. 30 simultaneous requests sharing a queue of 10 meaning that 10 can run at most while 20 are waiting, and each of the 10 uses up to 8 threads at once for parallelism, seems to be too much for a machine with 12 cores (out of which 6 are virtual). This seems to me like a common use case, yet I could not find information by searching. IDEAS 1) request counting One idea is to count the current number of processed requests. If 1 or low then do more parallelism, if high then don't do any and continue single-threaded as before. This sounds simple to implement. Drawbacks are: request counter resetting must not contain bugs, think finally. And it does not actually check available cpu, maybe another process uses cpu also. In my case the machine is dedicated to just this application, but still. 2) act…
linked to: http://stackoverflow.com/q/7926864
has answer: http://stackoverflow.com/a/24429935
has comment: http://stackoverflow.com/comment/51068537
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37763770
possible better answer: http://stackoverflow.com/a/37519890
has title: Java concurrency based on available FREE cpu
has comment: http://stackoverflow.com/comment/37762706
has answer: http://stackoverflow.com/a/37519890
tagged with: performance
upvote count: 9
tagged with: concurrency
accepted answer: http://stackoverflow.com/a/24429935
type: AnsweredQuestion
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/24322083
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/24311314
has body: If you are looking for a good quality commercial solution, take a look at Aspose.Pdf for Android. It is a PDF processing library that enables you to create, manipulate and edit documents. Features include: PDF compression options, support for graph objects, extensive hyperlink functionality, extended security controls, custom font handling, integration with data sources, adding or removing bookmarks, working with attachments and annotations, importing or exporting PDF form data, working with text and images, splitting, concatenating, extracting or inserting pages, converting pages to images and much more. Here is a simple example to extract text from a PDF file. String input = new File(Environment.getExternalStorageDirectory(), "Document1.pdf").toString(); // Load the PDF document Document doc = new Document(input); // Create a text absorber TextAbsorber absorber = TextAbsorber(); // Accept page 1 for absorber. doc.getPages().get_Item(1).accept(absorber); // Extract all text from page 1 String text = absorber.getText(); Log.i("PDF", text); PS: I am a developer at Aspose.
answers question: http://stackoverflow.com/q/24311314

http://stackoverflow.com/comment/37757473
type: QuestionComment
comment on: http://stackoverflow.com/q/24395770
has text: What does "access" mean to you? Are you trying to "find" this in a query or "update" the selected element in the array? In either case the positional `$` only returns the "outer" array position in the match. What is your question?
score: 0
type: Comment

http://stackoverflow.com/comment/37644198
comment on: http://stackoverflow.com/q/24345891
type: Comment
type: QuestionComment
has text: `Exception in thread "main" java.lang.NullPointerException at dao.DireccionDao.traerListaRubros(DireccionDao.java:128)` What happens at line 128 of `DireccionDao`?
score: 0

http://stackoverflow.com/comment/37564300
type: Comment
has text: Unless we find out where `start2` is initialized, that might not be the problem.
comment on: http://stackoverflow.com/a/24306296
type: AnswerComment
score: 0

http://stackoverflow.com/q/24409120
has answer: http://stackoverflow.com/a/24409520
has comment: http://stackoverflow.com/comment/37759345
has title: JUnit Test for Comparator in Java
has comment: http://stackoverflow.com/comment/37760257
tagged with: junit
downvote count: 0
possible better answer: http://stackoverflow.com/a/24409686
has answer: http://stackoverflow.com/a/24471756
has answer: http://stackoverflow.com/a/24409686
answer count: 4
favorite count: 0
has body: How can I test the following class using JUnit testing. I am new to unit testing I just need a push to start public class ComponentComparator implements Comparator&lt; Component &gt; { @Override public int compare ( final Component c1, final Component c2 ) { if ( c1.getBandwidthWithHeader() &gt; c2.getBandwidthWithHeader() ) { return -1; } else if ( c1.getBandwidthWithHeader() &lt; c2.getBandwidthWithHeader() ) { return 1; } return 0; } } Part of the component class is, there is no constructor for this class public class Component { private float bandwidthwithHeader; public void setBandwidthWithHeader ( float bandwidthwithHeader ) { this.bandwidthwithHeader = bandwidthwithHeader; } public float getBandwidthWithHeader () { return this.bandwidthwithHeader; } }
upvote count: 1
has answer: http://stackoverflow.com/a/24410150
type: AnsweredQuestion
tagged with: junit4
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24410150
tagged with: unit-testing
type: Question

http://stackoverflow.com/q/24312675
type: Question
has body: Until now i hardcoded the file paths in order to save facts or loading them into memory, but i have made modifications in the code when i ask for a file with a showSaveDialog() and get the path as well as name with getAbsolutePath(). The slice of code is as follows: int retVal = fs.showSaveDialog(this); if (retVal == fs.APPROVE_OPTION){ fn = fs.getSelectedFile().getAbsolutePath(); . . . Now, the variable that receives the string is called fichero and is used on a jess sentence like this: motor.eval("(save-facts "+fichero+")"); motor is the instance of the rete engine. The problem is that jess uses the string but with simple backslashes '\', and it don't get saved correctly, because it gets all the string as the filename. I have used the Jess console and noticed that the same string but with double backslashes on it '\' saves it correctly into the specified path. how can i replace the single slash with the double on the String fichero? I tried with fichero.replaceAll() method, using two strings as arguments, one with the single slash and the other with the double slash, but seems that java don't get it. The arguments described are declared as String var1 = "\" and String var2 = "\\". Using a println i observed that each one has a single and double backslash respectively, but did'nt seem to work when applied to the replaceAll() method. Anyone can help? Thanks in advance!
has answer: http://stackoverflow.com/a/24326690
answer count: 2
upvote count: 1
favorite count: 0
tagged with: jess
has title: jess and backslashes when saving facts
downvote count: 0
type: UnansweredQuestion
score: 1
has answer: http://stackoverflow.com/a/24313765
tagged with: java

http://stackoverflow.com/comment/37502202
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24272411
type: Comment
has text: In Java context all this applies to *nix only because for Windows there's no standard way in Java to set `FILE_SHARE_DELETE` on the files being created/opened so they can never be deleted normally.

http://stackoverflow.com/comment/37558241
type: Comment
has text: I copied .so files to my tomcat's lib folder and added LD_LIBRARY_PATH=$CATALINA_BASE/lib:$LD_LIBRARY_PATH to catalina.sh as I dont have setenv.sh .Its not working for me. Same error I am getting
comment on: http://stackoverflow.com/a/24302797
score: 0
type: AnswerComment

http://stackoverflow.com/q/24368839
has comment: http://stackoverflow.com/comment/37683914
has comment: http://stackoverflow.com/comment/37684285
tagged with: java
has body: I want to make SWT TableViewer row with alternate grey and white color, some links showed a way to do by using setLinesvisible but that option didn't work. Other way I can find is like using IColorProvider, wanted to know any better approach to do this?
type: Question
tagged with: tableviewer
score: 0
tagged with: colors
has comment: http://stackoverflow.com/comment/37684145
has title: Color JFace TableViewer alternatively
tagged with: jface
answer count: 0
type: UnansweredQuestion
tagged with: swt

http://stackoverflow.com/q/24401612
has comment: http://stackoverflow.com/comment/37749077
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37745920
upvote count: 1
tagged with: parameter-passing
has comment: http://stackoverflow.com/comment/37745547
linked to: http://stackoverflow.com/q/16223531
score: 1
has comment: http://stackoverflow.com/comment/37749984
tagged with: java
has body: I have a java function which operate on huge amount of data may be 500MB. I have to pass this 500MB of data to a java function and return the data after processing from the java function. My is in the tabular form as follows col1 col2 col3 col4 col5 col6 3 5 2 5 1 6 7 5 6 8 3 8 5 3 7 9 8 1 I have few ideas in mind but don't know exactly which one is efficient and how to implement like which java api I need for those. Convert the data into java objects (each row one object of same class). Then pass the objects as an array to java function. Prepare XML doc from the tabular data and pass XML doc to java function. inside java function extract objects from XML document. Save the tabular data into file and input the file as argument to java function. These ideas I have in my mind, if some one can provide pros and cons of above 3 methods or suggest some new method it will be grateful to me.
has comment: http://stackoverflow.com/comment/37750031
has answer: http://stackoverflow.com/a/24403165
tagged with: methods
type: Question
has title: Whats the efficient way to pass huge data to a java function?
downvote count: 0
has answer: http://stackoverflow.com/a/24401815
has answer: http://stackoverflow.com/a/24401667
has answer: http://stackoverflow.com/a/24410499
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/37745576

http://stackoverflow.com/q/24414186
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/37769344
type: Question
has comment: http://stackoverflow.com/comment/37768784
has title: Server side application
accepted answer: http://stackoverflow.com/a/24414384
answer count: 1
has body: for my new project I need to write server-side application that will serve some of simple requests. I have no experience of writing server-side application, so I need some advice. The problem is that I don't know how to start; I've spent couple of hours searching google for some guidelines, but I got nowhere. I need to write application that will ran on the server (I've installed Ubuntu server in VirtualBox and used briged connection, so I can access it from my network) and will serve some requests: connnect to server authorize user (check user and his pass in db) store some data in db on connection (for example IP address) I am not sure which language would be best to use and what do I need to know to implement that app. This is my private project, which I came up with to learn something new; until now I have always written apps that ran locally (usually in Java/C/Python). I've seen some tutorials on PHP and Django, but I am not sure if I am going in the right direction. Thanks in advance for all help :)
tagged with: server-side
favorite count: 0
tagged with: django
tagged with: python
tagged with: php
score: -1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37770455
has answer: http://stackoverflow.com/a/24414384
tagged with: java

http://stackoverflow.com/q/24349085
has answer: http://stackoverflow.com/a/24349638
score: 0
possible better answer: http://stackoverflow.com/a/24349139
has body: I want to split a String into n number of characters. Consider input to be "Example-for-my-Question". Now if I want to split into n=3 characters, output should be "Exa, mpl, e-f, or-, my-, Que, sti, on" and suppose n=4, output should be "Exam, ple-, for-, my-Q, uest, ion" How can you modify the program below without using POSIX. import java.util.Scanner; public class SplitString { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Enter a String; "); String inputString = in.nextLine(); System.out.println("How many characters do you want to split into ?"); int n = in.nextInt(); String[] array = inputString.split(" ", n); System.out.println("Number of words: " + array.length); for (String arr : array) System.out.println(arr); } }
has answer: http://stackoverflow.com/a/24349139
tagged with: string
has answer: http://stackoverflow.com/a/24349164
has answer: http://stackoverflow.com/a/24349141
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37645962
tagged with: java
type: Question
tagged with: split
has title: Split a String into number of Characters desired by the user
accepted answer: http://stackoverflow.com/a/24349141

http://stackoverflow.com/a/24316651
has comment: http://stackoverflow.com/comment/37584303
answers question: http://stackoverflow.com/q/24316164
has comment: http://stackoverflow.com/comment/37584734
has comment: http://stackoverflow.com/comment/37584677
has body: There are several reasons why this does not work: A normal computer can only handle about 4-8 threads in total per cpu. As the system uses some of thise threads you would only be able to run some threads at the same time. The computer handles this by pausing some threads then running another thread. If you try to send several queries through the socket to the mysql server at the same time chanses are that some of the requests will not work and you lose some of your data. As for now I do not have any solution for faster updates of the table.
downvote count: 1
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/37584538
has comment: http://stackoverflow.com/comment/37584386
score: -1

http://stackoverflow.com/a/24288680
score: 1
accepted answer of: http://stackoverflow.com/q/24288508
type: Answer
answers question: http://stackoverflow.com/q/24288508
upvote count: 1
has body: Keep the classes separate since they do different things. Combining them will only make a giant mess and violates the Single Responsibility Principle. If you don't want the users to see the classes, then make the classes package private. Then you make a new Builder or Factory class that takes parameters and figures out which class to instantiate. Hope this helps.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24350042
type: Question
has title: Persisting ArrayList<String> with ORMLite in Android
tagged with: arraylist
has comment: http://stackoverflow.com/comment/51149577
upvote count: 1
answer count: 1
favorite count: 0
tagged with: ormlite
has answer: http://stackoverflow.com/a/24375357
accepted answer: http://stackoverflow.com/a/24375357
tagged with: android
has body: When trying to persist the class Goods with ORMLite, I don't know how to persist componentList here. I have found a similar question Persisting a Collection class with ORMLite in android, but it seems not pointing the way to solve the problem. public class Goods extends Object implements Serializable { private static final long serialVersionUID = -7560219283718464481L; ... public ArrayList&lt;String&gt; componentList; public String getComponentList(){ return componentList; } public void setComponentList(ArrayList&lt;String&gt; componentList){ this.componentList = componentList; } ... }
tagged with: collections
linked to: http://stackoverflow.com/q/6272155
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/18441595

http://stackoverflow.com/q/24401222
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24401330
answer count: 4
has comment: http://stackoverflow.com/comment/37744823
tagged with: text
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/24401397
has title: hardcode or a file for text in java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24401275
score: -1
has answer: http://stackoverflow.com/a/24401378
has comment: http://stackoverflow.com/comment/37745044
has comment: http://stackoverflow.com/comment/37744896
tagged with: string
has body: I'm learning programming and started to think how people usually add text to their programs. I mean if I have a program which has say thousands of sentences. Do i write them all in class files like this String str="hello world"; Or do I put it in a separete file and call that file from my code somehow?
favorite count: 0

http://stackoverflow.com/a/24296826
type: Answer
answers question: http://stackoverflow.com/q/24296800
has body: If you have maven added to the system path then you can simply compile it using the maven commands on the prompt: mvm clean install
score: 0

http://stackoverflow.com/comment/37712988
type: Comment
has text: have added this @lazyCollection (False) but still nothing in database.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24384122

http://stackoverflow.com/q/24412511
has answer: http://stackoverflow.com/a/52350468
has answer: http://stackoverflow.com/a/43099920
tagged with: java
has comment: http://stackoverflow.com/comment/37766128
score: 28
has comment: http://stackoverflow.com/comment/37766254
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/42305586
answer count: 5
type: UnansweredQuestion
tagged with: jsonpath
has comment: http://stackoverflow.com/comment/37765972
has body: I have JSON as a string and a JSONPath as a string. I'd like to query the JSON with the JSON path, getting the resulting JSON as a string. I gather that Jayway's json-path is the standard. The online API, however, doesn't have have much relation to the actual library you get from Maven. GrepCode's version roughly matches up though. It seems like I ought to be able to do: String originalJson; //these are initialized to actual data String jsonPath; String queriedJson = JsonPath.&lt;String&gt;read(originalJson, jsonPath); The problem is that read returns whatever it feels most appropriate based on what the JSONPath actually finds (e.g. a List&lt;Object&gt;, String, double, etc.), thus my code throws an exception for certain queries. It seems pretty reasonable to assume that there'd be some way to query JSON and get JSON back; any suggestions?
downvote count: 0
has title: Basic use of JSONPath in Java
favorite count: 0
has answer: http://stackoverflow.com/a/30410403
upvote count: 28
type: Question
has answer: http://stackoverflow.com/a/73819046

http://stackoverflow.com/comment/37669963
type: Comment
type: QuestionComment
has text: I think it is simple try to manage flag.
score: 0
comment on: http://stackoverflow.com/q/24361365

http://stackoverflow.com/a/24369858
score: 0
has body: A general tip first: use for instance FireFox with the TamperData add-on, which enables to trace a regular form submit, and inspect everything. In your case a proxy monitor might be more of a help. Also: curl --trace-ascii ... TamperData will show where it goes wrong. Without encoding parameter the current platform encoding is taken; non-portable. OutputStreamWriter wr = new OutputStreamWriter(connection.getOutputStream(), StandardCharsets.UTF_8); Reader in = new BufferedReader(new InputStreamReader( connection.getInputStream(), StandardCharsets.UTF_8));
type: Answer
answers question: http://stackoverflow.com/q/24368731

http://stackoverflow.com/comment/37589031
type: AnswerComment
has text: There is no `UV_COORD` constant used anywhere in the code you posted.
comment on: http://stackoverflow.com/a/24318955
type: Comment
score: 1

http://stackoverflow.com/comment/37583038
has text: @Aleksandr thank you for your answer, you were right. Now I am trying to solve another problem "Cannot invoke Tomcat manager: Connection to http://127.0.0.1:8080 refused: Connection refused" I am trying to reach the solution.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24311383
score: 0

http://stackoverflow.com/q/24401160
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/24401340
tagged with: java
type: Question
score: 0
has body: I'm reading text from a file using BufferedReader, when some condition evaluates to true I want to roll back to the previous line.
tagged with: bufferedreader
has answer: http://stackoverflow.com/a/24401250
favorite count: 0
has title: java BufferedReader roll back to previous line
linked to: http://stackoverflow.com/q/4901508
answer count: 3
has answer: http://stackoverflow.com/a/24401259

http://stackoverflow.com/q/24320783
has answer: http://stackoverflow.com/a/24320968
tagged with: android
type: AnsweredQuestion
score: 0
type: Question
has body: I'm developing an android application, The layout is shown in the image below : Screenshot http://www.lebanon-trading-center.com/daymanager/layout.PNG The layout contains 2 main linearlayouts : a horizontal layout that takes 90% of the height of the device and a vertical layout that takes 10% of it. Inside the horizontal linearlayout there is three linearlayout ( two red and one containing an imageview). Each red layout is 10% of the width of the screen and the one containing the ImageView is 80%. Here is the xml code : <?xml version="1.0" encoding="utf-8"?> <ImageView android:id="@+id/imageView1" android:layout_width="match_parent" android:layout_height="match_parent" android:adjustViewBounds="true" android:src="@drawable/ic_launcher" /> The problem is, when I set a PNG image (1036px X 730px ) as a source to the ImageView, the ImageView will get over the bottom linearlayout ( the black one ) and the two red layouts will be squeezed. Screenshot http://www.lebanon-trading-center.com/daymanager/layout2.PNG My question is how can I solve the problem and have the same layouts functional on all kind of tablets ?
accepted answer: http://stackoverflow.com/a/24320968
has title: Android ImageView getting over linearlayout
tagged with: android-layout
tagged with: java
has comment: http://stackoverflow.com/comment/37592014
answer count: 1

http://stackoverflow.com/comment/37529965
type: Comment
comment on: http://stackoverflow.com/a/24286874
type: AnswerComment
score: 0
has text: Fine, now the error should be clear. You got something as String expected where Object was encountered.

http://stackoverflow.com/q/24423081
type: Question
accepted answer: http://stackoverflow.com/a/24423977
has title: How to manipulate all active threads in a JavaFX application
has answer: http://stackoverflow.com/a/24423977
score: 0
answer count: 1
tagged with: multithreading
type: AnsweredQuestion
has body: System.out.println(Thread.activeCount()); prints the number of active threads. Right as I start my application, it says it is running 6 threads. How would one go about to manipulate (say, priority of) all these threads? Putting System.out.println(Thread.currentThread().getName()) in my code always prints JavaFX Application Thread.
tagged with: java
tagged with: javafx
tagged with: thread-priority

http://stackoverflow.com/a/24419328
score: 0
has comment: http://stackoverflow.com/comment/37780808
type: AcceptedAnswer
has body: You theoretically have this &lt;input&gt; &lt;flight flight="LX179" dep="SIN" arr="ZRH" aircraftRegistration="HBJMN" paxWeight="10000" /&gt; &lt;flight flight="LX178" dep="SIN" arr="YUL" aircraftRegistration="ABCDE" paxWeight="10000" /&gt; &lt;/input&gt; Therefore you have a collection of &lt;flight&gt; elements within one &lt;input&gt; element. You have to model that with Java. public class Input { public List&lt;Flight&gt; lista; } public class Flight {} Once you have that, you have to add the appropriate annotations. &lt;input&gt; is the root element, so Input should be a root element. @XmlRootElement(name = "input") public class Input { It has a collection of elements called &lt;flight&gt;, so that field should be annotated @XmlElement(name = "flight") public List&lt;Flight&gt; lista;
type: Answer
accepted answer of: http://stackoverflow.com/q/24416869
answers question: http://stackoverflow.com/q/24416869
has comment: http://stackoverflow.com/comment/37787262
has comment: http://stackoverflow.com/comment/37802338
has comment: http://stackoverflow.com/comment/37781519

http://stackoverflow.com/a/24361165
has body: The standard way of abstracting similar behaviour is to use interfaces. In your case you want to build a total some over all the elements of a list. First create an interface public interface Summable { double getSum(); } Now implement that interface in SmallClassA and SmallClassB. This shifts most of the loop bodies to the specific classes e.g. for SmallClassA public SmallClassA implements Summable{ public double getSum() { return getValue() + getGainLoss(); } } Now both your loops can be written as for ( Summable summable : smallClassArray ) { total += summable.getSum(); } You can also make this an external method.
answers question: http://stackoverflow.com/q/24360375
score: 0
type: Answer

http://stackoverflow.com/comment/37745542
type: AnswerComment
score: 0
type: Comment
has text: ...and what about `return;`
comment on: http://stackoverflow.com/a/24401678

http://stackoverflow.com/comment/37658955
has text: How would i select a specific field? Instead of selecting all of it?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24355404
score: 0

http://stackoverflow.com/comment/37667624
score: 0
type: QuestionComment
has text: At least debug through the code...
type: Comment
comment on: http://stackoverflow.com/q/24360168

http://stackoverflow.com/a/24269250
type: Answer
has body: You have 3 variables called style in one method. You cannot do this. Also you are not passing the correct number of arguments to addStyle. See http://www.java2s.com/Code/Java/Swing-JFC/JTextPaneStylesExample6.htm for a complete example of using JTextPane Styles: /* Core SWING Advanced Programming By Kim Topley ISBN: 0 13 083292 8 Publisher: Prentice Hall */ import javax.swing.*; import javax.swing.text.*; import java.awt.*; public class StylesExample6 { public static void main(String[] args) { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception evt) {} JFrame f = new JFrame("Styles Example 6"); // Create the StyleContext, the document and the pane StyleContext sc = new StyleContext(); final DefaultStyledDocument doc = new DefaultStyledDocument(sc); final JTextPane pane = new JTextPane(doc); // Create and add the main document style Style defaultStyle = sc.getStyle(StyleContext.DEFAULT_STYLE); final Style mainStyle = sc.addStyle("MainStyle", defaultStyle); StyleConstants.setLeftIndent(mainStyle, 16); StyleConstants.setRightIndent(mainStyle, 16); StyleConstants.setFirstLineIndent(mainStyle, 16); StyleConstants.setFontFamily(mainStyle, "serif"); StyleConstants.setFontSize(mainStyle, 12); // Create and add the constant width style final Style cwStyle = sc.addStyle("ConstantWidth", null); StyleConstants.setFontFamily(cwStyle, "monospaced"); StyleConstants.setForeground(cwStyle, Color.green); // Create and add the heading style final Style heading2Style = sc.addStyle("Heading2", null); StyleConstants.setForeground(heading2Style, Color.red); StyleConstants.setFontSize(heading2Style, 16); StyleConstants.setFontFamily(heading2Style, "serif"); StyleConstants.setBold(heading2Style, true); StyleConstants.setLeftIndent(heading2Style, 8); StyleConstants.setFirstLineIndent(heading2Style, 0); try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { try { // Set the logical style doc.setLogicalStyle(0, mainStyle); /…
accepted answer of: http://stackoverflow.com/q/24268062
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37502637
has comment: http://stackoverflow.com/comment/37502458
has comment: http://stackoverflow.com/comment/37495861
has comment: http://stackoverflow.com/comment/37496197
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37496260
answers question: http://stackoverflow.com/q/24268062
has comment: http://stackoverflow.com/comment/37494995

http://stackoverflow.com/comment/44405873
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24305640
type: AnswerComment
has text: So what is the solution ?

http://stackoverflow.com/comment/41265633
comment on: http://stackoverflow.com/a/24384067
type: Comment
has text: Theoretically yes. In practice you will have to do a lot of optimizing and tweaks to get it working at a reasonable speed. If you want to scrape mails, my guess, try looking at https://developers.google.com/gmail/
score: 0
type: AnswerComment

http://stackoverflow.com/q/24373237
favorite count: 0
has title: Spring How to autowire a component without using @Component or other derivatives
has comment: http://stackoverflow.com/comment/37692557
tagged with: spring
accepted answer: http://stackoverflow.com/a/24373710
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24373416
has body: I would like to autowire a component (still using the @Autowired annotation), but not require it to have the @Component (or other similar annotations) on it. How would I do this? public class A { @Autowired private class B b; } @Component public class B { } This would be convenient in order to allow autowiring of class A without requiring the creation of A, unless we needed it (in otherwise on the fly by reflection using the class name).
upvote count: 5
score: 4
possible better answer: http://stackoverflow.com/a/24373416
has answer: http://stackoverflow.com/a/24373710
has comment: http://stackoverflow.com/comment/37692367
answer count: 2

http://stackoverflow.com/comment/37726060
type: AnswerComment
has text: @MingtaoZhang `capacity` is different from `size`. An ArrayList is backed by an array and `capacity` is the size of that array. Java manages the array (increase/decrease size etc) and mostly transparent. `size` is the actual number of elements in the `ArrayList`. `capacity >= size`.
type: Comment
comment on: http://stackoverflow.com/a/24389680
score: 0

http://stackoverflow.com/comment/37573402
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24311061
has text: It's certainly bad practice in Python...
type: Comment

http://stackoverflow.com/q/24373368
has answer: http://stackoverflow.com/a/24374542
upvote count: 4
answer count: 2
tagged with: sql
has comment: http://stackoverflow.com/comment/37692414
has answer: http://stackoverflow.com/a/68081130
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: Hibernate @Where clause
tagged with: jdbc
score: 4
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/37693044
has body: I have User class, which has groups. @Where(clause = "enabled = 1 and deleted = 0") @Fetch(FetchMode.SUBSELECT) public Set&lt;Group&gt; getGroups() { return groups; } But when I'm trying to make some operation on Group which is already stored in DB and is not suitable for @Where clause, Hibernate just ignores me. Actually, @Where is not my decision, but solution I could find to overcome this (create another dao method to perform some operation) is so ugly. So, is there way to overcome this? Or did I miss something? Thanks for the help.

http://stackoverflow.com/a/24330910
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24329804
answers question: http://stackoverflow.com/q/24329804
has body: You may use :read-resource-description(operations=true) and process the result in result.operations. Another option would be to use tab complete to see the list or use the operation :read-operation-names and read-operation-description to see details about a specific operation.
has comment: http://stackoverflow.com/comment/37611067
score: 1
has comment: http://stackoverflow.com/comment/37696235
has comment: http://stackoverflow.com/comment/37719331
upvote count: 1

http://stackoverflow.com/comment/37629453
type: QuestionComment
has text: why dont you use `AsyncTask` instead of `Thread`?
score: 0
comment on: http://stackoverflow.com/q/24340793
type: Comment

http://stackoverflow.com/a/24423646
downvote count: 0
type: Answer
score: 4
answers question: http://stackoverflow.com/q/24423598
upvote count: 4
has body: In java you cannot have a class which extends from two classes, since it doesn't support multiple inheritance. What you can have, is something like so: public class A ... public class B extends A ... public class C extends B ... In your generic signature, you can then specify that T must extend C: &lt;T extends C&gt;. You could give a look at Default Methods (if you are working with Java 8), which essentially are methods declared within interfaces, and in Java, a class can implement multiple interfaces.

http://stackoverflow.com/comment/37741623
has text: Well I don't think there is anything wrong with the db code. Everything worked just fine when the array was less the 3. I'll try the debugger. Thanks. @alfasin
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24399004

http://stackoverflow.com/comment/37736917
type: Comment
comment on: http://stackoverflow.com/q/24396544
has text: @nosid, Actually, i don't think i can provide an example that couldn't be resolved using || or && since Predicate has to return boolean. I just locked myself on finding a functional solution.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37633541
has text: What is the java implementation you have started/tried?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24342833

http://stackoverflow.com/comment/37731640
type: AnswerComment
has text: I am sorry, I am confused by your last comment.
comment on: http://stackoverflow.com/a/24393140
type: Comment
score: 0

http://stackoverflow.com/comment/37615737
type: QuestionComment
comment on: http://stackoverflow.com/q/24331411
has text: This software is actually used by a custom trackball on a medical device that has left, right and center buttons located around it. They all must work with the UI they control.
score: 0
type: Comment

http://stackoverflow.com/comment/37692478
comment on: http://stackoverflow.com/a/24371085
type: Comment
has text: huh, i dont know how to implement or use 3d textures... to lazy to googel, couldt you post a bit example code? ^^ It does'nt have to contain much explanation but.. yeah.. :D
score: 0
type: AnswerComment

http://stackoverflow.com/q/24375913
has answer: http://stackoverflow.com/a/24375944
accepted answer: http://stackoverflow.com/a/24375944
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
answer count: 1
has body: I have a problem to run the application by click run as "Java Application" on Eclipse; nothing happened. I tracked my code and found that the following code cause the app didn't run. If I comment it out, the frame show. There is no error when it complier. Would someone tell me solve the problem. Thanks in advance. for (Comment source:c ){ String iconString="ABCTestLocation"; PrintList p=new PrintList(iconString, source.toString()); newList.add(p); if (source.thisContent.length()&gt;0){ p=new PrintList("", source.thisContent); }else{ p=new PrintList("",""); } newList.add(p); } There is the whole java file package PDFAnnotationPackage; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.SwingUtilities; import javax.swing.table.DefaultTableModel; public class Question extends JFrame implements ActionListener { private static ArrayList&lt;PrintList&gt;newList; private static DefaultTableModel tableModel; public static void main(String[] args) { // TODO Auto-generated method stub SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new Question(); } }); } public Question(){ super("Main Form"); this.setMinimumSize(new Dimension(400, 500)); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setExtendedState(JFrame.MAXIMIZED_BOTH); this.setLayout(new BorderLayout()); // Name the JMenu &amp; Add Items JMenu menu = new JMenu("File"); JMenuItem m=new JMenuItem("Print"); m.addActionListener(this); menu.add(m); // Add JMenu bar JMenuBar menuBar = new JMenuBar(); menuBar.add(menu); //http://www.java2s.com/Code/Java/Swing-JFC/DynamicmenuitemforMDIchildrenwindowandscrollbar.htm setJMenuBar(menuBar); ArrayList&lt;Comment&gt;c=new ArrayList&lt;Comment&gt;(); c.add(new Comment("Testing 123", "Tester", 2)); c.add(new Comment(…
has title: Inline class cause the application didn't run

soap
tags question: http://stackoverflow.com/q/24302055
tags question: http://stackoverflow.com/q/24389381
type: Tag
tags question: http://stackoverflow.com/q/24332915
tags question: http://stackoverflow.com/q/24396008
tags question: http://stackoverflow.com/q/24422613
tags question: http://stackoverflow.com/q/24302046
tags question: http://stackoverflow.com/q/24373027
tags question: http://stackoverflow.com/q/24328078
tags question: http://stackoverflow.com/q/24299584
tags question: http://stackoverflow.com/q/24417687
tags question: http://stackoverflow.com/q/24377430
tags question: http://stackoverflow.com/q/24337369
tags question: http://stackoverflow.com/q/24329327
tags question: http://stackoverflow.com/q/24364157
tags question: http://stackoverflow.com/q/24302793
tags question: http://stackoverflow.com/q/24385603
tags question: http://stackoverflow.com/q/24320675
tags question: http://stackoverflow.com/q/24384190
tags question: http://stackoverflow.com/q/24320879
tag name: soap

http://stackoverflow.com/a/24428494
score: 13
has comment: http://stackoverflow.com/comment/78943408
answers question: http://stackoverflow.com/q/24298925
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/85730374
accepted answer of: http://stackoverflow.com/q/24298925
type: Answer
upvote count: 13
has body: I found the answer and it worked for few Ajax and non-ajax sites I checked. After this patch I no longer need to do implicit waits even for ajax heavy pages, LeGac pointed out the following code in one of his comments to the question. public static void checkPendingRequests(FirefoxDriver driver) { int timeoutInSeconds = 5; try { if (driver instanceof JavascriptExecutor) { JavascriptExecutor jsDriver = (JavascriptExecutor)driver; for (int i = 0; i&lt; timeoutInSeconds; i++) { Object numberOfAjaxConnections = jsDriver.executeScript("return window.openHTTPs"); // return should be a number if (numberOfAjaxConnections instanceof Long) { Long n = (Long)numberOfAjaxConnections; System.out.println("Number of active calls: " + n); if (n.longValue() == 0L) break; } else{ // If it's not a number, the page might have been freshly loaded indicating the monkey // patch is replaced or we haven't yet done the patch. monkeyPatchXMLHttpRequest(driver); } Thread.sleep(1000); } } else { System.out.println("Web driver: " + driver + " cannot execute javascript"); } } catch (InterruptedException e) { System.out.println(e); } } public static void monkeyPatchXMLHttpRequest(FirefoxDriver driver) { try { if (driver instanceof JavascriptExecutor) { JavascriptExecutor jsDriver = (JavascriptExecutor)driver; Object numberOfAjaxConnections = jsDriver.executeScript("return window.openHTTPs"); if (numberOfAjaxConnections instanceof Long) { return; } String script = " (function() {" + "var oldOpen = XMLHttpRequest.prototype.open;" + "window.openHTTPs = 0;" + "XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {" + "window.openHTTPs++;" + "this.addEventListener('readystatechange', function() {" + "if(this.readyState == 4) {" + "window.openHTTPs--;" + "}" + "}, false);" + "oldOpen.call(this, method, url, async, user, pass);" + "}" + "})();"; jsDriver.executeScript(script); } else { System.out.println("Web driver: " + driver + " cannot execute javascript"); } } catch (Exception e) …
has comment: http://stackoverflow.com/comment/54783332

http://stackoverflow.com/comment/37581352
has text: Note: if you post to do this using scriptlet, your answer would become awful.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24315103

http://stackoverflow.com/comment/138771541
has text: The link is now dead. This is one of the reasons an answer should directly include the most relevant code/information from the link.
score: 1
comment on: http://stackoverflow.com/a/24302235
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37635334
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24343652
type: Comment
has text: @TheGuywithTheHat Object[][] data = new Object[donne.length][6]; So i don't think

http://stackoverflow.com/q/24367337
tagged with: datetime
linked to: http://stackoverflow.com/q/19002978
tagged with: datetime-parsing
has comment: http://stackoverflow.com/comment/37681195
upvote count: 9
has title: How to set a timezone with org.joda.time?
has answer: http://stackoverflow.com/a/79129533
has answer: http://stackoverflow.com/a/24367538
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24367538
has answer: http://stackoverflow.com/a/24367661
tagged with: java
type: Question
score: 9
tagged with: jodatime
downvote count: 0
possible better answer: http://stackoverflow.com/a/79129533
favorite count: 0
has body: I want to parse a string into DateTime object: DateTimeFormatter fmt = DateTimeFormat.forPattern("M/d/yyyy HH:mm"); DateTime dt = fmt.parseDateTime(stringDate + " " + stringTime).withZone(DateTimeZone.forID("Europe/Dublin")); If I introduce time 06/22/2014 10:43 I get 06/22/2014 8:43 +0100, but I want to get 06/22/2014 10:43 +0100 How can I do this?
answer count: 3
tagged with: timezone

http://stackoverflow.com/comment/37664889
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24357092
has text: I solved it. I can't officially answer until tomorrow, but the solution is to wrap the splitpanes inside something else, I used a regular pane. Everything works fine now.

http://stackoverflow.com/q/24334849
upvote count: 1
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/40733163
favorite count: 0
has comment: http://stackoverflow.com/comment/37618922
tagged with: xpath
downvote count: 0
type: UnansweredQuestion
tagged with: selenium-webdriver
has title: Selenium Webdriver unable to locate element from webtable
score: 1
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/24335548
type: Question
has body: I am trying to access a webtable which is quite static and get the values from each row. I am getting an error, the code is: import java.util.List; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; public class TS1_TC2 { WebDriver driver=null; String btn1="html/body/form/div[1]/center/table/tbody/tr/td[1]/input"; String table="html/body/form/table/tbody/tr[2]/td/div/center/table"; @BeforeTest public void browserCheck() { driver=new FirefoxDriver(); driver.get("http://demo.borland.com/gmopost/"); driver.manage().window().maximize(); driver.manage().deleteAllCookies(); driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); } @Test public void TS1_TC2() { driver.findElement(By.xpath(btn1)).click(); //html/body/form/table/tbody/tr[2]/td/div/center/table/tbody //html/body/form/table/tbody/tr[2]/td/div/center/table WebElement table=driver.findElement(By.xpath("html/body/form/table/tbody/tr[2]/td/div/center/table")); List&lt;WebElement&gt; rows=table.findElements(By.tagName("tr")); //WebDriverWait wait = new WebDriverWait(driver, 100, 15); System.out.println(rows.size()); for(int rownum=2;rownum&lt;rows.size();rownum++) { List&lt;WebElement&gt; cols=rows.get(rownum).findElements(By.tagName("td")); System.out.println(cols.size()); for(int colnum=1;colnum&lt;cols.size();colnum++) { //System.out.println(cols.get(colnum).getText()); //wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath("html/body/form/table/tbody/tr[2]/td/div/center/table/tbody/tr["+rownum+"]/td["+colnum+"]"))); System.out.println("html/body/form/table/tbody/tr[2]/td/div/center/table/tbody/tr["+rownum+"]/td["+colnum+"]"); System.out.println(cols.get(coln…
answer count: 1

http://stackoverflow.com/comment/38017186
type: AnswerComment
comment on: http://stackoverflow.com/a/24534022
score: 0
type: Comment
has text: @SilverlightFox That's really a good piece of information that you have given me. I didn't know that.

http://stackoverflow.com/q/24392876
tagged with: java
type: Question
upvote count: 4
tagged with: imageview
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24392960
score: 4
favorite count: 0
tagged with: android
has title: How to open a URL when click on ImageView on Android?
accepted answer: http://stackoverflow.com/a/24392960
linked to: http://stackoverflow.com/q/3536165
tagged with: android-intent
has comment: http://stackoverflow.com/comment/37732299
type: AnsweredQuestion
has body: How can ImageView Link to Web Page I did find this link and i copied below code over into onCreate function and out of the onCreate function and it doesn't seem to be working for me. Following is my main.java file @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Go to myurl.com when clicking on logo ImageView img = (ImageView)findViewById(R.id.logoId); img.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.addCategory(Intent.CATEGORY_BROWSABLE); intent.setData(Uri.parse("http://casidiablo.net")); startActivity(intent); } }); } and this is how my main.xml looks like &lt;ImageView android:id="@+id/logoId" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/logo"/&gt; so where am i doing wrong? I also tried to add a android:onClick="openBrowser" on main.xml and I created openBrowser function and put all the code in there, out of the onCreate function and still no luck. What am I missing?

http://stackoverflow.com/comment/37720662
type: AnswerComment
comment on: http://stackoverflow.com/a/24388027
has text: it wasnt looping for me in the first place turns out the }while (userReady = false); needed to be "==" instead of "=" then the program started to loop when i entered "n"
type: Comment
score: 1

http://stackoverflow.com/a/24404944
has comment: http://stackoverflow.com/comment/37752306
has comment: http://stackoverflow.com/comment/37751584
type: Answer
has comment: http://stackoverflow.com/comment/37751924
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/37752141
has body: Interfaces offer a contract, meaning that when a class implements an interface, then, by definition it provides a set of methods. How these are implemented is left to the class implementing the interface. Consider: public interface IPrint { public void print(String str); } public interface IClean { public void clean(); } public class CanonPrint implements IPrint, IClean //Prints to a physical canon printer { public void print(String str) { //Send data to canon printer } public void clean() { //Clean printer buffer, etc } } public class Console implements IPrint, IClean //Prints to a console { public void print(String str) { //Send data to console } public void clean() { //Clean console buffer, etc } } The above example, you know that the CanonPrint and ConsolePrint classes can print and clean after themselves, they have the logic to do it, the fact that they implement the IPrint and IClean interfaces guarantees it. Nothing is inherited, there is no functionality being extended, just a guaranteed a set of functions. The logic, etc, is delegated.
answers question: http://stackoverflow.com/q/24404873
upvote count: 3

http://stackoverflow.com/q/24414902
score: 0
has answer: http://stackoverflow.com/a/24414940
type: UnansweredQuestion
tagged with: tree
tagged with: java
has body: I wrote the implementation of a generic tree like this: public class Tree { private Node root; private Node ultimo; private Node padre; private String nome; private String messaggio; public Tree() { root = null; ultimo = root; padre = root; } public Node getRoot() { return root; } public void setRoot(Node root) { this.root = root; } public Node getUltimo() { return ultimo; } public Node getPadre() { return padre; } public String getNome() { return nome; } public String getMessaggio() { return messaggio; } public void setUltimo(Node ultimo) { this.ultimo = ultimo; } public void setPadre(Node padre) { this.padre = padre; } public void setNome(String nome) { this.nome = nome; } public void setMessaggio(String messaggio) { this.messaggio = messaggio; } public ArrayList&lt;Node&gt; getPreOrderTraversal() { ArrayList&lt;Node&gt; preOrder = new ArrayList&lt;Node&gt;(); buildPreOrder(root, preOrder); return preOrder; } public ArrayList&lt;Node&gt; getPostOrderTraversal() { ArrayList&lt;Node&gt; postOrder = new ArrayList&lt;Node&gt;(); buildPostOrder(root, postOrder); return postOrder; } private void buildPreOrder(Node node, ArrayList&lt;Node&gt; preOrder) { preOrder.add(node); for(Node child : node.getChildren()) { buildPreOrder(child, preOrder); } } private void buildPostOrder(Node node, ArrayList&lt;Node&gt; preOrder) { for(Node child : node.getChildren()) { buildPreOrder(child, preOrder); } preOrder.add(node); } public void print(String indent) { if(root == null) { System.out.println("Empty tree."); return; } if(getPadre() != null) getPadre().printNode(); getUltimo().printNode(); } } Now I would like to write a method that allows me to print the entire tree (or in graphical form with graphviz or by the prompt). For now, the print() method that I wrote print only the last inserted node in the tree and his father. I suppose to print the whole tree I should use the print method recursively, but how? Thank you very much
has title: How to print a generic tree
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/41675635

http://stackoverflow.com/comment/37609760
comment on: http://stackoverflow.com/q/24329883
score: 0
type: Comment
type: QuestionComment
has text: Is this to detect users not complying with your license scheme?

http://stackoverflow.com/q/24386325
possible better answer: http://stackoverflow.com/a/24386447
type: Question
tagged with: class
duplicate of: http://stackoverflow.com/q/380813
has body: I am getting an exception for the following code. class A { void foo() { System.out.println("Running foo()"); } } class B extends A { void foo() { System.out.println("Overidden foo()"); } } public class Casting { public static void main(String[] args) { A obj = new B(); obj.foo(); // B ref = (B) obj; // ref.foo(); B ref = (B) new A(); ref.foo(); } } But if I run B ref = (B) obj; ref.foo(); instead of B ref = (B) new A(); ref.foo(); it works properly. Can anyone explain what is happening here.?
answer count: 2
accepted answer: http://stackoverflow.com/a/24386448
linked to: http://stackoverflow.com/q/380813
has comment: http://stackoverflow.com/comment/37716387
has answer: http://stackoverflow.com/a/24386447
favorite count: 0
has answer: http://stackoverflow.com/a/24386448
upvote count: 2
has comment: http://stackoverflow.com/comment/37716696
tagged with: classcastexception
has title: Class/object Casting
type: AnsweredQuestion
score: 1
tagged with: java
downvote count: 1

http://stackoverflow.com/comment/37658788
type: Comment
comment on: http://stackoverflow.com/a/24355341
type: AnswerComment
score: 0
has text: @user3745832 was this helpful?

http://stackoverflow.com/comment/37705591
type: Comment
has text: The pedantry aligns exactly with what I was aksing - your usage of scope matches mine, and my "`a` is getting detected as having no references" matches your "reachable".
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/24380219

http://stackoverflow.com/q/24277238
answer count: 1
has answer: http://stackoverflow.com/a/24359018
type: UnansweredQuestion
has title: No name matching graph.facebook.com found (SSLHandshakeException/CertificateException)
has body: At our QC server we have done the following steps: openssl genrsa -out server.key 2048 openssl req -new -out server.csr -key server.key openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt openssl pkcs12 -export -in server.crt -inkey server.key -out server.p12 -name some-alias -CAfile ca.crt -caname root keytool -importkeystore -deststorepass changeit -destkeypass changeit -destkeystore server.keystore -srckeystore server.p12 -srcstoretype PKCS12 -srcstorepass changeit -alias server (The CAfile never got created, so have not used it yet.) These steps were done based on SO references: 1/importing an existing x509 certificate and private key in Java keystore to use in ssl 2/Trust Store vs Key Store - creating with keytool Further, I have used/tested the SSLPoke utility from Altassian(https://confluence.atlassian.com/download/attachments/180292346/SSLPoke.java?version=1&amp;modificationDate=1236556497004&amp;api=v2) and the same seems to work with the following command on the same server: java -Djavax.net.ssl.keyStore=server.keystore -Djavax.net.ssl.keyStorePassword=changeit -Djavax.net.debug=all SSLPoke facebook.com 443 The problem is with apache+tomcat, which is throwing the said exception when a connection to https://graph.facebook.com is made via java code. How can I overcome this exception? Here is the listing of the facebook certificat in the server.keystore: #keytool -list -v -keystore server.keystore -alias facebook.com Enter keystore password: Alias name: facebook.com Creation date: 17 Jun, 2014 Entry type: trustedCertEntry Owner: CN=*.facebook.com, O="Facebook, Inc.", L=Menlo Park, ST=CA, C=US Issuer: CN=DigiCert High Assurance CA-3, OU=www.digicert.com, O=DigiCert Inc, C=US Serial number: 771430e2db21fb0b295cdb959c98454 Valid from: Sat Mar 01 05:30:00 IST 2014 until: Mon Apr 13 17:30:00 IST 2015 Certificate fingerprints: MD5: D3:A6:3C:18:15:C6:4B:BB:BE:75:7B:AC:ED:7D:2B:80 SHA1: BD:01:2A:89:B2:CC:9E:49:F8:1F:47:BF:BD:52:DE:48:A0:4E:…
linked to: http://stackoverflow.com/q/906402
tagged with: java
tagged with: certificate
type: Question
tagged with: ssl
score: 0
linked to: http://stackoverflow.com/q/6340918

http://stackoverflow.com/q/24346774
tagged with: javascript
has body: I want to access a JavaScript file using a Java Method in tomcat. I put js file in Web-INF folder and used engine.eval(new java.io.FileReader("fileName.js")); in a java method to access it. but it doesn't detect the js file and always throws the java.io.FileNotFoundException .please help me to solve this matter.
has answer: http://stackoverflow.com/a/24346802
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0
accepted answer: http://stackoverflow.com/a/24346802
has title: access JavaScript file in a java method in tomcat
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/q/24356765
linked to: http://stackoverflow.com/q/4212675
has comment: http://stackoverflow.com/comment/37661134
has answer: http://stackoverflow.com/a/25485021
has comment: http://stackoverflow.com/comment/37661062
type: UnansweredQuestion
tagged with: paragraph
has body: In Java, I want to print a rather long String to the console, but instead of having it printed as one really long line, I'd like to turn it into a nicely formatted paragraph. So example: String something = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890" Would print as abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890 But I would like something like this abcdefghijklmnopqrstuvwxyz1234567890 abcdefghijklmnopqrstuvwxyz1234567890 How to make new lines where appropriate without having to do it manually with \n?
tagged with: java
has comment: http://stackoverflow.com/comment/37661269
has comment: http://stackoverflow.com/comment/37661074
type: Question
tagged with: indentation
answer count: 1
tagged with: string
score: 0
has title: Turning a long string into a paragraph in console in Java

http://stackoverflow.com/comment/37744529
score: 0
type: Comment
type: QuestionComment
has text: that is my code i want to put the value of in the txtfield which is 12223312123
comment on: http://stackoverflow.com/q/24400609

http://stackoverflow.com/a/24304413
type: Answer
answers question: http://stackoverflow.com/q/24304321
has body: I think, past a few days I was developing a simple project which involved the same thing. You can use Scanner to scan the file for the data. And then loop through it to get the data. I would paste the code here and I would share the post link with you, so that if you need any further info, you can get it from there. You can pass the string as the parameter to the method. String character = sc.next(); // read character... // Find the character System.out.println("Searching now..."); getCharacterLocation(character); // here is the parameter as character File reading function is below: File file = new File("res/File.txt"); Scanner sc = new Scanner(file); int lineNumber = 0; int totalLines = 0; boolean found = false; // First get the total number of lines while(sc.hasNextLine()) { totalLines++; sc.nextLine(); System.out.println("Line looping! For Total Lines variable."); } int[] lineNumbers = new int[totalLines]; int lineIndex = 0; System.out.println("Searching in each line..."); sc.close(); sc = new Scanner(file); while(sc.hasNextLine()) { // Until the end /* Get each of the character, I mean string from * each of the line... */ String characterInLine = sc.nextLine().toLowerCase(); if(characterInLine.indexOf(character.toLowerCase()) != -1) { found = true; } lineNumber++; if(sc.hasNextLine()) sc.nextLine(); } System.out.println("Searching complete, showing results..."); // All done! Now post that. if(found) { // Something found! :D System.out.print("'" + character + "' was found in the file!"); } else { // Nope didn't found anything! System.out.println("Sorry, '" + character + "' didn't match any character in file ."); } sc.close(); Yes, I know its a bit messed up code, because I like writing comments and I like to get information of what ever process is being executing and has done executing. To get the whole code for this, go to the link below. http://basicsofwebdevelopment.wordpress.com/2014/05/27/scanning-file-for-particular-string-or-character-searching/
has comment: http://stackoverflow.com/comment/37561883
score: 0

http://stackoverflow.com/comment/40704086
type: AnswerComment
comment on: http://stackoverflow.com/a/24272567
type: Comment
has text: It is a spring web application project . i looked at your posts it is more of swing . can you pls help me ?
score: 0

http://stackoverflow.com/comment/37708288
comment on: http://stackoverflow.com/q/24381570
score: 0
has text: Do you have any controller that handle the URL `/loginView`?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24417246
type: AnsweredQuestion
upvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24430415
score: -2
accepted answer: http://stackoverflow.com/a/24430415
has title: Yield calculation
tagged with: java
downvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/37774842
has body: In my portfolio application I have a table with stock title and portfolio weight. For each stock title I'm downloading prices for a specific time window. Now I'm trying to calculate the average portfolio rate return. Formula per day: Ypf(d) = (W1 * Y1(d)) + (W2 * Y2(d)) + … + (Wn * Yn(d)) Formula Portfolio: (Ypf(1) + Ypf(2) + ... + Ypf(dn)) / n &gt; W1 = weight of 1st stock in table &gt; W2 = weight of 2nd stock in table &gt; Y1 = yield of 1st stock in table &gt; Y2 = yield of 2nd stock in table &gt; d = current day n = total days I am stuck here and seeking for help.... public void calcAvgYield() { for (Stock s : pfTable.getItems()) { // get list of prices for stock title List&lt;Double&gt; vl = s.getValue(); // new list for calculated yield List&lt;Double&gt; yl = null; // get weight for stock title int w = s.getWeight(); // get list size int i = vl.size()-1; // calculate yield for each day and fill new list with results while (i &gt; 0) { yl.add(((s.getValue().get(i) - s.getValue().get(i-1)) / s.getValue().get(i-1)) * 100); i--; } } } Stock class: public class Stock { private final SimpleStringProperty symbol = new SimpleStringProperty(); private final SimpleIntegerProperty weight = new SimpleIntegerProperty(); private List&lt;Double&gt; value = new ArrayList&lt;Double&gt;(); private List&lt;String&gt; date = new ArrayList&lt;String&gt;(); public String getSymbol() { return symbol.get(); } public void setSymbol(String symbol) { this.symbol.set(symbol); } public Integer getWeight() { return weight.get(); } public void setWeight(Integer weight) { this.weight.set(weight); } public List&lt;Double&gt; getValue() { return value; } public void setValue(ArrayList&lt;Double&gt; value) { this.value = value; } } Thanks.
has answer: http://stackoverflow.com/a/24429195
possible better answer: http://stackoverflow.com/a/24417337
tagged with: math
has answer: http://stackoverflow.com/a/24417337
has comment: http://stackoverflow.com/comment/37774698

http://stackoverflow.com/comment/37501241
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24272357
type: AnswerComment
has text: I've added the entire buildConfig application. Please take a gander

http://stackoverflow.com/comment/37675145
type: AnswerComment
type: Comment
has text: do you have any more suggestions?
comment on: http://stackoverflow.com/a/24328314
score: 0

http://stackoverflow.com/q/24322085
has comment: http://stackoverflow.com/comment/37596291
score: 0
answer count: 1
tagged with: jdbc
has answer: http://stackoverflow.com/a/24322348
has title: In spring declarative transaction management when transaction commited
has body: As describe in question , where actually transaction get committed in spring desclarative transaction mangament. For e.g suppose i have following code @Service @Transactional class CustomerAService{ public void processCustomer(Customer customer){ //call dao and insert customer furtherProcessCustomer(Customer customer); //last line (a) } @Transactional(propagation=Propagation.REQUIRES_NEW) public void furtherProcessCustomer(Customer customer){ //call another dao do some db work //last line (b) } } suppose if i stop execution @ line //last line (a) so will trasaction get commited for processCustomer() method. I tried to search on net but didn't get much information
tagged with: spring
has comment: http://stackoverflow.com/comment/37594659
tagged with: spring-mvc
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/12390888
tagged with: transactions
tagged with: java
accepted answer: http://stackoverflow.com/a/24322348
type: Question

http://stackoverflow.com/comment/37587405
type: Comment
comment on: http://stackoverflow.com/a/24311197
type: AnswerComment
has text: Probably worth mentioning that you'll want to do something like `set path=%path%;C:\Program Files (x86)\Java\jre7\bin`.
score: 0

http://stackoverflow.com/a/24361481
has comment: http://stackoverflow.com/comment/37670209
upvote count: 4
has comment: http://stackoverflow.com/comment/37670313
accepted answer of: http://stackoverflow.com/q/24361442
downvote count: 0
has comment: http://stackoverflow.com/comment/37670019
score: 4
has comment: http://stackoverflow.com/comment/37670247
has comment: http://stackoverflow.com/comment/37670042
type: AcceptedAnswer
has body: Change this apkList.setAdapter(new ApkAdapter(this, packageList1, packageManager)); to apkList.setAdapter(new ApkAdapter(getActivity(), packageList1, packageManager)); this in Fragment does not refer to valid context. Also LayoutInflater inflater; // declare as instance variable Then in the constructor public ApkAdapter(Context context, List&lt;PackageInfo&gt; packageList, PackageManager packageManager) { super(); inflater = LayoutInflater.from(context); // can initialize here
has comment: http://stackoverflow.com/comment/37670442
has comment: http://stackoverflow.com/comment/37670252
type: Answer
answers question: http://stackoverflow.com/q/24361442

http://stackoverflow.com/a/24389598
has comment: http://stackoverflow.com/comment/37723163
has comment: http://stackoverflow.com/comment/37723918
has comment: http://stackoverflow.com/comment/37723175
upvote count: 5
has comment: http://stackoverflow.com/comment/37722779
score: 4
has comment: http://stackoverflow.com/comment/37722659
has comment: http://stackoverflow.com/comment/37723291
has body: You can use EnumSet.range() method passing the required range. EnumSet&lt;SomeEnum&gt; enumSet = EnumSet.range(SomeEnum.EXAMPLE_B, SomeEnum.EXAMPLE_D);
has comment: http://stackoverflow.com/comment/37723564
has comment: http://stackoverflow.com/comment/37722674
has comment: http://stackoverflow.com/comment/37722800
type: Answer
has comment: http://stackoverflow.com/comment/37722734
has comment: http://stackoverflow.com/comment/37723978
has comment: http://stackoverflow.com/comment/37723083
has comment: http://stackoverflow.com/comment/37722843
has comment: http://stackoverflow.com/comment/37723423
has comment: http://stackoverflow.com/comment/37722957
has comment: http://stackoverflow.com/comment/37723054
has comment: http://stackoverflow.com/comment/37723748
downvote count: 1
has comment: http://stackoverflow.com/comment/37723549
answers question: http://stackoverflow.com/q/24389533

http://stackoverflow.com/a/24325833
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/87550196
type: Answer
accepted answer of: http://stackoverflow.com/q/24305512
has comment: http://stackoverflow.com/comment/37658923
answers question: http://stackoverflow.com/q/24305512
score: 17
has body: You can pass in a ResourceBundle.Control which, regardless of requested Locale, always searches only the root ResourceBundle: ResourceBundle rootOnly = ResourceBundle.getBundle("labels", new ResourceBundle.Control() { @Override public List&lt;Locale&gt; getCandidateLocales(String name, Locale locale) { return Collections.singletonList(Locale.ROOT); } });
upvote count: 17
downvote count: 0
has comment: http://stackoverflow.com/comment/37652907

http://stackoverflow.com/comment/37673328
has text: it seems it works now, don't know why, but it does. i just compiled with JME sdk and copied all libraries out of the mobile folder to my eclipse lib folder.
score: 0
comment on: http://stackoverflow.com/q/24362029
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37774024
comment on: http://stackoverflow.com/q/24416881
has text: The JVM starts the main thread, which can in turn start other threads.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/37803479
score: 0
has text: @WillKru i tried doing Body testBody = world.createBody(tempBodyDef); testBody.createFixture(tempFD); but that doesnt seem to work for my program so i modified it to world.createBody(testBody).createFixture(tempshape, 50.0f); which compiled
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24419505

http://stackoverflow.com/comment/37717236
has text: the actual problem was that caused the original ClassCastException was that I had an entity bean with dubious naming for accessor methods. Which means in concrete terms an Account entity with the following methods Agent getAgent(), void setAgent(Agent), boolean isAgent(). It seems that the Getter in the AbstractEntityTuplizer was calling the isAgent() method rather than the getAgent() method, hence later on down the line it was trying to set the Agent as "true" i.e. the result of isAgent, rather than Agent - the result of getAgent. Hope that saves someone the time it took me
comment on: http://stackoverflow.com/q/24301813
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24322095
accepted answer: http://stackoverflow.com/a/24323719
has body: I want to marshal and unmarshal like below: I want to unmarshal xml from value to HashMap class A{ private String name; private List list; } class B{ private Map <String, String> map; } Xml: name value value I want to unmarshal the xml to Class A. I was using @XmlAnyElement. When I unmarshal A at with a large size XML Blist.size=100000, the performance is not ideal. What should I do to improve the performance?
tagged with: java
tagged with: jaxb
score: 0
has answer: http://stackoverflow.com/a/24323719
answer count: 1
has title: How to improve Jaxb unmarshaller performance
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37596356
has comment: http://stackoverflow.com/comment/37596106
type: Question

http://stackoverflow.com/q/24425791
downvote count: 1
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/24426713
answer count: 1
has comment: http://stackoverflow.com/comment/37790291
has title: Bound Mismatch on new object of generic class
has comment: http://stackoverflow.com/comment/37790385
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/37790937
has comment: http://stackoverflow.com/comment/37813631
has body: I have an error occuring with a program for an assignment. In it, I have to create an own generic public class LinkedList&lt;E extends Comparable&lt;T&gt;&gt; implements List&lt;E&gt; { the implemented Interface is: public interface List&lt;E extends Comparable&lt;T&gt;&gt; { } Now, whenever I try to create a new object of the type LinkedList as follows: LinkedList&lt;Termin&gt; k = new LinkedList&lt;Termin&gt;(); eclipse gives me the following error: Bound mismatch: The type Termin is not a valid substitute for the bounded parameter > of the type LinkedList the class declaration of the class Termin is as follows: public class Termin implements Comparable&lt;T&gt; { } in case you need the constructor and variables of the LinkedList object: private E item; private LinkedList&lt;E&gt; next; //Constructor public LinkedList() { item = null; next = null; } With a little google magic, I also found out that there once was a bug involving generics in eclipse that gave the same error for no reason. I suppose some of my declarations aren't entirely correct.
type: AnsweredQuestion
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/24426713

http://stackoverflow.com/comment/37547071
type: Comment
has text: please be more specific
comment on: http://stackoverflow.com/q/24296886
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37786154
type: Comment
comment on: http://stackoverflow.com/a/24423398
has text: Thanks EJP. My problem is : have to use single stream/channel for both header and content. I will try to solve with nio socketChannel. I m thinking, for header part will send using socketChannel->socket->outputstream then flush output stream after that same socketChannel will use as argument for FileChannel.transferTo. will get back, if got any problem. meanwhile, please suggest me if this is not a correct way to solve this problem...
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37707346
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24381522
has text: So will we get multiple inheritance features in that way ?

http://stackoverflow.com/q/24273328
favorite count: 0
has comment: http://stackoverflow.com/comment/37502359
tagged with: linked-list
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37502322
has title: Fastest way to remove the null elements in a list
has answer: http://stackoverflow.com/a/24273529
downvote count: 1
tagged with: list
has body: Is there a quick way of removing the null elements from a linked list? The only way i know is to iterate on the elements and remove the null ones. I don't see how multithreading would help-- linked list doesn't have direct access to its members. //////////////////////////////// EDIT: One I could think of is putting the elements into a set then back to the list again. This wouldn't retain the order, However would work every otherwise(?)
has comment: http://stackoverflow.com/comment/37502338
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/37502347
type: Question
has comment: http://stackoverflow.com/comment/37502409
has comment: http://stackoverflow.com/comment/37502313
upvote count: 0
has comment: http://stackoverflow.com/comment/37502266
has answer: http://stackoverflow.com/a/24273490
has answer: http://stackoverflow.com/a/24273986
tagged with: data-structures
has comment: http://stackoverflow.com/comment/37502394
has comment: http://stackoverflow.com/comment/37502664
has comment: http://stackoverflow.com/comment/37502524
has comment: http://stackoverflow.com/comment/37502554
has answer: http://stackoverflow.com/a/24273404
answer count: 4

http://stackoverflow.com/comment/37584462
type: QuestionComment
comment on: http://stackoverflow.com/q/24315952
type: Comment
has text: It's the same without it too.
score: 0

http://stackoverflow.com/q/24395746
has body: Currently large library i am compiling on Linux outputs shared library as: libxxx1.1.so.0.0.0 Problem arises when i try to load it in java's System.loadLibrary(..); What can i do to make compiled so be simple libxxxx.so?
tagged with: java
type: Question
tagged with: shared
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24398474
tagged with: autoconf
tagged with: linux
tagged with: makefile
has answer: http://stackoverflow.com/a/24398474
has title: Disabling version suffix/extension in autoconf or makefile
type: AnsweredQuestion

http://stackoverflow.com/comment/37716530
comment on: http://stackoverflow.com/q/24386283
score: 0
type: Comment
type: QuestionComment
has text: I dont which hibernate version you are using, but upto version 4.3.5, i still have problems with fetch=FetchType.LAZY on the @OneToMany annotation. and only works with @LazyCollection(LazyCollectionType.TRUE) hibernate equivalence

http://stackoverflow.com/a/24395995
score: 1
has body: Processing is an environment/language which is based on Java. You can find more information about it here: http://processing.org/ As far as getting that library working, it might be fairly simple to port it. Processing's syntax is nearly identical to Java's. You'll have to make proper Java classes for everything if that hasn't already been done.
has comment: http://stackoverflow.com/comment/37738208
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24395738
type: Answer
answers question: http://stackoverflow.com/q/24395738
upvote count: 1

http://stackoverflow.com/comment/37598506
type: QuestionComment
comment on: http://stackoverflow.com/q/24322414
has text: `color.toString().toLowerCase() + "block.png"` if you use that you can get rid of the switch statement
score: 0
type: Comment

http://stackoverflow.com/a/24278016
type: Answer
answers question: http://stackoverflow.com/q/24277942
has body: How about BiMap&lt;Integer, T&gt; A bimap (or "bidirectional map") is a map that preserves the uniqueness of its values as well as that of its keys. This constraint enables bimaps to support an "inverse view", which is another bimap containing the same entries as this bimap but with reversed keys and values.
score: 3
has comment: http://stackoverflow.com/comment/37510833
upvote count: 3
has comment: http://stackoverflow.com/comment/37510894
downvote count: 0

http://stackoverflow.com/comment/37579831
comment on: http://stackoverflow.com/q/24314353
has text: Can you please provide a minimal code sample that produces this Exception? It helps to identify the problem.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37692953
comment on: http://stackoverflow.com/a/24372721
score: 0
type: Comment
has text: Beautiful explanation. @azurefrog.
type: AnswerComment

http://stackoverflow.com/comment/37735580
comment on: http://stackoverflow.com/a/24395611
score: 0
type: AnswerComment
type: Comment
has text: The scheme relies on the OTP never being reused and upon secure escrow of the keys. The problem then becomes one merely of key distribution. "If the key is truly random, and at least as long as the plaintext, and never reused in whole or in part, and kept completely secret, then the resulting ciphertext will be impossible to decrypt or break.[1][2]" <wikipedia>

http://stackoverflow.com/comment/37516533
type: AnswerComment
score: 0
type: Comment
has text: @omu_negru Yes, that would be better for this specific case. In the general case you need to understand this behaviour to do threading properly though.
comment on: http://stackoverflow.com/a/24281076

http://stackoverflow.com/a/43303382
downvote count: 2
answers question: http://stackoverflow.com/q/24284257
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/73672195
has body: public tuna(int h, int m, int s){ this(h,m,s); //with hours, minutes and seconds } Insead of this(h,m,s); use setTime(h,m,s); It should be: public class tuna { private int hour; private int minute; private int second; public tuna() { this(0,0,0); //default } public tuna(int h){ this(h,0,0); //with hours input } public tuna(int h, int m){ this(h,m,0); //with hours and minutes } public tuna(int h, int m, int s){ setTime(h,m,s); //with hours, minutes and seconds } // define setTime method below
type: Answer

http://stackoverflow.com/comment/37832585
comment on: http://stackoverflow.com/a/24431495
type: Comment
has text: I think the undertow fix will be shipped with Wildfly 9. In the meantime, you can use Spring Framework 4.0.6 as soon as it's out (in a few days) with a non-beta undertow version.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/37648437
comment on: http://stackoverflow.com/q/24350273
has text: @dasblinkenlight You could post that as an answer.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37766889
comment on: http://stackoverflow.com/q/24413096
score: 0
type: Comment
type: QuestionComment
has text: Your `List` contains `Object[]` objects, not `Route` objects. How did you break type safety?

http://stackoverflow.com/q/24405893
has comment: http://stackoverflow.com/comment/37757952
has comment: http://stackoverflow.com/comment/37753421
tagged with: struts2
has answer: http://stackoverflow.com/a/24405999
answer count: 1
has body: I have issue in Struts2. The scenario is given below: I have a group of radio buttons (All unselected at first time), then i select one of them and i could get the corresponding value in Action class when submitted the page. &lt;s:radio id="autopayCardId" name="paymentType" list="autopayQualCardMap" /&gt; &lt;s:radio id="autopayNewCardId" name="paymentType" list="autopayNewCardMap" /&gt; &lt;s:radio id="bankAutopay" name="paymentType" list="autopayEFTMap" /&gt; &lt;s:radio id="paymentMethodId" name="paymentType" list="autopayPaymentMethodMap" /&gt; JS code: document.getElementById('autopayCardId').checked=false; document.getElementById('autopayNewCardId').checked=false; document.getElementById('bankAutopay').checked=false; document.getElementById('paymentMethodId').checked=false; Then again come back on same page, i make all radio button unselected through above JavaScript and submit the page. In Action class i am getting previous selected value of radio button instead of validation actionError like "Please select one radio button". I am stuck here, could someone please help me out. I will appreciate your help!!! Thanks
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38128796
tagged with: java
downvote count: 1
linked to: http://stackoverflow.com/q/17167178
has comment: http://stackoverflow.com/comment/38128493
type: Question
has comment: http://stackoverflow.com/comment/37756763
upvote count: 0
has comment: http://stackoverflow.com/comment/37756721
has title: Radio button returning old value if previously selected-submitting and now deselected-submitted in struts2
score: -1

http://stackoverflow.com/q/24406883
has comment: http://stackoverflow.com/comment/38029273
type: UnansweredQuestion
tagged with: tempdir
upvote count: 4
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/62784257
downvote count: 0
favorite count: 0
tagged with: nio2
type: Question
tagged with: windows
has title: Files.createTempDirectory("") throws NullPointerException
has body: When I call Files.createTempDirectory("") I get the below exception: java.lang.NullPointerException at sun.nio.fs.WindowsSecurityDescriptor.fromAttribute(WindowsSecurityDescriptor.java:353) at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:220) at java.nio.file.Files.newByteChannel(Files.java:315) at java.nio.file.Files.createFile(Files.java:586) at java.nio.file.TempFileHelper.create(TempFileHelper.java:138) at java.nio.file.TempFileHelper.createTempFile(TempFileHelper.java:161) at java.nio.file.Files.createTempFile(Files.java:803) None of the examples of the usage of Files.createTempDirectory("") I have found passed in any FileAttributes. I have tried with Files.createTempDirectory("", new FileAttribute&lt;?&gt;[] { }); but it did not help either. I am using 32 bit JDK 7 on Windows 7 system. I am not local admin on the machine. Has anybody come accross this? UPDATE 1: Files.createTempFile(this.tempDir.toPath(), "tmpFile", ""); seems to have the same problem. As a workaround I have moved to com.google.common.io.Files.createTempDir().
score: 4
tagged with: java
has comment: http://stackoverflow.com/comment/37886713
answer count: 1
has answer: http://stackoverflow.com/a/56377834

http://stackoverflow.com/comment/37722128
score: 3
has text: Have you tried running `clean` from the play console? Also, this should be in your plugins.sbt: `resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"`
comment on: http://stackoverflow.com/q/24388995
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37683318
score: 1
has text: Why don't you try debugging your code?
comment on: http://stackoverflow.com/q/24368627
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24356592
answer count: 1
tagged with: autocompletetextview
has title: AutoCompleteTextView Filter doesn't show the filtered list
tagged with: android
accepted answer: http://stackoverflow.com/a/24356963
type: AnsweredQuestion
has body: I have a problem with my filter in my custom Adapter for my AutoCompleteTextView. It doesn't want to show the filtered list. I know that the filter filters my list because for example I have "Paris/FRANCE" in my list and when I type it in the AutoCompleteTextView, the list is still shown but it continues to show the complete list and not the filtered list. If I type "Pary", the list disappear after typing the "Y" letter. That's why I know that the filter works. Here is my code: public class AutoCompleteAdapter extends ArrayAdapter&lt;String&gt; implements Filterable { private ArrayList&lt;String&gt; data; public AutoCompleteAdapter(Context context, int resource, ArrayList&lt;String&gt; objects) { super(context, resource, objects); data = objects; } @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi; vi = LayoutInflater.from(getContext()); v = vi.inflate(R.layout.item, null); } String s = getItem(position); if (s != null) { TextView city = (TextView)v.findViewById(R.id.city); TextView country = (TextView)v.findViewById(R.id.country); String[] split = s.split("/"); city.setText(split[0]); country.setText(split[1]); } return v; } @Override public Filter getFilter() { return new Filter() { @Override protected FilterResults performFiltering(CharSequence prefix) { FilterResults fr = new FilterResults(); if(prefix != null) { ArrayList&lt;String&gt; filtered = new ArrayList&lt;String&gt;(); for(String s : data) { if(s.toLowerCase().contains(prefix.toString().toLowerCase())) { filtered.add(s); } } fr.values = filtered; fr.count = filtered.size(); } return fr; } @SuppressWarnings("unchecked") @Override protected void publishResults(CharSequence contraint, FilterResults results) { data = (ArrayList&lt;String&gt;)(results.values); if(results != null &amp;&amp; results.count &gt; 0) { notifyDataSetChanged(); } else { notifyDataSetInvalidated(); } } }; } } Please forgive me for my bad english …
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37660761
has answer: http://stackoverflow.com/a/24356963
score: 0

http://stackoverflow.com/q/24331218
score: 0
accepted answer: http://stackoverflow.com/a/24334170
tagged with: jsonexception
has body: I am using the Facebook SDK with Eclipse to send requests to friends, I want to include additional information for the application in the "data" field. I keep getting the error java.lang.String cannot be converted to JSON object, no matter what I try. I've tried retrieving the data in a JSONArray and retrieving the specific values in JSONObjects, to no avail. I'd really appreciate it if you could tell me what I'm doing wrong. I've included the relevant code below. The badge of awesomeness and social karma values are placeholders, copied from the facebook tutorial here: https://developers.facebook.com/docs/android/send-requests the request-sending code, straight from the example (apart from the message field): private void sendRequestDialog() { Bundle params = new Bundle(); params.putString("title", "Send a Request"); params.putString("message", application.getUserId()+" has invited you to an event!"); String idHolder = ids.get(0); for (int i = 1; i &lt; ids.size(); i++) { idHolder = idHolder+"," + ids.get(i); // a for-loop to get all selected // user ids in the recipients // list (starting at 1 to // prevent comma placement // issues) } params.putString("to", idHolder); // comma seperated list of facebook // IDs to preset the recipients. params.putString("data", "{\"badge_of_awesomeness\":\"1\"," + "\"social_karma\":\"5\"}"); WebDialog requestsDialog = ( // initializes a web dialog, sends the // requests parameters to the stored // IDs, displays errors in sending new WebDialog.RequestsDialogBuilder(this, Session.getActiveSession(), params)).setOnCompleteListener(new OnCompleteListener() { @Override public void onComplete(Bundle values, FacebookException error) { if (error != null) { if (error instanceof FacebookOperationCanceledException) { Toast.makeText(getApplicationContext(), "Request cancelled", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getApplicationContext(), "Network Error", Toast.LENGTH_SHORT).show(); } } else { final String requestId = values.get…
has answer: http://stackoverflow.com/a/24334170
has comment: http://stackoverflow.com/comment/37611609
tagged with: android
tagged with: facebook
has title: Please help a newbie having trouble with the following: String cannot be converted to JSON object
has comment: http://stackoverflow.com/comment/37612318
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/37613383
answer count: 1
has comment: http://stackoverflow.com/comment/37614087
has comment: http://stackoverflow.com/comment/37611603

http://stackoverflow.com/comment/37728648
type: Comment
has text: How about a even fresher documentation: [Using the Quartz Scheduler](http://docs.spring.io/spring/docs/4.0.4.RELEASE/spring-framework-reference/htmlsingle/#scheduling-quartz).
comment on: http://stackoverflow.com/a/24392466
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37799638
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24409690
type: Comment
has text: @olgacosta Well your solution works for Firefox but not for Chrome. And mine works for Chrome and not for Firefox. Weird browsers. I hard-coded both the height and width for now.

http://stackoverflow.com/comment/37511171
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24277891
has text: if your writing a jsp or jsf page, then u can call this jquery on change event of the drop down event handler which is already attached with element.
score: 0

http://stackoverflow.com/a/24275262
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/24273589
score: 2
has body: Your fragment raises several l important points: A component's use of opacity is the determined by UI delegate supplied by the user's chosen Look &amp; Feel; it should not be modified except in the course of creating a new L&amp;F. Don't use setBounds(), or similar, when you really mean to override getPreferredSize(); alternatively, use a border, as shown below. Swing GUI objects should be constructed and manipulated only on the event dispatch thread. Following these guidelines, I see no flickering. import java.awt.Color; import java.awt.EventQueue; import java.awt.event.MouseEvent; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.event.MouseInputAdapter; /** * @see https://stackoverflow.com/a/24275262/230513 */ public class Test { private void display() { JFrame f = new JFrame("Test"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(new PopUpPanel("Test popup panel")); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); } private static class PopUpPanel extends JPanel { public PopUpPanel(final String info) { final JTextArea textArea = new JTextArea(info); setBackground(Color.WHITE); setBorder(BorderFactory.createTitledBorder("Test")); add(textArea); MouseInputAdapter mouseHandler = new MouseInputAdapter() { @Override public void mouseEntered(final MouseEvent e) { System.out.println(e); } @Override public void mouseExited(final MouseEvent e) { System.out.println(e); } }; addMouseListener(mouseHandler); } } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { new Test().display(); } }); } }
answers question: http://stackoverflow.com/q/24273589

http://stackoverflow.com/a/24315476
accepted answer of: http://stackoverflow.com/q/24314840
answers question: http://stackoverflow.com/q/24314840
has body: To change the data in the table you use: table.setValueAt(...); This will update the data in the TableModel. However, adding a JPanel to the table is not the way a table is designed to be used. Typically you add data to the model. Then you use a renderer to display the data in a cell. Start by reading the section from the Swing tutorial on Using Custom Renderers for more information and examples.
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/24403967
accepted answer: http://stackoverflow.com/a/24404213
downvote count: 1
has body: I have below two classes import java.util.*; public interface Stack&lt;Item&gt; extends Iterable&lt;Item&gt;{ void push(Item item); Item pop(); boolean isEmpty(); int size(); Iterator&lt;Item&gt; iterator(); } Second class is the : import java.util.*; public class LinkedStack&lt;Item&gt; implements Stack&lt;Item&gt;{ private Node head; private int size; private class Node{ Item item; Node next; public Node(Item item){ this.item = item; } public Node(Item item, Node next){ this.item = item; this.next = next; } } public boolean isEmpty(){ return(head == null); } public int size(){ return size; } public void push(Item item){ head = new Node(item,head); size++; } public Item pop(){ Item item = head.item; head = head.next; size--; return item; } public Iterator&lt;Item&gt; iterator(){ return new LinkedStackIterator&lt;Item&gt;(); } class LinkedStackIterator&lt;Item&gt; implements Iterator&lt;Item&gt;{ private Node current = head; public boolean hasNext(){ return current != null; } public Item next(){ Item return_item = current.item; current = current.next; return return_item; } public void remove(){}; } } I am getting typecast error in method public Item next(): Item return_item = current.item; If I write above line as Item return_item = (Item) current.item; It works fine. Can anybody suggest the reason? I am getting below compilation error: LinkedStack.java:57: error: incompatible types Item return_item = current.item; ^ required: Item#2 found: Item#1 where Item#1,Item#2 are type-variables: Item#1 extends Object declared in class LinkedStack Item#2 extends Object declared in class LinkedStack.LinkedStackIterator 1 error
type: Question
has title: Getting error during compiling java program
has comment: http://stackoverflow.com/comment/37749999
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37749812
type: AnsweredQuestion
upvote count: 2
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37749888
has comment: http://stackoverflow.com/comment/37750146
has answer: http://stackoverflow.com/a/24404213

http://stackoverflow.com/q/24354150
tagged with: java
type: Question
tagged with: jakarta-ee
has title: What extension / plugin / provider mechanisms could be used for making my web application extensible?
tagged with: service-provider
has body: I am working on a JavaEE web application which shall be able to fetch data from different sources. The data will be fetched and persisted in a database for later processing and reporting. I started with one default data provider covering a specific source but would like to design the application architecture in a way that either me or even others could write data providers / data provider plugins for different data sources. The service providers could be implemented independed from the core application and could be packaged in separated jars. Once dropped to the web applications classpath the provider implementation would be recognized as service providers by the application core that is triggering the data fetching job. I am looking for a standard way of implementing this SPI or extension points, but it shall not bloat my application's code. I thought of "OSGI extension points" but this is more for rcp platform applications and mine is a web application. So I ruled it out for now. My second idea is a combination of predefined provider interfaces and then the use of custom "provider" annotations to mark the implementing classes (the service providers). What mechanisms / approaches / frameworks can you recommend to solve this architectural question? Many Thanks in advance &amp; Cheers, Michael
score: 0
has answer: http://stackoverflow.com/a/24354172
answer count: 1
accepted answer: http://stackoverflow.com/a/24354172
tagged with: pluggable
type: AnsweredQuestion

http://stackoverflow.com/a/24353069
score: 0
answers question: http://stackoverflow.com/q/24350785
type: AcceptedAnswer
type: Answer
has body: As discussed in the comments, you can only use { if (e instanceof UsernameNotFoundException) return; // Log exception } at the beginning of your advice. There is no syntactic way in either AspectJ or Spring AOP to somehow use jokers or boolean expressions in the "throwing" part. There you only have the option to either capture all exceptions or implicitly narrow down the selection to one specific type (and its subtypes) by binding the thrown exception to a typed variable. If you think about it, how should you bind an object to a variable having multiple types? Whether you like it or not, this is the correct answer. I cannot change AspectJ syntax and semantics for you now. :-)
accepted answer of: http://stackoverflow.com/q/24350785

imageicon
tags question: http://stackoverflow.com/q/24375716
tags question: http://stackoverflow.com/q/24314840
tags question: http://stackoverflow.com/q/24356834
tag name: imageicon
tags question: http://stackoverflow.com/q/24272384
type: Tag

http://stackoverflow.com/comment/37715640
comment on: http://stackoverflow.com/a/24372470
has text: No. Sometimes you are interested in all solutions, or the "best" five (if you can compare two solutions). But from the moment you sometimes need to "destroy" a part of what you have constructed earlier in order to reassign variables, it is called a backtracking algorithm.
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/comment/37731443
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24393901
type: Comment
has text: I don't want to guess. Update your question. Add what your code currently looks like and the exception it's currently throwing and its message and stacktrace.

http://stackoverflow.com/comment/37737592
type: AnswerComment
has text: I'm looking for an example or a sample code in plain JSPs or Servelts... I'm Editing my question... Thank You..
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24396879

http://stackoverflow.com/comment/37499730
type: Comment
score: 2
comment on: http://stackoverflow.com/q/24271778
has text: Avoid using `System.exit()` anywhere except the top-level `main()` method with the only purpose to return an exit code. Always use exceptions in all other cases. See http://www.javapractices.com/topic/TopicAction.do?Id=86.
type: QuestionComment

http://stackoverflow.com/q/24302714
has comment: http://stackoverflow.com/comment/37557810
has title: C# server Socket to Android Socket over NAT
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/24303584
tagged with: c#
has body: The Android app is behind a NAT (3G connection) , while the server is on a public IP. The Android app can connect to the server socket and send data (via Socket/TCPclient on android) but the server cannot connect to the Android port because of the NATs (server getting "... has failed to respond "ip_adress_of_android : port_that_is_open_and_listening_on_android". Is there anyway to overcome this, or some parameters I can use in order for the server connection attempt to reach it's destination over the NATs without using a custom library? - or could you please point me to an easy to implement method, I don't have time to study and integrate a complicated 3rd party library Here is a sample of how my server code works: int port_server, port_android; // used to declare used ports by the server and android Socket server_socket, client_socket; //sockets used to receive and send data server_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); server_socket.Bind(new IPEndPoint(IPAddress.Any, port_server)); server_socket.Listen(0); public void listen() { server_socket.BeginAccept(new AsyncCallback(AcceptCallback), null); } private void AcceptCallback(IAsyncResult AR) { client_socket = server_socket.EndAccept(AR); buffer = new byte[client_socket.ReceiveBufferSize]; client_socket.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, new AsyncCallback(ReceiveCallback), null); } private void ReceiveCallback(IAsyncResult AR) { listen(); // to continue listening to the port // code that does something with the data send_string("Take this"); // sends a string to android } public void send_string(string notif) { string ip_client = client_socket.RemoteEndPoint.ToString(); string ip_client2 = (ip_c.Split(':'))[0]; TcpClient client = new TcpClient(ip_client, port_android); Byte[] notifi = System.Text.Encoding.ASCII.GetBytes(notif); NetworkStream stream = client.GetStream(); stream.Write(notifi, 0, notifi.Length); stream.Close(); client.Close(); } I sh…
tagged with: nat
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37558088
type: Question
tagged with: sockets
tagged with: android

http://stackoverflow.com/comment/37552435
comment on: http://stackoverflow.com/q/24299865
score: 1
type: Comment
has text: possible duplicate of [Maven Change a value in a file based on profile](http://stackoverflow.com/questions/2335431/maven-change-a-value-in-a-file-based-on-profile)
type: QuestionComment

http://stackoverflow.com/comment/39813609
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25460867
has text: Hey check my answer out, you can change all kinds of settings by following the Reference Models of Excel http://msdn.microsoft.com/en-us/library/office/ff194068(v=office.15).aspx. Also by using Jacob it makes it easier, was the generated PDF in my answer what you were trying to achieve?
type: Comment

http://stackoverflow.com/comment/37692569
type: AnswerComment
comment on: http://stackoverflow.com/a/24373126
type: Comment
has text: thanks, that makes sense. is there a way to compile java to binary?
score: 1

http://stackoverflow.com/comment/37560633
has text: Did u check this on the android platform? Note: the text can be UTF-8 encoded and can be Chinese, Japanese or Korean.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24302576

http://stackoverflow.com/q/24349861
has title: configure hibernate configuration file
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/31612049
score: 0
has comment: http://stackoverflow.com/comment/37647466
has comment: http://stackoverflow.com/comment/37647318
type: UnansweredQuestion
has body: following is my hibernate.cfg.xml file <?xml version='1.0' encoding='utf-8'?> <hibernate-configuration> com.mysql.jdbc.driver jdbc:mysql://localhost:3306/hibernate root root 1 org.hibernate.dialect.MySQLDialect org.hibernate.cache.NoCacheProvider true create <mapping class="org.javabrains.koushik.dto.UserDetails"/> </hibernate-configuration> Error I am getting is as follows SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml Stack Trace: at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2246) at org.hibernate.cfg.Configuration.configure(Configuration.java:2158) at org.hibernate.cfg.Configuration.configure(Configuration.java:2137) at org.koushik.hibernate.HibernateTest.main(HibernateTest.java:13) Caused by: org.dom4j.DocumentException: Error on line 1 of document : The processing instruction target matching "[xX][mM][lL]" is not allowed. Nested exception: The processing instruction target matching "[xX][mM][lL]" is not allowed. at org.dom4j.io.SAXReader.read(SAXReader.java:482) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2238) ... 3 more I am new to Hibernate. Was following a tutorial. Got this error. Can anybody help me with this??
has comment: http://stackoverflow.com/comment/37647887
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24349928

http://stackoverflow.com/comment/37592315
comment on: http://stackoverflow.com/q/24320724
has text: try finding a web application server that does not store its session in cookies then
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/113125963
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24287372
has text: I have a similar problem but my JAR simply don't have the path javax/persistence. Better you verify within the JAR also.

identifier
tag name: identifier
type: Tag
tags question: http://stackoverflow.com/q/24392123

http://stackoverflow.com/comment/37553533
comment on: http://stackoverflow.com/a/24287588
has text: How can i load the xml configuration file using this approach. @M.Sharma
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37620813
type: AnswerComment
has text: Contact contact is only necessary if cursor.moveToFirst() returns true.
type: Comment
comment on: http://stackoverflow.com/a/24335954
score: 0

http://stackoverflow.com/a/24368340
has comment: http://stackoverflow.com/comment/37682994
score: 2
answers question: http://stackoverflow.com/q/24368236
upvote count: 2
has body: Use zEntry.getMethod() to get the compression method Returns the compression method of the entry, or -1 if not specified. It will return an int which will be public static final int STORED public static final int DEFLATED or -1 if it don't know the method. Docs.
has comment: http://stackoverflow.com/comment/37682968
has comment: http://stackoverflow.com/comment/37683090
type: Answer
has comment: http://stackoverflow.com/comment/37682892
downvote count: 0
has comment: http://stackoverflow.com/comment/37682918

http://stackoverflow.com/a/24372991
has body: You can register to be notified when an object is created. WinEvents provides the infrastructure for this. In your callback you can filter out the object you are interested in. Once found you can retrieve an IAccessible interface and perform the desired action on it, for example IAccessible::accDoDefaultAction.
type: Answer
answers question: http://stackoverflow.com/q/24363891
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/a/24311164
answers question: http://stackoverflow.com/q/24310230
downvote count: 0
score: 1
type: Answer
has body: One possibility would be to cut the applications from your database completely. Instead, have them post jobs on a queue. Have queue workers take jobs from the queue, read/write the database and post the results to some form of result cache. Applications can then poll the result cache for their results. While this doesn't reduce your database read/writes, it allows you to layer your overall application. As an example, you could have a layer for filtering the jobs on the queue, bundle together multiple counter updates and have a worker write them all in one go. The other obvious possibility would be to take a good look at your architecture and decide whether changing the database technology would be desireable. If you don't overly rely on joins, complex SQL queries, etc. have a look at key-value stores or NoSQL. Have a look at Cassandra for performance. This interview is about the architecture of Reddit and it might give you some nice ideas. (It also shows the worker/queue approach that I mentioned)
upvote count: 1

http://stackoverflow.com/comment/37578372
score: 1
comment on: http://stackoverflow.com/a/24310778
type: AnswerComment
has text: @Seal, don't know what to tell you, that's how it works. I've done it more times than I can count. Are you sure that you were operating on an instance of the subclass and not actually an instance of the super class? If you have instantiated the `Drawer` object (assuming it's not abstract) then there's no way it could possibly call the subclass's implementation because it doesn't know about it!
type: Comment

http://stackoverflow.com/q/24269273
has comment: http://stackoverflow.com/comment/37494334
has body: While I'm testing my code in Eclipse, I stopped the program in the console, but I found the threads still keep working. I'm trying to create a pipeline to precess for our continuously incoming data. How can I shut down all the running threads when I stop the program? (Especially when I am using a infinite loop ) Here is my main: public static void main(String[] args) { queue = new ArrayBlockingQueue&lt;StreamQueueItem&gt;(100); LogFileProcessor threadFileProcessor = new LogFileProcessor(queue); new Thread(threadFileProcessor).start(); StreamCoordinator threadStreamCoordinator = new StreamCoordinator(queue); new Thread(threadStreamCoordinator).start(); } Basically first thread is keeping enqueue the BlockingQueue, and the second Thread is keeping pop items out of the queue, and pick a request sender to send a request. The code of StreamCoordinator: public StreamCoordinator(BlockingQueue&lt;StreamQueueItem&gt; mQueue) { super(); this.mQueue = mQueue; this.mThreadPool = Executors.newFixedThreadPool(ConfigConstants.SENDER_THREDPOOL_SIZE); mBqHelper = new BigqueryHelper(ConfigConstants.PROJECT_ID,ConfigConstants.DATA_SET, ConfigConstants.TABLE_EXISTS); } @Override public void run() { StreamQueueItem item = null; while(true){ //wait 1 second for next request try { Thread.sleep(1 * 1000); } catch (InterruptedException e) { e.printStackTrace(); } item = mQueue.poll(); if( item != null){ mThreadPool.execute(new RequestSender(mBqHelper,item)); } } } RequestSender: @Override public void run() { System.out.format("%d is sending request %s . List size: %d %s\n",mSenderId,FormatHelper.currentDate(),mRequestItem.getRowList().size(),mRequestItem.getLogReason().getTableName()); mBqHelper.submitStreamRequest(mRequestItem.getLogReason().getTableName(), mRequestItem.getRowList()); System.out.println("# " + mSenderId + " done. " + FormatHelper.currentDate()); }
has comment: http://stackoverflow.com/comment/37494278
upvote count: 1
has title: What happens to ExecutorService if I stop a running java project
answer count: 1
has comment: http://stackoverflow.com/comment/37495008
favorite count: 0
has comment: http://stackoverflow.com/comment/37494907
tagged with: executorservice
has comment: http://stackoverflow.com/comment/37498012
has answer: http://stackoverflow.com/a/24802759
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: multithreading
type: Question
has comment: http://stackoverflow.com/comment/37501752

http://stackoverflow.com/comment/37647512
has text: Hi, thank you for the reply, I tried registering the the listener but ADT does not detect code hinting and gives the above error given in the code snippet.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24349951

http://stackoverflow.com/q/24283871
has comment: http://stackoverflow.com/comment/37536340
type: Question
accepted answer: http://stackoverflow.com/a/26887642
score: 0
has body: I have a few quartz triggers set-up in my xml file, that has been running for a while now. dailytrigger weeklytrigger and monthlytrigger But I have now added a forth, and am not getting the 4th trigger I have added firing with all triggers in the xml file. But if it is on its own, it fires every time. I also see a trigger firing even thought I don't have it defined in the xml file, so I wondered where else Quartz gets its triggers from?
answer count: 1
has comment: http://stackoverflow.com/comment/37555857
has answer: http://stackoverflow.com/a/26887642
tagged with: spring
type: AnsweredQuestion
has title: quartz cron scheduling where does it read triggers
tagged with: java
tagged with: quartz-scheduler

http://stackoverflow.com/comment/37743484
type: Comment
type: QuestionComment
has text: I have added the filter method which obtains the cookie. The filter checks every request that goes to /javax.faces.resource. The plan is to redirect to the MockAuthenticationServlet if the cookie is not set. Once it is set from the MockAuthenticationServlet it should be redirected back. Again I have to say I see the cookie in the browser, but in the java code when I debug it is empty. The domain is the same 127.0.0.1, just the context path is changed.
comment on: http://stackoverflow.com/q/24397771
score: 0

http://stackoverflow.com/a/24363036
upvote count: 7
answers question: http://stackoverflow.com/q/24362980
has body: When you close a BufferedInputStream, the underlying InputStream is indeed also closed. :)
has comment: http://stackoverflow.com/comment/37672691
has comment: http://stackoverflow.com/comment/37672720
downvote count: 0
has comment: http://stackoverflow.com/comment/37672849
type: Answer
has comment: http://stackoverflow.com/comment/37672665
has comment: http://stackoverflow.com/comment/37672785
score: 7

http://stackoverflow.com/comment/37612691
comment on: http://stackoverflow.com/q/24331671
score: 0
type: Comment
type: QuestionComment
has text: Oh ok, it is a java application, I am coding in Netbeans and it is using a my sql database.

http://stackoverflow.com/a/24943189
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24332302
has body: It really depends on the pool library you are using. If you are using Apache Commons Pool, then set BaseGenericObjectPool.setBlockWhenExhausted(false). Then calls to GenericObjectPool.borrowObject(long borrowMaxWaitMillis) will throw a NoSuchElementException.
downvote count: 0
score: 1

http://stackoverflow.com/comment/37733033
comment on: http://stackoverflow.com/a/24327826
has text: @Remus Added the link to the issue and proposed patch.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37616201
comment on: http://stackoverflow.com/q/24332596
type: Comment
type: QuestionComment
score: 1
has text: the last error is only related to usage of REPL: classes defined in it are getting wrapped

http://stackoverflow.com/q/24407094
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24407478
has comment: http://stackoverflow.com/comment/37756044
has title: Simple java AI response program?
accepted answer: http://stackoverflow.com/a/24407478
has body: Hi I have this program: import java.util.Scanner; public class HowAreYou { public static void main(String[] args) { Scanner in = new Scanner(System.in); String input; System.out.println("How are you?"); input = in.nextLine(); if (input.equals("I'm doing good!")) { System.out.print("That's great to hear!"); } else if (input.equals("I'm not doing too well...")) { System.out.print("Aw I'm sorry to hear that"); } else { System.out.print("Sorry I didn't catch that are you doing good or bad?"); input = in.nextLine(); if (input.equals("good")) { System.out.print("That's great to hear!"); } else if (input.equals("bad")) { System.out.print("Aw I'm sorry to hear that"); } } } } It works fine for the first two responses, and if you enter something other than that it prints "Sorry I didn't catch that are you doing good or bad?" correctly, but I want it to take in a response again after printing that. At the moment after it says "Sorry I didn't catch that are you doing good or bad?" it doesnt allow you to enter anything else.
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37755621
has answer: http://stackoverflow.com/a/24407276
possible better answer: http://stackoverflow.com/a/24407211
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/37755498
has comment: http://stackoverflow.com/comment/37755468
has comment: http://stackoverflow.com/comment/37755729
has answer: http://stackoverflow.com/a/24407211

http://stackoverflow.com/a/24979671
type: Answer
answers question: http://stackoverflow.com/q/24398309
accepted answer of: http://stackoverflow.com/q/24398309
has body: This sounds like it is related to the new use of the Guava library. Adding guava to the dependency pulls and the eclass path in the maven.xml file fixes these errors, according to (1) https://github.com/zeromq/jeromq/issues/174 and (2) https://github.com/zeromq/jeromq/issues/176. You also may have a stale Ant build.xml, and might need to blow that away and regenerate it, if that is what you are using.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/24267834
has comment: http://stackoverflow.com/comment/37491652
tagged with: recursion
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24267972
has comment: http://stackoverflow.com/comment/37491538
tagged with: java
has answer: http://stackoverflow.com/a/24268507
has comment: http://stackoverflow.com/comment/37491394
has title: Add Elements of a 2-Dimensional Array using recursion
has comment: http://stackoverflow.com/comment/37491704
has comment: http://stackoverflow.com/comment/37491819
upvote count: 0
has answer: http://stackoverflow.com/a/27462796
tagged with: arrays
has comment: http://stackoverflow.com/comment/37491462
has answer: http://stackoverflow.com/a/61798064
has comment: http://stackoverflow.com/comment/37491562
has comment: http://stackoverflow.com/comment/37491488
has comment: http://stackoverflow.com/comment/37491612
possible better answer: http://stackoverflow.com/a/24267972
has comment: http://stackoverflow.com/comment/37492013
has comment: http://stackoverflow.com/comment/37491535
answer count: 4
score: -6
favorite count: 0
downvote count: 6
has body: Hey guys I am having problems writing this part of my code. I have to sum up the elements of this 2-dimensional array using recursion. I understand what I need to do but I am not understanding how to implement this to step through the array. I keep receiving errors. Could someone please help me out? import java.util.Scanner; public class Main { public static void main(String[] args) { int[][] a; a = new int[3][4]; int sum = 0; System.out.println("Enter 12 numbers: "); Scanner scan = new Scanner(System.in); for (int i = 0; i &lt; 3; i++) { for (int j = 0; j &lt; 4; j++) { a[i][j] = scan.nextInt(); } } sum = sum2D(a, 0, 0); System.out.println("The sum of the array: " + sum); } public static int sum2D(int a[][], int row, int col) { if (row == a.length-1) { return a[row][col]; } if (col == a[row].length-1) { return a[row][col] + sum2D(a, row++, 0); } return a[row][col] + sum2D(a, row, col++); } }
has comment: http://stackoverflow.com/comment/37491340
accepted answer: http://stackoverflow.com/a/24268507
has comment: http://stackoverflow.com/comment/37492030
type: Question

http://stackoverflow.com/a/24279487
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
has body: Firstly, XPath and CSS selectors are not definitive. There are many XPath and CSS for every element on a page so to say they have the same Xpath and CSS selectors is incorrect. For your example, is there any need to use XPath or combine two selectors? The following CSS would work; form.auto_fs_steps_checkbox input
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24278998
answers question: http://stackoverflow.com/q/24278998

http://stackoverflow.com/a/24279553
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24279405
has body: Addressing your question: take a look at the class java.lang.DecimalFormat - this will allow you to define some output-format for your float-values. But it is usually a bad idea to store monetary values in binary floatinf-point-types (like float or double) since you will run into rounding-issues as soon as you use values like 0.1 (decimal). Better use somthing like java.math.BigDecimal or (I like that even better) a custom-class for storing fixed-point-values that internally uses an ìnt or a long and a some scale.
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24279405

http://stackoverflow.com/a/24351490
upvote count: 2
has comment: http://stackoverflow.com/comment/37650805
has body: Let the class Individu implement the Comparable&lt;Individu&gt; interface in order to make a list of them List&lt;Individu&gt; sortable. class Individu implements Comparable&lt;Individu&gt; { // implementation here ... } Then you can create a list assign elements to it and sort it like that: List&lt;Individu&gt; list = // create list as linked list e.g list.add(i1); list.add(i2); Collections.sort(list); If it is not possible for you to change the class Individu then you can create a Comparator. Leave a comment if further information is required. FYI: This site gives an overview over the concepts around Comparable Comparator using small focussed examples. Hope this helps
score: 2
answers question: http://stackoverflow.com/q/24351459
downvote count: 0
type: Answer

http://stackoverflow.com/q/24294442
upvote count: 1
has comment: http://stackoverflow.com/comment/37607705
has answer: http://stackoverflow.com/a/24329105
has comment: http://stackoverflow.com/comment/37554914
downvote count: 0
has comment: http://stackoverflow.com/comment/37565183
has title: Android(Java) Socket read hung when reading from a Netty Nio server
type: UnansweredQuestion
tagged with: android-networking
tagged with: android
has body: I've implement a Netty server with a pipeline like this: public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline p = ch.pipeline(); p.addLast(new ByteArrayDecoder(), new Byte2MsgHandler() , new ByteArrayEncoder(), new Msg2ByteHandler(), new MsgDispatcher()); } The business logic is in MsgDispatcher(). See below: public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { super.channelRead(ctx, msg); Msg message = (Msg) msg; switch (message.messageType) { case MType.SIGN_UP://sends response to the client if (userValidator.validate(message.user)) { userReg.signUp(message.user); } else { Msg error = new Msg.Builder().messageType(MType.ERROR) .errorCode(Constants.USERREG_NULL).build(); ctx.write(error.toByteArray());// write the response back ctx.flush(); //flush the stream } break; } } I can succesfully send data to the server with the following code from android: public void writeAndFlush(Msg msg) throws IOException { try { bos.write(msg.toByteArray()); bos.flush(); } catch (IOException e) { throw new IOException("Exception writing and flushing Msg to network.", e); } } bos is a bufferedOutputstream from the socket. When I close the serversocket after writing I can sucessfully read the data. Msg error = new Msg.Builder().messageType(MType.ERROR) .errorCode(Constants.USERREG_NULL).build(); ctx.write(error.toByteArray());// write the response back ctx.flush(); //flush the stream ctx.close(); //this result in sucessfull read on android socket. But (without "ctx.close() in the above server code"), it hungs in the while loop(code below): public Msg read() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int read = 0; try { while ((read = bis.read(buffer, 0, buffer.length)) != -1) { Log.e("com.traderreg", "" + read); baos.write(buffer, 0, read); } baos.flush(); } catch (IOException e) { throw new IOException("error reading bytes from socket", e); } try { return wire.pars…
has comment: http://stackoverflow.com/comment/37546966
score: 1
favorite count: 0
type: Question
tagged with: netty
answer count: 1
has comment: http://stackoverflow.com/comment/37543679
tagged with: java

http://stackoverflow.com/comment/37638476
comment on: http://stackoverflow.com/a/24345192
type: AnswerComment
has text: For Java 7 and below, Guava has a `Function` with the same name, but of course it'd also be a rather simple interface to implement yourself.
type: Comment
score: 1

http://stackoverflow.com/comment/58646991
type: Comment
comment on: http://stackoverflow.com/a/35450970
has text: This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment). - [From Review](/review/low-quality-posts/11296693)
type: AnswerComment
score: 0

http://stackoverflow.com/q/24416423
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: apache-kafka
has body: I am converting an application to Kafka 0.8 from Kafka 0.7, and I am having to make use of the new API's for a simple consumer. In doing so I was following along with the examples here and converting to the API from our current implementation. However when creating an OffsetRequest object the example passes a string as the third argument, the jar that I have pulled from the apache kafka expects an arg of type string called "replicaid" I cannot find any documentation on what this is value is, can someone explain what it is and if there are defaults for this like there are on other similar kafka API's I would appreciate knowing what they are. Thank you!
has title: In kafka 0.8 API, what is the replicaId value supposed to be when creating an OffsetRequest?
has answer: http://stackoverflow.com/a/24435871
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24435871

http://stackoverflow.com/a/24286440
type: Answer
answers question: http://stackoverflow.com/q/24286013
has body: To solve the problem go ahead with your modelling. You have to create classes Tr and Td, and add instances of these classes to table instead of adding full string. However I fully agree with guys that mentioned that it is not the best idea to use JAXB for HTML generating. I do not know what is your final aim however although theoretically HTML is a subset of XML there are better tools to operate with it. I can mention however that I personally used XML parsing technique to deal with HTML, however there were other constraints that made me to do this.
upvote count: 1
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37526558

http://stackoverflow.com/comment/37633214
type: AnswerComment
has text: well, I didn't use the Applet class, but using HttpClient I could process the response data.
type: Comment
comment on: http://stackoverflow.com/a/24319182
score: 0

http://stackoverflow.com/comment/37692602
comment on: http://stackoverflow.com/a/24373126
type: AnswerComment
has text: The main benefit of Java is the optimizing Jus-In-Time compiler. The Virtual Maschine executes the ByteCode. After a amount of runs (I think 10000 invocations for a method, this method is compiled into native code. The JVM creates some statistice while running your code. The compiled native code may become faster than native code because of the knowledge of the runtime.
score: 0
type: Comment

http://stackoverflow.com/comment/37502053
has text: A JVM Only ever optimizes BYTECODE not java code. It optimizes by taking comon java patterns and mapping them to more efficient bytecode forms. It never "optimizes your java" http://www.cubrid.org/blog/dev-platform/understanding-jvm-internals/
score: 1
comment on: http://stackoverflow.com/q/24273146
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37665495
type: QuestionComment
comment on: http://stackoverflow.com/q/24339448
has text: Hi @Bruno. The server provides 3 CA certificates that I load to truststore, and a client server that the server uses to authenticate the client who is me.
score: 0
type: Comment

http://stackoverflow.com/comment/37774571
score: 0
comment on: http://stackoverflow.com/q/24416506
type: Comment
type: QuestionComment
has text: it would need *calibrated stereo* to do proper displacement, not consecutive frames from a single cam.

http://stackoverflow.com/comment/37699936
score: 0
type: Comment
has text: Okaay your suggestion solved the first problem. But now when i scroll the list view the app crashes? Any suggestions?
comment on: http://stackoverflow.com/a/24377222
type: AnswerComment

http://stackoverflow.com/q/24350146
has comment: http://stackoverflow.com/comment/37649584
has comment: http://stackoverflow.com/comment/37649519
has comment: http://stackoverflow.com/comment/37649167
tagged with: optimization
has comment: http://stackoverflow.com/comment/37647992
score: 0
has comment: http://stackoverflow.com/comment/37649510
answer count: 2
has comment: http://stackoverflow.com/comment/37649446
has title: Best way to load a large amount of data in android without making the user wait
has comment: http://stackoverflow.com/comment/37649095
has comment: http://stackoverflow.com/comment/37648056
has comment: http://stackoverflow.com/comment/37649357
has comment: http://stackoverflow.com/comment/37648834
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37649546
has answer: http://stackoverflow.com/a/24350873
has comment: http://stackoverflow.com/comment/37649395
tagged with: java
has comment: http://stackoverflow.com/comment/37649586
linked to: http://stackoverflow.com/q/3879992
has comment: http://stackoverflow.com/comment/37649573
type: Question
tagged with: android-contacts
tagged with: performance
has body: I'm working in an application that read phone contacts and use them in my application (Call history, Favorite contacts and All contacts). My UI consist of tab host control and user can swap between them, as I want my data to be shared across all my activities and also to be saved in only one place. So I have created a singleton class called data controller, and when I open the application I show loading screen until all data loaded. The problem now that user is complaining because of waiting a lot of time about (1 minute) every time they open the application when he has a very large amount of contacts, so how can I optimize my code in a good way? EDIT This is the method that I'm using to get all contacts: public static ArrayList&lt;ContactInfo&gt; getAllContactWithNumberAndNameAndPhoto( Context context, boolean starred) { ArrayList&lt;ContactInfo&gt; retList = new ArrayList&lt;ContactInfo&gt;(); ContentResolver cr = context.getContentResolver(); Cursor cur = null; if (starred == true) { cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, "starred=?", new String[] { "1" }, null); } else { cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); } if (cur.getCount() &gt; 0) { while (cur.moveToNext()) { ContactInfo item = new ContactInfo(); String id = cur.getString(cur .getColumnIndex(ContactsContract.Contacts._ID)); String name = cur .getString(cur .getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)); Uri photo = PhoneUtils.getPhotoUriFromID(context, id); String starredValue = cur.getString(cur .getColumnIndex(ContactsContract.Contacts.STARRED)); boolean isFav = false; if (starredValue.equals("1")) isFav = true; if (Integer .parseInt(cur.getString(cur .getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) &gt; 0) { Cursor pCur = cr.query( ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?", new String[] { id }, null); while (pCur.moveToNext()) { String phoneNo = …
has comment: http://stackoverflow.com/comment/37648101
has answer: http://stackoverflow.com/a/24350173

oracle11g
tags question: http://stackoverflow.com/q/24424642
tags question: http://stackoverflow.com/q/24390562
type: Tag
tag name: oracle11g
tags question: http://stackoverflow.com/q/24275081
tags question: http://stackoverflow.com/q/24302955
tags question: http://stackoverflow.com/q/24398976
tags question: http://stackoverflow.com/q/24356983

http://stackoverflow.com/a/24403228
has body: toString() is defined in the Object class. And every other class is an Object. You will always be implicitly extending the Object class. So, you can call any method of the Object class (hashCode(),toString(), wait() etc) on your instance.
score: 0
answers question: http://stackoverflow.com/q/24403200
type: Answer

http://stackoverflow.com/comment/37590718
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24320126
type: QuestionComment
has text: Don't know about joda time. But you can use java.util.Calendar to achieve this. You have start time, and end time as 2 calendar objects. Recursively divide the interval to shorter intervals, by moving the end calendar to the mid point. `endCalendar.setTime(endCalender.getTimeinMillis - (endCalender.getTimeInMillis - startCalender.getTimeInMillis)/2)`

http://stackoverflow.com/comment/37627404
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24339371
has text: Yeah looks like we cannot simply unmarshall it. Trying GSON library.
score: 0

http://stackoverflow.com/comment/37679161
type: AnswerComment
type: Comment
has text: I edited my first post, hoping that this function was what you were asking for. Yes I gave it a try with your exact request, so should be the same alias names. However I think the Hibernate error is due to the fact that I'm mapping some Concentrator object, but there's also a Department field (d.name) and a type field (t.name) in the SELECT. I guess I must specifiy that d.name and t.name are not part of the Concentrator object somehow
comment on: http://stackoverflow.com/a/24365584
score: 0

http://stackoverflow.com/comment/37774434
score: 1
has text: According to this question, it is valid, although the parsers don't allow it for obvious reasons. I dont really care if its not valid JSON as long as I can convert the string format with repeated values into a string format without repeated values http://stackoverflow.com/questions/21832701/does-json-syntax-allow-duplicate-keys-in-an-object
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24416960

pattern-matching
tags question: http://stackoverflow.com/q/24368791
type: Tag
tags question: http://stackoverflow.com/q/24358310
tags question: http://stackoverflow.com/q/24325598
tags question: http://stackoverflow.com/q/24302480
tag name: pattern-matching
tags question: http://stackoverflow.com/q/24402590

http://stackoverflow.com/comment/37735774
comment on: http://stackoverflow.com/a/24396309
type: Comment
has text: The path separator is replaced/normalized because the target folder is generated from the source folder, which uses windows-style path separators.
score: 1
type: AnswerComment

http://stackoverflow.com/a/24351418
upvote count: 2
downvote count: 1
score: 1
has body: Here's the recursive method fixed: int countNrOfInnerNodes (Node node) { if(node == null) { return 0; } if (node.left == null &amp;&amp; node.right == null) { // not an inner node ! return 0; } else { // the number of inner nodes in the left sub-tree + the number of inner // nodes in the right sub-tree, plus 1 for this inner node return countNrOfInnerNodes(node.left) + countNrOfInnerNodes(node.right) + 1; } } Here's the iterative method: int countNrOfInnerNodes(Node node) { if (node == null) return 0; Stack&lt;Node&gt; nodesToCheck = new Stack&lt;Node&gt;(); nodesToCheck.push(node); int count = 0; while (!nodesToCheck.isEmpty()) { Node checkedNode = nodesToCheck.pop(); boolean isInnerNode = false; if (node.left != null) { isInnerNode = true; nodesToCheck.push(node.left); } if (node.right != null) { isInnerNode = true; nodesToCheck.push(node.right); } if (isInnerNode) count++; } return count; }
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24351311
type: Answer
answers question: http://stackoverflow.com/q/24351311

image
tags question: http://stackoverflow.com/q/24345902
tags question: http://stackoverflow.com/q/24268931
tags question: http://stackoverflow.com/q/24405210
tags question: http://stackoverflow.com/q/24295081
tags question: http://stackoverflow.com/q/24338073
tags question: http://stackoverflow.com/q/24286261
tags question: http://stackoverflow.com/q/24336835
tags question: http://stackoverflow.com/q/24371642
tags question: http://stackoverflow.com/q/24272384
tags question: http://stackoverflow.com/q/24377840
tags question: http://stackoverflow.com/q/24275914
tags question: http://stackoverflow.com/q/24347360
tags question: http://stackoverflow.com/q/24361179
tags question: http://stackoverflow.com/q/24302955
tags question: http://stackoverflow.com/q/24359460
tags question: http://stackoverflow.com/q/24333761
tags question: http://stackoverflow.com/q/24416464
tags question: http://stackoverflow.com/q/24363671
tags question: http://stackoverflow.com/q/24270687
tags question: http://stackoverflow.com/q/24386129
tags question: http://stackoverflow.com/q/24371319
tag name: image
tags question: http://stackoverflow.com/q/24356188
tags question: http://stackoverflow.com/q/24329842
tags question: http://stackoverflow.com/q/24327231
type: Tag
tags question: http://stackoverflow.com/q/24304282
tags question: http://stackoverflow.com/q/24275267

http://stackoverflow.com/a/24375690
type: Answer
has body: You have not linked application-context.xml into your web.xml file. This is the problem. Check if you have any entry in your web.xml of your spring configuration file Or: You may have two config files, for example: spring-servlet.xml spring-security.xml So beans defined in one are not able to find those in the other. So you should try something like &lt;import resource="spring-servlet.xml"/&gt; in spring-security.xml .
has comment: http://stackoverflow.com/comment/37696705
upvote count: 1
has comment: http://stackoverflow.com/comment/37696756
answers question: http://stackoverflow.com/q/24375588
has comment: http://stackoverflow.com/comment/37711107
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37696800

http://stackoverflow.com/comment/37771813
type: QuestionComment
has text: I type a "t" in both to test it. it goes to the if part every time and tells me i have the wrong pass or username. and when i use toast to see what i have in my variables from the edit text field they are empty
comment on: http://stackoverflow.com/q/24415313
score: 0
type: Comment

http://stackoverflow.com/comment/37692173
score: 1
type: Comment
comment on: http://stackoverflow.com/q/24373256
type: QuestionComment
has text: No need for the I/O code in your example. You could simplify it to a constant list to save us all from making files.

http://stackoverflow.com/a/24607720
score: 2
has body: You must use the same jars (or at least recent, compatible versions) on the client and server. The error shows you are using the 2.x version jar on the server but a 1.8 jar on the client. Check NetBeans to see if some extension you have loaded has the old driver. You can use the correct jar in your NetBeans project by adding it as a library. If the error is not from NetBeans, check your application's classpath and make sure you have the latest jar in it.
answers question: http://stackoverflow.com/q/24408144
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/q/24405350
linked to: http://stackoverflow.com/q/6684665
type: Question
answer count: 2
has body: In BluetoothChat source code i cannot understand some part of the code- private void sendMessage(String message) { // Check that we're actually connected before trying anything if (mChatService.getState() != BluetoothChatService.STATE_CONNECTED) { Toast.makeText(this, R.string.not_connected, Toast.LENGTH_SHORT).show(); return; } // Check that there's actually something to send if (message.length() &gt; 0) { // Get the message bytes and tell the BluetoothChatService to write byte[] send = message.getBytes(); mChatService.write(send); // Reset out string buffer to zero and clear the edit text field mOutStringBuffer.setLength(0); mOutEditText.setText(mOutStringBuffer); } } Here, I undersatnd that byte[] send is a array but cannot understand why i am intializing this array = message.getBytes(); May be its a very silly question but as i am a beginner so i think i should clear this part. Java experts need your suggestion.
has title: Why using getBytes() method in BluetoothChat
possible better answer: http://stackoverflow.com/a/24405548
has answer: http://stackoverflow.com/a/24405548
has answer: http://stackoverflow.com/a/24405479
has comment: http://stackoverflow.com/comment/37752456
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24405479
score: 0
tagged with: java

ruby-on-rails-4
type: Tag
tags question: http://stackoverflow.com/q/24303468
tag name: ruby-on-rails-4

http://stackoverflow.com/q/24404154
downvote count: 0
score: 1
tagged with: java
type: Question
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/28894071
has body: I can't find a screenshot anywhere - but essentially, when I select text from an EditText on Android (4.0+, I think), a small white bubble saying REPLACE pops up, to allow me to replace the text with other predictions. The same kind of bubble pops up saying PASTE when I long press a field. What class is this? I can't seem to find any reference to it in the developer docs; could somebody help me out? If it's just a custom view, where is it instantiated? I'd like to write an Xposed module that requires this method, but I'm damned if I can find it. Thanks!
favorite count: 0
linked to: http://stackoverflow.com/q/27869983
has title: What is the "Replace" object that pops up when I select text in Android?
type: UnansweredQuestion
tagged with: android
tagged with: android-edittext

http://stackoverflow.com/a/24370296
type: Answer
answers question: http://stackoverflow.com/q/24367829
score: 1
has comment: http://stackoverflow.com/comment/37705353
upvote count: 1
downvote count: 0
has body: See the Weaving Hook specification in the OSGi Core spec. You can implement the hook and weave your annotations into loaded classes as well as add the necessary dynamic import package statements to that the classes have visibility to the package(s) containing your annotations.
has comment: http://stackoverflow.com/comment/37716190

http://stackoverflow.com/comment/37556323
type: AnswerComment
has text: yes but as i have say, i m forced to use @RunWith(PowerMockRunner.class) can i combine both of them? if not i can't use SpringJunit4ClassRunner :( and its seem to be not available in spring 2.0...
type: Comment
comment on: http://stackoverflow.com/a/24301734
score: 0

http://stackoverflow.com/q/24340243
downvote count: 4
tagged with: java
has body: This may be an obvious question, I don't know, but I could not find any answers anywhere. So, I have a JTextField which is getting some text and putting it into a string[] but i want it into an int[] instead. Here's a bit of my code, but of course i have errors with that and I need it to convert to int[]. Any ideas of how i can do this? Also the code i am having trouble with is inside of the button actionevent, just so you find it easily :) Thank you! private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY // //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Will Baker textField9 = new JTextField(); textField10 = new JTextField(); label10 = new JLabel(); label9 = new JLabel(); button5 = new JButton(); // ======== this ======== Container contentPane = getContentPane(); contentPane.setLayout(null); contentPane.add(textField9); textField9.setBounds(90, 15, 273, textField9.getPreferredSize().height); contentPane.add(textField10); textField10.setBounds(90, 40, 273, textField10.getPreferredSize().height); // ---- label10 ---- label10.setText("Loot Name(s):"); contentPane.add(label10); label10.setBounds(new Rectangle(new Point(20, 40), label10 .getPreferredSize())); // ---- label9 ---- label9.setText("NPC Name(s):"); contentPane.add(label9); label9.setBounds(20, 10, 68, 25); // ---- button5 ---- button5.setText("Start!"); button5.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { NPC_NAME = textField9.getText().split(","); LOOT_NAMES = textField10.getText().split(","); running = true; gui.dispose(); } }); contentPane.add(button5); button5.setBounds(90, 70, 208, button5.getPreferredSize().height); { // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i &lt; contentPane.getComponentCount(); i++) { Rectangle bounds = contentPane.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); prefer…
type: Question
has comment: http://stackoverflow.com/comment/37628517
has comment: http://stackoverflow.com/comment/37628508
has answer: http://stackoverflow.com/a/24340273
answer count: 2
has answer: http://stackoverflow.com/a/24340301
upvote count: 1
has comment: http://stackoverflow.com/comment/37628520
favorite count: 0
type: UnansweredQuestion
has title: How can I convert String[] to int[]?
score: -3

http://stackoverflow.com/comment/37790765
type: AnswerComment
comment on: http://stackoverflow.com/a/24425847
type: Comment
has text: @96andrei Actually, it's necessary to change the sprite's position during the `update(float delta)` only if your enemies move :)
score: 0

http://stackoverflow.com/q/24410407
has comment: http://stackoverflow.com/comment/37762792
accepted answer: http://stackoverflow.com/a/24414949
tagged with: access-control
score: 2
type: AnsweredQuestion
has body: I would like to check write permission on folder. Folder may be user.home or something else. Whatever folder I put to the FilePermission, I catch this.. Some code: public class Test { public static void main(String[] args) { AccessController.checkPermission(new FilePermission(System.getProperty("user.home"), "write")); System.out.println("tadam"); } } StackTrace: Exception in thread "main" java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\Users\AntonovDI" "write") at java.security.AccessControlContext.checkPermission(AccessControlContext.java:366) at java.security.AccessController.checkPermission(AccessController.java:560) at ru.inversion.jinved.impl.Test.main(Test.java:19) Why? I know another solution, but I'm still interested in =) Path userHomePath = Paths.get(System.getProperty("user.home")).toAbsolutePath(); if (Files.isWritable(userHomePath)) { System.out.println("tadam"); }
upvote count: 2
has comment: http://stackoverflow.com/comment/37770312
type: Question
has comment: http://stackoverflow.com/comment/37763218
tagged with: java
has comment: http://stackoverflow.com/comment/37880054
has answer: http://stackoverflow.com/a/24414949
answer count: 1
downvote count: 0
has title: AccessControlException when check write folder permission
favorite count: 0

http://stackoverflow.com/q/24367345
type: Question
has title: Starting Elastic Search from java and not form any batch file
score: 0
has body: I ma totally new to this . . . I want to start Elastic search by java code say by a main method `Node node = nodeBuilder().local( true ).node(); Client client = node.client(); node.start();` I used the above code to run it which runs without error but it stops after two seconds only thing that i see in console is log4j:WARN No appenders could be found for logger (org.elasticsearch.node). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. Kindly help guys and here is the link of a similar question but it dint helped starting elasticsearch instance from java?
answer count: 1
tagged with: logstash
type: UnansweredQuestion
tagged with: elasticsearch
has comment: http://stackoverflow.com/comment/37682990
tagged with: java
has answer: http://stackoverflow.com/a/24368767
linked to: http://stackoverflow.com/q/17498853

http://stackoverflow.com/comment/37510388
comment on: http://stackoverflow.com/q/24277699
score: 0
type: Comment
type: QuestionComment
has text: Yes. Right now I'm just running the MainActivity, but even that won't run since I added my custom class to the app package.

http://stackoverflow.com/q/24377105
type: UnansweredQuestion
tagged with: android
tagged with: java
has body: So I am working on an application that has 3 tabs with swipe gestures enabled. The tab containing content for playlists is actually a ListFragment. I am trying to read the names of all the audio files on my SD card and then fill a list with them. AndroidManifest.xml &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.stupidmusicplayer.application" &gt; &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name=".MainActivity" android:label="@string/app_name" android:launchMode="singleTop" android:screenOrientation="portrait" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; This is the code for Adapter package com.example.stupidmusicplayer.application; import java.util.ArrayList; public class playlistArrayAdapter extends ArrayAdapter&lt;String&gt; { private final Context context; private final String[] artistarray; private final ArrayList&lt;String&gt; songarray; public playlistArrayAdapter(Context context, ArrayList songnames, String[] artistnames) { super(context, R.layout.listview_layout, songnames); this.context = context; songarray = songnames; artistarray = artistnames; } @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.listview_layout, parent, false); TextView songName = (TextView) rowView.findViewById(R.id.text1); TextView artistName = (T…
type: Question
has comment: http://stackoverflow.com/comment/87148138
tagged with: listview
score: 0
has title: Android app crashes when filling array list with name of audio files in SD card?
answer count: 1
has answer: http://stackoverflow.com/a/24377222

http://stackoverflow.com/comment/37670381
comment on: http://stackoverflow.com/a/24359788
has text: Then please mark this answer as solved with the green check on the left.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24344069
downvote count: 0
answers question: http://stackoverflow.com/q/24344003
type: Answer
has comment: http://stackoverflow.com/comment/37636159
accepted answer of: http://stackoverflow.com/q/24344003
score: 1
has body: It seems that it's as simple as parameterizing your Node passed in. public Node&lt;T&gt; insert(Node&lt;T&gt; n, T v) Another solution to that would be to have Node itself implement Comparable. public class Node&lt;T extends Comparable&lt;T&gt;&gt; implements Comparable&lt;Node&lt;T&gt;&gt; { // ... }
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/24371903
type: UnansweredQuestion
score: 0
tagged with: windowbuilder
has title: How to access internals of dialogs, created by WindowBuilder?
tagged with: java
has body: It seems to me, that WindowBuilder dialogs are created as things in itseves. I.e. all components are present as local variables in constructor. So, no way to access, initialize or read, data inside them. Why so?
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/24830878

http://stackoverflow.com/comment/37770162
type: QuestionComment
comment on: http://stackoverflow.com/q/24412848
type: Comment
score: 0
has text: public class ArrayList<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, java.io.Serializable{............} @SyamS its not extending java.util.AbstractCollection

http://stackoverflow.com/q/24418904
has body: My attempt at this is: private void jTextField1KeyPressed(java.awt.event.KeyEvent evt) { char c = evt.getKeyChar(); if(c != '1' &amp;&amp; c != '2' &amp;&amp; c != '3' &amp;&amp; c != '4' &amp;&amp; c != '5' &amp;&amp; c != '6' &amp;&amp; c != '7' &amp;&amp; c != '8' &amp;&amp; c != '9' &amp;&amp; c != '0') { evt.consume(); } Which is quite strange, since this is what my book has shown me. Also, is this viable in comparison to a Formatted Text Field?
tagged with: swing
has answer: http://stackoverflow.com/a/24419208
type: AnsweredQuestion
tagged with: keyevent
tagged with: java
tagged with: formatting
accepted answer: http://stackoverflow.com/a/24418996
type: Question
has comment: http://stackoverflow.com/comment/37778233
score: 0
answer count: 3
has title: How do I only allow numbers in a JTextField using a KeyEvent?
has comment: http://stackoverflow.com/comment/37778340
has answer: http://stackoverflow.com/a/24419914
has answer: http://stackoverflow.com/a/24418996
has comment: http://stackoverflow.com/comment/37778389
tagged with: textfield
possible better answer: http://stackoverflow.com/a/24419914

http://stackoverflow.com/comment/37629845
score: 0
type: Comment
type: QuestionComment
has text: the problem is that it doesn't even delete my files from inside the folders
comment on: http://stackoverflow.com/q/24340973

cql
tags question: http://stackoverflow.com/q/24305296
type: Tag
tag name: cql

http://stackoverflow.com/comment/37516965
comment on: http://stackoverflow.com/a/24280753
has text: @UweAllner I edited the answer to add a solution. Maybe you can try something similar?
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37689601
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24371919
type: Comment
has text: @yate It was `java.lang.NumberFormatException` I put NullPointerException instead. Fixed.

http://stackoverflow.com/a/24281416
accepted answer of: http://stackoverflow.com/q/24280415
downvote count: 0
has comment: http://stackoverflow.com/comment/37519196
answers question: http://stackoverflow.com/q/24280415
has comment: http://stackoverflow.com/comment/37519489
score: 5
type: Answer
has body: In a distributed Hadoop cluster each Map/Reduce task runs in it's own separate JVM. So there's no way to share static variable between different class instances running on different JVMs (and even on different nodes). But if you want to share some immutable data between tasks, you can use Configuration class: // driver code Configuration config = Configuration.create(); config.setLong("foo.bar.somelong",1337); ... // mapper code public class SomeMapper ... { private long someLong = 0; public void setup(Context context) { Configuration config = context.getConfiguration(); someLong = config.getLong("foo.bar.somelong"); } }
upvote count: 5
type: AcceptedAnswer

http://stackoverflow.com/q/24301114
tagged with: http-redirect
type: Question
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37554884
score: 32
has answer: http://stackoverflow.com/a/24302616
has body: My objective is to pass model attributes from controller to JSP page during a redirect and avoid the attribute being displayed in URL. The source code below is validating login from datastore using java data objects. Controller: @Controller public class LoginController { int count; PersistenceManager pm = PMF.get().getPersistenceManager(); //Instance of data class User user; ModelAndView modelAndView=new ModelAndView(); @RequestMapping(value="/Login",method = RequestMethod.POST) public ModelAndView loginValidate(HttpServletRequest req){ //Getting login values String uname=req.getParameter("nameLogin"); String pswd1=req.getParameter("pswdLogin"); count=0; user=new User(); //Generating Query Query q = pm.newQuery(User.class); q.setFilter("userName == userNameParam"); q.declareParameters("String userNameParam"); try{ List<User> results = (List<User>) q.execute(uname); for (User u: results) { String userName=u.getUserName(); if(userName.equals(uname)){ System.out.println(u.getPassword()); if(u.getPassword().equals(pswd1)){ count=count+1; modelAndView.setViewName("redirect:welcome"); modelAndView.addObject("USERNAME",uname); return modelAndView; } //rest of the logic } JSP: Welcome ${USERNAME} My current URL is /welcome?USERNAME=robin My goal is to display it as /welcome Also, my page is supposed to display "Welcome robin" whereas it displays only Welcome.
answer count: 2
has answer: http://stackoverflow.com/a/35708928
linked to: http://stackoverflow.com/q/15544398
has title: Passing model attribute during redirect in spring MVC and avoiding the same in URL
downvote count: 0
tagged with: jsp
favorite count: 0
possible better answer: http://stackoverflow.com/a/35708928
has comment: http://stackoverflow.com/comment/37554918
has comment: http://stackoverflow.com/comment/37555254
upvote count: 32
accepted answer: http://stackoverflow.com/a/24302616
has comment: http://stackoverflow.com/comment/37555069

http://stackoverflow.com/q/24316830
score: 0
answer count: 2
favorite count: 0
has body: I am working on sorting WordCount example by frequency of words. I looked for some posts and found out that I can not do sorting by value in a MapReduce. So I decided to make two map reduce jobs separately. Thus the first one is original wordcount and the second one reads the output from the first MapReduce and sorting words by their frequency. The input file the second MapReduce uses is like the following (which is the output of the first MapReduce) 1 apple 2 ball 1 cartoon 4 day And here is the code for the second mapreduce code. I made a Pair class which I think unnecessary here and used it as keys. import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.util.Comparator; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.io.WritableComparable; import org.apache.hadoop.io.WritableComparator; import org.apache.hadoop.io.WritableUtils; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.Partitioner; import org.apache.hadoop.mapreduce.Reducer; import org.apache.hadoop.mapreduce.Reducer.Context; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.input.TextInputFormat; import org.apache.hadoop.mapreduce.lib.input.KeyValueTextInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat; import org.apache.hadoop.mapreduce.lib.jobcontrol.ControlledJob; import org.apache.hadoop.mapreduce.lib.jobcontrol.JobControl; import org.apache.hadoop.util.GenericOptionsParser; import org.apache.hadoop.util.*; //Sorting by valuel public class Sorting { //Using custom writable public static class Pair implements WritableComparable<Pair> { private Text…
has comment: http://stackoverflow.com/comment/37607140
has answer: http://stackoverflow.com/a/24317629
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24320052
possible better answer: http://stackoverflow.com/a/24317629
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37589220
accepted answer: http://stackoverflow.com/a/24320052
has title: Hadoop> WordCount sort by value
tagged with: sorting
tagged with: hadoop

http://stackoverflow.com/q/24322965
score: 3
has answer: http://stackoverflow.com/a/27701742
has comment: http://stackoverflow.com/comment/37597925
has body: I havea java maven3 project in Eclipse IDE with jboss tools installed. I'm using hibenrate4 I'm triing to setup the hibenrate configuratoin in hibernate view to test hql queries, the problem is that is says that it couldnt find the persistence unit. I have the persistence.xml placed in src/main/resources/META-INF/persistence.xml is there some maven config that I nead to set? Persistence.xml &lt;persistence-unit name="ypay"&gt; &lt;provider&gt;org.hibernate.jpa.HibernatePersistenceProvider&lt;/provider&gt; &lt;jta-data-source&gt;java:jboss/datasources/ypay&lt;/jta-data-source&gt; &lt;properties&gt; &lt;!-- Properties for Hibernate --&gt; &lt;!-- &lt;property name="hibernate.hbm2ddl.auto" value="validate" /&gt; --&gt; &lt;property name="hibernate.show_sql" value="false" /&gt; &lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect" /&gt; &lt;/properties&gt; hibernate.properties hibernate.connection.password= hibernate.connection.username=root hibernate.connection.driver_class=com.mysql.jdbc.Driver hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect hibernate.connection.url=jdbc:mysql://****************:3306/ypay?useUnicode=true&amp;amp;characterEncoding=UTF-8 hibernate.connection.provider_class=org.hibernate.connection.DriverManagerConnectionProvider hibernate.datasource= hibernate.transaction.manager_lookup_class=
downvote count: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/43658429
has title: hibernate reverse engineering persistence unit not found
type: Question
has comment: http://stackoverflow.com/comment/37597608
tagged with: jpa
has comment: http://stackoverflow.com/comment/37597280
has comment: http://stackoverflow.com/comment/43657411
upvote count: 3
has comment: http://stackoverflow.com/comment/43966171
has comment: http://stackoverflow.com/comment/37602393
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43776371
has comment: http://stackoverflow.com/comment/37596494
has comment: http://stackoverflow.com/comment/37598033
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/43695262
has comment: http://stackoverflow.com/comment/37597165

http://stackoverflow.com/q/24331200
type: AnsweredQuestion
tagged with: java
tagged with: arduino
has body: I have an Android application that sends and retreives data to/from an Arduino device. package com.arduino.arduinoled1; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.UUID; import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity { private static final String TAG = "Abdel-Domotic"; Button ledOn, ledOff; Button gateOn, gateOff; Button curtOn, curtOff; Button getTemp; TextView temp; OutputStream mmOutputStream; InputStream mmInputStream; Thread workerThread; byte[] readBuffer; int readBufferPosition; int counter; volatile boolean stopWorker; private static final int REQUEST_ENABLE_BT = 1; private BluetoothAdapter btAdapter = null; private BluetoothSocket btSocket = null; private OutputStream outStream = null; // Well known SPP UUID private static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"); // Insert your server's MAC address private static String address = "20:13:12:05:10:24"; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "In onCreate()"); setContentView(R.layout.activity_main); ledOn = (Button) findViewById(R.id.ledOn); ledOff = (Button) findViewById(R.id.ledOff); gateOn = (Button) findViewById(R.id.gateOn); gateOff = (Button) findViewById(R.id.gateOff); curtOn = (Button) findViewById(R.id.curtOn); curtOff = (Button) findViewById(R.id.curtOff); getTemp = (Button) findViewById(R.id.gettemp); btAdapter = BluetoothAdapter.getDefaultAdapter(); checkBTState(); ledOn.setOnCl…
has title: Android - Error while reading data from Bluetooth
type: Question
has answer: http://stackoverflow.com/a/24337364
tagged with: bluetooth
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24337364
tagged with: android

http://stackoverflow.com/comment/37642496
type: QuestionComment
has text: huh, i read about it, but i actually haven't thought about using it yet. It definitely seems feasible to store the CSV file in it. do you have any examples of somebody searching and displaying from sqlite based on multiple variables?
comment on: http://stackoverflow.com/q/24347157
score: 0
type: Comment

http://stackoverflow.com/comment/37783591
type: Comment
has text: @user3777537: than you. see edit. Your equals method is wrong messing up contains.
type: AnswerComment
comment on: http://stackoverflow.com/a/24421845
score: 0

http://stackoverflow.com/a/24352059
type: AcceptedAnswer
has body: Don't. What you are asking is a bad idea. What you can do is add multiple new objects to an Array or Collection. If you don't care about names an ArrayList&lt;Node&gt; will do the job. If you do need names then make them keys in a HashMap&lt;String, Node&gt; or similar. public List&lt;Node&gt; makeThisManyNodes(int count) { List&lt;Node&gt; nodes = new ArrayList&lt;Node&gt;(); for (int i=0; i&lt;count; i++) { nodes.add(new Node()); } return nodes; } static final String NODE_BASE_NAME = "node_%d"; public Map&lt;String, Node&gt; makeThisManyNodes(int count) { Map&lt;String, Node&gt; nodes = new HashMap&lt;String, Node&gt;(); String key; for (int i=0; i&lt;count; i++) { key = String.format(NODE_BASE_NAME, i); nodes.put(key, new Node()); } return nodes; }
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/24351982
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24351982

http://stackoverflow.com/comment/37784255
score: 0
type: Comment
has text: @melchoir55 If you want to make a reference to a statc field: yes. You might have thought of other options - see my second addition.
comment on: http://stackoverflow.com/a/24394377
type: AnswerComment

http://stackoverflow.com/q/24351388
has answer: http://stackoverflow.com/a/24351438
upvote count: 0
answer count: 1
tagged with: user-interface
has title: Building GUI for social networking app
has comment: http://stackoverflow.com/comment/37650480
favorite count: 0
has comment: http://stackoverflow.com/comment/37650442
type: UnansweredQuestion
tagged with: java
downvote count: 2
tagged with: social-networking
type: Question
has body: I am building a social networking app with java(using swing) . Which container Can I use for posts section to have post itself a place for comments and a like button .I also want to merge it with a scroll bar so the post will be displayed upon each other.
score: -2

http://stackoverflow.com/comment/37543985
comment on: http://stackoverflow.com/q/24295081
score: 0
type: Comment
type: QuestionComment
has text: When I check the phone in file explorer, it made a folder called "image.jpg"

http://stackoverflow.com/comment/37557226
score: 0
type: AnswerComment
has text: @BheshGurung I've added the trail link in a footnote; however, I believe that there is sufficient case to make an argument that overloading *is* a [different] form of polymorphism.
type: Comment
comment on: http://stackoverflow.com/a/24298553

http://stackoverflow.com/comment/37718843
has text: Riiight. That makes sense. Seems this question has its duplicate.
score: 0
comment on: http://stackoverflow.com/q/24385571
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37792617
type: Comment
has text: You are not getting the values in to the Excel sheet because you are not passing the values to the servlet. And how are you getting the values to be displayed inside your JSP?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24426612

http://stackoverflow.com/a/24291052
type: Answer
has comment: http://stackoverflow.com/comment/37537312
answers question: http://stackoverflow.com/q/24289689
has comment: http://stackoverflow.com/comment/37537613
upvote count: 4
has comment: http://stackoverflow.com/comment/37537381
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/37537778
has comment: http://stackoverflow.com/comment/37536998
has comment: http://stackoverflow.com/comment/37538810
has body: You actually can select the text nodes between &lt;BR&gt; tags. In HTML (not XHTML) they act as self-closing tags (like &lt;br/&gt;). Based on that behaviour, you could select all text nodes that have a &lt;BR&gt; tag before and after it using: //TABLE[@CLASS='datadisplaytable']/TR/TD[@CLASS="ntdefault"] /text()[preceding-sibling::node()[1][self::BR] and following-sibling::node()[1][self::BR]] That would select also the blank lines and the character text which is not a number. You can get rid of the empty space nodes adding a [normalize-space(.) != ''] to the end of the expression (which will now only return three nodes). And you can select which node you want using a positional predicate at the end of the expression ([1] to select the first node. The expression below selects the text node containing the value 2.000: //TABLE[@CLASS='datadisplaytable']/TR/TD[@CLASS="ntdefault"] /text()[preceding-sibling::node()[1][self::BR] and following-sibling::node()[1][self::BR]][normalize-space(.) != ''][2] Note: I'm assuming your source actually has tag names in uppercase, since in XPath &lt;TD&gt; is not the same as &lt;td&gt;. I'm not sure how tolerant Selenium is about this when parsing HTML.

http://stackoverflow.com/comment/37521214
type: QuestionComment
type: Comment
has text: How do you edit properties files? Are you using any plugin for that?
score: 0
comment on: http://stackoverflow.com/q/24282892

http://stackoverflow.com/q/24299707
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37552438
type: Question
downvote count: 0
possible better answer: http://stackoverflow.com/a/24299983
has answer: http://stackoverflow.com/a/24300068
has comment: http://stackoverflow.com/comment/37552659
has answer: http://stackoverflow.com/a/24299983
favorite count: 0
has answer: http://stackoverflow.com/a/58974757
has answer: http://stackoverflow.com/a/78842333
has body: When I create a new SOAP project in SoapUI 4.6.4, first I have to add initial WSDL url. My initial WSDL URL: http://l:xxxxxxxxxxxxxxx?wsdl. But I'm getting this error: Error loading http://lxxxxxxxx?wsdl: org.apache.xmlbeans.XmlException: java.io.IOException: Server returned HTTP response code: 405 for URL: http://lxxxxxxxx?wsdl So how can I fix this?
answer count: 4
tagged with: soapui
has title: Server returned HTTP response code: 405 for URL
accepted answer: http://stackoverflow.com/a/24300068
upvote count: 1
tagged with: http

http://stackoverflow.com/comment/37688694
type: QuestionComment
has text: What error/exception are you getting?
comment on: http://stackoverflow.com/q/24371465
score: 0
type: Comment

http://stackoverflow.com/comment/99349038
type: AnswerComment
type: Comment
score: 1
has text: Oh, this is really a good answer for me regarding library projects.
comment on: http://stackoverflow.com/a/54750045

http://stackoverflow.com/q/24377299
downvote count: 0
type: UnansweredQuestion
score: 1
has answer: http://stackoverflow.com/a/24377460
tagged with: java
tagged with: criteria-api
type: Question
tagged with: performance
tagged with: criteria
upvote count: 1
has body: What is the advantage of having parameter expressions in criteria api query? ParameterExpression&lt;String&gt; myParameter= criteriaBuilder.parameter(String.class, "name"); criteriaBuilder.equal(someDatabaseColumn,myParameter); query.setParameter(myParameter,"valueOfParameter"); or criteriaBuilder.equal(someDatabaseColumn,"valueOfParameter"); Both the ways, the result is same. But, what is the impact on performance of query with or without using parameters.
answer count: 1
favorite count: 0
has title: Criteria API - advantage of having parameter expressions

http://stackoverflow.com/a/56445975
score: 2
answers question: http://stackoverflow.com/q/24342886
has comment: http://stackoverflow.com/comment/115190847
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/115790776
has body: Try : brew cask install java 8 it will give the below result 8tracksradiohelper adoptopenjdk8 amitv87-pip corretto8 icons8 vmware-fusion8 x48 zulu8 Next enter: brew cask install adoptopenjdk8 ---- java 8 will be installed in Mac.
type: Answer

http://stackoverflow.com/comment/37748678
type: AnswerComment
comment on: http://stackoverflow.com/a/24400470
has text: Is `new HTable(config, "users")` supposed create the table if not existent?
type: Comment
score: 1

http://stackoverflow.com/a/24394540
score: 1
answers question: http://stackoverflow.com/q/24394491
upvote count: 1
has body: I think it's like this: public class TrainingData&lt;T extends Intent&gt; See http://www.angelikalanger.com/GenericsFAQ/JavaGenericsFAQ.html for more info.
type: Answer
downvote count: 0

servlets
tags question: http://stackoverflow.com/q/24359443
tags question: http://stackoverflow.com/q/24294577
tags question: http://stackoverflow.com/q/24321638
tags question: http://stackoverflow.com/q/24382987
tags question: http://stackoverflow.com/q/24330456
tags question: http://stackoverflow.com/q/24316783
tags question: http://stackoverflow.com/q/24351912
tags question: http://stackoverflow.com/q/24424327
tags question: http://stackoverflow.com/q/24329474
tags question: http://stackoverflow.com/q/24304232
tags question: http://stackoverflow.com/q/24302836
tags question: http://stackoverflow.com/q/24269166
tags question: http://stackoverflow.com/q/24370936
tags question: http://stackoverflow.com/q/24291142
tags question: http://stackoverflow.com/q/24363131
tags question: http://stackoverflow.com/q/24383219
tags question: http://stackoverflow.com/q/24290935
tags question: http://stackoverflow.com/q/24375260
tags question: http://stackoverflow.com/q/24339006
tags question: http://stackoverflow.com/q/24403965
tags question: http://stackoverflow.com/q/24317114
tags question: http://stackoverflow.com/q/24301231
tags question: http://stackoverflow.com/q/24285718
tags question: http://stackoverflow.com/q/24349732
tags question: http://stackoverflow.com/q/24272201
tags question: http://stackoverflow.com/q/24388338
tags question: http://stackoverflow.com/q/24329043
tags question: http://stackoverflow.com/q/24304125
tags question: http://stackoverflow.com/q/24270840
tags question: http://stackoverflow.com/q/24338551
tags question: http://stackoverflow.com/q/24366502
tags question: http://stackoverflow.com/q/24278868
tags question: http://stackoverflow.com/q/24405926
tags question: http://stackoverflow.com/q/24354881
tags question: http://stackoverflow.com/q/24349281
tags question: http://stackoverflow.com/q/24405768
tags question: http://stackoverflow.com/q/24336046
tags question: http://stackoverflow.com/q/24331044
tags question: http://stackoverflow.com/q/24356068
tags question: http://stackoverflow.com/q/24304906
tags question: http://stackoverflow.com/q/24282312
tags question: http://stackoverflow.com/q/24325277
tags question: http://stackoverflow.com/q/24305511
tags question: http://stackoverflow.com/q/24352230
tags question: http://stackoverflow.com/q/24302740
tags question: http://stackoverflow.com/q/24403448
tags question: http://stackoverflow.com/q/24285205
tags question: http://stackoverflow.com/q/24358069
tags question: http://stackoverflow.com/q/24298208
tags question: http://stackoverflow.com/q/24421172
tags question: http://stackoverflow.com/q/24405189
tags question: http://stackoverflow.com/q/24310950
tags question: http://stackoverflow.com/q/24339025
tags question: http://stackoverflow.com/q/24371156
tags question: http://stackoverflow.com/q/24413093
tags question: http://stackoverflow.com/q/24372359
tags question: http://stackoverflow.com/q/24422463
tags question: http://stackoverflow.com/q/24295572
tags question: http://stackoverflow.com/q/24303341
tags question: http://stackoverflow.com/q/24409954
tags question: http://stackoverflow.com/q/24360123
tags question: http://stackoverflow.com/q/24406509
tags question: http://stackoverflow.com/q/24273607
tags question: http://stackoverflow.com/q/24385149
tag name: servlets
tags question: http://stackoverflow.com/q/24426612
tags question: http://stackoverflow.com/q/24340973
tags question: http://stackoverflow.com/q/24313456
tags question: http://stackoverflow.com/q/24411770
tags question: http://stackoverflow.com/q/24402674
tags question: http://stackoverflow.com/q/24363392
tags question: http://stackoverflow.com/q/24409124
tags question: http://stackoverflow.com/q/24315074
tags question: http://stackoverflow.com/q/24409860
tags question: http://stackoverflow.com/q/24323715
type: Tag
tags question: http://stackoverflow.com/q/24319087
tags question: http://stackoverflow.com/q/24404827
tags question: http://stackoverflow.com/q/24319378
tags question: http://stackoverflow.com/q/24293933

http://stackoverflow.com/q/24332593
linked to: http://stackoverflow.com/q/4221467
score: 0
duplicate of: http://stackoverflow.com/q/4221467
tagged with: android
favorite count: 0
accepted answer: http://stackoverflow.com/a/24332895
upvote count: 1
has answer: http://stackoverflow.com/a/24332910
downvote count: 1
has title: Why doesnot android application require main method
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37614490
possible better answer: http://stackoverflow.com/a/24332910
has comment: http://stackoverflow.com/comment/37614754
has comment: http://stackoverflow.com/comment/37614368
has body: This is a question out of curiosity and not an actual problem. A stand alone java program that's executable requires a public static void main(String[] args) method. But in android there is no such method. Only thing closest to a main method is the activity defined as category android:name="android.intent.category.LAUNCHER in the manifest. So my question is does android require a main method? If yes how is it generated, is it by parsing the xml file and creating references like R.java in gen folder similar to res folder?? If not how does the execution of my java files start.
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24332895

http://stackoverflow.com/comment/37543767
type: Comment
comment on: http://stackoverflow.com/a/24294871
has text: thanks,you ansered exactly the way i was looking for
score: 0
type: AnswerComment

http://stackoverflow.com/a/24357300
accepted answer of: http://stackoverflow.com/q/24357001
type: Answer
answers question: http://stackoverflow.com/q/24357001
has body: Sorry, looks the question updated during I writing the example code. for the rephrased question, I guess you means the replaceAll take effect but not put back into ArrayList. repalceAll will generate a new String object and not affect the one in the array. so you needs to repaceAll just after read from the file and before "add" it into the ArrayList object. ======================== Try this code snippet, you may needs to tuning the judge of punctuation. public void convert(String filename) throws FileNotFoundException, IOException { List&lt;String&gt; list = new ArrayList&lt;String&gt;(); BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(filename)); String s = reader.readLine(); while (s != null) { // should work in this loop String s1 = s.replaceAll("\\p{Punct}|\\d","").toLowerCase(); list.add(s1.toString()); } } finally { if (reader != null) reader.close(); } for (String s : list) { // will not work in this loop //String s1 = s.replaceAll("\\p{Punct}|\\d","").toLowerCase(); // list.add(s1.toString()); System.out.println(s); } }
type: AcceptedAnswer
score: 0

http://stackoverflow.com/a/77430772
downvote count: 0
type: Answer
has body: You can mock using Mockito: mockStatic(Files.class); when(Files.size(any())).thenReturn(5000L);
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24298077

http://stackoverflow.com/a/24342377
score: 1
answers question: http://stackoverflow.com/q/24342350
type: Answer
has body: Results is not a JSONArray but a JSONObject: JSONObject results = json.getJSONObject("food"); String name = results.getString("name"); JSONObject details = results.getJSONObject("details"); String price = details.getString("price"); You can read more about JSON at json.org.
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/37646163
score: 0
has text: What language is this?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24349207

heap-fragmentation
type: Tag
tag name: heap-fragmentation
tags question: http://stackoverflow.com/q/24331023

http://stackoverflow.com/comment/37621969
has text: That's true, but also can be misleading. In practice, UTC is also regarded as a timezone (basically equivalent to GMT+0). And, indeed, in Java it's one of the available timezones IDs.
comment on: http://stackoverflow.com/a/24336433
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24367553
downvote count: 0
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/24367472
has body: Answering for C++: A new-expression (let's say new A()) is compiled as follows: 1 Check that the default constructor of A is accessible within the context; otherwise, signal a compilation error. 2a If class A has an overloaded allocation function A::operator new(), call it to obtain space for the object. 2b Otherwise, call the allocation function ::operator new() to obtain space for the object. 3 Call the default constructor A::A() in the space obtained from the allocation function.

http://stackoverflow.com/comment/37657691
comment on: http://stackoverflow.com/q/24354117
has text: Don't confuse precedence with order of evaluation.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/37557160
has text: They need to be added to your classpath. Use this to see how it looks:
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24301836

http://stackoverflow.com/q/24354471
possible better answer: http://stackoverflow.com/a/24356813
has answer: http://stackoverflow.com/a/24356813
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: save
type: Question
has title: Saving newly created objects in java
tagged with: object
answer count: 2
accepted answer: http://stackoverflow.com/a/24354535
tagged with: jcheckbox
upvote count: 1
has body: Sorry to keep bugging you guys but I've run into another problem with my program. I can't save my newly created check boxes without getting multiple errors. Basically, I made it so the program generates a new check box whenever you type in whatever you want to name it but the save button I've added isn't saving the program as intended. I'd like to save list and be able to come back and modify it should the need arise. Here are the parts in question that are giving me a hard time. Sorry about the poor formatting. This is largely from an older post and if you scroll down, you will see the saving code. package appchecklist; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Scanner; import javax.swing.*; public class List { public JPanel panel = new JPanel(); Scanner input = new Scanner(System.in); public List() { JButton button = new JButton("Add checkbox"); JButton save = new JButton("Save program"); JButton load = new JButton("load program"); panel.setLayout(new BoxLayout(panel,BoxLayout.Y_AXIS)); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { panel.add(new JCheckBox(input.nextLine())); if (input == null) { System.out.println("Please enter a name for a checkbox"); } panel.revalidate(); panel.repaint(); SwingUtilities.windowForComponent(panel).pack(); } }); save.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { new SaveButton(); } }); load.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { new Loadbutton(); } }); panel.add(button); panel.add(save); panel.add(load); } } } package appchecklist; import java.io.*; public class SaveButton{ public SaveButton() { List savedata = new List(); try { FileOutputStream saveFile = new FileOutputStream("Checklist.java"); ObjectOutputStream save = new ObjectOutputStream(saveFile); save.writeObject(savedata); save.close(); } catch (Exception exc){ exc.printS…
favorite count: 0
has answer: http://stackoverflow.com/a/24354535

http://stackoverflow.com/q/24414958
has comment: http://stackoverflow.com/comment/37770912
tagged with: android
answer count: 0
type: UnansweredQuestion
has title: Add footer to ListView if ArrayList size isn't 0
tagged with: java
has comment: http://stackoverflow.com/comment/37770822
type: Question
score: 0
has body: I only want my footer view to load if the size of my array is greater than 0. If I test it with an if statement, the footer doesn't load at all, even though the size of the array is greater than 0. Here's the code to setup the footer: private void setupFooterView() { footerView = (LoadMoreListItem) getSherlockActivity().getLayoutInflater().inflate(R.layout.load_more, null); footerView.showFooterText(); mListView.addFooterView(footerView); } The onCreateView: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.network_listview, container, false); mListView = (ListView)view.findViewById(R.id.network_listview); aToken = getSherlockActivity().getIntent().getStringExtra("token"); aTokenSecret = getSherlockActivity().getIntent().getStringExtra("token_secret"); context = getSherlockActivity().getBaseContext(); if (timeline_arg.size != 0) { setupFooterView(); // doesnt load if timeline_arg (ArrayList) is not 0 } // nothing special, just sets up baseadapter and passes arraylist attachAdapter(); } Why doesn't this work? It seemed so obvious, but ended up being more complicated than I thought.

http://stackoverflow.com/a/24288825
score: 0
answers question: http://stackoverflow.com/q/24288793
type: AcceptedAnswer
has body: Since you placed those views in the Fragment's layout, they are not part of the activity until the fragment is in place. In short: move the try... code into the Fragment's onCreateView(). And instead of findViewById, use rootView.findViewById(), where rootView is the view that is being returned by the method.
type: Answer
accepted answer of: http://stackoverflow.com/q/24288793

listview
tags question: http://stackoverflow.com/q/24388361
tags question: http://stackoverflow.com/q/24310853
tags question: http://stackoverflow.com/q/24283926
tags question: http://stackoverflow.com/q/24361442
tags question: http://stackoverflow.com/q/24404986
tags question: http://stackoverflow.com/q/24377105
tags question: http://stackoverflow.com/q/24275783
tags question: http://stackoverflow.com/q/24342105
tags question: http://stackoverflow.com/q/24359320
tags question: http://stackoverflow.com/q/24360686
tag name: listview
tags question: http://stackoverflow.com/q/24317097
tags question: http://stackoverflow.com/q/24309224
tags question: http://stackoverflow.com/q/24336696
tags question: http://stackoverflow.com/q/24276522
tags question: http://stackoverflow.com/q/24314518
tags question: http://stackoverflow.com/q/24325610
tags question: http://stackoverflow.com/q/24422202
tags question: http://stackoverflow.com/q/24309871
tags question: http://stackoverflow.com/q/24326482
tags question: http://stackoverflow.com/q/24347032
tags question: http://stackoverflow.com/q/24317217
tags question: http://stackoverflow.com/q/24285185
tags question: http://stackoverflow.com/q/24352070
tags question: http://stackoverflow.com/q/24347786
tags question: http://stackoverflow.com/q/24372535
type: Tag
tags question: http://stackoverflow.com/q/24354285
tags question: http://stackoverflow.com/q/24321668
tags question: http://stackoverflow.com/q/24352293
tags question: http://stackoverflow.com/q/24378561
tags question: http://stackoverflow.com/q/24303266

http://stackoverflow.com/comment/37632574
type: Comment
score: 0
has text: Do you have a reference to confirm this possibility?
type: AnswerComment
comment on: http://stackoverflow.com/a/24342305

http://stackoverflow.com/comment/37714792
has text: http://en.wikipedia.org/wiki/Elastic_collision has the "final speeds". With this you can react to all the collisions that happen on the line that connects the centers of mass of the two objects. ...I'am sorry to tell you that more than this IS "way more complicated". Collisions are REALLY hard...
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24365990

http://stackoverflow.com/comment/37632792
has text: Moreover, instead of traditional synchronization and object locking [Java's concurrent API](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/package-summary.html) should be preferred.
comment on: http://stackoverflow.com/q/24341447
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/37692650
type: Comment
type: QuestionComment
has text: By the way, the title of your question doesn't reflect your actual problem and vice versa. Both questions are interesting though.
comment on: http://stackoverflow.com/q/24373288
score: 0

http://stackoverflow.com/a/24420652
downvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/55826267
has comment: http://stackoverflow.com/comment/55823051
type: Answer
has comment: http://stackoverflow.com/comment/37781306
answers question: http://stackoverflow.com/q/24420209
has comment: http://stackoverflow.com/comment/37781441
upvote count: 2
has body: Unless you are writing an actual random number generator or some kind of encryption library that relies on secure random number generators you don't need to check that if the random number generator is biased or not. That is the job of the author of the Random number generator. Your example of Collections.shuffle() is also a poor example because it is a built in JDK method. There's no reason to test a built-in JDK method, the authors of Java have done that already for you plus the millions of users who have used these methods over the past 20 years. Do you also have tests to confirm System.out.print() works as expected too? Unit tests are supposed to be deterministic. Rerunning the same test over and over again should produce the same results EVERY time. If they don't and the test fails, is it failing because the code is buggy or because the non-deterministic output produced invalid input? If when rerunning the results, the tests pass, is it because the bug was fixed or because we happened to get random input that worked? For these reasons, your unit tests should try to mock or stub out any randomness. Perhaps write several tests that perform specific transformations of the data to test boundary conditions. For example, for shuffle() maybe have a test that reorders the elements in a specific order or sorts the elements in ascending or descending order or a test that doesn't actually do any transformation etc. These are all valid results that could happen randomly. This way the tests all produce the same output for the same input everytime and you get the benefit of different results. EDIT It appears you actually want to test your own random number generator. Here are links that describe statistical tests you should do to see if it is really random (or at least as random as possible) RANDOM.ORG statistical analysis NIST statistical test suite

http://stackoverflow.com/a/65844796
upvote count: 1
has comment: http://stackoverflow.com/comment/121657202
answers question: http://stackoverflow.com/q/24338734
downvote count: 1
score: 0
has body: Some workarounds, Double check that you use the correct signature for your overriding method. If you use any IDE, check if there is any @Override mark/sign/arrow that will ensure your override is valid. Check if you already extend the ResponseEntityExceptionHandler from another class of your project OR from any other class of your dependencies. Put a breakpoint to the ResponseEntityExceptionHandler::handleException method. For the NoHandlerFoundException you should configure the DispatcherServlet to throw and exception if it doesn't find any handlers, link here.
type: Answer
has comment: http://stackoverflow.com/comment/121685140

http://stackoverflow.com/q/24291768
has comment: http://stackoverflow.com/comment/37541768
type: UnansweredQuestion
answer count: 0
score: 1
has title: Add constraints in Max-flow
upvote count: 1
has comment: http://stackoverflow.com/comment/37537798
tagged with: operations-research
type: Question
tagged with: max-flow
tagged with: algorithm
tagged with: java
has comment: http://stackoverflow.com/comment/37541953
has comment: http://stackoverflow.com/comment/37541774
has body: I'm trying to find k(k is given) path using Max-flow from source node s to destination node t with some constraints in graph G= (V, E). Given Different subsets A_i of V, One subset can have one or more than one nodes. Problem is i can use one subset only in one path. I'm using this code Finding max-flow How can i add each subset only can use one path in this code (i mean if i use subset A_1 in path 1 then i can't use A_1 again for other paths ? I'm new in java. I tried to upload my problem picture but i couldn't because i'm new for this side. Thanks
has comment: http://stackoverflow.com/comment/37541641
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/24398622
duplicate of: http://stackoverflow.com/q/867194
upvote count: 10
linked to: http://stackoverflow.com/q/867194
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24398670
has title: Check if ResultSet is empty in Java
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37739974
has body: I am using HSQLDB in my program. I want to check if my Result Set is empty or not. //check if empty first if(results.next() == false){ System.out.println("empty"); } //display results while (results.next()) { String data = results.getString("first_name"); //name.setText(data); System.out.println(data); } The above method is not working properly. According to this post I have to call .first() or .beforeFirst() to rest the cursor to the first row, but .first() and .beforFirst() are not supported in HSQL. I also tried to add connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); but I still get the same outcome (I get the message empty and the data from the DB!!!) What am I doing wrong here?
type: Question
score: 10
answer count: 1
tagged with: jdbc
tagged with: hsqldb
favorite count: 0
accepted answer: http://stackoverflow.com/a/24398670
has comment: http://stackoverflow.com/comment/37745222

http://stackoverflow.com/q/24283397
tagged with: java
linked to: http://stackoverflow.com/q/5183687
tagged with: swing
has comment: http://stackoverflow.com/comment/37521171
type: Question
has answer: http://stackoverflow.com/a/24283957
accepted answer: http://stackoverflow.com/a/24283957
upvote count: 2
linked to: http://stackoverflow.com/q/7054466
has comment: http://stackoverflow.com/comment/37520904
tagged with: user-interface
answer count: 1
favorite count: 0
tagged with: jtabbedpane
has body: How to remove the indents around icon tabs in JTabbedPane? i.e. what would this icon was on the full size of the tabs?
score: 2
type: AnsweredQuestion
has title: How to remove indents in the tabs JTabbedPane?
downvote count: 0

http://stackoverflow.com/q/24383781
has body: I'm new with EhCache, so maybe my question is silly, but anyway: I'm using EhCache with Spring. And have this in my DAO: @Cacheable(value="product", key="#id") public Product getProductById(Integer id) {//some code;} @Cacheable(value="productList") public List&lt;Product&gt; getAllProducts() {//some code;} I want to update my productList cache when I delete or update some product. Can I do smthg like this in my code to resolve this issue (in this example productList and product caches both deleted): @Caching(evict={@CacheEvict(value="productList", allEntries=true), @CacheEvict(value="product", key="#id")}) public boolean deleteProductById(Integer id) { //some code;} Maybe, there is some way to do this without annotation. Be glad for any advice. Thank you.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/57670508
tagged with: spring
has comment: http://stackoverflow.com/comment/37712530
score: 0
tagged with: java
tagged with: annotations
type: Question
has comment: http://stackoverflow.com/comment/37717329
has comment: http://stackoverflow.com/comment/37719130
tagged with: caching
has comment: http://stackoverflow.com/comment/37723953
has comment: http://stackoverflow.com/comment/37719407
has comment: http://stackoverflow.com/comment/37717562
answer count: 1
has title: Spring+EhCache refresh cache list
tagged with: ehcache

http://stackoverflow.com/a/48678482
upvote count: 1
answers question: http://stackoverflow.com/q/24338734
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/97195176
has body: There are some reported situations where both ResponseEntityExceptionHandler and @ControllerAdvice didn't work. Both of them are supposed to compile the methods annotated with @ExceptionHandler under the class into a common place where all the controllers can refer from. If it doesn't work for you. You can add you @ExceptionHandler methods into a common AbstractController class which is extended by all other controllers.
score: 0

http://stackoverflow.com/q/24362732
has answer: http://stackoverflow.com/a/24731408
has body: This is my setup scenario: EAR application with 2 ejbs, 4 war applications One standalone war application, absolute with no dependency on the ear artifacts. Scenario for the standalone war: virtual-host: config-service, at context-root, alias config.mydomain.com Uses jsf templates, such that the user is always on the same page, no redirects. The pages are determined dynamically based on the user action and current state. Wildfly 8 correctly determines jsessionid without any problem. Scenarios for the EAR archives: war1 at virtual-host: war1-web, at contextroot /, alias www.mydomain.com war2 at virtual-host: war2-mobile at contextroot /mobile, alias www.mydomain.com war3 and war4 are at default-host, with contextroot as /war3 and war4 respectively. Problem: When i log into www.mydomain.com everything is fine, every flow and links works fine. Now i log out (destroy current session by invalidating it and so own), and then try to login again: What i see: On my main page, i have jsessionid at path / When i navigate to another page, say /account, i now have 2 jsessionids one at / and another at /account. Further navigate to /account/profile, and now i will have 3 jsessionids: /, /account, /account/profile If i logged in at say: /login, wildfly ignores jsessionid at /, and generates a new one at /login, which of course will not be available at /account, and since some of my pages can only be accessed when logged in, the state at /account says am not logged, and hence i am redirected back to /, which shows that i am logged in now. Reason why application at config.mydomain.com does not show this issue is because i am always on the same path, no links to redirect you anywhere else, and hence everything is cool with wildfly session management. The conetxtroots at /war3 and /war4 are webservices, so in essence, they work since currently they dont need any scenarios of session management. I need to work with java ee7 features, and hence i cannot get back to jboss 7.1 as it has i…
has comment: http://stackoverflow.com/comment/37724837
has title: Wildfly 8 Session Problems in multi-virtual-host configurations
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: jboss
has comment: http://stackoverflow.com/comment/37732335
type: Question
accepted answer: http://stackoverflow.com/a/24731408
tagged with: session
has answer: http://stackoverflow.com/a/26313992
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/26313992
favorite count: 0
has comment: http://stackoverflow.com/comment/37733328
tagged with: wildfly
tagged with: java-ee-7

http://stackoverflow.com/q/24349207
upvote count: 0
has answer: http://stackoverflow.com/a/24349568
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/24349316
type: Question
has answer: http://stackoverflow.com/a/24349243
has comment: http://stackoverflow.com/comment/37646163
has comment: http://stackoverflow.com/comment/37646207
tagged with: java
tagged with: indexoutofboundsexception
downvote count: 3
has comment: http://stackoverflow.com/comment/37646180
has comment: http://stackoverflow.com/comment/37646340
favorite count: 0
has answer: http://stackoverflow.com/a/24349227
has comment: http://stackoverflow.com/comment/37646165
has body: String resultArr[] = response.split("&amp;"); String[] values = resultArr; String name[] = new String[values.length/2]; for(int i = 0;i&lt;values.length-1;i++) { if(i%2==0) { name[i] = values[i]; } }
has title: Getting array index out of bounds exception on this
answer count: 4

http://stackoverflow.com/a/24355079
score: 2
answers question: http://stackoverflow.com/q/24354882
upvote count: 2
has body: MyType#myMethod() is a syntax for JavaDoc so that your documentation can link to a different method's documentation. For example Object.equals()'s javadoc contains text to link to the Object.hashCode() method since they are related. /** * ... * * @see Object#hashCode() */ public boolean equals(Object obj) Where as MyType.myMethod() is the syntx in actual syntax usd in Java code to call the method.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/116074007
type: AnswerComment
type: Comment
has text: This is what my problem was.
comment on: http://stackoverflow.com/a/57787626
score: 1

http://stackoverflow.com/comment/37652651
score: 2
comment on: http://stackoverflow.com/q/24352426
type: Comment
type: QuestionComment
has text: `Ctrl + C` does not do what you think it does if you are talking about command line UI. Instead of copying, it usually sends an interrupt to the running program/thread to stop it completely.

http://stackoverflow.com/comment/37791630
has text: I'm not sure this is intended to work in vaadin 7. A NULL URL is usually meaning that the component is not yet bound to the "output" dom tree. Perhaps it would be better to use request handlers?? https://vaadin.com/book/-/page/advanced.requesthandler.html
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24410805

http://stackoverflow.com/comment/37790118
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24425700
type: Comment
has text: http://stackoverflow.com/questions/156503/how-do-you-assert-that-a-certain-exception-is-thrown-in-junit-4-tests Duplicate?

http://stackoverflow.com/comment/37561074
type: QuestionComment
comment on: http://stackoverflow.com/q/24303444
score: 0
has text: But I'm struggling with that now. Grrr! Why Java, why!
type: Comment

http://stackoverflow.com/comment/39608901
comment on: http://stackoverflow.com/q/24381623
score: 0
has text: Hi, I am also getting the similar issue recently. Any updates you did those helped you? I will be so grateful.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37670497
type: Comment
has text: See, that is vital information for someone to help you fix it. Add it to your question. I can venture a guess that your websocket is on SSL, in which case the url is wss://
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24361342

http://stackoverflow.com/a/24293759
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24292827
type: Answer
accepted answer of: http://stackoverflow.com/q/24292827
score: 2
downvote count: 0
upvote count: 2
has body: This seems to be working: package dummy; import java.util.Collections; import java.util.LinkedList; import java.util.List; class ATransport{} class BTransport{} class A implements Transportable&lt;ATransport&gt; { public ATransport getTransport() { ATransport at=new ATransport(); return at; } } class B implements Transportable&lt;BTransport&gt; { public BTransport getTransport() { BTransport bt=new BTransport(); return bt; } } class X { public static &lt;U, T extends Transportable&lt;U&gt;&gt; List&lt;U&gt; getTransport(List&lt;T&gt; list) { List&lt;U&gt; ret = new LinkedList&lt;&gt;(); for (T t : list) { ret.add(t.getTransport()); } return ret; } public static void main(String[] args) { List&lt;BTransport&gt; transportsB = getTransport(Collections.singletonList(new B())); List&lt;ATransport&gt; transportsA = getTransport(Collections.singletonList(new A())); } } The idea behind this is that we name the type we need and what we get. The only trick is to create as a static method, so the type inference is working there. (Just like in the Collections.singletonList call.) Edit: This is a tutorial for generics explaining the static method trick and some other type inference use cases. This seems to be a useful resource for generics. The basic idea (naming the other type and using in the bound) might have a more general name that I am unaware of, sorry for not giving a reference to that.

http://stackoverflow.com/comment/37782063
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24421130
type: QuestionComment
has text: It completely works, But it starts with a value of 0 and then once you click one of the radio buttons; either add 2 or minus 2 and submit it you can't keep updating the values because it is only replacing the 0 with a 2 or -2. I wan't it to add/subtract 2 and then be able to do it again and have it update each time

http://stackoverflow.com/comment/37722549
type: AnswerComment
has text: Do i need webserver installed on each node to run RMI ?
type: Comment
comment on: http://stackoverflow.com/a/24347174
score: 0

http://stackoverflow.com/comment/114929493
has text: This worked perfectly for my Spring Boot 2.3.6 project. Thank you!
type: Comment
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/59988808

http://stackoverflow.com/comment/37691259
type: Comment
comment on: http://stackoverflow.com/q/24372800
type: QuestionComment
has text: No need to re-invent the wheel: [Commons IO `Tailer`](http://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/input/Tailer.html)
score: 1

http://stackoverflow.com/comment/37561406
comment on: http://stackoverflow.com/q/24304631
score: 0
has text: are you importing a project from a backup?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37519087
has text: @A4L Thanks, but I saw that post and I'm running version 0.12.0 of the tool.
comment on: http://stackoverflow.com/q/24281883
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24294948
has answer: http://stackoverflow.com/a/26653324
tagged with: android
type: UnansweredQuestion
tagged with: java
tagged with: preferenceactivity
type: Question
has body: I am very confused cause it works well if I create the PreferenceActivity in a new project but it's not work if I create it in my current project. I am sure my SDK version is over 14. <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" /> The code is auto-created by eclipse. package com.example.cornerstorepos; import android.annotation.TargetApi; import android.content.Context; import android.content.res.Configuration; import android.media.Ringtone; import android.media.RingtoneManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.preference.ListPreference; import android.preference.Preference; import android.preference.PreferenceActivity; import android.preference.PreferenceCategory; import android.preference.PreferenceFragment; import android.preference.PreferenceManager; import android.preference.RingtonePreference; import android.text.TextUtils; import android.util.Log; import java.util.List; /** * A {@link PreferenceActivity} that presents a set of application settings. On * handset devices, settings are presented as a single list. On tablets, * settings are split by category, with category headers shown to the left of * the list of settings. * * See * Android Design: Settings for design guidelines and the Settings * API Guide for more information on developing a Settings UI. */ public class SettingsActivity extends PreferenceActivity { /** * Determines whether to always show the simplified settings UI, where * settings are presented in a single list. When false, settings are shown * as a master/detail two-pane view on tablets. When true, a single pane is * shown on tablets. */ private static final boolean ALWAYS_SIMPLE_PREFS = false; @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); setupSimplePreferencesScreen(); } /** * Shows the simplified settings UI if the device configuration if the * device configuration dictates that a simplified, single…
linked to: http://stackoverflow.com/q/9961337
tagged with: eclipse
score: 0
answer count: 1
has title: Error Inflating class android.widget.Switch

http://stackoverflow.com/comment/37661417
comment on: http://stackoverflow.com/a/24355958
has text: Apart from the fact that your example code actually can't compile, I have no issues
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37657071
type: Comment
comment on: http://stackoverflow.com/a/24352046
has text: Just share all the POJO classes that your are trying to serialize. I'll try it. or edit in your post whatever you have tried.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37765542
score: 0
type: Comment
has text: @sridhar `StringBuffer` has `synchronized` methods, yes. However, if you create the object **inside** a controller method, it is only referenced with that method. Unless you pass to some other thread, there is no issue. Only one thread will be using it.
comment on: http://stackoverflow.com/a/24411723
type: AnswerComment

http://stackoverflow.com/a/24417822
has comment: http://stackoverflow.com/comment/37789732
downvote count: 0
upvote count: 2
has body: The best way to do it is to include Spring Data into your project. The JPA repositories offer basic CRUD, pagination, sorting and most of your queries could be built automatically from the methods naming convention. Before Spring Data we'd resort to such Generic Daos but not anymore.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24414132

http://stackoverflow.com/a/57795686
has body: There is no way to do it via hbm2ddl. However, you can wire your DataSource into your test suite and then drop the tables directly via the data source. If you go this route you may find it cleaner to also do the creates the same way instead of using hibernate.hbm2ddl.import_files. Something like: @ContextConfiguration(locations = {"spring-dao-test.xml"}) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) public class ExampleDaoTest extends extends AbstractTestNGSpringContextTests { private static final Logger log = Logger.getLogger(ExampleDaoTest.class); @Resource private DataSource dataSource; @BeforeMethod private void createExtraTables() { try { log.info("Creating table extra_table"); dataSource.getConnection().createStatement().execute("CREATE TABLE extra_table ( id number(4) not null )"); } catch(SQLException se) { log.error("Unable to create table extra_table", se); } } @AfterMethod private void dropExtraTables() { try { log.info("Dropping table extra_table"); dataSource.getConnection().createStatement().execute("DROP TABLE extra_table"); } catch(SQLException se) { log.error("Unable to drop table extra_table", se); } } @Test public void testSomeStuff() { } }
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24299965
downvote count: 0
type: Answer

http://stackoverflow.com/comment/37514679
score: 1
type: AnswerComment
has text: Ok, thanks. I dubbuged a bit and also found out, that the listeners become GCed in my case after `removeAll()`. I always used `WeakReferences` e.g. for use with Observers, i wasn't aware of `PhantomReference`s. I will read on about it, thanks!
type: Comment
comment on: http://stackoverflow.com/a/24279295

http://stackoverflow.com/a/24402342
score: 0
type: Answer
has body: You may use: Criterion c = null; for(String s : strArray){ if(c!=null){ c = Restrictions.like("field","%"+s+"%"); else { c = Restrictions.or(c,Restrictions.like("field","%"+s+"%")); } } it's an inefficient way but it's a solution.
answers question: http://stackoverflow.com/q/24372073
has comment: http://stackoverflow.com/comment/37746951

http://stackoverflow.com/a/24337308
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24301647
upvote count: 2
score: 2
has body: I would take a look at creating at what is known as a client node. A client node has node.data set to false, so while it is a full member of the cluster it stores no data locally. This both off-loads query processing from nodes handling document indexing and provides the beginnings of a load balancing approach. The data-less node has significantly lower chance of failure, given that most software failure scenarios for Elasticsearch revolve around blowing out your JVM heap and that is much less likely when you are only doing query processing and not also maintaining indexes. Further, this approach can be extended to a type of local load balancer. If you were to run your client node elasticsearch instance on your application server you effectively provide local load balancing. The node will send out the queries to all other nodes in the cluster that need to be included in a specific query. And since the software is running on the same server as your application software you eliminate the failure mode of the node you are connecting to failing while your app server is still up. This architectural approach is discussed in some detail here: https://blog.liip.ch/archive/2013/07/19/on-elasticsearch-performance.html And a bit more here on client nodes: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-node.html Alternatively, you could use the native Java Elasticsearch api which does not use the REST interface - this allows your Java application to connect as a member node of the cluster, in which case it will know about all the other nodes and will be able to route your queries to the correct node. I'd take a look at both the client node and the transport node approaches: http://www.elasticsearch.org/guide/en/elasticsearch/client/java-api/current/client.html#node-client http://www.elasticsearch.org/guide/en/elasticsearch/client/java-api/current/client.html#transport-client
accepted answer of: http://stackoverflow.com/q/24301647
type: AcceptedAnswer

http://stackoverflow.com/q/24292594
tagged with: jersey
has comment: http://stackoverflow.com/comment/37539216
has comment: http://stackoverflow.com/comment/37544189
answer count: 1
has comment: http://stackoverflow.com/comment/37539543
has body: I am a very very new REST developer. What I am trying to do is to serve all /*.htm request using controllers and all /rest/* requests using Jersey RESTful web services. I don't know how exactly can I make it work. REST request works ok, but if I try to request the index.htm page, it throws NOT FOUND (404) response. This is my web.xml config file: <?xml version="1.0" encoding="UTF-8"?> org.springframework.web.context.ContextLoaderListener contextConfigLocation /WEB-INF/applicationContext.xml jersey-serlvet org.glassfish.jersey.servlet.ServletContainer javax.ws.rs.Application com.ms2.spectrum.security.jersery.JerseyApplication 1 jersey-serlvet *.htm /rest/* redirect.jsp I have google this question, but I did not found any example where RESTful request and page requests coexists on same Spring MVC application. Maybe I did not use correct search words. Thanks in advance. EDIT: Here is the IndexController.java: package com.ms2.spectrum.security.controllers; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.portlet.ModelAndView; @Controller public class IndexController { @RequestMapping("/") public ModelAndView getIndex() { return new ModelAndView("index"); } } EDIT 2: Here is the applicationContext.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd http://www.springframework.org/s…
has comment: http://stackoverflow.com/comment/37538992
has comment: http://stackoverflow.com/comment/37539360
has comment: http://stackoverflow.com/comment/37539316
score: 0
tagged with: rest
has title: How to implement both serve REST (Jersey) request and web page requests using Spring MVC?
has comment: http://stackoverflow.com/comment/37539569
has comment: http://stackoverflow.com/comment/37539958
has answer: http://stackoverflow.com/a/24295513
has comment: http://stackoverflow.com/comment/37539228
tagged with: spring-mvc
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24295513
has comment: http://stackoverflow.com/comment/37540016
tagged with: java
type: Question

spring-validator
tags question: http://stackoverflow.com/q/24318405
tag name: spring-validator
tags question: http://stackoverflow.com/q/24386100
type: Tag

http://stackoverflow.com/comment/37725568
type: QuestionComment
comment on: http://stackoverflow.com/q/24390542
has text: @pulp_fiction Another thing you can do is accumulate points, then raise a bounty on one of the earlier questions.
score: 0
type: Comment

http://stackoverflow.com/comment/37651932
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24352163
has text: You can create your arrays on string.xml file or a new file called arrays.xml

http://stackoverflow.com/a/24385672
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24384765
type: Answer
score: 2
has body: This answer is sufficient and simple if ISOChronology is enough for you: Write the attributes getYear(), getMonthOfYear() and getDayOfMonth() out. Read the three mentioned integer attributes and use this constructor of LocalDate. In the case you need to serialize the Chronology then you are a little bit out of luck and have to study the serialization form of each concrete chronology you need as published in JavaDoc. One example is the serialization form of GJChronology.
answers question: http://stackoverflow.com/q/24384765
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/a/24287840
has comment: http://stackoverflow.com/comment/37529460
type: Answer
has comment: http://stackoverflow.com/comment/37529502
has body: You can create one list for each two instances, than create each of the two using a giving the list as constructor argument. Each object will access its list only, so B1,B2 will use a different list than A1,A2. You can create a Map&lt;String, List&lt;&gt;&gt; that holds name and list. Each time you create an object, get its list from the map. If it doesn't in map, create a new list and put it there.
answers question: http://stackoverflow.com/q/24287393
has comment: http://stackoverflow.com/comment/37530880
has comment: http://stackoverflow.com/comment/37529721
score: 0
has comment: http://stackoverflow.com/comment/37529852

http://stackoverflow.com/q/24308359
has answer: http://stackoverflow.com/a/24308753
has comment: http://stackoverflow.com/comment/37568395
accepted answer: http://stackoverflow.com/a/24308688
type: AnsweredQuestion
score: 2
downvote count: 0
favorite count: 0
type: Question
answer count: 2
tagged with: regex
has comment: http://stackoverflow.com/comment/37568528
has answer: http://stackoverflow.com/a/24308688
has title: How can i get content between dates using java regular expressions
upvote count: 2
possible better answer: http://stackoverflow.com/a/24308753
has body: Below code did not get me the content between dates.can you please help me. String res="05/22/2014 03:22:39.288 ffff gggg kkkkkk lllllll ssss 05/22/2014 03:22:39.288 oooooo ppppp qqqq rrrrrr sss 05/22/2014 03:22:39.378 mmmmmm nnn oooo "; String regEx="((0?[1-9]|1[012])/(0?[1-9]|[12][0-9]|3[01])/((19|20)\\d\\d).*([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9].[\\d]*)(.*?)((0?[1-9]|1[012])/(0?[1-9]|[12][0-9]|3[01])/((19|20)\\d\\d).*([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9].[\\d]*)?"; Matcher matcher = Pattern.compile(regEx).matcher(res); while(matcher.find()) { String group = matcher.group(); System.out.println(group); } Even i tried below using string split with regular expression in java but it gives only one result: String regEx="((0?[1-9]|1[012])/(0?[1-9]|[12][0-9]|3[01])/((19|20)\\d\\d).*([01]?[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9].([\\d][^\\s]+)?)"; String[] split = res.split(regEx);
tagged with: java

http://stackoverflow.com/q/24326324
has answer: http://stackoverflow.com/a/27532095
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: javafx
type: Question
score: 5
has answer: http://stackoverflow.com/a/27536459
accepted answer: http://stackoverflow.com/a/27536459
tagged with: progress-bar
possible better answer: http://stackoverflow.com/a/27532095
has answer: http://stackoverflow.com/a/35624500
answer count: 3
has body: I have a javafx Progressbar in my UI and then I have a for loop. In every iteration of the for loop this happens: progressVal += 5.0; progress.setProgress(progressVal); And after the whole loop, this happens: progress.setProgress(100); I now have recognized that the UI controls are only refreshed after the method has finished, so the progress bar wont update until the end and than would be set to 100 imidiatly. So is it possible so somehow force the UI update, even when the method isn`t finished completly? Or how else could I do this?
has title: JavaFX refresh Progress Bar within a method
favorite count: 0
upvote count: 5
has comment: http://stackoverflow.com/comment/37602458

http://stackoverflow.com/a/25945253
downvote count: 4
has body: The Alert Method, authenticateUsing() lets you skip the Http Basic Authentication box. WebDriverWait wait = new WebDriverWait(driver, 10); Alert alert = wait.until(ExpectedConditions.alertIsPresent()); alert.authenticateUsing(new UserAndPassword(username, password)); As of Selenium 3.4 it is still in beta Right now implementation is only done for InternetExplorerDriver
has comment: http://stackoverflow.com/comment/81765337
has comment: http://stackoverflow.com/comment/48964079
has comment: http://stackoverflow.com/comment/77471938
has comment: http://stackoverflow.com/comment/86252535
has comment: http://stackoverflow.com/comment/62718675
answers question: http://stackoverflow.com/q/24304752
has comment: http://stackoverflow.com/comment/44073673
has comment: http://stackoverflow.com/comment/61315885
type: Answer
has comment: http://stackoverflow.com/comment/44051756
has comment: http://stackoverflow.com/comment/43397430
has comment: http://stackoverflow.com/comment/44078941
has comment: http://stackoverflow.com/comment/45321510
upvote count: 44
has comment: http://stackoverflow.com/comment/85592249
has comment: http://stackoverflow.com/comment/59438482
score: 40
has comment: http://stackoverflow.com/comment/53176501

http://stackoverflow.com/comment/37738213
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24394515
has text: I would not worry about this then. It will take a lot of effort to learn to use GLSL, etc. If you are trying to meet some sort of deadline / software requirements that forbid the use of a third-party library, then for performance you should stick to the original non-GL code path you had. GL can actually hurt your performance if you use it wrong, and this is one example of that.
score: 0

http://stackoverflow.com/a/24274928
has comment: http://stackoverflow.com/comment/37548289
score: 0
type: AcceptedAnswer
has body: Press “Ctrl + Shift + O“ and eclipse will do the import automatically. http://www.mkyong.com/eclipse/how-to-import-class-automatically-in-eclipse/ If it doesn't work, must be a problem of importing the jar to the project.
type: Answer
accepted answer of: http://stackoverflow.com/q/24274409
answers question: http://stackoverflow.com/q/24274409

http://stackoverflow.com/q/24421333
accepted answer: http://stackoverflow.com/a/29059724
type: Question
answer count: 2
downvote count: 0
tagged with: javascript
possible better answer: http://stackoverflow.com/a/69916587
has answer: http://stackoverflow.com/a/69916587
favorite count: 0
has body: While passing JavaScript myScript.jsx to After Effects I want After Effects to exit on completion: "C:\Program Files\Adobe\Adobe After Effects CC\Support Files\AfterFX" -r "C:\Workspaces\MyAEScripts\myScript.jsx" So the very last line in passed JavaScript myScript.jsx script is: app.quit(); Regardless of this command After Effects just doesn't want to quit. I have tried to include an app.exitAfterLaunchAndEval=true; but that didn't help. If I would pass the same javaScript but using AfterEffects.exe -s "here is same javascript ending with; app.quit();" it exits (quits) beautifully. I would stay with passing javascript (using -r). But there is a limit on how many characters can be used on a command line in Windows. I need to be able to make After Effects to exit after it is finished running script passed with -r c:/path/to/myJavaScript.jsx.
tagged with: after-effects
upvote count: 1
type: AnsweredQuestion
has title: How to make After Effects quit after passing -r javascript from command line
has answer: http://stackoverflow.com/a/29059724
score: 1
tagged with: java

http://stackoverflow.com/a/24403687
has comment: http://stackoverflow.com/comment/37941019
has comment: http://stackoverflow.com/comment/37957412
has comment: http://stackoverflow.com/comment/37957085
has comment: http://stackoverflow.com/comment/37956595
downvote count: 0
answers question: http://stackoverflow.com/q/24403325
has comment: http://stackoverflow.com/comment/37898427
type: Answer
has body: Change your code to: @Controller public class YourController { @RequestMapping("test") public ModelAndView gettest() { //some code here if (somecondition) { return new ModelAndView("track/trackvehicle", "JSONdata", vehicleID); } System.out.println("Not present"); return new ModelAndView("track/trackvehicle"); } }
has comment: http://stackoverflow.com/comment/37906985
has comment: http://stackoverflow.com/comment/37898526
has comment: http://stackoverflow.com/comment/37898819
upvote count: 1
has comment: http://stackoverflow.com/comment/37898746
has comment: http://stackoverflow.com/comment/37957245
score: 1

http://stackoverflow.com/q/24422678
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/24257449
upvote count: 5
linked to: http://stackoverflow.com/q/438146
downvote count: 4
has body: Assuming that I've already got a working Spring project what is the minimal amount of configuration needed to add in Hibernate 4 with Spring 3 XML configuration? I want to use annotation based transaction management and have my objects mapped using annotations. Note: This is a self-answer Q&amp;A style question intended to give a canonical answer to a common problem. I intend to expand this question over time to keep up to date with Hibernate.
answer count: 1
tagged with: jpa
accepted answer: http://stackoverflow.com/a/24422679
favorite count: 0
tagged with: spring
has comment: http://stackoverflow.com/comment/37785998
score: 1
has comment: http://stackoverflow.com/comment/37785980
tagged with: java
tagged with: hibernate
has title: Minimal Hibernate 4 XML configuration with Spring 3 for annotation based transaction management and object mapping?
type: Question
has answer: http://stackoverflow.com/a/24422679

http://stackoverflow.com/comment/37614368
comment on: http://stackoverflow.com/q/24332593
has text: @rgamber that link doesnot answer my question
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/24394093
has comment: http://stackoverflow.com/comment/37733201
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24392603
accepted answer of: http://stackoverflow.com/q/24392603
type: Answer
upvote count: 3
has body: You seem to be trying to constrain the position to a circular disk, not a circle which is its boundary. I'd accomplish this by rescaling the offset vector from the center: double dx = event.getX() - 150; double dy = event.getY() - 375; double len = Math.hypot(dx, dy); if (len &gt; 75) { dx = dx*75/len; dy = dy*75/len; } _touchingPoint.x = (int)dx + 150; _touchingPoint.y = (int)dy + 375;
score: 3

http://stackoverflow.com/comment/37604734
score: 2
comment on: http://stackoverflow.com/q/24327634
type: Comment
type: QuestionComment
has text: what code have to tried so far, post it, then someone can help you

http://stackoverflow.com/a/24410339
has body: [0-9]+ is not conditional EDIT According to your valid/invalid inputs the following regex might work for you ([0-9]+[/\\-])?([A-Za-z]|[0-9]+) This basically conditionally evaluates a preceding Number plus a - or a / followed always by either a single Character OR a Number
answers question: http://stackoverflow.com/q/24410235
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37761922
has comment: http://stackoverflow.com/comment/37762388
has comment: http://stackoverflow.com/comment/37761804
has comment: http://stackoverflow.com/comment/37761642
type: Answer
has comment: http://stackoverflow.com/comment/37762522
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24410235
upvote count: 2
has comment: http://stackoverflow.com/comment/37761752

http://stackoverflow.com/comment/37591077
comment on: http://stackoverflow.com/q/24320189
score: 0
has text: @ElliottFrisch: I was asking me the same thing. It is working indeed and I was really wondering if it's still "bad" coding style if used in this context.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37688596
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24275081
has text: I have used loadjava without much more success (I mentionned "going command line" in my original post, which might not have been clear - I've edited). Using the `-verbose` command has given me serveral `ORA-2953` without any more detailed information: they are the same that show up as invalid in Toad.
score: 0

http://stackoverflow.com/comment/37653859
comment on: http://stackoverflow.com/q/24353110
score: 9
has text: Because the method in `IntValue` is **not** an override of the method in `Value`; it has different argument types. And even if it was, overload selection is performed on the static types of arguments, not on the dynamic runtime types.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24397178
has comment: http://stackoverflow.com/comment/37739782
score: 0
has body: I need to update my graphic, In which there are rectangulars. And at each step I need to highlight and modify the status of some of them. But now in my code, for each repaint(), it draw a totally new picture. I have read the followint similar quesion: Keeping draw graphics - removing super.paintComponent ,which cannot solve my problem. The next time it calls repaint(), those rectangulars disappear. It means it erases the prevous graphic. Please help! Here is the code: ("firstPaint = false" is just before the next repaint()) @Override protected void paintComponent(Graphics g2) { super.paintComponent(g2); final Graphics2D g = (Graphics2D) g2.create(); try{ if(firstPaint){ int status; g.setColor(Color.BLACK); for (int i = 0; i &lt; rows; i++) { for (int j = 0; j &lt; columns; j++) { status = current[i][j]; if(status == 1) { g.fillRect(j * 20, i * 20, 20, 20); } } } } if(executeResult == 2){ g.setColor(Color.BLUE); for(Cell c:highlightedCells){ g.drawRect(c.j * 20, c.i * 20, 20, 20); } } if(executeResult == 1){ g.setColor(Color.RED); for(Cell c:highlightedCells){ g.fillRect(c.j * 20, c.i * 20, 5, 5); } } } finally{ g.dispose(); } }
has comment: http://stackoverflow.com/comment/37749059
tagged with: repaint
has comment: http://stackoverflow.com/comment/37746835
has comment: http://stackoverflow.com/comment/37737287
has title: How can it save the previous graphics using repaint() in java?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37737377
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37788055
tagged with: swing
type: Question
tagged with: graphics
linked to: http://stackoverflow.com/q/12810057
has comment: http://stackoverflow.com/comment/37746817
tagged with: jpanel

http://stackoverflow.com/comment/37773180
type: QuestionComment
has text: That project was on 3.9, I moved it to 3.10. The behavior changed in 3.10, it is now too narrow for formula cells. When I `evaluateInCell` all cells before calling `autoSizeColumn` then the columns are all properly sized.
score: 0
comment on: http://stackoverflow.com/q/24374682
type: Comment

http://stackoverflow.com/q/24298854
type: Question
has title: How to Test and Login into PayPal using jMeter?
has body: We had written code using selenium for testing the PayPal login and tried to call the JAR from jMeter. We couldn't get any solution, but instead we're stuck with the errors. Can any one please provide how to Test the PayPal login using jMeter directly ?
has answer: http://stackoverflow.com/a/24307101
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: paypal
score: 2
tagged with: jmeter
tagged with: java

http://stackoverflow.com/comment/37750859
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24404478
has text: don't allow idiots to alter the code, and don't write silly mistakes in it. as soon as you have a developer "debugging" it, thinking that printing a password might help him fix anything faster and forgetting to remove that line, you're in trouble.
type: Comment

http://stackoverflow.com/q/24378747
upvote count: 1
has answer: http://stackoverflow.com/a/35006936
type: Question
has comment: http://stackoverflow.com/comment/37705128
has comment: http://stackoverflow.com/comment/37702257
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37702226
has comment: http://stackoverflow.com/comment/37714101
has body: Can any one please suggest me that how can I create .exe wrapper to install my Java application. Currently Iam using the following command to install my application. "java -jar application.jar" After googling I came to know that we can create .exe by using some third party tool which is open source. But don't know exactly which is best for my requirement. I have only application.jar with me as an input. Thanks In Advance.
has answer: http://stackoverflow.com/a/24378865
answer count: 2
linked to: http://stackoverflow.com/q/6349004
has title: How to create .exe wrapper to install the Java application
downvote count: 0
has comment: http://stackoverflow.com/comment/37702218
favorite count: 0
type: UnansweredQuestion
tagged with: windows
has comment: http://stackoverflow.com/comment/37702360
tagged with: exe
tagged with: installation
linked to: http://stackoverflow.com/q/147181

http://stackoverflow.com/comment/37765425
score: 1
has text: "I need to use stack to create a list storing objects" Well, do you need a `Stack`, or a `List`?. Pick one.
type: Comment
comment on: http://stackoverflow.com/q/24412329
type: QuestionComment

http://stackoverflow.com/comment/37624990
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24333480
type: QuestionComment
has text: This appears to be off-topic because it is not a question. It looks like the poster is using Stack Overflow as his/her own personal blog.

http://stackoverflow.com/a/24344166
upvote count: 1
answers question: http://stackoverflow.com/q/24343943
has comment: http://stackoverflow.com/comment/37638141
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/37639172
score: 1
has comment: http://stackoverflow.com/comment/37637989
has body: You wrote your HQL query as if it was a SQL query. It's not. HQL and JPQL are different languages. HQL never uses table and column names. It always uses entity names and their persistent field names (i.e. personId and not PERSON_ID) and their associations. Joins in HQL consists in navigating through association between entities. HQL queries thus don't have ON clauses. A correct HQL query would be select p from Person p join p.books where p.id = :personId Note that I use a named parameter in the query, that must be bound, instead of using concatenation which is the open door to SQL injection attacks (just as in SQL). The above query would select the person identified by the given ID, unless it doesn't have any book. You don't need any result transformer to get the result of this query: it's a Person instance. I strongly suggest you read the Hibernate documentation, which explains HQL queries. That said, you don't need any query to implement a method to get a person by ID. All you need is Person p = (Person) session.get(Person.class, personId); // now you can display the person and its books.
has comment: http://stackoverflow.com/comment/37637981

http://stackoverflow.com/q/24338416
has title: Using kryonet and amazon aws elastic beanstalk
type: Question
upvote count: 2
tagged with: amazon-web-services
tagged with: kryonet
favorite count: 0
answer count: 0
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: java
has body: Does anyone have any experience they could share with deploying a kryonet server within an amazon aws elastic beanstalk? And a more specific question - do you have to use a fixed ip-address or can it work via the beanstalk's url? If you need to use a fixed ip-address, how does this impact the beanstalk's scaling up?

http://stackoverflow.com/comment/37660630
comment on: http://stackoverflow.com/q/24356431
type: Comment
type: QuestionComment
has text: What are you actually trying to do?
score: 0

http://stackoverflow.com/comment/88469016
type: Comment
has text: or just `brew install homebrew/cask-versions/java8` for the win!
comment on: http://stackoverflow.com/a/46566569
score: 12
type: AnswerComment

http://stackoverflow.com/q/24356580
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37660756
has body: I am trying to read from a json file and get only the phone numbers back i am using java and using the library org.json.simple and i am getting a error that says "Exception in thread "main" java.lang.ClassCastException: org.json.simple.JSONArray cannot be cast to org.json.simple.JSONObject at Heatmap.main(Heatmap.java:21)" import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.Iterator; import java.util.logging.Level; import java.util.logging.Logger; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; public class Heatmap { public static void main(String[] args) { JSONParser parser = new JSONParser(); try { Object obj = parser.parse(new FileReader("c:\\clients.json")); JSONObject jsonObject = (JSONObject) obj; String phone = (String) jsonObject.get("Phone Number"); System.out.println(phone); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } catch (IOException ex) { Logger.getLogger(Heatmap.class.getName()).log(Level.SEVERE, null, ex); } } }
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/24356670
has comment: http://stackoverflow.com/comment/37660862
type: Question
tagged with: arrays
has title: Reading from a json file
score: 0
answer count: 1

http://stackoverflow.com/comment/37565014
score: 0
type: Comment
has text: OK, I think I know what happened. I had to remove the core expression from the handled menu item then re-add it to make it "active". I'd been changing the expression definition but not re-adding it to the menu item and it seems the menu handler wasn't using the latest definition. Possible caching issue?
type: AnswerComment
comment on: http://stackoverflow.com/a/24287274

http://stackoverflow.com/comment/37665575
type: AnswerComment
comment on: http://stackoverflow.com/a/24356800
type: Comment
has text: Well yes, assuming that the socket and server agree on `HTTP`... I don't want to use servlets in this case
score: 0

http://stackoverflow.com/comment/37675489
has text: Ok, he said his API only supports `Long` parameters - if he needs to convert to Long then he can tell us.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24364371
type: Comment

http://stackoverflow.com/a/24356874
upvote count: 7
downvote count: 1
has body: You'll want to add the Servlet API as a "provided" dependency. That is, you only use it to compile the code, but you don't need to package it with your web application since your web container will already contain a copy of it.
answers question: http://stackoverflow.com/q/24356809
has comment: http://stackoverflow.com/comment/95677884
type: Answer
score: 6

http://stackoverflow.com/comment/37610590
comment on: http://stackoverflow.com/q/24316520
score: 0
type: Comment
type: QuestionComment
has text: So you don't actually have a database in place yet? If that's the case then you need to find one that works for you and THEN start learning about and working with that specific API

http://stackoverflow.com/q/24305695
favorite count: 0
tagged with: rally
has answer: http://stackoverflow.com/a/24317231
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: java
type: Question
upvote count: 2
has title: Defects for specific user story from rally
answer count: 1
has body: How to retrieve/obtain the defects for particular user story form rally using rally rest api in java? The following code i have tried. QueryRequest projectRequest = new QueryRequest("Defect"); projectRequest.setProject( "https://rally1.rallydev.com/slm/webservice/v2.0/project/"+prjid); projectRequest.setQueryFilter(new QueryFilter("Requirement", "=", UserR)); //projectRequest.setScopedDown(true); QueryResponse projectQueryResponse = this.restApi.query(projectRequest);

http://stackoverflow.com/comment/37781818
score: 0
has text: @RobG yes java.lang.IllegalStateException: Cannot forward after response has been committed - it is working but nothing is passed
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24420600

pessimistic-locking
type: Tag
tags question: http://stackoverflow.com/q/24308202
tag name: pessimistic-locking
tags question: http://stackoverflow.com/q/24315948

http://stackoverflow.com/comment/37655485
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24353771
has text: @Raghunandan that is my class name.

http://stackoverflow.com/a/24412338
has comment: http://stackoverflow.com/comment/37765634
has body: It is not a good approach, but it's what you have. So yes, define a new jar to handle the common classes for your projects, even if is a single common class. Probably later in your projects you will encounter more classes to use or split this single class into more classes.
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24412130
answers question: http://stackoverflow.com/q/24412130
type: AcceptedAnswer

http://stackoverflow.com/q/24346757
answer count: 1
has title: What is the correct Hibernate Query syntax for a join between two classes / tables?
has comment: http://stackoverflow.com/comment/37641997
has comment: http://stackoverflow.com/comment/37641747
score: 0
has comment: http://stackoverflow.com/comment/37641931
has body: I have been at this for hours without success. For everything I try from other incidents logged here or examples elsewhere, the HQL syntax always seems to be wrong in my method: Session session = sessionFactory.openSession(); try { Query query = session.createQuery("select p from Person p join p.books where p.personId = :personId").setParameter("personId", personId); List&lt;Person&gt; persons = query.list(); Person person = persons.get(0); Hibernate.initialize(person.getBooks()); return person; } finally { session.close(); } And every time Hibernate gives me a message like: Your page request has caused a SQLGrammarException: could not prepare statement error: My two Java classes are: @Entity @Table(name = "PERSON") public class Person implements Serializable { // Attributes. @Id @Column(name="PERSON_ID", unique=true, nullable=false) @GeneratedValue(strategy=GenerationType.AUTO) private Integer personId; @Column(name="NAME", nullable=false, length=50) private String name; @Column(name="ADDRESS", nullable=false, length=100) private String address; @Column(name="TELEPHONE", nullable=false, length=10) private String telephone; @Column(name="EMAIL", nullable=false, length=50) private String email; @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY) private List&lt;Book&gt; books; And: Entity @Table(name = "BOOK") public class Book implements Serializable { // Attributes. @Id @Column(name="BOOK_ID", unique=true, nullable=false) @GeneratedValue(strategy=GenerationType.AUTO) private Integer bookId; @Column(name="AUTHOR", nullable=false, length=50) private String author; @Column(name="TITLE", nullable=false, length=50) private String title; @Column(name="DESCRIPTION", nullable=false, length=500) private String description; @Column(name="ONLOAN", nullable=false, length=5) private String onLoan; @ManyToOne @JoinColumn(name="person_Id") private Person person; Can someone please tell me where I am wrong? Hibernate returns this if is of any use: select person0_.PERSON_ID a…
has comment: http://stackoverflow.com/comment/37641728
has answer: http://stackoverflow.com/a/24346894
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: hql
accepted answer: http://stackoverflow.com/a/24346894
type: Question
has comment: http://stackoverflow.com/comment/37641984
has comment: http://stackoverflow.com/comment/37641913

http://stackoverflow.com/comment/37516549
score: 1
comment on: http://stackoverflow.com/q/24281042
type: QuestionComment
type: Comment
has text: your question is not really clear

http://stackoverflow.com/q/24305890
type: Question
has comment: http://stackoverflow.com/comment/37572730
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37596951
has title: Java 8 map merge method
upvote count: 10
tagged with: merge
tagged with: dictionary
has body: I am trying to create a HashMap that will contain an integer as a key and a list of strings as a value: Map&lt;Integer, List&lt;String&gt;&gt; map = new HashMap&lt;Integer, List&lt;String&gt;&gt;(30); I want to somehow populate it efficiently. What I came up was: map.merge(search_key, new ArrayList&lt;&gt;(Arrays.asList(new_string)), (v1, v2) -&gt; { v1.addAll(v2); return v1; }); This code is small and elegant but my problem is that I create a new List in every call. Is there any way that I can skip the List creation after the first merge, and just add new_string in the first created list?
tagged with: java-8
has answer: http://stackoverflow.com/a/24306085
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24306085
tagged with: java
score: 10

http://stackoverflow.com/a/24353273
has comment: http://stackoverflow.com/comment/37654233
has comment: http://stackoverflow.com/comment/37654181
type: Answer
has comment: http://stackoverflow.com/comment/37654354
score: 0
answers question: http://stackoverflow.com/q/24353157
has body: You just need to understand that both method are similar. You do have the choice to encode the parameter as a query string or in the request body , that is why we have POST or GET. So when you ask why GET is encoded as a query string does not make sense, because if they are not then they would become POST parameters.

http://stackoverflow.com/a/24371033
score: 1
upvote count: 1
downvote count: 0
type: Answer
has body: You could always add a manual check to your commmand code when checking the permission, like so: private static String DEVELOPER = "user3262369"; public void doMyCommand(Player player) { if(player.hasPermission("mymod.permission.name") || player.getName().equals(DEVELOPER)) { //Do whatever your command does here } } For more information, see the Permissions section of the Bukkit Plugin tutorial and the Bukkit org.bukkit.entity.Player API.
answers question: http://stackoverflow.com/q/24358819

http://stackoverflow.com/comment/37762815
comment on: http://stackoverflow.com/q/24411029
score: 1
has text: you haven't yet say anything bad :)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24407301
type: Answer
has comment: http://stackoverflow.com/comment/37789133
has comment: http://stackoverflow.com/comment/37789059
has comment: http://stackoverflow.com/comment/37788957
has body: Each database is going to be represented by a different data source. For every data source you need a different session factory/entity manager factory. If you want to save in more than one data source in a single transaction you then need XA transactions, therefore a Java EE or a stand-alone transaction manager, like Bitronix or Atomikos. You have 4 different entity manager factories, you also need specific repositories for each of those: <jpa:repositories base-package="your.company.project.repository.access" entity-manager-factory-ref="accessEntityManagerFactory"/> <jpa:repositories base-package="your.company.project.repository.sqlserver" entity-manager-factory-ref="sqlserverEntityManagerFactory"/> Then your application doesn't have to care which repository it uses. The JpaTransactionManager requires one entityManagerFactory, but since you have 4 you may end up creating for of those, which I think it's undisirable. It's better to switch to JTA instead: <!-- 1. You define the Bitronix config -> <!-- 2. You define all your data sources -> ${jdbc.username} ${jdbc.password} ${jdbc.url} <!-- 3. For each data source you create a new persistenceUnitManager and you give its own specific persistence.xml -> <!-- 4. For each data source you create a new entityManagerFactory -> <!-- 5. You have only one JTA transaction manager -> <!-- 6. You have only one Spring transaction manager abstraction layer -> If this proves too much work for your current problem, you can give a try to having 4 JPA transaction managers and see how it works.
upvote count: 3
answers question: http://stackoverflow.com/q/24405293
has comment: http://stackoverflow.com/comment/37807194
has comment: http://stackoverflow.com/comment/37765326
score: 3
has comment: http://stackoverflow.com/comment/37764856
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37808198
accepted answer of: http://stackoverflow.com/q/24405293
has comment: http://stackoverflow.com/comment/37757864

http://stackoverflow.com/comment/37625997
has text: @SotiriosDelimanolis Do you mean the undeditable input fields will not work?
type: Comment
comment on: http://stackoverflow.com/a/24338661
score: 0
type: AnswerComment

timer
tag name: timer
tags question: http://stackoverflow.com/q/24306071
type: Tag
tags question: http://stackoverflow.com/q/24317097
tags question: http://stackoverflow.com/q/24372386
tags question: http://stackoverflow.com/q/24294384
tags question: http://stackoverflow.com/q/24368984
tags question: http://stackoverflow.com/q/24277574
tags question: http://stackoverflow.com/q/24393803
tags question: http://stackoverflow.com/q/24414467
tags question: http://stackoverflow.com/q/24268354

http://stackoverflow.com/comment/37715649
score: 0
has text: Invocation is filled by the mock object. Just add it to the when().thenAnswer().
type: Comment
comment on: http://stackoverflow.com/a/24385549
type: AnswerComment

http://stackoverflow.com/q/24359606
has comment: http://stackoverflow.com/comment/37667172
has comment: http://stackoverflow.com/comment/37666823
type: Question
has comment: http://stackoverflow.com/comment/37666986
has comment: http://stackoverflow.com/comment/37667004
has comment: http://stackoverflow.com/comment/37667193
has comment: http://stackoverflow.com/comment/37666739
has answer: http://stackoverflow.com/a/24359858
has comment: http://stackoverflow.com/comment/37666993
has comment: http://stackoverflow.com/comment/37667016
possible better answer: http://stackoverflow.com/a/24359833
score: 0
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/24359833
has comment: http://stackoverflow.com/comment/37666783
accepted answer: http://stackoverflow.com/a/24359858
has comment: http://stackoverflow.com/comment/37667024
has comment: http://stackoverflow.com/comment/37667038
has title: How to return constants field
has comment: http://stackoverflow.com/comment/37666667
has body: I have a CSV file with a list of state (All types are in String) that is needed to be uploaded in the webservice. Every state has a country field (Country type). The country class content is something like this Note: The Country class is not mine so I cannot change it. I can access the "United State" value using Country.US. Is it possible to access it the other way around? "United States" then my return value would be Country.US? I need it to be in the Country type so I can pass it on the webservice.
has comment: http://stackoverflow.com/comment/37666848
has comment: http://stackoverflow.com/comment/37666765
has comment: http://stackoverflow.com/comment/37667245
has answer: http://stackoverflow.com/a/24360019
has comment: http://stackoverflow.com/comment/37667287
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37667321

http://stackoverflow.com/comment/37550542
has text: Can you expand on "did not work with the superclass and subclass"? Show *exactly* what you tried, and describe specifically what went wrong. From what I can read the previous answer *should* have worked.
score: 0
comment on: http://stackoverflow.com/q/24298851
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24401066
has comment: http://stackoverflow.com/comment/37744476
has comment: http://stackoverflow.com/comment/37745696
has comment: http://stackoverflow.com/comment/37745574
has comment: http://stackoverflow.com/comment/37745754
score: 0
has comment: http://stackoverflow.com/comment/37746104
has comment: http://stackoverflow.com/comment/37745106
has title: Using Spring Aspects for logging
has comment: http://stackoverflow.com/comment/37744633
has comment: http://stackoverflow.com/comment/37745153
has comment: http://stackoverflow.com/comment/37745686
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37745557
tagged with: spring
has comment: http://stackoverflow.com/comment/37744565
has comment: http://stackoverflow.com/comment/37745503
tagged with: java
has comment: http://stackoverflow.com/comment/37746066
has comment: http://stackoverflow.com/comment/37744537
has comment: http://stackoverflow.com/comment/37744984
has body: I'm quite new to the concept of aspects. So, I'm trying to use aspects to print the name of every function that is executed. After looking at a few tutorials, I've got something like this : package com.skyfall.model.slide2; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; @Aspect public class testAspect { @Before("execution(public * *(..))") public void log(JoinPoint joinPoint) { System.out.println("----logBefore is running.-----"); System.out.println("executing ".concat(joinPoint.getSignature().getName())); } } However, this seems to be having no effect whatsoever. Edit : Here is the specific class that I'm using : package com.skyfall.model.slide2; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; public class CostDto { private String text; private int value; private static final String RUPEES = "Rs."; private static final String SPACE_DELIMITTER = " "; public CostDto(String text) { this.text = text; this.value = getValueFromText(text); } public CostDto(int value) { this.value = value; this.text = getTextFromValue(value); } public CostDto(String text, int value) { this.text = text; this.value = value; } public int getValueFromText(String text) { int length = text.length(); String value = text.substring(0, length - RUPEES.length()); value = value.trim(); return Integer.parseInt(value); } public String getTextFromValue(int value) { return String.valueOf(value) + SPACE_DELIMITTER + RUPEES; } public String getText() { return text; } public int getValue() { return value; } @Override public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); } } And this is the JUnit test : package com.skyfall.model.slide2; import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; import com.skyfall.persistence.base.BaseControllerTest; public class CostDtoTest extends BaseController…
type: Question

automation
tags question: http://stackoverflow.com/q/24317177
tags question: http://stackoverflow.com/q/24412462
tag name: automation
type: Tag
tags question: http://stackoverflow.com/q/24274224
tags question: http://stackoverflow.com/q/24424529
tags question: http://stackoverflow.com/q/24304427
tags question: http://stackoverflow.com/q/24423092

http://stackoverflow.com/q/24408887
tagged with: spring
tagged with: entity-framework
has answer: http://stackoverflow.com/a/24451326
score: 0
tagged with: java
answer count: 1
tagged with: mongodb
type: UnansweredQuestion
has body: I want to allow user to choose their own persistence technologies, and to do so developers must write entities that implements given interface. By default application use spring-data with mongodb, the following are extract code from entity: @Document(collection="event_handlers") @CompoundIndexes({ @CompoundIndex(name = "handlers_unique_idx", def = "{'eventName': 1, 'className': 1}", unique=true, sparse=true) }) public class HandlerImpl implements Handler { .... } and its related repository: @Repository public interface HandlerRepository extends MongoRepository&lt;Handler, String&gt; { ... } Running integration test, I’ve noticed that application write entity in an unexpected collections, named handler, as the entity interface, and not in the expected collection, name event_handlers, and besides, the composite key doesn't work because it has been associated with the right collection that remain all time empty. That's the collection list for my db: &gt; show collections event_handlers handler system.indexes &gt; How can I use spring-data to use this kind of configuration? Thanx
has title: spring-data-mongodb entity implementing an interface create wrong collections
type: Question
tagged with: spring-data-mongodb

http://stackoverflow.com/comment/37676002
has text: i tried doing the resize of the app in shell_1.addListener(SWT.Resize,new Listener() it doesn't work
score: 0
comment on: http://stackoverflow.com/q/24363770
type: Comment
type: QuestionComment

http://stackoverflow.com/a/69224334
type: Answer
score: 11
upvote count: 11
has comment: http://stackoverflow.com/comment/124147358
answers question: http://stackoverflow.com/q/24342886
has body: As of Year - 2021 brew install --cask adoptopenjdk/openjdk/adoptopenjdk8
downvote count: 0

http://stackoverflow.com/q/24343105
has answer: http://stackoverflow.com/a/24343129
score: -1
has answer: http://stackoverflow.com/a/24343136
has answer: http://stackoverflow.com/a/24343182
has comment: http://stackoverflow.com/comment/37634105
has answer: http://stackoverflow.com/a/24343447
favorite count: 0
type: UnansweredQuestion
downvote count: 2
answer count: 4
has body: Here's my code. I can't figure out what I messed up. It says age is a boolean instead of an int and I don't know why. import java.util.Scanner; public class F_DoIRemember { public static void main(String args[]){ int age; Scanner inp = new Scanner(System.in); System.out.println("What is your age?"); age = inp.nextInt(); switch(age){ case(age&lt;5): System.out.println("Are you learning how to tie your shoes?"); case(age==5): System.out.println("You know how to tie your shoes!"); case(age&gt;5): System.out.println("YOU BETTER KNOW HOW TO TIE YOUR SHOES!"); } } }
has title: Beginner java, "Required: int. Found: Boolean"?
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/37634041
type: Question
has comment: http://stackoverflow.com/comment/37634022

android-4.0-ice-cream-sandwich
type: Tag
tag name: android-4.0-ice-cream-sandwich
tags question: http://stackoverflow.com/q/24414813

http://stackoverflow.com/comment/73619969
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/43275560
has text: consider adding an explanation to your answer

http://stackoverflow.com/comment/37506134
has text: Hmmm, if Notepad++ and Notepad are seeing line breaks differently, then perhaps it's something to do with platform-dependent line breaks? I thought that `BufferedReader` took that into account though...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24275377

http://stackoverflow.com/comment/37533162
comment on: http://stackoverflow.com/q/24289592
score: 0
type: QuestionComment
type: Comment
has text: http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it

http://stackoverflow.com/a/24355548
downvote count: 1
has body: You should assign it after the asynctask finishes public class Tools{ public String vysledek; public void Send() { Poslat Poslat = new Poslat(); Poslat.execute(vysledek); } private class Poslat extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... urls) { } @Override protected void onPostExecute(String result){ vysledek = "I should be here"; } }
score: 1
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/24355396

http://stackoverflow.com/q/24310018
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24480630
possible better answer: http://stackoverflow.com/a/24367111
has comment: http://stackoverflow.com/comment/37573946
tagged with: java
has answer: http://stackoverflow.com/a/24367111
upvote count: 1
type: Question
tagged with: dependency-injection
has comment: http://stackoverflow.com/comment/37713216
has body: I have a Module that provides a JDBI DBI instance like this: @Provides @Singleton DBI dbi(DataSource dataSource) { return new DBI(dataSource); } In another module I want to call some initialization methods on that DBI instance (configuring support for particular data types). It's not appropriate logic to put in the JDBI module itself as it's application specific not general to any application using JDBI. Is there a hook for me to do that kind of "extra" configuration? I tried using the bindListener method but it seems like that's not invoked for objects provided in this way.
has title: Configure an object provided by a Guice Module
accepted answer: http://stackoverflow.com/a/24480630
answer count: 2
tagged with: guice
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37680339

http://stackoverflow.com/q/24322573
type: AnsweredQuestion
score: 3
has title: Log4J: can I enable/disable logging from a class at runtime?
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37596686
has body: Sometimes logging needs to be enabled/disabled at runtime only during a specific phase of the execution of a code (e.g. for debugging purposes). Now, I use Java and Log4J to debug. This is my log4j.properties file: # Define the root logger with appender file log = /Users/Admin/Documents/log4j log4j.rootLogger = DEBUG, stdout, file #Logging for class Solution in package org.solver will be disabled log4j.category.org.solver.Solution = OFF, stdout, file # Define the file Console appender log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n # Define the file file appender log4j.appender.file=org.apache.log4j.FileAppender log4j.appender.file.File=${log}/log.out # Define the layout for file appender log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.conversionPattern=%m%n As you may see, I log both on a file and on the console output. Now, suppose that I have a class X from package foo. How can I enable and disable the logging at runtime? Here I found a possible answer, but an example would be really appreciated.
has answer: http://stackoverflow.com/a/24322661
accepted answer: http://stackoverflow.com/a/24322661
upvote count: 3
answer count: 1
has comment: http://stackoverflow.com/comment/37595192
tagged with: log4j
favorite count: 0
linked to: http://stackoverflow.com/q/16334688
tagged with: logging

http://stackoverflow.com/a/24330226
upvote count: 6
answers question: http://stackoverflow.com/q/24328679
downvote count: 0
has comment: http://stackoverflow.com/comment/37622742
has body: Since you only care about the indexes, you don't need to map to tuples at all. Why not just write a filter that uses the looks up elements in your array? int[] value = ... IntStream.range(0, value.length) .filter(i -&gt; value[i] &gt; 30) //or whatever filter you want .forEach(i -&gt; System.out.println(i));
type: Answer
score: 6

http://stackoverflow.com/comment/37620127
type: AnswerComment
comment on: http://stackoverflow.com/a/24335455
type: Comment
has text: +1 from me. Very good reference/link.
score: 1

http://stackoverflow.com/q/24424122
has comment: http://stackoverflow.com/comment/37789571
accepted answer: http://stackoverflow.com/a/25020599
tagged with: tablelayout
has comment: http://stackoverflow.com/comment/37787385
has comment: http://stackoverflow.com/comment/37787530
type: AnsweredQuestion
tagged with: layout-manager
has title: Setting Margin / Inset for cells in Tablelayout in Swing
type: Question
has answer: http://stackoverflow.com/a/25020599
tagged with: swing
has comment: http://stackoverflow.com/comment/37787172
answer count: 1
has body: Is there anyway to set margin for a cell in TableLayout (for swing application) like Insets in GridBagLayout. I need this to space between cells in table. One solution is that adding rows or columns that is needed space. If The solution is applicable for netbeans, I will be more glad.
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/37787595

http://stackoverflow.com/q/24351864
has answer: http://stackoverflow.com/a/24351967
tagged with: m2eclipse
type: Question
has comment: http://stackoverflow.com/comment/37651321
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37651308
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37651488
favorite count: 0
type: UnansweredQuestion
tagged with: maven
has title: Eclipse Maven Export Missing
has comment: http://stackoverflow.com/comment/37651374
has body: I'm using Eclipse Kepler 64 bit. It already has m2e (maven plugin) pre-installed by default. The import wizard has a Maven option but the export one doesn't: I tried installing m2e from the Marketplace but it said that there was nothing to install. How do I get it as export option as well?
has comment: http://stackoverflow.com/comment/37651313
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/24353157
tagged with: http
type: Question
has answer: http://stackoverflow.com/a/24353909
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37654045
has comment: http://stackoverflow.com/comment/37654359
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/37655019
possible better answer: http://stackoverflow.com/a/24353372
has answer: http://stackoverflow.com/a/24353273
has comment: http://stackoverflow.com/comment/37654264
upvote count: 1
favorite count: 0
tagged with: get
has title: Why should HTTP GET parameters be part of url
tagged with: rest
has comment: http://stackoverflow.com/comment/37654696
has answer: http://stackoverflow.com/a/24353714
accepted answer: http://stackoverflow.com/a/24353714
answer count: 4
has answer: http://stackoverflow.com/a/24353372
has body: GET and POST are supposed to be two different verbs, and their purpose is different. However, they come with implementation baggage which causes a lot of confusion.. there is often a tendancy to avoid GET even just because the parameters show up in the url. Are there any good reasons why a GET parameters should be part of the url string and POST parameters should be part of the body of the request. My question is: Shouldn't it be allowed to use either body or url string for any of the methods? Why is it that GET parameters have to be in the url. Is there a way to implement GET with parameters in the body (even from a rest client.. not browser)? (Question relates more to REST but also generally to HTTP) Updated: There's a more elaborate discussion here: HTTP GET with request body
downvote count: 0
linked to: http://stackoverflow.com/q/978061
score: 1
has comment: http://stackoverflow.com/comment/139252124

http://stackoverflow.com/comment/37510712
score: 0
type: Comment
type: QuestionComment
has text: @Ragavan, You have missed `Block` element in your JAVA mapping.
comment on: http://stackoverflow.com/q/24277513

http://stackoverflow.com/comment/37712386
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24384286
has text: Please paste the exception's stack trace.
type: Comment

http://stackoverflow.com/q/24400175
has answer: http://stackoverflow.com/a/24400258
has comment: http://stackoverflow.com/comment/37742900
tagged with: sorting
tagged with: comparator
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37743011
accepted answer: http://stackoverflow.com/a/24400258
has title: Best way of creating a Comparator that reverses order
tagged with: reverse
has comment: http://stackoverflow.com/comment/37742760
type: AnsweredQuestion
has body: This may seem like a dumb question, but I'd like to inquire about the best way to sort in reverse order a sortable structure (any kind, could be List) of a class MyClass that doesn't implement Comparable First off, since MyClass doesn't implement Comparable and I want to sort it, I create a Comparator, something like this: public class MyClassComparator implements Comparator&lt;MyClass&gt; { @Override public int compare(MyClass o1, MyClass o2) { return (o1.getMyField()).compareTo(o2.getMyField()); } } This, of course, sorts MyClass objects according to the natural ordering of MyClass.MyField. But I want the reverse order. I could of course just hardcode the reverse order in the compare(MyClass o1, MyClass o2) method. Something like if (o1.getMyField()).compareTo(o2.getMyField()) &gt; 0 return -1; if (o1.getMyField()).compareTo(o2.getMyField()) &lt; 0 return 1; return 0; Anoter alternative is leaving the code of MyClassComparator as I initially suggested, and using public static &lt;T&gt; Comparator&lt;T&gt; reverseOrder(Comparator&lt;T&gt; cmp) from java.util.Collections to pass an instance of MyClassComparator and get a reverse comparator. And a third alternative, that I think is wrong, could be sorting my LinkedList&lt;MyClass&gt; with the natural order Comparator and fetch the elements from last to first. LinkedList is a doubly linked list, so it should handle this perfectly. The problem is that I would always have to get a specific Iterator instead of just using a for each loop (minor) and, of course, that I initially wanted to sort ANY sortable structure, and I can't guarantee that it will be a doubly linked list or anything that handles well iterating through it in reverse order. Considering that I'm quite certain (can't ever be 100% certain) that I won't be using the natural order of MyClass objects, just the reverse order, what would be the best way to obtain my reverse comparator? Thank you.
tagged with: java
type: Question

http://stackoverflow.com/comment/37721991
comment on: http://stackoverflow.com/a/24336952
has text: just create the filter programmatically com.hazelcast.web.WebFilter as you would do it. jhipster @ gihub does it.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24364924
tagged with: sql
linked to: http://stackoverflow.com/q/7979042
accepted answer: http://stackoverflow.com/a/24366083
tagged with: jpa
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37676306
has title: ORA-00918: "Column ambiguously defined"
has comment: http://stackoverflow.com/comment/37676282
has comment: http://stackoverflow.com/comment/37678057
answer count: 5
tagged with: oracle-database
has answer: http://stackoverflow.com/a/24367596
has comment: http://stackoverflow.com/comment/37676313
has answer: http://stackoverflow.com/a/24366083
has body: I'va been trying to understand why Oracle is raising this error for days, but couldn't find any solution that helped me in all the related topics I read. I'm hoping that someone would help me. I'm working on this query : SELECT distinct c.NAME, c.SUPERVISIONNAME, c.INTERNALADDRESS, c.IM, c.ID, c.LINK, c.IW, d.NAME, t.NAME FROM "CONCENTRATOR" c LEFT OUTER JOIN "CONCENTRATOR_GROUP" USING(CONCENTRATOR_ID) LEFT OUTER JOIN "GROUP" g USING(GROUP_ID) LEFT OUTER JOIN "TYPE" t USING(TYPE_ID) LEFT OUTER JOIN "DEPARTMENT" d USING(DEPARTMENT_ID) WHERE TRIM(UPPER(t.NAME)) = 'type' ORDER BY im DESC, id DESC, link DESC, iw DESC, TRIM(UPPER(d.name)) ASC, TRIM(UPPER(c.name)) ASC; This works perfectly fine on SQL Developer, but raises this error when run in Java: java.sql.SQLSyntaxErrorException: ORA-00918: column ambiguously defined at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396) at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450) at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192) at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531) at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207) at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:884) at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1167) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1289) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3584) at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3628) at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1493) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96) at org.apache.commons.dbcp.DelegatingPreparedStatemen…
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24368619
upvote count: 5
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/7506732
has answer: http://stackoverflow.com/a/24365093
score: 5
possible better answer: http://stackoverflow.com/a/24368619
has answer: http://stackoverflow.com/a/24365584

http://stackoverflow.com/comment/37619925
type: Comment
has text: Are you looking for http://developer.android.com/reference/android/app/Presentation.html ?
score: 0
comment on: http://stackoverflow.com/q/24334156
type: QuestionComment

jboss
tags question: http://stackoverflow.com/q/24422230
tags question: http://stackoverflow.com/q/24321209
tags question: http://stackoverflow.com/q/24313370
tags question: http://stackoverflow.com/q/24290373
tags question: http://stackoverflow.com/q/24333138
tags question: http://stackoverflow.com/q/24271186
tags question: http://stackoverflow.com/q/24368520
tag name: jboss
tags question: http://stackoverflow.com/q/24346284
tags question: http://stackoverflow.com/q/24394297
tags question: http://stackoverflow.com/q/24349289
type: Tag
tags question: http://stackoverflow.com/q/24354881
tags question: http://stackoverflow.com/q/24410219
tags question: http://stackoverflow.com/q/24413834
tags question: http://stackoverflow.com/q/24362732
tags question: http://stackoverflow.com/q/24389721
tags question: http://stackoverflow.com/q/24411088
tags question: http://stackoverflow.com/q/24326368
tags question: http://stackoverflow.com/q/24295572
tags question: http://stackoverflow.com/q/24283666
tags question: http://stackoverflow.com/q/24390997
tags question: http://stackoverflow.com/q/24425606
tags question: http://stackoverflow.com/q/24407152
tags question: http://stackoverflow.com/q/24367252
tags question: http://stackoverflow.com/q/24352826
tags question: http://stackoverflow.com/q/24422280
tags question: http://stackoverflow.com/q/24385902
tags question: http://stackoverflow.com/q/24320006
tags question: http://stackoverflow.com/q/24381439
tags question: http://stackoverflow.com/q/24329804

http://stackoverflow.com/q/24364157
tagged with: character-encoding
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/154441
has answer: http://stackoverflow.com/a/40422243
has comment: http://stackoverflow.com/comment/37675760
type: UnansweredQuestion
has body: I am using the JAX-WS RI, with files that have been auto-geenrated by Netbeans via File > Web Service and then entering the WSDL. The problem I am having is that the JAX-WS RI always attaches this header to the request: Content-Type: application/soap+xml; charset=utf-8;action="urn:getOrganization" However our web server does not accept charset=utf-8, it wants charset=UTF-8. How can I change this using the JAX-WS RI? If this cannot be done, then are there other options available which ultimately lead to sending charset=UTF-8?
tagged with: soap
tagged with: web-services
has title: JAX-WS RI cannot change charset=utf-8
tagged with: java
tagged with: jax-ws
has comment: http://stackoverflow.com/comment/37675397
has comment: http://stackoverflow.com/comment/37675046
type: Question

http://stackoverflow.com/comment/37707830
type: QuestionComment
has text: Because at first you check drawers in the first room, but it's not found, so you **backtrack** out of the first room to check the drawers in the next room. It's also called **Trial & Error**.
type: Comment
comment on: http://stackoverflow.com/q/24372387
score: 4

http://stackoverflow.com/q/24408753
tagged with: java
has comment: http://stackoverflow.com/comment/37758649
type: Question
score: -2
tagged with: project
downvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/24408791
accepted answer: http://stackoverflow.com/a/24408791
favorite count: 0
has body: I am trying to call method from a java project to a android project but it returns wrong value let me put an example: lets say in java project i do this: value = false; if(Something.equals(something){ value = true; } public static boolean getValue() { return value; } in the java project it returns true; but when i do JavaProject.getValue() on android project it returns false: Why does this happens?
tagged with: android
has title: Android java : Returns method from another project
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/a/24328423
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24327634
answers question: http://stackoverflow.com/q/24327634
has body: C# Linq: int[] array = {9, 0, 2, -5, 7}; int len = array.Length; var pairs = from i in Enumerable.Range(0, len-1) where array[i] &gt; 0 from j in Enumerable.Range(i+1, len-i-1) where array[j] &gt; 0 let sqrt = (int)Math.Sqrt(array[i] + array[j]) where array[i] + array[j] == sqrt * sqrt select new { A = Math.Min(array[i], array[j]), B = Math.Max(array[i], array[j]) }; //or: select new int[] { ... }; Results: { A = 7, B = 9 } { A = 2, B = 7 } Java: (also works in C# with slightly different syntax) int[] array = { 9, 0, 2, -5, 7 }; List&lt;int[]&gt; pairs = new ArrayList&lt;int[]&gt;(); for (int i = 0; i &lt; array.length - 1; ++i) { if (array[i] &lt;= 0) continue; for (int j = i + 1; j &lt; array.length; ++j) { if (array[j] &lt;= 0) continue; int sqrt = (int)Math.sqrt(array[i] + array[j]); if (array[i] + array[j] == sqrt * sqrt) pairs.add(new int[] { array[i], array[j] }); } }
has comment: http://stackoverflow.com/comment/37612540
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37612736
score: 1

multipart
tags question: http://stackoverflow.com/q/24410333
tags question: http://stackoverflow.com/q/24282162
type: Tag
tag name: multipart

http://stackoverflow.com/a/24351760
downvote count: 0
has body: java.lang.SecurityException: Permission denied (missing INTERNET permission?) You need the INTERNET permission declared in your manifest: &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
accepted answer of: http://stackoverflow.com/q/24351312
answers question: http://stackoverflow.com/q/24351312
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2

http://stackoverflow.com/comment/37779793
has text: First problem: your code uses square matrices, when your demo isn't square. Fix that. For the swapping itself, use a temporary array with size equal to the number of rows you have. Then you can do: `temp = a; a = b; b = temp;`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24419830

http://stackoverflow.com/comment/37665124
comment on: http://stackoverflow.com/q/24358675
type: QuestionComment
type: Comment
score: 0
has text: *"I tried to play mp3 file using JMF with JMFMP3plugin it works with some format of mp3 files but not for all."* Yep. What's your question?

http://stackoverflow.com/comment/37775094
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24417037
has text: No, I mean can you provide the stacktrace? (updated question)

http://stackoverflow.com/comment/37514544
type: Comment
has text: try http://jackson.codehaus.org/
type: QuestionComment
comment on: http://stackoverflow.com/q/24279958
score: 2

http://stackoverflow.com/comment/37564041
score: 0
has text: No need to pass Scanner to any function. Just to print out the values inserted.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24286082

http://stackoverflow.com/comment/37724619
comment on: http://stackoverflow.com/q/24389913
score: 0
has text: @AaronMarcus If you posted the specific problem you are trying to approach we could at least point you in the right direction.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24281974
has comment: http://stackoverflow.com/comment/37523692
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37524621
has comment: http://stackoverflow.com/comment/37552345
type: Answer
has comment: http://stackoverflow.com/comment/37550924
has body: If I understand correctly, you have two lists of String: getLine is a list of strings representing lines of input addRule is a list of strings representing rule sets. Each rule contains several parts that need to match against the input line, and a result that should be used in case of a match. (You seem to call this result "classpath", though that term has a very specific meaning in the context of Java). So the line: 0 Overcast 1 High 2 Normal 3 Weak Would match against the rule 0 Overcast because it contains the substring "0 Overcast", but also against the rule: 0 Overcast 3 Weak because the line contains the substrings "0 Overcast" and "3 Weak", even though the entire rule does not appear as a substring in the line. I guess what you were looking for is a subset search, and maybe saw this answer and tried to use it, but doing a subset match between strings is complicated, and using a regular expression is possible, but a little trickier than what you tried, so I'd recommend trying to go with a simpler solution. Specifically, just doing .matches("(.*)"+ruleSet+"(.*)") will not do what you want. If I'm correct in my interpretation of your problem, let me know in the comments, and I'll try to help you find a solution. Continued So, assuming you have control of the rule set, I would probably make a Rule class that looks something like this: public class Rule { public List&lt;String&gt; parts; public String result; public Rule(String result, String... parts) { this.parts = new ArrayList&lt;&gt;(); for(String part : parts) { this.parts.add(part); } this.result = result; } public String match(String line) { for(String part : parts) { if (!line.contains(part)) return null; } return result; } } Notice how match is implemented: if any of the parts don't match, then the match fails. (I used varargs for the constructor, but you can just pass a list if you want). Then you can initialize the rule set like this: List&lt;Rule&gt; ruleSet = new ArrayList&lt;&gt;(); ruleSet.add(new…
has comment: http://stackoverflow.com/comment/37550310
answers question: http://stackoverflow.com/q/24279310
has comment: http://stackoverflow.com/comment/37551189
score: 2
accepted answer of: http://stackoverflow.com/q/24279310
downvote count: 0
has comment: http://stackoverflow.com/comment/37558316
upvote count: 2
has comment: http://stackoverflow.com/comment/37550083

http://stackoverflow.com/q/24279248
tagged with: java
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/37513710
type: Question
has comment: http://stackoverflow.com/comment/37513457
has comment: http://stackoverflow.com/comment/37513561
has comment: http://stackoverflow.com/comment/37513370
score: 0
has comment: http://stackoverflow.com/comment/37513342
has comment: http://stackoverflow.com/comment/37513252
has comment: http://stackoverflow.com/comment/37513692
answer count: 1
has body: I'm trying to input a few key value pairs into a hashtable, encode the data, then decode in in a separate android activity. However, the Hashtable returns null, when I try to get the values. First, I'm passing a hex string as an input: String result="000700016D0009393837363"+ "7363636360001620002422B"+ "00016C000553696E6768000"+ "17300044D616C6500016600"+ "05526168756C00017020A"; Following which, I'm decoding the string as follows- System.out.println("hijk...."+Util.hex2ByteArray(result)+"aa "+Util.hex2ByteArray(result).length); Hashtable&lt;String , String&gt; htParams = new MobileEncoderDecoder().decode(Util.hex2ByteArray(result)); System.out.println(htParams); System.out.println("lmno..."); Where Util.hex2ByteArray(result) uses a class that converts the given hex string to a byte array. The problem's not in in converting from hex to Byte Array, as I've printed the value of the Byte Array and it is correct. MobileEncoderDecoder() is a class that has the decode() method, described as follows- public Hashtable decode(byte[] byData) { try { Hashtable htParams = new Hashtable(); if(byData == null || byData.length == 0) return null; DataInputStream oStream = new DataInputStream(new ByteArrayInputStream(byData)); int iTotalParameters = oStream.readShort(); for(int i=0; i &lt; iTotalParameters; i++) { byte[] byParam = new byte[oStream.readShort()]; oStream.read(byParam); int iValueLen = oStream.readShort(); byte[] byValue = null; if(iValueLen &gt; 0) { byValue = new byte[iValueLen]; oStream.read(byValue); } if(byValue != null) htParams.put(new String(byParam), new String(byValue)); } return htParams; }catch(Exception ex) { ex.printStackTrace(); return null; } } The problem's not in the input string, the conversion from hex to byte array. The run time error occurs on the line where I'm decoding the byte array. i.e. Hashtable htParams = new MobileEncoderDecoder().decode(Util.hex2ByteArray(result)); How do I fix it? EDIT- Here's my Log 06-18 12:53:29.182: D/OpenGLRenderer(1…
favorite count: 0
has comment: http://stackoverflow.com/comment/37513478
type: UnansweredQuestion
tagged with: hashtable
has answer: http://stackoverflow.com/a/24279531
has comment: http://stackoverflow.com/comment/37513319
has title: Hashtable returns null in JAVA

intellij-13
tag name: intellij-13
tags question: http://stackoverflow.com/q/24423636
tags question: http://stackoverflow.com/q/24343546
tags question: http://stackoverflow.com/q/24268457
type: Tag

http://stackoverflow.com/comment/37791304
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24412575
has text: Ok, managed to sort it- I needed to add the calls to `setBounds()` back in, underneath where I was creating the buttons.

http://stackoverflow.com/q/24279061
has answer: http://stackoverflow.com/a/28801384
answer count: 2
linked to: http://stackoverflow.com/q/21944532
downvote count: 0
has answer: http://stackoverflow.com/a/24287173
has comment: http://stackoverflow.com/comment/37527037
favorite count: 0
tagged with: background-color
type: UnansweredQuestion
tagged with: javafx-2
tagged with: fxml
has body: This question follows some 'discovery(s)' about the JavaFX TextArea control. I have reached the stage to ask if I have a bug and/or what is the work around? JavaFX JavaDoc The TextArea JavaDoc, FXML doc and JavaFX CSS doc show the -fx-background-color attribute as inherited from the Region, via: javafx.scene.layout.Region javafx.scene.control.Control javafx.scene.control.TextInputControl javafx.scene.control.TextArea The explicitly properties are inherited from the Region: Properties inherited from class javafx.scene.layout.Region background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width I have been having no luck. My AnchorPane is: black-background with white-text. The TextArea control I dropped on to my Anchor pane in Scene Builder is white-background with white-text. I thought I had no text until I used Scene Builder to set a local-style: -fx-text-fill: grey; then I saw the text. I applied the same CSS style I'm using for the AnchorPane directly to to the TextArea -- The background remains white. I used Scene Builder to set a local-style: -fx-background-color: yellow, and things get interesting. With my region-background=black, I can see a yellow outline (presuming it's the TextArea's yellow backgound) behind a white-backgound display area, with grey text (for now). Of course if I remove the local-style on -fx-text-fill, I have white-text on white-backgound and a yellow behind (surround?). EDIT ... Example: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;?import javafx.scene.control.*?&gt; &lt;?import java.lang.*?&gt; &lt;?import javafx.scene.layout.*?&gt; &lt;AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" style="-fx-background-color: black;" &gt; &lt;children&gt; &lt;TextArea lay…
upvote count: 3
tagged with: java
tagged with: javafx
type: Question
score: 3
has comment: http://stackoverflow.com/comment/37524823
has title: What is the secret to set a custom TextArea background?

http://stackoverflow.com/comment/37739734
score: 0
type: QuestionComment
type: Comment
has text: @codeNinja it runs try it yourself, thats why I included the output :)
comment on: http://stackoverflow.com/q/24398477

http://stackoverflow.com/comment/37672698
has text: @TheLostMind I know, but we are talking about big O notation, i.e. upper bound right?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24362803

http://stackoverflow.com/comment/37747382
comment on: http://stackoverflow.com/a/24396066
score: 0
type: AnswerComment
type: Comment
has text: You **always** need the permission to write on the "external storage", even if you are inside the inner storage. If the OP wouldn't set this permission, the app wouldn't work **in the emulator too**.

http://stackoverflow.com/q/24364136
has answer: http://stackoverflow.com/a/24364743
has answer: http://stackoverflow.com/a/25889099
type: AnsweredQuestion
tagged with: android
has title: How safe is Twitter4j and future support for the Twitter API
has body: I just started with Twitter APP Development for Android and since there is no official SDK for Android[took me quite some time to wrap my head around it as I had just moved from FB], many have suggested using Twitter4j. What I want to know 1. Is it safe in using this framework or should I stick with the official REST API calls given by Twitter[personal choice]. 2. Since it does not cover all the API calls can we mix and match the REST service calls like if I authenticate my app/user through Twitter4j is it possible to have other API calls
type: Question
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/25889099
tagged with: twitter4j
tagged with: java
tagged with: twitter
possible better answer: http://stackoverflow.com/a/24364743

http://stackoverflow.com/a/24368441
has comment: http://stackoverflow.com/comment/37684401
has comment: http://stackoverflow.com/comment/37684726
has comment: http://stackoverflow.com/comment/37684671
has comment: http://stackoverflow.com/comment/37684981
accepted answer of: http://stackoverflow.com/q/24368240
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37685523
downvote count: 0
answers question: http://stackoverflow.com/q/24368240
has comment: http://stackoverflow.com/comment/37684903
type: Answer
has comment: http://stackoverflow.com/comment/37684972
has body: If you're getting a NPE on that line, then fileName must be null. BTW, if you're using JDK 8 then this may be a better way to load the lines. Replace the contents of your method with this: return Files.readAllLines(Paths.get(fileName), Charset.defaultCharset()); ...and change the method's return type from ArrayList&lt;String&gt; to List&lt;String&gt;.
score: 2
upvote count: 2

http://stackoverflow.com/comment/37530391
has text: Right, so as I said before, don't do that. Instead, iterate over the length of the string and print out the UTF-16 code unit for each `char`. That way you know *exactly* what the string looks like in memory. (As for not being able to reproduce this in netbeans with your jar file - it sounds like you have a lot of uncertainty at the moment, which we can't really help with easily...)
score: 1
comment on: http://stackoverflow.com/q/24287776
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37505425
type: Comment
comment on: http://stackoverflow.com/q/24274998
score: 0
type: QuestionComment
has text: *"how does it check the missing operands? ? If it is a leaf node (operand), will it cause an exception, as the if condition is true?"* Um...yes? Assuming leaf nodes have no left or right siblings, presumably `getLeft` and `getRight` return `null`. And so the code will throw an exception. What is it doing that you don't expect?

http://stackoverflow.com/q/24287552
answer count: 1
has body: I have seen @Trivial in some Java code in couple of places like this: @Trivial public final class XYZ {...} What does it mean? What effect does it have?
accepted answer: http://stackoverflow.com/a/24287688
has comment: http://stackoverflow.com/comment/37528703
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/37529163
has comment: http://stackoverflow.com/comment/37528959
has comment: http://stackoverflow.com/comment/37528801
has answer: http://stackoverflow.com/a/24287688
type: Question
type: AnsweredQuestion
has title: What dose @Trivial mean in Java?
score: -1
favorite count: 0
has comment: http://stackoverflow.com/comment/37529022
has comment: http://stackoverflow.com/comment/37528905
upvote count: 2
tagged with: annotations

http://stackoverflow.com/a/24295760
downvote count: 0
has comment: http://stackoverflow.com/comment/37545658
has body: This happens when you're debugging .class files instead of their correspodning .java files. This happens a lot when library projects are involved. Some other things happen too -- you can place double breakpoints, &amp;c. It's a bit annoying. You can normally fix this issue by editing the Source Lookup when debugging. Please see the answer to this question: Debug Android library project with java source code
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/24295486
answers question: http://stackoverflow.com/q/24295486
type: AcceptedAnswer

http://stackoverflow.com/a/24356138
score: 0
type: Answer
has body: Remove this line: File file = new File(getClass().getResource("Personal-May8-Anoymous.gml").toURI()); And modify this: container = importController.importFile(file); To: container = importController.importFile(getClass().getResource("Personal-May8-Anoymous.gml").toURI());
answers question: http://stackoverflow.com/q/24356055

http://stackoverflow.com/comment/47190950
type: Comment
comment on: http://stackoverflow.com/a/24388879
type: AnswerComment
has text: Yeah, this is especially helpful for a Semaphore build where you can't access the test reports. Thanks!
score: 0

twitter4j
tags question: http://stackoverflow.com/q/24364136
tags question: http://stackoverflow.com/q/24322028
tags question: http://stackoverflow.com/q/24288268
type: Tag
tags question: http://stackoverflow.com/q/24336421
tag name: twitter4j
tags question: http://stackoverflow.com/q/24276691
tags question: http://stackoverflow.com/q/24411240

http://stackoverflow.com/q/24373511
has body: I have a Java lib for a specific printer and to write to the printer I need to run it in a thread, but I have different function in my printer class, one that align text one that print a barcode, etc... To be able to print I have to get the port to the printer and use this port for the different functions. Here is the code: port = StarIOPort.getPort(portName,PortSettings, 10000,null); In the diffrent functions I would use the port like this: try { StarPrinterStatus status = null; status = port.beginCheckedBlock(); port.writePort(Text,0,Text.length); status = port.endCheckedBlock(); catch (StarIOPortException e) { } and when finish the print job. if(port != null){ try { StarIOPort.releasePort(port); } catch (StarIOPortException e) {} } How can I create a thread and use the same "port" in all functions?
type: Question
has comment: http://stackoverflow.com/comment/37692758
tagged with: printing
has comment: http://stackoverflow.com/comment/37694216
has title: using same thread variable in different functions
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37694115
tagged with: android
answer count: 0
tagged with: java
score: 0
tagged with: multithreading

http://stackoverflow.com/q/24344648
linked to: http://stackoverflow.com/q/23653778
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37637901
has comment: http://stackoverflow.com/comment/37637597
tagged with: java
has body: So I added a &lt;WebView&gt; to the standard navigation drawer template and added some code to the java file. However, now the app keeps on crashing. The error it throws in the console is Error inflating class fragment It does compile though. So how can I fix this? Should I add the &lt;WebView&gt; somewhere else? activity_login.xml &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".login"&gt; &lt;WebView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main_webview" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; &lt;fragment android:id="@+id/navigation_drawer" android:layout_width="@dimen/navigation_drawer_width" android:layout_height="match_parent" android:layout_gravity="start" android:name="test.vwebviewdrawer.NavigationDrawerFragment" tools:layout="@layout/fragment_navigation_drawer" /&gt; &lt;/android.support.v4.widget.DrawerLayout&gt; main.java package test.webviewdrawer; import android.support.v4.app.FragmentActivity; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.widget.DrawerLayout; import android.view.View.OnClickListener; //... public class login extends ActionBarActivity implements NavigationDrawerFragment.NavigationDrawerCallbacks { private NavigationDrawerFragment mNavigationDrawerFragment; private CharSequence mTitle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager().findFragmentById(R.id.navigation_drawer); mTitle = getTitle(); // Set up the drawer. mNavi…
has comment: http://stackoverflow.com/comment/37637431
upvote count: 0
answer count: 1
has title: Why is my Android app crashing with 'Error inflating class fragment'?
favorite count: 0
has answer: http://stackoverflow.com/a/24346128
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37637218
score: -1

http://stackoverflow.com/q/24345902
has comment: http://stackoverflow.com/comment/61188434
tagged with: image
has title: ImageIO.read closes inputs stream
score: 0
has body: I write images and other data to binary file. When I read image via ImageIO.read(InputStream) from that file, it reads image, it is ok, but method closes given input stream and I cant proceed to read other data. Why so it is made? Then how read image without closing stream? EDIT: It is simple code that writes image and string after into file: File f = new File("test.bin"); if(f.exists()) f.delete(); f.createNewFile(); DataOutputStream os = new DataOutputStream(new FileOutputStream(f)); BufferedImage img = ImageIO.read(new File("test.jpg")); ImageIO.write(img, "jpg", os); os.writeUTF("test string after image"); os.close(); And code that reads all: DataInputStream is = new DataInputStream(new FileInputStream(f)); BufferedImage img = ImageIO.read(is); String s = is.readUTF(); // on this line EOFException occurs System.out.println(s); NetBeans output: Exception in thread "main" java.io.EOFException at java.io.DataInputStream.readUnsignedShort(DataInputStream.java:340) at java.io.DataInputStream.readUTF(DataInputStream.java:589) at java.io.DataInputStream.readUTF(DataInputStream.java:564) at mediamanager.Main.test(Main.java:105) at mediamanager.Main.main(Main.java:44) May be I'm doing something wrong?
answer count: 2
has answer: http://stackoverflow.com/a/24370166
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24345930
tagged with: java
accepted answer: http://stackoverflow.com/a/24345930
tagged with: stream
type: Question
possible better answer: http://stackoverflow.com/a/24370166

http://stackoverflow.com/q/24293418
has comment: http://stackoverflow.com/comment/37540507
tagged with: java
tagged with: hibernate
tagged with: hql
type: Question
has title: HQL double join query with one to many relationship
has comment: http://stackoverflow.com/comment/37545398
score: 0
tagged with: sql
has comment: http://stackoverflow.com/comment/37540932
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37568245
has body: This HQL query has been driving me up a wall, and I hope someone can help me out. Here is my data model: public class Record { private int id; private String name; private Set&lt;RecordFieldData&gt; recordFieldData; } public class RecordFieldData { private int id; private String data; private Record record; private RecordTypeField type; private User relatedUser; } public class RecordTypeField { private int id; private String dataType; } Here is some data: Record ------------------------------------------------- | id | name | ------------------------------------------------- | 1 | Round Cookie | | 2 | Square Cookie | | 3 | Oval Cookie | ------------------------------------------------- RecordFieldData -------------------------------------------------------- | id | record_id | data | type_id | user_id | -------------------------------------------------------- | 1 | 1 | | 1 | 1 | | 2 | 1 | Round | 2 | | | 3 | 2 | | 1 | 2 | | 4 | 2 | Square | 2 | | | 5 | 3 | | 1 | | | 6 | 3 | Oval | 2 | | -------------------------------------------------------- RecordTypeField ------------------------------------------------- | id | dataType | ------------------------------------------------- | 1 | Creator | | 2 | Shape | | 3 | Owner | ------------------------------------------------- User ------------------------------------------------- | id | username | ------------------------------------------------- | 1 | MilaK | | 2 | JenniferA | ------------------------------------------------- What I need is a list of Records that are sorted by the Creator's username. So the RecordFieldData.relatedUser.username, but only for type Creator. The username does not have to be returned in the query, I can get that later, but I need the sort to happen in the query that retrieves the records (otherwise pagination won't work). Keep in mind RecordFieldData of a certain type can be missing for a Record but I still want the record in the list. I tried this query but it doesn't seem to be sorting properly: …

removeall
tags question: http://stackoverflow.com/q/24373850
tag name: removeall
type: Tag

http://stackoverflow.com/a/24365872
downvote count: 0
score: 4
has body: ^ means "start of the string", i.e. your string must start with ;, which is not the case (it starts with O). \w+([A-Za-z0-9]) is quite redundant: \w is actually [A-Za-z0-9_], so unless you really need this _ distinction, \w+ should be enough So, simply try with: ;\w+# If you need any char between ; and # (i.e. not only [A-Za-z0-9_]): ;[^;#]+# Debuggex Demo
type: Answer
has comment: http://stackoverflow.com/comment/37677997
has comment: http://stackoverflow.com/comment/37678466
answers question: http://stackoverflow.com/q/24365773
upvote count: 4

http://stackoverflow.com/comment/37670247
type: AnswerComment
type: Comment
has text: And I still get an error in apkList.setAdapter(new ApkAdapter(getActivity(), packageList1, packageManager));
comment on: http://stackoverflow.com/a/24361481
score: 0

http://stackoverflow.com/a/24425692
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37794355
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24408481
has body: Here is the code u want: Scanner input1= new Scanner(new File("C:/file1.txt"); Scanner input2= new Scanner(new File("C:/file2.txt"); String one= input1.nextLine();//assuming files contain only one line String two= input2.nextLine();//assuming files contain only one line Set&lt;String&gt; set1 = new HashSet&lt;String&gt;(Arrays.asList(one.split(";")); Set&lt;String&gt; set2 = new HashSet&lt;String&gt;(Arrays.asList(two.split(";")); System.out.println(set1.equals(set2));
answers question: http://stackoverflow.com/q/24408481
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37797378

http://stackoverflow.com/comment/37573293
score: 0
comment on: http://stackoverflow.com/q/24310049
type: Comment
type: QuestionComment
has text: Does not help. Tried appending it to my HADOOP_CLASSPATH and also used it alone - still the same error. Iteresting thing - my code compiles OK with this new version of Hadoop, but when it runs - can not resolve class!

http://stackoverflow.com/q/24302009
possible better answer: http://stackoverflow.com/a/24302084
downvote count: 2
score: -2
has answer: http://stackoverflow.com/a/24302618
has body: How can I cast List&lt;String&gt; with List&lt;HeaderInfo&gt; HeaderInfo is my class name public class HeaderInfo{ public HeaderInfo(List&lt;String&gt; list){} public HeaderInfo(){} } public SomeClass{ List&lt;String&gt; lables = new ArrayList&lt;String&gt;(); lables = getAllLabels(); List&lt;HeaderInfo&gt; lables1 = new ArrayList&lt;HeaderInfo&gt;(lables); } I wanted to convert lables to type List&lt;HeaderInfo&gt; so that I can pass it to my custom adapter says undefined
has answer: http://stackoverflow.com/a/24302084
has title: Casting List<String> to List<ClassType> in java(android)
answer count: 3
tagged with: android
linked to: http://stackoverflow.com/q/16071149
favorite count: 0
upvote count: 0
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24302912
accepted answer: http://stackoverflow.com/a/24302912
type: Question

http://stackoverflow.com/comment/37703064
comment on: http://stackoverflow.com/q/24370313
type: Comment
score: 0
type: QuestionComment
has text: @VictorSorokin `ListenableFuture` will launch listeners after task cancellation, as well as after normal termination

http://stackoverflow.com/q/24425237
score: 0
answer count: 3
has body: I have this list of string: private final List&lt;String&gt; categoryList = Arrays.asList("27", "28, 96", "10", "15", "7", "98"); From the above list, "28, 96" is considered as one item (Not a typo). Converting each of them to short have no problems except for that one item: for ( int m = 1; m &lt; categoryList.size(); m++) { short layerValue = Short.parseShort(categoryList.get(m)); } I'm getting this error converting the "28, 96": java.lang.NumberFormatException: For input string: "28, 96" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:492) at java.lang.Short.parseShort(Short.java:117) at java.lang.Short.parseShort(Short.java:143) But if I add it directly: //pmTPSelectList[0].layerRateList = new short[] {layerValue}; pmTPSelectList[0].layerRateList = new short[] {28, 96}; It works properly. So, I'm confused as to why it is and if there's a way to convert it as I need to loop a couple of values to replace the layervalue (Short)??? ty
has answer: http://stackoverflow.com/a/24425313
tagged with: string
accepted answer: http://stackoverflow.com/a/24425333
has answer: http://stackoverflow.com/a/24425301
has answer: http://stackoverflow.com/a/24425333
type: AnsweredQuestion
tagged with: list
has title: Java List<String> to Short
tagged with: java
tagged with: loops
possible better answer: http://stackoverflow.com/a/24425301
has comment: http://stackoverflow.com/comment/37789426
type: Question
tagged with: short
has comment: http://stackoverflow.com/comment/37789366

http://stackoverflow.com/comment/37600997
has text: This has nothing to do with REST. It is about server configuration. Why do you want to access `localhost` over HTTPS?
comment on: http://stackoverflow.com/q/24325335
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24425555
score: 0
has body: Use sComment = commentElement.text(); instead.
has comment: http://stackoverflow.com/comment/37790022
has comment: http://stackoverflow.com/comment/37790878
type: Answer
has comment: http://stackoverflow.com/comment/37790226
has comment: http://stackoverflow.com/comment/37791292
has comment: http://stackoverflow.com/comment/37789801
has comment: http://stackoverflow.com/comment/37791866
answers question: http://stackoverflow.com/q/24425202
has comment: http://stackoverflow.com/comment/37790176
has comment: http://stackoverflow.com/comment/37790481
has comment: http://stackoverflow.com/comment/37790612
has comment: http://stackoverflow.com/comment/37790756

http://stackoverflow.com/q/24383445
has answer: http://stackoverflow.com/a/24384188
score: 2
type: AnsweredQuestion
tagged with: enums
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/24383473
has answer: http://stackoverflow.com/a/24383473
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24383501
has title: Why use static enum?
has answer: http://stackoverflow.com/a/24383735
has comment: http://stackoverflow.com/comment/56429264
answer count: 4
favorite count: 0
accepted answer: http://stackoverflow.com/a/24383501
tagged with: static
has body: Sometimes I saw use static enum in android. but I can't find that information(I know enum in C) example, public static enum brush{ static{ array[0] = brush1; array[1] = brush2; array[2] = brush3; array[3] = brush4; } } but that is occurred error in project. error message is "Syntax error, insert "Identifier" to complete EnumConstantHeader" but I don't understand that's mean.

http://stackoverflow.com/a/24278442
has body: you don't. it already is a boolean expression. something.contains("value") -> this returns either true or false &amp;&amp; somethingElse.equals("one"); -> this also returns true or false. what you need, is either: boolean strCondition = something.contains("value") &amp;&amp; somethingElse.equals("one"); if ( strCondition ) or if ( something.contains("value") &amp;&amp; somethingElse.equals("one")) EDIT: The above would either return true, false, or throw a nasty NullPointerException. To avoid the latter, you should use: if ( "one".equals(somethingElse) &amp;&amp; (something != null &amp;&amp; something.contains("value"))
type: Answer
upvote count: 7
score: 7
accepted answer of: http://stackoverflow.com/q/24278398
answers question: http://stackoverflow.com/q/24278398
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37609055
has text: That was it. If you provide this as an answer I will accept it. THANKS!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24297681

http://stackoverflow.com/comment/37621657
type: Comment
has text: Im using table layout for the whole application(consistency). The table row shouldnt be a problem should it?
score: 0
comment on: http://stackoverflow.com/q/24335682
type: QuestionComment

http://stackoverflow.com/comment/37569262
type: Comment
type: QuestionComment
has text: I have tryed but still the same error
comment on: http://stackoverflow.com/q/24308794
score: 0

http://stackoverflow.com/q/24418118
has comment: http://stackoverflow.com/comment/37776940
score: 0
tagged with: http-post
tagged with: http-get
has comment: http://stackoverflow.com/comment/37776450
answer count: 0
has comment: http://stackoverflow.com/comment/37777148
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37776412
has comment: http://stackoverflow.com/comment/37777040
has body: I don't know how to POST things on a localhost webserver. I don't even know how to make the webserver handle POST requests. I tried the following code and manage to post on an API but have not been able to do the same on my localhost. public class JSONTest { public static String executePost(String targetURL, String urlParameters){ URL url; HttpURLConnection connection = null; try { //Create connection url = new URL(targetURL); connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Length", "" + Integer.toString(urlParameters.getBytes().length)); connection.setRequestProperty("Content-Language", "en-US"); connection.setUseCaches (false); connection.setDoInput(true); connection.setDoOutput(true); //Send request DataOutputStream wr = new DataOutputStream (connection.getOutputStream ()); wr.writeBytes (urlParameters); wr.flush (); wr.close (); //Get Response InputStream is = connection.getInputStream(); BufferedReader rd = new BufferedReader(new InputStreamReader(is)); String line; StringBuffer response = new StringBuffer(); while((line = rd.readLine()) != null) { response.append(line); response.append('\r'); } rd.close(); return response.toString(); }catch (Exception e) { e.printStackTrace(); return null; } finally { if(connection != null) connection.disconnect(); } } public static String test(){ try{ JSONObject obj = new JSONObject(); //JSONArray array = new JSONArray(); obj.put("Products","Successful test"); return "Products="+obj.toString(); } catch (Exception e){ e.printStackTrace(); } return null; } public static void main(String[]args){ executePost("http://&lt;localhost&gt;:9000/SelendroidManager",test()); } } I get the following error: java.io.IOException: Server returned HTTP response code: 500 for URL: http://&lt;localhost&gt;:9000/SelendroidManager at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at Administrator.JSONTest.executePost(JSONTest.java:65) at Ad…
has comment: http://stackoverflow.com/comment/37776479
has title: Getting HTTP Response code 500 for posting on localhost
tagged with: java
has comment: http://stackoverflow.com/comment/37776739
has comment: http://stackoverflow.com/comment/37777058
type: Question
has comment: http://stackoverflow.com/comment/37776765
has comment: http://stackoverflow.com/comment/37777186
has comment: http://stackoverflow.com/comment/37776904

http://stackoverflow.com/comment/37673955
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24363562
has text: Hello Shivam, I am asking you about how to integrate this sample notification app given by parse.com into my existing app. The link does not help :(
score: 0

http://stackoverflow.com/comment/37685053
type: Comment
type: QuestionComment
has text: Please edit your question. Post the code that you tried using, what you actually got and what you expected to get.
comment on: http://stackoverflow.com/q/24351255
score: 0

http://stackoverflow.com/a/24286879
score: 5
accepted answer of: http://stackoverflow.com/q/24286713
answers question: http://stackoverflow.com/q/24286713
upvote count: 5
has comment: http://stackoverflow.com/comment/37595388
type: AcceptedAnswer
downvote count: 0
has body: Renaming sb to just b. This is just a sum of a geometric progression In Java, you can write: return b * (m * m - Math.pow(m, x + 1)) / (1 - m); This will be considerably faster than using a loop, although you must check that m is not 1. If you want to solve for x given a sum S then a rearrangement of the formula gives the following Java code: double x = Math.log(m * m - S * (1 - m) / b) / log(m) - 1; and truncate this result to get the integral value of x where the next integer bankrupts the player.
has comment: http://stackoverflow.com/comment/37532990
type: Answer
has comment: http://stackoverflow.com/comment/37533217

http://stackoverflow.com/comment/84011297
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24365327
type: AnswerComment
has text: Even the sonar specific settings using the -D flag for Maven: -Dsonar.skipPackageDesign=true -Dsonar.skipDesign=true

http://stackoverflow.com/a/24417861
type: Answer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24390492
has body: If you are using a build tools such as Maven, Gradle, sbt, etc. You have to add the dependency plugin to your build file. For Maven,per example, you have to add the following into your pom.xml org.apache.hadoop hadoop-core 1.2.1 You can find the dependency settings for other build tools here

http://stackoverflow.com/comment/127513999
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26647373
score: 0
has text: unfortunately there is no such alternative in openapi.

http://stackoverflow.com/a/24319350
score: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24319266
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24319266
has body: I think you're probably looking for SharedPreferences... "context" is your Activity or Application try: SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); String tickets = prefs.getString("tickets", "???"); Log.d("Prefs", tickets); prefs.edit().putString("tickets", "!!!").commit();
downvote count: 0

http://stackoverflow.com/q/24412974
linked to: http://stackoverflow.com/q/32689185
type: Question
has answer: http://stackoverflow.com/a/24413108
score: 1
tagged with: java
tagged with: caching
has body: I want to use HTTPURLConnection to enable cache which is supported on android based on doc But when using HTTPURLConnection return 401 responseCode . String BASIC_AUTH = "Basic " + Base64.encodeToString((USER+":"+PASS).getBytes(), Base64.NO_WRAP); HttpURLConnection con = (HttpURLConnection) urlObj.openConnection(); con.setConnectTimeout(CONNECT_TIMEOUT); con.setReadTimeout(READ_TIMEOUT); con.setRequestProperty("Authorization", BASIC_AUTH); // Enable cache con.setUseCaches(true); con.setRequestProperty("Content-Type", "application/json"); con.setRequestProperty("Accept", "*/*"); // add reuqest header con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); Log.d("Response Code : ", responseCode + ""); // return 401 When using apache DefaultHttpClient work perfect. DefaultHttpClient httpClient = new DefaultHttpClient(); httpClient.getCredentialsProvider().setCredentials( new AuthScope(null, -1), new UsernamePasswordCredentials(USER,PASS)); HttpResponse httpResponse; HttpEntity httpEntity; String url = apiURL.getURL(); // request method is GET String paramString = URLEncodedUtils.format(params, "utf-8"); url += "?" + paramString; HttpGet httpGet = new HttpGet(url); httpGet.setHeader("Accept", "text/json"); httpResponse = httpClient.execute(httpGet); httpEntity = httpResponse.getEntity(); The question how to set Credentials on HTTPURLConnecion to work like apache DefaultHttpClient.
answer count: 2
has title: Android HttpUrlConnection doesn't support digest authentication?
downvote count: 0
tagged with: httpclient
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/35584655
tagged with: httpurlconnection
upvote count: 1

http://stackoverflow.com/comment/37773053
comment on: http://stackoverflow.com/q/24416002
score: 0
has text: does the child pom have the version number specified?
type: Comment
type: QuestionComment

maven-3
tags question: http://stackoverflow.com/q/24412796
type: Tag
tag name: maven-3
tags question: http://stackoverflow.com/q/24386306
tags question: http://stackoverflow.com/q/24291299
tags question: http://stackoverflow.com/q/24343254
tags question: http://stackoverflow.com/q/24355016
tags question: http://stackoverflow.com/q/24306761
tags question: http://stackoverflow.com/q/24321887

http://stackoverflow.com/q/24310984
favorite count: 0
type: UnansweredQuestion
tagged with: multithreading
has title: HttpPut peformance with Apache HttpClient in a multithread environment
has comment: http://stackoverflow.com/comment/37864971
has body: these days i'm struggling with a quite weird issue regarding Apache HttpClient and threads. The point is that I have a HttpClient shared by all the threads and the use it to execute an HttpPut request to upload a small file (8k aprox.). Well with a small amount of threads everything is allright and the times are good (200-600 milliseconds), but when we start increasing the number of concurrent threads the times are awful (8 seconds). We checked the server to ensure the problem wasn't there. Using jmeter with the same load (1000 threads in a second) we got response times of milliseconds!! The implentation uses a thread-safe connection manager: PoolingHttpClientConnectionManager httpConnectionManager = new PoolingHttpClientConnectionManager(); httpConnectionManager.setMaxTotal(5000); httpConnectionManager.setDefaultMaxPerRoute(5000); HttpClient httpClient = HttpClientBuilder.create() .setConnectionManager(httpConnectionManager) .build(); And the threads run the following code: HttpPut put = new HttpPut(urlStr); put.setConfig(RequestConfig.custom() .setExpectContinueEnabled(true) .setStaleConnectionCheckEnabled(false) .setRedirectsEnabled(true).build()); put.setEntity(new FileEntity(new File("image.tif"))); put.setHeader("Content-Type", "image/tiff"); put.setHeader("Connection", "keep-alive"); HttpResponse response = httpClient.execute(put, HttpClientContext.create()); It looks like if there was a shared resource that has a huge impact when there is a high load. Looking at the sourcecode of Apache Jmeter I don't see relevant differences respect this code. Any idea guys?
tagged with: performance
score: 1
tagged with: java
type: Question
upvote count: 1
downvote count: 0
tagged with: httpclient
has answer: http://stackoverflow.com/a/24464713
answer count: 1

http://stackoverflow.com/q/24317006
accepted answer: http://stackoverflow.com/a/24317258
possible better answer: http://stackoverflow.com/a/24317239
has body: I am new at Java but becoming more and more addicted. I created these classes: Car car1 = new Car(); car1.model = "Toyota"; car1.price = 1500; Car car2 = new Car(); car2.model = "Peugeot"; car2.price = 2600; I calculated the max price with int maxprice=Math.max(car1.price, car2.price); Which is the Peugeot. Now I want to print the model of the calculated price: System.out.println("The most expensive car is "+ ????); Here is the problem. I can't really figure out what goes here. I thought it would be .getmodel or something but I can't get anything to work. I thank you in advance for your help. Thanks.
has answer: http://stackoverflow.com/a/24317239
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37585063
has comment: http://stackoverflow.com/comment/37586573
type: Question
has answer: http://stackoverflow.com/a/24317258
tagged with: java
has title: get a different variable from a calculated class
has comment: http://stackoverflow.com/comment/37585022
tagged with: class
score: 0
answer count: 2

http://stackoverflow.com/a/24407067
has body: It works like that: @Override public boolean onTouch(View v, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_UP) { Your code... } return false; }
has comment: http://stackoverflow.com/comment/37755477
accepted answer of: http://stackoverflow.com/q/24406791
answers question: http://stackoverflow.com/q/24406791
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/37665113
comment on: http://stackoverflow.com/q/24347360
score: 0
type: Comment
type: QuestionComment
has text: OK, so that worked to compile it, but the jar file wont run it. gonna start bangin my head on the wall soon. I'm editing my test file to show what I have in my program in the hopes that somehow it will work in my program the same as it does in the test.

http://stackoverflow.com/comment/37715756
score: 0
comment on: http://stackoverflow.com/q/24384681
type: Comment
has text: read the docs, getExtras returns a Bundle, so call writeToParcel, with Parcel call marshall, the same way go from byte array to Bundle
type: QuestionComment

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/24368903
tags question: http://stackoverflow.com/q/24369296
tags question: http://stackoverflow.com/q/24377153
tags question: http://stackoverflow.com/q/24314252
tags question: http://stackoverflow.com/q/24358784
tags question: http://stackoverflow.com/q/24267082
tag name: android-actionbar

http://stackoverflow.com/comment/37622803
type: QuestionComment
comment on: http://stackoverflow.com/q/24336920
has text: Show us some more code. And what exactly is the reason that you set the layout in PageOne, but add the listener in MainActivity? Also, what does not work? "Does not work" doesn't tell us much.
type: Comment
score: 0

http://stackoverflow.com/comment/37573739
comment on: http://stackoverflow.com/a/24311157
score: 0
has text: What's wrong with, say, `Iterable getItems(){return new ArrayList();}`?
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24387823
has comment: http://stackoverflow.com/comment/37721453
score: 2
answers question: http://stackoverflow.com/q/24387775
has comment: http://stackoverflow.com/comment/37719648
has comment: http://stackoverflow.com/comment/37719272
has body: Your nested loop condition appears to be incorrect, for (int ii = 0; ii &lt; result.get(0).size(); ii++) { should be for (int ii = 0; ii &lt; result.get(i).size(); ii++) { Edit (Based on your comments and edit, next time - please include a Short, Self Contained, Correct (Compilable), Example for better help faster) ArrayList&lt;ArrayList&lt;String[]&gt;&gt; result = new ArrayList&lt;ArrayList&lt;String[]&gt;&gt;(); StringBuilder sb = new StringBuilder(); ArrayList&lt;String[]&gt; t = new ArrayList&lt;String[]&gt;(); t.add(new String[] { "String1" }); t.add(new String[] { "String2" }); t.add(new String[] { "String3" }); result.add(t); result.add(t); for (int i = 0; i &lt; result.size(); i++) { for (int ii = 0; ii &lt; result.get(i).size(); ii++) { if (i != 0 || ii != 0) { sb.append("\n"); } if (ii == 0) { sb.append("k"); } sb.append(result.get(i).get(ii)[0]); } } System.out.println(sb.toString()); Output is kString1 String2 String3 kString1 String2 String3
has comment: http://stackoverflow.com/comment/37719511
has comment: http://stackoverflow.com/comment/37719348
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37719870
upvote count: 2

http://stackoverflow.com/comment/37669320
score: 0
type: Comment
type: QuestionComment
has text: Have a look here http://www.exiv2.org
comment on: http://stackoverflow.com/q/24359460

weakhashmap
tags question: http://stackoverflow.com/q/24325203
tag name: weakhashmap
type: Tag

http://stackoverflow.com/q/24381372
has comment: http://stackoverflow.com/comment/37707946
has comment: http://stackoverflow.com/comment/37709486
type: Question
has comment: http://stackoverflow.com/comment/37707089
has comment: http://stackoverflow.com/comment/37709600
has comment: http://stackoverflow.com/comment/37708530
has comment: http://stackoverflow.com/comment/37709615
has title: Cannot type in output panel in NetBeans
has comment: http://stackoverflow.com/comment/37709546
has comment: http://stackoverflow.com/comment/37709220
score: 0
has comment: http://stackoverflow.com/comment/37707873
tagged with: netbeans
has comment: http://stackoverflow.com/comment/37707699
tagged with: java.util.scanner
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37709752
has comment: http://stackoverflow.com/comment/37707095
has comment: http://stackoverflow.com/comment/37709919
has comment: http://stackoverflow.com/comment/37709974
has body: I try Scanner method from Java, but when I debug in NetBeans, the output panel does not show me anything and same problem with typing into output panel to test the Scanner method. Does anyone, how to fix it ? import java.util.Scanner; import java.io.*; public class HowToUseScanner { public static void main(String[] args) { Scanner sc = new Scanner (System.in); System.out.println(" What is your name ? "); System.out.println("Input =&gt;"); String name = sc.nextLine(); System.out.println("My name is " + name + "."); } } Picture of Netbeans
has comment: http://stackoverflow.com/comment/37707859
tagged with: java

http://stackoverflow.com/q/24399571
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/37741834
downvote count: 1
type: Question
has body: I am trying to add a method in my parent activity that all my activities are inheriting from. I want the method to catch any errors that have not already been handled so the app does not crash. Instead of crashing it will redirect to a failure screen activity. Here is what I have at the moment but it does not work, the app freezes and then goes black: Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread paramThread, Throwable paramThrowable) { redirectToFailureScreen(); } });
has answer: http://stackoverflow.com/a/24399670
score: 0
tagged with: android
answer count: 1
accepted answer: http://stackoverflow.com/a/24399670
favorite count: 0
has comment: http://stackoverflow.com/comment/37742219
type: AnsweredQuestion
has title: Global method to prevent app from crashing?

http://stackoverflow.com/comment/37545155
type: Comment
type: QuestionComment
score: 0
has text: And why is the D/IMAGE_ERROR not included? Or did you comment the media store line? Post more please. The logcat mentions a function saveImage(). But we do not see it in your code.
comment on: http://stackoverflow.com/q/24295081

http://stackoverflow.com/a/28642853
has body: you can use var-char,String,and int ,it depends on you, if you use only country code with mobile number than you can use int,if you use special formate for number than use String or var-char type, if you use var-char then must defile size of number and restrict from user.
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24353778

http://stackoverflow.com/q/24295081
tagged with: external
has comment: http://stackoverflow.com/comment/37545175
has comment: http://stackoverflow.com/comment/37544285
favorite count: 0
has comment: http://stackoverflow.com/comment/37544624
has comment: http://stackoverflow.com/comment/37543882
has comment: http://stackoverflow.com/comment/37544071
has comment: http://stackoverflow.com/comment/37544314
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/37545155
has comment: http://stackoverflow.com/comment/37544270
has comment: http://stackoverflow.com/comment/37544940
has comment: http://stackoverflow.com/comment/37544309
has comment: http://stackoverflow.com/comment/37545121
has comment: http://stackoverflow.com/comment/37544913
has comment: http://stackoverflow.com/comment/37544399
score: 0
tagged with: java
tagged with: save
has comment: http://stackoverflow.com/comment/37543772
has comment: http://stackoverflow.com/comment/37543985
has comment: http://stackoverflow.com/comment/37585319
has comment: http://stackoverflow.com/comment/37544572
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/37544194
type: Question
has comment: http://stackoverflow.com/comment/37544720
answer count: 2
has comment: http://stackoverflow.com/comment/37544249
has answer: http://stackoverflow.com/a/39278272
has body: In my android app, I want to store an image to external storage. I have this code: package async; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; import http.Network; import interfaces.ImageDownloader; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.os.AsyncTask; import android.os.Environment; import android.provider.MediaStore; import android.util.Log; import android.widget.ImageView; public class Async_image_task extends AsyncTask&lt;String, Void, Bitmap&gt; { ImageDownloader callerContext; ImageView calledImageView; String link; public Async_image_task(ImageView calledImageView, String link) { this.callerContext = (ImageDownloader)calledImageView.getContext(); this.calledImageView = calledImageView; this.link = link; execute(link); } @Override protected Bitmap doInBackground(String... params) { Bitmap bitmap = Network.DownloadImage((Context) callerContext, params[0]); if (bitmap != null) { try { String[] segments = link.split("/"); int len = segments.length; String path = Environment.getExternalStorageDirectory().getAbsolutePath(); String imgpath = segments[len-6] + "/" + segments[len-2] + "/" + segments[len-1]; File file = new File(path, imgpath); file.getParentFile().mkdirs(); String abs = file.getAbsolutePath(); OutputStream fOut = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut); fOut.flush(); fOut.close(); MediaStore.Images.Media.insertImage(((Activity)callerContext).getContentResolver(),abs,file.getName(),file.getName()); } catch (Exception e) { Log.d("IMAGE_ERROR", e.getMessage()); } } return bitmap; } @Override protected void onPostExecute(Bitmap bitmap) { callerContext.ImageCallback(bitmap, calledImageView); } } And in the manifest I have this permission: &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; But when it…
has comment: http://stackoverflow.com/comment/37544052
tagged with: image
has comment: http://stackoverflow.com/comment/37544777
has answer: http://stackoverflow.com/a/24295111
has comment: http://stackoverflow.com/comment/37544162
has comment: http://stackoverflow.com/comment/37544149
has comment: http://stackoverflow.com/comment/37544516
has title: Saving image to external storage not working in android
has comment: http://stackoverflow.com/comment/37545242
has comment: http://stackoverflow.com/comment/37543895

http://stackoverflow.com/comment/37709546
comment on: http://stackoverflow.com/q/24381372
has text: I tried it and not, but I made a new project and insert the same code and it has worked in the new project.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24321388
accepted answer of: http://stackoverflow.com/q/24321274
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37593003
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/24321274
has body: I'd try: "Clean and build" option Remove /target/*jar and then Shut down NetBeans ->remove /AppData/Local/NetBeans/Cache (in windows) -> run NetBeans agein You can also try to combine them together if each alone won't work.

http://stackoverflow.com/comment/37753835
type: AnswerComment
has text: Ohk , sorry I could not make that out from the problem statement, I think then in that case your solution would work.
comment on: http://stackoverflow.com/a/24404112
type: Comment
score: 0

http://stackoverflow.com/a/35734257
upvote count: 9
type: Answer
has comment: http://stackoverflow.com/comment/87036336
answers question: http://stackoverflow.com/q/24319143
downvote count: 0
score: 9
has comment: http://stackoverflow.com/comment/66651916
has body: There are many solutions out there that kind of say the same thing without providing a step-by-step. So here was my experience on a Mac'16 with Sublime Text 3: Open a terminal window and do the following: $ cd /Applications/Sublime\ Text.app/Contents/MacOS/Packages/ Made a temp directory to mess with. $ mkdir java Copy current Java.sublime-package into new java directory and cd into java. $ cp Java.sublime-package java/ $ cd java Then, unzip the package to see the contents: $ unzip Java.sublime-package Now, edit the build file, JavaC.sublime-build. If you have sublime text's command line script: $ subl JavaC.sublime-build Otherwise, $ vi JavaC.sublime-build Then I copied the following into my JavaC.sublime-build which I found here posted by Sean Mullen: { "cmd": ["javac \"$file_name\" && java \"$file_base_name\""], "shell": true, "file_regex": "^(...*?):([0-9]*):?([0-9]*)", "selector": "source.java" } After that, save, and while inside the java directory type: $ zip Java.sublime-package * Move new build package to necessary folder (parent directory): $ mv Java.sublime-package ../ UPDATE: 4/18/18: Sorry it took me so long to adjust this answer. Based on comments from @bumbu, we do need to execute the following command before removing the temp directory: $ cd .. Remove temp java directory: $ rm -fr java/ And DONE. Now building the Java file will now attempt to run it as well. I prefer this behavior instead of having to do another "variant" to run the program.

http://stackoverflow.com/q/24309495
answer count: 1
has comment: http://stackoverflow.com/comment/37571164
has answer: http://stackoverflow.com/a/24309773
has comment: http://stackoverflow.com/comment/37571543
tagged with: generics
has title: overriding with different return types (generic collections)
tagged with: collections
has body: Please help me solve the following: class Cat must extend Animal (keep inheritance); Animal.getAll() must return all animals (cats, dogs, etc.) and Cat.getAll() must return only cats (don't alter the signature). I've tried and failed with error The return type is incompatible with Animal.getAll() on line 8. class Animal { public static List&lt;Animal&gt; getAll() { return new ArrayList&lt;Animal&gt;(); } } class Cat extends Animal { public static List&lt;Cat&gt; getAll() { return new ArrayList&lt;Cat&gt;(); } }
has comment: http://stackoverflow.com/comment/37570859
accepted answer: http://stackoverflow.com/a/24309773
type: AnsweredQuestion
tagged with: java
type: Question
score: 0

http://stackoverflow.com/q/24312765
has title: Play Framework: couldn't write meta-data in eclipse project
type: AnsweredQuestion
tagged with: playframework-2.0
has body: I have created a new play project called 'first app'. I then went to the project dir in terminal and used the command "play eclipse". It said that it was successful. I then imported the project into eclipse. This worked, but it gave a warning that 'Periodic workspace save has encountered a problem: it couldn't write meta-data for /RemoteSystemsTempFiles'. Will this be an issue? If so, what should I do about it? On a side note, in the project directory, there are also a lot of resources sitting around. Is this normal for an eclipsified play project?
tagged with: java
has answer: http://stackoverflow.com/a/24323963
type: Question
accepted answer: http://stackoverflow.com/a/24323963
has comment: http://stackoverflow.com/comment/37584061
score: 0
tagged with: playframework
has comment: http://stackoverflow.com/comment/37578049
answer count: 1

http://stackoverflow.com/q/24327860
upvote count: 2
tagged with: button
favorite count: 0
tagged with: android
has body: I am new to libGDX. I am trying to create a custom button by extending com.badlogic.gdx.scenes.scene2d.ui.Button. I want all the button related logic in this class. But I am not getting how to make the click work. I read many tutorials regarding adding Event Listeners but nothing is working. public class RestartButton extends Button { public RestartButton(ButtonStyle style) { super(style); } @Override public void draw(SpriteBatch batch, float parentAlpha) { batch.draw(TextureProvider.getInstance().getRestart(), 175, 100); } } And i am trying to add my button in the screen(i.e in show method) like this RestartButton restartButton; restartButton=new RestartButton(new ButtonStyle()); Stage stage; stage.addActor(restartButton); I am able to see my button on the screen. Now what i want to do is add some code which gets invoked when button is clicked or touched. Can someone please help ?
possible better answer: http://stackoverflow.com/a/24329019
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: scene2d
tagged with: java
has answer: http://stackoverflow.com/a/24329019
type: Question
answer count: 2
tagged with: libgdx
has title: Need help in using scene2d button in libgdx
has answer: http://stackoverflow.com/a/24329299
accepted answer: http://stackoverflow.com/a/24329299

http://stackoverflow.com/comment/37665168
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24358538
has text: okay... thanks 4 ur explanation..
type: AnswerComment

http://stackoverflow.com/comment/37594129
comment on: http://stackoverflow.com/a/24321100
score: 1
type: AnswerComment
has text: @BlackLabrador Usually an application runs and its memory requirement grow and then stay the same (or drop just to grow later again). Your application is a rare exception and I guess nobody cares about such a case. Or there may be some technical difficulty... maybe a good idea for another question. But I've found [this](http://stackoverflow.com/questions/675589) and [this](http://stackoverflow.com/questions/324499) already.
type: Comment

http://stackoverflow.com/q/24331993
type: Question
has title: FFT implementation using Apache Common Math
tagged with: fft
has answer: http://stackoverflow.com/a/24332094
accepted answer: http://stackoverflow.com/a/24332094
score: 0
answer count: 1
type: AnsweredQuestion
tagged with: imagej
tagged with: java
has body: I am trying to implement the FFT in ImageJ and I tried the this: https://stackoverflow.com/questions/24291896/fft-image-is-not-the-same-as-the-fft-image-produced-in-imagej but I could seem to make it work so I thought I would try using Apache Common Math and see what it produces. I have tried the following lines of code but I keep getting an error when I try to do the f. transform(). What am I missing? FastFourierTransformer f = new FastFourierTransformer(null); TransformType type; f.transform(fdata, type.GENERAL); This is the error I get: The method transform(double[], org.apache.commons.math3.transform.TransformType) in the type FastFourierTransformer is not applicable for the arguments (double[], org.apache.batik.ext.awt.g2d.TransformType)

http://stackoverflow.com/q/24371825
has comment: http://stackoverflow.com/comment/37689609
answer count: 0
type: UnansweredQuestion
tagged with: java
has body: I want to analyze the meaning of all the nouns in a text document and want annotate them as object/location etc. (or something similar) For example if the text document contains, Stella went to the kitchen to get a knife. I need to identify kitchen as a location and knife as an object. For the moment I use the wordnet Rita with a java code and identify all the nouns in the text document and get the synset of each word.But I don't know how to analyze each and every meaning of the word and identify the most relevant meaning according to the context and identify it as a object or location etc.
tagged with: wordnet
has comment: http://stackoverflow.com/comment/37689470
type: Question
has comment: http://stackoverflow.com/comment/37697389
has comment: http://stackoverflow.com/comment/37689531
has title: Semantically Analyse words in a text document using wordnet
score: 0

http://stackoverflow.com/comment/37684897
has text: @mohan on mine yea it displaying true even if tz is added
type: Comment
comment on: http://stackoverflow.com/a/24360674
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37584741
comment on: http://stackoverflow.com/q/24316461
score: 0
type: Comment
type: QuestionComment
has text: What build tools are you using?

http://stackoverflow.com/comment/37575524
type: Comment
comment on: http://stackoverflow.com/q/24302991
type: QuestionComment
score: 0
has text: So what is your question? If you just need a regular expression for a string see http://stackoverflow.com/questions/24156948/javacc-quote-with-escape-character , or check out any of the many grammars in the JavaCC repository for languages that have strings.

http://stackoverflow.com/q/24398197
has title: Memory error when running unit tests in SonarQube -- forked VM terminated without saying properly goodbye
upvote count: 2
tagged with: java
tagged with: maven-surefire-plugin
has answer: http://stackoverflow.com/a/24398224
type: UnansweredQuestion
tagged with: sonarqube
has body: We are consistently getting out of memory errors when running our sonar analysis. It is intermittent across machines, but seems once you get it, it persists. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-cli) on project optimus-client-web-configuration: Execution default-cli of goal org.apache.maven.plugins: maven-surefire-plugin:2.16:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ? [ERROR] Command wascmd.exe /X /C ""C:\Program Files\Java\jdk1.7.0_45\jre\bin\java" -javaagent:C:\Users\cxxx\AppData\Local\Temp\jacocoagent8301608889470684052.jar=destfile=target/jacoco.exec,excludes= *_javassist_* -jar C:\redesign_Trunk\optimus-lms-server\optimus-client-web-configuration\target\surefire\surefirebooter2312966376869893038.jar C:\redesign_Trunk\optimus-lms-server\optimus-client-web-con figuration\target\surefire\surefire350975689095180011tmp C:\redesign_Trunk\xxx-xx-server\xxx\target\surefire\surefire_45613339175612175619tmp" The unit tests do not fail with this when running before the sonar phase. It is occurring on one particular test that activates the Spring configuration to test that it works okay. Likely this test consumes more memory than most since it has to load the whole context. I upped memory in MAVEN_OPTS to use 1024M max heap. Added this configuration to my pom org.apache.maven.plugins maven-surefire-plugin 2.16 -Xmx1024m
score: 2
downvote count: 0
favorite count: 0
type: Question
tagged with: out-of-memory
answer count: 2
tagged with: maven
has answer: http://stackoverflow.com/a/41377768

http://stackoverflow.com/comment/37756952
type: Comment
comment on: http://stackoverflow.com/q/24380951
type: QuestionComment
has text: Please post your solution here, so others can benefit from it as well.
score: 0

http://stackoverflow.com/a/24333380
answers question: http://stackoverflow.com/q/24333115
score: 0
type: Answer
has body: You could do the same they do in binary; by having the firstmost digit determine the sign 0b0100 == 4 0b1100 == -4 Similarly you could write {0, 1, 1} == 11 {1, 1, 1} == -11, Although this deviates from the initial idea; since you ARE working with integers, you could do this: {-1, 1} == -11 { 1, 1} == 11

http://stackoverflow.com/q/24368731
score: 0
has body: So I'm trying to retrieve information about Jira issues through REST API using Java, however I keep getting the 400 error. I feel like there's something really stupid that I'm missing, can anyone help me find out what's wrong with this? EDIT: I realised that I'm not sending the username/password to Jira in the Java program, but I'm actually unsure how to do that... Help here would be great! Here is the code I have (company name edited): import java.io.*; import java.net.*; import java.util.*; public class JiraConnector { public static void main(String[] args) { try { //store necessary query information URL jiraURL = new URL("http://jira.somecompany.com/rest/api/2/search"); String data = "'{\"jql\":\"project = PROJ\"}'"; //establish connection and request properties HttpURLConnection connection = (HttpURLConnection)jiraURL.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Accept", "*/*"); connection.setRequestProperty("Content-Type", "application/json"); connection.setDoOutput(true); connection.setDoInput(true); connection.connect(); OutputStreamWriter wr = new OutputStreamWriter(connection.getOutputStream()); wr.write(data.toString()); wr.flush(); wr.close(); Reader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); for (int c; (c = in.read()) &gt;= 0; System.out.print((char)c)); } catch (MalformedURLException e) { System.err.println("MalformedURLException: " + e.getMessage()); } catch (java.net.UnknownServiceException e) { System.err.println("UnknownServiceException: " + e.getMessage()); } catch (IOException e) { System.err.println("IOException: " + e.getMessage()); } } } For the record, using this curl command works: curl -D- -u- user:password -X POST -H "Content-Type: application/json" --data '{"jql:"project=PROF"}' "http://jira.somecompany.com/rest/api/2/search"
tagged with: jira-rest-api
has answer: http://stackoverflow.com/a/24369858
answer count: 4
possible better answer: http://stackoverflow.com/a/24371123
has answer: http://stackoverflow.com/a/31819151
type: AnsweredQuestion
has title: HTTP POST request to JIRA using Java yields 400 bad request error, curl works fine
tagged with: java
tagged with: http
accepted answer: http://stackoverflow.com/a/24424571
tagged with: post
tagged with: jira
type: Question
has answer: http://stackoverflow.com/a/24424571
has answer: http://stackoverflow.com/a/24371123

http://stackoverflow.com/q/24288787
has answer: http://stackoverflow.com/a/24288899
answer count: 1
has body: I am working on a project where I need to create some rules using the Jena freamwork. I have created the rules and they work as they should. I can see the output on the screen but what I would like to do is storing the result into the model of ontology I have. I have this code : @prefix ex: &lt;http://www.semanticweb.org/prova_rules_M#&gt; . @prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt; . @prefix xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt; . @include &lt;OWL&gt; [pippo: (?p http://www.semanticweb.org/prova_rules_M#anni_persona ?x) &lt;- (?p rdf:type ex:Persona) (?p http://www.semanticweb.org/prova_rules_M/persona#data_nascita ?c) myDiffDateYear(?c,"2014-06-18T00:00:00.0"^^xsd:dateTime,?x) ] In this example I am using a custom built-in which I have created previously. It returns the number of years of difference between two dates. I can see the output in my screen thanks to the following code : String percorsoFile ="./prova_rules_M_rdf.owl"; String ruleFile= "./prova_rules_M_rdf_7_diffDate.txt"; Model rawModel = ModelFactory.createDefaultModel(); //create a resource (empty model) Resource configuration = rawModel.createResource(); // set engine mode configuration.addProperty(ReasonerVocabulary.PROPruleMode, "hybrid"); // set the rules file configuration.addProperty(ReasonerVocabulary.PROPruleSet, ruleFile); List&lt;Rule&gt; rules = Rule.rulesFromURL(ruleFile); GenericRuleReasoner reasonerRULE = (GenericRuleReasoner) GenericRuleReasonerFactory.theInstance().create(configuration); reasonerRULE.setRules(rules); Model modelRULE= FileManager.get().loadModel(percorsoFile); //create the inference model InfModel infModelRULE = ModelFactory.createInfModel(reasonerRULE, modelRULE); //force starting the rule execution infModelRULE.prepare(); //write down the result in RDFXML form infModelRULE.write(System.out); How can I write the result of the data property "anni_persona" inside my model (and not only as output) ? Thank you.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24288899
tagged with: jena-rules
tagged with: java
tagged with: ontology
tagged with: protege
has title: How to write the result of a rule, into a model (in Jena)?
type: Question
tagged with: jena
score: 0

http://stackoverflow.com/comment/37687710
comment on: http://stackoverflow.com/q/24347465
has text: please have the mysql-connector.jar in the classpath
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37578513
type: Comment
comment on: http://stackoverflow.com/a/24312976
score: 0
type: AnswerComment
has text: @RaghavTandon it is a race condition. When `Thread2#run` is executed, code in `Thread1#run` had executed, so `boolean b=isTrue;` was executed and `b` will be `true`. Note that the order of the execution of methods cannot be guaranteed, so in any of your executions `Thread2#run` may execute before `Thread1#run` and the application finished w/o even executing the code inside the `while` loop in `print` method.

http://stackoverflow.com/comment/37550117
comment on: http://stackoverflow.com/q/24298640
score: 0
type: Comment
type: QuestionComment
has text: where's your `JavaScript` code ? there's only `html` and `scriplet`..

http://stackoverflow.com/comment/37650934
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24337913
has text: I´m sorry for bothering but I just can´t get it done. Any possible way that you can clarify it for me a bit?

list
type: Tag
tags question: http://stackoverflow.com/q/24392682
tags question: http://stackoverflow.com/q/24405213
tags question: http://stackoverflow.com/q/24345073
tags question: http://stackoverflow.com/q/24353628
tags question: http://stackoverflow.com/q/24351459
tags question: http://stackoverflow.com/q/24425237
tag name: list
tags question: http://stackoverflow.com/q/24319855
tags question: http://stackoverflow.com/q/24273328
tags question: http://stackoverflow.com/q/24375035
tags question: http://stackoverflow.com/q/24341307
tags question: http://stackoverflow.com/q/24292827
tags question: http://stackoverflow.com/q/24368864
tags question: http://stackoverflow.com/q/24333482
tags question: http://stackoverflow.com/q/24287393
tags question: http://stackoverflow.com/q/24274124
tags question: http://stackoverflow.com/q/24319584
tags question: http://stackoverflow.com/q/24333115
tags question: http://stackoverflow.com/q/24421599

http://stackoverflow.com/q/24425935
has comment: http://stackoverflow.com/comment/37791453
has comment: http://stackoverflow.com/comment/37792744
type: Question
has comment: http://stackoverflow.com/comment/37793051
accepted answer: http://stackoverflow.com/a/24428618
has comment: http://stackoverflow.com/comment/37791370
linked to: http://stackoverflow.com/q/6559859
score: 0
answer count: 3
upvote count: 1
linked to: http://stackoverflow.com/q/6340918
has answer: http://stackoverflow.com/a/24428618
downvote count: 1
has answer: http://stackoverflow.com/a/24426572
linked to: http://stackoverflow.com/q/15405581
has title: Java SSL Socket Programming
favorite count: 0
tagged with: sockets
has comment: http://stackoverflow.com/comment/37791258
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37791054
has body: I read about the SSLSocket when i had already finished a Chat program with java that use normal ServerSocket. I am trying to replace the normal ServerSocket with SSlSocket, there is not much on the internet but i found something. Now my WhServer class look like this: This class is the one which start the Socket in a selected port, if you need to see other classes i will edit the question: import java.io.IOException; import java.net.*; import javax.net.ServerSocketFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; public class WhServer extends Thread { private int port; private ServerSocket server; private ChannelsManager manager; SSLContext context; SSLSocketFactory sslSf; public WhServer(int port, ChannelsManager manager) throws IOException { this.port = port; this.manager = manager; } public void ServerStop() throws IOException{ server.close(); } public WhServer(int port) throws IOException { this(port, new ChannelsManager()); } public int getPort() { return port; } public void run() { try { while(true) { ServerSocketFactory ssf = ServerSocketFactory.getDefault(); server = ssf.createServerSocket(port); Socket socket = server.accept(); sslSf = context.getSocketFactory(); SSLSocket sslSocket = (SSLSocket) sslSf.createSocket(socket, null,socket.getPort(), false); sslSocket.setUseClientMode(false); manager.initialite(socket); } } catch(Exception ex) { ex.printStackTrace(); } } }
tagged with: java
tagged with: ssl
possible better answer: http://stackoverflow.com/a/24426572
has answer: http://stackoverflow.com/a/33306559

http://stackoverflow.com/comment/37710841
comment on: http://stackoverflow.com/a/24361992
type: AnswerComment
has text: Just free your RAM - turn off any program you don't need so you have free 2G for the compiler.
type: Comment
score: 0

http://stackoverflow.com/q/24309655
score: 1
has answer: http://stackoverflow.com/a/24311590
favorite count: 0
type: Question
tagged with: spring
has title: Subsets of Properties With Spring
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/37571280
has comment: http://stackoverflow.com/comment/37571458
tagged with: java
has answer: http://stackoverflow.com/a/24311242
type: UnansweredQuestion
has body: Suppose I have a properties file with contents looking like this: local.jndi.datasource = localDataSource dev.jndi.datasource = devDataSource test.jndi.datasource = testDataSource prod.jndi.datasource = prodDataSource I have system variables called "app.configDir" and "app.environment". The app.environment variable can be "local","dev","test", or "prod". What I would like to do is something like this: &lt;context:property-placeholder location="file:#{systemProperties['app.configDir'] }/&gt; However, I would like to have the properties narrowed down to the subset defined in the environment variable. Is there a relatively easy way to do this in XML configuration? I can think of a couple of ways to do this if I were able to use programatic configuration. Edit: Currently using Spring 3.1.
downvote count: 0

http://stackoverflow.com/comment/37713342
type: Comment
comment on: http://stackoverflow.com/a/24384634
score: 1
type: AnswerComment
has text: Its a good suggestion, although HttpClient specifically isn't really relevant to this question. Its about receiving a request, not sending one ;)

http://stackoverflow.com/comment/49245898
type: AnswerComment
score: 0
type: Comment
has text: Didn't work to me. BTW, why 1337 is only available to `root`? I know that ports below 1024 are root privileged.
comment on: http://stackoverflow.com/a/24528586

http://stackoverflow.com/a/24270825
has body: The problem is here: contentPane.add(textPane, BorderLayout.CENTER); At this point, you haven't set up textPane. You set it up 4 lines later: textPane = new JTextPane(); textPane.setBackground(Color.DARK_GRAY); textPane.setEditable(false); textPane.setMargin(null); textPane.setContentType("text/html"); You need to add it to the pane after initializing. Simple debugging would have fixed this problem for you. SO is not an appropriate place for "fix my code" questions.
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/37497267
has comment: http://stackoverflow.com/comment/37498513
has comment: http://stackoverflow.com/comment/37498594
has comment: http://stackoverflow.com/comment/37498087
score: 4
has comment: http://stackoverflow.com/comment/37497225
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24270777
has comment: http://stackoverflow.com/comment/37498655
has comment: http://stackoverflow.com/comment/37499313
answers question: http://stackoverflow.com/q/24270777

http://stackoverflow.com/comment/37602898
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24322824
type: AnswerComment
has text: Will I replace the [default|<indexName>] with something? or that's it?

http://stackoverflow.com/comment/37759050
has text: Downvoters, now that this question is properly formatted, I do not see how this question is invalid? It pertains to streams and flushing. Care to comment why downvoted?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24409002
score: 3

http://stackoverflow.com/a/24349993
score: -1
upvote count: 0
has body: Heres some things you should all the time with your code Use consistent formatting and make sure things are indented to the correct location. This means that if you have code inside brackets ({}) that they are are indented 1 and only 1 tab in (tab or 4 space w/e...). in Java classes are always started with an uppercase and non static final variables are started with lower case variables, the variables Balance, Owner and AcctNo would be more suitable to start with lower case characters. If you follow those formatting steps it will be much easier to debug and read your code. Now your problem is your withdraw and deposit methods for 1 dont have a variable in the arguments. You need to add a variable to the method signature. public void deposit(double ammount) {.... Then you have the statement 0=deposit+Balance; which I dont know what your intending to do there but it is invalid Java. It probably should read: Balance=Balance+deposit.
answers question: http://stackoverflow.com/q/24349894
type: Answer
downvote count: 1

neo4j
tags question: http://stackoverflow.com/q/24305681
tags question: http://stackoverflow.com/q/24274364
tag name: neo4j
tags question: http://stackoverflow.com/q/24407600
tags question: http://stackoverflow.com/q/24348566
tags question: http://stackoverflow.com/q/24330121
tags question: http://stackoverflow.com/q/24340483
tags question: http://stackoverflow.com/q/24372301
tags question: http://stackoverflow.com/q/24321306
tags question: http://stackoverflow.com/q/24268744
type: Tag
tags question: http://stackoverflow.com/q/24340722
tags question: http://stackoverflow.com/q/24368176
tags question: http://stackoverflow.com/q/24277315

http://stackoverflow.com/comment/37541436
type: Comment
comment on: http://stackoverflow.com/a/24293937
type: AnswerComment
has text: It matches `ansid` as well.
score: 0

http://stackoverflow.com/comment/37726566
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24390997
type: Comment
has text: Thanks for completely misquoting me and specifically naming me, that is really going to help someone to understand what you are talking about. And again you ask something entirely different from what you really want to know. You do not want to know if an EJB is running, you are asking about connectivity problems from a client to the server. And that is as much as I am going to say about this AGAIN.

http://stackoverflow.com/a/57869487
downvote count: 0
answers question: http://stackoverflow.com/q/24399613
has comment: http://stackoverflow.com/comment/118544981
score: 4
type: Answer
upvote count: 4
has body: I know it's old topic but I had similar issue: The archetype:generate goal has a parameter outputDirectory, you can set it to root folder (../). When generating artifact from archetype it's important that your artifact name is same as current directory. mvn archetype:generate -DarchetypeGroupId=[archetype-group] -DarchetypeArtifactId=[archetype-id] -DoutputDirectory=../ -DartifactId=[current-folder-name] -DgroupId=[whatever-you-want] -Dversion=[ex: 0.1] -Dpackage=[jar|pom|etc.] -B

http://stackoverflow.com/a/24321396
has comment: http://stackoverflow.com/comment/37593024
has comment: http://stackoverflow.com/comment/115718577
has comment: http://stackoverflow.com/comment/37593728
score: 4
has comment: http://stackoverflow.com/comment/37593026
has comment: http://stackoverflow.com/comment/37593308
answers question: http://stackoverflow.com/q/24321280
has body: JPA only updates the version only when there really exists some dirty data (uncommitted) present in the entity. I assume Student 195948 already had semester value as "1". Though you are setting the value, which is equal to the previous value, ideally there is no change in the entity state. Hence JPA is not updating the version value. If you set the semester value to different value (not the earlier one), then there is a change in the state of the entity and it updates the version column accordingly. Thanks, Jagan
has comment: http://stackoverflow.com/comment/37595349
has comment: http://stackoverflow.com/comment/37593832
has comment: http://stackoverflow.com/comment/37593719
type: Answer
has comment: http://stackoverflow.com/comment/37595429
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/24320727
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24320493
has comment: http://stackoverflow.com/comment/37618472
has comment: http://stackoverflow.com/comment/37592567
has body: Try using a 'working set' to group multiple projects into a collapsible item.
answers question: http://stackoverflow.com/q/24320493

http://stackoverflow.com/a/24330475
has body: Sounds Good, You want to use JSP Standard Tag Library instead of Scriplet. Yes, It's possible using c:set. Read more about Core Tag Library &lt;c:set var="enablebtnRelatedDocs" value="${true}" scope="request"/&gt; &lt;c:out value="${requestScope.enablebtnRelatedDocs }"/&gt; By default c:set set a attribute in page context. you can set it in any scope.
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37610378
answers question: http://stackoverflow.com/q/24330155
upvote count: 11
has comment: http://stackoverflow.com/comment/37610598
accepted answer of: http://stackoverflow.com/q/24330155
score: 11
has comment: http://stackoverflow.com/comment/37610720

http://stackoverflow.com/comment/37588892
type: AnswerComment
has text: And yes, make sure that the passwords on the server are hashed and the connection is over SSL. MySQL has builtin functions for password hashing. Let the server do the encrypt/decrypt so if someone get's access to the table, they just see the encrypted values.
type: Comment
comment on: http://stackoverflow.com/a/24319011
score: 0

http://stackoverflow.com/a/24359211
score: 3
has comment: http://stackoverflow.com/comment/37666088
has comment: http://stackoverflow.com/comment/37666822
answers question: http://stackoverflow.com/q/24359175
downvote count: 1
has comment: http://stackoverflow.com/comment/37666668
has comment: http://stackoverflow.com/comment/37666127
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/37666791
has comment: http://stackoverflow.com/comment/37666136
has body: Short is a 16bit You can call Random class to generate random number on the range of Short.MAX_VALUE, which is around 0-65535. by adding the Short.MAX_VALUE and Short.MIN_VALUE sample: new Random().nextInt(1 + Short.MAX_VALUE - Short.MIN_VALUE);
has comment: http://stackoverflow.com/comment/37666699

http://stackoverflow.com/comment/37580282
type: Comment
type: QuestionComment
has text: Dont do the entire file at once. Break it into chunks.
score: 2
comment on: http://stackoverflow.com/q/24314578

http://stackoverflow.com/a/25658747
answers question: http://stackoverflow.com/q/24325977
has comment: http://stackoverflow.com/comment/55731808
score: 0
upvote count: 1
has body: System.setProperty('socksProxyHost','127.0.0.1'); System.setProperty('socksProxyPort','9051'); Add this two line in your main method and use vidalia for tor
type: AcceptedAnswer
downvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/24325977
has comment: http://stackoverflow.com/comment/40948888

http://stackoverflow.com/a/24410637
has comment: http://stackoverflow.com/comment/37762318
answers question: http://stackoverflow.com/q/24410235
upvote count: 1
has comment: http://stackoverflow.com/comment/37775130
score: 1
has body: Regarding your first Question: + in Regex means: "multiple times, but at least one time", meaning that you defenitely want a digit before the rest of the pattern. If you want just letters to be possible as well, use * instead, which is: "zero or more times". Not sure if that makes sense though, if you are going for house numbers (probably can depent on different systems in different areas/countries). The second one probably has similar problems...
downvote count: 0
type: Answer

http://stackoverflow.com/q/24387505
has comment: http://stackoverflow.com/comment/37725096
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37719790
has comment: http://stackoverflow.com/comment/37718797
has comment: http://stackoverflow.com/comment/37721241
has comment: http://stackoverflow.com/comment/37718883
has body: I have a 54,120 byte JSON file which is all on one line I'm trying to read this into a String in an Android application using: //Method from class FileManager public String readInternalFile(String filename) throws IOException { Log.d(getClass().getName(),"Reading Internal File: " + filename); // Open file FileInputStream fIS = context.openFileInput(filename); Log.d(getClass().getName(),"File is " + fIS.available() + " bytes"); // Process file String s = ""; int ch; while ((ch = fIS.read()) != -1) { s += (char) ch; } //Close InputStream if(fIS!= null){ fIS.close(); } Log.d(getClass().getName(),"File is " + s.length() + " characters long"); return s; } When I run this in my JUnit test application or in an Emulator I get a wall of Log text for the garbage collector: This never seems to end and is slowing down my application. Is there a way I can read this in that wouldn't cause this? If it helps the JSON file can be accessed here. It's just a news Feed.
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/37718757
type: Question
has answer: http://stackoverflow.com/a/24390586
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/37718792
score: 0
tagged with: fileinputstream
has title: Memory leak when reading a file in Java
answer count: 1

http://stackoverflow.com/comment/37535423
has text: [http://stackoverflow.com/questions/2457239/injecting-mockito-mocks-into-a-spring-bean](http://stackoverflow.com/questions/2457239/injecting-mockito-mocks-into-a-spring-bean)
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24290633

http://stackoverflow.com/comment/51265786
type: Comment
has text: I would advise checking the github page as EWS Java was open sourced last year, thank goodness. I believe this bug (among others) has been fixed.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24416678

http://stackoverflow.com/a/44624488
answers question: http://stackoverflow.com/q/24386771
upvote count: 14
score: 14
has body: Regarding the Hibernate validator documentation page, you have to define a dependency to a JSR-341 implementation: org.glassfish javax.el 3.0.1-b11
downvote count: 0
type: Answer

http://stackoverflow.com/comment/37497342
has text: possible duplicate of [What is a Null Pointer Exception, and how do I fix it?](http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it)
comment on: http://stackoverflow.com/q/24270777
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/24394087
has comment: http://stackoverflow.com/comment/37731842
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37731637
has title: How can I save a image file from a String in Java?
has comment: http://stackoverflow.com/comment/42685263
has answer: http://stackoverflow.com/a/24400951
type: Question
tagged with: arrays
has body: I need read a file, extract the bytes and add the &lt;segment&gt;&lt;/segment&gt; tag. Then I have to extract the bytes and extract what is between &lt;segment&gt; label. Finally, the tag data will be used to make an exact copy of the original image... but my problem is that the image does not look like the original. With text files works fine but not with images. This is my java code. Is easy: public class MyFile { public static void main(String[] args) { try{ /* Read File */ File aFile= new File("infinito.jpg"); FileInputStream fis = new FileInputStream(aFile); long sizeFichero = aFile.length(); byte []datos = new byte[(int) sizeFichero]; fis.read(datos); fis.close(); /* Write copy file */ File copyFile = new File("infinto_COPY.jpg"); FileOutputStream fos = new FileOutputStream(copyFile); /* Add bytes to array bytes */ ByteArrayOutputStream outputStream = new ByteArrayOutputStream( ); outputStream.write("&lt;segment&gt;".getBytes()); outputStream.write(datos); outputStream.write("&lt;/segment&gt;".getBytes()); byte [] bytes = outputStream.toByteArray(); /* Regular Expression */ String text = new String(bytes); String regexpr = "&lt;segment&gt;(.*?)&lt;/segment&gt;"; Pattern pat = Pattern.compile(regexpr, Pattern.MULTILINE | Pattern.DOTALL); Matcher mat = pat.matcher(text); /* If find between &lt;segment&gt;&lt;/segment&gt; then write file */ if (mat.find()){ String group1 = mat.group(1); fos.write(group1.getBytes()); fos.close(); } } catch (IOException e) { e.printStackTrace(); } } } The result. Original and the copy: How could I do it by analyzing regular expression? Thank you very much.
has comment: http://stackoverflow.com/comment/37731467
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24400951
has comment: http://stackoverflow.com/comment/37733377
tagged with: regex

http://stackoverflow.com/a/24370331
type: AcceptedAnswer
downvote count: 0
has body: It is only needed for the main jar - the Java 8 documentation says This attribute is required in the manifest of the main JAR file for the RIA, secondary JAR files and extensions are not required to have the Permissions attribute. However there were a few bugs (like this one or this one) when Oracle first rolled out this functionality, and there may still be some lurking. I notice several reports of the second quote bug which have all be closed as 'Cannot Reproduce'. You might want to check that your scenario works as expected with the most up-to-date version of Java.
accepted answer of: http://stackoverflow.com/q/24305861
answers question: http://stackoverflow.com/q/24305861
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/37677099
has text: How can I found out without counting manually? I'm a little new to eclipse :)
comment on: http://stackoverflow.com/q/24365370
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37514166
has text: This is not covariance. In `Impl` you're overloading (try putting `@Override` there).
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/24279691
type: Comment

http://stackoverflow.com/comment/37556538
type: QuestionComment
type: Comment
has text: http://stackoverflow.com/a/21099135/1654265
comment on: http://stackoverflow.com/q/24301980
score: 0

http://stackoverflow.com/comment/37651413
score: 1
has text: I know those method but why I am going through those method when libraries and API are available. And I think I have to setup more things after that. It doesn't help me that much
type: AnswerComment
comment on: http://stackoverflow.com/a/24351904
type: Comment

http://stackoverflow.com/comment/37544116
type: Comment
comment on: http://stackoverflow.com/a/24295244
has text: My file has no blank lines, but forgot I was using a text editor and after I hit enter to separate data, that will be read as a new line. Did what you did with a (!line.isEmpty()) and it works. Thank you.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37625930
score: 1
comment on: http://stackoverflow.com/q/24293945
type: Comment
type: QuestionComment
has text: Take a look at [this](http://www.byteslounge.com/tutorials/spring-change-transaction-isolation-level-example). I haven't tried it myself, but looks like a good place to start.

http://stackoverflow.com/a/24403916
type: Answer
has body: You can create a @ClassRule for your test suite. It is invoked for each test. See API and Example for ExternalResource on how to apply before/after.
upvote count: 5
answers question: http://stackoverflow.com/q/24403801
score: 5
downvote count: 0

http://stackoverflow.com/comment/37492749
type: QuestionComment
comment on: http://stackoverflow.com/q/24268452
has text: @IllegalArgument could you please tell me or show me the code how to use viewTreeobsrver() inside the button onclick method thanks.
score: 0
type: Comment

http://stackoverflow.com/comment/135191362
type: Comment
score: 1
has text: Should probably be noted that the above solution will return true for an empty list.
comment on: http://stackoverflow.com/a/24304199
type: AnswerComment

http://stackoverflow.com/a/24358024
has comment: http://stackoverflow.com/comment/37733586
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37695064
has comment: http://stackoverflow.com/comment/37724091
accepted answer of: http://stackoverflow.com/q/24356585
has body: You can create a separate thread for each message, which will require a separate connection to the mail server. Depending on your mail server, it may limit the number of connections you can use. You can also send the messages serially, using a single connection. Again, depending on your mail server, it may limit the number of messages you can send in a single connection.
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/37683891
answers question: http://stackoverflow.com/q/24356585
has comment: http://stackoverflow.com/comment/37802955
downvote count: 0

http://stackoverflow.com/comment/37620346
comment on: http://stackoverflow.com/a/24335451
has text: okay, in this case as n increases, I seem to be getting a smaller output, from 10 being ~.8 to 5000 being ~.49
score: 0
type: AnswerComment
type: Comment

android-lifecycle
tags question: http://stackoverflow.com/q/24293969
tags question: http://stackoverflow.com/q/24344610
type: Tag
tag name: android-lifecycle
tags question: http://stackoverflow.com/q/24315270

http://stackoverflow.com/comment/37511219
type: QuestionComment
has text: Well, I can imagine a *really* bad (and probably useless) solution involving methods with side effects, but you probably really don't want to do that.
type: Comment
comment on: http://stackoverflow.com/q/24278179
score: 0

http://stackoverflow.com/comment/37687435
has text: `future.isCancelled()` can be pre-evaluated speculativelly with result caching. Speculative optimizer can do such tricks. He thinks that `isCancelled()` and `isDone()` calling are commutative, because he sees that no one can detect an actual calling order.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24370313

http://stackoverflow.com/q/24296059
possible better answer: http://stackoverflow.com/a/24296132
tagged with: enums
has comment: http://stackoverflow.com/comment/37545677
tagged with: java
has answer: http://stackoverflow.com/a/24296173
has body: I am trying to store and retrieve an enum class so I can later find the correct type (based on configuration) and call ValueOf on it to parse a string. How do I put/get and then call the ValueOf? In pseudo code it would look something like this: enum MyType { VAL1, VAL2 }; enum MyColors { BLUE, RED }; Map&lt;String, Class&gt; map = Maps.newHashMap(); map.put("key1", MyType.class); //this is the MyType enum above map.put("colors", MyColors.class); //this is the MyColors enum above ... String inputType = "colors"; String inputValue = "BLUE"; Class c = map.get(inputType); assertEquals(MyColors.BLUE, c.ValueOf(inputValue)); //here I want MyColors.ValueOf() to get called Class c2 = map.get("key1"); assertEquals(MyType.VAL1, c.ValueOf("VAL1")); //here I want MyType.ValueOf() to get called How can I do this? To give some background on why I am doing this - I have multiple such enum types and I get an input which tells me what kind of enum it is (in text) and one of the values from the enum, so I want to look up the enum class from the map and then call the static ValueOf on it which will parse correctly. Note - I do not want to store MyType objects in the map, I want to store class references Thanks!
upvote count: 2
downvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/37545570
has comment: http://stackoverflow.com/comment/37548601
favorite count: 0
has answer: http://stackoverflow.com/a/24296132
score: 0
has comment: http://stackoverflow.com/comment/37548497
has comment: http://stackoverflow.com/comment/37548464
has title: How do I store Enum types into a map?
has comment: http://stackoverflow.com/comment/37549100
has comment: http://stackoverflow.com/comment/37548519
accepted answer: http://stackoverflow.com/a/24296173
has answer: http://stackoverflow.com/a/24296153
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/24288709
has body: Though we move ahead with Java versions, why are we maintaining support of primitives ( which are not objects consitituting to not making 100% OOP language ). Wrapper classes around the primitives comes with support of auto boxing &amp; unboxing as well. Few main reasons I could think of are : Though conversion happens automatically with (un)boxing support, behind the scenes it still does run .intValue() to get its associated primitive value to perform calculation &amp; then stores back to its corresponding Integer object. Integer a=3,b=5; // Below will do a.intValue()+b.intValue() &amp; then store/display, if I am correct. System.out.println(a+b); And also using wrapper class objects consumes heap space as opposed to performing arithematic operations using primitives on stack space. I read something stating : its for support of some Enumeration classes as a backward compatibility reason? Is above listed reasons not leading to non-elimination / making deprecated on primitives usage?.
has comment: http://stackoverflow.com/comment/37532006
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37531506
has comment: http://stackoverflow.com/comment/37531170
tagged with: wrapper
linked to: http://stackoverflow.com/q/5199359
favorite count: 0
tagged with: primitive-types
duplicate of: http://stackoverflow.com/q/5199359
answer count: 0
type: Question
score: 0
has title: Java primitives support elimination? and exact purpose of retaining with new Java version release
upvote count: 1
downvote count: 1
tagged with: oop
tagged with: java

http://stackoverflow.com/a/24426790
has comment: http://stackoverflow.com/comment/50571870
type: Answer
has comment: http://stackoverflow.com/comment/37792130
has comment: http://stackoverflow.com/comment/37792199
answers question: http://stackoverflow.com/q/24426635
has comment: http://stackoverflow.com/comment/37792049
accepted answer of: http://stackoverflow.com/q/24426635
downvote count: 1
has body: I think this happens when you run the app from eclipse while you already have the previous version installed ? This won't happen if you uninstall the app before running it again from eclipse. Also, this won't cause any problems.
upvote count: 16
has comment: http://stackoverflow.com/comment/50649462
has comment: http://stackoverflow.com/comment/37792278
has comment: http://stackoverflow.com/comment/37791962
has comment: http://stackoverflow.com/comment/37792352
score: 15
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37792521
has comment: http://stackoverflow.com/comment/106854000

http://stackoverflow.com/comment/37528669
type: Comment
comment on: http://stackoverflow.com/a/24287031
has text: Java 7 docs also seem to think phaser.register(); while (!phaser.isTerminated()) phaser.arriveAndAwaitAdvance(); is an acceptable usage approach?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37658573
type: Comment
type: QuestionComment
score: 0
has text: When I start it from the IDE I'm not using maven. Jetty version 9.2.1.v20140609
comment on: http://stackoverflow.com/q/24355374

http://stackoverflow.com/q/24282398
has comment: http://stackoverflow.com/comment/37561095
answer count: 0
has comment: http://stackoverflow.com/comment/37559302
score: 1
has comment: http://stackoverflow.com/comment/37520272
tagged with: java
upvote count: 1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37520098
type: Question
has comment: http://stackoverflow.com/comment/37519277
tagged with: liferay
downvote count: 0
tagged with: tomcat
has body: I have scenario where I develop my liferay portlets through eclipse deploy them on tomcat server integrated in eclipse. Whenever I get an exception, I am able to trace it through console as the complete stacktrace is displyed there. But, when i deploy the same portlets on to my stage and production server I am not able to see any exception in the command prompt / terminal / putty where catalina.out is displayed live. Please tell me a way to achieve that or a workaround that. If possible, please state the merits and demerits for the same.
has comment: http://stackoverflow.com/comment/37560313
has comment: http://stackoverflow.com/comment/37559093
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37560173
has title: Get complete logs in tomcat console in catalina.out
tagged with: liferay-6

http://stackoverflow.com/comment/37716399
has text: yes, it popup the message if username and password is not true
comment on: http://stackoverflow.com/q/24385600
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24275019
has comment: http://stackoverflow.com/comment/37508999
tagged with: java
score: 0
tagged with: load-balancing
answer count: 1
has answer: http://stackoverflow.com/a/24277377
has comment: http://stackoverflow.com/comment/37506072
has body: I believe this could be applied to any application but in this case I am talking about a minecraft server (java). Occasionally the server will receive spikes mostly in CPU usage and I am wondering if it is possible to then share this load with another virtual machine. When I get times of high CPU load I would like to be able to boot up another VM in the same cloud service that will then share the CPU load. Is this possible to do? I know this is the idea behind availability sets and I understand how that would work in terms of a website etc, but not sure how this could be applied or if it can be applied to something like a game server where the application can only be run on the one machine at a time.
has comment: http://stackoverflow.com/comment/37509617
tagged with: azure
type: UnansweredQuestion
tagged with: cpu
has comment: http://stackoverflow.com/comment/37509669
has title: How can I scale a single application in Microsoft Azure?
type: Question

http://stackoverflow.com/comment/37543488
type: Comment
type: QuestionComment
has text: `List<? extends ElementParent>`.
comment on: http://stackoverflow.com/q/24294782
score: 0

http://stackoverflow.com/a/24362772
answers question: http://stackoverflow.com/q/24361283
has body: Write another controller which returns another.jsp From your test.jsp, give window.location = /home/test?lat1=' + l1 + '&amp;lat2=' + l2; once the json data is processed, redirect to the another controller.
score: 0
type: Answer

http://stackoverflow.com/comment/37681045
type: QuestionComment
comment on: http://stackoverflow.com/q/24367503
type: Comment
has text: For simplicity, at the moment. I don't need the extra layer at this point in application's lifecycle.
score: 0

constructor
tags question: http://stackoverflow.com/q/24326066
tags question: http://stackoverflow.com/q/24395090
tags question: http://stackoverflow.com/q/24311496
tags question: http://stackoverflow.com/q/24284257
tags question: http://stackoverflow.com/q/24414722
tags question: http://stackoverflow.com/q/24349944
tags question: http://stackoverflow.com/q/24361610
tags question: http://stackoverflow.com/q/24300773
tag name: constructor
tags question: http://stackoverflow.com/q/24283889
type: Tag
tags question: http://stackoverflow.com/q/24356204
tags question: http://stackoverflow.com/q/24367472
tags question: http://stackoverflow.com/q/24377273
tags question: http://stackoverflow.com/q/24336940

http://stackoverflow.com/a/24314847
answers question: http://stackoverflow.com/q/24311383
has comment: http://stackoverflow.com/comment/48046549
accepted answer of: http://stackoverflow.com/q/24311383
downvote count: 1
upvote count: 23
has comment: http://stackoverflow.com/comment/120938812
has comment: http://stackoverflow.com/comment/48046935
has comment: http://stackoverflow.com/comment/37581911
has comment: http://stackoverflow.com/comment/37593734
type: AcceptedAnswer
type: Answer
score: 22
has body: Plugins goals can be called using their 'FQN': groupId:artifactId:version:goal or, if applicable, shorter commands (many variants available). Using only the short name of a plugin (in your tomcat7:deploy, tomcat7 is the short name, deploy being the goal/mojo) is applicable if: 1) the groupId of the plugin is contained in the known plugin groups of Maven. org.apache.maven.plugins being in the list by default. OR the pom.xml of the project you're invoking the Maven command on declares the plugin 2) the artifactId is [short-name]-maven-plugin or maven-[short-name]-plugin (maven-[short-name]-plugin being 'reserved' for plugins provided by Maven project. That explains why mvn compiler:compile can work out of the box on any project, but not tomcat7:deploy In your case, the second condition is true, so you just have to declare the plugin on the project you're launching the command on, or add this to your user settings.xml file: org.apache.tomcat.maven See here for more info

http://stackoverflow.com/a/24351431
score: 1
has body: Your FindRoom method is returning a reference to the actual room. 'TurnRoomCW' returns a new object, but you then assign that new object back into the original room So your problem is right here: newRoom = FindRoom(Room.RoomType.DeadEnd); // 1) find a DeadEnd room newRoom.room = TurnRoomCW(newRoom.room); // 2) create rotated room, assign it to the room from step 1) If you want to work with a new Room object, you will need to create a new one somehow. For example, you might define a constructor for Room that returns a new object initialized from an existing one. For example, /** copy constructor */ public Room(Room oldRoom) { this(); // regular constructor this.room = oldRoom.room.clone(); // new Room gets its own array! this.roomType = oldRoom.roomType; // … etc for any other member variables }
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24351264
answers question: http://stackoverflow.com/q/24351264
type: Answer
downvote count: 0

http://stackoverflow.com/comment/37759735
type: Comment
comment on: http://stackoverflow.com/a/24408352
score: 0
has text: I actually tried using the setText() method for the word in question, and it worked all fine, what i did exactly is (as you said in your last comment) textPane.setText(" Tekst ") and then i used my doc to add other strings! About the editorPane, i looked up the difference between the JeditorPane, the JtextPane, and as i understood, the Jtextpane supports formatting better then the editorpane, that's why i used it, no need to change now since your solution worked. Anyway, thank you a lot for your help, and again sorry for the ignorance :D!
type: AnswerComment

http://stackoverflow.com/a/24385762
has comment: http://stackoverflow.com/comment/37715667
accepted answer of: http://stackoverflow.com/q/24385611
has body: I'm wondering if the very act of submitting constructs a Future with predefined false for isDone() Just check the source for the answer. In the FutureTask constructor, the private field state is set to NEW. The isDone() method returns state != NEW. Hence, the moment the object is created, isDone() is theoretically false. public FutureTask(Runnable runnable, V result) { this.callable = Executors.callable(runnable, result); this.state = NEW; // ensure visibility of callable } public boolean isDone() { return state != NEW; } Of course, as described in Alexey's answer, your futureState variable may be true if the task has executed between the time you submitted it and the time you checked.
has comment: http://stackoverflow.com/comment/37715717
answers question: http://stackoverflow.com/q/24385611
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0
score: 4

http://stackoverflow.com/comment/37650442
type: Comment
type: QuestionComment
has text: Offtopic, but I would recommend to use HTML5/JS/CSS to build a frontend rather than Java Swing. This library is a bit obsolete. Unless you are doing a homework of course.
comment on: http://stackoverflow.com/q/24351388
score: 0

http://stackoverflow.com/a/24280145
answers question: http://stackoverflow.com/q/24279986
has body: stringBuilderAppend: The method is not returning anything. You are passing an object and modify its state inside the methods body. As you keep a reference to the same object in the calling method, you see the changes made on that object. This is a fundamental concept of object orientation which you need to understand. addNumber: You are passing a primitive integer which is assigned to the parameter number. That parameter is nothing more than a variable only visible in the methods body. If you assign a new value to that variable, which you do, the caller doesn't see anthing of that. The same would happen in stringBuilderAppend if you would assign a new StringBuilder to your variable (stringBuilder = new StringBuilder()) before modifying it. stringAppend: Basically the same as addNumber. string += "second String" is the same as string = string + "second String" so you are assigning a new value to the variable.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24279986
score: 3
type: Answer
upvote count: 3

http://stackoverflow.com/comment/37496126
type: Comment
type: QuestionComment
score: 0
has text: @LuiggiMendoza great, but why do you even refer to production?
comment on: http://stackoverflow.com/q/24270267

http://stackoverflow.com/a/24294130
has body: clearVariables just clear the local variables hasGsmCheckBox/isDualSimCheckBox, which is not the checkBox view itself. To make the CheckBox shown ready you have to use checkBox.setChecked(true), like what you did on the onStart method; But onStart() is only called when the activity is no longer visible See https://i.sstatic.net/YvmA8.png I guess you could probably try to put what's in onStart() into in onResume().
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24293969
upvote count: 2
type: Answer

http://stackoverflow.com/a/24376505
has body: You could also use a JSpinner or a DocumentFilter (with examples) depending on your overall needs A DocumentFilter will provide you with the added benefit of been able to filter the content coming into the field in real time
answers question: http://stackoverflow.com/q/24375071
type: Answer
downvote count: 0
score: 3
upvote count: 3

http://stackoverflow.com/q/24299286
has comment: http://stackoverflow.com/comment/37551464
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/24314459
has comment: http://stackoverflow.com/comment/37551388
has answer: http://stackoverflow.com/a/24314459
favorite count: 0
has answer: http://stackoverflow.com/a/24299508
has comment: http://stackoverflow.com/comment/37551376
type: AnsweredQuestion
has title: File is not working correctly in Java
tagged with: java
tagged with: file
upvote count: 1
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/24299508
has body: So, here's the problem. I'm making a game, and I'm having trouble with the file saving class that saves your progress. It is able to load default values in the file to create a new game, then restarts the game so the changes can take effect. The thing is, the default values are saved, but the game no longer recognizes them. then, when I manually delete the file, the same exact method is used to re-create the file, then the game recognizes it. Here is the class I used: import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import mario.simulator.MarioSimulator; /** * * @author Jaca */ public class filer { private static File f; private static BufferedReader br; private static BufferedWriter bw; private boolean docterlicense; private boolean driverlicense; private boolean policelicense; private boolean finishedschool; private boolean bullied; private boolean messedtubby; private boolean toadmode; private long candy; private long coin; private long spaghetti; private long cake; private long water; private long mushroom; private long bomb; private long gun; private int hunger; private long respawn; private long swag; private long awesome; public filer(){ f = new File("resource\\config\\save.sav"); if(!f.exists()){ try { f.createNewFile(); filer.reset(); br = new BufferedReader(new FileReader(f)); docterlicense = Boolean.parseBoolean(br.readLine()); policelicense = Boolean.parseBoolean(br.readLine()); finishedschool = Boolean.parseBoolean(br.readLine()); driverlicense = Boolean.parseBoolean(br.readLine()); bullied = Boolean.parseBoolean(br.readLine()); messedtubby = Boolean.parseBoolean(br.readLine()); toadmode = Boolean.parseBoolean(br.readLine()); candy = Long.parseLong(br.readLine()); coin = Long.parseLong(br.readLine()); spaghetti = Long.parseLong(br.readLine()); cake = Long.parseLong(br.readLin…

http://stackoverflow.com/q/24289006
has answer: http://stackoverflow.com/a/24289373
tagged with: struts2
answer count: 2
tagged with: validation
tagged with: jsp
favorite count: 0
possible better answer: http://stackoverflow.com/a/24289373
upvote count: 2
has title: Not able to call two different methods under same action class without using validation.excludeMethods
has body: Struts.xml: <?xml version="1.0" encoding="UTF-8"?> /Profile.jsp /LoginError.jsp /Success.jsp /login.jsp I'm trying to map two Action in this XML to two different methods in Action class LoginAction.java: package login.action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts2.interceptor.ServletRequestAware; import org.apache.struts2.interceptor.ServletResponseAware; import com.opensymphony.xwork2.ActionSupport; import login.service.LoginDao; import login.service.RegisterDao; @SuppressWarnings("serial") public class LoginAction extends ActionSupport implements ServletRequestAware, ServletResponseAware { private String username; private String password; private HttpServletRequest httpServletRequest; private String firstname; private String lastname; private String regpassword; private String conpassword; private String regemail; private String conemail; private String phone; public String register(){ RegisterDao rdao = new RegisterDao(); String registered = rdao.registerdao(firstname,lastname,regpassword,conpassword,regemail,conemail,phone); if(registered == "TRUE"){ return SUCCESS; } return INPUT; } public String login() { System.out.println("user name::: "+username); httpServletRequest.getSession().setAttribute("key", username); httpServletRequest.getSession().setAttribute("key", password); LoginDao db = new LoginDao(); Boolean validate = db.loginresult(username, password); if (validate == true) { return SUCCESS; } else { return INPUT; } } public HttpServletRequest getHttpServletRequest() { return httpServletRequest; } public void setHttpServletRequest(HttpServletRequest httpServletRequest) { this.httpServletRequest = httpServletRequest; } public String getFirstname() { return firstname; } public void setFirstname(String firstname) { this.firstname = firstname; } public String getLastname() { return lastname; } public void setLastname(String lastname) { this.lastname = lastname; } public String get…
accepted answer: http://stackoverflow.com/a/24289507
tagged with: regex
type: AnsweredQuestion
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/24241572
has answer: http://stackoverflow.com/a/24289507
downvote count: 1
type: Question

http://stackoverflow.com/comment/37834459
has text: Thanks, Could you please briefly share your solution with us.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24422703
type: AnswerComment

http://stackoverflow.com/comment/37652678
comment on: http://stackoverflow.com/a/24352488
score: 0
type: Comment
has text: Ok I fixed it by changing `adapter = new ArrayAdapter<String> (this, android.R.layout.simple_list_item_1, events);` TO `adapter = new ArrayAdapter<String> (SearchTwitter.this, android.R.layout.simple_list_item_1, events);`
type: AnswerComment

http://stackoverflow.com/q/24286082
has comment: http://stackoverflow.com/comment/37525963
has answer: http://stackoverflow.com/a/24286121
has title: Passing scanner to method
has comment: http://stackoverflow.com/comment/37564041
has answer: http://stackoverflow.com/a/24286178
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24286114
tagged with: java
answer count: 6
tagged with: methods
has body: Can anybody tell me why the date prints 0/0/0? What part of the code is missing so the values input using Scanner are passed into the method DisplayDate and printed on the screen? import java.util.Scanner; public class DateClass { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter day:"); int day = scanner.nextInt(); System.out.println("Enter month:"); int month = scanner.nextInt(); System.out.println("Enter year:"); int year = scanner.nextInt(); Date d = new Date(day,month,year); d.DisplayDate(); } } class Date { private int day; private int month; private int year; public Date(int day, int month, int year) { } public int getDay() { return day; } public void setDay(int day) { this.day = day; } public int getMonth() { return month; } public void setMonth(int month) { this.month = month; } public int getYear() { return year; } public void setYear(int year) { this.year = year; } public void DisplayDate() { System.out.println(getDay() + "/" + getMonth() + "/" + getYear()); } }
has answer: http://stackoverflow.com/a/24286164
type: Question
has answer: http://stackoverflow.com/a/24286111
has comment: http://stackoverflow.com/comment/37526492
tagged with: class
score: 0
has answer: http://stackoverflow.com/a/24286138

http://stackoverflow.com/comment/37647834
has text: can you share your entity classes in post?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24349784

http://stackoverflow.com/q/24359130
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37665834
tagged with: sorting
tagged with: comparable
has body: I am copying off of an example from my textbook and yet it refuses to compile. Did I make a typo somewhere? For some reason, on the client code, Collections.sort(words) does not allow the program to compile. Any help is appreciated. Code is copied from "Building Java Programs" 2nd edition by Stuart Reges and Marty Stepp. I'm trying to understand it by copying it. The program is supposed to crate a CalendarDate object to put into an ArrayList. By implementing the Comparable interface for CalendarDate, I can use the Collections.sort to sort the birthdays in order in that arraylist. However, that's not working b/c Collections.sort(dates) will not run. The Client code(Contains the issue): import java.util.*; // Short program that creates a list of birthdays of the // first 5 U.S. Presidents and that puts them into sorted order. // We can now use Collections.sort for ArrayList&lt;CalendarDate&gt; b/c CalendarDate implements the Comparable interface. public class CalendarDateTest { public static void main(String[] args) { ArrayList&lt;CalendarDate&gt; dates = new ArrayList&lt;CalendarDate&gt;(); // Creates a new ArrayList of 'CalendarDate' object type. // adds a new CalendarDate object with month = 2 and day = 22 into an element of ArrayList dates, and etc. dates.add(new CalendarDate(2, 22)); // Washington dates.add(new CalendarDate(10, 30)); //Adams dates.add(new CalendarDate(4, 13)); // Jefferson dates.add(new CalendarDate(3, 16)); // Madison dates.add(new CalendarDate(4, 28)); // Monroe System.out.println("birthdays = " + dates); // Before sorting Collections.sort(dates); // WHY WON'T THIS WORK? System.out.println("birthdays = " + dates); // After Sorting } } The CalendarDate object class: public class CalendarDate implements Comparable&lt;CalendarDate&gt; { private int month; private int day; // Constructor public CalendarDate(int month, int day) { this.month = month; this.day = day; } // Compares this calendar date to another date // Dates are compared by month and t…
tagged with: arraylist
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37665905
accepted answer: http://stackoverflow.com/a/24359171
has title: Why Can't I Sort this ArrayList?
has answer: http://stackoverflow.com/a/24359167
has comment: http://stackoverflow.com/comment/37665959
linked to: http://stackoverflow.com/q/16185601
favorite count: 0
possible better answer: http://stackoverflow.com/a/24359167
has comment: http://stackoverflow.com/comment/37665927
tagged with: interface
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37665882
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/24359171

http://stackoverflow.com/a/24399529
has comment: http://stackoverflow.com/comment/37741833
has comment: http://stackoverflow.com/comment/123462279
has comment: http://stackoverflow.com/comment/37741787
score: 17
accepted answer of: http://stackoverflow.com/q/24392602
has comment: http://stackoverflow.com/comment/42090186
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24392602
upvote count: 17
has body: The docs are included in the SDK. You can download the SDK here: http://www.oracle.com/technetwork/java/javaee/downloads/java-ee-sdk-7-downloads-1956236.html API docs can be found under glassfish4/docs/api.
has comment: http://stackoverflow.com/comment/52503058
type: Answer
has comment: http://stackoverflow.com/comment/41833925

http://stackoverflow.com/comment/37556683
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24301231
has text: Context is still starting see me edited Answer.
score: 0

http://stackoverflow.com/q/24323752
has title: How to use the API Sesame with Tomcat server into a Java dynamic web project?
answer count: 1
tagged with: sesame
favorite count: 0
has comment: http://stackoverflow.com/comment/37606132
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37597562
downvote count: 1
has answer: http://stackoverflow.com/a/24324969
has body: I developed an Java application who request in SPARQL on Sesame repositories. I use currently a Tomcat server what I run on console (with ./startup.sh). I must now include my application into a web page and I choose J2EE. But I have a problem : I can't run a Sesame connection and use JSP files, servlets,...together. I have this error : Etat HTTP 404 : The requested resource is not available How to "join" us ? Is it a conflict because of the "8080" port ?
tagged with: java
score: -1
type: Question
upvote count: 0
tagged with: tomcat

http://stackoverflow.com/comment/136806547
score: 0
type: Comment
has text: Hi, this isn't working for me, I'm launching: java -cp .\myjar.jar -Dloader.main=com.mypackage.MyMain org.springframework.boot.loader.PropertiesLauncher and I get: Error: Could not find or load main class .main=com.mypackage.MyMain Any ideas?
comment on: http://stackoverflow.com/a/36552613
type: AnswerComment

http://stackoverflow.com/comment/37527223
comment on: http://stackoverflow.com/q/24286517
has text: This will add all jason attributes to hashmap
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37502237
comment on: http://stackoverflow.com/q/24271743
score: 0
type: Comment
type: QuestionComment
has text: Where do you initialize `ImageView iv`? I see you use it in `tt.setNode(iv);`

http://stackoverflow.com/comment/37697868
type: QuestionComment
type: Comment
has text: Nevermind it had something to do with another variable having a null pointer exception, but was not reported as such. Thank you.
comment on: http://stackoverflow.com/q/24374970
score: 0

http://stackoverflow.com/comment/37505376
has text: Thank you, but I think you got me a bit wrong. I actually meant not to disturb a current flow of a house, but just that after 1 second, another house is drawn and follows the previous house till its gone (under the screen).
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24274728
type: AnswerComment

http://stackoverflow.com/q/24298851
downvote count: 0
score: 1
tagged with: java
has body: The problem is on my second switch case 1: I will put the "arrayEmployees[0]." but it doesn't see my methods in the superclass PersonData or the subclass personLocation. My understanding of polymorhpism is a bit shady as well as the internal "Object" possibility as I just began learning about these so perhaps I am referencing them wrong. I was given these instructions: Design a new class called PersonTest with a main method that defines a PersonData object and a PersonLocation object (both without arguments) and two more objects with arguments and store all the objects in an Array for retrieval and modification of instantiated objects (i.e. Array of Objects). My Actual Code package lab5; import java.util.InputMismatchException; import java.util.Scanner; public class PersonTest { public static void main(String args[]) { Scanner input = new Scanner(System.in); PersonLocation personLocation = new PersonLocation(); PersonData personData = new PersonData(); PersonLocation personLocationOverLoaded = new PersonLocation("Hamilton"); PersonData personDataOverloaded = new PersonData("Stirling", "905-567-7656"); Object[] arrayEmployees = new Object[4]; arrayEmployees[0] = personLocation; arrayEmployees[1] = personLocationOverLoaded; arrayEmployees[2] = personData; arrayEmployees[3] = personDataOverloaded; int user = 0; int menu = 0; // Get input here, put into variable "user" switch(user) { case 1: System.out.print("Printing Object Information With Given Values\n\n\t"); arrayEmployees[0]. //Issue } }//End Main Method }//End Class PersonTest What is Supposed to Happen: I am suppose to be able to reference from my array as shown above (arrayEmployees[0].) and have my methods show up for that particular class.
has comment: http://stackoverflow.com/comment/37551022
type: Question
has comment: http://stackoverflow.com/comment/37550469
tagged with: object
has comment: http://stackoverflow.com/comment/37550665
has comment: http://stackoverflow.com/comment/37551356
has comment: http://stackoverflow.com/comment/37550644
linked to: http://stackoverflow.com/q/5289393
tagged with: inheritance
has comment: http://stackoverflow.com/comment/37550985
has comment: http://stackoverflow.com/comment/37550945
has comment: http://stackoverflow.com/comment/37550891
has comment: http://stackoverflow.com/comment/37550691
upvote count: 1
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/37550910
has comment: http://stackoverflow.com/comment/37551319
has comment: http://stackoverflow.com/comment/37550992
tagged with: polymorphism
favorite count: 0
has comment: http://stackoverflow.com/comment/37551268
has comment: http://stackoverflow.com/comment/37550523
has comment: http://stackoverflow.com/comment/37550542
has title: Proper way of creating an array of Objects holding objects from superclass and subclass
has comment: http://stackoverflow.com/comment/37550704
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24299334
accepted answer: http://stackoverflow.com/a/24299334

http://stackoverflow.com/a/24344008
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24343707
answers question: http://stackoverflow.com/q/24343707
has body: What you have should work, (with fully qualified class names, of course). E.g. this definitely works: jjs&gt; var x = new java.util.BitSet() jjs&gt; x instanceof Java.type("java.util.BitSet") true Note: java.util.BitSet and Java.type("java.util.BitSet") are interchangeable, I just used both to illustrate that no matter how you construct the object, the result should be the same.
type: Answer
score: 12
upvote count: 12

http://stackoverflow.com/comment/37663844
score: 1
comment on: http://stackoverflow.com/a/24327459
type: AnswerComment
has text: @Gimby The problem I am facing is that, there are more than 10 collections in some of my entities. When I need to load the whole object together, I have to do `Hibernate.initialize("collection1")` for each of the collections. I want to avoid doing this in each of the DAO layer, and instead expose a generic method to EAGER load the whole entity. Is this not a proper way?
type: Comment

voice-recognition
tags question: http://stackoverflow.com/q/24392324
type: Tag
tag name: voice-recognition

http://stackoverflow.com/a/24284598
answers question: http://stackoverflow.com/q/24282931
type: Answer
has body: DateTimeFormatter XML_DATE_TIME_FORMAT= ISODateTimeFormat.dateTime().withZone(DateTimeZone.UTC); DateTime dt = XML_DATE_TIME_FORMAT.parseDateTime("2009-12-12T23:00:00.000+05:30"); System.out.println(dt); This converts to my local timezone.
score: 0

http://stackoverflow.com/comment/37594018
has text: java -jar "C:\Users\utente\Desktop\WatchFileThreadMod\dist\WatchFileThreadMod.jar" "C:\Program Files (x86)\MT4 Exchange\MQL4\Files\Data"
comment on: http://stackoverflow.com/a/24313572
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37529599
type: QuestionComment
has text: am using utf-8 encoding to read..updated the qn
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24287776

http://stackoverflow.com/comment/37621545
type: Comment
score: 0
type: AnswerComment
has text: This worked for me for what I wanted to do. Thanks for not being judgemental on my noob question.
comment on: http://stackoverflow.com/a/24321710

http://stackoverflow.com/q/24339371
tagged with: java
has comment: http://stackoverflow.com/comment/37627404
tagged with: post
type: Question
has comment: http://stackoverflow.com/comment/37627007
has title: Extract data from Curl POST request
has body: I am making a POST request using curl as follows curl -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -X POST \ -d '{ "name": "PhoneName", "description": "Phone Description!", "details": { "imeiNumber": "123456789123456", "phoneNumber": "9999999999"}}' \ -k \ http://test.domain.com/myTestServer/devices But in the servlet I am not able to get any of the data posted. public void devices(HttpServletRequest request, HttpServletResponse response) throws IOException { System.out.println("Got Request for devices"); System.out.println("Request is : "+ request); System.out.println("Name : " + request.getParameter("name")); //gives null System.out.println("description : " + request.getParameter("description")); //gives null Enumeration&lt;String&gt; paramNames = request.getParameterNames(); //Empty Enumeration while(paramNames.hasMoreElements()){ String paramName = paramNames.nextElement(); System.out.println(paramName + " : " + request.getParameter(paramName)); } } Any suggestions? Also a better way to get data inside data like "details": { "imeiNumber": "123456789123456", "phoneNumber": "9999999999"} ?
tagged with: servlets
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/24339436
accepted answer: http://stackoverflow.com/a/24339453
tagged with: curl
favorite count: 0
possible better answer: http://stackoverflow.com/a/24339436
has answer: http://stackoverflow.com/a/24339453
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/a/24406468
has comment: http://stackoverflow.com/comment/37760924
score: 0
has comment: http://stackoverflow.com/comment/37761507
has body: Date date = new Date(); DateFormat formatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z"); formatter.setTimeZone(TimeZone.getTimeZone("EST")); String convertedDate = formatter.format(date); System.out.println(formatter.format(date)); try { Date date1 = formatter.parse(convertedDate); System.out.println("IST : "+date1); } catch (ParseException e) { e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/37766111
has comment: http://stackoverflow.com/comment/37762041
type: Answer
answers question: http://stackoverflow.com/q/24406322
has comment: http://stackoverflow.com/comment/37754787
has comment: http://stackoverflow.com/comment/37785356

http://stackoverflow.com/a/24391227
has comment: http://stackoverflow.com/comment/52136599
type: AcceptedAnswer
downvote count: 0
has body: There are new methods added to java.util.Arrays to convert an array into a Java 8 stream which can then be used for summing etc. int sum = Arrays.stream(myIntArray).sum(); Multiplying two arrays is a little more difficult because I can't think of a way to get the value AND the index at the same time as a Stream operation. This means you probably have to stream over the indexes of the array. //in this example a[] and b[] are same length int[] a = ... int[] b = ... int[] result = new int[a.length]; IntStream.range(0, a.length).forEach(i -&gt; result[i] = a[i] * b[i]); Commenter @Holger points out you can use the map method instead of forEach like this: int[] result = IntStream.range(0, a.length).map(i -&gt; a[i] * b[i]).toArray();
has comment: http://stackoverflow.com/comment/61573365
has comment: http://stackoverflow.com/comment/37727110
accepted answer of: http://stackoverflow.com/q/24390463
answers question: http://stackoverflow.com/q/24390463
type: Answer
has comment: http://stackoverflow.com/comment/71638252
upvote count: 323
score: 323
has comment: http://stackoverflow.com/comment/37727434

http://stackoverflow.com/comment/37798695
comment on: http://stackoverflow.com/a/24428614
has text: I realized after asking it and I was looking for how to do it. Thank you
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24458955
type: Answer
has comment: http://stackoverflow.com/comment/37870332
answers question: http://stackoverflow.com/q/24312016
has comment: http://stackoverflow.com/comment/37958092
has comment: http://stackoverflow.com/comment/37920166
has comment: http://stackoverflow.com/comment/37865037
has comment: http://stackoverflow.com/comment/37869010
score: 5
has comment: http://stackoverflow.com/comment/37923891
has comment: http://stackoverflow.com/comment/37869512
upvote count: 5
has comment: http://stackoverflow.com/comment/37869768
has comment: http://stackoverflow.com/comment/37851659
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24312016
has body: So after doing some digging I think I have come up with an (as yet) untested solution. Firstly, based on Diane's suggestion here: https://groups.google.com/forum/#!topic/android-developers/Nb58dOQ8Xfw I should be binding to the application context - so my problem of losing the context is gone - I can maintain my ServiceConnection across configuration changed with a Non-UI fragment - great. Then when I am done I can use the app context to hand back the service connection and unbind. I shouldn't receive any leaky service connection warnings. (I should probably point out that this is a standard and recommended way to maintain instances across config changes) The final crux of this problem was I was unsure of whether I could bind multiple times from the same context - the documentations on bindings imply there is some dependence between the binding and the context's lifecycle and so I was worried I would have to do my own form of reference counting. I had a look at the source code and ended up here: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.4.2_r1/android/app/LoadedApk.java#LoadedApk.forgetServiceDispatcher%28android.content.Context%2Candroid.content.ServiceConnection%29 Crucially, these lines: sd = map.get(c); if (sd != null) { map.remove(c); sd.doForget(); if (map.size() == 0) { mServices.remove(context); } Reveal that the map is being used for the reference counting I was worried about. SO the take home is this: Bound service will work fine with the app context and we SHOULD do this to prevent leaking a service connection from one activity to another during a config change I can keep my service connection on a non-UI fragment safely and use it to unbind when I am done I'll try and post some tested code soon. UPDATE and tested solution: I've made some code to test this and published here: https://github.com/samskiter/BoundServiceTest It seems to work quite well and the non-ui fragment (data fragment) acts as a nice proxy li…

http://stackoverflow.com/a/24354965
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/37662663
score: 1
upvote count: 1
has body: Use the pollEnrich component to obtain additional data: from("direct:twitter") .pollEnrich("twitter://timeline/user?type=direct&amp;user=" + this.uri) .choice() ... Alternatively, you may just use following route that is automatically started: from("twitter://timeline/user?type=direct&amp;user=" + this.uri) .choice() ... Note, that the twitter component creates one route exchange per returned object and not a list.
answers question: http://stackoverflow.com/q/24349210
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24349210

http://stackoverflow.com/a/24273716
score: -1
upvote count: 0
type: Answer
downvote count: 1
has body: You can achieve the effect of "switching" between two JPanel objects in a JFrame by using the setVisible() command like so: panelA.setVisible(false); //the current JPanel you are switching out of panelB.setVisible(true); //the JPanel you are switching to
answers question: http://stackoverflow.com/q/24273547

http://stackoverflow.com/q/24267191
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24267763
score: 1
tagged with: java
has body: I got two test classes: A and B. The main problem is that JUnit enters in @BeforeClass of B before executing the @AfterClass of A. Usually it is not a big deal but now I have to work on a shared database and this way it fails. Sample: public class A { @AfterClass public static void clearDb(){ try{ ... EntityManager em = .. em.getTransaction().begin(); em.createQuery("DELETE FROM ClassName").executeUpdate(); em.getTransaction().commit(); }catch(...){...} } @Test public test(){ ... } } public class B { @BeforeClass public static void clearDb(){ try{ ... EntityManager em = .. em.getTransaction().begin(); em.clear(); em.persist(...) em.getTransaction().commit(); }catch(...){...} } @Test public test(){ ... } } Connection: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 My question is: Is there a way to force JUnit to process as a single thread, or wait till the other class really cleaned up its stuff.
accepted answer: http://stackoverflow.com/a/24424925
has comment: http://stackoverflow.com/comment/37490266
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37493923
answer count: 2
tagged with: junit
downvote count: 0
has title: Disable JUnit concurrent tests - BeforeClass, AfterClass issue
has comment: http://stackoverflow.com/comment/37491336
has answer: http://stackoverflow.com/a/24424925
favorite count: 0
has comment: http://stackoverflow.com/comment/37510982
possible better answer: http://stackoverflow.com/a/24267763

http://stackoverflow.com/q/24424498
has answer: http://stackoverflow.com/a/24424596
linked to: http://stackoverflow.com/q/5961997
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24425438
type: Question
has answer: http://stackoverflow.com/a/24425269
has title: Need a regex to extract a substring
has answer: http://stackoverflow.com/a/24424569
has answer: http://stackoverflow.com/a/24425258
answer count: 6
score: 0
has body: I am struggling to figure out a decent way to extract a substring from the below string. Inputs: Invoice 1800000173 of 06/18/2014/150 USD Discnt to 07/02/2014 Invoice 1200000000 of 02.04.2014/150 Details The above are the 2 possible combinations. Expected Output: Invoice 1800000173 of 06/18/2014 Invoice 1200000000 of 02.04.2014 There is a similar question asked here - Regex to get date from string but that didn't help me here. Any suggestions ?
has answer: http://stackoverflow.com/a/24425235
tagged with: jsp
tagged with: regex

http://stackoverflow.com/q/24413186
downvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/24413319
tagged with: end-of-line
has body: I am new to java regex.I saw this in Docs: $ The end of a line But when I try this snippet: String str = "firstline\r\nsecondline"; String regex = "$"; System.out.println(str.replaceAll(regex, "*")); I guess result will be: firstline* secondline* But I see this result: firstline secondline* It seems that it $ only matches the end of a String. So why do the docs say it matches "The end of a line"?
tagged with: regex
has answer: http://stackoverflow.com/a/24413253
accepted answer: http://stackoverflow.com/a/24413311
favorite count: 0
score: 2
possible better answer: http://stackoverflow.com/a/24413319
upvote count: 2
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24413311
has title: java regex $ metacharacter

http://stackoverflow.com/a/24271901
score: 8
has comment: http://stackoverflow.com/comment/37499499
has comment: http://stackoverflow.com/comment/37499432
has body: String[] strings = one.split("[^\\d]+"); This treats every sequence of one or more non-digits as a delimiter, and returns an array of the results. Pretty much exactly what you want, right? This also works, but I usually forget about the built-in character classes that means "not" (thanks, @Pshemo): String[] strings = one.split("\\D+"); One caveat: the first element of Strings might be an empty string. This happens if the first character is not a digit. From @Ruslan Ostafiychuk, here's how we can fix it by stripping off the leading nondigits: String[] strings = one.replaceFirst("^\\D+","").split("\\D+");
has comment: http://stackoverflow.com/comment/37499549
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37499768
upvote count: 8
accepted answer of: http://stackoverflow.com/q/24271813
type: Answer
answers question: http://stackoverflow.com/q/24271813
has comment: http://stackoverflow.com/comment/37499530

http://stackoverflow.com/comment/37630552
has text: Link..i did not get you..i was wondering if you give a working code on my requirement..i would be grateful to you..
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24339574
type: AnswerComment

http://stackoverflow.com/q/24267409
tagged with: java
tagged with: multithreading
tagged with: objectinputstream
type: Question
has body: I have a Client-Server architecture. The server can have * clients so for each of them two threads (input &amp; output) are created. I have one master class that coordinates all actions on server side. it has (among others) such a method: public static synchronized void sendMessageToUser(Message message, String username){ clientOutputThreadPool.submit(new ObjectStreamOutputCallable(userObjectOutputStreams.get(username), message)); } the objectOutputStreamCallable gets the objectOutputStream for the specific user passed (i keep them in a hashmap to reuse them). The callable is executed in a threadpool the callable looks like this: @Override public Object call() throws Exception { writeObjectToStream(); return null; } private synchronized void writeObjectToStream() throws IOException { oos.reset(); oos.writeObject(message); oos.flush(); } Now I !Sometimes! get the above mentioned errors (on the client side). The fact that this only happens about 30-40% of the time, gets me to believe, that it has something to do with concurrency. Could it be e.g. that the message object that is being serialized is at the same time manipulated somewhere else in the code and that then creates the error? I have read many times that one may not use more than one objectOutputStream or objectInputStream . But I cannot find any place in my code where I use different objectOutputStreams for the same client. Each one has one oos that is created at socket creation time and then kept in a hashmap for later use. also i reset the socket before each message but that still has no effect...
has comment: http://stackoverflow.com/comment/37490629
has title: StreamCorruptedException | OptionalDataException in objectInputStream.readObject() in multithreaded environment
score: 0
has comment: http://stackoverflow.com/comment/37490810
type: UnansweredQuestion
tagged with: sockets
tagged with: objectoutputstream
answer count: 0

jdbc
tags question: http://stackoverflow.com/q/24372286
tags question: http://stackoverflow.com/q/24347465
tags question: http://stackoverflow.com/q/24416683
tags question: http://stackoverflow.com/q/24347315
tags question: http://stackoverflow.com/q/24384988
tags question: http://stackoverflow.com/q/24400513
tags question: http://stackoverflow.com/q/24299512
tags question: http://stackoverflow.com/q/24278138
tags question: http://stackoverflow.com/q/24379332
tags question: http://stackoverflow.com/q/24427103
tags question: http://stackoverflow.com/q/24313442
tags question: http://stackoverflow.com/q/24397088
tags question: http://stackoverflow.com/q/24393617
tags question: http://stackoverflow.com/q/24353597
tags question: http://stackoverflow.com/q/24423779
tags question: http://stackoverflow.com/q/24289387
tags question: http://stackoverflow.com/q/24332928
tags question: http://stackoverflow.com/q/24390179
tags question: http://stackoverflow.com/q/24361591
tags question: http://stackoverflow.com/q/24305109
tags question: http://stackoverflow.com/q/24363050
tags question: http://stackoverflow.com/q/24323733
tags question: http://stackoverflow.com/q/24292026
tags question: http://stackoverflow.com/q/24334319
tags question: http://stackoverflow.com/q/24372301
type: Tag
tags question: http://stackoverflow.com/q/24289076
tags question: http://stackoverflow.com/q/24369261
tags question: http://stackoverflow.com/q/24361950
tags question: http://stackoverflow.com/q/24321312
tags question: http://stackoverflow.com/q/24323674
tags question: http://stackoverflow.com/q/24298507
tags question: http://stackoverflow.com/q/24416579
tags question: http://stackoverflow.com/q/24310207
tags question: http://stackoverflow.com/q/24406662
tags question: http://stackoverflow.com/q/24373368
tags question: http://stackoverflow.com/q/24378194
tags question: http://stackoverflow.com/q/24373063
tags question: http://stackoverflow.com/q/24341441
tags question: http://stackoverflow.com/q/24322085
tags question: http://stackoverflow.com/q/24378270
tags question: http://stackoverflow.com/q/24363173
tags question: http://stackoverflow.com/q/24426304
tags question: http://stackoverflow.com/q/24338203
tags question: http://stackoverflow.com/q/24279035
tags question: http://stackoverflow.com/q/24401923
tags question: http://stackoverflow.com/q/24361142
tags question: http://stackoverflow.com/q/24329558
tags question: http://stackoverflow.com/q/24418068
tags question: http://stackoverflow.com/q/24418458
tags question: http://stackoverflow.com/q/24392916
tags question: http://stackoverflow.com/q/24398953
tags question: http://stackoverflow.com/q/24267112
tags question: http://stackoverflow.com/q/24276582
tags question: http://stackoverflow.com/q/24337166
tags question: http://stackoverflow.com/q/24390567
tags question: http://stackoverflow.com/q/24360168
tags question: http://stackoverflow.com/q/24415520
tags question: http://stackoverflow.com/q/24335604
tags question: http://stackoverflow.com/q/24303327
tags question: http://stackoverflow.com/q/24335810
tags question: http://stackoverflow.com/q/24268705
tags question: http://stackoverflow.com/q/24326502
tags question: http://stackoverflow.com/q/24320914
tags question: http://stackoverflow.com/q/24402022
tags question: http://stackoverflow.com/q/24329331
tags question: http://stackoverflow.com/q/24390146
tags question: http://stackoverflow.com/q/24396535
tags question: http://stackoverflow.com/q/24337694
tags question: http://stackoverflow.com/q/24331765
tags question: http://stackoverflow.com/q/24332302
tags question: http://stackoverflow.com/q/24424642
tags question: http://stackoverflow.com/q/24276801
tags question: http://stackoverflow.com/q/24335518
tags question: http://stackoverflow.com/q/24398622
tags question: http://stackoverflow.com/q/24365581
tag name: jdbc
tags question: http://stackoverflow.com/q/24392903
tags question: http://stackoverflow.com/q/24282159
tags question: http://stackoverflow.com/q/24285545

http://stackoverflow.com/q/24414299
tagged with: java
has comment: http://stackoverflow.com/comment/37769045
has title: Java Scanner exception handling
type: Question
downvote count: 0
possible better answer: http://stackoverflow.com/a/24414523
accepted answer: http://stackoverflow.com/a/24414457
has comment: http://stackoverflow.com/comment/37769017
has answer: http://stackoverflow.com/a/24414523
has answer: http://stackoverflow.com/a/30616046
tagged with: exception
has answer: http://stackoverflow.com/a/24414546
has comment: http://stackoverflow.com/comment/37769227
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/37769091
score: 6
upvote count: 6
type: AnsweredQuestion
has body: I would like to receive a Double from the user and handle the exception thrown in case the user didn't input a double/int; in that case I'd like to ask the user to insert the amount again. My code gets stuck in a loop if the exception is caught, and keeps printing "Insert amount". private static double inputAmount() { Scanner input = new Scanner(System.in); while (true) { System.out.println("Insert amount:"); try { double amount = input.nextDouble(); return amount; }catch (java.util.InputMismatchException e) {continue;} } } Thank you in advance.
has answer: http://stackoverflow.com/a/24414457

http://stackoverflow.com/comment/37783275
type: AnswerComment
has text: activity.getFilesDir() returns it. But it should be in the /data/data/full_app_name directory
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24421609

http://stackoverflow.com/comment/37757399
type: Comment
has text: and we can only set `PropertyValueFactory property` as `firstname` because when i change no data is added in the tablview
comment on: http://stackoverflow.com/a/24404734
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37624699
type: AnswerComment
type: Comment
has text: Thank you for that insight. I hope the State of the Values proposal moves forward; it's about time! (also therein are references to James Gosling on the topic of Efficient Classes).
comment on: http://stackoverflow.com/a/24336841
score: 0

http://stackoverflow.com/a/24389514
score: 1
has comment: http://stackoverflow.com/comment/37852496
has comment: http://stackoverflow.com/comment/37723729
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/37726932
downvote count: 0
answers question: http://stackoverflow.com/q/24389358
has body: Worked on my machine, i just had to add a pause to see the effects: color 0a java -jar launcher.jar pause

http://stackoverflow.com/comment/37564551
score: 0
comment on: http://stackoverflow.com/q/24302827
type: QuestionComment
has text: ... Also note that JRE/lib/security/cacerts is the *default* trustore for Java SSL connections, but it is overridden by jssecacerts if that is present, and either of those can be overridden by system properties or by the code you are running; are you sure neither of those is done?
type: Comment

http://stackoverflow.com/a/24355958
has body: st1 is declared locally to the constructor, meaning it can't be accessed from the actionPerformed method. You need to make st1 an instance variable like you buttons For example... public class myJPanel6 extends JPanel implements ActionListener { myJButton b1, b2; private student st1; public myJPanel6() { setLayout(new GridLayout(1, 1)); //===================================== st1 = new student("Michael", "Robinson", 20); Updated Without further information, the WhatIsUp method is package-private, meaning it can only be accessed from within the package the class was declared, you'll need to make public if you want to access it else where public String WhatIsUp() {...
score: 1
has comment: http://stackoverflow.com/comment/37661417
answers question: http://stackoverflow.com/q/24355919
downvote count: 0
has comment: http://stackoverflow.com/comment/37660577
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/37659710

http://stackoverflow.com/q/24286065
has comment: http://stackoverflow.com/comment/37526175
has comment: http://stackoverflow.com/comment/37539886
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37792026
type: Question
tagged with: graph
has body: I am implementing the graph data structure in Java as a Map of maps. The Graph object is a map of data(key) and all vertices(value) public class GraphAdjMap&lt;T&gt; implements IGraph&lt;T&gt; { private Map&lt;T, Vertex&lt;T&gt;&gt; vertices = new HashMap&lt;T, Vertex&lt;T&gt;&gt;(); Each vertex is a map of edges where key is the destination vertex and value is the edge object: class Vertex&lt;T&gt; { private T data; private Map&lt;T, Edge&lt;T&gt;&gt; edges = new HashMap&lt;T, Edge&lt;T&gt;&gt;(); Edge is a simple value object: public class Edge&lt;T&gt; { private T destination; private int weight; With this structure its easy and fast for me to answer a lot of queries like: Are 2 edges connected? What are all the edges of a vertex? Is this vertex connected to the other vertex? How many edges does a vertex have? etc... Is this a good implementation or am I missing something? Thanks, Chris.
tagged with: hashmap
has comment: http://stackoverflow.com/comment/37526253
tagged with: algorithm
has comment: http://stackoverflow.com/comment/37526072
has title: Implementing Graph as a map of maps
tagged with: data-structures
score: 0
has comment: http://stackoverflow.com/comment/37526308
has comment: http://stackoverflow.com/comment/37526152
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37525974

http://stackoverflow.com/comment/37702562
comment on: http://stackoverflow.com/q/24378231
type: Comment
type: QuestionComment
has text: Not much to share, simply put stopwatch.start(); before cache.getAllPresent and stopwatch.elapsed(TimeUnit.MILLISECONDS) after. There is separate system to track stats from machines where this latency is reported. Later it get's aggregated from all machines.
score: 0

http://stackoverflow.com/a/24484674
accepted answer of: http://stackoverflow.com/q/24405634
answers question: http://stackoverflow.com/q/24405634
type: AcceptedAnswer
has body: In my application i have a scenario of superadmin who can view all namespaces hence i need to set them according to request. My issue is resolved now as I was setting namespace after calling getPersistentManger() so it was causing the problem, after shifting NamespaceManger.set at first line of call, and then calling persistent manager, application is working fine:)
score: 0
type: Answer

http://stackoverflow.com/q/24322728
type: Question
tagged with: jakarta-ee
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24323095
type: UnansweredQuestion
tagged with: spring
has body: I have such service: @Service public class UserEventServiceImpl implements UserEventService { @Autowired UserEventDao userEventDao; @Override public UserEvent getOrCreateUserEvent(String guid) { return userEventDao.getOrCreateUserEvent(guid); } @Override public void updateUserEvent(UserEvent userEvent) { userEventDao.update(userEvent); } @Override public void processEventType(String guid, EventType type) { UserEvent userEvent = getOrCreateUserEvent(guid); switch (type) { case DOWNLOAD_STARTED: { userEvent.setDownloadInstallStarted(new Date()); updateUserEvent(userEvent); break; } case DOWNLOAD_COMPLETE: { userEvent.setDownloadInstallCompleted(new Date()); updateUserEvent(userEvent); break; } case UPDATE_DOWNLOAD_STARTED: { userEvent.setDownloadUpdateStarted(new Date()); updateUserEvent(userEvent); break; } case UPDATE_DOWNLOAD_FINISHED: { userEvent.setDownloadUpdateCompleted(new Date()); updateUserEvent(userEvent); break; } case UPDATE_COMPLETE: { userEvent.setUpdateCompleted(true); updateUserEvent(userEvent); break; } } } } And such dao class: @Repository public class UserEventDaoHb extends BaseDaoHb&lt;UserEvent&gt; implements UserEventDao { public UserEventDaoHb() { super(UserEvent.class); } @Override public UserEvent getOrCreateUserEvent(String guid) { DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); Date date = new Date(); try { date = formatter.parse(formatter.format(date)); } catch (ParseException e) { //do nothing. Impossible to happen } UserEvent event = findOneByParams(Restrictions.eq("guid", guid), Restrictions.eq("date", date)); if (event == null) { event = new UserEvent(); event.setGuid(guid); event.setDate(date); getHibernateTemplate().save(event); getHibernateTemplate().flush(); } return event; } } UserEvent is a simple POJO object. This code works perfectly at local and test server but when i run it at production it causes such exception: ERROR [http-apr-8080-exec-55] - 2014-06-20 07:27:14 - (BatchingBatcher.java:73) - Exception executing b…
has title: Exception executing batch. Spring application
tagged with: java
tagged with: hibernate

http://stackoverflow.com/a/27632551
upvote count: 2
has comment: http://stackoverflow.com/comment/43685316
answers question: http://stackoverflow.com/q/24421337
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/43887319
has body: Please see the following link to get over the issue of compilation: XERCESJ-1621 xerces2 doesn't build with Mac OS 10.9 and JDK 1.7 The core idea is : The Issue here is that Xerces supports DOM Level 1 HTML Specification only. However the JDK installed on your system which is 1.7 has DOM Level 3 specification. The newly added methods from Level 2 and Level 3 specification in JDK 1.5 and onwards are not implemented in Xerces. So one of the options is to build the code with older version i.e JDK 1.4 etc or work around fix would be to add dummy method implementations in the source so that you don't get error's for not implementing them.
score: 1

http://stackoverflow.com/q/24421937
downvote count: 0
has comment: http://stackoverflow.com/comment/37783529
favorite count: 0
has answer: http://stackoverflow.com/a/24421974
has answer: http://stackoverflow.com/a/24422097
type: Question
score: 3
has body: I'm working on a program that takes the input of two numbers and then does some different calculations. I have my TwoNumbers class with several different methods to calculate sum, distance, average, etc. Should I put the scanner in this class, or should I put it in the Main method? I know this is really basic but I've only been learning java for a couple weeks and I'm having a hard time finding how this should be done/how to get the input to correlate to my instance variables and firstNumber and secondNumber public class TwoNumbers{ private double firstNumber; private double secondNumber; public double getSum() { double sum = firstNumber + secondNumber; return sum; } public double getDifference() { double difference = firstNumber - secondNumber; return difference; } public double getProduct() { double product = firstNumber - secondNumber; return product; } public double getAverage() { double average = (firstNumber + secondNumber) / 2; return average; } public double getDistance() { double distance = Math.abs(firstNumber - secondNumber); return distance; } public double getMax() { double maximum = Math.max(firstNumber, secondNumber); return maximum; } public double getMin() { double minimum = Math.min(firstNumber, secondNumber); return minimum; } }
answer count: 6
upvote count: 3
has answer: http://stackoverflow.com/a/24422000
has answer: http://stackoverflow.com/a/24421959
has answer: http://stackoverflow.com/a/24421958
has title: Where should scanner go in this program?
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24422011

http://stackoverflow.com/a/24277225
answers question: http://stackoverflow.com/q/24277129
upvote count: 1
has body: This is working example with handling Exception can raised as IOException, FileNotFoundException public static void main(String[] args) { FileInputStream in = null; FileOutputStream out = null; try { in = new FileInputStream("D:\\input.txt"); //specify exact location here. out = new FileOutputStream("D:\\output.txt"); int c; while ((c = in.read()) != -1) { out.write(c); } } catch(FileNotFoundException fe) { fe.printStackTrace(); } catch(IOException ie) { ie.printStackTrace(); } finally { if (in != null) { try { in.close(); } catch (IOException e) { e.printStackTrace(); } } if (out != null) { try { out.close(); } catch (IOException e) { e.printStackTrace(); } } } }
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/a/24422975
accepted answer of: http://stackoverflow.com/q/24361996
type: Answer
answers question: http://stackoverflow.com/q/24361996
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: I was also struggling to find which of the devices support USB hosting. After trying various devices it is clear that just having Android 3.1 or higher does NOT guarantee that your phone support USB Hosting. I came across this Google Spread Sheet which lists various devices with USB Hosting. You can also contribute to this list by submitting your responses through this Google Form. Hope this helps !

http://stackoverflow.com/comment/37548588
type: Comment
type: QuestionComment
has text: I mean that my code works for some inputs and for others it doesn't Kick Buttowski. Read my comment above with the explanation
score: 1
comment on: http://stackoverflow.com/q/24297688

mousemotionlistener
type: Tag
tag name: mousemotionlistener
tags question: http://stackoverflow.com/q/24407434

http://stackoverflow.com/comment/37808409
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24419886
has text: Did you remove the `static` from `onProgressUpdate` in your current code? And plase add the code that is called after `new MyAsync().execute();`.

http://stackoverflow.com/a/24267479
has comment: http://stackoverflow.com/comment/37495917
has body: You have to go into your build.gradle file and change your Build to this: android { compileSdkVersion 19 buildToolsVersion "19.1.0" It should be located in your project folder (the one that contains src and build folders). If you can't find it in your build.gradle file, it's possible there's a second file that has this correct piece. Note, only change the buildToolsVersion, don't add anything else.
score: 2
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/24267457
answers question: http://stackoverflow.com/q/24267457
has comment: http://stackoverflow.com/comment/37495849

http://stackoverflow.com/a/24364028
has comment: http://stackoverflow.com/comment/37674935
score: 2
upvote count: 2
has body: Note: Input can't be changed. The problem is coming due to the inclusion of ' in the input. Best practice is to use PreparedStatement for binding the input values with the query parameters. It manages to escape special characters if any in the input values. Example: // body_template, idno are of type String String sql_command = "Update email_template set body_template=? WHERE id=?"; PreparedStatement pst = con.prepareStatement( sql_command ); pst.setString( 1, body_template ); pst.setString( 2, idno ); int updateResult = pst.executeUpdate();
has comment: http://stackoverflow.com/comment/37674659
accepted answer of: http://stackoverflow.com/q/24363050
answers question: http://stackoverflow.com/q/24363050
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/37522511
has text: Hi Blaise, I have created model manually, can you please tell me how can i pass the ClassLoader?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24283380

http://stackoverflow.com/comment/47504177
type: Comment
type: QuestionComment
has text: I gave up on it, it was to awkward...
score: 1
comment on: http://stackoverflow.com/q/24279699

vaadin
tags question: http://stackoverflow.com/q/24364251
tags question: http://stackoverflow.com/q/24329048
tags question: http://stackoverflow.com/q/24394729
tag name: vaadin
tags question: http://stackoverflow.com/q/24365060
tags question: http://stackoverflow.com/q/24279182
type: Tag
tags question: http://stackoverflow.com/q/24362405
tags question: http://stackoverflow.com/q/24330272
tags question: http://stackoverflow.com/q/24296961
tags question: http://stackoverflow.com/q/24385269
tags question: http://stackoverflow.com/q/24341852
tags question: http://stackoverflow.com/q/24363588
tags question: http://stackoverflow.com/q/24291911
tags question: http://stackoverflow.com/q/24327475
tags question: http://stackoverflow.com/q/24410805
tags question: http://stackoverflow.com/q/24381762

http://stackoverflow.com/comment/37514150
comment on: http://stackoverflow.com/a/24278820
type: Comment
has text: you can pass this rotated graphics object before the children are painted which would then paint the children in this rotated fashion. But the origin is not changing. It is just the visual reference that is changing
type: AnswerComment
score: 0

http://stackoverflow.com/comment/60150714
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24433916
has text: can we use the type token method here?

http://stackoverflow.com/q/24322567
linked to: http://stackoverflow.com/q/16149347
downvote count: 1
favorite count: 0
has title: How to get value of a html textarea (given its id/name) using Java?
has comment: http://stackoverflow.com/comment/37595088
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/37596188
tagged with: java
has body: I have a html page with several tags. I need to get the value of the tag textarea. For eg I have several lines of data inside textarea tag. I need to get its value using JAVA. Can somebody give suggestions on how to do this?
type: Question
has answer: http://stackoverflow.com/a/24322922
has answer: http://stackoverflow.com/a/24322588
score: 0
answer count: 2
upvote count: 1

http://stackoverflow.com/q/24320330
has body: I have a JSON array like this, JSONArray content= "[ {"+"\"pageid\":\"19\","+"\"company\":"+"\"C1\","+"\"pageview\":"+"\"10\","+"\"visitfreq\":"+"\"2\"},{"+"\"pageid\":\"19\","+"\"company\":"+"\"C2\","+"\"pageview\":"+"\"20\","+"\"visitfreq\":"+"\"4\"},{"+"\"pageid\":\"200\","+"\"company\":"+"\"C3\","+"\"pageview\":"+"\"30\","+"\"visitfreq\":"+"\"3\"} ]"; Code for JSONArray: JSONObject jObj1 = new JSONObject(); jObj1.put("pageid", "19"); jObj1.put("company", "C1"); jObj1.put("pageview", "10"); jObj1.put("visitfreq", "2"); JSONObject jObj2 = new JSONObject(); jObj2.put("pageid", "19"); jObj2.put("company", "C2"); jObj2.put("pageview", "20"); jObj2.put("visitfreq", "4"); JSONObject jObj3 = new JSONObject(); jObj3.put("pageid", "200"); jObj3.put("company", "C3"); jObj3.put("pageview", "30"); jObj3.put("visitfreq", "3"); JSONArray jArr = new JSONArray(); jArr.put(jObj1); jArr.put(jObj2); jArr.put(jObj3); Visual representation: [ { "company": "C1", "visitfreq": "2", "pageview": "10", "pageid": "19" }, { "company": "C2", "visitfreq": "4", "pageview": "20", "pageid": "19" }, { "company": "C3", "visitfreq": "3", "pageview": "30", "pageid": "200" } ] I have worked on it to get an out put like below the out put like this [{pageid},[{rest of details}] ,{pageid},[{rest of details}] ] if same pageid occur more than once it should be like this [{pageid},[{rest of details1},{rest of details2},.. ],{pageid},[{rest of details}] ]
tagged with: arrays
has title: How do i refactor one JSON array into other format in JAVA?
accepted answer: http://stackoverflow.com/a/24494156
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37591202
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/24494156
has comment: http://stackoverflow.com/comment/37591633
type: Question

http://stackoverflow.com/q/24338734
linked to: http://stackoverflow.com/q/30329543
has comment: http://stackoverflow.com/comment/46577887
has answer: http://stackoverflow.com/a/48678482
favorite count: 0
has comment: http://stackoverflow.com/comment/117597724
has answer: http://stackoverflow.com/a/36689191
has answer: http://stackoverflow.com/a/77081069
answer count: 9
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/61106960
has answer: http://stackoverflow.com/a/73469096
upvote count: 13
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/41393996
has title: ResponseEntityExceptionHandler is not getting called when exception occurs
tagged with: spring-3
tagged with: java
tagged with: error-handling
has comment: http://stackoverflow.com/comment/47358241
has body: I am new to spring. I am developing a REST api with spring webmvc. For Error Handling I got this link http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/mvc.html#mvc-ann-rest-spring-mvc-exceptions I have tried to use ResponseEntityExceptionHandler in my project . but whenever my controller throws exception it never reaches to this ResponseEntityExceptionHandler. Following are my code snippet Controller @Controller @RequestMapping("/hello") public class HelloController { private static final Logger logger = Logger.getLogger(HelloController.class); @RequestMapping(value="/{name}", method=RequestMethod.GET) public @ResponseBody String greet(@PathVariable(value = "name")String name ) throws InvalidInputException, ResourceNotFoundException{ logger.info("start greet() "+name ); System.out.println("start greet() "+name); String message = null; if("".equalsIgnoreCase(name)) { throw new InvalidInputException("Invalid Input"); } List<String> names = new ArrayList<String>(); names.add("Harshal"); names.add("Smitesh"); if(names.contains(name)){ message = "Hello "+ name; }else{ throw new ResourceNotFoundException("Requested Resource not found"); } System.out.println("end greet"); logger.info("end greet()"); return message; } } Exceptions package com.practice.errorhandlerdemo.exception; public class InvalidInputException extends RuntimeException{ private static final long serialVersionUID = 5489516240608806490L; public InvalidInputException() { super("Invalid Input"); } public InvalidInputException(String message) { super(message); } } package com.practice.errorhandlerdemo.exception; public class ResourceNotFoundException extends RuntimeException { private static final long serialVersionUID = -4041009155673754859L; public ResourceNotFoundException() { super("requested resource not found"); } public ResourceNotFoundException(String message) { super(message); } } exceptionhandler @ControllerAdvice public class RestResponseEntityExceptionHandler extends Response…
type: Question
has answer: http://stackoverflow.com/a/72554907
has answer: http://stackoverflow.com/a/65844796
downvote count: 0
has comment: http://stackoverflow.com/comment/53122038
tagged with: spring-security
score: 13
has answer: http://stackoverflow.com/a/62822256
has answer: http://stackoverflow.com/a/31148618

http://stackoverflow.com/a/24345472
type: Answer
score: 1
upvote count: 1
has body: Specify complete package - Ex - jxl.write.Number number = new jxl.write.Number(columnNum,rowNum, value); //adds the cell to the Excel sheet sheet.addCell(number);
answers question: http://stackoverflow.com/q/24345452
downvote count: 0

http://stackoverflow.com/a/38207415
score: 0
answers question: http://stackoverflow.com/q/24289070
type: Answer
has body: There is nothing wrong with having protected static. One thing a lot of people are overlooking is that you may want to write test cases for static methods that you don't want to expose under normal circumstances. I've noticed this is particularly useful for writing tests for static method in utility classes.

http://stackoverflow.com/a/24434484
type: AcceptedAnswer
has body: I did it! FileInputStream fis; try { fis = new FileInputStream(file); } catch (FileNotFoundException fnfe) { return; } try { Document doc = new Document(); String line = null; try (BufferedReader reader = new BufferedReader(new InputStreamReader(fis, StandardCharsets.UTF_8))) { line = reader.readLine(); Field headerField = new TextField("header", line, Field.Store.YES); headerField.setBoost(2.0F); doc.add(headerField); while ((line = reader.readLine()) != null ) { doc.add(new TextField("contents", line, Field.Store.YES)); } } catch (IOException e) { System.err.println(e); } } finally { fis.close(); }
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24410063
answers question: http://stackoverflow.com/q/24410063

http://stackoverflow.com/a/34775708
has comment: http://stackoverflow.com/comment/61319338
score: 5
has body: Actually, now you can use your own IDE (or ADB instance) to upload your apps to RTL device and debug them. That feature is called Remote Debugging and you can find it i Test section of Client menu. http://developer.samsung.com/remotetestlab/rtlHelpDevice.action?gid=2000&amp;pageord=4#d4e45 It creates a tunnel between your PC's ADB/SDB instance and chosen device debug bridge. It gives you almost the same access as to your USB-connected device. Feature works pretty well. However, you need to remember about bandwidth limitations if you want to test bigger apps. Here is a screenshot of the Remote Debug Bridge in action - type the string in your terminal and it will connect to the Logcat in Android Studios:
answers question: http://stackoverflow.com/q/24402118
downvote count: 0
has comment: http://stackoverflow.com/comment/116624156
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/62673440
has comment: http://stackoverflow.com/comment/118294548

http://stackoverflow.com/q/24337936
accepted answer: http://stackoverflow.com/a/24338002
downvote count: 5
answer count: 1
has answer: http://stackoverflow.com/a/24338002
has comment: http://stackoverflow.com/comment/37624504
favorite count: 0
type: AnsweredQuestion
upvote count: 0
score: -5
tagged with: java
has body: Is there any way to edit a string which is already on a text file using vectors in Java? For example, the user inputs the employee number asked by the program and then the user will input the name and age. The modified info will be updated to the text file which serves as employee records.
has title: Edit record employee on text file using Vectors in Java
type: Question

http://stackoverflow.com/comment/37752652
comment on: http://stackoverflow.com/q/24401969
score: 0
type: Comment
type: QuestionComment
has text: Sure, knock yourself out

http://stackoverflow.com/comment/37711154
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24376658
type: QuestionComment
has text: You are using the wrong API on either client or server side. HBase has an old and a new Thrift API. See [here](http://stackoverflow.com/questions/22874861/hbase-thrift-in-cdh-5), same problem. -1 for not doing your homework before asking: [The very same question has been asked just yesterday](http://stackoverflow.com/questions/24371444/tapplicationexception-invalid-method-name-gettablenames-for-hbase-thrift-nodej).

http://stackoverflow.com/a/24467171
accepted answer of: http://stackoverflow.com/q/24296014
type: AcceptedAnswer
score: 0
answers question: http://stackoverflow.com/q/24296014
type: Answer
has body: I finally found the way to do it. I looked at Solandra tests and found how they were sending files to solr. URL url = new URL("http://hostname:port/solr/resource/solrksname.tablename/schema.xml"); // write try { HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); wr.write(builder.toString()); wr.flush(); wr.close(); System.out.println("Schema insert response code : " + conn.getResponseCode()); } catch (IOException e) { e.printStackTrace(); } And response code is 200, checking returns the correct schema, no error in solr admin, and no error while creating solr core. Don't know how i did it wrong the first time, the way was to use the basic HttpURLConnection and stream data with an output stream writer. No need for HttpCommons.

http://stackoverflow.com/a/24347191
has body: Apparently, the root cause of the problem is that Oracle has made an incompatible change to the serialization format of the com.sun.jini.logging.Levels class. The change reportedly happened in Oracle JDK 1.6.0_38 and JDK 1.7.0_13, and has presumably made it into recent OpenJDK versions as well. This problem has manifested in a variety of projects that use JINI. Examples: https://issues.apache.org/jira/browse/RIVER-415 + https://issues.apache.org/jira/browse/RIVER-416. https://cloudifysource.zendesk.com/entries/23079726-bootstrap-localcloud-not-working-Could-not-initialize-class-com-sun-jini-logging-Levels More examples can be found by searching for "com.sun.jini.logging.Levels EOFException". I can't say what the solution is / would be for you, but I have a couple of ideas: Avoidance: I think you can avoid the problem if you don't mix pre and post-change JVM versions in your application network. If you need to upgrade your application JVMs, I suggest that you upgrade them all, and then do a complete shutdown/restart of your JINI applications and services. Fix your applications: It appears that the Apache River project fixed the problem by modifying the JINI code. As the issue ticket says: The com.sun.jini.logging.Levels class produces a RuntimeException with the latest version of Java (both 1.6 and 1.7). The issue surrounds creation of custom java.util.logging.Level. The current implementation uses a ClassReplacingObjectOutputStream and the LevelData approach. By removing this approach and creating a subclass of java.util.logging.Level the issue gets resolved. The issue ticket has a lot of discussion on the best way to do this, proposed patches and links to the checkin where they actually implemented the fix.
answers question: http://stackoverflow.com/q/24342263
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24342263

http://stackoverflow.com/comment/37707795
score: 0
has text: dear Guillaume, thanks for your answer. could you plz tell me the function of mNewAdapter.setInflater((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE),this); and and also function of setInflater. ---- gratefull to you mate---
type: AnswerComment
comment on: http://stackoverflow.com/a/24369483
type: Comment

http://stackoverflow.com/comment/37747717
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24402338
has text: I have posted the code which does the update in OP, it already uses the transformer to format and indent. but the empty lines keep coming.

http://stackoverflow.com/q/24369934
has title: Create a jar file using jdev that includes weblogic.jar
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/24906244
downvote count: 0
tagged with: jar
has body: I've been having troubles lately in creating a jar file that can call a secured web service on Weblogic server using Jdev. I've created a web service proxy which is handling the situation perfectly. My goal is to deploy this web service as a jar file so that I can use it in my other projects as a simple library. I was able to deploy the project as a jar file, which in turn allowed me to use it's different methods to connect to the web service. However, when I run the web service client on eclipse I get an error: Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/xml/crypto/wss/provider/CredentialProvider at WebServiceCaller.callGetCardDetailJar(WebServiceCaller.java:55) at WebServiceCaller.main(WebServiceCaller.java:29) Caused by: java.lang.ClassNotFoundException: weblogic.xml.crypto.wss.provider.CredentialProvider 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) ... 2 more The problem may be fixed by finding the weblogic.jar file and including it in the eclipse build path, but is there a way to deploy a jar file with all the library dependencies included in it ?
answer count: 1
score: 1
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: web-services
tagged with: jdeveloper

http://stackoverflow.com/q/24413547
score: 1
favorite count: 0
type: Question
tagged with: android
has body: I am trying to allow my webview to be able to go back to the previous page when the back button on the phone/device is pressed. I am currently getting an error that says "non static "can go back" cannot be referenced from a static context" as well as "non static "go back" cannot be referenced from a static context". I think it has something to do with the placement of my back button overide code but im not too sure. Any ideas please? package com.test; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.support.v4.content.LocalBroadcastManager; import android.view.KeyEvent; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Button; import android.widget.Toast; import com.parse.ParseInstallation; import com.parse.ParsePush; import com.parse.ParseQuery; import com.parse.PushService; public class MainActivity extends Activity implements OnClickListener { private Button push; private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Toast.makeText(getApplicationContext(), "onReceive invoked!", Toast.LENGTH_LONG).show(); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); PushService.setDefaultPushCallback(this, MainActivity.class); WebView wv = (WebView) findViewById(R.id.webView1); wv.getSettings().setJavaScriptEnabled(true); wv.loadUrl("http://www.usa.gov/LawnBuddy/ "); wv.setWebViewClient(new WebViewClient()); push = (Button)findViewById(R.id.senPushB); push.setOnClickListener(this); } private class Callback extends We…
tagged with: java
answer count: 3
tagged with: webview
upvote count: 1
has answer: http://stackoverflow.com/a/24413678
has title: Webview Back Button Causing Static Error
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24413990
has answer: http://stackoverflow.com/a/24413941
downvote count: 0

http://stackoverflow.com/a/24299816
has body: Your URL seems missing http:// try to add in prefix 192.168.56.1/android_connect/get_users.php ex:- http://xxx.xxx.xx.x/android_connect/get_users.php
answers question: http://stackoverflow.com/q/24299653
score: 0
type: Answer

http://stackoverflow.com/comment/37567536
score: 0
has text: Good idea, using a seperate class for the parameters should work for me. Thanks!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24307440

http://stackoverflow.com/comment/37689941
type: Comment
has text: It's a file .kml and i would parse it.
comment on: http://stackoverflow.com/q/24372154
score: 0
type: QuestionComment

http://stackoverflow.com/a/24364371
type: Answer
has comment: http://stackoverflow.com/comment/37675523
has comment: http://stackoverflow.com/comment/37675381
has comment: http://stackoverflow.com/comment/37675878
has comment: http://stackoverflow.com/comment/37683300
has body: If you really need a long in that format, which i would seriously question: long dateTimeLong = year * 10000000000L + month * 100000000L + date * 1000000L + hours * 10000L + minutes * 100L + seconds * 1L; You say you need an URL parameter though, which is a string, and not a long. So just use DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyyMMddHHmmss"); String dateTimeString = formatter.print(dateTime);
has comment: http://stackoverflow.com/comment/37675489
score: 0
answers question: http://stackoverflow.com/q/24364128

http://stackoverflow.com/a/24289231
type: Answer
has comment: http://stackoverflow.com/comment/41191736
has comment: http://stackoverflow.com/comment/41191856
has body: It's more a stylistic thing than a direct problem. It suggests that you haven't properly thought through what is going on with the class. Think about what static means: This variable exists at class level, it does not exist separately for each instance and it does not have an independent existence in classes which extend me. Think about what protected means: This variable can be seen by this class, classes in the same package and classes which extend me. The two meanings are not exactly mutually exclusive but it is pretty close. The only case I can see where you might use the two together is if you had an abstract class that was designed to be extended and the extending class could then modify the behavior using constants defined in the original. That sort of arrangement would most likely end up very messy though and indicates weakness in the design of the classes. In most cases it would be better to have the constants as public since that just makes everything cleaner and allows the people sub-classing more flexibility. Quite apart from anything else in many cases composition is preferable to inheritance, while abstract classes force inheritance. To see one example of how this could break things and to illustrate what I mean by the variable not having an independent existence try this example code: public class Program { public static void main (String[] args) throws java.lang.Exception { System.out.println(new Test2().getTest()); Test.test = "changed"; System.out.println(new Test2().getTest()); } } abstract class Test { protected static String test = "test"; } class Test2 extends Test { public String getTest() { return test; } } You will see the results: test changed Try it yourself at: https://ideone.com/KM8u8O The class Test2 is able to access the static member test from Test without needing to qualify the name - but it does not inherit or get its own copy. It is looking at the exact same object in memory.
has comment: http://stackoverflow.com/comment/105509400
upvote count: 99
score: 98
has comment: http://stackoverflow.com/comment/59272979
downvote count: 1
has comment: http://stackoverflow.com/comment/59272744
accepted answer of: http://stackoverflow.com/q/24289070
has comment: http://stackoverflow.com/comment/59236984
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/41196303
has comment: http://stackoverflow.com/comment/105519588
has comment: http://stackoverflow.com/comment/37536483
has comment: http://stackoverflow.com/comment/59274048
answers question: http://stackoverflow.com/q/24289070
has comment: http://stackoverflow.com/comment/37749236

http://stackoverflow.com/comment/37675391
has text: json not valid please check properly...error Parse error on line 1: ({ "status": { ^ Expecting '{', '['
score: 0
comment on: http://stackoverflow.com/q/24363971
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24321724
has title: Decompiled Obfuscated Code "Cannot return from within an initializer"
has comment: http://stackoverflow.com/comment/37594396
has comment: http://stackoverflow.com/comment/37593786
type: Question
has comment: http://stackoverflow.com/comment/37593968
has answer: http://stackoverflow.com/a/24366914
has comment: http://stackoverflow.com/comment/37593681
has comment: http://stackoverflow.com/comment/37593812
tagged with: java
tagged with: decompiling
has answer: http://stackoverflow.com/a/24322801
accepted answer: http://stackoverflow.com/a/24322801
has comment: http://stackoverflow.com/comment/37593888
has comment: http://stackoverflow.com/comment/37600193
has comment: http://stackoverflow.com/comment/37593722
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37594615
has body: I have a class file named StaticInitializer.class which obfuscated successfully. When I have decompiled it I got following result where IDE gives an compiler error "Cannot return from within an initializer". Removing "return" statement solves the problem. But In fact What I want to know is that how obfuscated class file works properly if it has an return statement in static initializer. Is there a mismatch between compiling and running phase of java files, that obfuscation detects and uses them as a way of obfuscation? Decompiled code public class StaticInitializer { static { int a=12; int b=34; return ; } } Edited: Following operation shows that obfuscated class file is compiled with jdk 1.5 javap -c StaticInitializer.class major version: 49 J2SE 8 = 52, J2SE 7 = 51, J2SE 6.0 = 50, J2SE 5.0 = 49, JDK 1.4 = 48, JDK 1.3 = 47, JDK 1.2 = 46, JDK 1.1 = 45
possible better answer: http://stackoverflow.com/a/24366914
linked to: http://stackoverflow.com/q/7591064
tagged with: obfuscation
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37593686

http://stackoverflow.com/comment/37521227
has text: @blgth Since they're in different folders I figured it must have started with the JavaCC folder, failed and stopped. Thanks for your help. I think the proper thing to do is set a property on the plugin so that the generated files go into the same folder as the rest of the package they belong to.
score: 0
comment on: http://stackoverflow.com/q/24280372
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37695309
comment on: http://stackoverflow.com/q/24374867
has text: non-editable in this context means you can't edit it on screen, it doesn't mean you can't edit it programmatically.
score: 12
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24364039
type: Answer
answers question: http://stackoverflow.com/q/24363971
upvote count: 1
has comment: http://stackoverflow.com/comment/37674934
score: 1
has body: You JSON is wrong: "date": "3 hours agp", "distance": "1.9km" } { "country": "Canada", To coorect it, you must add a , "date": "3 hours agp", "distance": "1.9km" }, { "country": "Canada",
has comment: http://stackoverflow.com/comment/37718945
has comment: http://stackoverflow.com/comment/37675044
downvote count: 0
has comment: http://stackoverflow.com/comment/37674512
has comment: http://stackoverflow.com/comment/37674757

http://stackoverflow.com/comment/37777892
has text: Yes. That's what I meant. Model your Java POJOs after your XML and vice versa. Your XML contains an outer `Inner` element and many `Flight` elements, so your Java should have an `Inner` element with many `Flight` elements. How do you model _many_? You use a `List`, `Set`, or array.
score: 0
comment on: http://stackoverflow.com/q/24416869
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37752141
type: Comment
score: 1
has text: @NullPointer The inheritance tells what the class *is*. The interface tells what the class *cans*. For example, ArrayList *is* a sort of AbstractList but declares that it *cans* be Cloned and Serialized.
type: AnswerComment
comment on: http://stackoverflow.com/a/24404944

http://stackoverflow.com/q/24414896
has answer: http://stackoverflow.com/a/24415151
tagged with: regex
accepted answer: http://stackoverflow.com/a/24415151
type: AnsweredQuestion
tagged with: java
downvote count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/24415169
type: Question
tagged with: regular-language
has comment: http://stackoverflow.com/comment/37770515
has comment: http://stackoverflow.com/comment/37770582
has body: Hi don't know much of regular expression and I am trying to get just the digits from the string "glm=4563125@", can someone please help me. The number of digits can vary, so it's not specific the amount of digits that will be there. Thanks.
has comment: http://stackoverflow.com/comment/37770626
score: -2
has comment: http://stackoverflow.com/comment/37770348
has title: Getting digits from string Regular Expression in Java
possible better answer: http://stackoverflow.com/a/24414957
has answer: http://stackoverflow.com/a/24414957
answer count: 3
has comment: http://stackoverflow.com/comment/37770358
has comment: http://stackoverflow.com/comment/37770297
favorite count: 0
has comment: http://stackoverflow.com/comment/37770206
has comment: http://stackoverflow.com/comment/37770607

http://stackoverflow.com/comment/37554108
type: Comment
type: QuestionComment
has text: @Andremoniy You *can* call the constructor of an abstract class, but not by using the "normal" `new _____()` notation.
comment on: http://stackoverflow.com/q/24300773
score: 0

http://stackoverflow.com/a/24404488
score: 2
accepted answer of: http://stackoverflow.com/q/24385613
answers question: http://stackoverflow.com/q/24385613
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Let us assume we have a package com.pasquier.IDAO.WS and the following classes/interface in it: LogWebService LogWSDTO ILogWebService LS2J is a strange thing and does not work as it should be in some cases. And a developer reacts like this when LS2J reports an error which should not be occured. We assume that LogWSDTO has default constructor, so we create its instance: Set logWSDTOClass = javaSession.getClass("com/pasquier/IDAO/WS/LogWSDTO") Set logWSDTOObject = logWSDTOClass.CreateObject() Then we create object, that uses this log in it's constructor. We get the class: Set logWebServiceClass = javaSession.getClass("com/pasquier/IDAO/WS/LogWebService") And calling: Set logWebServiceObject = logWebServiceClass.CreateObject("(Lcom/pasquier/IDAO/WS/LogWSDTO;)V", logWSDTOObject) TA-DAA!, that's does not work. We get a famous "Java constructor failed to execute". Why? Because the constructor has one parameter with a correct type and this error should not occur. But it is LS2J, and we need to suffer :) So, we need a workaround to solve this task. We are modifying our LogWebService class to declare a default constructor, and we're adding a new method: public void setLog(LogWSDTO log) { this.logDTO = log; } After that we do: Set logWebServiceObject = logWebServiceClass.CreateObject() Call logWebServiceObject.setLog(logWSDTOObject) Call logWebServiceObject.notesMain() It works. Magic. Below there is listing of all classes/code you will need for this example: package com.pasquier.IDAO.WS; public class LogWSDTO { public LogWSDTO() { System.out.println("@@@ LogWSDTO constructor called!"); } public void log() { System.out.println("@@@ LogWSDTO DO called!"); } } package com.pasquier.IDAO.WS; public interface ILogWebService { void notesMain(); } package com.pasquier.IDAO.WS; import lotus.domino.Session; public class LogWebService implements ILogWebService { private Session session; private LogWSDTO logDTO = null; public LogWebService() { System.out.println("LogWebService: Default …

http://stackoverflow.com/comment/37687070
has text: Le sigh. Ant code generation conspired to bite us in our shiny metal butts, as Bender would say. What was being typed in the source file doesn't necessarily resemble what gets spit out in the class file...
comment on: http://stackoverflow.com/a/24317433
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24328989
type: AnsweredQuestion
tagged with: generics
favorite count: 0
has title: Unexpected "unchecked conversion" warning
type: Question
has comment: http://stackoverflow.com/comment/37608468
has comment: http://stackoverflow.com/comment/37608245
answer count: 2
has comment: http://stackoverflow.com/comment/37608283
score: 4
tagged with: java
has answer: http://stackoverflow.com/a/24329679
has comment: http://stackoverflow.com/comment/37607419
downvote count: 1
has body: The following code results in an unchecked conversion compiler warning - { List&lt;String&gt; first = first((Class)Integer.class); } private &lt;T&gt; List&lt;String&gt; first(Class&lt;T&gt; clazz) { return null; } However, the following code doesn't have any warnings - { List&lt;String&gt; second = second((Class)Integer.class); } private List&lt;String&gt; second(Class&lt;?&gt; clazz) { return null; } There are three warnings in total, the first two I expect but the third doesn't make sense - $ javac Test1.java -Xlint Test1.java:6: warning: [unchecked] unchecked conversion found : java.lang.Class required: java.lang.Class&lt;T&gt; List&lt;String&gt; first = first((Class)Integer.class); ^ Test1.java:6: warning: [unchecked] unchecked method invocation: &lt;T&gt;first(java.lang.Class&lt;T&gt;) in Test1 is applied to (java.lang.Class) List&lt;String&gt; first = first((Class)Integer.class); ^ Test1.java:6: warning: [unchecked] unchecked conversion found : java.util.List required: java.util.List&lt;java.lang.String&gt; List&lt;String&gt; first = first((Class)Integer.class); ^ 3 warnings Compiler version - $ javac -version javac 1.6.0_45 My question is, why does the third compiler warning occur?
upvote count: 5
possible better answer: http://stackoverflow.com/a/24330319
tagged with: unchecked
has answer: http://stackoverflow.com/a/24330319
accepted answer: http://stackoverflow.com/a/24329679
tagged with: java-6

http://stackoverflow.com/q/24353106
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24353144
has body: I have this code if( id == 0 ||(id % 2) != 0){ System.out.println("test"); synchronized(lock) { try { out1.println("Wait for another player..."); lock.wait(); System.out.println("lock"); } catch (InterruptedException e) { e.printStackTrace(); } some code here }else{ System.out.println("tes1t"); player p2 = new player(id,socket); Players.add(p2); id++; lock.notify(); } The first time i run the client, the first block of code gets executed and it waits() until one more client gets connected. When i run the second client, and i try to notify the first block of code, it shows to me this error: Exception in thread "NewPlayer1" java.lang.IllegalMonitorStateException at java.lang.Object.notifyAll(Native Method) at tictactoe.ServerClass.run(ServerClass.java:129)
score: 0
tagged with: java
type: Question
has title: Java multi-threaded Server notify() IllegalMonitorStateException
tagged with: wait
tagged with: notify
has comment: http://stackoverflow.com/comment/37653868
answer count: 1
has comment: http://stackoverflow.com/comment/37653887
has answer: http://stackoverflow.com/a/24353144

http://stackoverflow.com/a/24400771
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/37743962
has comment: http://stackoverflow.com/comment/37744054
downvote count: 0
has comment: http://stackoverflow.com/comment/37744174
has comment: http://stackoverflow.com/comment/37744238
accepted answer of: http://stackoverflow.com/q/24400736
score: 3
answers question: http://stackoverflow.com/q/24400736
has body: A private class is visible to all the methods and nested classes in the same file. Normally you would think of private as narrowing the scope of use, but in this case using private you are broadening the scope of where is the class is visible in a way Java doesn't support. Making the method private is the same as doing this class outer { private class inner { // Line-1 public void showinner() { System.out.println("I am in Inner Class"); } } public void outerfunction() { } } Which looks fine until you consider that a nested class can use the values in it's outer context. class outer { public void printInner() { // accessible in the same .java file because we made it private inner i = new inner(); i.showInner(); // what should `x` be? } public void outerfunction(final int x) { private class inner { // Line-1 public void showinner() { System.out.println("I am in Inner Class, x= " + x); } } } }
has comment: http://stackoverflow.com/comment/37743922
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37744420

http://stackoverflow.com/comment/37788968
score: 0
type: Comment
type: QuestionComment
has text: Please [edit] your question to describe the problem you are having with the code in more detail and [include a *minimal* example](http://stackoverflow.com/help/mcve).
comment on: http://stackoverflow.com/q/24411240

foreach
tags question: http://stackoverflow.com/q/24300733
tags question: http://stackoverflow.com/q/24399181
type: Tag
tag name: foreach
tags question: http://stackoverflow.com/q/24274124

http://stackoverflow.com/a/24281501
downvote count: 0
has comment: http://stackoverflow.com/comment/37517805
type: AcceptedAnswer
score: 43
has comment: http://stackoverflow.com/comment/37517757
has comment: http://stackoverflow.com/comment/53629348
accepted answer of: http://stackoverflow.com/q/24281235
type: Answer
has comment: http://stackoverflow.com/comment/37517602
answers question: http://stackoverflow.com/q/24281235
has body: The error: invalid constant type: 18 Indicates that you have built the Jars with Java 8, but are attempting to run the application in a lower version. From what I have seen elsewhere, you probably need to switch to a newer version of javassist (which is raising the error), as the version you are using is not compatible with Java 8.
has comment: http://stackoverflow.com/comment/37518885
upvote count: 43
has comment: http://stackoverflow.com/comment/37517854

http://stackoverflow.com/comment/37642197
has text: Causes `Your page request has caused a SQLGrammarException: could not prepare statement error:`
score: 0
comment on: http://stackoverflow.com/a/24346894
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37573760
type: Comment
comment on: http://stackoverflow.com/q/24311076
type: QuestionComment
score: 1
has text: You are using `dcObject` objectclass. This OC requires `dc` attribute to be present on the object, which does not make much sense for persons (you should not use that objectclass). I am pretty sure this information is burried somewhere in the error... you should use proper logging mechanism (i.e. SLF4J with Logback) and not throw exception stack-traces away.

http://stackoverflow.com/a/24348889
has comment: http://stackoverflow.com/comment/37645888
has comment: http://stackoverflow.com/comment/37645878
type: Answer
has body: In case of Multi-threading there is no guarantee that which thread is allocated for what time to run by the processor and in that case the result is unpredictable and will generate different output for each run. If you are looking for desired output then you need synchronization block. using wait and notify you can achieve it easily. Please have a look at below Lesson directly from Oracle official site: Lesson: Concurrency to read more about concurrency. Chapter 17. Threads and Locks to read more about thread, locks and synchronization. Note: wait &amp; notify must be called inside the synchronized block and can call on the same object on which it is synchronized. Sample code: (read inline comments) public class Connor extends Thread { private static Connor runner1 = new Connor(); private static Connor runner2 = new Connor(); public void run() { for (int i = 0; i &lt; 10; i++) { System.out.println("Hello " + i); // wake up another thread to come out from wait state if (runner1 == this) { // wake up runner2 synchronized (runner2) { runner2.notify(); } } else { // wake up runner1 synchronized (runner1) { runner1.notify(); } } synchronized (this) { try { // say current thread to wait until notify by another thread this.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } } public static void main(String[] args) { runner1.start(); runner2.start(); } } output: Hello 0 Hello 0 Hello 1 Hello 1 Hello 2 Hello 2 Hello 3 Hello 3 Hello 4 Hello 4 Hello 5 Hello 5 Hello 6 Hello 6 Hello 7 Hello 7 Hello 8 Hello 8 Hello 9 Hello 9
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24348745
upvote count: 2

http://stackoverflow.com/a/24331079
type: Answer
has comment: http://stackoverflow.com/comment/37681053
answers question: http://stackoverflow.com/q/24331042
accepted answer of: http://stackoverflow.com/q/24331042
upvote count: 9
score: 9
has body: You should be getting it as a compile-time error, not an exception (unless the actual exception is that you've got an unresolved compile-time error). Just importing org.mockito.Matchers means you can use the name Matchers to mean org.mockito.Matchers anywhere in the class. If you want to import the methods, you need a static wildcard import: import static org.mockito.Matchers.*; Or specific methods: import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.anyList; Or you could just qualify the method name in the calling code instead: Mockito.when(nrClient.uploadFiles("DF49ACBC8", Matchers.anyList(), "dl")) .thenReturn("");
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37611364

http://stackoverflow.com/comment/37664025
comment on: http://stackoverflow.com/q/24358221
has text: you should be able to change query to return only last record
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37776943
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24415787
has text: Difference is, he is adding click listeners for edit text fields, and both the edit text fields have the same listeners.
type: AnswerComment

http://stackoverflow.com/comment/37623720
has text: You'll have to explain more in your post about what the logs in `ReAppointmentService` pointed out - `extras.hasExtra("id")` is `false`? `extras.getString("id")` is null? Is the `id` you are putting into the Intent actually a String?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24337466
type: Comment

http://stackoverflow.com/comment/37572677
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24308219
has text: Yes, this is precisely what you will get if you connect to your server (router in your case). If your server accepts connection and commands it will respond on your connection I/O channels exactly as with client/server because that is precisely what it is.
score: 0

http://stackoverflow.com/q/24322041
type: Question
score: 1
tagged with: java
has title: Overriding the AWT Event Dispatch Thread
upvote count: 1
has answer: http://stackoverflow.com/a/24326090
accepted answer: http://stackoverflow.com/a/24326090
answer count: 1
tagged with: awt
favorite count: 0
type: AnsweredQuestion
tagged with: event-dispatch-thread
downvote count: 0
has comment: http://stackoverflow.com/comment/37600557
tagged with: multithreading
has body: I am building on a java profiling tool, the mechanism requires all Thread instances of the application to be replaced by the subclass "ProfilingThread" which overrides some of the threads's behavior to achieve the profiling functionality. Given the Java application's source code, I can simply re-factor all "Thread" class to "ProfilingThread" class. However, the AWT event dispatcher's thread is not instantiated by user's code, it is instead created autonomously when AWT functions are called. What can I do to replace AWT event dispatcher's Thread instance with a ProfilingThread instance? All ideas and criticisms are welcome.

http://stackoverflow.com/q/24312152
score: -1
has comment: http://stackoverflow.com/comment/37575442
has answer: http://stackoverflow.com/a/24312212
has body: public class chessboardUsingArray { private Car[][] myBoard = new Car[8][8]; public chessboardUsingArray() { // make sure at the end of this constructor, myBoard is 8x8 and each car // in it is set to NULL for (int x = 0; x &lt; myBoard.length; x++) { for (int y = 0; y &lt; myBoard[x].length; y++) { myBoard[x][y] = null; // System.out.print(myBoard[x][y] + " "); } // System.out.println(); } } public void printBoard() { for (int x = 0; x &lt; myBoard.length; x++) { for (int y = 0; y &lt; myBoard[x].length; y++) { Car defaultCar = myBoard[x][y]; if (defaultCar != null) { System.out.println(" " + defaultCar.getMake() + " "); } else { System.out.print(" X "); } } System.out.println(); } } public boolean placeCar(int y, int x, Car myCar) { if (x &gt;= 0 &amp;&amp; x &lt; 8 &amp;&amp; y &gt;= 0 &amp;&amp; y &lt; 8) { if (myBoard[x][y] == null) { myBoard[x][y] = myCar; } } return false; } The place car function should place a car in the specified coordinates and return everything else with an X as specified. When I try to put a car in location (2, 3) this happens... The car is placed correctly as you can see with an H but do some of the other locations disappear? X X X X X X X X X X X X X X X X X X X X X X X X X X H X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X the five X 's to the right of H disappear as do three others below it. idk why its not being shown correctly. any ideas? thanks
answer count: 1
downvote count: 1
tagged with: java
has title: Why is my output messed up for printing out 2-d array?
upvote count: 0
type: UnansweredQuestion
favorite count: 0
type: Question
tagged with: multidimensional-array

http://stackoverflow.com/comment/37795476
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24426092
has text: Could you try to remove the ... part and check if the error persists? Maybe the problem is there...

http://stackoverflow.com/a/24409347
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37759717
type: Answer
has body: You can Create a BufferedImage with the JFrame's size Call the JFrame's print() method with the BufferedImage's graphics Code: BufferedImage image = new BufferedImage(frame.getWidth(), frame.getHeight(), BufferedImage.TYPE_INT_RGB); frame.print(image.getGraphics());
upvote count: 5
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24409172
answers question: http://stackoverflow.com/q/24409172
score: 5

elasticsearch
tags question: http://stackoverflow.com/q/24301647
tags question: http://stackoverflow.com/q/24320124
type: Tag
tags question: http://stackoverflow.com/q/24341441
tags question: http://stackoverflow.com/q/24323480
tags question: http://stackoverflow.com/q/24367345
tags question: http://stackoverflow.com/q/24353260
tags question: http://stackoverflow.com/q/24283057
tags question: http://stackoverflow.com/q/24317551
tag name: elasticsearch
tags question: http://stackoverflow.com/q/24380857
tags question: http://stackoverflow.com/q/24363999
tags question: http://stackoverflow.com/q/24328698

http://stackoverflow.com/comment/37521422
type: Comment
type: QuestionComment
has text: Please read this, I hope it helps: http://stackoverflow.com/questions/2983248/com-mysql-jdbc-exceptions-jdbc4-communicationsexception-communications-link-fai
comment on: http://stackoverflow.com/q/24283613
score: 0

http://stackoverflow.com/comment/37595202
type: Comment
comment on: http://stackoverflow.com/a/24301210
has text: Okay. What I've learned so far is: **1**. If drawing is required, use the object of a class that extends JPanel. Use JFrame only as a container for panels. **2**. Avoid using getGraphics() as long as you can. **3**. Panels are better usable when used for containing a single component. Am I right?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37801453
type: Comment
comment on: http://stackoverflow.com/a/24423409
score: 0
type: AnswerComment
has text: The `doGet` in your Edit3 is not in the same servlet , is it ? If a servlet forward to itself you do have an infinite loop. The rule is : browser => servlet => jsp => html

http://stackoverflow.com/a/24339427
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37631362
has body: It looks like you're using readLine() because you're used to working with text. Wikipedia says AMF is a binary encoding, so you should be able to do something like this, rather than going through an encode/decode noop (you'd need to use ISO-8859-1, not UTF-8 for that to work) with a string. ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] buffer = new byte[2048]; try (InputStream in = conn.getInputStream()) { int read; while ((read = in.read(buffer)) &gt;= 0) { out.write(buffer, 0, read); } } out.toByteArray(); // Convert to hex if you want.
downvote count: 0
answers question: http://stackoverflow.com/q/24335073
type: Answer

http://stackoverflow.com/comment/37670944
type: Comment
comment on: http://stackoverflow.com/a/24360481
type: AnswerComment
has text: but your output showed the difference. could u check out my answer too? but I didn't remove any of cuz the question doesn't ask :)
score: 0

http://stackoverflow.com/q/24295486
has comment: http://stackoverflow.com/comment/37544549
answer count: 1
accepted answer: http://stackoverflow.com/a/24295760
has title: Eclipse prevents editing after debug mode entered
score: 0
tagged with: android
linked to: http://stackoverflow.com/q/9403634
has answer: http://stackoverflow.com/a/24295760
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
has body: I'm working on an Android project in Eclipse. I just updated to: Version: Kepler Service Release 2 Build id: 20140224-0627 Since then, if I hit a breakpoint in debug, I can no longer type in any files. The keyboard seems to work for stepping through code and for typing text elsewhere in Eclipse outside the file editors. The behavior persists even if I terminate the debug session. (I'm debugging on a device.) I need to restart Eclipse in order to be able to change files in the editor. Not too fun! I've not found any recent bug that explains the behavior. FWIW the upgrade wiped out my preferences too. It looks like my install history was lost too because the previous configuration does not seem available to revert to. Any help appreciated!

http://stackoverflow.com/q/24388173
upvote count: 1
linked to: http://stackoverflow.com/q/4414770
answer count: 1
downvote count: 1
duplicate of: http://stackoverflow.com/q/565634
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/565634
tagged with: java
has answer: http://stackoverflow.com/a/24388200
type: Question
has body: why output so strange 0022 =18? hello everyone to day i have test.the question is "what is the output of System.out.println(0022); i so confuse why Answer is 18 explain needed
duplicate of: http://stackoverflow.com/q/4414770
has title: Java:output Strange in printstream
score: 0

http://stackoverflow.com/q/24293012
has comment: http://stackoverflow.com/comment/37539626
type: Question
has comment: http://stackoverflow.com/comment/37539572
has title: run time error (ArrayOutOfBoundException)
has answer: http://stackoverflow.com/a/24293073
has comment: http://stackoverflow.com/comment/37539654
has body: Getting a run time error ArrayOutOfBoundException class Command { public static void main(String[] args) { int a,b,c,sum; a = Integer.parseInt(args[0]); b = Integer.parseInt(args[1]); c = Integer.parseInt(args[2]); sum = a+b+c; System.out.println("Command Line Sum is "+sum); } } // what is error in this code ?
answer count: 3
has comment: http://stackoverflow.com/comment/37539670
favorite count: 0
has answer: http://stackoverflow.com/a/24293406
upvote count: 2
type: UnansweredQuestion
downvote count: 1
has answer: http://stackoverflow.com/a/24293062
score: 1
tagged with: java

http://stackoverflow.com/comment/37539891
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24292784
has text: I can access the params array for the annotated columns. If I want to access columns which are non annotated have to use resultset. I am capturing annotated field with params. I think resultSet parameter is intend to that purpose is not it ?

http://stackoverflow.com/comment/37679736
score: 1
has text: absolutely not, `android:text="@string/hello_world"` should work on its own
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24365383

http://stackoverflow.com/comment/37653611
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24352822
has text: Your method should be broken up into 6 methods, open connection, queries 1 - 4, close connection.
score: 0

http://stackoverflow.com/comment/37761459
has text: Looking at [the docs you linked to](http://commons.apache.org/proper/commons-lang/javadocs/api-3.1/org/apache/commons/lang3/Validate.html#Validate()) the constructor for `Validate` is described with "This class should not normally be instantiated" ... and it doesn't take any parameters. So @vptheron is correct asking for clarification about what method you are calling, since what you have doesn't appear to be a method in the `org.apache.commons.lang3.Validate` class that you linked to.
type: QuestionComment
comment on: http://stackoverflow.com/q/24404802
type: Comment
score: 0

http://stackoverflow.com/q/24394909
tagged with: hsqldb
has title: HSQLDB QUERY correctness
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24607875
has body: merge into TEST_TABLE a using (select ? ID1, ? ID2 from dual) b (ID1, ID2) on (a.ID2 = b.ID2) when matched then update SET a.ID1 = b.ID1 when not matched then insert (a.ID1, a.ID2) values (b.ID1, b.ID2) Is the above HSQLDB query syntactically correct, to pass as a parameter to a JdbcTemplate object.update method ? I have been getting too many errors and haven't been able to find any useful material online to help me. Thank You.
tagged with: java
tagged with: jdbctemplate
type: Question
accepted answer: http://stackoverflow.com/a/24607875
score: 0
answer count: 1

http://stackoverflow.com/comment/37701289
type: QuestionComment
comment on: http://stackoverflow.com/q/24378061
has text: Can you refer to this SO Q&A? http://stackoverflow.com/questions/15653118/javafx-launch-another-application
score: 0
type: Comment

http://stackoverflow.com/q/24325171
type: UnansweredQuestion
tagged with: timezone
tagged with: dst
tagged with: java
type: Question
has title: UTC Timezone is not detecting Daylight saving s time
has body: I have the following code. //this line returns - UTC TimeZone timeZone = TimeZone.getDefault(); //date1 - todays date in UTC format boolean dstInit = timeZone.inDaylightTime(date1); //date2 - todays date in UTC format boolean dstNext = timeZone.inDaylightTime(date2); But due to some reason both dstInit and dstNext returning false (instead of TRUE). date1 and date2 is June 20, 2014 in UST formnat which falls in DST time between march and october. Can anyone please help me in fixing this issue?
has comment: http://stackoverflow.com/comment/37600989
tagged with: date
has answer: http://stackoverflow.com/a/24336433
has answer: http://stackoverflow.com/a/24336488
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/2532729
has comment: http://stackoverflow.com/comment/37600130

http://stackoverflow.com/q/24322793
tagged with: curl
score: 0
tagged with: java
upvote count: 1
answer count: 1
downvote count: 1
tagged with: glassfish
type: AnsweredQuestion
favorite count: 0
has answer: http://stackoverflow.com/a/24324954
accepted answer: http://stackoverflow.com/a/24324954
tagged with: rest
type: Question
has comment: http://stackoverflow.com/comment/37604103
has body: I plan to implement a java client to deploy and undeploy the application to Glassfish, Below is the curr command curl -s -S \ -H 'Accept: application/json' \ -H 'X-Requested-By: dummy' \ -X DELETE http://localhost:4848/management/domain/applications/application/hello And my java code is URL url = new URL( "http://localhost:4851/"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/json"); String input = "{\"DELETE\":\"http://localhost:4851/management/domain/applications/application/hello\"}"; OutputStream os = conn.getOutputStream(); os.write(input.getBytes()); os.flush(); if (conn.getResponseCode() != HttpURLConnection.HTTP_CREATED) { throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode()); } BufferedReader br = new BufferedReader(new InputStreamReader( (conn.getInputStream()))); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { System.out.println(output); } conn.disconnect(); Unfortunately, I not able to get the expected result. Anyone can help to advice?
has title: Glassfish REST API

http://stackoverflow.com/comment/118371259
type: Comment
has text: It might be worth adding that if you don't set a priority it will implicitly have a priority of zero. At least this is what I see in my testing on TestNG version 6.14.3
comment on: http://stackoverflow.com/a/39726456
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37630710
comment on: http://stackoverflow.com/q/24341368
has text: Your issue _is_ the same. And you _haven't_ read the answers to that question. This has nothing to do with `PATH`. This is due to your cwd being wrong.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24315599
tagged with: netbeans-6.9
has title: Java look and feel at runtime different from jFrame preview (NetBeans)
has comment: http://stackoverflow.com/comment/37584632
score: 0
has body: I am curious as to which I should trust what would best represent my code at runtime. For example, when I build and run the application, I get the following: However, when I right click on my jFrame, and click on preview, I get what I actually "wanted" (I realize the menuBar is missing): It's strange, because going into the Properties of the jPanel (which has the BorderedLayout manager and contains the jDesktopPane), and setting the preferred size or the size itself will actually 'refresh' and display accordingly whereas when I compiled and ran the program, no changes were visible. So which should I trust?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37590680
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37590711
tagged with: swing
type: Question

http://stackoverflow.com/comment/37592064
type: Comment
score: 0
has text: i am not using cookie. when we are creating a session at that time jsessionid cookie will be automatically generated at client browser.
comment on: http://stackoverflow.com/q/24320724
type: QuestionComment

http://stackoverflow.com/comment/37513616
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24279405
has text: You should use `BigDecimal` here and for any currency values. http://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency

http://stackoverflow.com/comment/37731945
type: Comment
comment on: http://stackoverflow.com/a/24362496
score: 0
type: AnswerComment
has text: Most of the logic is in the base class.

http://stackoverflow.com/comment/37728581
comment on: http://stackoverflow.com/a/24384850
score: 0
type: AnswerComment
has text: 'name' and 'value' are children of 'parameter'. This way I dont get the 'parameter' element. You can throw some more light
type: Comment

http://stackoverflow.com/a/78420210
has comment: http://stackoverflow.com/comment/138295061
type: Answer
has comment: http://stackoverflow.com/comment/138272932
downvote count: 0
has body: Also works for Weblogic 12.2.1.4 wlthint3client.jar alone is sufficient.
score: 1
answers question: http://stackoverflow.com/q/24362551
upvote count: 1

http://stackoverflow.com/comment/37533901
type: Comment
comment on: http://stackoverflow.com/a/24289524
score: 0
type: AnswerComment
has text: But that will not effect the context root in the war right? If that is true and you update your build.gradle to remove the unnecessary stuff I will accept

http://stackoverflow.com/a/24366405
has body: Its probably because you are not passing arguments to your program properly, i get the same error without args. With correct args it runs fine. Make sure to pass arguments properly in cmd java WordFrequency "Hello.txt"
answers question: http://stackoverflow.com/q/24366189
score: 0
type: Answer

http://stackoverflow.com/q/24333539
tagged with: java
has answer: http://stackoverflow.com/a/24357915
type: Question
tagged with: jakarta-ee
has body: Ok, this is going to be long, so here's the tl;dr: When distributed cache coordination is enabled, one of the apps slowly starts to degrade in integrity and throws a really strange exception. The 'fix' is to disable caching. Which sucks. Please help us find the issue in EclipseLink so we can patch it! EclipseLink 2.5.1 We have these Entities: @MappedSuperclass public abstract class Identifiable implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name = "id", nullable = false, updatable = false) @GeneratedValue(strategy = GenerationType.IDENTITY) public Integer id; @Version @Column(name = "meta__version") private Integer version; } @Entity @Table(name = "customers", indexes = { @Index(columnList = "phone_number"), @Index(columnList = "email_address") }) @Cacheable public class Customer extends Identifiable { private static final long serialVersionUID = 1L; @Column(name = "last_name") public String lastName; @Column(name = "first_name") public String firstName; .... } @Entity @Table(name = "notes", indexes = { @Index(columnList = "customer_id, is_cleared") }) @Cacheable public class Note extends Identifiable { private static final long serialVersionUID = 1L; @ManyToOne @JoinColumn(name = "customer_id") public Customer customer; @ManyToOne @JoinColumn(name = "agent_id") public Agent agent; @Size(min = 1, max = 32767) @Column(name = "text", length = 32767) public String text; @Column(name = "is_cleared") public Boolean isCleared; } <?xml version="1.0" encoding="UTF-8"?> org.eclipse.persistence.jpa.PersistenceProvider jdbc/databunker databunker.orm.xml com.mycompany.Customer com.mycompany.Note <exclude-unlisted-classes>true</exclude-unlisted-classes> ENABLE_SELECTIVE <!-- <property --> <!-- value="FINE" /> --> <!-- <property --> <!-- value="true" /> --> <property name="eclipselink.ddl-generation.output-mode" value="database" /> <property name="eclipselink.ddl-generation" value="create-or-extend-tables" /> <property name="eclipselink.wea…
has answer: http://stackoverflow.com/a/24497913
has comment: http://stackoverflow.com/comment/37779233
has comment: http://stackoverflow.com/comment/37812469
tagged with: caching
answer count: 2
tagged with: eclipselink
tagged with: jpa
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: EclipseLink Distributed Cache causing Null Primary Keys, what?
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37680561

http://stackoverflow.com/q/24319278
answer count: 0
type: UnansweredQuestion
upvote count: 1
linked to: http://stackoverflow.com/q/9546208
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37589443
has body: I'm trying to design a Java API roughly like this: package core; public abstract class GraphNode { public void add(Condition... conditions) { // check conditions isn't null, and translate them into a Map this.addCore(translatedConditions, new TraversalContext()); } protected abstract void addCore(Map&lt;String, Condition&gt; conditions, TraversalContext traversalContext); } The problem is that I need my concrete implementations to be able to recursively pass control onto subsequent nodes in the graph. Something like this: package core.nodes; public final class ConcreteGraphNode extends GraphNode { @Override protected void addCore(Map&lt;String, Condition&gt; conditions, TraversalContext traversalContext) { if (conditions.size() == 0) { // recursion done return; } // remove the appropriate condition, modify the traversal context, create or find the next node in the graph // pass the call on recursively nextNode.addCore(conditions, traversalContext); } } My motivation here is threefold: Incur the cost of argument checking only once when called via the public API. Thenceforth, all recursion happens against non-public APIs, so the argument validation can be skipped (or just asserted). Enable the non-public API to take an extra context parameter that has no business being in the public API because it's an implementation detail. Include only the minimal abstraction types in the core package, with a separate package (core.nodes) for actual implementations of those abstractions. However, Java's accessibility modifiers don't seem to accommodate this. By being in a separate package, I can no longer call protected members declared by my superclass. In other words, the call to nextNode.addCore in the ConcreteGraphNode is not possible. I'm wondering whether there's some elegant way around this that doesn't require me to move my implementation classes into my core package?
has comment: http://stackoverflow.com/comment/37590370
downvote count: 0
has comment: http://stackoverflow.com/comment/37590334
favorite count: 0
has title: How to keep a clean Java API

http://stackoverflow.com/comment/37619542
score: 0
type: Comment
has text: @AndreiVolgin Sorry I have very little knowledge about URL domain name. It's just a example. The regex can be modified or simply use String#split() method.
type: AnswerComment
comment on: http://stackoverflow.com/a/24334846

http://stackoverflow.com/q/24394470
answer count: 1
tagged with: eclipse-plugin
type: UnansweredQuestion
tagged with: java
has body: I added a CommandStackListener to my GraphicalEditor's command stack: getCommandStack().addCommandStackListener(new CommandStackListener() { public void commandStackChanged(EventObject event) { ... } } But I guess if I want to get information from the event parameter, I need to do a cast first. However, I don't know which subclasses of EventObject are used here. I am trying to detect the case where the command stack was changed or saved.
has answer: http://stackoverflow.com/a/24398553
type: Question
tagged with: eclipse-gef
score: 0
has title: With which subclasses of EventObject is CommandStackListener.commandStackChanged(EventObject) invoked in GEF?

http://stackoverflow.com/a/30918728
has body: you can quickly generate a voronoi diagram in Processing (Development Environment) using a library called toxi. Here is an example, https://github.com/hamzeen/voronoi_image P.S. Processing is a tiny development environment specially for artists (yet not restricted to them) to quickly prototype their ideas with minimal code (java) &amp; it's based on java applets.
score: 0
answers question: http://stackoverflow.com/q/24395738
type: Answer

http://stackoverflow.com/comment/37544052
type: Comment
has text: I tried the mkdirs and the one with the parent like greg says below, both have same results. I updated the code above to be the current code I have in the app.
type: QuestionComment
comment on: http://stackoverflow.com/q/24295081
score: 0

data-structures
tags question: http://stackoverflow.com/q/24367994
tag name: data-structures
tags question: http://stackoverflow.com/q/24361652
tags question: http://stackoverflow.com/q/24273328
tags question: http://stackoverflow.com/q/24415540
tags question: http://stackoverflow.com/q/24376731
tags question: http://stackoverflow.com/q/24346972
tags question: http://stackoverflow.com/q/24286065
tags question: http://stackoverflow.com/q/24414595
tags question: http://stackoverflow.com/q/24277942
tags question: http://stackoverflow.com/q/24293821
tags question: http://stackoverflow.com/q/24379271
tags question: http://stackoverflow.com/q/24420984
tags question: http://stackoverflow.com/q/24333115
tags question: http://stackoverflow.com/q/24269147
tags question: http://stackoverflow.com/q/24357436
tags question: http://stackoverflow.com/q/24340967
type: Tag
tags question: http://stackoverflow.com/q/24375848

http://stackoverflow.com/q/24392551
accepted answer: http://stackoverflow.com/a/24393189
has comment: http://stackoverflow.com/comment/37728338
has comment: http://stackoverflow.com/comment/37728630
tagged with: spring
has comment: http://stackoverflow.com/comment/37728776
tagged with: el
has comment: http://stackoverflow.com/comment/37728791
has title: Weird exception while using contains() method
tagged with: collections
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
has body: I'm building a web application using Spring MVC framework. I have some controller which adds some attributes (users belonging to the same team) to my view, as follows: @RequestMapping(value = "/friends", method = RequestMethod.GET) public ModelAndView showFriends(Principal principal) { ModelAndView mav = new ModelAndView("friends"); User currentUser = userService.findUser(principal.getName()); // this method returns a Collection&lt;long&gt; of userIds from users that belong to a given team Collection&lt;long&gt; userIds = findUsersFromTeam(currentUser.getTeam()); mav.addObject("users", userIds); mav.addObject("currentUser", userService.findUsers(); return mav; } And, in my "friends.jsp" file, I do the following test: &lt;c:when test="${users.contains(currentUser.id)}"&gt; Which throws the following exception: java.lang.NoSuchMethodException: java.util.ArrayList.contains(java.lang.Long) However, ArrayList class implements contains(Object o) method. What's wrong?
answer count: 1
has comment: http://stackoverflow.com/comment/37729235
has answer: http://stackoverflow.com/a/24393189

http://stackoverflow.com/comment/37589054
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24318727
has text: Thanks for the response! Indeed, I think you are on to something. Switching the roles of COM1 and COM13 (that is, leaving COM13 open, and closing and opening COM1) produces no error. I know COM13 is producing data while I think COM1 is not. So as you say, seems like it has something to do with the stream buffers holding data when they're closed (though there are no IOExceptions). Not sure what I can do about it though.

swing
tags question: http://stackoverflow.com/q/24361690
tags question: http://stackoverflow.com/q/24276609
tags question: http://stackoverflow.com/q/24287049
tags question: http://stackoverflow.com/q/24348950
tags question: http://stackoverflow.com/q/24278389
tags question: http://stackoverflow.com/q/24324781
tags question: http://stackoverflow.com/q/24352580
tags question: http://stackoverflow.com/q/24381981
tags question: http://stackoverflow.com/q/24393637
tags question: http://stackoverflow.com/q/24427092
tags question: http://stackoverflow.com/q/24282820
tags question: http://stackoverflow.com/q/24273547
tags question: http://stackoverflow.com/q/24289758
tags question: http://stackoverflow.com/q/24363902
tags question: http://stackoverflow.com/q/24379923
tags question: http://stackoverflow.com/q/24303014
tags question: http://stackoverflow.com/q/24274997
tags question: http://stackoverflow.com/q/24333267
tags question: http://stackoverflow.com/q/24344267
tags question: http://stackoverflow.com/q/24326910
tags question: http://stackoverflow.com/q/24392916
tags question: http://stackoverflow.com/q/24361230
tags question: http://stackoverflow.com/q/24355919
tags question: http://stackoverflow.com/q/24294117
tags question: http://stackoverflow.com/q/24283397
tags question: http://stackoverflow.com/q/24275063
tags question: http://stackoverflow.com/q/24317216
tags question: http://stackoverflow.com/q/24321274
tags question: http://stackoverflow.com/q/24427448
tags question: http://stackoverflow.com/q/24375071
tags question: http://stackoverflow.com/q/24378435
tags question: http://stackoverflow.com/q/24425542
tags question: http://stackoverflow.com/q/24291030
tags question: http://stackoverflow.com/q/24379563
tags question: http://stackoverflow.com/q/24268062
tags question: http://stackoverflow.com/q/24423922
tags question: http://stackoverflow.com/q/24341248
tags question: http://stackoverflow.com/q/24351426
tags question: http://stackoverflow.com/q/24303046
tags question: http://stackoverflow.com/q/24322765
tags question: http://stackoverflow.com/q/24299678
tags question: http://stackoverflow.com/q/24330976
tags question: http://stackoverflow.com/q/24299984
tags question: http://stackoverflow.com/q/24398107
tags question: http://stackoverflow.com/q/24313160
tags question: http://stackoverflow.com/q/24418904
tags question: http://stackoverflow.com/q/24387971
tags question: http://stackoverflow.com/q/24334967
tags question: http://stackoverflow.com/q/24415275
tags question: http://stackoverflow.com/q/24383368
tags question: http://stackoverflow.com/q/24323126
tags question: http://stackoverflow.com/q/24377641
tags question: http://stackoverflow.com/q/24366713
tags question: http://stackoverflow.com/q/24332058
tags question: http://stackoverflow.com/q/24331898
tags question: http://stackoverflow.com/q/24347872
tags question: http://stackoverflow.com/q/24331411
tags question: http://stackoverflow.com/q/24409879
tags question: http://stackoverflow.com/q/24370591
tags question: http://stackoverflow.com/q/24342893
tags question: http://stackoverflow.com/q/24295849
tags question: http://stackoverflow.com/q/24356583
tags question: http://stackoverflow.com/q/24381955
tags question: http://stackoverflow.com/q/24408501
tags question: http://stackoverflow.com/q/24349534
tags question: http://stackoverflow.com/q/24278666
tags question: http://stackoverflow.com/q/24391798
tags question: http://stackoverflow.com/q/24286751
type: Tag
tags question: http://stackoverflow.com/q/24353153
tags question: http://stackoverflow.com/q/24401969
tags question: http://stackoverflow.com/q/24324066
tags question: http://stackoverflow.com/q/24331161
tags question: http://stackoverflow.com/q/24289018
tags question: http://stackoverflow.com/q/24289450
tags question: http://stackoverflow.com/q/24363775
tags question: http://stackoverflow.com/q/24324236
tags question: http://stackoverflow.com/q/24320286
tags question: http://stackoverflow.com/q/24395633
tags question: http://stackoverflow.com/q/24310801

http://stackoverflow.com/q/24317493
accepted answer: http://stackoverflow.com/a/24355653
has title: Google Reflections object doesn't instance
score: 1
tagged with: java
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/37586329
downvote count: 0
has answer: http://stackoverflow.com/a/24355653
favorite count: 0
has comment: http://stackoverflow.com/comment/37586295
upvote count: 1
has comment: http://stackoverflow.com/comment/37585876
type: AnsweredQuestion
tagged with: reflections
has body: I'm trying to make a class that calls certain instances of an object according to the value of my custom annotation, to it found that, Google Reflection is a good option but I can not instantiate it, what am I doing wrong? I try public class TesteDeAnotacoes { /** * @param args the command line arguments */ public static void main(String[] args) { Reflections reflections = new Reflections("testedeanotacoes.test"); } } and have the follow error: Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/base/Predicate at testedeanotacoes.TesteDeAnotacoes.main(TesteDeAnotacoes.java:26) Caused by: java.lang.ClassNotFoundException: com.google.common.base.Predicate at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 1 more Java Result: 1 my project I missed some detail for it is not working?

http://stackoverflow.com/a/24326458
has comment: http://stackoverflow.com/comment/37603616
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24320109
has comment: http://stackoverflow.com/comment/37708595
upvote count: 1
has body: You can use @AutowiredBean from JSF-Spring integration project to inject JSF managed beans into Spring beans: @Component @Scope(WebApplicationContext.SCOPE_REQUEST) public class JsfTest implements Serializable { private static final long serialVersionUID = 1L; @AutowiredBean private JsfBean jsfBean; ... } Add Maven artifact com.intersult:jsf-spring:2.2.0.1-SNAPSHOT to your project, see https://www.intersult.com/wiki/page/JSF%20Spring%20Integration (use translation button).
type: Answer

http://stackoverflow.com/a/24338170
type: Answer
has body: For one thing, JPanel already implements ImageObserver, so overriding imageUpdate in this way likely breaks the panel's normal functionality. Also, you implement ImageObserver but never subscribe/register to observe anything. Try this: ... @Override public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h) { if ((infoflags &amp; ALLBITS) == 0) { System.out.println("Processing still"); } else { System.out.println("Done processing"); } return super.imageUpdate(img, infoflags, x, y, w, h); } ... public ImageTest() { try { img = ImageIO.read(new File("res/soccer-ball.jpg")); prepareImage(img, this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } ...
score: 0
answers question: http://stackoverflow.com/q/24338073

http://stackoverflow.com/a/24398380
upvote count: 3
has comment: http://stackoverflow.com/comment/37739535
score: 3
answers question: http://stackoverflow.com/q/24398107
downvote count: 0
type: Answer
has body: First, I wouldn't use JTextArea, it's meant for free form text editing (think NotePad). Instead you should, at the very least, use a JTextField but a JSpinner might actually even be better. Take a look at How to Use Text Fields for more details. Essentially, for JTextField, you could use a ActionListener and/or a FocusListener to monitor for changes to the field. This listeners will tend to be notified after the fact, that is, only once the user has finished editing fields. If you want real time feed back, you could use a DocumentListener which will notifiy each time the underlying Document of the field is modified, in real time. A JSpinner is a little more complicated as it's a component that contains an editor and controls. You can use a ChangeListener, which will notifiy when a change to the fields model is commited. This occurs in place of the ActionListener and FocusListener mentioned previously, so you should only require a single listener, but won't provide real time feedback (at least, not without a lot more work)

http://stackoverflow.com/q/24290477
type: Question
tagged with: mongodb
has body: I need to execute a multiple MySql Queries and Multiple MongoDB queries. If the execution of one of the queries fails (SQL or Mongo) I must rollback all the executed queries. Is that possible?
accepted answer: http://stackoverflow.com/a/24311897
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37535995
has answer: http://stackoverflow.com/a/24311897
has title: MongoDB and MySql Transaction
type: AnsweredQuestion
tagged with: transactions
has comment: http://stackoverflow.com/comment/37535322
tagged with: java
tagged with: mysql

http://stackoverflow.com/a/24346468
score: -1
accepted answer of: http://stackoverflow.com/q/24346310
type: AcceptedAnswer
has body: Disclaimer This is a pretty long winded, very basic tutorial on variable shadowing, scope and static fields. With the edits to your question it doesn't really apply as much as it seemed to originally. I started writing it though so figured I'd finish, maybe it will be of use to somebody or I'll find somewhere to migrate it to in the future... You don't need to declare mName in Class3 as it already inherits that field from its parent, Class2. However, if you want to be able to make changes to any Class2 and see the results in Class3 then you need to know about static variables, variable scope and variable shadowing Variable Shadowing If you declare another field in Class3 with the same name as one that the Parent class also has then it 'shadows' or 'hides' the original field as Java will use the first variable with the correct name that it finds. Consider a very simple base class like this: public class Parent { public int myVariable = 5; public void printMyVariable() { System.out.println(myVariable); } } Now lets define some children: public class ChildOne extends Parent { // nothing here } public class ChildTwo extends Parent { public void printMyVariable() { System.out.println(myVariable + 2); } } public class ChildThree extends Parent { public int myVariable = 10; } public class ChildFour extends Parent { public int myVariable = 99; public void printMyVariable() { int myVariable = 700; System.out.println(myVariable); } Now lets take a look at how all those different values get read by the JVM: public static void main (String[] args) { // make some objects: Parent parent = new Parent(); ChildOne childOne = new ChildOne(); ChildTwo childTwo = new ChildTwo(); ChildThree childThree = new ChildThree(); // print some values: parent.printMyVariable(); childOne.printMyVariable(); childTwo.printMyVariable(); childThree.printMyVariable(); childFour.printMyVariable() } This will print these values to your console: 5 // original parent class' base value 5 // does not try to …
type: Answer
answers question: http://stackoverflow.com/q/24346310
downvote count: 1
upvote count: 0

http://stackoverflow.com/q/24375351
has answer: http://stackoverflow.com/a/24386930
answer count: 1
tagged with: http://stackoverflow.com/tag/r
has body: I want to use java to perform multiple correlation using large datasets. I can't find any library which provides this. The closest I could find is located at [https://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/stat/correlation/SpearmansCorrelation.html][1] but this only does partial correlation an not multiple. I suppose I could use R to do this but my datasets are very large (trillions) and I would like to benefit from using Java's performance (threading, multicore, etc). Is there a library which does multiple correlation that anyone is aware of? It would be also be great if the library could perform stepwise multiple regression.
has title: how to use renjin inside java application for creating multiple correlations
type: UnansweredQuestion
tagged with: regression
type: Question
tagged with: math
tagged with: java
score: 0
tagged with: renjin

http://stackoverflow.com/comment/65866317
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24317068
has text: Dear Sir, you saved my day! Thank you very much for hinting out the "Distinct" KeyWord for method queries!
score: 0

http://stackoverflow.com/q/24363031
type: Question
score: 3
has answer: http://stackoverflow.com/a/24383352
has comment: http://stackoverflow.com/comment/37682376
has title: How to implement java production grade RabbitMQ consumer
has comment: http://stackoverflow.com/comment/37679167
has comment: http://stackoverflow.com/comment/37679359
has comment: http://stackoverflow.com/comment/37682213
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0
has body: I having a problem with the RabbitMQ Work Queue implementation. im current running it in Tomcat, and i have the following class constantly listerning to new task in the queue. But after a day or two, sudden it behaving strangely, where by the object DeliveryOK return by channel.queueDeclare(taskQueueName, isDurable, false, false, null); is always zero. (i print out this in the log below mentioning "Current poolSize"). But in Rabbit admin (./rabbitmqadmin list queues or the RabbitMq Admin portal) it always return a number greater than zero (say 1267 messages in the queue). And it will not reduce to zero until i restart the tomcat, the class below only able to detect that there are actually some messages in the queue. Initially i thought that this class was terminated somehow, but it is able to consume those messages that newly arrive. It will not consume those 1267 messages that is left hanging inside the queue. For example messages 1267 in the queue, will not be consume until i restart tomcat. From the code below, is it because buggy implementation or is there a better way to implement a queue consumer specifically for RabbitMQ? i have read a related stack post(Producer/Consumer threads using a Queue), but im not sure if it helps. Also, is it true that this consumer implementation below will not survive a RunTimeException? MqConsumer Class: @Service public class MqConsumer implements Runnable{ private static final Logger logger = LoggerFactory.getLogger(MqConsumer.class); private final int MAX_ALERT_THRESHOLD = 10000; @Autowired private AsynchSystemConnections asynchSystemConnections; public MqConsumer(){ } @PostConstruct private void init() { (new Thread(new MqConsumer(asynchSystemConnections))).start(); } public MqConsumer(AsynchSystemConnections asynchSystemConnections){ this.asynchSystemConnections = asynchSystemConnections; } @Override public void run() { logger.info("Execute Consumer instance..."); while (true) { // infinite loop until it die due server restar…
has comment: http://stackoverflow.com/comment/37681585
accepted answer: http://stackoverflow.com/a/24383352
has comment: http://stackoverflow.com/comment/37684709
has comment: http://stackoverflow.com/comment/37710177
has comment: http://stackoverflow.com/comment/37676376
tagged with: rabbitmq
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37710459
linked to: http://stackoverflow.com/q/2332537
upvote count: 3
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37679348
has comment: http://stackoverflow.com/comment/37672917

http://stackoverflow.com/q/24291744
tagged with: java
has answer: http://stackoverflow.com/a/24299052
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37537840
accepted answer: http://stackoverflow.com/a/24299052
has comment: http://stackoverflow.com/comment/37537951
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/24270226
has title: Make Swing operations immediate
has body: I have a method in Swing to hide and show some buttons, called setScreen(int stage), which will hide or not certain buttons depending on the stage parameter. I want to call the method, then wait a few seconds and then call it again, like in this code: ... //Here stage has been assigned to some value setScreen(stage); if (stage != STAGE_TWO) { sleep(WAIT_TIME * 1000); stage = WELCOME; setScreen(stage); } The code for setScreen(int stage) is something like this: void setScreen(int stage) { switch (stage) { case WELCOME: screen.infoLabel.setText("Welcome!"); screen.startButton.setVisible(true); break; case STAGE_TWO: screen.infoLabel.setText("We are in stage two!"); screen.startButton.setVisible(false); break; } screen.validate(); } Where screen is an instantiation of a class extending JFrame. The problem here is that the first setScreen(stage) is never displayed, since the thread goes to sleep before the changes have been commited. I have tried substituting the sleep for a while loop checking the time of the system, but the effect is the same. **EDIT: ** I have found in a recommended StackOverflow thread some information on Swing Timer that may be useful. I'll work with it and upload any useful advances I make.
tagged with: swing
type: Question
tagged with: time-wait

http://stackoverflow.com/q/24414146
has body: I'm struggling to figure out what the problem is. I'm working on a spring web application that also has a mobile application. The mobile app needs to talk to our server to refresh the web clients. I thought the easiest way to do this would be using a controller set up with a request mapping. The mobile app has it's own authentication system so access to the url needs to be open/anonymous. I've got the following set up: @Controller public class UpdateService { @Autowired private Config _appConfig; @Autowired private SubscriptionsHandler _subscriptionsHandler; @RequestMapping(value = "/events/update") @ResponseBody public String UpdateEventList(String token) throws SQLException { ExternalUpdateHandler updateHandler = new ExternalUpdateHandler(_appConfig, _subscriptionsHandler); updateHandler.MaybeUpdateBasedOn(token); return ""; } } In my security context I have tried both : and <intercept-url pattern="/login.jsp" access="IS_AUTHENTICATED_ANONYMOUSLY" /> <intercept-url pattern="/events/update" access="IS_AUTHENTICATED_ANONYMOUSLY" /> <intercept-url pattern="/**" access="ROLE_USER" /> .... If I try and curl the url it gives me a 404 Not found. In the logs when the server runs I get this message: 2014-06-25 17:23:40,693 [RMI TCP Connection(3)-127.0.0.1] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/events/update],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String ...UpdateService.UpdateEventList(java.lang.String) throws java.sql.SQLException Which would seem to indicate that the request mapping is working as expected. Before switching off security on that request I was getting the login form as a response to curling. So that seems to indicate the security switchoff worked aswell. I'm a bit out of ideas! Help would be appreciated. Cheers Update I'm using the following curl: curl -i http://localhost:8100/events/update The dispatcher-servlet.xml looks like this: <?xml versi…
has comment: http://stackoverflow.com/comment/37789651
has answer: http://stackoverflow.com/a/24430902
upvote count: 1
tagged with: spring
accepted answer: http://stackoverflow.com/a/24430902
has title: Providing anonymous access to request-mapping/controller in spring
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37799281
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37789559
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/37769356
tagged with: spring-security
answer count: 1
favorite count: 0

http://stackoverflow.com/a/24334170
has body: 1.Do you know on which particular line you receive the exception? On your receiving-end code, I see you try to get the JSON in 2 different ways: JSONObject dataObject = new JSONObject((String)graphObject.getProperty("data")); ... JSONObject fromObject = (JSONObject) graphObject.getProperty("from"); The first is the correct way to convert String to JSON, the second is not. Can you please try: JSONObject fromObject = new JSONObject((String)graphObject.getProperty("from")); Instead of: JSONObject fromObject = (JSONObject) graphObject.getProperty("from"); 2.Also on your sending-end code: I don't see anywhere where you would call: params.putString("from", "{...json stuff...}"); to actually put "from" anywhere. Maybe you forgot to include that?
has comment: http://stackoverflow.com/comment/37649806
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24331218
answers question: http://stackoverflow.com/q/24331218
type: Answer

http://stackoverflow.com/a/24304199
has comment: http://stackoverflow.com/comment/92608047
type: Answer
has comment: http://stackoverflow.com/comment/37560312
has comment: http://stackoverflow.com/comment/37560276
has body: If you have java 8, use stream's allMatch function (reference): ArrayList&lt;Integer&gt; col = ...; col.stream().allMatch(i -&gt; i&gt;0); //for example all integers bigger than zero
has comment: http://stackoverflow.com/comment/135191362
has comment: http://stackoverflow.com/comment/37563496
upvote count: 65
accepted answer of: http://stackoverflow.com/q/24304129
score: 65
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24304129

http://stackoverflow.com/a/24314459
has body: I see what I did. The program only reads the file if it doesn't exist! That was just me not paying attention to my code. Maybe, debugging it would be easier if I organize everything a little better, like this: import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import mario.simulator.MarioSimulator; /** * * @author Jaca */ public class filer { private static File f; private static BufferedReader br; private static BufferedWriter bw; private boolean docterlicense; private boolean driverlicense; private boolean policelicense; private boolean finishedschool; private boolean bullied; private boolean messedtubby; private boolean toadmode; private long candy; private long coin; private long spaghetti; private long cake; private long water; private long mushroom; private long bomb; private long gun; private int hunger; private long respawn; private long swag; private long awesome; public filer(){ f = new File("resource\\config\\save.sav"); if(!f.exists()){ //creates the file if it does not exist try { f.createNewFile(); filer.reset(); //loads default values to new file } catch (IOException ex) { Logger.getLogger(filer.class.getName()).log(Level.SEVERE, null, ex); } } this.read(); //reads the file } public void read(){ //reads the file, then passes variables to game thread try { br = new BufferedReader(new FileReader(f)); docterlicense = Boolean.parseBoolean(br.readLine()); policelicense = Boolean.parseBoolean(br.readLine()); finishedschool = Boolean.parseBoolean(br.readLine()); driverlicense = Boolean.parseBoolean(br.readLine()); bullied = Boolean.parseBoolean(br.readLine()); messedtubby = Boolean.parseBoolean(br.readLine()); toadmode = Boolean.parseBoolean(br.readLine()); candy = Long.parseLong(br.readLine()); coin = Long.parseLong(br.readLine()); spaghetti = Long.parseLong(br.readLine()); cake = …
score: 0
answers question: http://stackoverflow.com/q/24299286
type: Answer

http://stackoverflow.com/comment/37593577
type: AnswerComment
has text: @CasimiretHippolyte FYI `\h` is supported in Java 8 (the platform I was testing against) but not Java 7. :) [the doc](http://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html)
type: Comment
comment on: http://stackoverflow.com/a/24320737
score: 0

http://stackoverflow.com/q/24337852
has comment: http://stackoverflow.com/comment/37624876
has answer: http://stackoverflow.com/a/24342130
has title: Verify clicked buttons from multiple columns and display same println
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24342130
tagged with: java
type: Question
tagged with: verify
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37624401
score: 0
has comment: http://stackoverflow.com/comment/37631753
has comment: http://stackoverflow.com/comment/37624324
answer count: 1
tagged with: button
has body: When a button in Column A or B is clicked, it displays either "0" and "1". I'd like to verify that all buttons are clicked via the Submit button. If any button in either column is NOT clicked, then the println "Please click all buttons." should be displayed. if (id==R.id.Submit){ int counter=0; for(int i=0; i&lt;colA.length; i++ ){ if (((colA[i].getText()==("0"))) || ((colA[i].getText()==("1")))){ counter++; } } for(int i=0; i&lt;colB.length; i++ ){ if (((colB[i].getText()==("0"))) || ((colB[i].getText()==("1")))){ counter++; } } if((counter==colA.length) || (counter==colB.length)){ // All buttons have been clicked } else{ System.out.println("Please click all buttons."); } }
tagged with: click

http://stackoverflow.com/comment/37573499
comment on: http://stackoverflow.com/q/24311061
score: 0
has text: Both have uses, but the latter should be used a lot more frequently than the latter.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24417528
downvote count: 0
has comment: http://stackoverflow.com/comment/37776333
has comment: http://stackoverflow.com/comment/102551488
answers question: http://stackoverflow.com/q/24416480
has body: Getting an immutable Scala map is a little tricky because the conversions provided by the collections library return all return mutable ones, and you can't just use toMap because it needs an implicit argument that the Java compiler of course won't provide. A complete solution with that implicit argument looks like this: import scala.collection.JavaConverters$; import scala.collection.immutable.Map; public class Whatever { public &lt;K, V&gt; Map&lt;K, V&gt; convert(java.util.Map&lt;K, V&gt; m) { return JavaConverters$.MODULE$.mapAsScalaMapConverter(m).asScala().toMap( scala.Predef$.MODULE$.&lt;scala.Tuple2&lt;K, V&gt;&gt;conforms() ); } } Writing conversions in Java is a little cleaner with JavaConversions, but on the Scala side essentially everyone hopes that piece of crap will get deprecated as soon as possible, so I'd avoid it even here.
type: AcceptedAnswer
score: 15
has comment: http://stackoverflow.com/comment/37778520
has comment: http://stackoverflow.com/comment/102551405
has comment: http://stackoverflow.com/comment/102551743
upvote count: 15
has comment: http://stackoverflow.com/comment/57757636
has comment: http://stackoverflow.com/comment/102546255
type: Answer
has comment: http://stackoverflow.com/comment/62189678
has comment: http://stackoverflow.com/comment/37779311
has comment: http://stackoverflow.com/comment/37775177
accepted answer of: http://stackoverflow.com/q/24416480

http://stackoverflow.com/a/24394475
type: Answer
has comment: http://stackoverflow.com/comment/37733197
answers question: http://stackoverflow.com/q/24392815
score: 0
has body: You can try the Apache Commons Math library, specifically the BigFraction class. I think this will do what you want.
has comment: http://stackoverflow.com/comment/37734952

http://stackoverflow.com/comment/37722393
type: QuestionComment
type: Comment
has text: @VishaID I am making a simple app that sends strings over WiFi. Since I have several activities, once I go back to the main UI the connection is lost. From some research that I did it is highly recommended to use a singleton class that handles the socket and that can be accessed by all my activities. I hope this is more clear. Please excuse any mistakes or misconceptions, since I am very new to these concepts.
score: 0
comment on: http://stackoverflow.com/q/24389294

http://stackoverflow.com/comment/37568627
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24280604
has text: Its not a valid pattern, to have it behind a poll like that. It should be behind an inbound endpoint to map the uri to the correct resources. If your not doing that you should just use a standard java/spring component for processing the message.
type: QuestionComment

http://stackoverflow.com/q/24273694
has answer: http://stackoverflow.com/a/24280376
type: AnsweredQuestion
upvote count: 14
tagged with: java-8
type: Question
score: 14
tagged with: default-method
has body: In java 8 I have something like this: package test; public class SimpleFuncInterfaceTest { public static void carryOutWork(AFunctionalInterface sfi){ sfi.doWork(); } public static void main(String[] args) { carryOutWork(() -&gt; System.out.println("Do work in lambda exp impl...")); AImplementor implementsA = new AImplementor(); //carryOutWork(() -&gt; implementsA.doWork()); BImplementor implementsB = new BImplementor(); carryOutWork(() -&gt; implementsB.doWork()); } } @FunctionalInterface interface AFunctionalInterface { public void doWork(); default public void doSomeWork(){ System.out.println("FOO"); } } @FunctionalInterface interface BFunctionalInterface extends AFunctionalInterface { @Override default public void doSomeWork(){ System.out.println("BAR");//Unreachable in same object? } } class AImplementor implements AFunctionalInterface { @Override public void doWork() { doSomeWork(); } } class BImplementor extends AImplementor implements BFunctionalInterface { public void doSomeWork(){ super.doSomeWork(); new BFunctionalInterface(){ @Override public void doWork() { }}.doSomeWork(); System.out.println("WUK WUK"); } @Override public void doWork() { doSomeWork(); } } Is there a way to call the default functional interface behavior from implementsB without having to create an anonymous inner class and invoking that? That has a side effect (calling implementsA's method 2 times), what is desired is a call to the parent's implementation, and then have the childs implementation be able to call the child's default implementation, along with some specialization if needed. As you can see calling the parent's implementation is dead easy, but I don't see a way to avoid re-writing the default implementation unless I add a layer of indirection to the class that implements the child interface, and no way to enforce that. For instance if A unlocked or provided access to a resource say a database, and B unlocks a second resource (another database), I see no way to make code unloc…
tagged with: java
accepted answer: http://stackoverflow.com/a/24280376
has comment: http://stackoverflow.com/comment/37503587
has title: Can you call the parent interface's default method from an interface that subclasses that interface?
tagged with: functional-interface
linked to: http://stackoverflow.com/q/19976487
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/70109340
duplicate of: http://stackoverflow.com/q/19976487

http://stackoverflow.com/comment/37589350
comment on: http://stackoverflow.com/q/24319266
has text: why use Preferences.userRoot() if you could use the getSharedPreferences?
score: 0
type: Comment
type: QuestionComment

sonarqube
tags question: http://stackoverflow.com/q/24289291
tags question: http://stackoverflow.com/q/24312688
type: Tag
tags question: http://stackoverflow.com/q/24367789
tag name: sonarqube
tags question: http://stackoverflow.com/q/24362982
tags question: http://stackoverflow.com/q/24280389
tags question: http://stackoverflow.com/q/24398197
tags question: http://stackoverflow.com/q/24289704
tags question: http://stackoverflow.com/q/24300325
tags question: http://stackoverflow.com/q/24407368

http://stackoverflow.com/comment/37624350
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24337754
has text: @MadProgrammer Any examples? I am new to this.
score: 0

http://stackoverflow.com/comment/37675448
type: AnswerComment
comment on: http://stackoverflow.com/a/24355693
type: Comment
has text: @user3741964 check MadProgrammer's answer, that's the correct way.
score: 0

http://stackoverflow.com/a/24362615
upvote count: 2
type: Answer
has body: In your first and third example all threads use another object for synchronizing. First example: public class SynchronizedIncrement implements Runnable { private static int x = 0; private Object o = new Object(); // Each new SynchronizedIncrement will create its own new Object. public void run() { for (int i=0; i&lt;10000; ++i) synchronized(o) { // All threads can still interleave and access 'x'. ++x; } } } Third example: public synchronized void run() { // Now the threads synchronize again on its own object each: the thread itself! for (int i=0; i&lt;10000; ++i) ++x; } Only the second example is correctly synchronized because all threads use the same object for synchronizing.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24362284

semaphore
type: Tag
tags question: http://stackoverflow.com/q/24267635
tag name: semaphore

http://stackoverflow.com/comment/37544556
comment on: http://stackoverflow.com/a/24295485
type: Comment
has text: +1 for addressing array index out of bounds exception as well.
score: 0
type: AnswerComment

http://stackoverflow.com/a/24307550
type: AcceptedAnswer
type: Answer
score: 6
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24306932
answers question: http://stackoverflow.com/q/24306932
has body: "It works when I use the default layoutmanager, but when im trying to implement this with GridBagLayout it wont." GBL respects preferred sizes. Your ZeichenTest has none. You need to explicitly set it by overriding getPreferredSize(). (The default layout of JFrame which is BorderLayout doesn't respect preferred sizes, and will stretch you panel to fit) public class ZeichenTest extends JComponent { ... @Override public Dimension getPreferredSize() { return new Dimension( ... , ... ); } } Also note, after setting the preferred size of the component, just call pack() on the frame, instead of setSize(). The pack() will "fit" everything according to the preferred sizes. You can actually test that your component currently has no preferred size by calling pack() instead of setSize() and you will see the frame shrink on launching. But if you override the getPreferredSize() of the component and call pack, the frame will be size according the new preferred size. Other Important notes: Use java.swing.Timer instead of TimerTask. repaints should be done on the EDT and Swing Timer handles this for you. See more at How to Use Swing Timer I think you mean to repaint() the instance of ZeichenTest and not the frame. It makes a difference. Always call super.paintComponent in your paintComponent method, as to not leave nasty paint atrifacts @Override protected void paintComponent(Graphics g) { super.paintComponent(g); } Swing apps should always be run on the Event Dispatch Thread (EDT). See Initial Threads. Basically, in this case, just wrap the main code in a SwingUtilities.invokeLater(...) public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable(){ public void run() { FarbBalkenTest fbt = new FarbBalkenTest(); fbt.init(); } }); }
has comment: http://stackoverflow.com/comment/37607050
upvote count: 6

http://stackoverflow.com/a/24390347
has body: A common way to do this is to define a function for creating AA objects, which subclasses can override. This allows the subclass to create objects which are a subclass of AA if that's desired. public class A{ public void methodThatDoesStuff(){ AA aa = getAA(); // use aa } protected class AA{ //does most of the stuff here } // Function to create AA instances. Subclasses // can override this. protected AA getAA() { return new AA(); } } public class B extends A{ public class BB extends AA{ } @Override protected AA getAA() { return new BB(); } }
type: Answer
answers question: http://stackoverflow.com/q/24389077
score: 0

http://stackoverflow.com/comment/40833124
type: QuestionComment
comment on: http://stackoverflow.com/q/24314792
type: Comment
score: 0
has text: @KevinBrown - Please read the question. No one is asking for a recommendation on a tool. I have asked if anyone has found a workaround to this or similar issue. Perhaps, an Unix expert would just be knowing on top of his head.

http://stackoverflow.com/comment/37558319
type: Comment
comment on: http://stackoverflow.com/a/24282535
has text: @user3751867 I am afraid that you're iterating over the table values incorrectly, this code provides a working example of how to insert a value into the database. The part where you iterate over the table is another question, which shouldn't be discussed here.
type: AnswerComment
score: 0

http://stackoverflow.com/a/58542404
downvote count: 0
has body: for sbt, use below versions val glassfishEl = "org.glassfish" % "javax.el" % "3.0.1-b09" val hibernateValidator = "org.hibernate.validator" % "hibernate-validator" % "6.0.17.Final" val hibernateValidatorCdi = "org.hibernate.validator" % "hibernate-validator-cdi" % "6.0.17.Final"
upvote count: 2
answers question: http://stackoverflow.com/q/24386771
type: Answer
score: 2

http://stackoverflow.com/a/52199764
type: Answer
downvote count: 0
score: 1
has body: Well, as most of the people have answered: protected means - 'package-private + visibility to subclasses - the property/behaviour is INHERITED' static means - 'the opposite of instance - it is a CLASS property/behaviour, i.e it is NOT INHERITED' Therefore they are slightly contradictive and incompatible. However, recently I came up to a use case where it might make sense to use these two together. Imagine that you want to create an abstract class which is a parent for immutable types and it has a bunch of properties which are common to the subtypes. To implement immutability properly and keep readability one might decide to use the Builder pattern. package X; public abstract class AbstractType { protected Object field1; protected Object field2; ... protected Object fieldN; protected static abstract class BaseBuilder&lt;T extends BaseBuilder&lt;T&gt;&gt; { private Object field1; // = some default value here private Object field2; // = some default value here ... private Object fieldN; // = some default value here public T field1(Object value) { this.field1 = value; return self();} public T field2(Object value) { this.field2 = value; return self();} ... public T fieldN(Object value) { this.fieldN = value; return self();} protected abstract T self(); // should always return this; public abstract AbstractType build(); } private AbstractType(BaseBuilder&lt;?&gt; b) { this.field1 = b.field1; this.field2 = b.field2; ... this.fieldN = b.fieldN; } } And why protected static ? Because I want a non-abstract subtype of AbstactType which implements its own non-abstract Builder and is located outside package X to be able to access and reuse the BaseBuilder. package Y; public MyType1 extends AbstractType { private Object filedN1; public static class Builder extends AbstractType.BaseBuilder&lt;Builder&gt; { private Object fieldN1; // = some default value here public Builder fieldN1(Object value) { this.fieldN1 = value; return self();} @Override protected Builder self() { return thi…
answers question: http://stackoverflow.com/q/24289070
upvote count: 1

http://stackoverflow.com/a/24348159
has comment: http://stackoverflow.com/comment/37644710
has body: You can do something like below. First split the Sting using "\"" and then split the remaining ones using space" " . The even tokens will be the ones between quotes "". public static void main(String args[]) { String str = "hello bonjour \"good morning\" buongiorno"; System.out.println(str); String[] parts = str.split("\""); List&lt;String&gt; myList = new ArrayList&lt;String&gt;(); int i = 1; for(String partStr : parts) { if(i%2 == 0){ myList.add(partStr); } else { myList.addAll(Arrays.asList(partStr.trim().split(" "))); } i++; } System.out.println("MyList : " + myList); } and the output is hello bonjour "good morning" buongiorno MyList : [hello, bonjour, good morning, buongiorno]
has comment: http://stackoverflow.com/comment/37644290
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37644406
answers question: http://stackoverflow.com/q/24348098
accepted answer of: http://stackoverflow.com/q/24348098
type: Answer
has comment: http://stackoverflow.com/comment/37644317
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37644480

http://stackoverflow.com/comment/37640484
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24320132
has text: Also, how do I do a single timer in this case? I have an array of 20 bullets each with separate xcoord and ycoord, so everytime I press A, a bullet is fired and the timer is then started for that bullet.
score: 0

http://stackoverflow.com/comment/37578447
type: Comment
score: 2
comment on: http://stackoverflow.com/q/24313835
has text: What do mean be single regex? Isn't is a single regex? What is your expected output?
type: QuestionComment

http://stackoverflow.com/a/24313640
has comment: http://stackoverflow.com/comment/37578901
has comment: http://stackoverflow.com/comment/37578709
type: Answer
answers question: http://stackoverflow.com/q/24313063
has comment: http://stackoverflow.com/comment/37578233
has body: This XML file does not consist of a Well-formed XML file. (See en.wikipedia.org/wiki/Well-formed_document) One way to solve it: you can add a temporary root element to your XML file and parse it normally. XML parsers will always read XML files line by line (DOM or SAX). Another solution would be to separate your file into 2 XML files. Units.xml and Extras.xml!
has comment: http://stackoverflow.com/comment/37578293
has comment: http://stackoverflow.com/comment/37578570
has comment: http://stackoverflow.com/comment/37578496
has comment: http://stackoverflow.com/comment/37578361
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24313063

http://stackoverflow.com/a/24406014
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24405848
upvote count: 1
has body: Here for Hello World next will consider Hello (Only) as token and nextDouble takes World(This causes Exception) as input as both are separated by space.Use nextLine instead if you want to pass multiple words in second input. Because next method reads upto space. You can use hasNextDouble,hasNextInt or hasNext methods to check or Surround your code with try-catch. As you are mixing up nextInt() and nextLine() there will be issue in newLine character which wasn't read by nextInt. So i suggest you to do it like this. Product p = new Product(); p.setPid(s.nextInt()); s.nextLine();//to remove newLine character inconvinience Skip Line p.setName(s.nextLine()); p.setPrice(s.nextDouble());
downvote count: 0

http://stackoverflow.com/comment/37598252
score: 0
type: Comment
has text: So I would not be able to store the data, since I don't have a GAE application... Ok thanks for the explanation and the Google Cloud Datastore suggestion!
comment on: http://stackoverflow.com/a/24323970
type: AnswerComment

http://stackoverflow.com/q/24291857
favorite count: 0
has body: Use a modulus operator is something which all programmers must to know. I know it =). In java we have : int a = 100 , b = 50, c; If we do : c = a % b; // c = 0 because : 100 = 50*2 + 0 | D = d*q + r using simple maths However I felt a little frustrated for not finding the Why of this operation : c = b % a; // c = 50 ???? It seems not to have logic when a use D = d*q + r Can someone could explain me why 50 % 100 is 50 ??? I can't understand very well. Thanks
tagged with: modulus
accepted answer: http://stackoverflow.com/a/24291883
score: -3
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24292166
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/24292166
has answer: http://stackoverflow.com/a/24291883
answer count: 2
has title: Java modulus operator
upvote count: 0

http://stackoverflow.com/q/24331923
answer count: 6
has comment: http://stackoverflow.com/comment/37613373
favorite count: 0
has answer: http://stackoverflow.com/a/24332340
tagged with: extends
tagged with: hierarchy
has answer: http://stackoverflow.com/a/24332064
has answer: http://stackoverflow.com/a/24332049
tagged with: drawing
score: -1
has comment: http://stackoverflow.com/comment/37613255
has answer: http://stackoverflow.com/a/24332057
has title: Does "extends" also extend variables?
has body: I figured when you extend an object from another object, that object then receives all of the variables and the definition of those variables as well as that objects methods. So when I have code like this import javax.swing.*; import java.awt.*; public abstract class Object extends JComponent{ private int xpos; private int ypos; private int height; private int width; private double rotate; private Rectangle rect; public Object(int p1, int p2, int w, int h, double r){ this.xpos = p1; this.ypos = p2; this.width = w; this.height = h; this.rotate = r; rect = new Rectangle(xpos, ypos, width, height); } } as the original object, and then another object like this: import javax.swing.*; import java.awt.*; public class Block extends Object{ public Block(int p1, int p2, int p3, int p4, double r) { super(p1, p2, p3, p4, r); } public void paintComponent(Graphics g){ Graphics2D gd = (Graphics2D) g; gd.setColor(Color.BLUE); gd.draw(rect); } } Why isn't the rectangle "rect" being extended over? I am sorta new at java and still learning so please go easy on me XD
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37613101
downvote count: 1
has comment: http://stackoverflow.com/comment/37612989
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24332067
has comment: http://stackoverflow.com/comment/37612950
upvote count: 0
has answer: http://stackoverflow.com/a/24332081
has comment: http://stackoverflow.com/comment/37613053

http://stackoverflow.com/comment/37786223
score: 0
type: AnswerComment
has text: I think you can try with src/main/ in outputDirectory. AFAIK, the entire folder structure from source can be copied this way.
type: Comment
comment on: http://stackoverflow.com/a/24423392

http://stackoverflow.com/comment/37540737
has text: well that did not work i stripped out the https:// and still got a malformed url exception: java.net.MalformedURLException: Protocol not found: s3.amazonaws.com/knuser9/ae2f40a6-c563-4f9d-ade4-beb8d373ebc3.png
comment on: http://stackoverflow.com/a/24293486
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37640592
type: AnswerComment
has text: Very strange. I did a little experiment, and it seems like the ImageIO.read() method reads more bytes than strictly necessary to read the image. Fo example, if I write 10,000 bytes after the image, I can only read 7998 bytes after reading the image. I have no idea how to fix that except by knowing the size (N) of each image, read N bytes in a byte array, and reading the image from this byte array.
type: Comment
comment on: http://stackoverflow.com/a/24345930
score: 0

princexml
type: Tag
tags question: http://stackoverflow.com/q/24314792
tag name: princexml

http://stackoverflow.com/comment/37542792
has text: It only prints out the first occurrence
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24294638
type: Comment

http://stackoverflow.com/comment/37708472
type: Comment
comment on: http://stackoverflow.com/a/24380797
type: AnswerComment
has text: Thanks for your answer. I solved it by adding to androidmanifest the line `android:noHistory="true"`
score: 0

http://stackoverflow.com/comment/37615588
comment on: http://stackoverflow.com/q/24333075
has text: my first suggestion to you is to work on your logcat. Without it you are like a blind man trying to cross new york traffic
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/24291001
score: -4
upvote count: 1
has comment: http://stackoverflow.com/comment/43919282
has title: BufferedWriter not writing to my text file
type: Question
downvote count: 5
answer count: 2
has body: File outFile = new File("D:\\output.txt"); BufferedWriter wb = new BufferedWriter(new FileWriter(outFile)); while (resultSet.next()) { int attr_id = resultSet.getInt("int_id"); String stringValue = resultSet.getString("StringValue"); String name = resultSet.getString("Name"); int index = stringValue.indexOf("."); int valueLength = stringValue.length(); if(isNumeric(stringValue)) { //if(index != -2 ) { if(index != (valueLength - 2)) { String string1 = Double.valueOf(stringValue).toString(); System.out.println("converted values : " +string1); System.out.println("stringValue : " +stringValue); System.out.println("intValue : " +int_id); wb.write( stringValue + "," + int_id + "," + string1 ); wb.newLine(); } } } Above is my part of the code, from resultset i'm writing the data into a file. However the code is not printing values in output.txt file but i could see the result in console. if i remove the commented line and comment if(index != (valueLength - 2)) { this line, the java code is creating output.txt with values. What's wrong?
has answer: http://stackoverflow.com/a/24291075
linked to: http://stackoverflow.com/q/13426142
favorite count: 0
has comment: http://stackoverflow.com/comment/37535736
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24292939
has comment: http://stackoverflow.com/comment/37535742
tagged with: java

http://stackoverflow.com/a/24424546
score: 0
has comment: http://stackoverflow.com/comment/37789009
upvote count: 1
has comment: http://stackoverflow.com/comment/37788355
downvote count: 1
has comment: http://stackoverflow.com/comment/37788611
answers question: http://stackoverflow.com/q/24424481
type: Answer
has comment: http://stackoverflow.com/comment/37788079
has comment: http://stackoverflow.com/comment/37789649
has body: If you have installed Java Development Kit (JDK) you can find this Jar at the place. I seems you have installed only Java Runtime Environment (JRE) So if tools.jar is not there at the path C:\Program Files\Java\jre7\lib\, try placing it manually at the path.It should solve your problem.
has comment: http://stackoverflow.com/comment/37789055
has comment: http://stackoverflow.com/comment/37788431
has comment: http://stackoverflow.com/comment/37788166
has comment: http://stackoverflow.com/comment/37789125

http://stackoverflow.com/comment/37738539
has text: @user3772960 The workaround so that you don't have to nest POJOs is uglier and requires configuration of the `ObjectMapper` and a specific, hardcoded string for the `People` key. The ideal would be getting rid of the `People` altogether.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24397055
type: Comment

http://stackoverflow.com/q/24366161
has comment: http://stackoverflow.com/comment/37678676
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24381576
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/53100683
answer count: 2
downvote count: 0
tagged with: struts2
has title: How to use Struts 2 annotation with XML configuration together
has body: Recently I did try to configure [Struts 2 annotation] with [XML config] together, although the XML always overrides the annotations config. It is possible to use them together? Or no way?
favorite count: 0

http://stackoverflow.com/comment/37725188
comment on: http://stackoverflow.com/a/24390515
type: Comment
score: 0
type: AnswerComment
has text: Am using Java 7 ,but i will try your method.

http://stackoverflow.com/q/24314035
tagged with: zlib
score: 0
has comment: http://stackoverflow.com/comment/37589684
has comment: http://stackoverflow.com/comment/37598610
linked to: http://stackoverflow.com/q/81323
has body: I'm using the Deflater class to compress some String. I need to convert that ascii String to a hexadecimal String. How do I convert it back to ascii String so that I can decompress using Inflater to receive my original String? My problem is that the backwards conversion doesn't equal the original due to the encoding (?) or something. Test code: String compressed = Compressor.compress("stackoverflow.com"); System.out.println("Compressed ascii: " + compressed); String converted = Converter.asciiToHex(compressed); System.out.println("Compressed hex: " + converted); System.out.println("Compressed ascii: " + Converter.hexToAscii(converted)); Output: Compressed ascii: xœ+.ILÎÎ/K-JËÉ/×KÎÏ Compressed hex: 789c2b2e494ccece2f4b2d4acbc92fd74bcecf05003ff306f8 Compressed ascii: x?+.ILÎÎ/K-JËÉ/×KÎÏ Notice how the 2nd character is a ? instead of œ? Why is not converted properly? How can it be fixed? The "faulty" method: public static String hexToAscii(String hex) { StringBuilder output = new StringBuilder(); for (int i = 0; i &lt; hex.length(); i += 2) { String str = hex.substring(i, i + 2); output.append((char) Integer.parseInt(str, 16)); } return output.toString(); }
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37715909
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37673976
upvote count: 1
has title: Inflating Delfated Hex String
downvote count: 1
type: Question

http://stackoverflow.com/comment/37587788
score: 1
has text: You have posted _way_ too much code. Please read [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve) It'd also be handy to point to where you're getting this error.
comment on: http://stackoverflow.com/q/24318478
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24425336
favorite count: 0
linked to: http://stackoverflow.com/q/156503
possible better answer: http://stackoverflow.com/a/24425398
has comment: http://stackoverflow.com/comment/37789410
has comment: http://stackoverflow.com/comment/37789673
score: -3
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37789420
has comment: http://stackoverflow.com/comment/37789486
tagged with: java
has comment: http://stackoverflow.com/comment/37789574
has answer: http://stackoverflow.com/a/24425398
type: Question
has answer: http://stackoverflow.com/a/24425532
has comment: http://stackoverflow.com/comment/37789819
downvote count: 5
has title: NullPointerException in JUnit Test
upvote count: 2
has comment: http://stackoverflow.com/comment/37789333
answer count: 3
has answer: http://stackoverflow.com/a/24425700
accepted answer: http://stackoverflow.com/a/24425700
tagged with: junit
has body: I'm doing some tests for my app and when I send a null it catch NullPointerException. The method still contines but the test present an error. How can avoid it?. TestService.java Integer number = null; ServiceToTest service; try{ service.methodToTest(number); } catch(Exception e){ //Do some stuff } ServiceToTest.java public void methodToTest(Integer number){ if(number != null) //Do some stuff } I tried too if(number.equals(null)) but it also have the same exception

http://stackoverflow.com/a/24324793
answers question: http://stackoverflow.com/q/24324261
has body: Convert it to an array, wrap the array in a ByteArrayInputStream, wrap that in a DataInputStream, and use readInt().
score: 0
type: Answer

http://stackoverflow.com/q/24392803
has comment: http://stackoverflow.com/comment/37728897
tagged with: exception
has answer: http://stackoverflow.com/a/24393182
has comment: http://stackoverflow.com/comment/37729437
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24393140
tagged with: java
has comment: http://stackoverflow.com/comment/37728858
possible better answer: http://stackoverflow.com/a/24393012
has answer: http://stackoverflow.com/a/24393012
has comment: http://stackoverflow.com/comment/37728815
type: Question
has body: I am having trouble understanding exception handling, unfortunately it just really confuses me. So, I have to implement exception codes that have been created by my teacher in another code with try and catch blocks. I understand the majority of the try and catch blocks, but I don't know how to use the exceptions that have been created and print out the information in their constructors. This is one of the exceptions that she created * This exception should be used when the hours worked value for an hourly employee * is found to be less than 1 or greater than 84. * * When using this exception, if at all possible, pass a String containing employee SSN * to the constructor. The SSN will then be displayed as part of the exception message, * thus allowing the invalid record to be more easily located. */ public class InvalidHoursWorkedException extends Exception { /** * No-arg constructor */ public InvalidHoursWorkedException() { super("\nInvalid Hours Worked"); } /** * The following constructor accepts the employee's SSN * as an argument. The SSN will be displayed in the error message * for the exception. */ public InvalidHoursWorkedException(String ssn) { super("\nHours Worked are &lt;1.0 or &gt;84.0 Employee cannot be processed: " + ssn ); } } And this is what I have so far. I don't know if it's right nor do I know how to pass the ssn variable in the set method for InvalidHoursWorkedException. public class HourlyEmployee extends Employee /* * You will need to add a throws clause to the class header. * List each of the exceptions that may be thrown by the constructor */ { private double hrsWorked; private double hrlyRate; // private double weeklyPay; // hourly pay per week // five-argument constructor -- additional arguments are hours worked &amp; hourly rate public HourlyEmployee( String first, String last, String ssn, double hours, double rate ) throws InvalidHoursWorkedException { super( first, last, ssn ); // pass to Employee constructor /* * Before executing each "…
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24393140
has comment: http://stackoverflow.com/comment/37728967
has title: Throws and catch clauses

http://stackoverflow.com/q/24319577
tagged with: android
has comment: http://stackoverflow.com/comment/37591491
has body: I'm making my first app within eclipse, and I've been watching a YouTube playlist to help along the way (Link below). Currently I'm working on building buttons and linking pages to each other. The problem I'm running into is an R cannot be resolved to a variable error, for any code like the following. Atlantic = (Button) findViewById(R.id.Atlantic); or setContentView(R.layout.mainactivity); The quick fix wants to import android.R. When you do this, the ID kicks off this error "ID" cannot be resolved or is not a field. The odd thing is, sometimes I can just remove import android.R and it will work. However, it tends to come back after adding a picture or something to another screen (that has nothing to do with any Java code (yet) or any ID (yet)) BTW, I don't know if this helps. for the ID I use the "@+id/bla" trick.
has comment: http://stackoverflow.com/comment/37591085
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/24319628
has answer: http://stackoverflow.com/a/24319722
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24319722
tagged with: java
tagged with: eclipse
type: Question
has title: Don't need R, but getting R cannot be resolved to variable error
score: 0
has comment: http://stackoverflow.com/comment/37589964
answer count: 2
has answer: http://stackoverflow.com/a/24319628
has comment: http://stackoverflow.com/comment/37589875

http://stackoverflow.com/comment/37494233
has text: Is it really worth it to write a whole new function to save yourself one word in the view? Redirecting like this is considered bad practice, and furthermore the extra code needed to make this work will grow exponentially with your `Form`. Please don't do this.
type: Comment
comment on: http://stackoverflow.com/a/24269094
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37588169
type: Comment
comment on: http://stackoverflow.com/q/24318137
score: 0
has text: I've added all this in (counter, starting from 0), it all works! Thank you all so so much! Where can I credit these comments for the solution?
type: QuestionComment

http://stackoverflow.com/comment/37868988
score: 1
has text: doesn't give the correct path either. Excel uses a really strange way of pointing to files if you do not change the settings ti absolute paths...
type: AnswerComment
comment on: http://stackoverflow.com/a/24367577
type: Comment

http://stackoverflow.com/a/24413999
has comment: http://stackoverflow.com/comment/37772512
has body: Say you have your two Date values as time1 and time2. int daysApart = (int)((time2.getTime() - time1.getTime()) / (1000*60*60*24l)); if (abs(daysApart) &gt;= 10) System.out.println("10+ days apart."); else System.out.println("Less than 10 days apart.");
has comment: http://stackoverflow.com/comment/37770706
score: 6
has comment: http://stackoverflow.com/comment/37769596
has comment: http://stackoverflow.com/comment/37768431
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24413867
type: Answer
accepted answer of: http://stackoverflow.com/q/24413867
upvote count: 6
has comment: http://stackoverflow.com/comment/37768462

http://stackoverflow.com/comment/37739755
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24395752
has text: There are a couple answers that have figured out how to group the "similar" plants together (assuming that "similar" means they have the same camera, measurement, and replicate values). Now that similar plants have been gathered together, what's to be done with them? Append which values to which plant?
score: 0

http://stackoverflow.com/comment/37730325
has text: @NG: I don't know what parser the downstream customer will be using.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24393405
score: 0

http://stackoverflow.com/comment/37739241
has text: [A quick glance at the Javadoc](http://docs.oracle.com/javase/7/docs/api/java/io/DataInputStream.html#readLine()) suggests that you shouldn't be reading lines like this anyway. Use a `Scanner` or the new `Files` API instead from Java 7 to make this a ton simpler for you.
score: 2
comment on: http://stackoverflow.com/q/24398280
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37722604
type: QuestionComment
has text: Hint: You might want to add a `outgoing.close()` after closing your writer, since the socket isn't going to be used again.
score: 0
comment on: http://stackoverflow.com/q/24389491
type: Comment

http://stackoverflow.com/comment/37707472
has text: Can you show your ajax call code in test.html?
comment on: http://stackoverflow.com/q/24381486
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37539543
type: QuestionComment
has text: Thanks for your patience. I just posted the `index.htm` controller code.
comment on: http://stackoverflow.com/q/24292594
score: 0
type: Comment

http://stackoverflow.com/comment/37562785
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24305174
has text: It's ok, I don't need the answer. I was just asking you.
score: 0

http://stackoverflow.com/comment/37525974
type: QuestionComment
has text: I think, edges shouldn't be `HashMap`, but some kind of unmodifiable map.
score: 0
comment on: http://stackoverflow.com/q/24286065
type: Comment

http://stackoverflow.com/comment/37719728
type: AnswerComment
has text: This is probably [a hibernate bug](https://hibernate.atlassian.net/browse/HHH-5798). If you cannot redefine your column, you can try avoiding the bug. Are you using hibernate 3.6? Have you tried using explicit @DiscriminatorValue values for the concete classes? Have you tried switching to a later Hibernate version?
type: Comment
comment on: http://stackoverflow.com/a/24384226
score: 0

http://stackoverflow.com/a/24329523
has body: The compiler is correctly telling you that there is an execution path via which 'stmt' doesn't get initialized, namely if you get an exception opening the connection. But in any case as you're carefully closing both the statement and the connection in the static block, the entire exercise is completely pointless in the first place. I recommend a connection pool, and opening and closing connections as and when you actually need them. Much more robust than trying to keep a single connection open for the life of the process, and much kinder to the database than trying to tie up a single connection all day.
score: 1
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24329331

http://stackoverflow.com/a/24357673
score: 0
has body: Your method // I've removed the index parameter as it makes no sense public static int findHighestRate(double interestRate []) has a return type, int. As such, you have to make the method return a value. If it returns a value, you can assign the value to a variable or use it as an argument to another method. For example int index = findHighestRate(someDoubleArray); You can then use that variable's value to access an element in the array double highestRate = someDoubleArray[index]; You can then print out that value System.out.println(highestRate);
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/24357497
answers question: http://stackoverflow.com/q/24357497
has comment: http://stackoverflow.com/comment/37663134

http://stackoverflow.com/comment/37527754
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24286760
has text: Thank you so much @Morvader!!! Its the first time i excecuted... Where i want refer to improve my coding for this webdriver pls help me:)
type: AnswerComment

http://stackoverflow.com/a/24317947
answers question: http://stackoverflow.com/q/24317447
score: 1
upvote count: 1
downvote count: 0
type: Answer
has body: As @AlexandreSantos pointed out, you need to reinitialise the values of maxRolls and sum every time you restart the game. That is, these initialisations should be the first things executed in your do {} while () loop. do { int maxRolls = 7; int sum = 0; // ... } while (option); I'd also give you other recommendations: in Java, the class names, by convention, start with an upper-case letter. Thus, I'd name your class Game instead of game. The following code (and its equivalent with "no"): (userInputTwo.equals("Yes") || userInputTwo.equals("yes") || userInputTwo.equals("YES")) ... can be replaced by: userInputTwo.equalsIgnoreCase("yes") ... since, as you mentioned in your question, you're actually simply trying to ignore the case ;) You're doing all that asking the user whether is wants to restart or not in two places. You could (should) actually simply do it once, after having printed either "You won" or "You lost". I'd suggest to replace: if (sum &gt;= 43) { System.out.println("You Win"); System.out.print("Would You Like To Play Again . Yes or No?"); final String userInput = input.nextLine(); if (userInput.equals("Yes") || userInput.equals("yes") || userInput.equals("YES")) { // MISSING CODE TO RESTART THE PROGRAM option = true; } else if (userInput.equals("No") || userInput.equals("no") || userInput.equals("NO")) { System.exit(0); } } if (sum &lt; 43 || sum % 10 == 0) { System.out.println("You Lose"); System.out.print("Would You Like To Play Again . Yes or No?"); final String userInputTwo = input.nextLine(); if (userInputTwo.equals("Yes") || userInputTwo.equals("yes") || userInputTwo.equals("YES")) { option = true; // MISSING CODE TO RESTART THE PROGRAM } else if (userInputTwo.equals("No") || userInputTwo.equals("no") || userInputTwo.equals("NO")) { System.exit(0); } } ... by: if (sum &gt;= 43) { System.out.println("You Win"); } if (sum &lt; 43 || sum % 10 == 0) { System.out.println("You Lose"); } System.out.print("Would You Like To Play Again . Yes or No?"); final…

http://stackoverflow.com/comment/37648467
type: AnswerComment
comment on: http://stackoverflow.com/a/24340260
has text: I'd go with the solution that is easiest to get right and to maintain (StringEscapeUtils). If your application has performance problems you profile it to find the bottlenecks. If this part of the code happens to be critical you can start doing some micro benchmarking / try different implementation such as the replaceAll variant.
type: Comment
score: 1

http://stackoverflow.com/comment/38042849
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24387551
has text: Ah. That will be my fault for doing some refactoring to clean up the Tomcat 8 code. You need to look at the value of the state attribute. The class loader(s) you want will have a state of something other that STARTED.

http://stackoverflow.com/q/24334157
tagged with: system
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24334542
accepted answer: http://stackoverflow.com/a/24334542
has body: I'm in the process of writing a school project and I have one problem i can't solve. I have a tree that shows directories and file paths but I need to display only .mp3 and .wav files. Can someone give me some advice how to do that? I have a class with a tree model: public boolean isLeaf(Object node) { File file = (File) node; return file.isFile(); } public int getIndexOfChild(Object parent, Object child) { File directory = (File) parent; File file = (File) child; String[] children = directory.list(); for (int i = 0; i &lt; children.length; i++) { if (file.getName().equals(children[i])) { return i; } } return -1; } public void valueForPathChanged(TreePath path, Object value) { File oldFile = (File) path.getLastPathComponent(); String fileParentPath = oldFile.getParent(); String newFileName = (String) value; File targetFile = new File(fileParentPath, newFileName); oldFile.renameTo(targetFile); File parent = new File(fileParentPath); int[] changedChildrenIndices = { getIndexOfChild(parent, targetFile) }; Object[] changedChildren = { targetFile }; fireTreeNodesChanged(path.getParentPath(), changedChildrenIndices, changedChildren); } private void fireTreeNodesChanged(TreePath parentPath, int[] indices, Object[] children) { TreeModelEvent event = new TreeModelEvent(this, parentPath, indices, children); Iterator iterator = listeners.iterator(); TreeModelListener listener = null; while (iterator.hasNext()) { listener = (TreeModelListener) iterator.next(); listener.treeNodesChanged(event); } } public void addTreeModelListener(TreeModelListener listener) { listeners.add(listener); } public void removeTreeModelListener(TreeModelListener listener) { listeners.remove(listener); } private class TreeFile extends File { public TreeFile(File parent, String child) { super(parent, child); } public String toString() { return getName(); } } String getFileDetails(File file) { if (file == null) return ""; StringBuffer buffer = new StringBuffer(); buffer.append("Name: " + file.getName() +…
type: AnsweredQuestion
tagged with: java
tagged with: file
type: Question
tagged with: jtree
has title: JTree - file system viewer tree only with fixed file extensions

http://stackoverflow.com/a/24419512
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37779105
accepted answer of: http://stackoverflow.com/q/24419224
has comment: http://stackoverflow.com/comment/37779173
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24419224
type: Answer
has body: Looks like the second example doesn't refer to the Point class. For some odd reason, they apparently just changed the way that the class works, replacing the "Point" class (which is effectively just two integers anyway) with integers x and y To re-write the second class such that it actually works the same as the first, you'd write it as follows: public class Rectangle { private Point origin; private int width, height; public Rectangle() { this(new Point(0,0), 1, 1); } public Rectangle(int width, int height) { this(new Point(0,0), width, height); } //One more constructor just for fun public Rectangle(int x, int y, int width, int height) { this(new Point(x, y), width, height); } //Note: All of the constructors are calling this method via this(Point, int, int) public Rectangle(Point origin, int width, int height) { this.origin = origin; this.width = width; this.height = height; } ... }

http://stackoverflow.com/a/24379660
has body: Instead completely ordering the elements, you can fill a priority queue and extract its root twice: public static int[] minmax(File f) { int [] res = {-1,-1}; try { Scanner scan = new Scanner(f); scan.nextLine(); PriorityQueue&lt;Integer&gt; values = new PriorityQueue(10, new Comparator&lt;Integer&gt;() { @Override public int compare(Integer o1, Integer o2) { return o2.compareTo(o1); } }); while(scan.hasNextInt()) { int id = scan.nextInt(); if(!scan.hasNextInt()) continue; int val = scan.nextInt(); values.add(val); } scan.close(); res[0] = values.poll(); res[1] = values.poll(); } catch (FileNotFoundException ex) { Logger.getLogger(Test2.class.getName()).log(Level.SEVERE, null, ex); } return res; } The idea of this is to build a heap in O(n) but, as @bcorso has pointed, Java's PriorityQueue implementation does not provide that build time complexity.
has comment: http://stackoverflow.com/comment/37704841
type: Answer
answers question: http://stackoverflow.com/q/24379372
has comment: http://stackoverflow.com/comment/37704715
score: 0

http://stackoverflow.com/q/24400401
has body: I want to convert large PDF files to HTML with correct formatting even with image graphs. I tried with aspose, but its converting only 2 pages from 10 page PDF file. Please suggest me any good API in java to convert large PDF to HTML.
favorite count: 0
tagged with: java
score: -4
has answer: http://stackoverflow.com/a/24406773
has answer: http://stackoverflow.com/a/24403555
accepted answer: http://stackoverflow.com/a/24406773
type: Question
type: AnsweredQuestion
has title: PDF to Html Conversion using API in java
downvote count: 5
tagged with: aspose
answer count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/24403555
tagged with: pdf-to-html

http://stackoverflow.com/q/24405666
type: Question
has title: Sometime webdriver finds the element but sometime for the same xpath it gives nosuchelement exception
has answer: http://stackoverflow.com/a/24407349
score: 0
answer count: 3
has body: I created a test script in which i want to click a edit button and then close the window. Most of the time the code works as expected but some time for the same code i gets nosuchelement exception. I went through the similar questions asked in the forum but none of the solution worked for me. Below i am putting the java code along with the HTML Code in hope to find a solution. for(String newwindow : window.getWindowHandles()){ //swithching to the new pop up using window.switchTo().window(passing newwindow as argument) window.switchTo().window(newwindow);} //getting title of new window using getTitle() method System.out.println("NewWindow Title"+ window.getTitle()); window.findElement(By.xpath(".//*[@id='edit_resume_section3_open' and not(@disabled)]")).click(); window.manage().timeouts().implicitlyWait(40, TimeUnit.SECONDS); System.out.println(window.findElement(By.xpath("//input[@name='title']")).getAttribute("value")); window.manage().timeouts().implicitlyWait(40, TimeUnit.SECONDS); window.findElement(By.id("update")).click(); window.manage().timeouts().implicitlyWait(40, TimeUnit.SECONDS); window.close(); Html Code for the webelement- 1.6YR Experiance/BSC(CS) [Edit]
has answer: http://stackoverflow.com/a/24406096
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/43601628
tagged with: selenium-webdriver
tagged with: xpath
tagged with: java

http://stackoverflow.com/q/24339432
accepted answer: http://stackoverflow.com/a/24340139
tagged with: eclipse
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/24340139
downvote count: 0
has answer: http://stackoverflow.com/a/24339497
favorite count: 0
tagged with: google-app-engine
has body: i just wanted to clarify and know , how we can share codebase between project under Ear Project , following is my project layout I Have one EAR Project, which has two appengine dynamic web application project added to it, as app1 and app2 i have all of my model java class and service class in app1 , and now i dont wanted to rewrite or have duplicate of these files in app2 , i just wanted to use these classes in app1 from app2. Note: am not using maven, since there is a lot of issue with (maven + appengine + eclipse) and i dont want to complicate things. In short, two web application project with shared src folder or part of it, is it possbile? Any help is highly appreciated, Thanks!
type: AnsweredQuestion
has title: Share src folder between two Java Dynamic Web project under Ear Project Structure Eclipse
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/24339497
linked to: http://stackoverflow.com/q/10072835
type: Question

http://stackoverflow.com/a/24875006
type: AcceptedAnswer
upvote count: 2
has body: In a bolt, if you want to anchor a tuple that you're emitting, to a tuple that you have received, you have to first emit the anchored tuple, before emitting the ack for the received tuple. So you should do: Spout -&gt; Storm emit 1 Storm -&gt; Bolt deliver 1 Bolt -&gt; emit 2, anchored to 1 Bolt -&gt; ack 1
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24303313
answers question: http://stackoverflow.com/q/24303313

http://stackoverflow.com/q/24359320
type: Question
has title: Item disappear in an endless ListView
has comment: http://stackoverflow.com/comment/47400959
linked to: http://stackoverflow.com/q/5123407
tagged with: asynctaskloader
downvote count: 0
has body: I'm using an AsyncTaskLoader to load paginated data into an ArrayAdapter, but when I rotate the device, all of the previously fetched data will be cleared and the top of the list will now start at the last page that I fetched. private int mPageNumber; @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (mPageNumber &gt;= firstVisibleItem + visibleItemCount) { mPageNumber++; getLoaderManager().restartLoader(0, null, this); } } I don't really understand why this happens or the best way to handle it. Should I be caching the data, is that really necessary?
tagged with: listview
has comment: http://stackoverflow.com/comment/37666300
has comment: http://stackoverflow.com/comment/37666232
tagged with: android
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: android-arrayadapter
score: 1
tagged with: java

http://stackoverflow.com/comment/37506127
comment on: http://stackoverflow.com/q/24275377
type: QuestionComment
type: Comment
score: 1
has text: You should double check the content of your file, in binary if need be.

http://stackoverflow.com/a/24316029
downvote count: 0
type: Answer
has body: Please check out cTAKES, an open source project. They are doing the same thing what you want. You can use Finite State Machine for this purpose. Refer this guide, to set up this cTAKES project. Also refer this javaDoc for frequency unit of Drug.
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24300973

http://stackoverflow.com/q/24286729
has answer: http://stackoverflow.com/a/24289439
has comment: http://stackoverflow.com/comment/37530676
answer count: 2
accepted answer: http://stackoverflow.com/a/24290879
has body: I am trying to get a CSV from the report using this well-known plugin and the example from its documentation, but it throws an exception. I wonder why, because I just copied most of the code from the doc. My code is: import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.logging.Level; import org.eclipse.birt.core.exception.BirtException; import org.eclipse.birt.core.framework.Platform; import org.eclipse.birt.report.engine.api.EngineConfig; import org.eclipse.birt.report.engine.emitter.csv.CSVRenderOption; import org.eclipse.birt.report.engine.api.IReportEngine; import org.eclipse.birt.report.engine.api.IReportEngineFactory; import org.eclipse.birt.report.engine.api.IReportRunnable; import org.eclipse.birt.report.engine.api.IRunAndRenderTask; public class RunReport { static void runReport() throws FileNotFoundException, BirtException { String resourcePath = "C:\\Users\\hpsa\\workspace\\My Reports\\"; FileInputStream fs = new FileInputStream(resourcePath + "new_report_1.rptdesign"); IReportEngine engine = null; EngineConfig config = new EngineConfig(); config.setEngineHome("C:\\birtre\\birt-runtime-4_3_2\\"); config.setLogConfig("C:\\birtre\\", Level.FINE); config.setResourcePath(resourcePath); Platform.startup(config); IReportEngineFactory factory = (IReportEngineFactory) Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY); engine = factory.createReportEngine(config); engine.changeLogLevel(Level.FINE); IReportRunnable design = engine.openReportDesign(fs); IRunAndRenderTask task = engine.createRunAndRenderTask(design); CSVRenderOption csvOption = new CSVRenderOption(); String format = CSVRenderOption.OUTPUT_FORMAT_CSV; csvOption.setOutputFormat(format); csvOption.setOutputFileName("newBIRTcsv.csv"); csvOption.setShowDatatypeInSecondRow(true); csvOption.setExportTableByName("SecondTable"); csvOption.setDelimiter("\t"); csvOption.setReplaceDelimiterInsideTextWith("-"); task.setRenderOption(csvOption); task…
has title: BIRT csv emitter plugin error -
type: AnsweredQuestion
tagged with: birt
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/24290879
type: Question
tagged with: birt-emitter
possible better answer: http://stackoverflow.com/a/24289439

http://stackoverflow.com/q/24293005
score: 0
answer count: 3
has title: Try-Catch-Finally - Final Block not recognising variable
has body: firstly I know I should be using a try-catch with resources, however I don't currently have the most up to date JDK on my system. I have the following code below, and am trying to ensure the resource reader is closed using the finally block, however the code below doesn't compile for two reasons. Firstly is that reader may have not been initialized and secondly that close() should be caught within its own try-catch. Dont both of these reasons defeat the object of the initial try-catch block? I can solve the issue with the finally block close() statement by putting it in its own try-catch. However this still leaves the compile error about reader not being initialized? I'm presuming I have gone wrong somewhere? Help appreciated! Cheers, public Path [] getPaths() { // Create and initialise ArrayList for paths to be stored in when read // from file. ArrayList&lt;Path&gt; pathList = new ArrayList(); BufferedReader reader; try { // Create new buffered read to read lines from file reader = Files.newBufferedReader(importPathFile); String line = null; int i = 0; // for each line from the file, add to the array list while((line = reader.readLine()) != null) { pathList.add(0, Paths.get(line)); i++; } } catch(IOException e) { System.out.println("exception: " + e.getMessage()); } finally { reader.close(); } // Move contents from ArrayList into Path [] and return function. Path pathArray [] = new Path[(pathList.size())]; for(int i = 0; i &lt; pathList.size(); i++) { pathArray[i] = Paths.get(pathList.get(i).toString()); } return pathArray; }
accepted answer: http://stackoverflow.com/a/24293074
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24293051
has answer: http://stackoverflow.com/a/24293051
tagged with: java
tagged with: try-catch-finally
has answer: http://stackoverflow.com/a/78414993
type: Question
has answer: http://stackoverflow.com/a/24293074

http://stackoverflow.com/q/24340180
tagged with: android
has comment: http://stackoverflow.com/comment/37631504
has body: Im trying to make a floating activity and on click open up transparent canvas for drawing. This content is drawing but i want make it transparent . what i tried is: final DrawingView drawingView = (DrawingView) findViewById(R.id.drawing); My DrawingView Class: import java.util.ArrayList; import android.content.Context; import android.graphics.*; import android.graphics.Point; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.hardware.Camera.Size; import android.util.AttributeSet; import android.util.Log; import android.util.Pair; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; public class DrawingView extends View implements OnTouchListener { private Canvas m_Canvas; private Path m_Path; private Paint m_Paint; ArrayList&lt;Pair&lt;Path, Paint&gt;&gt; paths = new ArrayList&lt;Pair&lt;Path, Paint&gt;&gt;(); ArrayList&lt;Pair&lt;Path, Paint&gt;&gt; undonePaths = new ArrayList&lt;Pair&lt;Path, Paint&gt;&gt;(); private float mX, mY; private static final float TOUCH_TOLERANCE = 4; public static boolean isEraserActive = false; public DrawingView(Context context, AttributeSet attr) { super(context); setFocusable(true); setFocusableInTouchMode(true); this.setBackgroundColor(Color.TRANSPARENT); this.setOnTouchListener(this); onCanvasInitialization(); } public void onCanvasInitialization() { m_Paint = new Paint(); m_Paint.setAntiAlias(true); m_Paint.setDither(true); m_Paint.setColor(Color.parseColor("#000000")); m_Paint.setStyle(Paint.Style.STROKE); m_Paint.setStrokeJoin(Paint.Join.ROUND); m_Paint.setStrokeCap(Paint.Cap.ROUND); m_Paint.setStrokeWidth(30); m_Canvas = new Canvas(); m_Canvas.drawColor(Color.argb(0, 255, 255, 255)); m_Path = new Path(); Paint newPaint = new Paint(m_Paint); paths.add(new Pair&lt;Path, Paint&gt;(m_Path, newPaint)); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); } public boo…
answer count: 0
type: UnansweredQuestion
upvote count: 1
has title: Make canvas transparent on Android Linear Layout
linked to: http://stackoverflow.com/q/2176922
type: Question
tagged with: android-layout
has comment: http://stackoverflow.com/comment/37631231
tagged with: java
tagged with: canvas
has comment: http://stackoverflow.com/comment/37631369
downvote count: 0
has comment: http://stackoverflow.com/comment/37631159
score: 1
favorite count: 0
linked to: http://stackoverflow.com/q/8703581

http://stackoverflow.com/a/24338556
has body: Spring Data Elastic Search is mostly intended to inject your elasticsearch client dependency, which is then used to perform queries. Once you have the client object (after adding to appcontext.xml and autowiring) you then have a standard Java elasticsearch client object and can find examples here: http://www.elasticsearch.org/guide/en/elasticsearch/client/java-api/current/search.html
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24328698

http://stackoverflow.com/q/24371833
accepted answer: http://stackoverflow.com/a/24372643
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37694891
type: Question
tagged with: parameters
has comment: http://stackoverflow.com/comment/37692808
tagged with: java
has answer: http://stackoverflow.com/a/24372643
has title: Pass parameters to a Java Applet from Java Program
has body: I want to change the os.name property before invoking an applet. (Using appletviewer -J-Dos.name=Windows on Linux raises a lot of exceptions, understandably so) So, I figured I'll use System.setProperty() to set the os name in a Java Program (i.e. the JVM on starting will have the correct OS name, but the applet won't) and then invoke the applet from there (by calling it's init() function) The issue is I don't know how to pass the parameters to the applet (the ones I'd normally be using the param HTML tag for.)? Any ideas? I think it might be possible by implementing the AppletStub interface, but I'm not sure how to implement the other methods (apart from getParameter).
answer count: 1
tagged with: applet
score: 0

http://stackoverflow.com/a/24542289
type: AcceptedAnswer
has body: Mixing Restlet classes from the Spring extension with other one shouldn't be an issue. Spring* classes only provide additional configurability.
type: Answer
accepted answer of: http://stackoverflow.com/q/24360910
answers question: http://stackoverflow.com/q/24360910
has comment: http://stackoverflow.com/comment/38825247
score: 0

jpanel
tags question: http://stackoverflow.com/q/24311478
tags question: http://stackoverflow.com/q/24356343
tags question: http://stackoverflow.com/q/24327231
tags question: http://stackoverflow.com/q/24356570
type: Tag
tags question: http://stackoverflow.com/q/24276273
tags question: http://stackoverflow.com/q/24336113
tags question: http://stackoverflow.com/q/24276609
tags question: http://stackoverflow.com/q/24393637
tags question: http://stackoverflow.com/q/24295012
tags question: http://stackoverflow.com/q/24379923
tags question: http://stackoverflow.com/q/24355265
tags question: http://stackoverflow.com/q/24275063
tags question: http://stackoverflow.com/q/24314840
tags question: http://stackoverflow.com/q/24337754
tags question: http://stackoverflow.com/q/24397178
tag name: jpanel
tags question: http://stackoverflow.com/q/24318051
tags question: http://stackoverflow.com/q/24426197
tags question: http://stackoverflow.com/q/24406766
tags question: http://stackoverflow.com/q/24350194

http://stackoverflow.com/q/24381623
type: UnansweredQuestion
tagged with: solr
tagged with: jetty
has comment: http://stackoverflow.com/comment/39625177
upvote count: 1
tagged with: java
type: Question
downvote count: 0
has body: Solr is giving me java.lang.OutOfMemoryError: Java heap space when I am grouping and doing sorting on multiple fields. The query runs fine for a condition matching small no of documents. This is the query i am firing: q=*%3A*&amp;fq=DOCUMENT_TYPE%3APROPERTY&amp;fq=%7B%21tag%3DCITY_ID%7DCITY_ID%3A%282%29&amp;fq=%7B%21tag%3DLOCALITY_ID%7DLOCALITY_ID%3A%2850186%29&amp;fq=%7B%21tag%3DUNIT_TYPE%7DUNIT_TYPE%3A%28"Apartment"+OR+"Villa"%29&amp;rows=9999&amp;start=0&amp;sort=DISPLAY_ORDER+asc%2CPROJECT_PRIORITY+asc%2CPROJECT_ID+desc&amp;group=true&amp;group.ngroups=true&amp;group.limit=-1&amp;group.field=PROJECT_ID&amp;group.sort=BEDROOMS+asc%2CSIZE+asc Here is the resulting stacktrace. SEVERE: null:java.lang.RuntimeException: java.lang.OutOfMemoryError: Java heap space at org.apache.solr.servlet.SolrDispatchFilter.sendError(SolrDispatchFilter.java:469) at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:297) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1337) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:484) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:486) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149) at org.eclipse.jetty.server.handler.Handl…
tagged with: lucene
favorite count: 0
has title: java.lang.OutOfMemoryError for Solr Queries Including Grouping And Sorting
score: 1
has comment: http://stackoverflow.com/comment/39608901
answer count: 0
has comment: http://stackoverflow.com/comment/39650275

http://stackoverflow.com/comment/37683259
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24368492
type: Comment
has text: And that's where the value will be returned to: the caller/client of the method.

http://stackoverflow.com/q/24316804
has answer: http://stackoverflow.com/a/24327069
favorite count: 0
tagged with: fft
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/22768869
score: 3
upvote count: 3
tagged with: java
type: Question
tagged with: correctness
has answer: http://stackoverflow.com/a/24322189
has comment: http://stackoverflow.com/comment/37584663
tagged with: algorithm
has comment: http://stackoverflow.com/comment/37584690
tagged with: math
has title: Verifying correctness of FFT algorithm
answer count: 2
downvote count: 0
has body: Today I wrote an algorithm to compute the Fast Fourier Transform from a given array of points representing a discrete function. Now I'm trying to test it to see if it is working. I've tried about a dozen different input sets, and they seem to match up with examples I've found online. However, for my final test, I gave it the input of cos(i / 2), with i from 0 to 31, and I've gotten 3 different results based on which solver I use. My solution seems to be the least accurate: Does this indicate a problem with my algorithm, or is it simply a result of the relatively small data set? My code is below, in case it helps: /** * Slices the original array, starting with start, grabbing every stride elements. * For example, slice(A, 3, 4, 5) would return elements 3, 8, 13, and 18 from array A. * @param array The array to be sliced * @param start The starting index * @param newLength The length of the final array * @param stride The spacing between elements to be selected * @return A sliced copy of the input array */ public double[] slice(double[] array, int start, int newLength, int stride) { double[] newArray = new double[newLength]; int count = 0; for (int i = start; count &lt; newLength &amp;&amp; i &lt; array.length; i += stride) { newArray[count++] = array[i]; } return newArray; } /** * Calculates the fast fourier transform of the given function. The parameters are updated with the calculated values * To ignore all imaginary output, leave imaginary null * @param real An array representing the real part of a discrete-time function * @param imaginary An array representing the imaginary part of a discrete-time function * Pre: If imaginary is not null, the two arrays must be the same length, which must be a power of 2 */ public void fft(double[] real, double[] imaginary) throws IllegalArgumentException { if (real == null) { throw new NullPointerException("Real array cannot be null"); } int N = real.length; // Make sure the length is a power of 2 if ((Math.log(N) / Math.log(2))…

http://stackoverflow.com/comment/37761804
type: Comment
comment on: http://stackoverflow.com/a/24410339
has text: any ideas about the second question which I asked?
type: AnswerComment
score: 0

tcpclient
tags question: http://stackoverflow.com/q/24299600
tag name: tcpclient
type: Tag

http://stackoverflow.com/comment/37586741
type: QuestionComment
comment on: http://stackoverflow.com/q/24317957
has text: Not sure why this is getting down voted.
score: 0
type: Comment

http://stackoverflow.com/q/24395413
has comment: http://stackoverflow.com/comment/37735419
tagged with: java
score: -1
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/24396066
favorite count: 0
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/37734537
has comment: http://stackoverflow.com/comment/37734545
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37733869
has title: Android writes to file fine in emulator but not on actual phone
downvote count: 1
has body: I'm creating an app where you input the date, time, location to and from, and any notes you have to track your mileage. In my AddActivity.java, you input the information. A BufferedWriter then writes this information to a txt file. In my EditActivity.java (attached), the text should be automatically read from the file and then displayed to the user in an EditText. When I run it an an emulator, the text displays fine. When I run it on my phone after exporting it, the text "Could not retrieve" displays meaning that the BufferedReader in the try/catch block did not successfully run. What am I missing here? Thanks! package com.reese.mileagelog; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class EditActivity extends Activity implements View.OnClickListener { Button addBut; Button editBut; Button emailBut; EditText editText; String currentText; Button delete; public String current; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit); editText=(EditText)findViewById(R.id.edit1); delete = (Button)findViewById(R.id.delete); delete.setOnClickListener(this); editText.setText(getCurrentText()); Toast.makeText(getBaseContext(), getCurrentText(), Toast.LENGTH_LONG).show(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public void onClick(View v) { switch(v.getId()) { case R.id.delete: deleteText(); editText.setText(getCurrentText()); break; } } public void deleteText(){ BufferedWriter…

http://stackoverflow.com/comment/37676419
type: AnswerComment
comment on: http://stackoverflow.com/a/24364163
score: 0
type: Comment
has text: This will help if I know what kind of format is used by the number. But I still have to find what is it

http://stackoverflow.com/a/24311185
has comment: http://stackoverflow.com/comment/37578772
type: Answer
has body: YES! There is a single exception to this: You want to catch, do something, then re-throw. Maybe you have some resources you need to close before the exception goes up, or you want to inform the user something wrong has happened: FileResource fileResource = new FileResource("/some/path"); try { fileResource.open(); fileResource.dostuff(); //other logic } catch (Exception e){ fileResource.close(); throw e; } Hence, when an exception gets thrown, you can close your resources before the program exits. Always catch the most specific exception type you can. Also, catching all Exceptions is exceptionally bad in Python, because you can catch syntax exceptions and the like.
has comment: http://stackoverflow.com/comment/37574004
score: 2
has comment: http://stackoverflow.com/comment/37577624
has comment: http://stackoverflow.com/comment/37578718
accepted answer of: http://stackoverflow.com/q/24311061
has comment: http://stackoverflow.com/comment/37574512
answers question: http://stackoverflow.com/q/24311061
type: AcceptedAnswer
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/37766823
type: AnswerComment
score: 0
type: Comment
has text: I just ran it with 5 client threads and your task executor and all ran fine; received 2500 messages. Is your `MyImportService` thread-safe?
comment on: http://stackoverflow.com/a/24412050

http://stackoverflow.com/q/24292960
score: 1
tagged with: java
has body: I have a servlet based application running on tomcat(7.0.53), oracle jvm (1.7.x) and CentOS(6.5). There is a script that peridically "sainity checks" the application by issuing GET request to it (every 10sec). I am encountering the following issue: When under normal (moderate) load (~4k parallel connections), some of the sanity checks fail with connect timeout (approximately every 10th to 20th request fails). The connection timeout configured on the client is 120s. This is happning ONLY when connecting to 127.0.0.1 (loopback), connecting to &lt;IP&gt; of the real lan interface (eth0) does not have this issue*. So: curl &lt;args&gt; http://127.0.0.1:&lt;port&gt; fails, curl &lt;args&gt; http://1.2.3.4:&lt;port&gt; does not fail. Running tcpdump show that the server side does not send back SYN-ACK in the failed cases. Note: Out of curiosity, I disabled IPv6 support (net.ipv6.conf.all.disable_ipv6 = 1) and the issue dissapeared. Before, IPv6 is not used, but IPv6 for the loopback (lo) interface was initialized and the application was bound to all available interfaces (127.0.0.1, ::1 and &lt;IP&gt;). On the eth interface IPv6 was not initialized at all. What are the possilbe reasons for this kind of behaviour? Any ideas for furthure troubleshooting this issue?
downvote count: 0
has comment: http://stackoverflow.com/comment/37624759
favorite count: 0
tagged with: linux
has title: Intermittent failures connecting to 127.0.0.1, no failures when connecting to IP (eth0)
answer count: 0
tagged with: tcp
type: UnansweredQuestion
upvote count: 1
tagged with: ip
type: Question
tagged with: network-programming

http://stackoverflow.com/comment/37700234
comment on: http://stackoverflow.com/a/24376653
type: AnswerComment
score: 0
has text: "Store as int" gets into what I alluded to before when I said "depending on what you want to do". Perhaps I should have said "depending on everything you want to do" -- store them? are there millions of calculations, with CPU speed an issue? are there buckets and buckets of them in one structure? All of these things would go into deciding how you want to represent them. Good luck with it. As an aside, you might want to mark the earliest one of these answers that you feel answered your question; it's part of how SO works.
type: Comment

http://stackoverflow.com/q/24318267
type: Question
has body: The problem my application reads in jpegs and displays them on a jlabel (these are pictures of books) Everything works fine when used with the local version e.g. reading from the C drive, but once I try to do this over the internet problems occur that I have tried without success to correct Scenario Should the jpeg not be present at the end of the url I get the following error javax.imageio.IIOException: Can't get input stream from URL! In the version that reads from the local drive I detect if the file exist and overcome this problem however I have tried lots of the ideas posted and I simply can’t find out how to detect that the jpeg is absent! Please can some one help here are the two version of the code Read from local drive C private void showcover() { String stockPic; String partofISBN; String completeurl; jButton9.setVisible(true); stockPic = jTextField1.getText();// get the current isbn partofISBN = stockPic.substring(0, 7); // get first 7 numbers String picUrl; stockPic = stockPic + localNumber + ".jpg"; picUrl = partofISBN + "\\" + stockPic; completeurl = "C:\\Apicture\\" + picUrl; File pf = new File(completeurl); if (!pf.exists()) { jLabel9.setIcon(new ImageIcon("C:\\Apicture\\" + picUrl)); jLabel9.setIcon(new ImageIcon("C:\\Apicture\\nojpegs.jpg")); jLabel9.setText("NO Jpeg"); } jLabel9.setIcon(new ImageIcon(completeurl)); } Adaption to read from url URL url; url = new URL("http://ebid.s3.amazonaws.com/upload_big/9/1/1/1401018425-17770-385.jpg"); Image image = null; try { image = ImageIO.read(url); } catch (IOException ex) { Logger.getLogger(baseframe.class.getName()).log(Level.SEVERE, null, ex); } } catch (MalformedURLException ex) { Logger.getLogger(baseframe.class.getName()).log(Level.SEVERE, null, ex); }
linked to: http://stackoverflow.com/q/24317978
score: 0
has answer: http://stackoverflow.com/a/24318329
tagged with: url
has comment: http://stackoverflow.com/comment/37587474
has title: detecting missing jpegs over the internet
has answer: http://stackoverflow.com/a/24318315
answer count: 4
has comment: http://stackoverflow.com/comment/37587392
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24318539
has answer: http://stackoverflow.com/a/24318497
tagged with: java

http://stackoverflow.com/comment/37728163
type: Comment
score: 0
has text: Hello and thank you all for the impressively fast answers!! I will use the UUID solution. Just for the sake of learning something: Why would I not use finalize() method to take care of it? Is there a reason or is it just not Javaish to do so?
type: AnswerComment
comment on: http://stackoverflow.com/a/24392167

http://stackoverflow.com/comment/37766684
score: 0
comment on: http://stackoverflow.com/q/24412848
type: Comment
type: QuestionComment
has text: Remember its class isn't actually `Collection` its still an `ArrayList`

http://stackoverflow.com/a/24301812
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/24289858
has body: With &lt;security:intercept-url pattern="/" access="permitAll" /&gt; Only the URL matching / will have the permitAll access. So what you need is actually: &lt;security:intercept-url pattern="/protected/**" access="isFullyAuthenticated()" /&gt; &lt;security:intercept-url pattern="/**" access="permitAll" /&gt;
type: Answer
upvote count: 4

http://stackoverflow.com/comment/37550100
type: QuestionComment
type: Comment
has text: your javascript code is never called so nothing will be printed. You may simply wrap it in a function and call the function on some UI event.
comment on: http://stackoverflow.com/q/24298640
score: 0

http://stackoverflow.com/a/24304692
answers question: http://stackoverflow.com/q/24304631
type: Answer
upvote count: 0
downvote count: 1
score: -1
has comment: http://stackoverflow.com/comment/37561293
has body: Simply delete from hard disk where it previously belong and you are done. Now try to Import it from anther copy (external source).
has comment: http://stackoverflow.com/comment/37561357

http://stackoverflow.com/a/24303979
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24303656
answers question: http://stackoverflow.com/q/24303656
upvote count: 2
has body: Don't use setPreferredSize, the JViewport is using to information to decide how much space is required it needs, which the JScrollPane is then using to decide if it needs to show the scroll bars or not If you really, absolutely have to modify the viewable size of the table, can try using setPreferredScrollableViewportSize
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/24407196
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24406774
downvote count: 0
has body: You can create a dedicated class named "Mammal" which would have properties of fat content, name of mammal and protein content. Make a array of Mammals and loop over to find the max fat content and easily you would find the corresponding protein content or any other query. P.S.: You should have followed the object oriented paradigm. It's helpful.

http://stackoverflow.com/q/24269147
favorite count: 0
duplicate of: http://stackoverflow.com/q/8891284
tagged with: multicast
has comment: http://stackoverflow.com/comment/37494016
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/24269604
downvote count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/8891284
type: Question
has body: I would like to send the same message to a set of threads in a way that each thread gets all the messages that I am adding to the queue. It is like a broadcasting queue. Is there a data structure like that, preferably in Java?
tagged with: algorithm
has title: Is there a data structure similar to a queue that can do multicast to different threads?
tagged with: data-structures
has comment: http://stackoverflow.com/comment/37494062
has answer: http://stackoverflow.com/a/24269289
answer count: 3
has answer: http://stackoverflow.com/a/24278117
upvote count: 1

http://stackoverflow.com/q/24357956
type: Question
has answer: http://stackoverflow.com/a/24358104
tagged with: jstl
has body: I am asking after almost one day struggling with this simple problem. I have a personal web application which I've been developing on tomcat on my localhost (no problem) since I want to save memory on the server I've decided to deploy it on jetty in production use. And in this moment the problem came. I can not figure out the right configuration of things. My files are as follow: relevant part of pom.xml javax.servlet jstl 1.2 javax.servlet servlet-api 2.5 taglibs standard 1.1.2 web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> org.springframework.web.context.ContextLoaderListener contextConfigLocation /WEB-INF/applicationContext.xml, WEB-INF/hibernateContext.xml appServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation 1 appServlet /* and when render my jsp I obtain this <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> instead of recognize it as a taglib. Any help will be very appreciated. Thank you.
has comment: http://stackoverflow.com/comment/37664374
score: 0
answer count: 1
has title: Taglibs are not recognized when war deployed to jetty 8
has comment: http://stackoverflow.com/comment/37664318
type: UnansweredQuestion
tagged with: jetty
tagged with: maven
tagged with: taglib
tagged with: java

http://stackoverflow.com/comment/37679148
score: 0
type: Comment
type: QuestionComment
has text: In all versions of java this loop won't work
comment on: http://stackoverflow.com/q/24366439

http://stackoverflow.com/q/24303444
tagged with: graphics
has comment: http://stackoverflow.com/comment/37560671
has comment: http://stackoverflow.com/comment/37561407
has comment: http://stackoverflow.com/comment/37561074
has comment: http://stackoverflow.com/comment/37559825
tagged with: java
has comment: http://stackoverflow.com/comment/37561299
linked to: http://stackoverflow.com/q/2056221
score: 0
has comment: http://stackoverflow.com/comment/37560006
tagged with: directory
has comment: http://stackoverflow.com/comment/37560522
has comment: http://stackoverflow.com/comment/37560018
has comment: http://stackoverflow.com/comment/37560171
has body: I'm writing a slideshow which allows the pictures it shows to be deleted, edited or ignored as they are displayed. It's working fine except for when the directory it's been pointed to contains subfolders. In this case I would like the code to search through the subfolders and also display the images within them. At the moment subfolders are ignored and a null pointer exception is thrown, though images in the main directory are read and displayed. This is the relevant section of the code: String files; File folder = new File(path); //Loads folder File[] listOfFiles = folder.listFiles(); //assigns filenames to array for (int i = 0; i &lt; listOfFiles.length; i++) { //Some code here deals with graphics Random randomGenerator = new Random(); //Initiates random generator int randomInt = randomGenerator.nextInt(listOfFiles.length); //Limits max random to lenth of folder array files = listOfFiles[randomInt].getName(); //Chooses a filename based on random number final String fileID = "file:///" + path + "\\" + files; //creates path to display currentFile = path + "\\" + files; //Assigns filename to variable ready for deletion later } I need to treat these more as discrete images rather than just printing out a list of them. I've excluded from the code here the snippet which deals with painting to the screen (g.drawImage). If anybody suggests Apache Commons IO FileUtils, would you be kind enough to explain how I go about downloading, installing and then importing the correct libraries, as I've been having trouble achieving this (if it even works). I would prefer a solution which doesn't require non-standard libraries. I have read that it is do-able in Java 8 (which I'm using) but I've not been able to find any relevant examples. I apologise if this turns out to be a duplicate question, but I've been unable to find a similar example that quite matches these requirements. Most other examples seem content simply to list the files, rather than perform an action with them. Many t…
has title: How to display pictures from all subdirectories within a parent directory? (Java & Netbeans)
tagged with: netbeans
has comment: http://stackoverflow.com/comment/37561037
answer count: 0
has comment: http://stackoverflow.com/comment/37560321
type: UnansweredQuestion
tagged with: file
has comment: http://stackoverflow.com/comment/37560536
has comment: http://stackoverflow.com/comment/37559054
type: Question

m2e
type: Tag
tag name: m2e
tags question: http://stackoverflow.com/q/24346893

http://stackoverflow.com/comment/37525938
comment on: http://stackoverflow.com/a/24282142
has text: I don't know what went wrong, but somehow the problem is still there. I deleted the "standalone" attribute, didn't work. So I tried deleting the "standalone" attributes in ALL the XML files from my docx, still didn't work. I did some tests, and the loading/processing part works fine, I think the corruption happens when the save method is called... Any thoughts on the matter ?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37622595
type: Comment
score: 1
has text: I'm not sure what you're trying to do, but taking over the user's mouse is usually a very bad UI experience.
type: QuestionComment
comment on: http://stackoverflow.com/q/24336694

http://stackoverflow.com/comment/37652828
has text: I.e. I don't want to delay a long network action just because the phone is rotated....
comment on: http://stackoverflow.com/q/24312016
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/50564765
score: 41
answers question: http://stackoverflow.com/q/24322776
has comment: http://stackoverflow.com/comment/97369846
has body: If we are parsing all model classes of server in GSON format then this is a best way to convert java object to JSONObject.In below code SampleObject is a java object which gets converted to the JSONObject. SampleObject mSampleObject = new SampleObject(); String jsonInString = new Gson().toJson(mSampleObject); JSONObject mJSONObject = new JSONObject(jsonInString);
downvote count: 1
type: Answer
upvote count: 42

http://stackoverflow.com/a/24337320
score: 1
accepted answer of: http://stackoverflow.com/q/24337280
answers question: http://stackoverflow.com/q/24337280
type: Answer
has body: problem: String first = keyboard.nextLine(); The problem is that it will consume the new Line "\n" of your keyboard.next(); that was entered by the user thus skipping the it. solution: use next() instead. or after you call next() call nextLine() to consumed the "\n" sample: System.out.println("Would you like to add more materials? (yes / no) :: "); String response = keyboard.next(); keyboard.nextLine();
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24414045
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37769263
favorite count: 0
tagged with: android-asynctask
accepted answer: http://stackoverflow.com/a/24414994
tagged with: android
has answer: http://stackoverflow.com/a/35621303
has body: I have some tasks that I need to process concurrently on Android and I would like to use some sort of a thread pool to do so. I couldn't find in the documentation what actually happens "behind the scenes" when executing an AsyncTask with AsyncTask.THREAD_POOL_EXECUTOR. My question is: What do I lose by using AsyncTasks with AsyncTask.THREAD_POOL_EXECUTOR as opposed to implementing a custom ThreadPool with Runnables? (Let's talk post-honeycomb). I realize the question is rather general, but I'm fairly new to doing concurrent programming (besides AsyncTask itself). I'm not looking for a tutorial on concurrent programming! I only seek to understand how the Android specific AsyncTask.THREAD_POOL_EXECUTOR is different. I think an explanation would be helpful for others in the future as they weigh the pros and cons of choosing to use AsyncTask vs Thread/Runnable. Thanks in advance!
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24414994
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37776177
upvote count: 7
type: Question
tagged with: threadpool
score: 7
linked to: http://stackoverflow.com/q/4068984
possible better answer: http://stackoverflow.com/a/35621303
has title: Android AsyncTask.THREAD_POOL_EXECUTOR vs custom ThreadPool with Runnables

http://stackoverflow.com/comment/37724033
type: QuestionComment
comment on: http://stackoverflow.com/q/24389913
score: 0
type: Comment
has text: @Tyler Heiks Like the Java selection inside Control Panel? Not seeing where I could find this information in there...

http://stackoverflow.com/comment/47806215
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/28942107
has text: An exe created this way would work independently, right? ie when not in the same folder as the jre
score: 0

http://stackoverflow.com/comment/37556295
comment on: http://stackoverflow.com/q/24298925
score: 0
type: Comment
has text: As I mentioned, unless the sites uses jquery, there is no point using jquery. Try to get something using plain javascript instead of jquery way
type: QuestionComment

http://stackoverflow.com/comment/37654264
type: Comment
type: QuestionComment
has text: I know... but why shouldn't there be? Why is it designed that way?
score: 0
comment on: http://stackoverflow.com/q/24353157

http://stackoverflow.com/a/24281116
score: 1
has comment: http://stackoverflow.com/comment/37525788
has comment: http://stackoverflow.com/comment/37518334
has comment: http://stackoverflow.com/comment/37524785
has body: You can take a look at this question: How to setup classpath in Netbeans? It is shown how to add a JAR to Netbeans' classpath UPDATE In case you were creating a Maven Project, you don't need to add the JARs manually to it. Instead, you should add the needed dependencies to your POM file. Check the "Installation / Maven dependencies" section of the tutorial you are following.
has comment: http://stackoverflow.com/comment/37517022
has comment: http://stackoverflow.com/comment/37525015
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37529409
has comment: http://stackoverflow.com/comment/37525976
has comment: http://stackoverflow.com/comment/37530423
type: Answer
accepted answer of: http://stackoverflow.com/q/24280958
answers question: http://stackoverflow.com/q/24280958
downvote count: 0

http://stackoverflow.com/comment/37680762
comment on: http://stackoverflow.com/q/24367313
score: 0
type: Comment
type: QuestionComment
has text: For a normal lock, yes. I agree with this way of doing this.

http://stackoverflow.com/q/24298690
upvote count: 1
has answer: http://stackoverflow.com/a/24298965
favorite count: 0
has answer: http://stackoverflow.com/a/24299129
has body: I am trying to simply send an event from my app to Google Analytics. - I have an account with my UA- ID. - Google Play Services Revision 17 is installed and all configuration done. I searched in Google for samples how to do this and found a lot of samples, but none of them worked for me. I get syntax errors not runtime errors. I also do not know which version of Google Analytics (v4?) I have installed, because this would be relevant for the samples I find in the net. Questions: - How do I find out which version is installed ? - Is there any simple sample to only send an event. I my code here I started so far: private static final String PROPERTY_ID = "UA-XXXXXXXX-1"; private Tracker googleanalyticstracker; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); googleanalyticstracker = GoogleAnalytics.getInstance(this).newTracker(PROPERTY_ID);
accepted answer: http://stackoverflow.com/a/24299129
possible better answer: http://stackoverflow.com/a/24298965
tagged with: android
tagged with: google-analytics-api
type: AnsweredQuestion
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/24299233
tagged with: java
type: Question
has title: simple sample for google analytics eventtracker in android
answer count: 3

http://stackoverflow.com/q/24401621
linked to: http://stackoverflow.com/q/12936473
type: Question
has title: Java's System.exit(0); vs C++ return 0;
has body: When we learn C++ in school, our professor will tell us to write return 0; at the last line of codes in the main function and it is considered as a good programming practice. In Java, I realise some people writes System.exit(0); at the last line of the main method. However, in C++, if I use exit(0); I get penalized by my professor, because (in school) for procedural programming, we are expected to let the program flow till the end of main and let the program stop naturally. My question: Is Java's System.exit(0); similar to C++'s return 0; ? (Or is it similar to C++'s exit(0)) Is it bad practice to use System.exit(0) in java when it is unnecessary (I.e.: writing it in last line of main method)?
has comment: http://stackoverflow.com/comment/37745552
has comment: http://stackoverflow.com/comment/52208962
linked to: http://stackoverflow.com/q/3715967
score: 18
upvote count: 18
has comment: http://stackoverflow.com/comment/37745535
downvote count: 0
has comment: http://stackoverflow.com/comment/37745583
has comment: http://stackoverflow.com/comment/37745533
favorite count: 0
has comment: http://stackoverflow.com/comment/37745509
tagged with: return
has answer: http://stackoverflow.com/a/24401735
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37745511
tagged with: c++
tagged with: exit
has answer: http://stackoverflow.com/a/24402197
tagged with: java
has answer: http://stackoverflow.com/a/24401678
has answer: http://stackoverflow.com/a/24401734
has answer: http://stackoverflow.com/a/24402619

http://stackoverflow.com/comment/37767878
type: AnswerComment
score: 0
type: Comment
has text: +1 Some IDEs can suggest only refactoring when the scope of the variable would change. They can also detect and refactor when a variable is needlessly reused.
comment on: http://stackoverflow.com/a/24413602

http://stackoverflow.com/comment/37654076
type: QuestionComment
has text: you should post up some of codes that you have done
score: 0
comment on: http://stackoverflow.com/q/24353217
type: Comment

http://stackoverflow.com/q/24319526
has comment: http://stackoverflow.com/comment/37591398
tagged with: firefox
tagged with: javascript
has body: How do I click on the "Apply Now" button as seen on the site and code below? I have tried the standard findElement, hovering over using Selenium Actions, even executing javscript, but no luck. Any ideas? Thanks! http://www.indeed.com/viewjob?jk=fd5fae9c8825702b&q=java&l=San+Francisco+Bay+Area%2C+CA&tk=18qk10l871d2i1hp&from=web <span style="padding: 0px ! important; margin: 0px ! important; text-indent: 0px ! important; vertical-align: top ! important; position: relative; display: inline-block;" class="indeed-apply-widget indeed-apply-button-container indeed-apply-status-not-applied" data-indeed-apply-apitoken="2e4c33bed2e10444a2f575136a9476c58b8b1291a9cbd0824694fa89ac09d381" data-indeed-apply-jobid="fd5fae9c8825702b" data-indeed-apply-joblocation="San Francisco, CA" data-indeed-apply-jobcompanyname="Supercool School" data-indeed-apply-jobtitle="Supercool Designer Wanted" data-indeed-apply-joburl="http://www.indeed.com/job/Supercool-Designer-at-Supercool-School-in-San-Francisco,-CA-fd5fae9c8825702b" data-indeed-apply-name="" data-indeed-apply-onapplied="indeed_apply_callback" data-indeed-apply-onclick="indeed_apply_onclick" data-indeed-apply-jk="fd5fae9c8825702b" data-indeed-apply-jobmeta="viewjob-bottom" data-indeed-apply-email="781601ccad3e06e0a9aa90626fe8d4a1c0eb314dffe73765b4f252173c92cc2c" data-indeed-apply-locale="en_US">Apply Now
has comment: http://stackoverflow.com/comment/37589760
type: Question
tagged with: css
score: 0
tagged with: selenium
answer count: 1
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37591969
has answer: http://stackoverflow.com/a/24319784
has title: How do I click the Apply Now button on Indeed with Selenium?

http://stackoverflow.com/comment/37674113
type: Comment
has text: @sarath: No, you shouldn't just tack on extra (and incomplete!) questions as comments on a different question. Ask a new question, but ask a *good* one this time. Read the hints I linked to earlier.
comment on: http://stackoverflow.com/a/24362394
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37517550
type: Comment
has text: @muffin Yes, `Properties` implementation is kind of `Map<Object, Object>`, so it can be problem in UI population. I've updated the answer and try it with and let me know the result.
comment on: http://stackoverflow.com/a/24280602
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37691015
type: QuestionComment
has text: Aren't values of `rows` and `n_threads` known beforehand (before you start submitting tasks)?
score: 0
comment on: http://stackoverflow.com/q/24372178
type: Comment

http://stackoverflow.com/q/24411541
has comment: http://stackoverflow.com/comment/37768230
score: 0
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/24411640
has body: Morning everyone, I have a question in regards to JSF navigation and using for navigation. My navigation was working fine until I put a three .xhtml files into subfolders. I have Home.xhtml, A.xhtml, B.xhtml, and C.xhtml all in the same folder. Upon putting A,B,and C.xhtml into subfolders A,B, and C, and then navigating from Home.xhtml, to A.xhtml, then to B.xhtml, I get this error: "/A/B/B.xhtml Not Found in ExternalContext as a Resource". Obviously the pages are stacking in the URL, but I'm not sure why. My Bean: @ManagedBean(name="company") @SessionScoped public class CompanyBean implements Serializable { private static Map&lt;String, Object&gt; companyValue; public String value; boolean temp; public static Map&lt;String, Object&gt; getCompanyValues() { return companyValue; } public boolean getTemp() { if (Env.isProd()==true) { return true; } return false; } public void setTemp() { temp=Env.isProd(); } public static void setCompanyValues(Map&lt;String, Object&gt; companyValues) { CompanyBean.companyValue = companyValues; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public CompanyBean() { companyValue=new LinkedHashMap&lt;String, Object&gt;(); companyValue.put("Select Company", "choose"); companyValue.put("AE", "AE/AE.xhtml"); companyValue.put("BP", "BP/BP.xhtml"); companyValue.put("CBK", "CBK/CBK.xhtml"); } public Map&lt;String,Object&gt; getCompanyValue() { return companyValue; } public void navigate(ValueChangeEvent event) { String page= event.getNewValue().toString(); try { FacesContext.getCurrentInstance().getExternalContext().redirect(page); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } My jsf code: &lt;h:form&gt; &lt;h:selectOneMenu value="#{company.value}" valueChangeListener="#{company.navigate}" onchange="this.form.submit()"&gt; &lt;f:selectItems value="#{company.companyValue}" /&gt; &lt;/h:selectOneMenu&gt; &lt;/h:form&gt; Sorry if this has been answered…
has title: JSF Navigation using h:SelectOneMenu
has comment: http://stackoverflow.com/comment/37772374
tagged with: http://stackoverflow.com/tag/xhtml
tagged with: navigation
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37763889
type: Question
has answer: http://stackoverflow.com/a/24411640
tagged with: jsf

http://stackoverflow.com/q/24286752
has answer: http://stackoverflow.com/a/24287128
favorite count: 0
score: 0
has answer: http://stackoverflow.com/a/24287116
answer count: 3
has title: Selenium using Java.io FileUtils.copyFile to dynamic destination file name
tagged with: selenium-webdriver
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24287243
tagged with: selenium
upvote count: 1
downvote count: 1
tagged with: java
type: Question
has body: take an screenshot and copy that file in my local folder using java io (Webdriver with Java) File screenshot = ((TakesScreenshot) driver) .getScreenshotAs(OutputType.FILE); FileUtils.copyFile(screenshot, new File("d:\\pic\\report.jpg")); i call this method more than one time, so in this situation i dont want to repeat the file name as "report.jpg" so please provide an suggestion how can i change that file name dynamically like report1 report2 etc.,

http://stackoverflow.com/comment/37647280
score: 1
has text: @ TomTomTom: Can you give a few examples? My experience of using Java software doesn't match with your statement that "many" programs require you to download a version specific to your OS. Normally there's just one, or two (one for everyone but Windows, one for Windows), which is usually about the installer.
comment on: http://stackoverflow.com/q/24349726
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24490510
type: Answer
accepted answer of: http://stackoverflow.com/q/24364435
score: 0
has body: It appears the main problem was with specifying search base argument in DefaultLdapAuthoritiesPopulator. Changing value to "" in DefaultLdapAuthoritiesPopulator bean solved the problem and started returning user's authorities. uid={0},ou=Employees uid={0},ou=Clients
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24364435

http://stackoverflow.com/comment/37711205
score: 0
has text: it works fine no error is there
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24382915

http://stackoverflow.com/a/24276335
score: 0
type: AcceptedAnswer
type: Answer
has body: There are a few issues with this code. I have made a revised version of it, with comments to help you understand why it would not work. public class Main { //There is no reason to use public, final, or static on this int variable int a = 10; public static void main(String[] args) { //Cannot print a, as main is a static method and a is out of it's scope //System.out.println(a); //Creates new "Main" object, calls hai method Main m = new Main(); m.hai(); } public void hai() { int b = 1; System.out.println(b); } } When we create the "Main" object, we are creating an instance of this class. An instance is simply an Object created from a class. In this example that object is Main. Once this instance is created, we are able to call all of the methods located inside Main, (including the 'hai' method) Also, ensure your Main class surrounds all of your methods. Your class contains all of the methods needed to perform your file's functions. You will not have two classes inside one file, nor will you write much outside of the class declaration, (excluding imports, etc).
accepted answer of: http://stackoverflow.com/q/24276184
answers question: http://stackoverflow.com/q/24276184

http://stackoverflow.com/q/24326856
has answer: http://stackoverflow.com/a/24330584
type: UnansweredQuestion
tagged with: android
has body: I have installed a few apps on my android device, and I developed a code to create a shortcut for them, they all work apart from one app, but if I manually drag the app on homescreen it works, I'm really confused... the next code is what I used to create the shortcuts try { //Log.i("shortcut method in androidhelper start","in the shortcutapp on create method "); boolean flag =false ; int app_id=-1; PackageManager p = getPackageManager(); Intent i = new Intent(Intent.ACTION_MAIN); i.addCategory(Intent.CATEGORY_LAUNCHER); List&lt;ResolveInfo&gt; res =p.queryIntentActivities( i,0); //System.out.println("the res size is: "+res.size()); for(int k=0;k&lt;res.size();k++) { //Log.i("","the application name is: "+res.get(k).activityInfo.loadLabel(p)); if(res.get(k).activityInfo.loadLabel(p).toString().equals("Kortext")){ flag = true; app_id = k; break; } } if(flag) { ActivityInfo ai = res.get(app_id).activityInfo; Intent shortcutIntent = new Intent(); shortcutIntent.setClassName(ai.packageName, ai.name); shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); shortcutIntent.addCategory(Intent.ACTION_PICK_ACTIVITY); Intent intent = new Intent(); intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); // Sets the custom shortcut's title intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "Kortext"); BitmapDrawable bd=(BitmapDrawable)(res.get(app_id).activityInfo.loadIcon(p).getCurrent()); Bitmap newbit; newbit=bd.getBitmap(); intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, newbit); intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT"); sendBroadcast(intent); } else { // throw new UserException(UserException.KErrGeneral,"Application not found"); } } catch(ActivityNotFoundException e) { e.printStackTrace(); //throw new UserException(UserException.KErrGsmRRNoActivityOnRadioPath,e.getMessage()); } catch(Exception e) { e.printStackTrace(); //throw new UserException(UserException.KErrGeneral,e.getMessage()); } Any ideas?
tagged with: java
type: Question
has title: shortcut not opening app on android homescreen
score: 0
answer count: 1

http://stackoverflow.com/comment/37593417
type: QuestionComment
score: 0
has text: If you have converted it into string then use `String.contains()` or `String.indexOf()` methods.
type: Comment
comment on: http://stackoverflow.com/q/24321568

http://stackoverflow.com/a/48424996
type: Answer
has comment: http://stackoverflow.com/comment/83845178
score: 9
upvote count: 9
accepted answer of: http://stackoverflow.com/q/24416960
has comment: http://stackoverflow.com/comment/83852753
answers question: http://stackoverflow.com/q/24416960
has body: As of today the org.json library version 20170516 provides accumulate() method that stores the duplicate key entries into JSONArray JSONObject jsonObject = new JSONObject(); jsonObject.accumulate("a", "b"); jsonObject.accumulate("c", "d"); jsonObject.accumulate("c", "e"); jsonObject.accumulate("f", "g"); System.out.println(jsonObject); Output: { "a":"b", "c":["d","e"], "f":"g" }
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24543581
has body: If you don't like any of the examples above, you can always use an enum. This way you can add other characters you may want with their respective upside down equivalent. Example: //only lower case in this example, but new values can be added enum upsideDown{ a('ɐ'), b('q'), c('ɔ'), d('p'), e('ə'), f('ɟ'), g('ƃ'), h('ɥ'), i('ı'), j('ɾ'), k('ʞ'), l('l'), m('ɯ'), n('u'), o('o'), p('d'), q('b'), r('ɹ'), s('s'), t('ʇ'), u('n'), v('ʌ'), w('ʍ'), x('x'), y('ʎ'), z('z'); private char value; private upsideDown(char value) { this.value = value; } private char getValue(){ return value; } }; public static void main(String[] args) { String hello = "helloworld"; StringBuilder str = new StringBuilder(hello.length()); for (int i = hello.length()-1; i &gt;= 0; i--) { str.append(upsideDown.valueOf(String.valueOf(hello.charAt(i))).getValue()); } System.out.println(str.toString()); }
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/24371977
type: Answer

http://stackoverflow.com/a/24335969
accepted answer of: http://stackoverflow.com/q/24335906
has body: The StringBuilder API documentation is available here. You just need to create it and then call the append method. You can then convert it using toString. StringBuilder string = new StringBuilder(); Iterator&lt;?&gt; it = list.descendingIterator(); while (it.hasNext()) { string.append(it.next()); } System.out.println(string);
downvote count: 1
upvote count: 5
type: AcceptedAnswer
score: 4
answers question: http://stackoverflow.com/q/24335906
type: Answer

http://stackoverflow.com/comment/37681238
type: QuestionComment
type: Comment
has text: @NathanHughes Isn't that the default way in Spring? I am not using AspectJ.
comment on: http://stackoverflow.com/q/24367503
score: 0

http://stackoverflow.com/q/24333784
score: 0
tagged with: sql
answer count: 1
has body: I have stupid error, or bug, or hole in my ignorance. Probably third. SOLVED: From http://www.h2database.com/html/cheatSheet.html Embedded jdbc:h2:~/test 'test' in the user home directory ... **In-Memory** jdbc:h2:mem:test multiple connections in one process ... So, I create in-memory DB, and it make autoclean when you restart the program. I have typically support class: @Entity public class UserDetalis { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int userId; private String userName; public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public int getUserId() { return userId; } public void setUserId(int userId) { this.userId = userId; } } Typically hibernate.cfg.xml org.h2.Driver jdbc:h2:mem:db1 sa 10 org.hibernate.dialect.H2Dialect org.hibernate.cache.internal.NoCacheProvider true create <mapping class="org.zyxerdima.dto.UserDetalis" /> Main class: ... Session session = sessionFactory.openSession(); session.beginTransaction(); for (int i = 0; i < 10; i++){ UserDetalis user = new UserDetalis(); user.setUserName("User " + (i + 1)); session.save(user); } session.getTransaction().commit(); session.close(); session = sessionFactory.openSession(); session.beginTransaction(); Query query = session.createQuery("from UserDetalis"); List users = query.list(); session.getTransaction().commit(); session.close(); System.out.println(users.size()); Execute it, and output is: ... 10x Hibernate: insert into UserDetalis (userId, userName) values (null, ?) Hibernate: select userdetali0_.userId as userId1_0_, userdetali0_.userName as userName2_0_ from UserDetalis userdetali0_ 10 10 - correct size of my array After this I change update And execute in main class only ... session = sessionFactory.openSession(); session.beginTransaction(); Query query = session.createQuery("from UserDetalis"); List users = query.list(); session.getTransaction().commit(); session.close(); System.out.println(users.size()); An…
accepted answer: http://stackoverflow.com/a/24334165
tagged with: spring
type: AnsweredQuestion
type: Question
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24334165
has title: Hibernate: cant get data after record to DB

http://stackoverflow.com/comment/37536612
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24290801
has text: After throwing break points in Slider class at all places where the detail are updated it appears that gtk_button_press_event always returns 0 aka NONE. This causes the gtk_change_value to always set the event detail to none.

http://stackoverflow.com/a/61798064
downvote count: 1
has body: Equivalent "C" program here, but for number of Rows 4 and Number of columns 1 , I get unpredictable result why? #include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;conio.h&gt; int row,col; main() { int a[][]; int nrow,ncols,summ = 0; printf("Enter No of Rows:"); scanf("%d",&amp;nrow); printf("Enter No of Columns:"); scanf("%d",&amp;ncols); int arraylength,rowlength; printf("Enter %d numbers: \n",nrow*ncols); for (int i = 0; i &lt; nrow; i++) { for (int j = 0; j &lt; ncols; j++) { scanf("%d",&amp;a[i][j]); } } arraylength=sizeof(a)/sizeof(int); summ = sum(a,0, 0,nrow,ncols); printf("\n The sum of the array: %d ",summ); getch(); } int sum( int a[row][col],int row,int col,int RowLen,int ColLen) { if ((row == RowLen-1) &amp;&amp; (col==(ColLen)-1)) { return a[row][col]; } if (col == (ColLen)-1) { return (a[row][col] + sum(a,row+1,0,RowLen,ColLen)); } return (a[row][col] + sum(a,row, col+1,RowLen,ColLen)); }
answers question: http://stackoverflow.com/q/24267834
score: -1
has comment: http://stackoverflow.com/comment/109541618
upvote count: 0
has comment: http://stackoverflow.com/comment/109312815
type: Answer

http://stackoverflow.com/comment/37710055
score: 0
type: Comment
type: QuestionComment
has text: You know the retainInstance() method on the activity? Probably this suits your need.
comment on: http://stackoverflow.com/q/24312016

http://stackoverflow.com/q/24274868
accepted answer: http://stackoverflow.com/a/24279128
tagged with: jsf
tagged with: primefaces
has comment: http://stackoverflow.com/comment/37505211
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/24281707
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24279128
has comment: http://stackoverflow.com/comment/37505395
has body: I am using primfaces 5 version to show images from my database in datatable, but unfortunately instead of actual images "image" is getting written in column, here is my xhtml file. I have a list of objects with a StreamedContent property and I need to show it in the component. i throw the showcase primefaces with no result &lt;p:dataTable id="dta" value="#{UtilisateurComponent.listUtilisateurs()}" var="current" rows="15" paginator="true" paginatorPosition="bottom" rowKey="current.iduser"&gt; &lt;p:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="id User" /&gt; &lt;/f:facet&gt; &lt;h:outputText value="#{current.iuser}" /&gt; &lt;/p:column&gt; &lt;p:column &gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="Photo" /&gt; &lt;/f:facet&gt; &lt;p:graphicImage value="#{UtilisateurComponent.content}" height="100" width="150"&gt; &lt;f:param name="id" value="#{current.iduser}" /&gt; &lt;/p:graphicImage&gt; &lt;/p:column&gt; &lt;/p:dataTable&gt; here is my managed bean : enter code here @Scope("session") @Component("UtilisateurComponent") public class UtilisateurComponentImpl implements UtilisateurComponent { private Utilisateur utilisateur; byte[] f; private UploadedFile file; private StreamedContent content; @Autowired private UtilisateurDAO utilisateurDAO; @Autowired private UtilisateurService utilisateurService; public StreamedContent getContent() { FacesContext context = FacesContext.getCurrentInstance(); if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) { return new DefaultStreamedContent(); } else{ String imageId = context.getExternalContext().getRequestParameterMap().get("id"); Utilisateur u = utilisateurDAO.findUtilisateurByIduser(Integer.parseInt(imageId)); return new DefaultStreamedContent(new ByteArrayInputStream(u.getPhoto())); //the line that throw the Error } } public void setContent(StreamedContent content) { this.content = content; } @PostConstruct public void init() { //initialize the data here this.utilisateur = new Utilisat…
favorite count: 0
downvote count: 1
tagged with: file-upload
possible better answer: http://stackoverflow.com/a/24281707
upvote count: 0
has title: how to load dynamic images in datatable using primefaces from database? images not showing in datatable
tagged with: jakarta-ee
type: AnsweredQuestion

http://stackoverflow.com/comment/37709358
type: Comment
comment on: http://stackoverflow.com/q/24376731
score: 0
type: QuestionComment
has text: @PeterLawrey yes I mean a list where the indexes change automatically.

http://stackoverflow.com/comment/37721968
type: QuestionComment
has text: What actually replaces `Uses AA here`?
comment on: http://stackoverflow.com/q/24389077
score: 0
type: Comment

http://stackoverflow.com/a/24285191
score: 1
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24284902
has body: Great advantage of Java NIO Java NIO: A single thread managing multiple connections. where as Java IO: A classic IO server design - one connection handled by one thread.Source here

http://stackoverflow.com/q/24424686
downvote count: 0
has answer: http://stackoverflow.com/a/24424844
favorite count: 0
has comment: http://stackoverflow.com/comment/37788315
accepted answer: http://stackoverflow.com/a/24425272
has answer: http://stackoverflow.com/a/24424815
tagged with: narrowing
score: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24424704
has title: How does narrowing work in method invocation in Java?
type: Question
has answer: http://stackoverflow.com/a/24424722
has body: Why this is giving the compile time error? 2 is constant at compile time, therefore narrowing should be allowed here since 2 is in range of byte. public class Test { public static void main(String[] args) { ForTest test=new ForTest(); test.sum(1, 2); //compile time error here } } class ForTest { public int sum(int a,byte b) { System.out.println("method byte"); return a+b; } } The error is: The method sum(int,byte) in the type ForTest is not applicable for the arguements (int,int). Edit: I think the answer lies here: http://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.3 but I am not getting it :(
tagged with: java
has answer: http://stackoverflow.com/a/24424714
answer count: 6
has comment: http://stackoverflow.com/comment/37788378
upvote count: 4
possible better answer: http://stackoverflow.com/a/24424714
has answer: http://stackoverflow.com/a/24425272
linked to: http://stackoverflow.com/q/20442782

http://stackoverflow.com/comment/37509139
has text: ....An instance of a wrapper class *by definition* can't be a primitive. It can represent *the same value* as a primitive, but isn't one. In addition, `char[]` isn't a primitive.
type: Comment
comment on: http://stackoverflow.com/a/24277083
score: 3
type: AnswerComment

http://stackoverflow.com/q/24277775
downvote count: 0
linked to: http://stackoverflow.com/q/5310403
favorite count: 0
accepted answer: http://stackoverflow.com/a/24278104
type: Question
duplicate of: http://stackoverflow.com/q/5310403
has body: yesterday i saw an example of Combo box on oracle site on the link below: http://docs.oracle.com/javase/8/javafx/user-interface-tutorial/combo-box.htm#BABJCCIB On this page there is an example under the section named "Applying Cell Factories to Combo Boxes". In this example there is a code i am pasting here:- priorityComboBox.setCellFactory( new Callback&lt;ListView&lt;String&gt;, ListCell&lt;String&gt;&gt;() { @Override public ListCell&lt;String&gt; call(ListView&lt;String&gt; param) { final ListCell&lt;String&gt; cell = new ListCell&lt;String&gt;() { { super.setPrefWidth(100); } @Override public void updateItem(String item, boolean empty) { super.updateItem(item, empty); if (item != null) { setText(item); if (item.contains("High")) { setTextFill(Color.RED); } else if (item.contains("Low")){ setTextFill(Color.GREEN); } else { setTextFill(Color.BLACK); } } else { setText(null); } } }; return cell; } }); In the above code below code is used to call the super class method setPrefWidth. { super.setPrefWidth(100); } Now my question is why they used the anonymous code block to do this. They can put that statement in the updateItem method. What is the intention to do this?
upvote count: 2
tagged with: java
tagged with: javafx
answer count: 1
has answer: http://stackoverflow.com/a/24278104
has title: What is the reason to use these anonymous block to call super class method in this code?
tagged with: javafx-8
score: 2
type: AnsweredQuestion

http://stackoverflow.com/q/24335771
has body: We have configuration that includes Apache and Tomcat servers connected by mod_jk. There are several tomcat servers and request are distributed by the Round-Robin algorithm. Just recently the number of AJP threads suddenly started growing and the tomcat servers crashed. We do not see anything unusual in the logs, and the load was below average. The Garbage collection started about 5 minutes before the sudden increase as shown by New Relic software. What is the best approach in dealing with this crash? I am thinking about simulating the load with JMeter, what can be other ideas?
score: 0
has answer: http://stackoverflow.com/a/24336592
answer count: 1
tagged with: tomcat
has comment: http://stackoverflow.com/comment/37729199
tagged with: mod-jk
has comment: http://stackoverflow.com/comment/37723458
type: UnansweredQuestion
type: Question
has title: How to investigate the acute growth of the AJP threads number in Tomcat?
tagged with: jvm-crash
tagged with: ajp
tagged with: java

http://stackoverflow.com/q/24343652
has comment: http://stackoverflow.com/comment/37635248
has comment: http://stackoverflow.com/comment/37636203
has body: I have this error when i try to do data[i][1]=tmp[1]; Or any int > 0 in tmp[]. However donne contains 5 parts separated by :__:. Also if I do System.out.println(tmp[1]); it will print the right thing and then throw the exception. Here is the code: String[] donne=toServ.getDonneAccueil(); System.out.println(donne[0]); // Données test Object[][] data = new Object[donne.length][6]; for(int i=0;i&lt;donne.length;i++){ final int k; String[] tmp=donne[i].split(":__:"); /*System.out.println(tmp[0]); System.out.println(tmp[1]); System.out.println(tmp[2]); System.out.println(tmp[3]); */ data[i][0]=tmp[0]; data[i][1]=tmp[1]; data[i][2]="n"; data[i][3]=tmp[2]; data[i][4]=tmp[3]; The Stack Trace is: Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 1 at Vue_Accueil.&lt;init&gt;(Vue_Accueil.java:60) at Menu$1.mouseClicked(Menu.java:65) at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$400(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown So…
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37635200
has comment: http://stackoverflow.com/comment/37636304
has comment: http://stackoverflow.com/comment/37635214
has comment: http://stackoverflow.com/comment/37635334
type: Question
has comment: http://stackoverflow.com/comment/37635352
tagged with: arrays
has comment: http://stackoverflow.com/comment/37635123
has comment: http://stackoverflow.com/comment/37635271
has comment: http://stackoverflow.com/comment/37635246
score: 0
has comment: http://stackoverflow.com/comment/37635314
has comment: http://stackoverflow.com/comment/37635114
has title: Java: ArrayOutOfBoundsException
has comment: http://stackoverflow.com/comment/37635164
type: UnansweredQuestion

http://stackoverflow.com/comment/39181012
type: QuestionComment
type: Comment
has text: When I had a similar need in the past, I ended up implementing a main method in the Java code to allow execution from R as an external program using 'system'.
score: 0
comment on: http://stackoverflow.com/q/24337383

http://stackoverflow.com/comment/37649877
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24350866
type: Comment
has text: Which datatype if preferable for phone num? even Double will also not suppose @size validation.

http://stackoverflow.com/q/24318491
upvote count: 0
answer count: 1
tagged with: iterable
favorite count: 0
has title: The type ArrayGSackIterable<T> must implement the inherited abstract method GSackIterableADT<T>.remove()
has body: This is an example run in our Java class today with no problem but when I added the files into a new project I am having the following error. Can you please tell me if I have added files wrongly or maybe the professor was using an slightly different version of the files? Can you let me know what's the reason for this error and how to fix it? The code for each of the file is as following: ArrayGSackIterable.java: import java.util.Iterator; public class ArrayGSackIterable&lt;T&gt; extends ArrayGSack&lt;T&gt; implements GSackIterableADT&lt;T&gt; { public Iterator&lt;T&gt; iterator() { return new ArrayGSackIterator&lt;T&gt;(items, numItems); } } and for ArrayGSackIterator.java: import java.util.Iterator; import java.util.NoSuchElementException; public class ArrayGSackIterator&lt;E&gt; implements Iterator&lt;E&gt; { private E[] items; private int numItems, curr; public ArrayGSackIterator(E[] gsackitems, int num) { items = gsackitems; numItems = num; } public boolean hasNext() { return curr &lt; numItems; } public E next() { if (!hasNext()) throw new NoSuchElementException(); return items[curr++]; } public void remove() { } } and finally for GSackIterableADT.java: import java.util.Iterator; import java.util.NoSuchElementException; public interface GSackIterableADT&lt;T&gt; extends Iterable&lt;T&gt; { void add(T item); T remove() throws NoSuchElementException; boolean isEmpty(); Iterator&lt;T&gt; iterator(); } UPDATE: Apparently I had to add these two files from another .zip file. GSackADT.java: import java.util.NoSuchElementException; public interface GSackADT&lt;T&gt; { void add(T item); T remove() throws NoSuchElementException; boolean isEmpty(); } ArrayGSack.java: import java.util.NoSuchElementException; public class ArrayGSack&lt;T&gt; implements GSackADT&lt;T&gt; { // Internal storage and accounting members protected T[] items; protected int numItems; private static final int INIT_SIZE = 100; public ArrayGSack() { items = (T[]) new Object[INIT_SIZE]; numItems = 0; } …
has comment: http://stackoverflow.com/comment/37587876
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24318545
tagged with: java
downvote count: 1
type: Question
score: -1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37587801
accepted answer: http://stackoverflow.com/a/24318545
tagged with: iterator

http://stackoverflow.com/comment/37623157
has text: @Inject(optional=true) is something that we are gradually going to be eliminating in Guice, in favor of DefaultBinding and OptionalBinding (new in 4.0). This is not really an answer to the issue in the qeustion though.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24337040
type: Comment

http://stackoverflow.com/comment/37758416
has text: no exceptions... nothing? It's hard to give you an answer without knowing exactly what's not working
comment on: http://stackoverflow.com/q/24382392
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24337369
tagged with: soap
favorite count: 0
answer count: 0
downvote count: 0
type: UnansweredQuestion
has title: JAX-WS Provider with attachment streaming
tagged with: attachment
score: 1
tagged with: java
tagged with: mtom
tagged with: jax-ws
has body: I would like to implement a JAX-WS Provider, that receives large MTOM attachments. I would like to prevent the attachments from being cached in memory; I would like to stream them to a temporary file (or the JAX-WS implementation to stream them to a temporary file). Theoretically I could get the MTOM attachmments with SOAPMessage#getAttachments(), or with WebServiceContext#getMessageContext()#get(INBOUND_MESSAGE_ATTACHMENTS), and stream them into a temporary file. The problem is that I've found no way to get the SOAP Part itself without the attachments resolved (in memory). I've tried the PAYLOAD/MESSAGE annotations, Source/SOAPMessage parameters, but no luck, the memory always gets filled with the attachments. Does anyone have an idea, or experience about this problem?
type: Question
upvote count: 1

http://stackoverflow.com/q/24317748
has body: import java.util.*; public class newclass { public static String name; static Scanner input = new Scanner(System.in); public static void main(String[] args){ newclass picname = new newclass(); picname.namechecker(); picname.agechecker(); } public void namechecker(){ System.out.println("Please enter your name new user"); String name = input.nextLine(); System.out.println("Hello " + name + "!"); } public void agechecker(){ System.out.println("What is your age " + name); int age = input.nextInt(); System.out.println("You're " + age + " years old"); } } For some reason whenever I enter my name. Java would not recall it in the agechecker() method. I do not know why it wouldn't since I used it as a global variable. Can someone please explain this to me. Thank you in advance.
accepted answer: http://stackoverflow.com/a/24317784
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24317784
score: 1
tagged with: java
tagged with: methods
type: Question
has title: Calling name error in agecheck method
has comment: http://stackoverflow.com/comment/37586371
answer count: 1
downvote count: 0
upvote count: 1
favorite count: 0

xamarin.android
type: Tag
tag name: xamarin.android
tags question: http://stackoverflow.com/q/24309224
tags question: http://stackoverflow.com/q/24300482

http://stackoverflow.com/q/24278868
has title: ServletActionContext for struts2 + spring MVC
has comment: http://stackoverflow.com/comment/37512705
answer count: 1
has comment: http://stackoverflow.com/comment/37512804
has answer: http://stackoverflow.com/a/24279008
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37512674
tagged with: java
has comment: http://stackoverflow.com/comment/37512531
has comment: http://stackoverflow.com/comment/37512609
has body: I want to change this struts 2 code to spring MVC, does anyone have a clue? HttpServletRequest request = ServletActionContext.getRequest(); I am getting this org.apache.struts2.dispatcher.StrutsRequestWrappe@3535 while it hits a struts2 web app and this : FirewalledRequest[ org.apache.catalina.connector.RequestFacade@2425] while hitting a spring MVC web app. I am a bit confused. Any suggestions will help
has comment: http://stackoverflow.com/comment/37512738
type: Question
accepted answer: http://stackoverflow.com/a/24279008
tagged with: struts2
tagged with: servlets
score: 0

http://stackoverflow.com/comment/37615539
comment on: http://stackoverflow.com/a/24324004
type: AnswerComment
score: 0
type: Comment
has text: @JasperBlues Are you using the formatter? i.e. ctrl+alt+L

http://stackoverflow.com/comment/37490747
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24267510
type: AnswerComment
has text: There's no need to override `hashCode` in `Node`.

http://stackoverflow.com/comment/37686600
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24368160
has text: You're welcome. As you can see the API is tricky. Another caveat you probably know is the `read` method that returns an int actually returns a single byte wrapped in an int. Finally try to close resources in the finally clauses, or use [Java 8's try-with-resources](http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html)
score: 1

http://stackoverflow.com/a/24285816
upvote count: 2
answers question: http://stackoverflow.com/q/24279691
type: Answer
has body: As sp00m said, your Impl#compareTo(Impl) has a different signature than AbstractBase#compareTo(AbstractBase), so it's not overloading it. The key point is in understanding why it doesn't work, even when you try to sort() comparing with another Impl, where the more specific signature do matches. As you defined Comparable&lt;AbstractBase&gt;, you need to define how your instances compareTo AbstractBase instances. And so you need to implement compareTo(AbstractBase). You can think that, being Impl a subtype of AbstractBase, the more specific method would be used when a comparison between two Impls takes place. The problem is Java has static binding, and so the compiler defines at compile time which method would use for solving each method call. If what you were doing was sorting AbstractBases, then the compiler would use the compareTo(AbstractBase), that is the one AbstractBase's interface define when it implements the Comparable(AbstractBase) interface. You can make Impl implement the Comparable&lt;Impl&gt; interface for using the compareTo(Impl) method, but that would only work if you explicitly sort things that are known to be Impls at compile time (ie, an Impl object or Collection&lt;Impl&gt;). If you really want to apply a different comparison whenever your two objects are Impls, you should fall to some kind of double-dispatch in your Impl#compareTo(AbstractBase) like: Impl &gt;&gt;&gt; int compareTo(AbstractBase other) { return other.compareToImpl(this); } int compareToImpl(Impl other) { // perform custom comparison between Impl's } AbstractBase &gt;&gt;&gt; int compareTo(AbstractBase other) { // generic comparison } int compareToImpl(Impl other) { // comparison between an AbstractBase and an Impl. //Probably could just "return this.compareTo(other);", but check for loops :) } This requires you add some Impl information in your AbstractBase, which is not pretty, though, but solves the problem the more elegant way it could - using reflection for this is not elegan…
score: 2
downvote count: 0

http://stackoverflow.com/a/24273595
score: 5
has body: Yes, you can switch to a new page by using a CardLayout. Take a look at the CardLayout tutorial and the CardLayout API. The idea behind this layout is that only one "card" (or otherwise a page) is visible at a given time. This layout thus allows you to switch between different pages in the same window.
answers question: http://stackoverflow.com/q/24273547
upvote count: 5
downvote count: 0
type: Answer

http://stackoverflow.com/comment/37614443
type: QuestionComment
type: Comment
has text: You can use proxy pattern to achieve this, return a proxy instance and call actual method when really required
score: 0
comment on: http://stackoverflow.com/q/24332599

http://stackoverflow.com/a/71354002
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24345754
has body: If you're not teetering on the edge of losing frames, you can enable antialiasing in your launcher. You can increase the sample count for better results, but it's really diminishing returns. LWJGL3 : config.setBackBufferConfig(8, 8, 8, 8, 16, 0, 2); LWJGL2 : config.samples = 2; GWT : config.antialiasing = true; Android: config.numSamples = 2; iOS : config.multisample = GLKViewDrawableMultisample._4X;

class
tags question: http://stackoverflow.com/q/24288879
tags question: http://stackoverflow.com/q/24280406
tags question: http://stackoverflow.com/q/24355348
tags question: http://stackoverflow.com/q/24400736
tags question: http://stackoverflow.com/q/24299949
tags question: http://stackoverflow.com/q/24422153
tags question: http://stackoverflow.com/q/24386325
tags question: http://stackoverflow.com/q/24282879
tags question: http://stackoverflow.com/q/24404232
tags question: http://stackoverflow.com/q/24379298
tags question: http://stackoverflow.com/q/24362281
tags question: http://stackoverflow.com/q/24318662
tags question: http://stackoverflow.com/q/24321182
tags question: http://stackoverflow.com/q/24357969
tags question: http://stackoverflow.com/q/24280292
tags question: http://stackoverflow.com/q/24293417
tags question: http://stackoverflow.com/q/24378375
tags question: http://stackoverflow.com/q/24355396
type: Tag
tags question: http://stackoverflow.com/q/24371587
tags question: http://stackoverflow.com/q/24346594
tags question: http://stackoverflow.com/q/24336162
tag name: class
tags question: http://stackoverflow.com/q/24270267
tags question: http://stackoverflow.com/q/24317006
tags question: http://stackoverflow.com/q/24362885
tags question: http://stackoverflow.com/q/24378455
tags question: http://stackoverflow.com/q/24370726
tags question: http://stackoverflow.com/q/24354884
tags question: http://stackoverflow.com/q/24394132
tags question: http://stackoverflow.com/q/24368243
tags question: http://stackoverflow.com/q/24286082
tags question: http://stackoverflow.com/q/24412130
tags question: http://stackoverflow.com/q/24277644
tags question: http://stackoverflow.com/q/24416881
tags question: http://stackoverflow.com/q/24356204

http://stackoverflow.com/q/24421835
tagged with: eclipse
type: Question
downvote count: 0
has body: I have an instruction manual with just the following picture. I figured it required the following plugin after searching which is a maven plugin. I have already installed maven http://maven.apache.org/plugins/maven-ear-plugin/ SO i think I will get the above EAR/WAT settings in my Eclipse->pfreferences after i install this maven plugin. But how do i install a plugin for maven? The above website does not say how to install that plugin. Most searches are leading me to maven eclipse plugin installation instead of this particular installation. I am installing it for the first time and have not worked with maven before.
has comment: http://stackoverflow.com/comment/37783607
favorite count: 0
answer count: 0
has title: Installing Maven Plugins
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37783327
upvote count: 1
tagged with: maven
score: 1
tagged with: java

http://stackoverflow.com/q/24302726
favorite count: 0
tagged with: oracle-database
tagged with: oracleforms
type: AnsweredQuestion
downvote count: 0
type: Question
has comment: http://stackoverflow.com/comment/37557905
has comment: http://stackoverflow.com/comment/37701110
score: 1
tagged with: java
has body: I just have a problem relative to concurrency whose logic flow is when a client (called Oracle Forms) will submit a request （called concurrent program ) and call a plsql procedure, this procedure eventually will call a java static method. What I find is that when I submit two request in the same time or in a very short interval(like 1 second), some concurrency problem will be noticed. The java method is the start point of doing something that search from the database suggest that which records should be inserted into database. The problem is that, they will result in duplicated result since when I query, both request find it fine to insert new records. I tried add synchronized in the static java method, but this does not solve this problem, why? What I do is: public static synchronized void execute Please note that the insert will be called in plsql, which means I do a not sufficient synchronize if only synchronize the java method. But when I look into the log, it shows the two request run in the same second, which I do not think it is normal! since query database and doing the suggestion is time consuming. To make the java method really time consuming, I add a code call Thread.sleep(5000), and log for the time after this code and log the thread id. Surprise to see that the Thread id is 1! And also, the time where they pass the sleep is in the same time. Why is that? What can I do to solve the problem? Any lock on the java method or pl sql? PS: I am now trying to use DMBS_LOCK, and which seems to be working but I still hope to know the reason why the java method is not synchronized.
has answer: http://stackoverflow.com/a/24380080
accepted answer: http://stackoverflow.com/a/24380080
tagged with: concurrency
has title: How to synchronize a java method called by PL/SQL
tagged with: plsql
answer count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/24378407
has answer: http://stackoverflow.com/a/24378407

http://stackoverflow.com/a/24304938
answers question: http://stackoverflow.com/q/24304852
has comment: http://stackoverflow.com/comment/72910319
score: 4
upvote count: 4
downvote count: 0
has body: You cannot iterate over map in for loop and delete entries from this map simultaneously. Try this Iterator entries = onsDetailsMap.entrySet().iterator(); while (entries.hasNext()) { Entry&lt;String, FieldType&gt; entry = (Entry) entries.next(); if (uxDetailsMap.containsKey(entry.getKey()) { System.out.println("BOTH :: " + entry.getKey()); entries.remove(); } }
type: Answer
has comment: http://stackoverflow.com/comment/37565104
has comment: http://stackoverflow.com/comment/37565328
has comment: http://stackoverflow.com/comment/37564064

http://stackoverflow.com/comment/37736502
score: 1
has text: @BrianGoetz +1 Totally that, and nice to see a comment from the spec lead of JSR 335 himself. :-D On which note, maybe you'd know the answer to [this question](http://stackoverflow.com/q/17203781/13)? :-)
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24396579

http://stackoverflow.com/q/24364128
has comment: http://stackoverflow.com/comment/37674801
tagged with: java
downvote count: 1
type: Question
upvote count: 4
tagged with: jodatime
has answer: http://stackoverflow.com/a/24364579
has title: converting JodaTime to Long Integer format
has comment: http://stackoverflow.com/comment/37675423
has body: hello I had date format which i use in a API call in Long integer format. That API call does not support date in any other format and it should as follows. public static long start_date=20140401101010L; public static long end_date=20140430101010L; I had to make some changes in that date, so i changed that date into JodaDate format as like the below code. DateTime startDateTime = formatter.parseDateTime(String.valueOf(start_date)); DateTime endDateTime = formatter.parseDateTime(String.valueOf(end_date)); This is how we convert normal variable to DateTime object. so how can i do the opposite.? If i have a JodaTime 2014-04-30T10:10:10.000+05:30 and i want to change that time to this format which is as a Long integer. 20140430101010L . I want to do this because i am doing an API program and the url parameter has time and which support only the above format and not in JodaTime.
has comment: http://stackoverflow.com/comment/37684399
score: 3
has answer: http://stackoverflow.com/a/24364267
has comment: http://stackoverflow.com/comment/37674921
has answer: http://stackoverflow.com/a/24364371
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24364654
answer count: 4

http://stackoverflow.com/comment/121426677
comment on: http://stackoverflow.com/a/28942107
score: 0
type: AnswerComment
type: Comment
has text: launch4j 3.14: This don't work. ./jre if in same folder ../jre if you are in 1 step deeper (work like linux)

http://stackoverflow.com/comment/37788083
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24424183
has text: This is so embarrassing. I overlooked this simple thing. Should I remove my question since I feel its a really irrelevant and silly one !!
score: 0

http://stackoverflow.com/comment/37703539
type: Comment
type: QuestionComment
score: 0
has text: If you need 2 max values then make 2 variables to store the information. So you will have idMax, idMin, valueMax, valueMin.
comment on: http://stackoverflow.com/q/24379372

http://stackoverflow.com/a/72171673
score: 5
upvote count: 5
downvote count: 0
has body: Eclipse Temurin is the official successor to adoptopenjdk. So, as of May 2022, I would use the following brew install --cask temurin@8 When the installation is done, JDK 8 is installed in /Library/Java/JavaVirtualMachines/temurin-8.jdk
answers question: http://stackoverflow.com/q/24342886
type: Answer

http://stackoverflow.com/a/24524085
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24384223
downvote count: 0
has body: Does this help you in creating custom edges ? This particular example is drawn from the JGrapht internal documentation . Search for StoerWagnerMinimumCut algorithm inside the code base . Here we go . The idea here is to give some weights to the edges of the graph hence the need to manipulate the default weights. final WeightedGraph&lt;Set&lt;V&gt;, DefaultWeightedEdge&gt; workingGraph; .... workingGraph = new SimpleWeightedGraph&lt;Set&lt;V&gt;, DefaultWeightedEdge&gt;( DefaultWeightedEdge.class); list = .... workingGraph.addVertex(list); .... // Lets manipulate the edge weights now DefaultWeightedEdge eNew = workingGraph.getEdge(someSourcEdge, someTargetEdge); if (eNew == null) { eNew = workingGraph.addEdge(someSourcEdge, someTargetEdge); workingGraph.setEdgeWeight(eNew, graph.getEdgeWeight(e)); } else { workingGraph.setEdgeWeight( eNew, workingGraph.getEdgeWeight(eNew) + graph.getEdgeWeight(e)); I hope you can play around with the example and use it to create customized edges . PS : My answer my not be 100% correct but the idea is to point you to the correct direction in the docmentation :-)

http://stackoverflow.com/q/24379667
answer count: 1
linked to: http://stackoverflow.com/q/23841518
accepted answer: http://stackoverflow.com/a/24379773
has body: I want to create a loading message that will popup on the screen while information is being loaded. I will call the initLoadingPanel() method for it so that the JFrame will be visible. My problem is how can I close it? My code is below. public class DataMigration extends JFrame{ private JFrame frmDataMigration; private JFrame loader; private JButton btnProcess; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { DataMigration window = new DataMigration(); window.frmDataMigration.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public DataMigration() { initialize(); } private void initialize() { LoggerImp.startLog(CLASS_NAME, "initialize()"); frmDataMigration = new JFrame(); btnProcess = new JButton("Load"); btnProcess.setEnabled(false); btnProcess.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { SwingWorker &lt;CSV, CSV&gt; worker = new SwingWorker&lt;CSV, CSV&gt;() { @Override protected CSV doInBackground() throws Exception { return FileReaderCSVHelper.fileReader(dirName.getText(), fileName.getText()); } @Override protected void done() { try { csv = doInBackground(); generateTableList(csv.getCsvTitle(), stateController.getFieldNames()); } catch (ExecutionException ex) { ex.printStackTrace(); } catch (Exception e){ } loader.dispose(); } }; worker.execute(); } }); frmDataMigration.getContentPane().add(btnProcess); } public void initLoadingPanel(){ SwingUtilities.invokeLater(new Runnable() { @Override public void run() { loader = new JFrame("Loading...."); ImageIcon img = new ImageIcon("loader.gif"); loader.add(new JLabel(" Loading...", img, JLabel.CENTER)); loader.setAlwaysOnTop(true); loader.pack(); loader.setSize( 448, 497); loader.setVisible(true); loader.setLocationRelativeTo(null); } }); }
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/24379773
tagged with: swing
has title: Java Swing Utilities
score: 0
tagged with: java

google-maps
tags question: http://stackoverflow.com/q/24358356
tag name: google-maps
tags question: http://stackoverflow.com/q/24376834
tags question: http://stackoverflow.com/q/24412902
tags question: http://stackoverflow.com/q/24421983
tags question: http://stackoverflow.com/q/24271544
tags question: http://stackoverflow.com/q/24353793
tags question: http://stackoverflow.com/q/24280970
tags question: http://stackoverflow.com/q/24355041
tags question: http://stackoverflow.com/q/24361365
type: Tag
tags question: http://stackoverflow.com/q/24332490

http://stackoverflow.com/q/24276691
has body: I have been searching on how to retrieve a public user timeline from Facebook without any authentication or sign in. The easiest library I found is facebook4j but I can't figure out how to achieve my goal(don't understand the access token). I have achieved my my goal for Twitter using twitter4j and my code is as follow: class TweetFetch extends AsyncTask&lt;String,String,Void&gt;{ private String convertedSingerName; private ArrayAdapter&lt;String&gt; nameAdapter; String user; ProgressDialog loadDialog; @Override protected void onPreExecute() { //get a loading animation /*loadDialog = new ProgressDialog(getApplicationContext()); loadDialog.setMessage("Loading..."); loadDialog.setCancelable(false); loadDialog.show();*/ setProgressBarIndeterminateVisibility(true); convertedSingerName = Normalizer.normalize(singerName, Normalizer.Form.NFD); convertedSingerName = convertedSingerName.replaceAll("[^\\p{ASCII}]", ""); convertedSingerName = convertedSingerName.replaceAll("\\s", ""); user = convertedSingerName; nameAdapter = (ArrayAdapter&lt;String&gt;) tweetList.getAdapter(); getTweetOAuthDetails(); } @Override protected Void doInBackground(String... params) { try{ Paging page = new Paging(1, 50);//page number, number per page statuses = twitter.getUserTimeline(user, page); Log.i("Status count ", statuses.size() + " Feeds"); for (int i=0 ; i&lt;statuses.size() ; i++){ twitter4j.Status status = statuses.get(i); publishProgress(status.getText()); Log.i("Tweet Count" + (i+1), status.getText() + "\n\n"); } }catch (TwitterException te){ te.printStackTrace(); } return null; } @Override protected void onProgressUpdate(String... values) { nameAdapter.add(values[0]); } @Override protected void onPostExecute(Void aVoid) { //loadDialog.dismiss(); setProgressBarIndeterminateVisibility(false); } } Is there anyway that I can use the same approach using facebook4j for Facebook. If this is not achievable using facebook4j what is the simplest way. Thanks.
tagged with: android
tagged with: facebook
answer count: 0
type: UnansweredQuestion
has title: How to retrieve a public user's timeline from Facebook using facebook4j without the need for the user to login
upvote count: 1
tagged with: twitter4j
score: 1
tagged with: java
type: Question
downvote count: 0
tagged with: facebook-graph-api
favorite count: 0

http://stackoverflow.com/comment/37692812
type: QuestionComment
has text: See http://stackoverflow.com/questions/4293098/how-to-integrate-spring-with-hibernate-session-and-transaction-management
comment on: http://stackoverflow.com/q/24373551
score: 1
type: Comment

http://stackoverflow.com/q/24286751
has answer: http://stackoverflow.com/a/24287179
type: AnsweredQuestion
has body: I want to make my application header repeated image like similar to ccleaner application header , below. I want to also put logo right top corner but when I maximizing the window , it stays in the middle. I am currently using netbeans. Similar to ; CSS Background Repeat ,
tagged with: java
downvote count: 1
type: Question
has title: Java Swing Background image repeat and maximized window
upvote count: 0
accepted answer: http://stackoverflow.com/a/24287179
score: -1
has comment: http://stackoverflow.com/comment/37527361
linked to: http://stackoverflow.com/q/5895829
has comment: http://stackoverflow.com/comment/37527607
answer count: 1
linked to: http://stackoverflow.com/q/8265548
favorite count: 0
tagged with: netbeans
linked to: http://stackoverflow.com/q/8264138
tagged with: swing

http://stackoverflow.com/a/24305715
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24305548
answers question: http://stackoverflow.com/q/24305548
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Make sure you use binary mode for the FTP transfer. The fact that txt files work indicates that this is most likely your problem.

http://stackoverflow.com/q/24346053
tagged with: eclipse
type: Question
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/37642862
has answer: http://stackoverflow.com/a/24346586
downvote count: 1
tagged with: jar
has title: how to create JAR File
favorite count: 0
has body: I know creating JAR files is easy, just use eclipse, right click on the project and select export and follow the wizard. There is also another way that is command-line, we can use this command. jar cf myjarfilename.jar file1.class file2.class The problem is I cannot use use eclipse to create JAR because my code is compiled in separate projects and then I place .class files in a particular hierarchy, compiled 'em into a JAR and place 'em at a specific location from where my web-app uses it. I could use the command line but that is not practical as my hierarchy is complex and uses a lot of .class files. (folders and only .class files) Now I need to make a JAR out of it. How to.
has comment: http://stackoverflow.com/comment/37640104
accepted answer: http://stackoverflow.com/a/24346087
score: 1
possible better answer: http://stackoverflow.com/a/24346586
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24346087
has comment: http://stackoverflow.com/comment/37640092
tagged with: java

http://stackoverflow.com/comment/37710297
type: Comment
comment on: http://stackoverflow.com/a/24361014
has text: no, still doesn't work... any bytearray (buffer) initiated to more than 10 length will resolve in a timeout exception. which coincidentally is the number of bytes supposed to be sent...
type: AnswerComment
score: 0

instantiation
type: Tag
tags question: http://stackoverflow.com/q/24395186
tag name: instantiation

netty
tags question: http://stackoverflow.com/q/24390184
tags question: http://stackoverflow.com/q/24294442
tags question: http://stackoverflow.com/q/24362004
tags question: http://stackoverflow.com/q/24323037
type: Tag
tags question: http://stackoverflow.com/q/24271624
tags question: http://stackoverflow.com/q/24376024
tags question: http://stackoverflow.com/q/24281702
tag name: netty
tags question: http://stackoverflow.com/q/24394025

http://stackoverflow.com/comment/37645690
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24348886
score: 5
has text: `int[] arr = new int[]{str.indexOf('['),str.indexOf(']')}` should do. http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#indexOf(int)

http://stackoverflow.com/tag/zip
tags question: http://stackoverflow.com/q/24392602
tags question: http://stackoverflow.com/q/24360476
tags question: http://stackoverflow.com/q/24363461
type: Tag
tags question: http://stackoverflow.com/q/24320726
tag name: zip
tags question: http://stackoverflow.com/q/24274432
tags question: http://stackoverflow.com/q/24388308

http://stackoverflow.com/comment/37633249
has text: After checking further today, I found out that table is not found because the search string is in upper case (despite being declared all caps via JPA in object)
comment on: http://stackoverflow.com/q/24330312
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24338999
has comment: http://stackoverflow.com/comment/37726735
score: 0
tagged with: android
tagged with: facebook
has title: ParseUser saveInBackground still not saving after Facebook Login
has body: I have login into facebook, and use ParseFacebookUtil to login Parse. I can get Current User, and put my "highscore" into it. However, when I perform saveInBackground, it error statusbg "Cannot save a ParseUser until it has been signed up". if (ParseUser.getCurrentUser() != null) { ParseUser.getCurrentUser().put("highscore", getHighScore()); ParseUser.getCurrentUser().saveInBackground(new SaveCallback() { public void done(ParseException e) { if (e == null) { Log.d(TAG, "SAVE SUCCESSFUL"); } else { Log.d(TAG, "SAVE FAILED " + e.getCause()); } } }); } My code for ParseFacebookUtil login as below ParseFacebookUtils.logIn(fbUser.getId(), session.getAccessToken(), session.getExpirationDate(), new LogInCallback() { @Override public void done(ParseUser parseUser, ParseException err) { if (parseUser != null) { // The user has been saved to Parse. if (parseUser.isNew()) { // This user was created during this session with Facebook Login. Log.d(TAG, "ParseUser created."); // Call saveInventory() which will save data to Parse if connected. CarRunnerApplication app = ((CarRunnerApplication)getApplication()); app.saveInventory(); } else { Log.d(TAG, "User exists in Parse. Pull their values: " + parseUser); // This user existed before. Call loadInventory() which has logic // to check Parse if connected. CarRunnerApplication app = ((CarRunnerApplication)getApplication()); app.loadInventory(); } loadInventoryFragment(); } else { // The user wasn't saved. Check the exception. Log.d(TAG, "User was not saved to Parse: " + err.getMessage()); } } }); It used to worked, and I don't know since when it's no longer working. Can someone shed some light how to even debug it... Thanks.
tagged with: parse-platform
answer count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/37895209
tagged with: java

http://stackoverflow.com/q/24392489
upvote count: 0
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
score: -1
favorite count: 0
tagged with: xpath
has answer: http://stackoverflow.com/a/24408534
type: Question
answer count: 2
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/24412179
tagged with: java
tagged with: selenium
downvote count: 1
has body: I created a test script in which i want to click a edit button and then close the window. Most of the time the code works as expected but some time for the same code i gets nosuchelement exception. I went through the similar questions asked in the forum but none of the solution worked for me. Below i am putting the java code along with the HTML Code in hope to find a solution. for(String newwindow : window.getWindowHandles()){ //swithching to the new pop up using window.switchTo().window(passing newwindow as argument) window.switchTo().window(newwindow);} //getting title of new window using getTitle() method System.out.println("NewWindow Title"+ window.getTitle()); window.findElement(By.xpath(".//*[@id='edit_resume_section3_open' and not(@disabled)]")).click(); window.manage().timeouts().implicitlyWait(40, TimeUnit.SECONDS); System.out.println(window.findElement(By.xpath("//input[@name='title']")).getAttribute("value")); window.manage().timeouts().implicitlyWait(40, TimeUnit.SECONDS); window.findElement(By.id("update")).click(); window.manage().timeouts().implicitlyWait(40, TimeUnit.SECONDS); window.close(); Html Code for the webelement- 1.6YR Experiance/BSC(CS) [Edit] Below code is for the button which is giving problem [Edit]
has title: Sometime Webdriver not able to find webelement and throw nosuchelementexception but many times same test runs perfectly

http://stackoverflow.com/a/24345752
type: Answer
score: 11
has comment: http://stackoverflow.com/comment/37662260
upvote count: 11
has body: Don't use ON operator if the relationship is already defined on the entity object, or at least put ON clause only for custom ON filter. The ORM already knows how two entities are linked together using the mapping of the association, so the syntaxically correct query is select sl from Sensorlist sl // why select each and every field instead of selecting the entity? left outer join sl.sensorTagsCollection st where st.sensorId is null I'm not sure I understand what you're trying to achieve with this query though If the goal is to find the SensorList having no tag, the query should be select sl from Sensorlist sl where sl.sensorTagsCollection is empty Side note: you should really fix your naming. You don't say "Hello mister, what's your mister name?". So why would you say sensorList.getSlName() instead of simply sensorList.getName()?
downvote count: 0
answers question: http://stackoverflow.com/q/24344842

http://stackoverflow.com/q/24329643
favorite count: 0
type: UnansweredQuestion
has body: So I have been working on a web service which communicates between the client and server. It fully works on my computer and am able to send requests from client to server while not in the same package. I am hosting my service like: public class WebServiceServer { public static void main(String[] args) { String bindingURI = "http://localhost:4040/absolute/uploadService"; FileReceive service = new FileReceiveImpl(); Endpoint.publish(bindingURI, service); System.out.println("Server started at: " + bindingURI); } } And my client connects to my service like: public static void main(String args[]) throws Exception { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.getInInterceptors().add(new LoggingInInterceptor()); factory.getOutInterceptors().add(new LoggingOutInterceptor()); factory.setServiceClass(FileReceive.class); factory.setAddress ("http://localhost:4040/absolute/uploadService"); FileReceive client =(FileReceive) factory.create(); From this point I would like to make the web-service public(able to connect from outside of the local-host). I installed ruby and ruby gems only to find out the local-tunnel is no longer available. I have then moved to using ngrok which forwarded a URL for me, but I cannot get any post requests to go through to it(as if it was my web-service) only get methods as I type the URL into my web-browser. Is anyone aware of any easier to use hosting services so that someone (outside of local-host) can post a file to my web-service? Thanks.
has comment: http://stackoverflow.com/comment/37611102
tagged with: web-services
has comment: http://stackoverflow.com/comment/37623264
tagged with: localhost
answer count: 0
tagged with: java
has title: Hosting a java made webservice
upvote count: 1
tagged with: eclipse
type: Question
tagged with: ngrok
has comment: http://stackoverflow.com/comment/37610286
downvote count: 0
score: 1

http://stackoverflow.com/a/24824562
type: Answer
answers question: http://stackoverflow.com/q/24369502
has body: Do you use preview? do you work with full size? If you work with full size you need to create preview in background. If it is possible to create preview in background create it for first time and then create preview only for new image.
score: 0

http://stackoverflow.com/a/24364359
has body: You don't have to do anything, the polling example specifically states that: By doing this the browser will poll the server each "timeout" ms and retrieve any possibly pending changes So, whatever you did in you application will be updated on the client browser when the next polling occurs. In the example you should see that label being displayed 5 seconds later after the UI has loaded, without any special user interaction. However if you need to execute some code with each such request, then you can add a pollingListener @Override protected void init(VaadinRequest request) { setPollInterval(1000); addPollListener(new UIEvents.PollListener() { @Override public void poll(UIEvents.PollEvent event) { log.debug("Polling"); } }); }
accepted answer of: http://stackoverflow.com/q/24363588
has comment: http://stackoverflow.com/comment/61340026
score: 7
answers question: http://stackoverflow.com/q/24363588
has comment: http://stackoverflow.com/comment/61318991
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/61335533
has comment: http://stackoverflow.com/comment/61339827
upvote count: 7

http://stackoverflow.com/comment/37674902
type: AnswerComment
has text: And how is that relevant to the answer? Any matching delimiter just causes LHS token into resulting array.
score: 0
comment on: http://stackoverflow.com/a/24364213
type: Comment

http://stackoverflow.com/comment/37735392
type: QuestionComment
has text: Yes, you can use `indexOf` which searches for where those Strings are.
type: Comment
comment on: http://stackoverflow.com/q/24396200
score: 0

http://stackoverflow.com/comment/83845178
has text: awesome! Don't need it anymore, but just what I was looking for long ago :)
type: AnswerComment
comment on: http://stackoverflow.com/a/48424996
score: 0
type: Comment

http://stackoverflow.com/comment/38944335
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24332302
has text: use a static connection then you use one connection .it's like you use one water pipe for get water from a well.if you open connection and close them it's like you use one pipe but put a tube get water and pullout it.again input pipe then get water then remove it and so on.and if you open connection without closing you fill your well with pipes.best way is to use a static connection

http://stackoverflow.com/a/24410360
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/37782504
answers question: http://stackoverflow.com/q/24384203
upvote count: 2
has comment: http://stackoverflow.com/comment/37831838
has body: From the documentation of Tokenizer#caseInsensitive: org.codehaus.jparsec.Terminals public static Terminals caseInsensitive(String[] ops, String[] keywords) Returns a Terminals object for lexing and parsing the operators with names specified in ops, and for lexing and parsing the keywords case insensitively. Keywords and operators are lexed as Tokens.Fragment with Tokens.Tag.RESERVED tag. Words that are not among keywords are lexed as Fragment with Tokens.Tag.IDENTIFIER tag. A word is defined as an alphanumeric string that starts with [_a - zA - Z], with 0 or more [0 - 9_a - zA - Z] following. Actually, the result returned by your parser is a Fragment object which is tagged according to its type. In your case, d is tagged as IDENTIFIER which is expected. It is not clear to me what you want to achieve though. Could you please provide a test case ?
downvote count: 0

http://stackoverflow.com/comment/37643924
has text: This is a `double`. Basically, if there's no letter suffix (like L or F) then a number literal is `int` if there's no decimal point, or `double` if there is a decimal point.
score: 4
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24347965

http://stackoverflow.com/q/24423779
downvote count: 0
has comment: http://stackoverflow.com/comment/37787138
has comment: http://stackoverflow.com/comment/37788834
has comment: http://stackoverflow.com/comment/37786576
has title: How do I insert data from mysql into the combobox?
favorite count: 0
has comment: http://stackoverflow.com/comment/37786670
has comment: http://stackoverflow.com/comment/37787221
accepted answer: http://stackoverflow.com/a/24424210
tagged with: jdbc
tagged with: jcombobox
has body: What's wrong with my code here? I'm trying to insert data from the mysql into the combobox in netbean private void btnSandoghMousePressed(java.awt.event.MouseEvent evt) { try { String query = "SELECT `AccountType` FROM `account`"; con = Connect.ConnectDB(); PreparedStatement stm = con.prepareStatement(query); pst = con.prepareStatement(query); ResultSet rs = pst.executeQuery(query); ArrayList&lt;String&gt; groupNames = new ArrayList&lt;String&gt;(); while (rs.next()) { String groupName = rs.getString(4); groupNames.add(groupName); } DefaultComboBoxModel model = new DefaultComboBoxModel(groupNames.toArray()); cmbSemetarID.setModel(model); rs.close(); } catch (SQLException e) { System.err.println("Connection Error! it's about date"); } }
has comment: http://stackoverflow.com/comment/37787899
tagged with: swing
type: AnsweredQuestion
upvote count: 5
tagged with: java
tagged with: comboboxmodel
possible better answer: http://stackoverflow.com/a/24424223
has comment: http://stackoverflow.com/comment/37787821
has answer: http://stackoverflow.com/a/24424210
has answer: http://stackoverflow.com/a/24424223
has comment: http://stackoverflow.com/comment/37787544
type: Question
answer count: 2
score: 5
has comment: http://stackoverflow.com/comment/37786753

http://stackoverflow.com/comment/37527097
type: QuestionComment
has text: @sp00m no I'd like to pass the objects myself. These are not objects that can be autowired.
comment on: http://stackoverflow.com/q/24286546
score: 0
type: Comment

http://stackoverflow.com/a/24386739
score: 2
has comment: http://stackoverflow.com/comment/37829370
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37896485
upvote count: 2
has body: The BSON Date data type that MongoDB uses is simply a 64-bit integer count of milliseconds since UTC Jan 1, 1970. So if you want to track a time stamp's original time zone you'd have to store that separately as it's lost when converted to Date.
accepted answer of: http://stackoverflow.com/q/24386239
answers question: http://stackoverflow.com/q/24386239

http://stackoverflow.com/comment/37540376
has text: I couldn't get you...Can you explain?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24293386

http://stackoverflow.com/comment/37647754
type: AnswerComment
comment on: http://stackoverflow.com/a/24349784
score: 0
type: Comment
has text: What is error ? can you write stacktrace. Also can you share your entity class?

http://stackoverflow.com/comment/104139055
type: AnswerComment
comment on: http://stackoverflow.com/a/32811065
type: Comment
has text: how do i set the JAVA_HOME path for the openjdk8??
score: 3

http://stackoverflow.com/a/24341526
has body: I'll give you a +1 to avoid your question to be taken for a wrong one. It's actually a valid one. What you probably don't understand it's the design pattern Android uses to create most if it's components. If you have a Java background you are then familiar with instantianting an object and changing their properties like: JFrame f = new JFrame() f.setSize(new Dimension(50,50)); f.setVisible(true) // etc Android's design pattern is a bit different. I'd call it Template/Inheritance since most of the time you're going to be subclassing android components, BUT ALSO OVERRIDING IT'S DEFAULT IMPLEMENTATION like this: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } You're actually inheriting a template (In this case Activity) and then adding your own logic inside the template. To understand what does this method does, you do need to read the documentation so you learn what are they used for: http://developer.android.com/reference/android/app/Activity.html So, now to answer your ACTUAL question, the class Activity, when instantiated, calls onCreate() method. so in that code you're overriding what this method does, and setting it to do: by calling super.onCreate(): it does what the default implementation do By adding any extra code like setContentView(): you add some custom code to the template
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/24341324
upvote count: 1

http://stackoverflow.com/q/24342963
score: 9
type: Question
has answer: http://stackoverflow.com/a/28618460
answer count: 2
has answer: http://stackoverflow.com/a/24343477
tagged with: java
has body: I keep getting the following error: Failed to instantiate SLF4J LoggerFactory Reported exception: java.lang.NoClassDefFoundError: org/slf4j/spi/LoggerFactoryBinder at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:270) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1562) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1420) at org.slf4j.LoggerFactory.bind(LoggerFactory.java:129) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108) at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:302) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:276) at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:156) at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132) at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:274) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:282) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4830) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5276) at org.apache.catalina.uti…
tagged with: jakarta-ee
upvote count: 9
has title: Tomcat ClassNotFoundException: org.slf4j.spi.LoggerFactoryBinder but slf4j is in libs
downvote count: 0
type: UnansweredQuestion
tagged with: tomcat
tagged with: slf4j
favorite count: 0

http://stackoverflow.com/q/24370937
has answer: http://stackoverflow.com/a/24371289
has answer: http://stackoverflow.com/a/24371238
score: 0
answer count: 2
has title: Using ReadFully in java
type: UnansweredQuestion
has body: I am using Readfully in java to read a file. The below code illustrates it. import java.io.*; public class RandomAccessFileDemo { public static void main(String[] args) { try { // create a string and a byte array // create a new RandomAccessFile with filename test RandomAccessFile raf = new RandomAccessFile("/home/mayank/Desktop/Image/Any.txt", "rw"); // set the file pointer at 0 position raf.seek(0); int Length = (int)raf.length(); // create an array equal to the length of raf byte[] arr = new byte[Length]; // read the file raf.readFully(arr,0,Length); // create a new string based on arr String s2 = new String(arr); // print it System.out.println("" + s2); } catch (IOException ex) { ex.printStackTrace(); } } } The contents of Any.txt is Hello World!! The above code prints Hello World!! but when I change raf.readFully(arr,0,Length); to raf.readFully(arr,3,Length-3); Instead of getting the output lo World!!, I get no error. Can any one explain me how to use readfully. Or how to get the output lo World!!?
has comment: http://stackoverflow.com/comment/37687878
tagged with: java
has comment: http://stackoverflow.com/comment/37688020
type: Question

http://stackoverflow.com/comment/37490578
has text: take a look at my BeanX class the setName is right there with an String argument, I believe this exception is wrong because everything is correct. u check it in your machine I even get the value of name when I call getName method using reflection ;)
comment on: http://stackoverflow.com/q/24267286
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37553220
comment on: http://stackoverflow.com/q/24300238
score: 0
has text: exceptional,case will be treated as two words when you split using comma as a separator.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37674343
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24363562
has text: I have an android Wallpaper app and I wish to put push notificiations into this. But i have no idea how to put
score: 0

http://stackoverflow.com/comment/37719303
score: 2
has text: Eclipselink also needs load time weaving (by default). There's a way to do compile time weaving but I've never messed with it.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24387356

http://stackoverflow.com/a/24340273
answers question: http://stackoverflow.com/q/24340243
score: 0
type: Answer
has body: There is no magical built-in function for that. You will need to implement one yourself. Just create int[] and iterate through string[] and in every iteration parse the string and save it into the new array matching index, when you finish just return the new int[] array.

http://stackoverflow.com/q/24373063
has comment: http://stackoverflow.com/comment/37698362
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37691983
has comment: http://stackoverflow.com/comment/37698477
type: Question
tagged with: jdbc
has answer: http://stackoverflow.com/a/24373160
has comment: http://stackoverflow.com/comment/37692688
has body: I want to update my Database When i enter the customer id in jTextbox after that pressing JButton OK then all respective data is extract from the Database is display in the remaining jTextfield in code After displaying all respective database of that particular customer id that again edited for updation purpose then after clicking on the Update JButton all respective data is updated respective customer id import java.awt.Container; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.*; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.*; public abstract class customer_details extends JFrame implements ActionListener { JTextField textFieldId; JTextField textFieldId1; JTextField textFieldId2; JTextField textFieldId3; JLabel l1; JLabel l2; JLabel l3; JLabel l4; JLabel l5; JButton b1,b2; Container c = getContentPane(); customer_details() { super("Shree Datta Digambar"); setBounds(140,250,777,555); c.setLayout(null); textFieldId = new JTextField(); textFieldId1 = new JTextField(); textFieldId2 = new JTextField(); textFieldId3 = new JTextField(); this.setExtendedState(JFrame.MAXIMIZED_BOTH); l1 = new JLabel("Update Customer Details:-"); l2 = new JLabel("Customer Id"); l3 = new JLabel("Customer Id"); l4 = new JLabel("Name"); l5 = new JLabel("Contact"); l1.setBounds(10,10,340,20); l2.setBounds(10,20,140,70); l3.setBounds(10,100,140,70); l4.setBounds(100,100,140,70); l5.setBounds(270,100,140,70); textFieldId.setBounds(10,70,70,20); textFieldId1.setBounds(10,160,70,20); textFieldId2.setBounds(100,160,150,20); textFieldId3.setBounds(270,160,90,20); b1 = new JButton("Ok"); b1.setBounds(100,70,50,20); b2 = new JButton("Update"); b2.setBounds(380,160,90,20); c.add(b1); c.add(b2); c.add(l1); c.add(l2); c.add(l3); c.add(l4); c.add(l5); c.add(textFieldId); c.add(textFieldId1); c.add(textFieldId2); c.add(textFieldId3); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); b1.addActionListener(this); b2.addAct…
upvote count: 2
tagged with: java
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/37698372
has comment: http://stackoverflow.com/comment/37692494
accepted answer: http://stackoverflow.com/a/24373160
has title: update using prepared statement
type: AnsweredQuestion
tagged with: sql

http://stackoverflow.com/a/24339574
has comment: http://stackoverflow.com/comment/37630948
has comment: http://stackoverflow.com/comment/37630747
has comment: http://stackoverflow.com/comment/37630296
score: 0
has comment: http://stackoverflow.com/comment/37631020
has comment: http://stackoverflow.com/comment/37630985
type: Answer
has body: This is your edited SecondActivity.java public class SecondActivity extends Activity { Button saveBtn, cancelBtn, addBtn; RelativeLayout layout; EditText third, first, second; LinearLayout Container; int counter = 0; int all = 0; int tag = 0; ArrayList&lt;Integer&gt; dynamicLayoutsTags; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.second_activity); saveBtn = (Button) findViewById(R.id.save); cancelBtn = (Button) findViewById(R.id.cancel); Container = (LinearLayout) findViewById(R.id.container); addBtn = (Button) findViewById(R.id.addBtn); saveBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (dynamicLayoutsTags.size() &gt; 0) { for (int i = 0; i &lt; dynamicLayoutsTags.size(); i++) { View getView = Container .findViewWithTag(dynamicLayoutsTags.get(i)); EditText editText1 = (EditText) getView .findViewById(R.id.editText1); EditText editText2 = (EditText) getView .findViewById(R.id.editText2); EditText editText3 = (EditText) getView .findViewById(R.id.editText3); Toast.makeText( SecondActivity.this, "Row " + i + " : " + "editext 1 is : " + editText1.getText() + " editext 2 is : " + editText2.getText() + " editext 3 is : " + editText3.getText(), Toast.LENGTH_LONG).show(); } } Intent intent = new Intent(SecondActivity.this, MainActivity.class); startActivity(intent); Toast.makeText(SecondActivity.this, "The Result: " + all, Toast.LENGTH_LONG).show(); finish(); } }); cancelBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(SecondActivity.this, MainActivity.class); startActivity(intent); finish(); } }); addBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { LayoutInflater layoutInflater = (LayoutInflater) getBaseContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View addView = layoutInflater.inflate(R.layout.row, null); Button button…
accepted answer of: http://stackoverflow.com/q/24339486
has comment: http://stackoverflow.com/comment/37630226
has comment: http://stackoverflow.com/comment/37627377
has comment: http://stackoverflow.com/comment/37627403
has comment: http://stackoverflow.com/comment/37630552
has comment: http://stackoverflow.com/comment/37630393
has comment: http://stackoverflow.com/comment/37630968
has comment: http://stackoverflow.com/comment/37630251
has comment: http://stackoverflow.com/comment/37630333
answers question: http://stackoverflow.com/q/24339486
type: AcceptedAnswer

http://stackoverflow.com/comment/37757725
comment on: http://stackoverflow.com/a/24405079
has text: I am not sure if it fits the performance requisites but, as you already indicated, it's a good start. It works perfectly. I will now try to reduce the work needed to make the conversion. Thanks!
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24363087
has body: From the source code of BufferedInputStream : public void close() throws IOException { byte[] buffer; while ( (buffer = buf) != null) { if (bufUpdater.compareAndSet(this, buffer, null)) { InputStream input = in; in = null; if (input != null) input.close(); return; } // Else retry in case a new buf was CASed in fill() } } So the answer would be : YES
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 29
upvote count: 29
accepted answer of: http://stackoverflow.com/q/24362980
answers question: http://stackoverflow.com/q/24362980

http://stackoverflow.com/comment/37666148
has text: OK, I just switched to forward slashes and that worked. :) Read another post about how it was a relative path and such and just moved the images into the folder with the class files (and the java files) and it all worked. now just have to fix the setIcon methods to change the buttons up when they need it and I'm home free. :)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24347360

http://stackoverflow.com/q/24295031
type: Question
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/37543609
tagged with: adt
has body: So I created a new project via Eclipse ADT and my app won't run, here is some useful info about it. I would be very grateful if you'd solve it. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } final TextView answer = (TextView) findViewById(R.id.textView1); Button askButton = (Button) findViewById(R.id.button1); askButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub answer.setText("veik"); } }); } This is the only part of MainActivity.java that was edited, here is the edited part of xml file: &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:text="Button" /&gt; And lastly, message of LogCat: 06-19 00:04:56.740: D/AndroidRuntime(7026): Shutting down VM 06-19 00:04:56.740: W/dalvikvm(7026): threadid=1: thread exiting with uncaught exception (group=0x41760ba8) 06-19 00:04:56.740: E/AndroidRuntime(7026): FATAL EXCEPTION: main 06-19 00:04:56.740: E/AndroidRuntime(7026): Process: com.example.babyplease, PID: 7026 06-19 00:04:56.740: E/AndroidRuntime(7026): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.babyplease/com.example.babyplease.MainActivity}: java.lang.NullPointerException 06-19 00:04:56.740: E/AndroidRuntime(7026): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2198) 06-19 00:04:56.740: E/AndroidRuntime(7026): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2248) 06-19 00:04:56.740: E/AndroidRuntime(7026): at android.app.ActivityThread.access$800(ActivityThread.java:138) 06-19 00:04:56.740: E/AndroidRuntime(7026): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1199) 06…
has comment: http://stackoverflow.com/comment/37543565
score: 0
has comment: http://stackoverflow.com/comment/37543542
duplicate of: http://stackoverflow.com/q/23653778
answer count: 1
has title: setOnClickListeners() crashes my app
linked to: http://stackoverflow.com/q/23653778
has comment: http://stackoverflow.com/comment/37543555
type: UnansweredQuestion
tagged with: android
duplicate of: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/37543624
has answer: http://stackoverflow.com/a/24295259
tagged with: java

http://stackoverflow.com/a/24374455
type: Answer
score: 1
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24374382
answers question: http://stackoverflow.com/q/24374382
upvote count: 1
type: AcceptedAnswer
has body: The second argument of Substring is not the index of the last character you want, it's the number of characters you want. So, if you want the first two characters after X, use a count of 2. key.Substring(key.Length -6, length: 2)

http://stackoverflow.com/comment/37640529
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24346186
type: QuestionComment
has text: Thanks for the link. However, I understand what a NPE is. What I don't understand is why it happened in this instance.

http://stackoverflow.com/q/24275783
tagged with: listview
answer count: 1
favorite count: 0
tagged with: swt
tagged with: jface
has comment: http://stackoverflow.com/comment/37513073
has comment: http://stackoverflow.com/comment/37517954
has answer: http://stackoverflow.com/a/24281890
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24281890
upvote count: 1
type: Question
has body: I have 2 Wizard pages and a ListViewer in both the pages. In the first Wizard Page I have a ListViewer wherein If I select the items from the ListViewer of the 1st Wizard page and Click "Next" button then these selected items are brought to the second Wizard page and displayed in the ListViewer of the Second Wizard page. Everything is fine until now, my problem is : If I click "Back" button from the 2nd Wizard page and once again make selections of same items that I had selected for the first time and then click "Next" button then in the 2nd page's list viewer duplicate items are being displayed, each item of the 1st Wizard page is being displayed twice. Once again If I go back to previous wizard page and select the same items and again click "Next" then each item displays thrice in the list viewer of Second wizard page. Is there a way to clear the contents of a list viewer prior to setting input? If I could clear all the contents of the List viewer prior to setting input then I could avoid duplicate items being displayed in the 2nd Wizard page. I know to clear contents through selecting items in the viewer but how do I clear all the contents of a viewer without making selections or without using a selection listener? Someone Please help me here,Any suggestions would be appreciated. Thanks.
has title: JFace : Clear contents of a ListViewer prior to setting input.(Clear all the contents without using Selection listener)
downvote count: 0
has comment: http://stackoverflow.com/comment/37517940

http://stackoverflow.com/a/24373888
has body: You can use Guava or diamond operator to avoid typos and writing same twice. For example: Map1 Map&lt;String, String&gt; innerMap = new HashMap&lt;String, String&gt;(); changes to: Map&lt;String, String&gt; innerMap = new HashMap&lt;&gt;(); // Diamond operator Map&lt;String, String&gt; innerMap2 = Maps.newHashMap(); // Using Guava Or Map3 Map&lt;Map&lt;Map&lt;String,String&gt;, List&gt;, List&gt; returnValueMap = new HashMap&lt;Map&lt;Map&lt;String,String&gt;, List&gt;, List&gt;(); changes to Map&lt;Map&lt;Map&lt;String,String&gt;, List&gt;, List&gt; returnValueMap = new HashMap&lt;&gt;(); // Diamond operator Map&lt;Map&lt;Map&lt;String,String&gt;, List&gt;, List&gt; returnValueMap2 = Maps.newHashMap(); // Using Guava
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24373663
score: 1
upvote count: 1

http://stackoverflow.com/q/24327031
has comment: http://stackoverflow.com/comment/37832744
score: 2
tagged with: android
tagged with: android-activity
has answer: http://stackoverflow.com/a/24327108
favorite count: 0
type: Question
upvote count: 2
tagged with: multithreading
has body: I have started to use the event bus library Otto for updating the interface (activities) from different components in my Android application. For instance, when a change to a Model class is made, I post to the event bus or if an AsyncTask has finished, I post an event to the event bus in the onPostExecute method. So far I am using one event bus for user interface updates. I noticed that even paused activities receive these events yet. In the documentation it states The paused activity does not receive user input and cannot execute any code. Which I find controversial, I can only explain this, that this code is of course executed on a different thread, but still in the activity. My question is, does this usage result in any disadvantages? Having multiple activies being paused, executing events, updating elements of (paused) activities or ignoring them. Does this result in a noticeable overhead or can I ignore it? Is there a different approach when one wants to use event bus for updating the interface?
answer count: 1
has comment: http://stackoverflow.com/comment/37733388
tagged with: java
tagged with: otto
has title: Disadvantages of using an event bus to update the interface?
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/37543566
score: 0
type: AnswerComment
type: Comment
has text: and also why the second program works fine...they are on the same line I guess?
comment on: http://stackoverflow.com/a/24294994

http://stackoverflow.com/q/24361230
has comment: http://stackoverflow.com/comment/37670745
upvote count: 1
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: jtable
tagged with: listselectionlistener
has title: JTable component access before row selection
has comment: http://stackoverflow.com/comment/37669734
score: 1
has comment: http://stackoverflow.com/comment/37669880
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37669771
tagged with: swing
has body: I'm using a jtable and i need to access a component locate in a row different from the selected one. The problem i have is that when i click the component the row selection change come before the component click event. This is a SSCE that explain the problem. package test; import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.AbstractCellEditor; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JTable; import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; public class Main extends JFrame { public static void main(String[] args) { new Main(); } public Main() { JButton btnTest = new JButton("test"); btnTest.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.err.println("btnTest clicked!"); } }); JButton btnTest2 = new JButton("test2"); btnTest2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.err.println("btnTest2 clicked!"); } }); JTable table = new JTable(new Object[][] { { btnTest, "test"}, { btnTest2, "test2"}, }, new Object[] {"btn", "desc"}); table.setDefaultEditor(Object.class, new Editor()); table.setDefaultRenderer(JComponent.class, new TableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { return (JComponent)(value); } }); ListSelectionModel rowSM = table.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { System.err.println("new Selection!"); } }); table.setSelectionModel(rowSM); add(table); setSize(300, 300); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setVisible(true); } class Editor …
tagged with: java

http://stackoverflow.com/comment/37531735
has text: Dam that's too much for my current knowledge. I think im getting it +- but theres something wrong, maybe I didnt explained myself correctly. A and B are not types, they are X objects, where we have A and B we could have Ants and Burps, it's just a name, not a type. Maybe I messed up with capital leter. My bad, but im really apreciated for your effort.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24288511

http://stackoverflow.com/a/25233202
answers question: http://stackoverflow.com/q/24267376
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Found the reason. There's a bug in Spring Web 3.1.x where it attempts to close the stream twice. The bug was fixed in Spring Web 3.2.x. Most application servers will not log an error in this situation (as it's actually completely harmless), but WebSphere Liberty freaks out.
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24267376
score: 3

http://stackoverflow.com/q/24340276
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24340651
type: Question
has comment: http://stackoverflow.com/comment/77166175
has answer: http://stackoverflow.com/a/51463120
has answer: http://stackoverflow.com/a/24340289
has answer: http://stackoverflow.com/a/24340321
has title: Android new activity not starting
downvote count: 0
tagged with: android-activity
favorite count: 0
has answer: http://stackoverflow.com/a/24340292
has body: I wrote this code following the skeleton of Reto Meier's "Professional Android 4 Application Development" and some slide of my professor, but i can't understand why the new activity (PreferencesActivity, fully coded) is not starting and is not raising any kind of errors: in the VM it just won't do anything when i press "Preferences" in the standard android menu I created. I added the new activity in app's manifest correctly (just name, label, theme and screen orientation). Here's the code public class MainActivity extends Activity implements OnClickListener, OnValueChangeListener { static final private int MENU_PREFERENCES = Menu.FIRST+1; ... @Override public boolean onCreateOptionsMenu(Menu menu){ super.onCreateOptionsMenu(menu); menu.add(0, MENU_PREFERENCES, Menu.NONE, "Preferences"); return true; } public boolean onOptionsitemSelected(MenuItem item) { super.onOptionsItemSelected(item); switch(item.getItemId()) { case (MENU_PREFERENCES): { Intent i = new Intent(this, PreferencesActivity.class); startActivity(i); return true; } } return false; } ... } The only strange thing I get is this warning in Logcat 06-20 14:50:49.760: W InputManagerService(699): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@41219950
answer count: 5
type: UnansweredQuestion
tagged with: android
tagged with: android-intent

http://stackoverflow.com/a/24366598
has comment: http://stackoverflow.com/comment/37679653
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/24361562
score: 2
accepted answer of: http://stackoverflow.com/q/24361562
has comment: http://stackoverflow.com/comment/37679983
has comment: http://stackoverflow.com/comment/37684714
downvote count: 0
has comment: http://stackoverflow.com/comment/37683862
type: AcceptedAnswer
has body: Take a look at the list of Camel Components. Not knowing what type of data you are sending between services, it is difficult to recommend which one to use. However, theres a component for pretty much every data type you can imagine, and even support to make your own! Edit An example might be: &lt;route&gt; &lt;from uri="direct:textmsgClient"/&gt; &lt;log message="Test log"/&gt; &lt;to uri="direct:textmsgServer"/&gt; &lt;/route&gt;

wifi
tag name: wifi
type: Tag
tags question: http://stackoverflow.com/q/24357892

http://stackoverflow.com/comment/37692893
has text: @ColinD---Well the question which you people have referred has only subpart of answer.Kindly open the question to be answered,else it will be considered monopoly of `higher rated professionals` on Stack Overflow!
comment on: http://stackoverflow.com/q/24373577
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37653292
score: 1
comment on: http://stackoverflow.com/q/24352822
has text: Which type of problems are you thinking of?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24271052
has title: Java loop not iterating
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24271107
possible better answer: http://stackoverflow.com/a/24271164
has comment: http://stackoverflow.com/comment/37499211
favorite count: 0
type: Question
answer count: 2
tagged with: android
accepted answer: http://stackoverflow.com/a/24271107
tagged with: java
has body: I am getting an IndexOutOfBounds error out of this code: Log.w("aa", "line size: " + line.getSize()); for ( a = line.getSize() - 1; a &gt;= 0; a--); test(a, line); } public void test(int a, LineCreator line){ Log.w("AA", "a equals: " + a); int test = line.getSquare(a); } 06-17 21:31:42.169 421-442/com.Nuotta W/aa﹕ line size: 3 06-17 21:31:42.169 421-442/com.Nuotta W/AA﹕ a equals: -1 The line size that it gets is 3. But it gives out a -1. LineCreator is an object of mine. It has very simple methods getSize which just returns Array.length and getSquare(x) which returns ArrayList.get(x) They work in every other place but not here.
tagged with: loops
upvote count: 1
has comment: http://stackoverflow.com/comment/37497699
downvote count: 7
score: -6
has answer: http://stackoverflow.com/a/24271164
has comment: http://stackoverflow.com/comment/37497738
tagged with: for-loop

http://stackoverflow.com/comment/37741088
type: Comment
has text: When I say it isnt being updated, I mean when I check my file on my dropbox. Also, on the right side of the screen it should say, "File ___ has been updated to its latest," however it doesnt.
comment on: http://stackoverflow.com/q/24398912
score: 0
type: QuestionComment

http://stackoverflow.com/q/24294051
has comment: http://stackoverflow.com/comment/37541589
linked to: http://stackoverflow.com/q/1732348
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37541686
accepted answer: http://stackoverflow.com/a/24294668
has comment: http://stackoverflow.com/comment/37541644
tagged with: regex
has body: Hi I'm having some trouble with parsing some data from a web source between two "tags" Here's what a sample of the web source and the code I'm using to try and parse it. &lt;div class="ProfileTweet-contents"&gt; &lt;p class="ProfileTweet-text js-tweet-text u-dir" dir="ltr"&gt;Come join us now! &lt;a href="http://t.co/Kbhh2ed" rel="nofollow" dir="ltr" data-expanded-url="http://forum.epicurus-pk.com/" class="twitter-timeline-link" target="_blank" title="http://www.google.com" &gt;&lt;span class="tco-ellipsis"&gt;&lt;/span&gt;&lt;span class="invisible"&gt;http://&lt;/span&gt;&lt;span class="js-display-url"&gt;www.google.com&lt;/span&gt;&lt;span class="invisible"&gt;/&lt;/span&gt;&lt;span class="tco-ellipsis"&gt;&lt;span class="invisible"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; &lt;a href="http://t.co/jIw2344dDZz" class="twitter-timeline-link u-isHiddenVisually" data-pre-embedded="true" dir="ltr" &gt;pic.twitter.com/jIwtc23juZz&lt;/a&gt;&lt;/p&gt; Code while ((line = in.readLine()) != null) { Pattern pattern = Pattern.compile("dir=.?!&lt;a href="); Matcher matcher = pattern.matcher(line); while (matcher.find()) { tweets[0] = matcher.group(); System.out.println(matcher.group()); } } The item of data I'm trying to fetch is the following dir="ltr"&gt;Come join us now! &lt;a href= For some reason it's not fetching the data inbetween dir= and &lt; a href Another working example which is parsing the web source just fine URL addr = new URL(url); URLConnection con = addr.openConnection(); ArrayList&lt;String&gt; data = new ArrayList&lt;String&gt;(); BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) { Pattern p = Pattern.compile("&lt;span itemprop=.*?&lt;/span&gt;"); Pattern p2 = Pattern.compile("&gt;.*?&lt;"); Matcher m = p.matcher(inputLine); Matcher m2; while (m.find()) { m2 = p2.matcher(m.group()); while (m2.find()) { data.add(m2.group().replaceAll("&lt;", "").replaceAl…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37541703
has comment: http://stackoverflow.com/comment/37541676
has comment: http://stackoverflow.com/comment/37541626
possible better answer: http://stackoverflow.com/a/24294126
type: Question
has answer: http://stackoverflow.com/a/24294668
has answer: http://stackoverflow.com/a/24294126
tagged with: java
has title: What's the correct regex to use for parsing data from a webpage source between tags?

http://stackoverflow.com/comment/37655767
comment on: http://stackoverflow.com/q/24347157
type: Comment
type: QuestionComment
score: 0
has text: so i should put the data from the csv file into a database?

http://stackoverflow.com/a/24281729
has comment: http://stackoverflow.com/comment/37517987
answers question: http://stackoverflow.com/q/24281528
type: AcceptedAnswer
downvote count: 0
has body: Tomcat server configuration has it's listening port to 8080 by default. You can find the configuration in server.xml located in conf directory and change the port if you like. It would look like &lt;Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /&gt; Change the port attribute as you like. If you want to change the port in eclipse embedded tomcat server, then Open the Servers and browse the configured tomcat directory listed in it. You will see server.xml. Change the port in it and re-run mvn As said by @Gimby, I really the missed the point. But, still the port settings in server.xml is also a place for problems. Try deleting the server configuration and recreate in eclipse and check the correct port is mentioned. If everything is mentioned correct, I think you need to set this property maven.tomcat.port to 8081 like mvn tomcat7:run -Dmaven.tomcat.port=8081 That may solve the problem
has comment: http://stackoverflow.com/comment/37521073
type: Answer
has comment: http://stackoverflow.com/comment/37518072
score: 1
has comment: http://stackoverflow.com/comment/37517988
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24281528

cosign-api
tags question: http://stackoverflow.com/q/24299584
tag name: cosign-api
type: Tag

http://stackoverflow.com/comment/37664040
comment on: http://stackoverflow.com/a/24358074
type: Comment
score: 0
type: AnswerComment
has text: @PerryMonschau i like your comment. It make sense to me

http://stackoverflow.com/q/24304427
tagged with: automation
has answer: http://stackoverflow.com/a/26512012
score: -1
upvote count: 0
has answer: http://stackoverflow.com/a/26955535
has answer: http://stackoverflow.com/a/24317026
favorite count: 0
answer count: 9
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/28299730
has answer: http://stackoverflow.com/a/38994285
has answer: http://stackoverflow.com/a/40830144
has comment: http://stackoverflow.com/comment/70735101
has answer: http://stackoverflow.com/a/30104747
has body: I am writing selenium script for Gmail login and logout functionality. I am able to successfully login using below code. //Open gmail driver.get("http://www.gmail.com"); // Enter userd id WebElement element = driver.findElement(By.id("Email")); element.sendKeys("xyz@gmail.com"); //wait 5 secs for userid to be entered driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); //Enter Password WebElement element1 = driver.findElement(By.id("Passwd")); element1.sendKeys("Password"); //Submit button element.submit(); But i could not write a script to logout. Could yu please provide me script for logout? Thanks!
has title: How to logout gmail using selenium script?
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/41770634
downvote count: 1
has comment: http://stackoverflow.com/comment/37573798
type: Question
has answer: http://stackoverflow.com/a/24305183

http://stackoverflow.com/comment/37629919
comment on: http://stackoverflow.com/q/24340973
score: 1
type: Comment
has text: You need not use files, ZipOutputStream on the response.getOutputStream, as the XSLT result.
type: QuestionComment

http://stackoverflow.com/comment/37774720
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24413595
score: 0
has text: The Scheduler is processing the jobs not the SchedulerFactory, isnt it? If you do not start it, it should not process any jobs.

http://stackoverflow.com/q/24269290
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24270179
tagged with: selenium
tagged with: google-chrome
type: Question
has body: I am trying to take full page (without any scroll bar) screenshots using Selenium in Java. My code below is working perfect in Firefox 29. I tested the same code in Chrome 35 and it is taking partial screenshot (not full page, screen with scroll bar) and IE8 is not supporting screen shots with Selenium Drive. File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(scrFile, new File("C://screenshot//" + image1.jpg));
score: 1
tagged with: java
has title: Fullpage Screenshot for IE and Chrome using Selenium JVM
tagged with: cucumber
linked to: http://stackoverflow.com/q/17885169
upvote count: 1
tagged with: firefox
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/41630075

eclipse
tags question: http://stackoverflow.com/q/24413448
tags question: http://stackoverflow.com/q/24286420
tags question: http://stackoverflow.com/q/24298383
tags question: http://stackoverflow.com/q/24305234
tag name: eclipse
tags question: http://stackoverflow.com/q/24417450
tags question: http://stackoverflow.com/q/24279554
tags question: http://stackoverflow.com/q/24402118
tags question: http://stackoverflow.com/q/24339432
tags question: http://stackoverflow.com/q/24355833
tags question: http://stackoverflow.com/q/24337816
tags question: http://stackoverflow.com/q/24382069
tags question: http://stackoverflow.com/q/24372198
tags question: http://stackoverflow.com/q/24425296
tags question: http://stackoverflow.com/q/24415762
tags question: http://stackoverflow.com/q/24305093
tags question: http://stackoverflow.com/q/24388490
tags question: http://stackoverflow.com/q/24421678
tags question: http://stackoverflow.com/q/24362029
tags question: http://stackoverflow.com/q/24357892
tags question: http://stackoverflow.com/q/24306715
tags question: http://stackoverflow.com/q/24281239
tags question: http://stackoverflow.com/q/24316878
tags question: http://stackoverflow.com/q/24416569
tags question: http://stackoverflow.com/q/24316164
tags question: http://stackoverflow.com/q/24415391
tags question: http://stackoverflow.com/q/24315233
tags question: http://stackoverflow.com/q/24300094
tags question: http://stackoverflow.com/q/24301570
tags question: http://stackoverflow.com/q/24294503
tags question: http://stackoverflow.com/q/24351864
tags question: http://stackoverflow.com/q/24294189
tags question: http://stackoverflow.com/q/24339611
tags question: http://stackoverflow.com/q/24346053
tags question: http://stackoverflow.com/q/24416955
tags question: http://stackoverflow.com/q/24278790
tags question: http://stackoverflow.com/q/24405213
tags question: http://stackoverflow.com/q/24292947
tags question: http://stackoverflow.com/q/24402432
tags question: http://stackoverflow.com/q/24398952
tags question: http://stackoverflow.com/q/24282410
tags question: http://stackoverflow.com/q/24426433
tags question: http://stackoverflow.com/q/24289387
tags question: http://stackoverflow.com/q/24370226
tags question: http://stackoverflow.com/q/24268926
tags question: http://stackoverflow.com/q/24282297
tags question: http://stackoverflow.com/q/24378497
tags question: http://stackoverflow.com/q/24372829
tags question: http://stackoverflow.com/q/24376075
tags question: http://stackoverflow.com/q/24421778
tags question: http://stackoverflow.com/q/24288566
tags question: http://stackoverflow.com/q/24304064
tags question: http://stackoverflow.com/q/24297133
tags question: http://stackoverflow.com/q/24339598
tags question: http://stackoverflow.com/q/24303414
tags question: http://stackoverflow.com/q/24269081
tags question: http://stackoverflow.com/q/24324179
tags question: http://stackoverflow.com/q/24282892
tags question: http://stackoverflow.com/q/24356265
tags question: http://stackoverflow.com/q/24412899
tags question: http://stackoverflow.com/q/24385346
tags question: http://stackoverflow.com/q/24398826
tags question: http://stackoverflow.com/q/24351598
tags question: http://stackoverflow.com/q/24385245
tags question: http://stackoverflow.com/q/24384979
tags question: http://stackoverflow.com/q/24320366
tags question: http://stackoverflow.com/q/24378768
tags question: http://stackoverflow.com/q/24411088
tags question: http://stackoverflow.com/q/24340129
tags question: http://stackoverflow.com/q/24342668
tags question: http://stackoverflow.com/q/24371465
tags question: http://stackoverflow.com/q/24321668
tags question: http://stackoverflow.com/q/24303820
tags question: http://stackoverflow.com/q/24393391
tags question: http://stackoverflow.com/q/24408864
tags question: http://stackoverflow.com/q/24328115
tags question: http://stackoverflow.com/q/24304631
tags question: http://stackoverflow.com/q/24413834
tags question: http://stackoverflow.com/q/24337671
tags question: http://stackoverflow.com/q/24423136

http://stackoverflow.com/q/24359036
accepted answer: http://stackoverflow.com/a/24359170
answer count: 1
tagged with: jsp
favorite count: 0
tagged with: http://stackoverflow.com/tag/html
type: AnsweredQuestion
upvote count: 0
has title: Get selected value from dynamic selection list
tagged with: java
downvote count: 1
type: Question
has body: I am working on a jsp project where I have a dynamic selection list. The values in this list change according to the value selected in the 1st selection list. Here's the code: GSM CDMA COMBO OFFER CRICKET ASTRO COMBO OFFER CDMA WIN THE DREAM VOICE CHAT now when the user selects a service, lets say "GSM", and then selects a service from the second list, lets say "ASTRO". He clicks on a button which redirects him to the next page where he sees "ASTRO" printed. This works fine. But if the user selects "CDMA" from the 1st list and then selects, let's say "VOICE CHAT" from the second list. It still prints "ASTRO" on the next page. IT should print "VOICE CHAT". this is the method to submit form: function submitForm(actionStr) { if(actionStr=="User Details") { document.login.action="showUsrDetail.jsp"; document.login.submit(); } } this is the code for the button: then it redirects to the page ""showUsrDetail.jsp". And when it does the name of the service is printed on the console. For which the code is: <% String service = request.getParameter("services"); System.out.println("Value Added Service selected is ="+service); %> if i change the first selection to CDMA and then select any service from the second selection list, it still prints the Service which is under GSM. Can somebody please help me out?
has comment: http://stackoverflow.com/comment/37666008
tagged with: javascript
score: -1
has answer: http://stackoverflow.com/a/24359170

tomcat
tags question: http://stackoverflow.com/q/24325784
tags question: http://stackoverflow.com/q/24359240
tags question: http://stackoverflow.com/q/24346774
tags question: http://stackoverflow.com/q/24409124
tags question: http://stackoverflow.com/q/24380364
tags question: http://stackoverflow.com/q/24404527
tags question: http://stackoverflow.com/q/24282398
tags question: http://stackoverflow.com/q/24406772
tags question: http://stackoverflow.com/q/24347301
tags question: http://stackoverflow.com/q/24388065
tags question: http://stackoverflow.com/q/24333428
tags question: http://stackoverflow.com/q/24386193
tags question: http://stackoverflow.com/q/24404135
tags question: http://stackoverflow.com/q/24425470
tags question: http://stackoverflow.com/q/24363031
tags question: http://stackoverflow.com/q/24310839
tags question: http://stackoverflow.com/q/24331927
tags question: http://stackoverflow.com/q/24398562
tags question: http://stackoverflow.com/q/24376381
tags question: http://stackoverflow.com/q/24294577
tags question: http://stackoverflow.com/q/24350101
tags question: http://stackoverflow.com/q/24299793
tags question: http://stackoverflow.com/q/24401322
tags question: http://stackoverflow.com/q/24270650
tags question: http://stackoverflow.com/q/24390131
tag name: tomcat
tags question: http://stackoverflow.com/q/24363735
tags question: http://stackoverflow.com/q/24280478
tags question: http://stackoverflow.com/q/24335771
tags question: http://stackoverflow.com/q/24357241
tags question: http://stackoverflow.com/q/24269166
tags question: http://stackoverflow.com/q/24330841
tags question: http://stackoverflow.com/q/24398438
tags question: http://stackoverflow.com/q/24337816
tags question: http://stackoverflow.com/q/24382076
tags question: http://stackoverflow.com/q/24281239
tags question: http://stackoverflow.com/q/24271213
tags question: http://stackoverflow.com/q/24375260
tags question: http://stackoverflow.com/q/24323752
tags question: http://stackoverflow.com/q/24386712
tags question: http://stackoverflow.com/q/24389862
tags question: http://stackoverflow.com/q/24415655
tags question: http://stackoverflow.com/q/24312224
tags question: http://stackoverflow.com/q/24339074
tags question: http://stackoverflow.com/q/24318668
tags question: http://stackoverflow.com/q/24311383
tags question: http://stackoverflow.com/q/24391121
tags question: http://stackoverflow.com/q/24382031
tags question: http://stackoverflow.com/q/24298208
tags question: http://stackoverflow.com/q/24349732
type: Tag
tags question: http://stackoverflow.com/q/24410741
tags question: http://stackoverflow.com/q/24342963
tags question: http://stackoverflow.com/q/24422463
tags question: http://stackoverflow.com/q/24327279
tags question: http://stackoverflow.com/q/24271063
tags question: http://stackoverflow.com/q/24319819
tags question: http://stackoverflow.com/q/24385102
tags question: http://stackoverflow.com/q/24359853
tags question: http://stackoverflow.com/q/24340973
tags question: http://stackoverflow.com/q/24301570
tags question: http://stackoverflow.com/q/24277472
tags question: http://stackoverflow.com/q/24373533
tags question: http://stackoverflow.com/q/24282091
tags question: http://stackoverflow.com/q/24378672
tags question: http://stackoverflow.com/q/24403448
tags question: http://stackoverflow.com/q/24416193
tags question: http://stackoverflow.com/q/24279913
tags question: http://stackoverflow.com/q/24281528
tags question: http://stackoverflow.com/q/24301836
tags question: http://stackoverflow.com/q/24385346
tags question: http://stackoverflow.com/q/24412401
tags question: http://stackoverflow.com/q/24394088

http://stackoverflow.com/q/24283666
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/24286686
has answer: http://stackoverflow.com/a/24300058
tagged with: java
type: Question
tagged with: java-5
tagged with: jboss
tagged with: jboss-4.2.x
score: 0
answer count: 2
has title: jaxws-maven-plugin 1.12 generates methods which are not compatible with jdk1.5
has body: I have a maven project where I use the jaxws-maven-plugin as follows: org.codehaus.mojo jaxws-maven-plugin 1.12 wsimport src/main/wsdl MyService.wsdl src/main/java true The project runs with jdk1.5.0_22 and jboss 4.2.2.GA. The problem that I have is that the jaxws-maven-plugin generates code which is not compatible with jdk1.5.0_22 anymore. As a consequence, I get the following error at compilation: cannot find symbol : method getPort(javax.xml.namespace.QName,java.lang.Class<com.example.MyService>,javax.xml.ws.WebServiceFeature[]) location: class javax.xml.ws.Service The project has to run with the above configuration (jdk1.5.0_22 and jboss 4.2.2.GA) under any circumstances, so I cannot upgrade to jdk1.6. Is there any way I can overcome this issue? Thanks in advance for your help.

http://stackoverflow.com/q/24356583
has body: I am trying to make a JFrame and see the progress of the counter. int i = 1; while (i &lt; 100000){ textField.setText(String.valueOf(i)); System.out.println(i); i++; } When I start it I can see the progress at the console but the value of the textField does not change. It changes to 100000 when the loop ends. How can I make it show the progress like in console?
accepted answer: http://stackoverflow.com/a/24356863
answer count: 1
downvote count: 0
favorite count: 0
tagged with: event-dispatch-thread
tagged with: jframe
tagged with: swing
has answer: http://stackoverflow.com/a/24356863
type: AnsweredQuestion
has title: Counter on JFrame
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/a/52350468
upvote count: 10
score: 9
type: Answer
has body: For those of you wondering why some of these years-old answers aren't working, you can learn a lot from the test cases. As of September 2018, here's how you can get Jackson JsonNode results: Configuration jacksonConfig = Configuration.builder() .mappingProvider( new JacksonMappingProvider() ) .jsonProvider( new JacksonJsonProvider() ) .build(); JsonNode node = JsonPath.using( jacksonConfig ).parse(jsonString);
answers question: http://stackoverflow.com/q/24412511
downvote count: 1

http://stackoverflow.com/comment/37658525
has text: @Arkain There's no magic `null` check in an enhanced `for` loop. If there's a null element in a list, it'll get iterated.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24355246
score: 0

http://stackoverflow.com/a/24398589
has comment: http://stackoverflow.com/comment/37842269
has body: try to compile with java 7 or use maven-compiler-plugin-2.1.1 instead Edit: add to your pom file to override the default compilation <defaultOptions> -frontend jaxws21 https://stackoverflow.com/a/17651644/2593751
has comment: http://stackoverflow.com/comment/37812504
has comment: http://stackoverflow.com/comment/137327826
has comment: http://stackoverflow.com/comment/37741428
score: 0
has comment: http://stackoverflow.com/comment/37763709
has comment: http://stackoverflow.com/comment/37842049
answers question: http://stackoverflow.com/q/24397494
type: Answer
has comment: http://stackoverflow.com/comment/37842004
has comment: http://stackoverflow.com/comment/37747995
has comment: http://stackoverflow.com/comment/37842139

http://stackoverflow.com/comment/37757520
type: AnswerComment
has text: I'm new to JSP and I don't know much about the tag library. I'm more comfortable to continue writing java code. Aside from converting to JSTL, is there no suppress warning annotation that would work for the above error?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24402756

http://stackoverflow.com/q/24313542
has answer: http://stackoverflow.com/a/24330519
type: Question
has comment: http://stackoverflow.com/comment/37578022
possible better answer: http://stackoverflow.com/a/24319908
answer count: 3
has answer: http://stackoverflow.com/a/24319908
downvote count: 0
accepted answer: http://stackoverflow.com/a/24330519
favorite count: 0
has comment: http://stackoverflow.com/comment/37578188
has answer: http://stackoverflow.com/a/24313854
has body: I am trying to extract data from tables in a webpage, but I keep pulling up the same information. For example I have each movie in an arraylist, but I want to match each movie with the relevant table data. The problem is, each table has the same class name. I am able to print each movie title, but I'am only pulling MovieOne's table information. Here is a sample of the HTML for movie one and two: MovieOne Movies Genre Time Days Where Date Range Seating Actors Action 10:00 am - 12:00 pm SMTWTHFSA AMC Showplace Aug 20, 2014 - Sept 12, 2014 Reservations Will Ferrel (P) target="Will Ferrel" > MovieTwo Movies Genre Time Days Where Date Range Seating Actors Action 11:00 am - 12:30 pm SMTWTHFSA Showplace Cinemas Aug 20, 2014 - Sept 12, 2014 TBA Zach Galifinakis (P) target="Zach Galifinakis" > Here is what I have been trying(courtesy of Praveen from another one of my question's Extract Text from BR tags): WebElement table =driver.findElement(By.xpath("//table[@class='datadisplaytable']")); WebElement tbody=table.findElement(By.tagName("tbody")); List<WebElement> rows=tbody.findElements(By.tagName("tr")); System.out.println("Row size:"+rows.size()); ArrayList<String> list=new ArrayList<>(); for(int i=0;i<rows.size();i++) { WebElement column = tbody.findElement(By.xpath("//table[@class='datadisplaytable']/tbody/tr[2]/td")); if(column.getText().trim().contains(".")) { System.out.println("text : "+column.getText().trim()); list.add(column.getText().trim()); } } I am also able to get the table information in a string, but I need to keep each table element separate. I could use substrings but information varies, so the string length varies too. Should I use xpath to extract the information, or is there another way?
score: 2
tagged with: xpath
type: AnsweredQuestion
upvote count: 2
linked to: http://stackoverflow.com/q/24289689
tagged with: java
tagged with: selenium
has title: Extract table data with same class names

http://stackoverflow.com/a/24355425
answers question: http://stackoverflow.com/q/24355259
downvote count: 0
has body: You can use Calendar class,basic example would be Calendar calendar = Calendar.getInstance(); int day = calendar.get(Calendar.DAY_OF_WEEK); if(dayOfWeek == Calendar.SUNDAY){ yourTextView.setText("it is sunday"); }
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/24358913
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24358864
downvote count: 0
has body: Unfortunately, that's not exactly how java arrays work. To instantiate and initialize an array use the syntax... String[] t = new String[20]; t[0] = "One"; t[1] = "Two"; or, String[] t = {"One", "Two"}; If you want more control over the array the I'd recommend using an ArrayList object instead where you can add, remove, change, sort the items in the array. For example, ArrayList t = new ArrayList(); t.add("One"); t.add("Two"); t.remove(0);
type: Answer

apache-stringutils
tag name: apache-stringutils
tags question: http://stackoverflow.com/q/24288809
type: Tag
tags question: http://stackoverflow.com/q/24411346

http://stackoverflow.com/a/24402619
has comment: http://stackoverflow.com/comment/37924794
type: Answer
score: 19
has comment: http://stackoverflow.com/comment/69103220
answers question: http://stackoverflow.com/q/24401621
upvote count: 19
has comment: http://stackoverflow.com/comment/37762414
has comment: http://stackoverflow.com/comment/69097485
has comment: http://stackoverflow.com/comment/37757034
downvote count: 0
has body: Java's System.exit(0) is like C++'s exit(0) in that It terminates the process It can be called from anywhere in the program. The latter point makes it an “unstructured” control-flow construct that academic types tend to frown on. (In this case, they've got a good reason: If a function reports a failure via an exception (or old-fashioned return code), it's possible for the caller to recover from the error, but exit burns that bridge. Of course, sometimes errors do need to be treated as fatal.) In C++, return 0 is equivalent to exit(0) if it's in the main function. (In other functions, it doesn't mean anything special.) The relevant different between C++ and Java here is the return type of main. In C++, main must return int. Normally, this would mean that it must have a return statement, but the C++ standard makes main a special case with an implied return 0; as the end if you don't write one. In Java, main must return void. In C++, it's common to write return statements in main, even though it's technically redundant, for stylistic consistency with all the other non-void functions in your program. In Java, you can't return the exit code from main because it's a void function. So, if you want to explicitly specify an exit code, you have to use System.exit. It's not wrong to end every Java main function with System.exit(0), but it's just not idiomatic to do so unless you've got a construct like public static void main(String[] args) { try { //... do the work System.exit(0); } catch (Throwable t) { //... report the error System.exit(1); } }

tablemodel
type: Tag
tag name: tablemodel
tags question: http://stackoverflow.com/q/24310801

http://stackoverflow.com/comment/37563864
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24305629
score: 0
has text: by executing response.getWriter.write("Hello") and calling pricer servlet I get a blank page

http://stackoverflow.com/comment/37725995
type: QuestionComment
has text: I am blocked from asking questions because of this now. It just makes one feel sad and its demoralizing. I simply asked what should I be doing for the program to be efficient as I could not figure out storing the array in a variable.
score: 0
comment on: http://stackoverflow.com/q/24388681
type: Comment

http://stackoverflow.com/a/24417778
accepted answer of: http://stackoverflow.com/q/24372386
answers question: http://stackoverflow.com/q/24372386
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/37816368
upvote count: 1
has body: By default, the EJB container uses a server-specific database to hold persistent timers. In a clustered (network deployed) environment, you need to configure the EJB container to use a data source that points to a common database. The easiest way to do this is to configure the EJB timer service to use a custom data source, but you can also configure the EJB timer service to use a custom scheduler with the custom data source. There is more information in the Configuring a timer service for network deployment topic in the knowledge center.

http://stackoverflow.com/comment/37779464
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/24419685
has text: What do you think `getClass().getResource("/jars/TurnOffClient.jar")` does and why?
type: Comment

http://stackoverflow.com/comment/37552384
type: Comment
has text: Never forget to check the stack trace ;): https://code.google.com/p/vt-middleware/source/browse/ldaptive/core/trunk/src/main/java/org/ldaptive/LdapUtils.java#399 -> https://code.google.com/p/vt-middleware/source/browse/ldaptive/core/trunk/src/main/java/org/ldaptive/ssl/AbstractCredentialReader.java#48 -> https://code.google.com/p/vt-middleware/source/browse/ldaptive/core/trunk/src/main/java/org/ldaptive/ssl/X509CredentialConfig.java#129 It would save you a lot of time debugging the problem.
comment on: http://stackoverflow.com/q/24273065
score: 0
type: QuestionComment

http://stackoverflow.com/q/24326167
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/24326400
tagged with: logging
type: Question
has body: I want to redirect all messages with error level to file and messages with info level to console. Here is my log4j.properties: log4j.rootLogger=INFO, stdout log4j.logger.java.lang.Exception=ALL, java.lang.Exception log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n log4j.appender.java.lang.Exception=org.apache.log4j.RollingFileAppender log4j.appender.java.lang.Exception.File=\\clientexceptionlog.txt log4j.appender.java.lang.Exception.MaxFileSize=2048KB log4j.appender.java.lang.Exception.layout=org.apache.log4j.PatternLayout log4j.appender.java.lang.Exception.layout.ConversionPattern=%d [%t] %-5p %c - %m%n But seems like it doesn't work as I expect: clientexceptionlog.txt is always empty. What I'm doing wrong? Thanks!
upvote count: 2
has title: log4j - INFO to console and ERRORS to file
answer count: 1
tagged with: log4j
favorite count: 0
accepted answer: http://stackoverflow.com/a/24326400

http://stackoverflow.com/a/24374615
type: Answer
answers question: http://stackoverflow.com/q/24374533
has body: Presuming your existing works, you will need to add a method call to the object reference. Something like z[0].getQuestion(). Alternatively you could define a cusom .toString() method to return the question.
score: 0

http://stackoverflow.com/q/24299984
has comment: http://stackoverflow.com/comment/37554461
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24300174
tagged with: swing
has title: how to substract two column values and show in another column in java
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24300174
has body: in my code i want to substract column Amount And cost value and show it on profit column. this is my code... package my.bill; import java.awt.*; import java.awt.event.*; import java.awt.event.*; import java.io.*; import java.lang.*; import java.sql.*; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.*; import java.util.Calendar; import java.util.GregorianCalendar; import javax.swing.*; import javax.swing.event.*; import javax.swing.table.*; import javax .swing.table.DefaultTableModel; public class bill extends javax.swing.JFrame { /** * Creates new form bill */ Object[][] data=null; String[] columnNames = new String[2]; /*static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; static final String DB_URL="jdbc:mysql://localhost:3306/gdb?zeroDateTimeBehavior=convertToNull"; //static final String DB_URL = "jdbc:mysql://localhost/"; // Database credentials static final String USER = "root"; static final String PASS = "root";*/ public bill() { initComponents(); CurrentDate(); } public void CurrentDate(){ Calendar cal=new GregorianCalendar(); int month=cal.get(Calendar.MONTH); int year=cal.get(Calendar.YEAR); int day=cal.get(Calendar.DAY_OF_MONTH); Date.setText(day+"-"+(month+1)+"-"+year); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jLabel1 = new javax.swing.JLabel(); Date = new javax.swing.JTextField(); jScrollPane2 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); netprofit = new javax.swing.JButton(); netsum = new javax.swing.JTextField(); save = new javax.swing.JButton(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenu2 = new javax.swing.JMenu(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setText("Date"); Date.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.…
tagged with: jtable

http://stackoverflow.com/a/24370212
has comment: http://stackoverflow.com/comment/37688449
has comment: http://stackoverflow.com/comment/37702287
has comment: http://stackoverflow.com/comment/37731244
has body: EDIT Completely rewritten due to the comments. (Note that this might actually be similar to what Khaled A Khunaifer wrote, but it has been created at the same time) One possible approach could be to find a "logical" description of the rules. The rules have a quite regular form, namely always a conjunction of disjunctions. The rules can be written as (Red) AND (Wood OR Glass) AND (Large) (Red) AND (Aluminium) AND (Large) ... Now, one could apply sophisticated optimizations and minimizations (like Quine McCluskey or any other form of minimization). However, I sketched a very simple implementation here. Rules can be "merged" when they only differ in one of the disjunctions. For example, the rules above could be merged to (Red) AND (Wood OR Glass OR Aluminium) AND (Large) Now, if a rule like (Red) AND (Wood OR Glass OR Aluminium) AND (Medium) was encountered, it could be merged with the previous one to (Red) AND (Wood OR Glass OR Aluminium) AND (Large OR Medium) If we then found a rule like (Red) AND (Glass OR Aluminium) AND (Medium) it could be marked as "redundant", because it is implied by the previous one. To emphasize this again: This implementation is rather "hacky" and far from being "elegant", and there are certainly many possible improvements. But maybe it shows that the general idea is feasible, at least. import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; public class RulesChecker { public static void main(String[] args) { List&lt;Rule&gt; rules = new ArrayList&lt;Rule&gt;(); List&lt;Set&lt;String&gt;&gt; domains = new ArrayList&lt;Set&lt;String&gt;&gt;(); domains.add(setOf("Red", "Green", "Blue")); domains.add(setOf("Wood", "Glass", "Aluminium")); domains.add(setOf("Small", "Medium", "Large")); // Rule 1 | Red | Wood, Glass | Large || $100 // Rule 2 | Red | Aluminium | Large || $200 // Rule 3 | Blue or Green | Wood | Medium || $300 // Rule 4 | Red | ** …
answers question: http://stackoverflow.com/q/24368791
has comment: http://stackoverflow.com/comment/37697313
has comment: http://stackoverflow.com/comment/37727079
upvote count: 1
has comment: http://stackoverflow.com/comment/37731645
has comment: http://stackoverflow.com/comment/37719114
has comment: http://stackoverflow.com/comment/37714418
type: Answer
has comment: http://stackoverflow.com/comment/37729743
has comment: http://stackoverflow.com/comment/37717985
has comment: http://stackoverflow.com/comment/37706005
downvote count: 0
score: 1

http://stackoverflow.com/a/24395474
accepted answer of: http://stackoverflow.com/q/24395364
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
answers question: http://stackoverflow.com/q/24395364
has comment: http://stackoverflow.com/comment/37734323
has comment: http://stackoverflow.com/comment/37735355
has body: You can simply call the String.replaceAll method and specify that those characters must be replaced by the empty String: clean = clean.replaceAll("(?:--|[\\[\\]{}()+/\\\\])", ""); But if you need to do this many times, it's worth creating a Pattern object so that the regex does not have to be compiled repeatedly: private static final Pattern UNWANTED_SYMBOLS = Pattern.compile("(?:--|[\\[\\]{}()+/\\\\])"); Now you can use this to create a Matcher object and use that to do the replacement: Matcher unwantedMatcher = UNWANTED_SYMBOLS.matcher(clean); clean = unwantedMatcher.replaceAll(""); This should be more efficient if you need to use the replacement in a loop which runs more than a few times.

http://stackoverflow.com/a/24360158
score: 0
has comment: http://stackoverflow.com/comment/37667942
type: Answer
has comment: http://stackoverflow.com/comment/37667669
answers question: http://stackoverflow.com/q/24359661
has body: I think you need both a group by as a derived table expression. You need to list all tb_practice table columns instead of column1...columnN, so this is your query: List&lt;Practice&gt; resultData= (List&lt;Practice&gt;) em.createNativeQuery(" SELECT NEW Practice( p.id, p.address, p.city) FROM ( SELECT p.id, p.address, p.city, ( 3959 * acos( cos( radians(?1) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(?2) ) + sin( radians(?1) ) * sin( radians( latitude ) ) ) ) AS distance FROM tb_practice GROUP BY p.id, p.address, p.city HAVING distance &lt; 200 ORDER BY distance ) practice_by_distance ",Practice.class) .setParameter(1, latitude) .setParameter(2, longitude) .getResultList();
has comment: http://stackoverflow.com/comment/37667815

http://stackoverflow.com/comment/37551714
score: 1
has text: @hims056 Wow, okay, I think I went for "why does this code not work" option
comment on: http://stackoverflow.com/a/24298922
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37523285
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24284013
has text: I'm more interested in the inference question. But yes, if I wanted to fix the declaration that's absolutely the right thing to do; `T` would be inferred to be Exception and it would correctly fail to compile because checked.

http://stackoverflow.com/q/24350101
type: Question
score: 0
tagged with: 64-bit
has answer: http://stackoverflow.com/a/24350125
answer count: 1
tagged with: java
tagged with: eclipse
tagged with: classpath
has body: I have completed my project on windows7 - 32-bit system now I am trying to run this project on Windows7 - 64-bit system. While installing it I am getting this error: "The archive: C:/Program Files/Apache Software Foundation/Tomcat 7.0/bin/bootstrap.jar which is referenced by the class path, does not exist." I am using Eclipse and my server is tomcat 7.0 I have reinstalled the tomcat but not getting the solution. I have installed the same project in other 32-bit system,where it is running properly but I am getting the same error in other 64-bit system.
has title: Java - Classpath issue with 64-bit system
type: UnansweredQuestion
tagged with: tomcat

http://stackoverflow.com/q/24318434
answer count: 2
downvote count: 0
favorite count: 0
tagged with: generics
possible better answer: http://stackoverflow.com/a/24318606
has answer: http://stackoverflow.com/a/24318606
has answer: http://stackoverflow.com/a/24318544
upvote count: 2
has title: Passing the child instance on construction
score: 2
type: AnsweredQuestion
has body: I have a parent class which has methods that need to utilize the child's class instance, but I can't seem to pass it via constructor: public abstract class CodelanxPlugin&lt;E extends CodelanxPlugin&lt;E&gt;&gt; /* other inheritance */ { private final E plugin; public CodelanxPlugin(E plugin) { this.plugin = plugin; } @Override public void onEnable() { //need to be able to use the plugin instance } } However, because the child class has to be able to collect a child instance in some form before onEnable is called, I essentially came to this: public class MyPlugin extends CodelanxPlugin&lt;MyPlugin&gt; { public MyPlugin() { super(this); } Which is of course not possible since you can't super(this). How can I pass up the child instance upon construction? One idea I had was: public MyPlugin() { super(new Box&lt;MyPlugin&gt;(this).getInst()); } private class Box&lt;E&gt; { private E inst; public Box(E inst) { this.inst = inst; } public E getInst() { return this.inst; } } However it still calls this before the super() is called, so it's still illegal. One reason I cannot simple use this in the parent class in the first place is that I pass E as the type argument for some other classes: protected ListenerManager&lt;E&gt; listener; @Override public void onEnable() { //... this.getLogger().log(Level.INFO, "Enabling listeners..."); this.listener = new ListenerManager&lt;&gt;(/* need the E instance */); //... } If I pass this to the ListenerManager constructor, I receive this compiler error: error: incompatible types: cannot infer type arguments for ListenerManager&lt;> If I use new ListenerManager&lt;E&gt;(this), then my error is: error: incompatible types: CodelanxPlugin cannot be converted to E
tagged with: java
has comment: http://stackoverflow.com/comment/37598424
type: Question
accepted answer: http://stackoverflow.com/a/24318544

http://stackoverflow.com/comment/37624026
has text: Yes, exactly. I want to execute the method.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24337645

http://stackoverflow.com/a/24278479
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24275969
type: Answer
has body: alpha = (argb &gt;&gt; 24) &amp; 0xfc; red = (argb &gt;&gt; 16) &amp; 0xfc; green = (argb &gt;&gt; 8) &amp; 0xfc; blue = argb &amp; 0xfc; bytes[0] = alpha | (red &gt;&gt; 6); bytes[1] = (red &lt;&lt; 2) | (green &gt;&gt; 4); bytes[2] = (green &lt;&lt; 4) | (blue &gt;&gt; 2);
answers question: http://stackoverflow.com/q/24275969
has comment: http://stackoverflow.com/comment/37516412
score: 0

http://stackoverflow.com/a/24356677
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24354273
downvote count: 0
has body: Splitting on "" will cause the first element of the resulting array to be a blank, because the blank regex matches everywhere, including start of input. You need to split after every character: String[] digits = str.split("(?&lt;=.)"); This regex is a look behind that assets there is a character before the match. Look behinds are non-consuming, so you don't lose any input making the split.

http://stackoverflow.com/comment/37654487
comment on: http://stackoverflow.com/q/24336390
has text: You will probably find this info useful: http://stackoverflow.com/questions/17000193/can-we-have-more-than-one-path-annotation-for-same-rest-method
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/65354615
type: AnswerComment
has text: worked like a charm. thanks. I spent countless hours before i found your answer. thanks
comment on: http://stackoverflow.com/a/24269257
type: Comment
score: 1

http://stackoverflow.com/a/31156740
upvote count: 2
has body: As you elaborated did the transformation step proceed to the next create element if the element-nodes follow directly each other. In order to deal with this, you can rewrite you code using nested while loops, like this: while(reader.next() != XMLStreamConstants.END_DOCUMENT) { while(reader.getEventType() == XMLStreamConstants.START_ELEMENT && reader.getLocalName().equals("nextTag")) { StringWriter writer = new StringWriter(); // will transform the current node to a String, moves the cursor to the next START_ELEMENT t.transform(new StAXSource(reader), new StreamResult(writer)); System.out.println(writer.toString()); } }
has comment: http://stackoverflow.com/comment/82102590
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24350740
score: 2

http://stackoverflow.com/comment/37629840
type: AnswerComment
comment on: http://stackoverflow.com/a/24323537
has text: I edited my answer. Not absolutely sure if this will work since I switched from eclipse to intellJ some time ago.
type: Comment
score: 0

http://stackoverflow.com/a/24298848
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24298810
score: 5
has body: You can use Launch4j application. That convert executable jar file to windows native executable application. You can also embed JRE with it so if JRE is not installed on machine the application will run. you can also add some other mechanism to it also like loading image, icon, etc.
upvote count: 5

http://stackoverflow.com/comment/37610645
type: Comment
has text: In your Mysql Server if there is a way you can create a directory where to put your csv files that has a more lenient chmod permissions (like allowing delete from specific users/gropus) then you can change your MySQL script to point to that directory instead of /tmp/
score: 0
comment on: http://stackoverflow.com/q/24330034
type: QuestionComment

http://stackoverflow.com/q/24300117
has answer: http://stackoverflow.com/a/24300157
tagged with: java
has body: A simple test Shopping Application where i have two classes Clothing and Offers. Now on calling formalshirt bean, it throws the following exception Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DiwaliOffer' defined in class path resource [spring.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [Offers]: No default constructor found; nested exception is java.lang.NoSuchMethodException: Offers.<init>() Now if i comment the Offers constructor, the app runs successfully. My query is Why does Spring looks for default constructor only when there is another constructor? Clothing Class public class Clothing { private int price; private List<Offers> offer; public void setOffer(List<Offers> offer) { this.offer = offer; } public void setPrice(int price) { this.price = price; } } . Offers Class public class Offers { private int discount; private String promocode; public Offers(int val1, String val2) { this.discount=val1; this.promocode=val2; } //public Offers(){} /*Default Constructor added due to Spring Exception as in below */ /* Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class No default constructor found */ /* Caused by: java.lang.NoSuchMethodException: com.test.Shopping.Offers.<init>() */ public void setDiscount(int discount) { this.discount = discount; } public void setPromocode(String promocode) { this.promocode = promocode; } } Spring.xml
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24300316
possible better answer: http://stackoverflow.com/a/24300161
has answer: http://stackoverflow.com/a/24300154
answer count: 5
accepted answer: http://stackoverflow.com/a/24300154
has answer: http://stackoverflow.com/a/24300212
has title: Why Spring throws exceptions when No default constructor is found
score: 2
upvote count: 2
tagged with: spring
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24300161

http://stackoverflow.com/comment/37683793
has text: Ya Its a secret key generation. Can you tell me what is 128*8 and why I am getting 256 bits return value?
score: 0
comment on: http://stackoverflow.com/q/24368807
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37531508
type: Comment
has text: Great! There may be a better way to reference the specific enum value (Status.ONE) than using .staticRef().
comment on: http://stackoverflow.com/a/24276816
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37721573
type: Comment
comment on: http://stackoverflow.com/q/24388758
type: QuestionComment
score: 0
has text: try with this command to convert `mvn eclipse:eclipse` and import it

plugins
tags question: http://stackoverflow.com/q/24283057
tags question: http://stackoverflow.com/q/24387695
tags question: http://stackoverflow.com/q/24381954
tag name: plugins
tags question: http://stackoverflow.com/q/24358819
tags question: http://stackoverflow.com/q/24412899
type: Tag
tags question: http://stackoverflow.com/q/24423136

http://stackoverflow.com/q/24340214
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37632051
favorite count: 0
has comment: http://stackoverflow.com/comment/37632049
has title: Taking random defined Strings
tagged with: android
upvote count: 1
has comment: http://stackoverflow.com/comment/37632704
has answer: http://stackoverflow.com/a/24340410
has comment: http://stackoverflow.com/comment/37631990
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37628490
has body: I want to do an app that, in function of the parameters checked, gives me a random String that I previusly set. The problem isn't the design of the app so the problem is the methods or classes that do what I want. -I explain my objective with an example: We have 100 plans to do this weekend. They are in a box and I want to pick randomly one. So great, I suppose that would be more or less easy, but, this weekend is raining so I want to pick a plan that it could be done even if it rains. And it's ending the month and I don't want to spend money so a free plan would be great. Then, I check the boxes "Free plan" and "Raining" and the app gives to me a random plan that meet the conditions. How would you do that? I was thinking about a bigs arrays like "Raining plans", "Free plans", with strings inside and when you check the two boxes the arrays were mixed and a string was randomly picked but I don't know how to do that and I think it could be done in another easiest way. Thanks in advance.
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37628466
tagged with: methods
type: Question
accepted answer: http://stackoverflow.com/a/24340410
tagged with: random

oracle-database
tags question: http://stackoverflow.com/q/24285545
tags question: http://stackoverflow.com/q/24345086
tags question: http://stackoverflow.com/q/24305109
tags question: http://stackoverflow.com/q/24268847
tags question: http://stackoverflow.com/q/24297150
tags question: http://stackoverflow.com/q/24409920
tag name: oracle-database
tags question: http://stackoverflow.com/q/24358878
tags question: http://stackoverflow.com/q/24310207
tags question: http://stackoverflow.com/q/24378194
tags question: http://stackoverflow.com/q/24302726
tags question: http://stackoverflow.com/q/24422993
tags question: http://stackoverflow.com/q/24327389
tags question: http://stackoverflow.com/q/24357736
tags question: http://stackoverflow.com/q/24298534
tags question: http://stackoverflow.com/q/24399211
tags question: http://stackoverflow.com/q/24427427
type: Tag
tags question: http://stackoverflow.com/q/24317997
tags question: http://stackoverflow.com/q/24360492
tags question: http://stackoverflow.com/q/24390542
tags question: http://stackoverflow.com/q/24302165
tags question: http://stackoverflow.com/q/24322737
tags question: http://stackoverflow.com/q/24342263
tags question: http://stackoverflow.com/q/24364924
tags question: http://stackoverflow.com/q/24298905
tags question: http://stackoverflow.com/q/24278477
tags question: http://stackoverflow.com/q/24335604
tags question: http://stackoverflow.com/q/24285951
tags question: http://stackoverflow.com/q/24279699
tags question: http://stackoverflow.com/q/24398976
tags question: http://stackoverflow.com/q/24328505
tags question: http://stackoverflow.com/q/24426559
tags question: http://stackoverflow.com/q/24424642

http://stackoverflow.com/q/24291688
tagged with: inputstream
type: Question
has title: Sharing i/o between java programs
answer count: 1
score: 0
tagged with: io
has body: This question regards the redirection of input and output between two java programs. The source code for a simplified example of my problem is below. This is prog1: import java.io.*; public class prog1{ public static void main(String[] args) throws IOException{ Runtime rt = Runtime.getRuntime(); Process prog2 = rt.exec("java prog2"); System.out.println("prog2 has executed."); } } On a separate file, I've written prog2, where I execute Internet Explorer to verify that execution was successful: import java.io.*; public class prog2{ public static void main(String[] args) throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter a string: "); System.out.println("You entered " + in.readLine() + ". Starting Explorer..."); Runtime.getRuntime().exec("C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe"); } } This is what I see if I run prog2: &gt; java prog2 Enter a string: hello ** Here the program waited for my input ** You entered hello. Starting Explorer... ** Here Internet Explorer opens a new window ** This is what I see if I run prog1: &gt; java prog1 prog2 has executed. ** Internet Explorer opens a new window ** Note that prog2 did not prompt me for input, and did not output anything. My goal is for the following to occur: &gt; java prog1 Enter a string: hello ** Here I wish for the program to await my input ** You entered hello. Starting Explorer... ** Here I wish for an Explorer window to open ** prog2 has executed. I believe that this problem will require a good knowledge of I/O redirection, but I am unfortunately quite unexperienced in that area. Thank you all in advance. Devin
tagged with: outputstream
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24291893
accepted answer: http://stackoverflow.com/a/24291893
tagged with: java

http://stackoverflow.com/comment/37647045
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24349633
score: 0
has text: i don't understand that, sorry...

http://stackoverflow.com/a/39186320
upvote count: 0
answers question: http://stackoverflow.com/q/24268808
has body: What I recommend is not putting the tests in your src folder, but rather in a separate folder. This will result in: /src/main/java/mypackage /tst/main/java/mypackage which you can mark separately as source and test.
type: Answer
score: -2
downvote count: 2

http://stackoverflow.com/q/24375848
has title: Questions about recursive methods for generating a tree
answer count: 1
downvote count: 0
tagged with: data-structures
favorite count: 0
tagged with: arraylist
type: UnansweredQuestion
has body: I am trying to understand a simple spell checker program. Basically the program read a dictionary file, and put the words in a tree. When it performs the check function, it takes one word at a time from the file for checking, and checks if this word is in the tree, using retrieve(). I don't understand how this "add" method works. It is supposed to add the words from the dictionary to a tree structure. Please explain how this works? private static BinarySearchTree&lt;StringItem, String&gt; tree = new BinarySearchTree&lt;StringItem, String&gt;(); //Does this create a tree with StringItems as nodes? //In which part does this method assign value to the tree nodes? private static ArrayList&lt;String&gt; dictionary;//number is the number of strings in the dictionary private static TreeNode&lt;StringItem&gt; add (int number) { // adds to the tree //the numberOfWords has been counted in other methods. if (numberOfWords &lt; 1) { return null; } TreeNode&lt;StringItem&gt; left = add(number / 2); //What does this do? StringItem word = new StringItem(dictionary.remove(0) + ""); TreeNode&lt;StringItem&gt; right = add((number - 1) / 2); return new TreeNode&lt;StringItem&gt;(word, left, right); // I don't understand this part. //which node are we returning here? }
has answer: http://stackoverflow.com/a/24376201
upvote count: 1
tagged with: tree
tagged with: recursion
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/37547447
type: QuestionComment
type: Comment
has text: Yes it works, only writes 2 times or 3 times in DB, I do not know if my explanation this very confusing?
comment on: http://stackoverflow.com/q/24297077
score: 0

http://stackoverflow.com/q/24342434
tagged with: parsing
accepted answer: http://stackoverflow.com/a/24342593
type: AnsweredQuestion
tagged with: java
tagged with: dom
type: Question
possible better answer: http://stackoverflow.com/a/24342491
answer count: 2
tagged with: jsoup
has answer: http://stackoverflow.com/a/24342491
has answer: http://stackoverflow.com/a/24342593
has body: Jsoup incorrect counts the number of children: Document document = Jsoup .parse(testString); Element div = document.select("div").first(); Elements divChildren = div.children(); System.out.println(divChildren.size()); For example, if testString = text1 text2 or text1 text2 then divChildren.size() = 2 if testString = text1 text2 then divChildren.size() = 4 what am I doing wrong?
score: 0
tagged with: http://stackoverflow.com/tag/html
has title: Jsoup incorrect value children size

http://stackoverflow.com/comment/37685291
type: QuestionComment
has text: @tohuwawohu I am using tomcat 6. Created a web application, adding dependency jar as user library.
comment on: http://stackoverflow.com/q/24366502
score: 0
type: Comment

http://stackoverflow.com/comment/37523340
comment on: http://stackoverflow.com/q/24284559
score: 1
type: Comment
type: QuestionComment
has text: `DecimalFormat` and `NumberFormat` javadocs for `set(Maximum|Minimum)(Integer|Fraction)Digits` methods mention that these properties are used when "formatting" or "showing" numbers. There is not a word that these properties are used when parsing. This is pretty vague but in the end these properties indeed are used only for formatting.

http://stackoverflow.com/comment/37719130
comment on: http://stackoverflow.com/q/24383781
type: Comment
type: QuestionComment
has text: Yes, but I can't understand how can I use it. I should write smthg like this: @Caching(evict={ @CacheEvict( value = "product", key = "#id")}, put= { @CachePut(value = "productList", key="#id")}) above my delete method? Maybe you have some example? Thanks for your answer.
score: 0

http://stackoverflow.com/comment/37547052
type: Comment
type: QuestionComment
score: 1
has text: Why are you wanting to *inject* a boolean? There's nothing the slightest bit interesting a boolean can do. Just set it.
comment on: http://stackoverflow.com/q/24296911

http://stackoverflow.com/a/24291075
has body: probably need to just call flush and/or close on your BufferedWriter when you are done.
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24291001

http://stackoverflow.com/q/24273196
accepted answer: http://stackoverflow.com/a/24273244
favorite count: 0
has comment: http://stackoverflow.com/comment/37502036
has answer: http://stackoverflow.com/a/24273255
possible better answer: http://stackoverflow.com/a/24273255
type: AnsweredQuestion
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/5418464
upvote count: 1
has comment: http://stackoverflow.com/comment/37502135
has answer: http://stackoverflow.com/a/24273244
type: Question
linked to: http://stackoverflow.com/q/161633
duplicate of: http://stackoverflow.com/q/5418464
has body: public class TestImpl { public static void main(String[] args) { HelloImpl h1 = new HelloImpl(), h2 = h1; h1.message = "holla"; System.out.println(h2.sayHello()); } } interface Hello { String sayHello(); } class HelloImpl implements Hello { static String message = "Hello"; String sayHello() { return message; } } I get "attempting to assign weaker privilegies."
has title: Implementing an interface not working
has comment: http://stackoverflow.com/comment/37502091
answer count: 2
has comment: http://stackoverflow.com/comment/37502006
has comment: http://stackoverflow.com/comment/37502063
downvote count: 0

http://stackoverflow.com/a/24379167
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24311247
type: Answer
answers question: http://stackoverflow.com/q/24311247
has body: You can specify dependencies for the project which have test scope, in which case they will not be used in compile scope, or you can specify dependencies which are only used in certain scenarios (if, for example, you want to write Groovy tests without requiring the rest of your team to do so). This sample pom.xml has a custom profile element which describes dependencies and executions to run only if the current environment user is "andylopresto". This means that if my team doesn't want to use Groovy in their build, I could still write my test classes in Groovy and have them run as part of the standard mvn test phase on my machine only. In my team members' local machines (or a shared Jenkins instance), the Groovy test files will be ignored (not compiled or run, and the groovy-all dependency will not even be downloaded onto the machine). Example: <?xml version="1.0" encoding="UTF-8"?> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 your.package artifact 0.0.1-SNAPSHOT pom alopresto Andy LoPresto alopresto@example.com developer owner jjava Johnny Java ihategroovy@example.com sticking to older languages commons-codec commons-codec 1.9 junit junit 4.11 test org.apache.tomcat tomcat-util 8.0.8 provided andyLocalTest env.USER andylopresto org.codehaus.groovy groovy-all 2.2.1 test org.codehaus.mojo build-helper-maven-plugin 1.8 add-source generate-sources add-source src/main/groovy add-test-source generate-test-sources add-test-source src/test/groovy maven-compiler-plugin 3.1 groovy-eclipse-compiler 1.6 1.6 **/*.java **/*.groovy org.codehaus.groovy groovy-eclipse-compiler 2.8.0-01 org.codehaus.groovy groovy-eclipse-batch 2.1.5-03

http://stackoverflow.com/comment/129420114
type: Comment
has text: This answer seems to ask the same question as the original post. Integer types are not appropriate for storing phone numbers because some phone numbers include characters that are not numeric, and may have leading 0's.
score: 1
comment on: http://stackoverflow.com/a/73245278
type: AnswerComment

http://stackoverflow.com/comment/37548592
type: Comment
type: QuestionComment
has text: possible duplicate of [java.util.NoSuchElementException on reading a file (Scanner)](http://stackoverflow.com/questions/11602492/java-util-nosuchelementexception-on-reading-a-file-scanner)
score: 0
comment on: http://stackoverflow.com/q/24297688

http://stackoverflow.com/q/24369433
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/37685191
accepted answer: http://stackoverflow.com/a/24369699
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37685079
tagged with: string
has answer: http://stackoverflow.com/a/24369746
has answer: http://stackoverflow.com/a/24369699
tagged with: android
has body: Here's my code, there's nothing happen in LogCat and im pretty noob at this Android-code. somebody help-_- public class Keluarga extends Activity{ protected static final int REQUEST_CODE_FUNCTONE = 100; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.keluarga_utama); EditText nama = (EditText)findViewById(R.id.editText1); EditText umur = (EditText)findViewById(R.id.editText2); EditText gaji = (EditText)findViewById(R.id.editText3); EditText lain = (EditText)findViewById(R.id.editText4); EditText akun = (EditText)findViewById(R.id.editText5); final String namaString = nama.getText().toString(); final String umurString = umur.getText().toString(); String gajiString = gaji.getText().toString(); String lainString = lain.getText().toString(); String akunString = akun.getText().toString(); double gajiDouble; try { gajiDouble =(Double.parseDouble(gajiString)); } catch (NumberFormatException e) { gajiDouble = 0; // your default value } double lainDouble; try { lainDouble =(Double.parseDouble(lainString)); } catch (NumberFormatException e) { lainDouble = 0; // your default value } double akunDouble; try { akunDouble =(Double.parseDouble(akunString)); } catch (NumberFormatException e) { akunDouble = 0; // your default value } double totalDouble = gajiDouble+lainDouble; final String totalString = Double.toString(totalDouble); final String tabunganString = Double.toString(akunDouble); Button next = (Button)findViewById(R.id.keluarga_next); next.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(getApplicationContext (), Keluarga_output.class); intent.putExtra("NAMA", namaString); intent.putExtra("umur", umurString); startActivityForResult(intent, REQUEST_CODE_FUNCTONE); } }); } Here's my Second Activity : public class Keluarga_output extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { su…
has comment: http://stackoverflow.com/comment/37684817
favorite count: 0
upvote count: 0
has title: Passing String to another Activity, and then NOTHING HAPPEN
score: -3
possible better answer: http://stackoverflow.com/a/24369746
type: AnsweredQuestion

http://stackoverflow.com/comment/37686529
type: Comment
has text: @Holger Something like that might work if one were retrofitting value types onto the existing JVM, but the Value Types proposal (now ["Project Valhalla"](http://mail.openjdk.java.net/pipermail/discuss/2014-June/003445.html)) is much more radical. In particular, its value types would not necessarily be heap-allocated. Also, unlike objects today, and like primitives today, values would have no identity.
score: 3
comment on: http://stackoverflow.com/a/24336841
type: AnswerComment

http://stackoverflow.com/comment/37514429
has text: @mkl, yes I can do that surely, but isn't that cumbersome and error-prone. Thats why I need a API so when a client says hey I want to change font color on the webpage I will send request to the server where I will use java functions and just say changeFont(...) and it will take care of the rest. I hope I am clear now. :)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24279434

http://stackoverflow.com/comment/37744517
has text: Where you get the NPE?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24401086
score: 0

http://stackoverflow.com/q/24304631
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/24304923
has body: It looks basic question but i don't have solution, Long back, I soft deleted(physically project in workspace directory) from eclipse workspace. I am trying to import that project now. It is saying project already in workspace. So I am doing copy that project from workspace to other location and, deleting that project from workspace. And importing that project to workspace back. This way, It working fine. But do you have any better idea than this....
has comment: http://stackoverflow.com/comment/37561406
has title: how to import-back a deleted project from same eclipse workspace
has answer: http://stackoverflow.com/a/24304705
answer count: 4
has answer: http://stackoverflow.com/a/46703928
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37561166
tagged with: java
has answer: http://stackoverflow.com/a/24304692

http://stackoverflow.com/comment/37596576
score: 1
has text: Yes, it works! Thanks. Clearly, I have to do something like: `Logger.getLogger(foo.X.class.getName()).setLevel(Level.DEBUG);`
type: AnswerComment
comment on: http://stackoverflow.com/a/24322661
type: Comment

http://stackoverflow.com/a/24359373
answers question: http://stackoverflow.com/q/24359321
upvote count: 5
has comment: http://stackoverflow.com/comment/37667943
has comment: http://stackoverflow.com/comment/37669182
has comment: http://stackoverflow.com/comment/37666496
score: 5
has comment: http://stackoverflow.com/comment/37666672
downvote count: 0
has comment: http://stackoverflow.com/comment/37667676
has comment: http://stackoverflow.com/comment/37666316
type: Answer
has comment: http://stackoverflow.com/comment/37668787
has body: Try this: PdfPTable table = new PdfPTable(8); PdfPCell cell; for(int aw=0;aw&lt;8;aw++) { cell = new PdfPCell(new Paragraph("hi")); table.addCell(cell ); } EDIT: // Step 1 Document document = new Document(); // step 2 PdfWriter.getInstance(document, new FileOutputStream(filename)); // step 3 document.open(); // step 4 PdfPTable table = new PdfPTable(8); for(int aw=0;aw&lt;16 ; aw++){ table.addCell("hi"); } // Step 5 document.add(table); // step 6 document.close(); See SimpleTable for the full sample code and the resulting PDF: As you can see in the screen shot, the table has 8 columns and 2 rows (as expected). Reading the original question, I see that the first column has a cell with colspan 2. It's only a small change to take this into account: PdfPTable table = new PdfPTable(8); PdfPCell cell = new PdfPCell(new Phrase("hi")); cell.setRowspan(2); table.addCell(cell); for(int aw = 0; aw &lt; 14; aw++){ table.addCell("hi"); } Now the result looks like this: Again 8 columns and two rows, but now the cell in the first column spans two rows.
has comment: http://stackoverflow.com/comment/37666638

http://stackoverflow.com/a/24393855
has body: When you get an UnknownHostException it means, that you were not able to establish a connection to the server. You cannot, in fact, expect a HTTP status in that case. Naturally you only get a Http response (and with that a status) when you can connect to a server. Even when you get a 404 status code, you made a connection to the server. That is not the same as a UnknownHostException. The getResponse() can return null if you didn't get a response.
accepted answer of: http://stackoverflow.com/q/24374482
score: 10
has comment: http://stackoverflow.com/comment/37733275
answers question: http://stackoverflow.com/q/24374482
type: AcceptedAnswer
upvote count: 10
type: Answer
downvote count: 0

akka
type: Tag
tag name: akka
tags question: http://stackoverflow.com/q/24304152
tags question: http://stackoverflow.com/q/24376870

http://stackoverflow.com/a/24337040
downvote count: 2
upvote count: 1
score: -1
has comment: http://stackoverflow.com/comment/37623157
has body: The docs mentions @Inject(optional=true) Which will enable guice to use default values. "Mixing optional injection and just-in-time bindings may yield surprising results. For example, the following field is always injected even when Date is not explicitly bound. This is because Date has a public no-arguments constructor that is eligible for just-in-time bindings." Strings likely behave the same way as a Date does in the document example where it simply calls the default no-argument constructor.
type: Answer
answers question: http://stackoverflow.com/q/24336940

http://stackoverflow.com/comment/37580484
has text: Thanks. some more info:
comment on: http://stackoverflow.com/a/24304093
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24306837
favorite count: 0
tagged with: security
tagged with: android
has title: SSL realization for NSURLSession
answer count: 0
type: UnansweredQuestion
score: 1
upvote count: 1
has body: I have a big problem with in my app. I had java implementation, but i need to do the same for iOS app by using Security.framework an NSURLSession, and i dont know how. It will be great if u help me. Java: // get our trusted CA from resources CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); int caResId = context.getResources().getIdentifier("cert_ca", "raw", context.getPackageName()); X509Certificate cert = (X509Certificate)certificateFactory.generateCertificate(context.getResources().openRawResource(caResId)); String alias = cert.getSubjectX500Principal().getName(); // create empty trust store with only our CA KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); trustStore.load(null); trustStore.setCertificateEntry(alias, cert); // create TrustManagers based on our trust store TrustManagerFactory tmf = TrustManagerFactory.getInstance("X509"); tmf.init(trustStore); TrustManager[] trustManagers = tmf.getTrustManagers(); // get our client certificate from resources KeyStore keyStore = KeyStore.getInstance("PKCS12"); String pass = context.getResources().getString(R.string.pass); int clientResId = context.getResources().getIdentifier("cert_client", "raw", context.getPackageName()); keyStore.load(context.getResources().openRawResource(clientResId), pass.toCharArray()); // create KeyManagers based on our key store KeyManagerFactory kmf = KeyManagerFactory.getInstance("X509"); kmf.init(keyStore, pass.toCharArray()); KeyManager[] keyManagers = kmf.getKeyManagers(); // create SSL context SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(keyManagers, trustManagers, null); URL requestedUrl = new URL(url); HttpsURLConnection urlConnection = (HttpsURLConnection)requestedUrl.openConnection(); urlConnection.setSSLSocketFactory(sslContext.getSocketFactory()); urlConnection.setRequestMethod("GET"); urlConnection.setConnectTimeout(1500); // ? urlConnection.setReadTimeout(1500); // ? int responseCode = urlConnection…
tagged with: java
tagged with: ssl
type: Question
downvote count: 0
tagged with: ios

http://stackoverflow.com/a/35708928
upvote count: 10
type: Answer
score: 8
has body: You need to be careful here because I think what are you trying to do is not supported for a good reason. The "redirect" directive will issue a GET request to your controller. The GET request should only retrieve existing state using request parameters, this is the method contract. That GET request should not rely on a previous interaction or on any object stored some where in the session as a result of it. GET request is designed to retrieve existing (persisted) state. Your original (POST) request should have persisted everything you need for you GET request to retrieve a state. RedirectAttributes are not designed to support you in this case, and even if you managed to correctly use it it will only work once and then they will be destroyed. If you then refresh the browser you will get an application error because it cannot find your attributes anymore.
answers question: http://stackoverflow.com/q/24301114
downvote count: 2

http://stackoverflow.com/comment/37635200
type: QuestionComment
has text: Try `System.out.println(Arrays.toString(tmp));`
score: 0
comment on: http://stackoverflow.com/q/24343652
type: Comment

http://stackoverflow.com/comment/37532765
type: AnswerComment
comment on: http://stackoverflow.com/a/24289469
type: Comment
score: 0
has text: @Siva `0.04` is **not** an integer value. `0.04000` is mathematically equivalent to `0.04`.

http://stackoverflow.com/q/24312224
upvote count: 6
has answer: http://stackoverflow.com/a/24504327
tagged with: tomcat
linked to: http://stackoverflow.com/q/21650032
answer count: 3
has comment: http://stackoverflow.com/comment/38313320
has title: Atmosphere broadcasts don't reach client when running in Tomcat
favorite count: 0
tagged with: atmosphere
downvote count: 0
has comment: http://stackoverflow.com/comment/37968736
score: 6
possible better answer: http://stackoverflow.com/a/24487160
has answer: http://stackoverflow.com/a/29657154
accepted answer: http://stackoverflow.com/a/29657154
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24487160
type: Question
has comment: http://stackoverflow.com/comment/38341015
tagged with: jersey
has body: Substantial update below (October 15, 2014) ========== Original posting =================== I have a notification service webapp using Atmosphere and Jersey. I am trying to run it in Tomcat on Linux, and have run into a problem. (Note that this works fine when running in Tomcat-embedded-within-Eclipse, so it's possible it's a Tomcat configuration problem.) The problem is that broadcast messages seem to be queued up, or buffered, and are not actually delivered to the client until I shut down Tomcat. At that point they are all received by the client at once. I have tried a number of things that I found in various postings to try to solve this, but my efforts are scattershot because I don't know what is causing the problem: I have tried explicitly using Tomcat's NIO protocol. I have tried explicitly disabling text and binary buffering, and I have also queued up enough responses to trigger a flush if buffering were the cause. I tried running in Tomcat 8 instead (but that had different unrelated problems.) I have added the atmosphere-runtime-native, atmosphere-compat-jbossweb, and atmosphere-compat-tomcat dependencies. None of these has changed the behavior of the service. And, again, it seems to work fine when running in Eclipse. Environment: Ubuntu 14.04 LTS. Tomcat 7.0.54. Atmosphere 2.1.5. For a client, I'm just using telnet at the moment. (This code is a bit more complicated than the samples because I have a number of different routes I want to support, and I'm using the method proposed by this answer, which seems to be working nicely. Also I'm returning notification objects rather than Strings. This also seems to be working fine. I've stripped out most of the authentication stuff for clarity.) pom.xml: 4.0.0 com.clearcaptial notifications war 0.0.1-SNAPSHOT notifications Maven Webapp http://maven.apache.org org.atmosphere atmosphere-jersey 2.1.5 com.sun.jersey jersey-json 1.17.1 org.atmosphere atmosphere-runtime-native 2.1.5 org.atmosphere atmosphere-compat-jbosswe…

http://stackoverflow.com/comment/37609931
comment on: http://stackoverflow.com/q/24330199
score: 0
has text: Are you sure its not working? Did you try to print it using <c:out> tag?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37736040
type: QuestionComment
comment on: http://stackoverflow.com/q/24395607
score: 0
has text: Which Maven version do you use? Which Java version? ('Unsupported major.minor version 52.0')?
type: Comment

http://stackoverflow.com/q/24412130
upvote count: 1
has comment: http://stackoverflow.com/comment/37765159
downvote count: 0
answer count: 1
favorite count: 0
has title: Single class dependency
tagged with: dependencies
accepted answer: http://stackoverflow.com/a/24412338
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24412338
type: Question
score: 1
tagged with: java
has body: I have created two separate Java projects/packages that use the same class. If I change the code of the class in one of the projects I should also change the code in the other project. I want to keep the projects/packages as separated as possible, that is I don't want one to depend on the other in any way. How should I extract this class so the change is visible in both of the projects. Is a package with only one class a good approach?
tagged with: class
has comment: http://stackoverflow.com/comment/37765293
has comment: http://stackoverflow.com/comment/37765357

http://stackoverflow.com/a/24297452
has body: In NetBeans Clean &amp; Build usually will do the necessary re-build. Be sure to enable Compile On Save
answers question: http://stackoverflow.com/q/24268408
type: Answer
score: 0

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/24408682
tags question: http://stackoverflow.com/q/24298195
tags question: http://stackoverflow.com/q/24274809
type: Tag
tags question: http://stackoverflow.com/q/24358819
tags question: http://stackoverflow.com/q/24423136

http://stackoverflow.com/comment/37631964
type: QuestionComment
comment on: http://stackoverflow.com/q/24341490
has text: If you use an emulator, then on witch pc is the emulator?
score: 0
type: Comment

http://stackoverflow.com/a/24398514
has body: Depending on what you ultimately want to achieve you could, set the contentAreaFilled property... button1.setForeground(Color.RED); button1.setFocusPainted(true); button1.setContentAreaFilled(false); button1.setIcon(new ImageIcon(image)); (note, the frame's content area is yellow to highlight the button) And/or adjust the margins properties... button1.setForeground(Color.RED); button1.setFocusPainted(true); button1.setContentAreaFilled(false); button1.setMargin(new Insets(0, 0, 0, 0)); button1.setIcon(new ImageIcon(image)); Just as some additional ideas...
upvote count: 5
has comment: http://stackoverflow.com/comment/37740450
type: Answer
downvote count: 0
score: 5
answers question: http://stackoverflow.com/q/24397792
has comment: http://stackoverflow.com/comment/37740496

http://stackoverflow.com/comment/37688311
has text: I would classify this as a 'brute force' solution; How to handle 100^10 nodes?
type: AnswerComment
comment on: http://stackoverflow.com/a/24370150
type: Comment
score: 0

http://stackoverflow.com/comment/37566571
type: QuestionComment
has text: what you need is basic android java tutorials. because this code involves some fundamental errors such as instantiating activity.
comment on: http://stackoverflow.com/q/24306700
score: 0
type: Comment

http://stackoverflow.com/comment/37542536
comment on: http://stackoverflow.com/q/24293951
has text: @MonkeyZeus yes, that is where I am going.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39256768
type: Comment
comment on: http://stackoverflow.com/a/24318963
score: 0
type: AnswerComment
has text: @vs4vijay Actually they couldn't. `get(0)`, because of the generic type argument, returns a `OrderDetails` and that does not have a `get(String)` method. The actual object returned does, but the `ClassCastException` rightfully breaks the operation as soon as possible.

http://stackoverflow.com/comment/37632818
comment on: http://stackoverflow.com/q/24342350
score: 0
type: Comment
type: QuestionComment
has text: just a thought: if you are making a rest call to get this JSON, then try SPring RestTemplate then use Jackson as message converter to bind your JSON with java model. it will simplify your marshalling /unmarshalling

http://stackoverflow.com/comment/37523454
score: 0
comment on: http://stackoverflow.com/q/24284611
has text: @Khawar Yeah, that didn't work.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24393717
has comment: http://stackoverflow.com/comment/37731547
downvote count: 0
has body: If you are using this.panel.add(panels, BorderLayout.EAST); then you should use BorderLayout not GridBagLayout. this.panel.setLayout(new BorderLayout()); You can read more in the documentation How to Use BorderLayout.
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/37731429
upvote count: 2
answers question: http://stackoverflow.com/q/24393637

binary-tree
tag name: binary-tree
type: Tag
tags question: http://stackoverflow.com/q/24280833
tags question: http://stackoverflow.com/q/24351311
tags question: http://stackoverflow.com/q/24389995
tags question: http://stackoverflow.com/q/24344003

http://stackoverflow.com/comment/37550992
score: 0
type: Comment
type: QuestionComment
has text: Sorry I know your done with this but was wondering my question is more to what is expected now. I cleaned it up and took out the "fluff".
comment on: http://stackoverflow.com/q/24298851

http://stackoverflow.com/comment/37657466
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24354884
score: 0
has text: And where is that error pointing to?

http://stackoverflow.com/comment/37497925
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24270803
has text: If you want to prevent threads from invoking the `add` method you have to do it. I don’t see any attempt in your code. Your method `tcpResponder()` does not contain anything that would ever interact with other threads. Putting a comment like `// Test if we can modify myObject` in the code is **not** a test…
type: Comment

http://stackoverflow.com/comment/37566436
type: QuestionComment
has text: Code reduced as requested
comment on: http://stackoverflow.com/q/24306875
score: 0
type: Comment

http://stackoverflow.com/a/24405331
answers question: http://stackoverflow.com/q/24388809
type: Answer
downvote count: 0
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24388809
type: AcceptedAnswer
has body: So the fix is rather trivial: After fixing the version of all Spring components to 3.2.9, everything works as it should. I'm fairly sure it's due to Bug SPR-11744 (thanks to Andrei Stefan in the comments to the question).

http://stackoverflow.com/comment/37802628
type: QuestionComment
has text: I don't know phpmyadmin much, but maybe you'll need to define something like this https://phpmyadmin.readthedocs.org/en/latest/transformations.html - also, you'll probably need to store the original file name somewhere in your database
type: Comment
score: 2
comment on: http://stackoverflow.com/q/24421176

http://stackoverflow.com/comment/37666374
type: QuestionComment
type: Comment
has text: Yes, you already wrote that. Do you understand what a *question* is? **Hint** so far I've asked you two questions, you've asked none.
score: 0
comment on: http://stackoverflow.com/q/24358675

http://stackoverflow.com/comment/37677942
score: 0
type: Comment
has text: Why only `\w`? He asks for "everything".
comment on: http://stackoverflow.com/a/24365870
type: AnswerComment

http://stackoverflow.com/comment/37552626
type: QuestionComment
comment on: http://stackoverflow.com/q/24299949
has text: Did you define main() in your class?
score: 0
type: Comment

http://stackoverflow.com/comment/54653132
score: 2
comment on: http://stackoverflow.com/a/24548950
has text: I also did not find the file, not in EAP 6.1 or 6.4, but there is a jboss-cli-logging.properties under bin. Can you please be more specific. Do we have to create it or something?
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37641902
type: Comment
type: QuestionComment
has text: Don't confuse objects, object references, and variables.
score: 0
comment on: http://stackoverflow.com/q/24346787

http://stackoverflow.com/comment/37647179
type: AnswerComment
comment on: http://stackoverflow.com/a/24349560
score: 0
type: Comment
has text: i am a beginner so do i stick with this methodology or try something of professional type?

http://stackoverflow.com/a/24413344
upvote count: 1
has comment: http://stackoverflow.com/comment/37767446
answers question: http://stackoverflow.com/q/24413128
has comment: http://stackoverflow.com/comment/37767448
downvote count: 0
has comment: http://stackoverflow.com/comment/37768187
has comment: http://stackoverflow.com/comment/37769594
type: Answer
has body: Why not make your fields final and your modifier methods directly create new objects? public class Person { private final String name, surname; public Person(String name, String surname) {....} // getters... // and instead of setters public Person withName(String newName) { return new Person(newName, surname); } }
score: 1

http://stackoverflow.com/a/24419045
score: 1
accepted answer of: http://stackoverflow.com/q/24419025
answers question: http://stackoverflow.com/q/24419025
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37778176
type: Answer
has body: following keyword will break the execution of loop break; Also See "loop:" in Java code. What is this, why does it compile?
upvote count: 1
has comment: http://stackoverflow.com/comment/37778128

opencsv
tags question: http://stackoverflow.com/q/24418143
tags question: http://stackoverflow.com/q/24400064
type: Tag
tags question: http://stackoverflow.com/q/24273627
tag name: opencsv
tags question: http://stackoverflow.com/q/24380883

http://stackoverflow.com/comment/37729781
has text: So I fixed the issue, it's connecting fine. I think you're right Elliott. I'm not being given access permissions to my DB using my control panel username and password..The following is being printed out - http://prntscr.com/3w2nh4
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24392903

http://stackoverflow.com/a/24376631
downvote count: 1
accepted answer of: http://stackoverflow.com/q/24376075
answers question: http://stackoverflow.com/q/24376075
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/60327111
score: 1
has body: You should really look to google, this is a pretty straight forward functionality. The main way to do this on iOS is to use parse, you can do the same with android, here's a tutorial: how to add push notifications in my existing android app using pushbots Here is another example using Google cloud API https://mixpanel.com/help/reference/android-push-notifications
upvote count: 2
type: Answer

http://stackoverflow.com/q/24366622
score: -5
tagged with: java
tagged with: percentage
type: Question
answer count: 7
tagged with: string
has answer: http://stackoverflow.com/a/24366720
possible better answer: http://stackoverflow.com/a/24366654
favorite count: 0
has answer: http://stackoverflow.com/a/24366654
has answer: http://stackoverflow.com/a/24366707
has comment: http://stackoverflow.com/comment/37680671
tagged with: uppercase
has answer: http://stackoverflow.com/a/24366799
has comment: http://stackoverflow.com/comment/37679422
has answer: http://stackoverflow.com/a/24366832
has body: My question is simple: How to check if a String is more then 60% uppercase?
has answer: http://stackoverflow.com/a/24367044
has answer: http://stackoverflow.com/a/24367450
has title: Check if String is more then 60% uppercase
upvote count: 1
accepted answer: http://stackoverflow.com/a/24366707
downvote count: 6
type: AnsweredQuestion

http://stackoverflow.com/comment/37771724
type: Comment
score: 0
has text: @yshavit But wouldn't that mean that its synchronizing the method for all the instances ?
comment on: http://stackoverflow.com/a/24415245
type: AnswerComment

http://stackoverflow.com/q/24326511
has body: I am trying to figure out what's the bean configuration for AuthenticationFailureHandler on a REST Login. The usually examples of the AuthenticationFailureHandler are coupled with Form-Login. What I'm trying to achieve is locked an account based on 3 incorrect login attempts. My current bean configuration &lt;http pattern="/oauth/token" create-session="stateless" authentication-manager-ref="authenticationManager" xmlns="http://www.springframework.org/schema/security"&gt; &lt;intercept-url pattern="/oauth/token" access="ROLE_USER" /&gt; &lt;anonymous enabled="false" /&gt; &lt;http-basic entry-point-ref="clientAuthenticationEntryPoint" /&gt; &lt;custom-filter ref="clientCredentialsTokenEndpointFilter" before="BASIC_AUTH_FILTER" /&gt; &lt;access-denied-handler ref="oauthAccessDeniedHandler" /&gt; &lt;/http&gt; &lt;beans:bean id="restServicesSuccessHandler" class="com.cointraders.api.handlers.RestAuthenticationSuccessHandler" /&gt; &lt;beans:bean id="restServicesFailureHandler" class="com.cointraders.api.handlers.RestAuthenticationFailureHandler" /&gt; &lt;beans:bean id="customUserDetailService" class="com.cointraders.api.services.UserDetailsServiceImpl" /&gt; &lt;beans:bean id="daoProvider" class="com.cointraders.api.daoauthproviders.CustomDaoAuthenticationProvider"&gt; &lt;beans:property name="userDetailsService" ref="customUserDetailService"/&gt; &lt;beans:property name="passwordEncoder" ref="passwordEncoder" /&gt; &lt;/beans:bean&gt; &lt;beans:bean id="clientDetails" class="org.springframework.security.oauth2.provider.JdbcClientDetailsService"&gt; &lt;beans:constructor-arg ref="dataSource" /&gt; &lt;/beans:bean&gt; &lt;beans:bean id="accessDecisionManager" class="org.springframework.security.access.vote.UnanimousBased" xmlns="http://www.springframework.org/schema/beans"&gt; &lt;beans:constructor-arg&gt; &lt;beans:list&gt; &lt;beans:bean class="org.springframework.security.oauth2.provider.vote.ScopeVoter" /&gt; &lt;beans:bean class="org.springframework.security.acces…
has title: Have AuthenticationFailureHandler on REST Login
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37807838
tagged with: spring
has comment: http://stackoverflow.com/comment/37808458
has comment: http://stackoverflow.com/comment/37893486
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37885841
has comment: http://stackoverflow.com/comment/37891193
type: Question
has comment: http://stackoverflow.com/comment/37893538
tagged with: spring-security
tagged with: spring-security-oauth2
has comment: http://stackoverflow.com/comment/37798550
score: 0

http://stackoverflow.com/comment/37666418
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24359263
type: Comment
has text: You have to basically verify that someNumber on SomeVO object is present in the someMap? Firstmap --> Key= variableX value= shortdesc, SecondMap --> key=someNumber value=Y or N.. am i correct??!!

http://stackoverflow.com/q/24289704
type: Question
has title: SonarQube Java version used to verify code
accepted answer: http://stackoverflow.com/a/24341948
has answer: http://stackoverflow.com/a/24290218
has answer: http://stackoverflow.com/a/69753549
tagged with: java
has answer: http://stackoverflow.com/a/61738075
tagged with: sonarqube
possible better answer: http://stackoverflow.com/a/24290218
answer count: 4
score: 8
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/24341948
favorite count: 0
has body: How can I know against which version of Java SonarQube validates the code? Is it the version of the JVM? What then if my project is based on a different version?
upvote count: 8

http://stackoverflow.com/q/24340606
type: Question
has answer: http://stackoverflow.com/a/24340693
tagged with: jcheckbox
score: 2
has title: How do I change the colour of the focus ring in a JCheckBox?
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: Our Swing GUI has a black panel with white controls. However the JCheckBox instance on the panel always shows the focus ring in black. It seems to ignore the foreground colour when rendering the focus ring. Here's an example, where I've set the content pane background to grey so that the focus ring is visible: Here's the code I'm using: import javax.swing.*; import java.awt.*; public class ScratchSpace { public static void main(String[] args) throws Exception { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); SwingUtilities.invokeLater(new Runnable() { public void run() { JCheckBox checkBox = new JCheckBox("Hello cruel world"); checkBox.setForeground(Color.WHITE); checkBox.setOpaque(false); JPanel contentPane = new JPanel(); contentPane.setOpaque(true); contentPane.setBackground(new Color(0.5f, 0.5f, 0.5f)); contentPane.add(checkBox); JFrame frame = new JFrame(); frame.setContentPane(contentPane); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } } How can I tell a JCheckBox to render the focus ring in a specific colour? Ideally it would use the control's foreground colour.
tagged with: swing
tagged with: java

http://stackoverflow.com/a/24411721
type: Answer
downvote count: 0
score: 1
has body: It also depends on your dataset volume, for instance if you have a large data set, doing a select * without any condition might take some time, but if you have an index on your 'TYPE' column, then adding a where clause will reduce the time taken to execute the query. If you are dealing with a small data set, then doing a select * followed with your logic in the java code is a better approach
answers question: http://stackoverflow.com/q/24411248
upvote count: 1

http://stackoverflow.com/comment/37658751
has text: How could i do that? Would i need to make a new statement? like SELECT?
score: 0
comment on: http://stackoverflow.com/q/24355404
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24285004
has answer: http://stackoverflow.com/a/24285497
score: -2
has comment: http://stackoverflow.com/comment/37523977
has answer: http://stackoverflow.com/a/24285177
type: UnansweredQuestion
downvote count: 2
type: Question
has title: JAVA: VarArgs add variables
tagged with: java
has comment: http://stackoverflow.com/comment/37523862
answer count: 3
upvote count: 0
has body: I have this method: public static double[] averages(double[]... input) { double[] result = new double[input.length]; for(int i = 0; i&lt; result.length; i++) { result[i] = Arrays.stream(input[i]).average().getAsDouble(); } return result; } I do not know a priori how many double arrays should I switch to this method. How can I do to add to the method all the variable double [] with a for loop? In this case I: ArrayList&lt;double[]&gt; sim=new ArrayList&lt;double[]&gt;(); arrays.add(new double[]{0.25,0.97,0.47,0.31,0.71}); arrays.add(new double[]{0.51,0.91,0.88,0.12,0.15}); arrays.add(new double[]{0.47,0.71,0.42,0.17,0.71}); arrays.add(new double[]{0.41,0.55,0.53,0.64,0.81}); arrays.add(new double[]{0.91,0.14,0.71,0.11,0.61}); But unfortunately, I do not know arrays double[] before running the program. Should I go to method averages() 5 double arrays present in ArrayList "sim" I should get something like this: averages(arrays.get(0),arrays.get(1),arrays.get(2),arrays.get(3),arrays.get(4)) But the content dell'ArrayList "sim" I do not know prior to execution!
favorite count: 0
has answer: http://stackoverflow.com/a/24285150
has comment: http://stackoverflow.com/comment/37523974

http://stackoverflow.com/a/24318462
has comment: http://stackoverflow.com/comment/37587714
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/24318385
answers question: http://stackoverflow.com/q/24318385
upvote count: 1
type: AcceptedAnswer
has body: 1 - Does this mean that all objects created with Spring ApplicationContext are Singletons ? No. But Spring's default scope is singleton. If you want a different scope, you must explicitly declare it in the bean configuration. In Java configuration, you do that with the @Scope annotation. With XML configuration, you do it with the &lt;bean&gt; scope attribute. Among other ways... 2- Doesn't this create some problems when Spring create objects that keep some state ? You can always declare different scope, so no. 3- How to tell Spring to create a new object ? That depends on the scope. If the scope is prototype, then calling ApplicationContext#getBean(String) will give you a new instance every time. If your bean is a singleton, then you will always get the same instance. Note that you can have multiple beans of the same type but with different scopes. For example, &lt;bean name="my-proto" class="com.example.Example" scope="prototype" /&gt; &lt;bean name="my-singleton" class="com.example.Example" /&gt; &lt;!-- defaults to singleton --&gt; and later (Example) context.getBean("my-proto"); // new instance every time (Example) context.getBean("my-singleton"); // same instance every time You can therefore use the singleton in some cases, and a different scope in others. Also, you don't have to use Spring everywhere.

http://stackoverflow.com/comment/37684052
score: 0
comment on: http://stackoverflow.com/q/24368240
type: QuestionComment
type: Comment
has text: Tested on OS X. If `fileName` is NULL, it yields a NPE on that line. See my answer.

http://stackoverflow.com/comment/37736095
comment on: http://stackoverflow.com/a/24396619
has text: Yes, but wouldn't it auto-unbox the two values prior to comparison?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37790959
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24425730
has text: I think you should raise a generic null pointer error, something like "the field can't be null", and if there is any data then validate the concrete format (in that case you don't even need the instance of). This will also avoid glue code (copy and paste if xxx!=null). Let me know if this fits your needs.
type: Comment

http://stackoverflow.com/q/24308269
possible better answer: http://stackoverflow.com/a/24308508
upvote count: 1
has comment: http://stackoverflow.com/comment/37568407
downvote count: 1
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24308369
accepted answer: http://stackoverflow.com/a/24308369
answer count: 2
has answer: http://stackoverflow.com/a/24308508
has title: Java - instantiating an unknown number of entities
favorite count: 0
score: 0
has body: I have an entity called Person, in which there are 2 parameters: Name and Age. I don't know how many entities I might need, this how I use an predefined number of entities: private Person[] person = new Person[3]; //With this I'm saying that there will be only 3... Now, I dont know how many Persons will i have so, how can I do this using a List? List&lt;Person&gt; personList = new List&lt;Person&gt;(); //random guessing
has comment: http://stackoverflow.com/comment/37568372

http://stackoverflow.com/q/24403976
has answer: http://stackoverflow.com/a/24404059
accepted answer: http://stackoverflow.com/a/24404184
has comment: http://stackoverflow.com/comment/37749804
possible better answer: http://stackoverflow.com/a/24404199
tagged with: generics
has answer: http://stackoverflow.com/a/24404199
has comment: http://stackoverflow.com/comment/37749874
has body: I've got widely used method like: public Map&lt;String, Double&gt; parseData(String[] data) { ................. Where data is something like new String[] { "column1 -&gt; 2.00", "column2 -&gt; New York", ... } Problem: It appears that data can contains both: String -&gt; Double &amp; String -&gt; String values. So I need smth like: public Map&lt;String, String or Double&gt; parseData(String[] data) { ................ Question: Any ideas besides return Map&lt;String, Object&gt;?
answer count: 5
score: 0
tagged with: dictionary
tagged with: collections
has answer: http://stackoverflow.com/a/24404184
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37749841
tagged with: java
has answer: http://stackoverflow.com/a/24404178
type: Question
has title: Refactoring: Map<String, Double> to Map<String, Double or String>
has answer: http://stackoverflow.com/a/24404291

http://stackoverflow.com/a/35642588
answers question: http://stackoverflow.com/q/24310654
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: If you're getting java.lang.NoSuchMethodException error on JDK 8, its likely this bug https://github.com/GoogleCloudPlatform/gcloud-maven-plugin/issues/54 The solution discussed there is to add config to the appengine maven plugin. &lt;jvm_flag&gt; &lt;jvm_flag&gt;-Dappengine.user.timezone=UTC&lt;/jvm_flag&gt; &lt;/jvm_flag&gt; Passing the argume as -D does not work (nor adding .impl) as discuess in older solutions.

http://stackoverflow.com/comment/37642860
has text: what if I user WinRAR, set the archive type to ZIP and compression type to Store which is zero compression. Then ZIP it and after wards change the extension from .ZIP to .JAR
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24346087

http://stackoverflow.com/a/24385098
answers question: http://stackoverflow.com/q/24385050
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37714079
has comment: http://stackoverflow.com/comment/37713957
has comment: http://stackoverflow.com/comment/37714363
type: Answer
score: 11
upvote count: 11
has body: No, the array isn't length 4. The array is of length 3, because it's the result of the split operation. Your code is effectively just: String splitThis = "Hello, World, There"; String[] arr = splitThis.split(","); arr[3] = "YAY"; Once you've done an assignment to a variable, its previous value doesn't matter at all. The split method returns a reference to an array, and you're assigning that reference to arr. The split method is unaware of the previous value of the variable - it operates entirely independently of what you happen to do with the value afterwards - so it's not just filling in part of an existing array. If you want that sort of behaviour, you could use something like this: String[] array = { " ", " ", " ", " " }; // Or fill however you want String splitThis = "Hello, World, There"; String[] splitResults = splitThis.split(","); System.arraycopy(splitResults, 0, array, 0, Math.min(array.length, splitResults.length)); Or perhaps you want a List&lt;String&gt; so you can add items later: String splitThis = "Hello, World, There"; List&lt;String&gt; list = new ArrayList&lt;&gt;(Arrays.asList(splitThis.split(",")); list.add(...);
has comment: http://stackoverflow.com/comment/37713876
accepted answer of: http://stackoverflow.com/q/24385050
has comment: http://stackoverflow.com/comment/37714048

http://stackoverflow.com/comment/37591943
score: 0
has text: i am using session for details of logged in user.
comment on: http://stackoverflow.com/q/24320724
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37767521
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24374607
has text: I saw your last update, I think it should work, I don't see any stream that is not closed, so maybe saxon has a bug, check this : http://stackoverflow.com/questions/17998881/saxon-xslt-transformation-how-to-close-outputstream-when-failing-during-transfo maybe you could try another version
type: Comment

http://stackoverflow.com/a/24462144
upvote count: 2
has body: For Jersey 2.0, query parameters can be defined while declaring WebTarget using WebTarget.html.queryParam(String, Object...) There seems to be no need for MultivaluedMapImpl or MultivaluedHashMap.
has comment: http://stackoverflow.com/comment/107827702
answers question: http://stackoverflow.com/q/24292930
downvote count: 0
has comment: http://stackoverflow.com/comment/139485161
type: Answer
score: 2

http://stackoverflow.com/comment/37648121
comment on: http://stackoverflow.com/q/24350194
has text: Question seems similar to [this](http://stackoverflow.com/q/16079886/3165552)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24326687
score: 6
has body: Thread Long task in general Invoke by thread.start() method Triggered from any thread Runs on its own thread Manual thread management/code may become difficult to read AsyncTask Small task having to communicate with main thread Invoke by execute() method Triggered from main thread Runs on worker thread Must be executed and created from the main Thread Service Task with no UI,but should not use for long Task. Use Thread within service for long Task Invoke by onStartService() Triggered from any Thread Runs On Main Thread May block main(UI) thread IntentService Long task usually no communication with main thread if communication is needed then it is done by Handler or broadcast Invoke via Intent Triggered from Main Thread (Intent is received on main Thread and worker thread is spawned) Runs on separate thread Can't run task in parallel and multiple intents are Queued on the same worker thread.
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/37603022
downvote count: 0
answers question: http://stackoverflow.com/q/24326394

http://stackoverflow.com/a/24323164
answers question: http://stackoverflow.com/q/24322096
has body: It's basicly because Java generics are invariant. To make it possible to return generic subtypes, type-system should allow covariance. Without defining upper-bound of type, this won't work. Like pointed in earlier posts, this can be achieved by relaxing your type definition to allow subtypes returned: public Iterator&lt;? extends IFoo&gt; iterator() There is a good article about covariance and contravariance in Java, which also explains why this check has to be done at compile time.
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/37597358

http://stackoverflow.com/q/24348098
favorite count: 0
has answer: http://stackoverflow.com/a/24348159
linked to: http://stackoverflow.com/q/22416318
upvote count: 2
duplicate of: http://stackoverflow.com/q/22416318
has comment: http://stackoverflow.com/comment/37644248
score: 2
type: AnsweredQuestion
has title: Splitting a string based on " " and spaces
tagged with: java
accepted answer: http://stackoverflow.com/a/24348159
type: Question
has comment: http://stackoverflow.com/comment/37644269
has body: I have a String str, which is comprised of several words separated by single spaces. If I want to create a set or list of strings I can simply call str.split(" ") and I would get I want. Now, assume that str is a little more complicated, for example it is something like: str = "hello bonjour \"good morning\" buongiorno"; In this case what is in between " " I want to keep so that my list of strings is: hello bonjour good morning buongiorno Clearly, if I used split(" ") in this case it won't work because I'd get hello bonjour "good morning" buongiorno So, how do I get what I want?
has comment: http://stackoverflow.com/comment/37644187
has answer: http://stackoverflow.com/a/24348148
answer count: 3
has answer: http://stackoverflow.com/a/24348150
downvote count: 0
tagged with: string
possible better answer: http://stackoverflow.com/a/24348148

http://stackoverflow.com/q/24332058
tagged with: java
upvote count: 2
has answer: http://stackoverflow.com/a/24332078
accepted answer: http://stackoverflow.com/a/24332078
tagged with: thread-sleep
answer count: 1
favorite count: 0
type: AnsweredQuestion
score: 2
downvote count: 0
has title: Issue with multithreading in java
tagged with: multithreading
tagged with: swing
has body: I am facing a problem in Thread .Here is my code private void CustomBrightActionPerformed(java.awt.event.ActionEvent evt) { creed = new Thread() { public void run() { final JFrame jfmae = new JFrame("Set BrightNess"); JLabel jla = new JLabel("!@#$"); jfmae.add(jla, BorderLayout.CENTER); jfmae.setSize(180, 180); jfmae.addMouseListener(new Mymos()); jfmae.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent windowEvent) { jfmae.dispose(); } }); jfmae.setVisible(true); } }; creed.start(); } class Mymos extends MouseAdapter { public void mousePressed(java.awt.event.MouseEvent evt) { try { creed.sleep(3000); } catch (InterruptedException e) { } Bigh2MousePressed(evt); } private void Bigh2MousePressed(java.awt.event.MouseEvent evt) { System.out.println("dsds"); } } CustomBrightActionPerformed is a method of another class that deals with Action Event and Mymos is inner class .The problem is that I am sleeping creed Thread but my main thread is also sleeping for 3 seconds.Why ?
type: Question

http://stackoverflow.com/q/24342105
has title: Wicket replacing items in ListView
tagged with: listview
has comment: http://stackoverflow.com/comment/37632680
downvote count: 0
answer count: 1
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24343483
tagged with: wicket
has comment: http://stackoverflow.com/comment/37633817
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24343483
has body: I want to change the data of a listview on a Button Click. This is what I do currently: final PageableListView&lt;Users&gt; listview = new PageableListView&lt;Users&gt;("rows", displayList, 10) { //.... protected void populateItem(final ListItem&lt;Users&gt; item) { item.add(new Label("username").setOutputMarkupId(true)); // .. other fields } } final IndicatingAjaxFallbackLink&lt;MyPanel&gt; sublist = new IndicatingAjaxFallbackLink&lt;MyPanel&gt;("sublist") { public void onClick(AjaxRequestTarget target) { displayList = // get new list listview.setList(displayList); target.addChildren(listview, Label.class); } }; add(sublist); This works if the new list is exactly the same size as the old list. In any other case I get an Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 How can I fix this problem?

http://stackoverflow.com/a/24421173
type: Answer
has comment: http://stackoverflow.com/comment/37782118
score: 3
downvote count: 0
has body: You must retain the previous result: public void actionPerformed(ActionEvent e){ int v = Integer.parseInt(label.getText()); if (rdbtnAdd.isSelected()){ v += 2; } else { v -= 2; } label.setText(Integer.toString(v)); }
answers question: http://stackoverflow.com/q/24421130
upvote count: 3

http://stackoverflow.com/comment/37702577
comment on: http://stackoverflow.com/q/24378925
score: 0
has text: That is the correct pattern label. Are there many threads going through the code that logs whatever message it is you are logging?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37759329
type: AnswerComment
comment on: http://stackoverflow.com/a/24408352
has text: And if you have a lot of trouble with the JTextPane maybe look into JEditorPane it is a bit more html friendly I think.
type: Comment
score: 0

http://stackoverflow.com/q/24391606
answer count: 1
has comment: http://stackoverflow.com/comment/37727056
accepted answer: http://stackoverflow.com/a/24392083
has title: Spring Hibernate getCurrentSession() when there's no session?
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24392083
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/37727224
type: Question
has body: All in the title I'm confused with how to use sessionFactory.getCurrentSession(). In my web-app, multi-threads are created to save messages in the DB, and on creating of each thread, I never used openSession() method, all of the Daos use getCurrentSession(). And till now it's working fine. And there's no CurrentSessionContext configured. So does hibernate generate a new session for this thread, if not how does this getCurrentSession work? UPDATE Yes I'm using Spring 3.1. Tomcat6 (as plugin in Eclipse and real server on a Linux machine, the app works on both server)
score: 0

http://stackoverflow.com/a/24323970
has comment: http://stackoverflow.com/comment/37602322
type: Answer
answers question: http://stackoverflow.com/q/24323269
score: 1
accepted answer of: http://stackoverflow.com/q/24323269
upvote count: 1
has comment: http://stackoverflow.com/comment/37598252
type: AcceptedAnswer
downvote count: 0
has body: I'm not quite sure what you are hoping to do with this data. As you say, the GAE datastore is for GAE applications only. So even if you store the data, you won't be able to access it without having a web app running on GAE. (Note that there is a "remote API", but it only works alongside an existing GAE application - also it's not very efficient and isn't really for production use.) However, there is a separate product called Google Cloud Datastore that uses similar technology to the GAE app and can be accessed via REST, so your desktop app could create and read data there.

http://stackoverflow.com/comment/37508829
comment on: http://stackoverflow.com/q/24276522
score: 0
type: Comment
has text: Just add some ID value to your contact objects so you can find them again.
type: QuestionComment

http://stackoverflow.com/a/24329197
downvote count: 1
type: Answer
has body: You need to enable server push feature 11.16. Server Push In short: add vaadin-push library to your dependecies enable pushing (@Push annotation or servlet configuration) use UI.access(..) for pushing
accepted answer of: http://stackoverflow.com/q/24329048
score: 1
answers question: http://stackoverflow.com/q/24329048
has comment: http://stackoverflow.com/comment/69521572
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/37765575
has text: This question should go to ux.stackexchange.com, it's about user interface design, not strictly technical.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24412149
score: 1

http://stackoverflow.com/a/24349604
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24349451
type: Answer
has body: There's no point in declaring index at Class level since you dont want it to be a member or an instance of that class. Instead make it local to the method and pass it to other methods as argument where you want to access it.
downvote count: 0

http://stackoverflow.com/comment/37629245
score: 0
type: Comment
has text: This is what I get: "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1 at projectApplicationDevelopment.NumRow.storeDoublesAndPrintMaxMin(NumRow.java:34) at projectApplicationDevelopment.CallingClass.start(CallingClass.java:21) at projectApplicationDevelopment.CallingClass.main(CallingClass.java:26)" I call this class from my main class using "NumRow.storeDoublesAndPrintMaxMin();"
type: QuestionComment
comment on: http://stackoverflow.com/q/24340603

final
tags question: http://stackoverflow.com/q/24350612
tags question: http://stackoverflow.com/q/24335565
type: Tag
tag name: final
tags question: http://stackoverflow.com/q/24413128
tags question: http://stackoverflow.com/q/24283889

http://stackoverflow.com/comment/37499211
type: Comment
type: QuestionComment
has text: I really wish that this was a compilation warning/error and force a body to be put into brackets or something. An accidental typing error here could cause significant heartache.
score: 0
comment on: http://stackoverflow.com/q/24271052

http://stackoverflow.com/q/24301980
has comment: http://stackoverflow.com/comment/37794481
answer count: 2
has comment: http://stackoverflow.com/comment/37796211
tagged with: lazy-initialization
has comment: http://stackoverflow.com/comment/37562597
linked to: http://stackoverflow.com/q/21097007
has comment: http://stackoverflow.com/comment/37825892
favorite count: 0
has comment: http://stackoverflow.com/comment/37556933
has comment: http://stackoverflow.com/comment/37825046
has comment: http://stackoverflow.com/comment/37564749
linked to: http://stackoverflow.com/q/20560485
possible better answer: http://stackoverflow.com/a/24302863
upvote count: 2
has comment: http://stackoverflow.com/comment/37809960
has comment: http://stackoverflow.com/comment/37556538
has comment: http://stackoverflow.com/comment/37564806
accepted answer: http://stackoverflow.com/a/24445373
has body: I am calling autocomplete from JSP url: "ProductByName". On response in console it is showing POST http://localhost:8082/Store/SingleProduct 500 (Internal Server Error) In JSP: $(".name").autocomplete({ source: function(request, response) { $.ajax({ url: "ProductByName", dataType: "json", data: { str: request.term, maxRows: 5 },... In struts.xml: productList\[\d+\]\.id, productList\[\d+\]\.name, productList\[\d+\]\.description true I want to fetch only few properties of productList In Action class: public class ProductDetailsAction extends ActionSupport { private long id; private String barCode;//bardoce private String name; private String desc; private long quantity; private float unitPrice; private float sellingPrice; private float totalSellingPrice; private long clientId; private ArrayList<BillDetails> BillList; private Date startDate; private Date endDate; private int discountPercentage; private Timestamp addDate; private String dataStatus; private ArrayList<ProductDetailsAction> productList; private ArrayList<Product> productBillList; public String fetchByProductName() { ProductDetailsBusiness pdb = new ProductDetailsBusiness(); Map data = pdb.fetchByProductName(getName()); setProductList((ArrayList) data.get("list")); return SUCCESS; } //other methods and getter and setter } I am getting following exception: SEVERE: Exception occurred during processing request: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: iland.hbm.Client.billDetailses, no session or session was closed 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: iland.hbm.Client.billDetailses, no session or session was closed at org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:246) at org.apache.struts2.json.JSONWrit…
linked to: http://stackoverflow.com/q/23982290
downvote count: 1
type: AnsweredQuestion
has title: org.apache.struts2.json.JSONException: org.hibernate.LazyInitializationException: failed to lazily initialize a collection
score: 1
tagged with: java
tagged with: hibernate
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/37784979
has comment: http://stackoverflow.com/comment/37630140
has answer: http://stackoverflow.com/a/24445373
tagged with: struts2
type: Question
has answer: http://stackoverflow.com/a/24302863

http://stackoverflow.com/q/24305623
tagged with: java
has comment: http://stackoverflow.com/comment/37563203
score: 0
has comment: http://stackoverflow.com/comment/37565355
has body: Some time our application looks for message_de.properties file where as sometimes it looks up for message_de_DE.properties. We are storing the locale string in the Database where locale string value will be en_US en de ja Did anyone come across the issue or have any suggestions? Thanks.
answer count: 0
type: UnansweredQuestion
has title: ResourceBundle lookup on message_de.properties and message_de_DE.properties
type: Question
has comment: http://stackoverflow.com/comment/37564636

http://stackoverflow.com/q/24363080
possible better answer: http://stackoverflow.com/a/24363154
has answer: http://stackoverflow.com/a/24363187
has comment: http://stackoverflow.com/comment/37672780
favorite count: 0
tagged with: type-conversion
has body: I have the following code: public class MyFirstJavaProgram { public static void main(String []args) { boolean b = true; int x = b; System.out.println(x); } } As the title say, can I convert boolean type into another data type (in the above example, char), using Java?
has answer: http://stackoverflow.com/a/24363209
answer count: 9
has answer: http://stackoverflow.com/a/42325049
has title: Can I convert boolean into another data type in Java
has answer: http://stackoverflow.com/a/24363274
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/41256665
downvote count: 3
has answer: http://stackoverflow.com/a/24363175
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24363155
score: -2
has comment: http://stackoverflow.com/comment/37672763
linked to: http://stackoverflow.com/q/3793650
tagged with: java
has answer: http://stackoverflow.com/a/24363154
accepted answer: http://stackoverflow.com/a/41256665
has comment: http://stackoverflow.com/comment/37672777
has answer: http://stackoverflow.com/a/24363139

http://stackoverflow.com/comment/37534095
has text: There is no way to do this except unreliable hacks and hard-coded workarounds. Perhaps we can help more if you explain why you need this?
score: 0
comment on: http://stackoverflow.com/q/24288657
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37792325
type: QuestionComment
type: Comment
has text: Why would iterating over `Set<CustomKV>` be any more or less efficient than iterating over `Set<Integer>`?
comment on: http://stackoverflow.com/q/24426329
score: 0

http://stackoverflow.com/q/24288467
has answer: http://stackoverflow.com/a/24303559
tagged with: java
type: Question
score: 0
tagged with: spring-security
has answer: http://stackoverflow.com/a/24290095
tagged with: security
answer count: 3
has body: We have a web application, and we're want to use spring security to secure it in 2 different ways: 1) Users that are authenticate using login form and have access to certain services. 2) Other services that are secured using digest authentication (user + password are passed in the request's header) - used by other webapps so there's no login form. Each of these works on it's own, but we weren't able to get them to work in the same web app. When we try to run a webapp with both xmls we get the following error: A universal match pattern ('/**') is defined before other patterns in the filter chain, causing them to be ignored. Please check the ordering in your &lt;security:http&gt; namespace or FilterChainProxy bean configuration The security.xml for users: &lt;security:http use-expressions="true"&gt; &lt;security:intercept-url pattern="/user/login" access="permitAll" /&gt; ... &lt;security:intercept-url pattern="/**" access="isAuthenticated()" /&gt; &lt;security:form-login authentication-success-handler-ref="userAuthenticationSuccessHandler" /&gt; &lt;security:logout logout-url="/user/logout" logout-success-url="/demo/user/logoutSuccess" /&gt; &lt;/security:http&gt; &lt;bean id="bCryptPasswordEncoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder" /&gt; &lt;security:authentication-manager alias="authenticationManager"&gt; &lt;security:authentication-provider ref="authenticationProvider"&gt; &lt;/security:authentication-provider&gt; &lt;/security:authentication-manager&gt; The rest-security.xml for web services: &lt;security:http create-session="stateless" entry-point-ref="digestEntryPoint"&gt; &lt;security:intercept-url pattern="/provider/**" access="ROLE_WEBAPP" /&gt; &lt;security:http-basic /&gt; &lt;security:custom-filter ref="digestFilter" after="BASIC_AUTH_FILTER" /&gt; &lt;/security:http&gt; &lt;bean id="digestFilter" class="org.springframework.security.web.authentication.www.DigestAuthenticationFilter"&gt; &lt;property name="userDetails…
tagged with: spring
accepted answer: http://stackoverflow.com/a/24348986
has title: Spring security for both web services and users
has answer: http://stackoverflow.com/a/24348986
tagged with: spring-mvc
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24290095

http://stackoverflow.com/comment/37697277
comment on: http://stackoverflow.com/q/24376016
type: Comment
type: QuestionComment
has text: Need to review how to "securely" store passwords.. I would separate the auth from the lockout process; then the "Username or Password is invalid" is trivially detected. To add explicitly if a Username is invalid, check that independently of the other criteria.
score: 2

http://stackoverflow.com/comment/37649417
type: Comment
type: QuestionComment
has text: Can you post a stack trace and highlight somehow the parts you don't want? Or don't you even want the stack trace?
comment on: http://stackoverflow.com/q/24350785
score: 0

http://stackoverflow.com/q/24319266
tagged with: java
type: Question
score: 0
answer count: 3
has body: I'm new to the amazing world of java, but my Obj-C experince tells me that this code: Preferences prefs = Preferences.userRoot(); String tickets = prefs.get("tickets", "???"); Log.d("Prefs", tickets); prefs.put("tickets", "!!!"); should produce ??? on the first run, and !!! on the second run. But it does not. I see ??? all the time. What am I missing? Maybe some permissions? Maybe calling some save() method on prefs object? I've also tried: Preferences prefs = Preferences.userRoot().node(this.getClass().getName()); No luck either.
accepted answer: http://stackoverflow.com/a/24319350
has title: Android preferences not working
tagged with: android
has answer: http://stackoverflow.com/a/24319350
has answer: http://stackoverflow.com/a/24323249
tagged with: android-preferences
possible better answer: http://stackoverflow.com/a/24322768
has comment: http://stackoverflow.com/comment/37589350
has answer: http://stackoverflow.com/a/24322768
type: AnsweredQuestion

http://stackoverflow.com/comment/37569741
comment on: http://stackoverflow.com/a/24295881
has text: @Cheetah The most you can do (without actually knowing the order) is a best-effort matching the types (considering inheritance too). You could rank orders and choose the top ranking one.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37685428
type: QuestionComment
has text: oh, too tricky for me then :)
score: 0
comment on: http://stackoverflow.com/q/24365946
type: Comment

http://stackoverflow.com/comment/37765353
type: AnswerComment
has text: @rahulpasricha I think you were wrong. StringBuffer is threadsafe not stringbuilder. So code which we are using inside the method of controller should be synchronized if it has to been access two threads at a time .
comment on: http://stackoverflow.com/a/24411723
type: Comment
score: 0

http://stackoverflow.com/q/24271616
has answer: http://stackoverflow.com/a/24271632
score: 1
has answer: http://stackoverflow.com/a/32163359
tagged with: java
linked to: http://stackoverflow.com/q/4344246
tagged with: comparable
has answer: http://stackoverflow.com/a/24271763
type: Question
has body: I have a custom class like Person: public class Person { int age; String name; } Now I want to sort Person class objects based on age. So I will use Comparable interface and implement compareTo() method. And compareTo will have logic to compare person object based on just age. So if I do : Collections.sort(list); // where list is a list of person I will get sorted person list based on age. But I read somewhere, we need to override equals() method as well when we do Comparable implementation. But I am not seeing its use as of now. Can anyone explain, where there will be a need to override equals() method as well if I want to just sort based on age?
downvote count: 0
has title: equals method contract with comparable interface
favorite count: 0
answer count: 4
tagged with: equals
type: UnansweredQuestion
upvote count: 1
tagged with: collections
has answer: http://stackoverflow.com/a/24271718

http://stackoverflow.com/comment/37561990
has text: The order is likely to be of no concern. Please check your Maven configuration for Java compilation without debugging information; you might want to post the relevant bits here.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24301241
score: 0

http://stackoverflow.com/a/24291619
downvote count: 0
has comment: http://stackoverflow.com/comment/40331503
has comment: http://stackoverflow.com/comment/40330350
type: Answer
score: 11
upvote count: 11
has comment: http://stackoverflow.com/comment/40330618
has body: What you are looking for is not a standard feature, but you can customize the chooser, using JFileChooser.setAccessory(...) which takes as a argument a JComponent. So you can create a panel to with a list that you can add and remove selected files (or any other JComponent you want to create) and add it as an accessory to the file chooser. See the FileChooserDemo2 for more explanation on this. Here's an example. I just created JList that you can add to by selecting files, and remove files by selecting the file from the list and clicking remove. When you click open, all the files can be obtained from the DefaultListModel FileListAccessory class that extends JComponent import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.File; import javax.swing.DefaultListModel; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JFileChooser; import javax.swing.JList; import javax.swing.JScrollPane; import javax.swing.border.EmptyBorder; public class FileListAccessory extends JComponent implements PropertyChangeListener { private File file = null; private DefaultListModel model; private JList list; private JButton removeItem; public FileListAccessory(JFileChooser chooser) { chooser.addPropertyChangeListener(this); model = new DefaultListModel(); list = new JList(model); JScrollPane pane = new JScrollPane(list); pane.setPreferredSize(new Dimension(200, 250)); removeItem = createRemoveItemButton(); setBorder(new EmptyBorder(10, 10, 10, 10)); setLayout(new BorderLayout()); add(pane); add(removeItem, BorderLayout.SOUTH); } public DefaultListModel getModel() { return model; } private void addFileToList() { model.addElement(file); } private void removeFileFromList() { if (list.getSelectedIndex() != -1) { model.remove(list.getSelectedIndex()); } } private JButton createRemoveItemButton() { JButt…
answers question: http://stackoverflow.com/q/24290210

http://stackoverflow.com/comment/37650633
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24351438
has text: You can add any component to a JScrollPane to make it scrollable
score: 0

http://stackoverflow.com/a/24371569
upvote count: 2
has comment: http://stackoverflow.com/comment/37690598
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37691243
accepted answer of: http://stackoverflow.com/q/24371483
type: Answer
answers question: http://stackoverflow.com/q/24371483
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37694271
has comment: http://stackoverflow.com/comment/37694189
has comment: http://stackoverflow.com/comment/37690184
has comment: http://stackoverflow.com/comment/37690062
has comment: http://stackoverflow.com/comment/37693907
has body: It has no problem the first 5-6 times, so why does the memory seem to accumulate even though I'm recycling everything? It doesn't accumulate. It fragments. On Java, OutOfMemoryError is fairly literal: there is not enough heap space to allocate your desired block. On Android's Dalvik VM, OutOfMemoryError is really ThereIsNoBlockBigEnoughError, because Dalvik does not have a compacting garbage collector. I go more into what that means (and where the new ART runtime should have an impact) in a blog post. Is there something other than recycle() that I can use, or some other system resource that would help? Step #1: Set your android:minSdkVersion to 11 or higher. Step #2: Stop recycling your bitmaps. Reuse them, using inBitmap on BitmapFactory.Options. Maintain your own pool of available Bitmap objects eligible for recycling for each image resolution you are needing. See this bit of documentation for more.

hql
tag name: hql
tags question: http://stackoverflow.com/q/24293418
tags question: http://stackoverflow.com/q/24388787
tags question: http://stackoverflow.com/q/24393443
tags question: http://stackoverflow.com/q/24346757
tags question: http://stackoverflow.com/q/24369689
type: Tag
tags question: http://stackoverflow.com/q/24386659
tags question: http://stackoverflow.com/q/24319978
tags question: http://stackoverflow.com/q/24279660
tags question: http://stackoverflow.com/q/24310562
tags question: http://stackoverflow.com/q/24342174

http://stackoverflow.com/q/24367782
has body: I just want to know whether there are any programming language to achieve a task that is descried below. I have to develop a tool and it should perform the operations step by step based on my input. Steps include, FTPing some files -> starting a job -> Processing the output file -> generating report. Is there any jar written in java which can be used for this? Apart from java, my lead told to try "Ruby in Rails" and i have no idea in "Ruby in Rails". Can this be achieved using Rails? Thanks and i don't know whether this is the correct forum to post such questions. Please redirect if inappropriate.
score: 0
type: UnansweredQuestion
has title: Jar to perform step by step processing
answer count: 0
tagged with: ruby-on-rails
has comment: http://stackoverflow.com/comment/37681724
type: Question
has comment: http://stackoverflow.com/comment/37681957
tagged with: java

http://stackoverflow.com/a/24326752
answers question: http://stackoverflow.com/q/24326488
upvote count: 2
has body: You can do it with technologies available in Java EE. It's important to mention that Java EE is itself composed of many specifications/frameworks, for which there are more implementations. See this: https://java.net/projects/javaee-spec/pages/Home Example with JSF http://www.tutorialspoint.com/jsf/jsf_architecture.htm Example with JSP http://www.datadisk.co.uk/html_docs/jsp/jsp_mvc_tutorial.htm Another example with JAX-RS https://jersey.java.net/documentation/latest/mvc.html JSF is much more feature rich than JSP, and there are many components already made for it: Omnifaces, Primefaces etc. JAX-RS is for web services. Have fun!
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/q/24405727
tagged with: spring-boot
tagged with: spock
has comment: http://stackoverflow.com/comment/134737690
score: 43
accepted answer: http://stackoverflow.com/a/24412145
upvote count: 43
tagged with: groovy
has title: How to start Spring Boot app in Spock Integration Test
downvote count: 0
has answer: http://stackoverflow.com/a/44624014
possible better answer: http://stackoverflow.com/a/43480494
favorite count: 0
has body: What is the best way to run an integration test (e.g., @IntegrationTest) with Spock? I would like to bootstrap the whole Spring Boot application and execute some HTTP calls to test the whole functionality. Spring Boot app starts in this working JUnit test (first the app runs and then the tests execute): @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = MyServer.class) @WebAppConfiguration @IntegrationTest class MyTest { RestTemplate template = new TestRestTemplate(); @Test public void testDataRoutingWebSocketToHttp() { def a = template.getForEntity("http://localhost:8080", String.class) println a } } But with Spock the application doesn't start (how can I get it to start?): @SpringApplicationConfiguration(classes = MyServer.class) @WebAppConfiguration @IntegrationTest class MyTestSpec extends Specification { RestTemplate template = new TestRestTemplate(); def "Do my test"() { setup: def a = template.getForEntity("http://localhost:8080", String.class) expect: println a } } For Spock, of course, I have specified the proper dependencies in my Gradle build file: ... dependencies { testCompile 'org.spockframework:spock-core:0.7-groovy-2.0' testCompile 'org.spockframework:spock-spring:0.7-groovy-2.0' } ...
has answer: http://stackoverflow.com/a/43480494
has answer: http://stackoverflow.com/a/41812611
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24412145
tagged with: java
tagged with: gradle
type: Question

http://stackoverflow.com/comment/37642840
type: AnswerComment
score: 0
type: Comment
has text: One option would be to modify your AsyncTask such that it returns an array from doInBackground (and this array gets passed to onPostExecute) and in `onPostExecute` use this array to configure the adapter. Care must be taken that when onPostExecute runs, the activity is still in a valid state (i.e. don't set the adapter if the activity has been destroyed etc.)
comment on: http://stackoverflow.com/a/24347263

http://stackoverflow.com/comment/37767165
has text: yeah..of course..you can always tell these things to them..they will fix it and will try to maximize `corner test cases` in other questions also
comment on: http://stackoverflow.com/q/24413007
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24422679
type: Answer
answers question: http://stackoverflow.com/q/24422678
upvote count: 6
has body: I find using Hibernate with Spring's XML config fairly intuitive, but if you've never added it to a project before, it can be a pain to get working correctly. Using Spring's XML config is my preferred option for Hibernate 4. So you've set up a Spring project and got everything working. You now want to add Hibernate. I always like to configure Hibernate in a separate XML file called something like database-servlet.xml inside your WEB-INF directory, but the name doesn't really matter as long as its on the classpath. My new database-servlet.xml looks like this: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"> </beans> You'll notice I imported the tx and jdbc Spring namespaces. This is because we are going to use them quite heavily in this config file. First thing you want to do is enable annotation based transaction management (@Transactional). The main reason that people use Hibernate in Spring is because Spring will manage all your transactions for you. Add the following line to your configuration file: <tx:annotation-driven /> We need to create a data source. The data source is basically the database that Hibernate is going to use to persist your objects. Generally one transaction manager will have one data source. If you want Hibernate to talk to multiple data sources then you have multiple transaction managers. The type of data source will depend on what you want it to accomplish. You can specify an existing database, or you c…
accepted answer of: http://stackoverflow.com/q/24422678
downvote count: 1
score: 5
type: AcceptedAnswer

http://stackoverflow.com/q/24407640
has comment: http://stackoverflow.com/comment/37757709
has comment: http://stackoverflow.com/comment/37756803
tagged with: java
has comment: http://stackoverflow.com/comment/37758273
tagged with: concurrency
type: Question
has body: I have 2 methods, one to add a message addMessage And one to get all messages and clear the list: getMessagesToSendAndClear Is it possible to allow multiple threads to call AddMessage at the same time, but keep calls "on hold" when getMessagesToSendAnClear is being called? getMessagesToSendAnClear is only called by 1 thread. With "on hold" i mean the same effect as when using synchronized. I can't put synchronized in front of the methods cause than addMessage can only be called by 1 thread at a time. [edit] I started thinking that getMessagesToSendAndClear may only be called when addMessage isn't called. Difficult one! [edit] Maybe also interested is that my write method (addMessage) is very cheap and called very frequently and my read method (getMessagesToSendAnClear) is slow and called rarely.
has comment: http://stackoverflow.com/comment/37756943
score: 0
has comment: http://stackoverflow.com/comment/37756564
has comment: http://stackoverflow.com/comment/37756496
has comment: http://stackoverflow.com/comment/37756597
has comment: http://stackoverflow.com/comment/37756443
has title: Block access to one method while another is called?
answer count: 0
has comment: http://stackoverflow.com/comment/37757817
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37757397
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37757926

http://stackoverflow.com/a/24437655
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24417729
downvote count: 1
has body: Like most issues related to Hibernate annotations, I resolved this by eliminating them altogether and doing it the old fashioned way (making separate queries in my transaction for creating/updating a user and then creating/updating each user property record). If anyone has a Hibernate solution that works, I'm happy to accept that answer.
score: -1

http://stackoverflow.com/a/24316429
has comment: http://stackoverflow.com/comment/99577531
type: Answer
score: 339
has comment: http://stackoverflow.com/comment/130164823
has comment: http://stackoverflow.com/comment/112963033
answers question: http://stackoverflow.com/q/24308146
has comment: http://stackoverflow.com/comment/91069461
has comment: http://stackoverflow.com/comment/112680054
has comment: http://stackoverflow.com/comment/55593452
has comment: http://stackoverflow.com/comment/113888222
has body: Eran's answer described the differences between the two-arg and three-arg versions of reduce in that the former reduces Stream&lt;T&gt; to T whereas the latter reduces Stream&lt;T&gt; to U. However, it didn't actually explain the need for the additional combiner function when reducing Stream&lt;T&gt; to U. One of the design principles of the Streams API is that the API shouldn't differ between sequential and parallel streams, or put another way, a particular API shouldn't prevent a stream from running correctly either sequentially or in parallel. If your lambdas have the right properties (associative, non-interfering, etc.) a stream run sequentially or in parallel should give the same results. Let's first consider the two-arg version of reduction: T reduce(I, (T, T) -&gt; T) The sequential implementation is straightforward. The identity value I is "accumulated" with the zeroth stream element to give a result. This result is accumulated with the first stream element to give another result, which in turn is accumulated with the second stream element, and so forth. After the last element is accumulated, the final result is returned. The parallel implementation starts off by splitting the stream into segments. Each segment is processed by its own thread in the sequential fashion I described above. Now, if we have N threads, we have N intermediate results. These need to be reduced down to one result. Since each intermediate result is of type T, and we have several, we can use the same accumulator function to reduce those N intermediate results down to a single result. Now let's consider a hypothetical two-arg reduction operation that reduces Stream&lt;T&gt; to U. In other languages, this is called a "fold" or "fold-left" operation so that's what I'll call it here. Note this doesn't exist in Java. U foldLeft(I, (U, T) -&gt; U) (Note that the identity value I is of type U.) The sequential version of foldLeft is just like the sequential version of reduce except that the int…
has comment: http://stackoverflow.com/comment/114087755
has comment: http://stackoverflow.com/comment/48396076
has comment: http://stackoverflow.com/comment/48410931
has comment: http://stackoverflow.com/comment/138717992
has comment: http://stackoverflow.com/comment/113760617
downvote count: 0
has comment: http://stackoverflow.com/comment/104237647
has comment: http://stackoverflow.com/comment/48402891
upvote count: 339
has comment: http://stackoverflow.com/comment/112945469

http://stackoverflow.com/comment/37532061
has text: Yep, just checked it, the excel limitation is 10000. see this link -----> http://office.microsoft.com/en-gb/excel-help/excel-specifications-and-limits-HA103980614.aspx . just create a copy of that file, read the first 10k line and delete them, read the next 10k line and delete them and continue until the file is empty. This is a stupid limitation of excel so good luck
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24288705
score: 0

http://stackoverflow.com/comment/37491533
type: Comment
comment on: http://stackoverflow.com/a/24267150
type: AnswerComment
has text: At the start of my script I get the screenHeight and screenWidth through the function i just uploaded to my code
score: 0

http://stackoverflow.com/comment/37619817
has text: Also, the Singleton `instance` should be static.
comment on: http://stackoverflow.com/a/24335387
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24362980
has title: When I close a BufferedInputStream, is the underlying InputStream also closed?
linked to: http://stackoverflow.com/q/11263926
type: Question
tagged with: bufferedinputstream
has answer: http://stackoverflow.com/a/24363126
has answer: http://stackoverflow.com/a/24363087
upvote count: 21
accepted answer: http://stackoverflow.com/a/24363087
has comment: http://stackoverflow.com/comment/37672730
favorite count: 0
duplicate of: http://stackoverflow.com/q/11263926
answer count: 5
possible better answer: http://stackoverflow.com/a/24363126
has answer: http://stackoverflow.com/a/24363036
has body: InputStream in = SomeClass.getInputStream(...); BufferedInputStream bis = new BufferedInputStream(in); try { // read data from bis } finally { bis.close(); in.close(); } The javadoc for BufferedInputStream.close() doesn't mention whether or not the underlying stream is closed: Closes this input stream and releases any system resources associated with the stream. Once the stream has been closed, further read(), available(), reset(), or skip() invocations will throw an IOException. Closing a previously closed stream has no effect. Is the explicit call to in.close() necessary, or should it be closed by the call to bis.close()?
linked to: http://stackoverflow.com/q/12199142
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24363082
downvote count: 0
score: 21
linked to: http://stackoverflow.com/q/1388602
tagged with: java
has answer: http://stackoverflow.com/a/24363081
tagged with: inputstream

http://stackoverflow.com/a/24278228
upvote count: 1
has comment: http://stackoverflow.com/comment/37512425
answers question: http://stackoverflow.com/q/24278179
has comment: http://stackoverflow.com/comment/37511285
has comment: http://stackoverflow.com/comment/37511839
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24278179
type: Answer
has comment: http://stackoverflow.com/comment/37511914
score: 1
has body: You can't do that cause super() has to be called on the first line. That said, you can use dependency injection and instantiate AnotherClass before you call new MyClass(new AnotherClass()). Then the constructor will look like this: public MyClass(AnotherClass a) { super(a); this.property = a; } In case you cannot change MyClass you can wrap it with a wrapper class and apply the same "trick".

http://stackoverflow.com/q/24269659
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/24270347
type: Question
has answer: http://stackoverflow.com/a/24270347
linked to: http://stackoverflow.com/q/3565840
has comment: http://stackoverflow.com/comment/139984490
downvote count: 0
has title: Checkstyle suggests impossible constant ordering
linked to: http://stackoverflow.com/q/4023185
has body: I have several long String constants (static final variables) that share a common fragment. The fragment does not have any meaning on its own, so I declared it as a "private static final". For example: private static final XML_H = "&lt;?xml ...."; public static final DOC_1 = XML_H + "&lt;tag...."; public static final DOC_2 = XML_H + "&lt;tag...."; Now I get an warning from checkstyle Variable access definition in wrong order Which is from the Declaration Order Check rule which is saying private should come after public. If I move XML_H to where it is "supposed" to be, the code does not compile because field cannot be referred to before it is declared. To me this seems to be a bug in the rule because this is a real language limitation and there's no other way to do this. I think the rule should exclude this case from checking. Do you guys agree or is there any way to improve the code without the problem?
has answer: http://stackoverflow.com/a/24272728
answer count: 3
favorite count: 0
tagged with: checkstyle
has answer: http://stackoverflow.com/a/79378567
accepted answer: http://stackoverflow.com/a/24272728
type: AnsweredQuestion
score: 3

soapui
tags question: http://stackoverflow.com/q/24335519
type: Tag
tag name: soapui
tags question: http://stackoverflow.com/q/24299707
tags question: http://stackoverflow.com/q/24339739

http://stackoverflow.com/a/27052213
score: 10
answers question: http://stackoverflow.com/q/24396544
has body: I was working on a similar problem of predicate chaining and came up with the following public static &lt;T&gt; Predicate&lt;T&gt; chain (Function&lt;T,Predicate&lt;T&gt;&gt; mapFn, T[]args) { return Arrays.asList(args) .stream() .map(x-&gt;mapFn.apply(x)) .reduce(p-&gt;false, Predicate::or); } The first parameter to chain is a lambda (Function) that returns a lambda (Predicate) so it needs a couple of arrows public static void yourExample() { String[] filterVals = { "1", "2" }; Arrays.asList("1","2","3") .stream() .filter(chain(x-&gt; (y-&gt; y.equals(x)), filterVals)) .count(); } For comparison, here is what I was trying to achieve... public static void myExample() { String[] suffixes = { ".png", ".bmp" }; Predicate&lt;String&gt; p = chain (x-&gt; y-&gt; y.endsWith(x), suffixes); File[] graphics = new File("D:/TEMP").listFiles((dir,name)-&gt;p.test(name)); Arrays.asList(graphics).forEach(System.out::println); }
has comment: http://stackoverflow.com/comment/96557461
upvote count: 10
type: Answer
downvote count: 0

http://stackoverflow.com/a/24320002
answers question: http://stackoverflow.com/q/24319939
has body: You are missing } for switch case.
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/24374867
has comment: http://stackoverflow.com/comment/37698310
answer count: 3
score: 70
possible better answer: http://stackoverflow.com/a/30463130
favorite count: 0
upvote count: 70
has title: Label and Text differences in JavaFX
accepted answer: http://stackoverflow.com/a/24389619
type: AnsweredQuestion
tagged with: fxml
has answer: http://stackoverflow.com/a/51566616
downvote count: 0
has comment: http://stackoverflow.com/comment/37695309
has body: What is the difference between javafx.scene.text.Text and javafx.scene.control.Label? The documentation says: Label is a non-editable text control. The Text class defines a node that displays a text. But the Label class has a method "setText" and "textProperty", therefore is editable.
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/24389619
has answer: http://stackoverflow.com/a/30463130
type: Question

http://stackoverflow.com/q/24307440
linked to: http://stackoverflow.com/q/1673841
has comment: http://stackoverflow.com/comment/37569161
tagged with: java
has comment: http://stackoverflow.com/comment/37567164
has answer: http://stackoverflow.com/a/24307974
score: 0
has comment: http://stackoverflow.com/comment/37566654
answer count: 3
has comment: http://stackoverflow.com/comment/37567150
has comment: http://stackoverflow.com/comment/37567536
tagged with: abstract-methods
has answer: http://stackoverflow.com/a/24307987
has body: I have a class (let's say Vehicle) with a rather large number of subclasses (Car, Bike, ..). Every subclass stores specific information on the type of the subclass (# of tires, ..). I want to ensure that all this information is already enforced (at compile-time). So I don't want to specify this data in the constructor of the subclass (because I might forget to set some of them). I could put this info in the constructor of Vehicle, but this would clutter code quite a lot, since I have many of those parameters. public class Vehicle { int numberOfTires; public Vehicle(int numberOfTires, ...) { ... } } public class Bike { public Bike() { super(2,...); ... } } I end up with completely unreadable constructors. It would also store this info per instance, even though it is specific to the subclass. An alternative way is to introduce abstract static getters/setters and store the info in the subclasses. public class Vehicle { ... abstract public int getNumberOfTires(); } public class Bike { static int numberofTires = 2; ... public int getNumberOfTires() { return numberOfTires; } } This seems way cleaner and also stores the info per subclass and not per instance but there will be a lot of code duplication in the subclasses. Right now, all the subclasses contain ~20 setters/getters but virtually no real functionality. Is there a clean way of avoiding this? Perhaps using the Factory method or alike?
has comment: http://stackoverflow.com/comment/37566745
type: UnansweredQuestion
has title: Avoiding code duplication with Java abstract methods
has answer: http://stackoverflow.com/a/24307949
has comment: http://stackoverflow.com/comment/37566583
type: Question

http://stackoverflow.com/q/24359661
tagged with: mysql
type: Question
tagged with: native
tagged with: jpa
has title: How to Map Native Query result to java Class
has comment: http://stackoverflow.com/comment/37666987
has comment: http://stackoverflow.com/comment/37666802
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24360158
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
has body: I am working on java nativequery in jpa.I have get result in class Practice but how i map the distance variable to my Practice class .Please help me. List&lt;Practice&gt; resultData=(List&lt;Practice&gt;)em.createNativeQuery("SELECT *, ( 3959 * acos( cos( radians(?1) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(?2) ) + sin( radians(?1) ) * sin( radians( latitude ) ) ) ) AS distance FROM tb_practice HAVING distance &lt; 200 ORDER BY distance;",Practice.class) .setParameter(1, latitude) .setParameter(2, longitude) .getResultList(); This is Result of my query: Please help how to map distance variable to my class practice. @Entity(name = "tb_practice") public class Practice { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; private String address; private String city; private String distance; } This is Pratice table.

http://stackoverflow.com/comment/37491493
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24267881
has text: and you question is what exactly?

http://stackoverflow.com/a/24279595
answers question: http://stackoverflow.com/q/24278576
type: Answer
has body: An educated guess, because your question is unclear: String[] words = csv.split(", *");
score: 0

http://stackoverflow.com/comment/37687141
comment on: http://stackoverflow.com/a/24355696
has text: Here is an example that try to do case insensitive mapping https://gist.github.com/elaatifi/7009879
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37539887
has text: What is code review? I fairly new to the site, sorry.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24293084

http://stackoverflow.com/comment/64390600
type: AnswerComment
has text: First of all, let me just emphasize that the bigger problem than slowness (albeit a BIG problem) with reading files during unit testing, is inconsistency, loss of repeatability and loss of isolation. Reading files depends on I/O, which means that it might fail, it might take a different amount of time each run, etc. Doing I/O operations during a test inhibit it from being a unit test. Regarding XML generation, define your generator to receive the output writer/stream as a parameter to the constructor/method or by injection. The unit test will provide a mock output buffer.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24387268

layout-manager
tags question: http://stackoverflow.com/q/24320436
tags question: http://stackoverflow.com/q/24289018
tags question: http://stackoverflow.com/q/24303014
tags question: http://stackoverflow.com/q/24317998
tags question: http://stackoverflow.com/q/24276807
tags question: http://stackoverflow.com/q/24419848
type: Tag
tags question: http://stackoverflow.com/q/24424122
tags question: http://stackoverflow.com/q/24306932
tags question: http://stackoverflow.com/q/24397173
tags question: http://stackoverflow.com/q/24425355
tags question: http://stackoverflow.com/q/24383848
tags question: http://stackoverflow.com/q/24413279
tags question: http://stackoverflow.com/q/24425542
tags question: http://stackoverflow.com/q/24291030
tag name: layout-manager

http://stackoverflow.com/a/24934058
upvote count: 1
type: Answer
has body: To display error message properly you have to put try and catch in the right place and at right time, To summarize you can use java.sql.SQLException as it can occur can both in the driver and the database. The basic and common scheme of any JDBC operations are: 1). Register your Driver 2). Open a connection. 3). Execute query 4). Extracting datas 5). Closing, Close everything: the ResultSet, the Statement, and the Connection. This is how you correctly catch the error or exception causes : try{ //1).Register JDBC driver Class.forName("com.mysql.jdbc.Driver"); // 2). Open a connection conn = DriverManager.getConnection(DB_URL,USER,PASS); //3). Execute a query System.out.println("Creating statement..."); Statement stmt = conn.createStatement(); String sql; sql = "SELECT id, first, last, age FROM Employees"; ResultSet rs = stmt.executeQuery(sql); //4). Extracting datas while(rs.next()){ ................. ............. } //5).close everything rs.close(); stmt.close(); conn.close(); } catch(SQLException se){ //Handle errors for JDBC se.printStackTrace(); } catch(Exception e){ //Handle errors for Class.forName / JDBC driver e.printStackTrace(); }finally{ //finally block used to close resources try{ if(conn!=null) conn.close(); } catch(SQLException se){ se.printStackTrace(); }//end finally try }//end try And about JDBC connection pool , you can check out links provided below: How to establish a connection pool in JDBC?
answers question: http://stackoverflow.com/q/24332302
downvote count: 0
score: 1

http://stackoverflow.com/comment/37630093
comment on: http://stackoverflow.com/q/24340116
has text: are you using an XML parser?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24411228
tagged with: security
tagged with: rest
has title: Securing REST Web Service using token (Java)
upvote count: 3
has body: This question is in some way related to the below linked question. However, I need a little more clarity on some aspects and some additional information. Refer: REST Web Service authentication token implementation Background: I need to implement security for a REST Web Service using token The webservice is intended for use with Java client. Hence, form authentication and popups for credentials are not useful. I'm new to REST security and encryption This is what I have understood till now: For first request: User establishes https connection (or container ensures https using 301) User POSTs username and password to login service If credentials are valid we: Generate a random temporary token Store the random token on server mapping it to actual username Encrypt the token using a symmetric key only known to server Hash the encrypted token Send the encrypted token and the hash to the client For subsequent requests: Client sends this encrypted token and hash combination (using username field of basic?) We make sure the encrypted token is not tampered using the hash and then decrypt it We check the decrypted token in the session-tracking-table for a not-expired entry and get the actual username (expiry to be managed by code?) If the username is found, based on allowed roles, allowed operations are configured More details: Since client is a java client, the first request can be a POST containing the credentials. However, this looks like it may expose the credentials before the https gets established. Hence should there be a dummy GET to a secured resource so that https is established first? Assuming above is required, the second request is a LoginAction POST with credentials. This request is handled manually (not using container's authorisation). Is this right? The above LoginAction returns the user the combination of encrypted token + hash User sets it to the header that is used by BASIC authentication mechanism (field username) We implement a JAASRealm to decrypt and val…
tagged with: encryption
tagged with: web-services
linked to: http://stackoverflow.com/q/15490265
has answer: http://stackoverflow.com/a/24534022
type: AnsweredQuestion
score: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24507614
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/24534022
favorite count: 0
possible better answer: http://stackoverflow.com/a/24507614

http://stackoverflow.com/q/24349451
has answer: http://stackoverflow.com/a/24349548
has answer: http://stackoverflow.com/a/24349653
has body: I have the following code for displaying the sum of two consecutive element of ArrayList until the element left is one.for example:- if i entered 1 2 3 4 5 output 3 7 5 //adding the two consecutive last one is as it is 10 5//doing the same thing 15 code import java.util.*; import java.lang.Integer; class Substan{ ArrayList &lt;Integer&gt; list = new ArrayList &lt;Integer&gt; (); ArrayList &lt;Integer&gt; newList = new ArrayList &lt;Integer&gt; ();// this will be the list containing the next sequence. int index=0; int sum=0; Substan(){ Scanner read = new Scanner(System.in); String choice; System.out.println("Enter the elements of the array"); do{ int element = read.nextInt(); list.add(element); System.out.println("More?"); choice = read.next(); }while(choice.equals("y") || choice.equals("Y")); } /* precondition- we have the raw list that user has enterd. postcondition - we have displayed all the sublists,by adding two consecutives numbers and the last one is having one element. */ void sublist(){ while(noofElementsIsNotOneInList()){ index =0; while(newListIsNotComplete()){ if(nextElementIsThere()){ sum = addTheConsecutive(); } else{ sum = getLastNumber(); } storeSumInNewList(); } displayTheNewList(); System.out.println(""); updateTheLists(); } displayTheNewList(); //as we have danger of Off By One Bug (OBOB) System.out.println(""); } private boolean noofElementsIsNotOneInList(){ boolean isnotone = true; int size = list.size(); if ( size == 1){ isnotone = false; } return isnotone; } private boolean newListIsNotComplete(){ boolean isNotComplete = true; int listSize = list.size(); int newListSize = newList.size(); if (listSizeIsEven()){ if ( newListSize == listSize/2){ isNotComplete = false; } } else{ if( newListSize == (listSize/2) +1){ isNotComplete = false; } } return isNotComplete; } private boolean listSizeIsEven(){ if ( list.size()%2 == 0 ){ return true; } else{ return false; } } /* we are at some index. returns true if we have an element at (index+1) index. */ pr…
has answer: http://stackoverflow.com/a/24349612
has title: How to decide the state of an object before starting to code?
type: Question
has answer: http://stackoverflow.com/a/24349560
has comment: http://stackoverflow.com/comment/37646650
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/24349604
has comment: http://stackoverflow.com/comment/37646670
answer count: 5
type: UnansweredQuestion
tagged with: methodology

http://stackoverflow.com/comment/37773043
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24414534
has text: I'm glad I was able to help!

http://stackoverflow.com/q/24418782
has body: I have been trying to wrap my head around this. Please help me where I screwed up. Similarily to calls on this url: http://www.codejava.net/java-se/applet/call-javascript-function-from-java-applet I made calls from within my Java Applet's init and start methods to the browser. Javascript goes like: function getHHandler() { console.log("handler requested from applet"); return HHandler.handler(); } HHandler.instance = null; function HHandler() { ... } HHandler.prototype = { doStuff : function() { } }; HHandler.handler = function() { if(HHandler.instance == null) HHandler.instance = new HHandler(); return jsb.instance; }; Here's my debug-ready method from the applet - nothing fancy at least it should be: private Object getHandlerObject() { Object jo = browser.call("getHHandler", null); log("call getJSBHandler():" + jo); return jo; } I've been through oracles examples, countless sites, tutorials, documentation and all point to the same call and eval methods. Experience What happens is when the applet calls to the getHHandler javascript function -- I can see the console log in the browser seeing that the action did actually happen, however the return statement from javascript never makes it back to the Java code. So Java is left with a null object which I have no use of. I even double-checked just to be sure that right before the return statement the js var is not null. I can understand why browser.call("HHandler.handler", null); would freak out and throw a NotAFunction exception, but in this case everything seems to go smoothly, but the return value. &lt;applet id="appletId" archive="../path/to/applet.jar" code=com.package.Main.class width="1" height="1" mayscript&gt;&lt;/applet&gt; It doesn't even matter if the applet is self-signed or not signed at all. Mayscript is added - not that it makes a difference. Any suggestions/inputs?
score: 0
answer count: 1
tagged with: applet
tagged with: return
has comment: http://stackoverflow.com/comment/37794295
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24423923
tagged with: java
type: Question
has title: Java Applet calling javascript function with return value
tagged with: null
tagged with: javascript

http://stackoverflow.com/comment/37762134
comment on: http://stackoverflow.com/q/24410326
score: 0
type: Comment
type: QuestionComment
has text: Thank you @maress, but honestly i can't say if i'm using JPA or Hibernate .. I'm very new to java / spring / hibernate world and i'm learning day by day building this project. btw i think i found a good solution (answer below): remove object from the Company Set

http://stackoverflow.com/comment/37567575
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24307259
has text: you can indent all the lines of code by four spaces, or you can select a block of code and click the button that looks like this { } in the little toolbar at the top

http://stackoverflow.com/a/24374760
has comment: http://stackoverflow.com/comment/37731984
has comment: http://stackoverflow.com/comment/37695171
has comment: http://stackoverflow.com/comment/37722102
has comment: http://stackoverflow.com/comment/37725031
has comment: http://stackoverflow.com/comment/37729706
has comment: http://stackoverflow.com/comment/38222899
has body: I trimmed down your HTML sample to the following: MovieOne Movies Genre Action MovieTwo Coming Soon MovieThree Movies Genre Action Hopefully it is representative of all your cases! Don't use a counter, but use the actual WebElements to iterate over: // default all your variables to TBA, like: String genre = "TBA"; // find all the listings on the page... List<WebElement> linstings = driver.findElements(By.className("ddtitle")); // ... and iterate over them for (WebElement listing : linstings) { // grab whatever is the _first_ element under the TH ... WebElement potentialMovie = listing.findElement(By.xpath("following-sibling::*[1]")); // ... check if it has a child element CAPTION if (potentialMovie.findElement(By.xpath("caption")) != null) { // make all your assignments, for example: genre = potentialMovie.findElement(By.xpath("tr[2]/td[1]")).getText(); } } Please note that this code is untested, your mileage may vary!
has comment: http://stackoverflow.com/comment/37730989
has comment: http://stackoverflow.com/comment/38230212
has comment: http://stackoverflow.com/comment/37729974
has comment: http://stackoverflow.com/comment/37730077
downvote count: 0
answers question: http://stackoverflow.com/q/24374619
has comment: http://stackoverflow.com/comment/38229953
has comment: http://stackoverflow.com/comment/37729455
type: Answer
has comment: http://stackoverflow.com/comment/37695356
has comment: http://stackoverflow.com/comment/38232441
score: 1
has comment: http://stackoverflow.com/comment/37730753
upvote count: 1

http://stackoverflow.com/comment/37917573
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24412523
has text: Stop looking at `WEB-INF/lib/`. That's step 25. Step 1 isn't working. If it's not deploying anything, why should there be anything in `WEB-INF/lib/`??

http://stackoverflow.com/comment/37771783
has text: I do not want to criticize anybody just I want to understand your train of thoughts cuz it seems you are professinal
type: Comment
comment on: http://stackoverflow.com/a/24415596
type: AnswerComment
score: 0

http://stackoverflow.com/a/24294040
has body: You need to use the getText method instead of nextText because you want the content of the tag, not the next text. Also, use this format: while (eventType != XmlPullParser.END_DOCUMENT){ tagName = xpp.getName(); if(eventType == XmlPullParser.START_TAG){ if (tagName != null){ if (tagName.equalsIgnoreCase("Command")){ Log.d("Command", xpp.getText()); } ... } } eventType = xpp.next(); } Add a root element, like &lt;Configuration&gt; that englobes the whole file.
has comment: http://stackoverflow.com/comment/37541749
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24292908
accepted answer of: http://stackoverflow.com/q/24292908
upvote count: 2
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/37588396
type: QuestionComment
has text: @MadProgrammer Yes sir and be able to add one
comment on: http://stackoverflow.com/q/24318478
score: 0
type: Comment

http://stackoverflow.com/comment/37577797
has text: @JoshuaTaylor In case you or someone else is not aware, *doubling* the size on re-allocation is not necessary, it's just the simplest option (the smallest integer > 1). The amortization works just as well for *any* constant **factor**.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24312499
score: 0

http://stackoverflow.com/comment/37617802
score: 0
type: Comment
has text: @user3427072: Changes made to the *object* will be seen - but nothing the caller does will change the value of the *field*. It will still refer to the same object as before... even if that object has its contents changed. (It's important to understand that the value of the field isn't an object, it's just a reference.)
comment on: http://stackoverflow.com/a/24334208
type: AnswerComment

http://stackoverflow.com/comment/37766475
has text: Do you know about polymorphism?
type: Comment
score: 2
comment on: http://stackoverflow.com/q/24412848
type: QuestionComment

obiee
tag name: obiee
tags question: http://stackoverflow.com/q/24358744
type: Tag

http://stackoverflow.com/comment/37772538
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24415702
type: Comment
has text: i have this in my xml `<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background" android:gravity="fill" tools:context="com.ucapp.uppercrustapp.MainActivity$PlaceholderFragment" >` and is it aproblem that im using fragment_main.xml?

http://stackoverflow.com/q/24412246
favorite count: 0
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: maven
score: 1
tagged with: java
upvote count: 1
has body: I have a google app engine project with java using maven, and every time I want to see the changes I made even to a simple jsp or html, I have to run clean install then run the server. I want to know if it's possible to see the changes without having to go through this long process. I have a GAE project structure that contains a war and ear folders. I run the clean install on the war, then I go to the ear folder to run the "appengine:devapp".
type: Question
tagged with: eclipse
has answer: http://stackoverflow.com/a/24412867
has title: Automatic build of GAE maven project from eclipse
downvote count: 0
answer count: 1

finalize
type: Tag
tag name: finalize
tags question: http://stackoverflow.com/q/24392123

http://stackoverflow.com/a/24268138
has comment: http://stackoverflow.com/comment/37492994
upvote count: 3
has comment: http://stackoverflow.com/comment/37493162
has body: The color of the text has nothing to do with the JScrollPane. Use a text component that support multiple colors, such as JTextPane or JEditorPane. Recommended reading: http://docs.oracle.com/javase/tutorial/uiswing/components/text.html
downvote count: 0
has comment: http://stackoverflow.com/comment/37492848
answers question: http://stackoverflow.com/q/24268062
has comment: http://stackoverflow.com/comment/37492921
type: Answer
score: 3

jscrollpane
tags question: http://stackoverflow.com/q/24317964
tag name: jscrollpane
tags question: http://stackoverflow.com/q/24426197
tags question: http://stackoverflow.com/q/24303923
type: Tag
tags question: http://stackoverflow.com/q/24319327
tags question: http://stackoverflow.com/q/24303656
tags question: http://stackoverflow.com/q/24420761
tags question: http://stackoverflow.com/q/24337754
tags question: http://stackoverflow.com/q/24356547
tags question: http://stackoverflow.com/q/24278389
tags question: http://stackoverflow.com/q/24303014
tags question: http://stackoverflow.com/q/24268062
tags question: http://stackoverflow.com/q/24423922
tags question: http://stackoverflow.com/q/24286357
tags question: http://stackoverflow.com/q/24370591

http://stackoverflow.com/q/24344086
tagged with: java
upvote count: 1
has title: How to use @Size validation while using Float field with javax library?
type: Question
has answer: http://stackoverflow.com/a/24350866
has body: I am trying to use maximum size validation with Float datatype with javax validations. Here is example @NotNull @Size(min = 5, max = 10) public Float getPhone(){ } But I am getting error that I can't use Size validation with Float datatype. Any Ideas?
tagged with: validation
answer count: 1
downvote count: 0
favorite count: 0
tagged with: hibernate-validator
type: UnansweredQuestion
score: 1

http://stackoverflow.com/q/24360079
type: UnansweredQuestion
has body: Im getting the following error when trying to generate the episode file using xjc2-maven-plugin. This error seems to be with META-INF folder creation. Any idea on how to solve this. I have been stuck of this for quite some time. the command line equivalent xjc command seems to work with the same inputs. [INFO] parsing a schema... [INFO] compiling a schema... [ERROR] null[-1,-1] org.xml.sax.SAXParseException; Failed to write to src\main\generated\META-INF\sun-jaxb.episode at com.sun.tools.xjc.addon.episode.PluginImpl.run(PluginImpl.java:209) at com.sun.tools.xjc.model.Model.generateCode(Model.java:294) at com.sun.tools.xjc.Driver.run(Driver.java:363) at org.codehaus.mojo.jaxb2.AbstractXjcMojo.execute(AbstractXjcMojo.java:316) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213) at org.apache.maven.cli.MavenCli.main(MavenCli.java:157) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccesso…
tagged with: jaxb2
score: 3
tagged with: pom.xml
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/37675164
tagged with: code-generation
has comment: http://stackoverflow.com/comment/37671997
tagged with: maven
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/37676205
has title: jaxb2-maven-plugin is giving me a SAXParseException when trying to generate META-INF\sun-jaxb.episode file
answer count: 0
downvote count: 0

http://stackoverflow.com/q/24291170
answer count: 1
has title: How do I map another column into Hibernate bean?
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
accepted answer: http://stackoverflow.com/a/24308416
tagged with: criteria
has body: I have an object that is mapped to Hibernate using a hbm.xml file. The BEAN/object for the table includes an extra field, with appropriate getter/setters. I want to do something like: SELECT T.*, 'XYZ' as otherData FROM table T and have all the data mapped into the BEAN, including the value of the fake/additional column - 'otherData.' This should be simple and maybe I'm missing something easy, but I cant get it to work. I've tried using createSQLquery() with addEntity(), addScalar(), setResultTransformer() and createCriteria() with a projectionList() and setResultTransformer() and whatever else I can think of and nothing gives the desired results. I dont want a generic list of Objects that I have to parse through to build my objects, and I don't want to have to specify every column of the table while building this query. Is there any way this can be done?
has answer: http://stackoverflow.com/a/24308416
score: 0

http://stackoverflow.com/a/24311291
answers question: http://stackoverflow.com/q/24299724
type: Answer
accepted answer of: http://stackoverflow.com/q/24299724
has body: I think you can use the existing TabPane, but you'll need to manage the tab content yourself; just switch the tab content for the selected tab with a change listener. import java.util.HashMap; import java.util.Map; import javafx.animation.ScaleTransition; import javafx.animation.SequentialTransition; import javafx.application.Application; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.Tab; import javafx.scene.control.TabPane; import javafx.scene.layout.BorderPane; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.scene.text.Text; import javafx.stage.Stage; import javafx.util.Duration; public class TransitioningTabPane extends Application { @Override public void start(Stage primaryStage) { TabPane tabPane = new TabPane(); Tab tab1 = new Tab("Tab 1"); Tab tab2 = new Tab("Tab 2"); tabPane.getTabs().addAll(tab1, tab2); Map&lt;Tab, Node&gt; tabContent = new HashMap&lt;&gt;(); tabContent.put(tab1, createTab1Content()); tabContent.put(tab2, createTab2Content()); // Initial state: tab1.setContent(tabContent.get(tab1)); tabPane.getSelectionModel().select(tab1); // State change manager: tabPane.getSelectionModel() .selectedItemProperty() .addListener( (obs, oldTab, newTab) -&gt; { oldTab.setContent(null); Node oldContent = tabContent.get(oldTab); Node newContent = tabContent.get(newTab); newTab.setContent(oldContent); ScaleTransition fadeOut = new ScaleTransition( Duration.seconds(0.5), oldContent); fadeOut.setFromX(1); fadeOut.setFromY(1); fadeOut.setToX(0); fadeOut.setToY(0); ScaleTransition fadeIn = new ScaleTransition( Duration.seconds(0.5), newContent); fadeIn.setFromX(0); fadeIn.setFromY(0); fadeIn.setToX(1); fadeIn.setToY(1); fadeOut.setOnFinished(event -&gt; { newTab.setContent(newContent); }); SequentialTransition crossFade = new SequentialTransition( fadeOut, fadeIn); crossFade.play(); }); BorderPane root = new BorderPane(tabPane); Scene scene = new Scene(root, 600, …
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37690541
has text: you could set a break point where this boolean array is created and run your project in debug mode then step through it and check your variables to see where exactly your error occurs. That might help you to figure it out on your own. Debugging is a good skill to have anyway!
type: Comment
comment on: http://stackoverflow.com/q/24372403
score: 0
type: QuestionComment

http://stackoverflow.com/a/24282434
accepted answer of: http://stackoverflow.com/q/24279344
answers question: http://stackoverflow.com/q/24279344
score: 0
type: Answer
has body: Get the channel you're locking with from the FileOutputStream instead of from a separate RandomAccessFile.
type: AcceptedAnswer

http://stackoverflow.com/comment/37656213
score: 0
type: Comment
has text: Yes i suppose that would work too - not sure why I didn't think of that. haha. But the concept is what the OP is after :)
type: AnswerComment
comment on: http://stackoverflow.com/a/24353276

http://stackoverflow.com/a/24307179
has body: You should use Integer.decode() instead of Integer.parseInt() as it handles hex strings as well. See; http://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#decode(java.lang.String)
score: 0
has comment: http://stackoverflow.com/comment/68849375
upvote count: 1
type: AcceptedAnswer
downvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/24306997
answers question: http://stackoverflow.com/q/24306997

http://stackoverflow.com/q/24320260
score: 1
tagged with: java
upvote count: 1
type: Question
has title: My scanner asks for an input twice
accepted answer: http://stackoverflow.com/a/24320325
has body: I seem to have this problem a lot, I can't quite seem to understand how to work scanners System.out.println("Please enter a number"); Scanner choice1 = new Scanner(System.in); int choiceH = choice1.nextInt(); while(!choice1.hasNextInt()){ System.out.println("Please enter a number"); choice1.next(); } What I want the code to do is ask for a number, and check if the input is a number. My problem is that it asks fro the number twice and I don't know why.
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/24320308
favorite count: 0
has answer: http://stackoverflow.com/a/24320308
has answer: http://stackoverflow.com/a/24320325
tagged with: integer
type: AnsweredQuestion

http://stackoverflow.com/q/24376083
score: 2
tagged with: equals
upvote count: 3
has comment: http://stackoverflow.com/comment/37697441
has answer: http://stackoverflow.com/a/24376148
accepted answer: http://stackoverflow.com/a/24376148
downvote count: 1
has comment: http://stackoverflow.com/comment/37697517
type: Question
type: AnsweredQuestion
tagged with: hashcode
tagged with: java
has answer: http://stackoverflow.com/a/24376159
has answer: http://stackoverflow.com/a/24376113
linked to: http://stackoverflow.com/q/24374127
has answer: http://stackoverflow.com/a/24376175
has title: Is checking hashCode() equality a valid approach to implement equals(Object obj)?
has comment: http://stackoverflow.com/comment/37697479
has body: My hashCode method ensures that equal objects have equal hash codes. My implementation also guarantees that the contrapositive is true, in that equal hash codes imply object equality. Doing something like: @Override public boolean equals(Object obj) { if (this == obj) {return true;} if (obj == null) {return false;} if (getClass() != obj.getClass()) {return false;} return (obj.hashCode() == this.hashCode()); } seems an obvious choice, but I don't see this often. Is this is a good idea in my case, or am I missing something? Also, I'm not sure if this is relevant, but the hashCode and equals methods are in generated classes (and obviously are themselves generated). The reason I mention this is to highlight the fact that these methods will not be maintained manually per say. They are in classes that are created at compile time and are not intended to be changed unless the schema they are based on changes.
favorite count: 0
has answer: http://stackoverflow.com/a/24376112
answer count: 5
possible better answer: http://stackoverflow.com/a/24376113

http://stackoverflow.com/q/24376834
linked to: http://stackoverflow.com/q/23353173
tagged with: google-maps
upvote count: 0
has comment: http://stackoverflow.com/comment/37699001
score: -1
answer count: 2
has body: Hi I want the map inside my app... I copy three tutorial and I change key for every project and the result is " the app is stopped" I use Frangment or SupportFrangment.... Why my Samsung S4 not execute the app for see map? Now I explain my app where I copy and change from this tutorial Premise: I load google-play-service for two times: 1- File->Import->Existing project into workspace-> google-play-services and include in every project 2-Add library google-play-services in properties of project. Where I wrong ?? This is the manifest.xml: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="19" /> <permission android:name="com.example.com.vogella.android.locationapi.maps.permission.MAPS_RECEIVE" android:protectionLevel="signature" /> <uses-feature android:glEsVersion="0x00020000" android:required="true" /> <uses-permission android:name="com.example.com.vogella.android.locationapi.maps.MAPS_RECEIVE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="KeyVALUE API" /> This is a frangment.xml: <fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.MapFragment" /> This is a ShowMapActivity.java: package com.example.com.vogella.android.locationapi.maps; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.Go…
tagged with: android
has answer: http://stackoverflow.com/a/24378320
favorite count: 0
has comment: http://stackoverflow.com/comment/37699170
has title: The app is stopped when load the map
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37699277
has comment: http://stackoverflow.com/comment/37699203
tagged with: java
has answer: http://stackoverflow.com/a/24376864
has comment: http://stackoverflow.com/comment/37699144
has comment: http://stackoverflow.com/comment/37699088
downvote count: 1
type: Question

http://stackoverflow.com/a/25136809
has comment: http://stackoverflow.com/comment/49939020
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24336819
accepted answer of: http://stackoverflow.com/q/24336819
upvote count: 1
has body: A simple workaround is to avoid using Button, which causes the extra words to be added. For example, you may be able to replace it with a TextView, made to look like a button, and add a click listener using View.setOnClickListener(listener) to get the desired effect - see Android docs. There are a number of such listeners in the basic View class which can be added to your UI component using View.setOn&lt;Event&gt;Listener(listener) in your Activity.onCreate method. In your case, a double-tap listener could be constructed with an onTouchListener, though it may require a little experimentation to get the precise result you want.
downvote count: 1
has comment: http://stackoverflow.com/comment/39126775
has comment: http://stackoverflow.com/comment/49890721
has comment: http://stackoverflow.com/comment/40004158
score: 0

http://stackoverflow.com/comment/37648470
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24350302
has text: Ok I think it is working now :o I don't know what the mistake was but now with your code I finally get the String like it was before the notification and that's what I wanted. Thank you :)
score: 0

http://stackoverflow.com/a/24326449
accepted answer of: http://stackoverflow.com/q/24325397
has body: By default, data that you store into the private folder is neither accessible by the user nor by other applications. See the documentation on the Android developers website about this: http://developer.android.com/guide/topics/data/data-storage.html#filesInternal However, as mentioned by SMR, if a device has been rooted this data is available to the user and might be compromised by any apps that the user has given root permission to. However it's a minority of users that are actually rooted and those that are should more or less know what they've gotten themselves into and what they're actions can do. It's up to you to decide if it's worth some effort to look out for these special cases. But by default your data should be safe and sound.
type: Answer
answers question: http://stackoverflow.com/q/24325397
score: 0
type: AcceptedAnswer

unchecked
tags question: http://stackoverflow.com/q/24328989
type: Tag
tag name: unchecked

http://stackoverflow.com/comment/37513319
type: QuestionComment
comment on: http://stackoverflow.com/q/24279248
score: 0
type: Comment
has text: No, as I said, I've checked the value it returns. It gives a byte array. To be precise, it gives [B@42009068

http://stackoverflow.com/q/24321008
score: 1
tagged with: java
type: Question
answer count: 2
upvote count: 1
tagged with: apache
has answer: http://stackoverflow.com/a/24325482
favorite count: 0
tagged with: proxy
type: UnansweredQuestion
tagged with: sockets
has title: How can I forward HttpResponse to an open client socket? (Java Program acts as a proxy)
tagged with: httpresponse
has body: I am using httpclient lib from apache. I managed to get an HttpResponse by sending a GET request to the server. Now what I am trying to do is to send that response that I got to a clientSocket output stream. So basically I want to send whatever I received from the server to the open client connection. Since I am using HttpClient I get the response in the form of an HttpResponse object. I tried the following: private void forwardRequest(String header, String url){ try { CloseableHttpClient httpclient = HttpClients.createDefault(); HttpGet httpget = new HttpGet(url); CloseableHttpResponse response; //Adding the request headers to httpget String lines[] = header.split("\\n"); for (String str : lines) { String parts[] = str.split(":", 2); httpget.addHeader(parts[0], parts[1]); } HttpResponse respone; response = httpclient.execute(httpget); //It works till here I can read from the response and print out the html page //But after this I don't know how to send it to client OutputStream bos = clientSocket.getOutputStream(); PrintWriter pw = new PrintWriter(bos); BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); while ((line = rd.readLine()) != null) { pw.println(line); //bos.write(line.getBytes()); //This also doesn't work } response.close(); } Also clientSocket is a global variable which is associcated with a ServerSocket like: clientSocket = serverSocket.accept(); I don't expect a full solution. Just point me in the right direction.. Thanks a ton! EDIT: I tried the following based on what EJP suggested.. It's still not working. I was wondering if it was correctly implemented? int portNumber = 8012; // port on which the program listens ServerSocket serverSocket = new ServerSocket(portNumber); //the socket at which the program listens Socket clientSocket = serverSocket.accept(); //clientSocket of the program Socket toServer = new Socket("localhost", 8089); //proxy server to which program connects PrintWriter out = new PrintWri…
has answer: http://stackoverflow.com/a/24321164
downvote count: 0

http://stackoverflow.com/a/24295513
downvote count: 0
answers question: http://stackoverflow.com/q/24292594
type: Answer
accepted answer of: http://stackoverflow.com/q/24292594
score: 2
has body: Thanks to @sotirios-delimanolis comments, I got the correct configuration for this basic case: 1) web.xml <?xml version="1.0" encoding="UTF-8"?> org.springframework.web.context.ContextLoaderListener contextConfigLocation /WEB-INF/applicationContext.xml jersey-serlvet org.glassfish.jersey.servlet.ServletContainer javax.ws.rs.Application com.ms2.spectrum.security.jersery.JerseyApplication 1 jersey-serlvet /rest/* dispatcher org.springframework.web.servlet.DispatcherServlet 2 dispatcher *.htm redirect.jsp 2) dispatcher-servlet.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd"> <property name="prefix" value="/WEB-INF/jsp/" /> <property name="suffix" value=".jsp" /> </beans> 3) applicationContext.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd http://www.springframework.org/schema/cont…
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/37681336
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24367492
type: AnswerComment
has text: leave some log messages in onStartCommand and onStart and see which one is called

http://stackoverflow.com/comment/37561357
score: 0
type: Comment
has text: I think person want to ask that he has deleted project & want to re-import from it back up.
comment on: http://stackoverflow.com/a/24304692
type: AnswerComment

http://stackoverflow.com/q/24332413
has answer: http://stackoverflow.com/a/24332501
has comment: http://stackoverflow.com/comment/37614066
score: -1
has answer: http://stackoverflow.com/a/24333004
has answer: http://stackoverflow.com/a/24332486
tagged with: autoboxing
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24332977
answer count: 4
upvote count: 0
type: UnansweredQuestion
tagged with: java
has title: java: Auto-boxing and casting?
type: Question
has body: I'm confused with a small problem , see the following : Double j = new Double(5); // No problem. double j =5;// //But //Here the problem: Double j = 5; Long k =5; Float g = 5.0; I know the solution but I want to understand why in some situations the cast is done implicitly and in others not.

http://stackoverflow.com/a/24271989
score: 0
answers question: http://stackoverflow.com/q/24271949
type: Answer
has body: Java is pass-by-value so when you pass the boolean here p.change(x,y,s); it will treat as pass by value and when you initialized the boolean from the change method x=true; y=true; it wont grab that reference but will get destroyed when it is out of scope
has comment: http://stackoverflow.com/comment/37499661
has comment: http://stackoverflow.com/comment/37499701

http://stackoverflow.com/q/24319325
favorite count: 0
type: UnansweredQuestion
tagged with: thrift-protocol
upvote count: 1
has title: Thrift can not deserialize from json to java object
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/37589337
type: Question
downvote count: 0
has body: I generated a java object from the following thrift object: struct Account { 1: required string accountType, 2: bool accountActive, } I wrote a java code trying to serialize java object to json string and then deserialize the json string back to java object. I can serialize successfully but failed to deserialize. TSerializer serializer = new TSerializer(new TSimpleJSONProtocol.Factory()); TDeserializer deserializer = new TDeserializer(new TSimpleJSONProtocol.Factory()); Account a1 = new Account(); a1.setAccountType("P"); a1.setAccountActive(true); String json = serializer.toString(a1); System.out.println(json); Account a2 = new Account(); deserializer.deserialize(a2, json, "UTF-8"); System.out.println(a2); System.out.println(a2.getAccountType()); It keeps throwing the following exception: Exception in thread "main" org.apache.thrift.protocol.TProtocolException: Required field 'accountType' was not present! Struct: Account(accountType:null, accountActive:false) Can anyone help me figure out what's the issue? Thanks in advance!
tagged with: thrift
answer count: 1
has answer: http://stackoverflow.com/a/24324884

http://stackoverflow.com/a/24307410
answers question: http://stackoverflow.com/q/24306700
accepted answer of: http://stackoverflow.com/q/24306700
has body: You shouldn't instantiate activity classes this way. Use a separate class instead, where you can define methods which you'd like to use somewhere else. In your case, receiving package name, I'd do something like this public class PackageNameHelper { private Context mContext; public PackageNameHelper(Context context) { mContext = context; } public String GetPackageName(){ return mContext.getPackageName(); } } Then in your activity / SQLite helper you'd do: PackageNameHelper helper = new PackageNameHelper(getApplicationContext()); String packageName = helper.getPackageName() Or you can make the helper class static, that way Context must be passed directly int the getPackageName() method, like public class PackageNameHelper { public static String GetPackageName(Context context){ return context.getPackageName(); } } and use it like //Where context is an instance of a context String packageName = PackageNameHelper.getPackageName(context);
type: Answer
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/37732936
type: Comment
type: QuestionComment
has text: @JackyHo check the [How to ask](http://stackoverflow.com/help/how-to-ask) section in help guide for future questions in the site :).
score: 0
comment on: http://stackoverflow.com/q/24394765

http://stackoverflow.com/q/24424124
favorite count: 0
has answer: http://stackoverflow.com/a/24429258
tagged with: push-notification
tagged with: android
tagged with: google-cloud-messaging
score: 1
upvote count: 1
has body: I am very new to java server side development, i have followed this link [http://javapapers.com/android/google-cloud-messaging-gcm-for-android-and-push-notifications/][1] and successfully implemented GCM with my android device, the problem is dont know how to trigger the GCM server while the content is updated in my db,i need to notify each and every update of my db to the user, am i need to watch the db using timer task something like that or is there any default solution to keep track of db ? My Server side code : regId = "my registration id"; String userMessage = request.getParameter("message"); Sender sender = new Sender(GOOGLE_SERVER_KEY); Message message = new Message.Builder().timeToLive(30) .delayWhileIdle(true).addData(MESSAGE_KEY, userMessage).build(); result = sender.send(message, regId, 1); have tried with many solution but till now not getting exact solution, Suggestion, ideas or related links are most welcome Thanks in advance
accepted answer: http://stackoverflow.com/a/24429258
type: AnsweredQuestion
tagged with: java
has title: how to trigger a gcm to send a push notification to android device(using java server)
type: Question
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/37661119
comment on: http://stackoverflow.com/q/24356791
type: Comment
score: 0
type: QuestionComment
has text: Do you know what `getResource()` does?

http://stackoverflow.com/a/24663960
answers question: http://stackoverflow.com/q/24427092
score: 2
has body: The abrupt changes in size from the MadProgrammer's solution can be easily fixed in two ways: public JPanel createPane(Color color) { JPanel pane = new JPanel(){ @Override public Dimension getPreferredSize() { return new Dimension(50, 50); } @Override public Dimension getMinimumSize() { return new Dimension(50, 50); } }; pane.setBackground(color); return pane; } We also provide a mimimum size which is equal to the preferred size. This way the panels are not shrinking but they are cut from the window when the container is too small to display them. The optimal solution is probably to set the weighty to 1. The panels will gradually being shrinking. gbc.weightx = 1; gbc.weighty = 1; gbc.gridy = 0; Finally, I also created a solution with MigLayout. If possible, try to create your layouts with MigLayout rather than with GridBagLayout. package com.zetcode; import java.awt.Dimension; import java.awt.EventQueue; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JPanel; import net.miginfocom.swing.MigLayout; public class MigLayoutPanels extends JFrame { public MigLayoutPanels() { initUI(); setTitle("Panels"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); } private void initUI() { setLayout(new MigLayout("wrap")); add(createPanel(), "w 200, push, grow"); add(createPanel(), "push, grow"); add(createPanel(), "push, grow"); add(createPanel(), "push, grow"); add(createPanel(), "push, grow"); add(createPanel(), "push, grow"); add(createPanel(), "cell 1 0 1 6, growy"); pack(); } public JPanel createPanel() { JPanel pnl = new JPanel(){ @Override public Dimension getPreferredSize() { return new Dimension(50, 50); } }; pnl.setBorder(BorderFactory.createEtchedBorder()); return pnl; } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { MigLayoutPanels ex = new MigLayoutPanels(); ex.setVisible(true); } }); } } GridBagLayout is a powerful manager which can be used to cre…
downvote count: 0
type: Answer
upvote count: 2

http://stackoverflow.com/comment/37629494
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24340800
type: QuestionComment
has text: Try looking in this post: http://stackoverflow.com/questions/6810158/java-hibernate-write-operations-are-not-allowed-in-read-only-mode

http://stackoverflow.com/comment/116924485
score: 1
has text: After following these steps, you may still need to define JAVA_HOME so it points to the brew installed java8. What worked for me was `export JAVA_HOME=$(/usr/libexec/java_home -v1.8)`
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/28635465

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/24346405
tags question: http://stackoverflow.com/q/24358989
tags question: http://stackoverflow.com/q/24362798
tags question: http://stackoverflow.com/q/24343981
tags question: http://stackoverflow.com/q/24339080
tags question: http://stackoverflow.com/q/24407640
tags question: http://stackoverflow.com/q/24372178
tags question: http://stackoverflow.com/q/24302726
tags question: http://stackoverflow.com/q/24309668
tags question: http://stackoverflow.com/q/24379922
tags question: http://stackoverflow.com/q/24279344
tags question: http://stackoverflow.com/q/24409387
type: Tag
tags question: http://stackoverflow.com/q/24353212
tags question: http://stackoverflow.com/q/24295470
tags question: http://stackoverflow.com/q/24285682
tags question: http://stackoverflow.com/q/24355834
tags question: http://stackoverflow.com/q/24370313
tags question: http://stackoverflow.com/q/24308202

http://stackoverflow.com/a/24370297
has body: Check your SQL query column with ResultSet.getString() methods dear. If you used SELECT str FROM database_table it's fine.
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24369261
type: Answer

http://stackoverflow.com/comment/37768554
type: QuestionComment
score: 0
has text: Please correct the subject of question : if..else if..else is not a loop. A loop is something which keeps on going till its condition is true e.g. while, for, do..while, whereas an if block is executed just once when a condition is true.
comment on: http://stackoverflow.com/q/24414024
type: Comment

http://stackoverflow.com/q/24420860
answer count: 1
has comment: http://stackoverflow.com/comment/37781561
accepted answer: http://stackoverflow.com/a/24420883
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24420883
type: Question
has body: Very often, it is the case that there is a compilation error in a project, yet I can't really find the source of the error. For instance: This web project has an error, yet it's basically my guess as to what the error is. Why isn't there a way to right-click an option called "find source of compilation error"? There's no quick fix option available. This is a simple question. I don't understand why this is an issue, because Eclipse knows what the problem is, but why won't Eclipse tell me?
tagged with: java
tagged with: eclipse
score: 0
has comment: http://stackoverflow.com/comment/37781536
has title: Source of project errors in Eclipse IDE

http://stackoverflow.com/a/51911514
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/24386771
score: 4
has body: If using Spring Boot this works well. Even with Spring Reactive Mongo. org.springframework.boot spring-boot-starter-validation and validation config: import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.mongodb.core.mapping.event.ValidatingMongoEventListener; import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; @Configuration public class MongoValidationConfig { @Bean public ValidatingMongoEventListener validatingMongoEventListener() { return new ValidatingMongoEventListener(validator()); } @Bean public LocalValidatorFactoryBean validator() { return new LocalValidatorFactoryBean(); } }

eclipse-rcp
tags question: http://stackoverflow.com/q/24327441
tags question: http://stackoverflow.com/q/24279651
type: Tag
tags question: http://stackoverflow.com/q/24289151
tags question: http://stackoverflow.com/q/24326097
tags question: http://stackoverflow.com/q/24360688
tags question: http://stackoverflow.com/q/24350221
tags question: http://stackoverflow.com/q/24389449
tag name: eclipse-rcp

http://stackoverflow.com/a/24422875
type: Answer
answers question: http://stackoverflow.com/q/24422800
score: 0
has body: SimpleDateFormat is documented here. You can parse that date with something like this, public static void main(String[] args) throws ParseException { String date = "1980/01/30 10:36:42 -0400"; String pattern = "yyyy/MM/dd HH:mm:ss Z"; SimpleDateFormat sdf = new SimpleDateFormat(pattern); System.out.println(sdf.parse(date)); } Output is (because my system is in EST) - Wed Jan 30 09:36:42 EST 1980

http://stackoverflow.com/comment/37553929
type: Comment
comment on: http://stackoverflow.com/a/24295881
has text: Ah i didn't think about that. My example would only ever have differing types. Guess I will write something...
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37614225
has text: Can you be more specific? What exactly is your problem? What have you tried?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24332302
score: 0

http://stackoverflow.com/q/24396070
has comment: http://stackoverflow.com/comment/137118922
has body: I am uploading a file via FTP to a Linux server. I use Apache's FTPClient. So let's say I wanted to upload the file C:\\downloads\\13\\myFile.txt to the server at /data/downloads/13/myFile.txt Before I upload, I determine whether the directory that it will be sent to exists using listFiles. When I say ftp.listFiles("/data/downloads/13"); I get an array containing one file object, meaning that the path exists (and I don't need to create a folder). However when I say ftp.listFiles("\\data\\downloads\\13"); I get an empty array, meaning the path does not exist. The reason for this is because I'm running my application from a Windows machine, so the path separator is different. The solution I've decided on is to normalize the paths by replacing \ with / before I proceed with the FTP transactions. Is this the proper way to address this issue?
score: 0
has answer: http://stackoverflow.com/a/24505536
has answer: http://stackoverflow.com/a/24396309
has comment: http://stackoverflow.com/comment/37736332
tagged with: ftp
type: UnansweredQuestion
tagged with: java
has title: Different path separators during FTP transaction between windows and linux
has comment: http://stackoverflow.com/comment/37735791
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37736287

http://stackoverflow.com/a/24276816
has comment: http://stackoverflow.com/comment/37531508
answers question: http://stackoverflow.com/q/24276371
score: 1
accepted answer of: http://stackoverflow.com/q/24276371
has body: I'm not sure codemodel has the ability to define static imports, as it's an older library. You can use the enum though just through the ref() method since static imports are really just a programmer's convenience: public class Tester { public enum Status{ ONE, TWO; } public static void main(String[] args) throws JClassAlreadyExistsException, IOException { JCodeModel codeModel = new JCodeModel(); JClass ref = codeModel.ref(Status.class); JDefinedClass outputClass = codeModel._class("Output"); outputClass.field(JMod.PRIVATE, ref, "status", ref.staticRef(Status.ONE.name())); codeModel.build(new StdOutCodeWriter()); } } Outputs: public class Output { private test.Tester.Status status = test.Tester.Status.ONE; }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37509381
upvote count: 1
type: Answer

http://stackoverflow.com/a/33760546
has body: First of all, a premise : I'm answering this question primarily for future users of WatchService, which (like me) could experience this problem (i.e. on some systems events are signaled way after they occur). The problem is that the implementation of this feature in Java is native, so it is platform-dependant (take a look at https://docs.oracle.com/javase/7/docs/api/java/nio/file/WatchService.html, under the section 'platform dependencies'). In particular, on Windows 7 (and MacOSX afaict) the implementation uses polling to retrieve the changes from the filesystem, so you can't rely on the 'liveliness' of notifications from a WatchService. The notifications will eventually be signaled, but there are no guarantees on when it will happen. I don't have a rigorous solution to this problem, but after a lot of trial and error I can describe what works for me : First, when writing to a file that is registered (i.e. 'watched'), I try to flush the content every time I can and update the 'last modified' attribute on the file, e.g. : try (FileWriter writer = new FileWriter(outputFile)) { writer.write("The string to write"); outputFile.setLastModified(System.currentTimeMillis()); writer.flush(); } Second, I try to 'trigger' the refresh from code (I know it's not good code, but in this case, I'm just happy it works 99% of the time) Thread.sleep(2000); // in case I've just created a file and I'm watching the ENTRY_CREATE event on outputDir outputDir.list(); or (if watching ENTRY_MODIFY on a particular file in outputDir) Thread.sleep(2000); outputFile.length(); In both cases, a sleep call simply 'gives the time' to the mechanism underlying the WatchService to trigger, even though 2 seconds are probably a lot more than it is needed.
type: Answer
answers question: http://stackoverflow.com/q/24306875
score: 4
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/24326158
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24326066
answers question: http://stackoverflow.com/q/24326066
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37601843
has comment: http://stackoverflow.com/comment/37678465
has body: Why not use an abstract class for that? Otherwise, you will have to roll out annotation processor and classpath scanning to check that all implementing classes obeys the annotation. If you decide to go this path, a maven plugin can also help during the compile phase and scan the classpath to ensure that the implementing classes have defined the constructor
type: Answer

http://stackoverflow.com/q/24280605
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24299538
has comment: http://stackoverflow.com/comment/37515966
tagged with: jackson
has body: I need to create a json response for a report. Something like this: var data = [ ["", "Kia", "Nissan", "Toyota", "Honda"], ["2008", 10, 11, 12, 13], ["2009", 20, 11, 14, 13], ["2010", 30, 15, 12, 13] ]; Im using jackson library and i create a JsonGenerator, this is the code i have: String[] cols = new String[5]; //Number of report columns JsonFactory jfactory = new JsonFactory(); JsonGenerator jGenerator = jfactory.createJsonGenerator(response.getOutputStream(),JsonEncoding.UTF8); jGenerator.writeStartArray(); jGenerator.writeStartArray(); jGenerator.writeStringField(cols[0], ""); //until... jGenerator.writeStringField(cols[4], "Honda"); jGenerator.writeEndArray(); jGenerator.writeStartArray(); jGenerator.writeStringField(cols[0], "2008"); //until... jGenerator.writeStringField(cols[4], "13"); jGenerator.writeEndArray(); //and the same with the next rows... jGenerator.writeEndArray(); The problem is when setting the first value i get this error: org.codehaus.jackson.JsonGenerationException: Can not write a field name, expecting a value
has comment: http://stackoverflow.com/comment/37515971
has comment: http://stackoverflow.com/comment/37516087
has answer: http://stackoverflow.com/a/24299141
has comment: http://stackoverflow.com/comment/37515863
has title: how to create json array using jackson
favorite count: 0
score: 8
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/37515688
has comment: http://stackoverflow.com/comment/37515715
has comment: http://stackoverflow.com/comment/37516104
upvote count: 9

weblogic8.x
tag name: weblogic8.x
tags question: http://stackoverflow.com/q/24329219
tags question: http://stackoverflow.com/q/24401597
type: Tag

http://stackoverflow.com/q/24422948
tagged with: java
has answer: http://stackoverflow.com/a/26661598
has title: Can I declare a Composite-Component using only xhtml file and still be able to use the component in a JAVA code
type: Question
has body: I am trying to create a composite-component using jsf simple tags without taking the advantages of UIComponent. I mean I do not want to implement the component by inheriting from UIComponentBase,UIComponentBase,etc. However, after the implementation, I want to be able to use the component in JAVA code. For example, consider the composite component below(lets call it MYcompositeComponent): &lt;html xmlns="http://www.w3.org/1999/xhtml" //... xmlns:composite="http://java.sun.com/jsf/composite"&gt; &lt;composite:interface&gt; &lt;composite:attribute name="anything" /&gt; &lt;/composite:interface&gt; &lt;composite:implementation&gt; #{cc.attrs.anything} &lt;/composite:implementation&gt; &lt;/html&gt; Then I want to use this component in a JAVA class as below: public class JavaClass { private MYcompositeComponent mYcompositeComponent; // .... }
tagged with: primefaces
upvote count: 2
tagged with: jsf-2
tagged with: composite-component
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: jsf
score: 1

http://stackoverflow.com/comment/37591944
comment on: http://stackoverflow.com/a/24308688
has text: 05/22/2014 03:22:39.288 oooooo ppppp qqqq rrrrrr sss
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24284559
favorite count: 0
has comment: http://stackoverflow.com/comment/37523696
has body: I've been trying to use java.text.DecimalFormat to validate user input of decimal numbers. I know the maximum number of digits both before and after the decimal place that are to be allowed - if there are more of either, that's an input error by the user. It seems like setMaximumIntegerDigits() is not being enforced though. (Or if I use a pattern, rather than the min/max setters, the maximum digits implied by the pattern seem again to be ignored.) What am I missing? (Apologies if this is a duplicate. I can find a lot of questions about DecimalFormat on SO - but none that seem to be quite this problem.) Here's the sample code and a unit test (distilled from real code): ---- Numbers.java /** Utility for creating and using a standard DecimalFormat. */ package com.myco.util; import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.ParsePosition; public final class Numbers { private Numbers() { ; } public static DecimalFormat standardFormat() { DecimalFormat df = new DecimalFormat(); df.setParseBigDecimal(true); df.setMaximumIntegerDigits(3); df.setMinimumIntegerDigits(1); df.setMaximumFractionDigits(2); df.setMinimumFractionDigits(0); return df; } // Alternatively, approach, also doesn't work. /*public static DecimalFormat standardFormat() { DecimalFormat df = new DecimalFormat("##0.##"); df.setParseBigDecimal(true); return df; }*/ public static BigDecimal match(DecimalFormat df, String s) throws NumberFormatException { if(s == null || (s = s.trim()).length() == 0) return null; ParsePosition pp = new ParsePosition(0); Number n = df.parse(s, pp); if(n == null || pp.getIndex() != s.length()) throw new NumberFormatException( "Invalid BigDecimal for format '"+df+"'!"); return BigDecimal.class.cast(n); } } By my reading of the Javadoc for DecimalFormat the test for 1000 (below) should pass (that is, it should throw an exception) but it doesn't. http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html ---- Numbers_Test.java package com.myco.u…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37524017
has comment: http://stackoverflow.com/comment/37524117
has comment: http://stackoverflow.com/comment/37523898
answer count: 0
has comment: http://stackoverflow.com/comment/37524044
tagged with: java
has comment: http://stackoverflow.com/comment/37524122
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37523340
has comment: http://stackoverflow.com/comment/37523465
has title: Is java.text.DecimalFormat.setMaximumIntegerDigits() being ignored?
tagged with: validation
has comment: http://stackoverflow.com/comment/37524234
downvote count: 0
score: 1

http://stackoverflow.com/q/24299167
linked to: http://stackoverflow.com/q/21814825
has answer: http://stackoverflow.com/a/24299338
tagged with: android
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37551089
has comment: http://stackoverflow.com/comment/37551078
downvote count: 1
has body: I am creating android application which is open a webpage using webview but on run time I got an error . This is mobile js page in which is I want to open webview. Log-cat : 06-19 00:44:25.756: I/Process(1130): Sending signal. PID: 1130 SIG: 9 06-19 00:46:45.136: D/AndroidRuntime(1156): Shutting down VM 06-19 00:46:45.136: W/dalvikvm(1156): threadid=1: thread exiting with uncaught exception (group=0xb4a48ba8) 06-19 00:46:45.156: E/AndroidRuntime(1156): FATAL EXCEPTION: main 06-19 00:46:45.156: E/AndroidRuntime(1156): Process: com.example.dynakodetechnologypvt.ltd, PID: 1156 06-19 00:46:45.156: E/AndroidRuntime(1156): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.dynakodetechnologypvt.ltd/com.example.dynakodetechnologypvt.ltd.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. 06-19 00:46:45.156: E/AndroidRuntime(1156): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 06-19 00:46:45.156: E/AndroidRuntime(1156): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 06-19 00:46:45.156: E/AndroidRuntime(1156): at android.app.ActivityThread.access$800(ActivityThread.java:135) 06-19 00:46:45.156: E/AndroidRuntime(1156): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 06-19 00:46:45.156: E/AndroidRuntime(1156): at android.os.Handler.dispatchMessage(Handler.java:102) 06-19 00:46:45.156: E/AndroidRuntime(1156): at android.os.Looper.loop(Looper.java:136) 06-19 00:46:45.156: E/AndroidRuntime(1156): at android.app.ActivityThread.main(ActivityThread.java:5017) 06-19 00:46:45.156: E/AndroidRuntime(1156): at java.lang.reflect.Method.invokeNative(Native Method) 06-19 00:46:45.156: E/AndroidRuntime(1156): at java.lang.reflect.Method.invoke(Method.java:515) 06-19 00:46:45.156: E/AndroidRuntime(1156): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 06-19 00:46:45.156: E/An…
has title: (WebView)java.lang.runtimeexception unable to start activity
has comment: http://stackoverflow.com/comment/37551500
has comment: http://stackoverflow.com/comment/37551246
tagged with: android-webview
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/37551157
type: Question
tagged with: runtimeexception
upvote count: 0

http://stackoverflow.com/comment/37667221
comment on: http://stackoverflow.com/q/24329007
score: 0
type: Comment
type: QuestionComment
has text: With a quick test it seems the problem happens around the libzmq or jzmq layer. Where the installation of ZeroMQ thr and lat tests are fine, but obviously under jzmq and libzmq the thr test would hang forever without any output. I hope I could get it resolved soon.

http://stackoverflow.com/a/24372025
has body: You can try in this way. final Icon icon = new ImageIcon("pirosgomb.jpg"); ... JLabel label = ... label.setIcon(icon); inside the mouse listener: if(label.getIcon() == icon){...}
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24371642
has comment: http://stackoverflow.com/comment/37701422

http://stackoverflow.com/comment/59896954
comment on: http://stackoverflow.com/a/24394162
type: Comment
type: AnswerComment
has text: i need to store the private key in database and then again need to use it. How can retrieve original private key object after converting it to string using above code ?
score: 0

http://stackoverflow.com/comment/37578799
has text: Be careful if you do concatenate your array of strings into one string-- it would be easy to misinterpret whether "bc" should be found within the array {"ab","cd"}.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24312480

simpledateformat
tags question: http://stackoverflow.com/q/24422800
tags question: http://stackoverflow.com/q/24281506
type: Tag
tag name: simpledateformat

timezone
tags question: http://stackoverflow.com/q/24412178
tags question: http://stackoverflow.com/q/24367337
type: Tag
tag name: timezone
tags question: http://stackoverflow.com/q/24340850
tags question: http://stackoverflow.com/q/24369159
tags question: http://stackoverflow.com/q/24325171
tags question: http://stackoverflow.com/q/24356215

http://stackoverflow.com/q/24368627
favorite count: 0
has body: I have 1 array list and I want to loop through that array list to find words that are the same within that array list because I need to store that index number where they are the same somewhere. So I wrote this code below to help me get started: String[] word = new String[] { "abcd", "efgh", "ijkl", "mnop" }; String[] word2 = new String[] { "ijkl", "rstu", "mnop" }; int totalWords = word.length; int totalWords2 = word2.length; //Use a List instead of array, because you don't know how many unique there are List&lt;String&gt; uniqueWords = new ArrayList&lt;&gt;(); for (int i = 0; i &lt; totalWords; i++) { // loop of the first array list boolean unique = false; for (int j = 0; j &lt; totalWords2; j++) { // second loop where the // words are being compared //compare String this way if (word[i].equals(word2[j])) { //we find two equals strings, it is unique unique = true; break; } } if (unique) { uniqueWords.add(word[i]); } } for (String s : uniqueWords) { System.out.println(s); } and it works and prints ijkl mnop Now I took this same code and I applied it to my problem and got the following but it doesn't work. It just prints out my exact array list. I just care about storing the index number where there are equal words in the list but it doesn't print correctly so I can't store anything yet. Am I approaching this problem incorrectly? //signatureList is my array list that i want to loop through to find words that are equal with each other int o = signatureList.size(); //Use a List instead of array, because you don't know how many unique there are List&lt;String&gt; uniqueWords = new ArrayList&lt;String&gt;(); for (int i = 0; i &lt; o; i++) { // loop of the first array list boolean unique = false; for (int j = 1; j &lt; o; j++) { // second loop where the // words are being compared //compare String this way if (signatureList.get(i).equals(signatureList.get(j))) { //we find two equals strings, it is unique unique = true; break; } } if (unique) { uniqueWords.add(signatureLi…
has answer: http://stackoverflow.com/a/24368744
has comment: http://stackoverflow.com/comment/37683318
has answer: http://stackoverflow.com/a/24368845
answer count: 5
possible better answer: http://stackoverflow.com/a/24368744
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/24368784
upvote count: 3
tagged with: java
downvote count: 1
type: Question
has title: How to loop to find equal words
has answer: http://stackoverflow.com/a/24368819
accepted answer: http://stackoverflow.com/a/24368819
has comment: http://stackoverflow.com/comment/37683333
has answer: http://stackoverflow.com/a/24368750

http://stackoverflow.com/q/24296079
type: UnansweredQuestion
tagged with: jsf
tagged with: java
tagged with: mysql
downvote count: 1
type: Question
upvote count: 0
answer count: 1
has title: Java options for the business logic and data layers
has answer: http://stackoverflow.com/a/24296568
has body: I want to create a java web application that uses a Mysql Data Base. I thoughy I could us JSF for the presentation layer. What are the options for the business logic and data layers? If I am using Java EE platform, I only could use EJB for the business logic layer and JPA for the data layer?
score: -1
favorite count: 0

http://stackoverflow.com/a/24403028
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The rule is if an object has a reference to another object, then both should be beans to have the second injected in the first. I suppose you will have a DAO and a service. Both must be beans and do not forget that an injected bean should allways be declared through an interface. This rule is not absolute but it will allow you to easyly use AOP if you need to, and is anyway a good practice in java programming. In contrast, Student has normally no reason to be a bean (should not be injected nor have anything injected into), and the RowMapper implementation can simply be an inner class of the Dao because it should never be used elsewhere.
score: 5
upvote count: 5
accepted answer of: http://stackoverflow.com/q/24402070
answers question: http://stackoverflow.com/q/24402070

http://stackoverflow.com/q/24413279
answer count: 2
has answer: http://stackoverflow.com/a/42841543
downvote count: 0
tagged with: layout-manager
favorite count: 0
possible better answer: http://stackoverflow.com/a/42841543
accepted answer: http://stackoverflow.com/a/24413554
has body: I just want to know if there is a way to resize the jpanels that has CardLayout as its layout. I have here a picture where you can see I have 5 panels. Here is my code snippets: JPanel container = new JPanel(); JPanel panel_1 = new JPanel(); // red JPanel panel_2 = new JPanel(); // violet JPanel panel_3 = new JPanel(); // violet JPanel panel_4 = new JPanel(); // blue FlowLayout flow = new FlowLayout(FlowLayout.RIGHT,1,1); CardLayout cl = new CardLayout(); This one is for my fist panel which is the no. 3 in the picture. panel_1 = new JPanel(); panel_1.setBackground(Color.WHITE); panel_1.setBorder(new EmptyBorder(0, 0, 0, 0)); panel_1.setLayout(flow); JButton btnGroup1 = new JButton(" Group 01 "); btnGroup1.setIcon(new ImageIcon("more_buttons\\green.png")); btnGroup1.setBorderPainted(false); btnGroup1.setFocusPainted(false); btnGroup1.setContentAreaFilled(false); btnGroup1.setHorizontalTextPosition(JButton.CENTER); btnGroup1.setFont(new Font("Calibri", Font.BOLD, 18)); btnGroup1.setPreferredSize(new Dimension(80, 80)); panel_1.add(btnGroup1); And this is the rest of my panel. panel_2 = new JPanel(); panel_2.setBackground(Color.BLUE); panel_2.setBorder(new EmptyBorder(0, 0, 0, 0)); panel_2.setLayout(flow); JButton button_2 = new JButton(" "); button_2.setIcon(new ImageIcon("more_buttons\\lightblue.png")); button_2.setBorderPainted(false); button_2.setFocusPainted(false); button_2.setContentAreaFilled(false); button_2.setHorizontalTextPosition(JButton.CENTER); button_2.setFont(new Font("Calibri", Font.BOLD, 12)); button_2.setPreferredSize(new Dimension(80, 80)); button_2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub cl.show(container, "4"); } }); panel_2.add(button_2); panel_3 = new JPanel(); panel_3.setBackground(Color.WHITE); panel_3.setBorder(new EmptyBorder(0, 0, 0, 0)); panel_3.setLayout(flow); JButton button_no_7 = new JButton("7"); button_no_7.setIcon(new ImageIcon("more_buttons\\gray.p…
tagged with: css
has title: How to resize the JPanel with CardLayout
type: AnsweredQuestion
score: 1
upvote count: 1
tagged with: swing
type: Question
tagged with: cardlayout
tagged with: java
has answer: http://stackoverflow.com/a/24413554

http://stackoverflow.com/q/24277813
tagged with: gxt
has answer: http://stackoverflow.com/a/24286024
type: Question
tagged with: gwt
type: AnsweredQuestion
has title: How to resize display of FramePanel in GXT?
score: 0
answer count: 1
has body: public class View implements IsWidget, EntryPoint { @Override public void onModuleLoad() { // TODO Auto-generated method stub RootPanel.get().add(asWidget()); } @Override public Widget asWidget() { // TODO Auto-generated method stub VerticalPanel vp = new VerticalPanel(); FramedPanel cp = new FramedPanel(); vp.setBorderWidth(1); vp.setWidth("100%"); vp.setHeight("100%"); cp.setWidth("100%"); cp.setHeight("100%"); vp.add(cp); return vp; } I want fill that Frame Panel in VerticalPanel. So I was designate the height and width of the VerticalPanel and FramedPanel as 100%. however, Results were different from expected results. How to resize display of FramePanel in GXT ?
accepted answer: http://stackoverflow.com/a/24286024
tagged with: java

http://stackoverflow.com/a/24322347
has body: Better to use GridBagLayout, in case if u add new components, Layout manager as to take care to fit the components with in the screen if u (maximized/Restore Down).
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24320436
type: Answer
downvote count: 0

http://stackoverflow.com/a/26669745
answers question: http://stackoverflow.com/q/24384223
accepted answer of: http://stackoverflow.com/q/24384223
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 7
has body: You do not require to subclass DefaultWeightedEdge to create your custom edge, the following works also. I'm currently using version 0.9.0 of JGraphT. Class definition : public class Connection { // class implementation // define all constructors and methods you need } Graph creation : SimpleWeightedGraph&lt;Sensor, Connection&gt; graph; graph = new SimpleWeightedGraph&lt;Sensor, Connection&gt;(Connection.class); Adding custom edge and setting weight : Sensor v1 = // sensor instance Sensor v2 = // another sensor instance graph.addVertex(v1); graph.addVertex(v2); Connection connection = new Connection(/* ... */); graph.addEdge(v1, v2, connection); graph.setEdgeWeight(connection, 10.0); Also consider to implement equals and hashCode methods of your Connection class, as JGraphT relies on those methods since version 0.8.4, see EqualsAndHashCode article. This article also provides an example where DefaultWeightedEdge is subclassed.
score: 7

http://stackoverflow.com/a/26195236
has comment: http://stackoverflow.com/comment/41742489
upvote count: 1
has comment: http://stackoverflow.com/comment/41738463
downvote count: 0
has body: Have you tried to set HTTPMethod of "Post" to the method annotation? Example: @ApiMethod(name = "setMyObject", path = "myObjectMethod", httpMethod = "POST") public MyResponse setMyObject(MyClass obj) {}
type: Answer
has comment: http://stackoverflow.com/comment/41735518
has comment: http://stackoverflow.com/comment/41743260
has comment: http://stackoverflow.com/comment/44027989
answers question: http://stackoverflow.com/q/24426433
score: 1

http://stackoverflow.com/q/24369487
linked to: http://stackoverflow.com/q/986627
has answer: http://stackoverflow.com/a/24369977
has title: Verify Android app signature with public key?
downvote count: 0
answer count: 1
favorite count: 0
tagged with: keystore
tagged with: android
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has body: I'm creating an unlock app that will remove ads and unlock premium features in a few apps. My plan is to just call PackageManager and verify the unlock app is installed, and if it is, verify the signatures to ensure it's actually my application. I'm following this answer here: Detect if app was downloaded from Android Market However, I guess I'm a little confused on what signature I'm verifying... It's my public key, correct? If so, how do I extract that from an existing app or keystore?
type: Question
accepted answer: http://stackoverflow.com/a/24369977

http://stackoverflow.com/a/24396320
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24395856
has body: Unfortunately, I don't think it is as simple as that since Exchange uses its own protocol: EWS. It used to support WebDAV but support for that was removed in 2007. If this is a personal project, one option is to follow this example; however, if this is a commercial endeavor I would suggest checking out JWebServices for Exchange.

http://stackoverflow.com/q/24421140
tagged with: java-stream
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24425706
has title: Is mapToDouble() really necessary for summing a List<Double> with Java 8 streams?
has comment: http://stackoverflow.com/comment/37802675
has answer: http://stackoverflow.com/a/38033755
has body: As far as I can tell, the way to sum a List&lt;Double&gt; using Java 8 streams is this: List&lt;Double&gt; vals = . . . ; double sum = vals.stream().mapToDouble(Double::doubleValue).sum(); To me, the mapToDouble(Double::doubleValue) seems kind of crufty - just the sort of boilerplate "ceremony" that lambdas and streams were supposed to dispense with. Best practices tell us to prefer List instances over arrays, and yet for this sort of summing, arrays seem cleaner: double[] vals = . . . ; double sum = Arrays.stream(vals).sum(); Granted, one could do this: List&lt;Double&gt; vals = . . . ; double sum = vals.stream().reduce(0.0, (i,j) -&gt; i+j); But that reduce(....) is so much longer than sum(). I get that this has to do with the way streams need to be retrofitted around the Java's non-object primitives, but still, am I missing something here? Is there some way to squeeze autoboxing in to make this shorter? Or is this just the current state of the art? Update - Answers Digest Here is a digest of answers below. While I have a summary here, I urge the reader to peruse the answers themselves in full. @dasblinkenlight explains that some kind of unboxing will always be necessary, due to decisions made further back in the history of Java, specifically in the way generics were implemented and their relationship to the non-object primitives. He notes that it is theoretically possible for the compiler to intuit the unboxing and allow for briefer code, but this has not yet been implemented. @Holger shows a solution that is very close to the expressiveness I was asking about: double sum = vals.stream().reduce(0.0, Double::sum); I was unaware of the new static Double.sum() method. Added with 1.8, it seems intended for the very purpose I was describing. I also found Double.min() and Double.max(). Going forward, I will definitely use this idiom for such operations on List&lt;Double&gt; and similar.
accepted answer: http://stackoverflow.com/a/24421331
score: 78
possible better answer: http://stackoverflow.com/a/24425706
answer count: 3
upvote count: 79
favorite count: 0
has comment: http://stackoverflow.com/comment/37782219
tagged with: java-8
has answer: http://stackoverflow.com/a/24421331
type: AnsweredQuestion

http://stackoverflow.com/q/24319584
has title: Java static Lists in Android
tagged with: list
possible better answer: http://stackoverflow.com/a/24319912
has comment: http://stackoverflow.com/comment/37590159
has comment: http://stackoverflow.com/comment/37590151
has body: I have a static List in a model class: public static List&lt;HomePageOptions&gt; homePageOptions = Arrays.asList( new HomePageOptions("Title1_1", "Title2_1"), new HomePageOptions("Title1_2!", "Title2_2"), new HomePageOptions("Title1_3", "Title2_3"), new HomePageOptions("Title1_4", "Title2_4") ); where HomePageOptions is defined: public class HomePageOptions { String Title1; String Title2; public HomePageOptions (String title1, String title2) { setTitle1(title1); setTitle2(title2); } //regular setters and getters } I have an activity that opens as such: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); List&lt;String&gt; values = new ArrayList&lt;String&gt;(); for(HomePageOptions ho : PharmacyModel.homePageOptions){ values.add(ho.getTitle1()); } } The for loop is giving me an ExceptionInInitializationError. I come across no problems when i create a regular List right before the for loop, but I would like to keep this structure in the model class. I've been trying to find a solution as to why this is. My guess is the static modifier on the List homePageOptions. Can anyone help? Here's what the debugger is saying Thread [&lt;1&gt; main] (Suspended (exception ExceptionInInitializerError)) &lt;VM does not provide monitor information&gt; HomeActivity.onCreate(Bundle) line: 33 HomeActivity(Activity).performCreate(Bundle) line: 4465 Instrumentation.callActivityOnCreate(Activity, Bundle) line: 1049 ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1920 ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1981 ActivityThread.access$600(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 123 ActivityThread$H.handleMessage(Message) line: 1147 ActivityThread$H(Handler).dispatchMessage(Message) line: 99 Looper.loop() line: 137 ActivityThread.main(String[]) line: 4424 Method.invokeNative(Object, Object[], Cl…
has comment: http://stackoverflow.com/comment/37590061
tagged with: java
has comment: http://stackoverflow.com/comment/37590031
has comment: http://stackoverflow.com/comment/37590012
has comment: http://stackoverflow.com/comment/37589808
type: Question
has answer: http://stackoverflow.com/a/24328630
accepted answer: http://stackoverflow.com/a/24328630
has answer: http://stackoverflow.com/a/24319912
has comment: http://stackoverflow.com/comment/37590066
score: 0
answer count: 2
tagged with: android-listview
has comment: http://stackoverflow.com/comment/37589843
has comment: http://stackoverflow.com/comment/37589881
has comment: http://stackoverflow.com/comment/37589916
tagged with: android
has comment: http://stackoverflow.com/comment/37589960
type: AnsweredQuestion

http://stackoverflow.com/comment/37705574
score: 1
has text: I assume this secure element is a UICC, right? In that case you would need to consult the UICC manufacturer's documentation (or in case you received the UICC through some mobile network operator, you would need to get in touch with them to add the necessary files for you). There's no such thing as a "simple" how-to for this.
type: AnswerComment
comment on: http://stackoverflow.com/a/24379069
type: Comment

http://stackoverflow.com/q/24329043
has comment: http://stackoverflow.com/comment/37607700
downvote count: 0
has answer: http://stackoverflow.com/a/24329172
type: UnansweredQuestion
score: 1
tagged with: java
has body: I have a Java Method, in a class called by a Java Servlet, that returns an Array of JSONObjects. For example, if I loop through the array in a standard for loop, each object is printed as you would expect a JSONObject to appear. I am struggling to understand how to use the .getJSON() Jquery method to get this data. Somehow, I need to get these JSONObjects to be called by this method, so I can populate a DataTable (using AJAX). {"lastName":"doe","requestVar":3,"name":" John","rqTime":"1402600668949"} {"lastName":"doe","requestVar":4,"name":" Jane","rqTime":"1402677126117"} Currently, the only answers I can find are when people use the .getJSON method on a .JSON file; is there any way for me to .getJSON from a .java file?
type: Question
tagged with: http://stackoverflow.com/tag/json
tagged with: servlets
has title: Getting JSON data from a .java file
upvote count: 1
answer count: 1
tagged with: jquery
favorite count: 0
tagged with: ajax

http://stackoverflow.com/a/24411651
upvote count: 4
accepted answer of: http://stackoverflow.com/q/24411248
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Logically, a DB query from a Java code will be more expensive than a loop within the code because querying the DB involves several steps such as connecting to DB, creating the SQL query, firing the query and getting the results back. Besides, something can go wrong between firing the first and second query. With an optimized single query and looping with the code, you can save a lot of time than firing two queries. In your case, you can sort in the query itself if it helps: SELECT * FROM MY_TABLE ORDER BY TYPE In future if there are more types added to your table, you need not fire an additional query to retrieve it.
answers question: http://stackoverflow.com/q/24411248
score: 4

http://stackoverflow.com/q/24397581
linked to: http://stackoverflow.com/q/16313260
has title: Text file not found throwing exception
has comment: http://stackoverflow.com/comment/37737958
possible better answer: http://stackoverflow.com/a/24397648
has answer: http://stackoverflow.com/a/24397648
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24397612
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37737920
has comment: http://stackoverflow.com/comment/37738055
tagged with: arrays
has comment: http://stackoverflow.com/comment/37738013
has body: I am sure there is something really stupid I am missing, but for some reason I am getting an "Unhandled exception type FileNotFoundException" error even though my input.txt file is located within the package. Any help would be great! Code for the scanner: File file = new File("input.txt"); Scanner inputFile = new Scanner(file); Company c = new Company(); String input = inputFile.nextLine(); Complete class code: package SimpleJavaAssignment; import java.io.File; import java.util.*; public class Company { ArrayList&lt;Department&gt; deptList = new ArrayList&lt;Department&gt;(); public Department checkDepartment(String name) { for(Department dept: deptList) { if(dept.getName().equals(name)) { return dept; } } Department d = new Department(name); deptList.add(d); return d; } public static void main(String[] args) { System.out.println ("This program will compile and display the stored employee data."); File file = new File("input.txt"); Scanner inputFile = new Scanner(file); Company c = new Company(); String input = inputFile.nextLine(); while(inputFile.hasNextLine() &amp;&amp; input.length() != 0) { String[] inputArray = input.split(" "); Department d = c.checkDepartment(inputArray[3]); d.newEmployee(Integer.parseInt(inputArray[2]), inputArray[0] + " " + inputArray[1], d); input = inputFile.nextLine(); } System.out.printf("%-15s %-15s %-15s %-15s %n", "DEPARTMENT", "EMPLOYEE NAME", "EMPLOYEE AGE", "IS THE AGE A PRIME"); for(Department dept:c.deptList) { ArrayList&lt;Employee&gt; empList = dept.getEmployees(); for(Employee emp: empList) { emp.printInfo(); } } } }
accepted answer: http://stackoverflow.com/a/24397612
score: 0
answer count: 2

http://stackoverflow.com/q/24355735
has answer: http://stackoverflow.com/a/24355759
duplicate of: http://stackoverflow.com/q/513832
score: -1
answer count: 2
upvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/513832
possible better answer: http://stackoverflow.com/a/24355759
tagged with: repeat
has title: How do I repeat an entire program until manually terminated?
tagged with: java
has answer: http://stackoverflow.com/a/24355807
has body: My code works fine except for the part where I am supposed to ask the user if they would like to quit the program. It's a simple y/n that should trigger the entire program to repeat if 'n' is entered and terminates when 'y' is entered. I know i need to use a while loop but i just can't figure out exactly how I need to write it in code so that it works like expected. import java.util.*; public class MilitaryTime { public static void main (String [] args) { Scanner in = new Scanner(System.in); int hour1, minute1, hour2, minute2; System.out.print("Please enter the first time: "); int time1 = in.nextInt(); System.out.println(); hour1 = time1 / 100; minute1 = time1 % 100; System.out.print("Please enter the second time: "); int time2 = in.nextInt(); System.out.println(); hour2 = time2 / 100; minute2 = time2 % 100; System.out.println("Time elapsed: " + (Math.abs(hour1 - hour2) + " Hours, " + (Math.abs(minute1 - minute2) + " Minutes \n"))); System.out.print("Do you want to quit? (y/n): "); String answer = in.next(); while (answer != "n") { } } }
accepted answer: http://stackoverflow.com/a/24355807
downvote count: 1
has comment: http://stackoverflow.com/comment/37659219
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/24363735
downvote count: 0
tagged with: tomcat
favorite count: 0
tagged with: out-of-memory
has body: I am developing a webapp that has a plugin-loading-mechanism. The plugins are in separate jar-files and loaded with separate URLClassLoaders for each file. When I redeploy my app several times, I get an OutOfMemoryError sometime. I have read that this is because the URLClassLoaders can not be garbage collected because references to classes loaded by them still exist. How can I release this references when the app is redeployed? The app runs on Jetty in development and on Tomcat in production. Tomcat also informs me about this memory leaks.
type: UnansweredQuestion
tagged with: jetty
has answer: http://stackoverflow.com/a/24363906
score: 1
has comment: http://stackoverflow.com/comment/37674323
tagged with: java
has title: OutOfMemoryError when redploying my app
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24387551
answer count: 3
has answer: http://stackoverflow.com/a/34679279

http://stackoverflow.com/a/24290511
has comment: http://stackoverflow.com/comment/37535502
accepted answer of: http://stackoverflow.com/q/24288483
answers question: http://stackoverflow.com/q/24288483
has comment: http://stackoverflow.com/comment/37535184
type: Answer
has comment: http://stackoverflow.com/comment/37535142
score: 3
downvote count: 0
has body: I am not sure if that is what you are looking for, but how about something like this List&lt;MyClass&gt; result = names.stream() .map(name-&gt;name.length) .map(length-&gt;new MyClass(length*length, length)) .collect(Collectors.toList());
has comment: http://stackoverflow.com/comment/37556309
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/37543362
has text: Unless you're seeing a specific performance issue with the errors being thrown I would stick with what you have. In your case, it may be the best solution. The extra logging is probably just a bug Adobe needs to fix. If the logging in question uses Log4J, you may be able to find the properties files and turn off logging for that package. Log4J is a common Java logging library. http://stackoverflow.com/questions/4972954/how-to-disable-loggers-of-a-class-or-of-whole-package
score: 1
comment on: http://stackoverflow.com/q/24285366
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24351255
has answer: http://stackoverflow.com/a/24515272
type: Question
has body: I am trying to write a Java program for getting the list of all profiles on the iSeries server having greater than READ access to any object on the server based on configuration and store the information in a sample JSON file. Can anyone help me with that?
has comment: http://stackoverflow.com/comment/37685053
has comment: http://stackoverflow.com/comment/37715029
score: 0
has title: List of users with READ access to JSON file
has comment: http://stackoverflow.com/comment/37664364
answer count: 1
has comment: http://stackoverflow.com/comment/37680468
tagged with: permissions
has comment: http://stackoverflow.com/comment/37650072
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37650073
has comment: http://stackoverflow.com/comment/37762025
tagged with: java
has comment: http://stackoverflow.com/comment/37650071
tagged with: ibm-midrange

http://stackoverflow.com/comment/37672823
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24363011
has text: Thanks, yes of course in production I'd have the extension injected by `Spring` or sort of. Anyhow, could you point me to an example of `PollListener`? I somehow cannot find any hints on how to use this class...
type: AnswerComment

http://stackoverflow.com/q/24396969
has comment: http://stackoverflow.com/comment/37736870
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37736775
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24397284
has body: I have this piece of code and I want to return the value of, "sql" in a new thread so this query sends/fetches info from the database fast and not on the main thread. If I make a new thread and initialize a string with the sql and then return it out side of the thread, it returns null. Is there anyway I can return sql in a new thread without it being null? Thanks. public String getCurrentG(final String username) { Sql2o sql2o = new Sql2o(DB_URL, USER, PASS); String sql = "SELECT CurrentGuild FROM Players WHERE Username='" + username + "'"; try (Connection con = sql2o.open()) { return con.createQuery(sql).executeScalar(String.class); } }
score: 0
has title: How to return values in a new thread?
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/37736981

http://stackoverflow.com/comment/37633785
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24342833
has text: [Specify the namespace](http://docs.oracle.com/javase/8/docs/api/javax/xml/bind/annotation/XmlAttribute.html#namespace--)

http://stackoverflow.com/a/24374265
upvote count: 3
answers question: http://stackoverflow.com/q/24374205
has comment: http://stackoverflow.com/comment/37694392
has comment: http://stackoverflow.com/comment/37694239
type: Answer
has comment: http://stackoverflow.com/comment/37694987
score: 3
has comment: http://stackoverflow.com/comment/37694136
downvote count: 0
has comment: http://stackoverflow.com/comment/37694097
has comment: http://stackoverflow.com/comment/37694126
has body: To use regex you will need replaceAll instead of replace method: as regex you can use \\d+ to match any group of one or more continues digits. We need all continues digits here because matching only one would create from foo123 something like foo 1 2 3 (?&lt;=[a-zA-Z])\\d if you want to add space only before digit which has alphabetic character before it. (?&lt;=\\[a-zA-Z]) part is look-behind and it just checks if tested digit has character from range a-z or A-Z before it. and as replacement you can use " $0 which means space and match from group 0 which means part currently matched by regex. So try with sample = sample.replaceAll("\\d+", " $0") or sample = sample.replaceAll("(?&lt;=[a-zA-Z])\\d", " $0") which will change "hello 1 world2" into "hello 1 world 2" - notice that only 2 has additional space.
has comment: http://stackoverflow.com/comment/37694267

http://stackoverflow.com/a/24294744
has comment: http://stackoverflow.com/comment/37544111
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24294686
answers question: http://stackoverflow.com/q/24294686
has comment: http://stackoverflow.com/comment/37543314
has comment: http://stackoverflow.com/comment/37543523
has body: Set binary transfer mode: f.connect("********"); f.login("*******", "********"); f.setFileType(FTP.BINARY_FILE_TYPE);

http://stackoverflow.com/comment/38925499
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24364465
has text: "==" is shallow comparision. If two objects point to the same memory reference, it returns true. ".equals" is deep comparion. It compares two objects by value, if they contain the same value, it returns true.
type: Comment

http://stackoverflow.com/q/24399846
tagged with: android
has comment: http://stackoverflow.com/comment/37742422
favorite count: 0
has comment: http://stackoverflow.com/comment/37742657
has answer: http://stackoverflow.com/a/24400202
accepted answer: http://stackoverflow.com/a/24400202
possible better answer: http://stackoverflow.com/a/24400198
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
tagged with: date
has title: Android SimpleDateFormat Parsing Error
type: Question
has comment: http://stackoverflow.com/comment/37742378
has answer: http://stackoverflow.com/a/24400198
has body: I know there are many other questions on stackoverflow that deal with SimpleDateFormatter in Android or Java, but I have been unable to find any questions that help me answer my own question. I have a String with this time format 2014-06-28T21:00:00-05:00 and I am trying to convert it to 9:00 PM (or at least 9:00). I'm pretty sure my issue is with actually writing out the correct notation for the above time, but here is my code: String input = '2014-06-28T21:00:00-05:00'; DateFormat fromFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss+|-hh:mm"); fromFormat.setLenient(false); DateFormat toFormat = new SimpleDateFormat("hh:mm"); toFormat.setLenient(false); try{ String output = toFormat.format(fromFormat.parse(input)); return output; } catch(ParseException pe){ pe.printStackTrace(); } return "No Date Listed"; If I look at the stack trace, it tells me unparseable date at offset #19. I am fairly certain the logic behind the code does work because I switched the SimpleDateFormats to something a little simpler like yyyy-MM-dd and MMMM dd, yy and it worked perfectly. So, can anyone point me in the right direction and help me figure out the proper time notation? I appreciate all of your help.
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/37742358

http://stackoverflow.com/comment/37619823
score: 0
type: Comment
type: QuestionComment
has text: @clearlyspam23 It just does not except LibGdx FileHandles as a parameter.
comment on: http://stackoverflow.com/q/24334925

http://stackoverflow.com/a/24296172
has body: Actually there is nothing fundamentally wrong with protected static. If you really want a static variable or method that is visible for the package and all subclasses of the declaring class then go ahead and make it protected static. Some people generally avoid to use protected for various reasons and some people think non-final static variables should be avoided by all means (I personally sympathize with the latter to some degree), so I guess the combination of protected and static must look bad^2 to those that belong to both groups.
score: 5
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24289070
upvote count: 5

http://stackoverflow.com/comment/37681261
comment on: http://stackoverflow.com/a/24367375
score: 0
type: Comment
has text: `But not in the case you mention.` I know, this was just meant as example. In my current case it is a more complex object structure where the elements will be filled case by case. The important point is: Will it be guaranteed that objects which are owned by only one other object will alway be located close to the owning object
type: AnswerComment

http://stackoverflow.com/q/24293488
score: 3
has title: How can an Android application function as a remote controller to a desktop application? (Spotify)
tagged with: java
has body: I am in the planning stages of developing an Android application to control my Spotify player. Since I am running Debian on my system, the options that are available on the Play Store are quite limited (I can't find any functioning apps). Therefore, the programmer inside me tells me to build one. I haven't built an Android application before, but I have good experience with working with APIs so I think this could be a pretty decent starter project for me. However, I am having some difficulties grasping some of the concepts on how I could implement this. With some research of the Spotify API documentation, I believe the Spotify Apps API is the one I should be using to control playback on the desktop. On the Android side of things, I would imagine I would use the Spotify Apps API in conjunction with the Libspotify API to receive metadata and display what the application is getting from the desktop playback. What I am having troubles understanding is how does the Android application talk with the Spotify desktop client? I have a few ideas, but I am unsure... My thought process so far is as follows: have a local webserver on the desktop open up and begin listening on the Android application, connect to the desktop's webserver (how do you do this?) once connected, the desktop sends metadata/other information to populate the Android application from the Android UI, hitting a UI button will send a request to the webserver, where it parses the data, completes an action, and then returns the response to the Android application I am a little lost on what tools I need to learn and use to get this working. Any suggestions to the implementation are greatly appreciated! Thank you!
has answer: http://stackoverflow.com/a/28935570
upvote count: 3
answer count: 2
tagged with: spotify
accepted answer: http://stackoverflow.com/a/24294456
tagged with: libspotify
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/24294456
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/28935570
downvote count: 0
tagged with: remote-access
type: Question

http://stackoverflow.com/comment/37598268
comment on: http://stackoverflow.com/a/24324083
score: 1
type: AnswerComment
type: Comment
has text: changed JSONObject settings = user.getJSONObject(JSONKeys.USER_SETTINGS); to JSONObject settings = new JSONObject(user.getString(JSONKeys.USER_SETTINGS)); and fixed my problem

http://stackoverflow.com/a/24402527
has comment: http://stackoverflow.com/comment/37750325
has body: i rephrase your command because you set the connection variable as drivermanager but in your statement you use con? and the string inside the connection replace it with the real value for example connect = DriverManager.getConnection("jdbc:mysql://localhost:3306", "&lt;your DBUsername&gt;", "&lt;your DB Password&gt;"); dont just copy paste next time, learn how the codes work try { Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection( "jdbc:mysql://HOST:port_number/DB_name","DB_username", "DB_pass"); st = connection.createStatement(); rs = st.executeQuery("SELECT * FROM table name WHERE id = 1"); } catch (Exception e) { System.out.println("DB error : " + e); }
type: Answer
has comment: http://stackoverflow.com/comment/37747335
answers question: http://stackoverflow.com/q/24402022
score: 0
has comment: http://stackoverflow.com/comment/37750904
has comment: http://stackoverflow.com/comment/37747307

http://stackoverflow.com/comment/37663603
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24357941
has text: Well now that depends if we're allowing Unicode characters as well. You see characters are not just letters but also any textual commands including new line, backspace etc. In the 8-bit model the DEL command is the last character, but z is the last letter. However in Unicode there can be millions of characters, including foreign language characters and mathematical symbols. So it really depends on what your intentions are how much of it matters.

http://stackoverflow.com/comment/37637133
type: Comment
has text: @FrenchFruits, see my edit - I think I found your issue.
type: AnswerComment
comment on: http://stackoverflow.com/a/24344396
score: 0

http://stackoverflow.com/q/24368090
type: Question
score: 10
has answer: http://stackoverflow.com/a/32163625
answer count: 3
tagged with: spring
has body: I'm new to Spring framework. I need to write Unit Test for JPA repository. I'm trying simple repository saveAndFlush() method. But nothing saves in my repository. Here is my source code: TestContext.class @Configuration @PropertySource("classpath:log4j.properties") public class TestContext { @Bean public RoleService roleService() { return Mockito.mock(RoleService.class); } @Bean public RightService RightService() { return Mockito.mock(RightService.class); } @Bean public RoleRepository RoleRepository() { return Mockito.mock(RoleRepository.class); } } RoleServiceTest.class @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {TestContext.class}) @WebAppConfiguration public class RoleServiceTest { @Autowired private RoleRepository roleRepository; @Test public void TestServices() throws Exception { RoleDetails first = new RoleDetails(); first.setId("1"); first.setDescription("First Description"); first.setName("First"); roleRepository.saveAndFlush(new RoleEntity(first)); roleRepository.save(new RoleEntity(first)); List&lt;RoleEntity&gt; roles = new ArrayList&lt;RoleEntity&gt;(); roles = roleRepository.findAll(); System.out.println(roles); assertEquals(1, roles.size()); } } And error: java.lang.AssertionError: expected:&lt;1&gt; but was:&lt;0&gt; I'm almost sure that problem occurs because of testContext.Class. I used this class to test my controller and it worked well, but now i need to test my database and i don't know how to modify contextConfiguration. I hope somone will help me. Thanks in advance!
tagged with: unit-testing
tagged with: spring-mvc
tagged with: java
has answer: http://stackoverflow.com/a/24368628
upvote count: 10
has title: Spring Unit test JPA repository
has answer: http://stackoverflow.com/a/24368315
type: AnsweredQuestion
tagged with: jpa
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/24368315
accepted answer: http://stackoverflow.com/a/24368628

http://stackoverflow.com/comment/37501735
score: 0
type: Comment
type: QuestionComment
has text: no, I've already been redirected to that question. It's not helped at all
comment on: http://stackoverflow.com/q/24273029

http://stackoverflow.com/a/24373277
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24373153
has body: The interface OperationManager might have other implementation classes also. Hence Spring would not be able to figure out which implementation has to be created. If that is the case, then the below should help. Also the interface need not be marked as a Component. @Autowired(required=true) @Qualifier("operationManagerImpl") private OperationManager opmanimpl ;
type: Answer

http://stackoverflow.com/q/24405975
has answer: http://stackoverflow.com/a/24406199
downvote count: 0
answer count: 1
favorite count: 0
tagged with: serialization
type: UnansweredQuestion
has title: JSON serialization strategy for dates
upvote count: 3
tagged with: java
type: Question
score: 3
tagged with: http://stackoverflow.com/tag/json
has body: The problem I am having is that I have some consumers that are Java and some that are browsers. My target browsers are IE7+ (json3 for IE7 only) &amp; Chrome. For a browser I wish to have the date deserialize to a Date JavaScript object (using the JSON.parse() method. For a Java consumer I wish to deserialize to a java.util.Date Java object. Given that I can't change anything on the browser side. I have to do serialize the messages to something like this: { myDate: new Date(&lt;EPOCH HERE&gt;) } Which of course will cause a problem for Java deserializer. However, I am hoping there is something I can do with Gson to make this work...amy ideas? Or should I take a different strategy altogether?

jdeveloper
tags question: http://stackoverflow.com/q/24369934
type: Tag
tag name: jdeveloper
tags question: http://stackoverflow.com/q/24324974

http://stackoverflow.com/comment/37587537
type: Comment
has text: And where in question it is said that `eyeColor` and `green` are Strings? People left comment about possible problem with `==` and Strings because this is only possibility of *future* problems, not answer to *current* OP question. Your answer currently lacks any information about how to solve not initialized variable error. I see you suggested Joda style `"string".equals(variable)` instead of `variable.equals("string")` which could prevent NullPointerException if `variable` would be `null`, but this is not the same problem as described in question.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24318183

http://stackoverflow.com/comment/37740483
type: AnswerComment
comment on: http://stackoverflow.com/a/24381409
has text: If this is what you mean by "guess" then the leadt I can say is that we would have to guess that this was what you meant.
type: Comment
score: 0

http://stackoverflow.com/q/24300479
has body: i want ask to convert doc docx to file text in here code enter code here public DokumenExtractor(String filename) { context = new ParseContext(); detector = new DefaultDetector(); parser = new AutoDetectParser(detector); context.set(Parser.class, parser); outputstream = new ByteArrayOutputStream(); metadata = new Metadata(); try { process(filename); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void process(String filename) throws Exception { URL url; File file = new File(filename); if (file.isFile()) { url = file.toURI().toURL(); this.PathFile=(file.getPath()).toString(); } else { url = new URL(filename); } this.input = TikaInputStream.get(url, metadata); ContentHandler handler = new BodyContentHandler(outputstream); parser.parse(input, handler, metadata, context); input.close(); } but output like this PAGE * MERGEFORMAT 36 not content of document clean ??? how to remove format Page after get string from document
score: 0
tagged with: http://stackoverflow.com/tag/docx
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/37560933
tagged with: java
has comment: http://stackoverflow.com/comment/37553524
has title: how to convert .doc .docx using tika apache?
type: Question
has comment: http://stackoverflow.com/comment/37553974
tagged with: apache-tika
has comment: http://stackoverflow.com/comment/37560346
tagged with: apache
has comment: http://stackoverflow.com/comment/37560824

http://stackoverflow.com/comment/37753396
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24405705
has text: First understand difference between SDK,JDK and Java EE HERE http://stackoverflow.com/questions/2024143/jdk-java-se-jdk-java-ee

http://stackoverflow.com/comment/37592275
score: 1
comment on: http://stackoverflow.com/a/24320340
type: AnswerComment
has text: Ok, you might want to include those at the end of the index. I also would recommend descending on start_ip, like: `CREATE INDEX map_ix1 ON myproject.MAP (end_ip, start_ip desc, lat, lng, county_id)` . It *should* perform much better that a single column index on start_ip
type: Comment

hadoop-plugins
type: Tag
tags question: http://stackoverflow.com/q/24390492
tag name: hadoop-plugins

http://stackoverflow.com/comment/37756329
has text: @DavidPostill Yes I am running my program on windows environment. That is why USB host support is unavailable like you stated in your comment. The thing is the same can be done using visual studio but as you know that makes the program run only on windows platform. I want my program to be platform independent.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24402964

http://stackoverflow.com/comment/37562618
comment on: http://stackoverflow.com/q/24302836
score: 0
type: Comment
has text: @Ankit it's working fine for single user, it's not working for more than one user. for 2 users it's giving npe exception .
type: QuestionComment

http://stackoverflow.com/q/24412401
upvote count: 0
has title: How to deploy the war file generated by maven on tomcat using eclipse?
tagged with: tomcat
favorite count: 0
type: UnansweredQuestion
has body: I have got a war file generated using Maven and it works perfectly fine when i manually deploy it on the tomcat server. However, the war file was generated using Maven on eclipse and when i try deploying this on the server using eclipse, it just doesn't act. The tomcat server starts perfectly fine. What I do is : Right click on the Tomcat Server 7.0, then Add/Remove Project and add it to the server. The problem is when I deploy and publish it on the server and nothing happens after that. On trying to access it, it says - The required resource is not found
downvote count: 2
tagged with: maven
has comment: http://stackoverflow.com/comment/37765597
has answer: http://stackoverflow.com/a/24412523
type: Question
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/37767567
tagged with: eclipse
answer count: 2
has answer: http://stackoverflow.com/a/24756059

http://stackoverflow.com/comment/37593021
type: Comment
comment on: http://stackoverflow.com/a/24321164
score: 0
type: AnswerComment
has text: Are you starting your response with "HTTP/1.1 200 OK\r\n" ?

http://stackoverflow.com/comment/37567648
type: AnswerComment
score: 0
type: Comment
has text: Yes, they should definitely be in sync.
comment on: http://stackoverflow.com/a/24307815

osmdroid
type: Tag
tags question: http://stackoverflow.com/q/24310756
tag name: osmdroid
tags question: http://stackoverflow.com/q/24331413

http://stackoverflow.com/q/24359062
has comment: http://stackoverflow.com/comment/37673522
upvote count: 2
has answer: http://stackoverflow.com/a/24367371
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37673560
tagged with: errorcollector
tagged with: java
has title: Storing/logging/printing all the errors collected by errorcollector
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has body: I have been using ErrorCollector Rule for collecting the failed test cases with a code that looks something like this : @Rule ErrorCollector collector = new ErrorCollector(); Map&lt;X, Y&gt; inputOutputMap = new HashMap&lt;X,Y&gt;(); inputOutputMap.add(new X("Input"), new Y("Output")); //Mocking service layers and returning expected outputs. for(Entry&lt;X,Y&gt; entry : inputOutputMap.entrySet()){ String url = "/do/something" Gson gson = new Gson(); String json = gson.toJson(); try{ this.mockMvc.perform(get(url) .contentType(MediaType.APPLICATION_JSON) .content(json)).andExpect(status().isInternalServerError()); } catch(Exception e) { collector.checkThat(e.getMessage, entry.getValue().getMessage()); } } So my problem is after collecting all the errors is there a way I can print all the errors also the way I write the test cases is this a write way - iterating a map and checking for output for respective input?
tagged with: junit
has comment: http://stackoverflow.com/comment/37680117
accepted answer: http://stackoverflow.com/a/24367371

http://stackoverflow.com/a/24350645
upvote count: 2
has comment: http://stackoverflow.com/comment/37648945
score: 2
has comment: http://stackoverflow.com/comment/37648921
has comment: http://stackoverflow.com/comment/37648930
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37648963
accepted answer of: http://stackoverflow.com/q/24350495
type: Answer
has body: Have you tried this? All classes of C# are derived from object. EDIT: Object class reference - http://msdn.microsoft.com/en-us/library/system.object.aspx You can typecast any object to object type - class Tag&lt;T&gt;{ } class ClassMap { private Dictionary&lt;object, object&gt; map = new Dictionary&lt;object,object&gt;(); public void put&lt;T&gt;(Tag&lt;T&gt; tag, T value){ map.Add(tag, value); } public T get&lt;T&gt;(Tag&lt;T&gt; tag){ return (T)map[tag]; } } public class Program { public static void Main(string[] args) { ClassMap v = new ClassMap(); Tag&lt;Int16&gt; t = new Tag&lt;short&gt;(); v.put&lt;short&gt;(t, 10); var tt = v.get&lt;short&gt;(t); } } The debug info -
answers question: http://stackoverflow.com/q/24350495

http://stackoverflow.com/q/24377772
tagged with: netbeans-7
has body: I ran a simple Calculator program with functions such as addition and multiplication and the program gave the required results. But after discussion on here, I tried to edit my code but after running the project its still giving me errors for my earlier program. All the commented code is from my earlier program. Please find both my program below and kindly tell me what I am doing wrong. After changing the values the program still gives the same result. public class Calculator { public static void main(String[] args) { int a = 6; int b = 5; // int c; // c = addition(a,b); //calling method and passing values for a and b System.out.println(addition(a, b)); } public static int addition(int a, int b) { // int c; // c= a+b; return a + b; } } // gives result of 11
has comment: http://stackoverflow.com/comment/37700594
has comment: http://stackoverflow.com/comment/37700630
has comment: http://stackoverflow.com/comment/37700610
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37700577
has comment: http://stackoverflow.com/comment/37700623
tagged with: java
has comment: http://stackoverflow.com/comment/37700625
has comment: http://stackoverflow.com/comment/37700588
type: Question
has answer: http://stackoverflow.com/a/24378726
has title: Edited program showing result for an earlier program
score: 0
has comment: http://stackoverflow.com/comment/37700636
answer count: 1

slf4j
tags question: http://stackoverflow.com/q/24359853
tag name: slf4j
type: Tag
tags question: http://stackoverflow.com/q/24342963

http://stackoverflow.com/comment/37624642
comment on: http://stackoverflow.com/a/24337851
has text: I've tried calling a new version of listBooksForPerson from the Person controller but it doesn't work with lazy fetching. So I'm going to amend getPerson so that it uses an SQL JOIN with Book to get the books for the Person in one go. Person has an arraylist of Book. But this can wait until tomorrow, it's dawn here. Thanks for help and I will update the question tomorrow.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24358990
has answer: http://stackoverflow.com/a/24359241
type: Question
linked to: http://stackoverflow.com/q/7188791
downvote count: 0
linked to: http://stackoverflow.com/q/10984835
favorite count: 0
has answer: http://stackoverflow.com/a/24359121
upvote count: 3
has answer: http://stackoverflow.com/a/24359124
has body: I am a beginner trying to learn how to use regular expressions in Java. By going through a few online tutorials, I wrote the following sample codes to teach myself how regex with grouping operates, but the results are somewhat unintuitive. String pattern = "((frok |dork )*)(\\w+) is (\\d+) Foo"; System.out.println(test1.matches(pattern)); System.out.println(test1.replaceAll(pattern, "$1")); System.out.println(test1.replaceAll(pattern, "$3")); With test1 = frok dork dumb is 10 Foo, I get $1 as frok dork, $3 as dumb, as expected. However, with test1 = frok dork is 10 Foo, I expected the match to fail. Instead, I get $1 as frok and $3 as dork. Why does the dork match with \\w+ here instead of ((frok | dork )*) as in earlier case? I did search here on SO, but these posts (Java regular expression with groups, Regular expressions, groups issue, Is there a way to use a list of string parameters with a regular expression (with groups) to construct a new string?, Regular expression with variable number of groups?) do not address this issue.
tagged with: regex
possible better answer: http://stackoverflow.com/a/24359241
accepted answer: http://stackoverflow.com/a/24359405
has answer: http://stackoverflow.com/a/24359139
answer count: 5
linked to: http://stackoverflow.com/q/5018487
linked to: http://stackoverflow.com/q/1814036
has title: Regex with grouping groups matches unintuitively?
has answer: http://stackoverflow.com/a/24359405
type: AnsweredQuestion
score: 3
tagged with: java

http://stackoverflow.com/comment/37539626
has text: Have you read about this exception before posting it here?
comment on: http://stackoverflow.com/q/24293012
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/comment/37503593
type: Comment
comment on: http://stackoverflow.com/a/24273046
has text: @OldCurmudgeon: In this case, I'm "handling" it by using the `while` loop, since the sole purpose here is just to wait until the specified time. If I could guarantee an InterruptedException is never thrown (and here, you can--I'm just trying to give a complete code example), I wouldn't need it.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37650583
type: QuestionComment
type: Comment
has text: @AlexR You can see it at the bottom of the formpanel class(just after the interface) sorry for this unorganized code.
score: 0
comment on: http://stackoverflow.com/q/24351426

http://stackoverflow.com/q/24323383
has title: Remove All Comments in Java Files
has comment: http://stackoverflow.com/comment/37596797
has comment: http://stackoverflow.com/comment/37596635
has body: I have many comments like following. Is there simple way to remove all comments? IDE Eclipse Kepler /* 34: */ /* * JD-Core Version: 0.7.0.1 */
linked to: http://stackoverflow.com/q/8748313
upvote count: 34
type: AnsweredQuestion
answer count: 12
score: 33
has answer: http://stackoverflow.com/a/30623955
tagged with: java
has answer: http://stackoverflow.com/a/30623840
linked to: http://stackoverflow.com/q/24326361
accepted answer: http://stackoverflow.com/a/24326900
linked to: http://stackoverflow.com/q/24320607
linked to: http://stackoverflow.com/q/1372748
downvote count: 1
has answer: http://stackoverflow.com/a/67090578
type: Question
has comment: http://stackoverflow.com/comment/37596821
has answer: http://stackoverflow.com/a/45392306
has answer: http://stackoverflow.com/a/74255504
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37596646
has answer: http://stackoverflow.com/a/24325328
has comment: http://stackoverflow.com/comment/37596674
possible better answer: http://stackoverflow.com/a/30622447
has comment: http://stackoverflow.com/comment/53637258
has answer: http://stackoverflow.com/a/24323537
has answer: http://stackoverflow.com/a/30622447
has answer: http://stackoverflow.com/a/24325629
has answer: http://stackoverflow.com/a/24326900
favorite count: 0
has answer: http://stackoverflow.com/a/73539627
has answer: http://stackoverflow.com/a/34972852
has comment: http://stackoverflow.com/comment/37601985

http://stackoverflow.com/q/24392403
has body: I have a project, with a parent module. Parent and child both using maven-assembly-plugin. Parent uses it's own descriptor (zip.xml): <?xml version="1.0" encoding="UTF-8"?> bin false zip ${svn.scripts} query.* ${cfgreader.dist} *.jar this way: maven-assembly-plugin ${basedir}/descriptors/zip.xml ${patch.prefix}_rev false make-assembly package single while my child's module pom.xml has: org.apache.maven.plugins maven-assembly-plugin com.test.cfgReader jar-with-dependencies cfgreader false make-assembly package single The problem is that the child module tries to use zip.xml descriptor and it causes errors: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2. 2-beta-5:single (make-assembly) on project dist: Error reading assemblies: Error locating assembly descriptor: D:\dist/descriptors/zip.xml [ERROR] [ERROR] [1] [INFO] Searching for file location: D:\dist\D\dist\D:\dist\descriptors\zip.xml [ERROR] [ERROR] [2] [INFO] File: D:\\dist\D:\\dist\descriptors\zip.xml does not exist. [ERROR] [ERROR] [3] [INFO] Invalid artifact specification: 'D:\\dist\D:\\dist\descriptors\zip.xml'. Must contain at le ast three fields, separated by ':'. [ERROR] [ERROR] [4] [INFO] Failed to resolve classpath resource: assemblies/D:\dist/descriptors/zip.xml from classloader: ClassRealm[plugin>org.apache.maven.plugins:maven-assembly-plugin:2 .2-beta-5, parent: sun.misc.Launcher$AppClassLoader@33d626a4] [ERROR] [ERROR] [5] [INFO] Failed to resolve classpath resource: D:\dist/descriptors/zip.xml from classloade r: ClassRealm[plugin>org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5, parent: sun.misc.Launcher$AppClassLoader@33d626a4] [ERROR] [ERROR] [6] [INFO] File: D:\D\descriptors\zip.xml does not exist. [ERROR] [ERROR] [7] [INFO] Building URL from location: D:\dist/descriptors/zip.xml [ERROR] Error: [ERROR] java.net.MalformedURLException: unknown protocol: d [ERROR] at java.net.URL.<init>(URL.java:592) [ERROR] at java.net.URL.<init>(URL.java:482) [ERROR] at ja…
has answer: http://stackoverflow.com/a/24406764
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/37751867
score: 0
accepted answer: http://stackoverflow.com/a/24406764
has comment: http://stackoverflow.com/comment/37728207
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/37745269
tagged with: maven
has title: Maven Assembly plugin parent descriptor sharing
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37731019

http://stackoverflow.com/q/24355567
has comment: http://stackoverflow.com/comment/37658986
score: 1
has comment: http://stackoverflow.com/comment/37659253
favorite count: 0
has body: There are two threads A and B. A keeps writing to an ArrayList and B keeps reading from it. The following code is for reading the ArrayList and belongs to thread B. The issue with this code is that sometimes both of the IF statements becomes true which should not be possible. First IF is there to ensure that list is not read beyond its size. Second IF is not a part of actual code. I have put it just for verification purposes. As you can see in the Output below, size of the list is greater than writeNext variable, I don't understand why this returns null. And yes, if I place a print statement or a a very small delay just after first IF, everything works fine. Please remember that there is just one thread that writes into the ArrayList, so issue should not be related to synchronization. public void run() {// thread B public class WriteTicksToFile implements Runnable, Serializable { int writeNext = 0; @Override public void run() { while (true) { // read till writeNext is equal to ArrayList.size()-1 i.e. the last index if (writeNext &lt; TickData.getCompleteTickList().size()) { // System.out.println(TickData.getCompleteTickList().size()+" "+writeNext); if (TickData.getCompleteTickList().get(writeNext) == null) { System.out.println("ListSize: " + TickData.getCompleteTickList().size() + " " + "Read@Index: " + writeNext); }// if ends // write element to file. writeTick(TickData.getCompleteTickList().get(writeNext)); writeNext++; }// if ends }// while ends } } Output: Number of symbols found: 19 Market Opening time: 81500 Market Closing time: 235900 Current Time: 203931 Waiting for market to open... Market Opened @ 203931 ListSize: 15876 Read@Index: 15875 ListSize: 15877 Read@Index: 15876
has comment: http://stackoverflow.com/comment/37659346
accepted answer: http://stackoverflow.com/a/24355816
has comment: http://stackoverflow.com/comment/37659036
has comment: http://stackoverflow.com/comment/37659174
has comment: http://stackoverflow.com/comment/37659127
has comment: http://stackoverflow.com/comment/37659470
type: AnsweredQuestion
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/37659448
type: Question
has comment: http://stackoverflow.com/comment/37659094
has comment: http://stackoverflow.com/comment/37659080
linked to: http://stackoverflow.com/q/11079210
has comment: http://stackoverflow.com/comment/37658968
has answer: http://stackoverflow.com/a/24355816
has comment: http://stackoverflow.com/comment/37659103
tagged with: arraylist
has comment: http://stackoverflow.com/comment/37680159
has title: null is returned while reading last index of an ArrayList
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/37770854
score: 0
comment on: http://stackoverflow.com/q/24414683
type: Comment
type: QuestionComment
has text: The raw.github and maven.onehippo.com repositories seemed to be not working and 1.3.6 is not available from maven central only 1.3.5. You should contact the author.

derby
tags question: http://stackoverflow.com/q/24336151
tags question: http://stackoverflow.com/q/24335810
tags question: http://stackoverflow.com/q/24395832
tags question: http://stackoverflow.com/q/24335752
tags question: http://stackoverflow.com/q/24323733
tag name: derby
type: Tag
tags question: http://stackoverflow.com/q/24289076

java-native-interface
tags question: http://stackoverflow.com/q/24397743
tags question: http://stackoverflow.com/q/24268926
tags question: http://stackoverflow.com/q/24295599
tags question: http://stackoverflow.com/q/24403340
tags question: http://stackoverflow.com/q/24295903
type: Tag
tags question: http://stackoverflow.com/q/24325676
tag name: java-native-interface
tags question: http://stackoverflow.com/q/24396722
tags question: http://stackoverflow.com/q/24289535
tags question: http://stackoverflow.com/q/24344034
tags question: http://stackoverflow.com/q/24375697
tags question: http://stackoverflow.com/q/24352392
tags question: http://stackoverflow.com/q/24362639

http://stackoverflow.com/q/24350194
favorite count: 0
upvote count: 0
linked to: http://stackoverflow.com/q/16079886
has comment: http://stackoverflow.com/comment/37648706
tagged with: swing
has comment: http://stackoverflow.com/comment/37648060
linked to: http://stackoverflow.com/q/10984114
has comment: http://stackoverflow.com/comment/37648253
type: AnsweredQuestion
tagged with: java
tagged with: jpanel
has comment: http://stackoverflow.com/comment/37648198
has body: I'm having a problem trying to change JPanels by using buttons. I have a JFrame with 2 panels, 1 of them is for the buttons, which i want them to always be showed. The other one is the one that i will be switching everytime i press one ot the buttons of the other panel. The problem is that everytime i press them nothing really ever displays, i keep my buttons but the other panel that i call does not appear. Code for one of the buttons is as follows private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { ReparacaoPanel r = new ReparacaoPanel(this, this.jPanel1); this.getContentPane().remove(this.jPanel1); this.getContentPane().add(r); //this.setContentPane(r); this.visiblePanel.setVisible(false); this.visiblePanel = r; this.pack(); this.setVisible(true); r.setLocation(200, 200); this.getContentPane().revalidate(); this.repaint(); } If i try to use "this.setContentPane(r);" (it sets the frame to only show the panel) the panel shows. But when i try to call it as i'm trying to do in the code above nothing is showed apart from the panel that has the buttons. I have no idea what i'm doing wrong, it does not seem to be a problem with the JPanel that i'm trying to call as it shows if used alone. Anyone can help me out?
has comment: http://stackoverflow.com/comment/37648136
type: Question
has title: JPanel does not appear when i try to add it to ContentPane
has comment: http://stackoverflow.com/comment/37648395
tagged with: contentpane
accepted answer: http://stackoverflow.com/a/24350400
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/37648167
has answer: http://stackoverflow.com/a/24350400
downvote count: 2
has comment: http://stackoverflow.com/comment/37648121
linked to: http://stackoverflow.com/q/15840686
has comment: http://stackoverflow.com/comment/37648200
has comment: http://stackoverflow.com/comment/37648649

http://stackoverflow.com/a/24396816
score: 2
has body: The JIT can inline and optimize away a method call, but only if it is relatively trivial e.g. a field lookup. Before you try to optimise your code, you should run it through a CPU and/or memory profiler and when you have measured your performance then you can decide how to optimise your code. Anything else will be just guessing what can make a difference. In short, make the code clear and simple to understand and worry about performance when you know you have a problem because you measured it.
upvote count: 2
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24396721

http://stackoverflow.com/q/24344003
tagged with: comparable
has body: First time posting. Having trouble finding an answer, so here goes: Introduction: It's part of my homework. Assignment was to work on integer binary tree. First 3 steps were about programming a dozen methods to manipulate and play around with the tree like adding new nodes, counting, traversing, summing, etc. 4th part required creating the exact same class only for strings, where values would be compared using compareTo method. Problem: Next step of the assignment requires using polymorphism to allow nodes to accept either int or string. Since I was only briefly introduced to this on our last lecture, I have found myself stuck for past few hours looking for solution, unsuccessfully. Code: public class Node&lt;T extends Comparable&lt;T&gt;&gt; { T val; Node&lt;T&gt; left, right; public Node(T val) { this.val = val; this.left = null; this.right = null; } public Node&lt;T&gt; insert(Node n, T v) { if (n == null) { return new Node(v); } if (v.compareTo(n.val) == 0) { return n; } if (v.compareTo(n.val) &lt; 0) { n.left = insert(n.left, v); } else { n.right = insert(n.right, v); } return n; } ... } The problem is using compareTo() on Raw types. I can't find anywhere how would I go about comparing two objects/raw types. I have tried numerous variations usually all with similar results. The debugger is constantly reminding me "incompatible types: Comparable cannot be converted to T". How exactly would I have to implement Comparable for this binary tree to work?
has comment: http://stackoverflow.com/comment/37635919
score: 0
answer count: 1
tagged with: polymorphism
tagged with: binary-tree
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24344069
accepted answer: http://stackoverflow.com/a/24344069
type: Question
has comment: http://stackoverflow.com/comment/37635921
tagged with: java
has title: Using comparable on raw types

http://stackoverflow.com/comment/50764641
type: Comment
comment on: http://stackoverflow.com/a/24470726
has text: Timay don't use the method I wrote above. Use custom decoding and playback using audio track. OR try creating an http server on local host to forward the stream to the media player.
score: 1
type: AnswerComment

http://stackoverflow.com/a/24377230
has comment: http://stackoverflow.com/comment/37699776
score: 0
has comment: http://stackoverflow.com/comment/37700368
has comment: http://stackoverflow.com/comment/37699834
answers question: http://stackoverflow.com/q/24377153
has body: You did not call super.onCreateOptionsMenu(menu); inside you onCreateOptionsMenu method so thats why it remains blank. solution: public boolean onCreateOptionsMenu(Menu menu){ MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.block, menu); return super.onCreateOptionsMenu(menu); } add this as well: @Override public boolean onPrepareOptionsMenu(Menu menu) { return super.onPrepareOptionsMenu(menu); } add the action as well: @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_overflow) { return true; } else if(id == R.id.action_search) { return true; } return super.onOptionsItemSelected(item); }
has comment: http://stackoverflow.com/comment/37706856
has comment: http://stackoverflow.com/comment/37699896
type: Answer
has comment: http://stackoverflow.com/comment/37700428

http://stackoverflow.com/a/24333885
accepted answer of: http://stackoverflow.com/q/24269717
has body: Found as the same problem as follows: https://hibernate.atlassian.net/browse/HHH-7842 This is probably a bug, if i ask it to be inner join in the alias, it should be, i can do this with HQL, why can't i do with Criteria? So, now i will have to use the LEFT_OUTER_JOIN type to solve this, or don't use alias at all (if i don't need to make a where clause or 2-depth fetch) Hope it help someone, thanks for all your help! example dc.createAlias(fetch, fetch, JoinType.LEFT_OUTER_JOIN); OR dc.setFetchMode(fetch, FetchMode.JOIN);
answers question: http://stackoverflow.com/q/24269717
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/24300091
has comment: http://stackoverflow.com/comment/37552826
has body: When I debugged my application, I located the problem at last. I can reproduce it, but I have no idea why it happens. Here's the entire code: public static MappedByteBuffer map(File file, long length) throws IOException { RandomAccessFile raf = new RandomAccessFile(file, "rw"); try { if (length &gt; 0) { raf.setLength(length); } try { return raf.getChannel().map(FileChannel.MapMode.READ_WRITE, 0, file.length()); } catch (IOException e) { System.gc(); System.runFinalization(); return raf.getChannel().map(FileChannel.MapMode.READ_WRITE, 0, file.length()); } } finally { raf.close(); } } public static void main(String[] args) throws IOException, InterruptedException { long t = System.currentTimeMillis(); MappedByteBuffer mbb = map(new File("temp.mmp"), 1024L * 1024 * 1024); System.out.println("load " + (System.currentTimeMillis() - t));//* for (int i = 0; i &lt; 2014L * 1024 * 1024; i++) {}//* int d = 0; for (int j = 0; j &lt; 10; j++) { t = System.currentTimeMillis(); mbb.position(0); mbb.limit(mbb.capacity()); for (int i = 0; i &lt; mbb.capacity(); i++) { d += mbb.get(); } System.out.println(j + " " + (System.currentTimeMillis() - t)); } System.out.println(d); } The output is: load 3 0 3429 1 3443 2 3203 3 3197 4 3203 5 3194 6 3247 7 3216 8 3211 9 3201 -1073741824 After commenting out the two lines marked with //*, The output is: 0 782 1 804 2 539 3 557 4 545 5 558 6 546 7 546 8 545 9 557 -1073741824 I've tested under JDK 6/7/8 and Windows7 64 OS, there's no difference. But under linux/CentOS the problem is gone. Is it a Java bug? Or something I do wrong. Thanks for help. After further study, I learned that this is a thing about JIT. But I can not tell why still. A new test code: public static void main(String args[]) { System.out.println("a");//1 for (int i = 0; i &lt; 1073741824; i++) {}//2 { long d = 0; long t = System.currentTimeMillis(); for (int j = 0; j &lt; 40; j++) { for (int x = 0; x &lt; 1073741824; x++) { d += 1; } } System.out.println(d + " " + (System.cu…
has comment: http://stackoverflow.com/comment/37556961
answer count: 0
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/37553354
downvote count: 1
type: Question
tagged with: performance
tagged with: nio
has comment: http://stackoverflow.com/comment/37557438
score: 0
has comment: http://stackoverflow.com/comment/37552961
has comment: http://stackoverflow.com/comment/37559917
linked to: http://stackoverflow.com/q/504103
has title: A very weird performance about JIT
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/37682557
has text: Take a look at [this](http://stackoverflow.com/questions/1217449/how-can-i-debug-this-nullpointer-exception) and [this](http://msmvps.com/blogs/jon_skeet/archive/2010/08/29/writing-the-perfect-question.aspx)
score: 0
comment on: http://stackoverflow.com/q/24368240
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37530975
comment on: http://stackoverflow.com/q/24288592
type: QuestionComment
score: 6
has text: I think it's question for CodeReview.
type: Comment

http://stackoverflow.com/q/24390492
downvote count: 0
has body: I am a beginner in hadoop using the hadoop's beginners guide book as a tutorial. I am using a mac osx 10.9.2 and hadoop version 1.2.1 I have set all the appropriate class path, when I call echo $PATH in terminal: Here is the result I get: /Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/oladotunopasina/hadoop-1.2.1/hadoop-core-1.2.1.jar:/Users/oladotunopasina/hadoop-1.2.1/bin:/usr/share/grails/bin:/usr/share/groovy/bin:/Users/oladotunopasina/.rvm/gems/ruby-2.1.1/bin:/Users/oladotunopasina/.rvm/gems/ruby-2.1.1@global/bin:/Users/oladotunopasina/.rvm/rubies/ruby-2.1.1/bin:/usr/local/heroku/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/oladotunopasina/.rvm/bin:/Users/oladotunopasina/.rvm/bin I tried compiling WordCount1.java and I am getting the following error: WordCount1.java:2: package org.apache.hadoop.conf does not exist import org.apache.hadoop.conf.Configuration ; ^ WordCount1.java:3: package org.apache.hadoop.fs does not exist import org.apache.hadoop.fs.Path; ^ WordCount1.java:4: package org.apache.hadoop.io does not exist import org.apache.hadoop.io.IntWritable; ^ WordCount1.java:5: package org.apache.hadoop.io does not exist import org.apache.hadoop.io.Text; ^ WordCount1.java:6: package org.apache.hadoop.mapreduce does not exist import org.apache.hadoop.mapreduce.Job; ^ WordCount1.java:7: package org.apache.hadoop.mapreduce does not exist import org.apache.hadoop.mapreduce.Mapper; ^ Kindly help.
tagged with: hadoop-plugins
favorite count: 0
score: 8
tagged with: word-count
upvote count: 8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24392218
tagged with: java
possible better answer: http://stackoverflow.com/a/24417861
has answer: http://stackoverflow.com/a/24417861
type: Question
tagged with: hadoop
has title: package org.apache.hadoop.conf does not exist after setting classpath
accepted answer: http://stackoverflow.com/a/24392218
answer count: 2
tagged with: javac

http://stackoverflow.com/comment/37768302
score: 1
comment on: http://stackoverflow.com/q/24413894
type: Comment
type: QuestionComment
has text: you can use [batch](http://docs.oracle.com/javase/7/docs/api/java/sql/Statement.html#executeBatch()) Also please try to implement using [preparedstatement](http://docs.oracle.com/javase/6/docs/api/java/sql/PreparedStatement.html)

http://stackoverflow.com/comment/37726163
has text: So now you want to have a distributed list? Can you use a server side option? or pass updates to all clients at the same time?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24376731

http://stackoverflow.com/q/24328136
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37606287
linked to: http://stackoverflow.com/q/1732348
score: 0
has comment: http://stackoverflow.com/comment/37605779
tagged with: regex
has comment: http://stackoverflow.com/comment/37605882
has comment: http://stackoverflow.com/comment/37605766
type: UnansweredQuestion
has title: Regular expression to match '\n' character
has answer: http://stackoverflow.com/a/24328519
has comment: http://stackoverflow.com/comment/37605681
tagged with: java
has body: I am having a string "<?xml version=2.0> Feed " I wrote a regex to match this string as "<?xml.*<rss.* " But if the input string contains \n like `"\nFeed" doesn't work for the above regex. How to modify my regex to include \n character between strings.
has answer: http://stackoverflow.com/a/24328358

http://stackoverflow.com/comment/37789059
comment on: http://stackoverflow.com/a/24407301
score: 0
type: AnswerComment
has text: Indeed the learning curve is steep but regard it as a learning experience, you'll have to know all these stuff when doing back-end development anyway.
type: Comment

http://stackoverflow.com/a/24427255
type: Answer
has body: If you are trying to Export the table (OR Web page) to excel file you need to write your download (response) code inside the SAME .jsp so in your case. Add following in your Excel.jsp file. &lt;%//Use scriptlet if (exportToExcel != null &amp;&amp; exportToExcel.toString().equalsIgnoreCase("YES")) { response.setContentType("application/vnd.ms-excel"); response.setHeader("Content-Disposition", "inline; filename=" + "excel.xls"); } %&gt; //In short COPY whole code from Servlet's get method and paste it in Scriplet So here you are apparently calling your own .jsp and handling the request and as exportToExcel is equal to YES it will give you the file with content on your .jsp.
score: 1
has comment: http://stackoverflow.com/comment/37793367
upvote count: 1
has comment: http://stackoverflow.com/comment/37793850
answers question: http://stackoverflow.com/q/24426612
downvote count: 0

http://stackoverflow.com/comment/37610628
has text: But I don't see what is invalid, sorry I have little experience in soap with java
comment on: http://stackoverflow.com/q/24328078
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37669369
type: Comment
has text: @M.Deinum: The original poster asked for Spring **or AspectJ** solutions. Spring AOP with its dynamic proxy approach is not only too limited but also too slow for my taste. But that is just personal opinion. Why use a musket if I can use a raygun?
comment on: http://stackoverflow.com/a/24361056
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37760040
comment on: http://stackoverflow.com/a/24406868
score: 0
type: AnswerComment
has text: It is not possible negate, but since the domain of values is fixed the user can select the complete domain except 'wood'. I'll look into Wang and BDD. _Plan B_ is to limit the amount of CPU as you mentioned, but i'll focus first on finding a way to prevent the timeout scenario.
type: Comment

http://stackoverflow.com/comment/37592517
comment on: http://stackoverflow.com/q/24321087
type: Comment
score: 0
has text: .....just out of curiosity,assuming predefined functions, *like in `java.util.ArrayList`* why the heck would u want to do that? :\
type: QuestionComment

http://stackoverflow.com/a/24334508
downvote count: 0
has body: It is because of the IdleHandler(). It is executed immediately quitting you looper. I commented your code: public void run() { super.run(); Looper.prepare(); MessageQueue queue = Looper.myQueue(); queue.addIdleHandler(new IdleHandler() { // This is executed immediately when the looper is idle. // So this looper is quitted // and thread starts to execute "while" loop @Override public boolean queueIdle() { Looper.myLooper().quit(); return false; } }); handler = new Handler() { @Override public void handleMessage(Message msg) { Log.i("HANDLING", "SOMETHING"); } }; Looper.loop(); // Take into account that this function is blocking // This "while" loop is executed after the looper is quitted from IdleHandler // So why your game is running // When you click your button it tries to send message to quitted looper // and you get the corresponding error message while (isRunning) { currentTime = System.currentTimeMillis(); // spin in a while loop for a while while ((currentTime - previousTime) &lt; REFRESH_RATE) { currentTime = System.currentTimeMillis(); } airplane.move(); canvas = surfaceHolder.lockCanvas(); if (canvas != null) { surfaceView.draw(canvas); airplane.draw(canvas); surfaceHolder.unlockCanvasAndPost(canvas); } } } When you commented the IdleHandler the thread executes Looper.loop() (it is blocking) method so the while loop is not being reached.
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24333878

http://stackoverflow.com/q/24320716
answer count: 1
tagged with: ms-access
has title: Managing a database with Java
linked to: http://stackoverflow.com/q/21955256
has comment: http://stackoverflow.com/comment/37593223
has comment: http://stackoverflow.com/comment/37591879
accepted answer: http://stackoverflow.com/a/24324240
has body: I have a MS Access database. My goal is to create a simple program to manage said database (i.e. add, modify, and/or delete information). Do I need to have Access installed in order for this program to work?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24324240
type: Question
tagged with: java
score: 0

http://stackoverflow.com/a/24288955
has comment: http://stackoverflow.com/comment/37613577
score: 2
has comment: http://stackoverflow.com/comment/37532940
has comment: http://stackoverflow.com/comment/37612107
downvote count: 0
has comment: http://stackoverflow.com/comment/37532078
has body: getResource method causes the class loader to look through the directories and JAR files in the program's class path for your image so it should be either in your jar or one of other jar inside your classpath http://docs.oracle.com/javase/tutorial/uiswing/components/icon.html#getresource I advice you to make folder inside your src folder for images and then move your images there then you can specify the foldername/imagename to access it: ImageIcon icon = ImageIcon(this.getClass().getResource("/images/filename.png")); or you can use: ImageIcon icon = ImageIcon(this.getClass().getClassLoader().getResource("images/filename.png")); both of them will start from the root of classpath
has comment: http://stackoverflow.com/comment/37612233
upvote count: 2
answers question: http://stackoverflow.com/q/24288686
type: Answer
has comment: http://stackoverflow.com/comment/37613512

http://stackoverflow.com/q/24396358
has comment: http://stackoverflow.com/comment/37738757
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/21233907
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/60348814
upvote count: 1
has comment: http://stackoverflow.com/comment/37767646
score: 1
tagged with: java
has title: Android DrawerLayout not Closing
type: Question
has body: I am having a problem getting an Android DrawerLayout to close. In my implementation I am using a LinearLayout rather than a listView. The list view implementation is the one commonly be found in most of the tutorials and discussed on this site. In my implementation I want to use the same DrawerLayout on all activities of my application. For that reason, in all of my XML layout files I use an include to cut down the amount of code one needs to store. The functionality of the drawer and it's buttons is exactly as I want them to be. The draw slides open on a swipe, closes on a swipe and all buttons respond with the appropriate functionality. However, I cannot get the drawer to close programmatically by calling any of the following. It simply has no effect. drawerLayout.closeDrawers(); drawerLayout.closeDrawer(GRAVITY_START); drawerLayout.closeDrawer(drawerLinearLayout); I tried a few variants on this like calling the whole DrawLayout object from the veiw to no avail, I tried different gravity options. Here I just got run time errors complaining about illegal states. Why is closing the draw programmatically such a hard thing to do? Why does closeDrawers not work? How can I close it simply and cleanly? Below is some code from one such Activity's layout. <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <FrameLayout android:id="@+id/content_frame" android:background="#000000" android:layout_width="match_parent" android:layout_height="match_parent" /> <include android:id="@+id/left_draw" android:layout_width="240dp" android:layout_height="match_parent" layout="@layout/options_draw" android:layout_gravity="start"/> </android.support.v4.widget.DrawerLayout> The include refers to a layout which is below. It defines a layout of 6 buttons plus two radio buttons. <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+…

http://stackoverflow.com/q/24387290
tagged with: java
tagged with: multithreading
type: Question
tagged with: android-layout
has body: I have a class which extends RelativeLayout and in this class I create a Thread. My custom RelativeLayout is now used in a ListView. Now my problem. I start the Thread after instantiation of my class. Now the user scrolled the ListView very fast. Where can I stop my Thread, because if my custom RelativeLayout is out of scope it won't be GCed because the Thread is still there. Here a stub of my code... private Thread mThread; public class MyLayout() extends RelativeLayout { public MyLayout(Context context) { super(context); mThread = new Thread(new Runnable...); mThread.start(); } }
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24387359
tagged with: android
has title: Android RelativeLayout Thread

aide-ide
tag name: aide-ide
type: Tag
tags question: http://stackoverflow.com/q/24366876

http://stackoverflow.com/comment/37561140
score: 0
type: Comment
has text: yours and Subhrajyoti Majumder code is working good..but geting the error :(
comment on: http://stackoverflow.com/a/24301944
type: AnswerComment

http://stackoverflow.com/comment/125649226
score: 2
comment on: http://stackoverflow.com/a/28635465
type: AnswerComment
type: Comment
has text: `brew install --cask adoptopenjdk/openjdk/adoptopenjdk8` worked for me, I am on a mac Monterey with Apple M1 chip.

http://stackoverflow.com/q/24298736
has answer: http://stackoverflow.com/a/24298937
linked to: http://stackoverflow.com/q/15661959
has title: How to use java git for java project
upvote count: 2
answer count: 1
tagged with: git
accepted answer: http://stackoverflow.com/a/24298937
tagged with: jgit
has body: What I want to know is, there are many java implementation for access git. Is there a way to use thees libraries? I have seen so many tutorials saying how access git via java code. Its a single class that has git functions. But there is no consideration how we use thees code for real application. Then without using plug in IDEs(jgit,egit....) or CLI tool how we use thees libraries for our java project?
tagged with: java
tagged with: egit
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5335804
downvote count: 0
favorite count: 0
type: Question

http://stackoverflow.com/q/24330150
accepted answer: http://stackoverflow.com/a/24333220
has body: I have read both Can I tell iText how to clip text to fit in a cell and http://osdir.com/ml/java.lib.itext.general/2005-01/msg00112.html, and I'm still confused about how to do what I want. I want to clip the text but still have the anchor reference work. Putting an anchor inside a template is no good (as per the second link). Here's the code I was using (I understand why it doesn't work, just not what to do instead): public static void drawTextClipped(PdfContentByte canvas, Rectangle rect, float clipHeight, Phrase p, int horizontalAlignment) { PdfTemplate tmp = canvas.createTemplate(rect.getWidth(), clipHeight); drawColumnText(tmp, new Rectangle(0, clipHeight - rect.getHeight(), rect.getWidth(), clipHeight), p, horizontalAlignment, false); canvas.addTemplate(tmp, rect.getLeft(), rect.getTop() - clipHeight); } public static float drawColumnText(PdfContentByte parent, Rectangle rect, Phrase p, int horizontalAlignment, boolean simulate) { try { ColumnText ct = new ColumnText(parent); ct.setLeading(0, 1); ct.setSimpleColumn(rect); ct.setText(p); ct.setAlignment(horizontalAlignment); ct.go(simulate); return ct.getYLine(); } catch (DocumentException de) { throw new ExceptionConverter(de); } } Bear in mind that this displays correctly, but when Phrase p is an Anchor, it is unclickable. Thanks!
tagged with: itext
upvote count: 1
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/14967188
type: Question
answer count: 1
linked to: http://stackoverflow.com/q/22095320
downvote count: 0
has title: How can I vertically clip a text anchor in iText (Java)
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24333220

http://stackoverflow.com/comment/37789055
type: AnswerComment
type: Comment
has text: Ok.Then one more try can be add %JAVA_HOME% to start of the PATH variable.
comment on: http://stackoverflow.com/a/24424546
score: 0

http://stackoverflow.com/a/24360731
type: Answer
has comment: http://stackoverflow.com/comment/37670621
has comment: http://stackoverflow.com/comment/37668830
has body: I would recommend using your own implementation (or a mock) of ExecutorService, which will not use threads, but rather mimic thread like behavior (or it can used threads but in a controlled manner). This way you'll have as much control as needed. This of course depends on the code being tested being testable enough to use a different ExecutorService for tests than for production, i.e. either the ExecutorService instance is being passed to it, or injected into it.
score: 0
has comment: http://stackoverflow.com/comment/37668947
answers question: http://stackoverflow.com/q/24360656
has comment: http://stackoverflow.com/comment/37668773

http://stackoverflow.com/q/24391121
has answer: http://stackoverflow.com/a/24615392
favorite count: 0
has body: I am setting up a custom 404 page in tomcat 7(CentOS 5). 404 /error/404.html The problem now is localhost:8080/badlink displays 404.html but when using with webapps/sample localhost:8080/sample/badlink displays a blank page The logs for /sample/badlink shows FINE: Processing ErrorPage[errorCode=404, location=/error/404.html] I think tomcat picks up the custom 404 page but it doesn't serve it to the browser. Is it because the error/404.html is placed in the webapps/ROOT so other webapps dont have access it Any ideas ?
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has title: tomcat 7 conf/web.xml custom error page not picked up by webapps
tagged with: tomcat
tagged with: centos
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/114267694
type: Comment
has text: What do you mean by "You have to make the static final static or remove static"? If you mean the field `foo`, it is possible to make it final, but the question author didn't ask about this. If you mean the variable `a`, this is not true - a Java variable can be `final`, but not `static final` (or `static`).
comment on: http://stackoverflow.com/a/24269485
score: 0
type: AnswerComment

http://stackoverflow.com/q/24317210
has answer: http://stackoverflow.com/a/24404262
has comment: http://stackoverflow.com/comment/37740567
accepted answer: http://stackoverflow.com/a/24404262
favorite count: 0
score: 2
tagged with: audio
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24412059
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/27278097
has comment: http://stackoverflow.com/comment/37585490
has comment: http://stackoverflow.com/comment/37602732
type: Question
has title: No Sound When Trying to Play Audio (.wav) Files
has body: I have a very simple class that can play a sound file with the following code: import java.io.File; import java.io.IOException; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.UnsupportedAudioFileException; public class Sound{ private Clip sound; public Sound(String location){ try{ sound = AudioSystem.getClip(); File file = new File(location); sound.open(AudioSystem.getAudioInputStream(file)); } catch(IOException | LineUnavailableException | UnsupportedAudioFileException error){ System.out.println(error); } } public void play(){ sound.start(); } } However, when I create an instance of this class and call the play function on it I don't get any sound. I hear a pop when the sound starts and when it ends but not the actual file. Also I don't get any errors of any sort. What am I doing wrong?
linked to: http://stackoverflow.com/q/2416935
has comment: http://stackoverflow.com/comment/37713613
has comment: http://stackoverflow.com/comment/37600672
upvote count: 2
answer count: 3
has answer: http://stackoverflow.com/a/24412059
tagged with: playing
tagged with: avaudioplayer
has comment: http://stackoverflow.com/comment/37585507

http://stackoverflow.com/comment/37685215
type: QuestionComment
type: Comment
score: 1
has text: The first mistake is storing a balance in a double. Never use floating point variables for storing amounts of money.
comment on: http://stackoverflow.com/q/24369643

http://stackoverflow.com/a/24343249
downvote count: 0
has comment: http://stackoverflow.com/comment/37639087
has comment: http://stackoverflow.com/comment/37634439
type: Answer
has body: If I understand your problem correctly, you want to use compression to return the PDF, but you want it to display directly in the user's browser, rather than requiring the user to unzip it and then open it on his desktop. If you're planning to return a javax.ws.rs.core.Response object, you'll need to set the Variant so it contains an encoding of "gzip". Ideally, you should let JAX-RS examine the Accept-Encoding header of the request and do the proper negotiation using Request.selectVariant; see this question for details. You will also of course need to zip or gzip your content. There are many ways to do this, but rather than stuffing the entire compressed document into a new file or byte array, I would favor StreamingOutput: @Path("document/{id}") @Produces("application/pdf") public Response getDocument(@PathParam("id") int id, @Context Request request) { final File pdfFile = getPdfContent(id); Variant.VariantListBuilder variantBuilder = Variant.mediaTypes(new MediaType("application", "pdf")); List&lt;Variant&gt; allVariants = variantBuilder.encodings("gzip", "identity").build(); Variant variant = request.selectVariant(allVariants); Response.ResponseBuilder response = Response.ok().variants(allVariants).variant(variant); if (variant.getEncoding().equals("gzip")) { response.entity(new StreamingOutput() { @Override public void write(OutputStream stream) throws IOException { GZIPOutputStream gzipped = new GZIPOutputStream(stream); Files.copy(pdfFile.toPath(), gzipped); gzipped.flush(); } }); } else { response.entity(pdfFile); } return response.build(); } Edit: Michael points out that as of Java EE 7, you can register a WriterInterceptor to, among other things, wrap a response OutputStream in a GZIPOutputStream. In this case I assume you would have to set the Content-Encoding header yourself, since WriterInterceptorContext does not use Variant.
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37637295
answers question: http://stackoverflow.com/q/24342751

http://stackoverflow.com/q/24395832
downvote count: 0
has answer: http://stackoverflow.com/a/28319922
tagged with: derby
answer count: 2
accepted answer: http://stackoverflow.com/a/24649992
favorite count: 0
has body: I need to create a User Defined Aggregate (UDA) function in Derby (specifically, a Variance function), but I'm kinda stuck with the proper way to write it. So far, I have the "template" for the UDA: public class Variance&lt;V extends Comparable&lt;V&gt;&gt; implements Aggregator&lt;V,V,Variance&lt;V&gt;&gt; { private ArrayList&lt;V&gt; _values; public Variance() {/*Empty constructor*/} public void init() {_values = new ArrayList&lt;V&gt;(); } public void accumulate(V v) { _values.add(v); } public void merge(Variance&lt;V&gt; o) { _values.addAll(o._values); } public V terminate() { // Here is my issue!!! } } The issue I'm facing is this: To compute the variance I need to calculate something like this: V sum, sumSq; int n = _values.size(); if(n &lt;= 0) return null; // Initialize sum and sumSq to "zero" for(V v : _values) { sum += v; // Or somehow add v to sum sumSq += Math.pow(v, 2); // Or somehow add (v^2) to sumSq } return (sumSq - n * Math.pow(sum / n, 2)) / n; ... but I don't know how to tell that this is only valid for numeric types (integer, decimal or floating-point values). I think I'm missing something in my code, but I don't know if there's a way to tell this program that V is numeric, and thus, I can use arithmetic operations on values of type V. So, the specific questions are: Is there a way to perform this operations (addition, substraction, product, power) on the values? Should I change the definition of V (somewhat making it extend a "numeric" class, like Double)?
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24649992
has title: Creating a User Defined Aggregate function in Apache Derby
type: Question
linked to: http://stackoverflow.com/q/3850970
possible better answer: http://stackoverflow.com/a/28319922

http://stackoverflow.com/comment/37745935
type: Comment
comment on: http://stackoverflow.com/q/24401822
type: QuestionComment
has text: `A varA = this;` would be enough here.
score: 1

http://stackoverflow.com/comment/37787864
comment on: http://stackoverflow.com/a/24424217
score: 0
type: Comment
has text: Hi, I have use "tasklist /v" to see the process list. But I can only see "ConsoleApplication1.exe" but not "exe.bat" when I use bat. So, how can I stop one bat includes more than one exe command ?
type: AnswerComment

http://stackoverflow.com/q/24334499
upvote count: 3
tagged with: querydsl
has comment: http://stackoverflow.com/comment/37627077
possible better answer: http://stackoverflow.com/a/69822974
accepted answer: http://stackoverflow.com/a/24352513
type: AnsweredQuestion
has title: Retrieving table name and/or column name via QueryDSL?
score: 3
has answer: http://stackoverflow.com/a/24352513
downvote count: 0
has body: Is there any way in QueryDSL to retrieve the table name and/or column name for an entity from the Q classes? I've looked through the classes and can't find anything offhand, but I figure there must be a way for QueryDSL to know the table names.
tagged with: java
has comment: http://stackoverflow.com/comment/70626523
type: Question
has answer: http://stackoverflow.com/a/69822974
answer count: 2
has comment: http://stackoverflow.com/comment/37642571
favorite count: 0

http://stackoverflow.com/a/24398897
score: 1
has comment: http://stackoverflow.com/comment/37740455
upvote count: 1
answers question: http://stackoverflow.com/q/24398828
downvote count: 0
has body: From the PrintWriter.println() javadoc, Terminates the current line by writing the line separator string. The line separator string is defined by the system property line.separator, and is not necessarily a single newline character ('\n'). So, I think you could use - try{ PrintWriter out = new PrintWriter("file.txt"); for (String s : str.split("\n")) { out.println(s); } out.close(); System.out.print(str); }catch(Exception e){System.out.println(e);}
type: Answer

http://stackoverflow.com/q/24382306
type: Question
has answer: http://stackoverflow.com/a/24382398
answer count: 2
has body: I am trying to implement a scanner to read in code and later use it in my application to show and filter data. Code snippet is below for the app, taken from a tutorial online. I am getting the below error when I try to run the app **FATAL EXCEPTION: main Process: com.example.barcodescanningapp, PID: 27516 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.barcodescanningapp/com.example.barcodescanningapp.MainActivity}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) at android.app.ActivityThread.access$800(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5001) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime(27516): Caused by: java.lang.NullPointerException at com.example.barcodescanningapp.MainActivity.onCreate(MainActivity.java:38) at android.app.Activity.performCreate(Activity.java:5231) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)** I am not able to identify from where my null point exception is from. Please help. public class MainActivity extends ActionBarActivity implements OnClickListener{ private Button scanBtn; private TextView formatTxt, contentTxt; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) {…
tagged with: nullpointerexception
score: 2
accepted answer: http://stackoverflow.com/a/24382398
downvote count: 0
has comment: http://stackoverflow.com/comment/37708900
has comment: http://stackoverflow.com/comment/37708918
favorite count: 0
possible better answer: http://stackoverflow.com/a/24382860
upvote count: 2
has answer: http://stackoverflow.com/a/24382860
tagged with: android
tagged with: barcode
type: AnsweredQuestion
has title: Unable to start actvity componentinfo - android app barcode scanner
tagged with: java

http://stackoverflow.com/comment/37643336
comment on: http://stackoverflow.com/q/24347560
score: 0
has text: Try `createTransformedShape()`, mentioned [here](http://stackoverflow.com/q/23644698/230513).
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24309191
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24308255
has body: Emoji is a list of unicode emoticons which has a github that can implement emoticons into code (Found here). From there you could use regex(\ue415\ue056\ue057) to find them or build them by char array (below). Example: StringBuilder sb = new StringBuilder(); for (char curr : str.toCharArray()) { sb.append((SUPPORTED_EMOJI_SET.contains(curr)) ? convertCharToImgTag(curr) : curr); } where SUPPORTED_EMOJI_SET is just a set of chars, for example: new HashSet&lt;Character&gt;() {{ add('\ue415'); add('\ue056'); ... }} For more ideas: go here!
type: Answer
upvote count: 1
score: 1
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24308255

http://stackoverflow.com/q/24399292
has answer: http://stackoverflow.com/a/24400081
linked to: http://stackoverflow.com/q/1139547
tagged with: client
possible better answer: http://stackoverflow.com/a/24400081
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/37741970
linked to: http://stackoverflow.com/q/3584210
linked to: http://stackoverflow.com/q/1402005
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24399774
has title: Java: Client automatically connecting to server when internet is available
tagged with: java
answer count: 2
tagged with: client-server
downvote count: 0
accepted answer: http://stackoverflow.com/a/24399774
favorite count: 0
has body: I have made a client-server application which can connect over the internet. I have hard coded in my client the server's IP which is fixed. My question is that I want a way that will not take a lot of processing and memory. I want my client to check if internet is available and then try to connect to the server if its up and running. If not then to wait and try again. Keeping in mind that the app is supposed to always run on your computer 24/7 and connect when possible just like skype does, in the sense that its always on and when you have the internet available and server reachable , it connects. My client's code that connects to the server: private void connectToServer() throws Exception { showMessage("Attempting Connection... \n"); try{ connection = new Socket(InetAddress.getByName(serverIP), 6789); showMessage("Ok dude you are Connected to:" + connection.getInetAddress().getHostName());} catch(IOException e){ int x = 0; while (true){ try { showMessage("Sorry Your IP was not found, \nAutomatic detection:"); showMessage("Now trying again"); connection = new Socket(InetAddress.getByName(serverIP),6789); break; } catch (UnknownHostException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); showMessage("\nConnection not established, trying again\n"); } /*x++; if(x&gt;10) break;*/ } //throw new Exception(); } } This does work but takes a lot of processing and memory ! I know that by adding thread.sleep(5000), I am going to add them eventually etc... But this doesn't solve the memory problem. My program would be running for a long time and this doesn't stop the inevitable. Is there a better way? THANKS P.S : showMessage() is just my function that displays the output on my GUI The way I checked memory was using Window's Task Manager ! (the memory increases drastically)

http://stackoverflow.com/comment/37532596
type: Comment
has text: look for "Items displayed in filter drop-down lists". that is what your iterator would see.
comment on: http://stackoverflow.com/a/24288705
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37694066
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24374029
score: 0
has text: @aeskreis - Object is definitely not a viable option. The idea is that whenever I type `SubOfAbstractEvent.addListener(` in my IDE, the auto-complete requires the right type of event as the parameter.

http://stackoverflow.com/comment/37502881
has text: Beware stored procs in the input text. Further analysis/parsing may be required.
comment on: http://stackoverflow.com/a/24269853
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37717433
comment on: http://stackoverflow.com/a/24302797
score: 0
type: Comment
has text: actually i have 2 .so files So I tried doing $ umask 022 LD_LIBRARY_PATH="$CATALINA_HOME/lib:/opt/jmagick-6.4.0/lib/libJMagick.so:$LD_LIBRARY_PATH" LD_LIBRARY_PATH="$CATALINA_HOME/lib:/opt/jmagick-6.4.0/lib/libJMagick-6.4.0.so:$LD_LIBRARY_PATH" Still getting same error export LD_LIBRARY_PATH
type: AnswerComment

http://stackoverflow.com/a/24327351
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24327226
upvote count: 2
type: AcceptedAnswer
has body: if you have any directories in your folder your array length will be longer than your number of files leaving a set of null entries at the end of your array. When your random number hits one of these you will get this error. I suggest switching your array to a list to eliminate this.
type: Answer
answers question: http://stackoverflow.com/q/24327226
score: 2

http://stackoverflow.com/comment/37566722
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24307205
type: AnswerComment
has text: pstmt.setNull(45,Types.INTEGER); it becasue datatype in DB is number and condition is if there is no value in CSV file then set null in db

http://stackoverflow.com/a/24367296
score: 0
has body: Means that Web Service client expects SOAP envelope response, but receives HTML page. Probably the service you are calling is not available.
has comment: http://stackoverflow.com/comment/37681587
has comment: http://stackoverflow.com/comment/37681672
has comment: http://stackoverflow.com/comment/37680958
has comment: http://stackoverflow.com/comment/37680897
type: Answer
has comment: http://stackoverflow.com/comment/37683780
has comment: http://stackoverflow.com/comment/37681122
answers question: http://stackoverflow.com/q/24367178

http://stackoverflow.com/q/24342919
has comment: http://stackoverflow.com/comment/37657619
tagged with: java
tagged with: message-queue
answer count: 1
has title: Java and C# communication via message queue
has body: I have an application in C#, which is extracting some data from files. I want to send this extracted data to Java application via message queue. I have no experience with message queue. I don't want to use web services. Which message broker will be the best one? I have domain models in C# which I need to send to Java app. How to do it? These are just plain POCO classes. Should I serialize them to XML, then to string, the send as a byte array, and in the Java side do the reverse order?
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37647450
type: Question
tagged with: c#
has answer: http://stackoverflow.com/a/24342975
has comment: http://stackoverflow.com/comment/37635405

http://stackoverflow.com/a/24388885
type: AcceptedAnswer
downvote count: 0
has body: delete .classpath and target folders(only src and pom whould be there). without running mvn eclipse:eclipse just import like a simple maven project. Give it a try it should work
accepted answer of: http://stackoverflow.com/q/24388758
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24388758

http://stackoverflow.com/comment/37521900
comment on: http://stackoverflow.com/q/24283767
has text: That might be hard to do, since how do you _know_ that `DS` isn't a typo and that `IS` stands for `Information Systems` and not `Industrial Solutions` etc.?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24393340
answers question: http://stackoverflow.com/q/24393112
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/75663276
has body: try BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream(), "UTF-8")); then String readLine = ""; while ((readLine = in.readLine()) != null) { line+=readLine }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37735144
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24393112
type: Answer
has comment: http://stackoverflow.com/comment/37735409

http://stackoverflow.com/q/24270064
has body: I have a question related to the way I should be setting up the overall architecture of my project. I have a project A with a set of classes in it. Now project B also needs certain classes which are actually present in project A. There are two approaches that I am able to think of: Approach 1: Create a separate project C with the classes which are common between project A and project B. Include project C as dependency in both project A and project B build path. Approach 2: While building project A, build a separate jar including only the common classes. Once this jar is built, include this jar in the build path of project B. Could you please help me understand which is of these approaches is more standard and follows the best practices of setting up projects?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37495678
tagged with: dependencies
answer count: 0
has comment: http://stackoverflow.com/comment/37495956
type: Question
has comment: http://stackoverflow.com/comment/37495874
tagged with: project
tagged with: java
has comment: http://stackoverflow.com/comment/37495801
has comment: http://stackoverflow.com/comment/37495893
score: 0
tagged with: jar
has title: Separate project or separate jar?

http://stackoverflow.com/a/24285741
upvote count: 6
answers question: http://stackoverflow.com/q/24285682
downvote count: 0
has body: In threading there are no guarantees. One or the other of the threads will hit the synchronized block first and you should never count on either behaviour. In practice the currently running thread has no "startup" cost so is more likely to hit the synchronized block first. The key here is to not worry about which thread is doing what when but to focus on reducing contention. Get as much processing as possible out of that synchronized block and evaluate whether you really need to synchronize everything or whether you can synchronize just a small part of the work, or have multiple different objects to lock against.
has comment: http://stackoverflow.com/comment/37528351
type: Answer
score: 6

http://stackoverflow.com/comment/37659710
comment on: http://stackoverflow.com/a/24355958
score: 0
type: AnswerComment
type: Comment
has text: Doing that still does not allow me access to the method in the student class that I am trying to reach. Is it even possible for me to access the method the way I am attempting to?

http://stackoverflow.com/q/24328538
type: UnansweredQuestion
tagged with: ajax
has title: AngularJS+Atmosphere Websockets: Is it possible to retrieve attributes in AtmosphereResource from a HttpServlet?
favorite count: 0
tagged with: atmosphere
tagged with: angularjs
type: Question
score: 5
tagged with: java
has body: I'm new to Atmosphere framework &amp; websockets. I'm developing a single page app, As a first step I want to implement a basic authentication using AngularJs(Client side) and Atmosphere websockets(server side). For authentication, in the beginning, I have used normal servlets and saved the User bean in HttpSession. But later I understood, I can't access the session attributes in the class(websocket service) @AtmosphereService(broadcaster = JerseyBroadcaster.class) So, I have created another Login AtmosphereService, In which suspend method checks the user and if user exists, then stores UserBean in ConcurrentMap against uuid key using following method so that I can access in future. public void createSession(AtmosphereResource resource) { logger.debug("Create session ({})", resource.uuid()); ConcurrentMap&lt;String, Object&gt; session = new ConcurrentHashMap&lt;String, Object&gt;(); ConcurrentMap&lt;String, Object&gt; prevSession = sessionsByUuid.putIfAbsent(resource.uuid(), session); if (prevSession != null) { logger.warn("Session already exists ({})", resource.uuid()); } } So in the client side, As I have AngularJS and configured routes, when the user logged in, I store the user-key in a rootscope variable and when ever route changes it checks as follows. $rootScope.$on("$routeChangeStart", function(event, next, current) { aNext = next; if (next.templateUrl != "./partials/login.html") { if($rootScope.loggedUser !=null &amp;&amp; $rootScope.loggedUser!=""){ $location.path(nextPage); }else{ $rootScope.goLoginPage(); } } }); But now the problem is If user refresh the page it goes to login page, because the $rootScope.loggedUser will not contain any thing. Before, when I used simple servlets for authentication I used a ajax call to the servlet to check the user exists in the session or not and if he exists I assigned the user-key in $rootScope.loggedUser and route used to change properly. Now as I'm using AtmosphereService instead of normal servlets for authentication…
upvote count: 5
answer count: 0
downvote count: 0

http://stackoverflow.com/comment/37551831
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24299521
has text: I've tried diff diff ways as i saw on this website and others.

http://stackoverflow.com/comment/37491336
type: Comment
type: QuestionComment
score: 0
has text: The parallelization is based on how you are running your tests. Are you using Maven (Surefire) or something else?
comment on: http://stackoverflow.com/q/24267191

http://stackoverflow.com/comment/37737282
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24397169
has text: Thanks for reply! :) So, I could manage your first solution. But, how can I retrieve the total formatted on "-HH:-MM"?

http://stackoverflow.com/q/24415891
favorite count: 0
has comment: http://stackoverflow.com/comment/37773105
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37773044
has title: How can I get a blurred stroke in java.awt.geom
downvote count: 0
tagged with: java
tagged with: stroke
type: Question
score: 3
tagged with: rectangles
upvote count: 3
has body: I would like to be able to control the blurred/fuzzy level of the stroke of a rectangle. It should be realized within the java.awt.geom package. I know how to change the shape of the stroke, like on this jhlabs page, but I don't know how to blur the stroke. This is basically what I want for my final result.
answer count: 1
has answer: http://stackoverflow.com/a/24416515

http://stackoverflow.com/a/24367500
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24283034
has body: The trick is that Maven failsafe plugin runs integration tests in a separate JVM : A typical Maven build with unit tests and integration tests can easily use 3 different JVMs : Maven main JVM (compile, package), launched by the mvn command Surefire JVM (unit tests), launched by the Maven main JVM Failsafe JVM (integration tests), launched by the Maven main JVM Profiling the Maven main JVM will never show information on the work done inside the Failsafe JVM. Moreover, options specified in the MAVEN_OPTS are only passed to the Maven main JVM. To profile one of the other JVMs, you have to configure it separately using plugins configuration in the pom.xml file. To answer the question, it requires the following plugin configuration : <plugins> [...] maven-failsafe-plugin 2.17 integration-test verify ${failsafeArgLine} [...] The important part here is ${failsafeArgLine} Then, JProfiler agent options can be specified through the failsafeArgLine argument : mvn verify -DfailsafeArgLine="-agentpath:/opt/jprofiler8/bin/linux-x64/libjprofilerti.so=port=8849" Running this command will start the Maven build normally (without profiling), then when the integration tests phase begins, it asks for a JProfiler connection : [...] [INFO] [INFO] --- maven-failsafe-plugin:2.17:integration-test (default) @ project --- [INFO] Failsafe report directory: /home/user/Repositories/project/target/failsafe-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- JProfiler> Protocol version 39 JProfiler> Using JVMTI JProfiler> JVMTI version 1.1 detected. JProfiler> 64-bit library JProfiler> Listening on port: 8849. JProfiler> Instrumenting native methods. JProfiler> Can retransform classes. JProfiler> Can retransform any class. JProfiler> Native library initialized JProfiler> VM initialized JProfiler> Waiting for a connection from the JProfiler GUI ... JProfiler> Using dynamic instrumentation JProfiler> Time measurement: elaps…
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/24283034

http://stackoverflow.com/comment/37524385
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24285286
type: Comment
has text: Thanks for your answer. Makes me a bit less confused about exceptions.

http://stackoverflow.com/q/24362944
tagged with: java
tagged with: gradle
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/37672573
has comment: http://stackoverflow.com/comment/37672800
has body: I need to compile a rather old project which uses java language level 1.3. Language level 1.3 must be used, since all classes use the default package and importing classes from the default package isn't allowed on higher language levels. I was able to compile the project by changing the language level to 1.3 in my Eclipse configuration, but have trouble using gradle. I added sourceCompatibility and targetCompatibility to my build.gradle file: compileJava { sourceCompatibility = 1.3 targetCompatibility = 1.3 } which produces the following warnings: warning: [options] bootstrap class path not set in conjunction with -source 1.3 warning: [options] source value 1.3 is obsolete and will be removed in a future release warning: [options] target value 1.3 is obsolete and will be removed in a future release but compiling fails pointing me to the import statements: ...\src\Foo.java: 10: error: '.' expected import Bar; My question is: How to compile Java 1.3 code using gradle without changing the code? gradle -v: Groovy: 1.8.6 Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013 Ivy: 2.2.0 JVM: 1.8.0_05 (Oracle Corporation 25.5-b02) OS: Windows 7 6.1 amd64
answer count: 1
has comment: http://stackoverflow.com/comment/37672580
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37672726
has answer: http://stackoverflow.com/a/24369441
has comment: http://stackoverflow.com/comment/37672601
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37672760
upvote count: 1
has title: How to compile java 1.3 code with gradle?

http://stackoverflow.com/comment/37676052
type: AnswerComment
score: 0
type: Comment
has text: I updated my question... do you know about how to do it using `HttpComponents`?
comment on: http://stackoverflow.com/a/24364709

http://stackoverflow.com/comment/37632152
type: QuestionComment
has text: how can i use this"/Images/tiles/" + i + ".png" in the array you mentioned above
score: 0
comment on: http://stackoverflow.com/q/24341753
type: Comment

http://stackoverflow.com/comment/37686995
comment on: http://stackoverflow.com/a/24370642
has text: Right, and his question is why the border doesn't automagically change when he changes the color variable later in the code.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24314213
tagged with: nullpointerexception
answer count: 2
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/37579654
has comment: http://stackoverflow.com/comment/37579607
has comment: http://stackoverflow.com/comment/37579342
has comment: http://stackoverflow.com/comment/37579523
favorite count: 0
has comment: http://stackoverflow.com/comment/37579600
has comment: http://stackoverflow.com/comment/37579488
has comment: http://stackoverflow.com/comment/37579360
has comment: http://stackoverflow.com/comment/37579503
type: UnansweredQuestion
has body: I ran into this problem, when an object uses a classes static instance, before it's even created. Example: class Chair { public static Chair mychair = new Chair(); public void foo() {} } class Table { public Table() { Chair.mychair.foo(); } } So if I call the mychair.foo() , I get a NullPointerException. I know, not even static things get performed until the class is really needed. But how can I force Java to actually load the class, so it will be created? Stacktrace of original program: Exception in thread "main" java.lang.ExceptionInInitializerError at hu.intelligames.game.level.Level.&lt;init&gt;(Level.java:34) at hu.intelligames.game.Game.initialize(Game.java:64) at hu.intelligames.game.Game.&lt;init&gt;(Game.java:43) at hu.intelligames.game.Game.main(Game.java:80) Caused by: java.lang.NullPointerException at hu.intelligames.game.level.tiles.Tile.&lt;clinit&gt;(Tile.java:25) ... 4 more Constructor of Level class (from line 25): public Level(int width, int height) { this.width = width; this.height = height; tiles = new Tile[width * height]; for (int i = 0; i &lt; tiles.length; i++) { if (i % 3 == 0) tiles[i] = Tile.GRASS; else if (i % 3 == 1) tiles[i] = Tile.GRASS; else tiles[i] = Tile.STONE; } init(); } Whole code for Tile class: public class Tile { public static Spritesheet tileSheet = new Spritesheet("/tiles.png"); public static final Tile VOID = new Tile(0, 0, tileSheet, 0x00000000); public static final Tile GRASS = new Tile(1, 0, tileSheet, 0xff00ff00); public static final Tile STONE = new Tile(2, 0, tileSheet, 0xffaaaaaa); public static final Tile ROAD = new Tile(3, 0, tileSheet, 0xffabcdef); private Spritesheet sheet; private int x; private int y; private int colorCode; private static ArrayList&lt;Tile&gt; tileList; static { tileList.add(VOID); tileList.add(GRASS); tileList.add(STONE); tileList.add(ROAD); } public Tile(int x, int y, Spritesheet sheet, int colorCode) { this.sheet = sheet; this.x = x; this.y = y; this.colorCode = colorCode; } public void ren…
has comment: http://stackoverflow.com/comment/37579420
tagged with: java
has comment: http://stackoverflow.com/comment/37579572
score: -4
has comment: http://stackoverflow.com/comment/37579516
type: Question
has comment: http://stackoverflow.com/comment/37579665
has comment: http://stackoverflow.com/comment/37579398
has answer: http://stackoverflow.com/a/24314412
has answer: http://stackoverflow.com/a/24314427
has comment: http://stackoverflow.com/comment/37579474
has comment: http://stackoverflow.com/comment/37579546
has comment: http://stackoverflow.com/comment/37579737
has title: Java performing instance commands before static ones

http://stackoverflow.com/q/24385293
has answer: http://stackoverflow.com/a/24385385
has title: Class reference is taken from different jar
has answer: http://stackoverflow.com/a/24385387
type: UnansweredQuestion
has body: There are some classes used in a java program referred from abc package from xyz.jar. The package is imported in the java file. Also the same class is in other lmn.jar. So if I delete the jar file from the project, i should be getting the error. But the class compiles and takes the class from the other lmn.jar. Eg. weblogic.jdbc.oci.Blob is a class in weblogic.jar But if i delete weblogic.jar, it takes it from java.sql.Blob. I don't want this to happen, the program should display error.
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24385413
tagged with: eclipse
answer count: 3
tagged with: jar
score: 0

http://stackoverflow.com/a/24280499
type: Answer
has body: If I am understanding you correctly you have something like class A { public static String str = "test" } and in you code you have a method like void methodA (A someObj) { in this method you can access the static variable as A.str or someObj.str
answers question: http://stackoverflow.com/q/24280292
score: 0
has comment: http://stackoverflow.com/comment/37515515

http://stackoverflow.com/comment/37639890
comment on: http://stackoverflow.com/q/24345899
type: Comment
type: QuestionComment
has text: I'm not sure it's really faster, it just sounds less error prone in your case and you won't get weird `NumberFormatExceptions`, serializing your own data should always be your last resort.
score: 0

http://stackoverflow.com/comment/37674749
has text: It's split to "", "..", "..." if my guess is correct.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24364139

http://stackoverflow.com/q/24305851
upvote count: 3
tagged with: java
tagged with: jaxb
answer count: 1
has body: I'm trying to build a global error handler for all of my camel (v 2.13.1) routes. If an exception bubbles up to this error handler it will log it and send the team an email. I'm having problems with polymorphism and my jaxb annotated messages, though. All of my messages look similar to this: @XmlRootElement @XmlAccessorType(value = XmlAccessType.PROPERTY) @XmlType(propOrder = {}) static abstract class Request { @XmlElement(required = true) abstract String getThing(); abstract void setThing(final String thing); } @XmlRootElement @XmlAccessorType(value = XmlAccessType.PROPERTY) @XmlType(propOrder = {}) static class MyRequest extends Request { private String name; @XmlElement(required = true) public String getName() { return name; } public void setName(final String name) { this.name = name; } private String thing; @Override @XmlElement(required = true) public String getThing() { return thing; } public void setThing(final String thing) { this.thing = thing; } } My error route I'm playing around with looks like this: from (errorQueue) .convertBodyTo(Request.class) .process(new Processor() { @Override public void process(Exchange exchange) throws Exception { final Request req = exchange.getIn().getBody(Request.class); log.info("name = {}, thing = {}", null, req.getThing()); } }); Depending on the component that fails, the message could be a MyRequest, a MyOtherRequest, etc. All of the messages inherit from Request. Here is the particular message I am testing with: some_name some_thing When I run this I get errors like: Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"myRequest"). Expected elements are <{}request> How can I convert jaxb annotated messages from various types to some base type so that I can get to the information from the base class? I would prefer using an interface instead of a base class, but I had similar results.
tagged with: apache-camel
accepted answer: http://stackoverflow.com/a/24308787
has title: Convert jaxb xml message to base type in apache camel (java)
type: AnsweredQuestion
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/37566959
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24308787

http://stackoverflow.com/a/24430415
has comment: http://stackoverflow.com/comment/37812070
has body: Java's an object-oriented language. Why don't you use objects and encapsulation to better advantage? I think your problem is that you haven't abstracted the problem very well. I'd expect to see a Stock class, not Lists of doubles. A Portfolio would have a Map of stock, shares pairs. A Stock might have a Map of date, value pairs. How do you calculate the weights? Are they fractions of shares in the Portfolio? Let the Portfolio calculate the current rate of return in a method by iterating over its Map of Stocks. Here's how I'd do it. I think there are still subtleties to be sorted out with number of shares, because your position can evolve over time. A Map of Stock and shares, with Stock carrying prices over time, is insufficient. But this will give you the idea. Stock.java package stock; import utils.StringUtils; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * Stock abstraction * @author Michael * @link https://stackoverflow.com/questions/24417246/yield-calculation/24430415 * @since 6/26/2014 6:22 PM */ public class Stock implements Comparable&lt;Stock&gt; { private final String symbol; private final String companyName; private Map&lt;Date, Double&gt; prices; public Stock(String symbol, String companyName) { if (StringUtils.isBlankOrNull(symbol)) throw new IllegalArgumentException("symbol cannot be blank or null"); if (StringUtils.isBlankOrNull(companyName)) throw new IllegalArgumentException("company name cannot be blank or null"); this.symbol = symbol; this.companyName = companyName; this.prices = new ConcurrentHashMap&lt;Date, Double&gt;(); } public String getSymbol() { return symbol; } public String getCompanyName() { return companyName; } public void addPrice(Date date, double price) { if (date == null) throw new IllegalArgumentException("date cannot be null"); if (price &lt; 0.0) throw new IllegalArgumen…
accepted answer of: http://stackoverflow.com/q/24417246
answers question: http://stackoverflow.com/q/24417246
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37817194
has comment: http://stackoverflow.com/comment/37810204
type: Answer
has comment: http://stackoverflow.com/comment/37812310
has comment: http://stackoverflow.com/comment/37816378
upvote count: 1
score: 1

http://stackoverflow.com/q/24290976
has body: Have a service that exposes crypto functions. We don't need a clean up nor do I want objects to be created every time/ every session. But i need a separate object per thread. In a web app - will the scope be the web container's thread pool ? Is it same in spring 3 and 4 implementation? Another place we plan to use this is to cache SimpleDateFormat objects. Again don't need a clean up method.
favorite count: 0
has comment: http://stackoverflow.com/comment/39701942
has title: Spring SimpleThreadScope in a web app : part of container pool?
answer count: 4
has answer: http://stackoverflow.com/a/25446008
tagged with: web-applications
linked to: http://stackoverflow.com/q/15472935
accepted answer: http://stackoverflow.com/a/25446708
tagged with: spring
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25446708
possible better answer: http://stackoverflow.com/a/25446008
type: Question
upvote count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25445206
has answer: http://stackoverflow.com/a/25442855

http://stackoverflow.com/a/24273777
upvote count: 9
accepted answer of: http://stackoverflow.com/q/24273746
type: Answer
answers question: http://stackoverflow.com/q/24273746
downvote count: 0
has body: The constants defined in the enum class are the only things that are implicitly static. It's close to (but not quite equivalent to): public static final Seasons SUMMER = new Seasons(); public static final Seasons FALL = new Seasons(); public static final Seasons WINTER = new Seasons(); public static final Seasons SPRING = new Seasons(); This allows you to write code such as Seasons.SUMMER. The rest of the class body is like a normal class body - public String toString() is not implicitly static, therefore it has access to this.
score: 9
has comment: http://stackoverflow.com/comment/37509231
type: AcceptedAnswer

http://stackoverflow.com/comment/37683637
type: Comment
type: QuestionComment
has text: @SotiriosDelimanolis The annotations are to enable procedural generation of UI components, and I would prefer to not write special handling for all cases like this.
comment on: http://stackoverflow.com/q/24368555
score: 0

http://stackoverflow.com/q/24422921
upvote count: 1
has body: ___WORKER_ID___|_______OCCUR________ 20 | 1 20 | 2 21 | 3 22 | 5 20 | 1 According to this table, I need to know each worker how many occur? Such as Worker_id=20 has occur is 4 Worker_id=21 has occur is 8 I can get two value from this Worker table by this code String sql = "SELECT Table.worker_id,Table.occur FROM keyword_pages Table" + " WHERE keyword_id=" + PUID; conn = getConnection(); stm = conn.createStatement(); rs = stm.executeQuery(sql); while (rs.next()) { int kwd_id = rs.getInt(1); /**Worker_id is 20,20,21,22,20*/ int occur = rs.getInt(2); /**Worker_id is 1,2,3,5,1*/ } How to get amount of occur for each worker? This is my coding. I use hashmap for store each record. and store hashmap to linklist. But I haven't idea for get result. conn = getConnection(); stm = conn.createStatement(); rs = stm.executeQuery(sql); while (rs.next()) { int kwd_id = rs.getInt(1); int occur = rs.getInt(2); hMap.put(kwd_id, occur); listID.add(hMap); //System.out.println(kwd_id +" | "+ occur); } for (int i = 0; i &lt; listID.size(); i++) { }
downvote count: 1
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/37793451
has comment: http://stackoverflow.com/comment/37785120
tagged with: sql
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24422978
has title: How to sum data from specific record?
has answer: http://stackoverflow.com/a/24422988
has comment: http://stackoverflow.com/comment/37785162
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/a/24361888
has comment: http://stackoverflow.com/comment/37670930
accepted answer of: http://stackoverflow.com/q/24361781
has comment: http://stackoverflow.com/comment/37671302
has comment: http://stackoverflow.com/comment/37671030
has comment: http://stackoverflow.com/comment/37671123
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24361781
type: Answer
has comment: http://stackoverflow.com/comment/37671083
has body: List&lt;String&gt; platformLst = new ArrayList&lt;String&gt;(); List&lt;String&gt; versionLst = new ArrayList&lt;String&gt;(); JSONArray array = obj.getJSONArray("France24"); for(int i = 0 ; i &lt; array.length() ; i++){ JSONObject obj = array.getJSONObject(i); versionLst.add(obj.getString("platform")); platformLst .add(obj.getString("version")); } Existing Question Example Simple Json Tutorial Link
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/37671336

http://stackoverflow.com/q/24336835
has body: I have a quite intriguing question, I am converting jpg image to byte array in Java, like this: &gt; public byte[] toBytes(String file) throws IOException { File img = new File(file); BufferedImage image = ImageIO.read(img); WritableRaster r = image.getRaster(); DataBufferByte data = (DataBufferByte) r.getDataBuffer(); return data.getData(); } This is obviously only a part of a system but please believe my word ^_^ : this method returns a byte array, however - when I give it a .jpg file of the size of some 20,000 bytes (Linux - right click on image -> properties -> size shown as around 20 000 bytes), obtained byte array has length of over 345 000, that is 345 000 bytes (all of them initialised to some values, not just 0-s). Do you guys know why is this happening?
score: -2
tagged with: java
downvote count: 3
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/24336886
has comment: http://stackoverflow.com/comment/37622618
tagged with: arrays
tagged with: image
has title: Java byte array larger than jpg image
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37622771
accepted answer: http://stackoverflow.com/a/24336886
has comment: http://stackoverflow.com/comment/37622647
favorite count: 0
tagged with: byte
type: Question

http://stackoverflow.com/q/24356809
has answer: http://stackoverflow.com/a/24356874
type: Question
score: 14
linked to: http://stackoverflow.com/q/4076601
has comment: http://stackoverflow.com/comment/37661276
tagged with: eclipse
duplicate of: http://stackoverflow.com/q/4076601
tagged with: servlets
answer count: 3
downvote count: 0
tagged with: jar
has title: Need the JAR file for a javax.servlet.http.HttpServletRequest
favorite count: 0
has comment: http://stackoverflow.com/comment/37661387
has answer: http://stackoverflow.com/a/29711261
has comment: http://stackoverflow.com/comment/79938039
has comment: http://stackoverflow.com/comment/37661154
upvote count: 14
has answer: http://stackoverflow.com/a/38572694
has comment: http://stackoverflow.com/comment/37661244
type: UnansweredQuestion
tagged with: java
has body: I am modifying behavior of a web-app(server &amp; client) running on web-sphere. I have de-compiled the code and just need to make minor changes and redeploy the code. For this I made a simple Java Project with Eclipse EE and loaded all the de-compiled code. I only need the *.class files which I will convert to a JAR and place them at their proper place. The thing is there is a dependency which is not being resolved javax.servlet.http.HttpServletRequest so my project is not building How to resolve this dependency? If this dependency cannot be resolved than my guess is I could just get the JAR file for javax.servlet.http.HttpServletRequest and add to the Project's Build Path as an external JAR. Where can I find the JAR for javax.servlet.http.HttpServletRequest p.s. I am new to JAVA so I don't know much about HttpServletRequest also I am using Java 1.6 JRE.

http://stackoverflow.com/comment/37670502
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24361591
has text: I tried your code and it worked just fine for me. What version of Spring are you using?

http://stackoverflow.com/q/24368303
accepted answer: http://stackoverflow.com/a/24388591
answer count: 1
tagged with: httpclient
has answer: http://stackoverflow.com/a/24388591
upvote count: 1
tagged with: apache-commons-httpclient
favorite count: 0
downvote count: 0
tagged with: jira-rest-api
has body: I used JIRA REST client api and am running it from java main program, This is the simple code, which Try to hit the JIRA server (JIRA 6.1) public static void main (String args[]) { new Main().doIt(); } public void doIt() { System.out.println("Start .. "); String url = "https://jira.com"; String userName = "sdfsdfsdf"; String password = "sdfsfsfsf"; AsynchronousJiraRestClientFactory factory = new AsynchronousJiraRestClientFactory(); JiraRestClient client = factory.createWithBasicHttpAuthentication(URI.create(url), userName, password) ; System.out.println("JiraRestClient created successfully .. "); } Every time when I run this program, i get "ClassNotFoundException", there by I find the dependencies and put the JAR file in my LIB folder, While doing so, I get strange exception which is the result of HTTPCLIENT and HTTPCLIENTCACHE jar files. Below-screenshot shows the lib-files in my classpath And the exception which I get is Start .. SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Exception in thread "main" java.lang.NoSuchMethodError: org.apache.http.impl.client.cache.CacheConfig.setNeverCache1_0ResponsesWithQueryString(Z)V at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClient.&lt;init&gt;(DefaultHttpClient.java:155) at com.atlassian.jira.rest.client.internal.async.AsynchronousHttpClientFactory.createClient(AsynchronousHttpClientFactory.java:53) at com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory.create(AsynchronousJiraRestClientFactory.java:35) at com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory.createWithBasicHttpAuthentication(AsynchronousJiraRestClientFactory.java:41) at com.arun.main.Main.doIt(Main.java:22) at com.arun.main.Main.main(Main.java:13) Can anyone suggest me on this Please ?
type: AnsweredQuestion
score: 1
has title: JIRA6 REST API - HttpClient and HttpClientCache JAR conflict
tagged with: java
tagged with: jira
type: Question

double
tags question: http://stackoverflow.com/q/24333482
tags question: http://stackoverflow.com/q/24309489
tag name: double
tags question: http://stackoverflow.com/q/24349865
tags question: http://stackoverflow.com/q/24396577
type: Tag
tags question: http://stackoverflow.com/q/24333074
tags question: http://stackoverflow.com/q/24397720
tags question: http://stackoverflow.com/q/24392815
tags question: http://stackoverflow.com/q/24325410
tags question: http://stackoverflow.com/q/24386086

http://stackoverflow.com/comment/37714610
score: 1
comment on: http://stackoverflow.com/q/24385346
type: Comment
type: QuestionComment
has text: explain this _Now when I try to add the project on the server - Nothing happens_

http://stackoverflow.com/comment/37794712
has text: @AndreiStefan Hmm. I guess I knew it. Just wondered whether by chance there is a way to do this without having to move on to AspectJ :(
comment on: http://stackoverflow.com/q/24427385
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37506331
has text: possible duplicate of [Including libraries in jar](http://stackoverflow.com/questions/16764834/including-libraries-in-jar)
comment on: http://stackoverflow.com/q/24275397
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37669154
has text: It's very simple to acheive that, but I'm not sure if it is what OP's wanted. Remove `if(value == 1)` and change `str.indexOf(word)` to `str.lastIndexOf(word)` and you will get that.
type: AnswerComment
comment on: http://stackoverflow.com/a/24359587
type: Comment
score: 0

http://stackoverflow.com/comment/73134237
score: 9
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/28635465
has text: it DOES install JDK. `brew cask info java`

http://stackoverflow.com/comment/37702013
type: QuestionComment
comment on: http://stackoverflow.com/q/24370328
has text: I added some more information to address the comments.
score: 0
type: Comment

http://stackoverflow.com/q/24278208
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
tagged with: java
has title: Spring security - Secure a request by validating principle against @RequestParam parameter?
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/24278308
tagged with: spring-security
tagged with: spring-el
answer count: 1
downvote count: 0
has body: I work with Restful API (with many urls) using Spring 3.1.2, and want to apply security filters per request that uses both data from the authenticated user "principal" and the data sent by the request. example: validate accountId from request url: http://www.foo.com/accountRecords?accountId=23 with principal data principal.accountId = 23. I know this can be done from within the @requestMapping methods, but want to do it outside the actual method, so it will be maintainable and configurable without interfering the business logic. But I didn't find any advice\sample about it.. I believe it should look something like: @PreAuthorize("principal.accountId == requestParam.accountId")
favorite count: 0
tagged with: spring
has answer: http://stackoverflow.com/a/24278308

http://stackoverflow.com/a/24349860
has comment: http://stackoverflow.com/comment/37648140
has body: Your question is more based on platform dependency/independency. Java is a programming language which is platform independent which means the code which you write will produce the same output on all machines running Windows, Linus, Unix, etc... without any changes to the code. To run a Java program you need to have JVM (Java Virtual Machine) installed. Now what does JVM do.? Well, it translates your code into Machine code which the Operating System could understand. Therefore JVM is platform dependent since every OS has a different Machine code. So, basically you write a Java Program only once and can be used/run everywhere.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24349726

http://stackoverflow.com/a/26421054
has comment: http://stackoverflow.com/comment/87924787
has body: It seems to be related to a rare race condition between request (w/o session identifier) and the session initialization as the getMetaData() throws the exception when using on any element in the SESSION scope, so it does not even depend on a custom component but rather coldfusion.runtime.SessionScope. Unfortunately it is very difficult to reproduct this issue. Sometimes it happens but then it does not for hours or even days. I filed a report at Adobe's bugbase, but they cannot look into this unless I can tell the steps to reproduce.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24285366

http://stackoverflow.com/comment/37625780
type: Comment
has text: @CuiPengFei You already have access to the `T`. All instance methods and fields do (as long as it isn't shadowed as you previously had). The question is: how do you want to use it? It has to have some value.
comment on: http://stackoverflow.com/a/24338535
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37573687
score: 0
type: AnswerComment
has text: I have a good understanding about GC in Java, but that doesn't mean I should post it as answer because it doesn't address OP's question. In fact, the question is too broad to be answered.
type: Comment
comment on: http://stackoverflow.com/a/24309690

http://stackoverflow.com/q/24362982
has comment: http://stackoverflow.com/comment/37673625
has answer: http://stackoverflow.com/a/24365327
tagged with: java
type: Question
upvote count: 27
has comment: http://stackoverflow.com/comment/37708932
has comment: http://stackoverflow.com/comment/37707856
tagged with: findbugs
tagged with: sonarqube
score: 27
accepted answer: http://stackoverflow.com/a/24365327
has body: I am getting OutOfMemoryException while performing sonar analysis on my project. Below is the stack trace: 14:55:55.433 DEBUG - Release semaphore on project : org.sonar.api.resources.Project@5a7b5cb8[id=1,key=myProj_web,qualifier=TRK], with key batch-myProj_web 14:55:55.711 DEBUG - To prevent a memory leak, the JDBC Driver [com.mysql.jdbc.Driver] has been forcibly deregistered INFO: ------------------------------------------------------------------------ INFO: EXECUTION FAILURE INFO: ------------------------------------------------------------------------ Total time: 12:48.979s Final Memory: 33M/910M INFO: ------------------------------------------------------------------------ ERROR: Error during Sonar runner execution org.sonar.runner.impl.RunnerException: Unable to execute Sonar at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91) at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75) at java.security.AccessController.doPrivileged(Native Method) at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50) at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102) at org.sonar.runner.api.Runner.execute(Runner.java:100) at org.sonar.runner.Main.executeTask(Main.java:70) at org.sonar.runner.Main.execute(Main.java:59) at org.sonar.runner.Main.main(Main.java:53) Caused by: org.sonar.api.utils.SonarException: Can not execute Findbugs at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:154) at org.sonar.plugins.findbugs.FindbugsSensor.analyse(FindbugsSensor.java:59) at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:79) at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:70) at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:131) at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:178) at org.sonar.api.platform.Component…
answer count: 1
downvote count: 0
favorite count: 0
tagged with: garbage-collection
linked to: http://stackoverflow.com/q/10104443
type: AnsweredQuestion
tagged with: memory-management
has title: GC overhead Limit exceeded while running sonar runner

http://stackoverflow.com/q/24298380
downvote count: 0
has answer: http://stackoverflow.com/a/24490250
has answer: http://stackoverflow.com/a/24576964
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/24576964
has title: Check if Offline with GWT
score: 1
accepted answer: http://stackoverflow.com/a/24490250
answer count: 2
upvote count: 1
tagged with: gwt
has body: I'm using Offline.js integrated with GWT to check if app is offline (i.e. server is down). The library works fine and the problem I have now is how to test it in Dev Mode, if I manually shut down the jetty server, the app also goes down. Unlike with when deployed with Tomcat or JBoss. Is there a way to test this in Dev Mode?
tagged with: java
type: AnsweredQuestion

http://stackoverflow.com/q/24379909
accepted answer: http://stackoverflow.com/a/24380024
answer count: 1
tagged with: android-activity
has comment: http://stackoverflow.com/comment/37704356
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has title: what is this dropdown looking layout called?
tagged with: android
has answer: http://stackoverflow.com/a/24380024
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
tagged with: android-layout
upvote count: 0
score: -1
has body: IThere is a really cool layout feature in the QuizUp app where when you click a button it shows a menu under that button and pushes everything else down, here is what I mean: This: http://m.imgur.com/p5iqS5c To this: http://m.imgur.com/WS931xS I'm wondering what it is called in terms of java/android so that I can look it up and learn how to implement it.

http://stackoverflow.com/q/24308840
favorite count: 0
type: Question
has title: Application using Jetty gets OutOfMemoryError on sudden burst of memory and threads
tagged with: jetty
has answer: http://stackoverflow.com/a/24679465
upvote count: 2
tagged with: java
has body: I have a problem with an embedded Jetty application. The application suddenly requires à large amount of memory and threads and I get an out of memory error. The application is running Jetty 9.1.2.v20140210 on java 1.7.51 The launch parameters are (now) -Xmx4096m -Xss4096k -XX:ParallelGCThreads=2 -Djava.awt.headless=true -server I have been trying a few launch options without much success so far. The stack size is large because I need to serialize/unserialize a huge Java object. The Jetty setup is: QueuedThreadPool threadPool = new QueuedThreadPool(56, 10); server = new Server(threadPool); ServerConnector connector = new ServerConnector(server); connector.setIdleTimeout(1000); connector.setPort(port); connector.setHost(hote); server.addConnector(connector); The application serves 6.67 requests per second on average (peak 16.23 request per second). The average request time is 42ms. There is no database I/O. There is a little file I/O by Lucene and logging. I can't be 100% sure that there are no memory leeks but the various tools I have used (Java Visual VM and various Jetty LeekPreventers) seem to indicate that there are none (or that it is insignificant). The application runs for 24 hours and is restarted. Sometime, randomly (after 3 hours or 20), the application suddenly requires à large amount of memory and threads and I get an out of memory error. I then have to kill the application. I did a thread dump and found that almost all threads were waiting. "qtp146419630-538" prio=10 tid=0x00007f07b0006800 nid=0x45f4 waiting on condition [0x00007f07fd7f3000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for &lt;0x0000000719d430f8&gt; (a java.util.concurrent.Semaphore$NonfairSync) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834) at java.util.concurrent.locks.AbstractQueuedSynchronizer.…
answer count: 1
accepted answer: http://stackoverflow.com/a/24679465
has comment: http://stackoverflow.com/comment/37895961
type: AnsweredQuestion
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37570172

http://stackoverflow.com/a/24329939
answers question: http://stackoverflow.com/q/24328949
score: 0
has body: You need to either implement equals in your Toy or use ArgumentCaptor to check details of the object passed. Otherwise (like geoand already managed to mention) you compare the references.
type: Answer

http://stackoverflow.com/q/24382804
favorite count: 0
tagged with: execution
has answer: http://stackoverflow.com/a/24384931
has comment: http://stackoverflow.com/comment/37746847
type: UnansweredQuestion
has body: I have 2 .m files. One is the function and the other one (read.m) reads then function and exports the results into an excel file. I have a java program that makes some changes to the .m files. After the changes I want to automate the execution/running of the .m files. I have downloaded the matlabcontrol.jar and I am looking for a way to use it to invoke and run the read.m file that then reads the function. Can anyone help me with the code? Thanks I have tried this code but it does not work. public static void tomatlab() throws MatlabConnectionException, MatlabInvocationException { MatlabProxyFactoryOptions options = new MatlabProxyFactoryOptions.Builder() .setUsePreviouslyControlledSession(true) .build(); MatlabProxyFactory factory = new MatlabProxyFactory(options); MatlabProxy proxy = factory.getProxy(); proxy.eval("addpath('C:\\path_to_read.m')"); proxy.feval("read"); proxy.eval("rmpath('C:\\path_to_read.m')"); // close connection proxy.disconnect(); }
upvote count: 1
has comment: http://stackoverflow.com/comment/37720293
tagged with: matlab
score: 1
has comment: http://stackoverflow.com/comment/37727750
tagged with: java
type: Question
answer count: 1
downvote count: 0
has title: How to run a .m (matlab) file through java and matlab control?

http://stackoverflow.com/q/24311262
tagged with: mongodb
has title: Mongodb cursor.hasNext() hangs?
score: 0
has comment: http://stackoverflow.com/comment/37583021
answer count: 0
has comment: http://stackoverflow.com/comment/37574681
has comment: http://stackoverflow.com/comment/37574305
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/38729809
has comment: http://stackoverflow.com/comment/37575568
has comment: http://stackoverflow.com/comment/37581250
tagged with: java
has body: Using mongodb 2.6. From Java, I'm going through a list of keys and generating a bunch of statistics for each key, involving some queries to Mongo (on a remote server). As I generate each key's statistics, I write it to a file, so I'm not running out of memory locally. At some point in the run (it changes each time), the code hangs on what appears to be something entirely innocuous - the check for curs.hasNext() in the following code. The query is a little slow, but it seems to run fine up until some variable point, when it no longer does. BasicDBObject idMatch = new BasicDBObject(Constants.USER_ID_STR, userid); // get the earliest tweet DBCursor curs = this.tweetsCollection.find(idMatch).sort(new BasicDBObject(Constants.TWEETED_AT_STR, Constants.ASCENDING_SORT_FLAG)).limit(1); Date theDate = null; if (curs.hasNext()){ DBObject obj = curs.next(); theDate = (Date) obj.get(Constants.TWEETED_AT_STR); } return theDate;
has comment: http://stackoverflow.com/comment/38796920
type: Question

http://stackoverflow.com/a/40897642
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/24322848
has body: Executing from Windows PowerShell I needed this format (with the quotes): java -cp .\myjarfile.jar -D"loader.main=com.app.etc.FullyQualifiedMainClass" org.springframework.boot.loader.PropertiesLauncher To clarify the accepted answer: You can directly modify the loader.main property in the jar's META-INF/MANIFEST.MF file, if you're ok with a more static solution.
type: Answer

http://stackoverflow.com/comment/37685331
comment on: http://stackoverflow.com/a/24368896
type: AnswerComment
score: 0
type: Comment
has text: Thanks, i'm trying the second atemp but the same error, i'm using java config so i don't know where to set `async-support` to my filters, i use `AbstractAnnotationConfigDispatcherServletInitializer` for my web initializer (replace to `web.xml`) and in `customizeRegistration` method i use `setAsyncSupported(true)` but i don't know where to set async in my `AbstractSecurityWebApplicationInitializer` (replace for springSecurityFilterChain ) so i think that without this no one of the two options works for me, i can see the undertow version chanage in my exception.

http://stackoverflow.com/comment/37764742
comment on: http://stackoverflow.com/q/24410975
has text: I updated my question. You see: No error and onPictureTaken didn't called...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24341948
has body: I do confirm that this property sonar.java.source is used only by the PMD tool. The SonarSource's Java analyser uses a superset grammar and so can analyse source files regardless of the Java version they comply to.
answers question: http://stackoverflow.com/q/24289704
has comment: http://stackoverflow.com/comment/37722460
upvote count: 2
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/40661746
has comment: http://stackoverflow.com/comment/37669163
score: 2
accepted answer of: http://stackoverflow.com/q/24289704
downvote count: 0

http://stackoverflow.com/q/24414596
tagged with: websocket
has body: I am using Tyrus 1.7 API for Java websocket development. I have developed a server and client. I want to send information to client without client's request. Whenever client is connected, I want to send information. Can we do that using Tyrus API or different java API will do that. Kindly waiting for your reply.
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24742415
tagged with: java
has title: Duplex communication using Java websocket
type: Question
answer count: 1

http://stackoverflow.com/a/24274013
type: Answer
has body: The value saved by an EditTextPreference is String, but you are trying to obtain int under that key here port_server=pref.getInt("port_server", 1234); port_android=pref.getInt("port_android", 37123); Must be port_server = Integer.parseInt(pref.getString("port_server", "1234")); port_android = Integer.parseInt(pref.getString("port_android", "37123")); The same applies to ListPreference, if you're going to use any.
answers question: http://stackoverflow.com/q/24273925
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/comment/37834789
score: 0
type: AnswerComment
has text: Seems i got something better with java 7 feature. Now they are providing a WatchService on a file\directory and we can receive events for file create\modify\delete. This is making my work simple and more robust for listening file system. Thanks
comment on: http://stackoverflow.com/a/24365426
type: Comment

http://stackoverflow.com/comment/37723341
type: Comment
comment on: http://stackoverflow.com/a/24389875
score: 0
type: AnswerComment
has text: Buttons below the textviews?

http://stackoverflow.com/comment/37637242
comment on: http://stackoverflow.com/a/24344396
score: 0
has text: Yeah, all the "entry points" like Activities, Receivers, Services etc.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37556961
comment on: http://stackoverflow.com/q/24300091
has text: no obvious difference after commented it.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37494996
comment on: http://stackoverflow.com/a/24269289
score: 0
type: Comment
type: AnswerComment
has text: @Mifmif, I think you're missing the point. JohnPristine wants each new datum to be automatically removed from the "queue" as soon as every registered thread has received it, but not before. May also want a method that waits until there is a message that the calling thread has not yet seen.

http://stackoverflow.com/q/24425595
favorite count: 0
accepted answer: http://stackoverflow.com/a/24425847
type: Question
upvote count: 1
answer count: 1
tagged with: java
tagged with: sprite
has body: I am using libgdx 1.2.0 + eclipse. I want to draw multiple sprites from a class in my game screen, but only one sprite gets drawn. This is my render method @Override public void render(float delta) { Gdx.gl.glClearColor(100/255f, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); if(Gdx.input.justTouched()){ touchX = Gdx.input.getX(); touchY = Gdx.input.getY(); //for(int i=0; i &lt; enemy.length; i++) //System.out.println(enemy[i].x + " " + enemy[i].y); } for(int i=0; i&lt; enemy.length; i++){ enemy[i].update(delta); if(enemy[i].getSprite().getBoundingRectangle().contains(touchX/ppX, touchY/ppY)) enemy[i].reset(); if(enemy[i].gameOver){ gameOver = true; //System.out.println("Over"); } } game.batch.begin(); //if(!gameOver){ for(int i=0; i &lt; enemy.length; i++) enemy[i].getSprite().draw(game.batch); //} game.batch.end(); } Same thing happens if I call enemy[0].getSprite().draw(game.batch); enemy[1].getSprite().draw(game.batch); It always draws something if I call just one of them. This is the Enemy class. I load the same sprite from the game screen class in every instance of Enemy, but I change it's position. public class Enemy { private final float minX=1, minY=2; private final float maxX=31, maxY=18; private float x,y; private float time; private Sprite sprite; boolean gameOver; public Enemy(Sprite sprite){ this.sprite = sprite; reset(); } public Sprite getSprite(){ return sprite; } public void reset(){ x = minX + (int)(Math.random() * (maxX - minX + 1)); y = minY + (int)(Math.random() * (maxY - minY + 1)); time = 0.0f; gameOver = false; sprite.setPosition(x, y); } public void update(float delta){ time += delta; if(time &gt;= 3.0f) gameOver = true; } }
tagged with: libgdx
downvote count: 0
type: AnsweredQuestion
has title: Drawing multiple sprites in libgdx
score: 1
has answer: http://stackoverflow.com/a/24425847

http://stackoverflow.com/q/24294486
tagged with: mysql
type: Question
has title: Java order of class fields and methods in singleton
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24294545
has body: I have a surprising problem that any amount of Googling is not helping. I was hoping I can clarify here. I declared a Java singleton for connection pooling my JDBC/MySQL DB using eager initialization like so: public class SomeConnectionPool { private static final Logger log = Logger.getLogger (SomeConnectionPool.class.getName()); private static SomeDataSource sDS = null; private static SomeConnectionPool sCP = new SomeConnectionPool (); private SomeConnectionPool () { // Configure DataSource, connect to DB sDS = new SomeDataSource (config); } public static SomeConnectionPool getInstance () { return sCP; } public static SomeDataSource getDataSource () { return sDS; } } In my application, I use the singleton like so: SomeDataSource sds = SomeConnectionPool.getInstance ().getDataSource (); Connection connection = sds.getConnection (); this works as expected. However, if I change the order of the members in SomeConnectionPool class like so: public class SomeConnectionPool { private static final Logger log = Logger.getLogger (SomeConnectionPool.class.getName()); private static SomeConnectionPool sCP = new SomeConnectionPool (); private static SomeDataSource sDS = null; ... // the rest is the same code as before } I get a null pointer exception on the line that requests a getConnection(). I can see that the connection objects are being allocated on the MySQL DB (show processlist lists them). Does the order of the members really matter? This goes against my previous experience. What am I missing?
tagged with: singleton
possible better answer: http://stackoverflow.com/a/24294537
has answer: http://stackoverflow.com/a/24294537
has answer: http://stackoverflow.com/a/24294580
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24294580
tagged with: connection-pooling
tagged with: java

http://stackoverflow.com/a/24309204
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24286876
has body: Wouldn't you mind to share your &lt;int-kafka&gt; config and point out where do you have an issue? Maybe it will be just enough to do this MessageLeftOverTracker.clearMessagesLeftOver() ? I'm not well with Kafka, but know what Spring Integration does.

http://stackoverflow.com/comment/37498350
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24271313
has text: This question has been asked numerous times. For example [here](http://stackoverflow.com/questions/322715/when-to-use-linkedlist-over-arraylist) is very good answer about difference of those two.
type: Comment

http://stackoverflow.com/comment/37722717
type: Comment
comment on: http://stackoverflow.com/a/24374271
has text: Whenever I read something you write I inevitably learn something. And everytime I think I know a lot about AspectJ I realise that I do not know enough yet. Thanks again. :-)
score: 0
type: AnswerComment

http://stackoverflow.com/a/24315148
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24315047
has body: A web container, JSP container or servlet container refer to the same thing: a server which takes your Java web application and executes it. An example would be Apache Tomcat or Eclipse Jetty. You create your app, start the server and pass your application to it. So the server will "contain" your application and executes it (therefore it's called a container). The server will handle things for you, such as listening on ports and incoming requests or routing. A Spring container executes an application written with the Spring framework.
answers question: http://stackoverflow.com/q/24315047
score: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37583085
has comment: http://stackoverflow.com/comment/37582235

http://stackoverflow.com/a/24293490
downvote count: 0
answers question: http://stackoverflow.com/q/24293018
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
has body: Please check the reduce method signature in your reducer implementation It should be public void reduce(Text key, Iterable&lt;MyWritable&gt; values, Context context) throws IOException, InterruptedException { instead of public void reduce(Text key, Iterator&lt;MyWritable&gt; values, Context context) throws IOException, InterruptedException {
accepted answer of: http://stackoverflow.com/q/24293018

http://stackoverflow.com/comment/37655230
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24353771
has text: What is line 103 `com.gpsocial.fragments.MapFragment`?
score: 0

http://stackoverflow.com/q/24312016
has comment: http://stackoverflow.com/comment/37625855
has comment: http://stackoverflow.com/comment/37646453
has comment: http://stackoverflow.com/comment/37710055
favorite count: 0
has comment: http://stackoverflow.com/comment/37920182
has comment: http://stackoverflow.com/comment/37656044
tagged with: android
linked to: http://stackoverflow.com/q/6841212
has comment: http://stackoverflow.com/comment/37667745
has comment: http://stackoverflow.com/comment/37904023
linked to: http://stackoverflow.com/q/2620917
answer count: 4
possible better answer: http://stackoverflow.com/a/24432178
type: AnsweredQuestion
has body: I'm trying to work out if bound service is appropriate for doing background work in my app. The requirements are that various application components can make web requests through it of varying priority. (Thus the service must maintain some sort of queue and be able to cancel it's ongoing requests for others of higher priority). I'd like the service to be relatively unobtrusive to the user such that they don't find it running after they are done with the application - if I want to do something more important that continues while the application is closed I can use startForeground() to push a notification during the process. Solution the first: bind from the activity So, for a given application component it should be able to bind to the service to get work done. But there seems to be a well known problem that if an activity is doing the binding, the binding will be lost during configuration change (rotation) as the activity will be closed. So, I was thinking I could use another context that I create (new Context()) and bind from that to the service, then use a non-UI fragment to maintain this context across config changes until I deem that I am finished with it. I could do this only during the configuration change or as a permanent alternative to binding from the activity. (I should probably point out that this is a standard and recommended way to maintain instances across config changes) Solution numero 2: The main alternative I see is that I can use the application context to do the binding - but could this persist too long? and/or could there be some cyclic relationship between the app context and the service thus preventing the service and the app context being destroyed? Questions: So the question I'm trying to answer to myself is: should I use the first method (activities with temporary contexts)? Or the second (just bind service to the app context)? Am I right in thinking the app context can bind to the service multiple times and then unbind from it the same nu…
downvote count: 0
score: 11
type: Question
has title: Bind to service from new Context for configuration changes or bind from app context?
has answer: http://stackoverflow.com/a/24612569
tagged with: android-background
has answer: http://stackoverflow.com/a/24458955
tagged with: java
has comment: http://stackoverflow.com/comment/37852194
accepted answer: http://stackoverflow.com/a/24458955
upvote count: 11
has answer: http://stackoverflow.com/a/24458004
has answer: http://stackoverflow.com/a/24432178
tagged with: android-service
has comment: http://stackoverflow.com/comment/37652828
tagged with: android-service-binding
has comment: http://stackoverflow.com/comment/37713354

http://stackoverflow.com/q/24351252
tagged with: reflection
tagged with: urlclassloader
tagged with: java
has title: How to reload a class using Java UrlClassLoader
type: Question
has answer: http://stackoverflow.com/a/24351745
has comment: http://stackoverflow.com/comment/37650524
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24351745
has body: I have a list of classes which I need to use many times during the execution of my program, I need to load them dinamically because their code can change very often and I want to treat them as services so that I can update them easily. Here my questions: Does UrlClassLoader always load the class again even when it hasn't changed? Can this cause performance or memory issues? Here is my code for testing this: package classloader; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; public class ClassLoaderClass { public static void main(String[] args) throws ClassNotFoundException, MalformedURLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, InterruptedException { //no paramater Class noparams[] = {}; URLClassLoader urlClassLoader = new URLClassLoader(new URL[]{new URL("file:///C:/Users/hm/Documents/classes/")}); Class gsonClass = urlClassLoader.loadClass("AppTest"); Constructor constructor = gsonClass.getConstructor(); Object Apptest = constructor.newInstance(); Method method = gsonClass.getMethod("printIt",noparams); Object returnObj = method.invoke(Apptest, null); String jsonString = (String)returnObj; } } I hope you can help me, thanks.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37650121

http://stackoverflow.com/a/24303303
score: 0
answers question: http://stackoverflow.com/q/24303005
has body: In your servlet, you can get absolute path using getServletContext().getRealPath ("."), this will return you the absolute path, in it append remaining path till your resources folder and read the desired files using FileInputStream.
type: Answer

http://stackoverflow.com/comment/37528289
type: AnswerComment
comment on: http://stackoverflow.com/a/24287179
type: Comment
has text: ok how about repeating image like ccleaner header grey lines at back ground , because if i design background insert into a label with specific size when I expand image size is not expanded , remainin part will be empty ! How to solve this ?
score: 0

http://stackoverflow.com/q/24364465
has comment: http://stackoverflow.com/comment/37675630
score: 6
has answer: http://stackoverflow.com/a/24364607
has body: I run the following code and get the results shown in the comments. I know the differences between == and .equals(). What I don't understand is why my code in the second line has different results from the code in the third line. String de = "de"; // String abcde = "abc" + "de"; // abcde == "abcde" reture true String abcde = "abc" + de; // abcde == "abcde" reture false; System.out.println(); System.out.println(abcde=="abcde"); System.out.println(de=="de"); In trying to debug this I used the javap -c command and got the following output 'code' for the first string concatenation: Code: 0: ldc #9; //String de 2: astore_1 3: new #10; //class java/lang/StringBuilder 6: dup 7: invokespecial #11; //Method java/lang/StringBuilder."&lt;init&gt;":()V 10: ldc #4; //String abc 12: invokevirtual #12; //Method java/lang/StringBuilder.append:(Ljava/lang String;)Ljava/lang/StringBuilder; 15: aload_1 16: invokevirtual #12; //Method java/lang/StringBuilder.append:(Ljava/lang String;)Ljava/lang/StringBuilder; 19: invokevirtual #13; //Method java/lang/StringBuilder.toString:()Ljava/l ng/String; 22: astore_2 23: getstatic #14; //Field java/lang/System.out:Ljava/io/PrintStream; 26: invokevirtual #15; //Method java/io/PrintStream.println:()V 29: getstatic #14; //Field java/lang/System.out:Ljava/io/PrintStream; 32: aload_2 33: ldc #16; //String abcde 35: if_acmpne 42 38: iconst_1 39: goto 43 42: iconst_0 43: invokevirtual #17; //Method java/io/PrintStream.println:(Z)V 46: getstatic #14; //Field java/lang/System.out:Ljava/io/PrintStream; 49: aload_1 50: ldc #9; //String de 52: if_acmpne 59 55: iconst_1 56: goto 60 59: iconst_0 60: invokevirtual #17; //Method java/io/PrintStream.println:(Z)V 63: return And the output for the second string concatenation: I am not so familiar with this 'code' and can't see any reason why these differences exists. So could anyone explain why those differences happen? Related post
answer count: 4
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/12081170
has comment: http://stackoverflow.com/comment/38925459
has comment: http://stackoverflow.com/comment/37675251
tagged with: java
possible better answer: http://stackoverflow.com/a/24364601
upvote count: 10
has comment: http://stackoverflow.com/comment/37675276
type: Question
has answer: http://stackoverflow.com/a/24364627
downvote count: 4
has comment: http://stackoverflow.com/comment/37675858
has answer: http://stackoverflow.com/a/24364601
has comment: http://stackoverflow.com/comment/37675370
has title: Differences between "abc" + "de" and "abc" + de (de = "de") in Java?
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/37675428
tagged with: string
has answer: http://stackoverflow.com/a/24364810
accepted answer: http://stackoverflow.com/a/24364810
has comment: http://stackoverflow.com/comment/37675885
favorite count: 0
has comment: http://stackoverflow.com/comment/38925499

http://stackoverflow.com/q/24295887
has answer: http://stackoverflow.com/a/24297280
linked to: http://stackoverflow.com/q/2036970
linked to: http://stackoverflow.com/q/383947
type: Question
has comment: http://stackoverflow.com/comment/37545282
has comment: http://stackoverflow.com/comment/37545244
tagged with: javascript
has title: How can I do this in Java? I can do it in Javascript?
answer count: 3
has comment: http://stackoverflow.com/comment/37545311
has comment: http://stackoverflow.com/comment/37545223
favorite count: 0
has answer: http://stackoverflow.com/a/24295959
has answer: http://stackoverflow.com/a/24295964
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37545224
downvote count: 6
has body: I'm trying to learn Java, I sort of know Javascript but I was wondering how I could do this in Java I use this for Javascript. var player = { X: 32, Y: 32, Cloned: false; }; I would use this to drawImage(player.x, player.y) For example, how would I do something like this in java?
tagged with: java
score: -4

http://stackoverflow.com/q/24319235
type: Question
tagged with: client-server
tagged with: public-key
has answer: http://stackoverflow.com/a/24336610
answer count: 1
downvote count: 0
favorite count: 0
has title: Update the list of clients online
type: UnansweredQuestion
tagged with: multithreading
has body: I'm writing a server in java which listens at a particular port. Different clients send messages to the server at regular intervals. The messages contain the respective public keys of the clients. The server has a list of public keys. If the newly received public key is not present in the list, the server adds it there. I have done the part of comparing the public keys and writing the public key not present in the list. Code for multithreaded server (here the server actually listens at two different ports) : while(!isStopped()){ System.out.println("Server is working"); try { serverSocket = ServerSocketChannel.open(); serverSocket.configureBlocking(false); serverSocket.bind(new InetSocketAddress(serverPortRequest)); serverSocket.register(selector, SelectionKey.OP_ACCEPT); serverSocket = ServerSocketChannel.open(); serverSocket.configureBlocking(false); serverSocket.bind(new InetSocketAddress(serverPortAccept)); serverSocket.register(selector, SelectionKey.OP_ACCEPT); while(selector.isOpen()){ selector.select(); Set&lt;SelectionKey&gt; readyKeys = selector.selectedKeys(); Iterator&lt;SelectionKey&gt; iterator = readyKeys.iterator(); while(iterator.hasNext()){ SelectionKey key = (SelectionKey) iterator.next(); if(key.isAcceptable()){ SocketChannel client = serverSocket.accept(); (new Thread(new WorkerRunnable(client,"Multithreaded Server"))).start(); } } } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } The WorkerRunnable thread is where I check if the client's public key is already in the server's list or not : if(!isPresent(userPK)) { FileOutputStream pk; try { pk = new FileOutputStream("contactsPK/contact"+Server.pkCounter++); pk.write(userPK); pk.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } Here userPK is a byte array which stores the public key obtained from the message sent by a client. How do i check at regular intervals (say 30 seconds) that a client, from the list of client…
score: 1
tagged with: java
tagged with: rsa
upvote count: 1

http://stackoverflow.com/comment/37655361
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24353559
has text: Find the view by id (`gview`) and use the method on the instance.
score: 1

http://stackoverflow.com/comment/37618866
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24322834
has text: I have updated my question to use byte[] but now I am getting this error: java.lang.Exception: [decrypt] For input string: "Ny"

http://stackoverflow.com/comment/37699483
type: Comment
comment on: http://stackoverflow.com/a/24376531
type: AnswerComment
has text: but I am going to also do comparisons. and things like `w |= ~0xff;`
score: 0

http://stackoverflow.com/comment/37765972
comment on: http://stackoverflow.com/q/24412511
type: Comment
type: QuestionComment
has text: I don't know JSONPath but I doubt what you linked as "online API" is the official API of the Jayway library. Since that looks like JavaDoc anyway, why don't you just download the newest version and directly read the current JavaDoc?
score: 0

http://stackoverflow.com/q/24404434
answer count: 1
type: UnansweredQuestion
tagged with: android
has body: I am using Eclipse with the Android plugin. I am trying to change some attributes in my manifest file for an android app. I open it from package explorer and then it opens, but I cannot edit any of the attributes. I am in the Application tab. I can't click on the browse buttons or bring focus to the text boxes. I have tried closing Eclipse and restarting it, but it didn't do anything.
tagged with: android-manifest
tagged with: java
tagged with: eclipse
has title: Cannot edit Android Manifest file in Eclipse
type: Question
has answer: http://stackoverflow.com/a/24404906
score: 0
has comment: http://stackoverflow.com/comment/37750737

http://stackoverflow.com/a/24306003
answers question: http://stackoverflow.com/q/24305830
score: 3
downvote count: 0
type: Answer
upvote count: 3
has body: Use the following, public class TestIncrement { private static int count = 0; private int jobID; private String name; private boolean isFilled; public TestIncrement(String title) { name = title; isFilled = false; setJobID(++count); } public int getJobID() { return jobID; } public void setJobID(int jobID) { this.jobID = jobID; } } Please use following to test this public class Testing { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub for (int i = 0; i &lt; 10; i++) { TestIncrement tst = new TestIncrement("a"); System.out.println(tst.getJobID()); } } }

http://stackoverflow.com/comment/37535374
type: AnswerComment
comment on: http://stackoverflow.com/a/24290757
type: Comment
has text: It is simple. The first setup indeed will take an hour or two, but it will help you in future.
score: 1

http://stackoverflow.com/q/24398679
answer count: 1
has answer: http://stackoverflow.com/a/24400577
tagged with: spring
type: UnansweredQuestion
tagged with: java
type: Question
has body: Lets say I have a Category domain model object that follows a file tree structure. I want to be able to construct a RequestMapping annotation for the controller method so that /category/art/macros /category/people/weddings/2014/5-19 /category/sports/college/baseball/2014/5-19 can be handled by the minimum number of controller methods. I already have one controller method defined: @RequestMapping(value ={"/category/{category}"}, method = RequestMethod.GET) public String adminCategory(ModelMap model, @PathVariable(value = "category") String category){ model.addAttribute("message", category); return "gallery"; } This works for a single URL like /category/sports How can I adapt this to be more flexible?
has title: Spring RequestMapping URL with hierarchal values
score: 0

http://stackoverflow.com/q/24324555
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24336360
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/37599687
has body: I am new in camel world. I wrote some code, it looks ugly: from('component:params') .process(someValidator()) .process{ def producerTemplate = lookup('template', ProducerTemplate.class) // I create NEW exchange because I need original in.body data in next routers def exchange = new DefaultExchange(context) exchange.in.body = someTransformation(it.in.body) def result = producerTemplate.send(SOMEWHERE, exchange) if (result.exception) throw result.exception } .process(someActionWithOriginalExchange(it.body.in)) I created addition exchange class here. I don't think it good idea. But when I try to rewrite it use "transform" and "to" I faced some problem: from('component:params') .process(someValidator()) .process{// or maybe transform, I guess it doesn't matter here it.in.body = someTransformation(it.in.body) } .to(SOMEWHERE) .process(someActionWithOriginalExchange(??? how can I get original exchange????)) I don't understand how can I save original message body?
has title: save original message use TO
type: Question
score: -2
tagged with: apache-camel
tagged with: groovy

http://stackoverflow.com/a/24342474
downvote count: 0
has body: The problem comes from your nesting of Method calls and the usage of @Transactional. By default Springs Transaction Management In proxy mode (which is the default), only external method calls coming in through the proxy are intercepted. This means that self-invocation, in effect, a method within the target object calling another method of the target object, will not lead to an actual transaction at runtime even if the invoked method is marked with @Transactional. Spring Transaction Management This means, that the call of xxx.payFee() is not surrounded by a transaction when it's called through saleFacade.update() -&gt; saleFacade.renewSale() -&gt; xxx.renewSpecialSale() As far as I got it, you have at least these options Mark xxx.renewSpecialSale() as @Transactional Mark saleFacade.update() as @Transactional Mark both classes xxx and saleFacade @Transactional
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24312343
score: 1

http://stackoverflow.com/comment/37750801
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24404477
score: 1
has text: Yes, why I am getting this unexpected behaviour

http://stackoverflow.com/comment/37592519
comment on: http://stackoverflow.com/q/24318668
has text: I'm sorry but I don't know what exactly you mean?I request the params at the action class.
type: Comment
type: QuestionComment
score: 0

access-control
tag name: access-control
type: Tag
tags question: http://stackoverflow.com/q/24410407

http://stackoverflow.com/comment/37560195
type: AnswerComment
has text: As the code now works well, what would be the answer to the question: "Explain the concept of casting using the code below"? The code that I provided.
score: 0
comment on: http://stackoverflow.com/a/24303538
type: Comment

http://stackoverflow.com/comment/37600787
type: Comment
comment on: http://stackoverflow.com/a/24322714
has text: This is system property, and will be available to web application that is running under tomcat
type: AnswerComment
score: 0

http://stackoverflow.com/a/24356901
score: 2
answers question: http://stackoverflow.com/q/24356883
has body: Take a look at How to Use Editor Panes and Text Panes, which will allow you to display HTML content. Remember though, Swing's support for HTML is limited to HTML 3.2 and only has limited support of CSS and probably no to little support for JavaScript. In this case, I might suggest having a look at JavaFX's WebView instead (and no, I've not used it)
upvote count: 2
downvote count: 0
type: Answer

http://stackoverflow.com/q/24400231
linked to: http://stackoverflow.com/q/3038392
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/15933919
has comment: http://stackoverflow.com/comment/37742930
has title: Why are arrays in Java restricted to "int" sizes?
has comment: http://stackoverflow.com/comment/37743130
has comment: http://stackoverflow.com/comment/37742906
has answer: http://stackoverflow.com/a/24400333
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/37742961
type: Question
has comment: http://stackoverflow.com/comment/37742933
has comment: http://stackoverflow.com/comment/37744029
has comment: http://stackoverflow.com/comment/37743190
answer count: 2
score: 2
tagged with: arrays
downvote count: 0
has body: For example, I get error "Cannot convert from long to int" while trying following long size = 32; int a[] = new int[size]; Java restrict array size to int, which limits me to create max ~2 billion elements. Why do we have this limit?
has answer: http://stackoverflow.com/a/24400374
linked to: http://stackoverflow.com/q/15933919
has comment: http://stackoverflow.com/comment/37742917
has comment: http://stackoverflow.com/comment/37742955
favorite count: 0

http://stackoverflow.com/comment/37571914
score: 0
type: Comment
type: QuestionComment
has text: Depends on what you're doing. What would you have in mind?
comment on: http://stackoverflow.com/q/24310221

http://stackoverflow.com/a/25437058
score: 1
has body: If you're running on Windows, the ClearImage Barcode SDK has a Java API. It can read and decode barcodes from PDFs or images and provide the decoded data to you. Some sample code: public static void testDataMatrix () { try { String filename = "1.png "; CiServer objCi = new CiServer(); Ci = objCi.getICiServer(); ICiDataMatrix reader = Ci.CreateDataMatrix(); // read DataMatrix Barcode reader.getImage().Open(filename, 1); int n = reader.Find(0); // find all the barcodes in the doc for (i = 1; i &lt;= n; i++) { ICiBarcode Bc = reader.getBarcodes().getItem(i); // getItem is 1-based System.out.println("Barcode " + i + " has Text: " + Bc.getText()); } } catch (Exception ex) {System.out.println(ex.getMessage());} } Another one to consider is Accusoft's Barcode Xpress which also has a Java API. Disclaimer: I've done some work for Inlite in the past.
upvote count: 1
answers question: http://stackoverflow.com/q/24323653
type: Answer
downvote count: 0

http://stackoverflow.com/comment/37694633
has text: The annotation is for container managed transactions. The container managed transactions cannot be demarcated (committed/rolled back) by the bean.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24374557

http://stackoverflow.com/a/24283009
has body: If you can, sort both lists. Then scan them in increasing order: read the first elements c and s from currentList and submittedList. If c==s, update c and get the next c and s; if c&lt;s (meaning that c is not in submittedList), discard c from currentList and get the next c; if c&gt;s (meaning that s is not in currentList), insert s in currentList and get the next s. And so on. When one of the list is exhausted, continue with the rules c&lt;* and *&gt;s. Stop when both lists are exhausted.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24280989

http://stackoverflow.com/comment/37516341
has text: can you show us what you have tried so far?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24280999

http://stackoverflow.com/comment/37667075
comment on: http://stackoverflow.com/q/24359582
score: 0
has text: Perhaps you should write one. Note: the states are different in each country.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37561037
type: QuestionComment
has text: @ peeskillet OK I'm getting somewhere. I can now list all the files in the appropriate directory and subdirectories. I would now like to place the resultant file paths (which I've just listed) into my original array (listOfFiles[]) so that I can continue as before with the original code intact.
score: 0
comment on: http://stackoverflow.com/q/24303444
type: Comment

http://stackoverflow.com/a/24320340
has comment: http://stackoverflow.com/comment/37591431
accepted answer of: http://stackoverflow.com/q/24319978
type: Answer
answers question: http://stackoverflow.com/q/24319978
has comment: http://stackoverflow.com/comment/37594445
has comment: http://stackoverflow.com/comment/37591510
has comment: http://stackoverflow.com/comment/37591468
upvote count: 1
has comment: http://stackoverflow.com/comment/37592030
has comment: http://stackoverflow.com/comment/37594353
has comment: http://stackoverflow.com/comment/37593581
has comment: http://stackoverflow.com/comment/37593145
has comment: http://stackoverflow.com/comment/37591678
has body: For this particular query I would suggest a composite index like: CREATE INDEX map_ix1 ON myproject.MAP (end_ip, start_ip); If that is a unique combination, create unique index .... Also, don't use * in the query. If you need all columns it is still better (for maintainability) to explicitly declare the columns. You may also consider a covering index (an index that contains all columns accessed in the query): CREATE INDEX map_ix1 ON myproject.MAP (end_ip, start_ip, ...);
has comment: http://stackoverflow.com/comment/37594007
has comment: http://stackoverflow.com/comment/37591619
has comment: http://stackoverflow.com/comment/37592275
has comment: http://stackoverflow.com/comment/37594675
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37591234

http://stackoverflow.com/comment/37670654
comment on: http://stackoverflow.com/a/24361796
type: Comment
score: 0
type: AnswerComment
has text: Java Persistence 2.1 is listed as a java ee 7 technologies in the link. http://www.oracle.com/technetwork/java/javaee/tech/index.html. When It becomes as a part of JSE and removed from Java EE tech?

http://stackoverflow.com/q/24311394
tagged with: mule
tagged with: mule-studio
upvote count: 2
answer count: 1
favorite count: 0
has title: Mule: How to track non-deletable & non-movable files
has comment: http://stackoverflow.com/comment/37575726
has comment: http://stackoverflow.com/comment/37576439
has comment: http://stackoverflow.com/comment/37685614
score: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/37623920
tagged with: java
accepted answer: http://stackoverflow.com/a/25671198
tagged with: file
type: Question
has body: I have a directory with files that cannot be removed because they are used by other applications or have read only properties. This means that I can't move or delete the files like Mule does as a natural file tracking system. In order to process these files through Mule once they arrive or when they get updated without deleting/moving them from the original directory I need some sort of custom tracking. To do this I think I need to add some rules and be able to track files that are: New files Processed files Updated files For this, I thought of having a log file in the same directory that would track each file by name and date modified, but I'm not sure if this is the correct way of doing this. I would need to be able to write and read this log file and compare its content with current files in the directory in order to determine which files are new or updated. This seems to be a bit too complicated and requires me to add quite a bit of programming (maybe as groovy scripts or overriding some methods). Is there any other simpler way to do this on Mule? If not, how should I start tackling this problem? I'm guessing I can write some java to talk to File EndPoint.
tagged with: version-control
has answer: http://stackoverflow.com/a/25671198

http://stackoverflow.com/comment/37649117
has text: Just to be sure, you *are* using the latest jOOQ version (3.4.0)?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24350446

http://stackoverflow.com/q/24325334
has comment: http://stackoverflow.com/comment/37601389
type: Question
has title: getPopup() of PopupFactory not called on Mac
tagged with: java
has comment: http://stackoverflow.com/comment/37602082
has comment: http://stackoverflow.com/comment/37600391
has comment: http://stackoverflow.com/comment/37602909
score: 0
has comment: http://stackoverflow.com/comment/37601424
has comment: http://stackoverflow.com/comment/37603107
has body: I have extended javax.swing.PopupFactory class and override getPopup(). Also I have set as shared instance for PopupFactory. I have put logs in getPopup() method. On Windows I can see the logs of getPopup(). But on Mac the logs are not showing. It seems like on Mac, the getPopup() method is not called. Can anyone help me why the method is not called on Mac? How can I override the getPopup() on Mac? Here is my custom PopupFactory and the class in which I pack a combo box in frame. public class PopupExample { public static void main(String args[]) { PopupFactory.setSharedInstance(new PopupFactory() { public Popup getPopup(Component owner, Component contents, int x, int y) throws IllegalArgumentException { System.out.println("getPopup called..."); return super.getPopup(owner, contents, x, y); } }); JFrame f = new JFrame(); f.getContentPane().add(new JComboBox(new String[]{"a","b","c"})); f.pack(); f.setVisible(true); } } On Windows I can see the message "getPopup called..." in the console when I click on combobox to open. But on Mac it didn't show the message.
has comment: http://stackoverflow.com/comment/37602467
tagged with: macos
has comment: http://stackoverflow.com/comment/37601258
answer count: 0
has comment: http://stackoverflow.com/comment/37601345
type: UnansweredQuestion
tagged with: jpopup
tagged with: swing

http://stackoverflow.com/a/24304494
has body: ${user eq null or user.preferredName eq null ? '' : user.preferredName} try this one ..
score: 2
has comment: http://stackoverflow.com/comment/37561374
type: Answer
has comment: http://stackoverflow.com/comment/37561052
upvote count: 3
answers question: http://stackoverflow.com/q/24304380
downvote count: 1
has comment: http://stackoverflow.com/comment/37561567

http://stackoverflow.com/q/24280463
has title: how to handle public and private jsp pages/servlet under login with a Filter
upvote count: 1
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37516180
has comment: http://stackoverflow.com/comment/37516541
type: Question
has comment: http://stackoverflow.com/comment/37515557
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/37515525
favorite count: 0
answer count: 0
has body: i've been studying for a while Java and jsp. Im developing a little application to test my knowledge. In my application i have some public pages and some pages that need to log in. For every jsp page I have a servlet that handles it. I created a filter to check if a user is logged in by checking if a session exist. My question is: how should i handle the jsp pages/servlet? Should i put the public jsp pages/servlet in one folder and the 'private' jsp pages/servlet in another and tell the filter to check just the jsp pages/servlet under the 'private' folder? Or should i tell the filter to check every jsp pages/servlet and tell it as well what jsp pages/servlet are not private so it knows that it doesn't need to redirect users to the login page?
type: UnansweredQuestion

http://stackoverflow.com/comment/37667004
score: 0
type: Comment
type: QuestionComment
has text: You need to pass in an instance of `Country`; `Country.US` would not work here since it is a `String`. There seems to be more in the `Country` class that you did not show.
comment on: http://stackoverflow.com/q/24359606

http://stackoverflow.com/comment/37581351
comment on: http://stackoverflow.com/a/24315103
type: AnswerComment
has text: just add %25 before the number it will treat it as %. So i would append %25 in my string.Thank you Garis
score: 0
type: Comment

http://stackoverflow.com/q/24338443
tagged with: nullpointerexception
tagged with: android
has comment: http://stackoverflow.com/comment/37625427
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24338454
tagged with: java
tagged with: navigation-drawer
type: Question
has answer: http://stackoverflow.com/a/24338454
answer count: 1
has title: Crashing when creating navigation panel
has body: I am attempting to make a navigation panel in Android. I followed the instructions from http://developer.android.com/training/implementing-navigation/nav-drawer.html. However the application is crashing by a Null Pointer Exception. MainActivity.java //import statements public class MainActivity extends ActionBarActivity { private String[] mPlanetTitles; private DrawerLayout mDrawerLayout; private ListView mDrawerList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mPlanetTitles = getResources().getStringArray(R.array.nav_drawer_items); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); // Set the adapter for the list view mDrawerList.setAdapter(new ArrayAdapter&lt;String&gt;(this,R.layout.activity_main, R.layout.drawer_listview_item, mPlanetTitles)); // Set the list's click listener // mDrawerList.setOnItemClickListener(new DrawerItemClickListener()); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } activity_main.xml &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/…
score: 0

http://stackoverflow.com/tag/pdf
tags question: http://stackoverflow.com/q/24426288
tags question: http://stackoverflow.com/q/24342489
tags question: http://stackoverflow.com/q/24301578
tags question: http://stackoverflow.com/q/24385965
tags question: http://stackoverflow.com/q/24385594
type: Tag
tag name: pdf
tags question: http://stackoverflow.com/q/24282559
tags question: http://stackoverflow.com/q/24284409
tags question: http://stackoverflow.com/q/24404413
tags question: http://stackoverflow.com/q/24300344
tags question: http://stackoverflow.com/q/24311314
tags question: http://stackoverflow.com/q/24270546

http://stackoverflow.com/comment/37524847
type: AnswerComment
comment on: http://stackoverflow.com/a/24285470
has text: I will try this. But what is r.roomnumber and b.roomnumber?
type: Comment
score: 0

http://stackoverflow.com/comment/37666999
score: 0
type: Comment
has text: Hey :) .. i am doing ma minor project on "online test". there is "chk" (hash table) in which i am copying question number. now i am trying to pass this chk to another jsp using session object "hash" . i am fetching questions by category. once i run the project..no problem at all. but when i am going back and select another category then new values are added in chk as well as old one. but if i clear chk at end then it work properly but session problem. Hope u understand what i am trying to say or ask.
comment on: http://stackoverflow.com/a/24339089
type: AnswerComment

http://stackoverflow.com/comment/37512938
comment on: http://stackoverflow.com/q/24279035
score: 0
type: QuestionComment
has text: Post the exception's stack trace.
type: Comment

http://stackoverflow.com/comment/101936446
score: 3
has text: I added a "version" field, with @Version. It updates in database fine. Opt Lock exception works fine. Problem is after save, entity does not get updates, DB updates, but entity still has old version value. What am I doing wrong?
type: AnswerComment
comment on: http://stackoverflow.com/a/24324733
type: Comment

http://stackoverflow.com/q/24357218
tagged with: heap-dump
has comment: http://stackoverflow.com/comment/37662944
score: 2
type: AnsweredQuestion
tagged with: profiling
downvote count: 0
has title: Runtime heap analysis; when is a String initialized that matches a pattern
accepted answer: http://stackoverflow.com/a/24361408
favorite count: 0
tagged with: heap-memory
type: Question
has comment: http://stackoverflow.com/comment/37662624
has comment: http://stackoverflow.com/comment/37664163
has comment: http://stackoverflow.com/comment/37663831
has body: I have a Java program that at some point eventually creates a string that is matched by "schema.sql". I want to find where in the source code this happens. Searching "schema.sql" on the source code does not yield the location. Instead the program must create the string at runtime. I just don't know where. It happens in some library on my project. How can I find where my program creates this string? Can I watch the heap at runtime somehow for a string that is matched by "schema.sql"? I looked at things like VisualVM but it looks like it only analyzes heap dumps, not the running state of the heap. There must be a way to do this; any ideas?
upvote count: 2
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/37661982
has answer: http://stackoverflow.com/a/24361408
linked to: http://stackoverflow.com/q/24135716
has comment: http://stackoverflow.com/comment/37661944

http://stackoverflow.com/q/24358434
score: -3
has comment: http://stackoverflow.com/comment/37664500
tagged with: java
downvote count: 3
type: Question
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/24358475
has comment: http://stackoverflow.com/comment/37664764
has answer: http://stackoverflow.com/a/24358519
has title: Cannot get the addition to output
has body: Everything is good, but i just cant get the addition to show up? When I run the program it is blank when it comes to the addition of the matrixes part. Thanks in advance. BtW does anyone know how I would make this display right column justified? public static void displayMatrixes(int[][] matrix1, int[][] matrix2, int[][] resultsMatrix) { System.out.println("This is how i want it to output"); for (int i = 0; i &lt; 3; i++) { for (int j = 0; j &lt; 3; j++) { System.out.print(matrix1[i][j] + " "); } System.out.print("+ "); for (int j = 0; j &lt; 3; j++) { System.out.print(matrix2[i][j]+ " "); } System.out.print("= "); for (int j = 0; j &lt; 3; j++) { System.out.print(resultsMatrix[i][j]+ " "); } System.out.println(); } ) This is my code import java.util.Scanner; public class MatrixAdd { public static void main(String arg[]) { Scanner input = new Scanner(System.in); int a[][]= new int[3][3]; int b[][] = new int[3][3]; int row, column; System.out.println("\nEnter Matrix A: \n"); for (int i = 0 ; i &lt; 3 ; i++){ for (int j = 0; j&lt;3 ; j++){ a[i][j] = input.nextInt(); } } System.out.println("\nEnter Matrix B: \n"); for (int i = 0; i &lt; 3; i++){ for (int j = 0; j &lt; 3; j++){ b[i][j] = input.nextInt(); } } System.out.println("\nMatrix A + Matrix B = Matrix C: \n"); int[][] resultingMatrix = addMatrix(a, b); } public static int[][] addMatrix(int[][] a, int[][] b){ int[][] result = new int[a.length][a[0].length]; for (int i = 0; i &lt; result.length; i++) { for (int j = 0; j &lt; result[0].length; j++){ result[i][j]=a[i][j] + b[i][j]; } } for (int i = 0; i &lt; a.length; i++) { char plus = '+'; for (int j = 0; j &lt; a[0].length; j++) { System.out.print(" " + a[i][j]); } if (i == a.length / 2) System.out.print(" " + plus + " "); else { System.out.print(" "); } for (int j = 0; j &lt; b[0].length; j++) { System.out.print(" " + b[i][j]); } if (i == a.length / 2) System.out.print(" = "); else { System.out.print(" "); } for (int j = 0; j &lt; result[0].length; j++) { System.…
favorite count: 0
has comment: http://stackoverflow.com/comment/37664514
has comment: http://stackoverflow.com/comment/37664482
type: UnansweredQuestion

http://stackoverflow.com/a/24421900
upvote count: 5
downvote count: 0
has body: Assuming that a is of type int[] and is not null, then ... In the first snippet, you create a new array, and then throw it away. In other words, by reassigning b to a, the array that you created is inaccessible, and will therefore be garbage collected shortly. One way in which the two snippets could behave differently is if there is insufficient heap space remaining to create the array, in which case the first snippet will give you an OutOfMemoryError and the second will not. Of course, if a is null, then the first snippet will give you a NullPointerException. But normally, if there's enough heap memory, and if a is not null, then you'd expect these two snippets to behave identically.
answers question: http://stackoverflow.com/q/24421822
type: Answer
score: 5

http://stackoverflow.com/a/24406403
upvote count: 1
has body: Can any one let me know why this object conversion time gradually increase and a better way to convert. ObjectOutputStream creates a lot of garbage and this put a strain on your L3 cache, main memory bus and GC. These are shared resources i.e. the work of one thread impacts all the other. Note: this will be a problem for you whether you have 1 core or 12 cores on a socket. I found a way using Externalization. This may be the simplest solution, if you want to avoid using another serialization liibrary such as Kryo, thrift, protobuf etc. I have one which I claim to be the fastest, but it is definitively not the simplest. e.g. it converts straight from/to native memory and skips the byte[] entirely ;) But then my all objects have to be rewritten with Externalizable. You can start with just one class, i.e. the one which adds the highest load, there is no requirement to do them all.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24406248
type: Answer

http://stackoverflow.com/comment/37664374
has text: @VinayLodha yes, the jars are all there
type: Comment
comment on: http://stackoverflow.com/q/24357956
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37525227
comment on: http://stackoverflow.com/a/24285537
has text: You are giving the list of occupied rooms, when OP asked for free ones (ok, it's just a matter or logical negation ...). But you **do** solve the ovelapping problem
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24301542
tagged with: jersey-2.0
tagged with: jax-rs
score: 0
has comment: http://stackoverflow.com/comment/37555588
tagged with: rest
type: UnansweredQuestion
has body: I am new to jax rs web service. I was studying from this link- http://www.vogella.com/tutorials/REST/article.html Now when I was trying to do my first rest service i faced some errors. This is my service code package de.vogella.jersey.first; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; @Path("/hello") public class Hello { // This method is called if TEXT_PLAIN is request @GET @Produces(MediaType.TEXT_PLAIN) public String sayPlainTextHello() { return "Hello Jersey"; } } My web.xml is <?xml version="1.0" encoding="UTF-8"?> de.vogella.jersey.first index.html index.htm index.jsp default.html default.htm default.jsp Jersey REST Service com.sun.jersey.spi.container.servlet.ServletContainer com.sun.jersey.config.property.packages de.vogella.jersey.first 1 Jersey REST Service /rest/* Now when I was running this code I faced HTTP Status 404 error. Please any one help me. I give all the jars from http://jersey.java.net/ Please help me.
tagged with: web-services
has comment: http://stackoverflow.com/comment/37555613
has comment: http://stackoverflow.com/comment/37555577
tagged with: java
has answer: http://stackoverflow.com/a/24301840
type: Question
has title: How to call rest with jax rs
answer count: 1

http://stackoverflow.com/comment/37512703
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24278811
has text: `Frame frame = (Frame) this.getParent().getParent();` is a bad idea. `Applets` typically live in a browser, to which, you won't be allowed to get direct access to...
score: 0

minecraft
tags question: http://stackoverflow.com/q/24291064
tags question: http://stackoverflow.com/q/24397666
tags question: http://stackoverflow.com/q/24408682
tags question: http://stackoverflow.com/q/24339852
tags question: http://stackoverflow.com/q/24293821
type: Tag
tags question: http://stackoverflow.com/q/24274809
tags question: http://stackoverflow.com/q/24358819
tag name: minecraft

http://stackoverflow.com/comment/37540687
comment on: http://stackoverflow.com/q/24291428
type: Comment
score: 0
has text: Which android version do you use? Real device or emulator?
type: QuestionComment

variables
tag name: variables
tags question: http://stackoverflow.com/q/24288566
tags question: http://stackoverflow.com/q/24409550
type: Tag
tags question: http://stackoverflow.com/q/24338551
tags question: http://stackoverflow.com/q/24350683
tags question: http://stackoverflow.com/q/24320366
tags question: http://stackoverflow.com/q/24370484

http://stackoverflow.com/a/24385826
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24385571
answers question: http://stackoverflow.com/q/24385571
upvote count: 2
has body: Java arrays are directly derived from java.lang.Object and thus inherit the methods equals and hashCode from it. The default equals method compares object identity (i.e. whether two references refer to the same object), and the default hashCode method will most probably return different values for different objects. In most cases, this is a behavior that you do not want. You most probably want to compare arrays based on the content. Note, that your equals method seems to do that, which in turn means that your hashCode method is broken. Look at the method's documentation for the reason. Java provides a class with helper methods for exactly that reason: java.util.Arrays. It provides the methods equals and hashCode that are both based on the content of the array. So you should write it like that: public class SomeObject { private String a; private char[] b; @Override public boolean equals(Object anotherObject) { if (!(anotherObject instanceof SomeObject)) { return false; } SomeObject object = (SomeObject) anotherObject; return (this.a.equals(object.a) &amp;&amp; Arrays.equals(this.b, object.b)); } @Override public int hashCode() { return (43 * this.a.hashCode() + 11 * Arrays.hashCode(this.b)); } }
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/37676871
type: Comment
score: 0
has text: have you tried anything? Go to their website, try a quick demo http://ucanaccess.sourceforge.net/site.html and see if it works. I'm not interested in the opinions of anyone who hasn't used these libraries. Those who have used it know exactly what the problem is.
comment on: http://stackoverflow.com/q/24365136
type: QuestionComment

http://stackoverflow.com/comment/37597071
type: QuestionComment
has text: ok,i must have a wrong understanding about spring boot,put it in a wrong way.
score: 0
comment on: http://stackoverflow.com/q/24320136
type: Comment

http://stackoverflow.com/q/24382457
has comment: http://stackoverflow.com/comment/37709579
tagged with: charts
has answer: http://stackoverflow.com/a/24383658
accepted answer: http://stackoverflow.com/a/24383658
upvote count: 2
has title: Stacked Bar Chart having upper limit line using jfreechart
answer count: 1
downvote count: 1
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37710248
score: 1
tagged with: java
has body: I'm trying to generate a Stacked Bar Chart having an upper limit for each and every category. The upper limit varies for each and every category and is indicated by a horizontal line. I was able to generate the stacked bar chart but got struck with horizontal line for indicating upper limit. Here is the sample chart. Here is my code for generating stacked bar chart import java.awt.BasicStroke; import java.awt.Color; import java.awt.GradientPaint; import java.awt.Paint; import java.awt.Stroke; import java.io.IOException; import java.io.OutputStream; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartUtilities; import org.jfree.chart.JFreeChart; import org.jfree.chart.LegendItem; import org.jfree.chart.LegendItemCollection; import org.jfree.chart.axis.SubCategoryAxis; import org.jfree.chart.plot.CategoryMarker; import org.jfree.chart.plot.CategoryPlot; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.ValueMarker; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.category.GroupedStackedBarRenderer; import org.jfree.data.KeyToGroupMap; import org.jfree.data.category.CategoryDataset; import org.jfree.data.category.DefaultCategoryDataset; import org.jfree.ui.GradientPaintTransformType; import org.jfree.ui.Layer; import org.jfree.ui.StandardGradientPaintTransformer; public class StackedBarServlet extends HttpServlet{ private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setContentType("image/png"); OutputStream outputStream = response.getOutputStream(); final CategoryDataset dataset = createDataset(); final JFreeChart chart = createChart(dataset); int width = 800; int height = 350; ChartUtilities.writeChartAsPNG(outputStream, chart, width, height); } private CategoryDataset createDatase…
tagged with: jfreechart
type: Question

http://stackoverflow.com/a/24414147
type: Answer
has comment: http://stackoverflow.com/comment/37788258
has comment: http://stackoverflow.com/comment/37782551
answers question: http://stackoverflow.com/q/24413628
score: 0
has body: Base 64 decoding is deterministic: the same input should always result in the same output. So for base 64, the same base 64 string should always return the same byte array. Probably the issue lies in the input, not in the function. Note that you should never use sun internal classes - the API and implementation may change at any time. Use either Guava, Apache Commons Codec or the internal Bouncy Castle codec instead.
has comment: http://stackoverflow.com/comment/37779860
has comment: http://stackoverflow.com/comment/37773298
has comment: http://stackoverflow.com/comment/37782008

http://stackoverflow.com/q/24272901
upvote count: 0
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/37532269
tagged with: jar
has answer: http://stackoverflow.com/a/24288665
has comment: http://stackoverflow.com/comment/37530033
favorite count: 0
has comment: http://stackoverflow.com/comment/37531779
has comment: http://stackoverflow.com/comment/37505867
accepted answer: http://stackoverflow.com/a/24288665
downvote count: 2
tagged with: maven
tagged with: spring
has comment: http://stackoverflow.com/comment/37530237
type: Question
type: AnsweredQuestion
has body: I have a dependancy jar that needs to access files in the resources of the jar as well as the resources of the project I am building that depends on it. I'm not sure if this is a task I need to accomplish or a problem I need to resolve. Both the jar and the current project that depends on it are mine and I can change either or both. They are both maven and spring based. More detail: util.jar -&gt;Base.class -resources -&gt;base-context.xml app -&gt;App extends Base -resources -&gt;app-context.xml To troubleshoot, I can move app-context into the jars resource folder and everything works as expected. I need to merge the classpaths. app/src/test/java/com/my/app/App.class @ContextConfiguration(locations = "classpath:app-context.xml") public class App extends Base {...} util.jar @ContextConfiguration(locations = "classpath:util-context.xml") public abstract class Base extends AbstractTestNGSpringContextTests {...} @contextconfiguration for app.class fails because it cannot locate "classpath:app-context.xml" java.lang.IllegalStateException: Failed to load ApplicationContext ... Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [app-context.xml]; nested exception is java.io.FileNotFoundException: class path resource [app-context.xml] cannot be opened because it does not exist This file does exist and is located in the resources folder for the app. If I copy the app-context.xml file into the util.jar resources folder, the error is resolved, but this workaround is not feasible as a solution.
tagged with: java
has title: my dependant jars cannot find resources on project classpath

http://stackoverflow.com/a/24494156
score: 0
type: AcceptedAnswer
type: Answer
has body: Looks like you need to create a Map that maps pageid : [{rest of details1},{rest of details2},.. ]. Once you have that Map, you can transform it into your desired output. Here is the code that will take your JSONArray (the one in the code above) and turn it into Map&lt;String, JSONArray&gt;. public Map&lt;String, JSONArray&gt; getJsonArrayAsMapOnPageId(JSONArray inputArr) throws JSONException { //Map holding pageid : [{company:"",pageview:"",visitfreq:""}, ... , ...] mappings Map&lt;String, JSONArray&gt; idMap = new HashMap&lt;String, JSONArray&gt;(); for (int i=0; i &lt; inputArr.length(); i++) { JSONObject inputObj = inputArr.getJSONObject(i); String id = inputObj.getString("pageid"); JSONArray jObjList; if (idMap.containsKey(id)) { //append to existing list in the Map jObjList = idMap.get(id); } else { //create new list jObjList = new JSONArray(); } JSONObject newJsonObj = new JSONObject(); newJsonObj.put("company", inputObj.get("company")); newJsonObj.put("pageview", inputObj.get("pageview")); newJsonObj.put("visitfreq", inputObj.get("visitfreq")); jObjList.put(newJsonObj); idMap.put(id, jObjList); } return idMap; } Here is what it'll look like: System.out.println("Map looks like:\n" + pageidMap); Here is what I got: { 200=[ { "company": "C3", "visitfreq": "3", "pageview": "30" } ], 19=[ { "company": "C1", "visitfreq": "2", "pageview": "10" }, { "company": "C2", "visitfreq": "4", "pageview": "20" } ] } I'm not sure exactly in what form (Object, print to output, etc) you want this output to be in, so you can do the final bit of transforming this Map&lt;String, JSONArray&gt; into [{pageid},[{rest of details1},{rest of details2},.. ],{pageid},[{rest of details}] ] without problems.
accepted answer of: http://stackoverflow.com/q/24320330
answers question: http://stackoverflow.com/q/24320330

http://stackoverflow.com/a/24376331
has comment: http://stackoverflow.com/comment/37725686
accepted answer of: http://stackoverflow.com/q/24376024
answers question: http://stackoverflow.com/q/24376024
has body: SAML in general uses the browser to keep a common "session" between two sites. This is done as follows: One site A.org starts a session A in the browser. It sees there is no SAML authentication, and posts to the SAML identity provider. Via the browser with automatic form submission (JavaScript), The identity provider sees there is no SSO session, does a login form After login form it posts back to the site A.org with an SSO session ID (so to say). If the same browser now on Site B.net starts a new session B, it again posts to the SAML identity provider, which now has an existing SSO session ID to return. The form posted to the SAML identity provider is automatically posted back, and the returned authentification is also an automatically posted form.A kinde of cross-site scripting. A SAML servlet filter could accept this result and put a UserPrinciepal in the application request. The configuration is not too difficult. You need your own unique key pair for your "server", All-in-all it was rather time consuming. It helped to set up ones own Identity Provider too. Apache Shiro, a security solution outside the Java EE server world, did not have a SAML solution at the time I worked on SAML. If you got a demo IdP and SP running, it should not be too difficult to short-cut everything. Maybe using FireFox with the TamperData add-on to inspect the communication.
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37724234

http://stackoverflow.com/comment/37789183
score: 0
type: Comment
type: QuestionComment
has text: @ccheneson anyway, this change did not help, thank you. I tried your suggestion with German locale. "de", "DE" worked but "ger","DE" did not work.
comment on: http://stackoverflow.com/q/24424164

http://stackoverflow.com/comment/37765886
has text: Based on the answers so far, I doubt that there is a general and efficient solution. Most answers aim at boolean term minimization and solvers, but these tend to involve 2^n terms for n variables, and/or require exponential time. One approach that could be "useful" based on the description so far could be to limit the implication checks to a certain number of rules. It is tremendously hard (i.e. practically impossible) to check whether rule 1000 is implied by any combination of the first 999 rules. But it would be feasible to check whether it is implied by, say, *any 3* of the first 999 rules
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24368791
score: 0

http://stackoverflow.com/comment/52367698
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/32239974
has text: There is one difference between between `requestContext.getUriInfo().getQueryParameters()` and `servletRequest.getParameterMap()`. The latter will also contain parameters of posted form data. I would agree that in this example the former makes more sense. Thanks!

http://stackoverflow.com/comment/37511889
has text: I already used this in my code before the @overide private MultiCurrencyPOJO currencypojo; and used this for instanciation public void multiCurrencyPOJO(MultiCurrencyPOJO currencypojo){ this.currencypojo=currencypojo; }
type: Comment
comment on: http://stackoverflow.com/a/24278552
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37514155
has text: I already posted the updated question, along with the full log of the error
comment on: http://stackoverflow.com/a/24277864
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37689746
type: Comment
has text: I am using Eclipse Juno, JUnit, maven 2.2 versions. As i've right clicked on test case mathod and getting the output as above. JUnit configuration is correct for other Test class.
comment on: http://stackoverflow.com/a/24370900
score: 0
type: AnswerComment

http://stackoverflow.com/q/24318879
has comment: http://stackoverflow.com/comment/37588633
has comment: http://stackoverflow.com/comment/37588797
answer count: 1
has answer: http://stackoverflow.com/a/24319055
tagged with: windows
has body: How doe we monitor a folder in Windows network from unix server using camel file component? When I run my program from Windows it works fine but when I deploy my jar on unix server it doesnt read the windows filepath.
tagged with: unix
type: AnsweredQuestion
score: 0
accepted answer: http://stackoverflow.com/a/24319055
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37588724
has title: Monitor folder on windows network from unix server using camel file component
has comment: http://stackoverflow.com/comment/37588756
tagged with: apache-camel

asteriskami
tags question: http://stackoverflow.com/q/24358069
tag name: asteriskami
type: Tag
tags question: http://stackoverflow.com/q/24362698

http://stackoverflow.com/q/24336151
has comment: http://stackoverflow.com/comment/37621762
answer count: 1
tagged with: jdbc
has comment: http://stackoverflow.com/comment/37621946
favorite count: 0
tagged with: netbeans
has comment: http://stackoverflow.com/comment/37621450
downvote count: 2
has title: refresh Jtable after inserting new row
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37622160
has answer: http://stackoverflow.com/a/24336568
has comment: http://stackoverflow.com/comment/37621587
tagged with: java
type: Question
has body: I have a jTable that is initialized thorough "right click> table content > bound > Import data to form " , and then the columns are shown from "right click>bind > elements". I have a insert form inside that form too and I want to refresh the jTable after inserting a new row. how should I do it?
upvote count: 0
score: -2
tagged with: derby
accepted answer: http://stackoverflow.com/a/24336568
tagged with: jtable

http://stackoverflow.com/comment/37666771
type: QuestionComment
has text: gtoAddedDate is a Db column of timestamp type
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24354542

http://stackoverflow.com/q/24317800
tagged with: database
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37586459
type: Question
score: 0
tagged with: encryption
answer count: 1
has title: Hide passwords for MySQL
tagged with: passwords
has comment: http://stackoverflow.com/comment/37586963
has comment: http://stackoverflow.com/comment/37586457
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/24319011
has body: I've found many questions on this topic, and many answers, but none that suited my situation. If I have missed one or two, feel free to refer me to a suitable one. Please bare in mind that I only have basic knowledge of Java, and am always willing to learn new things, as long as they are properly explained. I recently started writing a Java Application, requiring a secure login. I figured the best way to do this (for multiple users) was to use a MySQL database on a server I had full access to (in other words, my RaspBerry Pi). I've got the database set up correctly, and have created the user account I wish to use for the purpose of requesting data. When the user opens the application, it checks whether the application has access to the internet (by pinging multiple websites), and whether the application has access to the server (by pinging the server itself). The location of the server and database can be disclosed. When both connections are confirmed, the application will start, asking the user for a username and a password, stored in the MySQL database. The real problem is connecting to the database, without having people find other people's passwords. I don't want some kid to decompile my application and get all of the usernames and passwords stored in the database. How will I securely gain access to my database (meaning, how will I connect to it without the username and password being visible)? I'm also hoping to store the passwords in the database in encrypted form, decrypting them after they are retrieved. The most important issue is making sure nobody can decompile the application, find out how I did it, and do it themselves, giving them all the information I tried to hide.

http://stackoverflow.com/q/24371940
type: Question
tagged with: jersey
downvote count: 0
tagged with: jersey-2.0
has comment: http://stackoverflow.com/comment/37800214
has comment: http://stackoverflow.com/comment/37797773
has comment: http://stackoverflow.com/comment/37800758
has body: We've been running jersey in production for a while now and noticed recently that we started leaking memory. When digging we discovered that starting in HK2 2.3.0 there was a injecteeToResolverCache added to the HK2 class (org.jvnet.hk2.internal.ServiceLocatorImpl.class) Here's the line from the ServiceLocatorImpl.class private final Cache&lt;Injectee, InjectionResolver&lt;?&gt;&gt; injecteeToResolverCache = new Cache&lt;Injectee, InjectionResolver&lt;?&gt;&gt;(new Computable&lt;Injectee, InjectionResolver&lt;?&gt;&gt;() In our setup we're using jersey 2.9 (hk 2.3.0) and we have resource methods that use @BeanParam that look something like this : public CustomResponse getStuff( @BeanParam Paging paging, @BeanParam CustFilter filter){... What seems to be happening is that HK2 2.3.0 is caching each instance of anything marked as a BeanParameter as an Injectee in the injecteeToResolverCache. Since new instances of "paging" and "filter" BeanParams are created on every call to the "getStuff" resource there are 2 new entries added to the cache on every call. We wound up with over 10 million entries in this cache before things started falling apart. Has anyone else run into this or are we using the framework incorrectly ? For now we've downgraded to jersey 2.8 and that seems to be working since it depends on 2.2.0 of Hk2 which doesn't have the injectee cache. Thanks! Kris
has title: Memory leak in between Jersey @BeanParam and HK2 ServiceLocatorImpl
answer count: 1
tagged with: hk2
favorite count: 0
has answer: http://stackoverflow.com/a/24516751
has comment: http://stackoverflow.com/comment/37797739
upvote count: 2
accepted answer: http://stackoverflow.com/a/24516751
type: AnsweredQuestion
score: 2
tagged with: java

http://stackoverflow.com/comment/37608082
score: 0
type: Comment
has text: @PrashantOnkar Please mark it as the accepted answer, so it won't be listed as unanswered anymore.
type: AnswerComment
comment on: http://stackoverflow.com/a/24329299

http://stackoverflow.com/a/24367375
has comment: http://stackoverflow.com/comment/37681422
has comment: http://stackoverflow.com/comment/37681261
accepted answer of: http://stackoverflow.com/q/24366785
upvote count: 1
answers question: http://stackoverflow.com/q/24366785
type: AcceptedAnswer
has body: the first approach might lead to duplication of data in cases where the data can be reused. But not in the case you mention. An int is 4 bytes, a reference is typically 4-bytes so you don't gain anything by using Integer. For a more complex type, it can make a big difference however. Is there a way to have them located close to each other in memory so that the parent object and its' containing elements will be in the CPU cache at once and not distributed arbitrarily over the whole memory plus the GC will keep them together? The GC will do this anyway, provided the objects are only used in one place. If the objects are used in multiple places, they will be close to one reference. Note: this is not guaranteed to be the case, however when allocating objects they will typically be continuous in memory as this is the simplest allocation strategy. When copying retained objects, the HotSpot GC will copy them in reverse order of discovery. i.e. they are still together but in reverse order. Note 2: Using 4 bytes for an int is still going to be more efficient than using 28 bytes for an Integer (4 bytes for reference, 16 bytes for object header, 4 bytes for value and 4 bytes for padding) Note 3: Above all, you should favour clarity over performance, unless you have measured you need and have a more performant solution. In this case, an int cannot be a null but an integer can be null. If you want a value which should not be null use int, not for performance but for clarity.
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/24269959
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/103526326
score: 2
has body: I am currently trying to optimize the performance of a small application which loads a lot of data from the Database. I use standard JPA with Hibernate and Oracle as Database. I have a ServiceClass with a getAllData method which simply executes a named query loadAllData. FirstResult and MaxResult can also be set to limit data. The default value for fetchSize from the Oracle JDBC driver is 10, so I manually set it to 100 via q.setHint("org.hibernate.fetchSize", 100) to improve the performance when processing the ResultSet. The problem is that the hint only works for the entities which are loaded directly by this query, but not for the relations (ManyToMany/OneToMany) which are resolved eager or lazy! ServiceClass: public class ServiceClass { @Inject EntityManager entityManager; public List&lt;Data&gt; getAllData(Integer limit, Integer offset) { Query q = entityManager.createNamedQuery("loadAllData", Data.class); if (limit != null &amp;&amp; offset != null) { q.setFirstResult(offset); q.setMaxResults(limit); } q.setHint("org.hibernate.fetchSize", 100); List&lt;Data&gt; result = q.getResultList(); return result; } } Data entity: @Entity @Table(name="DATA") @NamedQuery(name = "loadAllData", //hints=@QueryHint(name=QueryHints.FETCH_SIZE, value="100"), query = "SELECT d FROM Data d LEFT JOIN FETCH d.dataA ORDER BY d.dataId") public class Data { @Id @Column(name="DATA_ID") private String dataId; @ManyToOne @JoinColumn(name = "A_ID") @BatchSize(size = 100) private A dataA; @OneToMany @JoinColumn(name = "DATA_ID") @BatchSize(size = 100) private Set&lt;B&gt; dataSetB; @ManyToMany @JoinTable(name = "DATA_C", joinColumns = { @JoinColumn(name = "DATA_ID") }, inverseJoinColumns = { @JoinColumn(name = "C_ID") }) @BatchSize(size = 100) private Set&lt;C&gt; dataSetC; } The debug output shows that the hint works fine if the Data object + A object is loaded: 15:55:11.337 [http-bio-8080-exec-3] DEBUG org.hibernate.loader.Loader - Result set row: 0 15:55:11.342 [http-bio-8080-exec-3] DE…
tagged with: performance
tagged with: many-to-many
answer count: 0
downvote count: 0
tagged with: java
tagged with: hibernate
type: Question
upvote count: 2
has title: JPA fetchSize not working for relations (ManyToMany/OneToMany) loaded lazy or eager
tagged with: jpa
has comment: http://stackoverflow.com/comment/103810104

http://stackoverflow.com/q/24396898
linked to: http://stackoverflow.com/q/18946657
answer count: 1
duplicate of: http://stackoverflow.com/q/18946657
type: UnansweredQuestion
tagged with: interface
has body: I am trying to do a 2d grid/array where each cell is a set. For the purpose I use the following code as an example List&lt;Set&lt;Integer&gt;&gt; grid = new ArrayList&lt;Set&lt;Integer&gt;&gt;(); // In this line Set is underlined as error grid.add(new Set&lt;Integer&gt;()); grid.get(0).add(2); but it says - "Cannot instantiate the type Set". Basically I want to instantiate a new list dimension and to each of this dimension the cells should be sets? And then comes the question how do I iterate efficiently through this grid?
has answer: http://stackoverflow.com/a/24396918
score: 0
tagged with: java
tagged with: set
tagged with: collections
type: Question
tagged with: arrays
has title: create 2d list of sets

http://stackoverflow.com/a/24383996
has comment: http://stackoverflow.com/comment/37712326
score: -1
has comment: http://stackoverflow.com/comment/37713863
has comment: http://stackoverflow.com/comment/37712442
downvote count: 1
has comment: http://stackoverflow.com/comment/37712098
has body: Try this one : public static boolean isUrl(String str){ Pattern urlPattern = Pattern.compile("((https?|ftp|gopher|telnet|file):((//)|(\\\\\\\\))+[\\\\w\\\\d:#@%/;$()~_?\\\\+-=\\\\\\\\\\\\.&amp;]*)",Pattern.CASE_INSENSITIVE); Matcher matcher = urlPattern.matcher(str); if (matcher.find()) return true; else return false; }
answers question: http://stackoverflow.com/q/24383886
has comment: http://stackoverflow.com/comment/37713119
has comment: http://stackoverflow.com/comment/37711986
upvote count: 0
has comment: http://stackoverflow.com/comment/37712064
has comment: http://stackoverflow.com/comment/37713499
has comment: http://stackoverflow.com/comment/37834190
type: Answer

http://stackoverflow.com/comment/37737935
has text: Have you tried using the debugger?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24397571
score: 3

http://stackoverflow.com/q/24331559
tagged with: parsing
favorite count: 0
tagged with: scala
type: UnansweredQuestion
tagged with: regex
has title: Parsing Java Classnames From Source File using Javascript
upvote count: 0
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24331727
tagged with: javascript
score: -1
linked to: http://stackoverflow.com/q/5993769
has body: Given a source file (Java / Scala), how do I parse out the class name of the source file using Javascript? Specifically, user enters source code into a browser-based editor. I would like to parse out the class names from the source text. For example: var sourceText = class TestClass extends MyClass{ // do something } class TestClass2 extends MyParentClass2 { } class TestClass3 extends MyParentClass3 { } How do I write this function: parseClassNameFromSourceText: function (sourceText) { } such that if I passed in the above source text, it will produce [TestClass, TestClass2, TestClass3]?
answer count: 1
has comment: http://stackoverflow.com/comment/37612455

http://stackoverflow.com/q/24312047
type: Question
has answer: http://stackoverflow.com/a/24313676
upvote count: 0
score: -1
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24313676
tagged with: android
downvote count: 1
type: AnsweredQuestion
tagged with: java
has title: transfer image from activity to adapter class
has body: This is my activity A case R.id.buttonSaveAdd: EditText editTextTitle = (EditText) findViewById(R.id.editTextTitle); EditText editTextDes = (EditText) findViewById(R.id.editTextDescription); EditText editTextOwner = (EditText) findViewById(R.id.editTextOwnerName); EditText editTextOwnerEmail = (EditText) findViewById(R.id.editTextOwnerEmail); EditText editTextPrice = (EditText) findViewById(R.id.editTextPrice); //populating data object from the values received //from view String title = editTextTitle.getText().toString(); String description = editTextDes.getText().toString(); String ownerName = editTextOwner.getText().toString(); String ownerEmail = editTextOwnerEmail.getText().toString(); String pricce = editTextPrice.getText().toString(); Advertisement object = new Advertisement(title, description, ownerName, ownerEmail, "ic_launcher", Integer.parseInt(pricce), 100); Button_mak.ads.add(object); this.finish(); break; } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RESULT_LOAD_IMAGE &amp;&amp; resultCode == RESULT_OK &amp;&amp; null != data) { Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String picturePath = cursor.getString(columnIndex); cursor.close(); ImageView imageView10 = (ImageView) findViewById(R.id.creatae); imageView10.setImageBitmap(BitmapFactory.decodeFile(picturePath)); //// I want to send this image to my adapter class. This is my adapter class public class MyAdapter extends ArrayAdapter&lt;Advertisement&gt; implements OnClickListener { public static int totalBill = 0; private final Context context; private final Advertisement[] values; public MyAdapter(Context context, Advertisement[] values) { super(context, R.…

http://stackoverflow.com/q/24356319
accepted answer: http://stackoverflow.com/a/24356368
has body: I'm trying to configure log4j to log messages to a file. Right now, the file does get created with the name I provide, but the logs are not written to the file. My code: public class Main extends Application { private static Logger logger = Logger.getLogger( Main.class.getName() ); @Override public void start(Stage primaryStage) throws Exception { logger.warning("test"); logger.severe("oh noes"); } public static void main(String[] args) { launch(args); } } Contents of my log4j.properties file: # Root logger option log4j.rootLogger=INFO, file, stdout # Direct log messages to a log file log4j.appender.file=org.apache.log4j.RollingFileAppender log4j.appender.file.File=log.log log4j.appender.file.MaxFileSize=1024MB log4j.appender.file.MaxBackupIndex=1 log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n When I run this, I get this output in the console: Jun 23, 2014 3:19:16 AM com.foo.Main start WARNING: test Jun 23, 2014 3:19:16 AM com.foo.Main start SEVERE: oh noes The file log.log does get created in my main directory. But its empty. Any ideas what I'm doing wrong? I'm using log4j version 1.2.17.
type: Question
has title: Log4J creates log file but does not write to it
possible better answer: http://stackoverflow.com/a/56085897
upvote count: 14
answer count: 4
tagged with: log4j
favorite count: 0
has answer: http://stackoverflow.com/a/50873627
has comment: http://stackoverflow.com/comment/37660306
downvote count: 0
has answer: http://stackoverflow.com/a/56085897
tagged with: logging
score: 14
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/70510948
tagged with: java
has answer: http://stackoverflow.com/a/24356368

http://stackoverflow.com/comment/125183680
has text: @Stephan: Usually there's *something* at the top level which will log the error before the process terminates... at which point you'll have a stack trace. The exact details depend on the application. (For a console application, it just happens automatically, for example - just logging to stderr.)
type: AnswerComment
comment on: http://stackoverflow.com/a/24344547
score: 0
type: Comment

http://stackoverflow.com/a/24277478
score: 0
has comment: http://stackoverflow.com/comment/37510163
has comment: http://stackoverflow.com/comment/37511269
has comment: http://stackoverflow.com/comment/37511832
type: Answer
has comment: http://stackoverflow.com/comment/37511529
answers question: http://stackoverflow.com/q/24277427
has comment: http://stackoverflow.com/comment/37511186
has body: SerialPort is a subclasse of CommPort. Unless you know for a fact that the variable declared as CommPort contains a SerialPort instance, your cast will compile correctly but fail at run time with an invalid cast exception. Indeed, casting a variable to its subclass is always valid at compile time but casting an instance of a class to an instance of a subclass is not valid and will fail at run time. [EDIT] From the documentation, it appears that the returned objects from getPortIdentifiers are instances of either SerialPort or ParallelPort. Accordingly the cast ti SerialPort will work provided the returned object is indeed a SerialPort and not a ParallelPort. Add an if statement to ensure you are getting a SerialPort instance and not something else. To do that, you can use getPortType method. See http://docs.oracle.com/cd/E17802_01/products/products/javacomm/reference/api/javax/comm/CommPortIdentifier.html#getPortType() Instead of picking up the last serial port in the list, you may want to check the name of the port using getName() or use a file descriptor to open a specific port. while (portList.hasMoreElements()) { portId = (CommPortIdentifier)portList.nextElement(); System.out.println("portId=" + portId); if (portId.getPortType () == CommPortIdentifier.PORT_SERIAL) break; }

http://stackoverflow.com/a/24295798
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37545561
answers question: http://stackoverflow.com/q/24295487
has body: at a glance, it seems like your scoping is off. The variable p in for (int j=0; j&lt;t; j++) { String p[j] = x.nextLine(); } is declared and then immediately discarded. You probably want something more like String[] p = new String[t]; for (int j=0; j&lt;t; j++) { p[j] = x.nextLine(); } similarly with q in the loop below int q = 0; for (int j=0; j&lt;p.length; j++) { for (int k=0; k&lt;p.length; k++) { if (p[j] = reverse(p[k])) { q = p[k].length(); System.out.println(""+q+((q/2)+1)); } } } Hope this helped. more information about variable scope in Java: variable scope

http://stackoverflow.com/a/24311303
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24307634
has comment: http://stackoverflow.com/comment/37582899
has body: see the camel-solr unit tests for some complete examples....SolrComponentTestSupport basically this... @BeforeClass public static void beforeClass() throws Exception { // Set appropriate paths for Solr to use. System.setProperty("solr.solr.home", "src/test/resources/solr"); System.setProperty("solr.data.dir", "target/test-classes/solr/data"); // Instruct Solr to keep the index in memory, for faster testing. System.setProperty("solr.directoryFactory", "solr.RAMDirectoryFactory"); // Start a Solr instance. solrRunner = new JettySolrRunner("src/test/resources/solr", "/solr", getPort()); solrRunner.start(); solrServer = new HttpSolrServer("http://localhost:" + getPort() + "/solr"); } @AfterClass public static void afterClass() throws Exception { if (solrRunner != null) { solrRunner.stop(); } }
accepted answer of: http://stackoverflow.com/q/24307634
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37605943

http://stackoverflow.com/a/24362667
has body: Time JodaTime - common used Time API. Time in Java 8 - new JDK 8 DateTime API. Very similar to Joda. Money JodaMoney -common Money API
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24359582
score: 1
downvote count: 0

http://stackoverflow.com/comment/37585321
type: Comment
type: QuestionComment
has text: "i don't actually store my data in an array" -- then what are you storing it in **in memory**? It's nice that you are persisting it in a CSV file, but that is not what your `ListAdapter` is using.
score: 0
comment on: http://stackoverflow.com/q/24317217

http://stackoverflow.com/comment/37543672
comment on: http://stackoverflow.com/q/24294189
type: Comment
has text: It is better to paste the code, not screenshots of it ;)
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37612502
type: QuestionComment
has text: What is a theoretical carry?
score: 0
comment on: http://stackoverflow.com/q/24331636
type: Comment

http://stackoverflow.com/comment/37633215
has text: Thats fine...I can use `removeAttribute` as well or some other options that I use in a simple Servlet Application but my question is why is the above example not working. Please let me know on this.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24342687
score: 0

http://stackoverflow.com/q/24380155
tagged with: encryption
has comment: http://stackoverflow.com/comment/37705734
has body: I have strucked at this issue java.security.NoSuchAlgorithmException: cannot find any provider supporting AES . Cipher c = Cipher.getInstance("AES"); SecretKeySpec k = new SecretKeySpec(key, "AES"); I am using jdk1.6.0_45 64 bit . Does version is the problem for this or any other. Before I got an error "illegal key size or default parameters java" and then it was resolved with by adding these things in environmental variables. I had set JAVA_HOME &amp; classpath with local_policy &amp; US_export_policy . Can any help me out of this issue.
score: 1
tagged with: java
type: Question
upvote count: 2
answer count: 1
has title: java.security.NoSuchAlgorithmException:cannot find any provider supporting AES
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24404347
type: UnansweredQuestion

http://stackoverflow.com/a/24367108
answers question: http://stackoverflow.com/q/24366985
has comment: http://stackoverflow.com/comment/37693787
has comment: http://stackoverflow.com/comment/37680298
score: 0
has comment: http://stackoverflow.com/comment/37686648
type: Answer
has comment: http://stackoverflow.com/comment/37680353
has body: hmmm why don't you just mapping instead? Something like this public void foo(Map&lt;String,Integer&gt; map){ } Or maybe instead of String and int, just use objects? public void foo(Object... args){ }

http://stackoverflow.com/a/24309577
type: Answer
has body: Instead of: boolean b = m.matches(); use: boolean b = m.find(); As Matcher#matches returns true only when it matches full input from start to end.
score: 3
upvote count: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24309488
has comment: http://stackoverflow.com/comment/37570799
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24309488

http://stackoverflow.com/comment/37707338
has text: The compiler does not treat `Void` like `void`. It treats it like any other class, so you need to return some instance of `Void` (of which there are none), or failing that, `null`.
type: AnswerComment
comment on: http://stackoverflow.com/a/24381343
type: Comment
score: 7

http://stackoverflow.com/comment/37546255
comment on: http://stackoverflow.com/q/24296326
type: QuestionComment
type: Comment
has text: Thanks @SotiriosDelimanolis, yes, it is for compile time
score: 0

http://stackoverflow.com/comment/37594788
comment on: http://stackoverflow.com/a/24321848
score: 0
type: AnswerComment
has text: At least the root cause is fixed? Just debug your code It's very easy to find the problem.
type: Comment

http://stackoverflow.com/q/24388542
upvote count: 3
favorite count: 0
tagged with: google-http-client
tagged with: access-token
answer count: 0
has title: Is the Google API for the id token too slow for some cases?
tagged with: google-api
type: UnansweredQuestion
tagged with: android
score: 3
tagged with: java
type: Question
has body: Since recently I didn't have any problems to obtain an id token and use it, but since maybe two weeks obtaining a new token (deleting the old and obtaining a new one) and verifying it doesn't work properly. I have an android app on the client side and a java-servlet on the server-side. The verification is done like described here. The client obtains a token with the GoogleAuthUtil.getToken() method. There is no problem obtaining a new token and verifying it. The problem occurs when I try to clear the old token with GoogleAuthUtil.clearToken() and obtain a new token. The verification fails. Checking on https://www.googleapis.com/oauth2/v1/tokeninfo?id_token= shows me that the token is valid. After resending the same token manually to the backend verifiers the token succesfully. It seems like the google api takes longer to aknowledge the new token then the call from my client to backend. Or is my code incorrect? What I don't get that the problem occured suddenly. Thank You EDIT: Found the problem. It wasn't with the api. The problem was that the server time was behind. After syncronizing the clock everything seems to work.
downvote count: 0

http://stackoverflow.com/a/24411723
has comment: http://stackoverflow.com/comment/37765641
has comment: http://stackoverflow.com/comment/37765273
has comment: http://stackoverflow.com/comment/37765194
downvote count: 0
has comment: http://stackoverflow.com/comment/37764636
has comment: http://stackoverflow.com/comment/37765542
has comment: http://stackoverflow.com/comment/37765356
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/37764479
has comment: http://stackoverflow.com/comment/37764312
upvote count: 3
has body: Model attributes, ex. from @ModelAttribute annotated parameters, are not beans. They are not managed by the BeanFactory / ApplicationContext. They are created by the DispatcherServlet's MVC stack and provided to you. There's no concurrency issue (unless you create one) because a Servlet container handles each request in a single thread.
has comment: http://stackoverflow.com/comment/37764243
has comment: http://stackoverflow.com/comment/37765353
has comment: http://stackoverflow.com/comment/37764910
has comment: http://stackoverflow.com/comment/37765749
answers question: http://stackoverflow.com/q/24411149
has comment: http://stackoverflow.com/comment/37764533
has comment: http://stackoverflow.com/comment/37765458

http://stackoverflow.com/comment/37617288
comment on: http://stackoverflow.com/q/24333944
has text: His answer can be used. Compare the end of the string to a vector of punctuation marks. If it's true then return it. He's suggesting that you create a method so you can reuse it and use a control flow to iterate through the vector.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24354921
has body: I made a simple program where you will just click on a button and a .wav song will play. I made a folder called wav where I store to music. When i make this a runnable jar file I want the music to be part of the program, also I would like a way to change the path of the song so it will take it from the jar file and not a library. My code is: package music; import javax.swing.JButton; import javax.swing.JFrame; public class Music { public static void main(String[] args) { // TODO Auto-generated method stub JFrame j = new JFrame(); JButton b = new JButton("Set sail"); j.add(b); b.addActionListener( new AL()); j.setVisible(true); j.pack(); j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }} public class AL implements ActionListener { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub InputStream in; try { String wav = "C:\\Users\\Mike\\workspace\\music\\wav\\One.wav"; in = new FileInputStream(wav); AudioStream audio = new AudioStream(in); AudioPlayer.player.start(audio); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); }}} So basically I want the .wav file to be a part of my runnable jar file for playing and what the new path name would be for it.
has answer: http://stackoverflow.com/a/24354985
score: 0
answer count: 1
has title: How to add own audio to a jar file when you export it
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: audio
tagged with: java
tagged with: eclipse
downvote count: 1
type: Question
tagged with: pathname
tagged with: jar

http://stackoverflow.com/a/24381571
has body: Both the definations are correct.. widget is a view.. while developing we see textview,imageview etc which are created for the developers to use.. the widgets we see on the homescreen are developed by the developerss for the users to use .. Shortly widgets are those which are created for developers and also created by developers..:)
type: Answer
answers question: http://stackoverflow.com/q/24381362
score: 0

http://stackoverflow.com/a/24399670
type: AcceptedAnswer
downvote count: 0
has body: The uncaught exception handler is not meant for rescuing an application. Ending up in that handler means the thread is being terminated. The handler gets notified as a courtesy for logging purposes before the thread is killed. Implemented by objects that want to handle cases where a thread is being terminated by an uncaught exception. Upon such termination, the handler is notified of the terminating thread and causal exception. If there is no explicit handler set then the thread's group is the default handler.
answers question: http://stackoverflow.com/q/24399571
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/24399571

http://stackoverflow.com/comment/37500244
has text: possible duplicate of [Case sensitive Search in Hibernate Criteria](http://stackoverflow.com/questions/11030921/case-sensitive-search-in-hibernate-criteria)
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24269834

http://stackoverflow.com/q/24371465
type: Question
has comment: http://stackoverflow.com/comment/37688694
has comment: http://stackoverflow.com/comment/37702036
has body: I've been trying to set up my machine to run phantomjs with Selenium WebDriver and java from Eclipse. I've been able to run phantomjs from the commandline(installed globally with npm), so I'm pretty sure I'm just not setting it up correctly through Eclipse. Here is a snippet of how I'm calling phantomjs in my test code: @Before public void setUp() throws Exception { dCaps = new DesiredCapabilities(); dCaps.setJavascriptEnabled(true); dCaps.setCapability("takesScreenshot", false); dCaps.setCapability("phantomjs.binary.path", "/usr/local/lib/node_modules/phantomjs/bin/phantomjs"); driver = new PhantomJSDriver(dCaps); baseUrl = "http://assertselenium.com/"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } Before I run the test from Eclipse, do I need to manually start phantomjs or the selenium server? Are there certain files that should be included in the bootstrap classpath?
downvote count: 0
has comment: http://stackoverflow.com/comment/57312553
has title: Running phantomjs using Selenium WebDriver and java in Eclipse
has comment: http://stackoverflow.com/comment/37701989
favorite count: 0
type: UnansweredQuestion
tagged with: phantomjs
answer count: 0
score: 1
tagged with: java
tagged with: selenium
upvote count: 1
tagged with: eclipse
tagged with: webdriver

http://stackoverflow.com/a/24361775
score: 0
has comment: http://stackoverflow.com/comment/37671350
accepted answer of: http://stackoverflow.com/q/24361560
has body: There are some java libraries you can use to manage log files the most popular log4j. So if you can edit the source code, this library can help achieve what you want. Besides that there are some tools that can handle large log files and give you search functionnality, edit reports and so on. try look for splunk, elasticsearch, kibana ..
answers question: http://stackoverflow.com/q/24361560
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/37515964
type: AnswerComment
has text: I get this error as I add this line: 'private List<Sprite> huisArray = new ArrayList<Sprite>;' Multiple markers at this line - Syntax error on token(s), misplaced construct(s) - Watchpoint:Papermadness [access and modification] - huisArray
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24274728

http://stackoverflow.com/a/24374383
type: Answer
has comment: http://stackoverflow.com/comment/37695022
downvote count: 0
has body: They are both parts of the same ecosystem. The 'Java' you see in the Windows Control Panel is a Setting Option for the Java Virtual Machine, which is installed on your PC. A virtual machine understands its own bytecode and translates it for your CPU. The 'Java' programming language is a computer programming language which allows you to write programs on top of this virtual machine. Java programs are compiled into Java bytecode and then executed by the JVM.
upvote count: 8
has comment: http://stackoverflow.com/comment/37695055
answers question: http://stackoverflow.com/q/24374303
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24374303
score: 8

http://stackoverflow.com/comment/37777403
score: 0
type: AnswerComment
type: Comment
has text: Thanks for all help. I created my implementation and it's working (sort of). I don't know why this mapping is not giving me desired results: class1{class2.class3{class4{class5.name}}} ---> should this map to Set<class1>.class2.List<class3>.List<class4>.class5.name ? I have an error saying that getClass3 is not found in class1
comment on: http://stackoverflow.com/a/24355696

http://stackoverflow.com/comment/37683710
has text: An example, no. In essence when you're constructing your graph, at some point you will have just constructed your node object, and so you'll have at hand the node and its ID; put them in a map at that point. Offhand the easiest way to do this would probably be to have your node class have a static Map instance inside it. This would also imply that findNode() itself should be a static method of your node class.
type: AnswerComment
comment on: http://stackoverflow.com/a/24368614
score: 0
type: Comment

scala
tags question: http://stackoverflow.com/q/24332596
tags question: http://stackoverflow.com/q/24333252
tags question: http://stackoverflow.com/q/24418068
tags question: http://stackoverflow.com/q/24334549
tags question: http://stackoverflow.com/q/24367879
tags question: http://stackoverflow.com/q/24417103
tags question: http://stackoverflow.com/q/24359359
tags question: http://stackoverflow.com/q/24376870
tags question: http://stackoverflow.com/q/24331815
tags question: http://stackoverflow.com/q/24397459
tags question: http://stackoverflow.com/q/24339011
tags question: http://stackoverflow.com/q/24404802
tags question: http://stackoverflow.com/q/24329597
tags question: http://stackoverflow.com/q/24388995
tags question: http://stackoverflow.com/q/24337223
tags question: http://stackoverflow.com/q/24394637
tags question: http://stackoverflow.com/q/24369113
tags question: http://stackoverflow.com/q/24407600
tags question: http://stackoverflow.com/q/24331559
tags question: http://stackoverflow.com/q/24415698
tags question: http://stackoverflow.com/q/24335343
tag name: scala
tags question: http://stackoverflow.com/q/24416480
tags question: http://stackoverflow.com/q/24362337
tags question: http://stackoverflow.com/q/24349517
tags question: http://stackoverflow.com/q/24409171
tags question: http://stackoverflow.com/q/24370336
tags question: http://stackoverflow.com/q/24357059
tags question: http://stackoverflow.com/q/24310889
tags question: http://stackoverflow.com/q/24321584
type: Tag
tags question: http://stackoverflow.com/q/24398781
tags question: http://stackoverflow.com/q/24268219

http://stackoverflow.com/comment/37514089
comment on: http://stackoverflow.com/q/24279620
type: QuestionComment
type: Comment
has text: your `printPointOf(...)` function only prints the address of the local variable, or not?
score: 0

http://stackoverflow.com/comment/37541610
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24294079
has text: Your code has nothing to do with `toString()`. What do you mean by `"add final message to toString()?"` And if you're getting errors, you might want to show the error messages to us. Sorry, but yours is a very confusing question. Please ask it as if you are in our shoes, folks who know nothing of what you're trying to do.

http://stackoverflow.com/q/24317766
has body: in my code I have ArrayList&lt;TreeMap&lt;String, Object&gt;&gt;. What TreeMap would have is the key and value. there is a key named sent_date with the value in format of yyyy-MM-DD HH:MM:SS. I can't find a way to sort this list...Can someone please help? thanks.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37587762
tagged with: java
tagged with: treemap
has comment: http://stackoverflow.com/comment/37586990
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/2784514
has comment: http://stackoverflow.com/comment/37587015
accepted answer: http://stackoverflow.com/a/24317819
has title: how can you sort by date for an ArrayList with TreeMap as value
has comment: http://stackoverflow.com/comment/37586429
has comment: http://stackoverflow.com/comment/37586526
has comment: http://stackoverflow.com/comment/37586403
score: 0
has answer: http://stackoverflow.com/a/24318007
has comment: http://stackoverflow.com/comment/37590558
possible better answer: http://stackoverflow.com/a/24318007
has answer: http://stackoverflow.com/a/24317819
tagged with: dictionary

http://stackoverflow.com/a/43099920
upvote count: 0
has body: Check out the jpath API. It's xpath equivalent for JSON Data. You can read data by providing the jpath which will traverse the JSON data and return the requested value. This Java class is the implementation as well as it has example codes on how to call the APIs. https://github.com/satyapaul/jpath/blob/master/JSONDataReader.java Readme - https://github.com/satyapaul/jpath/blob/master/README.md
has comment: http://stackoverflow.com/comment/73281843
answers question: http://stackoverflow.com/q/24412511
score: -1
downvote count: 1
has comment: http://stackoverflow.com/comment/73281549
type: Answer

http://stackoverflow.com/comment/37727911
score: 0
comment on: http://stackoverflow.com/q/24392257
type: Comment
type: QuestionComment
has text: google by key word "no bean named springsecurityfilterchain"

http://stackoverflow.com/comment/37787496
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [How is ambiguity in selecting from overloaded methods resolved in java?](http://stackoverflow.com/questions/2608394/how-is-ambiguity-in-selecting-from-overloaded-methods-resolved-in-java)
comment on: http://stackoverflow.com/q/24424211

http://stackoverflow.com/a/24333056
score: 0
type: Answer
has body: The two paragraphs in question are describing the nature of detached objects in JPA and correlating them to the concept of serializability. Once an object gets into detached state (i.e is no longer associated with an entity manager), it needs a way to reattach itself to a live session. If the object wants to attach itself to an entity manager this is usually done using the .merge() operation. What they mean when they say Objects must be able to be moved from one virtual machine to another and then back again, and must still be usable by the application. is that if you require your object to be sent over through a remote interface like over HTTP to another application or to a different tier, the object needs a way to move between the applications and to be able to retain its state. The way to accomplish this is to serialize the object and then send it over the wire - and when it is received on the other end it is reconstructed using the object definition. Then the object needs to attache itself to an entity manager so that it can be persisted. This is what they mean about portability of a detached object.
answers question: http://stackoverflow.com/q/24332649

http://stackoverflow.com/a/24320829
answers question: http://stackoverflow.com/q/24320452
has body: You can't deserialize an instance of a class if the class no longer exists. You changed the name--it's not the same class any more.
score: 0
has comment: http://stackoverflow.com/comment/37625737
type: Answer
has comment: http://stackoverflow.com/comment/37635331
has comment: http://stackoverflow.com/comment/37617416

http://stackoverflow.com/comment/37744537
type: QuestionComment
comment on: http://stackoverflow.com/q/24401066
has text: You mean, the spring XML files?
score: 0
type: Comment

http://stackoverflow.com/comment/37553221
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24299965
type: Comment
has text: Sorry for the lack of clarification. I want Hibernate to run a cleanup script when the test suite finishes all its tests, which I believe is the last thing you mentioned. I will edit my initial post for more clarity.

http://stackoverflow.com/a/65994807
type: Answer
has body: The standard definition according to oracle is as follows: A character preceded by a backslash \ is an escape sequence and has special meaning to the compiler.The following table shows the Java escape sequences EscapeSequence Description \&quot; Insert a double quote character in the text at this point. \\ Insert a backslash character in the text at this point. By following the above description in our case for System.out.println(&quot;\&quot; \\&quot;), \&quot; would be replaced with a double &quot; quote character and \\ would be replaced with a (single backslash) \ character. Hence output printed will be &quot; \ Hope this helps.
score: 0
answers question: http://stackoverflow.com/q/24319849

http://stackoverflow.com/a/25446708
has comment: http://stackoverflow.com/comment/39708330
has comment: http://stackoverflow.com/comment/90279781
has comment: http://stackoverflow.com/comment/39708994
accepted answer of: http://stackoverflow.com/q/24290976
upvote count: 5
has comment: http://stackoverflow.com/comment/39707099
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24290976
has comment: http://stackoverflow.com/comment/39790953
has body: Since version 3.0, Spring has a basic notion of thread scope : the SimpleThreadScope. It looks like it can feet what you ask, but it has some limitations : it is not registered by default with containers but must explicitely be it performs no cleanup on its beans. If you can accomodate with those limitations, you can register the scope programatically : Scope threadScope = new SimpleThreadScope(); appContext.getBeanFactory().registerScope("thread", threadScope); or in xml config : This works the same in Spring 3 and Spring 4. If you want to inject a thread scoped bean in a singleton bean, you have to declare an aop scoped-proxy on it : <aop:scoped-proxy/> (All examples from Spring Framework Reference Documentation). If you have to do some cleanup, you can look at this document Spring by Example Custom Thread Scope Module that shows an enhanced version of SimpleThreadScope. But I am not sure you really want that, unless all threads continuously use the thread scoped beans, or memory is not really a concern. Because in that design pattern, if only one session at a time needs the bean, but it is served by several threads (assuming other requests do not need the bean), all the threads will get a different instance of the bean, whereas with a pool only one instance would have been used. You will find an example of using a CommonsPoolTargetSource with Apache Common Pools in this other post from SO How to pool objects in Spring?. Extract from the post : The example use a ProxyFactoryBean to give an aop proxy to allow injection of simpleBean in a singleton bean, provided it is injected as an interface.

http://stackoverflow.com/comment/40285796
comment on: http://stackoverflow.com/a/24731408
has text: Thats not necessary. I have long separated my wars into different application deployments, and added this configuration to every war.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37631610
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24341897
score: 2
has text: I've never heart that sentence.

http://stackoverflow.com/comment/37693491
comment on: http://stackoverflow.com/a/24373752
type: AnswerComment
has text: I can't override `onPreferenceChange` in `PreferenceActivity`. I would have to extend `CheckBoxPreference` to a new class and put it in the preference.xml no? But thats a lot of code for such a small thing...
score: 0
type: Comment

http://stackoverflow.com/q/24398828
has comment: http://stackoverflow.com/comment/37740314
has title: Trouble printing a multiple-line String with PrintWriter into a File
has comment: http://stackoverflow.com/comment/37740278
has comment: http://stackoverflow.com/comment/37740276
has answer: http://stackoverflow.com/a/24398897
score: 0
answer count: 2
tagged with: string
has comment: http://stackoverflow.com/comment/37740319
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/207947
tagged with: printwriter
has comment: http://stackoverflow.com/comment/37740332
duplicate of: http://stackoverflow.com/q/207947
tagged with: java
has body: I'm trying to print a multiple-line String into a PrintWriter, but it doesn't recognizes the different lines. I have this String: "2\n0 0 1 string1\n0 2 1 string2". The text I expected to have into the file was: 2 0 0 1 string1 0 2 1 string2 but it actually is: 20 0 1 string10 2 1string2 My code is: public void save(String str){ try{ PrintWriter out = new PrintWriter("file.txt"); out.println(str); out.close(); System.out.print(str); }catch(Exception e){System.out.println(e);} } It's printed OK in the console. I'm using BlueJ to code. My OS is W7 and I just opened the file with notepad. SOLVED! Using "\r\n" instead of just "\n" works properly!
has comment: http://stackoverflow.com/comment/37740378
type: Question
has comment: http://stackoverflow.com/comment/37740366
has answer: http://stackoverflow.com/a/24398903

rest
tags question: http://stackoverflow.com/q/24282162
tags question: http://stackoverflow.com/q/24424305
tags question: http://stackoverflow.com/q/24416888
tags question: http://stackoverflow.com/q/24316356
tags question: http://stackoverflow.com/q/24354550
tags question: http://stackoverflow.com/q/24416067
tags question: http://stackoverflow.com/q/24303185
tags question: http://stackoverflow.com/q/24279389
tags question: http://stackoverflow.com/q/24282527
tags question: http://stackoverflow.com/q/24350019
tags question: http://stackoverflow.com/q/24360459
tags question: http://stackoverflow.com/q/24301542
tags question: http://stackoverflow.com/q/24325784
tags question: http://stackoverflow.com/q/24425619
tags question: http://stackoverflow.com/q/24348566
tags question: http://stackoverflow.com/q/24407576
tags question: http://stackoverflow.com/q/24322793
tags question: http://stackoverflow.com/q/24352048
tags question: http://stackoverflow.com/q/24403758
tags question: http://stackoverflow.com/q/24346993
tags question: http://stackoverflow.com/q/24326885
tags question: http://stackoverflow.com/q/24398653
tags question: http://stackoverflow.com/q/24336390
tags question: http://stackoverflow.com/q/24269449
tags question: http://stackoverflow.com/q/24411228
tags question: http://stackoverflow.com/q/24340483
tags question: http://stackoverflow.com/q/24339739
tags question: http://stackoverflow.com/q/24349219
tags question: http://stackoverflow.com/q/24288155
tags question: http://stackoverflow.com/q/24282453
tags question: http://stackoverflow.com/q/24382600
tags question: http://stackoverflow.com/q/24342751
type: Tag
tags question: http://stackoverflow.com/q/24354881
tags question: http://stackoverflow.com/q/24319819
tags question: http://stackoverflow.com/q/24399435
tag name: rest
tags question: http://stackoverflow.com/q/24410333
tags question: http://stackoverflow.com/q/24305681
tags question: http://stackoverflow.com/q/24378061
tags question: http://stackoverflow.com/q/24387394
tags question: http://stackoverflow.com/q/24397647
tags question: http://stackoverflow.com/q/24325335
tags question: http://stackoverflow.com/q/24292594
tags question: http://stackoverflow.com/q/24292798
tags question: http://stackoverflow.com/q/24312680
tags question: http://stackoverflow.com/q/24365116
tags question: http://stackoverflow.com/q/24353157
tags question: http://stackoverflow.com/q/24304496

http://stackoverflow.com/q/24373551
has comment: http://stackoverflow.com/comment/37692812
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: spring
tagged with: transactions
tagged with: java
tagged with: hibernate
tagged with: orm
linked to: http://stackoverflow.com/q/4293098
type: Question
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/11311075
favorite count: 0
has answer: http://stackoverflow.com/a/24382153
has title: HibernateException: save is not valid without active transaction
has comment: http://stackoverflow.com/comment/37693719
has comment: http://stackoverflow.com/comment/37718460
has body: So I thoroughly went through Get is not valid without active transaction and know I don't have the problem of not autowiring the SessionFactory and have followed best practices but still am encountering this exception: org.hibernate.HibernateException: save is not valid without active transaction at org.hibernate.context.internal.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:352) at com.sun.proxy.$Proxy31.save(Unknown Source) at com.bms.dao.DemandManageDAOImpl.save(DemandManageDAOImpl.java:25) 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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) at com.sun.proxy.$Proxy29.save(Unknown Source) at com.bms.service.DemandServiceImpl.createDemand(DemandServiceImpl.java:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect…

http://stackoverflow.com/comment/37765366
type: AnswerComment
type: Comment
has text: Thank you @Gary, The problem is when I execute more threads. In this case I should revice 500 * 5 messages. With single thread works fine. I'd like to know if this is the best way for this situtazion.
comment on: http://stackoverflow.com/a/24412050
score: 0

http://stackoverflow.com/comment/37548589
comment on: http://stackoverflow.com/a/24297065
score: 0
type: AnswerComment
type: Comment
has text: myMap.clear(); myMap.put("action", "inside the loop"); myMap.put("desc", "inside the loop of the sample app"); myMap.put("loop_count", String.valueOf(i)); logger.error(new MapMessage(myMap));

http://stackoverflow.com/q/24415700
tagged with: java
has comment: http://stackoverflow.com/comment/37773280
type: Question
has comment: http://stackoverflow.com/comment/37775063
has comment: http://stackoverflow.com/comment/37773329
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37776978
has comment: http://stackoverflow.com/comment/37777162
score: 1
tagged with: ejb-3.0
answer count: 0
type: UnansweredQuestion
upvote count: 1
has body: Problem as I call the methods of the remote interface with the servlet, but when i use java project the call successful in the void main() . The mapping successful. EJB project( 01_CatalogueEJB ) class Produit package metier; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity public class Produit implements Serializable{ @Id @GeneratedValue private long idProduit; private String nomProduit; private double prix; public long getIdProduit() { return idProduit; } public void setIdProduit(long idProduit) { this.idProduit = idProduit; } public String getNomProduit() { return nomProduit; } public void setNomProduit(String nomProduit) { this.nomProduit = nomProduit; } public double getPrix() { return prix; } public void setPrix(double prix) { this.prix = prix; } public Produit() { super(); // TODO Auto-generated constructor stub } public Produit(String nomProduit, double prix) { super(); this.nomProduit = nomProduit; this.prix = prix; } } the interface remote package metier; import java.util.List; import javax.ejb.Remote; @Remote public interface ICatalogueRemote { public void addProduit(Produit p); public List<Produit> getAllproduits(); public List<Produit> getProduitParMC(String mc); public Produit getProduit(long idproduit); public void removeProduit(long idproduit); public void updateProduit(Produit p); } the interface local package metier; import java.util.List; import javax.ejb.Local; @Local public interface ICatalogueLocal { public void addProduit(Produit p); public List<Produit> getAllproduits(); public List<Produit> getProduitParMC(String mc); public Produit getProduit(long idproduit); public void removeProduit(long idproduit); public void updateProduit(Produit p); } the session bean package metier; import java.util.List; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; @Stateless(na…
has title: Error: java.lang.IllegalStateException (EJB3 , jboss7.1)

http://stackoverflow.com/tag/csv
type: Tag
tags question: http://stackoverflow.com/q/24380883
tags question: http://stackoverflow.com/q/24275377
tag name: csv
tags question: http://stackoverflow.com/q/24330034
tags question: http://stackoverflow.com/q/24418143
tags question: http://stackoverflow.com/q/24294771
tags question: http://stackoverflow.com/q/24395851
tags question: http://stackoverflow.com/q/24267816
tags question: http://stackoverflow.com/q/24388506
tags question: http://stackoverflow.com/q/24307039
tags question: http://stackoverflow.com/q/24334093
tags question: http://stackoverflow.com/q/24400064
tags question: http://stackoverflow.com/q/24402683
tags question: http://stackoverflow.com/q/24347157
tags question: http://stackoverflow.com/q/24369864
tags question: http://stackoverflow.com/q/24273627
tags question: http://stackoverflow.com/q/24287776
tags question: http://stackoverflow.com/q/24279794
tags question: http://stackoverflow.com/q/24390897
tags question: http://stackoverflow.com/q/24400114

http://stackoverflow.com/a/24280400
has comment: http://stackoverflow.com/comment/37545918
has comment: http://stackoverflow.com/comment/37546655
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24278998
type: Answer
has comment: http://stackoverflow.com/comment/37561161
upvote count: 1
has body: There is no need to use chaining as this can all be expressed in XPath: //*[@id='edit_brochure_2863' and @class='feature_space_checkbox']/input So this will be in Java: driver.findElement(By.xpath("//*[@id='edit_brochure_2863' and @class='feature_space_checkbox']/input")); Of course, for the second submit button it will be driver.findElement(By.xpath("//*[@id='edit_brochure_2863' and @class='auto_fs_steps_checkbox']/input"));

http://stackoverflow.com/a/24323890
type: Answer
has body: You are missing some bits out of your code: xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("POST","ajax_test.asp",true); xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); xmlhttp.send("fname=Henry&amp;lname=Ford"); http://www.w3schools.com/ajax/ajax_xmlhttprequest_send.asp should put you on the right track. Another reason its not working is your assigning process to your onreadystatechange e.g onreadystatechange=process but process must exactly match the name of the function your assigning which in your case is process1 so the code would become reqObj.onreadystatechange=process1.
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/24323715
answers question: http://stackoverflow.com/q/24323715
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37597711

http://stackoverflow.com/a/24366720
answers question: http://stackoverflow.com/q/24366622
has comment: http://stackoverflow.com/comment/37679847
has comment: http://stackoverflow.com/comment/37679738
has comment: http://stackoverflow.com/comment/37679786
has comment: http://stackoverflow.com/comment/37679884
has body: Something like that should do it. Not tested at all. public boolean getPercentUpperCase(String str, int morethenpercent) { int lowercaseChars = 0, uppercaseChars = 0; for (int i = 0; i &gt;= str.length() -1; i++) { if (Character.isUpperCase(str.charAt(i))) { uppercaseChars++; } else { lowercaseChars++; } } return (Math.round(uppercaseChars / lowercaseChars) &gt; morethenpercent); }
score: 0
has comment: http://stackoverflow.com/comment/37679915
type: Answer

http://stackoverflow.com/q/24281885
has body: Say I am creating a class LangTest.java in the following way: package java.lang; public class LangTest { public static void show() { System.out.println("In langTest.show()"); } } In another class I am even calling the method as: LangTest.show(); None of them has given any compilation problem, yet at run-time it throws exception. -- Exception in thread "main" java.lang.SecurityException: Prohibited package name: java.lang at java.lang.ClassLoader.preDefineClass(ClassLoader.java:479) at java.lang.ClassLoader.defineClass(ClassLoader.java:614) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at com.javatpoint.Test.main(Test.java:28) This happens whenever you create a package name starting with "java.". My question is why we are not allowed to create a class in java.lang or similar? Moreover, why no compilation error was given in this case?
has answer: http://stackoverflow.com/a/24282061
tagged with: compilation
possible better answer: http://stackoverflow.com/a/24281996
has answer: http://stackoverflow.com/a/24282015
upvote count: 4
has answer: http://stackoverflow.com/a/24281996
favorite count: 0
has answer: http://stackoverflow.com/a/24282024
answer count: 5
tagged with: securityexception
accepted answer: http://stackoverflow.com/a/24282015
type: AnsweredQuestion
score: 3
has title: Why you can not create class in java.lang?
has answer: http://stackoverflow.com/a/24282002
linked to: http://stackoverflow.com/q/4838301
tagged with: java
downvote count: 1
type: Question

http://stackoverflow.com/q/24285185
upvote count: 4
has title: Different select colors for different list view items
answer count: 4
type: AnsweredQuestion
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/24329472
has answer: http://stackoverflow.com/a/24327723
type: Question
has answer: http://stackoverflow.com/a/24327365
linked to: http://stackoverflow.com/q/16976431
tagged with: listview
tagged with: user-interface
has answer: http://stackoverflow.com/a/24375067
accepted answer: http://stackoverflow.com/a/24375067
downvote count: 1
possible better answer: http://stackoverflow.com/a/24329472
favorite count: 0
linked to: http://stackoverflow.com/q/21930562
tagged with: android
has body: I have the following requirements: different colors for different list view items colors are specified dynamically in the code color should only be shown if the list view item is pressed/selected color of the list view item should not change permanently For whatever reasons it seems not to be as straight forward as I thought. The only solution that goes at least a little bit in the right direction is this one: https://stackoverflow.com/a/16978159/658718 The caveat is, that this does not change the on select color, but changes the background color permanently, plus it already changes the background color for list view items if you scroll down a bit. How can I approach this?
has comment: http://stackoverflow.com/comment/37605153

http://stackoverflow.com/a/39753392
has comment: http://stackoverflow.com/comment/102270686
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24425354
has body: You do not have to use a file like gradle.properties. If you change your build.gradle to: apply plugin: "java" ... test { ... ignoreFailures Boolean.getBoolean("test.ignoreFailures") } and invoke the tests with gradle -Dtest.ignoreFailures=true clean build you are done without editing any file. Note that, if you do not set the parameter or set it to any other value than true (case in-sensitive) failures are not ignored (ie. the default behaviour).
score: 10
upvote count: 11
has comment: http://stackoverflow.com/comment/102210063

http://stackoverflow.com/a/24295485
has body: Your for loop is written wrong, and will never end: for(int w = 1; 1 &lt;= 9; w++) The condition 1 &lt;= 9 will always be true, and so the loop will never end. Instead do: for(int w = 0; w &lt; 9; w++) Note that arrays are 0 based. If your w variable goes to 9, you will run out of array space and get an array index out of bounds exception. Even better is to avoid magic numbers: for (int w = 0; w &lt; numbers.length; w++) Regarding: By resource class I mean it's not a driver, so it doesn't contain a main method and this class Character is a JPanel being called by another class that contains the main method and JFrame. Then have your constructor throw the exception, and let the other class handle the exception by calling the constructor inside of a try and catch block. As a side recommendation, I'd change the name of this class since it clashes with a name of a core Java class. Another problem is that your code is shadowing some of its variables, namely names and numbers. By re-declaring the variables in the constructor, you're leaving the class fields null. The solution is to not re-declare the variables. i.e., change this: public Character() throws FileNotFoundException { Scanner inFile = new Scanner(new File("logos.txt")); int[] numbers = new int[9]; String[] names = new String[9]; to this: public Character() throws FileNotFoundException { Scanner inFile = new Scanner(new File("logos.txt")); numbers = new int[9]; names = new String[9]; Next we'll need to work on layout manager usage....
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24295013
answers question: http://stackoverflow.com/q/24295013
has comment: http://stackoverflow.com/comment/37544556
type: Answer
has comment: http://stackoverflow.com/comment/37544476
has comment: http://stackoverflow.com/comment/37544528
score: 3
upvote count: 3

http://stackoverflow.com/comment/37676901
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/24365277
has text: givin -1 for a right answer is not good too. It´s better to just advise the answering person to explain it and wait if he/she it is doing before givin -1.

http://stackoverflow.com/comment/37547666
has text: Hi Juned, The reason of asking similar question is that its Oracle's WebADI which hasn't been discussed here before. Furthermore, there are coding issues that needs to be fixed. Same code was never discussed here. Regards, M Habib
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24297150

jackrabbit
tags question: http://stackoverflow.com/q/24394609
tag name: jackrabbit
type: Tag

http://stackoverflow.com/q/24392682
has title: Java List size() performance and tips
score: 6
type: Question
tagged with: performance
linked to: http://stackoverflow.com/q/5126325
tagged with: java
has answer: http://stackoverflow.com/a/24392781
has comment: http://stackoverflow.com/comment/37728583
upvote count: 7
answer count: 1
downvote count: 1
favorite count: 0
duplicate of: http://stackoverflow.com/q/5126325
has body: I want to know the performance of .size() method. Does this method returns a reference from the number of objects in the list (like a class member which is incremented every time when an object is added to the list)? Or does it iterate through all objects? Which one is more efficient? Calling .size() every time: List&lt;Vector3&gt; objects = getCoords(); for (int x = 0; x &lt; objects.size(); x++){ for (int y = 0; y &lt; objects.size(); y++){ for (int z = 0; z &lt; objects.size(); z++){ drawShape(x, y, z); } } } Or by saving to a local variable: List&lt;Vector3&gt; objects = getCoords(); int size = objects.size(); for (int x = 0; x &lt; size; x++){ for (int y = 0; y &lt; size; y++){ for (int z = 0; z &lt; size; z++){ drawShape(x, y, z); } } } Let's assume that we have > 30.000 objects in the list. Which one is more faster/efficient? Does it matter if we use an ArrayList&lt;T&gt; or a List&lt;T&gt; ? What about simple statements: .size() or .isEmpty() if (objects != null &amp;&amp; objects.size() &gt; 0){ doThis(); } or by calling .isEmpty() if (objects != null &amp;&amp; !objects.isEmpty()){ doSomethingElse(); }
tagged with: list
has comment: http://stackoverflow.com/comment/37728531
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37728602

http://stackoverflow.com/q/24366184
has answer: http://stackoverflow.com/a/24366293
favorite count: 0
tagged with: ftp
type: AnsweredQuestion
has title: java.io.file is turning // into /?
tagged with: java
tagged with: file
type: Question
has body: I'd like to instantiate a file from an FTP path like: java.io.File file = new File("ftp://"+"path/to/file"); But when I try to get the fileInputStream of this file: FileInputStream in = new FileInputStream(file); I get a java.io.FileNotFoundException. When I debug, I can see that during the instantiation of the file object, the path turns to "ftp:/path/to/file" -- with ONE slash ==> which throws the exception since he needs double slashes "//" after "ftp:" to locate the file into the FTP server. How can I make the path contain double slashes ? Thank you
has comment: http://stackoverflow.com/comment/37679104
accepted answer: http://stackoverflow.com/a/24366293
score: 0
upvote count: 1
answer count: 1
downvote count: 1

http://stackoverflow.com/q/24399111
has answer: http://stackoverflow.com/a/24399503
has body: The below code gets down to the "Start uploading file" and "Trying to delete file from server..." and then never uploads nor delete the file if calling "onFileCreate" or "onFileDelete", also doesn't throw any errors to give any ideas of where it's being held up. I've waited over 5 minutes for it to do something, nothing. Does anyone know of anything I can put in to give me more of an idea about whats going on and ultimately get through the upload and respectively, the delete? public void onFileCreate(File file) { try { FTPClient ftpClient = new FTPClient(); System.out.println("File Created! - Do Work!" + file); ftpClient.connect(server, port); ftpClient.login(user, pass); ftpClient.enterLocalPassiveMode(); ftpClient.setFileType(FTP.BINARY_FILE_TYPE); InputStream inputStream = new FileInputStream(file); String filename = file.getPath(); System.out.println("Start uploading file"); boolean done = ftpClient.storeFile(filename, inputStream); inputStream.close(); if (done) { System.out.println("The file was uploaded successfully: " + file); } ftpClient.isConnected(); ftpClient.logout(); ftpClient.disconnect(); } catch(Exception e){ e.printStackTrace(System.err); } } @Override public void onFileDelete(File file) { try { System.out.println("File removed: Do Work!"); FTPClient ftpClient = new FTPClient(); ftpClient.connect(server, port); ftpClient.login(user, pass); ftpClient.enterLocalPassiveMode(); ftpClient.setFileType(FTP.BINARY_FILE_TYPE); String filename = file.getPath(); System.out.println("Trying to delete file from server..."); boolean done = ftpClient.deleteFile(filename); if(done){ ftpClient.isConnected(); ftpClient.logout(); ftpClient.disconnect(); System.out.println("File deleted from server: " + file); } } catch (IOException e) { e.printStackTrace(System.err); } } Below is my manifest: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.testapp" android:versionCode="1" android…
has title: FTPClient (apache.commons) isn't uploading or deleting my files
answer count: 1
tagged with: android
type: UnansweredQuestion
score: 0
tagged with: java
type: Question

http://stackoverflow.com/comment/37723586
has text: I've got more evidence the error is generated by the server. I turned off my wireless and then ran the iPhone app in the Xcode debugger. When I clicked the button that initiates the Endpoint call I got a different error: [0] (null) @"NSUnderlyingError" : (no summary) [1] (null) @"NSErrorFailingURLStringKey" : @"https://helloendpoints.appspot.com/_ah/api/rpc?prettyPrint=false" [2] (null) @"NSErrorFailingURLKey" : @"https://helloendpoints.appspot.com/_ah/api/rpc?prettyPrint=false" [3] (null) @"NSLocalizedDescription" : @"The Internet connection appears to be offline."
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24346876

http://stackoverflow.com/comment/37645829
type: Comment
type: QuestionComment
has text: Please provide a "Minimal, Complete, and Verifiable example" http://stackoverflow.com/help/mcve
comment on: http://stackoverflow.com/q/24347360
score: 0

http://stackoverflow.com/a/24507614
has body: The approach looks ok. Not very secure. Let me highlight some of the attacks possible with the request. Man-In-the-middle attack in a POST request, the user can tamper with the request and server does not have any way to ensure the data is not tampered. Replay attack: In this, the attacker does not tamper with the request. The attacker taps the request and sends it to the server multiple times in a short duration, though it is a valid request, the server processes the request multiple times, which is not needed Please read about Nonce. In the first step, the user sends his credentials i.e username and password to the login service and if you have a web based application that also uses the same password it might be dangerous. If in case password in compromised, API and web everything is exposed, please use a different PIN for API access. Also, ensure decrypted token as specified by you, expires after a certain time. Ensure the service (application server) tomcat. jboss never returns a server page in case of internal error, this gives the attacker extra information of the server where the app is deployed. -- MODIFIED BASED ON SECOND POST -- Yes your correct if your using mutual SSL, but in case its a one way access you don't have the client certificates. It would be good if you just double ensured everything in the request, just like signed (signature) SOAP, one of the strong data transfer mechanism. But replay attack is a possibility with HTTPS, just handle that. Rest use tokens encryption is good. And why not ask the client to decrypt the token with the password and return the output of the decryption by this you can validate the output, if it is present in your database ? This approach the user does not send the password over the wire even if it is HTTPS ?
answers question: http://stackoverflow.com/q/24411228
score: 0
has comment: http://stackoverflow.com/comment/38022501
type: Answer
has comment: http://stackoverflow.com/comment/37943369

http://stackoverflow.com/comment/37782988
type: Comment
has text: @FadyFarouk: are you doing this for school or for fun?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24421468

http://stackoverflow.com/q/24353933
answer count: 1
downvote count: 0
favorite count: 0
has body: I have a tree map object tm2 of type TreeMap&lt;String, ArrayList&lt;SomeObject&gt;&gt;. I want to make a copy (duplicate) out of it. I tried cloning : TreeMap tm = (TreeMap) tm2.clone() but did not help. Please suggest me how to get a copy entirely( so that copied Object does not refere to the original objects member)
has comment: http://stackoverflow.com/comment/37655612
score: 2
has comment: http://stackoverflow.com/comment/37656235
upvote count: 2
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37655666
type: Question
has answer: http://stackoverflow.com/a/24354093
has comment: http://stackoverflow.com/comment/37655720
has title: How to create a duplicate map object i java?
has comment: http://stackoverflow.com/comment/37655682

http://stackoverflow.com/comment/37533960
has text: Thanks, I didn't know it
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24286077
type: QuestionComment

http://stackoverflow.com/comment/37771346
has text: $ java CmdArgsTest 's\\*', it didn't work also. Regular expression: "s\\*"
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24414922

http://stackoverflow.com/q/24269060
answer count: 1
has answer: http://stackoverflow.com/a/24302423
has comment: http://stackoverflow.com/comment/37493784
type: AnsweredQuestion
tagged with: openxml
has comment: http://stackoverflow.com/comment/37494838
tagged with: xmlbeans
has comment: http://stackoverflow.com/comment/37494226
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/37495063
tagged with: java
accepted answer: http://stackoverflow.com/a/24302423
type: Question
tagged with: docx4j
has title: Passing an Enum to a method as a parameter in Java?
has comment: http://stackoverflow.com/comment/37494993
has body: I am trying to call a docx4j method "setAlgn" in the interface CTTextParagraphProperties, which, per the docx4j jar I am using and the compiler takes an Enum type as a parameter. I am passing the actual argument STTextAlignType.CTR which I believe should resolve to the value 'ctr' (citation: http://grepcode.com/file/repo1.maven.org/maven2/org.docx4j/docx4j/3.0.1/org/docx4j/dml/STTextAlignType.java?av=f, I am running this same code). Here is my code: import java.lang.Enum; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFCellStyle; import org.apache.poi.xssf.usermodel.XSSFClientAnchor; import org.apache.poi.xssf.usermodel.XSSFChildAnchor; import org.apache.poi.xssf.usermodel.XSSFDataFormat; import org.apache.poi.xssf.usermodel.XSSFDrawing; import org.apache.poi.xssf.usermodel.XSSFFont; import org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator; import org.apache.poi.xssf.usermodel.XSSFPrintSetup; import org.apache.poi.xssf.usermodel.XSSFRichTextString; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFSimpleShape; import org.apache.poi.xssf.usermodel.XSSFShapeGroup; import org.apache.poi.xssf.usermodel.XSSFTextBox; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.docx4j.dml.*; public static XSSFTextBox createTextBox(XSSFSheet sh, String message, int row1, int col1, int row2, int col2, boolean is_bold, boolean is_italics, boolean is_underline, boolean centered, int fontSize){ //Various apache-poi stuff XSSFWorkbook wb = sh.getWorkbook(); XSSFDrawing drawing = sh.createDrawingPatriarch(); XSSFClientAnchor clientanchor = new XSSFClientAnchor(0,0,0,0,(short)col1,row1,(short)col2,row2); XSSFChildAnchor childanchor = new XSSFCh…
score: 0
has comment: http://stackoverflow.com/comment/37495274

http://stackoverflow.com/comment/37711229
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24383637
has text: Best not to confuse EC with ECC as the later means something very different.

game-loop
tag name: game-loop
tags question: http://stackoverflow.com/q/24342387
type: Tag

galaxy
type: Tag
tag name: galaxy
tags question: http://stackoverflow.com/q/24281987

http://stackoverflow.com/comment/37678306
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24365773
has text: `OR(M1;M2#;M#3;M4)` would be `OR(M13;M4`
score: 0

http://stackoverflow.com/a/26202678
has body: The best place to ask such question would where the project says user can post their questions. I've completely missed this one, and since I wrote CalendarPicker and the sample that is a shame. CalendarPicker has a calenders property, which is an observable list of the selected calendars. This can be handed over to ListView's setItems. Changes are automatically updated due to JavaFX's binding.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24336696

http://stackoverflow.com/comment/37771281
comment on: http://stackoverflow.com/a/24415245
type: Comment
has text: @yshavit I tried with Sleep and Random Sleep.. Still not able to see race ?
score: 0
type: AnswerComment

http://stackoverflow.com/q/24341540
downvote count: 0
tagged with: web
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37633848
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/37632720
answer count: 0
type: UnansweredQuestion
tagged with: java
upvote count: 1
type: Question
has title: Play framework with Google App Engine, will this destroy scalability?
has body: Could I get some advice on what is the better way? My questions regard Play framework, Google App Engine and web development. So I am about to start writing a website which (the hope is) will be become quite popular and therefore will need to scale. I have heard from more experienced developers that my system will not work (a play framework on a VPS backed by Mysql). Apparently this just does not scale. Especially if storing and searching through many It has been suggested that I use a system like Google App Engine (GAE) that handles all the scalability aspects. However I am just starting to realise that this means a different mind set (Application Centric). My main question is whether I should still use play framework? The default way of using GAE is using plain Java servlets but I have found a plug in that allows play to interact with it. I like working with play but I am worried that this will diminish all the benefits of GAE scalability rendering the effort in porting my application to GAE useless. Can anyone give some advice? Update - to further explain: I was worried about using components that play framework provides such as sessions, cookies, etc. I am assuming that these will not be scalable unless I use the GAE api directly? I have heard that storing state like sessions is not very good and I should use the provided APIS. Or does Play's plug in already handle this? Also, Cheers
tagged with: playframework

http://stackoverflow.com/a/24268878
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24267162
has body: your 'createTree' should probably look like this: private static Element createTree(Document doc, TreeModel model, Object node) { Element el = doc.createElement(node.toString()); for(int i=0;i&lt;model.getChildCount(node);i++){ DefaultMutableTreeNode child = (DefaultMutableTreeNode)model.getChild(node, i); if (child.isLeaf()) { el.setTextContent(child.toString()); } else { el.appendChild(createTree(doc,model,child)); } } return el; } Because the original createTree converts node values to elements as there was a check (in the if condition above) missing
accepted answer of: http://stackoverflow.com/q/24267162

http://stackoverflow.com/comment/37794926
has text: @user3152748 delete the current post or [this](http://stackoverflow.com/questions/24424327/couldnt-get-the-values-from-jsp-to-servlet) one. You shouls not spam out of desperation of getting the answer
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24426612

http://stackoverflow.com/comment/37522947
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24282820
has text: Use Swing components instead of AWT(`Applet`->`JApplet`, `Frame`->`JFrame`...)

http://stackoverflow.com/comment/37697241
score: 0
comment on: http://stackoverflow.com/q/24375998
has text: show your long number and how you are trying to get it from SharedPreference
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37746919
score: 0
has text: looks like you machine does not have access to your DB server.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24402022

http://stackoverflow.com/q/24314826
accepted answer: http://stackoverflow.com/a/24323728
type: Question
tagged with: ant
score: 4
answer count: 2
has comment: http://stackoverflow.com/comment/37609155
tagged with: jar
favorite count: 0
has comment: http://stackoverflow.com/comment/37592321
has title: Using Maven in Ant for jar dependencies
has answer: http://stackoverflow.com/a/24323728
has comment: http://stackoverflow.com/comment/37585733
tagged with: maven
upvote count: 6
has comment: http://stackoverflow.com/comment/37592384
has body: Am new to Maven but am comfortable with the Ant, i like the way that maven downloads the jars and its dependencies, so i want to have maven dependency included in my Ant build script. I have seen how to use but here all the jar files are downloaded in .m2 folder, instead i need all the jars downloaded in the lib folder of my project. Can this be done or not,? if it can then can anybody please suggest me how to do it.
tagged with: build
type: AnsweredQuestion
tagged with: java
downvote count: 2
possible better answer: http://stackoverflow.com/a/24323097
has answer: http://stackoverflow.com/a/24323097

http://stackoverflow.com/comment/39421241
score: 0
comment on: http://stackoverflow.com/a/25289006
type: Comment
has text: Yes you would need those permissions, but the users would realize that it is for integration with Google Calendar.
type: AnswerComment

http://stackoverflow.com/comment/37568454
comment on: http://stackoverflow.com/a/24307801
has text: Where do you get the NullPointerException?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37689946
has text: Both done along with `-fileoutput` (very handy to refer/check the errors) alas without managing to resolve the issue. I should add that I tried using the `-genmissing` option, which does get rid of the `ORA-29534` or `ORA-29519` but gives me Java errors (NoSuchMethod) instead.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24275081

http://stackoverflow.com/comment/37554310
score: 0
type: Comment
has text: Martin how to create a data view with an emptylist.please share some examples.
type: AnswerComment
comment on: http://stackoverflow.com/a/24300597

http://stackoverflow.com/q/24368903
upvote count: 1
downvote count: 0
answer count: 1
has title: android: continuous Tab Bar
favorite count: 0
tagged with: tabs
tagged with: android
tagged with: android-actionbar
has body: is there a Way to implement a continuous button/tab Bar? The Action bar is already in use for the "main tab" selection. The "sub tab" selection should be some Buttons which you can scroll infinite (if the Bar ends the first Button is shown again)
type: AnsweredQuestion
tagged with: view
score: 1
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/15896373
has answer: http://stackoverflow.com/a/24405201
accepted answer: http://stackoverflow.com/a/24405201
has comment: http://stackoverflow.com/comment/37683974
has comment: http://stackoverflow.com/comment/37726933

http://stackoverflow.com/comment/37721453
comment on: http://stackoverflow.com/a/24387823
score: 0
type: AnswerComment
type: Comment
has text: Thanks, your code works, so did my code. I found out that the problem was somewhere else in my code which made the value of result.get(0).size() 21 instead of 3. Apparently, the list was messed up and containing all values in each ArrayList object, and k was printing, but it was too far down that I could not catch it.

http://stackoverflow.com/a/24369283
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24369267
downvote count: 0
has body: You have an extra comma: " \"object_id\": 366334, " + Should be: " \"object_id\": 366334 " + // /\ Extra comma was there. The error message says: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('}' (code 125)): was expecting double-quote to start field name This isn't very clear, but we can make out that it's a syntax error of some kind, and it has a line number. By looking around the line number, you can find the syntax error.
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/24369267

http://stackoverflow.com/q/24284491
has answer: http://stackoverflow.com/a/24286528
accepted answer: http://stackoverflow.com/a/24286528
has comment: http://stackoverflow.com/comment/37523007
has comment: http://stackoverflow.com/comment/37523952
score: 0
has comment: http://stackoverflow.com/comment/37523084
answer count: 1
has comment: http://stackoverflow.com/comment/37523258
has comment: http://stackoverflow.com/comment/37523003
tagged with: parsing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37522954
has title: Unexpected character(<) position 0 Java
type: Question
has body: I have a small problem with my json parser When i try to parse a string i get this exception: Unexpected character (&lt;) at position 0 But i dont see where the problem is. This is the code that i made: JSONParser parser = new JSONParser(); try { Object obj = parser.parse(response); System.out.println(obj); JSONObject jsonObject = (JSONObject) obj; // loop the string //id = (String) jsonObject.get("id"); voornaam = (String) jsonObject.get("voornaam"); achternaam = (String) jsonObject.get("achternaam"); _voornaamTxtField.setText(voornaam); _achternaamTxtField.setText(achternaam); } catch (ParseException pex) { JOptionPane.showMessageDialog(null, "ParseException", "Error", JOptionPane.ERROR_MESSAGE); System.out.println(pex); } catch (NullPointerException npex) { JOptionPane.showMessageDialog(null, "NullpointerException", "Error", JOptionPane.ERROR_MESSAGE); } Can someone explain to me what i am doeing to cause the exception
linked to: http://stackoverflow.com/q/20070380
has comment: http://stackoverflow.com/comment/37522990
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/37674664
score: 2
comment on: http://stackoverflow.com/q/24364133
has text: Apache Lucene. Your bottleneck is going to be in I/O not CPU IMHO.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37812070
type: AnswerComment
type: Comment
has text: Why is date a list of Strings? like i said, why not a map that explicitly ties these two together? still poor design.
comment on: http://stackoverflow.com/a/24430415
score: 0

http://stackoverflow.com/q/24290801
has body: I was following the SWT Slider Snippet example and the event detail is always 0 aka SWT.NONE on fedora yet the detail is set on windows 7. The example can be found here http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/SWTSliderprintscrolleventdetails.htm and here is the code I'm running. public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); final Slider slider = new Slider(shell, SWT.HORIZONTAL); slider.setBounds(10, 10, 200, 32); slider.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { String string = "SWT.NONE"; switch (event.detail) { case SWT.DRAG: string = "SWT.DRAG"; break; case SWT.HOME: string = "SWT.HOME"; break; case SWT.END: string = "SWT.END"; break; case SWT.ARROW_DOWN: string = "SWT.ARROW_DOWN"; break; case SWT.ARROW_UP: string = "SWT.ARROW_UP"; break; case SWT.PAGE_DOWN: string = "SWT.PAGE_DOWN"; break; case SWT.PAGE_UP: string = "SWT.PAGE_UP"; break; } System.out.println(slider.getSelection()); System.out.println("Scroll detail -&gt; " + string); } }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
linked to: http://stackoverflow.com/q/15288175
type: AnsweredQuestion
tagged with: java
tagged with: swt
tagged with: cross-platform
has answer: http://stackoverflow.com/a/24299843
accepted answer: http://stackoverflow.com/a/24299843
type: Question
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37536612
has comment: http://stackoverflow.com/comment/37535801
has title: Why does the SWT Selection event for a slider never have a detail?

http://stackoverflow.com/comment/37538292
comment on: http://stackoverflow.com/q/24292225
score: 0
type: Comment
type: QuestionComment
has text: You're not testing a real JavaFileInput instance. You're testing a mock of JavaFileInput. That makes no sense. By definition, methods of mock objects don't do anything other than what you tell them to do.

http://stackoverflow.com/q/24406791
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24407067
tagged with: touch
answer count: 1
accepted answer: http://stackoverflow.com/a/24407067
has title: Where can I put ACTION_UP in my code so it works?
tagged with: android
type: AnsweredQuestion
has body: I have code for a circle to appear onTouchListener and follow a finger around the screen. Now I'm working on getting it to disappear when the finger is taken off the screen. I'm pretty sure ACTION_UP: is what I need. I just don't know how to implement it. This is the code I want to go inside the ACTION_UP paint.setARGB(1, r, g, b); And here is the relavant code so far: public void onDraw(Canvas canvas) { paint.setARGB(255, r, g, b); //drawing the circle canvas.drawCircle(x,y,radius,paint); } public boolean onTouch(View view,MotionEvent event) { x=(int)event.getX()-(radius/2); //logic to plot the circle in exact touch place y=(int)event.getY()-(radius/2); //System.out.println("X,Y:"+"x"+","+y); randColor(); //color of circle invalidate(); return true; //where I think I need to put ACTION_UP... }

http://stackoverflow.com/a/24337720
has comment: http://stackoverflow.com/comment/37624476
has body: There are a number of problems with this code: Your SELECT statement is selecting the entire users table. Probably not a good idea. If you are selecting from the user's table, you should probably have a "WHERE" or "LIMIT" somewhere. It's unclear why you are adding 1 to the User ID (should probably add a comment). Your INSERT statement seems to be slightly off syntactically (see the documentation... "SET" is used for "UPDATE", the INSERT statement looks more like "INSERT INTO..."). When creating a new user entry, you probably should not set the UserID explicitly. You should, instead, make that column auto-incrementing and then omit it in the INSERT statement, relying on the declaration of the table to cause the value to be automatically computed and set. You are storing the password into the user's table, directly. If you are going to store the password, at the very least encrypt it (or, better yet, only store a salted hash of the password, nothing from which the password may be reconstructed). Even better, however, would be if you used OAuth, instead. You need to escape your user-provided fields (as mentioned in some of the comments, prepared statements are the way to go for something like this).
has comment: http://stackoverflow.com/comment/37624545
type: Answer
answers question: http://stackoverflow.com/q/24337694
has comment: http://stackoverflow.com/comment/37624325
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37624493
upvote count: 1

http://stackoverflow.com/comment/37752237
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24405213
has text: go with you mouse to the red squiggle. Eclipse shows you the message why it is marked.
score: 0

http://stackoverflow.com/comment/37774522
has text: Could you provide your code, please? :)
comment on: http://stackoverflow.com/q/24416175
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24319697
tagged with: junit
downvote count: 0
has answer: http://stackoverflow.com/a/53794053
has comment: http://stackoverflow.com/comment/37590024
has answer: http://stackoverflow.com/a/67632770
tagged with: ubuntu-12.04
answer count: 27
has answer: http://stackoverflow.com/a/75441272
favorite count: 0
linked to: http://stackoverflow.com/q/38822189
has answer: http://stackoverflow.com/a/24319836
has answer: http://stackoverflow.com/a/76388703
has answer: http://stackoverflow.com/a/73798511
has answer: http://stackoverflow.com/a/56577133
has answer: http://stackoverflow.com/a/69653032
has answer: http://stackoverflow.com/a/41042092
has answer: http://stackoverflow.com/a/68296367
accepted answer: http://stackoverflow.com/a/24319836
has answer: http://stackoverflow.com/a/61304106
has answer: http://stackoverflow.com/a/62170267
has answer: http://stackoverflow.com/a/78192010
has body: I am trying to run the JUnit on my Linux command prompt /opt/junit/ contains the necessary JARS(hamcrest-core-1.3.jar and junit.jar) and class files and I am using the following command to run the JUnit: java -cp hamcrest-core-1.3.jar:junit.jar:. org.junit.runner.JUnitCore TestRunner TestJunit class: import org.junit.Test; import static org.junit.Assert.assertEquals; public class TestJunit { @Test public void testAdd() { String str= "Junit is working fine"; assertEquals("Junit is working fine",str); } } TestRunner: import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; public class TestRunner { public static void main(String[] args) { Result result = JUnitCore.runClasses(TestJunit.class); for (Failure failure : result.getFailures()) { System.out.println("fail ho gaya"+failure.toString()); } System.out.println("passed:"+result.wasSuccessful()); } } I am getting the following exception on running this JUnit version 4.11 .E Time: 0.003 There was 1 failure: 1) initializationError(TestRunner) java.lang.Exception: No runnable methods at org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:169) at org.junit.runners.BlockJUnit4ClassRunner.collectInitializationErrors(BlockJUnit4ClassRunner.java:104) at org.junit.runners.ParentRunner.validate(ParentRunner.java:355) at org.junit.runners.ParentRunner.&lt;init&gt;(ParentRunner.java:76) at org.junit.runners.BlockJUnit4ClassRunner.&lt;init&gt;(BlockJUnit4ClassRunner.java:57) at org.junit.internal.builders.JUnit4Builder.runnerForClass(JUnit4Builder.java:10) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26) at org.junit.runner.Computer.getRunner(Computer.java:40) at org.junit.runner.Computer$1.runnerForClass(Computer.java:31) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(Runn…
type: AnsweredQuestion
tagged with: junit4
has answer: http://stackoverflow.com/a/60527116
has comment: http://stackoverflow.com/comment/113247591
tagged with: java
has answer: http://stackoverflow.com/a/57414089
has answer: http://stackoverflow.com/a/59976427
has answer: http://stackoverflow.com/a/60221240
has comment: http://stackoverflow.com/comment/86707264
has answer: http://stackoverflow.com/a/25922064
type: Question
has answer: http://stackoverflow.com/a/62933241
has answer: http://stackoverflow.com/a/65994841
possible better answer: http://stackoverflow.com/a/36718478
linked to: http://stackoverflow.com/q/672466
upvote count: 137
has answer: http://stackoverflow.com/a/36718478
has answer: http://stackoverflow.com/a/29865611
has answer: http://stackoverflow.com/a/70678209
linked to: http://stackoverflow.com/q/2818570
has answer: http://stackoverflow.com/a/60984184
has answer: http://stackoverflow.com/a/61345958
has answer: http://stackoverflow.com/a/59563970
has title: java.lang.Exception: No runnable methods exception in running JUnits
has answer: http://stackoverflow.com/a/72532842
score: 137
has comment: http://stackoverflow.com/comment/51938923

http://stackoverflow.com/q/24349598
favorite count: 0
tagged with: aggregate
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/23521118
has answer: http://stackoverflow.com/a/77677403
tagged with: java
tagged with: hibernate
type: Question
has body: Base Data: DEPTNO ENAME ------ ------ 20 SMITH 30 ALLEN 30 WARD 20 JONES 30 MARTIN 30 BLAKE 10 CLARK 20 SCOTT 10 KING 30 TURNER 20 ADAMS 30 JAMES 20 FORD 10 MILLER Desired Output: DEPTNO EMPLOYEES ------ --------- 10 CLARK,KING,MILLER 20 SMITH,FORD,ADAMS,SCOTT,JONES 30 ALLEN,BLAKE,MARTIN,TURNER,JAMES,WARD I have tried this jpql query: SELECT deptno, new list(ename) as employees FROM dept_emp However an exception is raised: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: new near line 1, column 15 JPA 2.1 Hibernate 4.3.1 See also: https://stackoverflow.com/a/24570617/363573
upvote count: 5
has answer: http://stackoverflow.com/a/24349785
has title: How to aggregate strings with JPA?
answer count: 3
score: 5
has answer: http://stackoverflow.com/a/24349784
tagged with: jpa
downvote count: 0
tagged with: string

http://stackoverflow.com/q/24373332
favorite count: 0
has title: SQLite error for Android: "Column is not unique"
tagged with: android
type: AnsweredQuestion
downvote count: 0
score: 1
possible better answer: http://stackoverflow.com/a/24373396
type: Question
accepted answer: http://stackoverflow.com/a/24373386
tagged with: java
tagged with: database
has body: I have spent lots of time searching for the answer, but I couldn't find it. I'm trying to use a SQLite database on my Android app, but when I try to add a new object with the db.insert(object), I get an error saying that my Primary Key is not UNIQUE. What am I doing wrong? SQLite Database: public class SqlCadastro extends SQLiteOpenHelper{ private static final int DATABASE_VERSION = 1; private static final String DATABASE_NAME = "contactsManager"; private static final String TABLE_MATERIAS = "Materias"; // Contacts Table Columns names private static final String KEY_NOME = "Nome"; private static final String KEY_NOTA1 = "Tri1"; private static final String KEY_NOTA2 = "Tri2"; private static final String KEY_NOTA3 = "Tri3"; private static final String KEY_PRENOTA3 = "Est3Tri"; private static final String KEY_MA = "MA"; private static final String KEY_PREPFV = "EstPFV"; private static final String KEY_PFV = "PFV"; public SqlCadastro(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } // Creating Tables @Override public void onCreate(SQLiteDatabase db) { String CREATE_CONTACTS_TABLE = "CREATE TABLE " + TABLE_MATERIAS + "(" + KEY_NOME + " TEXT UNIQUE," + KEY_NOTA1 + " FLOAT," + KEY_NOTA2 + " FLOAT," + KEY_PRENOTA3 + " FLOAT," + KEY_NOTA3 + " FLOAT," + KEY_MA + " FLOAT," + KEY_PREPFV + " FLOAT, " + KEY_PFV + " FLOAT, PRIMARY KEY (" + KEY_NOME + ") ON CONFLICT IGNORE)" + ")"; db.execSQL(CREATE_CONTACTS_TABLE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_MATERIAS); onCreate(db); } public void addMateria(Materias materia) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(KEY_NOME, materia.getNome()); values.put(KEY_NOTA1, Float.toString(materia.getNota1())); values.put(KEY_NOTA2, Float.toString(materia.getNota2())); values.put(KEY_PRENOTA3, Float.toString(materia.getPreNota3())); values.put(KEY_NOTA3, Float.toStr…
answer count: 2
has answer: http://stackoverflow.com/a/24373386
upvote count: 1
tagged with: sqlite
has answer: http://stackoverflow.com/a/24373396

http://stackoverflow.com/q/24417103
has answer: http://stackoverflow.com/a/24417415
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: compression
type: Question
has title: The performance of Java/Scala's Deflator for compressing BitSet
accepted answer: http://stackoverflow.com/a/24417415
possible better answer: http://stackoverflow.com/a/24417370
has answer: http://stackoverflow.com/a/24417370
answer count: 2
downvote count: 0
favorite count: 0
has body: I have this Scala code that uses Java's Deflator/Inflator. def compress(bytes: Array[Byte]): Array[Byte] = { val deflater = new java.util.zip.Deflater val baos = new ByteArrayOutputStream val dos = new DeflaterOutputStream(baos, deflater) dos.write(bytes) baos.close dos.finish dos.close baos.toByteArray } def decompress(bytes: Array[Byte]): String /*Array[Byte]*/ = { val deflater = new java.util.zip.Inflater() val baos = new ByteArrayOutputStream(512) val bytesIn = new ByteArrayInputStream(bytes) val in = new InflaterInputStream(bytesIn, deflater) var go = true while (go) { val b = in.read if (b == -1) go = false else baos.write(b) } baos.close in.close // String(byte[] bytes, Charset charset) new String(baos.toByteArray, "ASCII") } I need to compress BitSet that has only one bit (100th bit from 13 x 8 = 104 bits) set. val bs = new util.BitSet() bs.set(100) val ba = bs.toByteArray val z = gzip.compress(ba) println(ba.size) println(ba.mkString(":")) println(z.size) println(z.mkString(":")) I expect some dramatic size reduction, but the result is that I save only one byte. 13 0:0:0:0:0:0:0:0:0:0:0:0:16 12 120:-100:99:96:64:0:1:0:0:29:0:17 Is this expected results for Java's Deflator? Is there any better compressor for this case?
tagged with: scala
upvote count: 1

http://stackoverflow.com/comment/37496960
score: 1
comment on: http://stackoverflow.com/q/24270421
has text: Don't sysout. Don't do it with a password. Disclose proprietary based information affect your client.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37586596
type: Comment
has text: @NotSoOldNick I did "folder1.folder2.foler3.*", but I was still able to import it using intellisense.
comment on: http://stackoverflow.com/a/24297301
score: 0
type: AnswerComment

http://stackoverflow.com/a/24951337
score: 1
answers question: http://stackoverflow.com/q/24378435
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: You can't separate the tabs from their contents with another component like a JSplitPane. However you can tell the JTabbedPane how and where you want your tabs to be layed out. Look at the constructors JTabbedPane(int tabPlacement) and JTabbedPane(int tabPlacement, int tabLayoutPolicy) (there are also setters/getters for these). For tab placement use JTabbedPane.LEFT, or JTabbedPane.RIGHT and the result will be what you want to achieve. If you have too many tabs, you can choose between JTabbedPane.WRAP_TAB_LAYOUT or JTabbedPane.SCROLL_TAB_LAYOUT. The first will display all tabs in multiple rows/cols if needed, the latter one will only display as many that fits into the space and display scroll buttons to scroll to the not visible tabs. IF you really want to separate tabs from their contents with something like a JSplitPane, you can't use JTabbedPane for this. You have to implement that yourself. E.g. put buttons (representing the tabs) on one side of a JSplitPane, and when those buttons are clicked, change the component on the other side of the JSplitPane.
accepted answer of: http://stackoverflow.com/q/24378435
type: Answer

http://stackoverflow.com/a/24355134
downvote count: 0
type: Answer
score: 4
answers question: http://stackoverflow.com/q/24354568
has body: An overwhelming collection of Sudoku solving strategies for human players is nicely presented and explained on Andrew Stuart's Sudoku page: **Show Possibles** 1: Hidden Singles 2: Naked Pairs/Triples 3: Hidden Pairs/Triples 4: Naked Quads 5: Pointing Pairs 6: Box/Line Reduction **Tough Strategies** 7: X-Wing 8: Simple Colouring 9: Y-Wing 10: Sword-Fish 11: XYZ Wing **Diabolical Strategies** 12: X-Cycles 13: XY-Chain 14: 3D Medusa 15: Jelly-Fish 16: Unique Rectangles 17: Extended Unique Rect. 18: Hidden Unique Rect's 19: WXYZ Wing 20: Aligned Pair Exclusion **Extreme Strategies** 21: Grouped X-Cycles 22: Empty Rectangles 23: Finned X-Wing 24: Finned Sword-Fish 25: Altern. Inference Chains 26: Sue-de-Coq 27: Digit Forcing Chains 28: Nishio Forcing Chains 29: Cell Forcing Chains 30: Unit Forcing Chains 31: Almost Locked Sets 32: Death Blossom 33: Pattern Overlay Method 34: Quad Forcing Chains **"Trial and Error"** 35: Bowman's Bingo As a fairly frequent player, I would judge everything beyond strategy 11 as "no fun anymore". But that is probably a matter of taste.
upvote count: 4

http://stackoverflow.com/comment/37698136
type: AnswerComment
comment on: http://stackoverflow.com/a/24376445
type: Comment
has text: Well, you could do them on integers and mask out the upper-level 3 bytes. I don't know how many of them there are or how fast or whatever, but that would allow shifting, etc. You'll just have to deal with the signing part, in Java, I don't know any way around it. If it were me I'd define the operations I wanted and write methods that would do those on the bytes in the lowest-order 8 bits of integers, and that would allow me to insure I wasn't dealing with a negative integer in the first place, etc., without making the upper-level code too messy.
score: 1

http://stackoverflow.com/a/24346359
has comment: http://stackoverflow.com/comment/37649651
type: Answer
has comment: http://stackoverflow.com/comment/37690663
answers question: http://stackoverflow.com/q/24337835
has comment: http://stackoverflow.com/comment/37665524
has comment: http://stackoverflow.com/comment/37670525
has comment: http://stackoverflow.com/comment/87824931
upvote count: 2
has body: It seems that the problem is you declare twice the @OneToOne annotation between "person" table and "auth" table, without specify the relation between them. Take a look at the hibernate documentation, at the point 2.2.5.1, there is some examples about using one-to-one association. For me, the best way is to set up the association in one table, the one that declare the foreing key column, and to use the mappedBy parameter in the other object. In your code, this will be : @Entity @Table(name = "person") public class Person extends DomainBase { @OneToOne(cascade=CascadeType.ALL) @JoinColumn(name="auth_id") private Auth auth; } @Entity public class Auth { @Id @GeneratedValue(generator="foreign") @GenericGenerator(name="foreign", strategy = "foreign", parameters={ @Parameter(name="property", value="person") }) @Column(name="person_id") private int personId; @OneToOne(mappedBy = "auth") private Person person; .... } This is the second example in the hibernate documentation, introduce just after the sentence "In the following example, the associated entities are linked through an explicit foreign key column". I tested this code, and the "auth_id" column appeared.
has comment: http://stackoverflow.com/comment/37661617
score: 2
downvote count: 0

http://stackoverflow.com/comment/37614695
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24328619
has text: @Chris read the link mentioned by chafik and you will understand the problem. which cannot be solved if i have to use eclipse link

http://stackoverflow.com/a/24412059
type: Answer
has body: Use this and note this is not my code it's from here: How to play .wav files with java The only thing I did was post it here and optimize it a little. private final int BUFFER_SIZE = 128000; private AudioInputStream audioStream; private SourceDataLine sourceLine; /** * @param filename the name of the file that is going to be played */ public void playSound(String filename){ try { audioStream = AudioSystem.getAudioInputStream(new File(filename)); } catch (Exception e){ e.printStackTrace(); } try { sourceLine = (SourceDataLine) AudioSystem.getLine(new DataLine.Info(SourceDataLine.class, audioStream.getFormat())); sourceLine.open(audioStream.getFormat()); } catch (LineUnavailableException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } sourceLine.start(); int nBytesRead = 0; byte[] abData = new byte[BUFFER_SIZE]; while (nBytesRead != -1) { try { nBytesRead = audioStream.read(abData, 0, abData.length); } catch (IOException e) { e.printStackTrace(); } if (nBytesRead &gt;= 0) { @SuppressWarnings("unused") int nBytesWritten = sourceLine.write(abData, 0, nBytesRead); } } sourceLine.drain(); sourceLine.close(); } I hope this helps.
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24317210

http://stackoverflow.com/q/24384050
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/37712718
has comment: http://stackoverflow.com/comment/37715226
has answer: http://stackoverflow.com/a/24386066
possible better answer: http://stackoverflow.com/a/24384359
has comment: http://stackoverflow.com/comment/37713554
has answer: http://stackoverflow.com/a/24384359
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37713488
has comment: http://stackoverflow.com/comment/37713133
type: Question
accepted answer: http://stackoverflow.com/a/24386066
has comment: http://stackoverflow.com/comment/37712770
answer count: 2
tagged with: android
has comment: http://stackoverflow.com/comment/37715754
has body: I have to design an application for 10 inch tab in Android.But when i run the application the design is in blur or not clear .I don't know why. I have also declare the android:screenOrientation="portrait" in manifest .How to design properly and where I'm doing wrong in xml file.Thanks in advance. Here is my xml file code <?xml version="1.0" encoding="utf-8"?> <ImageView android:id="@+id/imageLogoBBT" android:layout_width="400dp" android:layout_height="80dp" android:layout_alignParentLeft="true" android:layout_marginLeft="5dp" android:layout_marginTop="5dp" android:contentDescription="@string/desc" android:scaleType="fitXY" android:src="@drawable/banya_tree_logo" /> <ImageView android:id="@+id/imageButtonBack" android:layout_width="40dp" android:layout_height="40dp" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_marginRight="15dp" android:layout_marginTop="18dp" android:contentDescription="@string/desc" android:scaleType="fitCenter" android:src="@drawable/back_img" /> <Spinner android:id="@+id/gps_spinnertitleName" android:layout_width="0dp" android:layout_height="40dp" android:layout_marginTop="5dp" android:layout_weight="0.10" android:background="@drawable/button_shape" android:gravity="center" android:inputType="text" android:textColor="#241444" android:textSize="19sp" android:textStyle="normal" /> <EditText android:id="@+id/gps_edittextLastName" android:layout_width="0dp" android:layout_height="40dp" android:layout_marginLeft="5dp" android:layout_marginTop="5dp" android:layout_weight="0.25" android:background="@drawable/button_shape" android:gravity="left" android:inputType="text" android:paddingLeft="5dp" android:paddingTop="5dp" android:textColor="#241444" android:textSize="19sp" android:textStyle="normal" /> <EditText android:id="@+id/gps_editTextFirst" android:layout_width="0dp" android:layout_height="40dp" android:layout_marginLeft="5dp" android:layout_marginTop="5dp" android:layout_weight="0.25" android:background…
has comment: http://stackoverflow.com/comment/37713040
has comment: http://stackoverflow.com/comment/37742842
tagged with: http://stackoverflow.com/tag/xml
has title: How to design in 10 inch tablet only in portrait mode in Android?
has comment: http://stackoverflow.com/comment/37712138

http://stackoverflow.com/a/24400490
has body: In case you are actually using TabSheet you can first add empty layouts on the tabs and then listen for tab selection change events. There you can fill the empty layout with your costly operations.
answers question: http://stackoverflow.com/q/24394729
type: Answer
score: 1
upvote count: 1
downvote count: 0

rpc
tag name: rpc
tags question: http://stackoverflow.com/q/24386008
tags question: http://stackoverflow.com/q/24358112
type: Tag
tags question: http://stackoverflow.com/q/24388490

http://stackoverflow.com/a/24407918
score: 0
has body: An HTTP Post using the HttpClient should work. Perhaps the schema.xml file is referring to other files that need to be uploaded. Can you check the DSE system.log? Can you verify the HTTP Post works with a different schema.xml file?
type: Answer
has comment: http://stackoverflow.com/comment/37776899
answers question: http://stackoverflow.com/q/24296014

http://stackoverflow.com/q/24410395
has body: I' m developing a REST WebApp with spring framework, now i'd like to know the best practice to receive data. It s best to retrieve them with @RequestParam or @PathVariable?Obviously i'm interested in receiving simple data like an userid or an username. Using an example: @RequestMapping(value = "/getdata", method = RequestMethod.GET) public String GetData(@RequestParam(value = "memberId", required = true) Integer memberId){ //return data for user with Id = memberid; } or @RequestMapping(value = "/getdata/{memberid}", method = RequestMethod.GET) public String GetData(@pathvariable int memberid){ //return data for user with Id = memberid; } I'm interested about REST web services
score: 0
has comment: http://stackoverflow.com/comment/37761744
has answer: http://stackoverflow.com/a/24410897
has answer: http://stackoverflow.com/a/34848514
linked to: http://stackoverflow.com/q/3198492
accepted answer: http://stackoverflow.com/a/24410505
tagged with: spring
linked to: http://stackoverflow.com/q/4024271
answer count: 4
possible better answer: http://stackoverflow.com/a/24410633
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24410633
tagged with: java
has answer: http://stackoverflow.com/a/24410505
type: Question
has title: Use @RequestParam or @PathVariable?

http://stackoverflow.com/comment/37633571
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24342751
has text: Please provide some more context for your architectural setup. It reads as if you have 2 servers and then a browser based client, but is not pretty detailed described. It reads like this: a remote server holding the files, then your own server on which you want to fetch the files from the remote server in order to provide the file as a data stream to the browser client. Your are using Javascript and AJAX in the browser in order to do the download call or do you want to simple have links pointing to our REST service URL with the file IDs as the last bit in the URL path?
score: 0

http://stackoverflow.com/comment/37645110
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24340349
has text: Thanks for your response, but the time complexity of this seems over O(n). Do you have any recommendation/solution for reducing time complexity to O(n)?

http://stackoverflow.com/comment/37729687
type: AnswerComment
has text: @user3164184 Updated to reuse the same `StringBuilder` instance. Should make it a bit faster.
comment on: http://stackoverflow.com/a/24391500
score: 0
type: Comment

http://stackoverflow.com/q/24372359
answer count: 3
has title: Servlet connection to database
has comment: http://stackoverflow.com/comment/37692352
has comment: http://stackoverflow.com/comment/37691162
has comment: http://stackoverflow.com/comment/37692077
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/37690441
has answer: http://stackoverflow.com/a/71279578
tagged with: java
has comment: http://stackoverflow.com/comment/37690450
tagged with: servlets
has body: I am trying to connect to jdbc database from servlet.I have separate class dbconnect for connection and inserting data to database. Here is my dbconnect class: import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; public class dbconnect { Connection conn; Statement stm; dbconnect(){ try{ Class.forName("org.apache.derby.jdbc.ClientDriver"); conn = DriverManager.getConnection ("jdbc:derby://localhost:1527/type","nika", "mypass"); stm = conn.createStatement(); System.out.println("success"); String sql = "INSERT INTO USERS " + "VALUES (\"tsogiaidze@yahoo.com\", \"nika\", \"nika\", \"kaci\")"; stm.executeUpdate(sql); } catch (Exception ex){ System.out.println(ex.getMessage()); } } } In servlet I create new dbconnect object which must insert data to database,but it does not happen. Can anyone tell me why it does not work? I guess I make fundamental mistake. Thank you. For more details I have jsp file which sends html form data to this servlet and then I try to write these data to database using dbconnect class. I have changed dbconnect class like this,now I use preparedstatement to write files but still does not work. import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.Statement; public class dbconnect { Connection conn; Statement stm; dbconnect(){ try{ Class.forName("org.apache.derby.jdbc.ClientDriver"); conn = DriverManager.getConnection("jdbc:derby://localhost:1527/type","nika","nika"); stm = conn.createStatement(); System.out.println("success"); String sql = "INSERT INTO NIKA.USERS (mail, pass, gender, saxeli) VALUES (?, ?, ?, ?)"; PreparedStatement statement = conn.prepareStatement(sql); statement.setString(1, "tsogiaidze"); statement.setString(2, "nika"); statement.setString(2, "nika"); statement.setString(2, "kaci"); int rowsInserted = statement.executeUpdate(); if (rowsInserted &gt; 0) { System.out.println("A new user was inserted successfully!"); } } catch (Exception ex){ Sy…
type: Question
has answer: http://stackoverflow.com/a/24372786
has answer: http://stackoverflow.com/a/24372711
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/comment/37706733
type: Comment
type: QuestionComment
has text: I know, but how it can affect on length?
comment on: http://stackoverflow.com/q/24380433
score: 0

http://stackoverflow.com/a/24336673
downvote count: 0
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/37622378
has comment: http://stackoverflow.com/comment/37622313
upvote count: 2
answers question: http://stackoverflow.com/q/24336621
has body: Look at the types more closely - you're trying to add a List&lt;List&lt;Integer&gt;&gt; to the first list inside list1 (because you've called get(0).) This first list (inside the topmost ArrayList) however is of type List&lt;Integer&gt;, not List&lt;List&lt;Integer&gt;&gt; - thus the types don't match, and you get a compile error.

http://stackoverflow.com/a/24302339
answers question: http://stackoverflow.com/q/24302165
type: Answer
has body: for clob field you can make use of .setClob(..) setString():Sets the designated parameter to the given Java String value. The driver converts this to an SQL VARCHAR or LONGVARCHAR value (depending on the argument's size relative to the driver's limits on VARCHAR values) when it sends it to the database. API DOC CLOB API DOC
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/37561620
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24304433
has text: If you updated the Question with a valid benchmark and valid results, it *might* be worth reopening ...
score: 0

http://stackoverflow.com/q/24319420
tagged with: java
has comment: http://stackoverflow.com/comment/37589639
type: Question
tagged with: currency-formatting
answer count: 2
tagged with: javascript
has title: Currency Locale- How to get the locale for the different countries
has answer: http://stackoverflow.com/a/24319555
accepted answer: http://stackoverflow.com/a/24319555
tagged with: currency
score: 0
has body: public double showinbrl(double amount, double rate) { double amountinbrl = amount * rate; NumberFormat brl = NumberFormat.getCurrencyInstance(Locale.BRAZIL); brl.format(amountinbrl); return amountinbrl; } how to get the locale for the different countries... i cant find locale for brazil..
has answer: http://stackoverflow.com/a/76275263
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/76275263

http://stackoverflow.com/q/24314592
has body: if(sqlData.get(i) != null){ DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); java.sql.Timestamp myDate = new java.sql.Timestamp(dateFormat.parse(sqlData.get(i)).getTime()); preparedStatement.setTimestamp(i+1, myDate); I'm not sure what i'm doign wrong and i keep geting "java.text.ParseException: Unparseable date:" on the 3rd line. These are dates that i have pulled out of a database, and are set in the past. System.out.println(sqlData.get(i)); prints out : 2014-04-19 05:48:22
has comment: http://stackoverflow.com/comment/37580462
tagged with: datetime
has comment: http://stackoverflow.com/comment/37580325
has answer: http://stackoverflow.com/a/24314718
accepted answer: http://stackoverflow.com/a/24314718
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37580244
tagged with: java
possible better answer: http://stackoverflow.com/a/24314686
tagged with: mysql
has comment: http://stackoverflow.com/comment/37580372
type: Question
has comment: http://stackoverflow.com/comment/37580266
has comment: http://stackoverflow.com/comment/37580417
score: 0
answer count: 2
has title: How to insert PAST dates into MySQL as Datetime?
has answer: http://stackoverflow.com/a/24314686

http://stackoverflow.com/comment/37611522
comment on: http://stackoverflow.com/a/24330543
score: 0
type: AnswerComment
type: Comment
has text: it should show a table, Kannada Kannada John asfasd

http://stackoverflow.com/comment/37568407
comment on: http://stackoverflow.com/q/24308269
score: 1
has text: Look at the implementations of List. And then according to your requirements go for appropriate concrete implementation of List. For a start go with ArrayList. List<Person> personList = new ArrayList<Person>();
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24272116
tagged with: jsp
favorite count: 0
has answer: http://stackoverflow.com/a/24280124
has title: Converting a CRUD JSP application to be used in CQ5 (OSGi)
tagged with: osgi
type: UnansweredQuestion
tagged with: aem
has answer: http://stackoverflow.com/a/24329093
downvote count: 0
score: 1
tagged with: java
type: Question
has body: I have a very simple CRUD application built using JSP. The application simply shows a list of words can be modified by the user. I want this application to be used inside CQ5. I am new to CQ5 so I'm not sure how complicated this is. From the documentation I've read it seems the JSP application needs to be converted to OSGi module but I haven't found any documentation that shows how the transformation should look and additionally how to actually install this module in CQ5. I would appreciate any help or links that can point to towards getting started
answer count: 2
upvote count: 1

http://stackoverflow.com/comment/37595827
comment on: http://stackoverflow.com/a/24310341
score: 0
type: AnswerComment
type: Comment
has text: The strings to be replaced will be numbers integers

http://stackoverflow.com/q/24318910
tagged with: spring
has comment: http://stackoverflow.com/comment/37588689
type: AnsweredQuestion
score: 7
accepted answer: http://stackoverflow.com/a/24318963
tagged with: java
type: Question
answer count: 1
downvote count: 0
has body: javascript $.ajax({ headers : { 'Accept' : 'application/json' , 'Content-Type' : 'application/json' }, url : "/realgrid/product/addOd.do", type : "post", data : JSON.stringify(JsonOrderDetailValues), dataType : "json", success : function(data){ var json = eval(data); if (json.result == 1) { alert("insert."); }else if(json.result == 2){ alert("update.") }else { alert("error."); } }, error : function(request,status,error){ alert("code:"+request.status+"\n"+"error:"+error); } }); console.log(JsonOrderDetailValues) [Object, Object, Object, Object] 0: Object categoryCode: "AC-MV" categoryName: undefined costPrice: 168050 date: undefined modelCode: "YP-GB70" modelName: undefined no: 1 number: "201309120932" total: 88 totalPrice: 14788400 typeCode: "AV" typeName: undefined unitPrice: 294500 __proto__: Object 1: Object 2: Object 3: Object java spring Controller @RequestMapping (value="/addOd.do",method=RequestMethod.POST) public ModelAndView addOdMaster(@RequestBody List&lt;OrderDetails&gt; od){ //java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast System.out.println(od.get(0).getNumber()); Map&lt;String, Integer&gt; result = new HashMap&lt;String,Integer&gt;(); result.put("result", 0); return new ModelAndView("jsonView",result); } vo public class OrderDetails { private String number; private int no; private String typeCode; private String categoryCode; private String modelCode; private int total; private int costPrice; private int unitPrice; private int totalPrice; public int getTotalPrice() { return totalPrice; } public void setTotalPrice(int totalPrice) { this.totalPrice = totalPrice; } public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } public int getNo() { return no; } public void setNo(int no) { this.no = no; } public String getTypeCode() { return typeCode; } public void setTypeCode(String typeCode) { this.typeCode = typeCode; } public String getCategoryCode() { return categoryCode; } public void…
has answer: http://stackoverflow.com/a/24318963
favorite count: 0
has title: java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast
upvote count: 7

http://stackoverflow.com/a/24358834
upvote count: 1
has body: The error was in the line: featureDetector = FeatureDetector.create("SIFT"); I have replaced it with: SIFT sift = new SIFT(); FeatureDetector featureDetector =sift.getFeatureDetector();
downvote count: 0
answers question: http://stackoverflow.com/q/24347396
type: Answer
score: 1

http://stackoverflow.com/a/24485333
score: 0
type: AcceptedAnswer
type: Answer
has body: I tried with this example and it worked for me. The json look now like this: contract = {fromDate:moment($('#datepickerVon').val(), 'DD-MM-YYYY').format('DD-MM-YYYY'), endDate:moment($('#datepickerVon').val(), 'DD-MM-YYYY').format('DD-MM-YYYY'), Season: { season: "SO14"}, name: {name: "peter"}, category:{category:"SomeString"}}; console.log(contract); $.ajax({ url:'/contracts/search/', dataType: "json", type: "POST", mimeType: 'application/json', contentType: "application/json", data: JSON.stringify(contract), success: function(data) { console.log(data); } }); The Controller receives like this: @RequestMapping(value = "/search/", method = RequestMethod.POST, headers = "Accept=application/json") public ResponseEntity&lt;String&gt; getVertagFromSearch(@RequestBody String json, UriComponentsBuilder uriBuilder){ Contract contract = contract.fromJsonToContract(json); //do Stuff return new ResponseEntity&lt;String&gt;(Contract.toJsonArray(result), headers, HttpStatus.OK); } And the deserialization is here: public static contract fromJsonToContract(String json) { return new JSONDeserializer&lt;Contract&gt;().use(Calendar.class, new CalendarTransformer("dd-MM-yyyy HH:mm")).use(null, Contract.class).deserialize(json); }
answers question: http://stackoverflow.com/q/24411436
accepted answer of: http://stackoverflow.com/q/24411436

http://stackoverflow.com/comment/37600670
comment on: http://stackoverflow.com/q/24325277
score: 0
type: QuestionComment
type: Comment
has text: I'm just wondering, spring seems to be initialized correctly: **Information: Initializing Spring root WebApplicationContext** - do I miss something in my context.xml?

http://stackoverflow.com/q/24346787
has body: So I understand that strings in Java are immutable. I'm interested in how to repeatedly update a certain string. Ex: public static void main(String[] args) { String myString = "hey"; for (int i = 1; i &lt;= 9; i++) { myString += "hey"; } } Now, this won't work in Java because I've already declared and assigned myString. How do people get around Java's immutable strings (as in the above example)? The only thing I can think to do is declare another string. Unfortunately, this just delays my problem, as the second time through the loop, I'll be reassigning an already assigned string: public static void main(String[] args) { String myString = "hey"; String secondString; for (int i = 1; i &lt;= 10; i++) { secondString += "hey"; } } Any suggestions / explanations are much appreciated! Thanks, Mariogs
has answer: http://stackoverflow.com/a/24346829
has answer: http://stackoverflow.com/a/24346811
accepted answer: http://stackoverflow.com/a/24346811
has answer: http://stackoverflow.com/a/24346806
answer count: 6
has comment: http://stackoverflow.com/comment/37641902
has title: Repeatedly updating string in Java
has comment: http://stackoverflow.com/comment/37641724
has answer: http://stackoverflow.com/a/24346831
has answer: http://stackoverflow.com/a/24346804
has answer: http://stackoverflow.com/a/24346846
favorite count: 0
possible better answer: http://stackoverflow.com/a/24346806
downvote count: 1
has comment: http://stackoverflow.com/comment/37641720
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37641731
has comment: http://stackoverflow.com/comment/37641729
upvote count: 3
has comment: http://stackoverflow.com/comment/37641734
tagged with: java
type: Question

http://stackoverflow.com/a/24337376
has comment: http://stackoverflow.com/comment/76290676
accepted answer of: http://stackoverflow.com/q/24337311
has body: Is there a shorter way of achieving this? Create a method and pass in the button as a parameter. The solutions proposed there are not useful to me, since I do not want to change the layout. The solution did not involve changing the layout manager for then entire panel. It involved adding a panel using a CardLayout containing your button and an empty panel to your main panel. I want to set some buttons as invisible You could replace the button with another component: GridBagConstraints gbc = layout.getConstraints( button ); panel.remove( button ); panel.add( new JLabel(" "); panel.revalidate(); So as you can see whatever you do it will require multiple lines of code, so pick the easiest solution and just move the code to a method so that you only need to use a single statement for each component you want to hide.
type: Answer
answers question: http://stackoverflow.com/q/24337311
has comment: http://stackoverflow.com/comment/37623692
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37776627
score: 0
has text: No it works only for ajax but the requests can be of any type.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24418043

http://stackoverflow.com/comment/37628067
type: AnswerComment
comment on: http://stackoverflow.com/a/24325570
score: 0
type: Comment
has text: But not formatted. The first step would be to get the img tag by `.getElementByTag("img");` Please try.

http://stackoverflow.com/comment/37748810
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24403325
has text: @geoand : Sir Its an ajax based application so I have used JsonView() And its just Spring MVC
score: 0

http://stackoverflow.com/q/24354174
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37656149
type: Question
has comment: http://stackoverflow.com/comment/37656398
accepted answer: http://stackoverflow.com/a/24354352
has answer: http://stackoverflow.com/a/24354310
has comment: http://stackoverflow.com/comment/37656615
score: 0
possible better answer: http://stackoverflow.com/a/24354310
answer count: 2
has comment: http://stackoverflow.com/comment/37677308
has body: I made several instances of objects in a hashtable and want to call a method from each of them. I made a for that goes through an enumeration of the values retrieved from said hashtable, but I'm unsure how to actually call the method on each object. for(Enumeration&lt;Agent&gt; AgentEnum = AgentList.elements(); AgentEnum.hasMoreElements();){ //content+= AgentEnum.nextElement(); } Content should receive the return of the method I'm trying to call from class Agent.
has comment: http://stackoverflow.com/comment/37656119
has answer: http://stackoverflow.com/a/24354352
linked to: http://stackoverflow.com/q/2351331
has title: Java: How to call a method from class from an enumeration of instanced objects?
has comment: http://stackoverflow.com/comment/37656081

http://stackoverflow.com/a/24282061
score: 0
has body: java.lang is reserved for java classes for security reasons. There is no reason for compilation error since your code is syntactically correct.
type: Answer
answers question: http://stackoverflow.com/q/24281885

http://stackoverflow.com/comment/38305392
score: 0
comment on: http://stackoverflow.com/q/24427409
type: Comment
has text: Thaks Donovan. I've already search in those modules. However my question was more generic about the possibility to write plugins that are reusable within any models.
type: QuestionComment

http://stackoverflow.com/a/24289907
has comment: http://stackoverflow.com/comment/37536704
has comment: http://stackoverflow.com/comment/37536538
score: 0
has comment: http://stackoverflow.com/comment/37533677
answers question: http://stackoverflow.com/q/24289778
type: Answer
has body: You can just supply a drawable as the resource in your Selector XML. The drawable can be anything (PNG, XML, etc) Like this: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:drawable="@drawable/shape_highlighted" android:state_pressed="true"/&gt; &lt;item android:drawable="@drawable/shape_disabled" android:state_enabled="false"/&gt; &lt;item android:drawable="@drawable/shape_normal"/&gt; &lt;/selector&gt;

http://stackoverflow.com/a/24309773
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24309495
has body: Change line 2 to: public static List&lt;? extends Animal&gt; getAll() { it will work. See Java Wildcards in Generics for more information
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24309495

http://stackoverflow.com/a/24381804
has comment: http://stackoverflow.com/comment/37708698
has comment: http://stackoverflow.com/comment/37710970
accepted answer of: http://stackoverflow.com/q/24381503
has comment: http://stackoverflow.com/comment/37708614
score: 0
has comment: http://stackoverflow.com/comment/37708270
answers question: http://stackoverflow.com/q/24381503
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37715574
type: Answer
has body: Interfaces are like templates and they do not provide any implementation . They are just meant to provide a kind of guideline to the implementing classes. A class may implement any number of intefaces but can extend only one class. The reason for this is that extending two classes that have a same method may create ambiguity when the same method is referred to from the child class (Since it is implemented). But since intefaces do not provide implementation , the implementing class will implement the method , which satisfies the implementation compulsion for both the interfaces . Quoting from the java lanuguage specification It is permitted for a single method declaration in a class to implement methods of more than one superinterface. For example, in the code: Example:- interface Fish { int getNumberOfScales(); } interface Piano { int getNumberOfScales(); } class Tuna implements Fish, Piano { int getNumberOfScales() { return 91; } } the method getNumberOfScales in class Tuna has a name, signature, and return type that matches the method declared in interface Fish and also matches the method declared in interface Piano; it is considered to implement both. Now we can see this is allowed in java, and whenever we do something like this:- Tuna t = new Tuna(); t.getNumberOfScales(); We know it will always point one function without ambiguity.
has comment: http://stackoverflow.com/comment/37714375
has comment: http://stackoverflow.com/comment/37708894

fft
tags question: http://stackoverflow.com/q/24403764
type: Tag
tags question: http://stackoverflow.com/q/24316804
tags question: http://stackoverflow.com/q/24270351
tags question: http://stackoverflow.com/q/24331993
tag name: fft

http://stackoverflow.com/a/24421086
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37782109
upvote count: 1
has body: Seems like you're getting tripped up on the type inference piece. It's binding the rest of your elements to a type of Class extends Comparable &amp; Serializable (from the compiler error). You can fix this by adding a wildcard-extends clause to your generic list; you only really care about elements that could actually be assigned as a Class. List&lt;? extends Class&gt; c = ListUtils.newList(String.class,Long.class);
score: 1
answers question: http://stackoverflow.com/q/24421040

http://stackoverflow.com/a/24410343
has body: The problem here I see is possibly, that You have a whitespace in your pathname: ("/sdcard/Track Monitor/" + MonitoringController.routname+ "/" + "client_logo.png"); The part "/sdcard/Track Monitor/" is maybe the error. You should handle such problems and replace whitespaces in path like: String filePath = "/sdcard/Track Monitor/" + MonitoringController.routname+ "/" + "client_logo.png"; String filePathWithoutBlank = filePath.replace(" ","\\ "); If this is not the Problem, come back and show us the logcat ouptut to give an exact answer. EDIT You have to declare Your Activity inside the manifest.xml like this: &lt;activity android:name=".YourActivity" &gt; &lt;/activity&gt;
has comment: http://stackoverflow.com/comment/37763248
answers question: http://stackoverflow.com/q/24410073
has comment: http://stackoverflow.com/comment/37762775
type: Answer
score: 0

http://stackoverflow.com/a/24321392
type: Answer
has body: You could use this: (?s)[0-9]{2}/[0-9]{2}/[0-9]{4}.*?(?=\s*[0-9]{2}/[0-9]{2}/[0-9]{4}|$) See demo.
answers question: http://stackoverflow.com/q/24321156
has comment: http://stackoverflow.com/comment/37593634
accepted answer of: http://stackoverflow.com/q/24321156
has comment: http://stackoverflow.com/comment/37593163
has comment: http://stackoverflow.com/comment/37593424
has comment: http://stackoverflow.com/comment/37598746
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37593346
has comment: http://stackoverflow.com/comment/37593130

http://stackoverflow.com/comment/37511000
type: Comment
has text: If you make the changes to and then update your code above and post a stacktrace of the error we'd be more able to help you. Make sure to indicate any lines referenced in the error so we know where the problem likely lies.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24277958

http://stackoverflow.com/comment/37652667
score: 0
type: Comment
has text: Sorry for the confusion ... I've made an edit, please try the new code and let me know if it works ... :)
type: AnswerComment
comment on: http://stackoverflow.com/a/24352488

http://stackoverflow.com/q/24306071
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has title: timer.schedule() in not working at all (in Java)
tagged with: awt
score: 0
accepted answer: http://stackoverflow.com/a/24306573
answer count: 1
favorite count: 0
has body: I made a simple program in Java which draws a rectangle on a canvas. And then the rectangle starts moving along X-axis, from left to right. But the timer.schedule() function is not working. Following is the code:- package firstanimation; import java.awt.*; import java.util.Timer; public class FirstAnimation { public static void main(String[] args) { Frame frame = new Frame("SomeRandomName"); frame.setBounds(50, 50, 700, 500); frame.setBackground(Color.red); MyCanvas canvas = new MyCanvas(); frame.add(canvas); frame.setVisible(true); Graphics graph = frame.getGraphics(); Timer timer = new Timer(); Task task = new Task(canvas, graph); timer.schedule(task, 1000,1000); } } package firstanimation; import java.awt.*; public class MyCanvas extends Canvas{ public int x,y,width,height; public MyCanvas() { x = 0; y = 0; width = 50; height = 50; } @Override public void paint(Graphics g) { g.setColor(Color.LIGHT_GRAY); g.fillRect(x, y, width, height); } @Override public void update(Graphics g) { x+=10; g.fillRect(x, y, width, height); } } package firstanimation; import java.util.TimerTask; import java.awt.Graphics; public class Task extends TimerTask{ private MyCanvas canvas; private Graphics graphics; public Task(MyCanvas can, Graphics g) { super(); canvas = can; graphics = g; canvas.paint(g); } @Override public void run() { canvas.update(graphics); //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } } But the strange thing is... Every time i'm maximizing and restoring the frame, the box is moving. Why is this happening?
tagged with: timer
has answer: http://stackoverflow.com/a/24306573
tagged with: animation
tagged with: swing
type: AnsweredQuestion

http://stackoverflow.com/q/24267112
tagged with: sql
possible better answer: http://stackoverflow.com/a/40490219
has comment: http://stackoverflow.com/comment/37490513
linked to: http://stackoverflow.com/q/20244173
has title: Prevent this statement from SQL injection
linked to: http://stackoverflow.com/q/3271249
tagged with: sql-injection
tagged with: jdbc
has comment: http://stackoverflow.com/comment/37583437
has body: I am trying to write a very simply query using the PreparedStatement class. I read here:Fail to convert to internal representation JDBC that you cannot parameterize column names, only values. Since my query is very simple, the only 'value' I can parameterize is count (*). This is the query: SELECT COUNT (*) FROM EZ_DAY If I try to parameterize it like this: SELECT ? FROM EZ_DAY I get an error: Fail to convert to internal representation when using the method getInt() on the ResultSet. How can I use PreparedStatement and parameterize something in this query to prevent SQL injection? Also I know you can't parameterize column names, does that include table names? For example, can I do something like: SELECT COUNT (*) FROM ? ?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24267174
has comment: http://stackoverflow.com/comment/37489932
tagged with: prepared-statement
has comment: http://stackoverflow.com/comment/37490113
type: Question
has comment: http://stackoverflow.com/comment/37489900
tagged with: java
has comment: http://stackoverflow.com/comment/37492209
has answer: http://stackoverflow.com/a/40490219
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24267174

http://stackoverflow.com/q/24308202
type: UnansweredQuestion
upvote count: 3
tagged with: java
type: Question
score: 3
tagged with: pessimistic-locking
tagged with: concurrency
has title: Hybrid optmistic / pessimistic locks
tagged with: optimistic-locking
has body: The application Hi, We have an application (J2EE/Hibernate/JPA) with several users making actions on a common entity. To simplify, let's say this application is like Google docs : A shared document on which many users can update at the same time. We have chosen optmistic lock to handle concurrency : Sentences are separate entities There is a low chance that several users will update the same sentence at the same time In that case, it is ok for one of the user to receive a message "sorry another user tried to edit the same sentence" Background processes So far, so good. But now, we have added background processes (quite fast ones) to this application. They regularly make changes (let say it replace any occurence of a word by another). It is ok for those job to fail. Their task is not urgent, and they can try the same task the next time (10 seconds after). The problem with the optimistic lock in that situation is that now a single user cannot perform anymore long actions on te whole document. Indeed, if a user changes the font of the whole document (on all sentences), and this action takes a while (> 10 sec), then in the meantime the background process will change some words, and the longer action (= the user action : change font) will fail on concurrent access. This is not acceptable to show this mesage to the user : "Your action failed because some technical process was running at same time". And since the background process could retry later, we would rather have it fail. The question How do we setup pessimistic lock for some actions / actors , within a optimistic lock approach ? Potential solutions In order to keep the optimistic approch for the users, we have thought of the following solution : Create a "user action" flag, that would be set during any action of any user A job will not start until this flag is "off" At the end of any running processes, check if the flag is on : If so, cancel this action / rollback. This way, the processes will only be able to run …
answer count: 1
tagged with: jpa
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24308420

http://stackoverflow.com/q/24411248
has comment: http://stackoverflow.com/comment/37763862
score: 5
has answer: http://stackoverflow.com/a/24411884
has answer: http://stackoverflow.com/a/24411687
has body: I have a table which I need to query, then organize the returned objects into two different lists based on a column value. I can either query the table once, retrieving the column by which I would differentiate the objects and arrange them by looping through the result set, or I can query twice with two different conditions and avoid the sorting process. Which method is generally better practice? MY_TABLE NAME AGE TYPE John 25 A Sarah 30 B Rick 22 A Susan 43 B Either SELECT * FROM MY_TABLE, then sort in code based on returned types, or SELECT NAME, AGE FROM MY_TABLE WHERE TYPE = 'A' followed by SELECT NAME, AGE FROM MY_TABLE WHERE TYPE = 'B'
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24411651
possible better answer: http://stackoverflow.com/a/24411687
upvote count: 5
tagged with: java
has title: Better to query once, then organize objects based on returned column value, or query twice with different conditions?
tagged with: database
has comment: http://stackoverflow.com/comment/37763350
type: Question
has answer: http://stackoverflow.com/a/24411721
downvote count: 0
has answer: http://stackoverflow.com/a/24412093
has comment: http://stackoverflow.com/comment/37763602
has answer: http://stackoverflow.com/a/24411637
tagged with: sql
has answer: http://stackoverflow.com/a/24411651
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/24411782

http://stackoverflow.com/comment/37773531
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24415245
has text: @KumarAlok It could well be that ideone is playing tricks with threading so that no one process can spam its servers with threads.

http://stackoverflow.com/comment/37697671
type: Comment
comment on: http://stackoverflow.com/a/24376223
score: 0
type: AnswerComment
has text: but the name of class is OperationManagerImpl with uppercase and not as you say what's the matter ?

http://stackoverflow.com/q/24412329
answer count: 1
has comment: http://stackoverflow.com/comment/37766082
has comment: http://stackoverflow.com/comment/37765476
has comment: http://stackoverflow.com/comment/37765963
has title: create a stack in java
has comment: http://stackoverflow.com/comment/37765989
has comment: http://stackoverflow.com/comment/37766290
has body: I need to use stack to create a list storing objects, and I try to look up in API, however, I have no idea which is the syntax I should refer to. Here is my code: public class Rock { public String name; public Rock(String name){ this.name=name; } } public class RockTest{ public static void main(String[] args){ Rock r1 = new Rock("eluanshi"); Rock r2 = new Rock("jingangshi"); Rock r3 = new Rock("dalishi"); Stack(r1,r2,r3); // this is obviously wrong but how can i deal with it } }
tagged with: vector
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37765766
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37765765
favorite count: 0
has comment: http://stackoverflow.com/comment/37765681
type: Question
has answer: http://stackoverflow.com/a/24412377
has comment: http://stackoverflow.com/comment/37765592
has comment: http://stackoverflow.com/comment/37765425
has comment: http://stackoverflow.com/comment/37765444
has comment: http://stackoverflow.com/comment/37765806
accepted answer: http://stackoverflow.com/a/24412377
tagged with: stack
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/37765456

http://stackoverflow.com/q/24296796
score: 0
tagged with: java
answer count: 1
type: AnsweredQuestion
tagged with: keystroke
type: Question
has answer: http://stackoverflow.com/a/24296820
has title: Capture Keystrokes when program is not active
accepted answer: http://stackoverflow.com/a/24296820
has body: I code in java. I wrote a keylistener for the frame and it prints all the keystrokes when the frame is active, but when i minimize it or deactivate it, the program obviously stops and no keystrokes are printed. I wanted to make a small game where i enter a key and using the robot class, it presses another set of keys but this game is in flash. any idea as to how i would capture keystrokes when window is deactivated. edit: I only code in java so is it possible using only java or at most combining it with native machine... i use windows

filter
tags question: http://stackoverflow.com/q/24270687
tag name: filter
tags question: http://stackoverflow.com/q/24302991
type: Tag
tags question: http://stackoverflow.com/q/24368144
tags question: http://stackoverflow.com/q/24363392

http://stackoverflow.com/comment/37785384
type: AnswerComment
has text: The log shows that the error is because of `SqlSessionBuilder.build(..)`, which is present in the given code with enough details. And the order in your test, doesn't that matter ? If it does, then shouldn't `PowerMock.expectNew(...)` be below the first `EasyMock.expect(...)`
comment on: http://stackoverflow.com/a/24409517
score: 0
type: Comment

http://stackoverflow.com/a/24387232
has body: You are performing integer arithmetic and have overflowed an int. The max value of a (signed) int is 2,147,483,647 (2^31-1). There are 86,400,000 milliseconds in ONE_DAY. On day 25 you reach 2,160,000,000, which is a larger value than can be represented in an int and you overflow into negative numbers. You can solve this by doing your math with longs instead of ints. public static void main(String[] args) { Calendar cal = Calendar.getInstance(); final long oneDay = 24 * 60 * 60 * 1000; for(int i=0; i &lt; 30; i++) { cal.setTimeInMillis(System.currentTimeMillis() - i * oneDay); System.out.println(cal.getTime()); } }
downvote count: 0
answers question: http://stackoverflow.com/q/24387050
type: Answer
upvote count: 2
score: 2

http://stackoverflow.com/comment/37523047
score: 0
comment on: http://stackoverflow.com/q/24284013
type: Comment
type: QuestionComment
has text: It can't be `Object`, it must extend `Throwable`.

http://stackoverflow.com/comment/37750904
comment on: http://stackoverflow.com/a/24402527
score: 0
type: AnswerComment
type: Comment
has text: @AhmadBassiouny can you send your actual coding? and i will correct it if i can :)

http://stackoverflow.com/q/24399043
answer count: 1
has body: I am developing an android app which launch my server address in chrome/firefox. I'm successful in that. Later in the development, I'm required to listen to the server which will notify me whether has my browser crash or hang. When this happen, I will need to restart the browser. This is what I did, when user press the button: Intent i = new Intent("android.intent.action.MAIN"); i.setComponent(ComponentName.unflattenFromString("com.android.chrome/com.android.chrome.Main")); i.addCategory("android.intent.category.LAUNCHER"); i.setData(Uri.parse("http://stackoverflow.com/")); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); ** This will bring the browser to the foreground, I want this to be restarted when it hang. How do I restart (close and start again) this foreground browser that was launch by my app programmatically?
has comment: http://stackoverflow.com/comment/37741260
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/24399247
type: UnansweredQuestion
tagged with: java
downvote count: 2
type: Question
score: -2
has title: Killing foreground browser programmatically
upvote count: 0

http://stackoverflow.com/comment/37591183
type: AnswerComment
comment on: http://stackoverflow.com/a/24305374
type: Comment
has text: Want the value of the respective 'key', here 'value' is a JAXB object.
score: 0

http://stackoverflow.com/q/24280372
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/37525448
has comment: http://stackoverflow.com/comment/37515286
has body: I am trying to get a JavaCC plugin working properly with Gradle. The plugin generates .java files correctly, but then during the compileJavaC task it crashes and burns with cannot find symbol errors. My JavaCC .jj file contains code that references other java files that are not generated, and I am guessing that the compileJava task tries to compile the generated code without providing a reference to the non-generated code. Here is a minimum breaking example. build.gradle: apply plugin: 'java' //compile .jj file in src/main/javacc buildscript { repositories { mavenCentral() } dependencies { classpath group: 'ca.coglinc', name: 'javacc-gradle-plugin', version: '1.0.0' } } apply plugin: 'javacc' src/main/MyClass.java: public class MyClass { public MyClass(){ } } and src/main/javacc/MyParser.jj: options {} PARSER_BEGIN(MyParser) import java.util.*; public class MyParser { public static void main(String[] args) throws ParseException { MyClass mc = new MyClass(); } } PARSER_END(MyParser) SKIP: { " " } TOKEN: { &lt;ANYTHING: ~[]&gt; } void production(): {} { (&lt;ANYTHING&gt;)+ } Running gradle build gives the following: gradle build :compileJavacc Java Compiler Compiler Version 5.0 (Parser Generator) (type "javacc" with no arguments for help) Reading from file C:\Users\Nate Glenn\Desktop\java_workspace\test-gradle-javacc\ src\main\javacc\MyParser.jj . . . File "TokenMgrError.java" does not exist. Will create one. File "ParseException.java" does not exist. Will create one. File "Token.java" does not exist. Will create one. File "SimpleCharStream.java" does not exist. Will create one. Parser generated successfully. :compileJavaC:\Users\Nate Glenn\Desktop\java_workspace\test-gradle-javacc\build\ generated\javacc\MyParser.java:5: error: cannot find symbol MyClass mc = new MyClass(); ^ symbol: class MyClass location: class MyParser C:\Users\Nate Glenn\Desktop\java_workspace\test-gradle-javacc\build\generated\ja vacc\MyParser.java:5: error: cannot find symbol MyClass mc = new M…
tagged with: java
has comment: http://stackoverflow.com/comment/37518906
tagged with: gradle
has answer: http://stackoverflow.com/a/24356911
has comment: http://stackoverflow.com/comment/37524862
answer count: 2
possible better answer: http://stackoverflow.com/a/31478370
downvote count: 0
has answer: http://stackoverflow.com/a/31478370
has comment: http://stackoverflow.com/comment/37520715
has comment: http://stackoverflow.com/comment/37519272
favorite count: 0
has comment: http://stackoverflow.com/comment/37566252
has comment: http://stackoverflow.com/comment/37521227
tagged with: javac
has comment: http://stackoverflow.com/comment/37520468
accepted answer: http://stackoverflow.com/a/24356911
tagged with: javacc
has title: gradle generated files fail to compile
upvote count: 3
has comment: http://stackoverflow.com/comment/37517369
has comment: http://stackoverflow.com/comment/37586845
type: Question

http://stackoverflow.com/comment/37665933
score: 0
has text: Have you tried looking around? What have you found? And if you know the number is 16 bits, you can easily calculate the range...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24359175

http://stackoverflow.com/comment/37667038
comment on: http://stackoverflow.com/q/24359606
score: 0
has text: Note: Country.US is a String, but your method expects a `Country` not a String.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24297541
tagged with: java
has comment: http://stackoverflow.com/comment/37548253
type: Question
accepted answer: http://stackoverflow.com/a/24297656
tagged with: bounded-wildcard
answer count: 1
has comment: http://stackoverflow.com/comment/37548237
score: 0
has title: How to upper bound a map's value type
tagged with: generics
has body: When should one of these be preferred to another? public static void doStuffWithIt_A( Map&lt;Integer, ? extends Object &gt; theThings){ ...} public static void doStuffWithIt_B( Map&lt;Integer, ? &gt; theThings){ ...} public static void doStuffWithIt_C( Map&lt;Integer, Object &gt; theThings){ ...} I've been using a variable parameters passing interface in java, inspired by python's "**kw"argument syntax, and I'm trying to get it 'more right'
has comment: http://stackoverflow.com/comment/37548207
has comment: http://stackoverflow.com/comment/37548249
has comment: http://stackoverflow.com/comment/37548218
has answer: http://stackoverflow.com/a/24297656
linked to: http://stackoverflow.com/q/2723397
has comment: http://stackoverflow.com/comment/37548208
type: AnsweredQuestion

http://stackoverflow.com/a/24420184
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24415313
has body: Deleted the fragment_main.xml and thetext linking it in the .java file. This fixed my issues

http://stackoverflow.com/q/24302055
tagged with: wsdl
answer count: 1
has title: SOAP security, headers and Handlers In JAVA
has body: I am dabbling with SOAP web services in JAVA with JWS. I want to implement custom headers that are constant for all webmethods provided so it would be inefficient to have the same parameter as an argument for all webmethods offered and declaring them as headers with the web param annotation. My trouble is i can implement a protocol handler to ensure that all my custom header parameters are present and throw an fault in the event they are not however this is a restful approach as these parameters will not be defined in the WSDL created which to me would mean I am not strictly following the concept behind soap and the WSDL (that being it is the contract of communication between to applications.) This example describes something similar but "Parse undeclared custom headerLet's consider We need to read WSS UserToken non published in our WSDL :" I need all the information required to be described in the WSDL both header and Body sections. All resources and questions on the matter are similar they just implement the handler but they are not described in the WSDL. Thanks in Advance.
type: UnansweredQuestion
tagged with: soap
tagged with: web-services
has answer: http://stackoverflow.com/a/24302698
type: Question
tagged with: soaphandler
tagged with: java
score: 0

http://stackoverflow.com/a/24284118
has comment: http://stackoverflow.com/comment/37522316
has comment: http://stackoverflow.com/comment/37522858
type: Answer
has comment: http://stackoverflow.com/comment/37522385
has comment: http://stackoverflow.com/comment/37523433
has comment: http://stackoverflow.com/comment/37522507
answers question: http://stackoverflow.com/q/24283971
has comment: http://stackoverflow.com/comment/37522647
score: 0
accepted answer of: http://stackoverflow.com/q/24283971
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37522578
has body: There might be 2 potential problems: The name of the datasource in standalone.xml might be wrong or missing. You might need to change java:jboss/datasources/DoDSRDS in persistence.xml to java:/DoDSRDS . I'd your main problem is number 2 but number 1 might still be true (you didn't provide the name definition in your post). Update: If you don't need to use the name jboss/datasources/DoDSRDS I'd suggest just using DoDSRS, i.e. jndi-name="java:/DoDSRDS" and java:/DoDSRDS . Update 2: A third problem might be the spaces in the pool-name. I'm not sure they're allowed here but at least it might cause problems if you reference the pool by name and don't have the exact same number of spaces, so I'd remove those in any case.
has comment: http://stackoverflow.com/comment/37522720

http://stackoverflow.com/q/24376934
has answer: http://stackoverflow.com/a/24376970
has body: I researched the term of View and found that the definition to be "topmost view in the current view hierarchy. http://developer.android.com/reference/android/view/View.html#getRootView%28%29 I know that view itself means components of an user interface(source: same link) and can be buttons. Say I have this hierarchy Link: http://imgur.com/YIVKNO5 By the definition at the top, would the topmost view be the image view(which is at the top of the screen) or the relative layout(that contains everything)
type: Question
accepted answer: http://stackoverflow.com/a/24376970
linked to: http://stackoverflow.com/q/12166905
has comment: http://stackoverflow.com/comment/37700971
answer count: 1
has title: What is the root view exactly given an example?
tagged with: view
has comment: http://stackoverflow.com/comment/37699068
tagged with: android
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/comment/37643942
comment on: http://stackoverflow.com/q/24347965
type: QuestionComment
type: Comment
score: 2
has text: This question appears to be off-topic because it is about A mnemonic for remembering what is a float vs. double. vs. decimal vs. dinosaur.

http://stackoverflow.com/comment/37639279
has text: Yes, I went through them all. The focus there is on java:comp schemes for configuration file initialization and configuration of resource managers. In my case I want to populate programatically the namespace and nothing is mentioned other than java:comp/env ...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24344771
score: 0

http://stackoverflow.com/comment/37670360
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24361610
score: 0
has text: Any chance to split into public and internal interfaces (with default methods on the internal one)? Internal can still `extend` the public interface.

http://stackoverflow.com/comment/37709557
has text: This is how it is : grant codeBase "file:${{java.ext.dirs}}/*" { permission java.security.AllPermission; };
score: 0
comment on: http://stackoverflow.com/a/24382553
type: Comment
type: AnswerComment

ios
tags question: http://stackoverflow.com/q/24408537
tags question: http://stackoverflow.com/q/24280174
tags question: http://stackoverflow.com/q/24346767
type: Tag
tags question: http://stackoverflow.com/q/24306837
tags question: http://stackoverflow.com/q/24378210
tags question: http://stackoverflow.com/q/24398620
tag name: ios
tags question: http://stackoverflow.com/q/24351326
tags question: http://stackoverflow.com/q/24411666

http://stackoverflow.com/q/24346354
score: -1
has comment: http://stackoverflow.com/comment/37641252
has comment: http://stackoverflow.com/comment/37641393
tagged with: version
has comment: http://stackoverflow.com/comment/37641307
has comment: http://stackoverflow.com/comment/37641837
favorite count: 0
possible better answer: http://stackoverflow.com/a/24346709
has answer: http://stackoverflow.com/a/24346709
has comment: http://stackoverflow.com/comment/37641456
tagged with: maven
has comment: http://stackoverflow.com/comment/37641377
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24397778
tagged with: java
has comment: http://stackoverflow.com/comment/37641427
downvote count: 1
accepted answer: http://stackoverflow.com/a/24397778
has body: I'm running a hadoop job on my university cluster, which is failing with the following error: hadoop jar target/SpamClassifier-1.0-SNAPSHOT-jar-with-dependencies.jar <args> Exception in thread "main" java.lang.UnsupportedClassVersionError: infolab/social/spam/FeatureApp : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) at java.lang.ClassLoader.defineClass(ClassLoader.java:615) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at org.apache.hadoop.util.RunJar.main(RunJar.java:205) I've done a bit of reading, and it looks like this can be because the jar is compiled with a version of java that is different to the runtime version. I tried building on the hadoop master itself (because I enjoy the luxury of permissive shell access to the machine), but it was to no avail. Java version: $ 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) Maven version: Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 09:22:22-0600) Maven home: /opt/apache-maven-3.1.1 Java version: 1.7.0_45, vendor: Oracle Corporation Java home: /usr/java/jdk1.7.0_45/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "2.6.32-431.5.1.el6.x86_64", arch: "amd64", family: "unix" Hadoop version (Hortonworks): $ hadoop version Hadoop…
type: Question
tagged with: hadoop
has title: UnsupportedClassVersionError on hadoop with no apparent change of version
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/37640894

http://stackoverflow.com/a/24343275
score: 0
type: Answer
has body: I guess you updated the eclipse recently, it might be related to the update process. please have a look Bug : https://bugs.eclipse.org/bugs/show_bug.cgi?id=385665
answers question: http://stackoverflow.com/q/24343159

http://stackoverflow.com/comment/37792105
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24423398
has text: First, forget about the output streams. Use ByteBuffer to send your headers. Second, you can achieve a connect timeout via SocketChannel.socket().connect().

http://stackoverflow.com/comment/37494293
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/24269308
has text: Java's static variables are different from those in C. The language just isn't made that way. To get the same effect, you need to make a class variable outside the static method.
type: Comment

http://stackoverflow.com/comment/37684972
comment on: http://stackoverflow.com/a/24368441
type: AnswerComment
score: 0
type: Comment
has text: @user3767791 never pass fileName as null ... have a null check first in the method

http://stackoverflow.com/comment/117770689
score: 2
comment on: http://stackoverflow.com/a/61555391
type: AnswerComment
has text: Beware of version compatibility: I just found out Hibernate Validator 6.1 will not work with `org.glassfish:jakarta.el:4.0.1`, I need to stick to `org.glassfish:jakarta.el:3.0.3` (until I upgrade Hibernate Validator I guess).
type: Comment

http://stackoverflow.com/a/24426987
type: Answer
score: 1
upvote count: 1
has body: You can use android:src="@drawable/imageName" So that the image will be perfect fit. Also you can use android:scaleType="fitCenter" android:adjustViewBounds="true" If you are using TextView then your background may not be good
answers question: http://stackoverflow.com/q/24426896
downvote count: 0

http://stackoverflow.com/comment/37699449
type: AnswerComment
has text: I'm actually only quite familiar with *Maven* and am maybe relying too much on what I'm used to. But, by doing this, the other projects who have a *Maven dependency* to `yourproject` won't have any visibility to the `MP3Player` class or anything that's not in the `yourproject.api` package, even though **at runtime**, the MP3Player implementation will be used, of course, yes.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24377082

http://stackoverflow.com/q/24372073
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37707492
has comment: http://stackoverflow.com/comment/37692428
favorite count: 0
has comment: http://stackoverflow.com/comment/37694853
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37740273
has comment: http://stackoverflow.com/comment/37691746
has body: I have a table which resides a string field that is separated by comma and I have a string array. I want to look this comma separated string feild inside the string array. I couldn't tokenize the string feild so that I can look inside string array by "IN" clause. Example is below: String feild = "inbox, outbox, draft, sent"; String[] strArray = ["inbox, "outbox", "sent", "web", "software"]; How can I get the intersection of the feild string with the string array?
score: 2
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24402342
type: Question
has comment: http://stackoverflow.com/comment/37692124
has title: Intersection of string field with string array in hibernate
upvote count: 2
tagged with: sql

http://stackoverflow.com/comment/37719014
comment on: http://stackoverflow.com/q/24387657
has text: jarsigner should sign the jar as a whole. What command do you give and what error message do you get?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24401960
has body: What you want is a new datatype, which contains two doubles and one String. from this, you create one array. You could do it starting messing with indexes, but that would make it more complex than it should be, and it would be more prone to errors.
answers question: http://stackoverflow.com/q/24401932
type: Answer
score: 0

http://stackoverflow.com/comment/37742995
has text: Great Glad TO Help You!! You should Accept One of the answers which you feel the one which solved the problem! Thanks.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24400234

http://stackoverflow.com/comment/37781990
type: QuestionComment
comment on: http://stackoverflow.com/q/24413746
has text: Not solving your problem, but `TaskInternal#execute()` should never be called from user code. Instead use `dependsOn prepareForIntegrationTests` (without the `doFirst`).
type: Comment
score: 0

http://stackoverflow.com/a/35721171
answers question: http://stackoverflow.com/q/24360656
has body: The ExecutorService generates a Future that you can use to await for the computation to finish. According to ExecutorService documentation: Method submit extends base method Executor.execute(java.lang.Runnable) by creating and returning a Future that can be used to cancel execution and/or wait for completion. Storing the Futures your executorService.submit method call returns and then calling Future#get() on all of your futures will ensure your Runnable will finish executing. According to Future#get() documentation: Waits if necessary for the computation to complete, and then retrieves its result. It should be safe to make your assertions after that.
type: Answer
score: 0

http://stackoverflow.com/q/24419994
has title: Java - SQL Exception column doesn't have default value
score: 0
tagged with: sql
has answer: http://stackoverflow.com/a/24420018
answer count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24420018
tagged with: java
has body: I've got this prepared statement: (I do not want to insert data into column_1) pstmt = artclSlctCon.prepareStatement("INSERT INTO `temp_articles` (`title`, `author`, `author_id`, `type`, `wfurl`, `intro`, `intro_image`, `main_image`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); With the error: java.sql.SQLException: Field 'content_1' doesn't have a default value My database looks like this: There are lots of image and content columns (17 of each). Is there anyway to keep the default value of the image_n and content_n columns none? PhpMyAdmin says:
type: Question

http://stackoverflow.com/q/24375673
score: 0
answer count: 3
has body: I am working on a p2p project. This project is supposed to be able to send and receive binary files and text messages concurrently. I have two separate threads for receiving file and messages. The problem is how to specify which thread should receive packet that is coming. now is it better to have just one thread for both operations? If yes how can i recognize the received packet type?
tagged with: p2p
type: UnansweredQuestion
tagged with: sockets
has answer: http://stackoverflow.com/a/24398160
tagged with: multithreading
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24375758
has answer: http://stackoverflow.com/a/24398729
has title: java threaded socket : which thread receives the packet?

http://stackoverflow.com/q/24379075
favorite count: 0
has answer: http://stackoverflow.com/a/24379362
type: Question
has answer: http://stackoverflow.com/a/47494453
has comment: http://stackoverflow.com/comment/37702889
has comment: http://stackoverflow.com/comment/37703078
has body: I am new in Hsqldb database. I want to know how to take backup and restore of Hsqldb database through java code.
tagged with: java
upvote count: 7
has title: Backup and restore of Hsqldb database in java code
downvote count: 1
type: UnansweredQuestion
score: 6
has answer: http://stackoverflow.com/a/24379423
answer count: 3
tagged with: backup
tagged with: sql
tagged with: hsqldb

http://stackoverflow.com/q/24359494
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24359679
has comment: http://stackoverflow.com/comment/37666490
accepted answer: http://stackoverflow.com/a/24359679
has title: Comparing an array to two static values
has comment: http://stackoverflow.com/comment/37666584
has body: So I am just doing something simple. I made a simple Java program where you enter your guess for what the roll will be which is stored in an array and then compared to two numbers generated randomly. So my question is how would I do the comparison of the array against the two number without referencing the exact index (i.e. not array[0]=number[1])? I am doing this mostly to figure out how array work. Also why is the else erroring? public static void main (String [] args){ java.util.Scanner input = new java.util.Scanner(System.in); int [] guess= new int [2]; System.out.print("Enter " + guess.length + " values: "); for (int i=0; i&lt;guess.length;i++) guess[i] = input.nextInt(); method(guess); } public static String method(int [] that){ int number1 = (int)(Math.random() * 6); int number2 = (int)(Math.random() * 6); for (int i =0;i&lt;that.length;i++){ if(that[i]==number1 and that[i]+1==number2) { return "You got it"; } else { return "try again"; }//end else } //end for }//end method
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37666591
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37666636
has answer: http://stackoverflow.com/a/24359773
possible better answer: http://stackoverflow.com/a/24359604
has comment: http://stackoverflow.com/comment/37666482
has answer: http://stackoverflow.com/a/24359604

http://stackoverflow.com/q/24366069
favorite count: 0
has title: redirect from method with http DELETE type to method with GET type
has comment: http://stackoverflow.com/comment/37691167
type: Question
has comment: http://stackoverflow.com/comment/37680044
linked to: http://stackoverflow.com/q/15996779
has comment: http://stackoverflow.com/comment/37680063
answer count: 1
upvote count: 6
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/37685638
tagged with: java
has comment: http://stackoverflow.com/comment/37694401
has body: I send my request using jquery ajax with type "DELETE". At server side I have approprite handle method that looks like this: @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) public String delete(@RequestParam("hotel") String hotelCode, @PathVariable Long id, Model model){ //delete operation return "redirect:/HotelTaxesAndCharges?hotel="+hotelCode; } and method to which I want to redirect my call after delete looks like this @RequestMapping(method = RequestMethod.GET) public String getAll(@RequestParam("hotel") String hotelCode, Model model){ //logic return 'getAll'; } so when i call delete method during execution I'm getting error "you can redirect to JSP using only GET PUT or HEAD methods". I found solution using HiddenHttpMethodFilter, but result code looks little messy and I need to send request using POST and adding additional parameter (_method) to requst with custom request type. So my question is there any other solution for DELETE/REDIRECT/GET transformation. SORRY FOR BAD ENGLISH UPDATE so you can that it redirects using delete too. And if I change everything from delete to post I get this:
type: UnansweredQuestion
score: 6
has comment: http://stackoverflow.com/comment/37679537
downvote count: 0
has answer: http://stackoverflow.com/a/24375475

http://stackoverflow.com/comment/37513641
comment on: http://stackoverflow.com/a/24279449
score: 0
type: AnswerComment
type: Comment
has text: It's not a eclipse project. It's jrupy-complete.jar file and it contains different subfolders and meta-inf folder.

instance-variables
tags question: http://stackoverflow.com/q/24274421
tag name: instance-variables
type: Tag

http://stackoverflow.com/q/24416869
has answer: http://stackoverflow.com/a/24419328
tagged with: unmarshalling
type: Question
has comment: http://stackoverflow.com/comment/37775349
has comment: http://stackoverflow.com/comment/37774064
accepted answer: http://stackoverflow.com/a/24419328
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/37774552
has comment: http://stackoverflow.com/comment/37775221
has comment: http://stackoverflow.com/comment/37777655
score: 0
has comment: http://stackoverflow.com/comment/37778408
has body: I have an xml which is looks like this: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;input&gt; &lt;flight flight="LX179" dep="SIN" arr="ZRH" aircraftRegistration="HBJMN" paxWeight="10000" /&gt; &lt;/input&gt; And i used jaxb to unmarshall it to an object So my class looks like this , if i delete the input tag from the xml, and make the Public Class Flight to my @RootElement, then it works fine, but thats not good for me, i need them there... pls could anyone help with this ? import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "input") @XmlElement //I GOT THE ERROR HERE public class Flight { private String flight,dep,arr,aircraftRegistration; private int paxWeight; public Flight() { } public Flight(String flight, String dep, String arr, String aircraftRegistration, int paxWeight, ) { this.flight = flight; this.dep = dep; this.arr = arr; this.aircraftRegistration = aircraftRegistration; this.paxWeight = paxWeight; public String getFlight() { return flight; } @XmlAttribute public void setFlight(String flight) { this.flight = flight; } public String getDep() { return dep; } @XmlAttribute public void setDep(String dep) { this.dep = dep; } public String getArr() { return arr; } @XmlAttribute public void setArr(String arr) { this.arr = arr; } public String getAircraftRegistration() { return aircraftRegistration; } @XmlAttribute public void setAircraftRegistration(String aircraftRegistration) { this.aircraftRegistration = aircraftRegistration; } public int getPaxWeight() { return paxWeight; } @XmlAttribute public void setPaxWeight(int paxWeight) { this.paxWeight = paxWeight; } My parsing method private void beolvasas() { try { File file = new File("/input.xml"); JAXBContext jaxbContext = JAXBContext.newInstance(Input.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); Input flight = (Input) jaxbUnmarshaller.unmarshal(file); flightList.add…
tagged with: annotations
has comment: http://stackoverflow.com/comment/37777209
has title: In Java when i parse an XML to Object how can i annotate my element which should be my Class and not my rootElement for an XML
answer count: 1
has comment: http://stackoverflow.com/comment/37777247
has comment: http://stackoverflow.com/comment/37774300
has comment: http://stackoverflow.com/comment/37777744
has comment: http://stackoverflow.com/comment/37773961
tagged with: java
has comment: http://stackoverflow.com/comment/37776407
has comment: http://stackoverflow.com/comment/37777850
has comment: http://stackoverflow.com/comment/37777892
has comment: http://stackoverflow.com/comment/37774529
type: AnsweredQuestion

http://stackoverflow.com/comment/37597033
has text: What is your exact string? Not understanding the question.
comment on: http://stackoverflow.com/q/24323548
score: 3
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37765560
has text: That's the trouble: there *isn't* one. The only observation is the void in the logs where all the initialization should have happened, and when I try to access any URL I get "no servlet context found" in the response.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24389655
type: Comment

http://stackoverflow.com/comment/37532137
has text: Look at the answers of your question to see how. If it still does not work, add to your question in detail why not.
comment on: http://stackoverflow.com/q/24270385
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37520102
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24280528
has text: In parent only. Add what ever you want as a list instead of ALL
type: AnswerComment

http://stackoverflow.com/q/24375885
has title: Convert mediumDate() to other format (with Locale) on Joda-Time
has answer: http://stackoverflow.com/a/24378967
type: Question
tagged with: jodatime
tagged with: date
score: 0
tagged with: converters
accepted answer: http://stackoverflow.com/a/24378967
answer count: 1
has comment: http://stackoverflow.com/comment/37702312
has body: I've a problem to convert a date in other format in java (I'm using Joda-Time). In fact, I've a formatted local date as is: 24/giu/14 (Italian format date...but other local formats are possible) I would like to see this in output (using Locale format date): 24/06/2014 I tried to build a sample code, but doesn't works...what am I doing wrong? public String DateConvertFromMediumFormatToSlash (String date) { DateTimeFormatter dtf = DateTimeFormat.mediumDate().withLocale(Locale.getDefault()); LocalDate dt = dtf.parseLocalDate(date); return dt.toString(); // output: 2014-06-24 }
tagged with: datetime
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/24336767
upvote count: 0
score: -1
tagged with: focus
has answer: http://stackoverflow.com/a/24337742
tagged with: jcombobox
favorite count: 0
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/24336768
tagged with: java
tagged with: keylistener
downvote count: 1
type: Question
has body: How do you get a Java combobox to accept the highlighted value when you type the Tab key, like it does when you type Enter? I think of this as a UI norm, and have seen it on websites and desktop programs, so I don't understand why Java doesn't do it by default. (The escape key is there to cancel.) I found several related questions to this, including how to get Enter to behave like Tab, but it turned out harder to go the other way, so I'll post how I did it. Perhaps I missed an easy way! In particular, the closest posting I could find didn't work because the tab key was already consumed by the focus system. Other related questions are here and here, and maybe some hints here.
has title: How to accept a value in a Swing JComboBox with the Tab key
answer count: 2

http://stackoverflow.com/comment/37694425
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24373922
type: Comment
has text: Its the frequency of the wave I need

c#
tags question: http://stackoverflow.com/q/24327634
tags question: http://stackoverflow.com/q/24353483
tag name: c#
tags question: http://stackoverflow.com/q/24350495
tags question: http://stackoverflow.com/q/24312125
tags question: http://stackoverflow.com/q/24425619
tags question: http://stackoverflow.com/q/24302714
tags question: http://stackoverflow.com/q/24281968
tags question: http://stackoverflow.com/q/24313411
tags question: http://stackoverflow.com/q/24366858
tags question: http://stackoverflow.com/q/24309549
tags question: http://stackoverflow.com/q/24274976
tags question: http://stackoverflow.com/q/24344034
tags question: http://stackoverflow.com/q/24374382
tags question: http://stackoverflow.com/q/24287774
type: Tag
tags question: http://stackoverflow.com/q/24352979
tags question: http://stackoverflow.com/q/24304282
tags question: http://stackoverflow.com/q/24286621
tags question: http://stackoverflow.com/q/24342333
tags question: http://stackoverflow.com/q/24284850
tags question: http://stackoverflow.com/q/24341490
tags question: http://stackoverflow.com/q/24342919
tags question: http://stackoverflow.com/q/24405595
tags question: http://stackoverflow.com/q/24288483

currency
tag name: currency
tags question: http://stackoverflow.com/q/24387801
type: Tag
tags question: http://stackoverflow.com/q/24319420

http://stackoverflow.com/comment/37698542
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24373160
has text: textFieldId is for when i enter the customer id for searching data relative to it in the database.after retriving relative data of jtextfield customer id then i update that data and again i stored in the database that why jtextfield3 for updated customer id purpose

http://stackoverflow.com/q/24311137
answer count: 1
downvote count: 1
favorite count: 0
upvote count: 0
has comment: http://stackoverflow.com/comment/37573563
has body: I had a couple of batch files to help me with minor tasks (one killed a running Skype process and the other deleted a file before running an executable). Both were only one or two lines of simple code. To run a program called Kernow I was told I needed to add a Windows environment variable called "Path" and set it to point to a Java folder (C:\Program Files (x86)\Java\jre7\bin) - the program wouldn't run until I had done this giving a Java error. I already had an environment variable called path which pointed to a long file path so instead of adding a variable I simply updated that one. Now neither of the batch files that were working fine before will work. Both will run with no errors but not produce results. I have very little knowledge of how batch files work with Windows. Can I set another environment variable called Path that will enable me to run my batch files and run Kernow??
type: AnsweredQuestion
tagged with: java
has title: Why won't my batch files run since I changed a Windows "Environment Variable"?
accepted answer: http://stackoverflow.com/a/24311197
type: Question
score: -1
has answer: http://stackoverflow.com/a/24311197
tagged with: batch-file
tagged with: kernow
tagged with: environment-variables
tagged with: windows

http://stackoverflow.com/comment/37495509
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24269289
has text: @JohnPristine it seems that you want each thread work on messages without waiting for poll() from someone .if this is the case, then you need more then ConcurrentLinkedQueue, may be something similar to a Pub/Sub system where each Thread would have it's messages list.

http://stackoverflow.com/q/24274178
type: Question
tagged with: avro
upvote count: 9
has title: avro-tools convert avdl to avsc does not generate correct avsc
answer count: 1
favorite count: 0
score: 8
has comment: http://stackoverflow.com/comment/75416689
type: UnansweredQuestion
has body: I am trying to convert an avro avdl file ( http://avro.apache.org/docs/1.7.6/idl.html#example ) to an avro schema file (example.avsc) using avro-tools. I downloaded avro-tools 1.7.6 and 1.6.3 example.avdl /** * An example protocol in Avro IDL */ @namespace("org.apache.avro.test") protocol Simple { @aliases(["org.foo.KindOf"]) enum Kind { FOO, BAR, // the bar enum value BAZ } fixed MD5(16); record TestRecord { @order("ignore") string name; @order("descending") Kind kind; MD5 hash; union { MD5, null} @aliases(["hash"]) nullableHash; array<long> arrayOfLongs; } error TestError { string message; } string hello(string greeting); TestRecord echo(TestRecord `record`); int add(int arg1, int arg2); bytes echoBytes(bytes data); void `error`() throws TestError; void ping() oneway; } generated example.avsc { "protocol" : "Simple", "namespace" : "org.apache.avro.test", "doc" : "* An example protocol in Avro IDL", "types" : [ { "type" : "enum", "name" : "Kind", "symbols" : [ "FOO", "BAR", "BAZ" ], "order" : "descending", "aliases" : [ "org.foo.KindOf" ] }, { "type" : "fixed", "name" : "MD5", "size" : 16 }, { "type" : "record", "name" : "TestRecord", "fields" : [ { "name" : "name", "type" : { "type" : "string", "order" : "ignore" } }, { "name" : "kind", "type" : "Kind" }, { "name" : "hash" ... I used the following command on my mac to generate it java -jar avro-tools-1.6.3.jar idl example.avdl (I've tried both 1.6.3 and 1.7.6) the above generated schema file is not valid since it does not have name, type and fields as the top level attributes. Is there anything wrong here ? Thanks
downvote count: 1
has answer: http://stackoverflow.com/a/28001942
tagged with: java

http://stackoverflow.com/q/24401722
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24401912
tagged with: pre-authentication
type: Question
has title: How to Redirect Header Not Found Exception to Login Page in Spring Security
upvote count: 1
downvote count: 0
answer count: 1
has body: I am implementing solution using spring security siteminder. I am able to check SM_USER in header if the header is not found in the request i want to redirect the request to login page .how can i do this i am new to spring Configuration is: <security:intercept-url pattern="/Login" access="permitAll"/> <security:intercept-url pattern="/**" /> <security:custom-filter position="PRE_AUTH_FILTER" ref="siteminderFilter" /> </security:http> <security:authentication-manager alias="authenticationManager"> <security:authentication-provider ref="preauthAuthProvider" /> </security:authentication-manager>
tagged with: spring-security
favorite count: 0
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/a/24336108
upvote count: 2
type: Answer
score: 2
downvote count: 0
has body: We have exactly the same "trouble" when trying to determine if an user is domain admin or not. We use the same scopes as you do, similar code (in PHP) as yours: $email = 'an_user_from_not_our_domain@domain.com'; $config = array( 'key' =&gt; "path/to/private/key", 'name' =&gt; "xxxxxxxxxxxxxxx@developer.gserviceaccount.com", 'prn' =&gt; "app_domain_admin@app_domain.com" ); $isAdmin = false; $key = file_get_contents($config['key']); $scopes_ = array("https://www.googleapis.com/auth/admin.directory.user.readonly"); $gac = new Google_AssertionCredentials($config['name'], $scopes_, $key, 'notasecret', 'http://oauth.net/grant_type/jwt/1.0/bearer', $config['prn']); $client = new Google_Client(); $client-&gt;setApplicationName("Test App"); $client-&gt;setUseObjects(true); $client-&gt;setAssertionCredentials($gac); require_once 'GoogleApiClient/contrib/Google_DirectoryService.php'; $directory = new Google_DirectoryService($client); $user = $directory-&gt;users-&gt;get($email); if ($user instanceof Google_User) $isAdmin = $user-&gt;getIsAdmin(); When we install the app for our own domain only - we can get "isAdmin" value. And when we install the app into other domains it does not work and returns the same "Not Authorized to access this resource/api". Maybe it's for what Directory API is designed for? I mean, for working with our own domain and not with domains that install our app. Deprecated Provisioning API was allowing to fetch such info. And now we could not determine whether an user is domain administrator or not.
answers question: http://stackoverflow.com/q/24305915

http://stackoverflow.com/a/24339261
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24338108
downvote count: 0
score: 1
has body: Here is a good example: http://javadigest.wordpress.com/2012/08/26/rsa-encryption-example/ and there are many more. (Google for "java encrypt RSA example" if this link breaks.) I can't seem to find an answer that actually works Try the one linked above. If it doesn't work, please follow up with an edit or comment to say what is going wrong. I can't imagine that there isn't some simple function to do such a trivial thing. :P Well sorry, but your imagination must be broken :-) In fact, it is not a trivial thing. And it is made more difficult by the fact that Java is trying to support a wide range of crypto functionality and crypto technology stacks using a single unified API.

meta-inf
tag name: meta-inf
tags question: http://stackoverflow.com/q/24279388
tags question: http://stackoverflow.com/q/24387657
type: Tag

http://stackoverflow.com/comment/37703015
has text: No, the JVM is far to complex to describe in a series of books. You need to be more specific.
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24379160

http://stackoverflow.com/q/24423256
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24423464
tagged with: spring
has title: Ultimate Aim of Spring-Boot
type: AnsweredQuestion
tagged with: spring-boot
accepted answer: http://stackoverflow.com/a/24423464
tagged with: java
type: Question
has body: as you may know Spring4 comes with new features, and one of the most important feature among them is Spring-boot. I am following the links below http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-documentation https://github.com/spring-projects/spring-boot Spring-boot feature comes with new class files in org.springframework.boot.* to start the Spring application. There are two question comes in mind that 1- for JavaSE, I can start-up the spring application with previoues spring versions easly, is the new feature spring-boot is just for simple boot 2- for JavaEE, as far as I know Spring-boot is not just for javaSE project, it can start-up web projects as well. So in the future spring-boot works as Application-server (like Glassfish)

http://stackoverflow.com/comment/37502919
comment on: http://stackoverflow.com/a/24273046
has text: This is extremely helpful. The only thing that is unclear to me is why the delay is necessary. My understanding is that adding multiple threads allows the program to make use of a computer's multiple CPUs. As I read your code it wastes valuable computation time by turning off the function for 50 milliseconds every time it returns a value. I guess it depends what a program is for and the different types of machines it will run on.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37598281
score: 0
type: Comment
type: QuestionComment
has text: Let me get this clear, user is another JSONObject, this usr jsonobject has a key value pair with key=app_settings and value equal to the jsonobject you have mentioned. You want to store this jsonobject in another jsonobject?
comment on: http://stackoverflow.com/q/24323887

http://stackoverflow.com/q/24368256
type: AnsweredQuestion
has body: I am not sure but I think my problem is that my function doesn't compare the char´s right. Am I using the Switch also right? my input x is a String and when x = "aaaaa" it returns "aaaaa" instead of "zzzzz". String c = ""; for (int i = 0; i &lt; x.length(); i++) { char getChar = x.charAt(i); switch (getChar) { case 1: (getChar) = 'a'; c += "z"; break; case 2: (getChar) = 'b'; c += "y"; break; case 3: (getChar) = 'c'; c += "x"; break; case 4: (getChar) = 'd'; c += "w"; break; case 5: (getChar) = 'e'; c += "v"; break; case 6: (getChar) = 'f'; c += "u"; break; case 7: (getChar) = 'g'; c += "t"; break; case 8: (getChar) = 'h'; c += "s"; break; case 9: (getChar) = 'i'; c += "r"; break; case 10:(getChar) = 'j'; c += "q"; break; case 11:(getChar) = 'k'; c+= "p"; break; case 12:(getChar) = 'l'; c += "o"; break; case 13:(getChar) = 'm'; c += "n"; break; default : c += x.charAt(i); } } System.out.println(c); }
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/24368410
has title: My 'decrypt' code doesn't work correctly
answer count: 2
has comment: http://stackoverflow.com/comment/37682608
possible better answer: http://stackoverflow.com/a/24368748
downvote count: 0
has answer: http://stackoverflow.com/a/24368748
favorite count: 0
has answer: http://stackoverflow.com/a/24368410
has comment: http://stackoverflow.com/comment/37683943
has comment: http://stackoverflow.com/comment/37683848

http://stackoverflow.com/q/24274432
accepted answer: http://stackoverflow.com/a/24274729
downvote count: 0
has body: I currently have a plausible resource leak in my library due to the fact that I hold a ZipFile open so that the returned InputStream for a certain ZipEntry is not closed. However, closing the returned InputStream doesn't close the rest of the ZipFile, so I'm stuck with it left open. Is there a way to safely close the ZipFile and keep the InputStream for returning?
answer count: 1
upvote count: 6
favorite count: 0
tagged with: http://stackoverflow.com/tag/zip
has title: Does a ZipEntry persist after a ZipFile is closed?
score: 6
has answer: http://stackoverflow.com/a/24274729
type: AnsweredQuestion
tagged with: java
tagged with: inputstream
type: Question

http://stackoverflow.com/comment/37583233
type: Comment
type: QuestionComment
has text: There're lots of answers: http://stackoverflow.com/questions/8782250/popupwindow-badtokenexception-unable-to-add-window-token-null-is-not-valid Just try to search "Unable to add window -- token null is not valid"
comment on: http://stackoverflow.com/q/24316010
score: 0

http://stackoverflow.com/a/24639378
type: Answer
has body: @burnttoat11's comment is correct. For ease of use, Plovr bundles the compiler code. The plovr repository includes branches which are copies of the Closure Library, Closure Compiler, and Closure Templates source code, so building plovr is entirely self-contained To use a different version of the compiler, you'll have to checkout Plovr, update the Closure code, and compile it yourself. It would be nice (but is not currently done) if: Plovr used Maven, the the Compiler now does or Plovr allowed specifying an external Compiler jar, much as can be done with extern files.
has comment: http://stackoverflow.com/comment/40128805
score: 0
answers question: http://stackoverflow.com/q/24341430

http://stackoverflow.com/q/24273929
tagged with: java
has comment: http://stackoverflow.com/comment/37503374
type: Question
answer count: 1
tagged with: inheritance
has comment: http://stackoverflow.com/comment/37503475
has answer: http://stackoverflow.com/a/24274092
has comment: http://stackoverflow.com/comment/37503758
score: 0
has title: Inheritance mind boggler
type: AnsweredQuestion
has body: Say there is a class Foo, and Bar is it's subclass (Bar extends foo), and the following is declared: Foo foo = new Bar(1) Bar bar = (Bar) foo The declared type of foo is Foo and it's actual type is Bar The declared type of bar is Bar, but what is it's actual type?
accepted answer: http://stackoverflow.com/a/24274092

http://stackoverflow.com/comment/37698310
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24374867
has text: One difference is the position in a group. When you add a Text it is placed above the group and Label is placed inside...

http://stackoverflow.com/q/24306088
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37564745
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24306296
has title: How to convert a big csv file into json array quickly in java
possible better answer: http://stackoverflow.com/a/24306171
has answer: http://stackoverflow.com/a/24306220
has comment: http://stackoverflow.com/comment/37564623
linked to: http://stackoverflow.com/q/19766266
has answer: http://stackoverflow.com/a/24306171
accepted answer: http://stackoverflow.com/a/24306296
has comment: http://stackoverflow.com/comment/37564643
has comment: http://stackoverflow.com/comment/37564360
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/37564329
linked to: http://stackoverflow.com/q/326390
favorite count: 0
has comment: http://stackoverflow.com/comment/37564466
has comment: http://stackoverflow.com/comment/37564478
has body: I want to convert a big csv file like 20000 to 50000 record file into json array but it takes nearly 1 min to convert in is there any way to achieve it in less then 5 sec. ResourceBundle rb = ResourceBundle.getBundle("settings"); String path = rb.getString("fileandfolder.Path"); System.out.println(path + "ssdd"); String csvPath = request.getParameter("DP") != null ? request .getParameter("DP").toString() : ""; String orname = path + csvPath; File file = new File(orname); FileReader fin = new FileReader(file); //Read file one by one BufferedReader bi = new BufferedReader(fin); int res; String csv = ""; while ((res = fin.read()) != -1) { csv = csv + ((char) res); //Converted int to char and stored in csv } long start3 = System.nanoTime(); JSONArray array = CDL.toJSONArray(csv); String Csvs = array.toString(); long time3 = System.nanoTime() - start3; System.out .printf("Took %.3f seconds to convert to a %d MB file, rate: %.1f MB/s%n", time3 / 1e9, file.length() &gt;&gt; 20, file.length() * 1000.0 / time3);
has comment: http://stackoverflow.com/comment/37563862

http://stackoverflow.com/q/24350023
downvote count: 1
type: Question
has body: I have this code: private String padWithZeroRightToPeriod(String serverFormat, float unformattedNumber, int index) { int nDigits = getNumberOfDigitsAfterPeriod(serverFormat); String floatingFormat = "%4." + nDigits + "f"; String formattedPrice = String.format(floatingFormat, unformattedNumber); When called with unformattedNumber being 846, why is the result " 846" (a space and then the three digits)? What does the %4. mean?
has title: Why does `%4.` add space to my number?
has comment: http://stackoverflow.com/comment/37647792
score: 0
has comment: http://stackoverflow.com/comment/37647745
answer count: 1
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/24350109
has comment: http://stackoverflow.com/comment/37647653
tagged with: string-formatting
upvote count: 1
accepted answer: http://stackoverflow.com/a/24350109
has comment: http://stackoverflow.com/comment/37647831
type: AnsweredQuestion
tagged with: format
has comment: http://stackoverflow.com/comment/37647679
tagged with: java
tagged with: formatting

http://stackoverflow.com/comment/37513455
type: AnswerComment
comment on: http://stackoverflow.com/a/24279261
type: Comment
has text: Guys, give me a break. I am struggling with the editor.
score: 0

http://stackoverflow.com/comment/37505589
type: AnswerComment
has text: because there is a return in the try block? Thanks for that!
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24275086

http://stackoverflow.com/a/24286712
has comment: http://stackoverflow.com/comment/131560976
type: Answer
answers question: http://stackoverflow.com/q/24285394
has body: Please check size of your result object and whether it contains any complex member variables other than java p primitives
score: 0
has comment: http://stackoverflow.com/comment/37527189

http://stackoverflow.com/comment/37770724
score: 0
has text: I don't know what to say; I took your code and added it to the sample (https://github.com/garyrussell/spring-integration-samples/tree/SO140625) and it all works fine for me. Here's the commit with the changes (https://github.com/garyrussell/spring-integration-samples/commit/2865f1c1214acffac4fe3353ad10c833dd1bfd97). Can you be more specific than "does not work" ?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24412050

http://stackoverflow.com/a/24347793
downvote count: 0
has comment: http://stackoverflow.com/comment/37643855
type: Answer
has comment: http://stackoverflow.com/comment/37643683
upvote count: 1
has comment: http://stackoverflow.com/comment/37643735
has comment: http://stackoverflow.com/comment/37643750
has body: I suspect you have a issue with referencing embedded resources. An embedded resource is any file which is contained within the application context (ie. In this case, stored within the application Jar). In order to obtain a reference to these resources, you need to use Class#getResource, which returns a URL, which you can then use to load the resource depending on your requirements, for example... public class Main extends Application { @Override public void start(Stage primaryStage) { String path = Test.class.getResource("/Kalimba.mp3").toString(); Media media = new Media(path); MediaPlayer mp = new MediaPlayer(media); mp.play(); System.out.println("Playing..."); } public static void main(String[] args) { launch(args); } } Now, I couldn't get it to work until I wrapped in a Application context...
score: 1
has comment: http://stackoverflow.com/comment/37643785
answers question: http://stackoverflow.com/q/24347658

http://stackoverflow.com/comment/37672555
type: QuestionComment
comment on: http://stackoverflow.com/q/24362885
has text: @TheLostMind fix the comment
score: 0
type: Comment

opencv
type: Tag
tags question: http://stackoverflow.com/q/24288890
tags question: http://stackoverflow.com/q/24416506
tags question: http://stackoverflow.com/q/24408251
tag name: opencv
tags question: http://stackoverflow.com/q/24408775
tags question: http://stackoverflow.com/q/24359363
tags question: http://stackoverflow.com/q/24416464
tags question: http://stackoverflow.com/q/24403476
tags question: http://stackoverflow.com/q/24347396

http://stackoverflow.com/a/24304980
score: 1
upvote count: 1
has body: Iterator&lt;String, FieldType&gt; iter = onsDetailsMap.entrySet().iterator(); while (iter.hasNext()) { Entry&lt;String, FieldType&gt; entry = (Entry) entries.next(); if (uxDetailsMap.contains(entry.getKey()) { iter.remove(); } }
answers question: http://stackoverflow.com/q/24304852
downvote count: 0
type: Answer

http://stackoverflow.com/a/24396245
upvote count: 7
answers question: http://stackoverflow.com/q/24384681
accepted answer of: http://stackoverflow.com/q/24384681
score: 7
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Just to complete this thread/help others........ pskink helped me to find the following solution: Bundle bundle = shortcutIntent.getExtras(); Parcel parcel = Parcel.obtain(); bundle.writeToParcel(parcel, 0); byte[] byt = parcel.marshall(); String s = Base64.encodeToString(byt, 0, byt.length, 0); //store this string to sqlite byte[] newByt = Base64.decode(s, 0); Bundle newBundle = new Bundle(); Parcel newParcel = Parcel.obtain(); newParcel.unmarshall(newByt, 0, newByt.length); newParcel.setDataPosition(0); newBundle.readFromParcel(newParcel); Intent intent = new Intent(); intent.putExtras(newBundle); MainActivity.getContext().startActivity((Intent)intent.getExtras().get(Intent.EXTRA_SHORTCUT_INTENT)); Thank you pskink so much again!

http://stackoverflow.com/q/24326482
type: Question
tagged with: listview
tagged with: android-listview
answer count: 1
has body: I have used the below XML on my custom adapter class in row XML file and also added my custom adapter class. When I click to Spinner after can't click on ListView on item click. How to solved this issue? My XML file: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/exam_linear" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="5dp" android:layout_marginTop="5dp" android:orientation="horizontal" &gt; &lt;TextView android:id="@+id/qeuestion_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_gravity="center_vertical" android:layout_marginLeft="15dp" android:paddingBottom="10dp" android:paddingTop="10dp" android:text="qwq" android:textColor="@color/Black" android:textSize="18sp" /&gt; &lt;ImageView android:id="@+id/img_select_question" android:layout_width="25dp" android:layout_height="25dp" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:layout_marginRight="20dp" android:src="@drawable/select_question" /&gt; &lt;Spinner android:id="@+id/marks_spinner" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginRight="10dp" android:layout_toLeftOf="@+id/img_select_question" android:focusable="false" android:focusableInTouchMode="false" android:padding="10dp" android:prompt="@string/tv_chapter" /&gt; &lt;/RelativeLayout&gt; spinner in set value as a custom class. so i don't no it better or not. also same help to solved click on list view issue. My adapter Java code: public class Question_list_adapter extends BaseAdapter{ private LayoutInflater l_Inflater; Activity obj_a; List&lt;Questions_Details&gt; question_list; private static class ViewHolder { public DataHolder data; public TextView qeuestion_name; public ImageView img_select_question; publi…
downvote count: 0
has comment: http://stackoverflow.com/comment/37602984
favorite count: 0
has answer: http://stackoverflow.com/a/24326971
type: UnansweredQuestion
tagged with: android
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/37602617
has title: Can't click on ListView after including Spinner inside ListView

http://stackoverflow.com/comment/37641931
type: QuestionComment
has text: Yes, but I want to keep LAZY fetching. So because I get errors about the session being closed, I'm trying to load the Books within the get Person method using Hibernate.initialize(person.getBooks());
comment on: http://stackoverflow.com/q/24346757
score: 0
type: Comment

http://stackoverflow.com/q/24381095
tagged with: opennlp
type: Question
has answer: http://stackoverflow.com/a/24406829
answer count: 1
has body: If i use a query like this in command line ./opennlp TokenNameFinder en-ner-person.bin "input.txt" "output.txt" I'll get person names printed in output.txt but I want to write own models such that i should print my own entities. E.g. what is the risk value on icm2500. Delivery of prd_234 will be arrived late. Watson is handling router_34. If i pass these lines, it should parse and extract product_entities. icm2500, prd_234, router_34... etc these are all Products( we can save this information in a file and we can use it as look up kind of for models or openNLP). Can anyone please tel me how to do this ?
downvote count: 0
has title: Writing our own models in openNLP
favorite count: 0
type: UnansweredQuestion
tagged with: nlp
score: 1
tagged with: java
upvote count: 1
tagged with: named-entity-recognition

http://stackoverflow.com/comment/129462341
score: 0
type: AnswerComment
has text: @mkierc Yes followed exactly. Your original answer was quite clear, but maybe add what your result looks like? I made sure that right margin setting was the same in `Code Style` and `Wrapping and Braces` (just in case). It is puzzling, but there must differences in other releated settings that are contributing to the differences in our results. I don't have time to figure this out right now (upcoming software deadline) but *definitely* would like to know the answer! I retracted my down vote.
type: Comment
comment on: http://stackoverflow.com/a/32850177

http://stackoverflow.com/q/24373512
tagged with: android
has comment: http://stackoverflow.com/comment/37693371
has title: How to add 9 patch to this layout to make it like bubble chat?
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37692861
has body: How to add 9 patch to this layout to make it like bubble chat ? Here is my layout: messaging_screen.xml http://pastebin.com/h9Dy5Pqz
tagged with: java
type: Question
tagged with: layout
score: 0

http://stackoverflow.com/comment/37757110
type: QuestionComment
type: Comment
has text: Since it's more efficient.
score: 0
comment on: http://stackoverflow.com/q/24407931

http://stackoverflow.com/q/24413715
has comment: http://stackoverflow.com/comment/37768065
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24413750
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/37767934
has body: I am writing my first Java program. Just for practice and a learning experience for a complete beginner. The program is a retirement calculator and I am having an issue with the code not flowing directly into the next code that I wrote. System.out.println("What investment style best suits your needs? i.e.(Very Aggressive, Aggressive, Moderate, Conservative)"); String investmentstyle = scanner.toString(); if (investmentstyle == "Very Aggressive") { System.out.println("With this type of fund, almost 100% of your funds would go towards stocks. you could expect a 12% rate of return on your investment."); } else if (investmentstyle == "Aggressive") { System.out.println("With this type of fund, 75% of your funds would go towards stocks and 25% would go towards bonds. You could expect a 9% rate of return on your investment."); } else if (investmentstyle == "Moderate") { System.out.println("With this type of fund, 50% of your funds would go towards stocks and 50% would go towards bonds. You could expect a 6% rate of return on your investment."); } else if (investmentstyle == "Conservative") { System.out.println("With this type of fund, 25% of your funds would go towards stocks and 75% would go towards bonds. You could expect a 3% rate of return on your investment."); } System.out.println("Please enter the expected return rate that is in accordance with the investment style you have chosen.\n Make sure you don't enter the percentage sign (%)."); double interestrate = scanner.nextDouble(); As you can see here, I am asking the user what type of fund he/she would be interested in. I want that input to be processed by the if/else to display the statement that correlates to the fund they chose. As of now, when I run the program it completely bypasses the if/else and moves on to then next question I ask. How would I go about fixing this? As always, any and all help is appreciated. Thank you in advance!
type: Question
has comment: http://stackoverflow.com/comment/37767968
has answer: http://stackoverflow.com/a/24413754
has title: How do I get my code to check if the variable has a certain value and then choose what to display in accordance with what the value is?
has comment: http://stackoverflow.com/comment/37767932
score: -2
has answer: http://stackoverflow.com/a/24413832
has answer: http://stackoverflow.com/a/24413887
linked to: http://stackoverflow.com/q/513832
upvote count: 0
favorite count: 0
answer count: 5
possible better answer: http://stackoverflow.com/a/24413790
has answer: http://stackoverflow.com/a/24413790
accepted answer: http://stackoverflow.com/a/24413887

http://stackoverflow.com/q/24301313
tagged with: netbeans
answer count: 0
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/37555196
has comment: http://stackoverflow.com/comment/37555464
has comment: http://stackoverflow.com/comment/37568687
tagged with: java
has body: I originally made a complex GUI in JFrame Form by the form editor. There are several Jpanels inside the frame. Now I am thinking of reusing some of the JPanels in other JFrames. I know it is possible to copy and paste the JPanel, but what I really want to do is factoring out the JPanel to make it a class. Is it possible to do it in Netbeans? EDIT: Thanks for the advices, it was really helpful, but not solving my problem. I still need to factor out the panel. Say if I have a Panel with several child panels inside. (eg: tabbed panel) I would like to design each of the child panel separately instead of doing them all together in a single class. That's my understanding of OOP. I did not do it at the first place because I was not familiar with netbeans nor I was an good designer. Now I realize I need to reuse some of the child panels. Am I able to factor out the code for each panel and make it a class without redoing the work? I used GridbagLayout.
has comment: http://stackoverflow.com/comment/37555174
type: Question
linked to: http://stackoverflow.com/q/9554636
has title: Netbeans - How to take out a Jpanel from JFrame and make it a class?
has comment: http://stackoverflow.com/comment/37580404
has comment: http://stackoverflow.com/comment/37557618
has comment: http://stackoverflow.com/comment/37555285
has comment: http://stackoverflow.com/comment/37555235
score: 0
has comment: http://stackoverflow.com/comment/37556039
has comment: http://stackoverflow.com/comment/37555089

http://stackoverflow.com/comment/37497486
type: Comment
type: AnswerComment
has text: File already exist when new RandomAccessFile(path, "r"); is done, it get removed later.
score: 0
comment on: http://stackoverflow.com/a/24270865

http://stackoverflow.com/comment/37505235
type: Comment
comment on: http://stackoverflow.com/a/24273201
has text: Is there a way to find all the matches?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37721299
score: 2
has text: For starters fix your dependencies, you are mixing spring 3.2.3 and 3.2.6 jars. Never mix versions of jars.
comment on: http://stackoverflow.com/q/24388809
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37792745
type: Comment
comment on: http://stackoverflow.com/a/24302797
score: 0
type: AnswerComment
has text: Did you get a chance to write that java Test class?

http://stackoverflow.com/comment/37527167
type: QuestionComment
comment on: http://stackoverflow.com/q/24286278
has text: @Mena Thx for your answer! I broke my problem down to 2 cases. My problem is to detect if the `;` is in AND/OR brackets or not.(Just these two cases.) If I know that the `;` is in one block I can mark it with another char like `!`. However, how to detect it?
score: 0
type: Comment

http://stackoverflow.com/q/24393803
type: AnsweredQuestion
has body: I'm trying to build a chessclock to learn and I'm stuck with the code below. I'll use the actionListener like this. When "White" button is pressed, blackTime will decrement one every second, when "Black" button is pressed whiteTime will decrement one every second. Right now my problem is to find a way to decrement time each second. I saw some questions like this and they talked about Timer class. I never used it and my understanding is it requires an ActionListener. I'm already using one so do I add another somehow or is there a simpler way? Thanks! public class ChessClock extends JFrame implements ActionListener { JPanel p; JButton b1,b2; JLabel l1; public ChessClock(){ super(); this.setVisible(true); this.setSize(600,400); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); int whiteTime = 59; int blackTime = 59; p = new JPanel(new GridBagLayout()); b1 = new JButton("White"); b2 = new JButton("Black"); l1 = new JLabel("00:" + whiteTime + " - " + "00:" + blackTime, SwingConstants.CENTER); l1.setFont(new Font("Serif", Font.PLAIN, 85)); b1.setPreferredSize(new Dimension(200,100)); b2.setPreferredSize(new Dimension(200,100)); b1.addActionListener(this); b2.addActionListener(this); GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(40,40,40,40); p.add(b1,c); p.add(b2,c); this.add(p, BorderLayout.SOUTH); this.add(l1, BorderLayout.CENTER); } public void actionPerformed(ActionEvent e){ //will later be used to switch between whiteTime - blackTime String s = e.getActionCommand(); if(s == "White") s = s; if(s == "Black") s = s; } }
possible better answer: http://stackoverflow.com/a/24393917
tagged with: java
has answer: http://stackoverflow.com/a/24393917
type: Question
accepted answer: http://stackoverflow.com/a/24394466
score: 0
answer count: 2
has title: Chessclock time decrement
tagged with: timer
has answer: http://stackoverflow.com/a/24394466

http://stackoverflow.com/a/24359814
has body: Eclipse has a timeout for starting and stopping Tomcat. You can change it, by opening 'Servers' view, double clicking the server name. As I can see form your logs your server did start in 458ms. But this problem might also be caused by components running lazily after server startup, f.e. servlets having a load-on-startup value greater than 0. First check if your server really starts up completly. This is when the green 'play' icon ('Start server') turns into a red 'stop' icon and the message 'starting server...' dissapears in the 'Progress' view. If that is not working increase the startup time, as mentioned before. If even that is not working check your servlets for endless slopes or connection attempts to a webservice or a database.
type: Answer
score: 5
accepted answer of: http://stackoverflow.com/q/24359240
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/24359240
type: AcceptedAnswer

http://stackoverflow.com/comment/37667081
has text: great! I'm happy you could solve the problem on your own ... although sending an `Intent`via a `BroadcastReceiver` to update the `Fragment`s is *less* messy than *this* ?? O_O
comment on: http://stackoverflow.com/a/24327146
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/76895551
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24401987
has text: The rule in OO is actually 'nobody sees your private parts'. Methods (including constructors) on objects are anathema to real OO.
type: AnswerComment

http://stackoverflow.com/q/24282527
has body: Intro Jersey: 2.9 This part of Jersey documentation describes how to provide authorization for REST services. There are two ways to do that: standard Servlet way, using configuration in web.xml much better solution using JSR 250 annotations The First approach works fine, but I cannot make the second work. Case 1 (using web.xml): This example works. It is for informational purpose. If you want just jump do the second one, which does not work. Resource is very simple: @Path("/HelloWorld") public class HelloWorldResource { @GET @Produces(MediaType.TEXT_PLAIN) public String sayHelloWorld(){ return "Hello World!!!"; } } Security configuration is placed in web.xml file, which looks like that: javax.ws.rs.core.Application javax.ws.rs.core.Application /rest/* <web-resource-collection> /rest/* </web-resource-collection> boss BASIC DefaultRealm This example works fine. When I try to access http://{myhost}:8080/{war_name}/rest/HelloWorld I have to provide username and password. This means that Realm and configuration in database is just fine. So there is no need to show it here. Case 2 (JSR 250 annotations): This example does not work. The resource is almost the same as in the first example, just some annotations are added: @Path("/HelloWorld") @PermitAll public class HelloWorldResource { @RolesAllowed("boss") @GET @Produces(MediaType.TEXT_PLAIN) public String sayHelloWorld(){ return "Hello World!!!"; } } As you see, two annotations are added. It is the same security policy like in the first example, but defined using annotations insted of web.xml. Now web.xml looks like that: <?xml version="1.0" encoding="UTF-8"?> BASIC DefaultRealm In addition new class is added (like described in documentation): @ApplicationPath("rest") public class MyApplication extends ResourceConfig { public MyApplication() { super(HelloWorldResource.class); register(RolesAllowedDynamicFeature.class); } } This class is important. As you see required RolesAllowedDynamicFeature is registered. So two main s…
upvote count: 3
has answer: http://stackoverflow.com/a/28812875
type: Question
score: 3
tagged with: java
has title: JAX-RS (Jersey 2) - authorization using JSR 250 annotations
downvote count: 0
answer count: 1
tagged with: jersey-2.0
tagged with: jax-rs
favorite count: 0
tagged with: security
tagged with: rest
type: UnansweredQuestion

http://stackoverflow.com/a/24305629
has comment: http://stackoverflow.com/comment/37563341
score: 2
has body: try : response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); response.getWriter().write(new Gson().toJson(data)); //here data is what you want to send first try this simple : response.getWriter().write("Hello"); in ajax : $.get('pricer', {passengers: passengers, price: price}, function(data){ console.log(data); }); then try to run and what it prints post me. console.log() prints data in browser console.
upvote count: 2
answers question: http://stackoverflow.com/q/24305511
has comment: http://stackoverflow.com/comment/37563143
has comment: http://stackoverflow.com/comment/37563265
has comment: http://stackoverflow.com/comment/37563920
has comment: http://stackoverflow.com/comment/37563864
downvote count: 0
has comment: http://stackoverflow.com/comment/37563194
has comment: http://stackoverflow.com/comment/37563141
type: Answer

http://stackoverflow.com/a/24325056
type: Answer
has body: Try the following - ByteArrayOutputStream out = new ByteArrayOutputStream(); DataInputStream dataIs = new DataInputStream (new ByteArrayInputStream(out.toByteArray()); // available stream to be read while(dataIs.available()&gt;0) { int k = dataIs.readInt(); // print int System.out.print(k+" "); }
answers question: http://stackoverflow.com/q/24324261
score: 0

http://stackoverflow.com/comment/38053584
has text: using binding provider I am able to do authentication,but while accessing getListItems of sharepoint i got error message " See stacktrace.javax.xml.ws.soap.SOAPFaultException: Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.".Can you please give any idea??
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24424021
type: Comment

http://stackoverflow.com/a/24366157
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: solution for your updated question would be: // the actual regex is ;[{}$*\w"']+?#, but extra escaping is needed for Java: input.replaceAll(";[{}$*\\w\"']+?#", ""); where you can update the character set between [] to match your actual requirements as you discover more edge cases.. if you decided you need a black-list of characters instead, you could use expression with negated character set (^ inside [], do not confuse with ^ at the start of a regex, which denotes the beginning of a string): ;[^;#]+?#
has comment: http://stackoverflow.com/comment/37678519
has comment: http://stackoverflow.com/comment/37679298
accepted answer of: http://stackoverflow.com/q/24365773
answers question: http://stackoverflow.com/q/24365773
has comment: http://stackoverflow.com/comment/37679641

http://stackoverflow.com/a/24268604
type: Answer
has body: change your url to GET /chart/:phrase controllers.Application.chart(phrase: String) and at your template routes.Application.chart("phraseValue") now url looks like /chart/pharseValue
has comment: http://stackoverflow.com/comment/37493843
answers question: http://stackoverflow.com/q/24268219
score: 0
has comment: http://stackoverflow.com/comment/37493061
has comment: http://stackoverflow.com/comment/37493195

http://stackoverflow.com/comment/37690245
type: Comment
has text: It is my stupidity guys. I just done some silly mistakes in coding but after realizing all thing again i come to know my mistake.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24360313

http://stackoverflow.com/comment/37800141
score: 0
type: Comment
has text: It is easier to let Eclipse generate the config.ini for you by selecting 'Generate a default config.ini'. Make sure to click 'Add Required' on the Dependencies tab to get all required plugins included.
type: QuestionComment
comment on: http://stackoverflow.com/q/24419859

http://stackoverflow.com/a/24313645
downvote count: 0
answers question: http://stackoverflow.com/q/24268354
type: Answer
score: 1
has body: Another way to do it ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor(); ses.scheduleAtFixedRate(new Runnable() { @Override public void run() { System.out.println(Runtime.getRuntime().freeMemory()); } }, 0, 1, TimeUnit.SECONDS); ses.shutdown(); Differences between java.util.timer and ScheduledExecutorService ScheduledThreadPoolExecutor are not sensitive to changes in the system clock but Timer is. Timer has only one execution thread, so long-running task can delay other tasks. ScheduledThreadPoolExecutor can be configured with any number of threads
upvote count: 1

http://stackoverflow.com/q/24277022
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/24277121
downvote count: 0
favorite count: 0
tagged with: primitive-types
has body: I was reading Android documentation regarding Shared Preferences here And they have mentioned one thing, You can use SharedPreferences to save any primitive data: booleans, floats, ints, longs, and strings. To best of my knowledge there are 8 primitive types in Java ie. byte, char, short, int, long, float, double, boolean String is a class in Java under java.lang package, not a primitive type. So questions arise, Q1. Why this thing is written in Android documentation that Primitive data: string? Q2. Does this primitive word used here, mean something else than the primitive data type? Thanks.
tagged with: android
answer count: 4
has answer: http://stackoverflow.com/a/24277083
has answer: http://stackoverflow.com/a/24277093
has title: Android Documentation - String a primitive type? Confusion
accepted answer: http://stackoverflow.com/a/24277093
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24277121
upvote count: 3
tagged with: sharedpreferences
tagged with: primitive
has answer: http://stackoverflow.com/a/24277125
type: Question

http://stackoverflow.com/q/24286840
tagged with: android
accepted answer: http://stackoverflow.com/a/29519095
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/75995299
has answer: http://stackoverflow.com/a/75995299
tagged with: java
type: Question
answer count: 2
tagged with: progress-bar
has answer: http://stackoverflow.com/a/29519095
has title: Android circular countdown
score: 2
has body: I'm new to Android Development and I'm trying to build a circular progressbar. And in its center a text that will change whenever the progress will be reached. Can you provide some code example? See this example:
linked to: http://stackoverflow.com/q/20010997
downvote count: 0
tagged with: countdown
tagged with: progress
favorite count: 0
upvote count: 2

http://stackoverflow.com/comment/37517167
score: 0
comment on: http://stackoverflow.com/q/24281042
type: Comment
type: QuestionComment
has text: The element (the String in this case) is atomic. I need to combine elements. Printing of 1 or 0 can be replaced by the printing of elements themself.

http://stackoverflow.com/q/24360492
tagged with: plsql
has body: I wondered that if a method is not invoked in a Java Thread but from a another thread or language, say plsql. As far as I am concerned, plsql does not have thread ,but it has session, what if I hope that the method being called from plsql procedure can be synchronized. My question is Does the synchronized keyword still work fine Does this calling create a java Thread Does the synchronized keyword or other Java concurrency object (like Semaphore, conditionObject) is only working in a Java Thread? The calling from pl/sql is like : language java name 'xxx.xxx.xxx.Engine.execute( java.lang.Integer, java.lang.String, java.sql.Timestamp, java.sql.Timestamp, java.lang.Long, java.lang.Long, java.lang.Long, java.lang.Long, java.lang.Long, java.lang.Long, java.lang.Long, java.lang.Long, java.lang.String, java.lang.Long )'; and the the execute method is a static method.
answer count: 1
downvote count: 0
favorite count: 0
tagged with: synchronization
tagged with: synchronized
has answer: http://stackoverflow.com/a/37423876
has comment: http://stackoverflow.com/comment/37668314
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/37701191
has comment: http://stackoverflow.com/comment/37669160
type: UnansweredQuestion
score: 1
has title: Does Synchronized method synchronized if a Java method is invokded from PLSQL
upvote count: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/37889927
score: 0
type: Comment
type: QuestionComment
has text: I'd go with a different schema, using an additional link table, with columns owner_task and member_task. This should also avoid useless queries using standard jpa. If this is something you can afford, I can elaborate further.
comment on: http://stackoverflow.com/q/24341533

http://stackoverflow.com/comment/37654037
has text: @KickButtowski - Then he will endup with a NumberFormatException. Its something that must be taken care by the OP.
type: AnswerComment
comment on: http://stackoverflow.com/a/24353189
score: 0
type: Comment

http://stackoverflow.com/a/24399976
upvote count: 2
has body: You set int x=0 and then compute the modulus, that is the remainder when dividing by x 6008 % x So effectively you are dividing by zero, which is impossible. Try starting with x = 1;
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24399936
type: Answer

http://stackoverflow.com/q/24303518
tagged with: java
has comment: http://stackoverflow.com/comment/37671803
type: Question
has title: ANTLR3 implemented Jaccard Similarity to compare two java's files
score: 0
has body: See this code, this is from JCCD API that I mashed up. ^_^ BufferedReader in = new BufferedReader(new FileReader(f.getFile())); String filePath = f.getNama(); // getName of file final Antlr3JavaLexer lexer = new Antlr3JavaLexer(); lexer.preserveWhitespacesAndComments = false; try { lexer.setCharStream(new ANTLRReaderStream(in)); } catch (IOException e) { e.printStackTrace(); return false; } StringBuilder sbu = new StringBuilder(); while (true) { org.antlr.runtime.Token token = lexer.nextToken(); if (token.getType() == lexer.EOF) { break; } sbu.append(token.getType()); System.out.println(token.getType()); } it gives me an output like this for TestFileOne.java 876116423877916429791644323742916418167432388167444266238816449164291643016743444242877916429791641179164432310329164351674323742916420164432316461643016444426623164616430164444242881644442879010116429164164224143234242[] and this TestFileTwo.java 876116423877916429791644323742916418167432388167444266238816449164291643016743444242877916429791641179164432310329164351674323742916420164432316461643016444426623164616430164444242881644442879010116429164164224143234242[] now my qusetion is, anyone can give me a clue or suggestion to implemented jaccard similiarity for the expected result like an output like percentage of the similiarity both ? Thank you so much ...
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37577537
tagged with: similarity
answer count: 0

http://stackoverflow.com/a/24416198
type: Answer
answers question: http://stackoverflow.com/q/24413096
score: 0
has body: There are two issues in your JSTL: &lt;c:foreach items="${list}" var="element"}&gt; ... &lt;/c:foreach&gt; Its c:forEach not c:foreach. There is one extra } in the end. It should be like this: &lt;c:forEach items="${list}" var="element"&gt; ... &lt;/c:forEach&gt; There are two option. Try any one as per need. If the list contains Object[] then use ${element[0]} If the list contains Route then use ${element['name']} or ${element.name} or ${element.getName()}. Make sure Route class contains name as instance variable with getter &amp; setter methods.

e4
tags question: http://stackoverflow.com/q/24287538
tags question: http://stackoverflow.com/q/24363770
type: Tag
tags question: http://stackoverflow.com/q/24286334
tag name: e4

http://stackoverflow.com/comment/37500685
type: AnswerComment
comment on: http://stackoverflow.com/a/24272422
score: 0
type: Comment
has text: Yeah I didn't know that JVM thing. I have edited it now! :)

http://stackoverflow.com/comment/37783543
type: Comment
score: 0
type: AnswerComment
has text: @user3777537: cripes you're missing the point -- please re-read my edit to my answer. The Point class has **everything** to do with your problem. Please just show it.
comment on: http://stackoverflow.com/a/24421845

http://stackoverflow.com/a/24304961
has comment: http://stackoverflow.com/comment/37562063
has body: Try this PreparedStatement ps; ps=con.prepareStatement("insert into tblmessage (message) values(?)"); ps.setString(2, usermsgmodel.getMessage().getValue()); ps.executeUpdate();
answers question: http://stackoverflow.com/q/24304906
score: 0
type: Answer

http://stackoverflow.com/a/24277863
type: Answer
has comment: http://stackoverflow.com/comment/37510794
answers question: http://stackoverflow.com/q/24276582
score: 0
has body: PreparedStatement used for inserting of data, i think you should use Statement. Statement stmt = c.createStatement(); ResultSet rs = stmt.executeQuery("SELECT AVG(DIST) FROM POOL_TABLE"); if( rs.next() ){ System.out.print( rs.getString(1) ); } i hope this example would help you :)

http://stackoverflow.com/q/24270777
has comment: http://stackoverflow.com/comment/37497621
downvote count: 7
has answer: http://stackoverflow.com/a/24270825
type: Question
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/37497202
tagged with: java
has answer: http://stackoverflow.com/a/24270893
answer count: 2
has comment: http://stackoverflow.com/comment/37498061
upvote count: 0
has title: NullPointerException Runtimer Error
score: -7
has comment: http://stackoverflow.com/comment/37497247
accepted answer: http://stackoverflow.com/a/24270825
possible better answer: http://stackoverflow.com/a/24270893
favorite count: 0
tagged with: runtime-error
has comment: http://stackoverflow.com/comment/37497350
tagged with: nullpointerexception
has body: I'm completely lost, being new to Java I can't seem to find what I need to do. Please, do not refer me to another person's question, those don't help because I don't know how it will fix my problem. Here is my code: import javax.swing.*; import javax.swing.border.EmptyBorder; import javax.swing.text.StyledDocument; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.util.Locale; import javax.swing.text.Element; import javax.swing.text.Style; import javax.swing.text.StyleConstants; import json.JsonObject; public class dicebot extends JFrame implements ActionListener { static final long serialVersionUID = 1L; private JPanel contentPane; public static String APIKey = null; public static JComboBox&lt;String&gt;cmbCurrency; public static JButton btnLow; public static JButton btnFloat; public static JButton btnHigh; public static JButton btnClearLog; public static JButton btnDonate; public static JTextPane textPane; public static JCheckBox scrollCheck; public static JCheckBox scrollDisable; public static JTextField txtRollAmnt; public static JTextField txtUserName; public static JTextField txtStartBid; public static JTextField txtMultiplier; public static JTextField txtMinRemaining; public static JPasswordField txtPassword; public static JTextField txtOdds; public static JTextField txtMaxBet; public static JTextArea txtInfo; public static JCheckBox RollAmntCheck; public static JLabel lblBalTag; public static JLabel userTag; public static JLabel passTag; public static void main(String[] args) { Locale.setDefault(Locale.US); EventQueue.invokeLater(new Runnable() { public void run() { try { dicebot frame = new dicebot(); frame.setVisible(true); Dicebotcode d = new Dicebotcode(); d.LoadSettings(); d = null; } catch (Exception e) { e.printStackTrace(); } } }); } public dicebot() { setTitle("Dice Bot"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); contentPane = new JPanel(); contentPane.setBorder…
has comment: http://stackoverflow.com/comment/37497467
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37497342
has comment: http://stackoverflow.com/comment/37497215

http://stackoverflow.com/comment/37516087
comment on: http://stackoverflow.com/q/24280605
type: QuestionComment
type: Comment
score: 1
has text: Do not use `writeXXXField()` to write array elements because array elements are not fields but simple values, use methods that output simple values like `writeNumber()` or `writeString()`.

http://stackoverflow.com/a/26516035
has body: I want to make sure people understand that the final code should be: SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); PBEKeySpec pbeKeySpec = new PBEKeySpec(password, salt, 1000, 384); Key secretKey = factory.generateSecret(pbeKeySpec); byte[] key = new byte[32]; byte[] iv = new byte[16]; System.arraycopy(secretKey.getEncoded(), 0, key, 0, 32); System.arraycopy(secretKey.getEncoded(), 32, iv, 0, 16); SecretKeySpec secret = new SecretKeySpec(key, "AES"); AlgorithmParameterSpec ivSpec = new IvParameterSpec(iv); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, secret, ivSpec); byte[] result = cipher.doFinal("asdfasdf".getBytes("UTF-8")); if you want to turn result to a string using new String(result) is best if you use new String(result,Charset), if you don't you may get the string in formatted incorrectly.
upvote count: 7
downvote count: 1
answers question: http://stackoverflow.com/q/24405731
type: Answer
score: 6

http://stackoverflow.com/comment/37775006
type: QuestionComment
comment on: http://stackoverflow.com/q/24270546
has text: Can you post the generated PDF?
type: Comment
score: 0

http://stackoverflow.com/a/24388258
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24388062
score: 1
answers question: http://stackoverflow.com/q/24388062
has comment: http://stackoverflow.com/comment/37724909
has body: There is a limited list of primitive types: byte, short, int, long, boolean, char. Each primitive has corresponding wrapper. That's it. So, it is really easy to write test for each primitive type. BTW you code cannot work for primitieves because they are not objects, so you cannot call isInt(123). If you want to write shorter tests you can write something like: @Test public void isInt() { assertTrue(obj.isInt(new Integer(1))); } @Test public void isNotInt() { for (Object obj : new Object[] {new Short(1), new Boolean(true), new Long(1), new Chaeracter('a')}) { assertFalse(obj.isInt(obj)); } } JUnit also supportes Parametrized tests. However this sounds as an overkill for such simple case.
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/37766545
score: 0
type: Comment
type: QuestionComment
has text: @HotLicks: does "no" mean "there is no way to do it", "this is bad practice", or both?
comment on: http://stackoverflow.com/q/24412738

http://stackoverflow.com/comment/37579594
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24312705
has text: Sample code modified per suggestion... is that what you had in mind? Note that the 2s thing is just for this example; in reality, the main loop has this: `synchronized (Main.waitObject) { while (!Main.initShutdown) { Main.waitObject.wait(); } }`, which will be pinged from a thread managed by MyThread.

http://stackoverflow.com/a/24427197
downvote count: 0
score: 75
has comment: http://stackoverflow.com/comment/107859375
type: Answer
answers question: http://stackoverflow.com/q/24427056
has comment: http://stackoverflow.com/comment/107851353
has comment: http://stackoverflow.com/comment/37820503
accepted answer of: http://stackoverflow.com/q/24427056
upvote count: 75
has body: It's how the various individual bytecode operations get their input, and how they provide their output. For instance, consider the iadd operation, which adds two ints together. To use it, you push two values on the stack and then use it: iload_0 # Push the value from local variable 0 onto the stack iload_1 # Push the value from local variable 1 onto the stack iadd # Pops those off the stack, adds them, and pushes the result Now the top value on the stack is the sum of those two local variables. The next operation might take that top stack value and store it somewhere, or we might push another value on the stack to do something else. Suppose you want to add three values together. The stack makes that easy: iload_0 # Push the value from local variable 0 onto the stack iload_1 # Push the value from local variable 1 onto the stack iadd # Pops those off the stack, adds them, and pushes the result iload_2 # Push the value from local variable 2 onto the stack iadd # Pops those off the stack, adds them, and pushes the result Now the top value on the stack is the result of adding together those three local variables. Let's look at that second example in more detail: We'll assume: The stack is empty to start with (which is almost never actually true, but we don't care what's on it before we start) Local variable 0 contains 27 Local variable 1 contains 10 Local variable 2 contains 5 So initially: +−−−−−−−+ | stack | +−−−−−−−+ +−−−−−−−+ Then we do iload_0 # Push the value from local variable 0 onto the stack Now we have +−−−−−−−+ | stack | +−−−−−−−+ | 27 | +−−−−−−−+ Next iload_1 # Push the value from local variable 1 onto the stack +−−−−−−−+ | stack | +−−−−−−−+ | 10 | | 27 | +−−−−−−−+ Now we do the addition: iadd # Pops those off the stack, adds them, and pushes the result It "pops" the 10 and 27 off the stack, adds them together, and pushes the result (37). Now we have: +−−−−−−−+ | stack | +−−−−−−−+ | 37 | +−−−−−−−+ Time for our third int: iload_2 # Push the value from local v…
type: AcceptedAnswer

http://stackoverflow.com/q/24287125
tagged with: swing
type: Question
tagged with: defaulttablemodel
has comment: http://stackoverflow.com/comment/37549307
has comment: http://stackoverflow.com/comment/37652816
has body: i'm developing a desktop app. When i execute my .jar file on another computers, the jframe where i load data into a datatable is not workign correctly. The jre is the same on both computers. The jar works fine on my computer. Here is the code: public int cargarClaseEnVentanaResultados(ConjuntoResultados conjunto, ControladorVentanaResultados cont){ ArrayList&lt;JPanel&gt; jpArray= new ArrayList&lt;&gt;(); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; String tipoExperimento = new String(); int contadorVariables = 0; if (!conjunto.getConjuntoResultados().isEmpty()){ for (int i=0;i&lt;conjunto.getConjuntoResultados().size();i++){ JTable jtable = new JTable(){ public boolean isCellEditable(int rowIndex, int colIndex) { return false; //Disallow the editing of any cell } }; jtable.setRowSelectionAllowed(true); jtable.setColumnSelectionAllowed(true); jtable.setCellSelectionEnabled(true); JPanel jpanel = new JPanel(); jpanel.setLayout(new GridBagLayout()); String[] columnNames ={"Variable","Valor"}; Object[][] data={}; DefaultTableModel model = new DefaultTableModel(data,columnNames); String nombreConjunto = conjunto.getConjuntoResultados().get(i).getNombreResultado();contadorVariables++; jpanel.setName(nombreConjunto); for (int j=0;j&lt;conjunto.getConjuntoResultados().get(i).getResultados().size();j++){ Object[] o = new Object[2]; String nombreVar = conjunto.getConjuntoResultados().get(i).getResultados().get(j).getNombre().replace(nombreConjunto+"_", ""); o[0] = nombreVar; if (conjunto.getConjuntoResultados().get(i).getResultados().get(j).getCadena()!=null){ o[1] = conjunto.getConjuntoResultados().get(i).getResultados().get(j).getCadena(); }else if (conjunto.getConjuntoResultados().get(i).getResultados().get(j).getDoble()!=null){ o[1] = conjunto.getConjuntoResultados().get(i).getResultados().get(j).getDoble(); }else if (conjunto.getConjuntoResultados().get(i).getResultados().get(j).getEntero()!=null){ o[1]…
tagged with: jtable
score: 0
tagged with: for-loop
has comment: http://stackoverflow.com/comment/37528172
has comment: http://stackoverflow.com/comment/37528763
has comment: http://stackoverflow.com/comment/37529447
type: UnansweredQuestion
has title: Problems on .JAR file with JTable and DefaultTableModel
has comment: http://stackoverflow.com/comment/37544514
has comment: http://stackoverflow.com/comment/37529421
answer count: 0
has comment: http://stackoverflow.com/comment/37576199
tagged with: java

http://stackoverflow.com/q/24379923
upvote count: 2
has body: I'm kind of new to GUIs. I created this simple app that paints an oval with different color every time a button is pushed. but when ever I call the JPanel's repaint() it doesn't just repaint the panel's portion of the frame (the oval). Instead, it kind of repaints the entire frame and it also paints the button that I clicked at the top of the frame (the northern border). I know I can simply call the JFrame's repaint() to solve this problem, but I was just wondering why is this happening. I thought that all what repaint() does is simply call the paintComponent() of the object. can somebody explain why is it behaving this way?? thanks!! import java.awt.BorderLayout; import java.awt.Color; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class Jbutton extends JFrame implements ActionListener { JFrame frame; JButton b; panel p; public void go() { frame = new JFrame(); b = new JButton("click me"); p = new panel(); b.addActionListener(this); frame.add(BorderLayout.CENTER, p); frame.add(BorderLayout.SOUTH, b); frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE); frame.setSize(250, 250); frame.setVisible(true); } class panel extends JPanel { public void paintComponent(Graphics g) { int red = (int) (Math.random() * 255); int green = (int) (Math.random() * 255); int blue = (int) (Math.random() * 255); g.setColor(new Color(red, blue, green)); g.fillOval(20, 30, 50, 50); } } @Override public void actionPerformed(ActionEvent arg0) { p.repaint(); } }
tagged with: user-interface
answer count: 1
accepted answer: http://stackoverflow.com/a/24379946
favorite count: 0
has answer: http://stackoverflow.com/a/24379946
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: swing
has title: Java JPanel repaint() issue?
type: Question
tagged with: components
tagged with: jpanel

http://stackoverflow.com/comment/38859934
has text: @Kliko - when I look at the question as a whole, its a bit large and hard to follow. It rambles on with no real structure. I tried reading it and lost all interest. I can barely make out the problem statement. You also don't provide the code that's causing an exception (rather, it rambles about other things, like docs and blog posts about how things are supposed to work). You might consider one last edit and contract it to the necessary information needed to help. Its up for a Close at the moment, and I'm inclined to agree - *Unclear what you're asking* and *Requires minimal example*.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24403448
score: 1

http://stackoverflow.com/comment/37709672
type: Comment
comment on: http://stackoverflow.com/a/24381657
has text: Ok. I understand your package structure, but at the same time you need to consider how `ComponentScan` works and to make some kind of compromise. If you'll ever want to give this another try or refactor it in some way, I think the basic idea which is the root of your initial issue is that `@EnableTransactionManagement` acts on beans in the same app context. Good luck!
score: 0
type: AnswerComment

http://stackoverflow.com/q/24311824
tagged with: android
tagged with: google-calendar-api
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25289006
has body: I want to be able to book and manage appointments for users of my App Engine project. These appointments will be specific to my app and should not show up on the users' Google Calendars. Is there an already existing service that I can leverage or will I have to build this out from scratch? What would be the recommended approach for building this from scratch? EDIT: If I use the Google Calendar API, is there a way to keep all the user appointment data only on the app servers and not on the users' Google Calendars?
upvote count: 1
tagged with: calendar
type: Question
has comment: http://stackoverflow.com/comment/37577575
has title: Is there a way to manage users' calendar appointments on App Engine?
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: google-app-engine

http://stackoverflow.com/comment/37507432
type: Comment
has text: I give up. You are NOT listening to what I have been saying. All you need is ONE label with an Icon. You set the layout for THAT label. You then add the button to THAT label. You then add THAT label to the frame. That is a total of THREE components, 1 frame, 1, label and 1 button. Why do you have a second label and a JPanel. Nowhere in my comments have I suggested you need a panel or a second label. This is my last comment. Good luck!
comment on: http://stackoverflow.com/a/24275494
type: AnswerComment
score: 0

querying
type: Tag
tags question: http://stackoverflow.com/q/24285118
tag name: querying

http://stackoverflow.com/comment/37728374
has text: Hello Shivam, I tried doing your suggestion but it turns out i didn't understand quite well. Here is the mainfest of second app: <action android:name="com.external.intentReceiver" /> This app is named image-chooser-app, and here's from OnClickListener button of first app named: Loginexample:
comment on: http://stackoverflow.com/a/24379126
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37557886
type: AnswerComment
has text: I removed the num.OnClickListener(), it was a mistake.I get what you are saying. I just thought using the switch case in onClick() seemed better than calling onClick() for each button. Is there anyway i can Implement onClickLitener and the values dont get initialized each time? A static specifier or something?
type: Comment
comment on: http://stackoverflow.com/a/24302589
score: 0

http://stackoverflow.com/comment/37578188
has text: No, but its an example of what it is. The webpage is large and if I was to post the entire thing it would be too long, and to shorten it I would have to cut and paste it in a way that it would be invalid anyway.
score: 0
comment on: http://stackoverflow.com/q/24313542
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24339057
has body: The first thing I notice is here, public Square(height, width) Should be public Square(int height, int width) The next thing I notice is public int computeSurfaceArea() { // int surfaceArea = square_height * square_width; // surfaceArea = (getheight() * getwidth()); return getheight() * getwidth(); } Finally, I suggest you follow standard Java naming practices; getHeight() and getWidth(), and then getHeight(), getWidth() and getDepth() in Cube. Also it might be better to call it getSurfaceArea(). Consistency is good (and remember the maintenance programmer). Note this applies also to your Cube constructor, for a quick fix - public Cube(int height, int width, int depth) { super(height, width); // cube_height, cube_width are defaulting to 0. cube_depth = depth; cube_height = height; // &lt;-- you called it cube_height, not just height. cube_width = width; }
answers question: http://stackoverflow.com/q/24338927
accepted answer of: http://stackoverflow.com/q/24338927
has comment: http://stackoverflow.com/comment/37626613
score: 0
has comment: http://stackoverflow.com/comment/37626842
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/37626625

http://stackoverflow.com/comment/37547168
has text: Glad you could see it; if there was no QueryPgm I would have gotten a document node does not exist or similar error. Unfortunately I get a clean run, but no code is toString() method is injected.
comment on: http://stackoverflow.com/q/24276404
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/37673447
score: 0
has text: I not getting the UI design? Is company Name field a auto populated combo box, which displays a drop down list on typing?
comment on: http://stackoverflow.com/q/24362525
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24373256
tagged with: sorting
favorite count: 0
has comment: http://stackoverflow.com/comment/37692173
has answer: http://stackoverflow.com/a/24373362
has comment: http://stackoverflow.com/comment/37692215
upvote count: 2
has comment: http://stackoverflow.com/comment/37692175
downvote count: 2
has comment: http://stackoverflow.com/comment/37692413
tagged with: collections
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37692305
accepted answer: http://stackoverflow.com/a/24373362
tagged with: java
type: Question
has title: Collections.sort() isn't sorting in the right order
score: 0
answer count: 1
has body: I have this code in Java: List&lt;String&gt; unSorted = new ArrayList&lt;String&gt;(); List&lt;String&gt; beforeHash = new ArrayList&lt;String&gt;(); String[] unSortedAux, beforeHashAux; String line = null; BufferedReader reader = new BufferedReader(new FileReader("C:\\CPD\\temp0.txt")); while ((line = reader.readLine()) != null){ unSorted.add(line); beforeHash.add(line.split("#")[0]); } reader.close(); Collections.sort(beforeHash); beforeHashAux = beforeHash.toArray(new String[beforeHash.size()]); unSortedAux = unSorted.toArray(new String[unSorted.size()]); System.out.println(Arrays.toString(beforeHashAux)); System.out.println(Arrays.toString(unSortedAux)); It reads a file named temp0.txt, which contains: Carlos Magno#261 Mateus Carl#12 Analise Soares#151 Giancarlo Tobias#150 My goal is to sort the names in the string, without the string after "#". I am using beforeHash.add(line.split("#")[0]); to do this. The problem is that it reads correctly the file, but it sorts in the wrong order. The correspondent outputs are: [Analise Soares, Giancarlo Tobias, Mateus Carl, Carlos Magno] [Carlos Magno#261, Mateus Carl#12, Analise Soares#151, Giancarlo Tobias#150] The first result is the "sorted" one, note that "Carlos Magno" comes after "Mateus Carl". I cannot find the problem in my code.

http://stackoverflow.com/comment/37548326
score: 0
type: AnswerComment
has text: I decided to abandon this idea temporarily. But i found solution for content provider app. I can schedule special service in system alarm manager. This module will gather info about subscribed apps and, if no apps present in system it can advice user to backup data and ask for self destruction. I think android way is creation huge apps with bunch of tasks, rather then simple tools for exact objectives
comment on: http://stackoverflow.com/a/24277946
type: Comment

http://stackoverflow.com/comment/37697573
comment on: http://stackoverflow.com/a/24376148
type: Comment
type: AnswerComment
has text: @PatriciaShanahan "My hashCode method ensures that equal objects have equal hash codes. My implementation also guarantees that the contrapositive is true." (Design decisions aside, the OP has already claimed to have addressed / eliminated / been-aware-of such.)
score: 0

http://stackoverflow.com/q/24319843
has title: Login server web app java
tagged with: java
type: Question
has body: Hi I am writing a basic login server using message passing . What my server does is it receives the message from some client checks in the database which is a file and accordingly sends back the reply so what is happening is whenever I send the message from telnet i can see that my server is accepting it and replying to it but it is not accepting a message again. Below is my code and this is no homework package login; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.StreamCorruptedException; import java.net.ServerSocket; import java.net.Socket; import java.net.SocketException; public class Login { public static void main(String[] args) { Login login = new Login(); new Thread(login.new ServerTask(null)).start(); new Thread(login.new ClientTask("clientstart")).start(); } public String login(String userName, String password, String memberId) { System.out.println("Entering login"); boolean match = false; try { // created an file input stream and a buffered reader stream to read // from the files FileInputStream inputStream = new FileInputStream( "/home/rahulroc18/Desktop/database.txt"); BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(inputStream)); String strLine; String[] dataReader; dataReader = new String[10]; String readData = ""; // Loop through the end of the file and read the data line by line // in order to store it into a string for further storage in the // memory while ((strLine = bufferedReader.readLine()) != null) { readData = readData + strLine + ":"; } // split the string to store user name and password for storing in // an array in alternate positions dataReader = readData.split(":"); // System.out.println(dataReader.length); // loops through the array and checks the user name and …
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/24322270
type: UnansweredQuestion
tagged with: sockets
tagged with: multithreading
has comment: http://stackoverflow.com/comment/37594703

http://stackoverflow.com/comment/37510403
type: Comment
comment on: http://stackoverflow.com/a/24277412
has text: Your eclipse.ini file shows that currently you are using 64 bit Java compiler. Change the Environment PATH appropriately to match that. Details: [Extending Eclipse fails with Java VM not found error message, IBM](http://www-01.ibm.com/support/docview.wss?uid=swg21319892)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37740002
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24364242
has text: Thank you for the response. I continually got the error on install (I'm on Windows 8.1 if that matters). I was able to get around it by installing 1.6 and overriding my environment variables. It works fine on 1.7, just doesn't install with 1.7.
type: Comment

http://stackoverflow.com/q/24353728
has title: Howto sanitize inputs
has comment: http://stackoverflow.com/comment/37779055
has answer: http://stackoverflow.com/a/28092903
tagged with: java
has comment: http://stackoverflow.com/comment/37869318
has answer: http://stackoverflow.com/a/72294770
type: Question
score: 12
has comment: http://stackoverflow.com/comment/37659006
answer count: 2
downvote count: 0
tagged with: sanitize
linked to: http://stackoverflow.com/q/24499820
favorite count: 0
tagged with: esapi
upvote count: 12
type: UnansweredQuestion
has body: I am willing to use "OWASP ESAPI for Java" to sanitize users inputs when they submits forms in a Tomcat Webapp. I used to use org.apache.commons.lang.StringEscapeUtils like this: public static String myEscapeHtml(String s) { String s_escapedString = null; s_escapedString = StringEscapeUtils.escapeHtml(s); return s_escapedString; } I don't know anymore if this is good enough to protect the webapp "reasonably"... I would like to know what lines of code I should write to use the OWASP ESAPI to sanitize a Tomcat webapp user inputs. Can you give an example in which one or several ESAPI "filters" (escaping?, encoding? ...) would be applied to a string to sanitize it? The backend RDBMS is PostgreSQL. The Tomcat server can either be be running on a Linux server or on a Windows server. Thank you and best regards.
tagged with: owasp
tagged with: input

http://stackoverflow.com/comment/37785759
score: 0
type: Comment
has text: _You need to add preceding or trailing spaces in input to check._
comment on: http://stackoverflow.com/a/24423069
type: AnswerComment

lucene
tags question: http://stackoverflow.com/q/24305215
tags question: http://stackoverflow.com/q/24427219
tags question: http://stackoverflow.com/q/24353260
tags question: http://stackoverflow.com/q/24304781
tags question: http://stackoverflow.com/q/24295361
tags question: http://stackoverflow.com/q/24282310
tags question: http://stackoverflow.com/q/24410063
tags question: http://stackoverflow.com/q/24306463
tags question: http://stackoverflow.com/q/24403993
tags question: http://stackoverflow.com/q/24403747
tags question: http://stackoverflow.com/q/24369540
tags question: http://stackoverflow.com/q/24362322
tags question: http://stackoverflow.com/q/24354871
tags question: http://stackoverflow.com/q/24386554
type: Tag
tags question: http://stackoverflow.com/q/24361923
tags question: http://stackoverflow.com/q/24412795
tag name: lucene
tags question: http://stackoverflow.com/q/24381623
tags question: http://stackoverflow.com/q/24320641
tags question: http://stackoverflow.com/q/24406694
tags question: http://stackoverflow.com/q/24385403
tags question: http://stackoverflow.com/q/24365696

http://stackoverflow.com/a/24348872
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/24348854
downvote count: 0
has comment: http://stackoverflow.com/comment/37654896
type: Answer
has body: File inside Jar file is no longer a File, so change it to read it as resource bgm = new AudioStream(new FileInputStream(new File("music\\Birthday.wav"))); to bgm = new AudioStream(Birthday.class.getResourceAsStream ("/music/Birthday.wav")); assuming you have music/Birthday.wav at the root of classpath

backup
tags question: http://stackoverflow.com/q/24379075
tag name: backup
type: Tag

http://stackoverflow.com/comment/39801949
has text: Hi! Do you know the alternative of `exec` on Windows?
type: Comment
comment on: http://stackoverflow.com/a/24390603
score: 0
type: AnswerComment

http://stackoverflow.com/q/24371297
type: Question
has comment: http://stackoverflow.com/comment/37688644
tagged with: php
score: 0
tagged with: java
tagged with: mysql
has body: I use an HttpPost Object in Java to communicate with my server that manage a Mysql database. So there is a receiver php page that manage every type of requests. If I insert/delete/update data there is no problem. But now I need to rename a table and I find out that other types of operations are not correctly executed too (for example: truncate table..). Finally I found this post Rename a MySQL table using SQL statement but it doesn't work in my project.. What about this particular situation? Any suggestion? Maybe something about permissions? Thank you!
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/9549243
has comment: http://stackoverflow.com/comment/37688456
tagged with: http-post
answer count: 0
has title: HttpPost java to Server/Mysql renaming

http://stackoverflow.com/q/24363902
favorite count: 0
accepted answer: http://stackoverflow.com/a/24364121
tagged with: swing
downvote count: 1
type: AnsweredQuestion
tagged with: java
score: -1
type: Question
upvote count: 0
answer count: 1
has title: Print an opened Document using JMenuItem
has answer: http://stackoverflow.com/a/24364121
tagged with: awt
has body: I want to print an opened File when I click print menuitem.I Wrote some code but It's not working properly.It shows print Dialog box then I click print button it was not taken print .Please help me,Thank you. My code: public class PrintAction extends javax.swing.JFrame { JScrollPane scrollPane; JTextPane textPane; int i=0; public PrintAction() { initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { tabbedPane = new javax.swing.JTabbedPane(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); open = new javax.swing.JMenuItem(); print = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jMenu1.setText("File"); open.setText("Open"); open.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { openActionPerformed(evt); } }); jMenu1.add(open); print.setText("Print"); print.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { printActionPerformed(evt); } }); jMenu1.add(print); jMenuBar1.add(jMenu1); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tabbedPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tabbedPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 279, Short.MAX_VALUE) ); pack(); }// &lt;/editor-fold&gt; private void openActionPerformed(java.awt.event.ActionEvent evt) { FileDialog fd = new FileDialog(PrintAction.this, "Select File", FileDialog.LOAD); fd.show(); String…

http://stackoverflow.com/comment/37649569
score: 0
type: AnswerComment
has text: Will add bounty when possible.
type: Comment
comment on: http://stackoverflow.com/a/24347557

http://stackoverflow.com/comment/37503536
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24273994
has text: @user3580294 What do you mean?
type: Comment

http://stackoverflow.com/q/24361094
has answer: http://stackoverflow.com/a/24361942
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: writable
linked to: http://stackoverflow.com/q/17203661
downvote count: 0
score: 1
tagged with: java
has body: I am new to map-reduce. I want to know what is the use of readfields and write methods when we implement our custom data types in hadoop? For example, public class Point3D implements Writable { public float x; public float y; public float z; public Point3D(float x, float y, float z) { this.x = x; this.y = y; this.z = z; } public Point3D() { this(0.0f, 0.0f, 0.0f); } public void write(DataOutput out) throws IOException { out.writeFloat(x); out.writeFloat(y); out.writeFloat(z); } public void readFields(DataInput in) throws IOException { x = in.readFloat(); y = in.readFloat(); z = in.readFloat(); } public String toString() { return Float.toString(x) + ", " + Float.toString(y) + ", " + Float.toString(z); } public void set(float x, float y, float z) { this.x=x; this.y=y; this.z=z; } } In the above example the custom recordreader uses the set method to set the values of x, y and z. So we finally, we get these values in the mapper. But whats the need of readfealds and write() methods from writable?? Pls. Help
type: Question
has title: Use of readFields() in writable class in hadoop.io api
tagged with: mapreduce
tagged with: hadoop

http://stackoverflow.com/a/24383571
type: AcceptedAnswer
upvote count: 5
downvote count: 0
type: Answer
has body: The issue lies in the fact that you have defined basically two foreign key columns for Blog in your Comment's entity: @Column(name = "blog_id", length = 36) public UUID blog_id; @ManyToOne public Blog blog; The default column name for your 'blog' field is: blog_id However, you've already named your 'blog_id' column that. Interestingly, no error/warning is thrown when creating this table... So when you call comment.save(), the following insert statement is generated: insert into blog_comment (id, blog_id, content, website, name, time_created, blog_id) values (?,?,?,?,?,?,?) Notice a reference to 'blog_id' column twice, which is invalid. And this is because of the above double mapping. To fix, just give your 'blog' property a different name to use for the foreign key column: @Column(name = "blog_id", length = 36) public UUID blog_id; @ManyToOne @JoinColumn(name = "blogId") public Blog blog; I'm not sure why you're mapping your entities like this (perhaps legacy schema?) but the 'blog_id' fields seem to be redundant (and confusing) as you already have an entity mapping in the form of your 'blog' property.
accepted answer of: http://stackoverflow.com/q/24377478
score: 5
answers question: http://stackoverflow.com/q/24377478

http://stackoverflow.com/comment/37736448
type: QuestionComment
has text: Remove `&` from end of your command line.
comment on: http://stackoverflow.com/q/24396793
score: 4
type: Comment

http://stackoverflow.com/comment/37634456
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24342893
has text: Although *certain* "bad practices" may be acceptable in order to achieve quick, motivating results, Swing in general is so easy that they should not be necessary, and the bad practices that Hovercraft Full Of Eels pointed out, the obvious typo that caused this question, and details like using `getSize().width` instead of `getWidth()` are not "simplifications", but simply the wrong way to do it. I always thought that these "...in 21 days" books are suspicious... http://abstrusegoose.com/249
type: Comment

http://stackoverflow.com/q/24317685
tagged with: caching
type: Question
tagged with: algorithm
tagged with: arraylist
has title: Java Benchmarking: Ensuring that objects are not reused after coming out of scope
accepted answer: http://stackoverflow.com/a/24318821
downvote count: 0
answer count: 1
favorite count: 0
tagged with: garbage-collection
upvote count: 1
has body: I am benchmarking several algorithms that do a variation of k-th closest neighbor problem. I'm seeing troubling results when repeatedly running algorithms that sort my data. Update It seems like the data itself is not being cached, as people have said. I ran the same n = 50000 test, but generated random points in both ArrayLists every time I ran three tests. The speedup that I was wary of still occurred. This DOES seem to be the JITC feature. Output: Stopping :: Brute Force. Time (ms): 21716 Stopping :: Sorted 'Smart' Brute Force. Time (ms): 24014 Stopping :: Quickselect. Time (ms): 17655 Stopping :: Brute Force. Time (ms): 22034 Stopping :: Sorted 'Smart' Brute Force. Time (ms): 23975 Stopping :: Quickselect. Time (ms): 18438 Stopping :: Brute Force. Time (ms): 20097 Stopping :: Sorted 'Smart' Brute Force. Time (ms): 15677 Stopping :: Quickselect. Time (ms): 14399 Stopping :: Brute Force. Time (ms): 20457 Stopping :: Sorted 'Smart' Brute Force. Time (ms): 15141 Stopping :: Quickselect. Time (ms): 14146 Stopping :: Brute Force. Time (ms): 20143 Stopping :: Sorted 'Smart' Brute Force. Time (ms): 15834 Stopping :: Quickselect. Time (ms): 14084 Stopping :: Brute Force. Time (ms): 20173 Stopping :: Sorted 'Smart' Brute Force. Time (ms): 15170 Stopping :: Quickselect. Time (ms): 13745 Stopping :: Brute Force. Time (ms): 19625 Stopping :: Sorted 'Smart' Brute Force. Time (ms): 14924 Stopping :: Quickselect. Time (ms): 15972 Stopping :: Brute Force. Time (ms): 19388 Stopping :: Sorted 'Smart' Brute Force. Time (ms): 15209 Stopping :: Quickselect. Time (ms): 13639 Stopping :: Brute Force. Time (ms): 19420 Stopping :: Sorted 'Smart' Brute Force. Time (ms): 14779 Stopping :: Quickselect. Time (ms): 13798 Stopping :: Brute Force. Time (ms): 19390 Stopping :: Sorted 'Smart' Brute Force. Time (ms): 15078 Stopping :: Quickselect. Time (ms): 13548 Original Query Background/Details: I have two unsorted n-sized ArrayLists of Points- A and B. For every Point P in A, check to see how …
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24318821
has comment: http://stackoverflow.com/comment/37586311

http://stackoverflow.com/a/24408520
upvote count: 1
has comment: http://stackoverflow.com/comment/37766965
type: Answer
answers question: http://stackoverflow.com/q/24408481
has comment: http://stackoverflow.com/comment/37792150
has comment: http://stackoverflow.com/comment/37767078
has comment: http://stackoverflow.com/comment/37794517
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37791638
has body: Add all the elements to sets and compare the sets. Note: sets will ignore duplicates. Or you can sort all the elements and compare the results. How you sort them doesn't matter provided the sorting it consistent. i.e. the original order doesn't change the result. Use this if there are duplicates.

http://stackoverflow.com/a/24320273
type: Answer
answers question: http://stackoverflow.com/q/24294279
score: 0
has body: A couple of pointers: The ChartFactory.createXYLineChart() method will create a line chart where both the X and Y axes are numerical. Try the createTimeSeriesChart() to get a chart that shows dates on the X axis (or create a new DateAxis() instance and call plot.setDomainAxis() to change the X axis); The TimeSeriesCollection class is a good dataset to use for time series data if you need the structure that it provides (it enforces a regular time period and prevents duplicates among other things). However, bear in mind that it is simply an implementation of the XYDataset interface where the x-values returned are "milliseconds since 1-Jan-1970" (the standard encoding of "dates" in Java). You can simplify your code by using an XYSeriesCollection (which also implements the XYDataset interface), and call System.currentTimeInMillis() to get the current x-value when new data comes in. The date axis on your chart will take care of presenting a date scale for this data.

http://stackoverflow.com/comment/37520272
comment on: http://stackoverflow.com/q/24282398
score: 1
has text: Check if there is any log4j.xml or log4j.properties file in your classpath. Listeners for logging are also configured inside web.xml of a web application.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37606596
type: QuestionComment
has text: ResultSet.getDate() will only not include the time portion of the data. http://docs.oracle.com/javase/7/docs/api/java/sql/ResultSet.html#getDate(int)
comment on: http://stackoverflow.com/q/24328505
score: 0
type: Comment

http://stackoverflow.com/a/24281651
accepted answer of: http://stackoverflow.com/q/24281509
type: Answer
has comment: http://stackoverflow.com/comment/37517991
answers question: http://stackoverflow.com/q/24281509
has body: Do a check for null, and either thrown an exception, or implement null object pattern - ie replace the null with a string, something like : "No parameter supplied". Alternatively, don't use strings to build a query, and just use the criteria api.
has comment: http://stackoverflow.com/comment/37517718
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/37675572
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24281987
has text: Edit: I've made progress, but another obstacle appeared!

http://stackoverflow.com/q/24369689
tagged with: spring-data-rest
has comment: http://stackoverflow.com/comment/37689535
downvote count: 0
favorite count: 0
has title: Pass parameter to query
type: UnansweredQuestion
has body: I have run into a problem when passing arguments to this query. When I try to run I get an exception. @Query("select o from Offer o, OfferCriteria ocg where o = ocg.offer and ocg.criteria = 'gender' and ocg.criteriaValue in (2, (select c.gender from Customer as c where c.id = :Id)) ") List&lt;Offer&gt; findOffersForCustomer(@Param("Id") String customerId) The exception is Caused by: java.lang.NullPointerException: null at org.hibernate.hql.internal.ast.ParameterTranslationsImpl.getNamedParameterExpectedType(ParameterTranslationsImpl.java:92) at org.hibernate.engine.query.spi.HQLQueryPlan.buildParameterMetadata(HQLQueryPlan.java:383) at org.hibernate.engine.query.spi.HQLQueryPlan.&lt;init&gt;(HQLQueryPlan.java:145) at org.hibernate.engine.query.spi.HQLQueryPlan.&lt;init&gt;(HQLQueryPlan.java:88) at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:190) at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301) at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236) at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1796) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:328) 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.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:342) at com.sun.proxy.$Proxy83.createQuery(Unknown Source) at org.springframework.data.jpa.repository.query.SimpleJpaQuery.validateQuery(SimpleJpaQuery.java:74) It seems it there's a problem when passing parameter Id to the nested query. I can provide more details if this is scarce. If I modify the query to select o from Offe…
answer count: 0
score: 1
tagged with: java
upvote count: 1
tagged with: hql
type: Question
has comment: http://stackoverflow.com/comment/37707486
tagged with: hibernate

http://stackoverflow.com/q/24387305
upvote count: 1
has body: Suppose I know the exact number of key-value pairs that will go in the HashMap and I know that it is not a power of 2. In these cases, should I specify the initial capacity or not ? I could get the nearest power of 2 and specify that but still I'd like to know which would be the better thing to do in such cases (when I don't want to calculate the nearest power of 2). Thanks!
possible better answer: http://stackoverflow.com/a/24387607
has comment: http://stackoverflow.com/comment/37718554
has answer: http://stackoverflow.com/a/24387607
favorite count: 0
linked to: http://stackoverflow.com/q/8352378
has answer: http://stackoverflow.com/a/24388662
accepted answer: http://stackoverflow.com/a/24388662
has comment: http://stackoverflow.com/comment/37719259
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37718629
downvote count: 0
has comment: http://stackoverflow.com/comment/37718912
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37718235
tagged with: hashmap
has title: Is it better to specify HashMap's initial capacity when it is not a power of 2 than to not specify at all?
has comment: http://stackoverflow.com/comment/37719015
has comment: http://stackoverflow.com/comment/37719097
answer count: 2
tagged with: java-6

jakarta-ee
tags question: http://stackoverflow.com/q/24303100
tags question: http://stackoverflow.com/q/24382506
tags question: http://stackoverflow.com/q/24323594
tags question: http://stackoverflow.com/q/24326488
type: Tag
tags question: http://stackoverflow.com/q/24410741
tags question: http://stackoverflow.com/q/24413093
tags question: http://stackoverflow.com/q/24389077
tags question: http://stackoverflow.com/q/24342963
tags question: http://stackoverflow.com/q/24322728
tags question: http://stackoverflow.com/q/24278197
tags question: http://stackoverflow.com/q/24370407
tags question: http://stackoverflow.com/q/24302667
tags question: http://stackoverflow.com/q/24281792
tags question: http://stackoverflow.com/q/24304467
tags question: http://stackoverflow.com/q/24413377
tags question: http://stackoverflow.com/q/24304203
tags question: http://stackoverflow.com/q/24344507
tags question: http://stackoverflow.com/q/24350186
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/24382915
tags question: http://stackoverflow.com/q/24346148
tags question: http://stackoverflow.com/q/24287191
tags question: http://stackoverflow.com/q/24398953
tags question: http://stackoverflow.com/q/24310987
tags question: http://stackoverflow.com/q/24393399
tags question: http://stackoverflow.com/q/24404135
tags question: http://stackoverflow.com/q/24295572
tags question: http://stackoverflow.com/q/24367977
tags question: http://stackoverflow.com/q/24343820
tags question: http://stackoverflow.com/q/24420600
tags question: http://stackoverflow.com/q/24400360
tags question: http://stackoverflow.com/q/24330874
tags question: http://stackoverflow.com/q/24299547
tags question: http://stackoverflow.com/q/24315074
tags question: http://stackoverflow.com/q/24379035
tags question: http://stackoverflow.com/q/24333539
tags question: http://stackoverflow.com/q/24304232
tags question: http://stackoverflow.com/q/24381486
tags question: http://stackoverflow.com/q/24413102
tags question: http://stackoverflow.com/q/24385925
tags question: http://stackoverflow.com/q/24380125
tags question: http://stackoverflow.com/q/24425365
tags question: http://stackoverflow.com/q/24407385
tags question: http://stackoverflow.com/q/24342070
tags question: http://stackoverflow.com/q/24300325
tags question: http://stackoverflow.com/q/24354150
tags question: http://stackoverflow.com/q/24392004
tags question: http://stackoverflow.com/q/24274868
tags question: http://stackoverflow.com/q/24389930
tags question: http://stackoverflow.com/q/24300642
tags question: http://stackoverflow.com/q/24380272
tags question: http://stackoverflow.com/q/24361573
tags question: http://stackoverflow.com/q/24356983
tags question: http://stackoverflow.com/q/24347283
tags question: http://stackoverflow.com/q/24298933
tags question: http://stackoverflow.com/q/24267286
tags question: http://stackoverflow.com/q/24356068
tags question: http://stackoverflow.com/q/24392602
tags question: http://stackoverflow.com/q/24325355
tags question: http://stackoverflow.com/q/24316164
tags question: http://stackoverflow.com/q/24302621

http://stackoverflow.com/comment/37509617
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/24275019
has text: @MarceloBezerra - I'm not sure why you chose to throw in subjective commentary here. Azure supports Java absolutely fine, whether in standard Linux distros, Oracle-specific distros, or Windows VMs. Plus there's a full Java SDK for the Azure API. This question is about scaling Minecraft within Azure.

http://stackoverflow.com/q/24296014
tagged with: datastax
has answer: http://stackoverflow.com/a/24467171
has body: I'm writing an application using Datastax Enterprise and DSE Search (SolR on Cassandra). My problem is i need to generate schema.xml and send to SolR both solrconfig.xml and schema.xml using Java, dynamically. Not using curl. I tried doing it using Commons HttpComponents but the solrconfig.xml file inserted into cassandra table is not correct. Http related data is inserted before the beginning of the XML file, like this : ��: solr_adminsolr_resourcesresource_value��--9NDJNu2AW4jtIyX6ggQAgEqI3FXp3JpDZ6 Content-Disposition: form-data; name="solrconfig.xml"; filename="solrconfig.xml" Content-Type: application/xml; charset=ISO-8859-1 Content-Transfer-Encoding: binary &lt;config&gt; &lt;!-- In all configuration below, a prefix of "solr." for class names is an alias that causes solr to search appropriate packages, including org.apache.solr.(search|update|request|core|analysis) [Continued...] And of course SolR fails when it tries to read this configuration. Do someone know how to send these two files programmatically from java to SolR correctly? Thanks in advance for your answers.
possible better answer: http://stackoverflow.com/a/24407918
tagged with: cassandra
has answer: http://stackoverflow.com/a/24407918
tagged with: datastax-enterprise
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24467171
score: 0
tagged with: java
tagged with: solr
type: Question
has title: Datastax DSE Search : How to post solrconfig.xml and schema.xml using java?
has comment: http://stackoverflow.com/comment/37630344
answer count: 2

http://stackoverflow.com/q/24417617
has comment: http://stackoverflow.com/comment/37775412
has answer: http://stackoverflow.com/a/24417827
has body: I'm new with javaEE development, i want to make simple "hello world" - spring,hibernate application, i already have mapped class to hibernate, dao classes etc... problem is that i would like to try my Controller which i dont know how to make it, but at first i have another question-> property: hibernate.dialect is deprecated -> is it wrong??? and is this cfg file good for postgresql? hibernate.cfg.xml file: <?xml version="1.0" encoding="UTF-8"?> <hibernate-configuration> org.hibernate.dialect.PostgreSQLDialect org.postgresql.Driver **** **** jdbc:postgresql://localhost:8080/come_to_blog_db false 1 <mapping class="com.lime.model.User" /> </hibernate-configuration> but now my controller class: @Controller public class UserController { @Autowired UserService userService; @RequestMapping(value = "/user", method = RequestMethod.GET) public String showUsers(ModelMap map) { return "redirect:/index"; } } hello world at localhost:8080 is working, but if i want acces to localhost:8080/user, it shows error 404, can anyone explain me what i'm doing wrong? shouldnt it redirect me to index page? thanks much :)
tagged with: spring
has comment: http://stackoverflow.com/comment/37783332
has comment: http://stackoverflow.com/comment/37775786
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/37775607
has answer: http://stackoverflow.com/a/24421879
has title: MVC application cannot perform RequestMapping
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37775486
has comment: http://stackoverflow.com/comment/37775858
tagged with: postgresql
type: UnansweredQuestion

http://stackoverflow.com/q/24318065
duplicate of: http://stackoverflow.com/q/4105331
has body: Is there a shorter hand way (more space savy) way to compact a toString than this? int number = 20; String numberChange = Integer.toString(number);
has comment: http://stackoverflow.com/comment/37587016
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24318096
has title: Java: is there a better way to change in to string than this?
score: -1
has comment: http://stackoverflow.com/comment/37586934
tagged with: java
downvote count: 1
answer count: 1
tagged with: tostring
accepted answer: http://stackoverflow.com/a/24318096
linked to: http://stackoverflow.com/q/4105331
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/q/24305686
type: AnsweredQuestion
has title: UnmarshalException: unexpected element on XML just been Marshaller
tagged with: java
has body: I get an UnmarshalException (unexpected element) when unmarshallering XML, which i have just run through marshaller. I looks like the marshalling process generates XML, which cannot be unmarshalled. ObjectFactory objectFactory = new ObjectFactory(); EjendomSoegType type = objectFactory.createEjendomSoegType(); EjendomSoegningKriterierType krit = new EjendomSoegningKriterierType(); { krit.setBy("Skovlunde"); } type.setEjendomSoegningKriterier(krit); JAXBElement<EjendomSoegType> soeg = objectFactory.createEjendomSoeg(type); // create JAXBContext which will be used to update writer JAXBContext context = JAXBContext.newInstance(EjendomSoegType.class); // marshall or convert jaxbElement containing element to xml format Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); StringWriter writer = new StringWriter(); marshaller.marshal(soeg, writer); String xml = writer.toString(); System.out.println( xml ); Unmarshaller unmarshaller = context.createUnmarshaller(); StringReader reader = new StringReader(xml); soeg = (JAXBElement<EjendomSoegType>) unmarshaller.unmarshal(reader); The following UnmarshalException is thrown by the last line of the code unmarshaller.unmarshal(reader): javax.xml.bind.UnmarshalException: unexpected element (uri:"http://rep.oio.dk/tinglysning.dk/service/message/elektroniskakt/1/", local:"EjendomSoeg"). Expected elements are (none) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:609) at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:244) The generated XML looks like: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ns8:EjendomSoeg xmlns:ns2="http://rep.oio.dk/tinglysning.dk/schema/model/1/" xmlns:ns4="http://rep.oio.dk/cpr.dk/xml/schemas/core/2005/03/18/" xmlns:ns3="http://rep.oio.dk/kms.dk/xml/schemas/2005/03/11/" xmlns:ns5="http://rep.oio.dk/bbr.dk/xml/schemas/2005/03/11/" xmlns:ns6="http://rep.oio.dk…
tagged with: jaxb
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/24305838
answer count: 1
score: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/24305838
upvote count: 1

http://stackoverflow.com/q/24369832
has comment: http://stackoverflow.com/comment/37685913
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37686494
has comment: http://stackoverflow.com/comment/37686056
tagged with: permission-denied
answer count: 1
has title: open a folder using java program
score: 0
has comment: http://stackoverflow.com/comment/37685792
tagged with: file-permissions
has comment: http://stackoverflow.com/comment/37685749
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37685654
has comment: http://stackoverflow.com/comment/37686696
has answer: http://stackoverflow.com/a/24370005
has body: I need to open a directory (explore folder) String path="/home/hp/Documents"; I tried to open a directory through this, Desktop.getDesktop().open(new File(path)); This works fine in windows but in ubuntu it says java.io.IOException: Failed to show URI:file:/home/hp/Downloads/drawable/ And when i use, Runtime runTime = Runtime.getRuntime(); Process process = runTime.exec(path); It says, Cannot run program "/home/hp/Downloads": java.io.IOException: error=13, Permission denied
has comment: http://stackoverflow.com/comment/37686015

http://stackoverflow.com/comment/37519566
type: QuestionComment
score: 0
has text: @Ivo, no luck, I would try to narrow down the source of the problem by trying to run the command with as less argements as possible once from command line and once using ProcessBuilder and after each successfull run adding the next argument. Try first with that js script one, also make sure your script is correctly escaped.
comment on: http://stackoverflow.com/q/24281883
type: Comment

http://stackoverflow.com/a/24341272
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24341216
answers question: http://stackoverflow.com/q/24341216
type: AcceptedAnswer
has body: use it like: int result = JOptionPane.showConfirmDialog(null, "Click yes to terminate. ", "TERMINATE SIMULATION?", JOptionPane.YES_NO_OPTION); if (JOptionPane.YES_OPTION == result) { System.out.println("yes"); } else if (JOptionPane.NO_OPTION == result) { System.out.println("No"); }else{ System.out.println("Nothing"); } Also find the option types and return values below(from source): /** * Type meaning Look and Feel should not supply any options -- only * use the options from the JOptionPane. */ public static final int DEFAULT_OPTION = -1; /** Type used for showConfirmDialog. */ public static final int YES_NO_OPTION = 0; /** Type used for showConfirmDialog. */ public static final int YES_NO_CANCEL_OPTION = 1; /** Type used for showConfirmDialog. */ public static final int OK_CANCEL_OPTION = 2; // // Return values. // /** Return value from class method if YES is chosen. */ public static final int YES_OPTION = 0; /** Return value from class method if NO is chosen. */ public static final int NO_OPTION = 1; /** Return value from class method if CANCEL is chosen. */ public static final int CANCEL_OPTION = 2; /** Return value form class method if OK is chosen. */ public static final int OK_OPTION = 0; /** Return value from class method if user closes window without selecting * anything, more than likely this should be treated as either a * CANCEL_OPTION or NO_OPTION. */ public static final int CLOSED_OPTION = -1; Also, don't do int check directly for response value, like if(1==result) for NO_OPTION, always use constants from the JoptionPane class.
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/37749776
type: QuestionComment
comment on: http://stackoverflow.com/q/24403929
has text: First show me your code
score: 0
type: Comment

http://stackoverflow.com/q/24367503
tagged with: spring-jdbc
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/11708967
has comment: http://stackoverflow.com/comment/37705158
has comment: http://stackoverflow.com/comment/37681378
has comment: http://stackoverflow.com/comment/37682481
type: Question
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/37704726
linked to: http://stackoverflow.com/q/3652090
has comment: http://stackoverflow.com/comment/37686346
tagged with: transactions
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/37681003
has comment: http://stackoverflow.com/comment/37707791
has comment: http://stackoverflow.com/comment/37705126
possible better answer: http://stackoverflow.com/a/24381657
has answer: http://stackoverflow.com/a/24381657
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/24389655
has body: I have a @Transactional @Controller, but its methods are being invoked by the Spring MVC framework without a transaction. In the exception trace I do not find the transaction advisor intercepting the call: org.hibernate.HibernateException: No Session found for current thread org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:106) org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:1014) org.example.businesslogic.MyController.userLoggedIn(SwiperRest.java:48) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:483) org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689) org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938) On the other hand, the log clearly indicates that the controller methods were detected as transactional: DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor' DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bea…
has comment: http://stackoverflow.com/comment/37681045
has comment: http://stackoverflow.com/comment/37707723
linked to: http://stackoverflow.com/q/19235436
downvote count: 0
has comment: http://stackoverflow.com/comment/37708104
has comment: http://stackoverflow.com/comment/37691988
linked to: http://stackoverflow.com/q/20385474
has comment: http://stackoverflow.com/comment/37681238
favorite count: 0
has comment: http://stackoverflow.com/comment/37681984
has title: Method not being intercepted by transaction advisor even though "adding transactional method" seen in logs
has comment: http://stackoverflow.com/comment/37681151
tagged with: spring
accepted answer: http://stackoverflow.com/a/24389655

http://stackoverflow.com/q/24352923
tagged with: key-pair
type: AnsweredQuestion
downvote count: 0
tagged with: java
score: 9
type: Question
tagged with: key-generator
has comment: http://stackoverflow.com/comment/39115910
has answer: http://stackoverflow.com/a/25130840
accepted answer: http://stackoverflow.com/a/25130840
answer count: 1
has body: I am making an application which generates a key pair for a user. But in every device the keys are identical. Here is my code: public KeyPair generateKeys() { KeyPair keyPair = null; try { // get instance of rsa cipher KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA"); keyGen.initialize(1024); // initialize key generator keyPair = keyGen.generateKeyPair(); // generate pair of keys } catch(GeneralSecurityException e) { System.out.println(e); } return keyPair; } And to show the generated keys code is: KeyPair keyPair = rsa.generateKeys(); byte[] publicKey = keyPair.getPublic().getEncoded(); byte[] privateKey = keyPair.getPrivate().getEncoded(); privateText.setText( Base64.encodeToString(privateKey, Base64.NO_WRAP) ); publicText.setText( Base64.encodeToString(publicKey, Base64.NO_WRAP) ); The key generation is called only one time for each android device, and for that reason the keys in each device should be different.. Can anyone tell me what i am missing here?
favorite count: 0
upvote count: 9
has title: Android KeyPairGenerator always generates the same key pair
tagged with: android

http://stackoverflow.com/comment/109114779
score: 3
type: AnswerComment
type: Comment
has text: This should be the chosen answer.
comment on: http://stackoverflow.com/a/54750045

http://stackoverflow.com/comment/37545611
has text: Same thing goes for you third for-loop
score: 0
comment on: http://stackoverflow.com/a/24295735
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37660811
comment on: http://stackoverflow.com/a/24337752
type: Comment
has text: I took note of setUseClientMode(false) yet the ssl handshake still fails.
type: AnswerComment
score: 0

http://stackoverflow.com/a/24323565
has body: Usually all public classes/enums/interface are defined each in a single file each (so Day.java, EnumTest.java and so on). But you don't have to make a class/enum/interface public unless it's being accessed from the outside: enum Day { ... } public class EnumTest { Day day; ...
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24323429
upvote count: 2
type: Answer

http://stackoverflow.com/q/24295896
type: Question
has answer: http://stackoverflow.com/a/24296726
score: 0
answer count: 1
has title: java get jsonarray from jsonobject error
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37545485
has comment: http://stackoverflow.com/comment/37546133
has body: I'm doing some recursive function call to append data in a JSONObject and count the totals in the end. My JSON Structure with both JSONObjects and JSONArray { "total": 247, "passed": 247, "failed": 0, "standard_count": [ "LINK_SHUT_NOSHUT", "LC_RELOAD", "VDC_RELOAD", "LINK_FLAP", "SWOVER" ], "submissionFlag": 2, "headCount": 6 } { "total": 0, "passed": 0, "failed": 0, "standard_count": [], "submissionFlag": 0, "headCount": 4 } I'm having a problem in the final steps of fetching the data from this object and calculating the totals in the below code for "standard_count" statement. java.lang.Integer cannot be cast to org.json.JSONArray while(managerKeys.hasNext()){ String manager = managerKeys.next(); try { JSONObject tempObj = (JSONObject) (trendsSet.get(manager)); JSONObject mgrObj = (JSONObject) (tempObj.get(manager)); JSONObject newMgrObj = new JSONObject(); double total = mgrObj.getDouble("total"); double passed = mgrObj.getDouble("passed"); double failed = mgrObj.getDouble("failed"); double headCount = mgrObj.getDouble("headCount"); double subCount = mgrObj.getDouble("submissionFlag"); //org.json.JSONArray standard_count = mgrObj.getJSONArray("standard_count"); org.json.JSONArray standard_count = (org.json.JSONArray) mgrObj.get("standard_count"); ..... //doing all the calculations } catch (JSONException e) { e.printStackTrace(); } } Code, how I'm populating the above JSONObject : org.json.JSONArray standard_count = new org.json.JSONArray(); org.json.JSONArray sub_mgr_count = subMgrInfo.getJSONArray("standard_count"); org.json.JSONArray mgr_count = mgrInfo.getJSONArray("standard_count"); Set&lt;String&gt; update_standard_set = new HashSet&lt;String&gt;(); for (int i = 0; i &lt; mgr_count.length(); i++) { update_standard_set.add((String) mgr_count.get(i)); } for (int i = 0; i &lt; sub_mgr_count.length(); i++) { update_standard_set.add((String) sub_mgr_count.get(i)); } standard_count.put(update_standard_set); mgrInfo.put("total", mgrInfo.getInt("total") + total); mg…
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/54793044
comment on: http://stackoverflow.com/a/29865611
has text: @user3486675 I have added an example of the safest way to do it. It ain't pretty.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24365327
has comment: http://stackoverflow.com/comment/84031220
score: 15
answers question: http://stackoverflow.com/q/24362982
has body: OK, after doing some more research I got it right. I had to do some setup, though. Skip the package design analysis, sonar.skipPackageDesign=true Remove the entries for lib/test directory in your project's properties file Give some more memory set SONAR_RUNNER_OPTS=-Xmx1536m -XX:MaxPermSize=512m Optionally you can disable design analysis by using sonar.skipDesign=true Restart SonarQube services and you should be good now :) To read more, please refer this post
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24362982
has comment: http://stackoverflow.com/comment/113551630
upvote count: 15
has comment: http://stackoverflow.com/comment/84011275
has comment: http://stackoverflow.com/comment/84011297
type: Answer
has comment: http://stackoverflow.com/comment/94273273
downvote count: 0

http://stackoverflow.com/comment/37563234
comment on: http://stackoverflow.com/a/24305678
type: Comment
type: AnswerComment
has text: Yeah I am able to download the file from the client and its not corrupted. The file size downloaded from the program is actually larger than when I download it just from the client o.o
score: 0

http://stackoverflow.com/q/24293084
has title: Java counting connected regions in a grid
tagged with: recursion
has body: I am trying to locate all four-connected regions in the grid. A four-connected region consists of a set of marked cells (value 1) such that each cell in the region can be reached by moving up, down, left or right from another marked cell in the region. The assignment states that we should use recursion. An example input would be: 10 20 0 1 1 0 0 0 1 0 1 1 0 0 0 0 1 0 0 0 1 0 0 1 1 1 0 1 1 0 0 1 0 0 1 1 1 0 0 0 1 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 0 0 1 1 1 1 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 1 1 1 0 1 1 0 1 0 0 0 1 1 1 0 0 0 1 1 0 1 1 0 0 1 1 1 1 0 0 0 0 0 0 1 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 0 0 1 1 0 1 0 0 0 0 1 1 1 1 1 0 0 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0 1 1 0 0 0 0 1 0 0 0 1 1 0 0 1 1 0 1 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 0 1 0 0 And the output should be: 0 1 1 0 0 0 2 0 3 3 0 0 0 0 4 0 0 0 5 0 0 1 1 1 0 2 2 0 0 3 0 0 4 4 4 0 0 0 5 5 0 0 1 0 0 0 2 2 0 3 0 0 0 4 0 0 0 5 5 5 6 0 0 0 0 0 0 0 3 3 0 0 7 0 0 0 5 5 5 0 6 6 0 6 0 0 0 3 3 3 0 0 0 8 8 0 5 5 0 0 6 6 6 6 0 0 0 0 0 0 9 0 8 8 8 0 0 0 0 0 0 6 6 6 0 0 0 9 9 9 9 0 0 8 8 0 8 0 0 0 0 6 6 6 6 6 0 0 9 9 9 0 0 0 8 8 8 8 8 0 0 0 0 6 6 0 0 0 0 9 0 0 0 8 8 0 0 8 8 0 10 0 6 6 6 6 6 0 0 0 0 0 0 0 8 8 0 8 0 0 Right now when I run the code I have, I get this output: 0 2 2 0 0 0 2 0 2 2 0 0 0 0 2 0 0 0 2 0 0 2 2 2 0 2 2 0 0 2 0 0 2 2 2 0 0 0 2 2 0 0 2 0 0 0 2 2 0 2 0 0 0 2 0 0 0 2 2 2 2 0 0 0 0 0 0 0 2 2 0 0 2 0 0 0 2 2 2 0 2 2 0 2 0 0 0 2 2 2 0 0 0 2 2 0 2 2 0 0 2 2 2 2 0 0 0 0 0 0 2 0 2 2 2 0 0 0 0 0 0 2 2 2 0 0 0 2 2 2 2 0 0 2 2 0 2 0 0 0 0 2 2 2 2 2 0 0 2 2 2 0 0 0 2 2 2 2 2 0 0 0 0 2 2 0 0 0 0 2 0 0 0 2 2 0 0 2 2 0 2 0 2 2 2 2 2 0 0 0 0 0 0 0 2 2 0 2 0 0 My code looks like: package project2; import java.io.FileInputStream; import java.io.IOException; import java.util.Scanner; public class project2 { private static int height; private static int length; public static void main(String[] args) { String inputFile; Scanner input = new Scanner(System.in); System.out.print("Enter input file name: "); inputFile = input.nextLine(); tr…
has comment: http://stackoverflow.com/comment/37539887
tagged with: java
tagged with: arrays
answer count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/37539764
has comment: http://stackoverflow.com/comment/37539935
score: 0
tagged with: grid

http://stackoverflow.com/q/24384837
type: Question
tagged with: urldecode
has answer: http://stackoverflow.com/a/24385028
accepted answer: http://stackoverflow.com/a/24385028
has title: Why URL is not decoded completely?
answer count: 1
has comment: http://stackoverflow.com/comment/37713872
score: 4
favorite count: 0
has body: I am writing a java program where my url need to be decoded and I am using URLDecoder.decode(url,"UTF-8") method to achieve it.But, unfortunately it is not decoding completely. For eg. above method decodes %3d to = , %2B to + but it is not decoding few chars like %3A%2F which remain unchanged even after decoding. Please tell me if I am missing something.
has comment: http://stackoverflow.com/comment/37713442
upvote count: 4
has comment: http://stackoverflow.com/comment/37713615
has comment: http://stackoverflow.com/comment/37713492
downvote count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37713590
tagged with: java

http://stackoverflow.com/q/24381984
tagged with: hashmap
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/37752997
has body: How can i put data in a HashMap where I don't want duplicate keys like string=a and string=A should be same. eg:HashMap&lt;String, Integer&gt; map = new HashMap&lt;String, Integer&gt;(); map.put("A", 37); map.put("a", 37); I want both A and a should be considered same.
answer count: 1
has comment: http://stackoverflow.com/comment/37708293
accepted answer: http://stackoverflow.com/a/24382090
favorite count: 0
linked to: http://stackoverflow.com/q/8236945
type: AnsweredQuestion
has title: How can i put data in a HashMap<String, Integer> where I don't want duplicate key like string=a and string=A should be same
tagged with: java
downvote count: 2
type: Question
has answer: http://stackoverflow.com/a/24382090

http://stackoverflow.com/comment/37602322
type: Comment
type: AnswerComment
has text: Actually you can do other things with the remote_api (though the cloud datastore is now a better option). I had a project many years ago (2009) that pushed content from Plone directly to the datastore via appengine. The plone instance used the remote_api to update content directly.
comment on: http://stackoverflow.com/a/24323970
score: 0

http://stackoverflow.com/comment/37739236
score: 1
comment on: http://stackoverflow.com/a/24372954
has text: Because JBoss AS does not use log4j. You could use log4j a configuration instead in your deployment, but it wouldn't log anything server supplied dependencies. https://docs.jboss.org/author/display/AS71/How+To#HowTo-HowdoIuselog4j.propertiesorlog4j.xmlinsteadofusingtheloggingsubsystemconfiguration%3F
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37547230
comment on: http://stackoverflow.com/q/24296973
type: Comment
type: QuestionComment
has text: Sorry,high school programmer. haha
score: 0

http://stackoverflow.com/comment/37624722
comment on: http://stackoverflow.com/q/24337822
score: 0
has text: I tried using System.out.println(" a line number") to narrow down where the problem was occuring. It seems to be the line rs.updateRow();
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24345459
has comment: http://stackoverflow.com/comment/37640535
tagged with: spring-roo
answer count: 0
type: UnansweredQuestion
tagged with: spring
has title: Spring Roo generated JSF project produces java.lang.ClassNotFoundException for generated ~.web.util.ViewExpiredExceptionExceptionHandlerFactory
tagged with: jsf
downvote count: 0
has body: When running a Spring Roo generated JSF project with one entity on VMWare server in STS I am getting a java.lang.ClassNotFoundException for the generated ~.web.util.ViewExpiredExceptionExceptionHandlerFactory class. I created a Spring Roo project using the option from the dashboard. I then used the Roo Shell to enter the following commands: jpa setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY entity jpa --class ~.domain.Subject --testAutomatically I then added a couple of fields with primitive types in Subject.java I then selected JSF using the following commands in the Roo Shell: web jsf setup web jsf all --package ~.web I changed persistence.xml property hibernate.hbm2ddl.auto to be "create-drop" I compiled it using Run As Maven Clean - no errors. I then selected Run As and On Server. The full trace is: Jun 21, 2014 6:50:18 PM com.springsource.tcserver.security.PropertyDecoder &lt;init&gt; INFO: tc Runtime property decoder using memory-based key Jun 21, 2014 6:50:18 PM com.springsource.tcserver.security.PropertyDecoder &lt;init&gt; INFO: tcServer Runtime property decoder has been initialized in 190 ms Jun 21, 2014 6:50:19 PM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] Jun 21, 2014 6:50:19 PM com.springsource.tcserver.serviceability.rmi.JmxSocketListener init INFO: Started up JMX registry on 127.0.0.1:6969 in 89 ms Jun 21, 2014 6:50:19 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 670 ms Jun 21, 2014 6:50:19 PM org.apache.catalina.core.StandardService startInternal INFO: Starting service Catalina Jun 21, 2014 6:50:19 PM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: VMware vFabric tc Runtime 2.8.2.RELEASE/7.0.35.B.RELEASE Jun 21, 2014 6:50:19 PM org.apache.catalina.startup.HostConfig deployDescriptor INFO: Deploying configuration descriptor C:\Program Files\springsource\vfabric- tc-server-developer-2.8.2.RELEASE\base-instance\conf\Catali…
score: 1
tagged with: java
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/38474894
favorite count: 0
has comment: http://stackoverflow.com/comment/37640440

http://stackoverflow.com/comment/37860417
type: AnswerComment
comment on: http://stackoverflow.com/a/24444831
type: Comment
has text: Thank you very much, i have got the response that the database is not accessible. i had forwarded the message to hosting provider support team and they fixed it.
score: 0

http://stackoverflow.com/q/24269927
has answer: http://stackoverflow.com/a/40162192
downvote count: 0
has comment: http://stackoverflow.com/comment/37495789
tagged with: amazon-web-services
possible better answer: http://stackoverflow.com/a/25132741
favorite count: 0
accepted answer: http://stackoverflow.com/a/40162192
has answer: http://stackoverflow.com/a/25132741
has title: How can I force AmazonSQSBufferedAsyncClient to flush messages?
upvote count: 7
has body: I'm using the AWS SDK for Java and I'm using the buffering async sqs client to batch requests so that I reduce costs. When my application shuts down, I want to ensure that no messages are waiting in the buffer, but there's no .flush() method I can see on the client. Does AmazonSQSBufferedAsyncClient.shutdown() flush my messages when called? I looked at the source code and it's unclear. The method calls shutdown() on each QueueBuffer that it has, but inside QueueBuffer.shutdown() it says public void shutdown() { //send buffer does not require shutdown, only //shut down receive buffer receiveBuffer.shutdown(); } Further, the documentation for .shutdown() says: Shuts down this client object, releasing any resources that might be held open. This is an optional method, and callers are not expected to call it, but can if they want to explicitly release any open resources. Once a client has been shutdown, it should not be used to make any more requests. For this application, I need to ensure no messages get lost while being buffered. Do I need to handle this manually using the normal AmazonSQSClient instead of the buffering/async one?
type: AnsweredQuestion
score: 7
tagged with: java
type: Question
tagged with: amazon-sqs
answer count: 2

http://stackoverflow.com/comment/59717145
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24347772
has text: @ChristianSchäfer : The best if not working . uninstall all related to ME SDK. Clean up folders with ME SDK stuff . Start ME SDK install from scratch. Sorry I have to install it also twice.

http://stackoverflow.com/comment/37582911
score: 0
has text: Can you use `JEditorPane`?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24315757

http://stackoverflow.com/a/24318329
has body: Read http HEAD request and response code 404 for not found. Http is your friend. Find out of the resource exists before you GET it.
type: Answer
answers question: http://stackoverflow.com/q/24318267
score: 0

http://stackoverflow.com/comment/37597367
has text: @Nizil: Then what should be the REGEX for name, according to you?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24323616

http://stackoverflow.com/q/24310801
type: AnsweredQuestion
answer count: 2
tagged with: swing
has body: This Code is in a While Loop, and each time I run a new Query it will go through this block after I have chosen what to filter it by, the problem is when I run it a second time and click on a cell in my table it will revert to cells in my previous table/query. I attached an image to show what I mean(I need 10 reputation for that so nevermind on the picture), I filtered the table by procsessState = -1 and when I clicked on some cells it reverted to what the previous table had. Help would be greatly appreciated. The program is around 1000 lines long and I did a terrible job of splitting it into different classes So I just posted where I am almost certain the issue arises. I declared final String columnNamesForTable[] = {"Error Message", "ID", "Locked By", "Message Id", "Process State", "Row Date", "Sender", "Sent Date", "Subject" }; At The top, then I have this a bit later on. else if (checkBoxCounter != 0) { DefaultTableModel tableModel = new DefaultTableModel(columnNamesForTable, 0); tableModel.fireTableDataChanged(); try { Connection conn = DatabaseConnection.getConnection(); System.out.println("Connected"); PreparedStatement statement = conn.prepareStatement(sb.toString(), ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); // Change CONCUR_READ_ONLY to CONCUR_UPDATABLE ResultSet resultSet = statement.executeQuery(); int errorMessageIndex = resultSet.findColumn("ErrorMessage"); int idIndex = resultSet.findColumn("Id"); int lockedByIndex = resultSet.findColumn("LockedBy"); int messageIdIndex = resultSet.findColumn("MessageId"); int processStateIndex = resultSet.findColumn("ProcessState"); int rowDateIndex = resultSet.findColumn("RowDate"); int senderIndex = resultSet.findColumn("Sender"); int sentDateIndex = resultSet.findColumn("SentDate"); int subjectIndex = resultSet.findColumn("Subject"); while (resultSet.next()) { Object[] rowsForTable = { resultSet.getString(errorMessageIndex), resultSet.getString(idIndex), resu…
has answer: http://stackoverflow.com/a/24311506
tagged with: tablemodel
has answer: http://stackoverflow.com/a/24311168
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/24311168
has title: JTable reverts to old cells when clicked on
accepted answer: http://stackoverflow.com/a/24311506
tagged with: jtable
type: Question

http://stackoverflow.com/comment/37713834
type: QuestionComment
has text: Tried to reproduce, but `import java.util.Map.Entry` lets me declare an instance of `Entry` without problems. Could you show us some code?
comment on: http://stackoverflow.com/q/24384948
score: 0
type: Comment

http://stackoverflow.com/comment/37714056
type: AnswerComment
comment on: http://stackoverflow.com/a/24368765
score: 0
type: Comment
has text: Right... I made a mistake that I didn't check size of each file separately. Logs have over 5 GB. Didn't know that they can grow that fast.

http://stackoverflow.com/comment/37616167
score: 0
comment on: http://stackoverflow.com/a/24333409
type: Comment
type: AnswerComment
has text: I understood. So, to do a clean job, I must unbind the "task" object from any others and the GC will clean up both objects when thread finishes. It is correct? PS: I put the `task` in an ArrayList, so I must remove it to GC do a clean.

http://stackoverflow.com/q/24346166
score: 0
type: UnansweredQuestion
has title: ArrayList From cache
type: Question
tagged with: java
has body: I am retrieving values from cache and it retrieves an array of values.But I need to pick a particular value from the arrayList. How can I do it? This is the output from the cache. data =Fruits Apple - 50 Banana - 20 Orange - 60 I need to access Apple. I can get to Fruits using data.get(0). But I dont know how to access Apple -50. Can any one please help?
has comment: http://stackoverflow.com/comment/37640390
has comment: http://stackoverflow.com/comment/37640701
has comment: http://stackoverflow.com/comment/37641228
tagged with: arraylist
has comment: http://stackoverflow.com/comment/37640406
answer count: 0

http://stackoverflow.com/a/24319836
has body: You will get this exception, if you use the JUnit 4.4 core runner to execute a class that has no "@Test" method. Kindly consult the link for more info. courtesy vipin8169
downvote count: 6
score: 155
answers question: http://stackoverflow.com/q/24319697
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24319697
has comment: http://stackoverflow.com/comment/109556452
upvote count: 161
type: Answer
has comment: http://stackoverflow.com/comment/72749383
has comment: http://stackoverflow.com/comment/128296703

http://stackoverflow.com/q/24359088
type: Question
answer count: 3
has title: High memory usage when using Hibernate
has body: I code a server side application with java run on linux server. I use hibernate to open session to database, use native sql to query it and always close this session by try, catch, finally. My server query DB using hibernate with very high frequency. I already define MaxHeapSize for it is 3000M but it usually use 2.7GB on RAM, it can decrease but slower than increase. Sometime it grow up to 3.6GB memory usage, more than my MaxHeapSize define when start. When memory used is 3.6GB, i try to dump it with -jmap command and got a heapdump with size of 1.3GB only. Im using eclipse MAT to analyse it, here is the dominator tree from MAT I think hibernate is the problem, i have so many org.apache.commons.collections.map.AbstractReferenceMap$ReferenceEntry like this. It maybe cant be dispose by garbage collection or can but slow. How can i fix it?
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26546583
has answer: http://stackoverflow.com/a/24359242
score: 9
tagged with: out-of-memory
tagged with: memory-leaks
has answer: http://stackoverflow.com/a/24482535
possible better answer: http://stackoverflow.com/a/26546583
accepted answer: http://stackoverflow.com/a/24359242
type: AnsweredQuestion
upvote count: 9
tagged with: java
tagged with: hibernate
tagged with: heap-dump

http://stackoverflow.com/a/24379951
answers question: http://stackoverflow.com/q/24379226
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24379226
has comment: http://stackoverflow.com/comment/37708456
has comment: http://stackoverflow.com/comment/37706589
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37709119
has comment: http://stackoverflow.com/comment/37704857
has comment: http://stackoverflow.com/comment/37704809
has body: I don't like static fields and methods. I think it's wrong for OOP paradigm. You can facing with a lot of problem with multithreading access to your database. In your case you can hold object as non-static field and access it from activity or service like this: ((MyApplication) getApplication()).getDao() For case like yours, you can use Dependency Injection. There is good lib for that on android (Dagger by squareUp). With it, you can easily "inject" you object in many places.
has comment: http://stackoverflow.com/comment/37704787
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/37706479
score: 1
has comment: http://stackoverflow.com/comment/37704744

http://stackoverflow.com/a/24370570
accepted answer of: http://stackoverflow.com/q/24368555
has body: Would something like this work: @Target(value = ElementType.FIELD) @Retention(value = RetentionPolicy.RUNTIME) public @interface MyAnnotation { Class&lt;? extends Enum&lt;?&gt;&gt; enumClass(); String[] disallowedValues(); } Used like @MyAnnotation(enumClass = Direction.class, disallowedValues = {"LEFT", "RIGHT"}) Direction turnSignal;
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37687481
answers question: http://stackoverflow.com/q/24368555
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/51069032
type: QuestionComment
has text: Instead of OperatingSystemMXBean#getSystemCpuLoad() you could use hyperic sigar CpuPerc#getCombined() (Apache 2 licence). The latency is a little bit better: Around **50 ms** on my Windows 7 box using Java 8 update 45.
score: 0
comment on: http://stackoverflow.com/q/24409387
type: Comment

http://stackoverflow.com/comment/37722734
has text: @LuiggiMendoza I guess that is what is asked for?
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24389598

http://stackoverflow.com/comment/37513788
type: QuestionComment
comment on: http://stackoverflow.com/q/24279388
has text: Hopefully this [answer](http://stackoverflow.com/a/9613766/1057230) be of some help on the topic :-)
score: 0
type: Comment

http://stackoverflow.com/q/24354187
tagged with: android
has comment: http://stackoverflow.com/comment/37730281
has body: Hey Guys i have the question: how could I read a database from backward? This is my method for reading the files: Cursor cursor = myDb.getAllRows(); // Allow activity to manage lifetime of the cursor. // DEPRECATED! Runs on the UI thread, OK for small/short queries. startManagingCursor(cursor); // Setup mapping from cursor to view fields: String[] fromFieldNames = new String[] {DBAdapter.KEY_KALO, DBAdapter.KEY_HYDRATE, DBAdapter.KEY_FAT, DBAdapter.KEY_PROTEIN ,DBAdapter.KEY_CAL}; int[] toViewIDs = new int[] {R.id.item_Kalorien, R.id.item_KG_in_g, R.id.item_F_in_g, R.id.item_P_in_g,R.id.item_cal}; // Create adapter to may columns of the DB onto elemesnt in the UI. SimpleCursorAdapter myCursorAdapter = new SimpleCursorAdapter( this, // Context R.layout.item_tagebuch, // Row layout template cursor, // cursor (set of DB records to map) fromFieldNames, // DB Column names toViewIDs // View IDs to put information in ); // Set the adapter for the list view ListView myList = (ListView) findViewById(R.id.listView1); myList.setAdapter(myCursorAdapter); Thank you for helping!:)
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
tagged with: database
has answer: http://stackoverflow.com/a/24536670
score: 0
tagged with: sql
answer count: 1
has title: How can I read a sql database backward
accepted answer: http://stackoverflow.com/a/24536670

io
tags question: http://stackoverflow.com/q/24380066
tags question: http://stackoverflow.com/q/24291688
tags question: http://stackoverflow.com/q/24395011
tag name: io
tags question: http://stackoverflow.com/q/24387700
tags question: http://stackoverflow.com/q/24406248
tags question: http://stackoverflow.com/q/24415784
tags question: http://stackoverflow.com/q/24301511
tags question: http://stackoverflow.com/q/24372800
type: Tag

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/24419580
type: Tag
tags question: http://stackoverflow.com/q/24311933
tags question: http://stackoverflow.com/q/24315802
tags question: http://stackoverflow.com/q/24369149

http://stackoverflow.com/q/24324761
favorite count: 0
has answer: http://stackoverflow.com/a/66467055
has comment: http://stackoverflow.com/comment/37679568
has comment: http://stackoverflow.com/comment/37668187
downvote count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37601305
has answer: http://stackoverflow.com/a/24324814
has comment: http://stackoverflow.com/comment/37599551
type: Question
tagged with: split
has body: I have: 1234 2345 3456 4567 When I try String.split(" ",2), I get: {1234} , {2345 3456 4567} But I need: {1234},{2345} I want only the first two elements. How do I implement this in Java? Thanks in advance. EDIT:This is just one line of a huge dataset.
score: 7
has answer: http://stackoverflow.com/a/24325087
has answer: http://stackoverflow.com/a/24325012
has answer: http://stackoverflow.com/a/24324983
has answer: http://stackoverflow.com/a/24325010
upvote count: 7
tagged with: function
has title: How to split the string before the 2nd occurrence of a character in Java
answer count: 7
has answer: http://stackoverflow.com/a/24324936
tagged with: string

http://stackoverflow.com/q/24278666
answer count: 2
tagged with: swingworker
tagged with: jtextarea
downvote count: 0
has comment: http://stackoverflow.com/comment/37552491
favorite count: 0
has answer: http://stackoverflow.com/a/24280504
has comment: http://stackoverflow.com/comment/37512792
has comment: http://stackoverflow.com/comment/37550676
upvote count: 3
has body: This has been driving me up the wall for 2 days now. I can't seem to make the JProgressBar update properly and I'm not sure why. I've read through the concurrency and SwingWorker tutorials, I've tested outside of my program and been able to get it working fine using simple code. I understand the concepts, and am just not seeing why it's not working as the code has been re-written in many different ways and still I can't make it work. I'll post a SSCE using as much code from my program as I can, and explain things best I can here as well. Basically I have a auto-updater/Installer program to update and/or install World of Warcraft addons to our customers computers. The first thing the 'updater' does is check the server to see if it's version is the same as the version of the updater installer on the server. This works swimmingly! In fact the entire updater works great except for this one issue. If the updater sees that the server has a different version number than the updater it downloads the installer (in a zip) from the server, unzips it, starts the installation from the exe that was contained in the zip and closes the currently open updater so the install can complete properly. So I have a progress bar on the card (using cardLayout to show the three different cards for the updater, SelfUpdate, Login, and AddonList) for the self updater. as well as a JTextArea below the JProgressBar and that's all that shows on the particular SelfUpdate card. It query's the server for the version number on the server and it compares that version to the version number on the updater currently installed. If the version is the same it changes to the Login card and moves along to the next bits of the program, which work great so far, if the versions are different it sends a query to the server and the server sends the zip file back to the updater for processing. This is where it's not working. The zip is a decent size and of course I want to show the progress of this download. The zip …
tagged with: jprogressbar
linked to: http://stackoverflow.com/q/7053865
tagged with: swing
accepted answer: http://stackoverflow.com/a/24280504
has comment: http://stackoverflow.com/comment/37551680
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37551596
score: 3
has comment: http://stackoverflow.com/comment/37551306
tagged with: java
has comment: http://stackoverflow.com/comment/37551488
possible better answer: http://stackoverflow.com/a/24279391
has answer: http://stackoverflow.com/a/24279391
has title: JProgressBar not updating from SwingWorker, while debugs work fine
has comment: http://stackoverflow.com/comment/37541808
type: Question
linked to: http://stackoverflow.com/q/6113944

http://stackoverflow.com/a/24431441
type: Answer
accepted answer of: http://stackoverflow.com/q/24410152
has body: I ended up solving my problem by borrowing the regular expression from the java source code. public class MyTest { static class PlaceHolder { int index; String flags; Integer width; Integer precision; String type; String conversion; @Override public String toString() { return String.format("PlaceHolder[index=%s, conversion=%s, flags=%s, width=%s, precision=%s, type=%s]", index, conversion, flags, width, precision, type); } } public List&lt;PlaceHolder&gt; getPlaceholders(String pattern) { // %[argument_index$][flags][width][.precision][t]conversion Pattern regex = Pattern.compile("%((\\d+)\\$)?([-#+ 0,(\\&lt;]*)?(\\d+)?(\\.(\\d+))?([tT])?([a-zA-Z%])"); int nextImplicitIndex = 1; Matcher matcher = regex.matcher(pattern); List&lt;PlaceHolder&gt; placeholders = new ArrayList&lt;PlaceHolder&gt;(); while (matcher.find()) { String sIndex = matcher.group(2); int index = sIndex == null ? nextImplicitIndex++ : Integer.parseInt(sIndex); String flags = matcher.group(3); String sWidth = matcher.group(4); String sPrecision = matcher.group(6); String type = matcher.group(7); String conversion = matcher.group(8); PlaceHolder placeholder = new PlaceHolder(); placeholder.index = index; placeholder.flags = flags; placeholder.width = sWidth == null ? null : new Integer(sWidth); placeholder.precision = sPrecision == null ? null : new Integer(sPrecision); placeholder.type = type; placeholder.conversion = conversion; placeholders.add(placeholder); } return placeholders; } @Test public void testGetPlaceholders() { System.out.println(getPlaceholders("Integer is %d, String is %s")); System.out.println(getPlaceholders("String is %2$s, Integer is %1$d")); System.out.println(getPlaceholders("%,6.2f")); System.out.println(getPlaceholders("Today is %tB %te, %tY %n")); } } The test outputs the following: [PlaceHolder[index=1, conversion=d, flags=, width=null, precision=null, type=null], PlaceHolder[index=2, conversion=s, flags=, width=null, precision=null, type=null]] [PlaceHolder[index=2, conver…
answers question: http://stackoverflow.com/q/24410152
type: AcceptedAnswer
score: 0

http://stackoverflow.com/a/24320134
type: Answer
answers question: http://stackoverflow.com/q/24320056
has body: Class A Should be represented in both bean2 and bean2 by this same object around this same ApplicationContext (especially if you declaring Beans as methods in @Configuration), but you can use also Dependency Injections implemented in Spring Container. This code in my opinion is more clear and unequivocal, but reader must know how Autoriwiring works. This code is equivalently: @Configuration public class MyConfiguration { @Bean public A bean1(){ return new AImpl(); } @Bean public B bean2(A bean1) { return new BImpl(bean1); } @Bean public B bean3(A bean1) { return new BImpl(bean1); } } Second way: Add @Component and @Inject/@Autowired on declared classes (you can't do this in legacy code, without AOP). @Component public class AImpl implements A {} @Component public class BImpl implements B { private final A a; @Inject public B(A a){ this.a = a; } } But this solution need to add @ComponentScan(packages="name.of.your.package") to your @Configuration class. @ComponentScan(packages="name.of.your.package") @Configuration public class MyConfiguration { ... }
has comment: http://stackoverflow.com/comment/37591401
score: 0

firefox
tags question: http://stackoverflow.com/q/24328915
tags question: http://stackoverflow.com/q/24269290
tags question: http://stackoverflow.com/q/24356008
tag name: firefox
tags question: http://stackoverflow.com/q/24319526
tags question: http://stackoverflow.com/q/24333480
type: Tag
tags question: http://stackoverflow.com/q/24292536
tags question: http://stackoverflow.com/q/24269218

http://stackoverflow.com/comment/37531731
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24288855
has text: _"Right?"_ Right. You've answered your own question.
score: 0

http://stackoverflow.com/a/24415245
has comment: http://stackoverflow.com/comment/37842875
has comment: http://stackoverflow.com/comment/37770980
has comment: http://stackoverflow.com/comment/37771281
type: Answer
has comment: http://stackoverflow.com/comment/37771229
has comment: http://stackoverflow.com/comment/37771758
has comment: http://stackoverflow.com/comment/37770924
score: 7
has comment: http://stackoverflow.com/comment/37771939
has comment: http://stackoverflow.com/comment/37771789
has comment: http://stackoverflow.com/comment/37773179
accepted answer of: http://stackoverflow.com/q/24415118
has comment: http://stackoverflow.com/comment/37771138
has body: You're right that the race condition exists. But the racy operations are so quick that they're unlikely to happen -- and the synchronized keywords are likely providing synchronization "help" that, while not required by the JLS, hide the races. If you want to make it a bit more obvious, you can "spell out" the count = count + 1 code and put in a sleep: public synchronized void incrementCount() { int tmp = count + 1; try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } count=tmp; } That should show the races more easily. (My handling of the interrupted exception is not good for production code, btw; but it's good enough for small test apps like this.) The lesson learned here is: race conditions can be really hard to catch through testing, so it's best to really understand the code and prove to yourself that it's right.
has comment: http://stackoverflow.com/comment/37773531
answers question: http://stackoverflow.com/q/24415118
downvote count: 0
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37771724

http://stackoverflow.com/comment/37727338
has text: I can't reproduce on OSX. What is the exact version of OpenOffice that you are using?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24270546

http://stackoverflow.com/q/24278347
has comment: http://stackoverflow.com/comment/37515141
has comment: http://stackoverflow.com/comment/37511938
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gxt
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37511680
has comment: http://stackoverflow.com/comment/37511628
has body: I execute the rest request to the WCF application’s service. The service returns the JSON serialized business object which has the date property. The date comes in the following format: "\/Date(1263412800000+0400)\/" When I deserialize the coming line is set in the property with type String. Then I transfer the string to the date type by means of the category in the following way: public static Date parseDateFromJsonString(String value) { if(value == null) return null; long dateValue = Long.parseLong(value.replaceAll(".+\\(|(\\+|\\-|\\)).+", "")); return new Date(dateValue); } For example, the server forwards the next date “14.01.2010 00:00:00”. But after the conversion it looks like “13.01.2010 23:00:00”. Does anyone know how to fix this problem? I'm in 'GMT +4:00' time zone, and I wanna the same time zone value to display in. NB The current problem rises not in all browsers. I'm using GWT 2.6 and GXT 3.1.0.
has title: How to parse date in the GWT from WCF
has comment: http://stackoverflow.com/comment/37514821
downvote count: 0
has comment: http://stackoverflow.com/comment/37513348
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37511486
tagged with: gwt
answer count: 0

http://stackoverflow.com/q/24293768
type: Question
has comment: http://stackoverflow.com/comment/37540982
downvote count: 0
has comment: http://stackoverflow.com/comment/37569692
tagged with: protected
has comment: http://stackoverflow.com/comment/37542961
favorite count: 0
tagged with: gui-builder
tagged with: netbeans
has title: Netbeans: how to make gui events method as protected instead of private
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/37555919
has comment: http://stackoverflow.com/comment/37555991
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37558243
has body: From the Gui builder in NetBeans 7.4 I can make action methods such as private void btnFilterActionPerformed(java.awt.event.ActionEvent evt) { } Is there any way to let NetBeans create protected mathods instead of private ones ? protected void btnFilterActionPerformed(java.awt.event.ActionEvent evt) { }

http://stackoverflow.com/a/25470068
has body: I've found out the solution, we need to override toString() method and pass every time a new test name. Then we get to see all the results. Something like below : @Override public String toString() { return this.testName; } where testName is a string which is accepted as one of the parameters of the constructor of your factory test class.
type: Answer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24424529

http://stackoverflow.com/comment/37653295
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24352822
has text: Couldn't you just use a JOIN query instead?

http://stackoverflow.com/a/45504438
has comment: http://stackoverflow.com/comment/129219761
has body: You can directly use enum instead of String parameter as a API parameter. @RequestMapping(value = "/test", method = RequestMethod.POST) public void test(EnumTest enum) { // body } EnumTest.java public enum EnumTest { One("One"), Two("Two"); private String str; EnumTest(String str){ this.str = str; } public String getStr() { return str; } }
has comment: http://stackoverflow.com/comment/128372190
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/24398653
score: 7
downvote count: 1

http://stackoverflow.com/a/24273046
answers question: http://stackoverflow.com/q/24271977
has comment: http://stackoverflow.com/comment/37505193
has comment: http://stackoverflow.com/comment/37503530
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37503531
has comment: http://stackoverflow.com/comment/37504794
has comment: http://stackoverflow.com/comment/37502998
type: Answer
has comment: http://stackoverflow.com/comment/37503593
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37503428
has comment: http://stackoverflow.com/comment/37502919
has body: You only need to run one additional thread: public class Main { /** * Delay in milliseconds until finished. */ private static final long FINISH_BY = 10000; /** * Start with this number. */ private static final int START_WITH = 1; /** * Delay between eversquare passes in milliseconds. */ private static final long DELAY_BETWEEN_PASSES = 50; /** * Holds the current result. The "volatile" keyword tells the JVM that the * value could be changed by another thread, so don't cache it. Marking a * variable as volatile incurs a *serious* performance hit so don't use it * unless really necessary. */ private static volatile int currentResult = 0; public static void main(String[] args) { // create a Thread to run "eversquare" in parallel Thread eversquareThread = new Thread(new Runnable() { @Override public void run() { eversquare(START_WITH, DELAY_BETWEEN_PASSES); } }); // make the eversquare thread shut down when the "main" method exits // (otherwise the program would never finish, since the "eversquare" thread // would run forever due to its "while" loop) eversquareThread.setDaemon(true); // start the eversquare thread eversquareThread.start(); // wait until the specified delay is up long currentTime = System.currentTimeMillis(); final long stopTime = currentTime + FINISH_BY; while (currentTime &lt; stopTime) { final long sleepTime = stopTime - currentTime; try { Thread.sleep(sleepTime); } catch (InterruptedException ex) { // in the unlikely event of an InterruptedException, do nothing since // the "while" loop will continue until done anyway } currentTime = System.currentTimeMillis(); } System.out.println(currentResult); } /** * Increment the value and compute its square. Runs forever if left to its own * devices. * * @param startValue * The value to start with. * * @param delay * If you were to try to run this without any delay between passes, it would * max out the CPU and starve any other threads. This value is the wait time * between passes. */ private static void eversq…
accepted answer of: http://stackoverflow.com/q/24271977
upvote count: 2

http://stackoverflow.com/comment/37566122
has text: Get rid of this: `while(!in.ready()){}`
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24307231

http://stackoverflow.com/a/24324969
upvote count: 1
answers question: http://stackoverflow.com/q/24323752
has comment: http://stackoverflow.com/comment/37600772
downvote count: 0
type: Answer
score: 1
has body: You have not provided enough information about how you have configured your Tomcat to allow a meaningful diagnosis. But I can say with certainty that it is possible to run Sesame repositories and JSPs on the same Tomcat service ... if you configure them correctly. Indeed it is possible that you are already doing this, but you are using the wrong URL to access the resource. How to "join" us ? I suggest that you start by looking at the Tomcat documentation on how to configure the server, and how to build a basic webapp. Is it a conflict because of the "8080" port ? That is unlikely.

http://stackoverflow.com/comment/37551519
type: Comment
comment on: http://stackoverflow.com/a/24299334
has text: I dont understand what you mean - Just be warned -- instanceOf will also match subclasses. So both x instanceof Integer and x instanceof Number will both return true if x is declared as Integer x = 1; Also this will sound dumb but I don't see the importance of a superclass and subclass here.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37502179
type: QuestionComment
score: 0
has text: Do you receive the data inside your `handleMessage` method?
type: Comment
comment on: http://stackoverflow.com/q/24267660

http://stackoverflow.com/a/24403982
upvote count: 1
downvote count: 0
type: Answer
has body: You should set the content type to the MIME type of the specific file. Otherwise, it will be hard for the client browser to determine what to do with the file. Also, you should be setting the Content-Disposition header, as you are attempting in the out-commented code. However, you should just be returning the raw byte array without wrapping it in anything (although you may use the Response wrapper object to set the correct headers)
score: 1
answers question: http://stackoverflow.com/q/24403758

http://stackoverflow.com/a/24373391
answers question: http://stackoverflow.com/q/24373315
score: 0
type: Answer
has body: you should use extends keyword to inherit a class, Like class derived extends base { //... }

http://stackoverflow.com/a/24370347
accepted answer of: http://stackoverflow.com/q/24370226
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24370226
type: Answer
downvote count: 0
score: 1
has body: setEGLContextClientVersion() needs to be called before setRenderer(), as specified in the documentation: http://developer.android.com/reference/android/opengl/GLSurfaceView.html#setEGLContextClientVersion(int) . There's also a hint that this is in your problem in the stack trace you copied: java.lang.IllegalStateException: setRenderer has already been called for this instance.
upvote count: 1

http://stackoverflow.com/q/24274134
tagged with: steelseries
favorite count: 0
type: UnansweredQuestion
score: 0
has title: Java SteelSeries Library step by step guide
upvote count: 1
tagged with: swing
downvote count: 1
tagged with: java
has body: I've developed an arduino project for weather measurements and i used visual basic for the gui. Everything works fine with gauges , db connection and other things! Now i want to try my lack and write the same thing in java. I've written a small gui with serial communication and displaying the incoming data in jlabels. But now i want to use gauges here too.. they look so cool! I've found steelseries which is fantastic but i dont know from where to start. I've imported the library and junit in my project but now i'm blind and new in java and eclipse..for the gui i use window builder plugin. Is there anybody who knows how to starts using the library? thank you!!
has answer: http://stackoverflow.com/a/24274722
type: Question
answer count: 1
tagged with: user-interface

http://stackoverflow.com/q/24322888
has answer: http://stackoverflow.com/a/24323001
tagged with: spring
score: 1
upvote count: 1
accepted answer: http://stackoverflow.com/a/24323001
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: grails
type: Question
answer count: 1
downvote count: 0
has body: I have created created a Grails application and created the Spring Security plugin set up into It. When I run the application I get following error. Hibernate folder is empty. Can anyone help me resolve this? 2014-06-20 13:41:26,946 [http-bio-8080-exec-21] ERROR [/GrailsLoginWithSpring].[gsp] - Servlet.service() for servlet [gsp] in context with path [/GrailsLoginWithSpring] threw exception Message: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.grails.internal.SESSION_FACTORY_HOLDER': Cannot create inner bean '(inner bean)#3720a15d' of type [org.codehaus.groovy.grails.orm.hibernate.ConfigurableLocalSessionFactoryBean] while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#3720a15d': Invocation of init method failed; nested exception is java.io.FileNotFoundException: class path resource [hibernate.cfg.xml] cannot be resolved to URL because it does not exist
has title: Configuring Hibernate with grails
favorite count: 0

http://stackoverflow.com/comment/37885841
type: Comment
type: QuestionComment
has text: @DaveSyer You're talking at the UserDetailsService level? I'm just looking to optimally leverage the Spring-Oauth/Spring Security stack.
score: 0
comment on: http://stackoverflow.com/q/24326511

http://stackoverflow.com/comment/37721393
comment on: http://stackoverflow.com/a/24388229
score: 0
type: AnswerComment
has text: what is the diff beetween your example to my code ? ,
type: Comment

http://stackoverflow.com/a/24303385
has body: I think you can also try this though it is some what same like above's : public void SelectDropDown() { WebElement selectDropDown =driver.findElement(By.id("CPHRegContent_ddlPageSize")); List&lt;WebElement&gt; option=selectDropDown.findElements(By.tagName("option")); ArrayList&lt;String&gt; list=new ArrayList&lt;&gt;(); for(int i=0;i&lt;option.size();i++) { list.add(option.get(i).getText().trim()); } Collections.reverse(list); String lastOption=list.get(0); new Select(selectDropDown).selectByVisibleText(lastOption); }
type: Answer
answers question: http://stackoverflow.com/q/24277891
score: 0

http://stackoverflow.com/q/24279316
has answer: http://stackoverflow.com/a/24279419
has answer: http://stackoverflow.com/a/24279464
favorite count: 0
has body: I'm following a java tutorial, i find this piece of code: //load the AppTest at runtime Class cls = Class.forName("com.mkyong.reflection.AppTest"); Object obj = cls.newInstance(); //call the printIt method Method method = cls.getDeclaredMethod("printIt", noparams); method.invoke(obj, null); My question is: if i don't know the class type, is not much easier (and faster) try to cast the object instead of invoking methods in that way? Why (and when) i should use this way?
linked to: http://stackoverflow.com/q/9222621
has title: Java - Invoking class methods
has comment: http://stackoverflow.com/comment/37513426
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/37513356
has comment: http://stackoverflow.com/comment/37513428
has comment: http://stackoverflow.com/comment/37513443
upvote count: 3
has comment: http://stackoverflow.com/comment/37513375
tagged with: java
linked to: http://stackoverflow.com/q/37628
possible better answer: http://stackoverflow.com/a/24279419
has comment: http://stackoverflow.com/comment/37513446
type: Question
has comment: http://stackoverflow.com/comment/37513323
downvote count: 0
has comment: http://stackoverflow.com/comment/37513439
has answer: http://stackoverflow.com/a/24279594
accepted answer: http://stackoverflow.com/a/24279594
answer count: 3

http://stackoverflow.com/q/24341753
has answer: http://stackoverflow.com/a/24342376
has body: How am I able to insert the i from the for loop in the imageview below, not the i to replace 12 in the file name so that it can become; ImageView Moon_img12 = new ImageView(new Image(getClass().getResourceAsStream("/Images/tiles/i.png"))); Code: for(int i=0; i&lt;=total_donnation; i++) { ImageView Moon_img12 = new ImageView(new Image(getClass().getResourceAsStream("/Images/tiles/12.png"))); }
has comment: http://stackoverflow.com/comment/37632270
has comment: http://stackoverflow.com/comment/37631427
has title: insert i variable from for loop in filename using java/ javafx
has comment: http://stackoverflow.com/comment/37632442
has comment: http://stackoverflow.com/comment/37632013
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/37633308
type: Question
has comment: http://stackoverflow.com/comment/37632470
has comment: http://stackoverflow.com/comment/37631476
has comment: http://stackoverflow.com/comment/37632152
has comment: http://stackoverflow.com/comment/37632317
has comment: http://stackoverflow.com/comment/37632091
has comment: http://stackoverflow.com/comment/37631685
has answer: http://stackoverflow.com/a/24342796
has comment: http://stackoverflow.com/comment/37633352
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37633333
has comment: http://stackoverflow.com/comment/37631456
has comment: http://stackoverflow.com/comment/37631760
has comment: http://stackoverflow.com/comment/37631346
has comment: http://stackoverflow.com/comment/37631572
type: UnansweredQuestion

http://stackoverflow.com/comment/37687241
type: QuestionComment
score: 5
has text: Is there really a need to differentiate? A class is always a type
comment on: http://stackoverflow.com/q/24370726
type: Comment

http://stackoverflow.com/q/24370987
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/27871733
favorite count: 0
has answer: http://stackoverflow.com/a/30805823
linked to: http://stackoverflow.com/q/8302519
type: UnansweredQuestion
score: 2
upvote count: 2
tagged with: classification
tagged with: java
tagged with: machine-learning
has body: I am using libsvm in java and am experiencing similar issues as described here for python. I am getting a lot of console output during training and prediction and would like to disable it. Sadly, due to a "Service Temporary Unavaiable" I can't access the website, where it might be described (here). I couldn't find a java related way to disable this warnings (If I did oversee something I apologize) The Output always looks quite similar to this: optimization finished, #iter = 10000000 nu = 0.013178458659415372 obj = -11.005078334927212, rho = -2.1799731001804696 nSV = 20, nBSV = 5 Total nSV = 20 Do you know how I can disable this kind of output in java? Thanks a lot for your help.
has answer: http://stackoverflow.com/a/24371844
type: Question
has title: How to disable the console output in libsvm (java)
tagged with: svm
tagged with: libsvm

http://stackoverflow.com/q/24357969
type: AnsweredQuestion
tagged with: physics-engine
tagged with: java
accepted answer: http://stackoverflow.com/a/24358080
type: Question
answer count: 1
tagged with: class
score: 0
has body: So I'm working on creating my own physics engine for an app that I'm creating. At the moment I've got a StaticObject class for simple objects that don't simulate every game tick, and a DynamicObject class for objects that pertain to gravity and collisions and such. Next, I'm creating a constraint class to create links between these different objects, like making this dynamicObject stay at the same position as this staticObject. Alright, I'm trying to access some methods and values in the Object Classes(StaticObject or DynamicObject) from the Constraint class, but the specific type/class that I am accessing is variable. It could be either of type StaticObject, or DynamicObject. This is the class that needs access to the Object classes, or 'variable type class'(I don't know the proper terms here, I would like to know though, a bit new to this aspect of java): public class Constraint&lt;objectType1, objectType2&gt; { private Class&lt;objectType1&gt; object1; private Class&lt;objectType2&gt; object2; public Constraint(Class&lt;objectType1&gt; object1, Class&lt;objectType2&gt; object2) { this.object1 = object1; this.object2 = object2; } public void update() { object2.position = object1.position; } } I know for certain that whatever type the Objects are( StaticObject or DynamicObject ), they will each have the attributeobject.position`. So, my question comes down to: How do I determine that the variable classes are of the correct types(StaticObject, or DynamicObject) and then how do I access methods and variables within the classes regardless of the type? Am I headed in the right direction? If not, what better ways can I learn? Examples please, this is new to me. :)
has answer: http://stackoverflow.com/a/24358080
has title: Accessing methods from a variable type class
tagged with: android

http://stackoverflow.com/comment/37791450
score: 0
type: QuestionComment
type: Comment
has text: As a reminder to address your comments : `Math.abs` returns the absolute value of an expression, but you could as well compare the square of the expression, as it is always positive as well. You could change your test to : `(a-c)*(a-c)==(b-d)*(b-d)`. As a side note concerning the `Math` library, it is standard to java, and every install will have it so you don't need to worry about portability
comment on: http://stackoverflow.com/q/24426155

http://stackoverflow.com/a/24398690
type: Answer
answers question: http://stackoverflow.com/q/24398476
upvote count: 1
has body: You don't need anything special. Just invoke it as StaticClass.getGroup(); You will simply be ignore the return value. The type argument will be inferred as Something, which is what you'd have access to in your method anyway. You would specify an actual type argument by doing StaticClass.&lt;SomeTypeThatExtendsSomething&gt;getGroup(); but you don't need that since the only part of your method that makes use of the generic type is the return type, which you are discarding.
downvote count: 0
score: 1

http://stackoverflow.com/q/24387367
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37740417
tagged with: java
has body: I am writing an android SSH Client. I have a terminal object that controls the view and an SSH object to send commands to the server. My problem is that the terminal displays in color during all sessions but when an ncurses application opens, (tmux for example), the terminal displays in black and white. I was able to find this: http://invisible-island.net/ncurses/ncurses.faq.html#white_black I am not really sure what that means. Can anyone guide me on more documentation on this, or if there are any open source Java clients that support this feature. I am not really sure how to fix this.
has answer: http://stackoverflow.com/a/24643265
has title: Ncurses not supporting color
answer count: 1
tagged with: terminal
score: 0
tagged with: android
tagged with: ssh
has comment: http://stackoverflow.com/comment/37737245
accepted answer: http://stackoverflow.com/a/24643265
tagged with: ncurses
type: Question

http://stackoverflow.com/comment/37752159
type: Comment
has text: if by plain object you mean "new Object()" then yes - just look at the constructor of the Thread class to get an impression of what is going on when creating a new thread
comment on: http://stackoverflow.com/a/24362191
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37571583
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24309871
has text: Where do you set data into adapter?

http://stackoverflow.com/comment/37511982
type: AnswerComment
type: Comment
has text: This fixed it I didn't even notice that my loop closed the file man i feel silly thank you so much.
comment on: http://stackoverflow.com/a/24278453
score: 0

amazon-elastic-beanstalk
tag name: amazon-elastic-beanstalk
tags question: http://stackoverflow.com/q/24313663
type: Tag

http://stackoverflow.com/a/68780528
upvote count: 5
downvote count: 0
has body: brew search openjdk find some openjdk formulae, in 2021, brew offer openjdk11 and openjdk8 as options.
score: 5
answers question: http://stackoverflow.com/q/24342886
has comment: http://stackoverflow.com/comment/122884711
type: Answer

http://stackoverflow.com/comment/37658853
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24355246
has text: @Paul It stops checking at the first null element, so yeah the second might be null... But as this is for a demo tomorrow and I'll never look at the code again, I'm going to leave it at this and just check whether gs==null.

http://stackoverflow.com/a/24350747
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24350186
answers question: http://stackoverflow.com/q/24350186
type: Answer
has body: It makes sense that you a get LazyInitializationException. Since you are using toString implicitly on TaskAction, task is trying to be accessed which is lazily loaded. If you try assertEquals("Should be 4 taskActions with getAllTaskActions.", 4, taskActionDao.getAllTaskActions(t2.getIdTask()).size());

http://stackoverflow.com/comment/37638440
has text: Please try to avoid *Scriplet* instead use JSTL & EL.
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/24345086

http://stackoverflow.com/comment/37793850
score: 1
has text: You can set all data in hidden fields and pass it to servlet where you need to write to the file and than set response.
type: AnswerComment
comment on: http://stackoverflow.com/a/24427255
type: Comment

http://stackoverflow.com/comment/37656789
score: 0
type: Comment
type: QuestionComment
has text: You mean cb.callback(response), right?
comment on: http://stackoverflow.com/q/24354527

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/24360079
tags question: http://stackoverflow.com/q/24326979
type: Tag
tags question: http://stackoverflow.com/q/24343330

http://stackoverflow.com/q/24343214
tagged with: sudoku
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/91454569
tagged with: algorithm
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/91438531
has answer: http://stackoverflow.com/a/24343433
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/24343243
accepted answer: http://stackoverflow.com/a/24343433
has body: I'm struggling with a backtracking algorithm to determine wether a Sudoku has a unique solution or if it has multiple Solutions. Here's the backtracking code i use: static boolean solve(int i, int j, int[][] cells) { if (i == 9) { i = 0; if (++j == 9) return true; } if (cells[i][j] != 0) // skip filled cells return solve(i+1,j,cells); for (int val = 1; val &lt;= 9; ++val) { if (legal(i,j,val,cells)) { cells[i][j] = val; if (solve(i+1,j,cells)) return true; } } cells[i][j] = 0; // reset on backtrack return false; } First approach: If i change for (int val = 1; val &lt;= 9; ++val) { for (int val = 9; val &gt;= 1; val--) { i get two different solving-algorithmns which should find different solutions (if different solutions exist). The problem with this approach is, that the algorithm doesn't terminate even though its just a slight change and i don't know why. Second approach: Reset to backtrack and continue searching for a solution. If i try this, it doesn't work either. I tried to find a Java example, but i can only find information like "reset on backtrack and continue searching for a second solution". Could someone please provide a example how to change the algorithm so it tells me if multiple solutions exists (the exact number is not needed) OR Could someone please explain to me why my first approach doesn't terminate? Thanks!
favorite count: 0
possible better answer: http://stackoverflow.com/a/24343243
has title: Determine whether a Sudoku has a unique solution
upvote count: 7
tagged with: backtracking

http://stackoverflow.com/q/24412683
has comment: http://stackoverflow.com/comment/37766188
tagged with: eclipse
type: Question
tagged with: helios
has comment: http://stackoverflow.com/comment/37767432
accepted answer: http://stackoverflow.com/a/24413984
has comment: http://stackoverflow.com/comment/37901915
answer count: 1
downvote count: 0
tagged with: jvm
has title: No Java Virtual machine was found error in Eclipse HELIOS\jre\bin\javaw.exe
favorite count: 0
has comment: http://stackoverflow.com/comment/37768407
type: AnsweredQuestion
score: 2
has body: Got the below Error messages when i try to open the Eclipse. "A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java Virtual machine was found after searching the follwing locations: C:\ECLIPSE\HELIOS\jre\bin\javaw.exe javaw.exe in your current PATH" i have modified the eclipse.ini (C:\ECLIPSE\HELIOS) by adding the below lines, -vm C:\Program Files (x86)\Java\jre7\bin\javaw.exe After that change, i'm able to access the Eclipse. but most of my colleague and web suggested the below different options. -vm C:\Program Files (x86)\Java\jdk1.5.0_22\jre\bin\javaw.exe and -vm C:\Program Files (x86)\Java\jdk1.5.0_22\bin\javaw.exe Please help me with this. which one is correct option for this error.?
upvote count: 2
has answer: http://stackoverflow.com/a/24413984
tagged with: java

http://stackoverflow.com/a/24349563
type: Answer
has body: you can call the java method by surrounding it with backtics c.`type`()
answers question: http://stackoverflow.com/q/24349517
accepted answer of: http://stackoverflow.com/q/24349517
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4

http://stackoverflow.com/q/24307160
upvote count: 1
answer count: 1
favorite count: 0
has body: JSP can be regarded as nice template and/or preprocessor engine. I would like to generate some XML files by program with it. What is the simplest way to accomplish this?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24307331
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37566369
tagged with: java
has comment: http://stackoverflow.com/comment/37567010
type: Question
linked to: http://stackoverflow.com/q/18877536
has comment: http://stackoverflow.com/comment/37566928
tagged with: desktop-application
tagged with: jsp
has comment: http://stackoverflow.com/comment/37566215
has title: How to execute JSP in desktop application?

http://stackoverflow.com/comment/37770959
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24415118
has text: How many cores do you have dedicated to that program?
type: Comment

http://stackoverflow.com/a/24318898
has body: There is "user roles" in spring security. This is very basic work with spring security. Did you try to search any tutorial for spring security? Yes, you can implement this. Yes, it is good idea to extend Customer, Student, and Admin from Spring's User class.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24318857
score: 1
upvote count: 1

http://stackoverflow.com/a/24353816
has comment: http://stackoverflow.com/comment/37655420
has comment: http://stackoverflow.com/comment/37655530
downvote count: 0
has comment: http://stackoverflow.com/comment/37655432
upvote count: 2
type: Answer
has body: You need to call animateCamera() from the main thread. You can do so with a Handler or runOnUiThread(), or post().
score: 2
answers question: http://stackoverflow.com/q/24353793
has comment: http://stackoverflow.com/comment/37655436

http://stackoverflow.com/comment/37774481
score: 0
type: AnswerComment
has text: Not necessarily. It depends on how you construct your .jar file. You can inspect a .jar file by rename it to a .zip and decompress. Can you please post (part) of the resulting file tree?
type: Comment
comment on: http://stackoverflow.com/a/24417037

http://stackoverflow.com/a/24306085
upvote count: 21
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24305890
answers question: http://stackoverflow.com/q/24305890
score: 21
type: Answer
has body: You should use the method Map::computeIfAbsent to create a list lazily: map.computeIfAbsent(search_key, k -&gt; new ArrayList&lt;&gt;()) .add(new_string);

http://stackoverflow.com/a/24387617
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/37721196
score: 2
has comment: http://stackoverflow.com/comment/37719528
has body: Here's a self-contained example of what you're trying to do. Code you're running try { // gets the "in" field Field f = Outer.class.getDeclaredField("in"); // sets it accessible as it's private f.setAccessible(true); // gets an instance of the Inner class by getting the instance of the // "in" field from an instance of the Outer class - we know "in" is // initialized in the no-args constructor Object o = Object o = f.get(Outer.class.newInstance()); // gets the "execute" method Method m = o.getClass().getDeclaredMethod("test", (Class&lt;?&gt;[])null); // sets it accessible to this context m.setAccessible(true); // invokes the method m.invoke(o, (Object[])null); } // TODO better handling catch (Throwable t) { t.printStackTrace(); } Classes (inner/outer)... public class Outer { private Inner in; public Outer() { in = new Inner(); } private class Inner { private void test() { System.out.println("test"); } } } Output test
has comment: http://stackoverflow.com/comment/37719899
has comment: http://stackoverflow.com/comment/37720359
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24387472
has comment: http://stackoverflow.com/comment/37720441
has comment: http://stackoverflow.com/comment/37720949
accepted answer of: http://stackoverflow.com/q/24387472
has comment: http://stackoverflow.com/comment/37721221

lemmatization
type: Tag
tags question: http://stackoverflow.com/q/24427219
tag name: lemmatization

http://stackoverflow.com/comment/37703254
type: Comment
score: 2
type: AnswerComment
has text: @KickButtowski Do you mean the oracle tutorial on Lambdas I linked to a few comments back? ;) Say these words " `->` is NOT a comparison ". I have said this twice now.
comment on: http://stackoverflow.com/a/24378684

http://stackoverflow.com/a/24312504
accepted answer of: http://stackoverflow.com/q/24287833
has body: Problem been solved by adding a validation method into the bean setter.
type: Answer
answers question: http://stackoverflow.com/q/24287833
type: AcceptedAnswer
score: 0

http://stackoverflow.com/q/24319611
downvote count: 3
has comment: http://stackoverflow.com/comment/37589924
has title: Starvation and threads
type: Question
has comment: http://stackoverflow.com/comment/37589888
has answer: http://stackoverflow.com/a/24319756
upvote count: 0
answer count: 1
favorite count: 0
has body: I have an interesting scenario based question related to java threads. Sam has designed an application. I t segregates tasks that are critical and executed frequently from tasks that are non critical and executed less frequently. He has prioritized these tasks based on their criticality and frequency of execution. After close scrutiny, he finds that the tasks designed to be non critical are rarely getting executed. From what kind of problem is the application suffering? I have figured it out as "Starvation" but i am still confuse whether I am right or wrong.
type: UnansweredQuestion
tagged with: multithreading
score: -3
has comment: http://stackoverflow.com/comment/37589850
has comment: http://stackoverflow.com/comment/37589844
tagged with: java

http://stackoverflow.com/a/24376109
score: 1
has comment: http://stackoverflow.com/comment/37743214
upvote count: 1
type: AcceptedAnswer
has body: Put all this logic into one single stored procedure (SP). At the very end of the body of this SP just do SELECT v AS RESULT; where v is some integer value. Make this value v different depending on the login attempt outcome e.g. v=0 means login succeeded; v=1 means login failed as there's no such username; v=2 means login failed as the account was already locked when this login was attempted; v=3 means login failed as the password does not match, but the SP did not lock the account; v=4 means login failed as the password does not match, and also the SP has just locked the account due to too many tries. Of course through the RESULT value, you can encode other login attempt outcomes in any way you like. Then in the Java code just inspect the SP RESULT value to know exactly what happened inside it during this login attempt. That is in the Java code you will get a result set with 1 row and 1 column called RESULT, just inspect its value and proceed the way you like.
accepted answer of: http://stackoverflow.com/q/24376016
type: Answer
answers question: http://stackoverflow.com/q/24376016
downvote count: 0

http://stackoverflow.com/q/24417394
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/24417497
has answer: http://stackoverflow.com/a/24417534
score: 0
has title: Java 7 Unicode Regex Tabs-only and Spaces-only
has body: I'm currently trying to add support to our application for Japanese and French language encodings. In doing so, I'm trying to create two Pattern matchers to detect tabs-only and spaces-only in a read file, regardless of language encoding. These will be used to determine what delimiter is used in a file, so they can be processed accordingly. When I've tried compiling a space pattern Pattern.compile(" ", Pattern.UNICODE_CHARACTER_CLASS); I don't see it generating a regex to handle different unicode space values. eg something like "[\\u00A0\\u2028\\u2029\\u3000\\u00C2\\u009A\\u0041]" Compilation seems to work properly with the '\s' character set, but that includes tabs and newlines. How should I be doing this in Java? UPDATE So part of the reason this wasn't working was the fact that Japanese web text HAS NO spaces, even though there appear to be spaces. Take the following line from a web imoprt: 実なので説明は不要だろう。その後1987 There are actually no spaces here う。そ. Just three characters. Fixing this is really the subject of another question, so I have accepted Casimir's answer, as it handled the French case just fine.
possible better answer: http://stackoverflow.com/a/24417534
has comment: http://stackoverflow.com/comment/37780407
has answer: http://stackoverflow.com/a/24417497
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37775754
tagged with: java

http://stackoverflow.com/comment/37790514
type: Comment
has text: is there any way where we can calculate individual tokens? thanks!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24425617

http://stackoverflow.com/comment/37775349
score: 0
has text: I copied my parsing method to the end of the question
comment on: http://stackoverflow.com/q/24416869
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37564466
comment on: http://stackoverflow.com/q/24306088
score: 1
has text: Note that by providing lots of unnecessary file reading code, which wasn't being timed (apparently), you've confused a lot of people here.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37653887
has text: And please format the code properly. It is very confusing with the incorrect indentation (e.g. I can not see where your synchronized block ends... which is probably because it does not end anywhere).
comment on: http://stackoverflow.com/q/24353106
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24310162
has title: JasperReports: fillReport very slow
favorite count: 0
score: 2
upvote count: 2
type: UnansweredQuestion
has body: We have this code to generate a PDF report, from XML input. It is very slow (2 hours to process 280K rows; 10 minutes for 70K rows, on a Solaris T5220). DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); FileInputStream fileStream = new FileInputStream(rawXmlFile); ds = docBuilder.parse(fileStream); Map&lt;String, Object&gt; params = new HashMap&lt;String, Object&gt;(); params.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, ds); params.put(JRXPathQueryExecuterFactory.XML_DATE_PATTERN, com.vodafone.gdsp.reporting.enums.xml.DateFormat.DATE_FORMAT_ISO8601); params.put(JRXPathQueryExecuterFactory.XML_NUMBER_PATTERN, "##0.##"); params.put(JRXPathQueryExecuterFactory.XML_LOCALE, Locale.ENGLISH); params.put(JRParameter.REPORT_LOCALE, Locale.UK); params.put("REPORT_DIR", jasperFile.substring(0, jasperFile.lastIndexOf("/"))); try { virtPageSize = Integer.parseInt(reportConfig.getJasperVirtPageSize()); virtPageDir = reportConfig.getJasperVirtPageDir(); } catch (NullPointerException npe) { logger.info("Virtual page size and directory not assigned, using the default value of virtPageSize {} and virtPageDir {}", virtPageSize, virtPageDir); } catch (Exception ex) { logger.error("Exception while fetching virtual page size and directory {}", ex.getMessage()); } logger.info("Using Jasper virtual parameters ({}, {})", virtPageSize, virtPageDir); JRFileVirtualizer virtualizer = new JRFileVirtualizer(virtPageSize, virtPageDir); JRVirtualizationHelper.setThreadVirtualizer(virtualizer); params.put(JRParameter.REPORT_VIRTUALIZER, virtualizer); DefaultJasperReportsContext context = DefaultJasperReportsContext.getInstance(); JRPropertiesUtil.getInstance(context).setProperty("net.sf.jasperreports.xpath.executer.factory", "net.sf.jasperreports.engine.util.xml.JaxenXPathExecuterFactory"); File jasperReport = new File(jasperFile); JasperPrint jasperPrint = JasperFillManager.fillReport(new FileInputStream(jasperReport), params); This DOES include the "use Jaxen" pr…
tagged with: performance
tagged with: java
has answer: http://stackoverflow.com/a/26610064
type: Question
tagged with: jasper-reports
has comment: http://stackoverflow.com/comment/60884827
answer count: 1
downvote count: 0

http://stackoverflow.com/q/24304876
has comment: http://stackoverflow.com/comment/37576874
type: Question
linked to: http://stackoverflow.com/q/218384
has body: NULL POINTER Error message is displayed when running my programme. code is attached but cannot seem to find the problem. Exception in thread "main" java.lang.NullPointerException at coursework2.Assignment.main(Assignment.java:330 lastName = last; firstName = first; email = pemail; dob = pdob; town = ptown; job = pjob; school = pschool; status = pstatus; //String[] friendArray; friendArray = new String[]{lastName,firstName,email,dob,town,job,school,status}; String searchName; int input; int index; SimpleDateFormat dateFormat= new SimpleDateFormat ("dd/mm/yyy"); SimpleDateFormat timeFormat= new SimpleDateFormat ("hh:mm"); SimpleDateFormat birthdayFormat= new SimpleDateFormat ("dd/mm"); Date today = new Date(); dateFormat.format(today); //get current date time with date() timeFormat.format(today); //get current date time with calender () birthdayFormat.format(today); //get current Calendar.getInstance(); //int length = friendList.length; int maxSize = 100; // array size User arr; // reference to array arr = new User(maxSize); // create the array User [] userList = new User[500]; friendArray = new String[]{lastName}; userList[0].setFriendArray("Henly"); userList[0].setFriendArray("White"); userList[1].setFriendArray("Davidson"); userList[1].setFriendArray("White"); userList[2].setFriendArray("Browne"); userList[2].setFriendArray("Gomez"); userList[3].setFriendArray("Browne"); userList[3].setFriendArray("Reid"); userList[4].setFriendArray("White"); userList[4].setFriendArray("Henly"); userList[5].setFriendArray("Myles"); userList[5].setFriendArray("Browne"); userList[6].setFriendArray("Davidson"); userList[6].setFriendArray("Browne"); userList[7].setFriendArray("White"); userList[7].setFriendArray("Gomez"); userList[8].setFriendArray("Reid"); userList[8].setFriendArray("Scott");
upvote count: 0
has comment: http://stackoverflow.com/comment/37562507
answer count: 1
has title: Null pointer displaying cannot find error
favorite count: 0
has comment: http://stackoverflow.com/comment/37561663
has comment: http://stackoverflow.com/comment/37562116
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/37561851
has answer: http://stackoverflow.com/a/24312533
has comment: http://stackoverflow.com/comment/37562425
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/37561716

http://stackoverflow.com/comment/37681173
type: AnswerComment
type: Comment
has text: There are multiple activities and i need the music to loop and persist across all activities.
comment on: http://stackoverflow.com/a/24367492
score: 0

http://stackoverflow.com/a/52960259
type: Answer
has body: if you use sqldeveloper 18.2.0 edit %APPDATA%\sqldeveloper\18.2.0\product.conf jdk9, jdk10, and jdk11 are not supported change back to jdk 8 for example SetJavaHome C:\Program Files\ojdkbuild\java-1.8.0-openjdk-1.8.0.191-1
answers question: http://stackoverflow.com/q/24390562
score: 0

http://stackoverflow.com/comment/37608329
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24327657
has text: No it does not... To be more specific, I found out that the event stucks into a while loop in EventDispatchThread.java, pumpEventsForFilter method. After being in the loop, debug just stays there. I cannot step over any further. It's like it cannot get out of while loop and stops debugging. What might be that? This is the same for every button.
score: 0

http://stackoverflow.com/comment/37649524
has text: `JApplet` is better in your project because you have to interact with swing components like `JFrame`, and `JApplet` is a swing component.
comment on: http://stackoverflow.com/a/24344527
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/37705289
score: 0
comment on: http://stackoverflow.com/q/24368901
type: Comment
type: QuestionComment
has text: No problem. Good luck with this. Please post "right" self answer when you find the solution.

http://stackoverflow.com/comment/37754313
type: Comment
has text: @Jurriaan: If you insist the the rules have an *order*, then you can resolve the inconsistencies by declaring that first matching rule wins. If the rules don't have an order (not obvious from your example), then you just have inconsistencies with no resolution (or maybe you invent another one, e.g., the most specific rule wins, if there is one). A real problem with 1000 rules like this, is there *will* be (conceptual) inconsistencies, and people will end up "debugging" them somehow. IMHO, better you should *dianose* the inconsistencies to help them do that debugging. (PS: +1).
score: 1
comment on: http://stackoverflow.com/a/24370150
type: AnswerComment

http://stackoverflow.com/comment/37707422
score: 0
type: AnswerComment
has text: I tried using "\n" but unfortunately it did not work.
type: Comment
comment on: http://stackoverflow.com/a/24372984

http://stackoverflow.com/q/24371483
tagged with: android
has body: This seems like a simple issue, but I can't figure out what's causing it. I have one activity that creates several Bitmaps using Bitmap.createBitmap(width, height, Config), applies a Canvas to them, and draws on the canvases. Once I'm done, I recycle them. They are created in the resolution that they are displayed at, and don't have any issues being created. In OnSurfaceDestroyed(), I recycle every Bitmap. As part of the drawing instructions, I do allocate temporary Bitmaps which are recycled as soon as they are unneeded. As an extra measure, I also put System.gc() in every activity's OnSurfaceDestroyed(). Now, when I switch between this activity and another activity (which creates no Bitmaps), I get an OutOfMemoryException after about 6 or 7 switches back and forth. The LogCat makes it clear that each time I create the first activity, more and more space is being freed by the automatic garbage collector. Here is the source error: 06-23 12:49:53.984: E/dalvikvm-heap(8487): Out of memory on a 1382416-byte allocation. I realize this is a huge byte allocation, but I don't really understand why? It has no problem the first 5-6 times, so why does the memory seem to accumulate even though I'm recycling everything? I'm fairly certain that nothing else I'm doing is high-memory. I did find a work-around by using Config.RGB_565 to create the Bitmaps instead of Config.ARGB_8888, but this simply increases the back-and-forth-til-crash count from 6-7 to around 30. It's still accumulating memory for some unknown reason. Is there something other than recycle() that I can use, or some other system resource that would help?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24371569
tagged with: garbage-collection
tagged with: bitmap
type: Question
tagged with: java
tagged with: memory
accepted answer: http://stackoverflow.com/a/24371569
has title: OutOfMemoryException when going back and forth between activities, despite recycling all Bitmaps and collecting garbage
answer count: 1
score: 0

http://stackoverflow.com/q/24419449
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24419522
downvote count: 0
tagged with: java
duplicate of: http://stackoverflow.com/q/2598009
type: Question
score: 3
has body: Shortly I came across an oddity, I can't explain to myself. The real-world problem is already worked around, I'm just curious if there is an satisfying answer I didn't find. Imagine you have to write a class that implements the following interface from some framework you are using: interface Interface1 { String method(); } So far so good. Now you introduce a second framework and it would be rather useful if your class would implement a second interface: interface Interface2 { Long method(); } That's the point where the problem arises: class ThatsTheProblem implements Interface1, Interface2 { public ???? method() { // ... } } Any ideas? Just for your information: The real-world problem is based on an abstract-dao-pattern where some entities had Long ids, others had UUID ids.
has answer: http://stackoverflow.com/a/24419693
upvote count: 3
possible better answer: http://stackoverflow.com/a/24419522
linked to: http://stackoverflow.com/q/2598009
has comment: http://stackoverflow.com/comment/37779072
linked to: http://stackoverflow.com/q/2261954
has answer: http://stackoverflow.com/a/24419615
accepted answer: http://stackoverflow.com/a/24419615
has answer: http://stackoverflow.com/a/24419787
favorite count: 0
has comment: http://stackoverflow.com/comment/37779136
tagged with: interface
has title: How to implement contradictory interfaces
answer count: 4

http://stackoverflow.com/a/29282465
upvote count: 1
has body: Where would I store the session information? In the data store or would this take to long? And surely far to costly? If you enable Sessions on GAE it'll automatically store session info in the memcache and back it up in the datastore. What about the mem cache? I have only known of GAE for a few days and am still reading. Is the Mem cache considered to be fast/scalable and does it cost? The memcache queries have no cost, and are quite faster than datastore queries. The downside is that memecache is volatile and might be flushed at any time. That's why GAE backs up session info on the datastore as well. What is the best practice for scalability with sessions? Well there are many schools of thought on that, but ideally your app should be "stateless" in order to achieve maximum "scalability" on GAE, so you should be able to process each request without any additional information, but that's usually really hard to get. Having shared spaces between your instances (like memcahce/datastore/blobsotre) practically eliminate all issues related to having a "distributed and dynamic" setup, but philosophically you should attempt to achieve an app as stateless as possible.
answers question: http://stackoverflow.com/q/24349328
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/24388758
tagged with: cometd
score: 0
has title: Importing maven web project in eclipse giving red, *, ? error in .project, .classpath
has body: I have created a maven project following the guidelines of the website http://docs.cometd.org/tutorials/. It's working fine in CMD. Now, i have converted this project to eclipse web project using command: mvn eclipse:eclipse -Dwtpversion=2.0 when i am importing this project to eclipse juno, it's giving some error. In project facets i have checked dynamic web module. But still i'm getting this error.
answer count: 1
has answer: http://stackoverflow.com/a/24388885
has comment: http://stackoverflow.com/comment/37721189
tagged with: maven
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37721573
has comment: http://stackoverflow.com/comment/37729389
tagged with: java
accepted answer: http://stackoverflow.com/a/24388885
tagged with: eclipse
type: Question

http://stackoverflow.com/a/24342491
has comment: http://stackoverflow.com/comment/37632965
answers question: http://stackoverflow.com/q/24342434
upvote count: 2
type: Answer
has body: Because of this: The P element represents a paragraph. It cannot contain block-level elements (including P itself).
score: 2
downvote count: 0

disk-access
tag name: disk-access
tags question: http://stackoverflow.com/q/24426827
type: Tag

http://stackoverflow.com/comment/37543129
type: Comment
type: QuestionComment
has text: @GriffeyDog I can't because i'm using this program to parse other files which arnt CSVs as well.
comment on: http://stackoverflow.com/q/24294771
score: 0

http://stackoverflow.com/a/24422590
downvote count: 0
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24422298
has body: Both of them increase the variable i by one like i = i + 1; The difference is that : ++i increments the value first and then return it i++ return the value first and then increments it This behavior difference doesn’t matter in a for loop. If you want to know the difference try this : int x = 0; int y = x++; int x = 0; int y = ++x; Here x++ returns the value then increments it but ++x first increments the value then returns that value

http://stackoverflow.com/a/24308531
answers question: http://stackoverflow.com/q/24308474
has body: The way to do it for me is Dao (interface) and Dao.xml (mybatis stuff, which does the queries and the mapping)
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24308474

http://stackoverflow.com/q/24303341
tagged with: java
possible better answer: http://stackoverflow.com/a/24311011
linked to: http://stackoverflow.com/q/2422468
has answer: http://stackoverflow.com/a/24311011
type: Question
accepted answer: http://stackoverflow.com/a/24303491
has comment: http://stackoverflow.com/comment/37558856
tagged with: servlets
score: 0
answer count: 2
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/37559634
has body: I am uploading a file using HTML form to a Servlet. Generally, I want to upload XML file, but the validation is done on the server side. How can I get the content of the file as a string on the Servlet? This is my HTML form: Select XML file: This is my Servlet: public class LoadFromXML extends HttpServlet { private BlackJackWebService_Service service; private BlackJackWebService BlackJackWB; /** * Processes requests for both HTTP GET and POST * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { URL serverUrl = new URL("http://" + "localhost" + ":" + 8080 + "/bjapi/BlackJackWebService"); service = new BlackJackWebService_Service(serverUrl); BlackJackWB = service.getBlackJackWebServicePort(); String XMlFileContent = request.getParameter("xmlFile"); boolean isDuplicate = false; boolean isValid = true; try { BlackJackWB.createGameFromXML(XMlFileContent); } catch (DuplicateGameName_Exception ex) { isDuplicate = true; } catch (InvalidParameters_Exception ex) { isValid = false; } catch (InvalidXML_Exception ex) { isValid = false; } response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { /* TODO output your page here. You may use following sample code. */ out.println(" "); out.println(" "); out.println(" "); out.println(" BlackJack "); out.println(" "); out.println(" "); out.println(" "); if (isDuplicate == false && isValid == true) { out.println(" " + " Game created" + " "); } else if (isDuplicate == true) { out.println(" " + " Game already exist !" + " "); } else if (isValid == false) { out.println(" " + " Invalid XML !" + " "); } out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" ")…
has answer: http://stackoverflow.com/a/24303491
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has title: get file content as a string in Servlet

http://stackoverflow.com/a/46726049
has body: In mysql: BIGINT. In java: Long.
upvote count: 1
downvote count: 5
answers question: http://stackoverflow.com/q/24353778
score: -4
type: Answer

http://stackoverflow.com/q/24273079
has body: I'm trying to use a java regex to extract data. Its matching my data, but I can't get the group data. I'm trying to get the data 1, xmlAggregator, 268803451, 3. Looking at the docs, I assume that if I put() around \d+, and \w+, I get the numbers and strings inside the group. Any suggestions on how to change the regex? String: Span(trace_id:1, name:XmlAggregator, id:268803451, parent_id:3) Java code: String pattern="Span\\(trace_id:(\\d+), name:(\\w+), id:(\\d+), parent_id:(\\d+), (duration:(\\d+))*"; Pattern r = Pattern.compile(pattern); Matcher m = r.matcher(line); int count = 0; while(m.find()) { System.out.println("Match number "+count); System.out.println("start(): "+m.start()); System.out.println("end(): "+m.end()); System.out.println("Found value: " + m.group(count) ); count++; } Output: Match number 0 start(): 0 end(): 64 Found value: Span(trace_id:1, name:XmlAggregator, id:268803451, parent_id:3, Hoping to get: Found value: 1 Found value: XmlAggregator Found value: 268803451 Found value: 3
has answer: http://stackoverflow.com/a/24273201
has comment: http://stackoverflow.com/comment/37501842
tagged with: regex
possible better answer: http://stackoverflow.com/a/24273133
downvote count: 0
score: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37502070
has comment: http://stackoverflow.com/comment/37501817
tagged with: java
has comment: http://stackoverflow.com/comment/37501791
type: Question
has title: Getting regex data
has answer: http://stackoverflow.com/a/24273133
answer count: 2
accepted answer: http://stackoverflow.com/a/24273201
upvote count: 1
favorite count: 0

http://stackoverflow.com/comment/37681985
score: 0
type: Comment
type: QuestionComment
has text: I've tried creating a JBenchX test case and have run it several times with and without `this.keys[i] = 0` and am getting similar results. Tests with the statement enabled come in around 214ns, while tests without are 56ns. When disabling `this.keys[i] = 0` I'm replacing it with `this.values[i] = DELETED` (marker object) and the corresponding checks, yet somehow it's nearly four times faster.
comment on: http://stackoverflow.com/q/24355894

http://stackoverflow.com/q/24357354
answer count: 1
has comment: http://stackoverflow.com/comment/37690888
score: 1
has comment: http://stackoverflow.com/comment/37662217
has title: Can't import Apache HTTP in Eclipse
has comment: http://stackoverflow.com/comment/37662279
has answer: http://stackoverflow.com/a/24372840
upvote count: 1
has comment: http://stackoverflow.com/comment/37690959
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37665309
tagged with: java
has comment: http://stackoverflow.com/comment/37662951
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/24372840
tagged with: apache
has body: I'm using example code from the Apache documentation, shown here: final WebClient webClient = new WebClient(); // Get the first page final HtmlPage page1 = webClient.getPage("http://some_url"); // Get the form that we are dealing with and within that form, // find the submit button and the field that we want to change. final HtmlForm form = page1.getFormByName("myform"); final HtmlSubmitInput button = form.getInputByName("submitbutton"); final HtmlTextInput textField = form.getInputByName("userid"); // Change the value of the text field textField.setValueAttribute("root"); // Now submit the form by clicking the button and get back the second page. final HtmlPage page2 = button.click(); webClient.closeAllWindows(); I get errors from WebClient, HtmlPage, HtmlForm... basically, everything that should be imported from Apache, just isn't. I've followed a bunch of guides on the web directing me on hwo to add external jars to my build path, and as far as I can tell, everything is set-up correctly. I've tried Cleaning the project, restarting Eclipse, closing/opening the project, etc. Nothing seems to work. For reference, I downloaded the .JARs from this website: http://hc.apache.org/. My import statements: import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.HtmlForm; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput; import com.gargoylesoftware.htmlunit.html.HtmlTextInput; My error message: [2014-06-23 12:43:55 - CampusHappenings] Dx 1 error; aborting [2014-06-23 12:43:55 - CampusHappenings] Conversion to Dalvik format failed with error 1 The entirety of the stacktrace is much too long to copy, but it's something to do with the htmlunit JARs themselves, not with my code. They all look something like this: Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.xalan.lib.sql.SecuritySupport12$4) that doesn't come with an associated EnclosingMethod at…
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/37593339
type: AnswerComment
has text: Hey, added Java code, have a look. Maybe a problem with the `\`, but the code should work. :)
type: Comment
comment on: http://stackoverflow.com/a/24320737
score: 0

http://stackoverflow.com/comment/37707104
has text: Thank you so much... I'll try it and then compare it with your solution.
type: Comment
comment on: http://stackoverflow.com/a/24365201
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37633931
comment on: http://stackoverflow.com/a/24342940
score: 0
type: AnswerComment
type: Comment
has text: OK, I recon that since Eclipse gives initial value of 200 x 200 this might makes sense, so that getSize().width, getSize().height gets those values? Am I right about that one? And fill method (later) actually has something to fill, but if it is like background = new Rectangle2D.Float(); then size of rectangle is zero, so background is not filled, did I get it right? Of course, later on, applet is resized to Eclipse default 200x200 when method drawString (line 43) is invoked?

http://stackoverflow.com/comment/37574339
has text: Where is casting in your code?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24311534
score: 0

http://stackoverflow.com/a/24279352
answers question: http://stackoverflow.com/q/24278938
score: 0
has body: I've found it better to use wait() and notify() than yield. Check out this example (seen from a book)- class Q { int n; boolean valueSet = false; synchronized int get() { if(!valueSet) wait(); //handle InterruptedException // valueSet = false; notify();//if thread waiting in put, now notified } synchronized void put(int n) { if(valueSet) wait(); //handle InterruptedException // valueSet = true; //if thread in get waiting then that is resumed now notify(); } } or you could try using sleep() and join the threads in the end in main() but that isn't a foolproof way
type: Answer

http://stackoverflow.com/q/24387680
has comment: http://stackoverflow.com/comment/37719634
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37719380
has comment: http://stackoverflow.com/comment/37721209
has title: JPasswordField not working properly
tagged with: swing
has answer: http://stackoverflow.com/a/24396851
has comment: http://stackoverflow.com/comment/37721948
tagged with: jpasswordfield
tagged with: java
has comment: http://stackoverflow.com/comment/37719505
has comment: http://stackoverflow.com/comment/37719946
downvote count: 1
type: Question
has body: I don't know what's wrong with my code but the password does not turn into dots. Please help me. >.&lt; Here is my UI code: private final JPanel contentPanel = new JPanel(); public JPasswordField password_id; public JFormattedTextField user_ID; public JButton btnAccept; private JFormattedTextField previouslyFocusedTextBox = user_ID; public login(final JFrame parent, boolean modal) { super(parent, modal); setBounds(100, 100, 469, 428); getContentPane().setLayout(new BorderLayout()); final Toolkit toolkit = Toolkit.getDefaultToolkit(); final Dimension screenSize = toolkit.getScreenSize(); final int x = (screenSize.width - getWidth()) / 2; final int y = (screenSize.height - getHeight()) / 2; setLocation(x, y); setResizable(false); FlowLayout flow_2 = new FlowLayout(0,0,0); final JPanel panel_1 = new JPanel(); panel_1.setBackground(new Color(128, 0, 128)); panel_1.setPreferredSize(new Dimension(10, 90)); panel_1.setBounds(new Rectangle(0, 0, 100, 100)); panel_1.setBorder(new EmptyBorder(50, 90, 0, 0)); panel_1.setLayout(flow_2); header_Login.add(panel_1, BorderLayout.SOUTH); user_ID = new JFormattedTextField(); user_ID.setFocusTraversalKeysEnabled(true); user_ID.setFocusable(true); user_ID.addFocusListener(this); user_ID.setBounds(0, 0, 423, 45); panel_1.add(user_ID); user_ID.setMinimumSize(new Dimension(8, 32)); user_ID.setUI(new JTextFieldHintUI("Enter ID Here", Color.gray)); user_ID.setHorizontalAlignment(SwingConstants.LEFT); user_ID.setFont(new Font("Calibri", Font.BOLD, 35)); user_ID.setPreferredSize( new Dimension(10, 40) ); user_ID.setColumns(20); FlowLayout flow_3 = new FlowLayout(0,0,0); JPanel body_Login = new JPanel(); body_Login.setBackground(new Color(128, 0, 128)); body_Login.setBorder(new EmptyBorder(0, 0, 0, 0)); getContentPane().add(body_Login, BorderLayout.CENTER); body_Login.setLayout(flow_3); password_id = new JPasswordField (); password_id.setFocusTraversalKeysEnabled(true); password_id.setFocusable(true); password_id.addFocusListener(this); body_L…
linked to: http://stackoverflow.com/q/7229226
has comment: http://stackoverflow.com/comment/37719871
upvote count: 0
has comment: http://stackoverflow.com/comment/37721155
score: -1
has comment: http://stackoverflow.com/comment/37719123
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/37788656
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example).
type: QuestionComment
comment on: http://stackoverflow.com/q/24423922
type: Comment
score: 0

http://stackoverflow.com/comment/37637483
type: Comment
type: QuestionComment
score: 0
has text: http://stackoverflow.com/questions/2441501/reverse-each-word-of-hello-world-in-java
comment on: http://stackoverflow.com/q/24344692

http://stackoverflow.com/q/24395032
upvote count: 2
has title: Intellij does not build JavaFX with libraries
type: AnsweredQuestion
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/24403366
has body: I am developing a JavaFX application that has a lot of libs. If i run it inside intellij it works ok, but when i build the JavaFX application it only builds the .JAR of the project files, it doesn't even copy the libraries to the OUT folder. How can i solve this?
type: Question
accepted answer: http://stackoverflow.com/a/24403366
tagged with: intellij-idea
score: 2
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/37502321
type: QuestionComment
comment on: http://stackoverflow.com/q/24273260
has text: I think QR codes store either Strings or byte[]s. If you want to *encode* an int, how you do it is up to you. Or another way, you're saying there's not ```getMyComplexObject()``` method, but that's a higher layer than you're working with.
score: 0
type: Comment

http://stackoverflow.com/q/24267881
tagged with: arrays
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/24268363
possible better answer: http://stackoverflow.com/a/24268181
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24268181
score: 0
has body: I am trying to read specific elements within lines of an ArrayList. For example, an array list called Combinations of size 3 with the following lines is being produced by my code: Combinations = [0, 1] [0, 2] [1, 2] I would like to create a loop that will read each line of the array, each element of that line, and add strings to a new array depending on the values of that array line. What should I use in order to accomplish the following pseudocode in java? Pseudocode would be as follows For (int i = 0; i &lt; Combinations.size(); i++) If Combinations(Line i, First Element) = "0" Then NewArray(i).add("Vial1,") If Combinations(Line i, First Element) = "1" Then NewArray(i).add("Vial2,") If Combinations(Line i, First Element) = "2" Then NewArray(i).add("Vial3,") If Combinations(Line i, Second Element)= "0" Then NewArray(i).add(+"Vial1") If Combinations(Line i, Second Element)= "1" Then NewArray(i).add(+"Vial2") If Combinations(Line i, Second Element)= "2" Then NewArray(i).add(+"Vial3") The resulting ArrayList would then be: NewArray = [Vial1,Vial2] [Vial1,Vial3] [Vial2,Vial3] Below is the code which I am using to generate my Arraylist import java.util.*; import org.apache.commons.math3.util.CombinatoricsUtils; public class Combinations1 { public static void main (String[] args){ ArrayList&lt;Integer[]&gt; combinations = new ArrayList(); Iterator&lt;int[]&gt; iter = CombinatoricsUtils.combinationsIterator(3, 2); while (iter.hasNext()) { int[] resultint = iter.next(); Integer[] resultInteger = new Integer[2]; for (int i = 0; i &lt; 2; i++) { resultInteger[i] = Integer.valueOf(resultint[i]); } combinations.add(resultInteger); } for (int i = 0; i &lt; combinations.size(); i++) { System.out.println(Arrays.deepToString(combinations.get(i))); }}}
has title: Iteratively reading specific elements within an ArrayList
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/37491493
has comment: http://stackoverflow.com/comment/37491821
answer count: 2
has answer: http://stackoverflow.com/a/24268363

junit
type: Tag
tags question: http://stackoverflow.com/q/24288091
tags question: http://stackoverflow.com/q/24425336
tags question: http://stackoverflow.com/q/24370407
tags question: http://stackoverflow.com/q/24372198
tags question: http://stackoverflow.com/q/24391017
tags question: http://stackoverflow.com/q/24420209
tags question: http://stackoverflow.com/q/24279362
tags question: http://stackoverflow.com/q/24410936
tags question: http://stackoverflow.com/q/24307737
tags question: http://stackoverflow.com/q/24366204
tags question: http://stackoverflow.com/q/24303820
tags question: http://stackoverflow.com/q/24337671
tags question: http://stackoverflow.com/q/24411346
tags question: http://stackoverflow.com/q/24267191
tags question: http://stackoverflow.com/q/24393684
tag name: junit
tags question: http://stackoverflow.com/q/24387558
tags question: http://stackoverflow.com/q/24359062
tags question: http://stackoverflow.com/q/24274421
tags question: http://stackoverflow.com/q/24374599
tags question: http://stackoverflow.com/q/24268808
tags question: http://stackoverflow.com/q/24288941
tags question: http://stackoverflow.com/q/24396145
tags question: http://stackoverflow.com/q/24292225
tags question: http://stackoverflow.com/q/24312717
tags question: http://stackoverflow.com/q/24323176
tags question: http://stackoverflow.com/q/24388062
tags question: http://stackoverflow.com/q/24278315
tags question: http://stackoverflow.com/q/24379386
tags question: http://stackoverflow.com/q/24319697
tags question: http://stackoverflow.com/q/24364418
tags question: http://stackoverflow.com/q/24425354
tags question: http://stackoverflow.com/q/24331042
tags question: http://stackoverflow.com/q/24294277
tags question: http://stackoverflow.com/q/24380272
tags question: http://stackoverflow.com/q/24295197
tags question: http://stackoverflow.com/q/24323628
tags question: http://stackoverflow.com/q/24374941
tags question: http://stackoverflow.com/q/24271778
tags question: http://stackoverflow.com/q/24403304
tags question: http://stackoverflow.com/q/24283849
tags question: http://stackoverflow.com/q/24409120
tags question: http://stackoverflow.com/q/24396392
tags question: http://stackoverflow.com/q/24301683
tags question: http://stackoverflow.com/q/24371069
tags question: http://stackoverflow.com/q/24299965
tags question: http://stackoverflow.com/q/24289291

http://stackoverflow.com/comment/37592149
comment on: http://stackoverflow.com/q/24320607
type: Comment
type: QuestionComment
has text: Why are you trying to parse a language without a proper grammar and parser?
score: 1

http://stackoverflow.com/q/24387700
has comment: http://stackoverflow.com/comment/74897469
answer count: 3
has answer: http://stackoverflow.com/a/31438085
has title: Are ReadableByteChannel and WritableByteChannel a replacement of InputStream and OutputStream?
downvote count: 0
favorite count: 0
has body: As far as I know, ReadableByteChannel and WritableByteChannel from the nio package can be considered a replacement of InputStream and OutputStream from the legacy io package. If fact, they can be used to do the same I/O operations and more. Nevertheless, they still seem not much used. Also, their support in popular libraries is quite poor. For example, the Guava team is even thinking about dropping it. Is there any reason for new code dealing with I/O to use Streams with respect to Channels?
accepted answer: http://stackoverflow.com/a/25021328
tagged with: io
score: 4
possible better answer: http://stackoverflow.com/a/24387995
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24387995
tagged with: java
has comment: http://stackoverflow.com/comment/38911821
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/25021328
tagged with: nio

http://stackoverflow.com/comment/38023612
type: Comment
comment on: http://stackoverflow.com/a/24528586
type: AnswerComment
has text: Excellent, that was it! I should have checked used port, but would be nice if neo would let us know about used ports. Thanks!
score: 0

http://stackoverflow.com/a/24353813
has comment: http://stackoverflow.com/comment/37655443
type: Answer
has comment: http://stackoverflow.com/comment/104003029
has comment: http://stackoverflow.com/comment/37655640
score: 121
has body: Strings &amp; VARCHAR. Do not try storing phone numbers as actual numbers. it will ruin the formatting, remove preceding 0s and other undesirable things. You may, if you choose to, restrict user inputs to just numeric values but even in that case, keep your backing persisted data as characters/strings and not numbers. Be aware of the wider world and how their number lengths and formatting differ before you try to implement any sort of length restrictions, validations or masks (eg XXX-XXXX-XX). Non numeric characters can be valid in phone numbers. A prime example being + as a replacement for 00 at the start of an international number. Edited in from conversation in comments: It is one of the bigger UI mistakes that phone numbers have anything to do with numerics. It is much better to think of and treat them like addresses, it is closer to what they actually are and represent than phone "numbers".
has comment: http://stackoverflow.com/comment/37655509
downvote count: 1
has comment: http://stackoverflow.com/comment/37655390
has comment: http://stackoverflow.com/comment/91954738
answers question: http://stackoverflow.com/q/24353778
has comment: http://stackoverflow.com/comment/112153740
has comment: http://stackoverflow.com/comment/46201109
upvote count: 122
has comment: http://stackoverflow.com/comment/37655616

http://stackoverflow.com/comment/37511054
comment on: http://stackoverflow.com/a/24277980
has text: i dnt want to set a default value for the column. i cant understand where to put referencedColumnName, can u explain to me how should i put referencedColumnName?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37741265
score: 0
has text: You don't need to create a new variable because you already have it. `int[] numeric = new int[operator.length + 1];`. This also ensures correct behavior even if `numberOfOperators` returns a different value the second time that you call it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24396721

http://stackoverflow.com/a/35742293
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24314724
upvote count: 2
has body: As it is mentioned before, Ebean is sessionless ORM so you don't need to think about sessions. Hibernate has first level cache which is impossible to disable. It means that if you query item through ORM and then delete it directly with SQL, it stays in the cache. You can explicitly clear the cache to get the most updated results from database but unfortunately such behavior may bring errors like "detached entity passed to persist".
type: Answer

http://stackoverflow.com/comment/37784749
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24421358
score: 1
has text: How often do you call `runLater`?

sampling
tags question: http://stackoverflow.com/q/24417007
tag name: sampling
type: Tag

http://stackoverflow.com/q/24345018
tagged with: java
has title: JPA MantyToOne update implementation
downvote count: 1
accepted answer: http://stackoverflow.com/a/24345788
type: Question
tagged with: jpa
score: -1
tagged with: persistence
has answer: http://stackoverflow.com/a/24345788
answer count: 1
tagged with: toplink
favorite count: 0
has body: i want to ask how implement such thing like updating entity with @ManyToOne relationship. I have two tables Documents and DocType type like that Doucments @JoinColumn(name = "doctype", referencedColumnName = "document_id") @ManyToOne private DocType doctype; DocType @OneToMany(mappedBy = "doctype") private Collection&lt;Documents&gt; DocCollection; When user need update doctype he type value in combobox wich contain all doctypes names in string .Then I find doctype entity, where doctype name like value selected in combobox and then i set that doctype entity to documents entity. public void saveDoc() { entityManager.getTransaction().begin(); currentEntitydoc.setDocType(getDocTypeEntity(ComboBox.getSelectedValue())); entityManager.getTransaction().commit(); } Where getDocTypeEntity() like public DocType getDocTypeEntity ( String userInput) { query = manager.createQuery( "Select type from DocType type Where type.name=:arg1" ); query.setParameter("arg1" , userInput); List&lt;DocType&gt; list = query.getResultList(); if (list.size() &lt; 1 ) { System.out.println ("can't find such DocType name); } return list.get(0); } Seem that it is a very often task , how do u implement such things ? is there a better way do this in JPA ?
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/a/24379958
answers question: http://stackoverflow.com/q/24379132
has comment: http://stackoverflow.com/comment/37704495
has comment: http://stackoverflow.com/comment/37704636
upvote count: 1
type: Answer
downvote count: 0
has body: Your problem resides in your database operations, it has nothing to do with the technology you use to access the database. The only reason why a database deadlock appears is that in some transactions/operations you lock the resources in the opposite order. For example: Transaction 1: UPDATE table1 SET col=val WHERE id=1 DELETE FROM table2 WHERE id=2 Transaction 2: UPDATE table2 SET col=val WHERE id=2 UPDATE table1 SET col=val WHERE id=1 The first transaction acquires a lock to table1, row 1. Meanwhile the second transaction gets a lock to table2, row 2. Then, the first transaction wants to get the row 2 from table2, but cannot, because the second transaction already has it. So, tr1 has to wait. Similarly, tr2 has to wait, too, because it wants to get row 1 from table1, but tr1 holds it. So, they are waiting for each other, and only a timeout can release (and roll back) one of the transactions (the other one can run, if it has enough time remaining). The solution: You give priorities to your tables, and ALWAYS use them in that order (e.g. table1, table2 ). If your logic dictates that you need some data from table2 first, you can think on reversing the order OR put a lock on the smallest possible set of rows in table1 that will surely cover the rows involved in the final operation (it may be that you have to lock all rows in table1, or put a table-level lock instead). And yes, ALL operation, including GUI queries, background processes, reports, etc. MUST use the same order.
score: 1

http://stackoverflow.com/a/24429186
has comment: http://stackoverflow.com/comment/37796140
has comment: http://stackoverflow.com/comment/37796399
has body: I found the solution, it was because my filter was not @Transactionnal package filter; import java.io.IOException; 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 org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @Component //was missing @Transactional(propagation=Propagation.REQUIRED) //was missing public class AuthFilter implements Filter { @Override //no use so not implemented public void destroy() { //Ignore } @Override //no use so not implemented public void init(FilterConfig config) throws ServletException { //Ignore } @Override public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { if(((HttpServletRequest)req).getSession().getAttribute("userAccount")==null) { HttpServletResponse response=(HttpServletResponse)resp; response.sendRedirect(((HttpServletRequest)req).getContextPath()+"/index.html"); return; } chain.doFilter(req, resp); } }
answers question: http://stackoverflow.com/q/24426738
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37797357
has comment: http://stackoverflow.com/comment/37796614
has comment: http://stackoverflow.com/comment/37797175

http://stackoverflow.com/comment/37725051
comment on: http://stackoverflow.com/q/24390542
score: 0
has text: @pulp_fiction :-Your name has forced me to comment,it's probably because of not entering all values of the columns--your table shows you have kept 4 non-nullable columns!(BTW which part of pulp_fiction---butch,vincent,jules,wallace...)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24394111
has body: You can use the SimpMessagingTemplate. It's automatically registered. Just autowire it in any Spring bean you want. @Autowired private SimpMessagingTemplate template; ... this.template.convertAndSend("/topic/greetings", text);
type: Answer
answers question: http://stackoverflow.com/q/24393480
has comment: http://stackoverflow.com/comment/65182400
accepted answer of: http://stackoverflow.com/q/24393480
upvote count: 7
has comment: http://stackoverflow.com/comment/62758276
score: 7
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24388222
has answer: http://stackoverflow.com/a/24388237
has answer: http://stackoverflow.com/a/24388296
type: UnansweredQuestion
downvote count: 2
duplicate of: http://stackoverflow.com/q/3519664
tagged with: java
has comment: http://stackoverflow.com/comment/37720147
type: Question
answer count: 2
has title: difference between the keywords volatile and syncronized
upvote count: 0
score: -2
favorite count: 0
has comment: http://stackoverflow.com/comment/37720084
has body: In which situation can volatile replace synchronized?Also how can the write operations on double and long become atomic after declaring them as volatile

http://stackoverflow.com/comment/37782901
score: 0
type: AnswerComment
type: Comment
has text: so you mean that i should call the LF method by : Tx_Customize.LF();
comment on: http://stackoverflow.com/a/24421468

http://stackoverflow.com/comment/37590492
type: Comment
type: QuestionComment
has text: @manish, Yes i saw, but how it is happening , is there any order of flow or NOT.
comment on: http://stackoverflow.com/q/24319997
score: 0

http://stackoverflow.com/q/24275666
has title: The libs.CopyLibs.classpath property is not set in Netbeans 8.0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26131899
score: 2
tagged with: netbeans
upvote count: 2
tagged with: java
has body: My Java EE project was running normally in NetBeans 8.0 and Glassfish 4.0. After rebooting my notebook, I started the server, the IDE and then tried to run the project again. I got a "The libs.CopyLibs.classpath property is not set" message and googled to find a solution. Many answers talk about Tools > Options > Miscellaneous > Ant. But my NetBeans does not have an Ant tab in Miscellaneous, but in Java. I don't know if there is any difference, I am new on this. Even adding the property "libs.CopyLibs.classpath=/java/ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar" on Java > Ant the project don't build. By adding this many other errors appear.
type: Question
has answer: http://stackoverflow.com/a/56896039
tagged with: ant
answer count: 2
downvote count: 0

http://stackoverflow.com/a/24278867
has comment: http://stackoverflow.com/comment/37529211
upvote count: 2
has body: See below code snippet public class Test { public static void main(String[] args) { Test test = new Test(); check(test.getClass()); } public static void check(Class&lt;?&gt; a){ System.out.println(a); } }
type: Answer
has comment: http://stackoverflow.com/comment/37541818
score: 2
has comment: http://stackoverflow.com/comment/37550284
answers question: http://stackoverflow.com/q/24277644
downvote count: 0

http://stackoverflow.com/q/24303168
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24307249
accepted answer: http://stackoverflow.com/a/24307249
linked to: http://stackoverflow.com/q/7425071
has body: I have a string like *this is text1 * this is text2 *this is text3 I want the output by spliting the text using * in my pdf like this is text1 this is text2 this is text3 my text coming in @value of xslt like &lt;fo:block linefeed-treatment="preserve" &gt; &lt;xsl:value-of select="@key"/&gt; &lt;/fo:block&gt; &lt;fo:block linefeed-treatment="preserve" &gt; &lt;xsl:value-of select="@value"/&gt; &lt;/fo:block&gt; &lt;fo:block linefeed-treatment="preserve" &gt; &lt;xsl:text&gt;&amp;#xA;&lt;/xsl:text&gt; &lt;/fo:block&gt; &lt;/fo:block&gt; How can I split the string produce the output. Please suggest. I'm using xsl 1.0
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/37566116
tagged with: xslt
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37559040
has title: How to split and break string in new line in XSLT

http://stackoverflow.com/comment/37917246
type: Comment
comment on: http://stackoverflow.com/a/24412523
type: AnswerComment
has text: Welcome to the wonderful world of WTP and deploying Java apps to web servers. Does the Jetty Maven Plugin work?
score: 0

database-connection
tags question: http://stackoverflow.com/q/24270650
type: Tag
tag name: database-connection

fractions
type: Tag
tags question: http://stackoverflow.com/q/24267998
tag name: fractions

http://stackoverflow.com/q/24303544
score: 1
tagged with: java
has body: Hey i am a php developer and this is my first go with jsp. Now i retrieved a Json string from my class and converted it into GSON. I display a field in my result.jsp for eg:- ID and on clicking the id it should go to details.jsp and show more info about that ID Currently my result.jsp is as follows:- <% String json = (String)request.getAttribute("jsonstring"); Gson gson = new Gson(); ConCom diff = new ConCom(); diff = gson.fromJson(json, ConCom.class); List<ComparisonResultDTOarr> ls = diff.getComparisonResultDTOarr(); for(int i = 0;i<ls.size();i++) { List<AuditItemLogsDTOArr> lsinner = ls.get(i).getAuditItemLogsDTOArr(); %> <%out.println(lsinner.get(0).getKeyAsString());%><% } %> I read around SO and googled it and understood that that i could make a hidden form. Now I create a form with the following two fields and using the anchor tag i submit the form. But the values in the form need to be posted according to the ID clicked, how can i make that dynamic? So if my form is as follows:- First name: Last name: And my details.jsp will be like:- <%= request.getParameter("firstname") %> <%= request.getParameter("phone") %> I want the firstname and phone to be set according to the ID clicked and the form to be submitted. I can obtain the String/Integer value from my diff object in this page. Would i need to use JQuery? Any help? Also i know i should be using JSTL. And i will get to that soon. Thank you.
possible better answer: http://stackoverflow.com/a/24304224
type: Question
has answer: http://stackoverflow.com/a/24304224
downvote count: 0
tagged with: jsp
tagged with: javascript
tagged with: jquery
accepted answer: http://stackoverflow.com/a/24304221
has answer: http://stackoverflow.com/a/24303845
has title: Pass data from one jsp to another and display that jsp view
answer count: 3
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/24304221
type: AnsweredQuestion

http://stackoverflow.com/a/24397952
downvote count: 0
has body: When you invoke Company.class.getResource("input.txt") You are using the relative resource name, which is treated relative to the class's package. So, are you sure there is a file called input.txt at the same level of package SimpleJavaAssignment? You could alternatively just specify the absolute path of the file and pass that into the File constructor, as such: File file = new File("/my/path/input.txt");
answers question: http://stackoverflow.com/q/24397906
score: 4
type: Answer
upvote count: 4

http://stackoverflow.com/comment/37658891
has text: If you look at the error, you can see that the client says that it receives a response with status code 500 from the server. This means that the client can connect to the server. It is just that the server encounters an unexpected error while processing the request. Now, change `FormDataBodyPart("content", MediaType.MULTIPART_FORM_DATA);` to `FormDataBodyPart("file", "contentOfTheFile", MediaType.TEXT_PLAIN);`
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24355020

http://stackoverflow.com/a/24327146
answers question: http://stackoverflow.com/q/24327009
has comment: http://stackoverflow.com/comment/37702919
accepted answer of: http://stackoverflow.com/q/24327009
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/37666787
type: Answer
has comment: http://stackoverflow.com/comment/37667081
has body: In your code, at some point you must have: FragmentManager fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.framelayout, new SomeXYZFragment(), "some_xyz_fragment"); ft.commit(); Add the line: fm.executePendingTransactions(); after the line ft.commit(); Try this. It should work.

http://stackoverflow.com/q/24401635
upvote count: 8
has answer: http://stackoverflow.com/a/24401868
possible better answer: http://stackoverflow.com/a/24401933
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24401933
linked to: http://stackoverflow.com/q/23806471
tagged with: java
tagged with: h2
type: Question
has comment: http://stackoverflow.com/comment/37745541
has comment: http://stackoverflow.com/comment/37745573
has body: I created a H2 database with my code with this URL: jdbc:h2:C:/data/fixed.db My code can create tables, perform queries. If I open the file manually, I can successfully see its content and view the create queries etc However, when I try to use H2 console with the web interface, I can't see the database. Instead, the web console create another empty database located here C:/data/fixed.db.mv.db. I just can't load my database. What am I missing ? EDIT My code uses H2 1.3.175 The web console H2 1.4.178
accepted answer: http://stackoverflow.com/a/24401868
has title: Can't see my H2 database in Web Console
answer count: 2
downvote count: 0
favorite count: 0
score: 8

http://stackoverflow.com/comment/37672973
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24336478
has text: See my comment on the issue.

http://stackoverflow.com/q/24282441
linked to: http://stackoverflow.com/q/8560559
tagged with: scheduler
possible better answer: http://stackoverflow.com/a/31479434
has body: How to check if scheduled Quartz cron job is running or not? Is there any API to do the checking?
has title: How to check whether Quartz cron job is running?
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/24282580
tagged with: cron
upvote count: 18
type: AnsweredQuestion
tagged with: job-scheduling
downvote count: 0
tagged with: quartz-scheduler
type: Question
has answer: http://stackoverflow.com/a/27395623
accepted answer: http://stackoverflow.com/a/27395623
has comment: http://stackoverflow.com/comment/89581717
has answer: http://stackoverflow.com/a/31479434
tagged with: java
score: 18

http://stackoverflow.com/comment/37622674
type: Comment
has text: Just to clarify: The user is moving the mouse while at the same time a background thread (or another user??) is moving (hijacking) the mouse as well?
comment on: http://stackoverflow.com/q/24336694
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37773921
type: AnswerComment
has text: This is the right basic idea. To avoid having a call to `containsKey` _and_ a call to `get`, it's probably better just to call `get`, then check whether the result is null.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24416170

http://stackoverflow.com/q/24389505
has comment: http://stackoverflow.com/comment/37722445
upvote count: 3
tagged with: java
tagged with: hibernate
tagged with: spring-data
type: Question
has comment: http://stackoverflow.com/comment/37723245
has title: Spring error Cannot convert value of type [java.lang.String] to required type - Nomatching editors or conversion strategy found
has body: Any ideas what is causing this error? I have been reading around and i think that it is to do with how i have declared the object that is failing (i.e. it has to be declared as an interface) but i dont think i am understanding exactly what is happening. Could someone please provide a clear explanation of what causes the error and how i can resolve it. Thanks in advance 2014-06-23 16:43:12,905 [main] ERROR com.abc.Author.loader.service.duplicate.myProdDuplicateAuthorService - JDUPLICATE - Error processing 198587 Author. org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'com.abc.Author.loader.model.myProdDuplicate' for property 'myProdDuplicate'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [com.abc.Author.loader.model.myProdDuplicate] for property 'myProdDuplicate': no matching editors or conversion strategy found at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:463) at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:494) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1097) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:882) at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation$DirectFieldAccessFallbackBeanWrapper.setPropertyValue(JpaMetamodelEntityInformation.java:290) at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation$IdentifierDerivingDirectFieldAccessFallbackBeanWrapper.setPropertyValue(JpaMetamodelEntityInformation.java:333) at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.getId(JpaMetamodelEntityInformation.java:123) at org.springframework.data.repository.core.support.AbstractEntityInformation.isNew(AbstractEntityInformation.java:51) at org.springframework.data.jpa.repository.su…
favorite count: 0
score: 2
answer count: 0
type: UnansweredQuestion
tagged with: spring
downvote count: 1
has comment: http://stackoverflow.com/comment/37767892

http://stackoverflow.com/q/24339414
has comment: http://stackoverflow.com/comment/37627497
has answer: http://stackoverflow.com/a/24339622
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37627104
has answer: http://stackoverflow.com/a/24339533
type: Question
has title: Java persistence api don't want to create entities
has answer: http://stackoverflow.com/a/24339527
accepted answer: http://stackoverflow.com/a/24339527
possible better answer: http://stackoverflow.com/a/24339533
has comment: http://stackoverflow.com/comment/37627592
tagged with: java
score: 0
answer count: 3
has body: Is there any way to use JPA just for insert, update, delete and select but not to change tables? I have made a reverse engineering and made java classes from database tables... In this class I have @Entity and @Id annotations, but I don't need to create entities or fields in the database. I have a finished database schema and there is a DB Admin who is responsible for all tables and fields. Is there any way to do this?
tagged with: jpa

http://stackoverflow.com/comment/37627521
type: QuestionComment
has text: The XML output you posted doesn't have ${colour} in it - split or otherwise - which suggests it isn't in the input. Unzip the input docx, and look at its document.xml. Or add System.out.println(documentPart.getXML()) before you do variableReplace.
comment on: http://stackoverflow.com/q/24335121
type: Comment
score: 0

http://stackoverflow.com/comment/37593848
score: 0
type: Comment
has text: I have just edited my question by adding a picture of file path
comment on: http://stackoverflow.com/a/24313572
type: AnswerComment

http://stackoverflow.com/comment/37511524
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24273678
has text: Thanks for the reply and the help. I already made ​​the connection to the database. And also got an out to do the graphics I saw this video: youtube.com/watch?v=z0fLprufs0o However only appears me a line and if you do a search within one week, just asks me one result per day, and not the right number should appear. Needed so that someone could help me do things correctly. Is it possible?
score: 0

ksoap2
type: Tag
tags question: http://stackoverflow.com/q/24342333
tags question: http://stackoverflow.com/q/24364392
tag name: ksoap2

http://stackoverflow.com/q/24344356
has title: try to get float or integer values stored in session
tagged with: session
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37637180
tagged with: jsp
accepted answer: http://stackoverflow.com/a/24344398
type: Question
has comment: http://stackoverflow.com/comment/37636570
answer count: 1
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37636595
has answer: http://stackoverflow.com/a/24344398
has body: I have stored in two different attribute two integer value session.setAttribute("passengers", new Integer(passengers)) session.setAttribute("luggages", new Integer(luggages)); but when I try to get them in a next request through Integer passengers = (Integer) session.getAttribute("passengers") Integer luggages = (Integer) session.getAttribute("luggages"); I get java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
has comment: http://stackoverflow.com/comment/37636572
has comment: http://stackoverflow.com/comment/37636576

http://stackoverflow.com/a/24290285
has comment: http://stackoverflow.com/comment/37534722
has body: The problem is that Spring-Boot does not seem to play nice with the tomcat-plugin (A response that can get it working will steal the star!). As noted above you can reduce to just using the spring-boot... buildscript { repositories { mavenLocal() mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.1.RELEASE") } } apply plugin: 'war' apply plugin: 'spring-boot' war { baseName='itext' } repositories { mavenLocal() mavenCentral() } dependencies { compile("org.springframework.boot:spring-boot-starter-web") providedRuntime("org.springframework.boot:spring-boot-starter-tomcat") testCompile("org.springframework.boot:spring-boot-starter-test") } If you do this, however, you will also need to change the Application.java to something like this.... package com.gleason.itext; import java.util.Arrays; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.web.SpringBootServletInitializer; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.web.bind.annotation.PathVariable; @Configuration @ComponentScan @EnableAutoConfiguration public class Application extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(applicationClass, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(applicationClass); } private static Class&lt;Application&gt; applicationClass = Application.class; }
score: 0
has comment: http://stackoverflow.com/comment/37534828
has comment: http://stackoverflow.com/comment/37534586
has comment: http://stackoverflow.com/comment/37534342
has comment: http://stackoverflow.com/comment/37534927
has comment: http://stackoverflow.com/comment/37534984
has comment: http://stackoverflow.com/comment/37534872
type: Answer
has comment: http://stackoverflow.com/comment/37534807
answers question: http://stackoverflow.com/q/24289334

http://stackoverflow.com/a/24377175
score: 2
upvote count: 3
has body: SBT cache issue. I ran activator clean and everything worked. I started pasting entire files from the GitHub repo to see if I could narrow it down. That led to a new set of errors which brought me to this StackOverflow question which had the SBT cache suggestion in the thread. I appreciate the suggestion and link to the error methods, LimbSoup. Will definitely be looking into those regardless and am sure I'll probably reference your answer in the future more than once! Thanks so much, all.
answers question: http://stackoverflow.com/q/24367879
downvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24367879
type: Answer

http://stackoverflow.com/comment/37545644
comment on: http://stackoverflow.com/a/24296132
has text: Adding MyType to the definition will make it work only with MyType. You have to make the value be something that extends enum: <K extends Enum<K>>
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/24407943
score: 0
tagged with: colors
tagged with: android
has title: add colors to paint-app in android?
has answer: http://stackoverflow.com/a/24409826
tagged with: http://stackoverflow.com/tag/xml
tagged with: paint
type: UnansweredQuestion
tagged with: java
has body: i have a little problem with eclipse/android. i am trying to mak my own paint-app in android. my problem is i can only paint with one color(black) , now i want to add 3 more colors(red,green,blue). im still a newbie to android developing, and i dont know how i can add that option. anyone has any suggestions? here is my code so far -SingleTouchEventView package nl.hr.teken0; import android.app.Activity; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; public class SingleTouchActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(new SingleTouchEventView(this, null)); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.main_fragment, container, false); return rootView; } } } SingleTouchActivity package nl.hr.teken0; import android.app.Activity; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; public class SingleTouchActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(new SingleTou…
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/37757642

http://stackoverflow.com/q/24372142
has answer: http://stackoverflow.com/a/24372270
favorite count: 0
type: AnsweredQuestion
upvote count: 3
accepted answer: http://stackoverflow.com/a/24372270
has body: First of all, I'm dealing with graphs more than 1000 edges and I'm traversing adjacency lists, as well as vertices more than 100 times per second. Therefore, I really need an efficient implementation that fits my goals. My vertices are integers and my edges are undirected, weighted. I've seen this code. However, it models the adjacency lists using edge objects. Which means I have to spend O(|adj|) of time when I'd like to get the adjacents of a vertex, where |adj| is the cardinality of its adjacents. On the other hand, I'm considering to model my adjacency lists using Map&lt;Integer, Double&gt;[] adj. By using this method, I would just use adj[v], v being the vertex, and get the adjacents of the vertex to iterate over. The other method requires something like: public Set&lt;Integer&gt; adj(int v) { Set&lt;Integer&gt; adjacents = new HashSet&lt;&gt;(); for(Edge e: adj[v]) adjacents.add(e.other(v)); return adjacents; } My goals are: I want to sort a subset of vertices by their connectivities (number of adjacents) any time I want. Also, I need to sort the adjacents of a vertex, by the weights of the edges that connect itself and its neighbors. I want to do these without using so much space that slows down the operations. Should I consider using an adjacency matrix?
downvote count: 1
type: Question
tagged with: graph
tagged with: algorithm
tagged with: java
has title: Best Way to Implement an Edge Weighted Graph in Java
score: 2
answer count: 1

http://stackoverflow.com/a/24371724
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24369886
score: 1
answers question: http://stackoverflow.com/q/24369886
type: AcceptedAnswer
has body: If you are executing your Java test class using the java Ant task, you can pass the environment URL as a system property via the sysproperty nested element: &lt;java dir="${testdir}" classname="MainClass"&gt; &lt;sysproperty key="env.url" value="${env.url}"&gt;&lt;/sysproperty&gt; ... &lt;/java&gt; You can access the value of the system property in your constructor like this: url = Configuration.setEnvironment(System.getProperty("env.url")); The ${env.url} Ant property can be fetched either from some configuration file that exists in the environment as another user mentioned in his comment, or it can be passed explicitly to your Ant buildfile when you want to run it: ant -f build.xml -Denv.url=DEV
upvote count: 1

http://stackoverflow.com/a/24323617
downvote count: 0
has comment: http://stackoverflow.com/comment/37597186
has body: You can put the System.out.print("Do you want to add a new name (Y/N)"); on the beginning of the while loop, something like this : import java.util.Scanner; public class SOF { public static void main(String test[]){ @SuppressWarnings("resource") Scanner scanner = new Scanner (System.in); int AddName = 0; while (AddName &lt; 3) { System.out.print("Do you want to add a new name (Y/N)"); String newname = scanner.next(); if (newname.equalsIgnoreCase("y")) { System.out.println("Enter first name: "); String fname = scanner.next(); System.out.println("Enter last name: "); String lname = scanner.next(); AddName = AddName + 1; } else if (newname.equalsIgnoreCase("n")) { System.out.println("Goodbye"); AddName = AddName + 3; //alternatively you can use break statement. } } } }
upvote count: 2
answers question: http://stackoverflow.com/q/24323516
type: Answer
score: 2

http://stackoverflow.com/a/24338918
type: Answer
has body: First, pay attention to this form: PairJ&lt;Car&gt; twoCars = new PairJ(new Car(), new Car()); You're getting a compiler warning in which you're doing an unchecked assignment from PairJ to PairJ&lt;Car&gt;. You may run into gotchas with this later. You can avoid this by providing the generic type, or letting Java (7.0+) infer it for you with the diamond operator. PairJ&lt;Car&gt; twoCars = new PairJ&lt;Car&gt;(new Car(), new Car()); // or PairJ&lt;Car&gt; twoCars = new PairJ&lt;&gt;(new Car(), new Car()); The first problem is here: public &lt;R&gt; PairJ&lt;R&gt; replaceFirst(R newFirst) { return new PairJ(newFirst, second()); } You're getting another unchecked assignment here, but this one is worse - you're actively changing the type of one of your parameters to something completely different. The reason that this is not possible is due to the way your generic type is bound to your class. You explicitly state that, in your constructor, you expect two arguments bound to some generic type T. What you're doing here is binding only one to R. If you were to "fix" the issue by doing type inference as described above, you'd get a compilation failure (which is good - you want these to fail at compile time as opposed to run time). public &lt;R&gt; PairJ&lt;R&gt; replaceFirst(R newFirst) { return new PairJ&lt;R&gt;(newFirst, second()); } The above fails due to it requiring parameters bound to R, R, not R, T. The second problem is here: class Vehicle {} class Car extends Vehicle {} class Tank extends Vehicle {} Your hierarchy mandates that, while a Car is a Vehicle, and a Tank is a Vehicle, a Car is not a Tank. So the ClassCastException is appropriate; you really can't cast a Car to a Tank. This would fail since they're not convertible between the two. Tank actuallyACar = twoCars.replaceFirst(new Tank()).second(); There's a solution here; if you want to keep this API, then you'll need two type parameters for your class. This means that you can now pass in a new type R freely …
answers question: http://stackoverflow.com/q/24338511
has comment: http://stackoverflow.com/comment/37628111
score: 0

http://stackoverflow.com/comment/37728433
comment on: http://stackoverflow.com/q/24392555
type: Comment
type: QuestionComment
has text: The code isn't "returning an exception" - you've got a compile-time error. It's important to understand the difference between compile-time errors and exceptions (which are thrown at execution time by code which compiled...)
score: 5

http://stackoverflow.com/comment/131482312
score: 0
type: Comment
comment on: http://stackoverflow.com/a/65957215
type: AnswerComment
has text: Sdk is the only answer worked for me. However, java 8.0.322-tem is no longer there. I have to use `sdk install java 8.0.352.fx-librca`

http://stackoverflow.com/comment/37766354
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24365426
has text: I think you would have to implement that logic for listening on file system changes yourself.
score: 0

http://stackoverflow.com/q/24290072
tagged with: java
tagged with: javafx
type: Question
has comment: http://stackoverflow.com/comment/37534500
tagged with: treetableview
has answer: http://stackoverflow.com/a/24308020
has comment: http://stackoverflow.com/comment/37564321
has comment: http://stackoverflow.com/comment/37564740
answer count: 1
downvote count: 0
has body: Following workflow is intended: User clicks a Button -> At the selected TreeItem a new TreeItem should be created. The selected TreeItem should get expanded and the new TreeItem should be displayed and entering in editing-mode, as displayed in the following screenshot: Unfortunatly the editing-mode seems to be canceled immediately in 99%, just in really rare cases the cell is staying in editing-mode. I tried implementing my own CellFactories and Editable-Cells, but for this usecase I always end up in the same situation. Anyone knows what I am doing wrong here? I created a small example to demonstrate the case. /** * Small Example for EditableState not initialized Case. * * @author mst */ public class TreeTableViewCreateExpandAndEditMain extends Application { @Override public void start( final Stage primaryStage ) { TreeItem&lt;Item&gt; root = new TreeItem&lt;&gt;( new Item( 1, "Root" ) ); TreeItem&lt;Item&gt; item1 = new TreeItem&lt;&gt;( new Item( 2, "Item1" ) ); TreeItem&lt;Item&gt; item11 = new TreeItem&lt;&gt;( new Item( 3, "Item11" ) ); TreeItem&lt;Item&gt; item2 = new TreeItem&lt;&gt;( new Item( 4, "Item2" ) ); TreeItem&lt;Item&gt; item3 = new TreeItem&lt;&gt;( new Item( 5, "Item3" ) ); TreeItem&lt;Item&gt; item31 = new TreeItem&lt;&gt;( new Item( 6, "Item31" ) ); root.getChildren().add( item1 ); item1.getChildren().add( item11 ); root.getChildren().add( item2 ); root.getChildren().add( item3 ); item3.getChildren().add( item31 ); TreeTableColumn&lt;Item, Integer&gt; columnId = new TreeTableColumn&lt;&gt;( "ColumnId" ); TreeTableColumn&lt;Item, String&gt; columnName = new TreeTableColumn&lt;&gt;( "ColumnName" ); columnId.setCellValueFactory( new TreeItemPropertyValueFactory&lt;Item, Integer&gt;( "id" ) ); columnName.setCellValueFactory( new TreeItemPropertyValueFactory&lt;Item, String&gt;( "name" ) ); columnName.setCellFactory( TextFieldTreeTableCell.forTreeTableColumn() ); columnName.setOnEditCommit( new EventHandler&lt;CellEditEvent&lt;Item, String&gt;&gt;() …
has title: Why JavaFX TreeTableView edit-mode gets undesirably canceled?
favorite count: 0
accepted answer: http://stackoverflow.com/a/24308020
upvote count: 2
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37554190

http://stackoverflow.com/a/24267803
has body: You could either pass the string as is : preparedStatement.setString(1, "4538762") ; or convert it to int and pass the int : preparedStatement.setInt(1, Integer.parseInt("4538762")) ; MySQL can handle both. In the former case, it would parse the String to int by itself.
type: Answer
answers question: http://stackoverflow.com/q/24267453
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/24267453
has comment: http://stackoverflow.com/comment/37491313
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37491189

http://stackoverflow.com/a/24505256
score: 0
has body: I was using GWT, and before you use the function you need to reveal the function as described in this link under the Creating JavaScript libraries with GWT section You'll basically need to "publish" the function as follows: $wnd.publishedFuncName = @pakage.class::realfuctionName(D); the D stands for double as an input parameter, a fuller list of how to refer to variables can be found here After doing that you can run the function as if you run it from the console, no window.fuction needed. And also, I had to change the type of retval to be Object, and then used the toString function.
type: Answer
answers question: http://stackoverflow.com/q/24425723

http://stackoverflow.com/a/26341283
score: 3
answers question: http://stackoverflow.com/q/24423092
has body: I've encountered the same problem today. At first, I was using only priority for my tests, but then I needed to add dependsOnMethods as well. Initially i've added the dependsOnMethods only to some of my @Test methods. As a result the execution order of my tests has scrambled. I've read a lot of articles and discussions related to this topic and it turned out, that the using of priority and dependsOnMethods attributes togeter brings a lot of uncertainty into the whole picture and the behaviour of TestNG will never be predictable and well defined in this situation. My solution was to add the dependsOnMethods to ALL of my test methods, while I kept the priority also for ALL of the mehtods. Now their execution order is back to normal and at the same time I benefit from the capabilities of the dependsOnMethods. i.e. The first failing test method in the chain, causes all subsequent test methods to be skipped and show correct in the reports. Here is fragment from my tests class: @Test(priority = 2, dependsOnMethods= {"Meganav_Point_C1_and_Click_C3"}) public void Click_product_in_Category_result_page() throws Throwable { Grid.clickProduct(1, 1); } @Test(priority = 3, dependsOnMethods= {"Click_product_in_Category_result_page"}) public void PDP_setQty() throws Throwable { ProductDetailsPage.setQty(2); } @Test(priority = 4, dependsOnMethods= {"PDP_setQty"}, alwaysRun= true) public void PDP_click_Add_To_Basket() throws Throwable { ProductDetailsPage.addToBasket(); } Hope this helps. Regards, Veselin Petrov
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/41368931
downvote count: 0
has comment: http://stackoverflow.com/comment/66781233

http://stackoverflow.com/q/24385942
type: AnsweredQuestion
tagged with: activemq-classic
tagged with: java
accepted answer: http://stackoverflow.com/a/24388325
upvote count: 1
has title: Get list of queue names in ActiveMQ
has answer: http://stackoverflow.com/a/67183416
type: Question
possible better answer: http://stackoverflow.com/a/52119427
has answer: http://stackoverflow.com/a/52119427
has comment: http://stackoverflow.com/comment/37715737
answer count: 3
downvote count: 0
score: 1
favorite count: 0
has body: I have tried below code to get list of queues in ActiveMQ. But its not working. I have 4 queues in my ActiveMQ. try { ActiveMQConnection.makeConnection(URL).start(); Set&lt;ActiveMQQueue&gt; allque= ActiveMQConnection.makeConnection().getDestinationSource().getQueues(); Iterator&lt;ActiveMQQueue&gt; itr= allque.iterator(); while(itr.hasNext()){ ActiveMQQueue q= itr.next(); System.out.println(q.getQueueName()); } } catch (Exception e) { e.printStackTrace(); } Please let me know any correction in my code or some new code get it done.
has comment: http://stackoverflow.com/comment/37716479
has answer: http://stackoverflow.com/a/24388325

http://stackoverflow.com/comment/37727152
has text: Do I need to pass the whole script to eval? Isnt there a method to just execute a .m file?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24384931

http://stackoverflow.com/a/24332067
answers question: http://stackoverflow.com/q/24331923
type: Answer
upvote count: 0
score: -1
downvote count: 1
has body: the variable "rect" won't be extended over. "extends" means you are making that class as a parent class. So the block class will inherit all the functionality the parent class contains. So block will get all methods and you can override methods as well. Since rect is a private variable that will not be seen by the block class unless you make it public. Extends basically allows the class to inherit attributes, methods and properties of the parent class but not private variables. Hope that helps.

http://stackoverflow.com/comment/37783301
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24421822
has text: is `b=a` the next line of code? Or are you saying that `b` is already equal to `a` before the first line runs?

http://stackoverflow.com/a/24362234
type: Answer
has body: @Autowired public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } Modify your HistoryDAOImpl class to have above method.It should work.
answers question: http://stackoverflow.com/q/24362044
score: 0

http://stackoverflow.com/comment/37629214
has text: You could just disable the JButton, and enable it when you want it to be active.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24337311
score: 1

http://stackoverflow.com/a/24428614
accepted answer of: http://stackoverflow.com/q/24427219
answers question: http://stackoverflow.com/q/24427219
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37798695
has body: I highly doubt that the create method is invoked on each query (for starters performance issues come to mind). I would take the safe route and create a Tokenizer that wraps a StandardTokenizer, then just override the setReader method and do my work there

http://stackoverflow.com/q/24363149
has comment: http://stackoverflow.com/comment/37672909
has title: Nooby Java programmer confused at output (Constructors)
tagged with: input
possible better answer: http://stackoverflow.com/a/24363215
has answer: http://stackoverflow.com/a/24363239
has comment: http://stackoverflow.com/comment/37673124
has comment: http://stackoverflow.com/comment/37672988
upvote count: 2
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37673005
tagged with: java
has body: I am a fairly new Java programmer and I am currently following an online tutorial to improve my skills. I found the following code example on the tutorial which all looks like it should run however I am getting a number of errors when I run the code in Eclipse. This is my first program using cases however I am pretty sure I have the correct syntax maybe somebody can point out my error? Also I was surprised that the compiler complains about the line "System.out.println ("Are you sure (y - yes, n - no)?");" I am getting errors on lines 3,4,7,8,10,11,15. Please can somebody tell me why my program will not run? class Certainty { System.out.println ("Are you sure (y - yes, n - no)?"); int ch = System.in.read (); switch (ch) { case 'Y': case 'y': System.out.println ("I am sure."); break; case 'N': case 'n': System.out.println ("I am not sure."); break; Default : System.out.println ("Incorrect choice."); } } /* Thank you for all of the helpful responses I'm slowly starting to get my head around Java and I'm really enjoying it and loving how quickly my question was answered you guys are awsome.**/
accepted answer: http://stackoverflow.com/a/24363239
has comment: http://stackoverflow.com/comment/37673162
tagged with: switch-statement
type: Question
has comment: http://stackoverflow.com/comment/37672923
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/24363215
favorite count: 0

http://stackoverflow.com/comment/37753911
type: Comment
type: QuestionComment
has text: I would guess OP's problem is the mechanics of making new nodes and splicing them in to the tree is non-obvious (and he claims non-documented).
comment on: http://stackoverflow.com/q/24403892
score: 0

http://stackoverflow.com/comment/37742259
has text: @DavidWallace, I just got to my computer and tested it and you are correct. My answer has now been edited with the correction. It appears that I misread the example in the answer.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24398903
type: AnswerComment

http://stackoverflow.com/q/24408251
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/37757727
score: 2
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/24450637
has comment: http://stackoverflow.com/comment/37835726
has comment: http://stackoverflow.com/comment/37835350
type: Question
tagged with: opencv
tagged with: java
has title: Using OpenCV Face recognition algorithms in Android application
has body: I am trying to implement face recognition in an android app and after a bit of research i installed the opencv android library and imported it in the android application. I also learned that the 3 most used algorithms (at least the most frequently used in tutorials) for face recognition are LBPH, FischerFaces and Eigenfaces, but i cannot find their implementations in the SDK, am i missing something? Do i have to import C++ code via JNI? or are there some java implementations i can use in android apps?
accepted answer: http://stackoverflow.com/a/24450637
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/99255593
has text: Yeah, I don't want to add more dependency. Good job
score: 2
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/54750045

http://stackoverflow.com/comment/37797773
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24371940
has text: Also, can we see some of the code for your InjectionResolver? Thanks
score: 0

http://stackoverflow.com/comment/37780248
comment on: http://stackoverflow.com/q/24419942
type: QuestionComment
has text: Guess this doesn't help much but calling setFlags(ANTI_ALIAS_FLAG) will clear dither and filter bitmap flags set previously. Maybe comparing Canvas objects between View and SurfaceView you draw into gives best results though. Ie. are both HW accelerated etc.
score: 0
type: Comment

http://stackoverflow.com/a/24971832
score: 0
has comment: http://stackoverflow.com/comment/38818179
has body: public static void main(String[] args) throws Exception{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line1 = in.readLine(); String line2 = in.readLine(); int diff = Integer.parseInt(line1.split(" ")[1]); Map&lt;Integer, Object&gt; nMap = new HashMap&lt;Integer, Object&gt;(); Map&lt;Integer, Boolean&gt; uMap = new HashMap&lt;Integer, Boolean&gt;(); Map&lt;Integer, Boolean&gt; lMap = new HashMap&lt;Integer, Boolean&gt;(); String[] numbers = line2.split(" "); //init maps for(String number : numbers){ Integer intValue = Integer.valueOf(number); nMap.put(intValue, new Object()); //original set, N uMap.put(intValue + diff, false); //upper-bound map lMap.put(intValue - diff, false); //lower-bound map } int count = 0; for(Integer nKey : nMap.keySet()){ //Do if the lower-bound of n exists in N and if n hasn't used as an upper-bound? if(nMap.get(nKey - diff) != null &amp;&amp; !uMap.get(nKey)){ count++; //Mark the lower-bound as used. lMap.put(nKey - diff, true); } //Do if the upper-bound of n exists in N and if n hasn't used as an lower-bound? if(nMap.get(nKey + diff) != null &amp;&amp; !lMap.get(nKey)){ count++; //Mark the upper-bound as used. uMap.put(nKey + diff, true); } } System.out.println(count); }
answers question: http://stackoverflow.com/q/24335820
type: Answer
has comment: http://stackoverflow.com/comment/38817651

http://stackoverflow.com/q/24289151
tagged with: java
has answer: http://stackoverflow.com/a/34146201
tagged with: jax-ws
type: Question
upvote count: 2
has title: Eclipse RCP and Apache CXF
has comment: http://stackoverflow.com/comment/37560350
has comment: http://stackoverflow.com/comment/37558866
tagged with: manifest.mf
tagged with: eclipse-rcp
answer count: 2
has body: I'm trying to use Apache CXF in an Eclipse RCP application. One plugin (X) would provide an OSGI service which uses CXF. Another plugin (Y) would call this service. The "X" plugin uses the CXF JAR's I downloaded (CXF 2.7.11) which I added to the MANIFEST.MF. When I run my test cases from withint plugin X everything goes fine i.e. I can call a webservice and get a response. When I try to run plugin "Y" it sees the OSGI service which I can call. The OSGI service calls the same code from withint project "X" as in the above case, but now it doesnt work. The exception I get is: com.sun.xml.internal.ws.client.sei.SEIStub cannot be cast to org.apache.cxf.frontend.ClientProxy in this part: org.apache.cxf.endpoint.Client client = ClientProxy.getClient(myServicePort); Now when I run the SAME CODE within this plugin (plugin X) it just runs fine. So I suspect it has something to do with the JAR's and dependencies etc. but Im not sure. I searched for this exception and this comes up when some JAR's are missing from CXF, but added ALL JAR's to the MANIFEST.MF I found in the CXF distribution. I'm not even sure what classes of CXF I really need, but the test cases seem to run just fine. Any ideas what went wrong?
favorite count: 0
linked to: http://stackoverflow.com/q/10543306
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37563461
score: 2
has comment: http://stackoverflow.com/comment/37534680
downvote count: 0
tagged with: cxf
has answer: http://stackoverflow.com/a/24306318

http://stackoverflow.com/a/24372497
has comment: http://stackoverflow.com/comment/131234448
answers question: http://stackoverflow.com/q/24372387
type: Answer
has body: Backtracking basically means trying all possible options. It's usually the naive, inefficient solutions to problems. In your example solution, that's exactly what's going on - you simply try out all possible paths, recursively: You try each possible direction; if you found a successful path - good. if not - backtrack and try another direction.
has comment: http://stackoverflow.com/comment/37736718
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/37625516
has text: I think I get it now I'll have to try this, thank you for the great explanation!
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24338154

http://stackoverflow.com/comment/37499865
comment on: http://stackoverflow.com/a/24271718
type: AnswerComment
score: 0
type: Comment
has text: thats okie..but how i should write equality consistant compareTo() method..can you show it for Person class itself...sorting should happen on age and equals should return true if compareTo() return 0

http://stackoverflow.com/comment/37598836
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24318217
type: Comment
has text: @Ra41P if my code works for you then mind accepting my answer

http://stackoverflow.com/comment/37500777
type: Comment
score: 1
type: AnswerComment
has text: I would rather leave `SpringApplication.run(Application.class` because this works, second solution looks too magic to me :)
comment on: http://stackoverflow.com/a/24271946

http://stackoverflow.com/a/24341977
upvote count: 29
downvote count: 1
has comment: http://stackoverflow.com/comment/79787990
score: 28
has comment: http://stackoverflow.com/comment/37642971
has body: Why don't you use Spring's TransactionTemplate to programmatically control transactions? You could also restructure your code so that each "transaction block" has its own @Transactional method, but given that it's a test I would opt for programmatic control of your transactions. Also note that the @Transactional annotation on your runnable won't work (unless you are using aspectj) as the runnables aren't managed by Spring! @RunWith(SpringJUnit4ClassRunner.class) //other spring-test annotations; as your database context is dirty due to the committed transaction you might want to consider using @DirtiesContext public class TransactionTemplateTest { @Autowired PlatformTransactionManager platformTransactionManager; TransactionTemplate transactionTemplate; @Before public void setUp() throws Exception { transactionTemplate = new TransactionTemplate(platformTransactionManager); } @Test //note that there is no @Transactional configured for the method public void test() throws InterruptedException { final Contract c1 = transactionTemplate.execute(new TransactionCallback<Contract>() { @Override public Contract doInTransaction(TransactionStatus status) { Contract c = contractDOD.getNewTransientContract(15); contractRepository.save(c); return c; } }); ExecutorService executorService = Executors.newFixedThreadPool(5); for (int i = 0; i < 5; ++i) { executorService.execute(new Runnable() { @Override //note that there is no @Transactional configured for the method public void run() { transactionTemplate.execute(new TransactionCallback<Object>() { @Override public Object doInTransaction(TransactionStatus status) { // do whatever you want to do with c1 return null; } }); } }); } executorService.shutdown(); executorService.awaitTermination(10, TimeUnit.SECONDS); transactionTemplate.execute(new TransactionCallback<Object>() { @Override public Object doInTransaction(TransactionStatus status) { // validate test results in transaction return null; } }); } }
type: Answer
answers question: http://stackoverflow.com/q/24338150

http://stackoverflow.com/comment/37701850
has text: @ShakeebAyaz which part you didn't understand? All I'm saying is, if you look at collection chart, Map doesn't come under collection, but when you talk about Collection, Map is part of it. Am I wrong?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24378195
type: Comment

http://stackoverflow.com/q/24313731
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/24316321
type: Question
has body: I am trying to figure out how to bind the progress property of a Task to the property of an object being used inside the Task's call function. Conceptually, I have an object that does a certain amount of work and exposes its progress via DoubleProperties. Since I would like to to do this (long running) task off of the JavaFX main thread, I would like to wrap it in a Task object and be able to show the progress of the underlying object. However it seems like the only way to update the progress in a Task is through the updateProgress() method, which takes concrete numbers instead of Observables. Similarly, the progressProperty is exposed as a ReadOnlyDoubleProperty, so I can't set the property that way, nor override the progressProperty() method to return the property I would like to use to display progress. More concretely, this is would I would like to do: final FooBuilder builder = new FooBuilder(); Task&lt;Void&gt; task = new Task&lt;Void&gt;() { @Override protected Void call() throws Exception { // // bind to FooBuilders progress property here...but how? // Progress of doLongBuildThing is reflected in an exposed // DoubleProperty in the FooBuilder class. // // builder.doLongBuildingThing(); return null; } }; This seems like such a basic thing that it should be pretty easy, yet I am not seeing a straightforward way to accomplish it. Any help would be appreciated. TIA. chooks
has title: JavaFX - How to bind Task progress property to another property within the call() method
answer count: 2
tagged with: javafx-8
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/24314845
has answer: http://stackoverflow.com/a/24314845
has answer: http://stackoverflow.com/a/24316321

http://stackoverflow.com/a/24392112
answers question: http://stackoverflow.com/q/24389654
type: Answer
upvote count: 1
downvote count: 0
score: 1
has body: If you want to test ConcreteObserver test it in isolation to your Subject; if you want to test Subject do it like this (which assumes an import static of EasyMock): @Test public void testUpdateFunction() { Subject subject = new Subject(); Observer observer = createMock(Observer.class); observer.update(eq(subject), anyObject()); replay(observer); subject.observer(observer); subject.funcA(); verify(observer); }

http://stackoverflow.com/q/24343697
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24343749
has body: I am trying to dynamically set a table layout in an activity. The number of rows and columns depend upon the user's input. So the problem - Every time number of rows are fine but number of columns (textViews) in each row is always equal to the lowest value of the array no_periods[ ]. For eg. if no_days has a value 5, no_periods[] have 2, 3, 4, 5, 6 values. The table will have 5 rows but each row will have only 2 textViews instead of 2, 3, 4, 5, 6 textViews in the respective rows. Here is the code I am trying with //loop to set the rows and text view in the table layout of activity_home for (int i = 0; i &lt; no_days; i++) { tableRow = new TableRow(TimeTable.this); for (int j = 0; j &lt;no_periods[i]; j++) { textView = new TextView(TimeTable.this); textView.setHint("Click"); textView.setClickable(true); textView.setOnClickListener(click_listen); int maxpixels = screenWidth/(no_periods[i]); int minpixels = maxpixels; textView.setPadding(10, 10, 10, 10); textView.setMaxWidth(maxpixels); textView.setMinWidth(minpixels); tableRow.addView(textView); } tableLayout.addView(tableRow); }
tagged with: android-tablelayout
has answer: http://stackoverflow.com/a/24343749
upvote count: 1
answer count: 1
has title: Dynamically setting the table layout
favorite count: 0
tagged with: android

http://stackoverflow.com/comment/37588229
comment on: http://stackoverflow.com/q/24318662
type: Comment
type: QuestionComment
has text: `ArrayList<Game>[10]` is bad idea. Generics don't play well with arrays. Also if you are already using collections then why you want to use arrays? Wouldn't `List<List<Game>>` be simpler? Also if you want to let instance of some class be serialized simplest way is to let that class implement `Serializable` interface.
score: 0

http://stackoverflow.com/comment/45647320
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24269733
has text: This is no longer valid in the latest maven plugin; see my answer below for the correct pom entry.
type: AnswerComment

http://stackoverflow.com/comment/37517805
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24281501
type: AnswerComment
has text: I tried reducing compliance level of project to Java 7 (instead of updating some of my things), and still not working for me.

http://stackoverflow.com/comment/37789093
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24424577
has text: Please see the note in http://jdbc.postgresql.org/documentation/92/listennotify.html though - you need a round-trip like an empty statement. I'm adding a function now that'll do a Sync protocol message instead.
type: AnswerComment

http://stackoverflow.com/q/24270643
has answer: http://stackoverflow.com/a/24270755
has answer: http://stackoverflow.com/a/24326880
score: 0
favorite count: 0
tagged with: data-transfer-objects
has body: I have a web application using jdbc for database calls. I have a service, dto and dao layer. I have a request xml which is huge. Can I pass the request object to dao method or should I transfer the request to a dto model and then pass the dto object as a paramter to my dao method? Which is the right approach?? public TestServiceClass addSurveySubmitDetails(TestRequestXML testRequestXML){ //call to dao method TestDao = testdao = new TestDao(testRequestXML); } OR public TestServiceClass addSurveySubmitDetails(TestRequestXML testRequestXML){ //create dto object TestDTO testDTO = new TestDTO(); testDTO .setId(testRequestXML); //call to dao method TestDao = testdao = new TestDao(testDTO ); } Which is the right approach??
has answer: http://stackoverflow.com/a/24270723
answer count: 4
has title: Design pattern for DTO
has answer: http://stackoverflow.com/a/43595426
type: UnansweredQuestion
upvote count: 1
tagged with: design-patterns
downvote count: 1
type: Question
tagged with: java

http://stackoverflow.com/q/24425293
score: -1
linked to: http://stackoverflow.com/q/24474905
has title: How to use Java SE vector arrays to determine the longest word in a series of words?
possible better answer: http://stackoverflow.com/a/24425565
accepted answer: http://stackoverflow.com/a/24425617
has answer: http://stackoverflow.com/a/24425565
has body: I am doing some programming for my Java school work. Yesterday I posted a question which is quite similar to this one regarding arrays and I managed to get it solved. This time round, I am required to prompt the user to enter a series of words regarding of the number and from there the application will determine the longest word of all and print to console stating the longest word as well as the length of it. Although, we weren't given any hint on how to go about it but I thought that by using vector could be the only solution. As for now, I only manage to print to console no matter how many words the user input but I have no idea how to be able to add each individual to the vector and compare them regarding their length. I am a total beginner in programming. import java.util.*; class LongestWord2 { public static void main(String [] args) { System.out.println("Please enter your words"); Scanner userInput = new Scanner(System.in); Vector <String> v = new Vector <String>(); while (userInput.hasNext()) { v.add(userInput.next()); System.out.println(userInput.next()); System.out.println(v.get(0)); } } }
downvote count: 1
has comment: http://stackoverflow.com/comment/37790341
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/24401478
has answer: http://stackoverflow.com/a/24425417
tagged with: java
type: Question
tagged with: vector
upvote count: 0
tagged with: arrays
has answer: http://stackoverflow.com/a/24425617
has answer: http://stackoverflow.com/a/24425408
favorite count: 0
answer count: 4

jena-rules
tags question: http://stackoverflow.com/q/24288787
type: Tag
tag name: jena-rules

http://stackoverflow.com/comment/37650615
has text: You may be able to do it with some arcane approach using AOP but you'd end up with potentially unreadable code. AOP pointcuts should be targeting the static structure of your code and you're looking to use it to do runtime type checking. This likely doesn't fit in the "15%"(Kiczales) that AOP does for you. You could likely modify your static structure, but then you'll have a more complex solution. Use the right tool for the right job (logging framework). This is not a nail.
comment on: http://stackoverflow.com/q/24350785
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37649934
comment on: http://stackoverflow.com/q/24350917
score: 0
type: Comment
type: QuestionComment
has text: @ThomasUhrig That's OK but it would be great for new OP to make it more clear. If you leave a comment then OP can provide more information.

http://stackoverflow.com/a/24351745
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24351252
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37651146
has comment: http://stackoverflow.com/comment/37651369
accepted answer of: http://stackoverflow.com/q/24351252
has body: URLClassLoader checks if a class has already been loaded and doesn't load it again. See ClassLoader.loadClass() for details.

http://stackoverflow.com/comment/37650072
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24351255
score: 0
has text: I wanted to know the iSeries command using which I can get the list of all the profiles in the server having greater than READ access to any object.

http://stackoverflow.com/comment/37712552
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24384369
has text: does casting it to `ChatData` work ? `ChatData clientInputData = (ChatData)clientReader.readObject();`

http://stackoverflow.com/q/24365662
has answer: http://stackoverflow.com/a/25624154
type: Question
has body: I want to get the list of all possible placement ideas for a particular set of keywords. I came across Google Display Planner which gives you placement ideas. I did not get any API for Google Display Planner. Also, I stumbled upon this. But it takes url as an input and gives related website. Is there any way I can do this in JAVA using Google Adwords API or without them?
answer count: 1
downvote count: 0
tagged with: google-ads-api
favorite count: 0
type: UnansweredQuestion
has title: How to get the list of possible placements for a set of keywords using Google Adwords API?
score: 2
upvote count: 2
tagged with: java

http://stackoverflow.com/comment/37523258
type: QuestionComment
type: Comment
has text: You are trying to parse data that is not a valid json.
score: 0
comment on: http://stackoverflow.com/q/24284491

http://stackoverflow.com/comment/37568076
type: AnswerComment
has text: @sandy_ws: That depends on what you want to achieve. If you set `JAVA_HOME` to `/usr/lib/jre-1.7.0`, then you can switch the Java version used by using `update-alternatives`. If you want to use a specific version, it might make more sense to set `JAVA_HOME` to a specific Java version. That will break when you install a new version of Java, though. The packaging system will tell `update-alternatives` about new versions but it won't try to figure out all places where you set `JAVA_HOME`.
type: Comment
comment on: http://stackoverflow.com/a/24308083
score: 1

http://stackoverflow.com/a/24322834
has body: String fileToDecrypt = null; while ((currentLine = input.readLine()) != null) { fileToDecrypt = fileToDecrypt + currentLine; } This will give you a String that starts with "n", "u", "l", "l". Try to initialize fileToDecrypt to an empty String. Or even better, use a StringBuilder. decrypted = new String(crypter.decrypt(fileToDecrypt)); Isn't this supposed to be a JPEG image? You cannot convert that to a String. Use a byte[] instead. (The same issue may apply to the encrypted input data that you try to read into Strings line by line. If this is binary data, you cannot use String there, either).
type: Answer
answers question: http://stackoverflow.com/q/24322564
has comment: http://stackoverflow.com/comment/37596222
accepted answer of: http://stackoverflow.com/q/24322564
has comment: http://stackoverflow.com/comment/37618866
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/24337816
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37666930
tagged with: java
tagged with: eclipse
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/37707587
tagged with: tomcat
has comment: http://stackoverflow.com/comment/37667091
has comment: http://stackoverflow.com/comment/37708475
score: 0
has answer: http://stackoverflow.com/a/24382161
has title: MyEclipse does not deploy jars into WEB-INF/lib directory
accepted answer: http://stackoverflow.com/a/24382161
tagged with: maven
has body: I import an existing Maven project into Eclipse,and i deployed it into tomcat.When I took a glance at the folder /WEB-INF/lib I have found no JAR files. pom.xml 4.0.0 com.bookshop.main BookShop war 1.0-SNAPSHOT <spring.version>4.0.5.RELEASE</spring.version> <junit.version>4.11</junit.version> junit junit ${junit.version} test org.springframework spring-framework ${spring.version} org.springframework spring-web ${spring.version} javax.servlet javax.servlet-api 3.1.0 com.fasterxml.jackson.core jackson-core 2.3.0 com.fasterxml.jackson.core jackson-databind 2.3.0 org.springframework spring-websocket 4.0.1.RELEASE org.springframework spring-messaging 4.0.1.RELEASE BookShop quote "eclipse project right click -> Properties -> Deployment Assembly -> Add -> Java Build Path",it's not help. Do you have an idea?Thanks. btw:i also got the following error messages when i redeploy it: could not be redeployed because it could not be completely removed in the undeployment phase.

http://stackoverflow.com/a/24279272
has body: You can get it from ActionMapping. The action mapping is passed to the action as parameter when it executes. String path = mapping.getPath();
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24279105
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24279105
score: 1

http://stackoverflow.com/a/24763885
downvote count: 0
answers question: http://stackoverflow.com/q/24370338
upvote count: 2
type: Answer
has body: Try this , pig pathname/pig_file_name.pig where pathname is the location where you have your pig script file. for example pig C:\Users\Ren\Documents\Scripts\Weather_Analysis.pig
score: 2

http://stackoverflow.com/comment/37524162
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24285041
has text: i added new ones and removed the missing .jar files, now i am facing errors with the source java files

http://stackoverflow.com/a/24302537
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24302165
has body: You cannot write a String into a Clob column. Instead of statement.setString(2, inXml); use statement.setClob(2, xmlClob); You first need to create xmlClob: Clob xmlClob = connection.createClob(); Writer clobWriter = myClob.setCharacterStream(1); clobWriter.write(inXml);
has comment: http://stackoverflow.com/comment/37558326
has comment: http://stackoverflow.com/comment/37632355
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37558816

linechart
tag name: linechart
tags question: http://stackoverflow.com/q/24283245
type: Tag

http://stackoverflow.com/comment/37744495
type: Comment
has text: @shujin When _producing_ and _consuming_ you cannot declare _extends_ nor _super_. So you must stick to `List<E>`.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24379561

http://stackoverflow.com/q/24370932
type: AnsweredQuestion
tagged with: java
tagged with: collections
has answer: http://stackoverflow.com/a/24370993
type: Question
has title: Why is a Map not a "true" collection?
possible better answer: http://stackoverflow.com/a/24370993
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24370950
accepted answer: http://stackoverflow.com/a/24370950
has answer: http://stackoverflow.com/a/24371219
has body: I came across this in the Java Collections tutorial: "Note also that the hierarchy consists of two distinct trees — a Map is not a true Collection." This confuses me, as I always thought a Map was a collection. Can anyone shine some light on what this means? What is a "true" collection and why is a Map not one of them?
tagged with: dictionary

http://stackoverflow.com/a/24298937
has comment: http://stackoverflow.com/comment/37550900
accepted answer of: http://stackoverflow.com/q/24298736
type: Answer
answers question: http://stackoverflow.com/q/24298736
score: 2
downvote count: 0
upvote count: 2
has body: The one library that you can use outside of any IDE, and for any of your java project, is JGit (sources at GitHub, User Guide). See "Confusion in choosing between JavaGit, JGit and EGit" That library can be used independently of Eclipse. As I mention in this answer, the package org.eclipse.jgit.test/tst/org/eclipse/jgit includes tons of tests, for you to take example of. This JGit cookbook project is also a good source of examples.
type: AcceptedAnswer

http://stackoverflow.com/comment/37600842
score: 1
has text: Format your code. Too lazy to do that.
comment on: http://stackoverflow.com/q/24325600
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37620970
comment on: http://stackoverflow.com/a/24335978
type: Comment
score: 1
type: AnswerComment
has text: @alerya No, I won't correct your code because I don't know what you are trying to do. What you **are** doing is invoking a method on one object, but expecting it from another.

http://stackoverflow.com/q/24418436
tagged with: java
has comment: http://stackoverflow.com/comment/37777057
upvote count: 4
has comment: http://stackoverflow.com/comment/37790551
answer count: 2
has comment: http://stackoverflow.com/comment/37777524
has body: I am using jdk-8u5-windows-i586 on Windows ? C:\prog\j\j-8u5-w-i586\bin&gt; dir java*.exe 25.06.2014 14:20 15.784 java-rmi.exe 25.06.2014 14:20 176.040 java.exe 25.06.2014 14:20 68.008 javacpl.exe 25.06.2014 14:20 176.040 javaw.exe 25.06.2014 14:20 264.616 javaws.exe ANSWER (i want to give here as the question is flagged) I have checked that. I have downloaded the SDK jdk-8u5-windows-i586.exe from oracle.com/technetwork/java/javase/downloads/…. When I give custom folder (C:\prog\java\jdk-8u5-windows-i586) during setup, the setup copies files also into C:\Program Files (x86)\Java\jdk1.8.0_05\bin (Which seem weird) C:\PF(x86)\J\j1.8.0_05\bin&gt; dir java*.exe Verzeichnis von C:\Program Files (x86)\Java\jdk1.8.0_05\bin 25.06.2014 14:18 15.752 java-rmi.exe 25.06.2014 14:18 176.008 java.exe 25.06.2014 14:18 15.752 javac.exe 25.06.2014 14:18 15.752 javadoc.exe 25.06.2014 14:18 69.000 javafxpackager.exe 25.06.2014 14:18 15.752 javah.exe 25.06.2014 14:18 15.752 javap.exe 25.06.2014 14:18 176.008 javaw.exe 25.06.2014 14:18 264.584 javaws.exe
favorite count: 0
tagged with: javac
has answer: http://stackoverflow.com/a/24418652
score: 2
has answer: http://stackoverflow.com/a/24418680
has comment: http://stackoverflow.com/comment/37777020
type: UnansweredQuestion
downvote count: 2
has title: Why has my JAVA SDK no javac binary?
type: Question

http://stackoverflow.com/comment/37768400
type: Comment
has text: Tried the above. The output file is an error for the first program. The error says the input parameters are not correct.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24411930

http://stackoverflow.com/comment/37585203
type: Comment
comment on: http://stackoverflow.com/a/24317002
score: 1
type: AnswerComment
has text: Thanks for catching the error. adding L works fine, but as suggested (and I read about it more) using add(field, amount) method seems a safer/cleaner/more-readable way.

http://stackoverflow.com/comment/37531696
type: QuestionComment
comment on: http://stackoverflow.com/q/24288489
has text: The number of rows should be only limited by the format. For Excel 2003 it is already 65536. Can you show how you are accessing the file?
score: 0
type: Comment

http://stackoverflow.com/comment/37693982
score: 0
has text: You can't however tmpFile is deleted _before_ the return
type: Comment
comment on: http://stackoverflow.com/a/24374122
type: AnswerComment

http://stackoverflow.com/q/24313421
linked to: http://stackoverflow.com/q/4437715
has comment: http://stackoverflow.com/comment/37577862
type: Question
has body: I'm struggling with this issue since some days ago and I'm not able to find a solution. I have a listener which receives market data (orders at bid and ask). If market is quiet (pre-market or post-market (low volatility)) everything works fine. But once the market is open the listener receives events too fast. So after a couple of minutes my app freezes. Right now the listener only assigns the received data to a var. orderBookBid.getBuyOrders().addListener(new ObservableListModelListener&lt;Order&gt;() { @Override public void modelChanged(final Change&lt;? extends Order&gt; change) { System.out.println("bid event"); bidChange = change.getSource(); } }); The program only freezes when uses real data. When market is closed and uses test data from a local file works fine. Is there any way to set the maximum number of events per second? Or any way to ignore events for a short time period? Any idea on how can I handle this would be very appreciated. Thanks.
tagged with: java
possible better answer: http://stackoverflow.com/a/24314659
score: 0
answer count: 2
has title: can I control the refresh rate of a Java listener?
has answer: http://stackoverflow.com/a/24313577
accepted answer: http://stackoverflow.com/a/24313577
has answer: http://stackoverflow.com/a/24314659
type: AnsweredQuestion
tagged with: listener
has comment: http://stackoverflow.com/comment/37577872

http://stackoverflow.com/a/24320461
has comment: http://stackoverflow.com/comment/37591507
answers question: http://stackoverflow.com/q/24319498
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/37591466
has comment: http://stackoverflow.com/comment/37591729
downvote count: 0
has body: The data you're trying to decode is not in an expected format for an RSA key. Doing a hex dump of it reveals: 0000000: aced 0005 7372 0014 6a61 7661 2e73 6563 ....sr..java.sec 0000010: 7572 6974 792e 4b65 7952 6570 bdf9 4fb3 urity.KeyRep..O. 0000020: 889a a543 0200 044c 0009 616c 676f 7269 ...C...L..algori 0000030: 7468 6d74 0012 4c6a 6176 612f 6c61 6e67 thmt..Ljava/lang 0000040: 2f53 7472 696e 673b 5b00 0765 6e63 6f64 /String;[..encod 0000050: 6564 7400 025b 424c 0006 666f 726d 6174 edt..[BL..format 0000060: 7100 7e00 014c 0004 7479 7065 7400 1b4c q.~..L..typet..L 0000070: 6a61 7661 2f73 6563 7572 6974 792f 4b65 java/security/Ke 0000080: 7952 6570 2454 7970 653b 7870 7400 0352 yRep$Type;xpt..R 0000090: 5341 7572 0002 5b42 acf3 17f8 0608 54e0 SAur..[B......T. 00000a0: 0200 0078 7000 0001 5830 8201 5402 0100 ...xp...X0..T... 00000b0: 300d 0609 2a86 4886 f70d 0101 0105 0004 0...*.H......... 00000c0: 8201 3e30 8201 3a02 0100 0241 008d 442f ..&gt;0..:....A..D/ 00000d0: 2df6 7e5d 6e48 16a9 70a1 9006 c932 1c47 -.~]nH..p....2.G 00000e0: 71de 6cb7 81eb 8483 e5e4 73ee b06f 5e73 q.l.......s..o^s 00000f0: ed1e 851d 54f1 2d86 6491 479a d314 8897 ....T.-.d.G..... 0000100: f7e6 85dc 65ca f1f9 318e cc41 4702 0301 ....e...1..AG... 0000110: 0001 0240 2306 f713 d47c bcb9 ed92 00ed ...@#....|...... 0000120: 7681 f9cc c56a 11a5 005b c09c ac43 2d59 v....j...[...C-Y 0000130: 416e 258e a6a3 c4bb cc6d bcf1 7b5b 24d6 An%......m..{[$. This looks like some sort of Java serialization format. You will need to convert it to a format which OpenSSL supports (e.g, DER), then load it using openssl_pkey_get_private().

http://stackoverflow.com/q/24269808
type: AnsweredQuestion
tagged with: java
has body: I'm really puzzled by this. I'm dividing two positive numbers and getting a negative result (I'm using Java). long hour = 92233720368L / (3600 * 1000000 ); I got as result -132. But if I divide them as two long numbers, I get the right result: long hour1 = 92233720368L / (3600000000L ); Then I get as result: 25 I'm wondering why it occurs... Thank you in advance! :)
has comment: http://stackoverflow.com/comment/37495235
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/3001836
has comment: http://stackoverflow.com/comment/37495243
score: 0
has answer: http://stackoverflow.com/a/24269852
possible better answer: http://stackoverflow.com/a/24269852
has comment: http://stackoverflow.com/comment/37495245
has title: Positive division, negative result in Java
tagged with: overflow
has answer: http://stackoverflow.com/a/24269861
accepted answer: http://stackoverflow.com/a/24269861
tagged with: division
has comment: http://stackoverflow.com/comment/37495228

http://stackoverflow.com/a/24346318
has body: This really should be a comment, but I needed the formatting. You need to be careful when you reuse a variable like ans. The values of the following constants are: JOptionPane.YES_OPTION = 0; JOptionPane.NO_OPTION = 1; JOptionPane.CANCEL_OPTION = 2; You could have just as easily added 1 to ans as coded the 3 if statements. The way you wrote your code: if (ans == JOptionPane.YES_OPTION) { ans = 1; } if (ans == JOptionPane.NO_OPTION) { ans = 2; } if (resp == JOptionPane.CANCEL_OPTION) { ans = 3; } If ans = 0 (the YES option), you set it to 1 in the first if. Then ans (your ans, not the original ans) = 1 (the NO option). The same thing happens in the 3rd if. So, if your user clicks on the YES button, you return a 3. If your user clicks on the NO button, you return a 3. Same for the CANCEL button. You return a 3. Either use two different variables, change your second and third if to an else if, or just add 1 to ans.
score: 0
answers question: http://stackoverflow.com/q/24345971
type: Answer

http://stackoverflow.com/q/24291540
has comment: http://stackoverflow.com/comment/37558670
has body: I'm trying to use Renjin as a Jar file in our Grails application. On start up, the following exception came up: BeanCreationException: Error creating bean with name 'appService': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: net/sf/cglib/core/DebuggingClassWriter Platform: Windows 7 Grails version for the application: Grails 2.2.3 Renjin version: 0.7.0-RC7 Top result in Google search is probably the only relevant post: NoClassDefFoundError in Grails app using XWiki with Markdown syntax It indicates there is a jar file conflict between Grails cglib-2.2/asm-3.1 and the other jar you put in the classpath. In my case, the Renjin jar file I assume. I chose to upgrade to cglib 3.0 and asm 4.0. The conflict seems resolved. However, the author of the post warns that there is a chance other functionality in the application may be affected. Of course I could re-test the whole app again (it will take some time but doable). My questions are: How are asm and cglib used in Grails? Which part of the application is likely to be affected? Are Renjin using cglib or asm library? Update: Strangely, when I create a new Grails application with Grails 2.2.3 (cglib-2.2/asm-3.1) and put the Renjin jar in the classpath, the app starts with no problem. I did a bit search about asm and cglib. It seems that they are used to modify existing classes or dynamically generate classes, directly in binary form quoted from ASM home page. So are they the library that allows us to modify Grails code and see the changes without restarting the application? Does this mean that the whole app is affected and I have to retest the whole thing?
tagged with: grails
score: 0
tagged with: renjin
has answer: http://stackoverflow.com/a/24303167
answer count: 1
type: UnansweredQuestion
has title: Renjin incompatible with Grails application and how are asm and cglib library used in Grails
tagged with: java
type: Question

http://stackoverflow.com/q/24321397
duplicate of: http://stackoverflow.com/q/11578071
tagged with: jar
has comment: http://stackoverflow.com/comment/37593065
score: 0
has comment: http://stackoverflow.com/comment/37593027
has body: I'm using log4j and slf4j in my application. I put it into jar. My manifest looks like this Manifest-Version: 1.0 Main-Class: org.runner.Main My jar file located in the same folder as jars log4j-1.2.17.jar and etc. But when I try to run it I've got an error. Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory at org.runner.control.environment.classes.utils.JxdlProperties.&lt;init&gt;(JxdlProperties.java:20) at org.runner.Main.main(Main.java:25) Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 2 more How to run it with dependencies?
linked to: http://stackoverflow.com/q/11578071
answer count: 0
type: UnansweredQuestion
type: Question
tagged with: java
has title: run jar with dependecies

http://stackoverflow.com/comment/37702919
has text: :D Yeah, in a sense. Because I was able to use the broadcast receiver for other things that I needed to implement.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24327146

http://stackoverflow.com/comment/37566119
has text: Sometimes I have to right click on the `pom.xml` in the file tree, and select `maven > reimport`. (In case you didn't try this already)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24306939
score: 1

http://stackoverflow.com/q/24395442
tagged with: performance
tagged with: java
has comment: http://stackoverflow.com/comment/37734021
type: Question
has comment: http://stackoverflow.com/comment/37735568
answer count: 1
has comment: http://stackoverflow.com/comment/37735732
tagged with: nio
has answer: http://stackoverflow.com/a/24395611
score: 0
tagged with: cryptography
has title: Fast modular addition of 2 (potentially large) files in java
has body: I am doing a cryptography experiment with One Time Pads. I have two files OTP and TEXT (1K-10K) with bytes in them. OTP is large (>1GB). I want to create a third file CYPHERTEXT (same size as TEXT) by performing modular addition of TEXT with OTP using an offset into OTP. I coded this by hand using java.io, and it works, but isn't very snappy, even with buffered IO (streams or writers). I was looking for a way to add one of underlying byte buffers together with the other one using NIO but could not find a (built-in) way to do that, or to filter the contents of TEXT using the data from OTP except by hand. Is there any way to do something like this without reinventing the wheel? I thought I could use a selector. Ideally I'd like to be able to handle files larger than 2GB in size for both the OTP and the TEXT which is why I was looking at NIO. private static void createOTP() { ... System.out.print("Generating " + filename + " "); long startTime = System.nanoTime(); FileOutputStream fos = new FileOutputStream(f); BufferedOutputStream bos = new BufferedOutputStream(fos, MB); for(long currentSize =0; currentSize &lt; OTPSize; currentSize += baSize){ new SecureRandom().nextBytes(ba); bos.write(ba); if(currentSize % (MB * 20L * (long)sizeInGB)==0){ System.out.print("."); } } long elapsedTime = System.nanoTime() - startTime; System.out.println(" OTP generation elapsed Time is " + (elapsedTime / 1000000.0) + " msec"); fos.close(); bos.close(); ... } private static void symetricEncryptionDecryption(boolean encrypt) { ... outtext=new File(intext.getParentFile(), direction + ".OTP"); BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(outtext), MB); byte[] plaindata = new byte[(int)intext.length()]; DataInputStream dataIs = new DataInputStream(new FileInputStream(intext)); dataIs.readFully(plaindata); dataIs.close(); ByteBuffer bb = ByteBuffer.wrap(plaindata); DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(otpFile))); in.…
has comment: http://stackoverflow.com/comment/37735637
has comment: http://stackoverflow.com/comment/37735445
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37760428
has comment: http://stackoverflow.com/comment/37735802

http://stackoverflow.com/comment/37851659
comment on: http://stackoverflow.com/a/24458955
has text: Why do you need to mediate through a background fragment? It just seems unnecessarily complicated.
score: 0
type: AnswerComment
type: Comment

javafx
tags question: http://stackoverflow.com/q/24290072
tags question: http://stackoverflow.com/q/24316858
type: Tag
tags question: http://stackoverflow.com/q/24340578
tags question: http://stackoverflow.com/q/24286420
tags question: http://stackoverflow.com/q/24403279
tags question: http://stackoverflow.com/q/24396897
tags question: http://stackoverflow.com/q/24390918
tags question: http://stackoverflow.com/q/24414764
tags question: http://stackoverflow.com/q/24375047
tags question: http://stackoverflow.com/q/24314668
tags question: http://stackoverflow.com/q/24378061
tags question: http://stackoverflow.com/q/24421358
tags question: http://stackoverflow.com/q/24354290
tags question: http://stackoverflow.com/q/24334042
tags question: http://stackoverflow.com/q/24320014
tags question: http://stackoverflow.com/q/24409550
tags question: http://stackoverflow.com/q/24347242
tags question: http://stackoverflow.com/q/24329395
tags question: http://stackoverflow.com/q/24347658
tags question: http://stackoverflow.com/q/24344768
tag name: javafx
tags question: http://stackoverflow.com/q/24361270
tags question: http://stackoverflow.com/q/24292790
tags question: http://stackoverflow.com/q/24279061
tags question: http://stackoverflow.com/q/24268954
tags question: http://stackoverflow.com/q/24423081
tags question: http://stackoverflow.com/q/24313731
tags question: http://stackoverflow.com/q/24307259
tags question: http://stackoverflow.com/q/24357092
tags question: http://stackoverflow.com/q/24277775
tags question: http://stackoverflow.com/q/24401086
tags question: http://stackoverflow.com/q/24302636
tags question: http://stackoverflow.com/q/24344791
tags question: http://stackoverflow.com/q/24299724
tags question: http://stackoverflow.com/q/24407673
tags question: http://stackoverflow.com/q/24374867
tags question: http://stackoverflow.com/q/24283245
tags question: http://stackoverflow.com/q/24336696
tags question: http://stackoverflow.com/q/24312260
tags question: http://stackoverflow.com/q/24329777
tags question: http://stackoverflow.com/q/24384624
tags question: http://stackoverflow.com/q/24412991
tags question: http://stackoverflow.com/q/24371319
tags question: http://stackoverflow.com/q/24341753
tags question: http://stackoverflow.com/q/24314800
tags question: http://stackoverflow.com/q/24326324
tags question: http://stackoverflow.com/q/24395032

http://stackoverflow.com/q/24424305
tagged with: java
has comment: http://stackoverflow.com/comment/37787508
has comment: http://stackoverflow.com/comment/37787811
type: Question
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37787487
upvote count: 3
tagged with: rest
has answer: http://stackoverflow.com/a/24424536
favorite count: 0
has body: Before you minus this question, you should know I searched for solution and didn't find it. I want to return String by rest endpoint: @GET @Path("/getMyString") @Produces({ MediaType.APPLICATION_JSON }) public Response getId() { String s = "this is my string"; (...) return Response.ok(s).build(); } But in view I receive char array (result in firebug): Resource { 0="t", 1="h", 2="i", more...} In front I use angular resource like: blablaResources.factory('AngularApp', [ '$resource', function($resource) { return $resource(contextPath + '/.rest/v1/someService', {}, { (... other methods ...) getString : { method : 'GET', url : contextPath + '/.rest/v1/someService/getMyString' } }); } ]); Is there any wrapper class for String or annotation to send it like: Resource { value = "this is my string" } or just normal "this is my string" Thanks for any constructive response :)
tagged with: angularjs
type: UnansweredQuestion
has title: Returning String using REST Endpoint
score: 3

apache
tag name: apache
tags question: http://stackoverflow.com/q/24401930
tags question: http://stackoverflow.com/q/24294686
tags question: http://stackoverflow.com/q/24359240
tags question: http://stackoverflow.com/q/24300479
tags question: http://stackoverflow.com/q/24352697
tags question: http://stackoverflow.com/q/24357354
tags question: http://stackoverflow.com/q/24379269
tags question: http://stackoverflow.com/q/24350838
tags question: http://stackoverflow.com/q/24276677
tags question: http://stackoverflow.com/q/24416193
tags question: http://stackoverflow.com/q/24293933
tags question: http://stackoverflow.com/q/24321008
tags question: http://stackoverflow.com/q/24328656
tags question: http://stackoverflow.com/q/24304619
tags question: http://stackoverflow.com/q/24384905
tags question: http://stackoverflow.com/q/24405550
tags question: http://stackoverflow.com/q/24293951
tags question: http://stackoverflow.com/q/24364541
tags question: http://stackoverflow.com/q/24346337
tags question: http://stackoverflow.com/q/24383479
tags question: http://stackoverflow.com/q/24410729
tags question: http://stackoverflow.com/q/24305093
tags question: http://stackoverflow.com/q/24412397
tags question: http://stackoverflow.com/q/24392463
tags question: http://stackoverflow.com/q/24285718
type: Tag
tags question: http://stackoverflow.com/q/24425081
tags question: http://stackoverflow.com/q/24283747
tags question: http://stackoverflow.com/q/24410012
tags question: http://stackoverflow.com/q/24385102
tags question: http://stackoverflow.com/q/24350777
tags question: http://stackoverflow.com/q/24425606
tags question: http://stackoverflow.com/q/24385206

http://stackoverflow.com/comment/37674060
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24363621
has text: Do the numbers always have a fractional or decimal part- that is, will the English numbers always have a period in them?
score: 0

garbage-collection
tags question: http://stackoverflow.com/q/24324944
tags question: http://stackoverflow.com/q/24373850
tags question: http://stackoverflow.com/q/24282091
tags question: http://stackoverflow.com/q/24362982
tags question: http://stackoverflow.com/q/24312652
tags question: http://stackoverflow.com/q/24376768
tags question: http://stackoverflow.com/q/24366785
tags question: http://stackoverflow.com/q/24274469
tags question: http://stackoverflow.com/q/24327821
tags question: http://stackoverflow.com/q/24328115
tags question: http://stackoverflow.com/q/24395623
tags question: http://stackoverflow.com/q/24371483
tags question: http://stackoverflow.com/q/24396432
tags question: http://stackoverflow.com/q/24390456
tag name: garbage-collection
tags question: http://stackoverflow.com/q/24319914
type: Tag
tags question: http://stackoverflow.com/q/24390918
tags question: http://stackoverflow.com/q/24279133
tags question: http://stackoverflow.com/q/24317685
tags question: http://stackoverflow.com/q/24387505
tags question: http://stackoverflow.com/q/24409546

http://stackoverflow.com/q/24315316
has comment: http://stackoverflow.com/comment/37582787
downvote count: 0
has comment: http://stackoverflow.com/comment/37581701
tagged with: java
has comment: http://stackoverflow.com/comment/37582159
has comment: http://stackoverflow.com/comment/37581828
type: Question
tagged with: algorithm
has body: I would like to calculate the occurrence of a random number. I will pick 1,000,000 numbers randomly from 1 to 1,000,000,000. For example: When I enter 1000, it will show how many times that 1000 has occurred in these 1,000,000 numbers. Following is the code I wrote, but I don't know why it always outputs 0. Could you help me fix the code? I made a hash table and put linked lists in it to avoid exceptions because with 1,000,000,000 the program runs out of memory. public static void main(String[] args) { Hashtable&lt;Integer,LinkedList&lt;Integer&gt;&gt; map = new Hashtable&lt;Integer,LinkedList&lt;Integer&gt;&gt;(); int index; int b; int x; for (b=0; b&lt;1000000; b++){ x = (int) (Math.random()*1000000000)+1; index = x % 10000; if(map.get(index) == null){ map.put(index, new LinkedList&lt;Integer&gt;()); map.get(index).add(x); }else{ map.get(index).add(x); } }
has title: Calculating the occurrence of a random number
upvote count: 2
has comment: http://stackoverflow.com/comment/37581731
answer count: 1
has answer: http://stackoverflow.com/a/24316962
accepted answer: http://stackoverflow.com/a/24316962
favorite count: 0
tagged with: hashtable
has comment: http://stackoverflow.com/comment/37582934
score: 2
type: AnsweredQuestion

restful-architecture
type: Tag
tags question: http://stackoverflow.com/q/24321783
tags question: http://stackoverflow.com/q/24407576
tag name: restful-architecture

http://stackoverflow.com/comment/37745269
has text: @JigarJoshi child's effective pom has the same descriptor as a parent. how to disable such behavior?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24392403
type: QuestionComment

http://stackoverflow.com/a/24320917
has body: What you are trying to do is to COPY the files. But that's not what renameTo does. Rather it MOVES or RENAMES them. The javadoc for renameTo explains this. If you want to copy a file using classic Java, you open a FileInputStream for the source file, and a FileOutputStream for the destination file, and then copy the bytes from the input stream to the output stream. For code examples, and for alternative ways of copying, read the answers to this Question: Standard concise way to copy a file in Java?
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/37592286
has comment: http://stackoverflow.com/comment/37592259
score: 4
answers question: http://stackoverflow.com/q/24320813

http://stackoverflow.com/comment/37745012
score: 0
type: Comment
type: QuestionComment
has text: How do you know that the LoginTimer's run method is not executing? Add a System.out.println at the top of the run method and see if that gets printed. Or use a debugger and debug the run method. It can be that the run method is throwing an exception and that's why you can't see its output.
comment on: http://stackoverflow.com/q/24383293

http://stackoverflow.com/q/24337909
has comment: http://stackoverflow.com/comment/37624433
favorite count: 0
has comment: http://stackoverflow.com/comment/37624483
has comment: http://stackoverflow.com/comment/37624418
has comment: http://stackoverflow.com/comment/37624420
tagged with: android
has title: editText.setOnEditorActionListener error on developer.android.com
has answer: http://stackoverflow.com/a/24338371
has comment: http://stackoverflow.com/comment/37624496
has comment: http://stackoverflow.com/comment/37624549
has comment: http://stackoverflow.com/comment/37624462
type: UnansweredQuestion
upvote count: 1
type: Question
has body: I see this code on developer.android.com for handle the IME_ACTION of the softkeyboard: EditText editText = (EditText) findViewById(R.id.search); editText.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { boolean handled = false; if (actionId == EditorInfo.IME_ACTION_SEND) { sendMessage(); handled = true; } return handled; } }); If you see, this code not working because the mehod OnEditorActionListener is for a TextView type... So, what are the right method to haddling the IME_ACTION of the softkeyboard?
has answer: http://stackoverflow.com/a/47258917
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37624424
has answer: http://stackoverflow.com/a/40778226
answer count: 3
has comment: http://stackoverflow.com/comment/37624566
downvote count: 0

http://stackoverflow.com/q/24345271
has title: Multiply/add/divide/subtract values in a class
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37638464
has comment: http://stackoverflow.com/comment/37638453
linked to: http://stackoverflow.com/q/1686699
has comment: http://stackoverflow.com/comment/37638452
answer count: 0
tagged with: java
type: Question
has body: I have this very simple class that looks like this: public class Vector2{ public final double x; public final double y; public Vector2(final double x, final double y){ this.x = x; this.y = y; } } Is it possible for me to do something like this in Java? Vector2 amount = new Vector2(10, 40) * 2; System.out.println(amount.x); // Prints 20 System.out.println(amount.y); // Prints 80
tagged with: math
has comment: http://stackoverflow.com/comment/37638460
score: 0
duplicate of: http://stackoverflow.com/q/1686699

http://stackoverflow.com/comment/37716887
type: AnswerComment
has text: Ok, Thanks! I thought that xml:Lang was a predicate, but I was wrong.
comment on: http://stackoverflow.com/a/24385916
type: Comment
score: 1

http://stackoverflow.com/comment/37555110
comment on: http://stackoverflow.com/a/24301163
type: AnswerComment
score: 0
type: Comment
has text: I took your first solution (my code is already very overloaded) and the smallest code is the most likely (at the moment).. Thank you very much, works perfectly.

http://stackoverflow.com/comment/37590925
type: QuestionComment
has text: Why doesn't every `GameElement` have an `update()`? If it's a no-op for some instances, how is it worse then the `instanceof` test. I think it's then a matter of opinion. The key question is this, does it work?
comment on: http://stackoverflow.com/q/24320189
type: Comment
score: 0

http://stackoverflow.com/q/24275081
has answer: http://stackoverflow.com/a/24433486
has comment: http://stackoverflow.com/comment/37688321
has comment: http://stackoverflow.com/comment/37689471
score: 3
upvote count: 3
tagged with: java
tagged with: loadjava
tagged with: oracle11g
type: Question
tagged with: java-stored-procedures
has comment: http://stackoverflow.com/comment/37688596
has title: Oracle Java stored librairies won't compile
has comment: http://stackoverflow.com/comment/37689946
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/37689604
favorite count: 0
has comment: http://stackoverflow.com/comment/37688130
type: UnansweredQuestion
has body: I'm looking to store Java libraries inside my Oracle database. Note that this is the first time I'm doing that. That library is pd4ml. It is made up of two jars, which contains the compiled classes. pd4ml.jar ss_css2.jar (required by pd4ml.jar) As loading them with Toad did not work (Toad said they were loaded successfully, but did they not show up anywhere) I went command line (loadjava) and managed to load ss_css2.jar successfully. All its classes were loaded and compiled. The second library, pd4ml.jar, was also loaded, but several classes won't compile. I ran ojvmtc to try to resolve references. I got the following message: The following classes could not be found: javax/servlet/http/HttpServletResponseWrapper org/zefer/pd4ml/npdf/parser/c The first one, if my understanding is correct, should be part of the JRE that is built-in 11g r2. Browsing the sys schema, it does not appear to exist. The second one is part of the jar library. Now I'm not exactly sure of the structure of compiled Java, I've never had to look into it before, but I have several .class files inside org/zefer/pd4ml/npdf/parser/, these being: c$_b, c$_c.... to c$_g. There is none that is only c. The library works well on my local machine when passing command line arguments or running it from Eclipse, so it should work. There is no specific error message that shows up when trying to compile them in Toad. I have a feeling it's a dependencies/classpath issue. Any hints on how I should ensure that classes contained in pd4ml.jar can properly access those in ss_css2.jar , or any potential causes to investigate? Perhaps a way to get detailed error messages from the Java code?
has comment: http://stackoverflow.com/comment/37690000
has comment: http://stackoverflow.com/comment/37688636

http://stackoverflow.com/a/24389705
has body: You need to add not set at first sight. Look at the doc of set() method Throws: IndexOutOfBoundsException - if the index is out of range (index &lt; 0 || index >= size()) You met with with the condition index &gt;= size()
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/24389620
upvote count: 2

http://stackoverflow.com/q/24340129
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/24342461
score: 0
answer count: 1
tagged with: eclipse-plugin
type: UnansweredQuestion
has body: I am trying to install WST on Eclipse 3.7.2 in order to be able to setup Tomcat server. I tried to install new software from inside of Eclipse using the site http://download.eclipse.org/webtools/updates It ends up with error: Cannot complete the install because one or more required items could not be found. Software being installed: Eclipse XML Editors and Tools SDK 3.1.1.v200907161031-7A228DXETAqLQFBNMuHkC8-_dRPY (org.eclipse.wst.xml_sdk.feature.feature.group 3.1.1.v200907161031-7A228DXETAqLQFBNMuHkC8-_dRPY) Missing requirement: Java EMF Model Utilities 2.0.201.v201001252130 (org.eclipse.jem.util 2.0.201.v201001252130) requires 'bundle com.ibm.icu [3.8.1.1,4.1.0)' but it could not be found Cannot satisfy dependency: From: WST Common Core 3.1.1.v200908102300-7B77FZ6F7RZHKDIwRlOwUN (org.eclipse.wst.common_core.feature.feature.group 3.1.1.v200908102300-7B77FZ6F7RZHKDIwRlOwUN) To: org.eclipse.jem.util [2.0.201.v201001252130] Cannot satisfy dependency: From: WST Common Plug-in Developer Resources 3.1.1.v200908102300-7938c9xOCMxOeqvXiT-qoyvN9BV2 (org.eclipse.wst.common_sdk.feature.feature.group 3.1.1.v200908102300-7938c9xOCMxOeqvXiT-qoyvN9BV2) To: org.eclipse.wst.common_ui.feature.feature.group [3.1.1.v200908102300-7B5FRHDhdMOGnoekn4gtEJxSmPxV] Cannot satisfy dependency: From: WST Common UI 3.1.1.v200908102300-7B5FRHDhdMOGnoekn4gtEJxSmPxV (org.eclipse.wst.common_ui.feature.feature.group 3.1.1.v200908102300-7B5FRHDhdMOGnoekn4gtEJxSmPxV) To: org.eclipse.wst.common_core.feature.feature.group [3.1.1.v200908102300-7B77FZ6F7RZHKDIwRlOwUN] Cannot satisfy dependency: From: Eclipse XML Editors and Tools SDK 3.1.1.v200907161031-7A228DXETAqLQFBNMuHkC8-_dRPY (org.eclipse.wst.xml_sdk.feature.feature.group 3.1.1.v200907161031-7A228DXETAqLQFBNMuHkC8-_dRPY) To: org.eclipse.wst.common_sdk.feature.feature.group [3.1.1.v200908102300-7938c9xOCMxOeqvXiT-qoyvN9BV2] I tried to update Eclipse, it encountered some dependencies error: Cannot complete the install because of a conflicting dependenc…
type: Question
has title: Can not install WST on Eclipse 3.7.2

http://stackoverflow.com/q/24313360
has body: in my expressions tab in Eclipse, I am able to see that the following output \nmilk product, cultured\ncow milk\ncheese farm\n by calling eElement.getElementsByTagName("XMLTAG").item(0).getTextContent()); How to tokenize the string using \n using indexof such that I can have separate string values ie: String dairy1 = "milk product, cultured"; String dairy2 = "cow milk" String dairy3 = "cheese farm"
has answer: http://stackoverflow.com/a/24313470
accepted answer: http://stackoverflow.com/a/24313470
upvote count: 1
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: dom
type: Question
tagged with: domparser
has title: Tokenizing XML output using Java DOM parser - multiple child node values

http://stackoverflow.com/a/24296843
upvote count: 1
has body: PrintWriter out = new PrintWriter("filePath"); Should be PrintWriter out = new PrintWriter(filePath); You want to use the variable name in the parameters, what you were passing instead is a string.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24296783

http://stackoverflow.com/a/24377082
answers question: http://stackoverflow.com/q/24377024
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37699384
accepted answer of: http://stackoverflow.com/q/24377024
score: 2
has comment: http://stackoverflow.com/comment/37699470
has body: Even though he'll know nothing about the actual implementation of that class (nor even it's existence), you fellow developer still needs to have access to an instance of the class that implements your interface (i.e.: an instance of an MP3Player)... but see it only as an IPlayer. Thus, you need to provide him with a way to get such an instance. What I'd suggest you to do is having two packages: package: yourproject.api - contains: public interface IPlayer public class IPlayers package: yourproject.impl - contains: public class MP3Player implements IPlayer Where IPlayers would be a factory class that has one method: public static IPlayer createIPlayer() { return new MP3Player(); } And you would only expose the yourproject.api package :)
upvote count: 2
has comment: http://stackoverflow.com/comment/37699449
has comment: http://stackoverflow.com/comment/37699487
has comment: http://stackoverflow.com/comment/37699400
has comment: http://stackoverflow.com/comment/37699335

http://stackoverflow.com/a/24295881
has comment: http://stackoverflow.com/comment/37553929
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24294738
upvote count: 1
has body: No, any implementation to solve your problem would need external information that only the provider of the Method and List&lt;Object&gt; would have. With a method like void method (String name, String city, String parent) {} and a List "Sotirios", "New York", "Alexander" where would each argument go in the Method#invoke(..)? Only you can know that information.
has comment: http://stackoverflow.com/comment/37569741

http://stackoverflow.com/comment/37605681
has text: It all depends on where you want to catch `\n`. After `<?xml`? After `<rss`?
comment on: http://stackoverflow.com/q/24328136
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24358989
favorite count: 0
has answer: http://stackoverflow.com/a/24359331
type: Question
has answer: http://stackoverflow.com/a/24359032
upvote count: 11
has body: Let's say I have a thread T and it is holding one resource R. If I call Thread.sleep() on the current thread i.e T, will it release the resource R (to let other threads use it) before going to sleep or not? Or it will hold that resource and again when it will awake it will use the resource R and after finishing the work will it release it?
has comment: http://stackoverflow.com/comment/37665570
has comment: http://stackoverflow.com/comment/37665615
tagged with: multithreading
has answer: http://stackoverflow.com/a/24359063
has answer: http://stackoverflow.com/a/24359016
has comment: http://stackoverflow.com/comment/37681025
has answer: http://stackoverflow.com/a/24359623
tagged with: java
answer count: 5
type: UnansweredQuestion
tagged with: concurrency
score: 11
downvote count: 0
has title: How Thread.sleep() works internally

http://stackoverflow.com/a/24277083
type: Answer
has comment: http://stackoverflow.com/comment/37509371
has comment: http://stackoverflow.com/comment/37509234
has comment: http://stackoverflow.com/comment/37509139
has comment: http://stackoverflow.com/comment/37509243
has comment: http://stackoverflow.com/comment/37509174
has comment: http://stackoverflow.com/comment/37509443
downvote count: 4
has comment: http://stackoverflow.com/comment/37509333
score: -2
has comment: http://stackoverflow.com/comment/37509242
has body: Why this thing is written in Android documentation that Primitive data: string? Actually primitive types can be a wrapper classes which can be used to saved data in the Shared Preferences. String actually wraps the char[] Does this primitive word used here, mean something else than the primitive data type? Nope. You can use wrapper classes which can be a primitive type
has comment: http://stackoverflow.com/comment/37509285
has comment: http://stackoverflow.com/comment/37509197
has comment: http://stackoverflow.com/comment/37509278
has comment: http://stackoverflow.com/comment/37509143
has comment: http://stackoverflow.com/comment/37509595
answers question: http://stackoverflow.com/q/24277022
upvote count: 2
has comment: http://stackoverflow.com/comment/37509410
has comment: http://stackoverflow.com/comment/37509287

http://stackoverflow.com/comment/37493392
score: 0
has text: what is `timestampA` here?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24268952

http://stackoverflow.com/comment/37724255
type: QuestionComment
type: Comment
has text: Inside Control Panel in Windows there is usually a 'Java' icon that gives you Java install info, but nothing that low level (that I can find anyways). Thought by your selection progression Harware->OS->JVM->... you meant I could find it somewhere in there
comment on: http://stackoverflow.com/q/24389913
score: 0

p6spy
type: Tag
tags question: http://stackoverflow.com/q/24330791
tag name: p6spy

http://stackoverflow.com/q/24337300
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
accepted answer: http://stackoverflow.com/a/24337851
type: Question
has answer: http://stackoverflow.com/a/24337851
tagged with: sql
has comment: http://stackoverflow.com/comment/37624230
answer count: 1
has body: I am using Spring 4 and Hibernate 4 is a scenario where I have two classes, Person and Book, which map to two tables in the database. The relationship is 1:M from Person to Book, i.e. a Person can have many Books. The relationship in the Person table is defined as: @OneToMany(cascade=CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name="PERSON_ID") private List&lt;Book&gt; books; And in Book: @ManyToOne private Person person; With appropriate getter and setter methods. But in my method to display the Books for a Person: // Calls books.jsp for a Person. @RequestMapping(value = "/books", method = RequestMethod.GET) public String listBooks(@RequestParam("id") String id, Model model) { logger.info(PersonController.class.getName() + ".listBooks() method called."); Person person = personService.get(Integer.parseInt(id)); // List&lt;Book&gt; books = bookService.listBooksForPerson(person.getId()); // Set view. model.addAttribute("person", person); // model.addAttribute("books", books); return "view/books"; } I find that Hibernate returns: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: library.model.Person.books, could not initialize proxy - no Session So I have two alternatives: I could use EAGER fetching - this does work but ignores the whole LAZY fetching principle. Resolve the issue. This is my preference given that this is an application for myself and others to learn from. If the answer to this issue is to do with specifying / using transactions in the service or DAO code, typically my database updates are annotated @TRANSACTIONAL in the service classes. and implemented as: @Override public void insert(Person person) { logger.info(PersonDAOImpl.class.getName() + ".insert() method called."); Session session = sessionFactory.openSession(); Transaction transaction = session.getTransaction(); try { transaction.begin(); session.save(person); transaction.commit(); } catch(RuntimeException e) { transaction.rollback(); throw e…
downvote count: 0
favorite count: 0
has title: Spring and Hibernate web application: how to resolve 'org.hibernate.LazyInitializationException?
tagged with: lazy-loading
linked to: http://stackoverflow.com/q/1139985
tagged with: spring

httprequest
tags question: http://stackoverflow.com/q/24384508
tags question: http://stackoverflow.com/q/24368870
tag name: httprequest
tags question: http://stackoverflow.com/q/24311221
tags question: http://stackoverflow.com/q/24332395
type: Tag

http://stackoverflow.com/comment/37512738
type: Comment
type: QuestionComment
has text: I don't follow. which class are we talking about?
score: 0
comment on: http://stackoverflow.com/q/24278868

http://stackoverflow.com/q/24312260
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: javafx
type: Question
answer count: 2
score: 5
tagged with: icons
accepted answer: http://stackoverflow.com/a/25289069
has body: I need to hide the dock icon of my javafx application. In a normal java application this can be achieved by the following property: System.setProperty("apple.awt.UIElement", "true"); However, this does not seems to work with JavaFX. Thanks!
favorite count: 0
has title: JavaFX application hide OSX dock icon
tagged with: macos
has answer: http://stackoverflow.com/a/25289069
upvote count: 5
possible better answer: http://stackoverflow.com/a/32984600
has answer: http://stackoverflow.com/a/32984600
tagged with: uielement

http://stackoverflow.com/q/24373678
type: Question
tagged with: hibernate-search
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24409654
score: 0
has comment: http://stackoverflow.com/comment/37707941
has comment: http://stackoverflow.com/comment/37724614
answer count: 1
accepted answer: http://stackoverflow.com/a/24409654
has body: Getting the following in my log when I run my Hibernate Search application: WARN 23 Jun 2014 15:08:51,623 org.hibernate.search.engine.metadata.impl.TypeMetadata:339 - HSEARCH000120: There are multiple properties indexed against the same field name 'foo.bar', but with different indexing settings. The behaviour is undefined. I see that the warning is being logged from: private Map&lt;String, DocumentFieldMetadata&gt; keyFieldMetadata(Set&lt;PropertyMetadata&gt; propertyMetadataSet) { Map&lt;String, DocumentFieldMetadata&gt; tmpMap = new HashMap&lt;String, DocumentFieldMetadata&gt;(); for ( PropertyMetadata propertyMetadata : propertyMetadataSet ) { for ( DocumentFieldMetadata documentFieldMetadata : propertyMetadata.getFieldMetadata() ) { DocumentFieldMetadata oldFieldMetadata = tmpMap.put( documentFieldMetadata.getName(), documentFieldMetadata ); if ( oldFieldMetadata != null ) { if ( !documentFieldMetadata.getIndex().equals( oldFieldMetadata.getIndex() ) ) { **log.inconsistentFieldConfiguration( documentFieldMetadata.getName()** ); } } } } for ( DocumentFieldMetadata documentFieldMetadata : classBridgeFields ) { tmpMap.put( documentFieldMetadata.getName(), documentFieldMetadata ); } if ( idPropertyMetadata != null ) { for ( DocumentFieldMetadata documentFieldMetadata : idPropertyMetadata.getFieldMetadata() ) { tmpMap.put( documentFieldMetadata.getName(), documentFieldMetadata ); } } return Collections.unmodifiableMap( tmpMap ); } but I'm having trouble figuring out the purpose of this code, or how my code could be causing it to meet the condition. It appears to only be happening on fields annotated with @IndexedEmbedded I've Googled and found nothing for the error. I assume that this has always been an issue in the code, but I just recently updated from Hibernate Search 4.2.0.Final to 4.5.1.Final, and this is when the warning began to appear. UPDATE @Entity @Table(name = "data_providers") @Immutable @Embeddable @Cache(usage = CacheConcurrencyStrategy.READ_ONLY) publ…
type: AnsweredQuestion
has title: There are multiple properties indexed against the same field name ..., but with different indexing settings. The behaviour is undefined

http://stackoverflow.com/comment/37560261
has text: @user3755831 post another question clearly mentioning your requirement with codes
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24303538
type: Comment

http://stackoverflow.com/comment/37717317
score: 1
comment on: http://stackoverflow.com/a/24386430
type: AnswerComment
type: Comment
has text: That one's wrong too. :-) [`ISODate`](http://docs.mongodb.org/manual/core/shell-types/#date) is just a constructor function in the MongoDB shell to help converting ISO 8601 strings to native `Date`.

http://stackoverflow.com/comment/37576481
comment on: http://stackoverflow.com/a/24312594
type: Comment
has text: Yes. This should work, if there are no more than three arrays
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37674323
type: Comment
type: QuestionComment
score: 2
has text: Instead of using something you rolled yourself, you might consider using OSGi to manage the plugins / bundles for you. Its an investment to learn how to apply it, but in the end it will pay off to use proven technology that you do not need to maintain yourself.
comment on: http://stackoverflow.com/q/24363735

http://stackoverflow.com/q/24271705
accepted answer: http://stackoverflow.com/a/24271946
tagged with: spring-boot
score: 59
possible better answer: http://stackoverflow.com/a/24271834
has answer: http://stackoverflow.com/a/24271834
has comment: http://stackoverflow.com/comment/37499650
has title: SpringApplication.run main method
tagged with: eclipse
downvote count: 0
has comment: http://stackoverflow.com/comment/37499086
favorite count: 0
has answer: http://stackoverflow.com/a/24271946
has answer: http://stackoverflow.com/a/44466367
tagged with: spring
answer count: 4
has answer: http://stackoverflow.com/a/79310822
type: AnsweredQuestion
has body: I created a project in Eclipse using the Spring Starter project template. It automatically created an Application class file, and that path matches the path in the POM.xml file, so all is well. Here is the Application class: @Configuration @ComponentScan @EnableAutoConfiguration public class Application { public static void main(String[] args) { //SpringApplication.run(ReconTool.class, args); ReconTool.main(args); } } This is a command line app that I am building and in order to get it to run I had to comment out the SpringApplication.run line and just add the main method from my other class to run. Other than this quick jerry-rig, I can build it using Maven and it runs as a Spring application, sort of. I'd rather, however, not have to comment out that line, and use the full Spring framework. How can I do this?
upvote count: 59
tagged with: java
type: Question

http://stackoverflow.com/q/24354218
has comment: http://stackoverflow.com/comment/37660591
type: Question
has comment: http://stackoverflow.com/comment/37657349
score: -2
has answer: http://stackoverflow.com/a/24355991
linked to: http://stackoverflow.com/q/19489320
has body: I'm very new to socket programming. I have a requirement on continuously sending and receiving data between client and server. Below the process flow needs to be done. Client sends "Client Hello" message to Server. Server sends "Server hello" message to Client. Client Sends "What is your server id?" message to Server Server sends "My ID is #1" message to Client. Client sends "Thank you" message to Server. Server send "You are welcome" message to client I tried to do this using Java sockets API. But i can't send multiple messages using a one socket. only 1 and 2 messages were able to transmit. Can someone tell me a way to achieve this requirement? Highly appreciate if someone give me an advise on this. This is the server side program package socketserver; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; public class SocketServer{ public static void main(String args[]){ final int SocketServerPORT = 4000; try{ ServerSocket serverSocket = new ServerSocket(SocketServerPORT); System.out.println("Server is started with port"+ serverSocket.getLocalPort()); System.out.println("Waiting for connection..."); Socket socket = serverSocket.accept(); BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream())); //Receiving Client Hello System.out.println(input.readLine()); PrintWriter output = new PrintWriter(new OutputStreamWriter(socket.getOutputStream())); //Sending Server Hello output.write("Server Hello"); output.flush(); //Recieving Client message asking regarding Server ID System.out.println(input.readLine()); //Sending Server ID to client output.write("MY Server ID is #1"); output.flush(); //Recieving Client Thank you message System.out.println(input.readLine()); //Sending Welcome message to Client output.write("You are welcome."); output.flush(); output.close(); input.close(); socket.cl…
answer count: 1
favorite count: 0
duplicate of: http://stackoverflow.com/q/19489320
has comment: http://stackoverflow.com/comment/37656645
tagged with: sockets
upvote count: 1
has comment: http://stackoverflow.com/comment/37659623
accepted answer: http://stackoverflow.com/a/24355991
type: AnsweredQuestion
tagged with: java
downvote count: 3
has title: Continuous data sending and receiving

http://stackoverflow.com/comment/37632317
type: QuestionComment
has text: @David: It matters because the variable name in the example suggests a correlation which would suggest using an array to store the image references - as you later suggested in your own comment. So it *was* relevant...
comment on: http://stackoverflow.com/q/24341753
score: 0
type: Comment

http://stackoverflow.com/comment/37600736
type: AnswerComment
has text: I did as you told me but the error is the same. i updated the post with the complete classes. P.S.:nice catch on the date objects but i had fixed that one.
comment on: http://stackoverflow.com/a/24324801
score: 0
type: Comment

http://stackoverflow.com/comment/37711023
type: QuestionComment
has text: @DavidWallace I just did, and it fixes some problems (now I have 10 errors). EDIT: adding `import android.support.v7.app.ActionBarActivity;` as fixed all the following errors. Feel free to post it as separate answer.
score: 0
comment on: http://stackoverflow.com/q/24382959
type: Comment

http://stackoverflow.com/q/24361066
tagged with: activemq-classic
tagged with: java
upvote count: 1
type: Question
tagged with: javascript
answer count: 1
downvote count: 0
score: 1
tagged with: paho
favorite count: 0
has answer: http://stackoverflow.com/a/24393832
has body: I have a Java Swing application that uses activeMQ 5.9.1 with topics and queues. Now, my intention is to migrate that swing application to web, so I'm making some proves using activeMQ + MQTT (paho) javascript library. I have enabled that in activemq.xml: &lt;transportConnector name="mqtt+ws" uri="ws://0.0.0.0:1883?maximumConnections=1000&amp;amp;wireFormat.maxFrameSize=104857600&amp;amp;transport.defaultKeepAlive=30000"/&gt; And I have implemented some examples with MQTT (paho - http://eclipse.org/paho/clients/js/) for listening some topics. function ramdomID(length) { var text = ""; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for(var i=0; i&lt;length; i++) { text += possible.charAt(Math.floor(Math.random() * possible.length)); } return text; } var client = new Messaging.Client('192.168.240.17', 1883, ramdomID(20)); client.onConnectionLost = onConnectionLost; client.onMessageArrived = onMessageArrived; client.connect({onSuccess:onConnect}); function onConnect() { console.log("onConnect"); client.subscribe("/KeepAlive"); } function onConnectionLost(responseObject) { if (responseObject.errorCode !== 0) { console.log("onConnectionLost: "+responseObject.errorMessage); } } function onMessageArrived(message) { console.log("onMessageArrived: "+message.payloadString); } The responses to a topic are received correctly, but the recovered message is a Java String object reference: onMessageArrived: ﭭsr&lt;com.my.project.bp.jms.MyImplementedMessageLmessagetLjava/lang/String;Ltypeq~xppt KeepAlivey Anyone knows the correct way to receive a friendly message if a java application writes on activeMQ topic directly?
type: UnansweredQuestion
has title: How is the correct way to receive messages using MQTT (paho) + activeMQ?
tagged with: mqtt
linked to: http://stackoverflow.com/q/23654715

http://stackoverflow.com/comment/37678040
score: 0
type: Comment
type: QuestionComment
has text: see http://stackoverflow.com/questions/10004789/missing-basic-javadoc-in-eclipse?lq=1
comment on: http://stackoverflow.com/q/24365787

http://stackoverflow.com/q/24276371
has body: JCodeModel generates an import statement in place of an import static. For example I have a class that has import nz.co.cloudm.cloudserv.api.pojos.core.file.attachment.Attachment.Status instead of import static nz.co.cloudm.cloudserv.api.pojos.core.file.attachment.Attachment.Status so the compiler throws an error. The class Status is an inner enum that lives in the Attachment class as you can see in the import statement. Do you know any way I can achieve an import static using code model? Or otherwise how make the member to use the class qualified name? private nz.co.cloudm.cloudserv.api.pojos.core.file.attachment.Attachment.Status status;
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
answer count: 1
upvote count: 1
favorite count: 0
has title: Codemodel does not generate static import
has answer: http://stackoverflow.com/a/24276816
tagged with: sun-codemodel
accepted answer: http://stackoverflow.com/a/24276816
downvote count: 0

http://stackoverflow.com/comment/37566227
comment on: http://stackoverflow.com/a/24301241
has text: That’s not a work-around, that’s the solution. SpEL cannot access arguments by name if that information is not available. You need at least `-g:vars`.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24365406
type: Question
has answer: http://stackoverflow.com/a/24366053
answer count: 1
accepted answer: http://stackoverflow.com/a/24366053
has title: jdbctemplate return multple rows with dynamic sql
type: AnsweredQuestion
has body: I have a method which needs to return a list of Strings from a DB. private static List&lt;String&gt; getUserForAccount(final String account) { String sql = "SELECT NAME FROM CLIENTS WHERE ACCOUNT = ?"; } I am unsure which jdbcTemplate method is the best to use for this situation. I don't think I can use queryForList() because the SQL has a parameter. Any suggestions would be welcome . Thanks
tagged with: java
score: 0
tagged with: jdbctemplate

http://stackoverflow.com/comment/37507551
score: 2
has text: Well, you never call it for one. As a side note, *please* take the time to format your code. You're asking for help from people who volunteer your time, the *least* you can do is at least make sure your code is readable. In addition, showing any attempts at solving the problem is usually a good idea. Right now it looks like you're saying "Here's my code, it isn't working, bye", which really isn't the kind of question that should be on Stack Overflow.
type: Comment
comment on: http://stackoverflow.com/q/24276184
type: QuestionComment

http://stackoverflow.com/comment/37658549
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24355424
has text: You could state how the object is represented by a string. Imo, documentation for `hashCode()` is unnecessary.
score: 0

http://stackoverflow.com/q/24301844
score: 1
tagged with: java
upvote count: 1
has title: Camel hiding middleware API send JMS exchange with headers
type: Question
tagged with: apache-camel
downvote count: 0
has body: Does anybody know how to follow this recommendation at [camel pojo producing][1]: We recommend Hiding Middleware APIs from your application code so the next option might be more suitable. You can add the @Produce annotation to an injection point (a field or property setter) using a ProducerTemplate or using some interface you use in your business logic. e.g. public interface MyListener { String sayHello(String name); } public class MyBean { @Produce(uri = "activemq:foo") protected MyListener producer; public void doSomething() { // lets send a message String response = producer.sayHello("James"); } } Here Camel will automatically inject a smart client side proxy at the @Produce annotation - an instance of the MyListener instance. When we invoke methods on this interface the method call is turned into an object and using the Camel Spring Remoting mechanism it is sent to the endpoint - in this case the ActiveMQ endpoint to queue foo; then the caller blocks for a response. but with headers, in order to work with this line of DSL: from("jms:activemq:toBeStored").recipientList(header("stores").tokenize(",")).parallelProcessing().ignoreInvalidEndpoints(); which I have successfully tested with the method of @EndpointInject public class Foo { @EndpointInject(uri="activemq:foo.bar") ProducerTemplate producer; public void doSomething() { if (whatever) { producer.sendBodyAndHeader(" world! ", "stores","store1"); } } } like as described before the recommendation. In brief: how can I make the injected smart client side proxy send also the headers I want? thanks
tagged with: jms
favorite count: 0
type: UnansweredQuestion
tagged with: spring
answer count: 0

http://stackoverflow.com/q/24355126
type: Question
has answer: http://stackoverflow.com/a/24355171
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/24358994
answer count: 2
upvote count: 0
favorite count: 0
has body: I am learning Natural Language Process using Stanford resources, the explanation on its website really confuse me, the code in the following below isn't the code that can typed in eclipse, how can I transfer these codes or is there other place to type in these codes? There is one sentence from its webstie: To process one file using Stanford CoreNLP, use the following sort of command line (adjust the JAR file date extensions to your downloaded release): java -cp stanford-corenlp-VV.jar:stanford-corenlp-VV-models.jar:xom.jar:joda-time.jar:jollyday.jar:ejml-VV.jar -Xmx2g edu.stanford.nlp.pipeline.StanfordCoreNLP [ -props &lt;YOUR CONFIGURATION FILE&gt; ] -file &lt;YOUR INPUT FILE&gt;
type: UnansweredQuestion
tagged with: nlp
has title: Java in Natural Language Process: what does this following code mean? Why they are different from what we are familiar?
downvote count: 1

http://stackoverflow.com/a/24392051
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24392004
upvote count: 2
has body: Singleton would be there best way to do this. When you get your token, save a static timestamp variable for the time when you got the token. Then, in your getInstance() function, check the timestamp against the current time to see if it is more than 72 hours old. If it is, grab a new token and recreate the instance before you return it, if it is not, just return the instance. I've done something similar using OAuth authentication, and found it to be a simple and effective method.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24392004

http://stackoverflow.com/a/24674756
type: Answer
has body: Indexes in Hibernate Search are not identified using an URL. The indexBase attribute is meant to point to a specific filesystem path. A filesystem could reside on a network share, so you could do that to share an index across a team. Generally speaking though a team of developers would normally have independent indexes in their local machine - and an independent database - so that they can run tests without interfering with each other's experiments. For a production deployment, an index is generally shared across multiple servers using the Infinispan storage or a master/slave approach using JMS queues.
score: 0
answers question: http://stackoverflow.com/q/24385403

http://stackoverflow.com/q/24402110
has comment: http://stackoverflow.com/comment/37751427
has body: There is a simple xml in the following format crawling.depth 1 video.appid 2 Value modified @25-06-2014 11:37:28.731 At start up of my application, I generate an id and set the same in the video.appid property of the XML. I am using a simple DOM parser and the XML gets updated properly, but during repeated start up process, noticed that the space between the two properties is getting added. after five or so modifications, the file looks like the one below. crawling.depth 1 video.appid 2 Value modified @25-06-2014 12:30:18.125 I remove the property and re-add the same into the XML, that I guess is the problem. while writing it back is there any way to reformat the whole file? so that the empty lines could be avoided. tried googling it and got only indenting related info, which is not the problem here. Thanks in advance. Edit: Code which does the update: public static boolean updatePropInFile(File file, Map propMap){ boolean success = false; try { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.parse(file); NodeList props = doc.getElementsByTagName("property");//No I18N List<Element> elements = new ArrayList<Element>(); for(int i=0;i<props.getLength();i++){ Element prop = (Element)props.item(i); Element nme = (Element)prop.getElementsByTagName("name").item(0);//No I18N String propName = nme.getTextContent(); Iterator it = propMap.entrySet().iterator(); while (it.hasNext()) { Map.Entry pairs = (Map.Entry)it.next(); if(pairs.getKey().equals(propName)){ prop.getParentNode().removeChild(prop); i--; } } } Iterator it = propMap.entrySet().iterator(); while (it.hasNext()) { Map.Entry pairs = (Map.Entry)it.next(); elements.add(createPropertyElement(doc,String.valueOf(pairs.getKey()),String.valueOf(pairs.getValue()))); } Node root = doc.getElementsByTagName("configuration").item(0);//No I18N for(Element ele:elements){ root.appendChild(ele); } TransformerFactory tra…
has comment: http://stackoverflow.com/comment/37755458
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37746651
tagged with: java
has title: New lines created when updating xml files using DOM parser
tagged with: dom
type: Question
has comment: http://stackoverflow.com/comment/37747170
has comment: http://stackoverflow.com/comment/37746708
has answer: http://stackoverflow.com/a/24402338
accepted answer: http://stackoverflow.com/a/24402338
linked to: http://stackoverflow.com/q/12669686
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/37747835
favorite count: 0

http://stackoverflow.com/comment/88328539
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/41675635
has text: Thanks! was very useful for debugging an assignment with trees!

http://stackoverflow.com/comment/37756374
type: Comment
type: QuestionComment
has text: I've a properties class. All are static fields. Actually I've no instance of it. And I want to log those properties. This is a Q&A site right?
comment on: http://stackoverflow.com/q/24406268
score: 0

http://stackoverflow.com/a/25156946
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24284836
type: Answer
has body: The problem, I believe I have resolved, by using URL resolvers rather than ibiblio. Despite using Ivy to publish to artifactory and using Ivy to resolve my dependencies I needed to use the URL resolver to allow me to specify the ivy pattern. Once I had done this my transitive dependencies started to be resolved. Just to note, I'm still using an ibiblio resolver for my external dependencies like junit.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24284836
score: 1

http://stackoverflow.com/comment/37552462
type: AnswerComment
type: Comment
has text: under src make a sub-folder named resources and place it there and while getting the file in your code get it through with the following method getResourceAsStream() or getResource().Clean and Build will compile the code and embed the contents of the resources folder into the application’s .jar file please [refer](http://stackoverflow.com/questions/24298884/java-code-cannot-find-resource-file-after-build-and-clean-in-netbeans-ide/24299174#24299174) my comment in that and let me know the further issue
comment on: http://stackoverflow.com/a/24287588
score: 0

http://stackoverflow.com/comment/37523183
comment on: http://stackoverflow.com/q/24284013
has text: Why don't you declare the parameter as T instead of Throwable? Then you don't even need the cast.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37788281
comment on: http://stackoverflow.com/q/24424164
score: 0
has text: Can you try `new Locale("cze", "CZ")` ?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37499140
type: Comment
comment on: http://stackoverflow.com/a/24271480
has text: @user3749843 Where are you using Callback object?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/125183623
type: AnswerComment
has text: By leaving `Error` instances bubble up, how do we know which component will catch them ? How will this or those component(s) log those errors ? How do we know what happened once the program crashed due to an error ? Some errors can be difficult to reproduce.
type: Comment
comment on: http://stackoverflow.com/a/24344547
score: 0

http://stackoverflow.com/comment/37656849
comment on: http://stackoverflow.com/q/24335040
score: 0
type: QuestionComment
type: Comment
has text: @VGR, I tried to print out cnx.getContentLengthLong() and it returned -1. I do not think I have my headers formatted correctly, and Eve is rejecting them for some reason.

http://stackoverflow.com/comment/37554002
type: QuestionComment
type: Comment
has text: Basically i have to automate the above said process
comment on: http://stackoverflow.com/q/24300729
score: 0

http://stackoverflow.com/comment/37714107
score: 0
type: Comment
type: QuestionComment
has text: At command prompt `netstat -np`.
comment on: http://stackoverflow.com/q/24385102

http://stackoverflow.com/a/24279320
score: 1
upvote count: 1
has body: It`s just that what i see in the outcome is suggesting that the threads aren't sharing the execution time evenly Well, this is exactly what you don't want if you are after efficiency. Yanking a thread from being executed and scheduling another thread is generally very costly. Therefore it's actually advantageous to do one of them, once takes over, executing on. Of course, when this is overdone you could see higher throughput but longer response time. In theory. In practice, JVMs thread scheduling is well tuned for almost all purposes, and you don't want to try changing it in almost all situations. As a rule of thumb, if you are interested in response times in millisecond order, you probably want to stay away messing with it. tl;dr: It's not being inefficient, you probably want to leave it as it is. EDIT: Having said that, using an AtomicInteger may help in performance, and is in my opinion less error prone than using a lock (synchronized keyword). You need to be hitting that variable really very hard in order to get a measurable benefit though.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24278938
answers question: http://stackoverflow.com/q/24278938
type: Answer
has comment: http://stackoverflow.com/comment/37513354
has comment: http://stackoverflow.com/comment/37513907

http://stackoverflow.com/a/24279575
answers question: http://stackoverflow.com/q/24279465
has comment: http://stackoverflow.com/comment/37519913
has comment: http://stackoverflow.com/comment/37518931
has comment: http://stackoverflow.com/comment/37518791
score: 4
has comment: http://stackoverflow.com/comment/37520142
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/37519709
has body: The PriorityQueue in Java is a datastructure, that sorts the elements it contains. Excerpt from the Javadoc: The elements of the priority queue are ordered according to their natural ordering, or by a Comparator provided at queue construction time, depending on which constructor is used. The Problem with the unordered output comes from the iterator implementation. Another excerpt, this time from the iterator() method: Returns an iterator over the elements in this queue. The iterator does not return the elements in any particular order. So you don't java a fixed order with the iterator. If you use the poll() method in a loop you would get all given elements in ascending order. If you are looking for a Queue in the FIFO-sense you may have a look at the LinkedList and only use the addFirst() and getLast() methods.
type: Answer
has comment: http://stackoverflow.com/comment/37520337

http://stackoverflow.com/comment/37529365
type: Comment
type: QuestionComment
has text: This question belongs to http://codereview.stackexchange.com/
comment on: http://stackoverflow.com/q/24286077
score: 0

http://stackoverflow.com/q/24373343
tagged with: jsoup
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37692693
type: UnansweredQuestion
has body: I have managed to extract the information in the "tables" on the right side of a Wikipedia article. However I also want to get paragraphs from the main text of the articles. The code I'm using atm is only working about 60% of the time(Nullpointers or no text at all). In the example below I'm only interested in the tho first paragraphs, however that is irrelevant for my question. In the picture below I show what parts I want the text from. I want to be able to iterate through all ... parts in the &lt; divid="mw-content-text"....class="mw-content-ltr"> block. StringBuilder sb = new StringBuilder(); String url = baseUrl + location; Document doc = Jsoup.connect(url).get(); Elements paragraphs = doc.select(".mw-content-ltr p"); Element firstParagraph = paragraphs.first(); Element elementTwo = firstParagraph.nextElementSibling(); if (elementTwo == null) { for (int i = 0; i &lt; 2; i++) { sb.append(paragraphs.get(i).text()); } } else { sb.append(elementTwo.text()); } return sb.toString();
tagged with: android
tagged with: http://stackoverflow.com/tag/html
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/37693470
upvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/37703838
has title: JSoup extract only specific parts from Wikipedia

http://stackoverflow.com/a/24390669
has comment: http://stackoverflow.com/comment/37724807
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24390444
has body: According to the source code: http://www.docjar.com/html/api/sun/nio/ch/SocketChannelImpl.java.html the SocketChannelImpl class is not final, it has a public getter for the FileDescriptor property and a package-private constructor that accepts a FileDescriptor. Hence you should be able to retrieve an existing FileDescriptor from one SocketChannelImpl and either: extend the SocketChannelImpl and create a constructor that passes a given FileDescriptor to the super class' constructor, or use Reflection API to retrieve a package-private constructor and use it to create a new instance of SocketChannelImpl.
score: 1
upvote count: 1

http://stackoverflow.com/q/24361392
has comment: http://stackoverflow.com/comment/37673607
has answer: http://stackoverflow.com/a/58274565
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37670315
has comment: http://stackoverflow.com/comment/37670332
has answer: http://stackoverflow.com/a/24363615
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/37669938
has answer: http://stackoverflow.com/a/29971355
has comment: http://stackoverflow.com/comment/37670023
has body: After adding mvc:resource my application throwing error like "javax.servlet.ServletException: No adapter for handler [com.test.web.controller.AppController@190cf5c]: Does your handler implement a supported interface like Controller?" when i use below configuration it's workin fine, <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> <mvc:resources mapping="/help/**" location="/help/" /> /WEB-INF/views.xml 1 But when i add my controller's i'm getting error. pls check the below configuration <?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/tx http://www.springfram…
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/37673588
has comment: http://stackoverflow.com/comment/37669955
has comment: http://stackoverflow.com/comment/37670096
type: UnansweredQuestion
upvote count: 1
has title: Does your handler implement a supported interface like Controller?
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/37670041

http://stackoverflow.com/comment/37675892
type: Comment
comment on: http://stackoverflow.com/a/24362653
score: 0
type: AnswerComment
has text: thanks I have improved solution based on your info, although maybe room for further improvement.

http://stackoverflow.com/a/24411477
has comment: http://stackoverflow.com/comment/37768350
type: Answer
answers question: http://stackoverflow.com/q/24411346
upvote count: 1
score: 1
downvote count: 0
has body: StringUtils.isBlank() checks for three things: length = 0 null whitespace (" ") StringUtils.EMPTY = "". So if you want to check for empty String then go for this but if you consider whitespace (" ") to be checked as well then use isBlank().

http://stackoverflow.com/a/24341056
has comment: http://stackoverflow.com/comment/37630271
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/24340483
has body: Multiple of relations of the same type with or without different properties are allowed between two nodes. This Cypher statement will create acts relations for all character names passed in: MATCH (actor:Actor {id:3}),(movie:Movie { id:4}) FOREACH (character IN ['Hank', 'Fred']| CREATE actor-[:acts { charactername:character }]-&gt;movie)
answers question: http://stackoverflow.com/q/24340483
type: Answer
has comment: http://stackoverflow.com/comment/37630379
has comment: http://stackoverflow.com/comment/37630211

http://stackoverflow.com/q/24309489
type: Question
has comment: http://stackoverflow.com/comment/37571083
tagged with: casting
downvote count: 0
answer count: 1
favorite count: 0
has title: convert double into int
has answer: http://stackoverflow.com/a/24309529
tagged with: double
has body: I have following double value: 8.943 need to convert(cast) into int e.g: 8.943*1000000 = 8943000 required value --> 8943000 please help! thanks.
tagged with: integer
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/37570584
accepted answer: http://stackoverflow.com/a/24309529

http://stackoverflow.com/comment/37499152
type: Comment
comment on: http://stackoverflow.com/a/24271480
has text: could it have to do with the Callback? Android Studio is saying that the private inner class is never used. And its shaded grey
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37618922
has text: What does the web page HTML look like?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24334849

http://stackoverflow.com/comment/37728280
comment on: http://stackoverflow.com/q/24391649
type: Comment
type: QuestionComment
has text: `if the method onPostExecute is called by thread` ? What do you mean? Are you calling it? You are not supposed to call that method as it will be done by the asynctask class.
score: 0

http://stackoverflow.com/a/24313338
answers question: http://stackoverflow.com/q/24313266
type: AcceptedAnswer
has body: scan through all classes in classpath and check if isEnum() and check if getInterfaces() contains Editable.class or check Editable.class.isAssignableFrom(ClassToCheck) (as pointed out in comments)
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/37578218
downvote count: 0
has comment: http://stackoverflow.com/comment/37577577
accepted answer of: http://stackoverflow.com/q/24313266

http://stackoverflow.com/q/24271949
score: 3
linked to: http://stackoverflow.com/q/4501223
has answer: http://stackoverflow.com/a/24272034
upvote count: 3
has comment: http://stackoverflow.com/comment/37500112
has answer: http://stackoverflow.com/a/24272016
has answer: http://stackoverflow.com/a/24271993
has comment: http://stackoverflow.com/comment/37499588
has title: How we can get Boolean value updated through other method in main method
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24271993
accepted answer: http://stackoverflow.com/a/24272034
has comment: http://stackoverflow.com/comment/37499578
type: Question
has answer: http://stackoverflow.com/a/24271989
has answer: http://stackoverflow.com/a/24272023
downvote count: 0
has body: Please ignore formatting and sentence related issues. class ABC { public void change(Boolean x, Boolean y, StringBuffer s) { x=true; y=true; s.append("vinay"); } public static void main(String a[]) { Boolean x = false; Boolean y = false; x=false; y=false; StringBuffer s = new StringBuffer(); s.append("jasi"); ABC p= new ABC(); p.change(x,y,s); System.out.println(x); System.out.println(y); System.out.println(s); } } i want to get all changes which i made in change() method in main() method for Boolean x,y as we are getting s modified in main function. Is there any way by which we can get modified value in main method.
favorite count: 0
answer count: 5

http://stackoverflow.com/comment/37773570
type: Comment
has text: That site doesn't seem to want to accept a dollar sign? I tried to make it also not accept extra junk at the end.
comment on: http://stackoverflow.com/a/24416457
score: 0
type: AnswerComment

http://stackoverflow.com/q/24318202
score: 0
has comment: http://stackoverflow.com/comment/37588456
has answer: http://stackoverflow.com/a/24345413
has comment: http://stackoverflow.com/comment/37587846
has body: For an assignment, I have been given the task of reading in a pre-populated file as an ArrayList, sorting it, and removing all duplicates. I have been tasked to doing this with the binarySearch API. He's being rather specific. I have never done this before, and I'm not sure what I need to do to get Collections.binarySearch to work. The instructor gave me a start, but I know I am doing the parameters of Collections.binarySearch incorrectly, but I cannot for the life of me figure out the correct way to do this. If anyone can help out, it would be greatly appreciated. This is what I have so far. If it matters at all, I can post the integers from set1.txt public static void main(String[] args) { collections program = new Collections(); program.readFile(); }//main public void readFile() { File f = new File("set1.txt"); try { Scanner in = new Scanner(f); while (in.hasNext()) { int x = in.nextInt(); int index = Collections.binarySearch(x,0); if (index == 1) list.add(x); }//while Collections.sort(list); in.close(); }//try catch (IOException e) { e.printStackTrace(); }//catch }//readFile
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37588796
tagged with: collections
has comment: http://stackoverflow.com/comment/37587152
has comment: http://stackoverflow.com/comment/37587223
has title: using Collections.binarySearch to remove duplicates from a pre-populated ArrayList
tagged with: java
tagged with: duplicates
type: Question
has comment: http://stackoverflow.com/comment/37587332
answer count: 2
has answer: http://stackoverflow.com/a/44883402
has comment: http://stackoverflow.com/comment/37587370
tagged with: arraylist

http://stackoverflow.com/q/24422463
tagged with: jsp
has body: I am using Tomcat server with Java web application. I need client public IP address from request. But i am unable to get that, i used request.getHeader("x-forwarded-for") request.getRemoteAddr() methods but I get client machine Local IP address.
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/24422594
accepted answer: http://stackoverflow.com/a/24422594
tagged with: servlet-filters
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/16163874
type: Question
possible better answer: http://stackoverflow.com/a/24422649
has answer: http://stackoverflow.com/a/24422649
duplicate of: http://stackoverflow.com/q/16163874
has title: How to get client public ip address in servlet java
has comment: http://stackoverflow.com/comment/37784427
tagged with: servlets
answer count: 2
upvote count: 1

http://stackoverflow.com/q/24412968
has comment: http://stackoverflow.com/comment/37766780
accepted answer: http://stackoverflow.com/a/24428410
has body: So I'm pretty new to Spring MVC, but I'm wondering if there's a way to setup a route that's visible in a development or test environment but not visible in production? To differentiate between environments I have a config file (loaded via the "context:property-placeholder" namespace element), and I've setup my controllers similar to what's talked about here - http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/mvc.html
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37769168
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37769031
tagged with: java
has title: In Java Spring, how would I create a URL route that's only visible in development?
has answer: http://stackoverflow.com/a/24428410
has comment: http://stackoverflow.com/comment/37767324
type: Question

http://stackoverflow.com/a/24689640
score: 0
has comment: http://stackoverflow.com/comment/77971323
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24346767
type: Answer
has body: Figured this out myself. Apparently iOS blocks you from getting the local IP address via getLocalHost. I had to use RoboVM bridges to insert an Objective-C script to do it: http://blog.robovm.org/2013/08/support-for-objective-c-blocks.html
accepted answer of: http://stackoverflow.com/q/24346767

http://stackoverflow.com/a/24412093
type: Answer
answers question: http://stackoverflow.com/q/24411248
score: 2
downvote count: 0
has body: From the database point of view, you optimally have exactly one statement that fetches exactly everything you need and nothing else. Therefore, your first option is better. But don't generalize that answer in way that makes you query more data than needed. It's a common mistake for beginners to select all rows from a table (no where clause) and do the filtering in code instead of letting the database do its job.
upvote count: 2

http://stackoverflow.com/q/24421348
has title: Java (ArrayList check with object's int)
type: Question
has answer: http://stackoverflow.com/a/24421771
has answer: http://stackoverflow.com/a/24421416
downvote count: 0
favorite count: 0
tagged with: arraylist
answer count: 5
has answer: http://stackoverflow.com/a/24421454
has answer: http://stackoverflow.com/a/24421818
has answer: http://stackoverflow.com/a/24421389
type: UnansweredQuestion
score: 1
upvote count: 1
has body: I have to make an ArrayList that contains an object, the object has one int for year lets say 1 and I don't what another object with the same year 1. If one object has the int = 1 , i dont want another object with that int(1) in my list. i want to deny it. Should I try using equal? something like @Override public boolean equals(Object o){ Object object = (Object)o; return this.getInt.equals(object.getInt()); }
tagged with: java

http://stackoverflow.com/comment/37736287
type: QuestionComment
has text: @PeterLawrey FTP provides an abstract view into some filesystem, so the separator is "/" because this is what the FTP protocol defines, not what the host OS expects (even if you run some FTP server on Windows, it is "/")
score: 1
comment on: http://stackoverflow.com/q/24396070
type: Comment

http://stackoverflow.com/q/24350785
has title: Exclude an exception from log
has comment: http://stackoverflow.com/comment/37649682
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37650181
has comment: http://stackoverflow.com/comment/37649794
has comment: http://stackoverflow.com/comment/37649860
tagged with: java
has comment: http://stackoverflow.com/comment/37649417
has answer: http://stackoverflow.com/a/24353069
tagged with: aspectj
has comment: http://stackoverflow.com/comment/37649779
has comment: http://stackoverflow.com/comment/37650455
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37649396
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37649647
has comment: http://stackoverflow.com/comment/37649169
tagged with: spring-aop
has body: How can I exclude a specific exception from being logged in aspectj? We're using spring security, so we've have an implementation of UserDetailsService. When a user enters a username that does not exist, spring throws org.springframework.security.core.userdetails.UsernameNotFoundException. we want to exclude that specific exception from the log, but not the class it is thrown from (implementation of UserDetailsService). For example in the following log, we want only the first line (entering...UserDetailsServiceImpl) and not the errors that follow. 22 Jun 2014 14:20:35 INFO LoggingAspect - Entering: ...UserDetailsServiceImpl Method name: loadUserByUsername Method arguments : [***] 22 Jun 2014 14:20:42 ERROR LoggingAspect - Unhandled exception caught: ...service.UserDetailsServiceImpl loadUserByUsername org.springframework.security.core.userdetails.UsernameNotFoundException: User with loginName: *** doesnt exist at ...UserDetailsServiceImpl.loadUserByUsername(UserDetailsServiceImpl.java:30) ... Is there a way to do that with spring AOP? EDIT: This is what we have in the LoggingAspect: @AfterThrowing(pointcut = "execution(* ..*.*(..)) && !methodsExcludedFromLog()", throwing = "exp") public void afterThrowing(JoinPoint joinPoint, Throwable exp) { ... } I this I need to somehow change the throwing to exclude the spring exception, but I'm not sure how to do that. EDIT 2: So as suggested in the comments, I tried adding a filter in log4j, but it doesn't seem to work, and the exception doesn't get filtered out. anyone know what the problem might be? <level value="INFO" /> <appender-ref ref="consoleAppender" /> <appender-ref ref="fileAppender" /> Thanks.
has comment: http://stackoverflow.com/comment/37650615
has comment: http://stackoverflow.com/comment/37649731
linked to: http://stackoverflow.com/q/24100740
tagged with: spring
has comment: http://stackoverflow.com/comment/37650148
accepted answer: http://stackoverflow.com/a/24353069
has comment: http://stackoverflow.com/comment/37649300
type: AnsweredQuestion

http://stackoverflow.com/q/24371642
tagged with: java
has answer: http://stackoverflow.com/a/24372123
tagged with: image
type: Question
has title: Java label check image
answer count: 2
has body: I have some labels (10) and I want to remove the listener like this JLabel.removeMouseListener(this); when Label Image="pirosgomb.jpg" I tried many different ways but I couldn't get it working... edit: Thank You guys, now work, edited code: if (event.getSource() instanceof JLabel) { kepstring=((JLabel)event.getSource()).getIcon().toString(); } if(kepstring.equals("pirosgomb.jpg")) { }else { if (x == 1) { ((JLabel)event.getSource()).setIcon(new ImageIcon("zoldgomb.jpg")); x = 2; } else if (x == 2) { ((JLabel)event.getSource()).setIcon(new ImageIcon("sargagomb.jpg")); x = 1; } }
tagged with: label
has comment: http://stackoverflow.com/comment/37688908
score: 0
accepted answer: http://stackoverflow.com/a/24372123
has comment: http://stackoverflow.com/comment/37689405
has answer: http://stackoverflow.com/a/24372025
possible better answer: http://stackoverflow.com/a/24372025
type: AnsweredQuestion

http://stackoverflow.com/comment/37702269
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/56159/discussion-between-kick-buttowski-and-peter-lawrey).
type: Comment
comment on: http://stackoverflow.com/a/24378684
score: 0
type: AnswerComment

http://stackoverflow.com/a/24320005
answers question: http://stackoverflow.com/q/24319997
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: Threads are scheduled by JVM and in no particular order. That's the reason you see different output for the same code involving threads. JVM uses internal OS underlying threads management to manage threads and in almost all of the available OS, the algorithm for threads scheduling is round-robin.

http://stackoverflow.com/a/24369763
type: Answer
answers question: http://stackoverflow.com/q/24369534
downvote count: 0
score: 1
upvote count: 1
has body: You are passing the same Runnable to both threads, and you create an Iterator in the constructor of your Runnable, not in the run() method, which means both runnables will "compete" for the same list (each element will be processed by only one thread). This might be what you want, however. As your list is quite small (10 elements), thread t1 probably has the time to process all elements before thread t2 fully starts, and then for t2 itr.hasNext() returns false and t2 finishes. EDIT: You also keep a lock, so you force thread t2 to wait for t1 to finish. Consider using a Blocking queue and removing the lock from your Runnable, like this (assuming as your example shows that the content of your list is static): public class MultipleThreadsReadingFromFile { public static void main(String[] args) throws InterruptedException { Employee e1 = new Employee(1, "zoheb", 10000); Employee e2 = new Employee(2, "anushka", 12000); Employee e3 = new Employee(3, "katrina", 15000); Employee e4 = new Employee(4, "kareena", 17000); Employee e5 = new Employee(5, "priety", 19000); Employee e6 = new Employee(6, "rani", 21000); Employee e7 = new Employee(7, "sunney", 23000); Employee e8 = new Employee(8, "soha", 23000); Employee e9 = new Employee(9, "allia", 29000); Employee e10 = new Employee(10, "asin", 30000); BlockingQueue&lt;Employee&gt; queue = new ArrayBlockingQueue&lt;Employee&gt;(10); queue.add(e1); queue.add(e2); queue.add(e3); queue.add(e4); queue.add(e5); queue.add(e6); queue.add(e7); queue.add(e8); queue.add(e9); queue.add(e10); ListThread run = new ListThread(queue); Thread t1 = new Thread(run, "t1"); Thread t2 = new Thread(run, "t2"); t1.start(); t2.start(); t1.join(); t2.join(); System.out.println("main over"); } } class ListThread implements Runnable { BlockingQueue&lt;Employee&gt; employees; public ListThread(BlockingQueue&lt;Employee&gt; employees) { this.employees = employees; } @Override public void run() { Employee e1; while ((e1 = this.employees.poll()) != null) { Syst…

http://stackoverflow.com/q/24410886
answer count: 1
tagged with: button
favorite count: 0
has comment: http://stackoverflow.com/comment/37762945
has answer: http://stackoverflow.com/a/24411039
score: -4
tagged with: android
has comment: http://stackoverflow.com/comment/37762730
accepted answer: http://stackoverflow.com/a/24411039
has comment: http://stackoverflow.com/comment/37762649
type: AnsweredQuestion
has title: Why does the button needs to be clicked twice to work
tagged with: java
has comment: http://stackoverflow.com/comment/37762652
type: Question
downvote count: 4
upvote count: 0
has body: I have created this app I which there is a button, everything in the application is fine, except for the fact that if I want the button to work I have to press it twice, not once like suppose to be. Here the piece of code: //CODE: public void INCASEOFCLICK(View view) { Button B = (Button) findViewById(R.id.B); B.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { EditText A = (EditText) findViewById(R.id.A); TextView C = (TextView) findViewById(R.id.C); String AA=A.getText().toString(); if(A.length()&gt;0){ C.setText(AA); }else{ Toast.makeText(getApplicationContext(), "TRY AGAIN", Toast.LENGTH_LONG).show(); } } }); }
has comment: http://stackoverflow.com/comment/37762554

http://stackoverflow.com/comment/37612736
comment on: http://stackoverflow.com/a/24328423
type: Comment
type: AnswerComment
has text: just change "where array[j] > 0" with "where array[j] > array[i]"
score: 0

http://stackoverflow.com/a/24403232
accepted answer of: http://stackoverflow.com/q/24403200
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24403200
type: Answer
downvote count: 0
score: 1
has body: In Java, every class inherits from Object, and toString() is part of the Object's contract. Thus, any Java object has a toString() method. Additionally, since toString() is non-final, any class can choose to provide its own implementation of the method.

http://stackoverflow.com/comment/37492922
comment on: http://stackoverflow.com/q/24268452
score: 0
type: Comment
type: QuestionComment
has text: you need to do something like if(hasfocus) do your work

http://stackoverflow.com/comment/37560552
has text: What do your JAXB classes look like?
score: 0
comment on: http://stackoverflow.com/q/24303474
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24402819
type: Answer
has body: I'm assuming you are generating your table dynamically and using httpSession, you can set the table in session like so: HttpSession.setAttribute("Data", ArrayList&lt;Object&gt; data); Then get the table from there when generating: ArrayList&lt;Object&gt; data = this.context.getSession().getAttribute("Data");
score: 0
answers question: http://stackoverflow.com/q/24402683

http://stackoverflow.com/comment/37666300
has text: How am I supposed to save x number of items in the saved instance state, place them all back on top of the last loaded items, and then continue the pagination? That doesn't really seems like much of a solution.
comment on: http://stackoverflow.com/q/24359320
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24287118
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37527962
upvote count: 0
has answer: http://stackoverflow.com/a/24287378
has title: Command Line Calulator, Java
favorite count: 0
has answer: http://stackoverflow.com/a/24287632
answer count: 5
has body: Input from the Java commandline: "4 + 6 + 5 - 5". Wanted outcome: "is 10". Actual outcome: "is 5". class Calculator { int v_in1, v_in2, v_in3, v_in4, v_answer, result; String v_sign1, v_sign2, v_sign3; public Calculator() { } public void count(String[] args) { for(int i = 0; i &lt; args.length; i++) { //System.out.print(args[i]+ " "); if(i == 0 || i % 2 == 0) { v_in1 = Integer.parseInt(args[i]); //System.out.print(v_in1 + " "); } switch(args[i]) { case "+": { v_answer += v_in1; break; } case "-": { v_answer -= v_in1; break; } } } System.out.print("is " + v_answer); } } There might be some additional problems e.g too many variable declared etc, but what I'm concerned about it the for- if- switch part, I'm unable to pin- point the problem. Thank you :)
has comment: http://stackoverflow.com/comment/37527928
has comment: http://stackoverflow.com/comment/37528499
has answer: http://stackoverflow.com/a/24287687
has answer: http://stackoverflow.com/a/24304178
downvote count: 3
score: -3
accepted answer: http://stackoverflow.com/a/24287632
possible better answer: http://stackoverflow.com/a/24287362
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37528612
has answer: http://stackoverflow.com/a/24287362

http://stackoverflow.com/a/24387276
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24387050
upvote count: 1
has body: Replace final int oneDay = 24 * 60 * 60 * 1000; with final long oneDay = 24 * 60 * 60 * 1000;

http://stackoverflow.com/comment/37771596
type: QuestionComment
comment on: http://stackoverflow.com/q/24400601
has text: The bind succeeds with no error, I checked. It only fails when you connect it to the 127.0.0.1 443 address. The listener being on 0.0.0.0 443 means that it picks up any ip on the same port. At least that's what I assume it does.
score: 0
type: Comment

http://stackoverflow.com/q/24420895
tagged with: selectmanymenu
tagged with: arraylist
score: 0
has body: I'm not novice to java , but today i sucked to a problem for 1 hour, i don't know why . My code looksas follows: My ArrayList: private ArrayList&lt;Theme&gt; selectedThemes; My Loop: for (Theme selectedTheme : selectedThemes) { System.out.println(selectedTheme.getNom()); } When i try to execute the code below , i receive this exception: java.lang.ClassCastException: java.lang.String cannot be cast to com.mycompany.ecommerce.Modele.Catalogue.Theme What i understand from the exception is that selectedTheme are String , it is very werd for me. Note that when i execute this code : System.out.println(selectedThemes); it show the object of the list normally. Edit I'm not sure if this code could have relation with my issues:it's a SelectManyMenu that has relation with my ArrayList &lt;p:selectManyMenu id="advanced" value="#{jsfClient.selectedThemes}" var="t" showCheckbox="true"&gt; &lt;f:selectItems value="#{jsfClient.themes}" var="theme" itemLabel="#{theme.nom}" itemValue="#{theme}" /&gt; &lt;p:column&gt; &lt;h:outputText styleClass="ui-theme ui-theme-#{t.nom}" /&gt; &lt;/p:column&gt; &lt;p:column&gt; &lt;h:outputText value="#{t.nom}" /&gt; &lt;/p:column&gt; &lt;/p:selectManyMenu&gt; jsfClient is the ManagedBean. Any Help please , thank you.
has comment: http://stackoverflow.com/comment/37781764
has title: how to go through a List of Object
has comment: http://stackoverflow.com/comment/37781651
type: UnansweredQuestion
tagged with: jsf
tagged with: primefaces
has comment: http://stackoverflow.com/comment/37781610
tagged with: java
has answer: http://stackoverflow.com/a/24421047
type: Question
answer count: 1

http://stackoverflow.com/comment/37503361
score: 0
type: Comment
type: QuestionComment
has text: where would I put the assert
comment on: http://stackoverflow.com/q/24273872

http://stackoverflow.com/a/24325969
type: Answer
has body: On TOMCAT: Open Tomcat/conf/server.xml and paste this tag. Paste it after &lt; Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="d:\keystore" keystorePass="mykeypass" /&gt; keystore has the certificate with mykeypass as its password.
score: 0
answers question: http://stackoverflow.com/q/24325335

http://stackoverflow.com/comment/87474716
has text: Hey, I tried your code and it works perfectly. But I also need to increase the height, how can I do this?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24404413

http://stackoverflow.com/comment/37593610
type: AnswerComment
comment on: http://stackoverflow.com/a/24320737
has text: And also find exactly else if statements only. please kindly help me.
score: 0
type: Comment

http://stackoverflow.com/a/24349495
upvote count: 1
has body: I think that the error is in line if (joinData.get(key) != null). joinData uses String as key and you pass Text as an argument to get so get returns null every time. Try to replace this line with if (joinData.get(key.toString()) != null). Another mistake is that each Mapper and each Reducer run in their own jvm so Reducer and Mapper can't communicate through the static objects and joinData is empty for every Reducer.
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/24349042

http://stackoverflow.com/a/24421906
has body: Yes. In the first case a new empty array is created of the same length as a. int[] b = new int[a.length]; You probably then want is a copy of a using System.arraycopy() so int[] b = new int[a.length]; System.arraycopy(a, 0, b, 0, a.length); In the second case int[] b = a; A new reference to the array a is created. That is b is only a reference to a. A change to either would be reflected in the other.
score: 2
has comment: http://stackoverflow.com/comment/37783461
downvote count: 0
has comment: http://stackoverflow.com/comment/37783589
has comment: http://stackoverflow.com/comment/37784865
upvote count: 2
has comment: http://stackoverflow.com/comment/37783623
answers question: http://stackoverflow.com/q/24421822
type: Answer

http://stackoverflow.com/comment/37679972
comment on: http://stackoverflow.com/q/24366204
has text: @UweAllner I also had to remove the `(optional=false)` part of the annotation for this to work. It seems like this is indeed a Hibernate error as described in [HHH-6709](https://hibernate.atlassian.net/browse/HHH-6709). Thank You.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24347878
downvote count: 2
has answer: http://stackoverflow.com/a/24347902
has title: Meaning of the # (pound) symbol
has comment: http://stackoverflow.com/comment/37643843
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/12220492
possible better answer: http://stackoverflow.com/a/24347902
has body: Does Java provide any symbolic meaning to the # (pound) symbol? It appears to be a meaningless symbol. I have seen it used as a pattern for DecimalFormat, but that is not the Java compiler giving it a meaning.
tagged with: java
has answer: http://stackoverflow.com/a/49503861
has comment: http://stackoverflow.com/comment/37643794
type: Question
score: 3
upvote count: 5
accepted answer: http://stackoverflow.com/a/49503861
answer count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/37643797

http://stackoverflow.com/comment/37686978
type: QuestionComment
comment on: http://stackoverflow.com/q/24370407
has text: What are you using to run the test... maven, eclipse, ant?
score: 2
type: Comment

jodatime
tags question: http://stackoverflow.com/q/24340850
tags question: http://stackoverflow.com/q/24370336
type: Tag
tag name: jodatime
tags question: http://stackoverflow.com/q/24348290
tags question: http://stackoverflow.com/q/24315101
tags question: http://stackoverflow.com/q/24410771
tags question: http://stackoverflow.com/q/24375885
tags question: http://stackoverflow.com/q/24320126
tags question: http://stackoverflow.com/q/24394954
tags question: http://stackoverflow.com/q/24384765
tags question: http://stackoverflow.com/q/24396620
tags question: http://stackoverflow.com/q/24362268
tags question: http://stackoverflow.com/q/24324149
tags question: http://stackoverflow.com/q/24381619
tags question: http://stackoverflow.com/q/24388698
tags question: http://stackoverflow.com/q/24282931
tags question: http://stackoverflow.com/q/24367337
tags question: http://stackoverflow.com/q/24364128
tags question: http://stackoverflow.com/q/24296532

http://stackoverflow.com/comment/37520807
score: 0
has text: OP was talking about ASP.NET, so the parallel would be with JSP or servlets or something like this, not with desktop applications.
type: Comment
comment on: http://stackoverflow.com/a/24283355
type: AnswerComment

http://stackoverflow.com/comment/37634141
score: 1
comment on: http://stackoverflow.com/q/24343002
has text: *"Wait a few seconds in Swing [SOLVED]"* Don't put solutions in questions. Either write up an answer, or delete it.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37625844
comment on: http://stackoverflow.com/q/24338660
has text: I wanted to store address,user Info & images
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37664048
comment on: http://stackoverflow.com/a/24358238
type: Comment
has text: The result set can contain duplicate values also..if 8 is last value it might be there at some other position also.
score: 0
type: AnswerComment

task
type: Tag
tag name: task
tags question: http://stackoverflow.com/q/24360459
tags question: http://stackoverflow.com/q/24333041

http://stackoverflow.com/comment/37527260
comment on: http://stackoverflow.com/a/24281865
has text: Hi Vash - thanks for answering:-) how should i edit the jnlp file here: comtrader-prod.epexspot.com/old/eex_ct.jnlp so it is compatible wiht my java 8 version installed
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24291592
tagged with: liquibase
type: Question
tagged with: gwt
has body: I'm getting started with GWT. I manage the database with Liquibase and I want to execute its chagelog on the server start but I don't know how to do it. I did some research on the internet but nothing. Is there any way to do that? Thank you
has answer: http://stackoverflow.com/a/24293971
score: 0
answer count: 1
has title: GWT execute Liquibase script on server start
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/37749857
comment on: http://stackoverflow.com/a/24326174
type: AnswerComment
score: 0
type: Comment
has text: Great edge case examples. Key point then is actually that compiler finds the closest method and there is no 1-1 mapping. But your answer explains exactly what I wanted to know, thank you.

vaadin-push
type: Tag
tags question: http://stackoverflow.com/q/24330272
tag name: vaadin-push

http://stackoverflow.com/a/24399966
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24399936
type: Answer
has body: Your code started x at 0. That means, your code will try to run 6008 % 0, which causes the division by zero error. Change int x = 0 to int x = 1 to fix that.

http://stackoverflow.com/comment/37791098
comment on: http://stackoverflow.com/q/24426092
type: QuestionComment
type: Comment
score: 2
has text: Post full stacktrace.

http://stackoverflow.com/a/24426995
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24320914
downvote count: 0
has body: Solved : I create an Employee DAO object and assign the DAO for Action Class Getter ,Setter Employee Object Variable. Here my latest code. public String EmpView() throws SQLException, IOException{ System.out.println("em.firstName---&gt;&gt;&gt;"+em.getFirstName()); System.out.println("em.lastName---&gt;&gt;&gt;"+em.getLastName()); try { CachedRowset tmList = TmMo.GetEmpViewData(ProcName,ParaName); while (tmList.next()) { for (int i=1; i&lt;= numcols; i++) { Employee emp = new Employee(); emp.setEmployeeId(tmList.getString("employeeId")); emp.setFirstName(tmList.getString("firstName")); em = emp; } } System.out.println("em.firstName---&gt;&gt;&gt;"+em.getFirstName()); System.out.println("em.lastName---&gt;&gt;&gt;"+em.getLastName()); /*Here i am getting the Name */ } catch (Exception e) { e.printStackTrace(); } return Action.SUCCESS; } And i am getting the value's in the HTML forms. I am using the same page for both add and Edit the Employee Details. As suggested by Andrea i had removed the HTML standards and Use Struts tags and accepting Andrea reply as Answer. Thanks alot.

http://stackoverflow.com/q/24363503
tagged with: java
tagged with: swing
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/7229226
score: 5
has comment: http://stackoverflow.com/comment/37675687
has body: As a beginner Java programmer I would like some help as to understanding the best way or technique for building a swing UI for my console app. The console app works well now I would like to convert it to a swing app. I would like to have a swing JTextArea in a JScrollPane that the user can edit to input their string then click a countwords button and get an output as a int. The code for my console app and my attempt to the swing app as well is below. I have spent quite a bit of time trying to research this but I can't seem to get it right. My console app : import java.util.*; public class WordCounter{ public static void main(String args[]) { // Create Scanner object Scanner s=new Scanner(System.in); // Read a string String st=s.nextLine(); //Split string with space String words[]=st.trim().split(" "); System.out.println("No. of words "+words.length); } } My attempt at Swing : import java.io.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.JTextArea; import java.util.*; class Countswords extends JPanel { public Countswords() { myTextArea(); } private void myTextArea() { this.setLayout(new BorderLayout()); this.setPreferredSize(new Dimension(400, 200)); JTextArea textArea = new JTextArea(5, 40); JScrollPane scrollPane = new JScrollPane(textArea); // textArea.setEditable(true); JTextArea.setText(userInput); } public static void showFrame() { JPanel panel = new Countswords(); panel.setOpaque(true); JFrame frame = new JFrame("My Text Area"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(panel); frame.pack(); frame.setVisible(true); } public static void main(String args[]) { // Create Scanner object // Scanner s=new Scanner(System.in); // Read a string // String st=s.nextLine(); // Split string with space // String words[]=st.trim().split(" "); // System.out.println("No. of words "+words.length); SwingUtilities.invokeLater(new Runnable() { public void run() { Countswords.showFrame(); } }); } }
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37673995
has comment: http://stackoverflow.com/comment/37673967
has answer: http://stackoverflow.com/a/24364237
has comment: http://stackoverflow.com/comment/37674329
upvote count: 6
has title: How to convert a console app to a swing app
has comment: http://stackoverflow.com/comment/37673920

http://stackoverflow.com/q/24312738
tagged with: performance
has comment: http://stackoverflow.com/comment/37577858
tagged with: arraylist
score: 0
answer count: 1
has title: Confusing results performance test Java 1.8 Collection Api
has answer: http://stackoverflow.com/a/24312837
linked to: http://stackoverflow.com/q/504103
favorite count: 0
has body: i am playing around with java 1.8. I read that the new collection api works faster because it runs the operations on the data structures parallelized. I want to see this efford. So i wrote following code: public static void main(String[] args) { ArrayList&lt;SamplePerson&gt; persons = new ArrayList&lt;&gt;(); for (long i = 0; i &lt; 10000000; i++) { persons.add(new SamplePerson(EyeColour.BLUE,20,"Max Musterman",Gender.MALE)); } long nsBefore = System.nanoTime(); // using the new collection api - parallel way?? persons.forEach(samplePerson -&gt; samplePerson.setAge(22)); // sequential way for(int i = 0; i &lt; persons.size(); i++){ persons.get(i).setAge(22); } long nsAfter = System.nanoTime(); long runtime = nsAfter - nsBefore; System.out.println("Time in Nanoseconds: " + runtime); } My Processor: i7-2600 CPU Result using the "parallel" way: Time in Nanoseconds: 74836825 Result using the sequential way: Time in Nanoseconds: 45071315 Could everybody explain this results. Is the overhead to set up this threats that high? I am a bit confused please help me :-)
has comment: http://stackoverflow.com/comment/37577089
has comment: http://stackoverflow.com/comment/37581613
tagged with: java-8
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24312837
upvote count: 2
tagged with: java
downvote count: 2
tagged with: collections
has comment: http://stackoverflow.com/comment/37578050
type: Question

http://stackoverflow.com/q/24295815
has comment: http://stackoverflow.com/comment/37545101
type: Question
has answer: http://stackoverflow.com/a/24297455
tagged with: android
answer count: 1
has body: In my android app, I am trying to retrieve user-installed apps and put them into a Fragment. Unfortunately, there is no FragmentListActivity support so I am unsure what to do and I need help in order to work around it. I tried to implement this except with a Fragment http://javatechig.com/android/how-to-get-list-of-installed-apps-in-android Currently I have three scrollable tabs and fragments in each tab. Below is my java code for the InstalledAppActivity: package com.spicycurryman.getdisciplined10.app; import android.app.AlertDialog; import android.app.ListActivity; import android.app.ProgressDialog; import android.content.ActivityNotFoundException; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ListView; import android.widget.Toast; import com.javatechig.listapps.ApplicationAdapter; import java.util.ArrayList; import java.util.List; public class InstalledAppActivity extends FragmentActivity { private PackageManager packageManager = null; private List&lt;ApplicationInfo&gt; applist = null; private ApplicationAdapter listadaptor = null; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); packageManager = getPackageManager(); new LoadApplications().execute(); return inflater.inflate(R.layout.installed_apps, container, false); } public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.block, menu); return true; } public boolean onOptionsItemSelected(MenuItem item) { boolean result = true; switch …
has title: Trying to implement all list activity in Fragment
tagged with: android-fragments
score: 0
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37545492
has comment: http://stackoverflow.com/comment/37545097

http://stackoverflow.com/a/24395661
answers question: http://stackoverflow.com/q/24395623
type: AcceptedAnswer
downvote count: 0
score: 1
has body: A named pipe is a type of file and you can write to it like any other file. Try -Xloggc:/my/named/pipe Note: you want to make sure the pipe is being read or it could cause the JVM to stop.
type: Answer
accepted answer of: http://stackoverflow.com/q/24395623
upvote count: 1

http://stackoverflow.com/comment/37507063
type: AnswerComment
comment on: http://stackoverflow.com/a/24275891
type: Comment
has text: @ddmichael - the array is on the heap not the stack, and the stack space needed to initialize the array will be trivial. But once again, this is premature optimization.
score: 0

http://stackoverflow.com/comment/50263771
has text: after setting this up, make sure you press `Ctrl + Shift + B` to run `JavaC` again. Then, assuming it successfully built, press it again, this time choosing `JavaC Run`. From here on out simply press `Ctrl + B` to run.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27298079

http://stackoverflow.com/q/24281506
answer count: 1
downvote count: 1
upvote count: 0
tagged with: simpledateformat
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37522822
has comment: http://stackoverflow.com/comment/37517475
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24281964
has title: Calendar object millisecond in Java NumberFormatException
has body: Am using calendar object to get the millisecond Calendar.getInstance().getTimeInMillis() But in some rare cases its returning invalid long millisecond. Eg : .4201442014EE44 Its returning with floating point. Why is it so? Because am converting this millisecond to some date format. During conversion its throwing "NumberFormatException". As am doing SimpleDateFormat's format(millisecond). Exception : java.lang.NumberFormatException: For input string: ".4201442014EE44" at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1241) at java.lang.Double.parseDouble(Double.java:540) at java.text.DigitList.getDouble(DigitList.java:168) at java.text.DecimalFormat.parse(DecimalFormat.java:1321) at java.text.SimpleDateFormat.subParse(SimpleDateFormat.java:1794) at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1455) at java.text.DateFormat.parse(DateFormat.java:355)
has comment: http://stackoverflow.com/comment/37517557
score: -1
tagged with: java
tagged with: calendar

http://stackoverflow.com/comment/37794764
has text: It's an org.geotools.styling.Stroke not a Stroke from java.awt.geom
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24416515

http://stackoverflow.com/comment/37765932
comment on: http://stackoverflow.com/q/24412176
type: Comment
has text: I've seen this as well. Are you using `.jsp` or `.jspx` files? What is the content-type being rendered?
score: 0
type: QuestionComment

http://stackoverflow.com/a/24281145
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/37517739
has comment: http://stackoverflow.com/comment/37518139
has comment: http://stackoverflow.com/comment/37517076
has comment: http://stackoverflow.com/comment/37521113
type: Answer
has comment: http://stackoverflow.com/comment/37520362
has comment: http://stackoverflow.com/comment/37517226
upvote count: 3
has body: The 'old' child probably still references the parent, while the new child does not. Both is an issue. In addition to removing an old child, you should set the parent reference of the child instance to null. In addition to adding the new child to the parent, you will need to add the parent to the child in order to provide the foreign key. Do not cascade from the many side (child) to the one side (parent). The behavior for this type of cascades is undefined and might work in an unexpected way. EDIT: what the JPA 2.0 spec has to say: Note that it is the application that bears responsibility for maintaining the consistency of runtime relationships—for example, for insuring that the “one” and the “many” sides of a bidirectional relationship are consistent with one another when the application updates the relationship at runtime.
has comment: http://stackoverflow.com/comment/37516897
answers question: http://stackoverflow.com/q/24280097
has comment: http://stackoverflow.com/comment/37517412

http://stackoverflow.com/comment/37637766
type: Comment
comment on: http://stackoverflow.com/a/24344595
type: AnswerComment
has text: Gives me: `Your page request has caused a LazyInitializationException: failed to lazily initialize a collection of role: library.model.Person.books, could not initialize proxy - no Session error:`
score: 0

http://stackoverflow.com/a/24359405
has comment: http://stackoverflow.com/comment/37667397
has comment: http://stackoverflow.com/comment/37667326
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37666645
has comment: http://stackoverflow.com/comment/37667298
has comment: http://stackoverflow.com/comment/37667516
type: Answer
answers question: http://stackoverflow.com/q/24358990
accepted answer of: http://stackoverflow.com/q/24358990
upvote count: 2
has comment: http://stackoverflow.com/comment/37667598
score: 2
has body: However, with test1 = frok dork is 10 Foo, I expected the match to fail. Instead, I get $1 as frok and $3 as dork. Why does the dork match with \\w+ here instead of ((frok | dork )*) as in earlier case? Your first sentence here is the answer to your question. ((frok |dork )*) wants to match as many occurrences of frok&nbsp; or dork&nbsp; as it can; but the overriding consideration is, it wants the regex match to succeed. If a given part of the regex has to match a little bit less in order to get the match as a whole to succeed, then so be it. For more information, I suggest Googling for regex + backtracking, greedy, and nongreedy.

http://stackoverflow.com/q/24362004
downvote count: 0
accepted answer: http://stackoverflow.com/a/24362682
linked to: http://stackoverflow.com/q/24134078
answer count: 1
favorite count: 0
upvote count: 2
tagged with: sockets
tagged with: netty
has answer: http://stackoverflow.com/a/24362682
score: 2
type: AnsweredQuestion
has body: A similar question might have been asked, but indeed it is a different question: How to send nessage to a client in netty I just have started Netty and asynchronous I/O. I want to map clients by a String. When a client connected to my server sends its ID-String and i want to save that String with that client's Socket/Channel into a map. After that when i want to send any message to the Client, get that client's Socket/Channel from map by ID and send it. Is it possible to implement it myself in this way: Create my ClientData class with variables ID-String and ChannelHandlerContext object. In ChannelHandler channelRead method add to map, and remove from map somewhere else. Or is there any other way in Netty? What do you recommend for this problem? Any help would be greatly appreciated!
has title: How to manage list of clients to send data in netty
tagged with: tcp
tagged with: java
type: Question

http://stackoverflow.com/comment/37788044
type: Comment
comment on: http://stackoverflow.com/a/24389655
has text: OK, now I know where I got the idea about context loader listener. This is the exact error message: `>java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered? org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:252)`
score: 0
type: AnswerComment

cordova-plugins
tags question: http://stackoverflow.com/q/24373536
type: Tag
tag name: cordova-plugins

http://stackoverflow.com/comment/37666908
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24359383
score: 0
has text: The performance improved magically. Your method reduced the problem from O(n^2) to O(n) which contributes to the burst in performance. Thank you very much for the help.

http://stackoverflow.com/comment/37561047
has text: is this technically a code review question?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/24304332
type: Comment

http://stackoverflow.com/comment/37786732
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24413554
has text: You see in 3,4,5 i have buttons. In panel 4 i have to switch panel 4 into another panel with same size not bothering the other buttons because they have to be intact and i need their values for the database. That's why I only want the 4th panel to be switched.
type: AnswerComment

http://stackoverflow.com/comment/38490930
type: AnswerComment
has text: Your answer is about reconstructing *packets.* He is asking about reconstructing *sessions.*
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24705504

google-signin
tags question: http://stackoverflow.com/q/24354870
type: Tag
tag name: google-signin

http://stackoverflow.com/comment/37722283
score: 0
type: Comment
type: QuestionComment
has text: There is a server, I've tried with curl and it fails on the handshake. This is running on an Android phone but I'll see if I can forward some ports to it at some point.
comment on: http://stackoverflow.com/q/24374294

http://stackoverflow.com/a/24300525
type: Answer
score: 2
answers question: http://stackoverflow.com/q/24299127
downvote count: 0
has body: I'd probably prefer using basic integer operations for that (assuming value is a non-negative integer): int remainder = value % 5000; int result = remainder == 0 ? value : value - remainder + 5000;
upvote count: 2

http://stackoverflow.com/comment/37532277
score: 0
has text: Yes, other tests might be added, I just wanted to show the main ones.
comment on: http://stackoverflow.com/a/24289169
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37745249
has text: When I wrote lt.start() in LoginForm, it gives warning that it should be implemented in LoginTimer.I did that.but block of Start() in LoginTimer is blank.I am new to Threads,please tell me how to start that thread from implemented Start() method
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24383293
score: 0

http://stackoverflow.com/a/24395845
answers question: http://stackoverflow.com/q/24394088
type: Answer
score: 2
upvote count: 2
downvote count: 0
has body: While a page is processed, Wicket will keep all further request waiting. These will give up after a configurable IRequestCycleSettings#timeout(). Check why your page takes so long to respond.

http://stackoverflow.com/comment/37605118
has text: But, I do not get the reference to each collections inside the HibernateUtil class right? I need to do that inside the service, which will result in lot of duplicate code (in all the services)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24327459

http://stackoverflow.com/comment/37643855
has text: @user3732441 `toURI` is system dependent and most likely doesn't confirm to the RFC-2396 requirements that `Media` is expecting
comment on: http://stackoverflow.com/a/24347793
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37652888
score: 0
type: Comment
type: QuestionComment
has text: In your first loop, you are looping over the elements of the newly created ArrayList, but this newly created ArrayList is empty, so this loop will not even run. Do you mean instead to loop over the elements of the passed Array?
comment on: http://stackoverflow.com/q/24352597

http://stackoverflow.com/q/24344267
tagged with: jframe
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24344535
has body: So I programmed am applet that makes a ball roll in circles for ever, and I wanted to make the user decide what speed the circle should roll in, but something failed when I added the JFrame: applet(the stop,destroy and update do not appear because they aren't important, and in start there is nothing): public class Main extends Applet implements Runnable{ private Image I; private Graphics GfU; int ballX, ballY=249; static int radius=20; double Memory; int changeY ,changeX=1; Speed S = new Speed(); @Override public void init() { setSize(750,750); S.setVisible(true); } @Override public void run() { while(true){ if(ballY&gt;=250 || ballY&lt;=-250){ changeY=0-changeY; changeX=0-changeX; } ballY+=changeY; Memory=(double)ballY/250; Memory=Math.asin(Memory); Memory=Math.cos(Memory); ballX=(int)(Memory*250); if(changeX==-1) ballX=0-ballX; repaint(); try { Thread.sleep(17); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } @Override public void paint(Graphics g) { g.setColor(Color.black); g.fillOval(ballX-radius+250, ballY-radius+250, radius*2, radius*2); } public void setChangeY(int changeY) { this.changeY = changeY; } public void Done(){ S.setVisible(false); Thread BallRun = new Thread(this); BallRun.start(); } } JFrame: public class Speed extends JFrame implements ActionListener{ private static final long serialVersionUID = 1L; public Speed(){ setDefaultCloseOperation(EXIT_ON_CLOSE); JPanel P = new JPanel(); JLabel L = new JLabel("please enter velosity(pixels per second)"); final JTextField TF = new JTextField("00"); final Main M = new Main(); JButton B = new JButton("OK"); B.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { M.setChangeY(Integer.parseInt(TF.getText())); M.Done(); } }); P.add(L,BorderLayout.NORTH); P.add(TF,BorderLayout.WEST); } @Override public void actionPerformed(ActionEvent arg0) { } } thanks (and sorry if it's bothering you the lack of information)
tagged with: swing
has title: opening JFrame from applet
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24344527
upvote count: 0
has answer: http://stackoverflow.com/a/24362096
score: -1
tagged with: awt
answer count: 3
tagged with: applet
favorite count: 0

http://stackoverflow.com/comment/37581172
comment on: http://stackoverflow.com/q/24315047
has text: Here is what you are looking for - http://docs.oracle.com/javaee/6/tutorial/doc/bnabo.html. And this one is for Spring - http://stackoverflow.com/q/8708529/738746.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/37610125
type: Comment
type: QuestionComment
has text: This is an SWT component.
comment on: http://stackoverflow.com/q/24330317
score: 0

http://stackoverflow.com/q/24313668
accepted answer: http://stackoverflow.com/a/26410611
tagged with: menubar
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37621886
has answer: http://stackoverflow.com/a/26453946
type: AnsweredQuestion
tagged with: popup
has title: How can I access a GWT menubar popup panel / submenu?
tagged with: java
has answer: http://stackoverflow.com/a/26410611
possible better answer: http://stackoverflow.com/a/26453946
has comment: http://stackoverflow.com/comment/41398504
has comment: http://stackoverflow.com/comment/41588854
type: Question
tagged with: gwt
has comment: http://stackoverflow.com/comment/41490420
has body: I'm trying to add some mouse listeners to the sub menus/ cascading menus of GWT's MenuBar. Sadly, I cannot seem to access the submenu popuppanel directly - the method to do so (getPopup() ) is private. And you can't access it via reflection due to the way GWT compiles. Adding a mouse listener to the main menu bar (to detect when the mouse is inside the menu bar boundaries) was nice and simple. But I can't figure out any way to add a mouse listener to tell when the mouse is inside one of the cascading sub menus. What I am doing is this: com.google.gwt.user.client.ui.MenuBar myMainBar = new MenuBar(); myMainBar.addDomHandler(menuHoverOutHandler, MouseOutEvent.getType()); myMainBar.addDomHandler(menuHoverOverHandler, MouseOverEvent.getType()); This works great for the actual GWT MenuBar. When I mouse in, the mouseOverEvent triggers. When I mouse out, the MouseOutEvent triggers. The problem is that if I open a submenu from the main menubar, mousing into that menu will also trigger the MouseOutEvent. I need it not to do that. When I say submenu I mean something like the ones seen here: http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/MenuBar.html So as long as I'm in the 'main' bar that lists Style, Fruit, and Term, the mouse events recognize this. But if I drop down to the sub menu that says Bold, Italicized, More, the mouse events believe I have left the menu bar entirely. I need a way to determine if the mouse is inside one of these submenus. (Or that a submenu of this main menu bar is open somewhere) You cannot simply do myMainBar.getPopup() and add listeners to the resulting PopupPanel as getPopup is private. I'm looking for another way to get to MenuBar.popup It seems there is no method to tell if one of the sub menus is open, as well, which is a bit perplexing to me. There seems to be a frustrating lack of ability to interact with these submenus, and I am wondering if I am missing something.
has comment: http://stackoverflow.com/comment/40147667
upvote count: 5
tagged with: submenu
has comment: http://stackoverflow.com/comment/37583815
has comment: http://stackoverflow.com/comment/41615442
answer count: 2
score: 5

http://stackoverflow.com/q/24396008
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/48081483
has title: Spring-ws @Endpoint/@PayloadRoot based configuration giving 404
tagged with: soap
favorite count: 0
type: UnansweredQuestion
tagged with: web-services
tagged with: spring
upvote count: 9
tagged with: spring-ws
tagged with: java
has answer: http://stackoverflow.com/a/24397196
has body: Really stumped on this one - trying to utilize Spring-ws's @Endpoint and @PayloadRoot to automagically stand up some WSDL endpoints, but I keep getting a 404 (deploying into Tomcat 7.0.54). I've scoured this thing looking for naming inconsistencies (seems to be the most common cause of problems), but am finding nothing! pom.xml: org.springframework.ws spring-ws-core 1.5.2 org.springframework.ws spring-ws-core-tiger 1.5.2 log4j log4j 1.2.9 org.codehaus.castor castor 1.2 Web.xml: weather org.springframework.ws.transport.http.MessageDispatcherServlet 1 weather /* weather-servlet.xml <?xml version="1.0" encoding="UTF-8"?> temperature.xsd <?xml version="1.0" encoding="UTF-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://nick.com/weather/schemas" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="GetTemperaturesRequest"> <xs:complexType> <xs:sequence> <xs:element type="xs:string" name="city"/> <xs:element type="xs:date" name="date" maxOccurs="5" minOccurs="1"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="GetTemperaturesResponse"> <xs:complexType> <xs:sequence> <xs:element name="TemperatureInfo" maxOccurs="5" minOccurs="1"> <xs:complexType> <xs:sequence> <xs:element type="xs:float" name="min"/> <xs:element type="xs:float" name="max"/> <xs:element type="xs:float" name="average"/> </xs:sequence> <xs:attribute type="xs:string" name="city" use="optional"/> <xs:attribute type="xs:date" name="date" use="optional"/> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> TemperatureMarshallingEndpoint.java: package com.nick.example.weather; import org.springframework.ws.server.endpoint.annotation.Endpoint; import org.springframework.ws.server.endpoint.annotation.PayloadRoot; import java.util.List; @Endpoint public class TemperatureMarshallingEndpoint { private static final String namespaceUri = "http://nick.com/weather/schemas"; private WeatherService weat…
type: Question
score: 9

http://stackoverflow.com/q/24409496
tagged with: jsp
has comment: http://stackoverflow.com/comment/37764469
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37760598
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37763337
has comment: http://stackoverflow.com/comment/37760915
tagged with: eclipse
has answer: http://stackoverflow.com/a/24410055
has title: Eclipse and JSP typing speed
score: 0
has comment: http://stackoverflow.com/comment/37763529
has body: I have read here about eclipse standard JSP validation plugin having performance issues, but I could not find a working solution. I've unticked all relevant options for my project and even restarted the IDE to see if that works, but I'm still typing with 1 character per second. Am I the only one who still experiences the problem after disabling JSP validation? Alternatively can you recommend me a different eclipse editor/plugin that does the job better?
answer count: 1

http://stackoverflow.com/comment/37651657
has text: @JBNizet I meant reference names.
comment on: http://stackoverflow.com/q/24351982
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37508424
comment on: http://stackoverflow.com/q/24276657
score: 0
type: Comment
type: QuestionComment
has text: you could turn the array into a string and use the regex `(.)\1+`

http://stackoverflow.com/q/24309861
score: -1
upvote count: 2
linked to: http://stackoverflow.com/q/1137884
downvote count: 3
favorite count: 0
has title: Are there any detailed instructions for how to use css-validator.jar?
has body: I am trying to use the local version of css-validator, but can't seem to get it to work. I think everything is set up correctly, but whenever I run it with the command given as an example by w3c, it gives errors. Some people say I am missing something in my path or something like that, but I am not sure which path they are talking about (build path or environmental variables), and I don't know what exactly needs to be put into this path either. I have looked for detailed instructions, but the most detailed instruction I found was that it needed to be in lib (which lib, I see hundreds of them). For reference, here is the documentation of css-validator.jar that I have found so far (which is not much, consisting of nothing but a command to run in cmd prompt): http://jigsaw.w3.org/css-validator/DOWNLOAD.html This is the part most relevant from there: Note : the css-validator.jar file must be located at the exact same level as the lib/ folder to work properly. Also, I tried using the jcabi.w3c wrapper(which I thought it said it only needed one dependency, but another website said it needed more, including glassfish jersey-core), but it talks about all these dependencies that I don't know where to put them (its xml, but it doesn't seem to match an Ivy document) and many I don't even have or know how to set up. The w3c wrapper simply says "No main in selection" when I try to run it (which is a message I have never even seen before in cmd). So how do I get this thing working? Where is the documentation (more than 3 lines that W3C provides please,)? Also, the error I am getting when trying to use css-validator.jar: C:\Users\burnjc\Downloads&gt;java -jar css-validator.jar http://www.w3.org/ Exception in thread "main" java.lang.NoClassDefFoundError: org/w3c/tools/resourc es/ProtocolException at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2531) at java.lang.Class.getMethod0(Class.java:2774) at java.lang.Class.getMet…
answer count: 0
type: UnansweredQuestion
tagged with: java
type: Question
duplicate of: http://stackoverflow.com/q/24274483

http://stackoverflow.com/a/24303720
has body: You can use a ListSelectionListener on your JTable which sets the text of the JTextField elements based on the current selection in your JTable. When the delete button is pressed, you can have the ActionListener remove the selected row from the JTable and force the next selection in the model via setRowSelectionInterval. Below is a simple example: import java.awt.*; import java.awt.event.*; import javax.swing.border.*; import javax.swing.event.*; import javax.swing.table.*; import javax.swing.*; public class JTableDelete extends JFrame { private static final long serialVersionUID = 1L; private JPanel contentPane; private JTable table; private JTextField textField; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { JTableDelete frame = new JTableDelete(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public JTableDelete() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); table = new JTable(); table.setModel(new DefaultTableModel(new Object[][] { { "Red" }, { "Green" }, { "Blue" }, { "Violet" }, { "Orange" }, }, new String[] { "Colors" })); ListSelectionModel cellSelectionModel = table.getSelectionModel(); cellSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); cellSelectionModel.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { int selectedRow = table.getSelectedRow(); int selectedColumn = table.getSelectedColumn(); if (selectedRow != -1 &amp;&amp; selectedColumn != -1) textField.setText((String) table.getValueAt(selectedRow, selectedColumn)); else textField.setText(""); } }); contentPane.add(table, BorderLayout.CENTER); JButton btnDelete = new JButton("Delete"); btnDelete.addActionListener(new ActionListener() { @Override public void actionPerformed(Actio…
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24303046
accepted answer of: http://stackoverflow.com/q/24303046
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/37647359
type: Comment
has text: @NickJ Sorry, I don't wanted to code the whole class here with this poor "editor" :-)
comment on: http://stackoverflow.com/a/24349809
score: 0
type: AnswerComment

http://stackoverflow.com/a/24417152
has body: A time like 2014-06-25T12:50:31Z is in UTC (that's the Z at the end), so it may be off according to your time zone.
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24416947
accepted answer of: http://stackoverflow.com/q/24416947
type: Answer

http://stackoverflow.com/a/24274111
type: Answer
has comment: http://stackoverflow.com/comment/37503749
upvote count: 15
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24273994
has comment: http://stackoverflow.com/comment/37503984
answers question: http://stackoverflow.com/q/24273994
score: 15
has body: The formula for single precision following the IEEE standard is: (-1)^sign + 1.Mantissa x 2^(Exponent - Bias) So 5.3 base 10 is 101.0100110011001100110011 base 2 101.0100110011001100110011 = 1.010100110011001100110011 * 2^2 2^2 = 2^(exp - bias) having bias = 127 (according to the IEEE standard for single precision) so: exp - 127 = 2 => exp = 129 base 10 or 10000001 base 2 Single precision table: 0 | 10000001 | 01010011001100110011001 Sign = 0 Exp = 129 Mantissa = 2726297
has comment: http://stackoverflow.com/comment/37504126
has comment: http://stackoverflow.com/comment/37504201
type: AcceptedAnswer

http://stackoverflow.com/comment/37583024
score: 0
type: AnswerComment
has text: @NathanHughes i did the same but result prints after b finished run. how can i confirm the notify gets called.
type: Comment
comment on: http://stackoverflow.com/a/24315454

ocpjp
tags question: http://stackoverflow.com/q/24298905
tag name: ocpjp
type: Tag

http://stackoverflow.com/q/24407433
answer count: 1
score: 0
tagged with: powermock
has body: I need to write tests for MyClass class. public class MyClass { public Result&lt;Data&gt; get() { return Request .buildRequest(session, Data.class, new DefaultErrorHandler()) .executeAndConvert(); } } My Request class public class Request&lt;Type&gt; implements RequestBuilder&lt;Type&gt; { public static &lt;T&gt; Request&lt;T&gt; buildRequest(String session, Class&lt;T&gt; responseClass) { return buildRequest(session, responseClass, null); } public static &lt;T&gt; Request&lt;T&gt; buildRequest(String session, Class&lt;T&gt; responseClass, ErrorHandler errorHandler) { Request&lt;T&gt; request = new Request&lt;T&gt;(session, responseClass); // some logic return request; } @Override public Result&lt;Type&gt; executeAndConvert() { Invocation.Builder req = buildRequest(); return executeRequest(req); } // some other code } Here is my code for test PowerMockito.mockStatic(Request.class); PowerMockito.when(Request.buildRequest(sessionMock, Data.class)).thenReturn(requestMock); myClass.get(); // which is return a Request object I want to disable Request constructor invocation because I get NPE when in firing inside. Actually I don't need to invoke all methods inside of constructor or in chain of methods. I 'm just need to return a mocked Result.
has comment: http://stackoverflow.com/comment/37776703
has title: How can I disable constructor execution in Mockito/PowerMock?
type: UnansweredQuestion
tagged with: unit-testing
tagged with: java
has answer: http://stackoverflow.com/a/45217876
type: Question
has comment: http://stackoverflow.com/comment/37756452
tagged with: mockito

http://stackoverflow.com/q/24304203
score: 0
has body: I am new in Java EE. So I cannot find the solution! Could you anybody figure out? Session Bean: package services; import javax.ejb.Stateless; import javax.ejb.LocalBean; @Stateless @LocalBean public class HelloService { public String getHelloString() { return "Hello"; } } Managed bean: package beans; import javax.ejb.EJB; import javax.inject.Named; import javax.enterprise.context.RequestScoped; import services.HelloService; @Named(value = "helloBean") @RequestScoped public class HelloBean { @EJB private HelloService helloService; private String hello; public HelloBean() { } public String getHello() { hello = helloService.getHelloString(); return hello; } public void setHello(String hello) { this.hello = hello; } } index.xhtml <?xml version='1.0' encoding='UTF-8' ?> <h:head> Facelet Title </h:head> <h:body> <h:outputText value="#{helloBean.hello}"/> </h:body> POM.xml of web module: <?xml version="1.0" encoding="UTF-8"?> 4.0.0 HRM iqbal 1.0-Snapshot iqbal HRM-web 1.0-Snapshot war HRM-web <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> org.primefaces primefaces 3.5 commons-fileupload commons-fileupload 1.3 ${project.groupId} HRM-ejb 1.0-Snapshot provided javax javaee-api 7.0 provided org.apache.maven.plugins maven-compiler-plugin 3.1 1.7 1.7 ${endorsed.dir} org.apache.maven.plugins maven-war-plugin 2.3 false org.apache.maven.plugins maven-dependency-plugin 2.6 validate copy ${endorsed.dir} true javax javaee-endorsed-api 7.0 jar http://repository.primefaces.org/ PrimeFaces-maven-lib default Repository for library PrimeFaces-maven-lib But in index.xhtml there is no output! Maven is build successfully and the page has been opened in browser. But no output!
has comment: http://stackoverflow.com/comment/37651605
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/37570145
answer count: 0
tagged with: java
tagged with: ejb-3.1
type: Question
tagged with: jakarta-ee
has title: No output is displaying from Session Bean via Managed bean to JSF page
tagged with: jsf-2.2

http://stackoverflow.com/q/24270025
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37511519
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: jaxb
has comment: http://stackoverflow.com/comment/37511428
has title: Generate dynamic xml file through jaxB
downvote count: 0
has comment: http://stackoverflow.com/comment/37536041
favorite count: 0
tagged with: struts2
has comment: http://stackoverflow.com/comment/37495767
tagged with: http://stackoverflow.com/tag/xml
has body: I want to generate this below mentioned xml file from my multiple action classes in struts2. I perform multiple below mentioned operations from my Struts 2 action classes and adding them in single existing xml file. 1) Adding news in xml file 2) Adding footer info in xml file 3) Adding agency info in xml file. <?xml version="1.0" encoding="UTF-8" standalone="yes"?> Ministry of Games http://www.abc.gov. 22/Apr/2014 How do I clear my web browsers cache, cookies, and history? images/header.jpg All rights reserved. images/logo1.jpg images/logo2.jpg I am using JaxB. When i am performing this different-different actions, my xml file is appended with that info but issue is tag name is same when it stored in xml file. Tag name must be looks like above mentioned xml file. When i update news information all tag name is changed as . So please any one help me to get this xml format through JaxB. Its my Java Code below package com.ocr.nsw.xml; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; @XmlRootElement(name = "agencylink") @XmlAccessorType(XmlAccessType.FIELD) @XmlSeeAlso({ Agency.class, AgencyNews.class, HeaderLogo.class, FooterText.class, ALoginLogo.class, AHeaderLogo.class }) public class AgencyLink { @XmlElement(name = "agencyNews") private List adate; @XmlElement(name = "agencyNews") private List anews; @XmlElement(name = "agency") private List atitle; @XmlElement(name = "agency") private List aurl; @XmlElement(name = "footerText") private List aftxt; @XmlElement(name = "headerLogo") private List headerLogoImg; @XmlElement(name = "aLoginLogo") private List loginLogoImg; @XmlElement(name = "aHeaderLogo") private List aHeaderLogoImg; } _____ public static void xmlWrite(List list, String filePath) { AgencyLink age…
has comment: http://stackoverflow.com/comment/37505153
answer count: 0

http://stackoverflow.com/q/24363689
has body: I'm upgrading my gradle wrapper from 1.0.3 milestone to 1.12. I was curious whether the cache directory is still under USER_HOME/.gradle/cache. How can I find out what is the cache directory? Thanks.
tagged with: build
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/24410968
tagged with: java
upvote count: 1
tagged with: gradle
type: Question
has title: Gradle 1.12 cache
downvote count: 0
accepted answer: http://stackoverflow.com/a/24410968
answer count: 1
favorite count: 0

http://stackoverflow.com/q/24346193
upvote count: 6
tagged with: java
linked to: http://stackoverflow.com/q/22905187
type: Question
has answer: http://stackoverflow.com/a/52506913
downvote count: 0
has body: I am having trouble installing the ME platform for Netbeans 8.0 - I have: Installed Netbeans IDE 8.0 Installed jmesdk-3.4 Installed the jmesdk-3.4 plugin &amp; activated it in Netbeans When I try to create a New Java ME > Mobile application project I get a warning saying No Java ME Platform found. Please add at least one When i try to add the java platform by locating the jmesdk-3.4 folder, it tells me no platform was detected automatically(failed) and it requires me to add manually.But adding it manually just creates more confusion. need help please.
answer count: 3
favorite count: 0
tagged with: netbeans
has answer: http://stackoverflow.com/a/53509946
type: UnansweredQuestion
score: 6
has answer: http://stackoverflow.com/a/24347772
has title: Adding Java ME platform in netbeans 8.0

http://stackoverflow.com/comment/37686821
type: Comment
comment on: http://stackoverflow.com/a/24370088
score: 1
type: AnswerComment
has text: @eis: No, you should of course not have to specify the character encoding when reading an XML file. The character encoding is specified in the XML header and the parser will use whatever encoding is specified in the XML file itself. Specifying the encoding can be useful if you e.g. get the XML stream from a network connection and the encoding is specified using an HTTP header, but *not* when reading an XML file from disk.

http://stackoverflow.com/a/24376773
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: This looks like it would throw a NPE if you don't include a mode parameter. String mode=request.getParameter("mode"); // This returns null if mode isn't set. request.setAttribute("att1", mode); if(mode.equalsIgnoreCase("edit")) // You can't call methods on a null object. You could check if mode is null before comparing it to "edit" or just swap mode/"edit" since "edit" will never be null if("edit".equalsIgnoreCase(mode))
answers question: http://stackoverflow.com/q/24376192
type: Answer
accepted answer of: http://stackoverflow.com/q/24376192

geotools
type: Tag
tags question: http://stackoverflow.com/q/24327420
tags question: http://stackoverflow.com/q/24384157
tag name: geotools

http://stackoverflow.com/comment/37559021
comment on: http://stackoverflow.com/q/24303486
has text: Can you elaborate what you want to do? Do you have Strings with the new values? Where do you know where they have to go?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24381283
tagged with: java
has comment: http://stackoverflow.com/comment/37709078
has comment: http://stackoverflow.com/comment/37708225
type: Question
has answer: http://stackoverflow.com/a/24398532
answer count: 2
has answer: http://stackoverflow.com/a/24382843
score: 0
has comment: http://stackoverflow.com/comment/37708526
tagged with: google-app-engine
has body: Query q = new Query("Employees"); q.addFilter("is_active", FilterOperator.EQUAL, isActive); q.addSort("first_name", SortDirection.ASCENDING); and Employees employee = ofy().load().type(Employees.class).id("123").get(); These type of queries are used for retrieve data from datastore, but i can't get the recent updates.
has comment: http://stackoverflow.com/comment/37709270
type: UnansweredQuestion
has title: How to implement ancestor or any other way to retrieve recent updates in Google App engine (Java)? I have to use single entity only..,

http://stackoverflow.com/comment/37545570
type: QuestionComment
has text: Why do you want to do this? If you don't know which Enum class it is in advance, how do you expect to use it?
comment on: http://stackoverflow.com/q/24296059
type: Comment
score: 1

http://stackoverflow.com/q/24303564
has title: How to retrieve id from sqlite database from selected spinner item in ANdroid?
tagged with: java
has comment: http://stackoverflow.com/comment/37559655
has comment: http://stackoverflow.com/comment/37560247
has comment: http://stackoverflow.com/comment/37559447
type: Question
has comment: http://stackoverflow.com/comment/37562112
score: 0
has body: I want to retrieve selected spinner item id from Sqlite database in Android.When i want to select any spinner item at that time i want to get that get id that spinner item which is i have to select.Thanks in Advanced. Here is my code spinnerProjectNames = (Spinner)findViewById(R.id.spinnerSelectProject); loadProjectsNameSpinnerData(); spinnerProjectNames.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub selectedProjectName = spinnerProjectNames.getSelectedItem().toString().trim(); System.out.println("selectedProjectName " + selectedProjectName); Cursor mCursor = db.rawQuery("SELECT project_id FROM project WHERE project_name= '"+selectedProjectName+"'" , null); if (mCursor != null ) { { mCursor.moveToFirst(); int projectId=mCursor.getInt(0); String strProjectId = String.valueOf(projectId); System.out.println("strProjectId = " + strProjectId); } } } @Override public void onNothingSelected(AdapterView&lt;?&gt; arg0) { // TODO Auto-generated method stub } });
tagged with: sqlite
has comment: http://stackoverflow.com/comment/37560013
answer count: 0
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/37692764
type: QuestionComment
comment on: http://stackoverflow.com/q/24373577
has text: Can you share the sample code that you are trying? use a `flag` as boolean to come out of `run` method. If run method is finished then thread is automatically closed. Rest depends on your code.
score: 0
type: Comment

http://stackoverflow.com/comment/37532711
type: AnswerComment
type: Comment
has text: Thanks for your answer.. but I need output as an integer value `0.04`.. how can I achieve?
score: 0
comment on: http://stackoverflow.com/a/24289469

http://stackoverflow.com/q/24345920
tagged with: maven
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/24350039
tagged with: gwt
tagged with: java
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/24350039
has body: Since GWT works strictly on Java source code, and Annotation Processors / JSR 269 generate also Java source code, would there be a way, in Maven, to have javac process the files, using the Annotation Processors, and save the generated Java source code somewhere, such that GWT can then use it itself, saving the work of reproducing the Annotation Processors implementation in a GWT generator? According to this question, assuming the answer is still relevant, it would be best to use the maven-processor-plugin to process annotations. The documentations says that you can specify an "outputDirectory". And this question says you should use the copy-resources goal of the maven-resources-plugin to make the source available to GWT. Assuming all of this is right, my question is: how do you tell Maven, that it should compile the code with javac, and run the other (maven-processor-plugin / maven-resources-plugin) plugins before running the "GWT Maven Plugin"? (Or would that always, for some reason, happen in that order anyway?)
favorite count: 0
linked to: http://stackoverflow.com/q/6512638
type: AnsweredQuestion
has title: Could I use Java 6 Annotation Processors / JSR 269 to produce code for GWT in Maven?
score: 1
linked to: http://stackoverflow.com/q/12822087

remote-debugging
tag name: remote-debugging
type: Tag
tags question: http://stackoverflow.com/q/24360688

http://stackoverflow.com/q/24414469
has comment: http://stackoverflow.com/comment/37769338
has body: String Index Out Of Range: -1 is the error I get when I execute this code in my mapper in hadoop MR. String line = value.toString(); String[] longLatArray = line.split(","); double lat = Double.parseDouble((longLatArray[0]).substring(1)); line looks like this: "(-21.24132363125682,-175.14134768396616,1)" My aim is to remove the first "(" and get just -21.2873623 into my lat variable. edit: When I tried to debug in the hadoop interface, this is what I got: attempt_201406251613_0002_m_000000_0: line: (-21.24132363125682,-175.14134768396616,1) attempt_201406251613_0002_m_000000_0: index 0 attempt_201406251613_0002_m_000000_0: (-21.24132363125682 attempt_201406251613_0002_m_000000_0: index 1 attempt_201406251613_0002_m_000000_0: -175.14134768396616 attempt_201406251613_0002_m_000000_0: index 2 attempt_201406251613_0002_m_000000_0: 1) When I executed very similar code just locally, I did not get any errors Also, what is the significance of the -1 here? Any help would be greatly appreciated!
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24414534
possible better answer: http://stackoverflow.com/a/24414986
tagged with: emr
tagged with: java
has answer: http://stackoverflow.com/a/24414986
accepted answer: http://stackoverflow.com/a/24414534
type: Question
tagged with: hadoop
answer count: 2
has title: String Index Out Of Range: -1 error
score: 0

http://stackoverflow.com/comment/37504376
type: Comment
type: QuestionComment
has text: You should probably be doing common setup (like determining the `mainId` value) in a pre-test method annotated with `@Before`.
comment on: http://stackoverflow.com/q/24274421
score: 1

http://stackoverflow.com/comment/37739088
has text: None of the code you provided should write to a file. We need to see the portion which is supposed to write to a file.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24397901
type: QuestionComment

http://stackoverflow.com/comment/37787819
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24423598
has text: Please write a class (say `ClassC`) that compiles and extends the two classes (`ClassA` and `ClassB`) and post it.

http://stackoverflow.com/comment/37574355
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24311061
has text: @Barnabe - I have flagged the question and asked a moderator to migrate it. They will take it from here. :)
score: 0

http://stackoverflow.com/comment/37631418
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24341768
score: 1
has text: Also, as a side note - Name your `Type`s with BlockCaseLikeThis, not camelCaseWordJoint. Semantics and makes your code more reusable :)

http://stackoverflow.com/comment/37681463
type: Comment
has text: I dont follow up. Where do you want to put this methods? I assume in **A** cause of AsGroup. I can't remove **A** from AsGroup because its holding **AsGroup** not A . So how this fix me issue? I still have to return modifiable set in **A** in order to add group in **AsGroup** methods.
type: AnswerComment
comment on: http://stackoverflow.com/a/24367471
score: 0

http://stackoverflow.com/a/29909059
score: 0
answers question: http://stackoverflow.com/q/24295197
type: Answer
has body: This is no problem with matching varargs. The only limitation is that you have to specify each individual array entry as a matched argument. I have updated your code below to show what I mean. I created a second objectArray2 to make the point clearer. All tests pass: @RunWith(MockitoJUnitRunner.class) public class UnitTest { private Object[] objectArray; private Object[] objectArray2; private List&lt;Object&gt; expected; private TestTarget target; private Object obj,obj2; @Before public void setUp() { obj = new Object(); obj2 = new Object(); objectArray = new Object[]{ obj }; objectArray2 = new Object[]{ obj, obj2 }; expected = Arrays.asList(new Object(), new Object()); target = Mockito.spy(new TestTarget()); } @Test public void testMakeList() { // this pass as eq works well with normal array doReturn(expected).when(target).toList(Mockito.eq(objectArray)); Assert.assertEquals(expected, target.makeList(objectArray)); } @Test public void testMakeList1() { // since objectArray has one entry you need to add one matching argument doReturn(expected).when(target).toList1(Mockito.eq(obj)); Assert.assertEquals(expected, target.makeList1(objectArray)); } @Test public void testMakeListWithAryEq() { // since objectArray2 has two entries you need to add two matching arguments doReturn(expected).when(target).toList1(Mockito.eq(obj),Mockito.eq(obj2)); Assert.assertEquals(expected, target.makeList1(objectArray2)); } private class TestTarget { public List&lt;Object&gt; makeList(Object[] objects) { return toList(objects); } public List&lt;Object&gt; makeList1(Object[] objects) { return toList1(objects); } protected List&lt;Object&gt; toList(Object[] objs) { return null; // Not implemented "Intentionally" } protected List&lt;Object&gt; toList1(Object... objs) { return null; // Not implemented "Intentionally" } } }

http://stackoverflow.com/q/24298748
tagged with: database
tagged with: resultset
accepted answer: http://stackoverflow.com/a/24303171
answer count: 1
downvote count: 0
has title: Getting Jena Resultset after closing query - for modularity
favorite count: 0
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java
has body: I have the following situation: Class B has a method that receives a String with a query, executes it and return the Resultset. Class A creates a SPARQL query and calls the method in Class B. The problem is, when Class A gets the Resultset object back, it is empty! Of course because the Query is closed in Class B (see jena.query.ResultSet and jena.query.QuerySolution: empty iterator after SPARQL request). My question is, how can this be made modular at all? I want to have a Class B that only executes SPARQL queries, without having to know about the result structure or anything. And I want Class B to deal with the query creation and the query closing, because it makes no sense that Class A does it. Class B: try { Query query = QueryFactory.create(myQuery); qe = QueryExecutionFactory.create(query, ontology); ResultSet results = qe.execSelect(); return results; } catch (...){ ... } finally { ... qe.close(); }
has answer: http://stackoverflow.com/a/24303171
linked to: http://stackoverflow.com/q/15698578
type: Question
tagged with: jena

http://stackoverflow.com/comment/37672800
type: QuestionComment
comment on: http://stackoverflow.com/q/24362944
has text: @JonSkeet Yes, I plan to introduce packages later on, but want to run and test the unchanged source first. If the answer is, gradle can't do it, I might skip this step.
score: 0
type: Comment

http://stackoverflow.com/a/24276806
has body: Changing props.setProperty("mail.store.protocol", "imaps"); to props.setProperty("mail.store.protocol", "imap"); resolved the issue
answers question: http://stackoverflow.com/q/24276191
downvote count: 0
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/92475736
upvote count: 6

http://stackoverflow.com/q/24280706
has answer: http://stackoverflow.com/a/24280797
type: AnsweredQuestion
score: 2
downvote count: 0
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/24280797
has body: I work on a Eclipse Plugin which have two TreeViewer, one of them with the parameter SWT.RIGHT_TO_LEFT. This looks like this: As you see the Tree Structure is drawn from right to left and that is what i need. But and here is my problem, the Text gets also inverted but only when special characters are in the string. PID.5.7 is transformed to 7.5.PID. Here is how i create TreeViewer and the Text: xmlTreeOut = new TreeViewer(composite, SWT.RIGHT_TO_LEFT | SWT.DOUBLE_BUFFERED); ... xmlTreeOut.getTree().addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { //loop over treeItems and for each ... TextLayout textLayout = new TextLayout(Display.getDefault()); textLayout.setText(xmlName + xmlValue); textLayout.draw(event.gc, root.getBounds().x + 2, root.getBounds().y + 1); ... } }); Does anyone have a fix for this problem? I would like to have my String exactly as I write it in the TextLayout. EDIT: I added the mentioned textLayout.setOrientation(SWT.RIGHT_TO_LEFT); Now my output is like this: As you can see it worked for Strings like PID.7.5 but if there are Strings seperated with space and only containing special characters its inversed. Like "MSH.1 |" becomes "| MSH.1" (removed the Style2 and use only one style in TextLayout) EDIT 2: WORKAROUND SOLUTION: I test now if my String starts with a "word" which has no a-z, A-Z I simply add a "x" with StyleColor = WHITE in front. This way all values are displeyed correctly.
has title: Java TreeViewer SWT.RIGHT_TO_LEFT
tagged with: jface
upvote count: 2
tagged with: swt
answer count: 1
tagged with: treeviewer
tagged with: java

http://stackoverflow.com/comment/37783656
comment on: http://stackoverflow.com/q/24414652
has text: It seem you are asking two duplicate questions, [here](http://stackoverflow.com/questions/24285544/android-volley-http-request-custom-header) is your previous question and you accepted an answer, why you still ask this?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37610829
type: QuestionComment
comment on: http://stackoverflow.com/q/24330140
has text: So what's the problem in having two String pointers in a single object?
score: 0
type: Comment

http://stackoverflow.com/comment/37739380
score: 0
type: AnswerComment
has text: I've never seen this before and it seems to have no effect. I'll keep it in mind though. It might be part of the puzzle.
type: Comment
comment on: http://stackoverflow.com/a/24338138

http://stackoverflow.com/a/24267150
upvote count: 5
score: 5
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24267082
downvote count: 0
has body: you can try this : requestWindowFeature(Window.FEATURE_NO_TITLE); Note that this has to be called before setContentView(XYZ_xml) There are other Window Features too, like no action bar and no title etc. See the javadoc for more help you can also add this to work with xml like this : android:theme="@android:style/Theme.NoTitleBar
type: Answer
has comment: http://stackoverflow.com/comment/37490201
has comment: http://stackoverflow.com/comment/37491418
has comment: http://stackoverflow.com/comment/37491445
accepted answer of: http://stackoverflow.com/q/24267082
has comment: http://stackoverflow.com/comment/37491533

http://stackoverflow.com/q/24403691
score: 1
accepted answer: http://stackoverflow.com/a/24403839
has comment: http://stackoverflow.com/comment/37750311
has comment: http://stackoverflow.com/comment/37758477
answer count: 2
tagged with: maven
upvote count: 1
tagged with: java
tagged with: gradle
has answer: http://stackoverflow.com/a/24403839
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has body: I am writing a Java library right now that I publish as a Maven artifact and use in a different Java/Groovy project. I was wondering whether in general it is a good idea to write a library that depends on a certain version of Groovy (e.g. has a dependency on groovy-all-2.x.y). The discomfort of just using Java in the library would not be too bad. What do you think? Should I better use a generous version range for the Groovy dependency? Should I rather write a plain Java library?
tagged with: groovy
type: Question
has title: Is writing a library with a dependency on Groovy a good idea?
possible better answer: http://stackoverflow.com/a/24403825
has answer: http://stackoverflow.com/a/24403825

http://stackoverflow.com/a/24344592
accepted answer of: http://stackoverflow.com/q/24344557
answers question: http://stackoverflow.com/q/24344557
type: Answer
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/37637152
has body: return ...; means "evaluate ... and exit the function, making the resulting value the function's return value." So let's break it down: this.x==e.x == is an equality operator. That line checks to see if this.x is equal to e.x (and this.y==e.y does the same for the ys). Let's call the result of the x check xResult and the result of the y check yResult. Next, we have &amp;&amp;: xResult &amp;&amp; yResult &amp;&amp; is a boolean "AND" operator (the spec calls it a "Conditional-And operator"): It's true if both of its operands are true, false if either of them is false. So the function will return true if both conditions are true, false if either condition is false. Side note: As chrylis points out in a comment, there's another way the function could terminate: Something called an exception. The first line of the function, Estado e = (Estado) x;, might "throw" (cause) an exception if the argument passed into the function does refer to an object, but the object isn't an Estado object (so the "cast" (Estado)x is invalid); the line you asked about might throw an exception if the argument passed into the function is null (doesn't refer to any object). When an exception is thrown within a function and not "caught" by code in the function, the function stops running but not via a return statement.
has comment: http://stackoverflow.com/comment/37637292
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24320886
tagged with: java
tagged with: javascript
linked to: http://stackoverflow.com/q/29081290
answer count: 1
downvote count: 0
favorite count: 0
has title: How to generate HTML UI(Firebug show) using .HAR file
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24383923
tagged with: har
score: 2
has body: Is there any open source utility in which I can input any .HAR files and can get output like firebug shows. I have created .HAR file using Phantom.js, now I want to represent content of .HAR file to end user using .HTML files
upvote count: 2
type: Question
tagged with: phantomjs

http://stackoverflow.com/comment/37745511
type: Comment
type: QuestionComment
has text: I never used `System.exit(0);` at the last line of the main method.
score: 1
comment on: http://stackoverflow.com/q/24401621

http://stackoverflow.com/a/24371787
has comment: http://stackoverflow.com/comment/37692658
has comment: http://stackoverflow.com/comment/37691739
score: 1
has body: 2000 per hour is ~ 0.55 per second. You should be able to handle that rate on a mobile phone running as your server (assuming the requests are not complex) if you need to handle up to 100K connections and over one billion requests per hour, TCP is likely to be fine. If you want much more than this you could use UDP, or buy a second server. More servers is likely to be much simpler ;) Note: your database and/or your network bandwidth is likely to be max-ed out long before your TCP server will be.
answers question: http://stackoverflow.com/q/24371700
has comment: http://stackoverflow.com/comment/37689725
downvote count: 0
has comment: http://stackoverflow.com/comment/37695947
type: Answer
has comment: http://stackoverflow.com/comment/37691316
upvote count: 1

http://stackoverflow.com/a/24330543
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37613192
type: Answer
accepted answer of: http://stackoverflow.com/q/24329923
answers question: http://stackoverflow.com/q/24329923
has comment: http://stackoverflow.com/comment/37612174
has body: Try to process each stream only once so use one main input document and one parameter, then, assuming your XSLT processor supports parameters of type source (like Saxon 9 does), use import java.io.StringReader; import java.io.StringWriter; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; public class Test2014062001 { final static String sourceXml1 =" \r\n" + " \r\n" + " John Family \r\n" + " asfasd \r\n" + " \r\n" + " "; final static String sourceXml2 = " \r\n" + " \r\n" + " John \r\n" + " NYC \r\n" + " \r\n" + " "; final static String xsl = "<xsl:stylesheet version=\"2.0\"\r\n" + "xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\r\n" + "\r\n" + "<xsl:param name=\"doc2\" />\r\n" + "\r\n" + " <xsl:template match=\"/\">\r\n" + " \r\n" + " \r\n" + " <xsl:value-of select=\"system-property('xsl:vendor')\"/> \r\n" + " \r\n" + " <xsl:for-each select=\"languages-list/language\">\r\n" + " <xsl:variable name=\"pos\" select=\"position()\"/>\r\n" + " \r\n" + " <xsl:value-of select=\"family\"/> \r\n" + " <xsl:value-of select=\"users\"/> \r\n" + " <xsl:value-of select=\"$doc2/languages-list/language[$pos]/name\"/> \r\n" + " <xsl:value-of select=\"$doc2/languages-list/language[$pos]/region\"/> \r\n" + " \r\n" + " </xsl:for-each>\r\n" + " \r\n" + " \r\n" + " \r\n" + " </xsl:template>\r\n" + "</xsl:stylesheet> "; public static void main(String[] args) { System.out.println(sourceXml1 + "\n=======\n" + sourceXml2+"\n=======\n"+xsl); try { StreamSource stream1 = new StreamSource(new StringReader(sourceXml1)); StreamSource stream2 = new StreamSource(new StringReader(sourceXml2)); StringReader xslReader = new StringReader(xsl); StringWriter writer = new StringWriter(); TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(new StreamSource(xslReader)); // style sheet transformer.setParameter("do…
has comment: http://stackoverflow.com/comment/37611225
has comment: http://stackoverflow.com/comment/37611522

http://stackoverflow.com/comment/37672401
type: AnswerComment
has text: That usual design you mention would be a monitor, right?
type: Comment
comment on: http://stackoverflow.com/a/24362484
score: 0

http://stackoverflow.com/comment/37607384
score: 1
type: AnswerComment
has text: As a side note:``ScheduledExecutorService`` is to be preferred over ``Timer``: http://stackoverflow.com/questions/409932/java-timer-vs-executorservice
comment on: http://stackoverflow.com/a/24329031
type: Comment

http://stackoverflow.com/a/24274528
has comment: http://stackoverflow.com/comment/110061628
answers question: http://stackoverflow.com/q/24274364
has body: I am afraid this is not supported at the moment. And it might for the very same reason than the one explained in this issue: https://github.com/neo4j/neo4j/pull/1542. The idea behind parametrized queries is to re-use (cache) execution plans. If a node label or a relationship type varies, the execution plan wouldn't be the same at all, thus ruining the usefulness of execution plan caching.
upvote count: 11
type: Answer
score: 11
has comment: http://stackoverflow.com/comment/44450609
downvote count: 0

http://stackoverflow.com/comment/58997658
type: Comment
comment on: http://stackoverflow.com/a/24382185
has text: The linux solution is not really ideal as the user will see the 8080 address in their browser's address field. I would suggest using an AJP connector to Apache, or authbind.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37494334
type: Comment
type: QuestionComment
has text: If you killed the JVM, there is no way the threads are still running.
score: 1
comment on: http://stackoverflow.com/q/24269273

http://stackoverflow.com/comment/37600562
type: Comment
type: QuestionComment
has text: Yes, PHP does it for you (I think they are `public` by default).
comment on: http://stackoverflow.com/q/24325412
score: 0

http://stackoverflow.com/comment/50649462
comment on: http://stackoverflow.com/a/24426790
type: AnswerComment
score: 0
type: Comment
has text: Upgrading how ? Via the play store ?

http://stackoverflow.com/comment/37511694
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24278474
has text: it depends on use case, you check if you want to see if the item is already mapped, there is no specific answer to this unclear question

http://stackoverflow.com/comment/37560955
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24304091
has text: Can you add `System.out.println(RowAsList);` to the code (before the `sortList.add()`) and cut&paste the result into your question, please?

http://stackoverflow.com/comment/37733352
has text: I should have noted, I'm using a 32 byte key I just changed it for the sake of posting online. :\ Apologies for that.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24395156

http://stackoverflow.com/a/24387345
score: 1
answers question: http://stackoverflow.com/q/24387291
accepted answer of: http://stackoverflow.com/q/24387291
has comment: http://stackoverflow.com/comment/37719051
upvote count: 1
has body: No. About the best you can do (to answer the question as asked) is make the method protected and have a subclass of Validation which extends it. Then, if all the other methods are private, that object will only have the one protected one. It's kind of a bad situation, though. More than likely, if you're trying to do this, you're either trying to optimize for no reason or you have a bad design somewhere. e.g., public class Validation { private void method1() {} private void method2() {} protected void method3() {} private void method4() {} } ... public class RestrictedValidation extends Validation { } ... public static void main(String[] args) { RestrictedValidation validation = new RestrictedValidation(); validation.method1(); //compiler error validation.method2(); //compiler error validation.method3(); //success validation.method4(); //compiler error } But yeah. I can't think of a single valid use-case for this.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37718728
type: Answer
downvote count: 0

http://stackoverflow.com/comment/41129392
has text: To be clear, the synchronize must be used on every thread which uses that object.
comment on: http://stackoverflow.com/a/24336785
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24358356
answer count: 3
has answer: http://stackoverflow.com/a/24360404
tagged with: smartgwt
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24360311
tagged with: gwt
tagged with: java
has answer: http://stackoverflow.com/a/24358705
has title: Error in running GWT Map - Is the Maps key missing or invalid?
type: Question
has body: I am trying to integrate the gwt map into my SmartGWT app. But for some reason I am getting this error. Can somebody please help me to resolve it. I am using this link as my reference http://forums.smartclient.com/showthread.php?t=3366. the error i get is Uncaught exception escaped : java.lang.RuntimeException The Maps API has not been loaded. Is a tag missing from your host HTML or module file? Is the Maps key missing or invalid? See the Development console log for details. Register a GWT.setUncaughtExceptionHandler(..) for custom uncaught exception handling. //This is added in my module file and i am using Maps v2 API 1.1.1 &lt;inherits name='com.google.gwt.maps.GoogleMaps' /&gt; HomeViewImpl homePanel = new HomeViewImpl(); addTab(homePanel, "Home", "Home"); ============================================== public class HomeViewImpl extends VLayout { private MapWidget getMap() { /*MapWidget map = new MapWidget(); map.setSize("500px", "300px"); map.addControl(new LargeMapControl()); map.getInfoWindow().open(map.getCenter(), new InfoWindowContent(getMapInfoWindow())); return map;*/ LatLng cawkerCity = LatLng.newInstance(-22.82, -47.26); final MapWidget map = new MapWidget(); map.setScrollWheelZoomEnabled(true); map.addControl(new LargeMapControl()); map.addOverlay(new Marker(cawkerCity)); map.getInfoWindow().open(map.getCenter(), new InfoWindowContent("World's Largest Ball of Sisal Twine")); return map; } public Canvas getViewPanel() { HLayout hLayout = new HLayout(5); hLayout.addMember(new Label("Dummy Label in a Horizontal Layout")); // Add the map to the HTML host page hLayout.addMember(getMap()); return hLayout; } private Canvas getMapInfoWindow() { final TabSet topTabSet = new TabSet(); topTabSet.setTabBarPosition(Side.TOP); topTabSet.setWidth(200); topTabSet.setHeight(100); Tab tTab1 = new Tab("Blue"); HTMLPane tab1Pane = new HTMLPane(); tab1Pane.setContents("Hello. This sample shows a google map widget taking part in a SmartGWT Layout"); tTab1.setPane(tab1Pane);…
tagged with: google-maps
score: 0

http://stackoverflow.com/q/24320607
type: Question
upvote count: 4
answer count: 1
favorite count: 0
tagged with: regex
has comment: http://stackoverflow.com/comment/37591747
downvote count: 3
has answer: http://stackoverflow.com/a/24320737
has body: I am new to regular expression, Am finding empty IF statements by using this if[\\s]*\\([^\\)]*\\)[\\s]*\\{((/\\*(.|[\\r\\n])*?\\*/)|\\s)*\\} and its works fine fine multi line comments with empty statements but not find single line comments. It find the below scenarios if (true) { /* * fsdsddgd ddgdgdfg gdfgdgdfg gdfgdfg fgdfgfg */ /* * fsdsddgd ddgdgdfg gdfgdgdfg gdfgdfg fgdfgfg */ } if (true) { } Not find the below scenarios if (true) { // kavi // kamal // kamal } if (true) { // kavi } please give me valuable solutions for this.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37591777
has title: Regular expression for single line java comments
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/24320737
has comment: http://stackoverflow.com/comment/37592149
has comment: http://stackoverflow.com/comment/37591657
has comment: http://stackoverflow.com/comment/37591732

http://stackoverflow.com/comment/37587688
has text: OK, now think about how big your array is compared to how many inputs you have. If you have fewer inputs than you do spaces in your array, you'll have `null` elements, right? And what happens when you try to dereference `null` elements with `accounts[f].indexOf()`?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24318137
score: 0

android-arrayadapter
tags question: http://stackoverflow.com/q/24359320
tags question: http://stackoverflow.com/q/24384871
type: Tag
tags question: http://stackoverflow.com/q/24354288
tag name: android-arrayadapter

http://stackoverflow.com/comment/37589684
type: Comment
type: QuestionComment
has text: I can't see what compress and asciiToHex are doing but it's probably a character set issue. Have you looked at the deflator example? http://docs.oracle.com/javase/7/docs/api/java/util/zip/Deflater.html
comment on: http://stackoverflow.com/q/24314035
score: 0

http://stackoverflow.com/comment/37675521
has text: i'm getting not equals values but it have a duplicates.. i want avoid that
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24364523

http://stackoverflow.com/comment/135454677
type: Comment
has text: This worked with Hadoop. For anyone using gradle : `implementation(group: 'org.apache.hadoop', name: 'hadoop-common', version: '3.3.6') { exclude module: 'jsp-api' }`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/65948958

http://stackoverflow.com/a/49059222
answers question: http://stackoverflow.com/q/24365413
type: Answer
score: -1
downvote count: 1
upvote count: 0
has body: I have been able to get rid of this problem by running a late package goal, as it re-compiles and re-packages de code without Cobertura. The goals I use are: clean site package

http://stackoverflow.com/comment/37908471
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24403942
has text: @mist jersey-container-grizzly2-servlet 2.10 and all its dependencies weight 5.6 MB, however it already includes jersey (JAX-RS framework)

http://stackoverflow.com/comment/37777507
type: Comment
comment on: http://stackoverflow.com/a/24418652
type: AnswerComment
has text: Could it be that he shortened the names of the directories in the path?
score: 0

http://stackoverflow.com/q/24354601
has answer: http://stackoverflow.com/a/24354665
tagged with: spring
has title: Null Pointer Exception while using sum agregation
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
upvote count: 1
downvote count: 1
type: Question
has body: While developing an ERP using Spring MVC, JPA/Hibernate i need summing the cr fields of the entity opération but when executing query with createquery I'm attempting to sum the CR fields of the entity operation in a MVC ERP I'm building but when executing the query with createQuery I get an null pointer exception. I tested selectQuery without the sum aggregation it worked well. I need clarification. com.ensi.erp.dao.operationManagerImpl.sommesComptes `public float sommeComptes(int... doubles) { String liste= new String(); String x; for (int d : doubles) { x=Integer.toString(d); x=x.concat(","); liste=liste.concat(x); } liste=liste.substring(0, liste.length()-1); String cc =" select sum(op.cr) from opération op "; System.out.println(cc); Query req= em.createQuery(cc); Number somme=(Number)req.getSingleResult(); return somme.floatValue(); } ` com.ensi.entitis.operation `@Entity @Table(name="opérations") public class opération implements Serializable { @Id @Column(name="id") private int idop; @Column(name="journal") private char journal; @Column(name="compte") private int compte; @Column(name="libellé") private String libellé; @Column(name="dateop") private Date dateop; @Column(name="dr") private float dr; @Column(name="cr") private float cr; //getters public int getIdop(){return idop;} public char getJournal(){return journal;} public int getCompte(){return compte;} public String getLibellé(){return libellé;} public Date getDateop(){return dateop;} public float getDr(){return dr;} public float getCr(){return cr;} //setters public opération(){}; public opération(int id,char j,int com,String lib, Date da ,float drr,float crr){idop=id;journal=j;compte=com;libellé=lib;dateop=da;dr=drr;cr=crr;}; public void setIdop(int op){idop=op;} public void setJournal(char op){journal=op;} public void setCompte(int op){compte=op;} public void setLibellé(String op){libellé=op;} public void setDateop(Date op){dateop=op;} public void setDr(float op){ dr=op;} public void setCr(float op){ cr…
score: 0
answer count: 1
tagged with: jpa
favorite count: 0

http://stackoverflow.com/comment/37526280
has text: Have you tried to set the thread status selector in the upper right corner to "All states"?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/24283034

http://stackoverflow.com/q/24304943
has answer: http://stackoverflow.com/a/24425515
has body: I have a database trigger which executes on insertion of data. From the application end, I use hibernate to update the same table which is update by the database TRIGGER. The data which was updated by Trigger gets overwritten by the older data when I update the data from the application end.I figured out that the cached value in hibernate is not in sych with the value from the database. Is there a proper way to get around this? The cache I am talking about is First level cache. EDIT - Hibernate should update certain fields in the database and other fields in the database should be updated by the TRIGGER. Is this possible?
answer count: 2
tagged with: jpa
score: 0
has answer: http://stackoverflow.com/a/24305450
type: AnsweredQuestion
type: Question
accepted answer: http://stackoverflow.com/a/24305450
tagged with: java
tagged with: hibernate
tagged with: mysql
has title: Hibernate should update only certain fields in the database
tagged with: caching
possible better answer: http://stackoverflow.com/a/24425515

http://stackoverflow.com/a/24349278
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24349188
has body: Try this : if(main.equalsIgnoreCase("N") | main.equalsIgnoreCase("NO")){ result = JOptionPane.showConfirmDialog(null, "WARNING! Are you sure you don't want to carry out maintenance? The simulation will stop if you click YES. ", "TERMINATE THE SIMULATION? ", JOptionPane.YES_NO_OPTION); if(JOptionPane.NO_OPTION == result){ System.out.println("Continuing Simulation..."); }else{ if (JOptionPane.YES_OPTION == result) { Result2 = JOptionPane.showConfirmDialog(null, "Are you sure you want to exit the simulation?", "Are You Sure?", JOptionPane.YES_NO_OPTION); } if(JOptionPane.YES_OPTION == Result2){ System.out.println("Maintenance will not be carried out, exiting Simulation..."); try{ System.exit(0); } finally{ System.err.println("Exiting..."); System.exit(1); } } if (JOptionPane.NO_OPTION == Result2) { System.out.println("Continuing simulation..."); } }} You need to put else after if(JOptionPane.NO_OPTION == result)

http://stackoverflow.com/a/24361279
type: Answer
answers question: http://stackoverflow.com/q/24360710
score: 0
has body: Blocking the main UI thread for 5 secods or more causes the ANR. from Anr Message with synchronized method Maybe that's happening because of: Thread.sleep(20000); Avoid to lock the main UI thread.

http://stackoverflow.com/a/24409259
score: 2
has comment: http://stackoverflow.com/comment/37759956
accepted answer of: http://stackoverflow.com/q/24409171
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24409171
has body: Use the combinators in List: myList.map(_.toArray).toArray
upvote count: 2
has comment: http://stackoverflow.com/comment/37770862

http://stackoverflow.com/q/24356777
type: Question
tagged with: sockets
has body: I'm trying to build a simple server in Java. Basically all I have so far is a ServerSocket listening on a port. It is working well. I want to implement the servers ability to respond to requests. To begin I want to reply to bad requests with a 503. The best idea I have for doing so, is using a BufferedWriter to do something like ... out.write("HTTP/1.0 503 Bad Request\r\n"); out.write("Date: Mon, 23 Jun 2014 23:59:59 GMT\r\n"); out.write("Server: Apache/1.3.2\r\n"); ... However this seems very error-prone. Also, I've looked at Apache's HttpComponents examples and they have a built-in class for HttpResponses however using them is so complicated and involves a whole infrastructure to be built around them. Does anyone have any suggestions on how to simply return HttpResponses in Java?
tagged with: httpresponse
score: 0
answer count: 2
tagged with: apache-httpcomponents
has answer: http://stackoverflow.com/a/24356789
tagged with: java
type: UnansweredQuestion
has title: How do you send a 503 error page directly with Java sockets
has answer: http://stackoverflow.com/a/24356800
has comment: http://stackoverflow.com/comment/37662266
has comment: http://stackoverflow.com/comment/37661097

http://stackoverflow.com/a/24379362
score: 4
answers question: http://stackoverflow.com/q/24379075
type: Answer
has comment: http://stackoverflow.com/comment/66954173
has body: Use the BACKUP DATABASE TO command. Here is a link to the documentation: HSQLDB System Management Documentation I haven't tested this, but I imagine it's something along the lines of: String backup = "BACKUP DATABASE TO " + "'" + filePath + "' BLOCKING"; PreparedStatement preparedStatement = connection.prepareStatement(backup); preparedStatement.execute(); You'll want to wrap it in a try-catch block of course. As far as restoring the db goes, I think you have to perform that while the database is offline using the DbBackupMain application. So you would issue this command at the command line: java -cp hsqldb.jar org.hsqldb.lib.tar.DbBackupMain --extract tardir/backup.tar dbdir
upvote count: 4
has comment: http://stackoverflow.com/comment/66954296
downvote count: 0

http://stackoverflow.com/q/24410532
downvote count: 0
score: 1
tagged with: java
type: Question
answer count: 2
has body: I am folowing the examples about spring boot project. I have compiled and created a jar file via maven but having an error while running attempt. https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-simple Project folders: Error: java -jar spring-boot-sample-simple-1.1.3.BUILD-SNAPSHOT.jar 014-06-25 09:10:00.653 ERROR 12028 --- [ main] o.s.boot.SpringApplication : Application startup failed ava.lang.IllegalStateException: Unable to load configuration files at org.springframework.boot.context.config.ConfigFileApplicationListener.addPropertySources(ConfigFileApplicationListener.java:158) at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEnvironmentPreparedEvent(ConfigFileApplicationListener.j va:138) at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEnvironmentPreparedEvent(ConfigFileApplicationListener.j va:131) at org.springframework.boot.context.config.ConfigFileApplicationListener.onApplicationEvent(ConfigFileApplicationListener.java:120) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98) at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:100) at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:59) at org.springframework.boot.SpringApplication.run(SpringApplication.java:277) at org.springframework.boot.SpringApplication.run(SpringApplication.java:944) at org.springframework.boot.SpringApplication.run(SpringApplication.java:933) at sample.simple.SampleSimpleApplication.main(SampleSimpleApplication.java:46) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source…
upvote count: 1
has title: Spring Boot Samples FileNot found error
has answer: http://stackoverflow.com/a/24415926
has answer: http://stackoverflow.com/a/24410797
favorite count: 0
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/37761962
tagged with: spring-boot

http://stackoverflow.com/q/24278389
answer count: 1
has comment: http://stackoverflow.com/comment/37511957
favorite count: 0
has answer: http://stackoverflow.com/a/24278820
upvote count: 2
tagged with: jcomponent
has body: I have a JScrollPanel implemented correctly . I want to be able to draw a graph in the scrolloable area . The JScrollPanel i produced has its origin (x=0,y=0) in the top left corner . How can i change this so that the origin becomes bottom left corner of the JScrollPane ?In other words the co-ordinate values should increase up and to the right. I need this because this origin style corresponds to the LANDSCAPE mode in which i want the graph to be visualized . I went through the JComponent doucmentation . I am not sure which API to use .
tagged with: swing
accepted answer: http://stackoverflow.com/a/24278820
type: AnsweredQuestion
tagged with: java
has title: Change the origin of the JScrollpane
type: Question
has comment: http://stackoverflow.com/comment/37512305
tagged with: jscrollpane
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37511939
has comment: http://stackoverflow.com/comment/37512295

http://stackoverflow.com/q/24300566
type: Question
has title: String manipulation for VML Path 2
score: 0
tagged with: vml
answer count: 1
accepted answer: http://stackoverflow.com/a/24325150
linked to: http://stackoverflow.com/q/24140101
tagged with: string
has body: I am trying to parse VML Path value (this post is not the same to String manipulation for VML Path). This has a more complicated path value to handle. I have this String value m@0,l@0@0,0@0,0@2@0@2@0,21600@1,21600@1@2,21600@2,21600@0@1@0@1,250,350,450,@5,xe I have four commands here m, l, x, and e. The following sums up my goal. m@0, l @0 @0 0 @0 0 @2 @0 @2 @0,21600 @1,21600 @1@2 21600@2 21600@0 @1@0 @1,250 350,450 @5, x e In code, I think the following is a very good representation. String command_type = "m" List&lt;String, String&gt; parameters = add("@0", "0") // because the y parameter is not specified I need to force it to 0 String command_type = "l" List&lt;String, String&gt; parameters = add("@0", "@0") add("0", "@0") add("0", "@2") add("@0", "@2") add("@0", "216000") add("@1", "216000") add("@1", "@2") add("21600", "@2") add("21600", "@0") add("@1", "@0") add("@1", "250") add("350", "450") add("@5", "0") //because the y parameter is not specified I need to force it to 0 String command_type = "x" (can have no parameter ) String command_type = "e" (can have no parameter ) Here are the things that I noticed from VML. Commands are not preceded by a comma , (true to all vml commands except m which is the first command. Parameters come in pairs (x and y pairs) I saw this link Java String.split() Regex and maybe it is possible to use regular expressions in retreiving the parameters.
tagged with: string-matching
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/9856916
tagged with: java
tagged with: stringtokenizer
has answer: http://stackoverflow.com/a/24325150

http://stackoverflow.com/comment/37587332
score: 1
comment on: http://stackoverflow.com/q/24318202
type: QuestionComment
type: Comment
has text: @MadProgrammer It seems that the problem description requires this particular use, but I agree that a `Set` would be the optimal solution.

http://stackoverflow.com/q/24334066
type: Question
has body: Player Class public class Player extends Sprite implements InputProcessor { public Vector2 velocity = new Vector2(); private float speed = 500; public Rectangle rectangle; public Player(Sprite sprite){ super(sprite); this.rectangle = sprite.getBoundingRectangle(); } public void draw(SpriteBatch spriteBatch){ update(Gdx.graphics.getDeltaTime()); super.draw(spriteBatch); } public void update(float delta) { rectangle = new Rectangle(getX() + velocity.x * delta,0,rectangle.getWidth(),rectangle.getWidth()); setX(getX() + velocity.x * delta); } } PlayScreen Class public class PlayScreen implements Screen { private Player player; private OrthographicCamera camera; private OrthogonalTiledMapRenderer renderer; private TiledMap map; private Rectangle rightRectangle, leftRectangle, playerRectangle; //private ShapeRenderer shapeRenderer; @Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); renderer.render(); renderer.getSpriteBatch().begin(); player.draw(renderer.getSpriteBatch()); renderer.getSpriteBatch().end(); //shapeRenderer.begin(ShapeType.Filled); //shapeRenderer.setColor(0, 1, 0, 1); //shapeRenderer.rect( // player.getX() + player.velocity.x * delta, 0, // player.rectangle.getWidth(), player.rectangle.getHeight()); //shapeRenderer.end(); } @Override public void resize(int width, int height) { camera.viewportWidth = width; camera.viewportHeight = height; camera.update(); } @Override public void show() { camera = new OrthographicCamera(); map = new TiledMap(); renderer = new OrthogonalTiledMapRenderer(map); //shapeRenderer = new ShapeRenderer(); player = new Player(new Sprite(new Texture("img/player.png"))); rightRectangle = new Rectangle(1280,0,0,720); leftRectangle = new Rectangle(0,0,0,720); boolean wallLeft = leftRectangle.overlaps(player.rectangle); boolean wallRight = rightRectangle.overlaps(player.rectangle); if(wallLeft){ System.out.println("wallLeft Overlap"); player.velocity.x = 0; } else if(wallR…
tagged with: rectangles
tagged with: libgdx
tagged with: java
has answer: http://stackoverflow.com/a/24334443
score: 0
upvote count: 1
downvote count: 1
answer count: 1
favorite count: 0
tagged with: collision
has title: Rectangles are not colliding?
type: UnansweredQuestion

http://stackoverflow.com/a/24314556
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24314319
accepted answer of: http://stackoverflow.com/q/24314319
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/37580171
downvote count: 0
has body: In short: no. Long version: According to this question you don't need that in java -> class complilation nor with Google App Engine. The answer on that question also states GAE survives well without the dependency, even gwt-user is not needed. So, based on that I would assume you will feel free to delete the whole dependency.

http://stackoverflow.com/comment/37568964
comment on: http://stackoverflow.com/a/24308480
has text: @Duncan I'm sorry. I'm caught up in so many things, I forgot this was specific to classes that implicitly extend Object
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24310562
tagged with: hql
type: Question
has body: I am trying to get what should be an easy update to set-up to work in Hibernate (using HQL) over a MySQL database. There are other threads out there in regards to errors similar to what I have encountered but nothing that speaks to the same exact problem. The update I am trying to do is to update a row with information from another row in the same table. Nothing special here and I have a similar version working in MySQL using Toad. It is my understanding that HQL does not like inner joins for updates and that a sub-query is to be used instead - do I have that right? Well anyways, below is the first version of the update I worked with. This threw the error message "Invalid path: 'tbB.column1'" and looking at the below I am not sure where the problem lies. UPDATE tableA tbA SET tbA.column1 = tbB.column1 WHERE tbA.operationalId = (SELECT tbB.operationalId FROM tableA AS tbB WHERE tbA.operationalId = tbB.operationalId) AND tbA.column2 = 1 Further researching this issue, I replaced the above listed 'set' statement with a straight assignment of a value to tbA.column1 and encountered a different error which is listed below. error = "You can't specify target table 'tableA' for update in FROM clause" UPDATE tableA tbA SET tbA.column1 = 1 WHERE tbA.operationalId = (SELECT tbB.operationalId FROM tableA AS tbB WHERE tbA.operationalId = tbB.operationalId) AND tbA.column2 = 1 If anyone can point me in the right direction that would be appreciated - I am not sure if the sql needs to be further adjusted to run successfully in Hibernate. Thank you in advance.
score: 0
has answer: http://stackoverflow.com/a/24310677
tagged with: sql
answer count: 1
type: UnansweredQuestion
has title: Problems updating using a subquery (join to the same table) using HQL over a MySQL database.
tagged with: java
tagged with: hibernate
tagged with: mysql

http://stackoverflow.com/comment/37597608
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24322965
score: 0
has text: @Andrei ... i nead hibernate-cfg.properties only for the purpouse of reverse engineering and hql query testing via jboss hibenrate tools in eclise, the aplication itself uses a datasource ... I have used many times both files in an aplication withowt problems

http://stackoverflow.com/q/24393847
downvote count: 2
has comment: http://stackoverflow.com/comment/37731007
has comment: http://stackoverflow.com/comment/37730906
has comment: http://stackoverflow.com/comment/37731101
upvote count: 3
score: 1
tagged with: java
has body: I have the following: Team A: # Name 0-1 Tim 2-3 Ryan 3-4 Jim Team B: # Name 0-1 John 2-3 Joan 3-4 Todd I would like to write an if statement when I only have the # value and the team. So if I knew someone had a value of 1 and was on Team A, I would want it to show "Tim." This is what I have come up with so far but I am not having any luck. Any suggestions? if(#&gt;=0 &amp; Team.equal("Team A")) { 'Tim' } else if(#&lt;=1 &amp; Team.equal("Team A")) { 'Tim' } else if(#&gt;=2 &amp; Team.equal("Team A")) { 'Ryan' } else if(#&lt;=3 &amp; Team.equal("Team A")) { 'Ryan' } // etc.. until all the people are listed in the conditions.
has title: Java If Statement with && and .equal
type: Question
has answer: http://stackoverflow.com/a/24393947
answer count: 2
has comment: http://stackoverflow.com/comment/37731104
has answer: http://stackoverflow.com/a/24393956
has comment: http://stackoverflow.com/comment/37734767
favorite count: 0
has comment: http://stackoverflow.com/comment/37730831
type: UnansweredQuestion

gson
tags question: http://stackoverflow.com/q/24397275
tags question: http://stackoverflow.com/q/24353855
tags question: http://stackoverflow.com/q/24304242
tags question: http://stackoverflow.com/q/24377454
tags question: http://stackoverflow.com/q/24288183
tags question: http://stackoverflow.com/q/24321975
tags question: http://stackoverflow.com/q/24413686
tags question: http://stackoverflow.com/q/24296208
tags question: http://stackoverflow.com/q/24324864
tags question: http://stackoverflow.com/q/24319284
tags question: http://stackoverflow.com/q/24363971
tag name: gson
tags question: http://stackoverflow.com/q/24382063
tags question: http://stackoverflow.com/q/24399435
tags question: http://stackoverflow.com/q/24330718
tags question: http://stackoverflow.com/q/24305341
tags question: http://stackoverflow.com/q/24295357
tags question: http://stackoverflow.com/q/24416960
tags question: http://stackoverflow.com/q/24362254
type: Tag
tags question: http://stackoverflow.com/q/24351771
tags question: http://stackoverflow.com/q/24393901

http://stackoverflow.com/q/24421358
upvote count: 1
has comment: http://stackoverflow.com/comment/37788522
answer count: 1
tagged with: user-interface
downvote count: 1
has comment: http://stackoverflow.com/comment/37784931
has answer: http://stackoverflow.com/a/24422592
accepted answer: http://stackoverflow.com/a/24422592
favorite count: 0
has body: I have a JavaFX application that I'm receiving information from hardware with, using: Platform.runLater(new Runnable() { @Override public void run() { } }); the problem being, sometimes, if not always, I want to prioritize the data collection for accuracy. Is there an alternative to runLater that perhaps halts the JavaFX thread temporarily? Or is it possible to have an application where the JavaFX thread is a sub-thread?
has title: Is it possible to prioritize non-JavaFX threads over the JavaFX thread?
has comment: http://stackoverflow.com/comment/86624511
type: AnsweredQuestion
tagged with: java
tagged with: javafx
tagged with: multithreading
tagged with: thread-priority
has comment: http://stackoverflow.com/comment/37784749
has comment: http://stackoverflow.com/comment/37786570
has comment: http://stackoverflow.com/comment/37785020
type: Question
has comment: http://stackoverflow.com/comment/37787089
has comment: http://stackoverflow.com/comment/37784806
score: 0

http://stackoverflow.com/a/24427289
has comment: http://stackoverflow.com/comment/37795456
has comment: http://stackoverflow.com/comment/37793428
has comment: http://stackoverflow.com/comment/37793193
has comment: http://stackoverflow.com/comment/37793752
score: 0
has comment: http://stackoverflow.com/comment/37793289
has body: http://www.java2s.com/Code/Java/Network-Protocol/Asimpleproxyserver.htm That is the example of proxy server. You will have to configure your browser to use it. Besides, using google doesn't hurt Edit: Your code works fine with firefox. This is what I have received when trying to get google page. Accepted connection from /127.0.0.1:49233 GET http://google.pl/ HTTP/1.1 Host: google.pl User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: pl,en-US;q=0.7,en;q=0.3 Accept-Encoding: gzip, deflate Cookie: PREF=ID=3726591df27f540a:U=ab8413c778d20cca:FF=0:LD=pl:NW=1:TM=1401430486:LM=1403779198:SG=2:S=KJ5wGcrbznlQF3a6; NID=67=kqWLLShO-xj4HPZRs7k-xDtASHYmnY3oTSkC6ndHVJBBNKOqhrmnynUrxiRh4mX3t4w7KaaOLtJInflI9MXjxCqrTDQgXcTLlvvbOMWb9ovQJOFz090oXRrkqXhK5ftTpDnTT1H8Z7tJRMwiOecMKcE4wu4u0KM; OGPC=4061130-2:5-5: Connection: keep-alive
has comment: http://stackoverflow.com/comment/37825546
has comment: http://stackoverflow.com/comment/37794303
type: Answer
answers question: http://stackoverflow.com/q/24426882
has comment: http://stackoverflow.com/comment/37796322
has comment: http://stackoverflow.com/comment/37794580
has comment: http://stackoverflow.com/comment/37794440

http://stackoverflow.com/q/24364139
upvote count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/37674772
has answer: http://stackoverflow.com/a/24364222
tagged with: regex
answer count: 4
favorite count: 0
has title: Why is String.split behaving like this?
downvote count: 0
has answer: http://stackoverflow.com/a/24364294
possible better answer: http://stackoverflow.com/a/24364213
has answer: http://stackoverflow.com/a/24364213
has comment: http://stackoverflow.com/comment/37674749
type: AnsweredQuestion
score: 1
has body: My code is public class Main { public static void main(String[] args) { String inputString = "#..#...##"; String[] abc = inputString.trim().split("#+"); for (int i = 0; i &lt; abc.length; i++) { System.out.println(abc[i]); } System.out.println(abc.length); } } The output abc is an array of length 3. with abc[0] being an empty string. The other two elements in abc are .. and ... If my inputString is "..##...". I don't get a empty string in the array returned by split function. The input String doesn't have trailing whitespace in both cases. Can soemone explain me why do I get a extra space in the code shown above?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24364898
accepted answer: http://stackoverflow.com/a/24364222

http://stackoverflow.com/q/24421176
accepted answer: http://stackoverflow.com/a/24452301
has comment: http://stackoverflow.com/comment/37802318
type: AnsweredQuestion
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/37800851
has comment: http://stackoverflow.com/comment/37801597
has body: I'm uploading images to a database in Blobs but the file names are being changed to database_name-table_name.bin.png which is not so good. Is there anyway to preserve the name that the application that uploads them uses? The java code (prepared statement) I use to upload them is: FileInputStream inputStream = null; // Directory with the name i want to use File image = new File(CreateArticleController.articleDetails.get("introImg")); inputStream = new FileInputStream(image); pstmt.setBinaryStream(7, (InputStream) inputStream,(int) (image.length())); Database: CREATE TABLE IF NOT EXISTS `temp_article` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(200) COLLATE utf8_unicode_ci NOT NULL, `author` varchar(200) COLLATE utf8_unicode_ci NOT NULL, `author_id` int(10) NOT NULL, `type` varchar(200) COLLATE utf8_unicode_ci NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `wfurl` varchar(200) COLLATE utf8_unicode_ci NOT NULL, `intro` text COLLATE utf8_unicode_ci NOT NULL, `intro_image` mediumblob NOT NULL, `status` int(10) NOT NULL DEFAULT '0', `main_image` mediumblob NOT NULL, `content_1` text COLLATE utf8_unicode_ci, `image_1` mediumblob, `content_2` text COLLATE utf8_unicode_ci, `image_2` mediumblob, `content_3` text COLLATE utf8_unicode_ci, `image_3` mediumblob, `content_4` text COLLATE utf8_unicode_ci, `image_4` mediumblob, // Images and content areas go on for 17 of each PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;
type: Question
linked to: http://stackoverflow.com/q/246701
tagged with: blob
has comment: http://stackoverflow.com/comment/37802628
has title: Preserve image names in MySQL Blob
has answer: http://stackoverflow.com/a/24452301
has comment: http://stackoverflow.com/comment/37801874
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/37798940
has comment: http://stackoverflow.com/comment/37782985
tagged with: phpmyadmin

http://stackoverflow.com/q/24363161
has answer: http://stackoverflow.com/a/24365530
has title: Grails: Connecting jconsole to local process on specified port
tagged with: jconsole
has comment: http://stackoverflow.com/comment/37672942
tagged with: grails
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24390110
tagged with: jmx
has comment: http://stackoverflow.com/comment/37673624
accepted answer: http://stackoverflow.com/a/24390110
type: AnsweredQuestion
tagged with: java
has body: I am trying to connect jconsole to a specified port for a local process. I can connect to the local process using the PID but not using the remote option. I am using ubuntu 14.04 and JDK 1.7 This is what I am doing to run my app. grails \ -Dcom.sun.management.jmxremote=true \ -Dcom.sun.management.jmxremote.port=9999 \ -Dcom.sun.management.jmxremote.authenticate=false \ -Dcom.sun.management.jmxremote.ssl=false \ -Djava.rmi.server.hostname=xxx.xxx.xxx.xxx \ -Dserver.port=8090 \ run-app hostname -i also gives me xxx.xxx.xxx.xxx
type: Question
possible better answer: http://stackoverflow.com/a/24365530

core-bluetooth
tag name: core-bluetooth
type: Tag
tags question: http://stackoverflow.com/q/24279271

http://stackoverflow.com/comment/37508252
has text: @Reynard I am using code from here: https://github.com/sjitech/sji-android-screen-capture specifically this file: https://github.com/sjitech/sji-android-screen-capture/blob/master/src/android/ffmpeg/get-raw-image.cpp
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24273983
score: 0

http://stackoverflow.com/comment/37595025
score: 0
type: Comment
type: QuestionComment
has text: It will help showing some of the relevant code (most importanly how the pool manages transactions). Also, what is the database?
comment on: http://stackoverflow.com/q/24315948

http://stackoverflow.com/q/24395384
has comment: http://stackoverflow.com/comment/37733930
has body: So I've seen, in many places, calling methods of a class like: SomeClass obj = new SomeClass(); obj.addX(3).addY(4).setSomething("something").execute(); I don't think I completely understand how that works. Is each method independent of each other, so the above is equal to: obj.addX(3); obj.addY(4); obj.addSomething("something"); obj.execute(); Or are they designing their class structure in some other fashion that allows for this. If they are how are they designing their classes to support this? Also, does that have a specific name? Or is this just calling methods on a class?
score: 0
has answer: http://stackoverflow.com/a/64629931
has answer: http://stackoverflow.com/a/24395398
accepted answer: http://stackoverflow.com/a/24395398
has answer: http://stackoverflow.com/a/24395423
has comment: http://stackoverflow.com/comment/37734410
has comment: http://stackoverflow.com/comment/37734006
has title: Java consecutive method calls
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24395396
tagged with: java
has answer: http://stackoverflow.com/a/24395396
tagged with: methods
type: Question

http://stackoverflow.com/comment/37790060
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24424642
score: 0
has text: That is not enough information. The statement used to produce that `ResultSet` is closed, therefor the `ResultSet` is closed; if you can't fix the problem with that information, you need to show the actual code.

http://stackoverflow.com/q/24350150
score: 15
type: Question
answer count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/58368702
has body: Curl has a feature for manually specifying which IP to resolve a host to. For example: curl https://google.com --resolve "google.com:443:173.194.72.113" This is particularly useful when using HTTPS. If it was just a HTTP request, I could have achieved the same by specifying the IP address directly, and adding a host header. But in HTTPS that would break the connection since the SSL certificate host would be compared to the IP address and not the host header. My question is, how can I achieve the same thing in Java?
upvote count: 15
has answer: http://stackoverflow.com/a/35329286
has title: How to override DNS in HTTP connections in Java
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37648143
has comment: http://stackoverflow.com/comment/37649866
tagged with: https
linked to: http://stackoverflow.com/q/2642777
tagged with: java
has answer: http://stackoverflow.com/a/35327982

http://stackoverflow.com/comment/37698802
has text: @user3580294 While the object is in scope - there are no more references to it. So it _may_ be allowed for the GC to collect it. I'd not be surprised if the spec rules either way.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24376768

http://stackoverflow.com/q/24319466
has comment: http://stackoverflow.com/comment/37590858
tagged with: java
has comment: http://stackoverflow.com/comment/37663336
type: Question
has body: Do the mail servers keep the address for an existing account? Can the address be queried? For example, if I have an existing account and its user name (login name) and password, but I forgot/lost the domain name. Is it possible to retrieve the complete mail address from mail servers (whether INCOMING or OUTGOING)? If it's possible, are there any APIs or classes to implement it on android apps? I know some mail services consider the complete mail address as its login name, and they ask for the fully address to login. I am not talking about this case. Will the mail servers provide the address for my account? I would be grateful if someone explain for these questions.
tagged with: imap
tagged with: smtp
has title: Do SMTP/IMAP servers save the email address for an existing email account? Can it be retrieved?
score: 0
tagged with: android
answer count: 1
tagged with: email
has answer: http://stackoverflow.com/a/24360525
accepted answer: http://stackoverflow.com/a/24360525
has comment: http://stackoverflow.com/comment/37662860
type: AnsweredQuestion

http://stackoverflow.com/comment/37659339
score: 0
comment on: http://stackoverflow.com/q/24354881
type: Comment
type: QuestionComment
has text: Check the log. The reason for the server error is logged there.

http://stackoverflow.com/q/24278992
tagged with: guice
possible better answer: http://stackoverflow.com/a/24384667
has answer: http://stackoverflow.com/a/24384667
has comment: http://stackoverflow.com/comment/37667710
has title: How to bind two classes into one classes using google guice?
has answer: http://stackoverflow.com/a/24367196
tagged with: selenium-webdriver
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24367196
type: Question
tagged with: java
has body: I'v a base class which has selenium configuration for the application. I want to use the class A(selenium configuration.class) to another class B(Action.class) which is again has to extend Class c(UIElemnts.class). I tried to user Google guice to bind the classes like this. how should I use two classes (A&amp; C) on class B using Google Guice. Kindly explain with example In this example I want to use the setup method and driver object in class B but class B is already extended to Class. I just want to try Google Guice to bind the classes. import java.util.concurrent.TimeUnit; import org.openqa.selenium.Proxy.ProxyType; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.FirefoxProfile; import org.testng.annotations.BeforeTest; import test.com.x.software.b.base.SeleniumConfiguration; import com.google.inject.Binder; import com.google.inject.Module; import com.google.inject.Singleton; import com.thoughtworks.selenium.SeleneseTestBase; public class SeleniumConfiguration extends SeleneseTestBase{ public static WebDriver driver; @BeforeTest public static void setup() { // Invoking firefox browser FirefoxProfile firefoxobj = new FirefoxProfile(); firefoxobj.setPreference("network.proxy.type", ProxyType.AUTODETECT.ordinal()); // System.out.println("********************"); driver = new FirefoxDriver(firefoxobj); // System.out.println("********************"+Url); driver.navigate().to("https://software.x.com"); // System.out.println("********************"); driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS); } } public class class B extends Class C{ @ Test public static void createDeveloper() throws InterruptedException { // String currentdate=dateFormatting(); // String firstname="Test_Fn_"+currentdate; // String lastname ="Test_Ln_"+currentdate; // String loginid="Test_Tp_"+currentdate; } import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.sel…
has comment: http://stackoverflow.com/comment/37523513
score: 0
answer count: 2

http://stackoverflow.com/a/24330789
score: 0
type: Answer
has body: It is because this is an AND operation. Once the first test fails, the if statement stops checking. It wouldn't make sense for the other operations to complete if there's no chance of the statement being any value other than false (or true if you had another case, such as x&lt;1). Thus, x is never incremented.
answers question: http://stackoverflow.com/q/24330709

http://stackoverflow.com/comment/98457543
type: Comment
has text: See https://stackoverflow.com/a/55775566/9306378 if you still want to use java8. Note that this uses OpenJDK though.
score: 3
comment on: http://stackoverflow.com/a/46566569
type: AnswerComment

http://stackoverflow.com/comment/37683862
comment on: http://stackoverflow.com/a/24366598
has text: My first app communicates directly with my second app right now. I want to put Camel in between them. So I tell my first app to communicate with Camel first (at a specific URI), and Camel forwards that to the second app. Do you see what I mean?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37686651
has text: First you need to have an understanding of difference between a class and it's instances/objects.
type: Comment
comment on: http://stackoverflow.com/q/24370484
score: 0
type: QuestionComment

http://stackoverflow.com/q/24381439
answer count: 1
has title: javax.naming.NoInitialContextException in simple jms app
tagged with: jms
has answer: http://stackoverflow.com/a/24389676
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/37707194
tagged with: publish-subscribe
has body: import java.util.Properties; import javax.jms.*; import javax.naming.*; public class TopicConsumer implements MessageListener { public static void main(String[] args) throws JMSException, NamingException { System.out.println("------&gt;STARTING JMS TopicConsumer&lt;----"); Context context= TopicConsumer.getInitialContext(); System.out.println("&gt;&gt;&gt;1&lt;&lt;&lt;"); TopicConnectionFactory topicConnectionFactory= (TopicConnectionFactory)context.lookup("ConnectionFactory"); System.out.println("&gt;&gt;&gt;2&lt;&lt;&lt;"); Topic topic= (Topic) context.lookup("Topic/AKSHAY"); System.out.println("&gt;&gt;&gt;3&lt;&lt;&lt;"); TopicConnection topicConnection= topicConnectionFactory.createTopicConnection(); System.out.println("&gt;&gt;&gt;4&lt;&lt;&lt;"); TopicSession topicSession= topicConnection.createTopicSession(false,TopicSession.AUTO_ACKNOWLEDGE); System.out.println("&gt;&gt;&gt;5&lt;&lt;&lt;"); topicSession.createSubscriber(topic).setMessageListener(new TopicConsumer()); System.out.println("&gt;&gt;&gt;6&lt;&lt;&lt;"); topicConnection.start(); System.out.println("------&gt;Énding JMS TopicConsumer&lt;----"); } @Override public void onMessage(Message message) { try { System.out.println("&gt;&gt;&gt;on msg&lt;&lt;&lt;"); System.out.println("Incoming message is"+((TextMessage)message).getText()); } catch (JMSException e) { e.printStackTrace(); } } public static Context getInitialContext() throws JMSException, NamingException{ System.out.println("&gt;&gt;&gt;7&lt;&lt;&lt;"); Properties props=new Properties(); System.out.println("&gt;&gt;&gt;8&lt;&lt;&lt;"); props.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory"); System.out.println("&gt;&gt;&gt;9&lt;&lt;&lt;"); props.setProperty("java.naming.factory.url.pkgs","org.jboss.naming"); System.out.println("&gt;&gt;&gt;10&lt;&lt;&lt;"); props.setProperty("java.naming.provider.url","localhost:1099"); System.out.println("&gt;&gt;&gt;11&lt;&lt;&lt;"); Context context= new InitialContext(); S…
tagged with: java
tagged with: jboss
type: Question

http://stackoverflow.com/q/24417007
answer count: 1
has title: better way of sampling in Hadoop MapReduce
score: 0
has answer: http://stackoverflow.com/a/24422179
has body: I want 20 % of sample data from the input dataset. I thought of 2 approaches: Initially emitting 20 % data from each mapper (single mapper emits 20% of data).Then, the reducer finds 20 % of mapper data after shuffle and sort.(Same procedure applied for both Map and Reduce) Simply emit each line from mapper and then find 20% of sample data from total data in Reducer.(processing only done is Reducer) Which is the better approach?
tagged with: sampling
has comment: http://stackoverflow.com/comment/37783661
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24422179
tagged with: java
has comment: http://stackoverflow.com/comment/37778423
tagged with: mapreduce
has comment: http://stackoverflow.com/comment/37808764
type: Question
tagged with: hadoop

http://stackoverflow.com/comment/37732061
comment on: http://stackoverflow.com/a/24362496
score: 0
type: AnswerComment
has text: BTW is there really a need to have your own log wrapper. If you can just move to normal logging then it's a lot easier.
type: Comment

http://stackoverflow.com/comment/37747170
type: Comment
type: QuestionComment
has text: Please provide the code you used for XML parsing.
score: 0
comment on: http://stackoverflow.com/q/24402110

http://stackoverflow.com/a/24399637
has body: The Object class, in the java.lang package, sits at the top of the class hierarchy tree. Every class is a descendant, direct or indirect, of the Object class. All objects, including arrays, implement the methods of this class. Thats why super() in your case is actually calling the constructor of Object class.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/24399612
upvote count: 1
type: Answer

http://stackoverflow.com/a/24300697
downvote count: 0
has comment: http://stackoverflow.com/comment/37554383
type: Answer
accepted answer of: http://stackoverflow.com/q/24299918
answers question: http://stackoverflow.com/q/24299918
has comment: http://stackoverflow.com/comment/37554078
has body: The problem might be with your text being white color. Just try graphView.getGraphViewStyle().setHorizontalLabelsColor(Color.BLACK); graphView.getGraphViewStyle().setVerticalLabelsColor(Color.BLACK); The size of text could be altered as follows... graphView.getGraphViewStyle().setTextSize(11);
score: 3
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/37584799
has text: I included the jfxrt from java 8 into a windows xp with java 7 and it ran just fine. And again, if you are afraid **use native packaging**.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24316858

http://stackoverflow.com/comment/37603796
comment on: http://stackoverflow.com/a/24326640
type: Comment
has text: I was more aiming at keeping it API-agnostic; like you have a generic updatable.update(), so to can a simple renderFrame() be in the example without having to further specify how it does that exactly. Its only to illustrate after all. Your code comment is good enough though :)
score: 0
type: AnswerComment

http://stackoverflow.com/a/24526458
answers question: http://stackoverflow.com/q/24385149
has body: Due to several problems I decided to revamp the whole project so the question here can be closed. Thanks for all the answers, they were helping me alot!
accepted answer of: http://stackoverflow.com/q/24385149
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/a/27845733
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24274124
score: 1
upvote count: 1
has body: Enhanced loop uses an Iterator behind the scenes [1] if it is about lists. In your case you have a linked list (which keeps pointers to next-previous items), so by using an enhanced for (iterator) you have sequential read complexity O(1). If you use the for you suggested, you're accessing your list randomly, which is O(n) for the LinkedList but it would be O(1) if it was an ArrayList. So it can be enhanced if used in a List with sequential read complexity &lt; random read complexity [1] why is enhanced for loop efficient than normal for loop

http://stackoverflow.com/comment/37713033
type: QuestionComment
score: 0
has text: @Gimby - well it is still the same problem, I cannot connect to the server. If you say that there must be a connectivity problem with the server then I will accept that, but how will I know if there is or not if I don't have the correct call to them, which was my original question?
comment on: http://stackoverflow.com/q/24368520
type: Comment

http://stackoverflow.com/comment/37755130
score: 0
type: Comment
type: QuestionComment
has text: Yes, but I found the solution already. Apparently it's not possible to do it straight like that. You need to download & parse the HTML first. Kinda strange that there is no nicer way.
comment on: http://stackoverflow.com/q/24406757

http://stackoverflow.com/comment/37563445
type: Comment
type: QuestionComment
has text: I think you need to show your entire project structure and the listing for SandhiGeneration.java for people to help you further with this one.
comment on: http://stackoverflow.com/q/24304778
score: 0

http://stackoverflow.com/q/24354568
answer count: 2
has comment: http://stackoverflow.com/comment/37657343
has body: The past few weeks I've been working on a sudoku game. The game as a lot of features such as: play game, print sudoku, solve sudoku. The solve function uses conventional backtracking but thats not the issue, the issue is that I need the game to be able to produce a humanely solvable sudoku, for that I need a method that will be able to solve a sudoku as a human would do it. If anyone could help me work out the mechanics of how this could be done I would greatly appreciate it.
has answer: http://stackoverflow.com/a/24355225
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24355134
has comment: http://stackoverflow.com/comment/37656920
tagged with: sudoku
tagged with: java
score: -4
has title: Sudoku solver, not backtracking solver
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37656871
has comment: http://stackoverflow.com/comment/37657355
downvote count: 5
has comment: http://stackoverflow.com/comment/37657003
has comment: http://stackoverflow.com/comment/37657372

http://stackoverflow.com/comment/37736332
type: QuestionComment
has text: @GyroGearless Thank you for the correction. All OSes should sue '/' anyway. ;)
score: 0
comment on: http://stackoverflow.com/q/24396070
type: Comment

http://stackoverflow.com/comment/37538091
type: QuestionComment
comment on: http://stackoverflow.com/q/24292104
type: Comment
score: 0
has text: I would use some web framework that handles it nicely, for example spring-mvc which gives you pretty url end point for each controller separately makes it much easy to manage your urls

http://stackoverflow.com/comment/37648060
type: QuestionComment
score: 3
has text: Consider using a [CardLayout](http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html) to switch between visible panels.
comment on: http://stackoverflow.com/q/24350194
type: Comment

http://stackoverflow.com/a/24322777
upvote count: 1
has body: I was having the same issue a while back. Although there also is an option of a spring EL enhancement to lookup spring beans there, I still found the differences between JSF and spring to be too wide a gap to try to cross in a seamless manner. My recommendation is therefore to make the gap explicit and not try to cross it. In my case I ended up with a service locator pattern, gaining access to spring context and lookup there.. @ManagedBean @ApplicationScoped public class ServiceLocator { public &lt;T&gt; T getServiceByType(Class&lt;T&gt; serviceType) { getSpringContext().getBean(serviceType); } public ApplicationContext getSpringContext() { return FacesContextUtils.getWebApplicationContext(FacesContext.getCurrentInstance()); } } @ManagedBean @ViewScoped public class ViewBean { @ManagedProperty("#{serviceLocator}") protected ServiceLocator serviceLocator; public void actionMethod() { serviceLocator.getService(BookingService.class).book(roomId, fromDate, toDate); } } Written from memory, but you might get the gist
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24320109
has comment: http://stackoverflow.com/comment/37627365
type: Answer

http://stackoverflow.com/comment/37507520
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24275494
type: AnswerComment
has text: Ohhhhhhhhhhhhhh..... I get it... the picture is set as the label icon, and the button gets placed on top. That makes so much more sense, thank you very much!

http://stackoverflow.com/comment/37625976
type: Comment
comment on: http://stackoverflow.com/a/24338661
has text: Their example wouldn't work even if they did submit data in their POST to `/generatepdf.html`. That is not the root cause.
type: AnswerComment
score: 0

http://stackoverflow.com/a/24341909
score: 2
accepted answer of: http://stackoverflow.com/q/24341691
has body: Now I identified the root cause of the problem: In the end was an encoding problem. A bit surprizing to me since I used the same Text resources for desktop &amp; android, but it turns out that the android version didn't like the encoding ISO-8859-1, while desktop was fine with that. Changing the encoding to utf-8 fixed the display of the special chars in android. In the end I have the following solution to get the text translations while I keep using the same resource bundle properties (encoded in utf-8) for both projects: public String get(String key) { if(dictBundle.containsKey(key)) { if (isDesktop) { try { return new String(dictBundle.getString(key).getBytes("ISO-8859-1"), "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } return dictBundle.getString(key); } return key; } where dictBundle is my ResourceBundle and I set the boolean isDesktop the following way: isDesktop = Gdx.app.getType().equals(Application.ApplicationType.Desktop);
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24341691
upvote count: 2
type: Answer

http://stackoverflow.com/q/24422008
accepted answer: http://stackoverflow.com/a/24422084
tagged with: maven
linked to: http://stackoverflow.com/q/24422121
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/24422084
has title: Sharing model classes in a maven module between apps
type: Question
score: 0
has body: I have a webapp with model classes containing Hibernate annotation which defines the database properties (e.g. @Column, @Entity, etc). I'm creating a new app that writes to the same database. Is it a good idea to put all the model classes into a maven module to be shared between apps?
answer count: 1

http://stackoverflow.com/a/24446857
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24426644
type: Answer
has body: The reason for that is pretty simple: the relation names for associated entities are derived from the property names of the containing class. So both PersonDetails and PersonChildren want to create an outbound link to a Person named person. If we rendered that, it would look something like this { _links : { person : { href : … }, &lt;- the one from PersonDetails person : { href : … } &lt;- the one from PersonChildren } This is of course invalid. Also, lining up the two links in an array would not allow you to distinguish between the two links anymore (which one is coming from PersonDetails and which one is coming from PersonChildren. So there are a few options here: Manually name the relations of those types. You can annotate the Person properties with @RestResource and configure the rel attribute of the annotation to something different than person. You want any of the two not exported at all. The very same annotation can be used to prevent the link from being rendered at all. Simply set the exported flag in @RestResource to false and the link will not be rendered. This might be useful if the pointer e.g. from PersonDetails is just relevant within the code, but actually not in a JSON representation.
has comment: http://stackoverflow.com/comment/50718441
score: 15
has comment: http://stackoverflow.com/comment/37864576
upvote count: 15
answers question: http://stackoverflow.com/q/24426644

http://stackoverflow.com/q/24360417
linked to: http://stackoverflow.com/q/4957094
tagged with: nullpointerexception
answer count: 3
tagged with: singleton
favorite count: 0
has title: NullPointerException at getCacheDir() android
tagged with: android
possible better answer: http://stackoverflow.com/a/24360463
has comment: http://stackoverflow.com/comment/37668131
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37668497
score: 3
has comment: http://stackoverflow.com/comment/37668120
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24360448
accepted answer: http://stackoverflow.com/a/24360448
has comment: http://stackoverflow.com/comment/37669806
has answer: http://stackoverflow.com/a/24361356
type: Question
has body: I am trying to clear my app data programmatically. But I get a NullPointerEXception with the following code. Here is my code:- public class MyApplication extends Application { private static MyApplication instance; @Override public void onCreate() { super.onCreate(); instance = this; } public static MyApplication getInstance(){ return instance; } public void clearApplicationData() { File cache = getCacheDir(); File appDir = new File(cache.getParent()); if(appDir.exists()){ String[] children = appDir.list(); for(String s : children){ if(!s.equals("lib")){ deleteDir(new File(appDir, s)); Log.i("TAG", "**************** File /data/data/APP_PACKAGE/" + s +" DELETED *******************"); } } } } public static boolean deleteDir(File dir) { if (dir != null &amp;&amp; dir.isDirectory()) { String[] children = dir.list(); for (int i = 0; i &lt; children.length; i++) { boolean success = deleteDir(new File(dir, children[i])); if (!success) { return false; } } } return dir.delete(); } } I get a NullPointerException while I try to do :- File cache = getCacheDir(); How can I resolve this?
downvote count: 0
has answer: http://stackoverflow.com/a/24360463

http://stackoverflow.com/comment/37702173
type: Comment
score: 0
type: AnswerComment
has text: @RomanDzhabarov See this presentation esp slide 8 http://www.slideshare.net/PeterLawrey/writing-and-testing-high-frequency-trading-engines-in-java
comment on: http://stackoverflow.com/a/24378613

http://stackoverflow.com/a/24272899
has comment: http://stackoverflow.com/comment/37502121
has comment: http://stackoverflow.com/comment/37502214
accepted answer of: http://stackoverflow.com/q/24272610
type: Answer
has body: Its most likely because your app isn't active in the background. A lot of my android apps have been struggling from this. A decent solution might be to make sure there is an alarm clock that wakes the app up. I've never dealt with parse though so this may not work, its worked for me in other scenarios though
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37501931
upvote count: 1
answers question: http://stackoverflow.com/q/24272610
type: AcceptedAnswer

http://stackoverflow.com/q/24398244
tagged with: android
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: invalidation
type: Question
has answer: http://stackoverflow.com/a/24398582
possible better answer: http://stackoverflow.com/a/24398658
has title: Is it possible to execute onDraw() right after invalidate(Rect)?
has answer: http://stackoverflow.com/a/24398658
answer count: 2
tagged with: ondraw
accepted answer: http://stackoverflow.com/a/24398582
has body: I added a breakpoint in my onDraw() method and noticed that my debugger only gets there after the method in which invalidate(rect) is, ends. Is it possible to be called right after? Because I need to call invalidate(rect) twice in my method. Thanks in advance.

http://stackoverflow.com/q/24416955
has title: connecting to SQLserver in eclipse
tagged with: sql-server
upvote count: 1
answer count: 1
has body: I'm having a problem connecting to an SQLserver in Java using Eclipse. I have used SQLjdbc4 but yet there's problem. I have no idea what is wrong with my code, but it just doesn't work. I've searched for similar problems but it wasn't useful. Here 's my code: import java.*; import java.sql.*; public class Connect{ public static void main(String[] args) { // Create a variable for the connection string. String connectionUrl = "jdbc:sqlserver://qp-vaio\\qp:1433;" + "databaseName=db;user=sa;password=1"; // Declare the JDBC objects. Connection con = null; Statement stmt = null; ResultSet rs = null; try { // Establish the connection. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); con = DriverManager.getConnection(connectionUrl); // Create and execute an SQL statement that returns some data. String SQL = "SELECT TOP 10 * FROM Person.Contact"; stmt = con.createStatement(); rs = stmt.executeQuery(SQL); // Iterate through the data in the result set and display it. while (rs.next()) { System.out.println(rs.getString(4) + " " + rs.getString(6)); } } // Handle any errors that may have occurred. catch (Exception e) { e.printStackTrace(); } finally { if (rs != null) try { rs.close(); } catch(Exception e) {} if (stmt != null) try { stmt.close(); } catch(Exception e) {} if (con != null) try { con.close(); } catch(Exception e) {} } } } This is the problem : Login failed for user 'sa'. ClientConnectionId:f87b859a-c901-4ce4-8e51-02478ffac83d at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216) at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:254) at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:84) at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:2908) at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:2234) at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:41) at com.microsoft.sqls…
favorite count: 0
has comment: http://stackoverflow.com/comment/37774182
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24417167
has comment: http://stackoverflow.com/comment/37774181
downvote count: 0
score: 1
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/24417167

http://stackoverflow.com/comment/37671350
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24361775
type: Comment
has text: I'll check that, I have access to the source code so I'll will add log4j, thanks :)

http://stackoverflow.com/comment/37756044
comment on: http://stackoverflow.com/q/24407094
has text: @Sanjeev yes that is correct, just for some reason after asking me Sorry I didn't catch that..., it doesn't let me input anymore
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/37514564
type: Comment
comment on: http://stackoverflow.com/q/24279913
has text: Please suggest some solution to go about this problem.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37617315
has text: whoops forgot to add it lol !
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24334078

http://stackoverflow.com/comment/37678590
score: 0
comment on: http://stackoverflow.com/q/24366219
type: Comment
type: QuestionComment
has text: Do you really know `Java`? You need to read Java Programming book!

http://stackoverflow.com/comment/37777037
type: Comment
has text: I don't see that the OP is adding click listeners
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24415787

http://stackoverflow.com/a/24381086
answers question: http://stackoverflow.com/q/24380241
has body: static int type; public void setType(int inType) { type = inType; } You should not be setting a static variable from an instance method. int type; public void setType(int inType) { type = inType; } Changing as above will fix your issue.
score: 0
type: Answer

http://stackoverflow.com/q/24414729
score: 0
tagged with: java
has title: Persistence unit not found but the file is there
tagged with: jpa
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/28484336
has body: I use netbeans and I have problem to compile. I get No persistence unit with name 'NotionService' found In this folder /home/bob/dev/storm/src/main/webapp/META-INF/ i have context.xml and persistence.xml any idea?
tagged with: netbeans
has comment: http://stackoverflow.com/comment/37770035
type: Question
has comment: http://stackoverflow.com/comment/37769992
answer count: 1

http://stackoverflow.com/q/24277234
tagged with: jdom
tagged with: xml-parsing
answer count: 1
has title: Write more than one element with same name to xml file using JDOM in JAVA
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24278008
type: Question
tagged with: java
has body: I have to loop through an object containing the data for all the xml elements, set the values accordingly and write it into a file. Here is my source code, for(int i=0;i&lt; dataHolder.getNumSensorsList().size();i++) { NumSensor numSensor = (NumSensor) dataHolder.getNumSensorsList().get(i); Element numSensorElement = new Element("numSensor"); numSensorElement.setAttribute("ruleid",numSensor.getRuleId()); Element type = new Element("type"); type.addContent(numSensor.getUnit()); numSensorElement.addContent(type); Element sensorId = new Element("sensorId"); sensorId.addContent(numSensor.getSensorId()); numSensorElement.addContent(sensorId); Element label = new Element("label"); label.addContent(numSensor.getLabel()); numSensorElement.addContent(label); } In case if am looping for three times and adding different data to "numSensorElement" all three times and I add the "numSensorElement" to a root tag and write it into a xml file. I am getting three copies of "numSensorElement" with the information from third loop. First two loops are replaced and written with third loop values for three times. Please help me with some better approach than mine. Thanks in advance.
score: 0
accepted answer: http://stackoverflow.com/a/24278008

http://stackoverflow.com/comment/37769769
type: AnswerComment
comment on: http://stackoverflow.com/a/24413108
type: Comment
score: 0
has text: @KhaledLela Hmm, to make it really similar to the second code snippet you want `USER+":"+PASS`. I tried your fixed code snippet (spaces removed) with http ://httpbin.org/basic-auth/user/pass and it works fine for me.

http://stackoverflow.com/comment/37767242
type: Comment
has text: I just tried it... my earlier comment was incorrect, you can add attributes to an empty element.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24412572

tcp
type: Tag
tags question: http://stackoverflow.com/q/24362004
tags question: http://stackoverflow.com/q/24345899
tags question: http://stackoverflow.com/q/24389294
tags question: http://stackoverflow.com/q/24271132
tags question: http://stackoverflow.com/q/24304650
tags question: http://stackoverflow.com/q/24406645
tags question: http://stackoverflow.com/q/24336560
tags question: http://stackoverflow.com/q/24351191
tags question: http://stackoverflow.com/q/24292960
tags question: http://stackoverflow.com/q/24386255
tags question: http://stackoverflow.com/q/24404497
tag name: tcp

http://stackoverflow.com/q/24364979
answer count: 1
has answer: http://stackoverflow.com/a/24398999
score: 0
tagged with: velocity
has comment: http://stackoverflow.com/comment/37676544
has title: Camel + Velocity: how to put things in Velocity context
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37676464
accepted answer: http://stackoverflow.com/a/24398999
type: Question
tagged with: java
has body: I have a lot of velocity templates that can be reused for another project (which is using Camel). Reading the documentation I'm not able to understand how to insert some custom object in the velocity context...my templates are expecting two or three different tools; I see that I can set those objects in the header but in this way I have to change my templates, and of course I would avoid that. So basically in my template I have something like $xpath.blablabla $anotherTool.doSomething Previously (in the other project) I set up those objects in a java class, now I could create a processor for doing the entire velocity processing but I suppose there's a quick way to avoid coding.
has comment: http://stackoverflow.com/comment/37682861
tagged with: apache-camel
has comment: http://stackoverflow.com/comment/37679019

http://stackoverflow.com/a/24420683
has body: For your example, it seems that you want to use Math.rint(). It will return the closest integer value given a double. int valueX = (int) Math.rint(x); int valueY = (int) Math.rint(y);
upvote count: 12
has comment: http://stackoverflow.com/comment/37781291
score: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/37781605
has comment: http://stackoverflow.com/comment/78091911
answers question: http://stackoverflow.com/q/24420633
type: Answer

http://stackoverflow.com/comment/37757211
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24319085
type: Comment
has text: Also, you can +! my post. Looks like it helped :)

http://stackoverflow.com/a/24380080
has comment: http://stackoverflow.com/comment/37729802
has body: I have no idea how the JVM inside the Oracle DB is implemented, but since (at least in some common configurations) every database connection gets its own server process, then if a separate JVM is embedded into each of those, a synchronized block won't do you much good. You'd need to use database locks.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/24302726
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24302726
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/37511177
type: Comment
type: QuestionComment
has text: Probably having a `getInstance()` method in `MyClass` could help.
comment on: http://stackoverflow.com/q/24278179
score: 0

http://stackoverflow.com/comment/37786199
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24423577
has text: I don't know your complete scenario, but this could help. http://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html#interrupt--

http://stackoverflow.com/q/24360910
has body: I'm having a problem with RESTlet Framework configuration with Spring. I want to have one global filter for all requests and responses. I guess I can use Filter class and it's methods beforeHandle, afterHandle and setNext like this: Filter.beforeHandle() -> Router -> Filter.afterHandle() The problem is, that I'm using Spring configured RESTlet and I don't know if the regular Filter will work correctly with SpringRouter from org.restlet.ext.spring package. My current restlet configuration is as follows: <lookup-method name="create" bean="loginResource" /> I'm thinking about adding a bean with id root and class that extends class Filter, and pass to it as property next a bean with id router (which currently is called root). What do you think about this solution?
type: Question
tagged with: restlet
has answer: http://stackoverflow.com/a/24542289
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24542289
tagged with: spring
has title: Restlet Framework and Spring - Global filter
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/24380433
has comment: http://stackoverflow.com/comment/37705709
has comment: http://stackoverflow.com/comment/37706050
has title: Why descendingSet smaller than original set?
has comment: http://stackoverflow.com/comment/37705987
favorite count: 0
has comment: http://stackoverflow.com/comment/37705622
type: Question
has comment: http://stackoverflow.com/comment/37705722
has comment: http://stackoverflow.com/comment/37705647
has comment: http://stackoverflow.com/comment/37706311
has body: I have a collection with 191 elements: NavigableSet&lt;Taxon&gt; _set = new ConcurentSkipListSet&lt;&gt;(); ... _set.size(); // 191 _set.descendingSet().size(); // also 191 _set.descendingSet().toArray().length; // 53 _set.toArray().length; // 191 Taxon.java: class Taxon implements Comparable&lt;Taxon&gt; { public final int x; public final int y; public final int r; public final List&lt;Long&gt; ips; public Taxon(int x, int y, int r, List&lt;Long&gt; ips) { this.x = x; this.y = y; this.r = r; this.ips = ips; } @Override public int compareTo(Taxon o) { return this.ips.size() &gt; o.ips.size() ? 1 : -1; } } Why _sel.descendingSet().toArray() is smaller? When I iterate _sel.descendingSet() it's breaken on 53 element. How to iterate whole descending collection? UPDATE I am sure there no modification on this set, during check
score: 0
answer count: 2
tagged with: set
has comment: http://stackoverflow.com/comment/37706291
upvote count: 1
tagged with: collections
downvote count: 1
has comment: http://stackoverflow.com/comment/37706227
has answer: http://stackoverflow.com/a/24445863
has comment: http://stackoverflow.com/comment/37706733
has comment: http://stackoverflow.com/comment/37705620
tagged with: java
has answer: http://stackoverflow.com/a/24445517
type: UnansweredQuestion

http://stackoverflow.com/comment/37627564
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24339599
score: 0
has text: You do: `sno.setText(sno+ c.getString(iSno) +"."+"\n");` - **what**? sno is a TextView! you can't do `sno+ c.getString(iSno)` - Your correct instruction is `sno.setText(c.getString(iSno) +"."+"\n");` (no **sno+**). And so for ther other ones.

http://stackoverflow.com/comment/37601232
score: 1
has text: I tagged Rest because Rest being a URL driven service having https might open up some more issues. Users might help me in that part too. U gave a -1 for that ? uhhhh
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24325335

http://stackoverflow.com/a/24348107
has body: Found the issue. Should have ignored the relativelayout completely. @Override public View getView(int i, View view, ViewGroup viewGroup) { //working with an object called "hl" if (view == null){ view = myInflater.inflate(R.layout.headline_list, null); } Bitmap background = hl.getBgImage(); Drawable dr = new BitmapDrawable(background); view.setBackgroundDrawable(dr); return view; }
has comment: http://stackoverflow.com/comment/37644559
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24347786
score: 0
answers question: http://stackoverflow.com/q/24347786
type: Answer

http://stackoverflow.com/comment/37765752
score: 0
comment on: http://stackoverflow.com/q/24412503
type: Comment
type: QuestionComment
has text: please run it with `-e` and post the error stack

http://stackoverflow.com/comment/37712530
has text: It looks correct. Have you tried it?
comment on: http://stackoverflow.com/q/24383781
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24406322
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24406445
has answer: http://stackoverflow.com/a/24406468
tagged with: date
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/38927803
has title: Convert String into Date With Locale
type: UnansweredQuestion
tagged with: date-format
has body: I have a date as a string like "2014-01-01 00:00:00". I want to convert it into Date With EST Local and my application server is in IST. So my expected output when I print date would be "Wed Jan 01 00:00:00 EST 2014". But it resulted output is "Wed Jan 01 00:00:00 IST 2014". Below is my code. DateFormat formatter; Date formattedDate = null; formatter = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss", Locale.US); try { formattedDate = formatter.parse("01-01-2014 00:00:00"); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println(formattedDate); How can I get my expected result.

http://stackoverflow.com/comment/37613927
has text: *because* of short-circuiting that expression will not be evaluated
comment on: http://stackoverflow.com/a/24330800
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/24348886
has comment: http://stackoverflow.com/comment/37645677
tagged with: regex
possible better answer: http://stackoverflow.com/a/24348959
answer count: 4
has body: Here is my text as Entry : This is An Image File [LoadImage:'image1.jpg'] this is Another Image [LoadImage:'image2.jpg'] I need to get [LoadImage:'*'] start and end position(s) as an array in java
type: AnsweredQuestion
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/37645681
accepted answer: http://stackoverflow.com/a/24349050
has answer: http://stackoverflow.com/a/24348977
type: Question
has title: Request a Regular Expression
has answer: http://stackoverflow.com/a/24349050
upvote count: 3
downvote count: 1
has answer: http://stackoverflow.com/a/24348972
has comment: http://stackoverflow.com/comment/37645747
favorite count: 0
has answer: http://stackoverflow.com/a/24348959
has comment: http://stackoverflow.com/comment/37645690

http://stackoverflow.com/a/31819151
score: 0
has body: Adding a basic authorization header is easy enough: HttpURLConnection connection = (HttpURLConnection)jiraURL.openConnection(); String userCredentials = "username:password"; String basicAuth = "Basic " + new String(new Base64().encode(userCredentials.getBytes())); connection.setRequestProperty ("Authorization", basicAuth);
type: Answer
answers question: http://stackoverflow.com/q/24368731

http://stackoverflow.com/comment/37612318
comment on: http://stackoverflow.com/q/24331218
has text: If you wish, as @IllegalArgument suggested, output what the app is receiving into your logcat so you can verify your calling it correctly and your receiving a correctly formatted responce. You should also post the logcat so we can see any warning or errors your getting.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24351168
has comment: http://stackoverflow.com/comment/37649963
tagged with: sockets
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24351246
downvote count: 1
tagged with: http
has title: How do you create a simple non-persistent server in Java?
type: Question
has comment: http://stackoverflow.com/comment/37650060
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/37650112
accepted answer: http://stackoverflow.com/a/24351246
upvote count: 0
has body: As part of a school assignment, I am trying to write a simple server that handles only non-persistent connections. I am using Java. From what I've read so far, HTTP is by default persistent, and Sockets/ServerSockets in Java are the same way. How do I implement non-persistent sockets?
answer count: 1
favorite count: 0

http://stackoverflow.com/q/24283953
has answer: http://stackoverflow.com/a/24283985
type: Question
has comment: http://stackoverflow.com/comment/37522009
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24284028
has title: Throwing null pointer when assigning text in code android?
has answer: http://stackoverflow.com/a/24283966
has body: I have below some code which will add the text 'test' to the textbox when the page loads, but for some reason it is throwing a null pointer; as if to say it can't find the control, or it is pointing to the incorrect file? Java: package com.example.application; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Toast; import android.os.Build; public class ShowTeamsChosen extends ActionBarActivity { //This is the textbox I am populating... TextView txtOne = (TextView) findViewById(R.id.textView1); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_show_teams_chosen); //here I am setting the text txtOne.setText("test"); readFromFile(); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } } XML: &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.application.ShowTeamsChosen" tools:ignore="MergeRootFrame" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" /&gt; &lt;/FrameLayout&gt;
tagged with: android
answer count: 4
type: UnansweredQuestion
downvote count: 3
linked to: http://stackoverflow.com/q/19078461
score: -3
has comment: http://stackoverflow.com/comment/37521996
duplicate of: http://stackoverflow.com/q/19078461
tagged with: java
has answer: http://stackoverflow.com/a/24283977

http://stackoverflow.com/comment/37796658
score: 0
type: Comment
type: QuestionComment
has text: @Pr38y New methods have been added. Its still being a little punk and causing a crash when I pick said contact out of the list. Over all its progress since its starting to shape up and be less old in code.
comment on: http://stackoverflow.com/q/24418011

http://stackoverflow.com/a/24332556
has comment: http://stackoverflow.com/comment/37614279
score: 1
has comment: http://stackoverflow.com/comment/37614694
upvote count: 1
has comment: http://stackoverflow.com/comment/37614218
has comment: http://stackoverflow.com/comment/37614568
has comment: http://stackoverflow.com/comment/37614714
answers question: http://stackoverflow.com/q/24332498
downvote count: 0
has body: b. why variables do not show the polymorphism phenomenon that overridden methods show. because field variables aren't polimorphic in java c. i read that super.super.methodname() does not workis removed to avoid violation of encapsulation.can anybody clarify on this how this is . because it isn't supported in java
has comment: http://stackoverflow.com/comment/37614539
type: Answer

http://stackoverflow.com/q/24351849
has title: Java - MySQL to Hive Import where MySQL Running on Windows and Hive Running on Cent OS (Horton Sandbox)
tagged with: hive
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/24351904
tagged with: mysql
linked to: http://stackoverflow.com/q/9229611
type: Question
tagged with: hortonworks-data-platform
linked to: http://stackoverflow.com/q/22487688
linked to: http://stackoverflow.com/q/17057591
has body: Before any Answer and Comments. I tried several option I found in Stackoverflow but end with a failure. Following are those links - How can I execute Sqoop in Java? How to use Sqoop in Java Program? How to import table from MySQL to Hive using Java? How to load SQL data into the Hortonworks? I tried it in Horton Sandbox through command line and succeded. sqoop import --connect jdbc:mysql://192.168.56.101:3316/database_name --username=user --password=pwd --table table_name --hive-import -m 1 -- --schema default Where 192.168.56.101 is for Windows and 192.168.56.102 for Horton Sandbox 2.6. Now I want to do the same thing from Java where that java code run somewhere else but not in horton sandbox. How to loacate HIVE_HOME and other Sqoop parameters because that are running in Sandbox. parameters which I have to pass. It should be passes as SqoopOptions or Sqoop.runTools String Array Arguments. Both failing. I also get confused While import library (com.cloudera.sqoop and org.apache.sqoop) and get this The method run(com.cloudera.sqoop.SqoopOptions) in the type ImportTool is not applicable for the arguments (org.apache.sqoop.SqoopOptions) with this two line (option parameter are added between this two lines) SqoopOptions options = new SqoopOptions(); int ret = new ImportTool().run(options); if I choose Cloudera method get deprecated but if I choose apace run method doesn't accept the options argument I am strucked in this from weeks. Please Help.
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/24351904
tagged with: sqoop
favorite count: 0
linked to: http://stackoverflow.com/q/14918923

http://stackoverflow.com/q/24408453
tagged with: java
tagged with: eclipse
has body: I have an existing project and I have imported it to a maven project in Eclipse Juno. The classes are to be generated into the folder target->classes by default settings But i see the java files in there and not the class files. Sounds weird to me. I tried to build the project, try creating new project. Doesn't seem to work. If its a normal project, it does generate the classes. Anyone faced this problem before? Your inputs on this is highly appreciated. Thanks, Reema
has title: Generating classes in eclipse Maven project
answer count: 1
has comment: http://stackoverflow.com/comment/37757955
has comment: http://stackoverflow.com/comment/37758230
has answer: http://stackoverflow.com/a/24429080
has comment: http://stackoverflow.com/comment/37757956
type: AnsweredQuestion
score: 0
tagged with: maven
has comment: http://stackoverflow.com/comment/37757996
type: Question
accepted answer: http://stackoverflow.com/a/24429080

http://stackoverflow.com/comment/37764806
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24411311
has text: The main problem is missing reference time in the signature of convert-method. The question is not clear at all about timestamp versus duration. We should not encourage the OP to use methods with such signatures. If the method had at least TWO args of type `DateTime` then it might be tolerated (suggesting a better method name like "between").

http://stackoverflow.com/comment/37690322
has text: Can you paste the whole file here? You don't need any imports to declare an array.
score: 1
comment on: http://stackoverflow.com/q/24372403
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24414331
answer count: 1
duplicate of: http://stackoverflow.com/q/7434084
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/24414587
has comment: http://stackoverflow.com/comment/37769085
favorite count: 0
has title: Why do we need Boolean(boolean) constructor in java?
type: UnansweredQuestion
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37769052
linked to: http://stackoverflow.com/q/7434084
type: Question
has body: I'm wondering if there is any legacy reason or common use case, because I do not see any use for this constructor. Why use this: Boolean b = new Boolean(var); when we have: Boolean b = var; // Java will auto-box into Boolean.TRUE / Boolean.FALSE or Boolean b = Boolean.valueOf(var); The documentation states that it is rarely appropriate to use this constructor, unless a new instance is required. When do we need require a new instance?

http://stackoverflow.com/q/24322028
tagged with: bigdata
tagged with: flume
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/31569540
has answer: http://stackoverflow.com/a/24331002
tagged with: twitter4j
tagged with: java
tagged with: twitter
has answer: http://stackoverflow.com/a/31569540
type: Question
has answer: http://stackoverflow.com/a/35162148
accepted answer: http://stackoverflow.com/a/24331002
score: 0
answer count: 3
has title: CDH Twitter example Java error
has body: I'm trying to follow the instructions from CDH Twitter Example and get a problem similar to the one posed in this question: 14/06/20 11:18:13 INFO twitter4j.TwitterStreamImpl: Establishing connection. 14/06/20 11:18:23 INFO twitter4j.TwitterStreamImpl: Connection established. 14/06/20 11:18:23 INFO twitter4j.TwitterStreamImpl: Receiving status stream. Exception in thread "Twitter4J Async Dispatcher[0]" java.lang.NoSuchMethodError: twitter4j.json.JSONObjectType.determine(Ltwitter4j/internal/org/json/JSONObject;)Ltwitter4j /json/JSONObjectType; at twitter4j.AbstractStreamImplementation$1.run(AbstractStreamImplementation.java:100) at twitter4j.internal.async.ExecuteThread.run(DispatcherImpl.java:116) The difference is that I only have twitter4j-core-3.0.3.jar (that is, I have no older versions of this file). The issue has been reported to the authour of the example on Git, but no solution was posted. Does it exist, and what can I do to work around this problem? Should I rebuild some jars?
linked to: http://stackoverflow.com/q/21263974

http://stackoverflow.com/comment/75615040
type: AnswerComment
has text: if your'e use spring mvc so write <tx:annotation-driven/> in dispatcher-servlet, and dont forget namespaces like tx,context...
comment on: http://stackoverflow.com/a/44168441
type: Comment
score: 1

http://stackoverflow.com/comment/37564352
comment on: http://stackoverflow.com/a/24305838
type: AnswerComment
score: 0
type: Comment
has text: For me it looks like i am using an unmarshaller based on a Class parameter, as context is created with JAXBContext.newInstance(EjendomSoegType.class) using a EjendomSoegType.class as input, wherefrom the unmarshaller is created: context.createUnmarshaller().

http://stackoverflow.com/a/24378201
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/24364634
answers question: http://stackoverflow.com/q/24364634
type: AcceptedAnswer
has body: possible answer to your query &lt;a href ="/RemoveCategory?remove=&lt;%=Database.getCategory().indexOf(k)%&gt;"&gt;

http://stackoverflow.com/comment/37774695
score: 0
type: AnswerComment
type: Comment
has text: Sorry I'm still a bit unsure what the question is. Do you mean header or fieldMapping, because they are 2 separate things?
comment on: http://stackoverflow.com/a/24400040

http://stackoverflow.com/q/24303014
score: 1
tagged with: java
tagged with: jscrollpane
upvote count: 1
answer count: 1
tagged with: layout-manager
has comment: http://stackoverflow.com/comment/37569305
favorite count: 0
has body: I have a content part with a vertical scroll bar, that is part of a window. The exact classes are: JScrollPane scrollPane1; JEditorPane editorPaneContent; JPanel contentPanel; scrollPane1.setViewportView(editorPaneContent); contentPanel.add(scrollPane1, CC.xy(1, 1)); The scrollbar should not always be visible, if the content is small, then it should not appear. (So far it works.) However if the content is large, and the scrollbar appears, resizing the main window (horizontally) will sometimes make the scrollbar disappear. Curious, that one resize makes it disappear, another resize makes it appear again. Disappear-appear-disappear in strict order. How can I force the scrollbar, to appear (only when it is needed by the length of the content) even after resizing the main window? Thanks for the help, Sziro.
has title: JScrollPane disappearing on resize
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37594269
tagged with: swing
has comment: http://stackoverflow.com/comment/37559337
type: Question
has answer: http://stackoverflow.com/a/49957046

http://stackoverflow.com/comment/37663093
score: 0
type: Comment
type: QuestionComment
has text: I have <context:annotation-config></context:annotation-config> in my context file. Shouldn't that make it work?
comment on: http://stackoverflow.com/q/24357693

http://stackoverflow.com/q/24327802
upvote count: 1
has comment: http://stackoverflow.com/comment/37606149
tagged with: spring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24330066
score: 1
tagged with: java
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/37605057
has body: My Java web application needs to serve up many static HTML reports. The reports are generated on-demand using a 3rd party application based on user's inputs. The reports will always be different from run to run, so they can't be cached. The reports include multiple HTML pages (including JS and CSS pages), and relative links between files. What's the easiest way to serve up these reports to the front-end user? The reports don't need to stick around -- they can be deleted after a set time or after the user logs out. I'm using: Tomcat 7 Spring framework Here is a similar example: Suppose the web app is an online IDE, and you'd like to occasionally generate and display Javadoc pages for the project.
has title: How to host user-generated HTML pages from Java web app?
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has answer: http://stackoverflow.com/a/24330066
favorite count: 0
has comment: http://stackoverflow.com/comment/37605195

http://stackoverflow.com/q/24310889
possible better answer: http://stackoverflow.com/a/24430459
has title: How to redirect AWS sdk logging output
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24430459
downvote count: 0
tagged with: amazon-web-services
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24410069
score: 15
tagged with: scala
answer count: 2
has body: I keep getting those on STDOUT even though I'm using logback and configured it. I'm not able to get AWS stuff out of the console. Jun 19, 2014 3:46:40 PM com.amazonaws.http.AmazonHttpClient executeHelper INFO: Unable to execute HTTP request: The target server failed to respond org.apache.http.NoHttpResponseException: The target server failed to respond at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:95) at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:62) at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:254) at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:289) at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:252) at org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:191) at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:300) at com.amazonaws.http.protocol.SdkHttpRequestExecutor.doReceiveResponse(SdkHttpRequestExecutor.java:66) at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:127) at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:713) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:518) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805) at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:402) at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:245) at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3573) at com.amazonaws.services.s3.AmazonS3Client.getObjectMetadata(AmazonS3Client.java:990) at com.amazonaws.services.s3.AmazonS3Client.get…
tagged with: logging
tagged with: java
tagged with: logback
accepted answer: http://stackoverflow.com/a/24410069
upvote count: 15

http://stackoverflow.com/comment/37808677
type: Comment
type: QuestionComment
score: 0
has text: @M.Sharma It's not the import statements that causes conflicts. ClassB will have compilation errors because it cannot access ClassA that is now in another directory/module.
comment on: http://stackoverflow.com/q/24423636

http://stackoverflow.com/a/24313006
has body: Unlike String, StringBuffer1 is a mutable type. True to this design, StringBuffer.reverse modifies the original object and then returns the same (current) StringBuffer instance; returning the same instance allows for method-chaining: [reverse] causes this character sequence to be replaced by the reverse of the sequence [and returns] a reference to this [StringBuffer] object. Thus StringBuffer w=p.reverse(); is semantically equivalent to p.reverse(); // side-effect! reverses content StringBuffer w == p; // w == p -&gt; true (same object), implies w.equals(p) -&gt; true One approach to solve this is to create a new StringBuffer instance for w, and reverse after. StringBuffer w = new StringBuffer(p); // w == p -&gt; false, w.equals(p) -&gt; true p.reverse(); // w == p -&gt; false, w.equals(p) -&gt; false If only needing a String, the same rules/logic apply - create a new object/copy of the data before reversing the StringBuffer. String s = p.toString() // s == p -&gt; false, s.equals(p) -&gt; true p.reverse(); // s == p -&gt; false, s.equals(p) -&gt; false While I doubt this is the actual task, consider p.toString.equals(p.reverse()) which also follows the preceding logic. boolean reversed = p.toString() // "s", new String / data copy .equals( p.reverse() // "p", reverse done after copy ); 1 StringBuffer is old, use StringBuilder going forward unless the synchronization properties are required: [StringBuilder] is designed for use as a drop-in replacement for StringBuffer in places where the string buffer was being used by a single threaded.. Where possible, it is recommended that this class be used in preference to StringBuffer as it will be faster under most implementations.
downvote count: 0
has comment: http://stackoverflow.com/comment/37577010
type: Answer
has comment: http://stackoverflow.com/comment/37577476
score: 2
answers question: http://stackoverflow.com/q/24312853
upvote count: 2

http://stackoverflow.com/a/25135413
type: Answer
has comment: http://stackoverflow.com/comment/39579607
accepted answer of: http://stackoverflow.com/q/24352137
score: 1
upvote count: 1
has body: This isn't your fault. ScoreOid certificate has expired. I filed a ticket and didn't get an answer.
answers question: http://stackoverflow.com/q/24352137
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/24279035
has comment: http://stackoverflow.com/comment/37513419
tagged with: resultset
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37513132
has comment: http://stackoverflow.com/comment/37512842
tagged with: jdbc
has comment: http://stackoverflow.com/comment/37513485
score: 2
answer count: 0
downvote count: 0
tagged with: sqlresultsetmapping
tagged with: java
tagged with: jdbi
linked to: http://stackoverflow.com/q/3942583
has comment: http://stackoverflow.com/comment/37512938
type: Question
has title: JDBI ResultSetMapper: partially map row to a Class
has comment: http://stackoverflow.com/comment/37513170
has body: When we define Mapper for a class, we have to fetch every column in sql queries in order to map with the Class in jdbc resultsetmapper eg. public class Mapper implements ResultSetMapper&lt;MyClass&gt;{ public MyClass map(int index, ResultSet rs, StatementContext ctx) throws SQLException{ MyClass mc = new MyClass(); mc.setEntity1(rs.getString("column1")); mc.setEntity2(rs.getString("column2")); mc.setEntity3(rs.getString("column3")); return mc; } } For using this mapper, I have to fetch every column used in Mapper, but If I fetch only 2 columns it will throw PSQLException. So instead of defining another Mapper for fetching 2 columns, is there any possible method to Use the same Mapper for mapping to MyClass?
upvote count: 2
has comment: http://stackoverflow.com/comment/37513065
favorite count: 0

http://stackoverflow.com/a/24271718
has comment: http://stackoverflow.com/comment/37499513
has comment: http://stackoverflow.com/comment/37499555
has comment: http://stackoverflow.com/comment/37506775
upvote count: 7
type: Answer
has body: There is no law that relates Comparable.compareTo() and equals(). However I'd say that it is confusing if compaeTo() returns 0 while equals() returns false. I think that in your case you should use custom comparator instead of making your class Comparable. The reason is that today your comparison criteria is age, tomorrow it will be the person's first name, then last name, then weight... etc, etc. This is the reason that Comparator was introduced and the use case when it should be used.
downvote count: 0
has comment: http://stackoverflow.com/comment/37511441
has comment: http://stackoverflow.com/comment/37499865
has comment: http://stackoverflow.com/comment/37529772
score: 7
has comment: http://stackoverflow.com/comment/37499772
answers question: http://stackoverflow.com/q/24271616

http://stackoverflow.com/a/24374756
has body: when you enter number and press Enter, It reads integer value to a and keeps \n in buffer Now when you invoke nextLine() it directly gets newline character from buffer skipping user's input to avoid it put next() method call to read left over \n from buffer before invoking newLine()and after successful execution of nextInt()
has comment: http://stackoverflow.com/comment/37710244
downvote count: 0
answers question: http://stackoverflow.com/q/24374730
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/q/24287775
accepted answer: http://stackoverflow.com/a/24287876
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/37529393
type: AnsweredQuestion
has body: My String for a URL to connect to my database is as follows String url ="jdbc:sqlserver://cvdserver07\\sql2005r2:3333;databaseName=YES_dev;integratedSecurity=true" the server is called cvdserver07\sql2005r2 and the port is 3333. The database name is YES_dev. It is not ran on the local host and the integratedSecurity=true is me trying to get windows authentication to work. I keep getting this error Unresolved compilation problem: Syntax error, insert ";" to complete LocalVariableDeclarationStatement Any help would be appreciated.
has comment: http://stackoverflow.com/comment/37529218
has answer: http://stackoverflow.com/a/24287876
score: 1
has comment: http://stackoverflow.com/comment/37529322
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/37529316
type: Question
has title: Unresolved compilation: Syntax error, insert ";" to complete LocalVariableDeclarationStatement JDBC Java

http://stackoverflow.com/comment/37529409
has text: Did you finally get it? I updated my answer with the information above
comment on: http://stackoverflow.com/a/24281116
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24347777
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: window
answer count: 1
has body: I have a problem with HSQLDB V2.3 on Windows. I can't connect with new databases using the HSQLDB Server. Is there a log or debug option for the server so I can check the properties loaded and file paths, etc? Is my properties file OK? I wasn't sure how to formulate file paths for windows. Can I use quotes on file path names? Is the connection string I'm using for the tmp db correct? What's the correct syntax to use the --props server argument? --props path --props path/filename I have set-up two environment variables (too keep it simple*). These variables don't have any effect except to save my typing. Initially I was loading the server from the HSQLDB folder directly. HSQLDB_HOME ... home folder for the current HSQLDB HSQLDB_DATA ... folder for data repository I am following the the steps from: Running and Using HSQLDB Every time I connect via the server it makes a database called, "test" instead of letting me connect to either of the two databases specified in the server.properties. %HSQLDB_DATA%/ test.log test.properties test.script test.tmp/ .......... (folder) test.lck I made a 'server.properties' file in: %HSQLDB_HOME%/lib/ where the HSQLDB JAR file is. I want two databases: tmp and dev: # -- tmp server.database.0=file:hsqldb/tmp_db/tmp server.dbname.0=tmp_db # #### # # -- dev server.database.1=file:r:/.data/hsqldb/dev_db/dev server.dbname.1=dev_db I expected that the properties file to be enough to set-up two databases. When I run the hsqldb manager I don't get a connection for tmp say: "jdbc:hsqldb:hsql://localhost/tmp" user: SA, password: "" I get a pop-up error: database alias does not exist (Manager) [Thread[HSQLDB Connection @26827674,5,HSQLDB Connections @372f7a8d]]: database alias=tmp does not exist (Server) I created these two manually using the cmd-line, e.g. named "tmp": %JAVA_HOME%\bin\java.exe -classpath %HSQLDB_HOME%\lib\hsqldb.jar org.hsqldb.server.Server org.hsqldb.server.Server --database.1 file:r:/.data/hsqldb/tmp_db --dbname.1 tmp_db And co…
score: 0
has title: How to ensure HSQLDB properties configuration loaded on Windows?
tagged with: windows
tagged with: hsqldb
has answer: http://stackoverflow.com/a/24348461
accepted answer: http://stackoverflow.com/a/24348461

http://stackoverflow.com/a/24371068
answers question: http://stackoverflow.com/q/24370978
type: Answer
has body: so many answers try this pattern to MATCH your request ([\d.]+)$ Demo for a replace version use this pattern ^.*?(?=[\d.]+$) Demo
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/37687808
has comment: http://stackoverflow.com/comment/37687763
has comment: http://stackoverflow.com/comment/37687912

http://stackoverflow.com/comment/37517843
has text: I think I remember seeing a very similar question at some point, and if memory serves the conclusion was that you can't. A nanosecond is just too short and short of *very* specialized hardware there just isn't a reliable way to be that accurate. GPS is *very* accurate, and even for that you get >10 ns of variation.
type: Comment
comment on: http://stackoverflow.com/q/24281726
type: QuestionComment
score: 0

http://stackoverflow.com/a/43611454
score: 24
answers question: http://stackoverflow.com/q/24386771
downvote count: 0
has body: If you are using tomcat as your server runtime and you get this error in tests (because tomcat runtime is not available during tests) than it makes make sense to include tomcat el runtime instead of the one from glassfish). This would be: org.apache.tomcat tomcat-el-api 8.5.14 test org.apache.tomcat tomcat-jasper-el 8.5.14 test
upvote count: 24
has comment: http://stackoverflow.com/comment/100694264
type: Answer

http://stackoverflow.com/comment/37594090
score: 0
type: Comment
has text: Is it a valid JSON string. Test it here [jsonlint](http://jsonlint.com/) that says `Parse error on line 18:`
type: QuestionComment
comment on: http://stackoverflow.com/q/24321975

http://stackoverflow.com/comment/37729233
type: QuestionComment
has text: Create a `Result` object hat has a `list` and an `exception`. Return that.
score: 3
comment on: http://stackoverflow.com/q/24393070
type: Comment

http://stackoverflow.com/comment/37626771
comment on: http://stackoverflow.com/a/24339177
type: AnswerComment
has text: @dystroy So in the case of argument matching compiler only sees if the parameters can hold the arguments
score: 0
type: Comment

http://stackoverflow.com/comment/37963021
comment on: http://stackoverflow.com/a/24424532
type: Comment
has text: It looks like you caught the culprit! However, I didn't come across it in my example. How do you register resources and providers in your application? I scan classes only from my own packages and I register the JacksonJsonProvider explicitly - probably that's why the mapper from com.fasterxml... doesn't come into play. And about logs - jersey uses java.util.logging so you need to configure it separately or use a jul to slf4j bridge. But for sure there is a log entry listing all registered providers and the unwanted one should be also on that list.
score: 0
type: AnswerComment

http://stackoverflow.com/a/25445206
has comment: http://stackoverflow.com/comment/39727361
answers question: http://stackoverflow.com/q/24290976
type: Answer
has comment: http://stackoverflow.com/comment/39725718
has body: An solution for you: provide your own FactoryBean to create your service bean. in your FactoryBean, you shuld use ThreadLocal to hold your bean, if not exist, create one and save it to ThreadLocal, next time, retrieve it from ThreadLocal!
upvote count: 1
downvote count: 1
score: 0

http://stackoverflow.com/q/24367877
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37682014
upvote count: 5
score: 4
has title: How to get children elements dynamically within expandablelistview by clicking parent node in android
answer count: 1
has body: I am very new to android so could anyone explain very easily about how to make the childList dynamic by clicking the parent? My problem: I have some static parent in expandablelistview. My intention is, when I will select a parent to see its child, the child will come dynamically form data base and they will be navigable (I want to see more detail or go to a different page.) I done the static child in three steps. Create XML file with expandablelistview. On main java call adapter Bind adapter with expandablelistview. create custom adapter. The adapter is following: package com.example.eschool_only_accrdion_straggle; import android.R.color; import android.content.Context; import android.graphics.Color; import android.view.View; import android.view.ViewGroup; import android.widget.BaseExpandableListAdapter; import android.widget.TextView; public class My_custom_adapter extends BaseExpandableListAdapter { private Context context; String [] parentList={"Summer Fruit", "Winter Fruit", "Hard fruit", "Watery Fruit"}; // String [][] childList={{"Lychy", "Mango"},{"Banana"},{"Pomy Granade"},{"pani Fruit"}}; public My_custom_adapter(Context context) { this.context = context; } // In Here 1st Parameter is for PARENT and 2nd one is for CHILD @Override public Object getChild(int groupPosition, int childPosition) { // TODO Auto-generated method stub return null; } @Override public long getChildId(int groupPosition, int childPosition) { // TODO Auto-generated method stub return 0; } @Override public View getChildView(int groupPosition, int childPosition, boolean arg2, View arg3, ViewGroup arg4) { TextView TxtV_child=new TextView(context); TxtV_child.setText(childList[groupPosition][childPosition]); TxtV_child.setPadding(35, 0, 0, 0); TxtV_child.setTextColor(Color.CYAN); TxtV_child.setTextSize(17); return TxtV_child; } @Override public int getChildrenCount(int groupPosition) { return childList[groupPosition].length; } @Override public Object getGroup(int groupPosition) { return gro…
has comment: http://stackoverflow.com/comment/37682927
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: expandablelistview
has answer: http://stackoverflow.com/a/24369483
tagged with: java

http://stackoverflow.com/a/24324814
has comment: http://stackoverflow.com/comment/37599490
has comment: http://stackoverflow.com/comment/37599870
score: 0
has comment: http://stackoverflow.com/comment/37599514
type: Answer
has body: Find the substring that contains what you want, by calling indexOf twice. Use split() on just that substring. Here is one alternate solution that uses only indexOf and substring. public class Program{ public static void main(String[] args) { String input = "1234 2345 3456 4567"; int firstIndex = input.indexOf(" "); int secondIndex = input.indexOf(" ", firstIndex + 1); String[] output = new String[] {input.substring(0, firstIndex), input.substring(firstIndex+1, secondIndex)}; System.out.println(output[0]); System.out.println(output[1]); } } Output: 1234 2345
answers question: http://stackoverflow.com/q/24324761

http://stackoverflow.com/comment/37588026
score: 1
has text: This would make the key non-unique, meaning that whatever you add to the directory would be overridden with this key
type: Comment
comment on: http://stackoverflow.com/a/24318586
type: AnswerComment

http://stackoverflow.com/comment/37590969
has text: why would this query produce 500 records?
comment on: http://stackoverflow.com/q/24319978
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/73204282
type: Comment
score: 2
comment on: http://stackoverflow.com/a/43038991
type: AnswerComment
has text: I don't like this answer much. It's a bit vague about what could be happening. The really interesting part is the paragraph below the big grey block, where you start talking about `Scene`, but nothing else is Java FX specific. However, in the absence of any other reasonable solution, you are the recipient of the bounty. Congratulations.

http://stackoverflow.com/comment/37611930
comment on: http://stackoverflow.com/a/24327826
type: AnswerComment
score: 1
type: Comment
has text: @Remus The behavior change didn't please me either. I agree with you on exhausting all lock files could be an issue. I'll raise this on the OpenJDK site.

http://stackoverflow.com/a/24325364
accepted answer of: http://stackoverflow.com/q/24325178
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/24325178
type: AcceptedAnswer
downvote count: 0
has body: It works if I add the following at the beginning of my JSP file: &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt; &lt;%@ taglib prefix="nav" uri="/WEB-INF/taglibs/navigation.tld" %&gt; &lt;%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %&gt; This is a working answer for now, but I think the best answer would be the one that tells how it can be sufficient to include the lines above in taglibs.jspf, instead of having them in every .jsp file.
type: Answer

http://stackoverflow.com/comment/37741191
has text: the JSON parser can't find a valid object for the key "production_companies", are you sure its present in your JSON?
score: 0
comment on: http://stackoverflow.com/q/24399304
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37575814
type: Comment
type: QuestionComment
has text: [How to Ask](http://stackoverflow.com/questions/how-to-ask) explains that we would like the asker to research the problem before asking. As it is trivial to find the answer elsewhere (I simply searched ["bigdecimal from string"](https://www.google.com/?#q=bigdecimal+from+string), this question doesn't really add much to the site. As a general rule, when you are having a problem with a specific class (`BigDecimal`), do a google search of "java classname documentation" (so `java BigDecimal documentation`). Go through the page and see if any of those methods answers your question.
score: 1
comment on: http://stackoverflow.com/q/24308606

http://stackoverflow.com/comment/37623125
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24332474
has text: Thank you very much! Apart from your code I played a little bit with `ipady` in order to make the buttons from the last row as tall as 1 and 3 and also with the weight for when the application is resized. Your code has been very helpful and I have learned quite Swing playing with it, thanks!
type: Comment

http://stackoverflow.com/q/24281528
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37542294
tagged with: java
score: -1
possible better answer: http://stackoverflow.com/a/24282539
tagged with: eclipse
has answer: http://stackoverflow.com/a/24282539
has answer: http://stackoverflow.com/a/24281729
answer count: 2
has comment: http://stackoverflow.com/comment/37525703
has body: I am running my maven project on tomcat using eclipse. But don't know why its running it on 8080 port as Tomcat7 installed is running on 8081 port. I don't know how to change it. I am running my project like right click on my project -&gt; run as -&gt; Run Configuration -&gt; Write "${workspace_loc:/myapp}" in Base directory-&gt; Goal "tomcat:run"&gt; then click Run then it shows "[INFO] Running war on "http://localhost:8080/myapp". Its by default running on my tomcat 6.0 server which is running my other applications. I have even changed target runtime to Tomcat7 and even tried change the goal to tomcat7:run. Please let me know if you need any further information
upvote count: 0
has comment: http://stackoverflow.com/comment/37517788
tagged with: tomcat
favorite count: 0
accepted answer: http://stackoverflow.com/a/24281729
has title: why eclipse running my project on apache 8080 by default
type: AnsweredQuestion
tagged with: maven

http://stackoverflow.com/q/24275724
has comment: http://stackoverflow.com/comment/37506674
type: AnsweredQuestion
has body: I have the following several HashMap initializations (previously defined elsewhere): hm1 = new HashMap&lt;String, Integer&gt;(); hm2 = new HashMap&lt;String, Integer&gt;(); . . . hmn = new HashMap&lt;String, Integer&gt;(); One idea would be to store the references into an array and then create the objects within a for loop, but that would allocate unnecessary space. Any ideas?
tagged with: java
has comment: http://stackoverflow.com/comment/37507071
accepted answer: http://stackoverflow.com/a/24275891
type: Question
has answer: http://stackoverflow.com/a/24275958
has comment: http://stackoverflow.com/comment/37506987
has comment: http://stackoverflow.com/comment/37506752
answer count: 3
has answer: http://stackoverflow.com/a/24275823
has title: Any way to make several object initializations more compact?
has comment: http://stackoverflow.com/comment/37507016
has comment: http://stackoverflow.com/comment/37506701
tagged with: initialization
has comment: http://stackoverflow.com/comment/37507051
possible better answer: http://stackoverflow.com/a/24275823
has answer: http://stackoverflow.com/a/24275891
score: 0

http://stackoverflow.com/a/24286722
upvote count: 2
has comment: http://stackoverflow.com/comment/37538780
accepted answer of: http://stackoverflow.com/q/24286278
answers question: http://stackoverflow.com/q/24286278
score: 2
has comment: http://stackoverflow.com/comment/37551000
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Hope following java code helps to resolve your problem, String str = "IF(AND(ROUND($GX18-SUM(0)/$M$12;2)&lt;=0$AK$7=1);0;OR(1;A2)+O2)"; char[] ch = str.toCharArray(); int count = 0; String temp = ""; for (int i = 0; i &lt; ch.length; i++) { temp = temp + ch[i]; if ("AND(".equals(temp) || "OR(".equals(temp)) { count++; } if ("(".equals(temp) &amp;&amp; count &gt; 0) { count++; } if (")".equals(temp) &amp;&amp; count &gt; 0) { count--; } if (";".equals(temp) &amp;&amp; count == 0) { ch[i] = '#'; } if ((!"AND(".startsWith(temp) &amp;&amp; !"OR(".startsWith(temp)) || temp.length() &gt; 4) { temp = ""; } } System.out.println("Expected Data &gt;&gt; " + String.valueOf(ch));

http://stackoverflow.com/comment/37715962
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24377211
has text: I am validating the content at serverside for cleanhtml, so i can't use the tool. If you have a regex for this, please let know.

http://stackoverflow.com/q/24391951
tagged with: linked-list
has body: This is a code for polynomial addition using linked lists. public class LinkedPolynomial{ private Node first=new Node(0,0); private Node last=first; private static class Node{ int coef; int exp; Node next; Node(int coef,int exp){ this.coef=coef; this.exp=exp; } } private LinkedPolynomial(){} public LinkedPolynomial(int coef,int exp){ last.next=new Node(coef,exp); last=last.next; } //return c=a+b public LinkedPolynomial plus(LinkedPolynomial b){ LinkedPolynomial a = this; LinkedPolynomial c = new LinkedPolynomial(); Node x=a.first.next; Node y=b.first.next; while(x!=null || y!=null){ Node t=null; if(x==null){ t=new Node(y.coef,y.exp); y=y.next; } else if(y==null){ t=new Node(x.coef,x.exp); x=x.next; } else if(x.exp&gt;y.exp){ t=new Node(x.coef,x.exp); x=x.next; } else if { t=new Node(y.coef,y.exp); y=y.next; } else{ int coef=x.coef+y.coef; int exp=x.exp; x=x.next; y=y.next; if(coef==0) continue; t=new Node(coef,exp); } c.last.next=t; c.last=c.last.next; } return c; } public static void main (String args[]){ LinkedPolynomial zero=new LinkedPolynomial(0,0); LinkedPolynomial p1=new LinkedPolynomial(4,3); } } In the method plus() can someone please explain to me what is done with LinkedPolynomial a = this; LinkedPolynomial c = new LinkedPolynomial(); Node x=a.first.next; Node y=b.first.next; What is a.first.next; What is LinkedPolynomial. Is it a node? Does every LinkedPolynomial has a first and last? Can someone please explain these to me.
tagged with: java
has comment: http://stackoverflow.com/comment/37727611
type: Question
has answer: http://stackoverflow.com/a/24392368
answer count: 2
has comment: http://stackoverflow.com/comment/37727525
has title: Polynomial addition using Linked List
score: 0
has comment: http://stackoverflow.com/comment/37727643
has answer: http://stackoverflow.com/a/24392439
tagged with: polynomials
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37727579

http://stackoverflow.com/comment/37506311
type: Comment
has text: If you are using Eclipse its as easy as right clicking your project -> export -> Java -> JAR file.
score: 0
comment on: http://stackoverflow.com/q/24275397
type: QuestionComment

http://stackoverflow.com/q/24289391
has answer: http://stackoverflow.com/a/24289475
has comment: http://stackoverflow.com/comment/37534404
tagged with: bigdecimal
has comment: http://stackoverflow.com/comment/37532690
has answer: http://stackoverflow.com/a/24289469
tagged with: int
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/37532871
duplicate of: http://stackoverflow.com/q/12944559
has body: I have one value like 0.0004 when I store this in Integer it is converting into Exponential format, So I have used Bigdecimal to convert it to normal value like below Bigdecimal x=BigDecimal.valueOf(0.0004) Now I am trying to multiply as x*100 but I am getting below error. Error: The operator * is undefined for the argument type(s) BigDecimal, int Because of this error if I use this without bigdecimal again it is converting to EXponential. Can any one please suggest me the way to multiply Bigdecimal and int. googled a lot but couldn't find the correct solution. Thanks for your time
has comment: http://stackoverflow.com/comment/37532898
has comment: http://stackoverflow.com/comment/37532645
favorite count: 0
has title: multiply Bigdecimal and int generating error
has comment: http://stackoverflow.com/comment/37535155
possible better answer: http://stackoverflow.com/a/24289475
tagged with: android
has comment: http://stackoverflow.com/comment/37533203
has comment: http://stackoverflow.com/comment/37532972
has comment: http://stackoverflow.com/comment/37532589
type: AnsweredQuestion
score: 3
linked to: http://stackoverflow.com/q/12944559
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37532551
accepted answer: http://stackoverflow.com/a/24289469
type: Question

http://stackoverflow.com/comment/37547297
comment on: http://stackoverflow.com/q/24296886
score: 0
type: Comment
type: QuestionComment
has text: @AlexandreSantos It is not; it is a Java project.

http://stackoverflow.com/comment/37673597
score: 1
type: Comment
type: QuestionComment
has text: Ok.. use combo box instead of textbox with list view. You can hide the arrow button in the combo box, so that it looks like a textbox. Add a selection listener to combobox and populate rest of the fields based on selection. http://stackoverflow.com/questions/21379865/how-to-hide-the-down-arrow-button-on-a-combobox-in-javafx
comment on: http://stackoverflow.com/q/24362525

http://stackoverflow.com/comment/37532292
score: 0
type: QuestionComment
type: Comment
has text: `return` means to return from (i.e. leave) the _method_ you're in, which is `main`. You can't just use `return` to mean "return to some other point in the program". I hate to be harsh, but if you're trying to program by guessing, that doesn't work--you need to find a good tutorial.
comment on: http://stackoverflow.com/q/24289131

buttonclick
type: Tag
tag name: buttonclick
tags question: http://stackoverflow.com/q/24305066

http://stackoverflow.com/comment/37548726
type: Comment
type: QuestionComment
has text: @alfasin, Adding a print statement after triming the line i've got 8 lines out of 12 from the file printed correctly and the error.
comment on: http://stackoverflow.com/q/24297688
score: 0

http://stackoverflow.com/q/24422045
tagged with: java
has body: This is my query. List exp = entityManager.getEntityManager() .createQuery("select sum(u.expenseAmount), u.wdExpenseGroup.expenseGroupName from WdExpense u WHERE MONTH(CAST(u.expenseDate as date)) = MONTH(NOW()) AND YEAR(CAST(u.expenseDate as date)) = YEAR(NOW()) group by u.wdExpenseGroup.expenseGroupId") .getResultList(); I'm getting below error. java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: Exception Description: Syntax error parsing the query [select sum(u.expenseAmount), u.wdExpenseGroup.expenseGroupName from WdExpense u WHERE MONTH(CAST(u.expenseDate as date)) = MONTH(NOW()) AND YEAR(CAST(u.expenseDate as date)) = YEAR(NOW()) group by u.wdExpenseGroup.expenseGroupId], line 1, column 91: unexpected token [(]. Internal Exception: NoViableAltException(83!=[661:1: simpleConditionalExpressionRemainder[Object left] returns [Object node] : (n= comparisonExpression[left] | (n1= NOT )? n= conditionWithNotExpression[(n1!=null), left] | IS (n2= NOT )? n= isExpression[(n2!=null), left] );]) How can I solve this?
tagged with: mysql
has title: An exception occurred while creating a query in EntityManager
tagged with: jpa
type: UnansweredQuestion
tagged with: entitymanager
tagged with: jpql
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24424168

http://stackoverflow.com/a/24389655
has body: If you haven't already read them What is the difference between ApplicationContext and WebApplicationContext in Spring MVC? Difference between applicationContext.xml and spring-servlet.xml in Spring Framework The same applies to AbstractAnnotationConfigDispatcherServletInitializer's getRootConfigClasses() and getServletConfigClasses(). Basically that WebApplicationInitializer will construct (and register) a ContextLoaderListener with a AnnotationConfigWebApplicationContext registering all the @Configuration (and other @Component annotated) classes from getRootConfigClasses(). It will then construct and register a DispatcherServlet with all the @Configuration (and other...) classes from the getServletConfigClasses(). As part of the Servlet lifecycle, the container will first initialize all ServletContextListener objects. This means ContextLoaderListener will load first and refresh the AnnotationConfigWebApplicationContext that was given to it (if it wasn't already refreshed, which ideally it shouldn't be). It will also put this ApplicationContext as an attribute in the ServletContext. The container will then initialize the registered DispatcherServlet. Here's some more reading How does the web container manage the lifecycle of a spring controller SpringMVC lifecycle-- the overall view Basically, the DispatcherServlet will refresh the ApplicationConfigWebApplicationContext that it received by first setting its parent to the ApplicationContext in the ServletContext (set by the ContextLoaderListener), if there is one. It will then start picking and choosing beans from its ApplicationContext to set up the MVC stack, controllers, handler methods, interceptors, etc. By default, it will only look up its handler beans, @Controller beans, in the ApplicationContext it loaded, not its parent(s). What you seem to have done is @Override protected Class&lt;?&gt;[] getServletConfigClasses() { return new Class[] { WebMvcConfig.class }; } and @Override protected Class&lt;?&gt;[] getR…
has comment: http://stackoverflow.com/comment/37788554
has comment: http://stackoverflow.com/comment/37763756
has comment: http://stackoverflow.com/comment/37764601
has comment: http://stackoverflow.com/comment/37765474
has comment: http://stackoverflow.com/comment/37765676
has comment: http://stackoverflow.com/comment/37810718
has comment: http://stackoverflow.com/comment/37812459
has comment: http://stackoverflow.com/comment/37763812
has comment: http://stackoverflow.com/comment/37766088
has comment: http://stackoverflow.com/comment/37788069
has comment: http://stackoverflow.com/comment/37803743
has comment: http://stackoverflow.com/comment/37810811
has comment: http://stackoverflow.com/comment/37763360
accepted answer of: http://stackoverflow.com/q/24367503
has comment: http://stackoverflow.com/comment/37813332
score: 4
answers question: http://stackoverflow.com/q/24367503
has comment: http://stackoverflow.com/comment/37803814
has comment: http://stackoverflow.com/comment/37803656
has comment: http://stackoverflow.com/comment/37812145
has comment: http://stackoverflow.com/comment/37765560
has comment: http://stackoverflow.com/comment/37763671
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37767050
has comment: http://stackoverflow.com/comment/37788044
has comment: http://stackoverflow.com/comment/37788779
has comment: http://stackoverflow.com/comment/37765415
type: Answer
has comment: http://stackoverflow.com/comment/37763488
upvote count: 4

http://stackoverflow.com/comment/37623664
comment on: http://stackoverflow.com/q/24337311
has text: Because I am trying to hide/show a few buttons in an otherwise static layout. I may want to make the hidden button show up again later.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24554867
upvote count: 1
answers question: http://stackoverflow.com/q/24293010
has body: I recommend using Cinematics for what you are attempting to do. All you have to do is create a cinematic object, add the appropriate events to it, and then use objectName.play(). The best part is that you are able to use both your original idea of animation objects as well as through your edited idea of using MotionPaths. You just have to use AnimationEvents and MotionEvents respectively. You can also implement looping through a simple function that the wikipedia page gives you as well as being able to set direction for the movement.
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/37796305
type: Comment
has text: @a_horse_with_no_name Yes, there is at least an ODBC driver. SSIS can work with many databases, it's not tied to SQL Server
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24427552

http://stackoverflow.com/q/24288879
has answer: http://stackoverflow.com/a/24289030
has comment: http://stackoverflow.com/comment/37531516
has comment: http://stackoverflow.com/comment/37531724
has body: I surprisingly find this confusing. I must be missing something. So I have this simple syntax public class OMG{ public static void main(String args[]){ int hi=2; letsDoIt(); System.out.println(hi); } public static void letsDoIt(){ hi+=1; } } Obviously this cause an error, since hi is a local variable. Judging from my experience from python I added this public class OMG{ public static void main(String args[]){ int hi=2; letsDoIt(); System.out.println(hi); } public static void letsDoIt(){ this.hi+=1; } } Which adds extra error when non-static variable cannot be accessed from a static method. I added static to hi public class OMG{ public static void main(String args[]){ static int hi=2; letsDoIt(); System.out.println(hi); } public static void letsDoIt(){ this.hi+=1; } } The compiler scolds me for a illegal expression. I substitute the static with private (which some SO answers, recommend) but same error. Where's my mistake? Is there any way I can solve this, without making global class?
has answer: http://stackoverflow.com/a/24288907
has answer: http://stackoverflow.com/a/24288966
accepted answer: http://stackoverflow.com/a/24288966
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37531599
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/24288855
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37531592
possible better answer: http://stackoverflow.com/a/24288907
has comment: http://stackoverflow.com/comment/37531666
has comment: http://stackoverflow.com/comment/37531924
has title: How do I refer to a variable from a method in the same class
has comment: http://stackoverflow.com/comment/37531884
tagged with: class
tagged with: scope
has answer: http://stackoverflow.com/a/24288935
has comment: http://stackoverflow.com/comment/37531554
upvote count: 1
favorite count: 0

http://stackoverflow.com/q/24269218
has answer: http://stackoverflow.com/a/24269219
has body: I get the following message in the Eclipse console: unable to create selected WebDriver; exiting early. org.openqa.selenium.WebDriverException: Error forwarding the new session cannot find : {platform=ANY, browserName=firefox, version=}
score: 0
has title: Error launching RemoteWebDriver test from Eclipse
type: AnsweredQuestion
tagged with: remotewebdriver
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: selenium
accepted answer: http://stackoverflow.com/a/24269219
type: Question
tagged with: firefox
answer count: 1

http://stackoverflow.com/comment/37788310
type: AnswerComment
type: Comment
has text: fixed, have to scroll down to 5.1.3 though, should be easy to find. -- edited, nevermind, found the anchor.
comment on: http://stackoverflow.com/a/24424722
score: 0

http://stackoverflow.com/q/24285636
has answer: http://stackoverflow.com/a/24286135
duplicate of: http://stackoverflow.com/q/16664808
score: 0
has comment: http://stackoverflow.com/comment/37525081
has comment: http://stackoverflow.com/comment/37525166
has answer: http://stackoverflow.com/a/24285952
has title: Check if 'Key' exists in a hashmap
has answer: http://stackoverflow.com/a/24286248
type: UnansweredQuestion
has body: I have a hashmap with Key and Value being 'String'. I want to check if a particular key exists by ignoring string after '$' in the Key. Hashmap contains keys as 'acctId$accountId', 'acctId$desc', 'acctId$crncyCode' etc. Iterator itx = uiToSrvFldMapList.entrySet().iterator(); if(uiToSrvFldMapList.containsKey(cellId)){ String sSrvFld = (String) uiToSrvFldMapList.get("acctId"); System.out.println("sSrvFld :: " +sSrvFld);
answer count: 4
has comment: http://stackoverflow.com/comment/37525073
tagged with: java
has answer: http://stackoverflow.com/a/24285689
type: Question
linked to: http://stackoverflow.com/q/16664808

http://stackoverflow.com/a/24352672
has body: Expanding on @EJP's answer, the corruption you are experiencing is a result of an application programming error of some kind. If you are using DataOutputStream to write the data, you should use DataInputStream to read it. And make sure that the sequence of write calls exactly matches the sequence of read calls. If you want to read using a Scanner, then you need to format the data as text, and use a Writer to write it. (Make sure that you use the same character encoding scheme at both ends, and avoid doing nasty things like mapping binary data to text via String(byte[]) ... 'cos they tend to break.) If you are either reading or writing the data using multiple threads that read from / write to a single stream, then you need to use some kind of locking to ensure that the messages interleave correctly / cleanly. Streams are typically NOT thread-safe. As to whether JSON will give you better performance, you probably need to do some experiments to be sure. Among other things, it will depend on the complexity of the data and the way you chose to encode it in the non-JSON case. (But I'd expect DataOutputStream / DataInputStream to be fastest if you chose an appropriate encoding.)
accepted answer of: http://stackoverflow.com/q/24345899
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24345899

http://stackoverflow.com/comment/37667016
type: QuestionComment
has text: The code was hidden from us! I don't know how I can access it
type: Comment
comment on: http://stackoverflow.com/q/24359606
score: 0

http://stackoverflow.com/a/24383095
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/24377067
has comment: http://stackoverflow.com/comment/37719255
has body: I second that what Tarik said in his answer. Possible algorithm I can think of (it is only idea and is not optimal but can be improved): First part - straightforward solving: 1) Assign to each empty cell list of possible numbers to insert (based on sudoku rules). 2) Iterate over each empty cell and check if list of possible numbers to insert contains only one element. If contains only one possible number to insert then insert this number and repeat step (1). If you cant insert more numbers go to second part. Second part - branching: 3) Iterate over each empty cell in ascending order based on number of possible numbers to insert (from first part). 4) Here comes the recursion. For each of possibe number to fill in given cell create separate sudoku board and try to solve it in same way starting from step (1) This recursive approach (Depth-first search) will allow you to find all possible solutrions. This is good excercise to increase your programing skills :)

http://stackoverflow.com/q/24396870
has answer: http://stackoverflow.com/a/24397104
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24397124
type: UnansweredQuestion
tagged with: encryption
has body: I'm currently running into problems decrypting my data. The base64 of the encoded string is being stored in the database. So, I'm printing out the encoded string and then trying to run it back through with "DECRYPT" instead of "ENCRYPT". However, I never get a value that the Decrypter method likes, it always gives me an error about parameters or the value not being 16 bytes. public class crypto { public static void main(String [] args) { String s = args[0]; String s1 = args[1]; String ivkey = "thisisasecretkey"; byte[] ivraw = ivkey.getBytes(); SecretKeySpec skeySpec = new SecretKeySpec(ivraw, "AES"); if (s.equalsIgnoreCase("ENCRYPT")) { try { Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, skeySpec); byte[] encrypted = cipher.doFinal(s1.getBytes()); System.out.println(new String(Base64.encodeBase64(encrypted))); } catch (Exception e) { throw new RuntimeException(e); } } else { try { Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, skeySpec); byte[] encrypted = cipher.doFinal(s1.getBytes()); System.out.println(new String(Base64.decodeBase64(encrypted))); } catch (Exception e) { e.printStackTrace(); } } return; }; } command:crypto "ENCRYPT" "password" output: 5eQvSzPG1TE2AybgCmeV6A== command:crytpo "DECRYPT" "5eQvSzPG1TE2AybgCmeV6A==" output: java.security.InvalidKeyException: Parameters missing I'm aware of the security flaws, that's not what I'm asking about and I would prefer answers/comments not get cluttered with best practices.
tagged with: aes
has title: JAVA: AES Decryption
tagged with: java
type: Question

http://stackoverflow.com/comment/37758002
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24408481
has text: It depends on the format your files: what makes it equal?
score: 0

http://stackoverflow.com/q/24404847
type: Question
has answer: http://stackoverflow.com/a/24404927
has comment: http://stackoverflow.com/comment/37756312
tagged with: generics
has body: In following code: class BaseT {} class Base&lt;T extends BaseT&gt; {} class CLass1T extends BaseT {} class Class1&lt;T extends Class1T&gt; extends Base&lt;T&gt; {} I would like: a) class Class1 should inherit class Base and parameter in bounds should be passed to class Base (It is done in this code) b) Class1 should have parameter Class1T in their code, not T. Something like this: class Class1&lt;T&gt; extends Base&lt;Class1T&gt; {} c) Class1 should be opened to inheritance. Example: class CLass2T extends CLass1T {} class Class2 extends CLass1&lt;Class2T&gt; {} How to do this? Is it possible?
answer count: 1
score: 0
tagged with: java
has title: Generics and inheritance with bounds
type: UnansweredQuestion

http://stackoverflow.com/comment/37784644
type: Comment
has text: Means you wanna populate your HashMap Where Key is class Node object and Value is array list of class ODData ?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24422068

exception
tags question: http://stackoverflow.com/q/24389930
tags question: http://stackoverflow.com/q/24280836
tags question: http://stackoverflow.com/q/24323567
tags question: http://stackoverflow.com/q/24388490
tags question: http://stackoverflow.com/q/24326693
tags question: http://stackoverflow.com/q/24353695
tags question: http://stackoverflow.com/q/24363988
tags question: http://stackoverflow.com/q/24340958
tags question: http://stackoverflow.com/q/24374730
tags question: http://stackoverflow.com/q/24399211
type: Tag
tags question: http://stackoverflow.com/q/24397571
tags question: http://stackoverflow.com/q/24419061
tags question: http://stackoverflow.com/q/24344511
tags question: http://stackoverflow.com/q/24342907
tags question: http://stackoverflow.com/q/24407229
tags question: http://stackoverflow.com/q/24417657
tags question: http://stackoverflow.com/q/24328545
tags question: http://stackoverflow.com/q/24284850
tags question: http://stackoverflow.com/q/24403448
tags question: http://stackoverflow.com/q/24332302
tags question: http://stackoverflow.com/q/24312717
tags question: http://stackoverflow.com/q/24289090
tags question: http://stackoverflow.com/q/24277208
tags question: http://stackoverflow.com/q/24393499
tags question: http://stackoverflow.com/q/24414299
tags question: http://stackoverflow.com/q/24391798
tag name: exception
tags question: http://stackoverflow.com/q/24280965
tags question: http://stackoverflow.com/q/24381762
tags question: http://stackoverflow.com/q/24392803
tags question: http://stackoverflow.com/q/24311061
tags question: http://stackoverflow.com/q/24408945
tags question: http://stackoverflow.com/q/24405848
tags question: http://stackoverflow.com/q/24279885
tags question: http://stackoverflow.com/q/24336123

http://stackoverflow.com/q/24360476
score: 0
accepted answer: http://stackoverflow.com/a/24378337
answer count: 1
has comment: http://stackoverflow.com/comment/37678712
has comment: http://stackoverflow.com/comment/37678877
has comment: http://stackoverflow.com/comment/37678791
has body: The following unzip finction doesn't work for all zip files. My zip file pattern is as follows- The Zip file contains one xml file and one folder(name- "images"). The name of the xml file is same as the zip file name. The folder("images") may or may not contain any files. I have validated the xml file before putting it into the zip file. It throws exception at this line for some zip files- FileOutputStream fout = new ileOutputStream(path.substring(0,path.length()-4)+"/"+filename); The function is: public boolean unZip(String path) { InputStream is; ZipInputStream zis; try { String filename; is = new FileInputStream(path); zis = new ZipInputStream(new BufferedInputStream(is)); ZipEntry ze; byte[] buffer = new byte[1024]; int count; while ((ze = zis.getNextEntry()) != null) { filename = ze.getName(); if (ze.isDirectory()) { File fmd = new File(path.substring(0,path.length()-4)+"/"+filename); fmd.mkdirs(); continue; } FileOutputStream fout = new FileOutputStream(path.substring(0,path.length()-4)+"/"+filename); while ((count = zis.read(buffer)) != -1) { fout.write(buffer, 0, count); } fout.close(); zis.closeEntry(); } zis.close(); } catch(IOException e) { e.printStackTrace(); return false; } return true; }
has comment: http://stackoverflow.com/comment/37678840
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/zip
tagged with: java
has title: Android unzip function not working
has answer: http://stackoverflow.com/a/24378337
type: Question
tagged with: unzip
has comment: http://stackoverflow.com/comment/37668538

http://stackoverflow.com/q/24394131
tagged with: delay
has answer: http://stackoverflow.com/a/24394296
score: 0
answer count: 2
has title: Java Swing redraw delay
possible better answer: http://stackoverflow.com/a/24394315
accepted answer: http://stackoverflow.com/a/24394296
has answer: http://stackoverflow.com/a/24394315
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/37731903
has body: I'm writing a little private application at the moment which utilizes the Wolfram Alpha Java Bindings. The application's GUI is realized using Swing. My Wolfram Alpha Plugin has a function looking like this: public void fire(String value) { // This sets the field state to loading _state = loading; // This tells the controller to redraw the window // When reading the state of the plugin it sets an // animated gif at a JPanel. This should be displayed // before the application is blocked by the Wolfram Alpha // Request. // updateInput does nothing more then call repaint after some // other function calls. No special threading included. getController().updateInput(""); // My wolfram request follows: WAQuery query = _engine.createQuery(); query.setInput(value); try { // For educational purposes, print out the URL we are about to send: System.out.println("Query URL:"); System.out.println(_engine.toURL(query)); System.out.println(""); // This sends the URL to the Wolfram|Alpha server, gets the XML result // and parses it into an object hierarchy held by the WAQueryResult object. WAQueryResult queryResult = _engine.performQuery(query); if (queryResult.isError()) { System.out.println("Query error"); System.out.println(" error code: " + queryResult.getErrorCode()); System.out.println(" error message: " + queryResult.getErrorMessage()); } else if (!queryResult.isSuccess()) { System.out.println("Query was not understood; no results available."); } else { // Got a result. System.out.println("Successful query. Pods follow:\n"); for (WAPod pod : queryResult.getPods()) { if (!pod.isError()) { System.out.println(pod.getTitle()); System.out.println("------------"); for (WASubpod subpod : pod.getSubpods()) { for (Object element : subpod.getContents()) { if (element instanceof WAPlainText) { System.out.println(((WAPlainText) element).getText()); System.out.println(""); } } } System.out.println(""); } } // We ignored many other types of Wolfram|Alpha output, such as warnings, assumptio…

http://stackoverflow.com/comment/37806127
type: QuestionComment
type: Comment
has text: And why? do you want to make some kind of load test?
comment on: http://stackoverflow.com/q/24400360
score: 0

http://stackoverflow.com/q/24302480
has comment: http://stackoverflow.com/comment/37557315
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24302576
tagged with: pattern-matching
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/80298872
has title: I want to check if a word or a set of words exists in a String
tagged with: android
has comment: http://stackoverflow.com/comment/37563173
tagged with: regex
has comment: http://stackoverflow.com/comment/37558077
tagged with: wordsearch
type: Question
has answer: http://stackoverflow.com/a/24302848
tagged with: java
has body: My requirement is to check if a group of words or a single word is present in a larger string. I tried using String.contains() method but this fails in case the larger string has new line character. Currently I am using a regex mentioned below. But this works for only one word. The searched text is a user entered value and can contain more than one word. This is an android application. String regex = ".*.{0}" + searchText + ".{0}.*"; Pattern pattern = Pattern.compile(regex); pattern.matcher(largerString).find(); Sample String String largerString ="John writes about this, and John writes about that," + " and John writes about everything. "; String searchText = "about this";

http://stackoverflow.com/comment/37678072
type: Comment
has text: So you actually need the `batchUpdate` method?
type: AnswerComment
comment on: http://stackoverflow.com/a/24362770
score: 0

http://stackoverflow.com/comment/37682359
comment on: http://stackoverflow.com/q/24367809
type: Comment
type: QuestionComment
has text: Ok I made an edit to the post as to what is happening now
score: 0

http://stackoverflow.com/a/24717258
score: 1
has comment: http://stackoverflow.com/comment/38375598
has body: I suggest you get aosp build work from a terminal window. I work on aosp 4.0.3 fork. Ubuntu 10.04 is preferred for this. It is old, but you don't have to change AOSP files to build. Building aosp from eclipse is not an option as far as I know. Please check Using eclipse to browse/edit/debug aosp tutorial.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24279992
downvote count: 0

http://stackoverflow.com/q/24377981
favorite count: 0
tagged with: atlassian-sourcetree
has answer: http://stackoverflow.com/a/24378000
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: git
type: Question
has body: My partner made a BitBucket git repository, and uploaded a Java project from Eclipse via SourceTree. I made my own project in Eclipse on my computer, and using SourceTree I pulled all the files from BitBucket. While these files show in Windows Explorer, they don't show in the Eclipse workspace. Is there a way to continue using SourceTree and Eclipse without using EGit, or is there no solution?
tagged with: eclipse
has title: Eclipse not recognizing files from SourceTree
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/124652467
has text: is this statement true: "In OOP you cannot do abstractions over behaviour"? I think otherwise, it is not that strict. If the behaviour is how to do things, we do often hide implementation details (if that implementation details represent a behaviour).
type: AnswerComment
comment on: http://stackoverflow.com/a/24359599
score: 0
type: Comment

http://stackoverflow.com/comment/37700368
has text: I apologize for the trouble but the action bar icons still won't display
score: 0
comment on: http://stackoverflow.com/a/24377230
type: AnswerComment
type: Comment

http://stackoverflow.com/a/24287917
answers question: http://stackoverflow.com/q/24287462
type: Answer
has body: http://en.wikipedia.org/wiki/Base32 example: Encode string to base32 string in Java
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/37716866
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24287462
downvote count: 0

http://stackoverflow.com/a/24286798
has comment: http://stackoverflow.com/comment/37528288
has comment: http://stackoverflow.com/comment/37527254
type: Answer
has body: If a component has a non-default constructor then you need to configure the constructor in the bean configuration. If you are using XML, it might look like this (example from the spring reference document): <constructor-arg ref="bar"/> <constructor-arg ref="baz"/> The key here is constructor wiring of the bean that will be used for the @AutoWire. The way you use the bean has no impact.
score: 0
answers question: http://stackoverflow.com/q/24286546

http://stackoverflow.com/comment/37637901
comment on: http://stackoverflow.com/q/24344648
type: Comment
type: QuestionComment
has text: Might be, but I'm not good enough to see whether it is and if it is, how I can fix that...
score: 0

http://stackoverflow.com/q/24309317
has answer: http://stackoverflow.com/a/24309439
type: UnansweredQuestion
has body: I have a grammar rule that looks like this: expr : ENUMFILED IN '(' ENUMVALUE (',' ENUMVALUE)* ')' ; ENUMFILED : 'color' | 'food' | 'car'; ENUMVALUE : (ALPHANUMERIC)+; DIGIT : '0'..'9' ; LETTER : ('a'..'z' | 'A'..'Z'); ALPHANUMERIC: (DIGIT | LETTER | '_'); So I can parse things like: car in (ford,toyota) color in (red,blue,green) In code I then want to convert those values from the in clause to enums. For each group I have an Enum type, e.g.: enum Car { FORD, TOYOTA, HONDA }; enum Color { RED, YELLOW, BLUE }; I will later walk the expression with a ParseTreeWalker many times so I want to convert the values to enums as I parse them. What's a good way of doing that? Note that there is more to my grammar so I can have multiple occurrences of the same field in the input: e.g. car in (ford,toyota) .... car in (honda)
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: antlr
downvote count: 0
answer count: 1
has title: How to best convert tokens to enum in antlr4?
favorite count: 0
tagged with: antlr4

ucanaccess
tag name: ucanaccess
type: Tag
tags question: http://stackoverflow.com/q/24365136

http://stackoverflow.com/a/24334578
type: Answer
has body: You can use a Properties class to read a .properties file. You can populate the .properties file as a normal text file with entries in the format key=value per line. You can place it in your filesystem and read it using an absolute path, like: //full path: Properties prop = new Properties(); prop.load(new FileInputStream("/path/to/file")); You can also place it in your web project's META-INF or WEB-INF folder so it will be loaded in the project's classloader when deployed. In this scenario you can read it without knowing its absolute path with the following commands: //relative path in Classloader: Properties prop = new Properties(); InputStream in = getClass().getResourceAsStream("foo.properties"); prop.load(in); in.close(); Once loaded, you can then read the properties entries with: props.getProperty("propName");
accepted answer of: http://stackoverflow.com/q/24334435
score: 0
answers question: http://stackoverflow.com/q/24334435
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37699684
has comment: http://stackoverflow.com/comment/37702689

http://stackoverflow.com/a/24397986
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24397976
type: AcceptedAnswer
downvote count: 0
has body: It is the default button padding you are seeing you cant do anything about it, but you can still put a drawable background to your button so the padding will disappear. solution: add background to the button so it wont have padding within it.
accepted answer of: http://stackoverflow.com/q/24397976

http://stackoverflow.com/q/24299512
has comment: http://stackoverflow.com/comment/37552164
has comment: http://stackoverflow.com/comment/37552548
type: Question
tagged with: websphere
has title: Connect to JDBC DataSource Using JNDI Websphere
score: 0
has comment: http://stackoverflow.com/comment/37552671
has body: I am trying to connect to a datasource available in my websphere 7.0 server through eclipse. Below is the code. Hashtable&lt;String, String&gt; pdEnv = new Hashtable&lt;String, String&gt;(); pdEnv.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory"); pdEnv.put(Context.PROVIDER_URL, "iiop://XX.XXX.XX.XX:YYYY"); Connection connection =null; Context initialContext = new InitialContext(pdEnv); DataSource datasource = (DataSource) initialContext.lookup("jdbc/AEDS"); if (datasource != null) { connection = datasource.getConnection("admin","admin"); // DB credintials } else { System.out.println("hi"); } But i am getting the below exception while trying to connect to it Exception in thread "P=365798:O=0:CT" javax.naming.ServiceUnavailableException: A communication failure occurred while attempting to obtain an initial context with the provider URL: at com.ibm.ws.naming.util.WsnInitCtxFactory.mapInitialReferenceFailure(WsnInitCtxFactory.java:2271) at com.ibm.ws.naming.util.WsnInitCtxFactory.getWsnNameService(WsnInitCtxFactory.java:1457) at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootContextFromServer(WsnInitCtxFactory.java:987) at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:909) at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:581) I am also confused about the port number to be used with iiop url as we have multiple server running on the same node and each having different bootstrap port.
tagged with: jdbc
answer count: 0
has comment: http://stackoverflow.com/comment/37553424
has comment: http://stackoverflow.com/comment/37553474
type: UnansweredQuestion
tagged with: jndi
tagged with: java
has comment: http://stackoverflow.com/comment/37558945
has comment: http://stackoverflow.com/comment/37552336
tagged with: datasource

http://stackoverflow.com/comment/37609661
score: 0
has text: Thank you for your post - I've edited the original question to be totally clear about it. Let's suppose I am willing to consider JNI calls - do you have anything to propose?
type: AnswerComment
comment on: http://stackoverflow.com/a/24327852
type: Comment

http://stackoverflow.com/a/24347651
type: Answer
answers question: http://stackoverflow.com/q/24347560
upvote count: 1
has body: After applying an AffineTransform, a Rectangle is no longer necessarily an ordinary Rectangle. A Rectangle however derives from Rectangle2D which implements Shape. And an AffineTransform can transform a Shape into a new Shape with its createTransformedShape method. That's a best way to go about it, if you want the full power of AffineTransform. You can draw a Shape, test whether points fall inside or outside it, turn it into an Area, etc.
score: 1
downvote count: 0

http://stackoverflow.com/comment/37649596
comment on: http://stackoverflow.com/a/24347457
has text: Thanks a lot for (both) your answer(s)! While this does answer the question, Pshemo's answer adds some additional stuff that I needed (and was visible from my own attempt). Sorry about not being clear in the requirements - it was late :-/
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24349823
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37648756
type: Answer
accepted answer of: http://stackoverflow.com/q/24349803
score: 2
answers question: http://stackoverflow.com/q/24349803
downvote count: 0
has body: In the button's ActionListener: if (textField.getText().isEmpty()) { JOptionPane.showMessageDialog(textField, "Beware: you left the text field blank"); } else { proceedAsUsual(); }
upvote count: 2

http://stackoverflow.com/a/24283131
has comment: http://stackoverflow.com/comment/37520373
has comment: http://stackoverflow.com/comment/37520382
type: Answer
has comment: http://stackoverflow.com/comment/37520380
has comment: http://stackoverflow.com/comment/37520333
score: 1
upvote count: 1
has body: If you are using JDK 7 you can use switch with strings. switch(className){ case "A": /* do your stuff */ break; default: //do default stuff } Im not sure why you having class 1 OR A (i guess it's because of ProGuard or any other obfuscator? If yes, use a Constant. Class a = YourClass.getClass(); The Obfuscator will change it automatically.
has comment: http://stackoverflow.com/comment/37520416
has comment: http://stackoverflow.com/comment/37520419
answers question: http://stackoverflow.com/q/24283038
downvote count: 0
has comment: http://stackoverflow.com/comment/37520388

http://stackoverflow.com/comment/37557142
type: AnswerComment
type: Comment
has text: Error: The constructor ArrayList<HeaderInfo>(List<String>) is undefined :(
comment on: http://stackoverflow.com/a/24302084
score: 0

http://stackoverflow.com/q/24320115
type: Question
tagged with: hadoop
score: -1
has answer: http://stackoverflow.com/a/24320438
accepted answer: http://stackoverflow.com/a/24320438
downvote count: 2
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/37590638
has body: I am new to mapreduce. I am running a mapreduce program. It's compiling fine and jar file is also created without any error but when I run the final Hadoop command it shows the following error and stops. This is the complete log: [u@h(IPC2-Gold) w]$ hadoop jar join.jar Runner -Dmapred.job.queue.name=score2 /axp/rim/score2/dev/cmc_score/rishabh/inp/file1.txt /axp/rim/score2/dev/cmc_score/rishabh/inp/file2.txt /axp/rim/score2/dev/cmc_score/rishabh/asd 14/06/19 21:28:44 INFO fs.JobTrackerWatcher: Current running JobTracker is: lgpbd1010.gso.aexp.com/10.22.45.20:9001 14/06/19 21:28:44 INFO mapred.JobClient: Cleaning up the staging area maprfs:/var/mapr/cluster/mapred/jobTracker/staging/rdwiv5/.staging/job_201405310436_72947 Exception in thread "main" org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory /axp/rim/score2/dev/cmc_score/rishabh/inp/file2.txt already exists at org.apache.hadoop.mapreduce.lib.output.FileOutputFormat.checkOutputSpecs(FileOutputFormat.java:132) at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:926) at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:885) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:396) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1127) at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:885) at org.apache.hadoop.mapreduce.Job.submit(Job.java:536) at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:566) at Runner.run(Runner.java:55) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65) at Runner.main(Runner.java:64) 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.apache.hadoop.util.RunJar.main(RunJar.java:197)
favorite count: 0
type: AnsweredQuestion
has title: MapReduce code cleaning staging area error
tagged with: java
tagged with: mapreduce

http://stackoverflow.com/a/24324924
answers question: http://stackoverflow.com/q/24321312
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24321312
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/37601049
has body: I expect you to be able to alter both databases. As you have written the data gets changed while the migration is processed, it shouldn't be so relevant how long it takes as the migration needs to be run more than once anyway. It has to cope with changing datasets, don't bother with performance, bother with correctness. Start with adding an indexed boolean column to the old database to mark migrated data, so you don't need to migrate it more than once. If the data in the old database gets updated (and not only inserted) while the migration is in process use a timestamp column instead. Mark the moment in time where its been shifted last and the moment where its been edited last - that way you can see what needs to be transformed and what already has been. Select data in chunks from older to newer. One chunk per thread (so first thread takes week 1, second takes week 2 etc.). If your table has no insertation date field use something else to split it - ID ranges, first letter of name, what have you. Make sure the sorting column has an index on it! Then you process the data in this form: Open transaction on both dbs. SELECT chunk of data from old one transform information create batch for insertion on new side (row - per row) create batch to mark for transformed on old side execute both batches commit both transactions only if both batches executed correctly. Most likely the bottleneck here is the java &lt;-> SQL Server network connection so using a sufficiently large connection pool is very important (at least amount of weeks since start +2 I would recommend). After you have transformed all the data once you will need to re-run it quite often to keep the data up to date. What you do with collisions is up to you. If you can do a cross-database selection from the old database an insertion trigger combined with a cross-database view will save you a lot of pain and soften the transformation.
score: 3

http://stackoverflow.com/comment/130153394
has text: As of 2022/09: OpenJDK Java 8 installer is available from Eclipse Temurin project - https://adoptium.net/temurin/releases/?version=8 . This does not require homebrew installed.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24342886

http://stackoverflow.com/q/24283926
has comment: http://stackoverflow.com/comment/37521875
tagged with: android
has comment: http://stackoverflow.com/comment/49123151
has comment: http://stackoverflow.com/comment/37521982
answer count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
tagged with: listview
type: Question
linked to: http://stackoverflow.com/q/20611123
has title: Set a background color to a selected ListView Item programatically
has body: There are many questions and answers explaining how to set the background color of a selected ListView item by using an adapter and selector. When an list view item is selected I want to define what background color it will have for the time being selected and I want to have different colors for different items. Using an OnItemSelectedListener did not work, probably doing it at that stage is too late.
tagged with: layout
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/37655373
type: QuestionComment
comment on: http://stackoverflow.com/q/24353695
has text: Oha! Yeah, I just realized that the Exception isn't a standard one, but is implemented inside the class `FeedController`. However that one is imported. The exception is a member of the `FeedController` class itself, so do I have to call it like `FeedController.ItemNotFoundException`?
score: 0
type: Comment

http://stackoverflow.com/comment/37715226
type: QuestionComment
has text: @Mahesh: I Use folder name layout-xlarge-port
comment on: http://stackoverflow.com/q/24384050
score: 0
type: Comment

http://stackoverflow.com/comment/37687027
type: Comment
has text: @axtavt I believe that is what I was missing too, thanks.
score: 0
comment on: http://stackoverflow.com/q/24370313
type: QuestionComment

http://stackoverflow.com/a/24289426
has comment: http://stackoverflow.com/comment/47153793
has body: Compiles for me fine in java 8. Earlier versions of Java might need more help return retval == null ? Collections.&lt;String&gt;emptyList() : retval; should work. EDIT This is due to improvements in Java 8 type inference as explained here http://openjdk.java.net/jeps/101 And here's a blog with the highlights: http://blog.jooq.org/2013/11/25/a-lesser-known-java-8-feature-generalized-target-type-inference/
has comment: http://stackoverflow.com/comment/37532757
type: Answer
has comment: http://stackoverflow.com/comment/37532642
upvote count: 27
has comment: http://stackoverflow.com/comment/47150397
downvote count: 0
has comment: http://stackoverflow.com/comment/37532702
has comment: http://stackoverflow.com/comment/37532602
score: 27
answers question: http://stackoverflow.com/q/24289320
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24289320

http://stackoverflow.com/comment/37787192
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24417974
has text: Thanks, I'm currently on it what rolls back the transaction.
type: Comment

http://stackoverflow.com/comment/37562226
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24304281
has text: Until you deign to post your secret code it is impossible to comment further.
score: 0

http://stackoverflow.com/comment/37723477
comment on: http://stackoverflow.com/a/24388075
type: AnswerComment
has text: That always get's me to :)
type: Comment
score: 1

http://stackoverflow.com/q/24382959
has comment: http://stackoverflow.com/comment/37710491
type: Question
has comment: http://stackoverflow.com/comment/37711428
has comment: http://stackoverflow.com/comment/37710154
accepted answer: http://stackoverflow.com/a/26581517
answer count: 2
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37711023
has body: So I am following this tutorial, using Sublime as a text editor and compiling everything from console. All was working good, but when we came to the part where you are supposed to make second Activity. They used Eclipse to autogenerate it and told me to paste it down, so I did. Here is my code (I added some imports and package at the beginning, it fixes some problems) /MyFirstApp/src/pl/qnsi/myfirstapp/DisplayMessageActivity.java package pl.qnsi.myfirstapp; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.MenuItem; public class DisplayMessageActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_message); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_display_message, container, false); return rootView; } } } And an error log from console [qnsi@archie MyFirstApp]$ ant debug Buildfile: /home/qnsi/code/Apps/learning/MyFirstApp/build.xml -set-mode-check: -set-debug-files: -check-env: [checkenv] Android SDK Tools Revision 22.6.4 [checkenv] Installed at /opt/android-sdk -setup: [echo] Project Name: MyFirstApp [gettype] Project Type: Applicatio…
possible better answer: http://stackoverflow.com/a/27561219
has comment: http://stackoverflow.com/comment/37710211
has answer: http://stackoverflow.com/a/27561219
favorite count: 0
has comment: http://stackoverflow.com/comment/37710224
has comment: http://stackoverflow.com/comment/37710138
upvote count: 2
tagged with: android
has title: 'cannot find symbol ActionBarActivity' following Android Development Tutorial?
has comment: http://stackoverflow.com/comment/41779493
has comment: http://stackoverflow.com/comment/37711479
has comment: http://stackoverflow.com/comment/41779193
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37710712
has answer: http://stackoverflow.com/a/26581517
tagged with: java

http://stackoverflow.com/comment/37642368
score: 1
has text: @necromancer Right, this technique isn't fully general in the cases where you want the index, but the data element can't be retrieved or computed using the index. (At least not easily.) For example, consider a problem where you're reading lines of text from a network connection, and you want to find the line number of the Nth line that matches some pattern. The easiest way is to map each line into a Pair or some composite data structure to number the lines. There's probably a hacky, side-effecty way to do this without a new data structure though.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24339157

http://stackoverflow.com/a/24333171
has body: My first guess is that you are dividing 0.0 by 0.0 -- maybe maxValue, minValue, and tfidf are all zero. My advice is to put a print statement just before the normalization step -- I'm guessing you'll see some unexpected values there.
answers question: http://stackoverflow.com/q/24333074
downvote count: 0
has comment: http://stackoverflow.com/comment/37615809
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/24306645
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37565101
has body: I have made a java code in eclipse. which is running properly. Now I need to make a web interface an use that code...Please tell me which is the easiest way to do it. I want to know in which language I can use that java code directly to develop the web content.
tagged with: java
has answer: http://stackoverflow.com/a/24307442
type: Question
has answer: http://stackoverflow.com/a/24308625
has title: Easiest way to embed java code in web content
has comment: http://stackoverflow.com/comment/37566316
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37565197
linked to: http://stackoverflow.com/q/1283468
tagged with: web
has comment: http://stackoverflow.com/comment/37565232

http://stackoverflow.com/comment/37565056
comment on: http://stackoverflow.com/q/24305935
has text: Take a screenshot? grep for public/private/protected?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/37539655
score: 0
type: AnswerComment
has text: There must be some Firefox API that can be accessed using any language, including Java.
type: Comment
comment on: http://stackoverflow.com/a/24293038

http://stackoverflow.com/q/24369630
tagged with: java
tagged with: forms
type: Question
linked to: http://stackoverflow.com/q/8986335
tagged with: mime-message
has body: I have a strange behavior, while Im sending a mail : This is my code : mailMessage.setSubject(subject); mailMessage.setHeader("Content-Type", "text/html; charset=UTF-8" ); mailMessage.setContent(content, "text/html"); Transport transport = mailSession.getTransport(); transport.connect(); transport.sendMessage(mailMessage,mailMessage.getRecipients(Message.RecipientType.TO)); transport.close(); This is what I send: (Only the form is concerned by the problem) &lt;form method="POST" action="localhost/Test/NotConnectedSetter.validateEmail" &gt; This is what I receive: &lt;form id="yui_3_16_0_1_1403504390037_61051" onsubmit="return theMainWindow.showFormWarning(this)" method="POST" target="_blank"&gt; Lots of things are added (What I don't care) but my action is deleted. I get the mail on yahoo (I'm not sure it's important, but who knows). This is my only form in the page, I have no idea how this happens. If anyone can help... Thanks
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24381310
has title: MimeMessage: Content sent different from content received

http://stackoverflow.com/comment/37666491
type: Comment
comment on: http://stackoverflow.com/a/24359515
score: 1
has text: Some explanation would be nice.
type: AnswerComment

http://stackoverflow.com/comment/37552793
score: 0
comment on: http://stackoverflow.com/a/24299765
type: AnswerComment
type: Comment
has text: i works but that code doesn't pass username, password in php. you have any idea?

http://stackoverflow.com/a/24397779
type: Answer
has comment: http://stackoverflow.com/comment/37778665
has comment: http://stackoverflow.com/comment/37738648
downvote count: 0
has comment: http://stackoverflow.com/comment/37769177
accepted answer of: http://stackoverflow.com/q/24397588
answers question: http://stackoverflow.com/q/24397588
score: 2
type: AcceptedAnswer
has body: With your current code you could end up with more than one task in the executor's queue at a time because you check if a task is running at the start of you method but only set it to true inside the runnable. It is completely possible that you could call the method twice before the first line of the runnable is run and the state is set to true. To ensure this does not happen you could use an AtomicBoolean to get and set the state atomically. private final AtomicBoolean runningBackgroundTask = new AtomicBoolean(false); private void runBackgroundTask() { if (runningBackgroundTask.getAndSet(true)) { System.out.println("This task will be ignored because the thread pool is busy."); return; } Runnable backgroundTask = new Runnable() { @Override public void run() { // Do something that takes time... runningBackgroundTask.set(false); } }; backgroundTaskExecutor.submit(backgroundTask); }
has comment: http://stackoverflow.com/comment/37738448
upvote count: 2

http://stackoverflow.com/comment/37774253
has text: I'm not sure if this will fix anything, but besides wondering where surf is called, I'd move `LinearLayout top = (LinearLayout)context.findViewById(R.id.topNav);` into your `onCreate()`. You may also consider making the `LinearLayout` visible in your `xml` temporarily just to make sure you can actually see it.
comment on: http://stackoverflow.com/q/24416822
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37610572
has text: How were you executing the queries? That depends on the language/library as in some cases they don't support a request body with GET.
type: AnswerComment
comment on: http://stackoverflow.com/a/24324210
type: Comment
score: 0

http://stackoverflow.com/comment/37636488
has text: Clarification: How will you be determining that no one is using one of your map elements (are you requiring "obtain"/"release" calls using the ID ?
type: QuestionComment
comment on: http://stackoverflow.com/q/24343981
type: Comment
score: 0

http://stackoverflow.com/comment/57965032
type: Comment
has text: if you want to perform the mathematical operation on the value, simply do it directly on the value (not using `get` as @vossad01 stated), like this: `ints.forEach((i)-> System.out.print((i-1)+ " "));`
type: AnswerComment
comment on: http://stackoverflow.com/a/24399368
score: 0

http://stackoverflow.com/comment/37757709
has text: @Keppil: Indeed, i suspect that makes blockingqueue quite useless in my case, cause when a item is added to the blockinqueue while drainto is executed the behaviour is undefined, maybe the added item is lost? Not sure what undefined means in this case, but it doesn't sound it can't be trusted. Going to do a bit of searching on the subject.
comment on: http://stackoverflow.com/q/24407640
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37704632
type: QuestionComment
comment on: http://stackoverflow.com/q/24379271
score: 0
has text: Create a base ship and extend it to make other ships. Keep your ships in a List .
type: Comment

http://stackoverflow.com/q/24350441
has comment: http://stackoverflow.com/comment/37649071
possible better answer: http://stackoverflow.com/a/24351863
has comment: http://stackoverflow.com/comment/37650826
tagged with: java
has answer: http://stackoverflow.com/a/24351863
score: -1
has body: From week I have been searching of a true explanation and implementation of MVC using java, but something i have noticed is that every one implement it differently, so I would be grateful if you give me a useful link or e-book about it, and I need these questions to be answered : How to inform the modal of the changes happen on the view, since the modal is observable adnd not observer ? How to inform the view of the changes happen on collections (adding an item to an arraylist), because to add an item this will be happen on the controller handler and the controller is not observable. Is it a must to work with MVC in the big projects.
has title: the true implementation of MVC in JAVA
tagged with: observer-pattern
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24350938
favorite count: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/37649633
upvote count: 1
accepted answer: http://stackoverflow.com/a/24350938
has comment: http://stackoverflow.com/comment/37649726
tagged with: model-view-controller
type: AnsweredQuestion

http://stackoverflow.com/a/24402430
type: Answer
answers question: http://stackoverflow.com/q/24367625
has body: Here is the solution. public static String getHierarchyPath (IlrElementDetails element) { try { if (!(element instanceof IlrRule)) return element.getName(); IlrRule rule = (IlrRule)element; StringBuffer sb = new StringBuffer (); // Get the rule name String name = rule.getName(); // Get the rule package IlrRulePackage current = rule.getRulePackage(); Stack&lt;String&gt; stack = new Stack&lt;String&gt; (); while (true) { if (current==null) break; // Push the package name onto the stack stack.push("/" + current.getName()); // Next parent ... current = current.getParent(); } // Pop the stack and build the path while (!stack.empty()) { String folder = (String) stack.pop(); sb.append(folder); } // Append the rule name to the path sb.append("/").append(name); // Return the built path return sb.toString(); } catch (Exception e) { return element.getName(); } }
score: 0

http://stackoverflow.com/a/24278618
has comment: http://stackoverflow.com/comment/37512509
has comment: http://stackoverflow.com/comment/37512143
answers question: http://stackoverflow.com/q/24278576
type: Answer
downvote count: 0
has body: To match all words followed by a comma and exactly one space: \b\w+(?=$|,[ ](?![ ])) See demo To retrieve the matches: Pattern regex = Pattern.compile("\\b\\w+(?=$|,[ ](?![ ]))"); Matcher regexMatcher = regex.matcher(your_original_string); while (regexMatcher.find()) { // matched text: regexMatcher.group() }
score: 3
has comment: http://stackoverflow.com/comment/37512197
has comment: http://stackoverflow.com/comment/37512245
has comment: http://stackoverflow.com/comment/37512558
upvote count: 3

http://stackoverflow.com/q/24333920
tagged with: mapreduce
type: Question
has answer: http://stackoverflow.com/a/24361468
tagged with: hadoop
score: 0
has title: Caught ClassCastException in my mapReduce code
answer count: 1
has body: Here attached my code, which could mash up all the avro files into a big one. When I run it, the classCastException is caught, can someone help me out? public class FileCompactionDriver extends Configured implements Tool { public static void main(String[] args) throws Exception { int returnCode = ToolRunner.run(new FileCompactionDriver(), args); /* Terminate job */ System.exit(returnCode); } public int run(String[] arg) throws Exception { /* Setup configuration */ Configuration conf = this.getConf(); /* Test if it is a valid running command */ if (arg.length != 2) { System.err.println("Usage: FileCompaction &lt;input path&gt; &lt;output path&gt;"); System.exit(2); } // Creating the job object from configuration Job job = Job.getInstance(conf); job.setJobName("FileCompactor"); job.setJarByClass(FileCompactionMapper.class); /* Setup the Mapper and Reducer classes */ job.setMapperClass(FileCompactionMapper.class); job.setReducerClass(FileCompactionReducer.class); job.setNumReduceTasks(1); /* Setup the output types */ job.setOutputKeyClass(AvroKey.class); job.setOutputValueClass(NullWritable.class); /* Setup the input and output classes format */ /* Handle and writing avro container files */ job.setInputFormatClass(AvroKeyInputFormat.class); job.setOutputFormatClass(AvroKeyOutputFormat.class); /* Specify input and output directories */ FileInputFormat.setInputPaths(job, new Path(arg[0])); FileOutputFormat.setOutputPath(job, new Path(arg[1])); return (job.waitForCompletion(true) ? 0 : 1); } }
has comment: http://stackoverflow.com/comment/37618462
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/24327441
type: UnansweredQuestion
tagged with: java
has body: Working with Eclipse Indigo on Windows 7 and Java 7, I have built a table from the CheckboxTableViewer class like this: tableViewer = CheckboxTableViewer.newCheckList ( groupTable, SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.VIRTUAL ); The viewer has two listeners, implementing respectively ISelectionChangedListener and ICheckStateListener. Everything works fine excepted the following: I cannot change the checkbox state on the selected row. Is this a known issue or should I add something to the definition of the viewer?
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/30811416
tagged with: eclipse-rcp
score: 0
has comment: http://stackoverflow.com/comment/37605355
tagged with: jface
has title: Cannot check/uncheck a checkbox on the selected row of a CheckboxTableViewer

http://stackoverflow.com/comment/37659512
type: AnswerComment
has text: Re your edit, the Registry doesn't 'detect new bindings automatically'. New bindings are created by a registry.bind()/rebind(). I don't understand your remark above about different ports. You don't need multiple Registries running on different ports per host.
type: Comment
comment on: http://stackoverflow.com/a/24347174
score: 0

http://stackoverflow.com/comment/37681216
type: QuestionComment
comment on: http://stackoverflow.com/q/24367313
has text: I can't understand what you're asking. Please clarify.
score: 0
type: Comment

http://stackoverflow.com/comment/43926011
type: Comment
has text: I think you cannot do that with the security manager. It will check the file permissions on normalized path. However this is actually better anyway, no matter how somebody tries to access a file, it will only be allowed if it is in the right place.
score: 0
comment on: http://stackoverflow.com/q/24376381
type: QuestionComment

http://stackoverflow.com/comment/37718651
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24386554
has text: what do you mean closed by lucene itself? you are responsible for closing the `IndexReader`. On the other hand, the `IndexSearcher` has no `close` method. As a side note.... have a look at the `SearcherManager` class and follow this example on how to use it : http://lucene.apache.org/core/4_0_0/core/
score: 0

gradle
tags question: http://stackoverflow.com/q/24276627
tags question: http://stackoverflow.com/q/24413746
tags question: http://stackoverflow.com/q/24289334
tags question: http://stackoverflow.com/q/24312001
tags question: http://stackoverflow.com/q/24289364
tags question: http://stackoverflow.com/q/24271518
tags question: http://stackoverflow.com/q/24391051
tags question: http://stackoverflow.com/q/24407368
tags question: http://stackoverflow.com/q/24363689
tags question: http://stackoverflow.com/q/24362944
type: Tag
tags question: http://stackoverflow.com/q/24280372
tags question: http://stackoverflow.com/q/24342031
tags question: http://stackoverflow.com/q/24379282
tags question: http://stackoverflow.com/q/24315233
tags question: http://stackoverflow.com/q/24342005
tags question: http://stackoverflow.com/q/24361397
tags question: http://stackoverflow.com/q/24372829
tag name: gradle
tags question: http://stackoverflow.com/q/24296942
tags question: http://stackoverflow.com/q/24337194
tags question: http://stackoverflow.com/q/24281235
tags question: http://stackoverflow.com/q/24405727
tags question: http://stackoverflow.com/q/24360099
tags question: http://stackoverflow.com/q/24403691
tags question: http://stackoverflow.com/q/24287370
tags question: http://stackoverflow.com/q/24425354
tags question: http://stackoverflow.com/q/24420252

http://stackoverflow.com/comment/37559737
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24303667
has text: No. {} can only be used to initialize an array. The correct way to print an array is with square brackets, like android.util.Arrays.arrayToString() (this method does not correctly handle multi-dimensional arrays)

http://stackoverflow.com/comment/37723066
has text: @AmanArora In addition to what TripeHound said, I've gotten the feeling that SO prefers questions that are like "Here's my problem, *here's what I tried*, but now I'm stuck" more than "Here's my problem, how do I proceed?" It can be a subtle difference, but showing what you have tried and researched could go a long way towards a question receiving a positive response instead of a negative one.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24388681

http://stackoverflow.com/a/24286176
has comment: http://stackoverflow.com/comment/37551689
has comment: http://stackoverflow.com/comment/37549507
score: 0
has comment: http://stackoverflow.com/comment/37551470
type: Answer
answers question: http://stackoverflow.com/q/24277036
has body: There is no AT command to start a SCO link (Audio link) over BT. A SCO link is started in Android by using AudioManager.startBluetoothSco() Have not used this myself so I can't help you more about this. Have you really connect a Bluetooth HF connection between two Android phones? I tought they only supported AG role not HF. It isn't a SPP connection you are using?
has comment: http://stackoverflow.com/comment/37551826

http://stackoverflow.com/a/24416735
score: 1
has comment: http://stackoverflow.com/comment/37773757
answers question: http://stackoverflow.com/q/24416683
has body: The variables that hold the values to be inserted should be passed as follows (with single quotes around them since they hold string values): stmt.executeUpdate("insert into empdetails(first_name,last_name,phone,email,city,state,pin) values('" + f_name + "', '" + l_name + "', '" + phno + "', '" + email + "', '" + city + "', '" + state + "', '" + pin +"')"); A better way is to use a PreparedStatement and put ? parameter placeholders in the SQL statement, which you can bind to your variables: preparedStmt.executeUpdate("insert into empdetails(first_name,last_name,phone,email,city,state,pin) values(?, ?, ?, ?, ?, ?, ?)"); preparedStmt.setString(1, f_name); preparedStmt.setString(2, l_name); ...
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/a/24339143
type: Answer
has body: WSimport tool automatically by default replaces returned arrays to lists.
score: 0
accepted answer of: http://stackoverflow.com/q/24268433
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24268433

http://stackoverflow.com/a/24408212
type: Answer
score: 0
has body: For using webview we need to add permission in manifestfile. Add the below code under the Androidmanifest.xml file ...
answers question: http://stackoverflow.com/q/24407451

http://stackoverflow.com/q/24338524
linked to: http://stackoverflow.com/q/19243708
has comment: http://stackoverflow.com/comment/37626283
has comment: http://stackoverflow.com/comment/37625628
downvote count: 0
score: 1
duplicate of: http://stackoverflow.com/q/19243708
favorite count: 0
type: Question
has body: public class NullDemo { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub NullDemo n = new NullDemo(); n.execute(null); } public void execute(Object o) { System.out.println("object"); } public void execute(Double o) { System.out.println("double"); } } i have executed this above code and it execute the method with execute(Double o).i need to know the reason why it executed execute(Double o) and not execute(Object o) and suppose public class NullDemo { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub NullDemo n = new NullDemo(); n.method1(null); /// give the compilation error } public void method1(Float o) { System.out.println("object"); } public void method1(Double o) { System.out.println("double"); } } if i make the method public void method1(Float o) and public void method1(Double o) it will give the compilation error why this is so? is this related with hierarchy?
tagged with: overloading
has answer: http://stackoverflow.com/a/24338600
tagged with: oop
tagged with: java
answer count: 3
upvote count: 1
has title: Which overloaded method will execute and why?
linked to: http://stackoverflow.com/q/1545501
has answer: http://stackoverflow.com/a/24338621
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24338610
duplicate of: http://stackoverflow.com/q/1545501
has comment: http://stackoverflow.com/comment/37625544

http://stackoverflow.com/q/24384765
has body: I need to write a custom serializer for a joda LocalDate. Serializer should be as fast as possible, and create an output which is as small as possible. I can send basic Java primitives and objects over the wire, e.g. long, boolean, int, String, etc, but not objects of any Joda types. I've noticied an internal "iLocalMillis" field which is not publicly accessable. Also not sure how to serialize the Chronology component... Any help would be appreciated. Cheers
has comment: http://stackoverflow.com/comment/37714188
has comment: http://stackoverflow.com/comment/37713322
upvote count: 2
has answer: http://stackoverflow.com/a/24385672
answer count: 1
favorite count: 0
has title: Efficient way to custom serialize a joda LocalDate
tagged with: serialization
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
tagged with: jodatime
accepted answer: http://stackoverflow.com/a/24385672

http://stackoverflow.com/comment/37689653
has text: Now can you post your `DBAdapter`, please?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24371617
score: 0

http://stackoverflow.com/comment/37760675
comment on: http://stackoverflow.com/q/24403665
has text: Ant isn't finding "dot" or "dot.exe" on the PATH. What OS are you running (Windows, Unix, etc.)?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24285029
has comment: http://stackoverflow.com/comment/37627921
downvote count: 0
answers question: http://stackoverflow.com/q/24283808
accepted answer of: http://stackoverflow.com/q/24283808
has comment: http://stackoverflow.com/comment/37527531
has comment: http://stackoverflow.com/comment/37609649
score: 1
has comment: http://stackoverflow.com/comment/37527347
has body: An alternative is to use ISaveablesSource which allows your editor to have multiple Saveable objects. Each Saveable has a separate dirty flag. If you are using a text editor based on AbstractTextEditor or one of its subclasses then the editor already implements ISaveablesSource and provides a Saveable for the main editor, so you would just add a Saveable for your outline data.
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37607846
type: Answer

http://stackoverflow.com/comment/76290676
type: Comment
score: 2
has text: The closing paranthesis for the panel.add is missing. After your edit, I will remove also this comment :)
type: AnswerComment
comment on: http://stackoverflow.com/a/24337376

http://stackoverflow.com/a/24421527
type: Answer
has body: Unix time represents the number of seconds from the epoch. As the name implies, getTimeInMillis() will return the number of milliseconds from the epoch. You need to divide your milliseconds by 1000 to get unix time. long unixTime = Calendar.getInstance().getTimeInMillis() / 1000;
upvote count: 2
has comment: http://stackoverflow.com/comment/37797968
score: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24421500
downvote count: 0
answers question: http://stackoverflow.com/q/24421500

http://stackoverflow.com/q/24355834
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/24359521
has answer: http://stackoverflow.com/a/24355989
tagged with: spring-integration
tagged with: java
tagged with: concurrency
has answer: http://stackoverflow.com/a/24371848
type: Question
has body: I'm a newbie in Spring Integration. In the current scenario, I was trying to call methods like this: MyObject.setMyList(); MyObject.setMyList1(); MyObject.setMyList2(); MyObject.setMyList3(); I had a interface to define the gateway, but my problem is how could i run this multiple methods at once using the spring integration and return MyObject. All the methods are interdependent here. Second case: I had a method which is dependent on the another method result. Method2 depends on Method1 result. method2.getMethod2Result(method1_String). How can I handle this situation using Spring Integration? I know how can handle it Java, but not in Spring Integration.
score: 0
answer count: 3
has title: Spring Integration to invoke multiple methods and response back to the same bean

http://stackoverflow.com/q/24274364
tagged with: neo4j
has title: In Neo4J, how to set the label as a parameter in a cypher query from Java?
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37515981
tagged with: cypher
upvote count: 16
has comment: http://stackoverflow.com/comment/58864530
tagged with: java
score: 16
has answer: http://stackoverflow.com/a/40960664
type: Question
has answer: http://stackoverflow.com/a/53562172
has answer: http://stackoverflow.com/a/24274528
answer count: 3
has body: I have problems with parameter in cypher in Neo4J from Java. I run the the database embedded. The code should be like this (GraphDB.cypher goes directly to the ExecutionEngine) HashMap&lt;String, Object&gt; parameter = new HashMap&lt;&gt;(); parameter.put("theLabel1", "Group"); parameter.put("theRelation", "isMemberOf"); parameter.put("theLabel2", "Person"); GraphDB.cypher("MATCH (n1:{theLabel1})-[r:{theRelation}]-&gt;(n2:{theLabel2}) RETURN n1, r, n2", parameter); but it ends in this exception Exception in thread "main" Invalid input '{': expected whitespace or a label name (line 1, column 11) "MATCH (n1:{theLabel1})-[r:{theRelation}]-&gt;(n2:{theLabel2}) RETURN n1, r, n2" The documentation (and tutorial) tells to use the { } to cover the parameters, BUT this is also used as the cypher json notation for properties. @See http://docs.neo4j.org/chunked/milestone/tutorials-cypher-parameters-java.html Is there another way to solve this issue rather than building the query string like this (or with other template methods) GraphDB.cypher("MATCH (n:" + labelName + ")-[r:" + relationName + "]-&gt;... This is needed because the target label can change and I want to reuse the code completly. Thanks in advance. EDITED AFTER GETTING A (sigh) NO AS ANSWER Since this form of parameter is currently (2014.6) not supported, I will run a little replacer right before sending the query. HashMap&lt;String, Object&gt; parameter = new HashMap&lt;&gt;(); parameter.put("theLabel1", "Group"); parameter.put("theRelation", "isMemberOf"); parameter.put("theLabel2", "Person"); parameter.put("aName", "Donald Duck"); GraphDB.cypher("MATCH (n1:#theLabel1#)-[r:#theRelation#]-&gt;(n2:#theLabel2#) WHERE n2.Name = {aName} RETURN n1, r, n2", parameter); ... with ... public static ExecutionResult cypher(String query, Map&lt;String, Object&gt; params) { for (String key : params.keySet()) { query = query.replaceAll("#" + key + "#", String.valueOf(params.get(key))); } return params == null ? cypherEngin…
downvote count: 0

http://stackoverflow.com/q/24346805
downvote count: 0
has comment: http://stackoverflow.com/comment/37654030
has body: This is a ACM-ICPC practicing problem: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&amp;Itemid=8&amp;page=show_problem&amp;problem=975. And the basic idea is to find the shortest weight of a minimum spanning tree. And I tried to solve it with Kruskal algorithm. I tested it myself and it seems to be working fine. However, when I submit it onto the uva online judge, the result is "wrong answer". Could any body see where is not correct? Thanks! import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Collections; //import java.util.Comparator; import java.util.List; //import java.math.*; public class Main { public static void main(String[] args) throws Exception, IOException { BufferedReader cin = new BufferedReader(new InputStreamReader(System.in)); int numOfCases = Integer.parseInt(cin.readLine()); while (numOfCases &gt; 0) { cin.readLine(); int numOfPoints = Integer.parseInt(cin.readLine()); List&lt;Points&gt; listOfPoints = new ArrayList&lt;Points&gt;(); List&lt;Edge&gt; listOfEdges = new ArrayList&lt;Edge&gt;(); double inkUsed = 0; for (int i = 0; i &lt; numOfPoints; i++) { String[] tokens = cin.readLine().split(" "); Points point = new Points(Double.parseDouble(tokens[0]),Double.parseDouble(tokens[1])); listOfPoints.add(point); } for (int i = 0; i &lt; listOfPoints.size(); i++) { for (int j = i+1; j &lt; listOfPoints.size(); j++) { Edge edge = new Edge(listOfPoints.get(i), listOfPoints.get(j)); listOfEdges.add(edge); } } Collections.sort(listOfEdges); for (Edge e: listOfEdges) { Points pointA = null; Points pointB = null; // Find pointA and pointB in the list "listOfPoints" for (int i = 0; i &lt; listOfPoints.size(); i++) { if (listOfPoints.get(i).x == e.A.x &amp;&amp; listOfPoints.get(i).y == e.A.y) { pointA = listOfPoints.get(i); } if (listOfPoints.get(i).x == e.B.x &amp;&amp; listOfPoints.get(i).y == e.B.y) { pointB = listOfPoints.get…
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
has title: Minimum Spanning Tree in Java
tagged with: minimum-spanning-tree
score: 2
tagged with: algorithm
tagged with: java
has comment: http://stackoverflow.com/comment/37642011
has comment: http://stackoverflow.com/comment/37641825
type: Question

http://stackoverflow.com/q/24410118
tagged with: swing
has comment: http://stackoverflow.com/comment/37790583
tagged with: java
has comment: http://stackoverflow.com/comment/37778911
has answer: http://stackoverflow.com/a/24411206
type: Question
has comment: http://stackoverflow.com/comment/37788660
has body: I have instances of JTable who listen for some remote events, and depending on the type of event I want to lock/unlock a row with model index N. By Locking a row I mean setting the editable flag for all its cells to false. This is handled by my table model. At the moment, I am calling repaint() because I did not want my table model to fire up the updated event, which is another alternative, but I am having a complex logic which is happening when the actual data in a row are changed, and did not want to trigger that logic. Is there any other way?
has comment: http://stackoverflow.com/comment/37790423
answer count: 1
tagged with: jtable
score: 0
type: UnansweredQuestion
has title: What is the idiomatic way (if any) to refresh (repaint) a row in JTable?

http://stackoverflow.com/q/24359667
tagged with: android
downvote count: 1
possible better answer: http://stackoverflow.com/a/24359788
has title: how to disable back button for particular activity
answer count: 9
has answer: http://stackoverflow.com/a/24359796
has comment: http://stackoverflow.com/comment/112063839
has answer: http://stackoverflow.com/a/24359838
has comment: http://stackoverflow.com/comment/37666845
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/4779954
has answer: http://stackoverflow.com/a/24359784
has answer: http://stackoverflow.com/a/24359800
score: 1
has comment: http://stackoverflow.com/comment/37666943
tagged with: java
has answer: http://stackoverflow.com/a/24359788
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/24359770
has answer: http://stackoverflow.com/a/24359831
linked to: http://stackoverflow.com/q/4779954
favorite count: 0
has answer: http://stackoverflow.com/a/24361254
accepted answer: http://stackoverflow.com/a/24361254
has body: I'm developing an Android app in which first screen is Login screen. after successful log-in, Home screen appears. But the problem is when I press Back button, it goes to login screen again. I want to disable the back button while I am on home screen and display an alert box asking are you sure you want to exit I have searched many examples, but didn't find any perfect solution I have tried using public void onBackPressed() {} method, but don't know what to implement. My min SDK version is 15.
has answer: http://stackoverflow.com/a/24359732

http://stackoverflow.com/a/24378532
answers question: http://stackoverflow.com/q/24378375
has body: My answer is correct? You are absolutely correct in saying that it is multi-level inheritance and not multiple inheritance. Only the root of the hierarchy is Object, all classes don't individually extend Object. A counter to the interviewer: If all classes extend Object, then how many times constructor of Object will be called on A a = new A(); The answer is only once, and that will be for the root of the hierarchy. Multiple inheritance and class Object
upvote count: 5
type: Answer
downvote count: 0
score: 5

http://stackoverflow.com/comment/37728602
type: Comment
type: QuestionComment
has text: No need to "dig". Check out the source code. As for the ArrayList vs List: One is an interface. Keeping an interface on the left of the assignment has its advantages (more on that somewhere here on SO)
score: 0
comment on: http://stackoverflow.com/q/24392682

http://stackoverflow.com/comment/37599863
comment on: http://stackoverflow.com/a/24323278
score: 0
type: Comment
type: AnswerComment
has text: As state, I have alredy checked the settings. Everything looks fine.

http://stackoverflow.com/comment/37743076
has text: Oh whoops, I see. Java has a system called checked Exceptions. You need to say that the method throws the exception or try to catch it. See http://stackoverflow.com/questions/6115896/java-checked-vs-unchecked-exception-explanation
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/24400286
type: Comment

http://stackoverflow.com/comment/37644406
comment on: http://stackoverflow.com/a/24348159
type: Comment
score: 0
type: AnswerComment
has text: Ohh cmmon... `trim()` it before splitting! Edited the answer :)

printing
tags question: http://stackoverflow.com/q/24384498
tags question: http://stackoverflow.com/q/24309470
tags question: http://stackoverflow.com/q/24373511
tags question: http://stackoverflow.com/q/24403443
tags question: http://stackoverflow.com/q/24294117
tags question: http://stackoverflow.com/q/24398620
tag name: printing
tags question: http://stackoverflow.com/q/24281296
tags question: http://stackoverflow.com/q/24340355
type: Tag
tags question: http://stackoverflow.com/q/24424164

http://stackoverflow.com/q/24381396
upvote count: 2
has comment: http://stackoverflow.com/comment/37722568
has comment: http://stackoverflow.com/comment/37708183
accepted answer: http://stackoverflow.com/a/24383936
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37707458
has answer: http://stackoverflow.com/a/24383936
type: Question
has comment: http://stackoverflow.com/comment/37707585
has comment: http://stackoverflow.com/comment/37710537
has title: Is it dangerous to run a web application server on Java 5.0?
has comment: http://stackoverflow.com/comment/37707136
answer count: 1
has comment: http://stackoverflow.com/comment/37707344
has comment: http://stackoverflow.com/comment/37707262
has comment: http://stackoverflow.com/comment/37724950
tagged with: security
has body: Java 5 is End-Of-Life since April 2008. We're mid-2014 and my customer is still using it to run their application servers, with a public web access from the Internet. I want to warn them about the risks and provide them with good reasons to migrate to most recent versions of Java, maybe even Java 8. I remember reading news about huge security flaws with Java 5 for which bugfixes aren't released anymore, but I can't find a precise example. Is there a severe unpatched vulnerability of Java 5 which would mandate a customer to update to a recent version of Java?
downvote count: 0
has comment: http://stackoverflow.com/comment/37707160
favorite count: 0

http://stackoverflow.com/comment/37630791
type: QuestionComment
has text: have you used asynctask or a thread for network operation in android?
comment on: http://stackoverflow.com/q/24341490
score: 0
type: Comment

http://stackoverflow.com/q/24382441
score: 1
tagged with: rmi
tagged with: java
accepted answer: http://stackoverflow.com/a/24400746
tagged with: error-handling
has title: ClassCastException : Proxy0 cannot be cast to interfaces.Patient
type: Question
tagged with: network-programming
tagged with: casting
downvote count: 0
has body: Hi i keep getting this error and don't know why java.lang.ClassCastException: com.sun.proxy.$Proxy0 cannot be cast to interfaces.Patient at main.RemoteObjects.&lt;init&gt;(RemoteObjects.java:15) at DRV_GUI.&lt;init&gt;(DRV_GUI.java:49) at Main.main(Main.java:13) I have a server application starting like this: import java.rmi.Naming; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; public class MainServer { PatientImpl patient = null; LoginImpl login = null; public MainServer(String[] args) { // TODO constructor System.out.println("Ich bin der Konstruktor von Main.java"); } public static void main(String[] args) { MainServer server = new MainServer(args); server.start(); } private void start() { try { patient = new PatientImpl(); login = new LoginImpl(); Registry registry = LocateRegistry.createRegistry(1099); Naming.rebind("patient", patient); Naming.rebind("login", login); } catch (Exception ex) { ex.printStackTrace(); } } } the patient interface ís the follówing: package interfaces; import java.rmi.RemoteException; import java.util.LinkedHashMap; public interface Patient { public LinkedHashMap&lt;String, LinkedHashMap&lt;Integer, LinkedHashMap&lt;String, Object&gt;&gt;&gt; patientSuchen(String id, User user) throws RemoteException; public boolean kostenzusageSpeichern (String id, User user) throws RemoteException; public boolean aufnahmeStornieren (String id, User user) throws RemoteException; public boolean aufnahmeAendern (String id, User user) throws RemoteException; public boolean entlassungStornieren (String id, User user) throws RemoteException; public boolean entlassungAendern (String id, User user) throws RemoteException; public boolean eingangEntlassungsStatistikStorieren (String id, User user) throws RemoteException; public boolean eingangEntlassungsStatistikAendern (String id, User user) throws RemoteException; public LinkedHashMap&lt;String, LinkedHashMap&lt;String, Object&gt;&gt; getVeraengerunglUnterbrechung(String id, Stri…
answer count: 1
has answer: http://stackoverflow.com/a/24400746
favorite count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/37740867
type: AnsweredQuestion

http://stackoverflow.com/a/24358135
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/24358069
has comment: http://stackoverflow.com/comment/57616262
score: 2
answers question: http://stackoverflow.com/q/24358069
has comment: http://stackoverflow.com/comment/38082263
has body: how do I test a Java SIP client? If you have a SIP server in place then you try to register your client to the server by sending a SIP REGISTER message. If you don't have a SIP server in place, then use SIPServlet to create a basic server with at least a doRegister implementation. Once you have that, you can test a client with registration process. If you don't have both a client and a server. Then write a basic server using SIPServelt. You can use any SIP client(SIP soft phone) downloaded from internet to test your server. Your questions is not very clear, hence I have provided the answer for different situations.
downvote count: 0
has comment: http://stackoverflow.com/comment/57616814
type: AcceptedAnswer

http://stackoverflow.com/comment/37871565
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24374713
type: Comment
has text: XMLIDRef requires that the field you refer to (the XMLID) be a String. Since the XML format has an attribute for the ID rather than just a value, it requires the use of an additional class object to fully represent it. If you try to use XMLIDRef on the Employee or Department object in this manner, it will expand the entire tag, rather than just refer to the ID when you marshal it.

http://stackoverflow.com/comment/37645884
has text: Yes, the name parameter also works with @XmlAttribute annotations. Thank you!
type: AnswerComment
comment on: http://stackoverflow.com/a/24343188
score: 0
type: Comment

http://stackoverflow.com/comment/37589109
type: Comment
type: QuestionComment
has text: is usedB has a value when updating?
comment on: http://stackoverflow.com/q/24319188
score: 0

http://stackoverflow.com/comment/37730959
score: 1
type: Comment
type: QuestionComment
has text: I want to redirect the user to a "400 Bad Request" page if an unexpected parameter is sent, without using RESTEasy, using only the JAX-RS specs. @LutzHorn, I know it can be ignored, but it's a project requisite.
comment on: http://stackoverflow.com/q/24368144

http://stackoverflow.com/a/42685080
downvote count: 0
has body: The error happens to have the plugin inside , it should be located in Before: org.apache.tomcat.maven tomcat7-maven-plugin 2.2 8080 / After: org.apache.tomcat.maven tomcat7-maven-plugin 2.2 8080 /
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/24311383
score: 1

http://stackoverflow.com/comment/37581131
type: Comment
type: QuestionComment
has text: You should use parameterized type instead of unknow that is `Comparable<T extends Comparable<T>> m1 = column.getMember(o1);`. But I cannot say more with my current knowledge (or absence of knowledge) of how `getMember` method is declared, what it does, what its class does.
comment on: http://stackoverflow.com/q/24311842
score: 0

http://stackoverflow.com/q/24379866
has answer: http://stackoverflow.com/a/24380397
has body: I am using Jsch to connect to a remote machine in my Java Code. I want to execute a command on the remote machine. On windows I need to append "cmd /c" before the command to be executed, but for linux this is not needed. So I want to know which OS I have connected to via Jsch. One way that comes to my mind is run some simple windows specific command, if it works it is windows. If it doesn't it is some other OS. And then I will run my actual command. Is there a way to avoid this? Some other way to execute commands OS independently over SSH via Jsch?
downvote count: 0
answer count: 1
tagged with: jsch
favorite count: 0
accepted answer: http://stackoverflow.com/a/24380397
tagged with: ssh
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37704323
upvote count: 3
tagged with: java
has title: Find remote os name via Jsch in Java
type: Question
score: 3
tagged with: remote-connection

http://stackoverflow.com/comment/37788610
score: 0
comment on: http://stackoverflow.com/a/24424666
type: AnswerComment
has text: yes exactly..i want to prevent ? character , i want it to print the PROJEçãO character to PROJECAO , actually i am able to convert it when i type the PROJEçãO to a string object , but when i read from file it prints with PROJE???
type: Comment

http://stackoverflow.com/q/24328085
type: Question
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24328270
has body: We allow user to entry any language in text field and that valu i store in database and we return same language to user when user view in browser. when i passed "Sant Juliã De Lã²ria" value in database and when i retrieve from database then display like this "Sant Juli�� De L��ria" How can we display user to same value as user input in text fields
has title: How can we store any language of text(english, hindi, spanish e.t.c.) and retrieve same value from database
has comment: http://stackoverflow.com/comment/37606870
has comment: http://stackoverflow.com/comment/37605590
has comment: http://stackoverflow.com/comment/37605540
duplicate of: http://stackoverflow.com/q/279170
upvote count: 3
has comment: http://stackoverflow.com/comment/37605663
type: UnansweredQuestion
tagged with: php
score: 3
has comment: http://stackoverflow.com/comment/37605543
tagged with: java
has answer: http://stackoverflow.com/a/24328167
tagged with: mysql
has comment: http://stackoverflow.com/comment/37605620
has comment: http://stackoverflow.com/comment/37605531

http://stackoverflow.com/comment/38623375
type: AnswerComment
score: 0
type: Comment
has text: Can you schedule more than one Notification this way? What happens if the device is rebooted?
comment on: http://stackoverflow.com/a/24420677

popup
tags question: http://stackoverflow.com/q/24424592
type: Tag
tag name: popup
tags question: http://stackoverflow.com/q/24313668
tags question: http://stackoverflow.com/q/24304752

http://stackoverflow.com/q/24299600
has comment: http://stackoverflow.com/comment/37551989
type: Question
linked to: http://stackoverflow.com/q/12684072
tagged with: tcpclient
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/24303179
has answer: http://stackoverflow.com/a/24299830
tagged with: tcpserver
has comment: http://stackoverflow.com/comment/37552081
has comment: http://stackoverflow.com/comment/37551993
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37552387
has body: I have these three classes, TCPClient, TCPServer and Member. I am using TCPClient to send RequestPacket object to TCPServer, which then responds back with a string to TCPClient. Here's the code: TCPServer import java.io.*; import java.sql.DriverManager; import java.sql.Connection; import java.sql.SQLException; import java.util.LinkedHashMap; import java.util.Map; import java.io.ObjectInputStream.GetField; import java.net.*; import data.RequestPacket; public class TCPServer { private static LinkedHashMap&lt;Integer,String&gt; port_database_map = new LinkedHashMap(); static{ port_database_map.put(2131,"testing1"); port_database_map.put(6789, "testing2"); } public static void main(String[] args) throws Exception { if(args.length==1){ String clientSentence; String capitalizedSentence; new TCPServer().sqlConnectionTest(); ServerSocket welcomeSocket = new ServerSocket(Integer.parseInt(args[0])); System.out.println("Server running at "+welcomeSocket.getLocalSocketAddress()+" and port "+welcomeSocket.getLocalPort()); Socket connectionSocket = welcomeSocket.accept(); InputStream is = connectionSocket.getInputStream(); ObjectInputStream ois = new ObjectInputStream(is); DataOutputStream outToClient; //DataOutputStream outToClient = new DataOutputStream(connectionSocket.getOutputStream()); while(true){ // BufferedReader inFromClient = new BufferedReader(new InputStreamReader(connectionSocket.getInputStream())); outToClient = new DataOutputStream(connectionSocket.getOutputStream()); //clientSentence = inFromClient.readLine(); RequestPacket rp = (RequestPacket) ois.readObject(); outToClient.writeUTF(rp.query); outToClient.flush(); System.out.println("Received object "+rp.query); //System.out.println("Client sentence is "+clientSentence); //capitalizedSentence = getClientResponse(clientSentence); // outToClient.writeBytes(getClientResponse(clientSentence)); } } else{ System.out.println("Enter port numnber as argument"); System.exit(1); } } public static String getClientResponse(St…
has title: Receiving data from server to client
tagged with: java

otto
tag name: otto
type: Tag
tags question: http://stackoverflow.com/q/24327031

http://stackoverflow.com/comment/37702037
type: QuestionComment
has text: Check your log, it could be many things. The messages are just for the enduser, the log is for you
comment on: http://stackoverflow.com/q/24377932
score: 0
type: Comment

http://stackoverflow.com/q/24364251
has title: How to add static resources to vaadin
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/37675709
has comment: http://stackoverflow.com/comment/89493361
accepted answer: http://stackoverflow.com/a/24364356
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: vaadin
has body: I am running a vaadin application and have some css files that reference images using "url()" syntax. The images however are not available and on the server side you get the error: rejecting published file request for file that has not been published I have tried putting them nearly everywhere (WEB-INF, WEB-INF/classes, VAADIN, VAADIN/themes/.., etc) but they remain unaccessible. How can I add static images to my vaadin application so they can be accessed by css? UPDATE Note that the images need to be accessible by css in the form of: .myCssClass { background: url(path/to/image.png); }
type: Question
has answer: http://stackoverflow.com/a/24364356

http://stackoverflow.com/q/24361193
downvote count: 1
accepted answer: http://stackoverflow.com/a/24361339
has comment: http://stackoverflow.com/comment/37671712
type: Question
upvote count: 0
score: -1
answer count: 1
has body: Please help me... I want my JSF datable to be rendered as follows i.e with employee name in tag in every row. Name Salary John 2000.0 Robert 3000.0 But i am getting is as follows. The name is coming in tag not in tag. I have tried many combinations but couldn't get to it Name Salary John 2000.0 Robert 3000.0 Code written is as follows <h:dataTable value="#{userData.employees}" var="employee"> <h:column> <f:facet name="header">Name</f:facet> #{employee.name} </h:column> <h:column> <f:facet name="header">Salary</f:facet> #{employee.salary} </h:column> </h:dataTable> please let me know how to do this
favorite count: 0
has answer: http://stackoverflow.com/a/24361339
has title: How to get in JSF datatable`
has comment: http://stackoverflow.com/comment/37669647
type: AnsweredQuestion
tagged with: jsf
tagged with: java
has comment: http://stackoverflow.com/comment/37670253

http://stackoverflow.com/comment/37658335
type: AnswerComment
type: Comment
has text: May be you can give examples? I don't quite understand the question.
comment on: http://stackoverflow.com/a/24355186
score: 0

http://stackoverflow.com/q/24305848
has comment: http://stackoverflow.com/comment/37565011
has comment: http://stackoverflow.com/comment/37568036
score: 1
has comment: http://stackoverflow.com/comment/37563544
tagged with: java
has comment: http://stackoverflow.com/comment/37563520
upvote count: 1
has title: Getting the name of class intersected by a pointcut
type: Question
has comment: http://stackoverflow.com/comment/37569149
has body: class SampleClass{ ChildClass childClass; public void init(){ childClass = ChildUtil.getChildClass(); childClass.callService("batman"); } } Aspect @Aspect public class CallServiceAspect{ @After("execution(* com.xyz.ChildClass.callService(..))") public void afterCallService(JoinPoint jp){ log.debug(jp.getTarget().getName()); } } I want the name of class within which the callService method was intersected by the aspect(i.e. SampleClass). Is there any way to obtain it?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37640225
has answer: http://stackoverflow.com/a/24360664
tagged with: aop
tagged with: spring-aop
tagged with: aspectj
has comment: http://stackoverflow.com/comment/37564987
answer count: 1
has comment: http://stackoverflow.com/comment/37563663
downvote count: 0
linked to: http://stackoverflow.com/q/5630809
favorite count: 0
accepted answer: http://stackoverflow.com/a/24360664
tagged with: spring

http://stackoverflow.com/q/24404497
score: 0
answer count: 2
type: UnansweredQuestion
tagged with: sockets
tagged with: android
linked to: http://stackoverflow.com/q/132799
tagged with: tcp
has body: I am trying to send a simple textual message to my android phone from my computer. The phone is on the same WiFi network and I am using the tutorial here for the android server. When it receives a connection, I log the message like this: String read; Log.i("COB", "test log"); while((read = input.readLine()) != null) { Log.i("COB", read); } In the logcat in android studio, it prints me the date and time but not the message it seems: 06-25 09:55:12.213 9573-9648/cob.vivid.app I/COB﹕ test log 06-25 09:55:12.213 9573-9648/cob.vivid.app I/COB﹕ [ 06-25 09:55:12.424 1025: 1079 D/WifiStateMachine ] I am using ncat for windows and I type the following in: echo messageTest & echo. | ncat {IP ADDRESS} {PORT} Obviously I use the actual ip and port. I know that the connection worked because as soon as I enter the ncat command it prints out the logs, but I don't understand why it isn't printing the message as well. Also, what is the 1025: 1079?
tagged with: java
tagged with: netcat
type: Question
has title: Android TCP server
has answer: http://stackoverflow.com/a/24418276
has answer: http://stackoverflow.com/a/24405175

http://stackoverflow.com/comment/37746326
type: Comment
type: QuestionComment
has text: Try to ping the DB server URL and check if your are able to do so
comment on: http://stackoverflow.com/q/24402022
score: 0

http://stackoverflow.com/comment/112541216
score: 0
type: Comment
comment on: http://stackoverflow.com/a/46566569
type: AnswerComment
has text: @user924 how about this `brew cask install adoptopenjdk8` ?

http://stackoverflow.com/a/24353909
score: 1
answers question: http://stackoverflow.com/q/24353157
downvote count: 0
type: Answer
upvote count: 1
has body: The HTTP RFCs define GET such that it is composed of the UrL abd other headers, and terminated by two newline chatacters. The URL scheme is defined by RFCs to include a special format for passing paramters as part of the URL. Web servers and browsers are specufically designed to comply with these standards, and so they are both defined standards and defacto standards. In theory, headers could be used to pass paramemters between the client and serve.Except for cookies, this is nonstandard behavior that is not available through most clients. HTTP POST is defined by RFCs to include the same URL and headers as GET, as well as to include a POSTDATA section, separated from the headers by two newline characters and terminated by two newline characters, (iirc). The POSTDATA SECTION is specially defined to allow the cliebt to pass parameters to the server. You coukd try to add a POSTDATA section to your GET requests, but proxies and servers wouldn't interpret it correctly - the two newlines that terminate the GET request headers will be interpreted to terminate the GET request entirely. the following POSTDATA section will be interpreted as a malformed request, and thrown out. You coukd write a custom web server to handle your custom GET format, but that wouldn't fix the ye proxy servers in between, and it wouldn't be used by any existing clients. You could create a custom client to communicate with your server using your custom GET requests, abd this woukd orobably work as long as no proxy servers are in between. But then you woukd not be communicating over HTTP, but rather a different custom protocol that you invented. And only your software would speak this custom protocol, so you wouldn't gain the interoperability that is typically dssired when using HTTP.

http://stackoverflow.com/q/24397683
answer count: 1
has title: Jsoup parseBodyFragment excludes elements having style attribute display:none
has answer: http://stackoverflow.com/a/24405743
tagged with: jsoup
type: AnsweredQuestion
type: Question
has body: I use Jsoup's parseBodyFragment method to convert a Java string to a Jsoup Document object: String trElem = " " + " " + " " + " " ; Document doc = Jsoup.parseBodyFragment(trElem) ; System.out.println ( "\nJsoup doc is " + doc + "\n" ) ; However, the first element is excluded from the Document object returned by parseBodyFragment, as shown below (the output of my System.out.println): My question: how can I include all elements (both those with display:none and those without) in the object returned by parseBodyFragment?
accepted answer: http://stackoverflow.com/a/24405743
score: 0
tagged with: java

http://stackoverflow.com/q/24275920
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37507299
has comment: http://stackoverflow.com/comment/37544587
has comment: http://stackoverflow.com/comment/37507762
has comment: http://stackoverflow.com/comment/37545406
has comment: http://stackoverflow.com/comment/37507155
has title: How can I go back to the start of while loop, without breaking it?
tagged with: java
has comment: http://stackoverflow.com/comment/37507038
type: Question
has comment: http://stackoverflow.com/comment/37507110
score: 0
has comment: http://stackoverflow.com/comment/37507162
tagged with: path-finding
has comment: http://stackoverflow.com/comment/37507086
has body: I have a while loop containing many if's: public ArrayList&lt;Position&gt; findPath(Position destination) { boolean pathToDestinationCreated = false; boolean xReached = false; boolean yReached = false; int reachableX = 0; int reachableY = 0; int reachableXY = 0; int isUnreachable = 0; Position myPos = myPlayer().getPosition(); ArrayList&lt;Position&gt; finalPath = new ArrayList&lt;Position&gt;(); if (destination != null) { Position toAdd; while (!pathToDestinationCreated) { if (myPos.getX() != destination.getX() &amp;&amp; myPos.getY() != destination.getY()) { if (myPos.getX() &lt; destination.getX() &amp;&amp; myPos.getY() &lt; destination.getY()) { toAdd = new Position(myPos.getX() + 1, myPos.getY() + 1, myPos.getZ()); if (canReach(toAdd)) { finalPath.add(toAdd); myPos = toAdd; isUnreachable = 0; } else { isUnreachable = 1; } } else if (myPos.getX() &gt; destination.getX() &amp;&amp; myPos.getY() &lt; destination.getY()) { toAdd = new Position(myPos.getX() - 1, myPos.getY() + 1, myPos.getZ()); if (canReach(toAdd)) { finalPath.add(toAdd); myPos = toAdd; isUnreachable = 0; } else { isUnreachable = 1; } } else if (myPos.getX() &gt; destination.getX() &amp;&amp; myPos.getY() &gt; destination.getY()) { toAdd = new Position(myPos.getX() - 1, myPos.getY() - 1, myPos.getZ()); if (canReach(toAdd)) { finalPath.add(toAdd); myPos = toAdd; isUnreachable = 0; } else { isUnreachable = 1; } } else if (myPos.getX() &lt; destination.getX() &amp;&amp; myPos.getY() &gt; destination.getY()) { toAdd = new Position(myPos.getX() + 1, myPos.getY() - 1, myPos.getZ()); if (canReach(toAdd)) { finalPath.add(toAdd); myPos = toAdd; isUnreachable = 0; } else { isUnreachable = 1; } } } I'm gonna skip the rest of the code because a wall of text isn't going to help. I'd like to go back to the beginning of my while loop, whenever finalPath.add(toAdd) is invoked. How would I do this?
has comment: http://stackoverflow.com/comment/37507581
has comment: http://stackoverflow.com/comment/37507746
has comment: http://stackoverflow.com/comment/37507200
has comment: http://stackoverflow.com/comment/37507715
has comment: http://stackoverflow.com/comment/37507228
answer count: 0
has comment: http://stackoverflow.com/comment/37507057

http://stackoverflow.com/comment/37613583
has text: So the cache will look like this <String, ImmutableList<DataObject>>, and immutablelist makes a new copy, as far as I know. So it actually does make copies of the objects. Or am I missing something here?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24315166

http://stackoverflow.com/a/24343749
has comment: http://stackoverflow.com/comment/37635883
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37635808
answers question: http://stackoverflow.com/q/24343697
has comment: http://stackoverflow.com/comment/37635349
has comment: http://stackoverflow.com/comment/37635660
type: Answer
has body: Instead of setting max and minWidth, use TableRow weight: textView.setPadding(10, 10, 10, 10); tableRow.addView(textView, new TableRow.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1)); This will distribute horizontal space among the TextViews in each row. PS. You will probably want to use textView.setGravity(Gravity.CENTER); too.
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37635755
accepted answer of: http://stackoverflow.com/q/24343697

http://stackoverflow.com/comment/135853167
has text: this answer is simple and neat. Thanks!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/40960664
type: AnswerComment

http://stackoverflow.com/comment/37654101
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24353189
has text: Awesome, it looks like it works. Can you explain what that does please? Trying to learn :D
type: Comment

http://stackoverflow.com/comment/37783872
comment on: http://stackoverflow.com/q/24422068
type: Comment
type: QuestionComment
has text: What exactly is the problem ?
score: 2

http://stackoverflow.com/q/24286777
tagged with: phaser
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24287031
type: UnansweredQuestion
tagged with: multithreading
tagged with: spring
has title: Phaser instances & Spring MVC
has body: I have a spring @Controller that has a request mapping. When requests are sent to it it creates a deferred result and runs a method on a delegator class. In the controller: @ResponseBody @RequestMapping(MenuModelCodes.MENU_NAME) DeferredResult&lt;HttpEntity&lt;?&gt;&gt; getModelCodesWithClass(String target) { final DeferredResult&lt;HttpEntity&lt;?&gt;&gt; deferredResult = getNewDeferredResult(); delegator.doStuff(target); return deferredResult; } The doStuff method in the delegator is @Async annotated - so it's running in another thread. In this thread a new Phaser is created to keep track of child threads it will create. The delegator thread itself registers with the phaser, and triggers a call to a method in "AnotherClass" that is also @Async annotated. I.e. the delegator is now spawning children. The delegator: public class Delegator { @Async public Object doStuff(String requestURI) { Phaser phaser = new Phaser(); phaser.register(); Object result = anotherClass.createThreadDoWork(phaser); phaser.arriveAndDeregister(); //Wait until phaser is completed while (!phaser.isTerminated()) {} return result; } } Each child spawned thread created by a call in the delegator to createThreadDoWork here registers itself with the phaser, does some work and then arrives and deregisters. AnotherClass: public class AnotherClass { @Async public void createThreadDoWork(Phaser phaser) throws Throwable { phaser.register(); //some kind of logic / rest call etc. phaser.arriveAndDeregister(); } } When all child threads complete, the delegator which is sitting at this piece of code: while (!phaser.isTerminated()) {} Will continue, set its deferred result and the delegator thread will end. So here's the question(s): I want a Phaser for every request - i.e. I create a new Phaser() everytime a request creates a new delegator thread. If I receive 5 requests to my controller, they each spawn a delegator thread, each delegator creates a new Phaser and passes it to their children. However, as so…
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/37681432
type: Comment
comment on: http://stackoverflow.com/q/24333922
score: 0
type: QuestionComment
has text: I understand your question, but the post includes a few more questions, that make "white noise" IMO. I truly think that if you rewrite your post with one, simple question, then the motivation to answer would increase.

google-analytics
tags question: http://stackoverflow.com/q/24325936
tag name: google-analytics
type: Tag

http://stackoverflow.com/comment/37755294
has text: So basically JDBC is everywhere?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24406878

http://stackoverflow.com/a/24493985
score: 0
type: Answer
has body: You can calculate the difference between your alarm time (totalTime) and the current time like this: long timeDiffInMillis = totalTime - System.currentTimeMillis(); This will give you the time remaining before your alarm will trigger (in milliseconds).
answers question: http://stackoverflow.com/q/24387819

http://stackoverflow.com/comment/55393326
has text: Why are you adding a comment over a year after the question is answered? I clearly show that I am using the RollingFileAppender.
type: Comment
comment on: http://stackoverflow.com/a/33810251
type: AnswerComment
score: 2

http://stackoverflow.com/comment/37594322
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24321312
score: 0
has text: I can't parse your numbers. What is `1,00,000` and what is `2,00,00,000`? @MikeW: And they will tell it's a programming problems a the OP is no DB admin. ;)

http://stackoverflow.com/a/24278454
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24278315
has body: There is nothing to be tested directly here. Probably the enum will be used in tests for other classes, which should be sufficient, since their existence is basically the only property of the Enums.
downvote count: 0
score: 1

http://stackoverflow.com/q/24277892
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/24277989
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/37510736
accepted answer: http://stackoverflow.com/a/24277947
possible better answer: http://stackoverflow.com/a/24277923
has answer: http://stackoverflow.com/a/24277923
answer count: 3
has body: I need to fetch a singleton bean from same ApplicationContext twice in 2 different classes. Example snippet : CLass A { public void foo(){ ApplicationContext context = new ClassPathXmlApplicationContext("common.spring.xml"); MyParametrizedSingletonClass myParametrizedSingletonClass = (MyParametrizedSingletonClass) context.getBean("myParametrizedSingletonClass"); // do more stuff.. } CLass B { public void bar(){ ApplicationContext context = new ClassPathXmlApplicationContext("common.spring.xml"); MyParametrizedSingletonClass myParametrizedSingletonClass = (MyParametrizedSingletonClass) context.getBean("myParametrizedSingletonClass"); // do more stuff.. } Since MyParametrizedSingletonClass is a singletom it if its constructor is called more than once for same constructor arguments it throws error. How do I cache and reuse ApplicationContext with spring?
linked to: http://stackoverflow.com/q/70689
favorite count: 0
has title: Accessing cached ApplicationContext in spring
upvote count: 1
tagged with: spring
has answer: http://stackoverflow.com/a/24277947
type: Question

http://stackoverflow.com/comment/37630260
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24340973
has text: I've already done that... it goes through each of them... but it only deletes the archive
score: 0

http://stackoverflow.com/q/24273146
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/24273191
answer count: 3
has comment: http://stackoverflow.com/comment/37503474
has answer: http://stackoverflow.com/a/24358651
has comment: http://stackoverflow.com/comment/37502780
has answer: http://stackoverflow.com/a/24273205
has comment: http://stackoverflow.com/comment/37503463
has comment: http://stackoverflow.com/comment/37550557
tagged with: jit
has title: Will JVM optimization break down my code?
possible better answer: http://stackoverflow.com/a/24273191
has comment: http://stackoverflow.com/comment/37503267
has comment: http://stackoverflow.com/comment/37503569
has comment: http://stackoverflow.com/comment/37623992
has comment: http://stackoverflow.com/comment/37501973
has comment: http://stackoverflow.com/comment/37502023
linked to: http://stackoverflow.com/q/24233716
has comment: http://stackoverflow.com/comment/37502053
has body: I have the following method which is being called by multiple threads: private final static Object lock = new Object(); public String createDirectory() { File file = new File("D:"+File.separator+"test"); if(!file.exists() || !file.isDirectory())//if file doesn't exist then create a new directory. { synchronized(lock) { if(!file.exists() || !file.isDirectory())//----&gt; (1) { boolean isCreated = file.mkdir(); } } } return file.getAbsolutePath(); } Is it possible that the JVM optimizer will comment out the code marked as (1) in above given menthod? I am suspecting that because, the existence of directory is checked twice in immediate succession. Considering it as a unnecessary redundant checking JVM optimizer might comment out the line --> (1).
has comment: http://stackoverflow.com/comment/37502548
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24358651
has comment: http://stackoverflow.com/comment/37503289
tagged with: jvm
type: Question
has comment: http://stackoverflow.com/comment/37502048
has comment: http://stackoverflow.com/comment/37502105
has comment: http://stackoverflow.com/comment/37502910

http://stackoverflow.com/comment/37643797
comment on: http://stackoverflow.com/q/24347878
has text: it is just for pattern nothing else.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37790226
type: Comment
comment on: http://stackoverflow.com/a/24425555
type: AnswerComment
has text: All the text including the one which is displayed on the popup?
score: 0

http://stackoverflow.com/comment/37513419
has text: @pingw33n yes. In some queries all columns can be present or in some queries only 2 or 1 columns can be present
comment on: http://stackoverflow.com/q/24279035
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37625483
type: QuestionComment
has text: Check if there are any null values at MainActivity.java:77
comment on: http://stackoverflow.com/q/24337674
score: 0
type: Comment

import
type: Tag
tags question: http://stackoverflow.com/q/24413698
tag name: import
tags question: http://stackoverflow.com/q/24378455
tags question: http://stackoverflow.com/q/24415309
tags question: http://stackoverflow.com/q/24303607

http://stackoverflow.com/q/24362566
has comment: http://stackoverflow.com/comment/37671823
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/37672154
has comment: http://stackoverflow.com/comment/37671869
has answer: http://stackoverflow.com/a/24362799
favorite count: 0
has comment: http://stackoverflow.com/comment/37672522
has body: While executing this code, sometimes I notice that the thread with minimum priority is getting executed before the thread with maximum priority. Can anyone help me understand what's going on here? class Test implements Runnable { public void run() { for(int i=0; i&lt;5; i++) System.out.println(Thread.currentThread().getName()); } } class TestMain { public static void main(String[] args) { Test test = new Test(); Thread t1 = new Thread(test); Thread t2 = new Thread(test); t1.setPriority(Thread.MAX_PRIORITY); t1.setName("Max priority thread"); t2.setPriority(Thread.MIN_PRIORITY); t2.setName("Min priority thread"); t1.start(); t2.start(); } } Sometimes, I'm getting the output as Min priority thread Min priority thread Min priority thread Min priority thread Max priority thread Max priority thread Max priority thread Max priority thread Max priority thread Min priority thread and sometimes as Max priority thread Max priority thread Max priority thread Max priority thread Max priority thread Min priority thread Min priority thread Min priority thread Min priority thread Min priority thread Logically, the thread with maximum priority should start first. But sometimes it is not happening. If this is unavoidable, then how to make sure that the thread with maximum priority will always start first?
has comment: http://stackoverflow.com/comment/37671902
has comment: http://stackoverflow.com/comment/37671818
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/24362799
upvote count: 1
has answer: http://stackoverflow.com/a/24362775
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24362775
downvote count: 1
type: Question
has title: How is minimum priority thread getting executed before maximum priority thread?

http://stackoverflow.com/comment/37507057
comment on: http://stackoverflow.com/q/24275920
type: Comment
type: QuestionComment
has text: I'm afraid it already is spaghetti-code. I'll definitely have to refactor this and think of some changes to make this look better. Continue seems to be what I was searching for though, I had no idea it does this, thanks!
score: 0

http://stackoverflow.com/comment/39775634
has text: This works only for the given example, the question is more generic. OP wants an answer that’d work for *any* long string.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25485021
score: 1

http://stackoverflow.com/comment/37533130
score: 0
comment on: http://stackoverflow.com/q/24289639
type: Comment
type: QuestionComment
has text: I don't understand your question, `return index[i];` has an *implicit* `this` (in Java). That is, it is `return this.index[i];`

http://stackoverflow.com/a/24290574
answers question: http://stackoverflow.com/q/24276580
type: AcceptedAnswer
downvote count: 0
has body: That template is usually autowired, because one is created for you that matches your configuration. It is, by design, coupled with other parts of your Simp infrastructure (and it has to be!), because to build one you need: the user destination prefix (if you configured a custom one) and more important, a MessageChannel to send messages to your message broker Maybe could you expand on why this class can't be Spring managed? See SimpMessagingTemplate javadoc.
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24276580
score: 1

http://stackoverflow.com/comment/37835451
type: AnswerComment
score: 0
type: Comment
has text: Indeed, it only gives 1 value, regardless of which printer it is. I've tried this OID with Canon, Brother, Kyocera and HP, each time it's only 1 result
comment on: http://stackoverflow.com/a/24406754

http://stackoverflow.com/q/24289157
tagged with: java-time
has answer: http://stackoverflow.com/a/24289356
linked to: http://stackoverflow.com/q/13922496
tagged with: datetime-format
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/37532550
has answer: http://stackoverflow.com/a/24289495
has answer: http://stackoverflow.com/a/62458614
favorite count: 0
possible better answer: http://stackoverflow.com/a/24289495
accepted answer: http://stackoverflow.com/a/24289356
has comment: http://stackoverflow.com/comment/37532488
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has title: Period.between only subtracting days
type: Question
has body: The variable dateSubtract comes out to 16 but I want to find the total number of days in between the 2 days, which should be 165. How can I do this WITHOUT JODA TIME? String date = "06/17/2014"; DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy"); LocalDate d1 = LocalDate.parse("01/01/2014", formatter); LocalDate d2 = LocalDate.parse(date, formatter); int dateSubtract = Period.between(d1, d2).getDays();
tagged with: period

endianness
tags question: http://stackoverflow.com/q/24311583
tags question: http://stackoverflow.com/q/24280999
type: Tag
tag name: endianness
tags question: http://stackoverflow.com/q/24330825
tags question: http://stackoverflow.com/q/24367913

http://stackoverflow.com/q/24308194
linked to: http://stackoverflow.com/q/6429462
tagged with: apache-storm
answer count: 1
tagged with: enums
accepted answer: http://stackoverflow.com/a/24309776
has body: Intro I am using Apache Storm (Local mode, not Remote mode) in my Java project and when creating the topology I need to pass an object to one of the bolts TopologyBuilder builder = new TopologyBuilder(); ..... builder.setBolt("last-bolt", new MyBolt(Classifier.SECONDS)).someGrouping(...); ..... LocalCluster cluster = new LocalCluster(); cluster.submitTopology("test", conf, builder.createTopology()); The object itself has some non-serializable fields. Instead of subclassing the classes to which those fields belong and making them Serializable I have taken another approach. Since the actual object isn't gonna be changing a lot and it can be enumerated I've decided to make it an enum and pass it like that to bolt's tasks. The good thing about enum is that it is serializable under all costs. This approach works in local mode because (if I understood Storm correctly) there is only one JVM running on my computer and things can't get complicated actually. Question If the enum consists of a static final non-serializable field will that field be constructed properly when the enum is deserialized by another process on a different machine or a cluster running multiple JVMs? The actual enum (static final field is at the end) public enum Classifier { SECONDS { public String classify(String timestamp) { DateTime dateTime = formatter.parseDateTime(timestamp); int second = dateTime.getSecondOfMinute(); if (second &lt;= 30) { return "00 - 30"; } else { return "30 - 60"; } } public int getNumberOfCategories() { return 2; } }, WEEK { public String classify(String timestamp) { DateTime dateTime = formatter.parseDateTime(timestamp); int dayOfWeek = dateTime.getDayOfWeek(); String typeOfDay = (dayOfWeek &gt;= 1 &amp;&amp; dayOfWeek &lt;= 5) ? "workday" : "weekend"; int hour = dateTime.getHourOfDay(); String hourInterval = hour + " - " + (hour == 23 ? 0 : hour + 1); return typeOfDay + " " + hourInterval; } public int getNumberOfCategories() { return 48; } }; private static final DateTimeF…
type: AnsweredQuestion
has title: Java enum fields serialization/deserialization
tagged with: serialization
tagged with: static
type: Question
linked to: http://stackoverflow.com/q/19433364
has answer: http://stackoverflow.com/a/24309776
score: 0
tagged with: java

http://stackoverflow.com/q/24335752
has comment: http://stackoverflow.com/comment/37620753
has comment: http://stackoverflow.com/comment/37620721
favorite count: 0
has comment: http://stackoverflow.com/comment/37620856
has answer: http://stackoverflow.com/a/24335918
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37620746
has comment: http://stackoverflow.com/comment/37620455
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37620544
has comment: http://stackoverflow.com/comment/37620570
has body: How do you convert this SQL query from String to Int ? String sql = "DELETE FROM DEMO.QUESTION " + "WHERE CAST (QUESTION_ID = '"+question+"' ,INT(10))";
tagged with: java
score: -1
tagged with: derby
has title: How do you convert this SQL query from String to Int?
has comment: http://stackoverflow.com/comment/37620600
upvote count: 0
answer count: 1

http://stackoverflow.com/q/24342907
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/37636479
has comment: http://stackoverflow.com/comment/37636454
tagged with: java
has comment: http://stackoverflow.com/comment/37633783
has comment: http://stackoverflow.com/comment/37636610
has comment: http://stackoverflow.com/comment/37635002
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37636805
has body: I have several Spring @ExceptionHandlers as follows: @ExceptionHandler(MailerException.class) @ResponseStatus(value = HttpStatus.INTERNAL_SERVER_ERROR) public String mailerException(MailerException e, HttpServletRequest request, Locale locale) { FlashMap outputFlashMap = RequestContextUtils.getOutputFlashMap(request); if (outputFlashMap != null) { outputFlashMap.put("flashMessage", messageSource.getMessage("controller.internal_server_error", null, locale)); } return "redirect:/index"; } @ExceptionHandler(ExecutionException.class) public String executionException(ExecutionException e) throws Throwable { throw e.getCause(); } When an ExecutionException is thrown with a MailerException as the cause, the executionException handler is invoked but not the mailerException one... I am not sure why... Can anyone please explain? Here is the stacktrace: GRAVE: Servlet.service() for servlet [bignibou] in context with path [/bignibou] threw exception [Request processing failed; nested exception is java.util.concurrent.ExecutionException: com.bignibou.MailerException: MessagingException | MailSendException] with root cause com.bignibou.MailerException: MessagingException | MailSendException at com.bignibou.service.preference.PreferenceServiceImpl.sendPasswordResetInfo_aroundBody10(PreferenceServiceImpl.java:122) at com.bignibou.service.preference.PreferenceServiceImpl$AjcClosure11.run(PreferenceServiceImpl.java:1) at org.springframework.transaction.aspectj.AbstractTransactionAspect.ajc$around$org_springframework_transaction_aspectj_AbstractTransactionAspect$1$2a73e96cproceed(AbstractTransactionAspect.aj:59) at org.springframework.transaction.aspectj.AbstractTransactionAspect$AbstractTransactionAspect$1.proceedWithInvocation(AbstractTransactionAspect.aj:65) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) at org.springframework.transaction.aspectj.AbstractTransactionAspect.ajc$around$org_springframew…
has comment: http://stackoverflow.com/comment/37636525
type: Question
tagged with: exception
has comment: http://stackoverflow.com/comment/37636668
score: 1
has comment: http://stackoverflow.com/comment/37636809
favorite count: 0
has title: Why isn't Spring chaining ExceptionHandlers?

http://stackoverflow.com/a/54264812
answers question: http://stackoverflow.com/q/24325178
has body: I recently faced same problem. I added a base.jspf file and referred it on the top of the file: &lt;%@ include file="/WEB-INF/includes/base.jspf" %&gt; That file contains &lt;%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %&gt;
score: 0
type: Answer

http://stackoverflow.com/q/24325178
has answer: http://stackoverflow.com/a/54264812
tagged with: jsp-fragments
has title: Unknown tags and undefined functions in JSP fragments
type: AnsweredQuestion
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/24325364
type: Question
has body: I imported a web project build in JSP, which I am relatively new to. I got some errors in WEB-INF/includes/components that I am unable to resolve. Some .jspf files show me errors such as at that line: &lt;c:if test="${fn:length(view.parent.views) &gt; 1}"&gt; the error is: Multiple annotations found at this line: - The function fn:length is undefined - Unknown tag (c:if). I also get errors like The function fn:length is undefined errors for fn:length. I followed up with other questions and made sure that standard.jar and jstl-1.2.jar are included in my build path. Moreover, WEB-INF/includes/taglibs.jspf has the following : &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt; &lt;%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %&gt;
answer count: 2
score: 3
accepted answer: http://stackoverflow.com/a/24325364
downvote count: 0
tagged with: jsp
favorite count: 0
possible better answer: http://stackoverflow.com/a/54264812
tagged with: jsp-tags

http://stackoverflow.com/comment/37761752
comment on: http://stackoverflow.com/a/24410339
has text: actually `??` is a reluctant quantifier while `?` is a greedy quantifier
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37645842
score: 5
has text: Instead of using a component listener on each panel, consider creating a single mouse listener add attaching it to all the panels. When mouseClicked is triggered, locate the source from MouseEvent, find the cell it represents and determine which cells need to be displayed from there...
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24348950

accelerometer
tags question: http://stackoverflow.com/q/24294503
tags question: http://stackoverflow.com/q/24349939
type: Tag
tag name: accelerometer

http://stackoverflow.com/a/24363530
upvote count: 1
answers question: http://stackoverflow.com/q/24362521
has body: The for loop condition will never be true as you are starting with j = 10 and condition j == 1 which will always be false. Instead try something like. for(int j = 10; j != 1; j--){ system.out.println("Printing: " + j) } OR for(int j = 10; j &gt; 1; j--){ system.out.println("Printing: " + j) }
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/37732783
type: Comment
type: QuestionComment
has text: You should follow a tutorial. Start with [the official Java tutorial](http://docs.oracle.com/javase/tutorial/).
comment on: http://stackoverflow.com/q/24394765
score: 0

cryptography
tag name: cryptography
tags question: http://stackoverflow.com/q/24401786
type: Tag
tags question: http://stackoverflow.com/q/24395442
tags question: http://stackoverflow.com/q/24269743
tags question: http://stackoverflow.com/q/24306315
tags question: http://stackoverflow.com/q/24322564
tags question: http://stackoverflow.com/q/24383637
tags question: http://stackoverflow.com/q/24368119

http://stackoverflow.com/comment/37772006
type: Comment
has text: It's really hard to read that in a comment but did it work? If so, then good work! It's important to always scale view size to screen/window size. It makes the code tedious but it produces consistent results.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24412132

http://stackoverflow.com/a/24337337
answers question: http://stackoverflow.com/q/24337168
has body: Based on your description, I don't think you want to use static. I would like the instantiate this class providing a name and an email. That means that you provide a name and an e-mail when creating an instance of the class. But using static means that there is only one name and one e-mail, that all instances of the class share! Unless every person in your universe has the same name and the same e-mail address, that is not what you want. So get rid of static on _name, _email, and testCard. Also, initializing testCard outside the constructor won't work, because the program will try to do new Card(_email, _name) before _email and _name have been initialized. So change that to private final Card testCard; and in the constructor: testCard = new Card(_email, _name); after _email and _name have been set. If you do this, you should be able to put the declarations anywhere you want. The "Cannot reference a variable before it is defined" or "Illegal forward reference" problems only come up when you have global (static) variables, according to this question.
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/24337168
type: AcceptedAnswer

http://stackoverflow.com/comment/37533386
type: Comment
comment on: http://stackoverflow.com/q/24289323
score: 0
type: QuestionComment
has text: Your question is not clear. You show a file containing *one* `mandatory` child, and another without it. What does all that mean? You also have a XPath expression `/people/man/attribute[not(key)][@name='John']` which tests for a child `<key>` element. Where is it and why is it significant?

http://stackoverflow.com/comment/37658754
type: Comment
comment on: http://stackoverflow.com/a/24355020
score: 0
type: AnswerComment
has text: Again this error : com.sun.jersey.api.client.UniformInterfaceException: POST http://localhost:8080/de.ServerReceiver/rest/upload returned a response status of 500 Internal Server Error at com.sun.jersey.api.client.WebResource.handle(WebResource.java:676) at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74) at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:563) at de.ClientSide.ClientSide.main(ClientSide.java:93)

http://stackoverflow.com/q/24359235
tagged with: android-fragments
possible better answer: http://stackoverflow.com/a/24359449
score: 0
answer count: 3
has body: I have implemented the fragment in android. Now we try to send the data from activity to the fragment. But while sending the data we are getting the NullPointerException in *onCreateView* method of fragment. Following code of Activity. setContentView(R.layout.fragment_1); FragmentManager fm = getFragmentManager(); FragmentTranstction ft = fm.beginTransaction(); Fragment1 f1 = new Fragment1(); String text1 = "prakash"; Bundle bundle = new Bundle(); bundle.putString("sessionName", text1); f1.setArguments(bundle); ft.add(R.id.frag1, f1); ft.commit(); Following code of Fragment: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { String strtext = this.getArguments().getString("sessionName"); TextView sessionTitle = (TextView) getView() .findViewById(R.id.session1); sessionTitle.setText(strtext); return inflater.inflate(R.layout.fragment_1, container, false); } what is the mistake i did, because of that i am getting NullPointerException, please help
has comment: http://stackoverflow.com/comment/37666157
has title: Getting NullPointerException while sending data from activity to fragment
tagged with: android
linked to: http://stackoverflow.com/q/24321449
has answer: http://stackoverflow.com/a/24359291
accepted answer: http://stackoverflow.com/a/24359291
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37666208
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24359449
has answer: http://stackoverflow.com/a/24359546

http://stackoverflow.com/comment/37573455
score: 0
has text: An instance of `MemoryChild` is what's present on the heap
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24311037

http://stackoverflow.com/q/24318189
answer count: 2
has comment: http://stackoverflow.com/comment/37587163
downvote count: 0
has body: My RMI server interface declares a method foo() which is declared to throw RemoteException and Exception, as follows: public interface Node extends RemoteService { public void foo() throws RemoteException, Exception; } The server implementation is: public class NodeImpl extends UnicastRemoteObject implements Node { public void foo() throws RemoteException, Exception { // Implementation - calls other stuff... } } My client calls foo on the server: try { node.foo(); } catch (Exception e) { System.err.print("Got exception from foo() of type " + e.getClass().getName()); System.err.println("Exception: " + e.getMessage()); } Now when I run the client I get: Got exception from foo() of type java.rmi.UnexpectedException Exception: undeclared checked exception; nested exception is: java.io.InterruptedIOException: The operation timed out Java doc says this about java.rmi.UnexpectedException: An UnexpectedException is thrown if the client of a remote method call receives, as a result of the call, a checked exception that is not among the checked exception types declared in the throws clause of the method in the remote interface. But my remote interface specifies that foo() throws Exception, and java.io.InterruptedIOException is a kind of Exception. So why does my client get UnexpectedException? Thanks, Tom
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37660537
has comment: http://stackoverflow.com/comment/37587276
has answer: http://stackoverflow.com/a/24376836
score: 1
tagged with: rmi
tagged with: java
has answer: http://stackoverflow.com/a/24318204
has comment: http://stackoverflow.com/comment/37636402
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37587640
has title: Client gets undeclared checked exception, but Exception is declared to be caught

http://stackoverflow.com/comment/37720980
has text: `int[] result = gprime(179424673); int a = result[i];` ?
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/24388681

http://stackoverflow.com/q/24295593
upvote count: 1
has body: In the GCM documentation (http://developer.android.com/google/gcm/gcm.html) it states that there's a 4kb payload limit per message. I am struggling to figure out how long my messages are. They're currently simply defined in a String and I use the packages com.google.android.gcm.server.Message com.google.android.gcm.server.Sender to send the messages. The messages sent and received are fine. I'm just wondering if there was a way to see how many bytes each message is at the moment to see how much more I can add. I tried printing out the default encoding using Charset.defaultCharset() but I'm not sure if that's the actual encoding. It returned US-Ascii. Currently the sending of messages goes something like: Message message; message = new Message.Builder() .addData("MESSAGE_TYPE", "version1") .addData("PERSONNAME", "john") .addData("PHONENUMBER", "5551234567") .build(); Sender sender = new Sender(API_KEY); try{ MulticastResult result = sender.send(message, registrationIds, 5); } Is there a way to determine how many bytes the message actually is? Thanks.
tagged with: java
tagged with: character-encoding
type: UnansweredQuestion
answer count: 0
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: google-app-engine
tagged with: android
has title: GAE GCM Size of message

http://stackoverflow.com/q/24386915
accepted answer: http://stackoverflow.com/a/24406887
tagged with: android
has title: Android Circle following touch and drag on screen
tagged with: geometry
type: Question
has answer: http://stackoverflow.com/a/24406887
type: AnsweredQuestion
has body: I have a simple app that draws a line as you move your finger around the screen. I want to change it so instead of it drawing behind the finger, a circle follows directly below where you have touched. As you move your finger along the screen the circle should follow. It should not leave a path behind it. The circle should appear where the finger is when the screen is touched and disappear when the finger is lifted. MainActivity: package com.example.dot2; import android.app.Activity; import android.os.Bundle; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(new SingleTouchEventListener(this, null)); } } SingleTouchEventListener: package com.example.dot2; import... public class SingleTouchEventListener extends View { private Paint paint = new Paint(); private Path path = new Path(); private Paint mPaint; public SingleTouchEventListener(Context context, AttributeSet attrs) { super(context, attrs); paint.setAntiAlias(true); paint.setStrokeWidth(6f); paint.setColor(Color.RED); paint.setStyle(Paint.Style.STROKE); paint.setStrokeJoin(Paint.Join.ROUND); } @Override protected void onDraw(Canvas canvas) { canvas.drawPath(path, paint); } @Override public boolean onTouchEvent(MotionEvent event) { float eventX = event.getX(); float eventY = event.getY(); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: path.moveTo(eventX, eventY); return true; case MotionEvent.ACTION_MOVE: path.lineTo(eventX, eventY); break; case MotionEvent.ACTION_UP: // nothing to do break; default: return false; } // Schedules a repaint. invalidate(); return true; } } Thanks
tagged with: java
tagged with: touch
score: 0
answer count: 1

http://stackoverflow.com/a/24366129
answers question: http://stackoverflow.com/q/24364392
score: 0
type: Answer
has body: I got the solution, as I said it was client side, only I needed to decode in base64, my new code is: String result = ((SoapObject)poSoap).getProperty("MyImage").toString(); byte[] bloc = Base64.decode(result, Base64.DEFAULT); Bitmap png = BitmapFactory.decodeByteArray(bloc,0,bloc.length);

zipoutputstream
tags question: http://stackoverflow.com/q/24363461
type: Tag
tag name: zipoutputstream

http://stackoverflow.com/a/24311011
type: Answer
has body: You can use commons file upload to parse multipart request. Common file upload gives you a FileItem instance when you are done with request parsing. Fetch the input stream from FileItem instance and use the contents in your servlet. protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { DiskFileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); // Parse the request List&lt;FileItem&gt; items = upload.parseRequest(request); for (FileItem item : items){ InputStream in = item.getInputStream(); //Use in here } }
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/37576932
has comment: http://stackoverflow.com/comment/37582028
answers question: http://stackoverflow.com/q/24303341
downvote count: 0

http://stackoverflow.com/comment/37653998
comment on: http://stackoverflow.com/a/24353188
has text: And then you can use "Output.write(i)" and "Input.read(i)" to read/write to files
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/99617470
comment on: http://stackoverflow.com/a/32811065
score: 23
type: AnswerComment
has text: `Error: Cask 'java8' is unavailable: No Cask with this name exists.`
type: Comment

http://stackoverflow.com/comment/37567734
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24305333
has text: Sorry I meant *"use `doAnswer`"* not literally but rather functionally. You should write code to return different results conditionally. Take a look on the second example. You can write another `Answer` which will return `selected` as result and `selected` becomes `true` only when something clicked on it

spongycastle
type: Tag
tags question: http://stackoverflow.com/q/24386306
tags question: http://stackoverflow.com/q/24355433
tag name: spongycastle

http://stackoverflow.com/comment/37731637
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24394087
has text: Regex is basically for text data which is String type in java. String is an array of `char`s and each `char` is comprised of two bytes. Giving the mixture of text and byte data as one unit of input to regex engine is not a good idea (IMHO), where the engine attempts to read series of `char`s.
score: 0

http://stackoverflow.com/comment/37543825
score: 1
comment on: http://stackoverflow.com/q/24294384
type: Comment
type: QuestionComment
has text: OK, Actors and Futures would probably count as cheating then. You would need to create at least one new thread there. Unfortunately concurrency is the only way I can think of to do this properly. Even if you could split the complicated computation up into smaller chunks, so that you could check the time between the smaller steps in each iteration, you would still risk exceeding the time limit because one step still computes when the time is up...

http://stackoverflow.com/comment/37656149
type: Comment
type: QuestionComment
has text: So it returns the next _object_ in the enumeration? How do you invoke a method on an _object_ (an object reference that is)?
score: 1
comment on: http://stackoverflow.com/q/24354174

http://stackoverflow.com/comment/37672111
score: 0
has text: It`s not about outputprotein.txt. It`s about blast.batch file which is not executing for the creation of outputprotein.txt file.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24359443

http://stackoverflow.com/a/24396111
downvote count: 0
type: Answer
has body: Assuming the input is valid... byte[] b = new byte[a.length()]; for (int i = 0; i &lt; b.length; i++) { b[i] = (byte) (a.charAt(i) - '0'); }
score: 5
answers question: http://stackoverflow.com/q/24395994
upvote count: 5

http://stackoverflow.com/comment/37635123
has text: print the value of `donne.length` and check what it is
comment on: http://stackoverflow.com/q/24343652
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37729040
type: QuestionComment
has text: It does allow, when I asked live support stating my reasons they told me it's fine. As far as drivers goes, mind directing me to the jar files you have in mind?
score: 0
comment on: http://stackoverflow.com/q/24392903
type: Comment

http://stackoverflow.com/a/24355322
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37658366
type: Answer
answers question: http://stackoverflow.com/q/24355246
score: 1
has comment: http://stackoverflow.com/comment/37658437
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24355246
has comment: http://stackoverflow.com/comment/37658584
has comment: http://stackoverflow.com/comment/37658392
has comment: http://stackoverflow.com/comment/37658329
has body: You need to check if gs is null in your for loop, something like if(gs != null &amp;&amp; &lt;insert original if statement&gt;){ ....

http://stackoverflow.com/q/24335565
favorite count: 0
has answer: http://stackoverflow.com/a/24335699
has comment: http://stackoverflow.com/comment/37620385
accepted answer: http://stackoverflow.com/a/24335699
tagged with: initialization
possible better answer: http://stackoverflow.com/a/24335713
has answer: http://stackoverflow.com/a/24335713
upvote count: 2
tagged with: final
has comment: http://stackoverflow.com/comment/37620205
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37620109
tagged with: java
type: Question
has body: please don't mind this is just a simple question on array length property. As a beginner in Java I came across Constants and final keyword, which is described as: Constants are non-modifiable variables, declared with keyword final. Their values cannot be changed during program execution. Also, constants must be initialized during declaration. For examples: final double PI = 3.1415926; // Need to initialize I have read nearly all the related posts, but I have a confusion about its initialization. I've tried to dive into its class using Netbeans IDE but it's implementation was not visible there. What about the length field to get the length of an array? http://docs.oracle.com/javase/specs/jls/se7/html/jls-10.html#jls-10.7 How and when it is initialized (runtime/compiletime)?
answer count: 2
linked to: http://stackoverflow.com/q/9297899
has comment: http://stackoverflow.com/comment/37621170
tagged with: arrays
downvote count: 0
has title: array length property in java

http://stackoverflow.com/comment/37653739
score: 0
type: Comment
type: QuestionComment
has text: @StuartMarks Sir i'm using this tutorial http://mrbool.com/how-to-create-rmi-client-and-server-to-invoke-remove-method-of-rmi-server-in-java/28320
comment on: http://stackoverflow.com/q/24345462

http://stackoverflow.com/comment/37561328
comment on: http://stackoverflow.com/q/24300604
type: Comment
has text: Hi lefloh, I have just added to add Content-Type:application/v-1.1 to add versioning support. In this case consume will become @Consumes("application/v-1.1").. I was just trying different way to add versioning support.. if you think this is not a good way then i can drop it..
score: 0
type: QuestionComment

http://stackoverflow.com/a/24387403
type: Answer
has body: As far as I understand you fetch method that accepts one argument of type ArrayList: Method method = this.cls.getDeclaredMethod("execute", ArrayList.class); But then try to invoke it with argument of type that I cannot recognize that is obviously not ArrayList (int) method.invoke(this.cls.newInstance()); What is the type of this.cls.newInstance()? Value of cls is assigned in method initializeCommandModule() as following: this.cls = this.loadClass(m.getMainClass(), url); where m is Module. I have no idea what Module is and therefore do not know what does getMainClass() return.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24387242
downvote count: 0

http://stackoverflow.com/q/24366219
answer count: 2
has comment: http://stackoverflow.com/comment/37678563
has comment: http://stackoverflow.com/comment/37678683
linked to: http://stackoverflow.com/q/24361042
has comment: http://stackoverflow.com/comment/37678785
has comment: http://stackoverflow.com/comment/37679882
score: 0
tagged with: android
tagged with: textview
has answer: http://stackoverflow.com/a/24366391
type: UnansweredQuestion
tagged with: java
has title: Cannot assign value to final variable - Android
has answer: http://stackoverflow.com/a/24366285
has body: I am trying to define a TextView final but says that: Cannot assign value to final variable. In the code below i inserted some comments to help catching easier the problem. Any help? Thanks in advance! CODE: public class single_presentation extends Activity { List&lt;Slider&gt; list; final TextView correctAnswerHolder = null; int i = 0; DatabaseHelper db = new DatabaseHelper(this); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.single_presentation); String value = getIntent().getStringExtra("PRESENTATION_SESSION_ID"); list = db.getAllSlidersByPresentation(value); db.close(); String question = list.get(0).getQuestion(); TextView questionText = (TextView) findViewById(R.id.questionText); questionText.setText(question); String correctAnswer = list.get(0).getCorrectAnswer(); TextView correctAnswerText = (TextView) findViewById(R.id.correctAnswerText); String wrongAnswer_1 = list.get(0).getWrongAnswer1(); TextView wrongAnswerText_1 = (TextView) findViewById(R.id.wrongAnswerText_1); String wrongAnswer_2 = list.get(0).getWrongAnswer2(); TextView wrongAnswerText_2 = (TextView) findViewById(R.id.wrongAnswerText_2); String wrongAnswer_3 = list.get(0).getWrongAnswer3(); TextView wrongAnswerText_3 = (TextView) findViewById(R.id.wrongAnswerText_3); Uri imgUri = list.get(i).getImageURI(); ImageView imageView = (ImageView)findViewById(R.id.imageView); imageView.setImageURI(imgUri); final String [] answers = {correctAnswer, wrongAnswer_1, wrongAnswer_2, wrongAnswer_3}; ArrayList&lt;String&gt; answersList = new ArrayList&lt;String&gt;(Arrays.asList(answers)); long seed = System.nanoTime(); Collections.shuffle(answersList, new Random(seed)); Log.e("First Slider Answers ", answersList.toString()); correctAnswerText.setText(answersList.get(0)); wrongAnswerText_1.setText(answersList.get(1)); wrongAnswerText_2.setText(answersList.get(2)); wrongAnswerText_3.setText(answersList.get(3)); if (correctAnswerText.getTex…
type: Question
has comment: http://stackoverflow.com/comment/37678775
has comment: http://stackoverflow.com/comment/37678590

http://stackoverflow.com/a/24392507
has comment: http://stackoverflow.com/comment/37729218
has comment: http://stackoverflow.com/comment/37728705
type: Answer
has comment: http://stackoverflow.com/comment/37728813
has comment: http://stackoverflow.com/comment/37728935
score: 2
has comment: http://stackoverflow.com/comment/37729060
has comment: http://stackoverflow.com/comment/37892733
upvote count: 2
has comment: http://stackoverflow.com/comment/37730128
accepted answer of: http://stackoverflow.com/q/24392463
has comment: http://stackoverflow.com/comment/37892063
answers question: http://stackoverflow.com/q/24392463
has body: HttpResponse response = httpclient.execute(httpost); HttpEntity entity = response.getEntity(); String responseString = EntityUtils.toString(entity, "UTF-8"); System.out.println(responseString); The response is held in the body of the HttpResponse. You can use EntityUtils to get the string body from the HttpEntity in the HttpResponse.
has comment: http://stackoverflow.com/comment/37729828
has comment: http://stackoverflow.com/comment/38184461
has comment: http://stackoverflow.com/comment/37729145
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24398501
has comment: http://stackoverflow.com/comment/37741460
upvote count: 3
has comment: http://stackoverflow.com/comment/37739752
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24398477
type: Answer
has comment: http://stackoverflow.com/comment/37739868
has comment: http://stackoverflow.com/comment/37739887
answers question: http://stackoverflow.com/q/24398477
score: 3
downvote count: 0
has body: You are shadowing your field myvalue and not overriding it, I believe something like this will do what you want public class a{ protected int myvalue = 1; } public class b extends a{ public b() { myvalue = 2; } } public class c extends a{ public c() { myvalue = 3; } } Also, please don't use Raw Types // ArrayList&lt;a&gt; mylist = new ArrayList(); ArrayList&lt;a&gt; mylist = new ArrayList&lt;&gt;(); // &lt;a&gt; on Java 5 and 6
has comment: http://stackoverflow.com/comment/37739793

http://stackoverflow.com/comment/37702354
type: AnswerComment
comment on: http://stackoverflow.com/a/24375002
score: 0
type: Comment
has text: @AvB are you sure you want me to delete anything I don't understand ;)

http://stackoverflow.com/comment/37655483
type: QuestionComment
score: 0
has text: I'm not quite familiar with android, yet I feel your code doesn't make sense or follow any logic. can you explain your logic plz?
comment on: http://stackoverflow.com/q/24353834
type: Comment

http://stackoverflow.com/comment/37658656
type: Comment
has text: I also had one more question. If any of you can pls look into it and reply. http://stackoverflow.com/questions/24189665/gae-one-to-one-relationship-delete-giving-error
comment on: http://stackoverflow.com/a/24343673
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37696538
type: Comment
type: QuestionComment
has text: An array in Java is an object, and therefore `vals` is an object reference. Every time you say `solutions.add(vals)`, you are adding a reference to that same array to the `ArrayList`; you are not making a copy of the array. Look at the [`Arrays.copyOf`](http://docs.oracle.com/javase/8/docs/api/java/util/Arrays.html) methods.
score: 3
comment on: http://stackoverflow.com/q/24375616

http://stackoverflow.com/a/24338630
type: Answer
downvote count: 2
answers question: http://stackoverflow.com/q/24338551
has body: I would think it would go something like this... ProcessDetailsServlet pds = new ProcessDetailsServlet(); System.out.println("Name: " + pds. + applicantName);
upvote count: 0
score: -2

http://stackoverflow.com/q/24319849
score: 2
upvote count: 3
has answer: http://stackoverflow.com/a/24319873
downvote count: 1
type: Question
answer count: 8
has body: In Java when i run System.out.println("\" \\"); I get output as : " \ Can you please explain in detail, why this is happening?
has answer: http://stackoverflow.com/a/65994807
tagged with: java
has answer: http://stackoverflow.com/a/24320007
has answer: http://stackoverflow.com/a/24319893
has comment: http://stackoverflow.com/comment/37591768
has answer: http://stackoverflow.com/a/24319861
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24319920
has title: In Java, why does System.out.println("\" \\"); gives " \ as output
has answer: http://stackoverflow.com/a/24319884
has answer: http://stackoverflow.com/a/24319917

http://stackoverflow.com/a/24376531
has comment: http://stackoverflow.com/comment/37699483
score: 2
has body: There is no problem using bit operations (apart from unsigned-shift-right) if you are not doing sign involving arithmetics. Yes, converting to char or int extends the sign, but you can do: byte b = (byte)0x96; int n = 0xFF &amp; b; // Again 0..255 (Maybe one should warn, trying to store bytes in a String with chars, is a kind of abuse involving encoding conversion.) By the way, the classes Integer, Long and such have many interesting bit operations. The class BitSet is also an interesting playground.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37705580
has comment: http://stackoverflow.com/comment/37725291
answers question: http://stackoverflow.com/q/24376426
type: Answer
accepted answer of: http://stackoverflow.com/q/24376426
upvote count: 2
has comment: http://stackoverflow.com/comment/37721799
has comment: http://stackoverflow.com/comment/37699666

http://stackoverflow.com/comment/67682885
type: Comment
comment on: http://stackoverflow.com/a/28635465
score: 16
has text: @tandrewnichols I just ran `brew cask install java` on my El Capitan Mac and it's downloading `jdk-8u112-macosx-x64.dmg`.
type: AnswerComment

http://stackoverflow.com/comment/37503523
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24273994
score: 2
has text: You're thinking of the mantissa in terms of a *decimal* point - it's a *binary* point...

http://stackoverflow.com/q/24312015
score: 0
answer count: 2
has title: java synchronize collections selection for application requirement
possible better answer: http://stackoverflow.com/a/24312095
accepted answer: http://stackoverflow.com/a/24312933
linked to: http://stackoverflow.com/q/12646404
has comment: http://stackoverflow.com/comment/37575348
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24312933
tagged with: java
has answer: http://stackoverflow.com/a/24312095
has body: What is synchronized collection means in java . Which to choose for developing application if i am printing records of user in jsp page from servlet?which to choose among the following HashMap Hash Table
type: Question

http://stackoverflow.com/q/24395851
answer count: 1
score: 0
tagged with: http://stackoverflow.com/tag/csv
tagged with: dozer
type: UnansweredQuestion
has body: I have the below classes.. SurveyResponse.java import java.util.List; public class SurveyResponse { private int age; private Boolean consentGiven; private List&lt;Answer&gt; answers; public SurveyResponse() { } public SurveyResponse(final int age, final Boolean consentGiven, final List&lt;Answer&gt; answers) { this.age = age; this.consentGiven = consentGiven; this.answers = answers; } public int getAge() { return age; } public List&lt;Answer&gt; getAnswers() { return answers; } public Boolean getConsentGiven() { return consentGiven; } public void setAge(final int age) { this.age = age; } public void setAnswers(final List&lt;Answer&gt; answers) { this.answers = answers; } public void setConsentGiven(final Boolean consentGiven) { this.consentGiven = consentGiven; } @Override public String toString() { return String.format("SurveyResponse [age=%s, consentGiven=%s, answers=%s]", age, consentGiven, answers); } } Answer.java public class Answer { private Integer questionNo; private String answer; public Answer() { } public Answer(final Integer questionNo, final String answer) { this.questionNo = questionNo; this.answer = answer; } public String getAnswer() { return answer; } public Integer getQuestionNo() { return questionNo; } public void setAnswer(final String answer) { this.answer = answer; } public void setQuestionNo(final Integer questionNo) { this.questionNo = questionNo; } @Override public String toString() { return String.format("Answer [questionNo=%s, answer=%s]", questionNo, answer); } } and my Main class with the looping which works fine as below - import java.io.FileWriter; import java.util.Arrays; import java.util.List; import org.supercsv.cellprocessor.FmtBool; import org.supercsv.cellprocessor.Optional; import org.supercsv.cellprocessor.Token; import org.supercsv.cellprocessor.constraint.NotNull; import org.supercsv.cellprocessor.ift.CellProcessor; import org.supercsv.io.dozer.CsvDozerBeanWriter; import org.supercsv.io.dozer.ICsvDozerBeanWriter; import org.…
tagged with: supercsv
tagged with: java
type: Question
has title: Java to CSV file, SuperCSV Dozer: How to avoid looping for a nested object
has answer: http://stackoverflow.com/a/24400040

http://stackoverflow.com/a/24411930
has comment: http://stackoverflow.com/comment/37768335
has comment: http://stackoverflow.com/comment/37768768
score: 0
has comment: http://stackoverflow.com/comment/37768300
has comment: http://stackoverflow.com/comment/37767983
has comment: http://stackoverflow.com/comment/37767715
has comment: http://stackoverflow.com/comment/37768400
has comment: http://stackoverflow.com/comment/37768171
type: Answer
has body: use directory() to set working directory to C:\\Radiance4.2\\bin\\ and pass List&lt;String&gt; List cmd = new ArrayList(); cmd.add("genskyvec"); cmd.add("1"); cmd.add("21"); cmd.add("11"); // all parameters and use redirectOutput() to file you are passing with &gt;
has comment: http://stackoverflow.com/comment/37767790
answers question: http://stackoverflow.com/q/24411664

http://stackoverflow.com/comment/69959730
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24438328
has text: @DennisLaumen I've since moved on, but I can say it only took me 2 days to hack Tyrus and use my own internal Tyrus build to make WebSockets work. Obviously not ideal but all the other implementations of WebSockets at the time also didn't have this feature so I made do.
type: AnswerComment

http://stackoverflow.com/a/24412374
has comment: http://stackoverflow.com/comment/37765451
type: Answer
accepted answer of: http://stackoverflow.com/q/24412149
answers question: http://stackoverflow.com/q/24412149
has body: The ellipsis generally means "I'm going to ask for more details", so file/open will have an ellipsis next to the command button to indicate that the app will pop up a dialog to ask which file you want opened. This standard was set by Microsoft in their style guide, so its pretty much universal in Windows apps. The >> tends to mean "and more options are available", so you have a button that you can click to expand the set of options to list less-used, or advanced choices. The difference is that ... means "choose and I'll ask for more info", &gt;&gt; means "choose more". Given your use-case I'd probably go with the &gt;&gt;. Ah - see this answer for some canonical documentation.
score: 2
type: AcceptedAnswer
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/124527075
type: AnswerComment
has text: Your first sentence is quite incorrect. Oracle provides *two* downloads of Java 8 Update 311: (a) the regular product [*Oracle JDK*](https://www.oracle.com/java/technologies/downloads/#java8), and the cutting-edge new technology product, [*GraalVM Enterprise*](https://www.graalvm.org/downloads/).
type: Comment
score: 0
comment on: http://stackoverflow.com/a/32811065

http://stackoverflow.com/comment/37505898
comment on: http://stackoverflow.com/a/24271378
score: 0
type: Comment
type: AnswerComment
has text: So, does that mean that the `index` there doesn't refer to an index, but to a different concept of the same name? ;)

http://stackoverflow.com/comment/37729706
type: Comment
comment on: http://stackoverflow.com/a/24374760
type: AnswerComment
score: 0
has text: Change `WebElement actualCourse` to `WebElement actualMovie`! Also, skip the `/descendant::table//` from all your XPaths.

http://stackoverflow.com/a/24334374
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24334093
has comment: http://stackoverflow.com/comment/37618099
score: 3
answers question: http://stackoverflow.com/q/24334093
has comment: http://stackoverflow.com/comment/37617869
has body: public static void main(String[] args) throws Exception { // initialize ArrayList&lt;String[]&gt; list = new ArrayList&lt;String[]&gt;(); list.add(new String[] {"Vial1","Dest1"}); list.add(new String[] {"Vial2","Dest2"}); list.add(new String[] {"Vial3","Dest3"}); list.add(new String[] {"Vial4","Dest4"}); // writer FileWriter writer = new FileWriter("output.txt"); // headers writer.write("VialNo,DestinationNo\n"); writer.flush(); // data for(String[] arr: list) { String appender = ""; for(String s : arr){ writer.write(appender + s); appender = ","; } writer.write("\n"); writer.flush(); } writer.close(); } This gave me the output VialNo,DestinationNo Vial1,Dest1 Vial2,Dest2 Vial3,Dest3 Vial4,Dest4 You need to loop over each string in each array, not try to simply print out the array. I also used an appender for formatting the file as a csv. Updated code to include creating the headers
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/37513370
type: QuestionComment
comment on: http://stackoverflow.com/q/24279248
score: 1
has text: 1. What is null? The hashtable or hashtable.get(somekey)? 2. Have you tried debugging?
type: Comment

http://stackoverflow.com/a/24414940
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24414902
has comment: http://stackoverflow.com/comment/37770572
has body: You will need to use one of the tree traversal algorithms. Here is the example.
has comment: http://stackoverflow.com/comment/37779787

http://stackoverflow.com/a/24419043
type: Answer
has body: Just break the for loop: for(int i = 0; i&lt; list.size(); i++){ if(list.get(i) != 0){ System.out.println(i); break; } }
score: 2
has comment: http://stackoverflow.com/comment/37778198
upvote count: 2
has comment: http://stackoverflow.com/comment/37778094
has comment: http://stackoverflow.com/comment/37778249
downvote count: 0
answers question: http://stackoverflow.com/q/24419025

http://stackoverflow.com/comment/37541749
type: Comment
comment on: http://stackoverflow.com/a/24294040
type: AnswerComment
has text: Thanks for your help, driving me crazy for ages
score: 0

http://stackoverflow.com/a/24318331
score: 2
upvote count: 2
has body: You are using integers to calculate the costs. By casting the result from the square root to an int, you are basically throwing away the significance. Casting to an int is not the same as rounding. So in this case: getH(...): 4.9 --&gt; 4 getH(...): 4.1 --&gt; 4 In both situations these costs will become the same value. Use doubles to compare the costs to resolve this issue. Related: How to cast a double to an int in Java by rounding it down?
has comment: http://stackoverflow.com/comment/37587464
has comment: http://stackoverflow.com/comment/37587441
accepted answer of: http://stackoverflow.com/q/24318239
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24318239
type: Answer

http://stackoverflow.com/comment/37525618
has text: make sure you have added jar files to the build path
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24285923

http://stackoverflow.com/q/24329219
tagged with: jms
favorite count: 0
type: UnansweredQuestion
has title: Store Weblogic JMS messages for analysis
has answer: http://stackoverflow.com/a/24366687
tagged with: weblogic8.x
score: 1
tagged with: java
upvote count: 1
has body: We are currently having issues with Weblogic JMS, some of the messages received by the Tibco end are blank, but, our logs indicate that the messages are sent in full (we log just before sending it to the queue). We are planning to store the jms messages for a couple of days and verify if that is a problem at the Weblogic end or the tibco end. I know that there is a persistance store in JMS, but that will clear the messages once the message is sent to the client. Do we have a feature that allows us to store the messages for a period of time? Environment: Weblogic 8.1 Integration Thanks.
type: Question
tagged with: weblogic
has comment: http://stackoverflow.com/comment/37620258
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/37739514
score: 1
type: AnswerComment
has text: @DanielPryden Thanks. Actually I hadn't seen your comment (it was hidden beneath "show more comments") at the time I wrote my answer. But you know what they say, you schmooze, you lose! :-)
comment on: http://stackoverflow.com/a/24380219
type: Comment

http://stackoverflow.com/a/24313526
has body: You need to make a method call to your myClass object, not a string. The string will not be executed, its not code, just words. statement.executeUpdate("INSERT INTO my_table VALUES(" + myClass.getValue() + ", 'abcd',now())");
answers question: http://stackoverflow.com/q/24313442
score: 0
type: Answer

http://stackoverflow.com/comment/107883672
has text: Can confirm @DavidJ.'s comment. I just created a `java.util.UUID` from a ULID from huxi (https://github.com/huxi/sulky/tree/master/sulky-ulid) and `toString()` works fine. NOTE: This is all on JDK11.
type: Comment
comment on: http://stackoverflow.com/a/24409153
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37592945
comment on: http://stackoverflow.com/a/24320674
type: Comment
score: 1
has text: If that's the case then you can roll with it. It's not what I would call a "clean" code, but you're not the first that uses an interface for the marker pattern (Serializable, Clonable etc.)
type: AnswerComment

http://stackoverflow.com/comment/76001557
comment on: http://stackoverflow.com/q/24274483
score: 0
has text: Possible duplicate of [How can I validate CSS on internal web pages?](https://stackoverflow.com/questions/1137884/how-can-i-validate-css-on-internal-web-pages)
type: QuestionComment
type: Comment

http://stackoverflow.com/a/24421389
answers question: http://stackoverflow.com/q/24421348
has comment: http://stackoverflow.com/comment/37921883
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/37782620
has body: Either use a Set...which explicitly disallows duplicates, or check if the list contains the element on insertion. @Override public boolean add(T element) { if(contains(element)) { return false; } else { return super.add(element); } } Overriding equals wouldn't get you very far, as you'd be overriding it for the List itself (i.e. you'd be checking if two lists were equal).
has comment: http://stackoverflow.com/comment/37782639
upvote count: 4
score: 3
has comment: http://stackoverflow.com/comment/37930438

http://stackoverflow.com/comment/37775575
score: 0
type: Comment
has text: Always paste the full stack trace of the exception when you get one and want help about it.
type: QuestionComment
comment on: http://stackoverflow.com/q/24417657

http://stackoverflow.com/q/24291030
has comment: http://stackoverflow.com/comment/37536541
has comment: http://stackoverflow.com/comment/37537095
tagged with: java
has answer: http://stackoverflow.com/a/24292236
type: Question
tagged with: gridbaglayout
has body: I am trying to create the following GUI: but the GUI that I make is: What my grid looks like: image: THE GRIDLAYOUT FOR THIS I don't understand why I am getting this output since I have drawn a diagram to aid the code and it seems to work out. The method addComp adds adds the input component to the input panel at a given (x, y) position and at a given component width and height. Code: import javax.swing.*; import java.awt.*; public class GUIError extends JFrame { //initialise all the components JPanel mainPanel = new JPanel(); JTextField txtDisplay = new JTextField(); JButton btnA = new JButton("A"); JButton btnB = new JButton("B"); JButton btnC = new JButton("C"); JButton btnD = new JButton("D"); JButton btnE = new JButton("E"); JButton btnF = new JButton("F"); JButton btnWA = new JButton("WA"); JButton btnWB = new JButton("WB"); JButton btnWC = new JButton("WC"); JButton btnWD = new JButton("WD"); private void addComp(JPanel panel, JComponent comp, int xPos, int yPos, int compWidth, int compHeight) { GridBagConstraints gridConstraints = new GridBagConstraints(); gridConstraints.gridx = xPos; gridConstraints.gridy = yPos; gridConstraints.gridwidth = compWidth; gridConstraints.gridheight = compHeight; gridConstraints.weightx = 0.5; gridConstraints.weighty = 0.5; gridConstraints.insets = new Insets(5, 5, 5, 5); gridConstraints.anchor = GridBagConstraints.CENTER; gridConstraints.fill = GridBagConstraints.BOTH; panel.add(comp, gridConstraints); } public static void main(String[] args) { try { for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { } SwingUtilities.invokeLater(new Runnable() { public void run() { // create frame JFrame frame = new JFrame("Calculator"); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setLocationRelativeTo(null); Container c = frame.getContentPane(); // create GUI within frame new GU…
score: 5
tagged with: layout
upvote count: 5
possible better answer: http://stackoverflow.com/a/24293183
has answer: http://stackoverflow.com/a/24293183
has title: GridBagLayout gridding not working
has answer: http://stackoverflow.com/a/24294725
accepted answer: http://stackoverflow.com/a/24292236
has comment: http://stackoverflow.com/comment/37536864
downvote count: 0
tagged with: layout-manager
favorite count: 0
has comment: http://stackoverflow.com/comment/37538041
has comment: http://stackoverflow.com/comment/52422940
tagged with: swing
has answer: http://stackoverflow.com/a/32277227
answer count: 4
has comment: http://stackoverflow.com/comment/37538014
type: AnsweredQuestion

http://stackoverflow.com/comment/37739061
comment on: http://stackoverflow.com/q/24398107
has text: Please post the exact code you're having trouble with in the question itself rather than linking offsite. Is your problem with setting the text of the jTextAreas, or attaching the event listeners, or the computation of the values or something else?
type: Comment
type: QuestionComment
score: 3

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/24319448
tags question: http://stackoverflow.com/q/24286537
tags question: http://stackoverflow.com/q/24401386
type: Tag

http://stackoverflow.com/a/24335270
score: 0
has comment: http://stackoverflow.com/comment/37620143
has comment: http://stackoverflow.com/comment/37619984
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24335148
answers question: http://stackoverflow.com/q/24335148
type: Answer
has body: There is a problem there... In your for you have IF statement with a return.. First Neighbour is Twee and it is not in the list so it will visit Twee and never go back to the next iteration because of that return statement. Try using a boolean variable and doing something like this: boolean b = false; for(String neighbour : graph.neighbours(nodeA)) { if(!visited.contains(neighbour)) { // this statement can never change b to false once it becomes true // and you make sure you return after checking your whole set of neighbours b = b || isRoute(neighbour, nodeB, visited); } } return b; This might not be the exact correct solution but at least now you know where is your problem... You are returning after first item and not iterating over all the neighbours.
has comment: http://stackoverflow.com/comment/37619905
has comment: http://stackoverflow.com/comment/37620038

http://stackoverflow.com/q/24301045
score: 0
tagged with: hibernate3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37560670
has answer: http://stackoverflow.com/a/24305014
has comment: http://stackoverflow.com/comment/37561712
tagged with: java
has comment: http://stackoverflow.com/comment/37555463
type: Question
has title: How to get Name from Code to display on records on JSP by using Strius2 and Hibernate3 Entity Mapping relationship
answer count: 1
tagged with: jsp
has body: I have two tables Group(Parent) andType(Child) and they are mapped by GroupId. This is done by Hibernate @OneToMany Mapping. My Issue is When I am displaying records of Type Table in JSP it is displaying TypeName &amp; GroupId because I am using TypeEntity Class to to this,but I want to display TypeName and GroupName not the GroupId. As Simple as I want .like: SELECT A.TYPE_NAME, B.GROUP_NAME FROM TYPE A, GROUP B WHERE A.GROUP_ID = B.GROUP_ID; Currently I am using: List&lt;UserTypeEntity&gt; typeList = criteria.add(Restrictions.eq("userActive", "Y").ignoreCase()).addOrder(Property.forName("userTypeName").asc()).list(); Just help on this how can I approch using hibernate3 My TypeEntity Class: @Entity @Table(name="USER_TYPE_MSTR") public class UserTypeEntity implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name="USER_TYPE_ID") private int userTypeId; @Column(name="USER_TYPE") private String userTypeName; @Column(name="USER_TYPE_DESC") private String userTypeDesc; // @ManyToOne @Column(name="USER_GRP_ID") private int userGroupId; ..... Setter Getters.... } And My GroupEntity Class: @Entity @Table(name="USER_GROUP_MSTR") public class UserGroupEntity implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name="USER_GRP_ID") private int userGroupId; @Column(name="USER_GRP") private String userGroupName; @Column(name="USER_GRP_DESC") private String userGroupDesc; @Column(name="ACTIVE") private String userActive; @OneToMany(cascade=CascadeType.ALL) @JoinTable( name ="USER_GROUP_TYPE", joinColumns = {@JoinColumn(name="GROUP_ID", referencedColumnName="USER_GRP_ID")}, inverseJoinColumns = {@JoinColumn(name="TYPE_ID", referencedColumnName="USER_TYPE_ID")} ) private Set&lt;UserTypeEntity&gt; userTypeEntities; /** * @return the userTypeEntities */ public Set&lt;UserTypeEntity&gt; getUserTypeEntities() { return userTypeEntities; } /** * @param userTypeEntities the userTypeEntities to set */ public void setUserTy…
tagged with: struts2

http://stackoverflow.com/comment/37665615
comment on: http://stackoverflow.com/q/24358989
has text: In general, no. No resources are released upon going to sleep.
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/a/24417497
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37775275
has comment: http://stackoverflow.com/comment/37775309
upvote count: 2
has body: You can use a negated character class. Example: [^\\S \\t] that means \s without space and tab. Or you can use a class intersection: [\\s&amp;&amp;[^ \\t]]
answers question: http://stackoverflow.com/q/24417394
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24417394
type: Answer

http://stackoverflow.com/q/24343438
has answer: http://stackoverflow.com/a/24343480
upvote count: 2
has answer: http://stackoverflow.com/a/24344114
linked to: http://stackoverflow.com/q/7271147
has body: import java.util.Random; public class Test{ static int r = new Random().nextInt(2); static int a(){ return r==1 ? 1 :0; } public static void test1() throws Exception { // System.out.println(1403187139018L); for (int i = 0; i &lt; 1073741824; i++) {}//* // Thread.sleep(20000); long d = 0; for (int j = 0; j &lt; 10; j++) { long y = System.currentTimeMillis(); for (int x = 0; x &lt; 1073741823; x++) { d += r==0?1:0; } System.out.println((System.currentTimeMillis() -y)); } } public static void test2() throws Exception{ // Thread.sleep(20000); long d = 0; for (int j = 0; j &lt; 10; j++) { long y = System.currentTimeMillis(); for (int x = 0; x &lt; 1073741824; x++) { d += r==0?1:0; } System.out.println((System.currentTimeMillis() -y)); // System.out.println("time:"+ (System.currentTimeMillis() - y)); } } public static void main(String[] args) throws Exception{ // Thread.sleep(20000); test1(); test2(); } } When I run the above code, I get this output: 32 26 28 28 32 29 35 33 30 31 1321 1308 1324 1277 1348 1321 1337 1413 1287 1331 Why is test1 much faster ? There is no difference except the followings: System.out.println(1403187139018L); for (int i = 0; i &lt; 1073741824; i++) {}//* Also, the time cost for test1 is 25-35 milliseconds, which I find unbelievable. I wrote the same code in C and it needed about 4 seconds to run every for loop. This behavior seems strange. How do I know when to add: System.out.println(1403187139018L); for (int i = 0; i &lt; 1073741824; i++) {}//* Also, if I change r==0?1:0 to a() then test2() runs faster than test1(). The output I get is: 1403187139018 3726 3729 3619 3602 3797 4362 4498 3816 4143 4368 1673 1386 1388 1323 1296 1337 1294 1283 1235 1460 the original legacy code: ... long t = System.currentTimeMillis(); MappedByteBuffer mbb = map(new File("temp.mmp"), 1024L * 1024 * 1024); System.out.println("load " + (System.currentTimeMillis() - t));//* for (int i = 0; i &lt; 2014L * 1024 * 1024; i++) {}//* int d = 0; for (int j = 0; j &lt; 10; j+…
possible better answer: http://stackoverflow.com/a/24343480
accepted answer: http://stackoverflow.com/a/24344114
tagged with: profile
tagged with: performance
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/37643329
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37638827
has answer: http://stackoverflow.com/a/24343556
type: Question
type: AnsweredQuestion
has title: Why does test1() run much faster than test2()?
favorite count: 0

http://stackoverflow.com/comment/37731381
has text: possible duplicate of [Project Euler #3 Java](http://stackoverflow.com/questions/12611149/project-euler-3-java)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24393670

nexus
type: Tag
tag name: nexus
tags question: http://stackoverflow.com/q/24359162

http://stackoverflow.com/a/66525598
downvote count: 0
has comment: http://stackoverflow.com/comment/138871859
score: 16
has comment: http://stackoverflow.com/comment/139181271
has comment: http://stackoverflow.com/comment/139181175
answers question: http://stackoverflow.com/q/24386771
has body: See also my fresh Answer written in 2024 on a similar Question. Find details there for Jakarta EE 11, Jakarta Validation 3.1.0, Hibernate Validator 9.0.0.Beta2, Jakarta Expression Language 6.0.1, and Tomcat’s tomcat-jasper-el version 11.0.0-M24. Jakarta namespace As part of the handover from Oracle to the Eclipse Foundation, Java EE is being renamed to Jakarta EE. With Jakarta EE 9, the Java package names were changed from javax.* to jakarta.*. The Answer by M. Justin is correct with regard to Jakarta. I added this Answer to provide more explanation and specific examples. Interface versus Implementation Jakarta Validation (formerly Jakarta Bean Validation) is a specification of an API in Java. The binary library for this spec contains only interfaces, not executable code. So we also need an implementation of these interfaces. I know of only one implementation of Jakarta Validation versions 2 & 3 specifications: Hibernate Validator versions 6 and 7 (respectively). Desktop & console apps For web apps, a Jakarta-compliant web container will provide both the interface and the implementation needed to perform Bean Validation. For desktop and console apps, we have no such Jakarta-compliant web container. So you must bundle both the interface jar and the implementation jar with your app. You can use a dependency-management tool such as Maven, Gradle, or Ivy to download and bundle the interface & implementation jars. Jakarta Expression Language To run Jakarta Bean Validation, we need another Jakarta tool as well: Jakarta Expression Language, a special purpose programming language for embedding and evaluating expressions. Jakarta Expression Language is also known simply as EL. Jakarta Expression Language is defined by Jakarta EE as a specification for which you must download a jar of interfaces. And you also need to obtain an implementation of these interfaces in another jar. You may have choice of implementations. As of 2021-03, I know of Eclipse Glassfish by Eclipse Founda…
upvote count: 16
type: Answer

http://stackoverflow.com/a/24272016
score: 0
answers question: http://stackoverflow.com/q/24271949
type: Answer
has body: You can transform your boolean as static var, you'll call them with ABC.x and define just after the class with public static boolean x; It'll looks like class ABC { public static boolean x;

http://stackoverflow.com/a/24305487
downvote count: 1
upvote count: 0
has comment: http://stackoverflow.com/comment/37734764
answers question: http://stackoverflow.com/q/24304282
type: Answer
score: -1
has body: Try Matlab solution LZW &amp; LZ77.

http://stackoverflow.com/q/24382343
type: AnsweredQuestion
downvote count: 0
tagged with: java-stream
linked to: http://stackoverflow.com/q/24366220
tagged with: java
has answer: http://stackoverflow.com/a/24382693
has answer: http://stackoverflow.com/a/24382542
accepted answer: http://stackoverflow.com/a/24382693
type: Question
has body: I want to restrict the type parameter of a function to be a functional interface. Something like this: public static &lt;@FunctionalInterface T extends Function&lt;A, B&gt;&gt; T foo () { return a -&gt; bar; } The @FunctionalInterface is not allowed here. The aim is, to make it possible to return a lambda with the type of the type parameter. Since T can be a normal class, a return of a lambda is not allowed. Is there a possibility to restrict the type parameter to be a functional interface?
score: 4
answer count: 2
possible better answer: http://stackoverflow.com/a/24382542
tagged with: generics
favorite count: 0
has title: Mark generic type parameter as functional interface in Java 8
tagged with: lambda
upvote count: 4
tagged with: java-8

http://stackoverflow.com/a/24367596
answers question: http://stackoverflow.com/q/24364924
type: Answer
downvote count: 0
score: 1
upvote count: 1
has body: Hibernate is likely wrapping the SQL within another query to use Oracle's rownum in filtering the maxresults and firstrows. This will mean that any duplicates (c.Name and d.NAME) will cause exceptions unless aliased as described here: Column ambiguously defined in subquery using rownums . Other JPA providers (EclipseLink for instance) will automatically alias fields when using pagination, so you might want to check if a later Hibernate version does the same or pull the patch described here https://hibernate.atlassian.net/browse/HHH-951 Another duplicate bug that describes the issue is https://hibernate.atlassian.net/browse/HHH-1436

http://stackoverflow.com/q/24316858
has comment: http://stackoverflow.com/comment/37584736
tagged with: command-line
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/9436219
tagged with: javafx
has comment: http://stackoverflow.com/comment/37584661
has comment: http://stackoverflow.com/comment/37584813
tagged with: classpath
has comment: http://stackoverflow.com/comment/37584851
has body: I am using some classes from javafx library (these are observable collections). I can't include jfxrt.jar into my distribution, since it is java version dependent and I don't know which java my program will run on. How to accomplish? UPDATE I put jfxrt.jar in lib subdirectory of the programm directory and the following command does not work java -classpath ./lib/jfxrt.jar -jar MyProgram.jar Why? UPDATE 2 This was also does not work java -cp MyProgram.jar;./lib/* MyClass
has comment: http://stackoverflow.com/comment/37585061
has comment: http://stackoverflow.com/comment/37584799
has comment: http://stackoverflow.com/comment/37587062
has title: How to refer javafx from command line?
tagged with: java
has answer: http://stackoverflow.com/a/24317292
type: Question
linked to: http://stackoverflow.com/q/9436219
score: 0
answer count: 1

http://stackoverflow.com/comment/37776199
type: Comment
comment on: http://stackoverflow.com/a/24417428
has text: Thanks, I have updated the question with the requested information.
score: 0
type: AnswerComment

http://stackoverflow.com/q/24277685
score: 0
answer count: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: pojo
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37510710
type: Question
has body: I have nested POJO as below. All the POJO's are in the same package. Please see student is is the name pojo and all other POJO are inside class Student{ String firstName; String lastName; List &lt;Activities&gt; activites; public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public List&lt;Activities&gt; getActivites() { return activites; } public void setActivites(List&lt;Activities&gt; activites) { this.activites = activites; } } class Activites{ List&lt;Quipments&gt; quipments; String time; public List&lt;Quipments&gt; getQuipments() { return quipments; } public void setQuipments(List&lt;Quipments&gt; quipments) { this.quipments = quipments; } public String getTime() { return time; } public void setTime(String time) { this.time = time; } } class Quipments{ String Type; public String getType() { return Type; } public void setType(String type) { Type = type; } } I want to convert the above student POJO in json that will have all the values of other pojo. We are not suppose to use below api. I know the below one works. import com.sun.jersey.api.json.JSONJAXBContext; import com.sun.jersey.api.json.JSONMarshaller; Want to use something like below import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.JSONValue; Please advice
has title: To form Json from nested POJOS
has comment: http://stackoverflow.com/comment/37510732
has answer: http://stackoverflow.com/a/37575435

http://stackoverflow.com/comment/37587808
comment on: http://stackoverflow.com/a/24318435
type: Comment
has text: sorry, I was using 1 and 2 as examples. I do really want to produce 0 and 1.
score: 0
type: AnswerComment

http://stackoverflow.com/q/24299298
score: 0
upvote count: 1
has answer: http://stackoverflow.com/a/24299345
accepted answer: http://stackoverflow.com/a/24299345
answer count: 1
downvote count: 1
favorite count: 0
type: AnsweredQuestion
tagged with: encryption
has body: I am trying to understand some legacy code where one of the parameter to Cipher.init is 2. What does 2 signify here? try { if (key == null) { key = SecretKeyFactory.getInstance("DESede").generateSecret(new DESedeKeySpec(keyBytes)); } Cipher cipher = Cipher.getInstance("DESede"); cipher.init(2, key); }
type: Question
tagged with: des
has title: DESede Decrypt Issue
tagged with: java

http://stackoverflow.com/a/24315028
score: 0
has body: Spring is a Java EE-like stack. The core Spring framework provides Dependency injection, AOP, JDBC helpers etc. Also there are a couple of sub-projects: Spring MVC, Spring batch, Integration etc. (See the full stack here: http://spring.io/projects) Yes Spring MVC is veri similar to Struts, as both are action oriented MVC frameworks. Usually the sub-projects depend on the core and not on the other sub-projects. The main point is that Spring is a stack of technologies.
type: Answer
answers question: http://stackoverflow.com/q/24314886

http://stackoverflow.com/comment/37694392
type: AnswerComment
type: Comment
has text: @Fede I am glad you like it :)
comment on: http://stackoverflow.com/a/24374265
score: 0

http://stackoverflow.com/comment/37531903
score: 0
comment on: http://stackoverflow.com/a/24275093
type: AnswerComment
type: Comment
has text: And what does having the ProtocolException in class path help to begin with? That seems like a useless and even possibly harmful action. You don't put Java Classes in class path. You put Java runtimes, file/program associations in those (assuming you are talking about environmental variables). Basically, what would be more useful, was where lib is and what it means by having it in the same directory as lib? I can't find lib.

http://stackoverflow.com/a/24297963
type: AcceptedAnswer
has body: The next input should always be a double, right? So instead of while(line != null) (which will return true when you have an empty line) check while(scanner.hasNextDouble()): public void readDatabase(String s) throws FileNotFoundException{ try { final BufferedReader br = new BufferedReader(new FileReader(s)); final Scanner trainFile = new Scanner(br); while (trainFile.hasNextDouble()) { double x = trainFile.nextDouble(); double y = trainFile.nextDouble(); int type = trainFile.nextInt(); this.database.add(new Point(x,y,type)); } trainFile.close(); br.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } You still need to change the comma to a decimal point. Otherwise the above will not work. If your file has commas and you need to interpret it as a decimal point then you can try the following: public void readDatabase(String s) throws FileNotFoundException{ try { final BufferedReader br = new BufferedReader(new FileReader(s)); String line = br.readLine(); while(line != null) { line = line.replace(',', '.'); final Scanner lineScanner = new Scanner(line); if(!scanner.hasNextDouble()) break;// quit loop // else continue loop double x = lineScanner.nextDouble(); double y = lineScanner.nextDouble(); int type = lineScanner.nextInt(); this.database.add(new Point(x,y,type)); line = br.readLine(); } br.close(); } catch (IOException ioe) { ioe.printStackTrace(); } }
type: Answer
has comment: http://stackoverflow.com/comment/37643013
answers question: http://stackoverflow.com/q/24297688
accepted answer of: http://stackoverflow.com/q/24297688
has comment: http://stackoverflow.com/comment/37623093
score: 0

http://stackoverflow.com/a/38708254
upvote count: 0
score: -1
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/24388279
has body: I ran into the same problem. I got stuck at this point where when compiling c library I got these errors saying ClassObject not found etc etc. So I dug deep and found that these header files object.h and class.h were previously part of vm/oo directory until android Kitkat. When Dalvik VM was almost buried, these files were deleted in and after Lollipop release. As you might have already found out swizelling methods in android is extremely difficult and not worth the time if you have any alternatives. I have not found a method to do it on ART so please comment if you have come across any

http://stackoverflow.com/comment/37790291
type: Comment
comment on: http://stackoverflow.com/q/24425791
has text: If `E` is the type of the list elements, what is `T`?
score: 4
type: QuestionComment

http://stackoverflow.com/comment/37719648
type: AnswerComment
score: 0
type: Comment
has text: the problem is that I don't get String 3k, I just get a newline character followed by String1,2,3 of next object(i) again. I need it like this: k > 3 strings > k > 3 Strings > k....
comment on: http://stackoverflow.com/a/24387823

http://stackoverflow.com/comment/37535995
comment on: http://stackoverflow.com/q/24290477
type: QuestionComment
type: Comment
has text: all the queries have one type, it is an insert operation
score: 0

http://stackoverflow.com/q/24355894
has body: This is a strange case that recently came up while profiling a specialised collection I've been working on. The collection is pretty much just two arrays, one an int[] array of keys, and one an Object[] array of values, with a hash function providing rapid lookup. It's all working nicely, but I've come to profiling the code and am getting some weird results; for profiling I've decided to do it the old fashioned way, by grabbing System.currentTimeMillis(), running a test over and over and then checking how much time has elapsed, like so: long sTime = System.currentTimeMillis(); for (int index : indices) foo.remove(index); long took = System.currentTimeMillis() - sTime; In my test I have foo prepared with 200,000 entries, and a pre-generated the list of indices that I will remove. I reset and run the test using a loop for a thousand repetitions and add took to a running total. Now, for commands I get extremely good results compared to other data types, except with my remove(int) method. However, I've been struggling to figure out why, as my removal method is identical to my get(int) method (other than the removal obviously), as shown: public Object get(int key) { int i = getIndex(key); // Hashes key and locates it return (i &gt;= 0) ? this.values[i] : null; } public Object remove(int key) { int i = getIndex(key); // Does exactly the same as above if (i &gt;= 0) { --this.size; ++this.modifications; // For concurrent access behaviour this.keys[i] = 0; // Zero indicates null entry Object old = this.values[i]; this.values[i] = null; return old; } return null; } While I would expect the removal to take a bit longer, they're taking more than 5 times as long to execute as get(int). However, if I comment out the line this.keys[i] = 0 then performance becomes nearly identical to get(int). Am I correct in observing that this is an issue with assigning a value to my int[] array? I've tried commenting out all the this.values operations and experience the same slow times, but leav…
has comment: http://stackoverflow.com/comment/37678587
type: Question
has comment: http://stackoverflow.com/comment/37659584
tagged with: arrays
has comment: http://stackoverflow.com/comment/37660062
has title: Unusual Performance Setting Integer Array Values
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/24356169
has comment: http://stackoverflow.com/comment/37683655
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37681985
has comment: http://stackoverflow.com/comment/37710662
tagged with: performance
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/24411029
downvote count: 2
has body: I trying to learn java. and i was trying to make a program that displays all text from an txt file and it stops when it read a specific number but it didn't work and i don't know what is going wrong. This is what I have right now: package textLezer; import java.io.IOException; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; public class FileData implements Runnable { public static final int WIDTH = 320; public static final int HEIGHT = WIDTH / 12 * 9; public static final int SCALE = 3; public final String NAME = "Text lezer"; public JFrame frame; public static JLabel label = new JLabel(); public static JPanel panel = new JPanel(); private Thread thread; public boolean running = false; public void start() { running = true; thread = new Thread(this, NAME + "_main"); thread.start(); } public void stop() { try { thread.join(); } catch (InterruptedException e) { e.printStackTrace(); } } public void run() { String file_name = "text/test.txt"; try { ReadFile file = new ReadFile(file_name); String[] aryLines = file.OpenFile(); for (int i = 0; i &lt; aryLines.length; i++) { if (aryLines[i].equals("5")) { return; } else { label.setText("&lt;html&gt;" + label.getText() + " &lt;br&gt; " + aryLines[i] + "&lt;/html&gt;"); System.out.println(aryLines[i]); } } } catch (IOException e) { System.out.println(e.getMessage()); } } } launcher file: package textLezer; import java.awt.BorderLayout; import java.awt.FlowLayout; import javax.swing.JFrame; public class Launcher { private static FileData data = new FileData(); public static void main(String[] args) { FileData.panel.setLayout(new FlowLayout()); FileData.panel.add(FileData.label); data.frame = new JFrame(); data.frame.setTitle(data.NAME); data.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); data.frame.setLayout(new BorderLayout()); data.frame.setSize(800, 400); data.frame.add(FileData.panel, BorderLayout.CENTER); data.frame.setResizable(false); data.frame.setLocationRelativeTo(null); data.fra…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37762958
tagged with: java
accepted answer: http://stackoverflow.com/a/24412450
has title: why this java code didn't work?
type: Question
upvote count: 0
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/37762815
has answer: http://stackoverflow.com/a/24412450
favorite count: 0
has comment: http://stackoverflow.com/comment/37763041
has comment: http://stackoverflow.com/comment/37763081
has comment: http://stackoverflow.com/comment/37763004

http://stackoverflow.com/comment/37511896
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24277864
has text: i cant guess the problem from this. need the full error Log like you have given in the question . by the way if the problem is solved you can mark the useful answer as 'accept' among all the answers . @user3751018
type: AnswerComment

http://stackoverflow.com/q/24401094
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: 10
upvote count: 10
accepted answer: http://stackoverflow.com/a/24433916
answer count: 3
has body: I'm sending a JSONArray GET request with Volley, and it's returning the specified JSON array. Here's my Request: JsonArrayRequest getRequest = new JsonArrayRequest(url, new Response.Listener&lt;JSONArray&gt;() { @Override public void onResponse(JSONArray response) { Log.d("Response", response.toString()); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.d("Error.Response", error.toString()); } } ); VolleySingleton.getInstance(this).addToRequestQueue(getRequest); //Call to get dashboard feed } As you can see, I'm currently just logging out the response. I want to parse the Array though and display the results in a list view. The documentation for this isn't great, and I'm pretty green in terms of Android dev. What is the proper way to parse a JSON array from Volley and display the results in a list view? I've gathered that I should use parseNetworkResponse, but not sure how to implement.
downvote count: 0
has title: Parse Android Volley JSONArray response
favorite count: 0
has answer: http://stackoverflow.com/a/24401297
tagged with: android-volley
tagged with: android
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24401232
has answer: http://stackoverflow.com/a/24433916
has answer: http://stackoverflow.com/a/24401232
type: Question

http://stackoverflow.com/comment/37537778
comment on: http://stackoverflow.com/a/24291052
type: AnswerComment
type: Comment
has text: Unfortunately I don't know much about how Selenium supports XPath in HTML. I know that different Selenium implementations (RC, WebDriver, etc.) might treat nodes differently, so although the `text()[1]` expression is perfectly valid in XPath, it might fail in some Selenium implementations. Also, you should check if it really is case-insensitive. It most XPath implementations `td` won't match `TD`.
score: 1

http://stackoverflow.com/comment/122884711
score: 0
type: AnswerComment
type: Comment
has text: what should be next command after searching?
comment on: http://stackoverflow.com/a/68780528

http://stackoverflow.com/comment/130870274
type: AnswerComment
score: 0
type: Comment
has text: Queue Fanout is rare in JMS Providers. If I remember correctly RabbitMQ has exchanges. Is that what you refer to ? Conceptually I would call a queue going to a message exchange making copies into multiple queues a 'topic'. But also checkout https://stackoverflow.com/questions/5576415/jms-topic-vs-queues
comment on: http://stackoverflow.com/a/62693723

api
tags question: http://stackoverflow.com/q/24392602
tags question: http://stackoverflow.com/q/24323991
type: Tag
tags question: http://stackoverflow.com/q/24396218
tags question: http://stackoverflow.com/q/24367625
tag name: api
tags question: http://stackoverflow.com/q/24391324
tags question: http://stackoverflow.com/q/24398912
tags question: http://stackoverflow.com/q/24362542
tags question: http://stackoverflow.com/q/24390535
tags question: http://stackoverflow.com/q/24288268

http://stackoverflow.com/comment/37619173
has text: if you're not already, make sure you're using libgdx's [file system](https://github.com/libgdx/libgdx/wiki/File-handling) to get handles to your files, rather than creating handles to them yourself. As in, don't do new File("your_path.csv"), instead do something like Gdx.files.internal("your_path.csv") and then get the file that way
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24334925
type: Comment

http://stackoverflow.com/comment/37645006
comment on: http://stackoverflow.com/q/24348548
has text: Exception suggesting, input is not a valid json..could you please validate the json in online tool once?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24425586
answer count: 1
tagged with: el
type: UnansweredQuestion
has body: I'm trying to display data on jsp page using jstl. but i'm getting error as NumberFormatException: For input string: "expense_id". Code List expense = entityManager .getEntityManager() .createNativeQuery( "SELECT e.expense_id, format(e.expense_amount,2) as expense_amount, DATE_FORMAT(e.expense_date, \"%Y-%m-%d\") as expense_date, e.expense_desc, e.payment_method, g.expense_group_name, c.company_name, e.comment FROM wd_expense e " + "join wd_expense_group g on e.expense_group_id = g.expense_group_id " + "left join wd_company c on e.company_id = c.company_id") .getResultList(); // set to request request.setAttribute("expenses", expense); // redirect to expense_list.jsp util.redirect(request, response, "/WEB-INF/expense/expense_list.jsp"); JSP Code <c:forEach items="${requestScope.expenses}" var="expense"> Edit ${expense.expense_desc} ${expense.expense_amount} ${expense.expense_group_name} ${expense.comment} Delete </c:forEach> Error Exception :org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/expense/expense_list.jsp at line 47 44: <c:forEach items="${requestScope.expenses}" var="expense"> 45: 46: Edit 49: 50: ${expense.expense_desc} Stacktrace: How can i solve this ?
tagged with: java
has comment: http://stackoverflow.com/comment/37792675
has answer: http://stackoverflow.com/a/24425810
type: Question
tagged with: jstl
tagged with: jsp
has title: NumberFormatException: For input string: "xxxx"
score: 0

http://stackoverflow.com/a/24388125
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/24388072
downvote count: 0
type: Answer
has body: Two ways to solve this common problem: Add "to" in front of terms, except the first Add it after every term, then clean up after the loop Code for 1: StringBuilder travelRoute = new StringBuilder(); for(int count = 0; count &lt; itinerary.size() ; count++) { if (count &gt; 0) { travelRoute.append(" to "); } String upperCaseDestination = itinerary.get(count).toUpperCase(); travelRoute.append(upperCaseDestination); } Code for 2: // after loop travelRoute.setLength(travelRoute.length() - 3); Personally, I prefer option 1.

http://stackoverflow.com/a/24309536
type: Answer
has body: You cannot address a resource in your jar as a File. In your IDE it likely is a file in the file system, not a resource in a jar. You need to be able to read the content as a URL and/or InputStream.
has comment: http://stackoverflow.com/comment/37572361
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/37571579
answers question: http://stackoverflow.com/q/24309384
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24309384

http://stackoverflow.com/q/24413686
tagged with: gson
type: Question
has answer: http://stackoverflow.com/a/24414041
has body: Can't get string from json object. I get Gson gson = new Gson(); Map&lt;String, Object&gt; resultMap = new HashMap&lt;String, Object&gt;(); resultMap = (Map&lt;String, Object&gt;)gson.fromJson(result, resultMap.getClass()); if (handler!=null) { handler.responseReceived(new HashMap(resultMap),_queryName); } and in another class I need to get Elements of JsonObject public void responseReceived(HashMap&lt;String, Object&gt; resp, String action) { Log.e("!!!", action); Log.e("!!!", "--------"); Log.e("!!!", resp.toString()); //Json Parsed, need just to get elements of jsonobject } Now how to get String, elements from HashMap&lt;String,Object&gt; resp?
accepted answer: http://stackoverflow.com/a/24414041
score: 0
answer count: 1
tagged with: android
type: AnsweredQuestion
has title: How to get string from gson in HashMap<String,Object> which is represented below
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/comment/37514742
score: 0
comment on: http://stackoverflow.com/q/24279983
has text: Sorry it would have just been odd to crop to keep all my tray, title bar, program, terminal, and directory in the same image.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37679727
type: Comment
type: QuestionComment
has text: Might help: http://stackoverflow.com/questions/21892694/libgdx-how-to-program-an-hp-bar
comment on: http://stackoverflow.com/q/24356672
score: 0

http://stackoverflow.com/comment/37675966
comment on: http://stackoverflow.com/a/24364836
score: 0
type: Comment
has text: No, the second java is not installed , that is the problem here . I just have a zip file which contains bin and other things , which I have extracted to /usr/local/java
type: AnswerComment

http://stackoverflow.com/comment/37699144
comment on: http://stackoverflow.com/q/24376834
score: 0
type: QuestionComment
type: Comment
has text: Where is line 26 of ShowMapActivity?

http://stackoverflow.com/a/24337004
has comment: http://stackoverflow.com/comment/37622907
type: AcceptedAnswer
downvote count: 0
score: 8
type: Answer
has comment: http://stackoverflow.com/comment/37622972
has body: it returns a list of selected indices because technically it's valid to select more than one element from the JList. Take the example given here selected indices here would be {1} selected indices here would be {1, 2, 3} selected indices here would be {0, 1, 3}
accepted answer of: http://stackoverflow.com/q/24336865
answers question: http://stackoverflow.com/q/24336865
upvote count: 8
has comment: http://stackoverflow.com/comment/37622871
has comment: http://stackoverflow.com/comment/37622933

http://stackoverflow.com/comment/37728705
has text: I appreciate the response, but as far as I can tell, this does not work. When I print the responseString aka the source code of that URL, I still can't find the error message that's supposed to be there, akin to "Couldn't connect..." It still just displays the original source code of the URL. Perhaps the solution I want is not possible? I can see the source code error message on my browser, but not when I print it. Note: this is mainly for testing purposes, I just want to see if my code does what it says it does.
type: AnswerComment
comment on: http://stackoverflow.com/a/24392507
score: 0
type: Comment

http://stackoverflow.com/comment/37765126
comment on: http://stackoverflow.com/q/24412178
score: 2
type: Comment
type: QuestionComment
has text: have you considered using UTC times across your application?

http://stackoverflow.com/comment/37710970
score: 0
type: AnswerComment
has text: Actually you cannot exactly call multiple interface implementation as multiple inheritance. Inheritance basically means you get all the existing elements of the parent classes. Implementing multiple interfaces just means you fulfilled the contract of each one of them. For example, You cannot simultaneously wear jeans from `armani` and `levis` , that creates ambiguity (synonymous to multiple inheritance). But wearing any jeans might fulfill the contract of many interfaces like `interface LookCool{ WearJeans()}` or `interface officeDressForFridays{ WearJeans()}` etc
type: Comment
comment on: http://stackoverflow.com/a/24381804

http://stackoverflow.com/comment/37786082
type: Comment
has text: Integer count = id2count.get( kwd_id ); something wrong. it go to cath(Exception)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24422978

http://stackoverflow.com/comment/37533416
comment on: http://stackoverflow.com/q/24280097
has text: I could not attend the chat earlier. here is what I have posted: The sequence for removing the child probably should be like this: * remove child from list in parent * remove parent reference from child (you can switch the first two steps) * either delete child from DB directly, or take advantage of orphanRemoval=true * then, to append the new child, add the parent reference to the new child * add the new child to the list of children in parent * merge parent
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37533372
type: Comment
has text: I apparently have Java 8 installed and I can import `java.time.LocalDate` and `java.time.Period` but ChronoUnit doesn't work
comment on: http://stackoverflow.com/a/24289356
score: 0
type: AnswerComment

http://stackoverflow.com/q/24412434
tagged with: mapreduce
type: Question
has comment: http://stackoverflow.com/comment/37914053
answer count: 3
tagged with: apache-spark
has answer: http://stackoverflow.com/a/26457541
has answer: http://stackoverflow.com/a/37531805
downvote count: 0
favorite count: 0
score: 17
has title: It is possible to start an embedded instance of apache Spark node?
type: UnansweredQuestion
has body: I want to start an instance of a standalone Apache Spark cluster embedded into my java app. I tried to find some documentation at their website but not look yet. Is this possible?
upvote count: 17
has answer: http://stackoverflow.com/a/64176595
has comment: http://stackoverflow.com/comment/137922316
tagged with: java
has comment: http://stackoverflow.com/comment/37778153

http://stackoverflow.com/q/24353771
type: Question
has title: Android - NullpointerException when I launch my application with turned-on GPS
has comment: http://stackoverflow.com/comment/37655485
has answer: http://stackoverflow.com/a/24353867
score: 0
has body: This is my code. An error occurred when I launch the application with turned-on GPS. It also means that with turned-off GPS, the application works perfectly. @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View v = inflater.inflate(R.layout.fragment_map, null, false); map = ((SupportMapFragment) getFragmentManager().findFragmentById(R.id.map)) .getMap(); map.setMyLocationEnabled(true); LocationManager lm=(LocationManager)getActivity().getSystemService(Context.LOCATION_SERVICE); Criteria c = new Criteria(); String provider = lm.getBestProvider(c, false); final TextView switchStatus = (TextView) v.findViewById(R.id.switchStatus); Switch mySwitch = (Switch) v.findViewById(R.id.gpsSwitch); boolean statusOfGPS = lm.isProviderEnabled(LocationManager.GPS_PROVIDER); if (statusOfGPS){ mySwitch.setChecked(true); switchStatus.setText("GPS Switch is currently ON"); } else{ mySwitch.setChecked(false); switchStatus.setText("GPS Switch is currently OFF"); } mySwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if(isChecked){ switchStatus.setText("GPS Switch is currently ON"); Intent viewIntent = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivity(viewIntent); }else{ switchStatus.setText("GPS Switch is currently OFF"); } } }); //check the current state before we display the screen if(mySwitch.isChecked()){ switchStatus.setText("GPS Switch is currently ON"); } else { switchStatus.setText("GPS Switch is currently OFF"); } Location l = lm.getLastKnownLocation(provider); if(l!=null) { onLocationChanged(l); } lm.requestLocationUpdates(provider, 20000, 0, this); return v; } @Override public void onLocationChanged(Location location) { TextView ln=(TextView)getView().findViewById(R.id.lng); TextView lt=(TextView)getView().findViewById(R.…
tagged with: android
has comment: http://stackoverflow.com/comment/37655230
answer count: 1
has comment: http://stackoverflow.com/comment/37655492
tagged with: google-maps-android-api-2
tagged with: gps
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24353867

http://stackoverflow.com/a/24419701
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24419489
type: Answer
answers question: http://stackoverflow.com/q/24419489
score: 2
upvote count: 2
has body: I don't know if it would solve your performance problems, but I see one inefficient thing you are doing : newMap.put(newKey, new HashSet&lt;Text&gt;()); for (Text t : map.get(keyToMerge)) { newMap.get(newKey).add(new Text(t)); } It would be more efficient to keep the HashSet in a variable instead of searching for it in newMap : HashSet&lt;Text&gt; newSet = new HashSet&lt;Text&gt;(); newMap.put(newKey, newSet); for (Text t : map.get(keyToMerge)) { newSet.add(new Text(t)); } Another inefficient thing you are doing is create a HashSet of values and then create another identical HashSet to put in the map. Since the original HashSet (values) is never used again, you are constructing all those Text objects for no reason at all. Instead of: while (context.nextKey()) { String line = context.getCurrentKey().toString(); HashSet&lt;Text&gt; values = new HashSet&lt;Text&gt;(); for (Text t : context.getValues()) { values.add(new Text(t)); } map.put(line, new HashSet&lt;Text&gt;()); for (Text t : values) { map.get(line).add(new Text(t)); } } You can simply write : while (context.nextKey()) { String line = context.getCurrentKey().toString(); HashSet&lt;Text&gt; values = new HashSet&lt;Text&gt;(); for (Text t : context.getValues()) { values.add(new Text(t)); } map.put(line, values); } EDIT : I just saw the additional code you posted as an answer (from your cleanup() method) : //clear map for (String s : map.keySet()) { map.remove(s); } map = null; //clear newMap for (String s : newMap.keySet()) { newMap.remove(s); } newMap = null; The reason this code gives you ConcurrentModificationError is that foreach loops don't support modification of the collection you are iterating over. To overcome this, you can use an Iterator : //clear map Iterator&lt;Map.Entry&lt;String, HashSet&lt;Text&gt;&gt;&gt; iter1 = map.entrySet ().iterator (); while (iter1.hasNext()) { Map.Entry&lt;String, HashSet&lt;Text&gt;&gt; entry = iter1.next(); iter1.remove(); } map = null; //clear newMap Iterator&lt;Map.E…
has comment: http://stackoverflow.com/comment/37779628

http://stackoverflow.com/q/24363562
has comment: http://stackoverflow.com/comment/37674117
has comment: http://stackoverflow.com/comment/37674201
answer count: 0
type: UnansweredQuestion
has title: How to integrate push notification code into my existing Android app from parse.com?
has body: I have just checkout http://www.parse.com and it gives great option to send push notification to android app. I have tried its sample push notification code and it works like a charm. But I have no idea how will I integrate it in my existing Android app code. I am a newbie. I have looked for examples over internet but could not find out how to integrate it in existing app code.
has comment: http://stackoverflow.com/comment/37674308
has comment: http://stackoverflow.com/comment/48728526
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37674343
has comment: http://stackoverflow.com/comment/37673784
score: 0
tagged with: push-notification
tagged with: android
has comment: http://stackoverflow.com/comment/37673985
tagged with: parsing
has comment: http://stackoverflow.com/comment/37673955

http://stackoverflow.com/comment/37525907
comment on: http://stackoverflow.com/q/24285610
type: Comment
type: QuestionComment
has text: its a package name "com.quickblox.sample.chat.ui.activities". Inside that package contains SplashActivity.
score: 0

http://stackoverflow.com/q/24374681
tagged with: java
downvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/37694870
score: -2
has comment: http://stackoverflow.com/comment/37694878
has body: I have a 2-dimensional array in java. For example, double count=0; double[][] arr1 =new double[3][3]; for(int i=0;i&lt;3;i++) { for(int j=0;j&lt;3;j++) { arr1[i][j]=count; count++; } } Now, I want to remove all elements where i or j value was 1. arr1[1][0], arr1[1][1], arr1[1][2], arr[0][1], arr[2][1] ... How can I achieve this?
upvote count: 0
has comment: http://stackoverflow.com/comment/37695423
has answer: http://stackoverflow.com/a/24374931
favorite count: 0
has comment: http://stackoverflow.com/comment/37694775
has answer: http://stackoverflow.com/a/24374879
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24374732
answer count: 4
has answer: http://stackoverflow.com/a/24374948
has comment: http://stackoverflow.com/comment/37694999
has title: Deleting elements from multi Dimensional Array

http://stackoverflow.com/comment/37716209
comment on: http://stackoverflow.com/q/24385479
type: QuestionComment
has text: Your problem is that you are initializing action on your single button for each user and all of them will execute when you press your button at once.
score: 0
type: Comment

http://stackoverflow.com/a/24388662
downvote count: 0
has comment: http://stackoverflow.com/comment/37760893
has comment: http://stackoverflow.com/comment/37720899
type: AcceptedAnswer
upvote count: 3
answers question: http://stackoverflow.com/q/24387305
type: Answer
has body: You should consider the initial capacity a hint to the HashMap of approximately what data to expect. By providing a correct initial capacity, you minimize the number of times the map has to be rebuilt in order to scale up. If, for instance, you knew you were planning to insert a million records, by constructing the map with a 1,000,000 initial capacity, it will ensure, at construction time, to allocate enough memory to handle that many inserts. After that point, future inserts into the map may require a large O(n) operation during a map.put() call in order to resize. Thinking of this initial capacity as a hint, rather than an instruction you expect HashMap to follow, may help you see that the optimization you're describing is unnecessary. HashMap is designed to behave well in all normal circumstances, and so while providing an initial capacity can help marginally, it's generally not going to have huge impacts on your code unless you are building many new large maps all the time. In such a case specifying the capacity would avoid the intermediate table resizing, but that's all. As documented, you could introduce some unnecessary slowdowns if you specified too large of an initial capacity: Iteration over collection views requires time proportional to the "capacity" of the HashMap instance However in practice the wasted memory of allocating such large maps would likely cause problems for you sooner than the slightly slower iteration speed. Be sure you read Why does HashMap require that the initial capacity be a power of two? as well. One thing you might consider is switching to Guava's ImmutableMap implementation; if you know in advance the contents of your map, and you don't expect to change them, immutable collections will prove easier to work with and use less memory than their mutable counterparts. Here's some quick inspections I did using Scala's REPL (and some personal utility functions) to inspect what's going on inside HashMap (Java 1.7): // Initialize with cap…
accepted answer of: http://stackoverflow.com/q/24387305
score: 3

http://stackoverflow.com/q/24302621
type: UnansweredQuestion
downvote count: 2
tagged with: jakarta-ee
has title: get absolute path of a java ee project inside a servlet
score: -2
tagged with: java
type: Question
answer count: 2
upvote count: 0
has body: For example, the java ee project is in C:\ABC. The servlet is in C:\ABC\src\demo\HelloServlet.java. public void doGet(..,..){ //how can I get the absolute path of the project(C:\ABC\) }
has answer: http://stackoverflow.com/a/24303366
tagged with: path
favorite count: 0
has answer: http://stackoverflow.com/a/24303110

http://stackoverflow.com/a/27298079
has comment: http://stackoverflow.com/comment/43775993
type: Answer
answers question: http://stackoverflow.com/q/24319143
upvote count: 12
downvote count: 0
has body: That's because you are not supposed to modify package files directly with an editor. They are zip files, despite they don't have an extension to warn the user. To modify the plug-in you have to go to /Packages and unzip the Java.sublime-package file. I'll use linux syntax but the procedure remains the same: cd &lt;sublime-text3-folder&gt;/Packages mkdir java cp Java.sublime-packages java cd java unzip Java.sublime-packages Then use an editor to modify JavaC.sublime-build to add the following lines (don' forget the extra comma after the last line { "shell_cmd": "javac \"$file\"", "file_regex": "^(...*?):([0-9]*):?([0-9]*)", "selector": "source.java", "variants": [ { "name": "Run", "shell_cmd": "java $file_base_name" } ] } Zip again the contents in Java.sublime-package and put it back in Package folder via: zip Java.sublime-package * cp Java.sublime-package ..//Packages Restart sublime and now along with Ctrl+B to build your project you will be able to run it with Ctrl + Mayus + B
has comment: http://stackoverflow.com/comment/59837528
has comment: http://stackoverflow.com/comment/50263771
score: 12

http://stackoverflow.com/comment/37498112
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24267660
has text: You're not actually explaining what part of it you don't understand... please elaborate your question.
score: 0

http://stackoverflow.com/q/24316420
upvote count: 3
type: AnsweredQuestion
score: 3
tagged with: performance
tagged with: java
has answer: http://stackoverflow.com/a/24316670
has comment: http://stackoverflow.com/comment/37584301
has comment: http://stackoverflow.com/comment/37584489
has answer: http://stackoverflow.com/a/24327852
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/24316670
downvote count: 0
tagged with: disk
favorite count: 0
has body: I am looking for ways to monitor disk activity in a Java, closed-source, commercial, desktop application. In particular, what I'd like to do is monitor how frequently the app is accessing database/disk - it would appear as "HDD led" indicator in the app and would work exactly the same (so, essentially real-time activity monitoring). I would also like to have as little as possible external libraries. What I've found so far, doesn't seem too encouraging - I haven't seen the exact examples of anything like that and the best hits I've managed to dig either reference huge frameworks (like Sigar) or libraries like JPicus (which doesn't support Java7 and doesn't seem like it'd support my case). JMX instrumentation doesn't seem to support this either, so I am pretty much open for any ideas/suggestions. The tech stack is - Java7, Eclipse RCP, SQL Server 2008. EDIT: To make matters totally clear, I want to monitor disk I/O activity of a Java program with a pure, platform agnostic Java solution.
has comment: http://stackoverflow.com/comment/37588893
tagged with: monitor
accepted answer: http://stackoverflow.com/a/24327852
tagged with: android-activity
has title: Monitor disk activity in Java

integer
tags question: http://stackoverflow.com/q/24423019
tags question: http://stackoverflow.com/q/24309489
tags question: http://stackoverflow.com/q/24273925
tag name: integer
tags question: http://stackoverflow.com/q/24344792
tags question: http://stackoverflow.com/q/24363991
tags question: http://stackoverflow.com/q/24371587
tags question: http://stackoverflow.com/q/24280999
tags question: http://stackoverflow.com/q/24346109
type: Tag
tags question: http://stackoverflow.com/q/24320260

http://stackoverflow.com/comment/37653398
score: 3
type: QuestionComment
comment on: http://stackoverflow.com/q/24352822
has text: Ideally, resources should be closed. There are 4 different PreparedStatements and 4 different ResultSets. Server could end up with open cursors until sessions time out.
type: Comment

http://stackoverflow.com/comment/54474590
score: 1
comment on: http://stackoverflow.com/a/33303239
type: AnswerComment
has text: @iturki I was referring to the background jobs, please refer here http://blog.parse.com/announcements/introducing-background-jobs/
type: Comment

http://stackoverflow.com/a/24411884
downvote count: 0
answers question: http://stackoverflow.com/q/24411248
has body: There are four main bottlenecks involved in querying a database. The query itself - how long the query takes to execute on the server depends on indexes, table sizes etc. The data volume of the results - there could be hundreds of columns or huge fields and all this data must be serialised and transported across the network to your client. The processing of the data - java must walk the query results gathering the data it wants. Maintaining the query - it takes manpower to maintain queries, simple ones cost little but complex ones can be a nightmare. By careful consideration it should be possible to work out a balance between all four of these factors - it is unlikely that you will get the right answer without doing so.
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/37660306
score: 1
has text: Are you sure you're importing Log4J's `Logger` class, and not `java.util.logging.Logger`?
comment on: http://stackoverflow.com/q/24356319
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24289070
has answer: http://stackoverflow.com/a/24289499
has comment: http://stackoverflow.com/comment/37532572
tagged with: protected
has answer: http://stackoverflow.com/a/24289729
has comment: http://stackoverflow.com/comment/98625421
downvote count: 0
upvote count: 142
tagged with: inheritance
has body: I was going through this question Is there a way to override class variables in Java?. The first comment with 122 upvotes was: If you ever see a protected static, run. Can anyone explain why is a protected static frowned upon?
has comment: http://stackoverflow.com/comment/37536569
favorite count: 0
possible better answer: http://stackoverflow.com/a/24289761
tagged with: static
has answer: http://stackoverflow.com/a/52199764
has answer: http://stackoverflow.com/a/24296172
score: 142
has comment: http://stackoverflow.com/comment/37536201
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/38207415
has answer: http://stackoverflow.com/a/24289231
accepted answer: http://stackoverflow.com/a/24289231
linked to: http://stackoverflow.com/q/685300
has title: Why we should not use protected static in java
type: Question
has answer: http://stackoverflow.com/a/24289258
has answer: http://stackoverflow.com/a/24289761
answer count: 8
tagged with: oop
has comment: http://stackoverflow.com/comment/37535770
tagged with: java

http://stackoverflow.com/comment/100000902
comment on: http://stackoverflow.com/a/24398331
type: AnswerComment
score: 0
type: Comment
has text: i did -1, as I disagree with the answe. Better use the answer of @Archimedes Trajano - using annotation ApplicationException.

http://stackoverflow.com/q/24345424
tagged with: android
has answer: http://stackoverflow.com/a/24345890
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/34516022
has comment: http://stackoverflow.com/comment/37639469
tagged with: java
has comment: http://stackoverflow.com/comment/37638834
tagged with: eclipse
has body: I've imported an existing Android project to Eclipse, but I'm getting errors on the following imports: import com.android.datetimepicker.time.RadialPickerLayout; import com.android.datetimepicker.time.TimePickerDialog; I already have the android-support-v4.jar library added to the build path. Could anybody help me to figure out what is missing?
has comment: http://stackoverflow.com/comment/37639198
type: Question
possible better answer: http://stackoverflow.com/a/34516022
answer count: 2
has title: The import com.android.datetimepicker cannot be resolved
accepted answer: http://stackoverflow.com/a/24345890
score: 0
has comment: http://stackoverflow.com/comment/37638988

http://stackoverflow.com/comment/37541808
score: 0
has text: If I'm reading it right, the get() in the done() method will return the file that was downloaded. wouldn't I still need to do some sort of Runtime.exec to run the exe that comes out of the zip that is downloaded?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24278666

http://stackoverflow.com/a/24317902
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Please do not try to create your own Thread-List. Use existing Methods and common ways doing this. One proper way is using a ThreadPoolExecutor. Check this for that. MultiThreading Vs ThreadPoolExecutor You should also use an Executor which let you limit the number of Threads used in parallel/max. Example: ExecutorService executor = Executors.newFixedThreadPool(10); executor.submit(yourfirstthread); executor.submit(secondthread); // and so on..
score: 3
answers question: http://stackoverflow.com/q/24317872
upvote count: 3
accepted answer of: http://stackoverflow.com/q/24317872

jformattedtextfield
tags question: http://stackoverflow.com/q/24280261
tag name: jformattedtextfield
type: Tag

http://stackoverflow.com/comment/37788071
comment on: http://stackoverflow.com/q/24282209
score: 0
type: Comment
type: QuestionComment
has text: I brilliantly solved by using another solution. thanks for your support!

http://stackoverflow.com/q/24279673
answer count: 2
tagged with: profiling
downvote count: 0
tagged with: profiler
favorite count: 0
type: AnsweredQuestion
tagged with: memory-management
has body: I want my application to profile itself and tell me where memory allocation is taking place. Profilers are able to do that, so my application should be able to do that somehow too. How do profilers trap object instantiation and how can I do it myself?
upvote count: 3
possible better answer: http://stackoverflow.com/a/24279719
has answer: http://stackoverflow.com/a/24279719
has title: Is there a way to trap object allocation in Java inside your code through a method callback?
has answer: http://stackoverflow.com/a/24287659
type: Question
score: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/24287659
tagged with: optimization

http://stackoverflow.com/a/24279396
has body: ++ and + are both operators. They are elements of the language. Technically they can be referred to as tokens. + + is not a single token in Java and is broken down into two individual tokens during the parsing stages of compilation. + can exist in two forms: (i) as a unary operator; for example +10 (which is essentially a no-op which only adds to the confusion) or (ii) as a binary operator (meaning it acts on two thing) to add two terms; for example 10 + 10. Since they have an intrinsic value, you can also regard 10 and +10 as both being expressions. You should also note that the unary + has a very high operator precedence so it will bind tightly to the expression immediately after it. So what is happening in your code is the the compiler is binding the + just to the left of the expression 10 to produce another expression with value 10. Then that binds the second leftmost unary + to produce, yet again, 10. In summary: without the space, ++ is a single token. With any space between them, the two + act as two unary operators.
type: Answer
downvote count: 0
score: 21
answers question: http://stackoverflow.com/q/24279192
upvote count: 21

http://stackoverflow.com/a/55246247
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/24418952
score: 4
has body: As I found this eminently helpful in solving my own problem, I'd just like to add that the changes suggested by @JanTheGun appear to have been folded into Spring Security 5.0.8.RELEASE / Spring Boot 2.0.5 The JavaDoc for ActiveDirectoryLdapAuthenticationProvider.setSearchFilter(String) reads: The LDAP filter string to search for the user being authenticated. Occurrences of {0} are replaced with the username@domain. Occurrences of {1} are replaced with the username only. Defaults to: (&amp;(objectClass=user)(userPrincipalName={0}))) Therefore, in Spring Security 5.0.8.RELEASE, it's possible to use the suggested search-filter change without having to replicate any of the Spring Security classes!
type: Answer

http://stackoverflow.com/a/24365911
has body: When there is a reason to have a specified algorithm for computing the hash-code, you should document that algorithm for the hashCode() method. Java itself does this for String.hashCode(): a hash code for this string. The hash code for a String object is computed as s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] using int arithmetic, where s[i] is the ith character of the string, n is the length of the string, and ^ indicates exponentiation. (The hash value of the empty string is zero.) For most other cases, however, the general contract of Object.hashCode() requiring it to be consistent with equals() is enough documentation. Bloch in Effective Java recommends documenting the format of the toString() message for value classes. He also notes that in that case you should provide a also provide a parsing function (a static factory method) that creates an object of the class given its String representation..
score: 0
answers question: http://stackoverflow.com/q/24355424
type: Answer

http://stackoverflow.com/a/24429042
answers question: http://stackoverflow.com/q/24426125
has comment: http://stackoverflow.com/comment/37881882
has comment: http://stackoverflow.com/comment/37882010
accepted answer of: http://stackoverflow.com/q/24426125
score: 0
has body: The broadcast receiver is activated every time a GCM message reaches the device, regardless of the user's action. Therefore, if you wish to record the message locally on each device, you can do it. You can even record it in the server side, if the code in the broadcast receiver would trigger a call to your server to notify it that the message was received by the app (in this case it would be better to start an intent service from the receiver, and let the service do the communication with the server).
has comment: http://stackoverflow.com/comment/37883143
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/37881753

http://stackoverflow.com/comment/37609415
has text: Please edit your question and show us the result you want and the one you get.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24329923

http://stackoverflow.com/q/24317854
has answer: http://stackoverflow.com/a/24318113
type: Question
tagged with: overloading
has comment: http://stackoverflow.com/comment/37590448
has body: I have been working on this code and I am not able to figure out why certain access modifiers work and some do not: public class Base { protected int method(int x) { return 0; } } class Child extends Base { // Line 1: Compiles public int method(int x) { return 0; } // Line 2: Cannot reduce the visibility of the inherited method from Base private int method(int x) { return 0; } // Line 3: Compiles private int method(long x) { return 0; } // Line 4: The return type is incompatible with Base.method(int) protected long method(int x) { return 0; } // Line 5: Compiles protected int method(long x) { return 0; } // Line 6: Compiles protected long method(long x) { return 0; } // Line 7: Compiles protected long method(int x, int y) { return 0; } } I am trying to understand why lines 1, 3, 5, 6, and 7 are allowed but lines 2 &amp; 4 are not. I've tried searching but haven't found a clear explanation, though I did find In Java, difference between default, public, protected, and private
has comment: http://stackoverflow.com/comment/37588778
tagged with: java
tagged with: overriding
linked to: http://stackoverflow.com/q/4041157
score: 0
has title: Confusion with Access Modifiers while using in inheritance
linked to: http://stackoverflow.com/q/215497
answer count: 3
has answer: http://stackoverflow.com/a/24318095
has comment: http://stackoverflow.com/comment/37586567
has answer: http://stackoverflow.com/a/24317995
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6851612

http://stackoverflow.com/q/24379386
favorite count: 0
possible better answer: http://stackoverflow.com/a/24383588
type: Question
accepted answer: http://stackoverflow.com/a/24696997
tagged with: spring
linked to: http://stackoverflow.com/q/11783283
tagged with: java
upvote count: 1
has body: A simple banking application: Points to note: Using Spring+JPA with EclipseLink as JPA provider EntityManager is injected into BaseDaoImpl using @PersistenceContext DAOs are autowired into the Service bean @Transactional annotation used at service methods Objective: Unit-test Service methods as part of maven build Unit-test = simple API testing. For example, a service method: transfer(int fromAccountId, int toAccountId, double amount) has unit-test cases: fromAccountId should not be 0 toAccountId should not be 0 fromAccountId != toAccountId `amount is greater than 0 etc. These "unit-test" cases do not require DB connection. Problem: Build server has no DB setup. However, when the unit-test case is executed, Spring tries to connect to DB which fails. However, we do not really need DB connection for these cases to go through. (We have another set of "integration cases" - these are not executed as part of the normal build but will be executed manually with full environment available. How? - See this thread) Questions: What are the best practices to execute these kinds of unit test cases? Can we force Spring not to make DB connection till the last minute it is actually needed? (Right now, it does when it encounters @Transactional method) Adding Service Layer code as requested: public class BankManagerImpl implements BankManager { @Autowired AccountDao accountDao; @Autowired TransactionDao transactionDao; ... @Override @Transactional public void deposit(int accountId, double amount) { Account a = accountDao.getAccount(accountId); double bal = a.getAmount(); bal = bal + amount; a.setAmount(bal); accountDao.updateAccount(a); transactionDao.addTransaction(a, TransactionDao.DEPOSIT, amount); } @Override @Transactional public void withdraw(int accountId, double amount) { Account a = accountDao.getAccount(accountId); double bal = a.getAmount(); if(bal &lt; amount) { throw new RuntimeException("insufficient balance"); } bal = bal - amount; a.setAmount(bal); accountDao.updateAcc…
tagged with: unit-testing
linked to: http://stackoverflow.com/q/22940571
has comment: http://stackoverflow.com/comment/37708896
has answer: http://stackoverflow.com/a/24696997
has comment: http://stackoverflow.com/comment/37703525
has comment: http://stackoverflow.com/comment/37703470
has comment: http://stackoverflow.com/comment/37703536
answer count: 3
has title: Unit-testing Service bean which uses Spring+JPA but no DB is available
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24383588
tagged with: junit
tagged with: jpa
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/24697671

http://stackoverflow.com/comment/37750455
comment on: http://stackoverflow.com/q/24404232
score: 0
has text: An abstract class is a class where some methods are abstract, i.e. missing an implementation. So: yes.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/56439155
type: Answer
answers question: http://stackoverflow.com/q/24359321
has body: iText 7 in 2019. When making a Table object, you specify the width as the number of columns you want to add. int numberOfColumns = 10; Table table = new Table(numberOfColumns); Then you can set how wide you want the whole table to be etc. table.setWidth(new UnitValue(UnitValue.PERCENT, 50)); table.setMaxWidth(new UnitValue(UnitValue.PERCENT, 100)); table.setFontSize(6f); After which you can add cells with content and manipulate their look: Cell cell = new Cell(); cell.setBorder(Border.NO_BORDER); Paragraph paragraph = new Paragraph("hi"); paragraph.setTextAlignment(TextAlignment.LEFT); paragraph.setBold(); //Instead of text you can add images and such in the same way cell.add(paragraph); //Insert cell into table table.addCell(cell); iText will simply keep adding your cells until it runs out of slots for cells on that row and then creates a new row by itself and starts injecting cells there.
score: 0

http://stackoverflow.com/a/24423426
type: Answer
upvote count: 1
has body: If all jars are on the class path: Class&lt;?&gt; klazz = Class.forName("sun.security.ec.SunEC", false, ClassLoader.getSystemClassLoader()); CodeSource codeSource = klazz.getProtectionDomain().getCodeSource(); URL url = codeSource.getLocation(); System.out.println(url.toExternalForm()); file:/C:/Program%20Files/Java/jre7/lib/ext/sunec.jar The detail to attend: false means no class initialisation to take place. Otherwise with just a list of files, one might use JarFile. In Java 8 you might even use parallelism.
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24422984

http://stackoverflow.com/a/24349994
answers question: http://stackoverflow.com/q/24349732
has comment: http://stackoverflow.com/comment/37659857
downvote count: 0
has comment: http://stackoverflow.com/comment/37658068
type: Answer
score: 1
has body: The Servlet container offers the concept of Contexts. I find it helpful to consider a Context as a useful box for storing things in, and operates like a Map. There are a number of different Contexts available to a Java Webapp, and they differ in scope (that is, how long the data held in the context lasts for, and where it can be accessed from). There is the Page Context, the Session Context and the Servlet Context The Page Context has the narrowest scope, and is only lasts as long as a single page takes to process. The Session Context has a greater scope, and lasts as long as single user session, i.e. multiple requests from a browser. It is useful if your webapp requires authentication - information about the authenticated user will be stored in the Session Context. The Servlet Context is effectively global and is always available to the whole application. This is where I would recommend storing configuration properties which effect the functioning of the application. In a Servlet, you may access the Servlet Context like this: ServletContext context = request.getSession().getServletContext(); You can store something in the context like this: context.setAttribute("key", object); Where key is a String - the name of the attribute. You may retrieve it again like this: object = context.getAttribute("key"); Which returns an Object. You may cast it to whatever type it really is. If you want to, you can store a Properties object in it: Properties props = //... get the properties from file context.setAttribute("props", props); And then retrieve them: Properties props = (Properties) context.getAttribute("props"); Or you can store the individual properties as separate attributes in the context. All contexts are accessed the same way.
upvote count: 1

http://stackoverflow.com/q/24304225
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/24305177
has answer: http://stackoverflow.com/a/24304513
accepted answer: http://stackoverflow.com/a/24304513
favorite count: 0
has title: How to pass Class of Class in ArrayList from one Activity to Another Activity
tagged with: android
has answer: http://stackoverflow.com/a/24304751
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/37560876
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37561209
has comment: http://stackoverflow.com/comment/37561026
has body: I want to pass one object of ArrayList&lt;Links&gt; to Next Activity. I have checked use of Parcelable to achieve this but I have one another Class object of Stream class in Links class. How can i pass this Links object to Next Activity Links class: public class Links implements Parcelable { private String name; private Streams streams; /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the name */ public String getName() { return name; } /** * @param streams the streams to set */ public void setStreams(Streams streams) { this.streams = streams; } /** * @return the streams */ public Streams getStreams() { return streams; } @Override public int describeContents() { // TODO Auto-generated method stub return 0; } @Override public void writeToParcel(Parcel dest, int flags) { // TODO Auto-generated method stub /** ** WHAT CAN I DO HERE...??? **/ } } Stream Class: public class Streams { private String link; private String stream; /** * @param link the link to set */ public void setLink(String link) { this.link = link; } /** * @return the link */ public String getLink() { return link; } /** * @param stream the stream to set */ public void setStream(String stream) { this.stream = stream; } /** * @return the stream */ public String getStream() { return stream; } } I want to send ArrayList object to next activity. how can i? Updated: I got this in Logcat: 06-19 16:23:00.820: E/AndroidRuntime(21080): FATAL EXCEPTION: main 06-19 16:23:00.820: E/AndroidRuntime(21080): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.gtu.gtupapers/com.gtu.gtupapers.StreamSelection}: java.lang.NullPointerException: expected receiver of type com.gtu.gtupapers.Links, but got null 06-19 16:23:00.820: E/AndroidRuntime(21080): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2129) 06-19 16:23:00.820: E/AndroidRuntime(21080): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2154) 06-…
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/24304751

methodology
tag name: methodology
tags question: http://stackoverflow.com/q/24349451
type: Tag

http://stackoverflow.com/comment/37738630
score: 0
type: Comment
has text: Sorry, I thought you were the OP!
type: AnswerComment
comment on: http://stackoverflow.com/a/24376159

http://stackoverflow.com/comment/37579150
has text: Is mvcDispatcher-servlet.xml also in WEB-INF directory? (WEB-INF/mvcDispatcher-servlet.xml)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24313248

http://stackoverflow.com/comment/37543821
score: 0
comment on: http://stackoverflow.com/a/24295111
has text: It didnt work, the error message was `java.io.FileNotFoundException: /storage/sdcard0/arin/53/image.jpg: open failed: EISDIR (Is a directory)`.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37630538
score: 0
type: Comment
type: QuestionComment
has text: Are you really working with `char[]`? Why not `string`?
comment on: http://stackoverflow.com/q/24341248

http://stackoverflow.com/comment/37636637
type: QuestionComment
comment on: http://stackoverflow.com/q/24344316
score: 0
type: Comment
has text: @Sotirios Delimanolis I think Mockito allows to play with inheritance and to check passing params.

spring-jms
tags question: http://stackoverflow.com/q/24290209
type: Tag
tag name: spring-jms

http://stackoverflow.com/comment/37791646
has text: Re. layouts. See also [combinations of them](http://stackoverflow.com/a/5630271/418556) and layout padding & borders for [white space](http://stackoverflow.com/q/17874717/418556).
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24425829

http://stackoverflow.com/comment/37723291
type: AnswerComment
has text: yeah I might not gave all info. I will be using with this enum bit number like '10110' and each bit is going to represent an enum. I answer to my question because e.g bits from 2-4 will represent group of actions etc. I've edited my question
comment on: http://stackoverflow.com/a/24389598
type: Comment
score: 0

http://stackoverflow.com/a/24369096
type: AcceptedAnswer
downvote count: 0
has body: You are specifying the HTTP Request type as GET, yet adding form data to it. JsonObjectRequest req = new JsonObjectRequest(Request.Method.GET, ... You want to be doing an HTTP Post method. Therefore you should replace Request.Method.GET to Request.Method.POST to post FormData to the server. More about HTTP Methods here. EDIT: If you are getting a 401 while trying an HTACCESS see this question. You need to pass the parameters using an Authenticator.
has comment: http://stackoverflow.com/comment/37684476
type: Answer
accepted answer of: http://stackoverflow.com/q/24368870
answers question: http://stackoverflow.com/q/24368870
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/37684268

http://stackoverflow.com/comment/37657761
type: AnswerComment
has text: But i have declared opmanimpl2 as a ben in the application-Context.xml file what's the matter ?
type: Comment
comment on: http://stackoverflow.com/a/24354665
score: 0

http://stackoverflow.com/comment/37630180
comment on: http://stackoverflow.com/a/24340286
has text: @Braj thanks a lot for your help. I got to learn a lot of new things thanks to you. But just out of curiosity,I would still like to know why shifting frame.getContentPane().add(ball); to after the for loop results in the ball not showing up in the frame.Could you please tell me the reason for that too.Thanks a million
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37533821
comment on: http://stackoverflow.com/a/24289469
score: 0
has text: your approach worked but a string value is returned when I tried to change to double using `Double.valueOf` then I am again getting an exponential value between my output is `0.0004` and not `0.04` can you please suggest any wayout. Thanks for your continous support
type: Comment
type: AnswerComment

http://stackoverflow.com/q/24268457
tagged with: intellij-13
has answer: http://stackoverflow.com/a/24295725
tagged with: java-8
type: AnsweredQuestion
score: 2
has body: I've downloaded and have Vertx running, but when I edited one of the examples to start using Java 8 features (lambdas) I kept getting compiler errors. In Intellij, everything compiles just fine and I have IntelliJ pointing to my Java 8 JDK, but when I run Vertx from the command line, the compilation errors occur: &gt; vertx run FanoutServer.java C:\Users\i50640\Documents\Intellij Projects\EchoServer\src\main\java\echoserver\FanoutServer.java:33: error: illegal start of expression vertx.createNetServer().connectHandler(socket -&gt; { ^ C:\Users\i50640\Documents\Intellij Projects\EchoServer\src\main\java\echoserver\FanoutServer.java:33: error: illegal start of expression vertx.createNetServer().connectHandler(socket -&gt; { ^ C:\Users\i50640\Documents\Intellij Projects\EchoServer\src\main\java\echoserver\FanoutServer.java:33: error: ';' expected vertx.createNetServer().connectHandler(socket -&gt; { ^ C:\Users\i50640\Documents\Intellij Projects\EchoServer\src\main\java\echoserver\FanoutServer.java:34: error: illegal start of expression connections.add(socket.writeHandlerID()); Failed in deploying verticle java.lang.RuntimeException: Compilation failed at org.vertx.java.platform.impl.java.CompilingClassLoader.&lt;init&gt;(CompilingClassLoader.java:108) at org.vertx.java.platform.impl.java.JavaVerticleFactory.createVerticle(JavaVerticleFactory.java:51) at org.vertx.java.platform.impl.DefaultPlatformManager$21.run(DefaultPlatformManager.java:1723) at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:175) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:370) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) at java.lang.Thread.run(Thread.java:722) Caused by: java.lang.RuntimeException: Compilation failed! at org.vertx.java.platform.impl.java.CompilingClassLoader.&lt;init&gt;(CompilingClassLoader.java:1…
upvote count: 2
tagged with: java
type: Question
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/24295979
has title: How to Run Vertx with Java 8
answer count: 2
accepted answer: http://stackoverflow.com/a/24295979
tagged with: vert.x
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/24295725

http://stackoverflow.com/comment/37745573
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24401635
has text: @MadProgrammer Even without the `.db` extension I got the same problem.

http://stackoverflow.com/q/24393112
has answer: http://stackoverflow.com/a/24393368
linked to: http://stackoverflow.com/q/1264709
tagged with: utf-8
favorite count: 0
has answer: http://stackoverflow.com/a/65467195
has answer: http://stackoverflow.com/a/52886311
possible better answer: http://stackoverflow.com/a/41211741
tagged with: sockets
has answer: http://stackoverflow.com/a/24393340
has answer: http://stackoverflow.com/a/41211741
has answer: http://stackoverflow.com/a/24393378
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 4
has title: Socket InputStream and UTF-8
tagged with: encoding
has body: I'm trying to make a chat with Java. Everything works fine, except that special characters doesn't work. I think that it's an encoding problem because in my Outputstream I encode the string in UTF-8 like this: protected void send(String msg) { try { msg+="\r\n"; OutputStream outStream = socket.getOutputStream(); outStream.write(msg.getBytes("UTF-8")); System.out.println(msg.getBytes("UTF-8")); outStream.flush(); } catch(IOException ex) { ex.printStackTrace(); } } But in my receive method I didn't find a way to do this: public String receive() throws IOException { String line = ""; InputStream inStream = socket.getInputStream(); int read = inStream.read(); while (read!=10 && read > -1) { line+=String.valueOf((char)read); read = inStream.read(); } if (read==-1) return null; line+=String.valueOf((char)read); return line; } So there is a quick way to specify that the bytes read by the buffer are encoded with UTF-8? EDIT: Okay, I tried with the BufferedReader like this: public String receive() throws IOException { String line = ""; in = new BufferedReader(new InputStreamReader(socket.getInputStream(), "UTF-8")); String readLine = ""; while ((readLine = in.readLine()) != null) { line+=readLine; } System.out.println("Line:"+line); return line; } But it doesn't work. It seems that the socket doesn't receive anything.
accepted answer: http://stackoverflow.com/a/24393340
downvote count: 0
answer count: 6
score: 4

http://stackoverflow.com/comment/37587101
type: Comment
score: 2
has text: Voting to put on hold. Read the Help Center and update your question accordingly.
comment on: http://stackoverflow.com/q/24318137
type: QuestionComment

http://stackoverflow.com/a/24410633
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/37763365
answers question: http://stackoverflow.com/q/24410395
has body: @PathVarible is used in RESTful web service. Learn what is REST . And the method name should start with lower case.

http://stackoverflow.com/comment/37624120
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24337679
has text: @SahaabZahid you are still creating the View inside the onCreateView so getView will return null. Instead use the one I implemented above

http://stackoverflow.com/q/24416459
has answer: http://stackoverflow.com/a/24430395
has body: i have multiple question .. We can run processing sketches on Android as well as IPhone I mean is it possible to upload code written in Processing to Play Store. if yes guide me .if it is not possible . Give me guide line . I will try to right it for android . help me out. if it is not possible . Tell me the difference between processing and android . both are in java. See example here..
has comment: http://stackoverflow.com/comment/37773446
tagged with: android
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: processing
has title: Is it possible to use or import Processing classes in android?
accepted answer: http://stackoverflow.com/a/24430395
score: 0
answer count: 1

http://stackoverflow.com/comment/37563341
comment on: http://stackoverflow.com/a/24305629
has text: look here's what you want http://www.programming-free.com/2012/09/ajax-with-servlets-using-jquery-and-json.html, http://stackoverflow.com/questions/19499572/how-to-return-an-json-object-and-catch-in-in-ajax-call-in-html#19536023
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37533210
has text: @Thomas So on a smaller scale are you saying that there are 2 days between Jan 1st and Jan 4th? Because that's what I am looking for
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24289495

type-conversion
tags question: http://stackoverflow.com/q/24322776
tags question: http://stackoverflow.com/q/24325410
tags question: http://stackoverflow.com/q/24381744
tag name: type-conversion
tags question: http://stackoverflow.com/q/24421046
tags question: http://stackoverflow.com/q/24409171
tags question: http://stackoverflow.com/q/24300482
type: Tag
tags question: http://stackoverflow.com/q/24413485
tags question: http://stackoverflow.com/q/24363080

self-signed
type: Tag
tags question: http://stackoverflow.com/q/24325335
tag name: self-signed

http://stackoverflow.com/comment/37647633
has text: I figured out that i need to use OnCreate method. But is there anyway to use the code without a layout? (calling from another class)
comment on: http://stackoverflow.com/a/24349951
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37588194
comment on: http://stackoverflow.com/a/24318361
has text: @user280655 I tried my previous code is working as expected. To ensure that I tried it again and it was successful again. Please check your code and resolve the errors.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24392123
favorite count: 0
tagged with: identifier
has comment: http://stackoverflow.com/comment/37729750
answer count: 5
possible better answer: http://stackoverflow.com/a/24392202
upvote count: 1
has answer: http://stackoverflow.com/a/24392202
has comment: http://stackoverflow.com/comment/37727862
type: AnsweredQuestion
has title: Java: How to give unique ids and reuse them?
score: 1
has comment: http://stackoverflow.com/comment/37727601
tagged with: java
has answer: http://stackoverflow.com/a/24392323
tagged with: reusability
has answer: http://stackoverflow.com/a/24392167
tagged with: finalize
has answer: http://stackoverflow.com/a/24392561
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/24392167
has body: I am implementing a simple class for giving ids to certain objects like this: class idObject { private static long next=0; private long id; idObject() { id=next; next = next +1; } } and derive all classes that I need my ids from this. The programm runs very long and a lot of objects are created. Thus, i am afraid next can overfow. Which results in non-unique ids. Some of the objects live very long, but most of them are deleted at some point. However, I would like to keep the ids unique. My question is, is there an easy way, to reuse ids of the objects that are deleted? My idea was to create a list of free ids and add the id of an object when it dies. Originally, i am a C++ programmer, so I thought of using a destructer, which is obviously not available in Java. Is the finalize() method the correct choice in this situation? Best Regards
has answer: http://stackoverflow.com/a/24392597
has comment: http://stackoverflow.com/comment/37728326
tagged with: unique

http://stackoverflow.com/q/24326910
score: 0
has answer: http://stackoverflow.com/a/24327657
has body: Is there any way to move actionListener classes to stand-alone classes? I made an exaple using Java and MVC design pattern. I have 3 buttons that change background color. Here's Model public class ChangeFontColorApplicationModel { public ChangeFontColorApplicationModel(){} } View import java.awt.event.*; import javax.swing.*; public class ChangeFontColorApplicationView extends JFrame{ private JButton changeToYellowButton = new JButton("Yellow font"); private JButton changeToBlackButton = new JButton("Black font"); private JButton changeToBlueButton = new JButton("Blue font"); public ChangeFontColorApplicationView(){ super("Change font"); JPanel buttonPanel = new JPanel(); buttonPanel.add(changeToYellowButton); buttonPanel.add(changeToBlackButton); buttonPanel.add(changeToBlueButton); this.add(buttonPanel); } public void addButtonActionListener(){ changeToYellowButton.addActionListener(new yellowBackgroundHandler()); changeToBlackButton.addActionListener(new yellowBackgroundHandler()); changeToBlueButton.addActionListener(new yellowBackgroundHandler()); } } Controller import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class ChangeFontColorApplicationController { private ChangeFontColorApplicationView changeFontColorApplicationViewObject; backgroundHandler yellowBackgroundHandlerObject = new yellowBackgroundHandler(); backgroundHandler blackBackgroundHandlerObject = new blackBackgroundHandler(); backgroundHandler blueBackgroundHandlerObject = new blueBackgroundHandler(); public ChangeFontColorApplicationController(ChangeFontColorApplicationView changeFontColorApplicationViewObject){ this.changeFontColorApplicationViewObject = changeFontColorApplicationViewObject; yellowBackgroundHandlerObject.setNextHandlerInChain(blackBackgroundHandlerObject); blackBackgroundHandlerObject.setNextHandlerInChain(blueBackgroundHandlerObject); this.changeFontColorApplicationViewObject.addButtonActionListener(); } } Now I created an interface that handles the …
has comment: http://stackoverflow.com/comment/37606669
tagged with: chain-of-responsibility
has comment: http://stackoverflow.com/comment/37603505
has title: Java ActionListeners to stand-alone classes
tagged with: observer-pattern
tagged with: swing
tagged with: design-patterns
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37604665
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/24327657
answer count: 1

http://stackoverflow.com/comment/37774216
type: Comment
type: QuestionComment
has text: A thread is a conceptual CPU execution unit -- something that executes the instructions of a program one at a time. Since this is conceptual/virtual there is a potentially unlimited number of threads.
score: 1
comment on: http://stackoverflow.com/q/24416881

http://stackoverflow.com/comment/37649817
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24350981
has text: For each call in the stack, you just print one string (the parent of the passed-in file). You do that for any call though, so you actually print the full tree parents.

http://stackoverflow.com/a/24307118
type: Answer
has comment: http://stackoverflow.com/comment/50539335
upvote count: 0
answers question: http://stackoverflow.com/q/24306761
has comment: http://stackoverflow.com/comment/37573534
score: -1
downvote count: 1
has body: May be this will work net.menago.core.main.Menago true true development ${project.url} value

http://stackoverflow.com/comment/37680339
comment on: http://stackoverflow.com/q/24310018
has text: By the way, this is the second Guice question in a row you've asked without tagging [tag:java]. If you don't tag Java, you're going to get a lot fewer views; even though dependency injection is not a Java specific idea, **Guice** is, so you should tag it that way.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24328898
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/24328505
score: 1
upvote count: 1
has body: use to_char function. Refer this link

http://stackoverflow.com/comment/37763365
has text: Yeah i forgot to say it was for RESTful web service
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24410633
type: Comment

http://stackoverflow.com/comment/37693433
score: 0
comment on: http://stackoverflow.com/a/24373537
type: AnswerComment
type: Comment
has text: Hi @SotiriosDelimanolis Thanks, can you give me any example of `HandlerMethodArgumentResolver` for such validation, if possible?

http://stackoverflow.com/q/24405848
answer count: 4
accepted answer: http://stackoverflow.com/a/24413051
has body: CODE package info.code; import java.util.Scanner; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; public class GetDataFromKeyBoardAndStoreInDB { public static void main(String[] args) { Scanner s = new Scanner(System.in); Product p = new Product(); p.setPid(s.nextInt()); p.setName(s.next()); p.setPrice(s.nextDouble()); Configuration cfg = new Configuration(); cfg.configure(); SessionFactory sf = cfg.buildSessionFactory(); Session hsession = sf.openSession(); hsession.beginTransaction(); hsession.save(p); hsession.getTransaction().commit(); hsession.close(); sf.close(); } } INPUT 115 Hello World Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Scanner.java:840) at java.util.Scanner.next(Scanner.java:1461) at java.util.Scanner.nextDouble(Scanner.java:2387) at info.code.GetDataFromKeyBoardAndStoreInDB.main(GetDataFromKeyBoardAndStoreInDB.java:18) -- The above code is working fine when supplied HelloWorld as input but not when supplied Hello World . Is this method doesn't accept String with space.
upvote count: 1
has answer: http://stackoverflow.com/a/24406014
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/24406014
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/24413051
has answer: http://stackoverflow.com/a/24406081
has title: java.util.InputMismatchException in Getting String From The Keyboard
favorite count: 0
tagged with: exception
has answer: http://stackoverflow.com/a/24406046

http://stackoverflow.com/q/24426083
has comment: http://stackoverflow.com/comment/37792356
type: UnansweredQuestion
tagged with: events
has title: How do I make an annotation based event system?
has comment: http://stackoverflow.com/comment/37792180
has comment: http://stackoverflow.com/comment/37791156
answer count: 0
tagged with: annotations
has comment: http://stackoverflow.com/comment/37791275
type: Question
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/37793988
has comment: http://stackoverflow.com/comment/37790772
tagged with: eventhandler
has body: Well I already made one but I don't know if it's the best tbh. Can anyone write me a good tutorial? I made this one with a tutorial and I understood 90% of it but 10% of off and it seems this aint the best way to do it. EventManager.java public class EventManager { private static List&lt;Listener&gt; registered = new ArrayList&lt;Listener&gt;(); public static void register(Listener listener) { if (!registered.contains(listener)) { registered.add(listener); } } public static void unregister(Listener listener) { if (registered.contains(listener)) { registered.remove(listener); } } public static List&lt;Listener&gt; getRegistered() { return registered; } public static void callEvent(final Event event) { new Thread() { @Override public void run() { call(event); } }.start(); } private static void call(final Event event) { for (Listener registered : getRegistered()) { Method[] methods = registered.getClass().getMethods(); for (int i = 0; i &lt; methods.length; i++) { EventHandler eventHandler = methods[i].getAnnotation(EventHandler.class); if (eventHandler != null) { Class&lt;?&gt;[] methodParams = methods[i].getParameterTypes(); if (methodParams.length &lt; 1) { continue; } if (!event.getClass().getSimpleName().equals(methodParams[0].getSimpleName())) { continue; } try { methods[i].invoke(registered.getClass().newInstance(), event); } catch (Exception exception) { System.err.println(exception); } } } } } } EventHandler.java @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface EventHandler { } and Event.java and Listener.java are blank interfaces.

http://stackoverflow.com/comment/37671500
has text: (Your title is also hopelessly vague. Please read http://tinyurl.com/so-hints and follow the guidance there to ask better questions in the future.)
comment on: http://stackoverflow.com/q/24362268
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/24390189
accepted answer of: http://stackoverflow.com/q/24389995
type: Answer
has comment: http://stackoverflow.com/comment/37724334
score: 2
has comment: http://stackoverflow.com/comment/37724274
upvote count: 2
has body: Use a StringBuilder to store the String representation of the node and append the data of the children nodes only in the specific node is not null. Here's an example using infix navigation on the nodes: public String toString() { StringBuilder sb = new StringBuilder(); if (this.left != null) { sb.append(this.left); sb.append(' '); } sb.append(this.val); if (this.right != null) { sb.append(' '); sb.append(this.right); } return sb.toString(); }
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/24389995

http://stackoverflow.com/q/24324620
type: UnansweredQuestion
has body: I have no idea what to do with this problem. I have a JSON object to assist in value input through POST (using Play Framework) that structures like this: { "start_absolute": 1403185486254, "end_absolute": 1403185486254, "metrics": [ { "name": "parts", "tags": [ { "key":"machine", "value":"10" } ], "sampling": { "value": 1, "unit": "minutes" } } ] } And in server side i try to process the info like this: Form&lt;QueryForm&gt; queryForm = Form.form(QueryForm.class).bindFromRequest(); if (queryForm.hasErrors()) { return badRequest(queryForm.errorsAsJson()); } QueryForm queryInfo = queryForm.get(); the classes used to define the JSON object in java public class QueryForm { private Date start_absolute; private Date end_absolute; private List&lt;MetricForm&gt; metrics= Lists.newArrayList(); public Date getStart_absolute() { return start_absolute; } public void setStart_absolute(long start_absolute) { this.start_absolute = new Date(start_absolute); } public Date getEnd_absolute() { return end_absolute; } public void setEnd_absolute(long end_absolute) { this.end_absolute =new Date(end_absolute); } public List&lt;MetricForm&gt; getMetrics() { return metrics; } public void setMetrics(List&lt;MetricForm&gt; metrics) { this.metrics = metrics; } @Override public String toString() { return "QueryForm[start_absolute="+start_absolute+", end_absolute="+end_absolute+", metrics="+metrics+"]"; } . public class MetricForm { private String name; private List&lt;Tag&gt; tags= Lists.newArrayList(); private RelativeTimeForm sampling= new RelativeTimeForm(1,"milliseconds"); public String getName() { return name; } public void setName(String name) { this.name = name; } public List&lt;Tag&gt; getTags() { return tags; } public void setTags(List&lt;Tag&gt; tags) { this.tags.addAll(tags); } public RelativeTimeForm getSampling() { return sampling; } public void setSampling(int val, String unit) { this.sampling.setUnit(unit); this.sampling.setVal(val); } @Override public String toString() { return …
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
score: 0
tagged with: playframework
has comment: http://stackoverflow.com/comment/37606910
answer count: 1
has answer: http://stackoverflow.com/a/24324801
has comment: http://stackoverflow.com/comment/37600051
has title: Convert JSON to JAVA Object through play.data.Form
linked to: http://stackoverflow.com/q/14234527
has comment: http://stackoverflow.com/comment/37600900
tagged with: spring
has comment: http://stackoverflow.com/comment/37601068

http://stackoverflow.com/comment/37600672
type: QuestionComment
has text: You have to wait for the clip to finish, see [this question](https://stackoverflow.com/questions/557903/how-can-i-wait-for-a-java-sound-clip-to-finish-playing-back)
comment on: http://stackoverflow.com/q/24317210
score: 0
type: Comment

http://stackoverflow.com/comment/37587072
score: 1
type: Comment
comment on: http://stackoverflow.com/q/24318137
type: QuestionComment
has text: Where do you set `accounts[0]`?

http://stackoverflow.com/comment/37723959
comment on: http://stackoverflow.com/q/24389358
score: 0
has text: For me when I put `start cmd /k "color 0A && java -jar app.jar` in a batch file, and starts the bat either by double click in explorer or directly from a command prompt it opens one single cmd windows, green on black, display the outpu of app.jar and wait at command prompt.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24271063
has comment: http://stackoverflow.com/comment/37661323
has comment: http://stackoverflow.com/comment/37669904
has comment: http://stackoverflow.com/comment/37660606
has comment: http://stackoverflow.com/comment/37660470
upvote count: 6
answer count: 1
has comment: http://stackoverflow.com/comment/37660789
tagged with: tomcat
has answer: http://stackoverflow.com/a/24387083
accepted answer: http://stackoverflow.com/a/24387083
favorite count: 0
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: h2
score: 6
has body: My web project is running in Tomcat 7. My server provider has already a MySQL server, however I want to use H2 as it give me a lot more flexibility and speed. My server provider has impose me a limitation that said that I should not start a new thread, doing so will automatically result in a tomcat stop. My project is in an alpha near beta stage, so it is been tested locally. I am getting an SqlException Locked by another process often. This is happening when Tomcat updates the thread pool, most of the times happened when automatically publishing from Eclipse (which it is not a deal, as it won't happen on the server) but some times it just happens randomly. My application doesn't access the database directly but through a wrapper that I am confident about it is not creating the issue but also prevents it to happened a lot. It looks like Tomcat it is sending the thread that holds the connection to the background and any foreground thread will fail (my app it is database intensive). Open a connection in server mode will fix the problem, but it will run in a new process which I'm not allowed to. I will like to keep H2, so before I have to switch to MySQL I will need a solution for any of the following answers: Can I somehow connect to embedded H2 without Tomcat thread pool collisions? Can I connect to server mode H2 without H2 creating a new process? Note: I can not post any actual code. I am sure is not my application issue. I don't think it is necessary but I will write a description of how my wrapper handle the connection if required, but the problem has been identified as explained above.
has title: H2 in Tomcat SqlException locked by another process when embedded mode
type: Question

http://stackoverflow.com/a/24361254
downvote count: 0
has body: In your activity just override onBackPressed() @Override public void onBackPressed() { AlertDialog diaBox = AskOption(); diaBox.show(); } private AlertDialog AskOption() { AlertDialog myQuittingDialogBox =new AlertDialog.Builder(this) .setTitle("Exit") .setMessage("Are you sure you want to exit?") .setIcon(R.drawable.delete) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { finish(); } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }) .create(); return myQuittingDialogBox; }
answers question: http://stackoverflow.com/q/24359667
score: 3
accepted answer of: http://stackoverflow.com/q/24359667
type: Answer
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/37547997
score: 0
type: Comment
type: QuestionComment
has text: In Java, there is a root class called `Object` from which every other class is inherited. So if you go up the inheritance tree from the two classes of yours, you are going to find a common ancestor class, not necessarily the Object class.
comment on: http://stackoverflow.com/q/24297404

http://stackoverflow.com/a/24314524
has body: The reason that val has changed is because in Java, "objects" are essentially pointers that point to that object in memory. In your code, you define a NEW object (and a pointer called v1 that points to it) for a Value. You then specify that you want the value to be 5. When you go to create you second value object, you instead are creating another POINTER, and having that pointer ALSO point at your first object. Therefore when you change the value that your pointer is pointing at, you change the object itself. Since both pointers point at this object, it appears that both are the same. What you should do instead is: Value v1 = new Value(); v1.val = 5; Value v2 = new Value(); v2.val = v1.val; v2.val = 6;// how val changes from 5 to 6 This creates a pointer pointing to a NEW object of the type Value, then sets the value of that object to the other objects value. This way when you reference them, they remain separate as they point to different spots in memory. Here is an image explanation: The left side shows the path you are taking, where you make a pointer go to the same blob, so both references edit the same blob. The right hand shows my answers, where you make a reference to a new blob in memory, and then edit that new blob. Please excuse my crude paint drawing, I'm no artist.
accepted answer of: http://stackoverflow.com/q/24314441
downvote count: 0
has comment: http://stackoverflow.com/comment/37581577
has comment: http://stackoverflow.com/comment/37581057
upvote count: 2
has comment: http://stackoverflow.com/comment/37581803
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37580772
has comment: http://stackoverflow.com/comment/37581635
has comment: http://stackoverflow.com/comment/37580614
type: Answer
answers question: http://stackoverflow.com/q/24314441
has comment: http://stackoverflow.com/comment/37581538
score: 2

http://stackoverflow.com/comment/37729337
has text: So, I don't need to throw in the System.err.print statement then, if I do that? And do I keep the throws clause in both the constructor and the set method?
comment on: http://stackoverflow.com/a/24393012
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37540023
has text: There are a number of Dialog classes that use it, such as [AlertDialog](http://developer.android.com/reference/android/app/AlertDialog.html). Usually it is used for callbacks when the user presses a button in a Dialog.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24293164
type: Comment

http://stackoverflow.com/comment/37541049
has text: This is getting more confusing by the minute.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24293593

http://stackoverflow.com/q/24279271
tagged with: google-glass
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/47171124
tagged with: bluetooth-lowenergy
answer count: 2
score: 5
has title: Android BLE: cannot write a Characteristic (no PROPERTY_WRITE)
has answer: http://stackoverflow.com/a/24530354
possible better answer: http://stackoverflow.com/a/24485227
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/24485227
linked to: http://stackoverflow.com/q/24485536
tagged with: core-bluetooth
has body: I have an Android (Glass) application that acts as a BLE central and connects to a BLE peripheral (which is an iOS device using Core Bluetooth). I am trying to read from and write to the peripheral. Reading works fine (and receiving notifications works fine too). However I didn't manage to write a characteristic. Here's my code: @Override public void onServicesDiscovered(BluetoothGatt gatt, int status) { if (status == BluetoothGatt.GATT_SUCCESS) { BluetoothGattService bse = gatt.getService(TRANSFER_SERVICE_UUID); BluetoothGattCharacteristic bgc = bse.getCharacteristic(TRANSFER_CHARACTERISTIC_UUID); bgc.setValue("Hello"); boolean writeOk = gatt.writeCharacteristic(bgc); } } @Override public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { // never called } writeOk is always false. I debugged it and found out that the reason is the properties. bgc.getProperties() always returns 50, no matter what properties are set on the iOS side. 50 is PROPERTY_READ, PROPERTY_NOTIFY and PROPERTY_INDICATE, but its missing PROPERTY_WRITE, so BluetoothGatt.writeCharacteristic() immediately exits: public boolean writeCharacteristic(BluetoothGattCharacteristic characteristic) { if ((characteristic.getProperties() &amp; BluetoothGattCharacteristic.PROPERTY_WRITE) == 0 &amp;&amp; (characteristic.getProperties() &amp; BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE) == 0) return false; ... } It seems to me that the properties are not transmitted correctly from the iOS peripheral to the Android central. When connecting to the iOS peripheral with an iOS central, the properties are transmitted correctly and writing works. I have tried: pairing the devices using reliable write (but I don't really know what that is anyway) So - am I doing anything wrong on the Android side? If not: Is this a bug? Or does iOS only wants to get writes from iOS devices? I am using Android 4.4.2 (Glass XE18.11).
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/24530354
favorite count: 0

http://stackoverflow.com/comment/37735939
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24396432
has text: The first of those two isn't strictly related to this as even in the olden days, returning from a function caused all the local variables in said function to be garbage collectable.

http://stackoverflow.com/comment/37613373
has text: *is there already an Object class? if there is I didn't know about it* I highly recommend you to stop doing this and learn Java. `Object` is the base class for all classes in Java, and is covered in basic lessons.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24331923
score: 3

http://stackoverflow.com/comment/37681862
comment on: http://stackoverflow.com/a/24337851
has text: @MrMorgan: Don't use an SQL query. Since you're using Hibernate, create an HQL query like the one I showed you. Consult the Hibernate documentation for information on how to do this.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24267376
answer count: 2
score: 5
downvote count: 0
has answer: http://stackoverflow.com/a/47603727
possible better answer: http://stackoverflow.com/a/47603727
favorite count: 0
has comment: http://stackoverflow.com/comment/37490545
tagged with: websphere-liberty
has answer: http://stackoverflow.com/a/25233202
has body: I randomly see the following error in the logs when using WebSphere Liberty Core (WLC: 8.5.5.1 (wlp-1.0.3.20130510-0831)). On other application servers, this does not happen. I do not know where in code does this occur... It almost looks like Spring 3.1.3 is trying to do something out of order. Has anyone ever tackled this? [03/06/14 20:04:33:232 BST] 000000cb com.ibm.ws.webcontainer.util.ApplicationErrorUtils E SRVE0777E: Exception thrown by application class 'com.ibm.wsspi.http.HttpOutputStream.validate:187' java.io.IOException: Stream is closed at com.ibm.wsspi.http.HttpOutputStream.validate(HttpOutputStream.java:187) at com.ibm.wsspi.http.HttpOutputStream.flush(HttpOutputStream.java:555) at com.ibm.ws.webcontainer.osgi.response.WCOutputStream.flush(WCOutputStream.java:213) at org.springframework.security.web.context.SaveContextOnUpdateOrErrorResponseWrapper$SaveContextServletOutputStream.flush(SaveContextOnUpdateOrErrorResponseWrapper.java:354) at org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:180) at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:137) at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:80) at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.handleReturnValue(RequestResponseBodyMethodProcessor.java:94) at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:69) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:118) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAda…
type: AnsweredQuestion
upvote count: 5
tagged with: java
accepted answer: http://stackoverflow.com/a/25233202
has title: WebSphere Liberty Core throwing java.io.IOException: Stream is closed
type: Question

http://stackoverflow.com/comment/37532602
score: 1
comment on: http://stackoverflow.com/a/24289426
type: AnswerComment
type: Comment
has text: @LuiggiMendoza Java 8 improved it's type inferencing http://blog.jooq.org/2013/11/25/a-lesser-known-java-8-feature-generalized-target-type-inference/

http://stackoverflow.com/comment/37764884
has text: I suppose it is `gensky.exe` etc. on windows. And i suppose `gensky.exe` knows nothing about piping, this is a feature of the shell (if one wants to call `cmd.exe` a shell..).
comment on: http://stackoverflow.com/q/24411664
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37765627
type: QuestionComment
comment on: http://stackoverflow.com/q/24412462
has text: What is "stress test" in the context of your question? To me it is putting the site under high load with many concurrent users. You don't do that with a single computer.
score: 0
type: Comment

http://stackoverflow.com/comment/37677179
comment on: http://stackoverflow.com/q/24365370
score: 0
type: QuestionComment
has text: http://eclipse.dzone.com/articles/line-numbers-eclipse
type: Comment

http://stackoverflow.com/a/24322913
type: AcceptedAnswer
type: Answer
score: 18
upvote count: 19
has comment: http://stackoverflow.com/comment/83778481
downvote count: 1
has comment: http://stackoverflow.com/comment/37596146
answers question: http://stackoverflow.com/q/24322776
has body: If it's not a too complex object, you can do it yourself, without any libraries. Here is an example how: public class DemoObject { private int mSomeInt; private String mSomeString; public DemoObject(int i, String s) { mSomeInt = i; mSomeString = s; } //... other stuff public JSONObject toJSON() { JSONObject jo = new JSONObject(); jo.put("integer", mSomeInt); jo.put("string", mSomeString); return jo; } } In code: DemoObject demo = new DemoObject(10, "string"); JSONObject jo = demo.toJSON(); Of course you can also use Google Gson for more complex stuff and a less cumbersome implementation if you don't mind the extra dependency.
accepted answer of: http://stackoverflow.com/q/24322776

http://stackoverflow.com/a/24340058
has comment: http://stackoverflow.com/comment/61431723
score: 208
has body: You can get the content of a MultipartFile by using the getBytes method and you can write to the file using Files.newOutputStream(): public void write(MultipartFile file, Path dir) { Path filepath = Paths.get(dir.toString(), file.getOriginalFilename()); try (OutputStream os = Files.newOutputStream(filepath)) { os.write(file.getBytes()); } } You can also use the transferTo method: public void multipartFileToFile( MultipartFile multipart, Path dir ) throws IOException { Path filepath = Paths.get(dir.toString(), multipart.getOriginalFilename()); multipart.transferTo(filepath); }
has comment: http://stackoverflow.com/comment/66009902
has comment: http://stackoverflow.com/comment/87563080
type: Answer
has comment: http://stackoverflow.com/comment/49740390
downvote count: 2
upvote count: 210
has comment: http://stackoverflow.com/comment/102209848
accepted answer of: http://stackoverflow.com/q/24339990
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24339990
has comment: http://stackoverflow.com/comment/61021648

http://stackoverflow.com/comment/37721982
score: 1
type: QuestionComment
has text: Are you willing to try out Spring 3.2.9? There is a [JIRA issue](https://jira.spring.io/browse/SPR-11744) that might be the reason for your exception. And, of course, as @M.Deinum said - don't mix versions.
comment on: http://stackoverflow.com/q/24388809
type: Comment

http://stackoverflow.com/a/24275629
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/37507181
accepted answer of: http://stackoverflow.com/q/24275415
has body: Binary search is way faster than normal search. Suppose you have a list with 11 elements: a, c, d, f, g, j, m, p, r, s, z. Your for loop to iterate over the elements, with a minimum of 1 iteration and a maximum of 11 iterations, which makes an average of 5.5 iterations to find an element. Now let's try to pick r from the list. The way binary search works is this: pick the middle element (in our case j). r > j, thus r's index is greater than j's. Let's do it again, the middle element from m to z. That's r, we're already there. You see that we have less iterations, by average. Per iteration, a half of the elements remain. That's the advantage of binary search. The drawback is that the list must be sorted. So if you change the list a lot, then you need to sort the inserted element, and then using binary search might be too 'expensive'. Otherwise, if you search a lot, you might want to use binary search.
has comment: http://stackoverflow.com/comment/37507328
answers question: http://stackoverflow.com/q/24275415
type: Answer
score: 3
downvote count: 0

http://stackoverflow.com/comment/37499375
type: Comment
type: QuestionComment
has text: If it was my Duration variable, why did it work the first several times?
score: 0
comment on: http://stackoverflow.com/q/24271743

http://stackoverflow.com/a/24378780
accepted answer of: http://stackoverflow.com/q/24378561
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/24378561
has body: Change this: @Override public Object getItem(int position) { return null; } To: @Override public Object getItem(int position) { return date.get(position); }

cors
type: Tag
tag name: cors
tags question: http://stackoverflow.com/q/24381486
tags question: http://stackoverflow.com/q/24386712

http://stackoverflow.com/comment/37633308
score: 0
comment on: http://stackoverflow.com/q/24341753
type: QuestionComment
type: Comment
has text: @JonSkeet OK, I bow to your superior foresight. I really thought that the missing bits were bits Ossama had chosen to omit, not bits he didn't know how to do.

http://stackoverflow.com/comment/37691611
has text: Don't why isn't showing even after repostong.I've commented my button attributes
type: Comment
comment on: http://stackoverflow.com/a/24371339
score: 0
type: AnswerComment

http://stackoverflow.com/a/24528900
type: Answer
has body: Not sure if I understand your question correctly, but I think this should work (if you haven't tried it already): Download add-on from the Vaadin website Unzip it and put jar file in the WEB-INF/lib folder inside WebContent folder Compile widgetset Restart your application as decribed here: Vaadin add-on instructions
score: 0
answers question: http://stackoverflow.com/q/24291911

http://stackoverflow.com/q/24283245
tagged with: charts
has comment: http://stackoverflow.com/comment/48286186
tagged with: linechart
upvote count: 1
favorite count: 0
type: UnansweredQuestion
has title: The x-values in a line chart of JavaFX are not ordered properly / messed up?
has body: I am working on some Graphs using JavaFX, and I use a few line charts to get my result. There is however a problem. I think that the following code will explain what I'm trying to do: while(startTime.getTimeInMillis() &lt;= endTime.getTimeInMillis()) { int index = getIndex(startTime); if(index != -1) { N k = dataList.get(index); Data&lt;String, N&gt; point = new Data&lt;String, N&gt;(distanceList.get(index) + "", k); series.getData().add(point); } int newMinutes = startTime.get(Calendar.MINUTE)+5; startTime.set(Calendar.MINUTE, newMinutes); } This code fills a series (JavaFX see here) and other code sets it in a chart which is not the problem. The above code retrieves the index by using the time. The indexes retrieved are all in ascending order, I already checked that. The distanceList is a list in ascending order and the dataList is not. So all the datapoints in the series are added with the x values in an ascending order, but whenever this is set, I get a graph where all the X labels are messed up (and therefore also the line itself). The x labels don't have equal spacing and sometimes are over each other. I searched the internet and found some similar problems of others, which some of them said it was a bug in JavaFX. I am running the newest version of Java and JavaFX, respectively 1.8 and 8. Everything is working fine, all values are correct as I checked it multiple times. It's just the labels on x-axis that are not shown properly. I have no clue in what the problem is, do some of you know?
answer count: 0
downvote count: 0
score: 1
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/37553850
has comment: http://stackoverflow.com/comment/37528976
type: Question

http://stackoverflow.com/q/24268477
type: Question
tagged with: comparison-operators
has body: The following code works perfectly and background changes when you change the data: constraint = validationHelper.createExplicitListConstraint(new String[]{"10","11"}); XSSFSheetConditionalFormatting my_cond_format_layer = sheet.getSheetConditionalFormatting(); XSSFConditionalFormattingRule my_rule = my_cond_format_layer.createConditionalFormattingRule(ComparisonOperator.EQUAL,"10"); PatternFormatting fill1 = my_rule.createPatternFormatting(); fill1.setFillBackgroundColor(IndexedColors.GREEN.index); fill1.setFillPattern(PatternFormatting.SOLID_FOREGROUND); CellRangeAddress[] my_data_range = {CellRangeAddress.valueOf("C1:C90")}; my_cond_format_layer.addConditionalFormatting(my_data_range,my_rule); XSSFSheetConditionalFormatting my_cond_format_layer2 = sheet.getSheetConditionalFormatting(); XSSFConditionalFormattingRule my_rule2 = my_cond_format_layer2.createConditionalFormattingRule(ComparisonOperator.EQUAL,"11"); PatternFormatting fill12 = my_rule2.createPatternFormatting(); fill12.setFillBackgroundColor(IndexedColors.RED.index); fill12.setFillPattern(PatternFormatting.SOLID_FOREGROUND); CellRangeAddress[] my_data_range2 = {CellRangeAddress.valueOf("C1:C90")}; my_cond_format_layer.addConditionalFormatting(my_data_range2,my_rule2); While the following doesn't work and background doesn't change: constraint = validationHelper.createExplicitListConstraint(new String[]{"OK","ERROR"}); XSSFSheetConditionalFormatting my_cond_format_layer = sheet.getSheetConditionalFormatting(); XSSFConditionalFormattingRule my_rule = my_cond_format_layer.createConditionalFormattingRule(ComparisonOperator.EQUAL,"OK"); PatternFormatting fill1 = my_rule.createPatternFormatting(); fill1.setFillBackgroundColor(IndexedColors.GREEN.index); fill1.setFillPattern(PatternFormatting.SOLID_FOREGROUND); CellRangeAddress[] my_data_range = {CellRangeAddress.valueOf("C1:C90")}; my_cond_format_layer.addConditionalFormatting(my_data_range,my_rule); XSSFSheetConditionalFormatting my_cond_format_layer2 = sheet…
has answer: http://stackoverflow.com/a/24285643
has answer: http://stackoverflow.com/a/27104969
answer count: 3
has answer: http://stackoverflow.com/a/25550097
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37496235
tagged with: apache-poi
score: 1
tagged with: java
upvote count: 1
has title: How compare strings in ConditionalFormatting?

http://stackoverflow.com/q/24304282
tagged with: image-processing
type: Question
tagged with: c#
score: -2
has title: View Compressed Image or encoded image ..?
tagged with: image
downvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/40031000
tagged with: asp.net
favorite count: 0
has answer: http://stackoverflow.com/a/24305487
upvote count: 0
has body: I need to view image .. the image file without extension Like (.jpeg , .TIF ,.TIFF....etc) and this image is scanned from scanner also it's white and black image "microcosmic image " . it might be encoded and compressed . i knew that is PKZIP tool is used to encode or decode or for compression .so i tried but not reach for result . image file upload over my google drive.
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/24308363
has body: I've been reading a lot of computer science books and articles and I keep seeing the phrase "code against." For example, in the book Struts 2 in Action by Donald Brown, Chad Michael Davis, and Scott Stanlick, the following sentences can be found: "Although it’s possible to write web applications by directly coding against the Servlet API, this is generally not considered a good practice." "This means that Java developers can write HTTP server code against an intuitive object-oriented abstraction of the HTTP client/server communications." In this book, particularly, there were a lot of instances of the use of the phrase "resolve against," as well. For example: "When the framework invokes the result, your JSP page data access will be resolved against the old object." "The ValueStack represents the data model exposed to the current request and is the default object against which all OGNL expressions are resolved." "If no namespace attribute is specified, then the action is resolved against the namespace of the current request." I guess my confusion is based around the word "against." How and why is it used in this programming concept? I wouldn't think you'd want to code against something; rather, I'd think you'd want to code in correspondence with it. This could just be the author's phraseology, but can anyone help me out?
linked to: http://stackoverflow.com/q/383947
type: Question
upvote count: 4
score: 4
has comment: http://stackoverflow.com/comment/75217278
tagged with: programming-languages
tagged with: struts2
has answer: http://stackoverflow.com/a/24308599
has comment: http://stackoverflow.com/comment/37568430
has comment: http://stackoverflow.com/comment/37568461
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24308599
has comment: http://stackoverflow.com/comment/37597474
favorite count: 0
tagged with: semantics
type: AnsweredQuestion
tagged with: oop
has title: What does it mean to "code against" or "resolve against" something?
tagged with: java

http://stackoverflow.com/q/24378375
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24378431
has answer: http://stackoverflow.com/a/29369918
has comment: http://stackoverflow.com/comment/37746778
has answer: http://stackoverflow.com/a/24378505
type: Question
has answer: http://stackoverflow.com/a/24378538
has comment: http://stackoverflow.com/comment/37701576
tagged with: oop
tagged with: java
linked to: http://stackoverflow.com/q/9790435
has answer: http://stackoverflow.com/a/24378425
has comment: http://stackoverflow.com/comment/37701563
answer count: 11
linked to: http://stackoverflow.com/q/17897244
tagged with: class
has comment: http://stackoverflow.com/comment/37701559
has answer: http://stackoverflow.com/a/48974410
has answer: http://stackoverflow.com/a/24378534
has answer: http://stackoverflow.com/a/24378603
has title: Java : If A extends B and B extends Object, is that multiple inheritance
has answer: http://stackoverflow.com/a/24378531
has comment: http://stackoverflow.com/comment/37749112
has comment: http://stackoverflow.com/comment/37701599
downvote count: 0
has answer: http://stackoverflow.com/a/24378431
has answer: http://stackoverflow.com/a/24378532
has body: I just had an interview, and I was asked a question. Interviewer - Does Java support multiple inheritance? Me - No Interviewer - Each class in Java extends class Object (except class Object) and if we externally extend one class like Class A extends B{ // some code here } then you can say that class A extend class B and class Object, which means it is multiple inheritance. So how can you say Java does not support multiple inheritance? Me - Actually class B extends class Object, so when you extend class B in class A then class A extends class Object indirectly. This is multi-level inheritance, not multiple inheritance. But my answer did not satisfy him. Is my answer correct? Or where am I wrong? What actually happens internally?
tagged with: inheritance
favorite count: 0
score: 39
has comment: http://stackoverflow.com/comment/37701873
possible better answer: http://stackoverflow.com/a/24378603
upvote count: 39
has answer: http://stackoverflow.com/a/24394285
linked to: http://stackoverflow.com/q/22881645
has comment: http://stackoverflow.com/comment/37701669

http://stackoverflow.com/comment/37576924
score: 0
type: Comment
type: AnswerComment
has text: ok...thanks for ur reply..can u give me an example where i can actually see volatile keyword working. I want example where one thread updates and other reads from memory and if the keyword is not volatile then it should go in infinite loop....
comment on: http://stackoverflow.com/a/24312967

http://stackoverflow.com/a/24389980
score: 1
has comment: http://stackoverflow.com/comment/37743309
accepted answer of: http://stackoverflow.com/q/24358744
answers question: http://stackoverflow.com/q/24358744
upvote count: 1
type: AcceptedAnswer
has body: You can find the Web Services documented here: http://docs.oracle.com/cd/E28280_01/bi.1111/e16364/soa_overview.htm#BABHJJAC Update: From what I can see, the OBIEE web services don't support export to PDF/image. If you want to work directly with PDFs, you might need to look at using BI Publisher (BIP) instead, which also supports Web Services. BI Publisher can query existing OBIEE analyses and RPDs. You can also call BIP directly from within a Java application using the available APIs.
has comment: http://stackoverflow.com/comment/37747961
has comment: http://stackoverflow.com/comment/37982977
type: Answer
downvote count: 0

http://stackoverflow.com/q/24382915
type: Question
score: 0
answer count: 1
tagged with: ajax
has answer: http://stackoverflow.com/a/24384528
tagged with: spring
tagged with: spring-mvc
has body: In my spring project I am sending request through Ajax call like this: function doAjaxPost(currentPage) { var appName = document.searchForm.txtZipFile.value; var e = document.getElementById("selectStatus"); var appStatus = e.options[e.selectedIndex].text; $.ajax({ type : "GET", url : "http://localhost:8080/ preListOnSearch.do", data : "currentPage=" + currentPage + "&amp;appName=" + appName + "&amp;appStatus=" + appStatus, cache: false, success : function(response) { alert(response); }, error : function(e) { alert('Error: ' + e); } }); } And in my controller I wrote method like: @RequestMapping(value = "/preListOnSearch", method=RequestMethod.GET) public String preTestDataolx(@PathVariable("siteId") String siteId, @PathVariable(value = "currentPage") String currentPage, @RequestParam(value = "appStatus") String appStatus) { System.out.println(appStatus); return "/preTestData"; } But this give me error. When I remove RequestParams from method definition it works fine. So I just want to know that how can I access ajax call parameter in controller.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37711205
has title: Receiving parameter in controller from Ajax call in Spring
tagged with: jakarta-ee
tagged with: java

http://stackoverflow.com/comment/37521797
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24282627
has text: What issue did you get?
type: Comment

http://stackoverflow.com/a/24383352
accepted answer of: http://stackoverflow.com/q/24363031
has comment: http://stackoverflow.com/comment/37783499
has body: Seems like you are missing some basics here. Taken from here and some code of mine. Setting up the connection outside of the consumer thread: //executed once ConnectionFactory factory = new ConnectionFactory(); factory.setHost("someHost"); factory.setUsername("user"); factory.setPassword("pass"); Connection connection = factory.newConnection(); What you have to do inside your thread: //Consumer - executed in a Thread QueueingConsumer consumer = new QueueingConsumer(connection.createChannel()); boolean autoAck = false; channel.basicConsume("hello", autoAck, consumer); while (!Thread.current().isInterrupted())) { QueueingConsumer.Delivery delivery = consumer.nextDelivery(); //... channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false); } In general I do still recommand you check out the spring-amqp library it integrates perfectly.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37789987
answers question: http://stackoverflow.com/q/24363031
type: Answer
has comment: http://stackoverflow.com/comment/37784535
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/37790805

http://stackoverflow.com/comment/37562188
comment on: http://stackoverflow.com/q/24300604
score: 0
type: Comment
type: QuestionComment
has text: `@Consumes` defines the accepted MediaType of the entity passed in the payload of the request. `GET` doesn't have a payload.

http://stackoverflow.com/a/24355941
has body: The synchronized block will ensure the updates to memory is seen by other threads. There is no need to make myObject volatile. From Intrinsic Locks and Synchronization: When a thread releases an intrinsic lock, a happens-before relationship is established between that action and any subsequent acquistion of the same lock.
answers question: http://stackoverflow.com/q/24355750
type: Answer
has comment: http://stackoverflow.com/comment/37667892
score: 4
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/24400724
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/24400655
has body: The "\" starts an escape sequence, A character preceded by a backslash (\) is an escape sequence and has special meaning to the compiler. So, (ludicrously perhaps) String old = readOld(); String newConfig = old.replaceAll(old, "[HKEY_CURRENT_USER\\\\Software\\\\xxxx\\\\xxxx\\\\Config]"); Or, String old = readOld(); char backSlash = '\\'; String newConfig = old.replaceAll(old, "[HKEY_CURRENT_USER" + backSlash + backSlash + "Software" + backSlash + backSlash + "xxxx" + backSlash + backSlash + "xxxx" + backSlash + backSlash + "Config]");
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/24400655
has comment: http://stackoverflow.com/comment/37744023
type: Answer

http://stackoverflow.com/q/24299584
tagged with: digital-signature
possible better answer: http://stackoverflow.com/a/24304086
has answer: http://stackoverflow.com/a/24304086
linked to: http://stackoverflow.com/q/24484147
tagged with: soap
tagged with: cosign-api
has comment: http://stackoverflow.com/comment/37905375
type: AnsweredQuestion
has title: How to run CoSign Signature SOAP API in IBM Lotus Notes?
tagged with: java
has answer: http://stackoverflow.com/a/24326443
accepted answer: http://stackoverflow.com/a/24326443
linked to: http://stackoverflow.com/q/10454037
type: Question
answer count: 2
has body: Session session = getSession(); AgentContext agentContext = session.getAgentContext(); // Custom Values String filePath = "C://20/ToSign.pdf"; // Pdf File to sign String fileMimeType = "application/pdf"; // File MIME type String username = "xyz@gmail.com"; // CoSign account username,Not exactly these credentials, I have entered my CoSign username and password here. String password = "password"; // CoSign account password String domain = ""; // CoSign account domain int sigPageNum = 1; // Create signature on the first page int sigX = 145; // Signature field X location int sigY = 125; // Signature field Y location int sigWidth = 160; // Signature field width int sigHeight = 45; // Signature field height String timeFormat = "hh:mm:ss"; // The display format of the time String dateFormat = "dd/MM/yyyy"; // The display format of the date long appearanceMask = 11; String signatureType = "http://arx.com/SAPIWS/DSS/1.0/signature-field-create-sign"; // The actual operation of the Sign Request function String wsdlUrl = "https://prime.cosigntrial.com:8080/sapiws/dss.asmx?WSDL"; // URL to the WSDL file // Read file contents BufferedReader br = new BufferedReader(new FileReader(new File(filePath))); String line; String fileBufferContent=""; while ((line=br.readLine())!=null){ fileBufferContent=fileBufferContent+line ; } byte[] fileBuffer = fileBufferContent.getBytes(); // Set file contents + MIME type (the SOAP library automatically base64 encodes the data) DocumentType document = new DocumentType(); Base64Data base64Data = new Base64Data(); base64Data.setValue(fileBuffer); base64Data.setMimeType(fileMimeType); document.setBase64Data(base64Data); // Set user credentials. In case of Active Directory, the domain name should be defined in the NameQualifier attribute ClaimedIdentity claimedIdentity = new ClaimedIdentity(); NameIdentifierType nameIdentifier = new NameIdentifierType(); nameIdentifier.setValue(username); nameIdentifier.setNameQualifier(domain); CoSignAuthDataType coSig…
score: 0

http://stackoverflow.com/comment/37622746
type: Comment
score: 1
has text: @PawelHuszcza JPEG has no alpha channel.
type: AnswerComment
comment on: http://stackoverflow.com/a/24336886

combinations
tags question: http://stackoverflow.com/q/24351240
tag name: combinations
type: Tag
tags question: http://stackoverflow.com/q/24281042

http://stackoverflow.com/comment/37513354
has text: this makes sense. are there any references that could pin this down? i was wondering whether the synchronized & asynchronized methods within the syn'd block would be an issue. and whether some other types of locks can do better.
type: Comment
comment on: http://stackoverflow.com/a/24279320
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37609100
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24328915
has text: How do you invalidate the session cookie?
score: 0

http://stackoverflow.com/q/24359818
has title: how to identify background processes?
score: 0
has comment: http://stackoverflow.com/comment/37667672
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37667551
has body: final List&lt;WindowInfo&gt; inflList=new ArrayList&lt;WindowInfo&gt;(); final List&lt;Integer&gt; order=new ArrayList&lt;Integer&gt;(); int top = User32.instance.GetTopWindow(0); while (top!=0) { order.add(top); top = User32.instance.GetWindow(top, User32.GW_HWNDNEXT); } User32.instance.EnumWindows(new WndEnumProc() { public boolean callback(int hWnd, int lParam) { if (User32.instance.IsWindowVisible(hWnd)) { RECT r = new RECT(); User32.instance.GetWindowRect(hWnd, r); if (r.left&gt;-32000) { // minimized byte[] buffer = new byte[1024]; User32.instance.GetWindowTextA(hWnd, buffer, buffer.length); String title = Native.toString(buffer); if (m.length == count) { // expand list m = Arrays.copyOf(m, m.length + arrayGrowth); } m[count]=Native.toString(buffer); System.out.println("title===="+m[count]); count++; inflList.add(new WindowInfo(hWnd, r, title)); } } return true; } }, 0); Collections.sort(inflList, new Comparator&lt;WindowInfo&gt;() { public int compare(WindowInfo o1, WindowInfo o2) { return order.indexOf(o1.hwnd)-order.indexOf(o2.hwnd); } }); for (WindowInfo w : inflList) { System.out.println(w); } } public static interface WndEnumProc extends StdCallLibrary.StdCallCallback { boolean callback (int hWnd, int lParam); } public static interface User32 extends StdCallLibrary { final User32 instance = (User32) Native.loadLibrary ("user32", User32.class); boolean EnumWindows (WndEnumProc wndenumproc, int lParam); boolean IsWindowVisible(int hWnd); int GetWindowRect(int hWnd, RECT r); void GetWindowTextA(int hWnd, byte[] buffer, int buflen); int GetTopWindow(int hWnd); int GetWindow(int hWnd, int flag); final int GW_HWNDNEXT = 2; } public static class RECT extends Structure { public int left,top,right,bottom; } public static class WindowInfo { int hwnd; RECT rect; String title; public WindowInfo(int hwnd, RECT rect, String title) { this.hwnd = hwnd; this.rect = rect; this.title = title; } public String toString() { return String.format("(%d,%d)-(%d,%d) : \"%s\"", rec…
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37669335
has comment: http://stackoverflow.com/comment/37667699
type: Question
has comment: http://stackoverflow.com/comment/37667045
has comment: http://stackoverflow.com/comment/37669435

http://stackoverflow.com/a/24283862
score: 2
has comment: http://stackoverflow.com/comment/37525307
upvote count: 2
has comment: http://stackoverflow.com/comment/37524955
has comment: http://stackoverflow.com/comment/37523481
type: Answer
downvote count: 0
has body: As I do not have all of your implementations, I setup some dummy implementations and made a similar setup like yours. The below code works fine for me. import static junit.framework.Assert.assertTrue; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) @PrepareForTest(value = { Role.class }) public class RoleTest { @Test public void mockRoleServices() throws Exception { PowerMockito.spy(Role.class); PowerMockito.doAnswer(new RoleAnswer(RoleEnum.ADMIN)).when(Role.class, "hasAdministratorRole", Mockito.anyLong(), Mockito.anyLong(), Mockito.anyLong()); Role.printOut(); assertTrue(Role.hasAdministratorRole(1, 1, 1)); } private class RoleAnswer implements Answer&lt;Boolean&gt; { private RoleEnum roleEnum; private RoleAnswer(RoleEnum roleEnum) { this.roleEnum = roleEnum; } public Boolean answer(InvocationOnMock invocation) throws Throwable { return true; } } } Dummy Role class: public class Role { public static Boolean hasAdministratorRole(long a, long b, long c) { System.out.println("Inside hasAdministratorRole"); return a + b + c &lt; 0; } public static void printOut() { System.out.println("Inside Printout"); } } My test case does not printout Inside hasAdministratorRole, but prints out Inside Printout Hope this helps
answers question: http://stackoverflow.com/q/24281913

http://stackoverflow.com/comment/37543556
comment on: http://stackoverflow.com/q/24267660
type: Comment
has text: I'll try again: what part of the code don't you understand? :-)
type: QuestionComment
score: 0

http://stackoverflow.com/q/24323628
has comment: http://stackoverflow.com/comment/37597572
tagged with: junit
downvote count: 0
has title: java: OutOfMemoryError: insufficient memory while running JUnits in Idea
has answer: http://stackoverflow.com/a/78997255
favorite count: 0
score: 30
possible better answer: http://stackoverflow.com/a/24361992
upvote count: 30
has answer: http://stackoverflow.com/a/61006559
has answer: http://stackoverflow.com/a/24361992
has body: I am trying to run JUnits from my IntelliJ Idea When I try to run the Test.java file it gives me an error saying that java: OutOfMemoryError: insufficient memory I have tried increasing the memory allocated to Idea to as large as 6GB but it still gives me the same error, what am I missing :/ Increasing the following in idea64.vmoptions didn't help. current vmoption settings in /opt/idea/bin are: -Xms124m -Xmx2g -XX:MaxPermSize=2g -XX:ReservedCodeCacheSize=196m -XX:+UseCodeCacheFlushing -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true PS:- the project has ~83k files and overall size of project is 1.1 GB Below Error is encountered:- Information:Using javac 1.6.0_35 to compile java sources Information:java: The system is out of resources. Information:java: Consult the following stack trace for details. Information:java: at com.sun.tools.javac.util.Position$LineMapImpl.build(Position.java:139) Information:java: at com.sun.tools.javac.util.Position.makeLineMap(Position.java:63) Information:java: at com.sun.tools.javac.parser.Scanner.getLineMap(Scanner.java:1105) Information:java: at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:512) Information:java: at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:550) Information:java: at com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:804) Information:java: at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727) Information:java: at com.sun.tools.javac.main.Main.compile(Main.java:353) Information:java: at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:115) Information:java: at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:166) Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:364) Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:276) Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:190) Informa…
has answer: http://stackoverflow.com/a/24323749
has comment: http://stackoverflow.com/comment/37663547
has comment: http://stackoverflow.com/comment/37622571
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/34449696
type: Question
has comment: http://stackoverflow.com/comment/118123199
tagged with: intellij-idea
accepted answer: http://stackoverflow.com/a/24323749
answer count: 6
has answer: http://stackoverflow.com/a/57086955
has comment: http://stackoverflow.com/comment/37597516
has answer: http://stackoverflow.com/a/59964464

http://stackoverflow.com/comment/37726749
type: Comment
has text: Ya I have tried your code . It worked , this method reduced the time to 3.5 s . Thank you.
type: AnswerComment
comment on: http://stackoverflow.com/a/24391500
score: 0

http://stackoverflow.com/comment/37653207
comment on: http://stackoverflow.com/q/24352597
score: 0
has text: 2 for loops are not necessary.. Your approach of copying the numbers smaller than the given number into a different arraylist can be done as @JBNizet says. With one for loop.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24271778
favorite count: 0
has answer: http://stackoverflow.com/a/24271835
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24271835
score: 1
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/24287320
type: Question
has answer: http://stackoverflow.com/a/24287320
has title: how to write Junit test case which covers catch block during code coverage?
linked to: http://stackoverflow.com/q/4972867
has body: below is code and I want to know how can I write a JUnit test so that my coverage can cover catch block import com.pkg.ClothBrandQuery; Public class MapBrand implements SomeInterface{ public Brand mapThisBrands(final ClothBrand clothBrand) { Brand brand = new Brand(); try{ defaultBrand = clothBrandQuery.getClothBrandMethod(ProjectConstants.DEFAULT_BRAND_KEY); } catch(Exception e){ logger.fatal("Database error occurred retrieving default cloth brands", e); System.exit(2); } if(defaultBrand != null &amp;&amp; defaultBrand != clothBrand){ brand.setBrandName(clothBrand.getBrandName()); brand.setCompanyName(clothBrand.getCompanyName()); brand.setBackgroundColor(clothBrand.getBackgroundColor()); } else{ brand.setBrandName(defaultBrand.getBrandName()); brand.setCompanyName(defaultBrand.getCompanyName()); brand.setBackgroundColor(defaultBrand.getBackgroundColor()); } } } I am able to write test method for mapThisBrands to test brand object but I dont know how I can test defaultBrand object and how I write a testcase where catch block will get executed.
has comment: http://stackoverflow.com/comment/37530343
answer count: 2
tagged with: mockito
tagged with: junit
downvote count: 0
has comment: http://stackoverflow.com/comment/37499730

morphia
tag name: morphia
type: Tag
tags question: http://stackoverflow.com/q/24331646

http://stackoverflow.com/comment/37553721
has text: **Thanks a lot** I will check it again now :D I know Java but still I need to learn much more.
comment on: http://stackoverflow.com/a/24284653
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/24401431
upvote count: 3
type: Answer
score: 3
downvote count: 0
has body: there is this statement in Java that everything starts and ends with the main() method. This is not true. You have import java.io.PrintStream; class Main { static { System.out.println("0) Printed before main"); } public static void main(String... args) { System.out.println("1) Printed in main"); Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { System.out.println("3) Printed long after main"); } }); throw new RuntimeException() { public void printStackTrace(PrintStream ps) { System.err.println(); System.out.println("2) Printed after main"); } }; } } prints Exception in thread "main" 0) Printed before main 1) Printed in main 2) Printed after main 3) Printed long after main
answers question: http://stackoverflow.com/q/24401333

http://stackoverflow.com/comment/37659396
has text: (1) Where exactly would the code that invokes `main()` be located ? I assume you wanted to advice that all that code should be extracted in a method other than `main`. (2) Since the `answer` is only available after the first iteration, this can only be achieved with a `do...while` loop.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24355759
type: Comment

http://stackoverflow.com/a/51705881
score: 18
upvote count: 18
downvote count: 0
has body: If you're using spring boot with starters - this dependency adds both tomcat-embed-el and hibernate-validator dependencies: org.springframework.boot spring-boot-starter-validation
type: Answer
answers question: http://stackoverflow.com/q/24386771

http://stackoverflow.com/comment/37653184
has text: @peeskillet I seem to be blind, because I don't see any archetypes with Spring in NetBeans. Can you be more specific, please?
comment on: http://stackoverflow.com/q/24320109
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24420789
answer count: 1
has answer: http://stackoverflow.com/a/24420812
type: Question
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/24420812
has title: Try and Catch for simple calculator input
tagged with: try-catch
has body: This program written in java serves as a calculator. Can anyone tell me how to implement a try/catch block if the user tries to input from the result text so that I can handle incorrect workflow? Here is the code: package simplecal; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class SimpleCal extends JFrame { JTextField jftinput1, jftinput2, jftresult; JButton jbtminus, jbtadd,jbtdivid, jbttimes; final int JTEXT_SIZE = 5; SimpleCal(){ setLayout(new FlowLayout()); jftinput1 = new JTextField(JTEXT_SIZE); jftinput2 = new JTextField(JTEXT_SIZE); jftresult = new JTextField(JTEXT_SIZE); add(new JLabel("Input 1: ")); add(jftinput1); add(new JLabel("Input 2: ")); add(jftinput2); add(new JLabel("Result ")); add(jftresult); JPanel p1 = new JPanel(); jbtminus = new JButton("Subtract"); jbtadd = new JButton("Add"); jbttimes = new JButton("Multiple"); jbtdivid = new JButton("Divided"); p1.add(jbtminus); jbtminus.addActionListener(new ButtonListener1()); p1.add(jbtadd); jbtadd.addActionListener(new ButtonListener2()); p1.add(jbttimes); jbttimes.addActionListener(new ButtonListener3()); p1.add(jbtdivid); jbtdivid.addActionListener(new ButtonListener4()); add(p1, BorderLayout.SOUTH); } class ButtonListener1 implements ActionListener{ public void actionPerformed(ActionEvent e){ double input1 = Double.parseDouble(jftinput1.getText()); double input2 = Double.parseDouble(jftinput2.getText()); double answer = input1 - input2; jftresult.setText(Double.toString(answer)); } } class ButtonListener2 implements ActionListener{ public void actionPerformed(ActionEvent e){ double input1 = Double.parseDouble(jftinput1.getText()); double input2 = Double.parseDouble(jftinput2.getText()); double answer = input1 + input2; jftresult.setText(Double.toString(answer)); } } class ButtonListener3 implements ActionListener{ public void actionPerformed(ActionEvent e){ double input1 = Double.parseDouble(jftinput1.getText()); double input2 = Double.parseDouble(jftinput2.getText()); …
has comment: http://stackoverflow.com/comment/37781444
type: AnsweredQuestion

http://stackoverflow.com/comment/37668249
has text: Create a method with Object array as parameter and iterate through the object array. Check for instanceOf of each object with desired class and have if condition to get the values.
comment on: http://stackoverflow.com/q/24360375
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24378925
has comment: http://stackoverflow.com/comment/37702599
has comment: http://stackoverflow.com/comment/37702680
answer count: 1
tagged with: jms
tagged with: log4j
has comment: http://stackoverflow.com/comment/37702715
accepted answer: http://stackoverflow.com/a/24379010
has title: Thread id not showing in logs
tagged with: multithreading
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37702706
has comment: http://stackoverflow.com/comment/37702577
type: Question
has answer: http://stackoverflow.com/a/24379010
has comment: http://stackoverflow.com/comment/37702863
has body: My applications listens to messages on a queue and then publishes results to Tibco subject. We have written a message listener which is called via "onMessage" method of "MessageListener" Problem i am facing is that all the threads in logs show same thread name i.e. "TIBCO EMS Session Dispatcher (21367271)". And its making it very difficult to track which thread is doing what. My log4j expression is "%d{HH:mm:ss,SSS} %-5p %c{1} [%t] - %m%n" . What change do i need to make to get proper thread id? EDIT: I want to be able to differentiate between log messages printed for processing of different messages. At present i can't do that with thread name.
has comment: http://stackoverflow.com/comment/37702854

http://stackoverflow.com/q/24314668
type: Question
downvote count: 0
has title: Open, edit and save image canvas on file.pgm in JavaFX
linked to: http://stackoverflow.com/q/24205382
has answer: http://stackoverflow.com/a/24314929
answer count: 1
favorite count: 0
upvote count: 2
has body: this drawing area to draw image with canvas Canvas canvas= new Canvas(); canvas.setHeight(500); canvas.setWidth(700); GraphicsContext gc = canvas.getGraphicsContext2D(); gc.setFill(Color.BLACK); gc.fillRect(0, 0, canvas.getWidth(), canvas.getHeight()); gc.setFill(Color.WHITE); gc.fillRect(1, 1, canvas.getWidth() - 2, canvas.getHeight() - 2); and I made this method to export drawing canvas to imagem.pgn or snapshot and its correctly public void snapshotCanvasImageToPNG(Stage primaryStage) { FileChooser fileChooser = new FileChooser(); FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("png files (*.png)", "*.png"); fileChooser.getExtensionFilters().add(extFilter); File file = fileChooser.showSaveDialog(primaryStage); if (file != null) { try { WritableImage writableImage = new WritableImage((int) canvas.getWidth(), (int) canvas.getHeight()); canvas.snapshot(null, writableImage); RenderedImage renderedImage = SwingFXUtils.fromFXImage(writableImage, null); ImageIO.write(renderedImage, "png", file); } catch (IOException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } and I have many doubts in making these methods to open edit and save the canvas drawing to file.pgm I made this but it complicate to finish public void openFilePGM(Stage primaryStage) { FileChooser fileChooser = new FileChooser(); FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("PGM files (*.pgm)", "*.pgm"); fileChooser.getExtensionFilters().add(extFilter); File file = fileChooser.showOpenDialog(primaryStage); if (file != null) { //doubt here } } public void saveFilePGM(Stage primaryStage) { FileChooser fileChooser = new FileChooser(); FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("PGM files (*.pgm)", "*.pgm"); fileChooser.getExtensionFilters().add(extFilter); File file = fileChooser.showSaveDialog(primaryStage); if (file != null) { //doubt here } }
accepted answer: http://stackoverflow.com/a/24314929
type: AnsweredQuestion
score: 2
tagged with: java
tagged with: javafx

http://stackoverflow.com/comment/37798121
type: Comment
has text: Is it safe enough for a chat to do that? And if i want to use a keystore file can i put it inside the runnable .jar? Where i can read about how to make Ketstore files? p.s my objective is only to encrypt client-server communication
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/24428618

http://stackoverflow.com/comment/37623343
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24337168
has text: I don't see how you've made it work just by moving the declarations. I ran into a number of other problems when I tried it.

modal-dialog
tag name: modal-dialog
type: Tag
tags question: http://stackoverflow.com/q/24394759
tags question: http://stackoverflow.com/q/24387395

http://stackoverflow.com/a/42508788
answers question: http://stackoverflow.com/q/24277652
downvote count: 1
type: Answer
upvote count: 0
has body: When doing OneToMany and ManyToOne, you have to do add Parent object in you Chilid object as well Child in Parent Ojbect I mean you need to do a.setUser(user); b.setUser(user);
score: -1

http://stackoverflow.com/comment/37675219
score: 0
type: Comment
type: QuestionComment
has text: Your first code bit is extremely confusing. First off, what is the `if()` check on `messageMap` doing? You just set it to null, now you are checking if it's null? Second, why are you using a `Set<Object>`? According to the APIs, `Properties` is basically a `Map<String,String>`, but you get the keys as `Objects` then do a conversion back to `String` using `toString()`? There seems to be a lot of unnecessary code going on. Also, flags went off in my head when you mentioned this method is called 25 times per second, but is a Static method. This makes me think there is a thread safety issue.
comment on: http://stackoverflow.com/q/24362210

http://stackoverflow.com/comment/37535663
type: AnswerComment
has text: @Siva no probs, glad it worked for you
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24289469

http://stackoverflow.com/comment/37783733
comment on: http://stackoverflow.com/a/24421845
score: 0
type: AnswerComment
type: Comment
has text: Yes i have fixed that problem but it only returns the first two values now not the last two i'll keep working but thank you for your help i would have never found that.

http://stackoverflow.com/a/24274463
has body: You can simply create additional collection type. See below code: TypeFactory typeFactory = mapper.getTypeFactory(); CollectionType listType = typeFactory.constructCollectionType(List.class, contentType); CollectionType listListType = typeFactory.constructCollectionType(List.class, listType); List&lt;List&lt;GeoPoint&gt;&gt; readValue = mapper.readValue(json, rootCollectionType); // convert to ThreePoints EDIT Unfortunately you are not able to tell Jackson to convert your JSON to your POJO classes because they do not fit to each other. Jackson also does not contain annotations which you can use to map your JSON to your POJO classes. You have to do it manually. Using my code you can write custom deserializer for ThreePoints class in which you can use inner ObjectMapper and my above code. I think, that you will be able easily convert List&lt;List&lt;GeoPoint&gt;&gt; readValue to ThreePoints class. Another option - you can write just a simple function in you JsonUtil class. If you really can not change this JSON you have to do it manually.
answers question: http://stackoverflow.com/q/24273835
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/37627416
upvote count: 3

http://stackoverflow.com/comment/37693481
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24373741
has text: I added the code I used. You should be able to create a new Android app, replace MainActivity with the one above, and add in the two layout XML files and see exactly what I've shown above. Hopefully this will help.

http://stackoverflow.com/comment/37606567
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24328314
type: Comment
has text: I've modified the question to show one place where there seems to be a problem, there are 93 places where the word ERROR is in the log file.

http://stackoverflow.com/q/24411557
score: 1
has comment: http://stackoverflow.com/comment/37763840
favorite count: 0
has comment: http://stackoverflow.com/comment/37763833
has comment: http://stackoverflow.com/comment/37764230
has comment: http://stackoverflow.com/comment/37763937
answer count: 0
type: UnansweredQuestion
has title: Java compatiblity with older version's bytecode
upvote count: 1
has comment: http://stackoverflow.com/comment/38058421
type: Question
tagged with: java
tagged with: compilation
has body: This is a question about Java version compatibility, which I know has been asked before, but from a slightly different angle. Previous answers I've seen suggest compiling the older version java code in the higher version of Java, like: javac -source 1.6 -target 1.6 MyJavaFile.java. However, I'm not clear whether if I have bytecode previously compiled under the older version of Java, e.g 1.5, will it run happily in e.g. a Java 6 or 7 environment, or is it a requirement to recompile under the later version of Java, as above? Thanks!
linked to: http://stackoverflow.com/q/1266940
tagged with: compatibility
downvote count: 0

http://stackoverflow.com/a/24445350
accepted answer of: http://stackoverflow.com/q/24380846
type: Answer
has body: This issue is not coming due to date ....This issue due to character field in table for which i am using char as a data type so i made changes char datatype to TinyInt(1) Now this work fine
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/24380846
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/24337136
answers question: http://stackoverflow.com/q/24336743
has comment: http://stackoverflow.com/comment/37625640
accepted answer of: http://stackoverflow.com/q/24336743
upvote count: 1
type: AcceptedAnswer
has body: The JavaDoc (http://docs.oracle.com/javase/7/docs/api/javax/swing/JOptionPane.html) says: message A descriptive message to be placed in the dialog box. In the most common usage, message is just a String or String constant. However, the type of this parameter is actually Object. Its interpretation depends on its type: ... Component The Component is displayed in the dialog. So the message can be any component, such as a JLabel. You can even add a JPanel with a more complicated layout.
type: Answer
downvote count: 0
score: 1

log4j
tags question: http://stackoverflow.com/q/24426013
tags question: http://stackoverflow.com/q/24277738
tags question: http://stackoverflow.com/q/24295350
tags question: http://stackoverflow.com/q/24401799
tags question: http://stackoverflow.com/q/24308793
tags question: http://stackoverflow.com/q/24287353
tags question: http://stackoverflow.com/q/24406532
tags question: http://stackoverflow.com/q/24380164
tag name: log4j
tags question: http://stackoverflow.com/q/24384498
tags question: http://stackoverflow.com/q/24326167
tags question: http://stackoverflow.com/q/24356319
tags question: http://stackoverflow.com/q/24328618
tags question: http://stackoverflow.com/q/24322573
tags question: http://stackoverflow.com/q/24282600
tags question: http://stackoverflow.com/q/24409475
tags question: http://stackoverflow.com/q/24274369
tags question: http://stackoverflow.com/q/24293213
tags question: http://stackoverflow.com/q/24410984
type: Tag
tags question: http://stackoverflow.com/q/24390740
tags question: http://stackoverflow.com/q/24378925
tags question: http://stackoverflow.com/q/24320158

http://stackoverflow.com/comment/117779662
type: Comment
comment on: http://stackoverflow.com/a/61555391
type: AnswerComment
has text: @EtienneMiret [Hibernate 7 documentation](https://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/?v=7.0#validator-gettingstarted-uel) uses 4.0.0, so it looks like updating to that would indeed let you use an EL 4 implementation. [Hibernate 6 documentation](https://docs.jboss.org/hibernate/validator/6.1/reference/en-US/html_single/#preface) on the other hand uses 3.0.3.
score: 0

http://stackoverflow.com/comment/37666813
type: Comment
type: QuestionComment
has text: @arjun.9990 i didn't copy the project this time but i get 255 errors now. Do you have any idea with an error on downloader_library/res/value-v9?
comment on: http://stackoverflow.com/q/24358837
score: 0

http://stackoverflow.com/comment/37561927
score: 0
type: AnswerComment
type: Comment
has text: of course but usually we try to pass in a known item so its not so much an any() but a when(myclass.checkDate(testDate)).thenReturn(true);
comment on: http://stackoverflow.com/a/24302033

http://stackoverflow.com/comment/37688775
type: QuestionComment
has text: If you're worried about speed, avoid boxing `int`s into `Integer`s.
score: 1
comment on: http://stackoverflow.com/q/24371204
type: Comment

http://stackoverflow.com/comment/37523038
type: Comment
type: QuestionComment
score: 0
has text: And you shouldn't confuse "Java" with "Javascript"...
comment on: http://stackoverflow.com/q/24284507

http://stackoverflow.com/comment/37782343
type: Comment
has text: Actually this is not the problem since it does insert properly after fixing minor syntax issue the major problem is that the image does move to the php script and i can extract while the string parameter i can not extract it :/
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24421032

http://stackoverflow.com/comment/37686123
score: 0
type: Comment
has text: @yanno `getContent` returns an `InputStream`? Was the `InputStream` empty? If it's empty, then there's not much we can do. Anyway, a 500 error is a server error. You'll have to check what happened on the server.
comment on: http://stackoverflow.com/a/24368621
type: AnswerComment

http://stackoverflow.com/comment/37659107
has text: Good point, thank you. Now I'm getting `java.security.NoSuchAlgorithmException: KeyManagerFactory SunX509 implementation not found` guess I'll have to start researching that error. Do I even need the load of keystore method? should I make a keystore?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24355540
type: Comment

tabs
type: Tag
tags question: http://stackoverflow.com/q/24310853
tags question: http://stackoverflow.com/q/24368903
tag name: tabs
tags question: http://stackoverflow.com/q/24327009

http://stackoverflow.com/comment/37609389
score: 0
comment on: http://stackoverflow.com/q/24329883
type: Comment
type: QuestionComment
has text: Not sure of your application or what you want to do // If you want the application to only run on a specific machine, possibly have the application check for a very specific and unique registry value that you set. This way it won't run on another machine without that value set. // Hmm, I guess that is only for windows. // Maybe just have the application prompt for a password on startup?

http://stackoverflow.com/comment/37558936
score: 0
type: Comment
type: QuestionComment
has text: Where does "value1,value2" come from?
comment on: http://stackoverflow.com/q/24303486

publish-subscribe
tags question: http://stackoverflow.com/q/24381439
tag name: publish-subscribe
type: Tag
tags question: http://stackoverflow.com/q/24329007

http://stackoverflow.com/comment/37670398
score: 0
has text: @Gimby the server is fine,but i got error "Firefox can't connect to ws://localhost/Books/websocket.ws" [HTTP/1.1 404 Not Found 6ms] from web console.
type: QuestionComment
comment on: http://stackoverflow.com/q/24361342
type: Comment

http://stackoverflow.com/a/24301022
answers question: http://stackoverflow.com/q/24300325
score: 1
has body: If the string constant is same, then create a Constants file and place that constant there. Use that constant in your multiple class files. like: Constants.CONSTANT_1
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/37779737
comment on: http://stackoverflow.com/q/24407833
has text: Well, that and the fact that you are getting actual pongs in your handler... is quite odd, I mean, it should handle them transparently. I seems a little bit sloppy.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37687325
type: QuestionComment
comment on: http://stackoverflow.com/q/24370799
score: 0
has text: I think it should be definitely possible to have that pointcut at compile time, because your annotations are already containing property value at compile time. Otherwhise I'll have additional if statement executed on any aspect execution (which is not good)
type: Comment

http://stackoverflow.com/comment/37658561
has text: @Paul Alaways happens on the first element (well, 3/3 attempts), gameServers.size is 2.
comment on: http://stackoverflow.com/q/24355246
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37730564
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24393099
has text: I am not doing this to humiliate you, I am trying to be nice guy here. I just pointed that your example wouldn't compile so you could change it to improve your question. I even showed you how you can fix it and explained why problem occurred. What is wrong with that?

http://stackoverflow.com/comment/37658839
comment on: http://stackoverflow.com/a/24355341
has text: Oh I didn't see your edit, but as it is what I need to do, I will accept it!
score: 0
type: AnswerComment
type: Comment

oop
tags question: http://stackoverflow.com/q/24415046
tags question: http://stackoverflow.com/q/24320189
tags question: http://stackoverflow.com/q/24279680
tags question: http://stackoverflow.com/q/24300773
tags question: http://stackoverflow.com/q/24420455
tags question: http://stackoverflow.com/q/24338896
tag name: oop
tags question: http://stackoverflow.com/q/24360375
tags question: http://stackoverflow.com/q/24357895
tags question: http://stackoverflow.com/q/24288709
tags question: http://stackoverflow.com/q/24308447
tags question: http://stackoverflow.com/q/24367472
tags question: http://stackoverflow.com/q/24372365
tags question: http://stackoverflow.com/q/24333645
tags question: http://stackoverflow.com/q/24388787
tags question: http://stackoverflow.com/q/24308363
tags question: http://stackoverflow.com/q/24285532
tags question: http://stackoverflow.com/q/24338524
tags question: http://stackoverflow.com/q/24373315
tags question: http://stackoverflow.com/q/24395090
tags question: http://stackoverflow.com/q/24278021
tags question: http://stackoverflow.com/q/24280292
tags question: http://stackoverflow.com/q/24378375
tags question: http://stackoverflow.com/q/24289070
tags question: http://stackoverflow.com/q/24403019
type: Tag

http://stackoverflow.com/a/24325491
score: 0
answers question: http://stackoverflow.com/q/24325412
type: Answer
has body: PHP is a loosely typed language. Unlike in languages such as Java, you don't need to declare fields in a class in order to use them. By setting the name in the constructor, the field is created and set. If you would remove the constructor or the field-setting in the constructor, the name would not exist when showname() is called.

http://stackoverflow.com/q/24361647
tagged with: heap-corruption
favorite count: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37687688
upvote count: 1
has body: "Everybody" knows heap pollution can cause unexpected ClassCastExceptions. What are other consequences of heap pollution (w.r.t. other types of exceptions, security, performance...)?
score: 1
tagged with: java
type: Question
downvote count: 0
tagged with: heap-memory
has title: Heap pollution consequences

http://stackoverflow.com/comment/37518354
comment on: http://stackoverflow.com/q/24278520
has text: You should have added the class to your original post. I did that for you.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/24269858
has comment: http://stackoverflow.com/comment/37495508
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/37497411
has comment: http://stackoverflow.com/comment/37495554
tagged with: android
has answer: http://stackoverflow.com/a/24270122
has comment: http://stackoverflow.com/comment/37496728
tagged with: android-activity
has comment: http://stackoverflow.com/comment/37495486
has body: One of the requirements of basic Android development (according to the Google docs) is that when you override the activity's lifecycle methods (onCreate, onResume, onPause, etc.), you must call the parent's method first: @Override protected void onResume() { super.onResume(); } Why doesn't the Android API use a non-virtual interface pattern to enforce this behavior, rather than relying on developers to remember to do so?: Android's Activity Base class could look something like this (crude example): public class Activity { public final void onResume() { // do important things here virtualOnResume(); } protected abstract void virtualOnResume(); } Child class written by Android developer: public class MainActivity extends Activity { @Override protected void virtualOnResume() { // do custom stuff here, without needing to call super.onResume() } } I haven't encountered a case where I need to write any instructions prior to calling the super method. Is there any time we should NOT call the super method, or not call it first? If it truly must always be first for any particular method in the life cycle, what was the reason behind the design decision not to use a NVI pattern to enforce it? UPDATE: Been developing for Android for a while now, everyone at work uses my BaseActivity NVI class, and I've still yet to encounter a reason NOT to use an NVI for all lifecycle methods but the onCreate one. It appears that those who answered/commented in defense of the existing API design don't really have a justification, or don't really seem to understand what an NVI pattern is, so I'm going with the assumption that there is no good reason, that it's "just how it is."
has title: Android activity life cycle: why isn't calling the super method first enforced?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37495762
type: Question
tagged with: non-virtual-interface
has comment: http://stackoverflow.com/comment/37496546
tagged with: java
has comment: http://stackoverflow.com/comment/37495360
upvote count: 2
downvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/24270165
has comment: http://stackoverflow.com/comment/37495417

http://stackoverflow.com/a/24272013
accepted answer of: http://stackoverflow.com/q/24271944
has comment: http://stackoverflow.com/comment/37500094
has comment: http://stackoverflow.com/comment/37499961
has comment: http://stackoverflow.com/comment/37500060
upvote count: 2
has comment: http://stackoverflow.com/comment/37500281
type: AcceptedAnswer
has body: Just do one change and everything will work fine. public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new MyCalculatorGUI(); } }); } Use SwingUtilities.invokeLater() to make sure that EDT is initialized properly. Read more Why to use SwingUtilities.invokeLater in main method? SwingUtilities.invokeLater EDIT Some time this.setResizable(false); create issues while re-sizing or packing the components in the JFrame.
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/37500314
downvote count: 0
answers question: http://stackoverflow.com/q/24271944

http://stackoverflow.com/a/24647300
score: 0
answers question: http://stackoverflow.com/q/24308991
type: Answer
has body: You are correct that an element is not evicted until it has expired and has been accessed. Take a look at what the Documentation has to say: If an entry expires but is not accessed, and no resource constraints force eviction, then the expired entry remains in place. Unfortunately while calling getKeysWithExpiryCheck() will only return you keys that have not expired, it will not force eviction of the expired elements. Still in this case, a large number of elements being evicted at once shouldn't lock up your system. Have you taken thread dumps or looked at your GC logs when your system locks up to verify what is slowing everything down?

checkbox
tag name: checkbox
tags question: http://stackoverflow.com/q/24305478
type: Tag

http://stackoverflow.com/a/24393699
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/37730952
upvote count: 1
has body: Short answer: Yes, it should be. Longer answer: You might want to have a look at you MySQL server configuration, specifically max connections. Depending on your use case, I would also suggest you look into Connection pooling (javax.sql.DataSource). Apache DBCP is popular. EVEN if your application typically only use one connection at a time, the pooling implementation will be able to maintain your connection(s) in a live, and connected state (ok, technically it can test and re-open a connection if needed before your app uses it). Dirty secret of production systems: things go wrong. You would do well to cater for it. Good luck!
answers question: http://stackoverflow.com/q/24393617
has comment: http://stackoverflow.com/comment/37731108
has comment: http://stackoverflow.com/comment/37730709
downvote count: 0

http://stackoverflow.com/a/24302698
score: 0
type: Answer
answers question: http://stackoverflow.com/q/24302055
has body: You can say in your Web service interface that all methods throws CustomException. In generated WSDL they will present as fault in operation, then user or service will be in aware that SOAP call may throw an exception. You actual implementation of service will not throw those exceptions, but handler will do.

http://stackoverflow.com/comment/37784865
type: AnswerComment
has text: @user3495562 In what Elliott has called "the second case", it's not so much that when you change `b`, it changes `a` at the same time. That's like saying, "WOW, if I send a letter to Samuel Clemens, then Mark Twain receives one as well". In fact, `a` and `b` end up being two names for the exact same array.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24421906

http://stackoverflow.com/a/24338916
type: Answer
upvote count: 4
has body: You cannot have two varargs as parameters. If you could, how Java would know what String that you are passing corresponds to what parameter? For example: setData("s1", "s2", "s3"); Which Strings would be assigned to which parameter?
has comment: http://stackoverflow.com/comment/37626279
downvote count: 0
has comment: http://stackoverflow.com/comment/37626350
has comment: http://stackoverflow.com/comment/37627892
score: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24338896
answers question: http://stackoverflow.com/q/24338896

http://stackoverflow.com/comment/37557618
has text: Set the layout of the new panel as the same as the panel, it should maintain the layout properties (depending on the layout)
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24301313
type: QuestionComment

http://stackoverflow.com/a/24339622
type: Answer
answers question: http://stackoverflow.com/q/24339414
has body: It is up to the developer whether to create new entities (rows in a table). There is no specific ORM technology for the above scenarios. Creating tables in a database is an additional feature provided by the most of the technologies, providing entities. In this case, you can create respective entity object from the database (as you already have the database) and then insert a new row, update, delete and free to do what ever you want. Thanks, JK
score: 0

http://stackoverflow.com/q/24414716
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: java
tagged with: antlr
type: Question
has body: I'm trying to parse some messages using an ANTLR grammar. Messages carry the structure: :20:REF123456 :72:Some narrative text which may contain new lines and occassionally other : characters :80A:Another field The target output is a table containing the text between the colons as a 'key' and the text until the next key as the value of that key. For example: Key | Values -------------------------------------- 20 | REF123456 72 | Some narrative text which may contain new lines and occassionally other : characters 80 | Another field I'm able to write a grammar to do this, as long as colons are not allowed in the value field based on the following reference http://danielveselka.blogspot.fr/2011/02/antlr-swift-fields-parser.html Can anyone offer guidance on how to approach this problem?
tagged with: grammar
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24415494
tagged with: parsing
has title: ANTLR text containing tokens - SWIFT newline colon

http://stackoverflow.com/comment/37505518
score: 0
type: Comment
type: QuestionComment
has text: Please, format your code properly. It's hard to read.
comment on: http://stackoverflow.com/q/24274919

http://stackoverflow.com/comment/37773144
comment on: http://stackoverflow.com/q/24415823
has text: have you consdiered moving this post to http://codereview.stackexchange.com/?
score: 0
type: Comment
type: QuestionComment

sonar-runner
tags question: http://stackoverflow.com/q/24289291
type: Tag
tag name: sonar-runner
tags question: http://stackoverflow.com/q/24280389

http://stackoverflow.com/q/24372257
downvote count: 0
answer count: 7
score: 1
has comment: http://stackoverflow.com/comment/37689983
favorite count: 0
has answer: http://stackoverflow.com/a/24372405
has body: This may be a very naive question or does not make sense. But i am really confused about implementation of priority queue. Why we cannot use a hashmap with key as priority and value as the data with that priority. Am i missing some basic here. For eg: If priority of A is 1, B is 3 and c is 4 we can simply keep 1,3,4 as keys and A,B,C as values of hashmap respectively for priority queue implementation. Please clear my logic
possible better answer: http://stackoverflow.com/a/24372348
tagged with: priority-queue
has answer: http://stackoverflow.com/a/71928834
has answer: http://stackoverflow.com/a/24372348
has answer: http://stackoverflow.com/a/57203430
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24372375
tagged with: java
has comment: http://stackoverflow.com/comment/37690219
upvote count: 1
accepted answer: http://stackoverflow.com/a/24372405
type: Question
has title: Implementing Priority queue using hashmap
tagged with: hashmap
has answer: http://stackoverflow.com/a/70428819
has comment: http://stackoverflow.com/comment/37690981
has answer: http://stackoverflow.com/a/75650184

http://stackoverflow.com/comment/37638660
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24345248
has text: I can easily switch back to EAGER. But I want to use LAZY because that is the norm. I just don't know what is affecting the application.

http://stackoverflow.com/q/24370336
has body: As a bit of background, I'm using joda DateTime from Scala. It seems that everywhere a Scala developer uses Joda DateTime, they define some implicit datetimeOrdering, which they then import. Each library seems to define its own. Occasionally there are conflicts from having multiple definitions from different libraries in scope. I'm curious if and how the Java library (in this case joda, but it's just an example) might define such an implicit in its Java source code, such that it would compile to equivalent scala bytecode, so that it could be imported in a scala program. I know I can do things like implement def +(x:Whatever):Whatever in Java using $plus(...), but I don't know how I would define an implicit. I'm not a joda developer, just curious how this would work. Obviously joda could include a single scala file in their project, but I'm curious if other options exist. Does defining an implicit in Java require the scala-tools.jar being on the classpath? Can an implicit be defined directly in Java code? What does the implementation of implicit actually look like?
tagged with: bytecode
tagged with: implicit
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/37687014
downvote count: 0
favorite count: 0
has title: how would one define a scala implicit in a java library?
linked to: http://stackoverflow.com/q/7134537
has comment: http://stackoverflow.com/comment/37692216
has comment: http://stackoverflow.com/comment/37690519
answer count: 0
type: UnansweredQuestion
tagged with: scala
tagged with: java
type: Question
tagged with: jodatime

http://stackoverflow.com/a/24376251
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37698452
has body: Draw with a Bitmap: Bitmap mDrawBitmap; Canvas mBitmapCanvas; Paint mDrawPaint = new Paint(); @Override public void onDraw(Canvas canvas) { if (mDrawBitmap == null) { mDrawBitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888); mBitmapCanvas = new Canvas(mDrawBitmap); } // draw on the btimapCanvas //... and more mBitmapCanvas.drawWhatever(...); // after drawing with the bitmapcanvas, //all drawn information is stored in the Bitmap // draw everything to the screen canvas.drawBitmap(mDrawBitmap, 0, 0, mDrawPaint); } In that way, "mDrawBitmap" will always contain the currently drawn state. If you want to, you can clear it by calling mBitmapCanvas.drawColor(Color.WHITE);
type: Answer
accepted answer of: http://stackoverflow.com/q/24376122
answers question: http://stackoverflow.com/q/24376122

http://stackoverflow.com/q/24339080
has comment: http://stackoverflow.com/comment/37627124
tagged with: thread-local
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37645343
score: 1
tagged with: java
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/24340406
upvote count: 1
has body: I was given some code that contains some classes that use TheadLocal. Here is a sample implementation: public class MyClass { public MyClass() { } // Class methods.. private static ThreadLocal&lt;MyClass&gt; factoryCache = new ThreadLocal&lt;MyClass&gt;() { public synchronized MyClass initialValue() { return new MyClass(); } public synchronized MyClass get() { return super.get(); } public synchronized void set(MyClass value) { super.set(value); } }; public static MyClass get() { return factoryCache.get(); } } Notice that in order to use the class the static getter is called: MyClass.get(); This ensure that I get an instance that corresponds to the current running thread. My question - this class contains no members nor static variables, meaning there are no shared objects in the class level. In this case - I'm wondering if the use of ThreadLocal here has any advantage. Let's assume I use this class as a singletone (removing the ThreadLocal part), each thread will create its own stack when entering a method (right?), so is there a point of using ThreadLocal in such a case? Additional info - this is a web application that handles many concurrent http requests and the issued class is used per http request.
type: Question
tagged with: concurrency
has comment: http://stackoverflow.com/comment/37626623
answer count: 1
downvote count: 0
has title: Usage of ThreadLocal when no shared objects exist
has answer: http://stackoverflow.com/a/24340406
has comment: http://stackoverflow.com/comment/37627134
favorite count: 0

http://stackoverflow.com/a/24431495
has comment: http://stackoverflow.com/comment/38408066
type: Answer
has comment: http://stackoverflow.com/comment/37814266
has body: In fact, it looks like this is a Wildfly issue (see WFLY-3474 - NPE in HttpServletResponse.getHeaders). Upgrading to a recent Undertow version (1.1.0.Beta2 +) solves that specific Exception but creates a bigger problem, since Spring Framework websocket module does not yet support this beta version. SPR-11919 should address your first issue. Follow SPR-11914 for the upcoming undertow 1.1 support.
answers question: http://stackoverflow.com/q/24346722
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/37832585
downvote count: 0
has comment: http://stackoverflow.com/comment/37832667

http://stackoverflow.com/a/24296772
has comment: http://stackoverflow.com/comment/37582719
has body: I had prepared a version of this post earlier, but based on your last comment in the other answer, it seems you have already figured it out. I'll posting this anyways, in case it is of any help. The broad answer is that your class, as you currently have it, effectively represents both the client-side AND server-side portions within the same thread / process. As you've seen, you're able to write your data to the outbound (or client-side) socket, but the server-side component never gets a chance to listen for incoming connections. Consequently, when you attempt to read data from the inbound (or server-side) socket's input stream, nothing exists because nothing was received. The readline() method ultimately blocks until data is available, which is why your program seems to hold at that point. Additionally, like haifzhan said, creating a new socket using new Socket(...) doesn't establish the connection, all you have is a socket with nothing in the stream. The ServerSocket#accept method what you need to use in order to listen for connections. This method will create the socket for you, from which you can attempt to read from its stream. Like haifzhan said, that method blocks until a connection is established, which is ultimately why it cannot function properly in a single-threaded environment. To do this within the same application, you'll simply need to separate the components and run them in separate threads. Try something like the following: public class EchoClient { public static void main(String[] args) throws InterruptedException { new Thread(new EchoServer()).start(); // start up the server thread String hostName = "localhost"; int portNumber = 5000; try { Socket outboundSocket = new Socket(hostName, portNumber); System.out.println("Echo client is about to send data to the server..."); PrintWriter writer = new PrintWriter(outboundSocket.getOutputStream()); for (int i = 0; i &lt; 100; i++) { writer.print("test String"); } System.out.println("Data has been sent"); w…
accepted answer of: http://stackoverflow.com/q/24293502
upvote count: 4
has comment: http://stackoverflow.com/comment/37583061
answers question: http://stackoverflow.com/q/24293502
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/37583002

http://stackoverflow.com/comment/54414569
comment on: http://stackoverflow.com/q/24393027
score: 0
has text: Check this out: http://stackoverflow.com/questions/28050986/how-to-avoid-installation-duplicates-using-parse/33306713#33306713
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24311037
tagged with: java
has answer: http://stackoverflow.com/a/24311512
linked to: http://stackoverflow.com/q/13897784
accepted answer: http://stackoverflow.com/a/24311104
has answer: http://stackoverflow.com/a/24311088
has title: Memory allocation is based on reference class or instance class?
has comment: http://stackoverflow.com/comment/37573455
has comment: http://stackoverflow.com/comment/37574161
answer count: 4
possible better answer: http://stackoverflow.com/a/24311088
has body: I have a very dump question in java. The memory allocation for every java object in heap will be based on the reference class or instance class? public static void main(String[] a){ MemoryParent parChild = new MemoryChild(); } In the above example, the memory allocation for the object parChild is based on MemoryChild or MemoryParent? I guess its based on instance class MemoryChild. Could somebody clarify this? Thanks in advance.
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24311104
tagged with: memory-management
has answer: http://stackoverflow.com/a/24311174
upvote count: 2

http://stackoverflow.com/a/24327949
type: Answer
score: 8
has body: When you call new TestNull(); you're calling the constructor of the class TestNull, which it calls the super() constructor: it contains a call to the method implemented in TestNull, where you print the String field, at this time the fields of the sub-class TestNull are not yet initialized, i.e. are null. After the super constructor call, all the fields will be initialized, and therefore the second print actually show the new value of the (initialized) string. The key point here is that fields of a sub-class are initialized after the instantiation of the super-classes. A workaround? It depends on what exact behaviour you desire: maybe it makes sense to NOT call the abstract method in the super constructor (i.e. in the constructor of the TestSuper class).
answers question: http://stackoverflow.com/q/24327834
type: AcceptedAnswer
downvote count: 0
upvote count: 8
accepted answer of: http://stackoverflow.com/q/24327834

http://stackoverflow.com/comment/37507016
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24275724
has text: That statement (question?) doesn't make much sense. Please clarify.
score: 0

http://stackoverflow.com/a/24325703
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24325494
type: Answer
has body: I assume HashSet is the better option to go with. There are two advantages: It doesn't allow duplicates HashSet internally assumes a HashMap, hence retrieval is faster.
score: 1

http://stackoverflow.com/comment/37697580
type: AnswerComment
has text: ok.. but what about when that line is not there (String s). Then it will have nothing to compile and it will crash.
comment on: http://stackoverflow.com/a/24376151
type: Comment
score: 0

http://stackoverflow.com/comment/37523487
comment on: http://stackoverflow.com/a/24280124
score: 0
type: AnswerComment
has text: Thats great. the tutorial will help a lot. However, I'm still confused as to how I actually run my bundle in CQ? Will my OSGi application create a JAR...if so, how do I upload that jar to CQ so it can be used there?
type: Comment

http://stackoverflow.com/comment/37641825
score: 0
has text: MST, can be solved by 4 known solutions but only 3 are relevant for non parallel computation. **Prim**, **Kruskal** and **Inverse Kruskal**. All 3 are solved using `BFS\DFS`. With Prime the solution is using the Vertex in order to solve this issue. While with Kruskal the solution is to Sort the edges weight and then to check for non circular connection, otherwise to remove it else add it.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24346805

http://stackoverflow.com/comment/37770706
has text: (time2.getTime()/(1000*60*60*24l) - time1.getTime()/(1000*60*60*24l)) this works
comment on: http://stackoverflow.com/a/24413999
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/37655868
has text: @BRS You're welcome. Unfortunately, I've never used Jasper Reports with Spring. However, you might want to look into [Open Reports](http://oreports.com/). It's a dead project but you may get some help out of its use of Jasper Reports.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24348301
type: AnswerComment

http://stackoverflow.com/q/24278945
accepted answer: http://stackoverflow.com/a/24279173
downvote count: 0
answer count: 3
tagged with: architecture
favorite count: 0
possible better answer: http://stackoverflow.com/a/24279602
has body: I have the following class: public class A { private String a; private Long b; private Date c; //getters, setters, constructors } And I need to be able to export it as an excel with different templates. For example, one excel has the following headers: a b c Another excel has the following template: b a c And another template could look like this: b a What would be a good way to design the code so that I could format the A object according to one template or another? Is there a particular design pattern I can look at?
has comment: http://stackoverflow.com/comment/37512882
has answer: http://stackoverflow.com/a/24279602
upvote count: 1
tagged with: design-patterns
has answer: http://stackoverflow.com/a/24279160
type: AnsweredQuestion
score: 1
has title: What design pattern would fit my needs?
tagged with: java
has answer: http://stackoverflow.com/a/24279173
type: Question

http://stackoverflow.com/comment/37558316
has text: This is my [rule file](http://pastebin.com/G4pz0w2t).So I need to read as u suggested instaed of storing simply storing them to list.
type: Comment
comment on: http://stackoverflow.com/a/24281974
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37536990
type: QuestionComment
score: 0
has text: I have explored the faulty jdk but it doesn't resolve my error
comment on: http://stackoverflow.com/q/24291064
type: Comment

http://stackoverflow.com/q/24362247
tagged with: dependency-injection
tagged with: guice
answer count: 1
score: 0
has title: Using google-guice with out bind code
has answer: http://stackoverflow.com/a/24363821
has body: Is the any way to bind classes not via code: bind(MessageService.class).to(FacebookService.class); Injector injector = Guice.createInjector(new AppInjector()); But with some annotation?
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/24363821
type: Question

http://stackoverflow.com/q/24366204
answer count: 0
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
has body: I am currently experiencing a problem that is very similar to the one discussed here Hibernate triggering constraint violations using orphanRemoval Unfortunately I get a SqlException - Column cannot be null error. My entities are as follows: CallDetail @OneToMany(mappedBy = "callDetail", cascade = CascadeType.ALL, orphanRemoval = true) private Set&lt;CallCycleDetail&gt; callCycles; public void addCallCycleDetail(CallCycleDetail callCycleDetail) { if (this.callCycles == null) { this.callCycles = new HashSet&lt;CallCycleDetail&gt;(); } callCycles.add(callCycleDetail); callCycleDetail.setCallDetail(this); } public void removeCallCycleDetail(CallCycleDetail callCycleDetail) { callCycles.remove(callCycleDetail); callCycleDetail.setCallDetail(null); } CallCycleDetail @ManyToOne(optional=false) @JoinColumn(name = "call_detail", nullable=false) private CallDetail callDetail; My JUnit test is as follows: CallDetail callDetail = createCallDetail(); CallCycleDetail ccd = new CallCycleDetail(callDetail); callDetail.addCallCycleDetail(ccd); callDetailService.saveCallDetail(callDetail); callDetail = callDetailService.findCallDetail(callDetail.getId()); callDetail.removeCallCycleDetail(ccd); callDetailService.updateCallDetail(callDetail); It saves correctly. However when I try to clear the set of callCycles, it fails with the Notnull constraint. How can I fix this?
has title: Delete child objects when removed from parent collection
has comment: http://stackoverflow.com/comment/37679003
type: Question
linked to: http://stackoverflow.com/q/3068817
has comment: http://stackoverflow.com/comment/37678669
has comment: http://stackoverflow.com/comment/37679972
tagged with: junit
tagged with: jpa-2.0
score: 0
has comment: http://stackoverflow.com/comment/38318480
has comment: http://stackoverflow.com/comment/37679259

http://stackoverflow.com/q/24380857
has answer: http://stackoverflow.com/a/24381768
possible better answer: http://stackoverflow.com/a/24389956
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24389956
score: 1
tagged with: spring-data
upvote count: 1
type: Question
has body: Spring is throwing java.lang.NoSuchMethodError: org.springframework.data.util.ClassTypeInformation.from(Ljava/lang/Class;)Lorg/springframework/data/util/ClassTypeInformation; at org.springframework.data.elasticsearch.core.MappingBuilder.isEntity(MappingBuilder.java:260) at org.springframework.data.elasticsearch.core.MappingBuilder.mapEntity(MappingBuilder.java:97) at org.springframework.data.elasticsearch.core.MappingBuilder.buildMapping(MappingBuilder.java:70) at org.springframework.data.elasticsearch.core.ElasticsearchTemplate.putMapping(ElasticsearchTemplate.java:156) at org.springframework.data.elasticsearch.repository.support.AbstractElasticsearchRepository.putMapping(AbstractElasticsearchRepository.java:84) at org.springframework.data.elasticsearch.repository.support.AbstractElasticsearchRepository.&lt;init&gt;(AbstractElasticsearchRepository.java:73) at org.springframework.data.elasticsearch.repository.support.NumberKeyedRepository.&lt;init&gt;(NumberKeyedRepository.java:36) at org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactory.getTargetRepository(ElasticsearchRepositoryFactory.java:73) at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:147) at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:162) at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:44) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102) at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1442) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(…
tagged with: java
accepted answer: http://stackoverflow.com/a/24381768
has title: Spring Data java.lang.NoSuchMethodError
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/37706173
favorite count: 0
tagged with: elasticsearch
tagged with: spring
tagged with: spring-data-elasticsearch

http://stackoverflow.com/a/24422360
downvote count: 0
type: Answer
has body: Since sample1 and sample2 are just modifying their own local variables i and j (not those of the calling method), it's clearer if we rewrite them without those modifications: private static int sample1(int i) { return i; // was 'i++', which evaluates to the old i } private static int sample2(int j) { return j + 1; // was '++j', which evaluates to j after incrementing } At which point it's straightforward to just substitute them in place &mdash; sample1(...) becomes ..., and sample2(...) becomes ... + 1: int i = 0; int j = 0; System.out.println(i++); System.out.println(++i); System.out.println((j++) + 1); System.out.println((++j) + 1); System.out.println(i); System.out.println(j); We can make this a bit clearer by separating the incrementations into their own commands. i++ evaluates to the original value of i, so it's like incrementing i after running the surrounding command; ++i, by contrast, is like incrementing i before running the surrounding command. So we get: int i = 0; int j = 0; System.out.println(i); i++; ++i; System.out.println(i); System.out.println(j + 1); j++; ++j; System.out.println(j + 1); System.out.println(i); System.out.println(j); . . . at which point it should be straightforward to trace through and see what it will output. Does that all make sense?
score: 16
upvote count: 16
has comment: http://stackoverflow.com/comment/37784244
has comment: http://stackoverflow.com/comment/37784278
has comment: http://stackoverflow.com/comment/37785069
answers question: http://stackoverflow.com/q/24422298

http://stackoverflow.com/comment/37659299
type: Comment
has text: See the server log to see exactly why the server cannot process your request. Then, update your question with the server log.
comment on: http://stackoverflow.com/a/24355020
type: AnswerComment
score: 0

http://stackoverflow.com/a/24353687
has comment: http://stackoverflow.com/comment/37655214
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24353217
type: Answer
answers question: http://stackoverflow.com/q/24353217
score: 0
has body: First you should allways close what you have opened. So in populateRegistration() do not forget rs.close() and pst.close(). Next to reference the ? to the vehReg, you create a PreparedStatement and call its setString method (supposing vehReg is a String). pst = conn.prepareStatement(newQuery); pst.setString(1, vehReg); rs = pst.executeQuery(); (try, catch, declarations, and actual read ommitted for brevity) Remember that columns are numbered starting by 1.

http://stackoverflow.com/comment/37697389
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24371825
has text: Thank you. I'll check in linguistics.stackexchange.com. And currently I'm using Gate Embedded to identify person names etc. But I want to move to another method to identify comman nouns as the above example.
score: 0

http://stackoverflow.com/q/24286713
has body: I would like to know how I would go about writing this summation equation in java. But, the trick is, I need the summation to be equal to an amount. x= Total Loss Streak amount sb= Starting Bet m= multiplier The whole equation will equal to the current amount of currency in one's account. The amount of times the summation can complete itself while adding up needs to be less than or equal to the amount of currency in ones account. Fyi, this is for a dicebot that work's on peerbet.org and I want to be able to show the user how many times he can loose in a row without wasting all his money. If this question is bad, please do not answer it and let me delete it. Also, it thought the middle part was code, so I had to put it as such or it wouldn't let me post.
tagged with: java
downvote count: 2
accepted answer: http://stackoverflow.com/a/24286879
possible better answer: http://stackoverflow.com/a/24286812
type: Question
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/37534902
upvote count: 5
tagged with: math
tagged with: calculus
answer count: 3
has comment: http://stackoverflow.com/comment/37527391
favorite count: 0
has title: Summation equation in Java?
has comment: http://stackoverflow.com/comment/37527220
has answer: http://stackoverflow.com/a/24286879
has answer: http://stackoverflow.com/a/24290197
has answer: http://stackoverflow.com/a/24286812

http://stackoverflow.com/comment/37630621
type: Comment
has text: I just updated my above comment, explaining how to do.
comment on: http://stackoverflow.com/a/24341350
score: 0
type: AnswerComment

macos
tags question: http://stackoverflow.com/q/24384979
tags question: http://stackoverflow.com/q/24312260
tags question: http://stackoverflow.com/q/24323115
tags question: http://stackoverflow.com/q/24275633
tags question: http://stackoverflow.com/q/24348535
tags question: http://stackoverflow.com/q/24342886
tags question: http://stackoverflow.com/q/24287538
tags question: http://stackoverflow.com/q/24321306
tags question: http://stackoverflow.com/q/24412503
tags question: http://stackoverflow.com/q/24363770
type: Tag
tags question: http://stackoverflow.com/q/24329410
tags question: http://stackoverflow.com/q/24416608
tags question: http://stackoverflow.com/q/24325334
tag name: macos

http://stackoverflow.com/a/24362738
has body: there are 2 approaches to this 1) if the number of opening and closing brackets are always going to be equal, then you can just track the last closing bracket by using a for loop. 2) if you are not sure about opening and closing brackets to be equal, then you can so the following--> public class RoundParser { public static String parseRound(String text) { text = text.toUpperCase(); String result; char[] ch = text.toCharArray(); int count=0,pos=0; int c[10]; for(int i=0;i&lt;ch.length;i++){ if(ch[i].equals("(")){ count++; if(ch[i-1].equals("D")){ c[pos]=count; //will store the count value at every opening round pos++; } } if(ch[i].equals(")")){ count--; for(int j=0;j&lt;10;j++){ if(c[j]==count) //if the closing of round had been encountered ch[i]="#"; } } } text = String.valueOf(ch); result = text; return result; } public static void main(String[] args) { String text = "=ROUND(IF(AND($BY18=2);CA18*CB18/$M$11;IF($BY18=3;CA18*CB18/$M$10;IF($BY18=4;ROUND(CA18*CB18;$M$10)/$M$9;CA18*CB18)))/$M$12;$M$11)"; System.out.println(parseRound(text)); } } there you go. i think this should work. hope this helps.
has comment: http://stackoverflow.com/comment/37746392
has comment: http://stackoverflow.com/comment/37676630
has comment: http://stackoverflow.com/comment/37672173
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24362335
downvote count: 0
has comment: http://stackoverflow.com/comment/37701881
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/24362335

http://stackoverflow.com/comment/37776737
score: 0
has text: Where's the duplicate? What exactly were you doing in the UI when this message appeared? What kind of project is it?
comment on: http://stackoverflow.com/q/24416569
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37678228
type: Comment
type: QuestionComment
has text: Way too complicated? How so? Detecting collisions is not trivial...the physics are what they are.
comment on: http://stackoverflow.com/q/24365990
score: 0

http://stackoverflow.com/q/24406694
has comment: http://stackoverflow.com/comment/37756316
tagged with: java
downvote count: 2
type: Question
tagged with: lucene
has body: I'm new to text search and I'm studying some examples related to lucene. I found one of the example from this link. http://javatechniques.com/blog/lucene-in-memory-text-search-example/ I tried it in my eclipse IDE. But it gives some errors. I imported all the relevent jar files as well. Here Is the code : public class InMemoryExample { public static void main(String[] args) { // Construct a RAMDirectory to hold the in-memory representation // of the index. RAMDirectory idx = new RAMDirectory(); try { // Make an writer to create the index IndexWriter writer = new IndexWriter(idx, new StandardAnalyzer(Version.LUCENE_48), IndexWriter.MaxFieldLength.LIMITED); // Add some Document objects containing quotes writer.addDocument(createDocument("Theodore Roosevelt", "It behooves every man to remember that the work of the " + "critic, is of altogether secondary importance, and that, " + "in the end, progress is accomplished by the man who does " + "things.")); writer.addDocument(createDocument("Friedrich Hayek", "The case for individual freedom rests largely on the " + "recognition of the inevitable and universal ignorance " + "of all of us concerning a great many of the factors on " + "which the achievements of our ends and welfare depend.")); writer.addDocument(createDocument("Ayn Rand", "There is nothing to take a man's freedom away from " + "him, save other men. To be free, a man must be free " + "of his brothers.")); writer.addDocument(createDocument("Mohandas Gandhi", "Freedom is not worth having if it does not connote " + "freedom to err.")); // Optimize and close the writer to finish building the index writer.optimize(); writer.close(); // Build an IndexSearcher using the in-memory index Searcher searcher = new IndexSearcher(idx); // Run some queries search(searcher, "freedom"); search(searcher, "free"); search(searcher, "progress or achievements"); searcher.close(); } catch (IOException ioe) { // In this example we aren't really doing an I/O, so this // exception shou…
has title: Error in Lucene text Search
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/24408344
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37755930
score: -2
tagged with: text-search

http://stackoverflow.com/a/24377866
type: Answer
accepted answer of: http://stackoverflow.com/q/24377840
has comment: http://stackoverflow.com/comment/37733105
has comment: http://stackoverflow.com/comment/37726746
has body: You can reduce the memory when you decode the image in your BitmapFactory.Options through skipping ARGB_8888 and using RGB_565 instead. and inDither to true to preserve image quality. sample: BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inJustDecodeBounds = false; opts.inPreferredConfig = Config.RGB_565; opts.inDither = true;
upvote count: 18
has comment: http://stackoverflow.com/comment/37734164
answers question: http://stackoverflow.com/q/24377840
type: AcceptedAnswer
downvote count: 0
score: 18

http://stackoverflow.com/comment/37645991
type: Comment
type: QuestionComment
has text: http://stackoverflow.com/questions/24256469/replacing-contents-inside-curly-braces-for-e-g-1-with-something-else?noredirect=1#comment37470934_24256469 might help
score: 0
comment on: http://stackoverflow.com/q/24349100

http://stackoverflow.com/q/24394637
type: Question
has comment: http://stackoverflow.com/comment/37732661
has answer: http://stackoverflow.com/a/24395160
has body: I am working on implementing an algorithm and testing it on medium-sized data in Spark (the Scala interface) on a local node. I am starting with very simple processing and I'm getting java.lang.OutOfMemoryError: Java heap space even though I'm pretty sure the data isn't big enough for such an error to be reasonable. Here is the minimal breaking code: import org.apache.spark.rdd.RDD import org.apache.spark.{SparkContext, SparkConf} val conf = new SparkConf() .setMaster("local[4]") .setAppName("AdultProcessing") .set("spark.executor.memory", "1g") val sc = new SparkContext(conf) val dataFile = "data/census/processed/census-income.data" val censusData: RDD[String] = sc.textFile(dataFile, 4) val censusDataPreprocessed = censusData.map { row =&gt; val separators: Array[Char] = ":,".toCharArray row.split(separators) } val res = censusDataPreprocessed.collect() the data I'm using is the classic census data, uncompressed. It's 100MB and almost 200k rows. The amount of memory on my machine should be more than sufficient: nietaki@xebab$ free -tm total used free shared buffers cached Mem: 15495 12565 2929 0 645 5608 -/+ buffers/cache: 6311 9183 Swap: 3858 0 3858 Total: 19354 12566 6788 The chunks of the data file are under 30MB for each of the virtual nodes and the only processing I'm performing is splitting row strings into arrays of under 50 items. I can't believe this operation alone should use up the memory. While trying to debug the situation I have found that reducing the number of nodes to 1, or, alternatively, increasing the SparkContext.textFile()'s minPartitions argument from 4 to 8 for example cures the situation, but it doesn't make me any wiser. I'm using Spark 1.0.0 and Scala 2.10.4. I am launching the project directly from sbt: sbt run -Xmx2g -Xms2g.
upvote count: 3
tagged with: apache-spark
has comment: http://stackoverflow.com/comment/37732548
answer count: 1
downvote count: 0
favorite count: 0
has title: Spark OutOfMemory error on small text data
type: UnansweredQuestion
tagged with: scala
linked to: http://stackoverflow.com/q/21138751
score: 3
has comment: http://stackoverflow.com/comment/37732745
tagged with: java

http://stackoverflow.com/comment/37710044
type: AnswerComment
score: 0
type: Comment
has text: Still no luck. Then how jconsole is able to connect using local process and pid. And I am able to see all these properties on **jconsole->MBeans->java.lang->Runtime->Attributes->System Properties**. And instead of grails 2.4.0, I tried my approach on grails 2.0.4 also and there also I am not able to connect using remote process option.
comment on: http://stackoverflow.com/a/24365530

http://stackoverflow.com/comment/37754027
has text: `toString` is supposed to be a string representation of a specific instance of your class - why would you want static fields to be included?
score: 5
comment on: http://stackoverflow.com/q/24406268
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24459665
has body: After further digging and decompiling the 3rd party code the behavior is a bit more clear. The main application (MyApp) used a JTable. A cell withinb JTable uses a custom cell editor (MyEditor). The custom cell editor (MyEditor) used a 3rd Party object to do the editing (3rdPartyObj_1) The 3rd Party object (3rdParyObj_1) extends another 3rd Party object (3rdPartyObj_2) The 3rd Party object (3rdParyObj_2) extends JComponent. The 3rd Party object (3rdParyObj_2) processes the call: processKeyEvent as well as calls: super.processKeyEvent The code listed in the original post is placed within the MyEditor object. As a test, I created my own class My_JComponent and extended JComponent. The method is processKeyEvent which doesn't do anything. (Sure I could have simply commented out the call to super but this allowed me to play around further.) If JComponent prevented from calling processKeyEvent then all works as expected where the cursor key movement moves between characters in edit mode. Essentially I don't even need the above code. It almost appears as JComponent is processing the arrow key as a tab key automatically or as default processing.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24398352

jaxb
tags question: http://stackoverflow.com/q/24369337
tags question: http://stackoverflow.com/q/24391258
tags question: http://stackoverflow.com/q/24342833
tags question: http://stackoverflow.com/q/24303474
tags question: http://stackoverflow.com/q/24271518
tags question: http://stackoverflow.com/q/24385553
tags question: http://stackoverflow.com/q/24390387
tags question: http://stackoverflow.com/q/24288080
tags question: http://stackoverflow.com/q/24282862
tags question: http://stackoverflow.com/q/24305686
tags question: http://stackoverflow.com/q/24416905
tags question: http://stackoverflow.com/q/24286013
tags question: http://stackoverflow.com/q/24341117
tags question: http://stackoverflow.com/q/24391864
tags question: http://stackoverflow.com/q/24270025
type: Tag
tag name: jaxb
tags question: http://stackoverflow.com/q/24307106
tags question: http://stackoverflow.com/q/24278842
tags question: http://stackoverflow.com/q/24366814
tags question: http://stackoverflow.com/q/24324928
tags question: http://stackoverflow.com/q/24373027
tags question: http://stackoverflow.com/q/24276404
tags question: http://stackoverflow.com/q/24301427
tags question: http://stackoverflow.com/q/24329603
tags question: http://stackoverflow.com/q/24413359
tags question: http://stackoverflow.com/q/24391145
tags question: http://stackoverflow.com/q/24327029
tags question: http://stackoverflow.com/q/24405059
tags question: http://stackoverflow.com/q/24322095
tags question: http://stackoverflow.com/q/24407360
tags question: http://stackoverflow.com/q/24277513
tags question: http://stackoverflow.com/q/24353871
tags question: http://stackoverflow.com/q/24305851
tags question: http://stackoverflow.com/q/24402963

http://stackoverflow.com/q/24297191
type: UnansweredQuestion
has body: I was wondering if someone could help me come to a conculiton with this problem... "Print all ordered 3 tuples (i,j,k) i in 0..(n-1), j in 0 .. (n-1), k in 0..(n-1), in lexicographical order, one 3 tuple per line. Lexicographical order (think about words in a dictionary), orders sequences: the first UNEQUAL element in the two sequences determines the order, e.g.: (0,1,5,3) &lt; (0,1,6,0). Format: open-paren number comma number comma number close-paren. Use the print3Tuple() method provided to print, so that we all print in the same format. (Think about this: how would you have to change your code to print 4-tuples, 5-tuples, k-tuples?) Example: for n=2, your output should be" so i have two methods and i'm stuck on my loops... public void print3Tuple(int a, int b, int c) { System.out.println("(" +a+ "," +b+ "," +c+ ")" ); } and then the one i'm working in public void print3Tuples(int n) { // Replace this body with your solution for (int i = 0; i &lt; n; i++) { for (int j = i; j &lt; n; j++) { for (int k = j; k &lt; n; k++) { print3Tuple(i, j, k); } } } which prints this (0,0,0) (0,0,1) (0,1,1) (1,1,1) and i need this (0,0,0) (0,0,1) (0,1,0) (0,1,1) (1,0,0) (1,0,1) (1,1,0) (1,1,1) i'm stuck any help would be appreciated.
has comment: http://stackoverflow.com/comment/37547659
has comment: http://stackoverflow.com/comment/37547614
has title: Print all ordered 3 tuples
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: for-loop
tagged with: arrays
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/37547916
favorite count: 0
has answer: http://stackoverflow.com/a/24297673

http://stackoverflow.com/q/24334967
tagged with: swing
has answer: http://stackoverflow.com/a/24335242
has body: how can I show a JProgressBar component like on the loading of a bin file? I can only found solutions for iterative bin read and I'm using an object reading like: CustomObj test = (CustomObj) in.readObject(); Cheers
tagged with: java
has answer: http://stackoverflow.com/a/24336293
type: Question
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24335092
tagged with: loading
has title: Progressbar of a bin file loading
type: UnansweredQuestion
tagged with: bin

http://stackoverflow.com/q/24301864
upvote count: 1
has body: I have just started android app development..and while opening the following app it says "Unfortunately your app has crashed". Can anyone point out the error in this code. fragmentmain.xml &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:background="#ffffbb" android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="85dp" android:text="Info of Departments and Student Bodies" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;ListView android:id="@+id/listView" android:layout_width="match_parent" android:layout_height="190dp" &gt; &lt;/ListView&gt; &lt;/LinearLayout&gt; MainActivity.java public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //adding items to list view final ListView listview = (ListView) findViewById(R.id.listView); String values[] = new String[]{"Departments" , "Student_bodies"}; final ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); for (int i=0 ; i &lt; values.length; ++i){ list.add(values[i]); } ArrayAdapter&lt;String&gt; ap = new ArrayAdapter&lt;String&gt; (this,android.R.layout.simple_list_item_1,values); listview.setAdapter(ap); listview.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { if (((TextView)arg1).getText().toString() == "Departments"){ startActivity(new Intent(MainActivity.this,Departments.class)); } if (((TextView)arg1).get…
has comment: http://stackoverflow.com/comment/37556121
type: Question
has comment: http://stackoverflow.com/comment/37556595
answer count: 2
accepted answer: http://stackoverflow.com/a/24301991
has comment: http://stackoverflow.com/comment/37556225
downvote count: 0
has comment: http://stackoverflow.com/comment/37556125
has title: Android app crashing on startup
possible better answer: http://stackoverflow.com/a/24302003
favorite count: 0
has answer: http://stackoverflow.com/a/24302003
linked to: http://stackoverflow.com/q/23653778
has comment: http://stackoverflow.com/comment/37556212
tagged with: android
has answer: http://stackoverflow.com/a/24301991
duplicate of: http://stackoverflow.com/q/23653778
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/37545631
has text: private String getStatusField(ResultSet resultSet) throws SQLException{ int columnCount = resultSet.getMetaData().getColumnCount(); for (int i = 1; i < columnCount; i++) { if(resultSet.getMetaData().getColumnLabel(i).startsWith("STATUS")) return resultSet.getMetaData().getColumnLabel(i); } return null; }
comment on: http://stackoverflow.com/a/24292784
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43505166
score: 1
has text: Ever get this working? I have the exact same issue at the moment with the similar swagger / cxf setup.
comment on: http://stackoverflow.com/q/24414007
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37745766
comment on: http://stackoverflow.com/a/24401198
score: 0
type: AnswerComment
type: Comment
has text: You could pass the `Reader` through a `InputSource` and allow the `DocumentBuilder` to parse the content.

buildpath
type: Tag
tags question: http://stackoverflow.com/q/24289387
tags question: http://stackoverflow.com/q/24274409
tag name: buildpath

http://stackoverflow.com/comment/37592873
comment on: http://stackoverflow.com/q/24321098
type: Comment
type: QuestionComment
score: 0
has text: @laune: Hi,this doesn't matter for this example. If I don't call "close", the ".lck" file will left over, after the application has stopped, but this is not the point, because this could also happens, when the application or the whole system crashes. In Java 7, the Filehandler detects in this case the existing lck-File and checks, whether it can lock it. If not, the file is in use by another process and the %u-counter gets incremented, but if yes, it consider this file as an left over from a previous, no more running process and uses the existing lock file.

http://stackoverflow.com/comment/37544646
has text: and what is your problem ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24295487

jdialog
type: Tag
tags question: http://stackoverflow.com/q/24387395
tag name: jdialog
tags question: http://stackoverflow.com/q/24313160
tags question: http://stackoverflow.com/q/24387971

http://stackoverflow.com/comment/37590946
has text: @user280655 Eclipse is open source,the ADT plugin is the one which would cause such issues.The eclipse that you use is open source and can be used to program in several languages.It is not upto such a multipurpose IDE to check these things.ADT is responsible for the same.Next time take it by default that if you're R file doesnt compile.Its an error with your resources.So check them thoroughly and then clean the project.This is the general procedure if your R file does not generate
comment on: http://stackoverflow.com/a/24319628
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24373877
has comment: http://stackoverflow.com/comment/37693646
upvote count: 1
downvote count: 1
type: Question
has body: I have an array list declared as such: ArrayList&lt;ArrayList&lt;String&gt;&gt; data = new ArrayList&lt;ArrayList&lt;String&gt;&gt;; I have filled the inner array list with Strings that i parsed out of a text file. I will later add all of the array lists to a database. After i first parse through and add data to the inner array list, i then want to go in and add additional data that can't be found in the files that i am parsing. Here is the code i have tried but it is not working: void SpecialOperations(ArrayList&lt;ArrayList&lt;String&gt;&gt; data) { for(ArrayList&lt;String&gt; sub: data){ String ip = sub.get(0); //System.out.println(sub.get(0)); sub.add(1,ip); } } In this example, the first element in the row is an IP address. I am trying to add the same exact IP address to the second element and push the rest of the data right. (There will be two of the same IP addresses next to each other). I plan on padding the IP address later but just want to get it added first. I know that before i send my 2d ArrayList to "SpecialOperations" it is filled with valid data, because i can loop through it and it prints out the correct data, so i know its not an issue of empty data. Edit: I have not used many other data types for lists other than Array Lists before. I've used hash maps and tree maps but not much. If this is not the right approach could you explain how i could use a different one? Edit2: The question auto linked where it says mine is already answered doesnt answer mine. I know how to add to the middle. I think there is something wrong with how i'm implememnting my 2d ArrayList.
answer count: 2
has answer: http://stackoverflow.com/a/24374080
has comment: http://stackoverflow.com/comment/37693582
tagged with: arrays
has comment: http://stackoverflow.com/comment/37693457
linked to: http://stackoverflow.com/q/7074402
has comment: http://stackoverflow.com/comment/37693688
has comment: http://stackoverflow.com/comment/37693898
score: 0
has comment: http://stackoverflow.com/comment/37693386
has comment: http://stackoverflow.com/comment/37694287
has comment: http://stackoverflow.com/comment/37693600
has title: How can i add elements to the middle of pre existing 2D Arrays in java?
has comment: http://stackoverflow.com/comment/37693789
favorite count: 0
has comment: http://stackoverflow.com/comment/37693411
has comment: http://stackoverflow.com/comment/37693522
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37694035
tagged with: 2d
has comment: http://stackoverflow.com/comment/37694218
tagged with: java
has answer: http://stackoverflow.com/a/24374581

http://stackoverflow.com/q/24378680
tagged with: loops
type: Question
tagged with: arrays
accepted answer: http://stackoverflow.com/a/24378847
has answer: http://stackoverflow.com/a/24378741
score: 0
answer count: 3
tagged with: min
has body: I'm trying to find the lowest time in minutes of the array int [] times, but I can't figure out how to make the second method work; I'm not getting any output. public static void main(String[] arguments) { String[] names = { "Elena", "Thomas", "Hamilton", "Suzie", "Phil", "Matt", "Alex", "Emma", "John", "James", "Emily", "Daniel", "Neda", "Aaron", "Kate" }; int[] times = { 321, 273, 278, 329, 445, 402, 388, 275, 243, 334, 412, 393, 299, 343, 317, 265 }; for (int i = 0; i &lt; names.length; i++) System.out.println(names[i] + ":" + times[i]); } I don't know what it's missing but i know i should get the lowest time in minutes: which is 243 (int [] times). I "believe" i need to pass the int time values from the first method to the second method...since i feel the second method array is empty. However, that, i don't know how to do. Help? public static int getMinIndex(int[] values) { int minValue = Integer.MAX_VALUE; int minIndex = -1; for (int i = 0; i &lt; values.length; i++) if (values[i] &lt; minValue) { minValue = values[i]; minIndex = i; } return minIndex; //not returning anything. }
has comment: http://stackoverflow.com/comment/37702139
possible better answer: http://stackoverflow.com/a/24378741
has title: How do I pass int values from one method to another
has answer: http://stackoverflow.com/a/24378781
has answer: http://stackoverflow.com/a/24378847
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37702140
tagged with: return-value
tagged with: java

http://stackoverflow.com/comment/37679786
score: 0
type: AnswerComment
has text: Im not sure if it's really an improvement calculating every time if it's higher then, instead of counting if it's an uppercase
comment on: http://stackoverflow.com/a/24366720
type: Comment

http://stackoverflow.com/comment/50427093
type: Comment
comment on: http://stackoverflow.com/a/31189839
has text: I just tested it on AIDE and I can confirm it works! Thanks bro, thank you very much! :-D
score: 1
type: AnswerComment

http://stackoverflow.com/comment/37510873
comment on: http://stackoverflow.com/a/24267510
type: AnswerComment
score: 0
type: Comment
has text: Thanks for the solution, i'm able to add 'String' and 'Node' into hashmap. I have two hashmaps of the same structure. Want to compare the hashmaps based on 'Key(String)' and get the node attributes respectively.

http://stackoverflow.com/a/24349205
score: 0
type: Answer
has body: Try this: EditText text = new EditText(this); text.setText(Html.fromHtml(html)); text.setMovementMethod(LinkMovementMethod.getInstance());
answers question: http://stackoverflow.com/q/24349137

http://stackoverflow.com/comment/37745576
type: QuestionComment
comment on: http://stackoverflow.com/q/24401612
score: 0
has text: I think you have to tests your ideas. It depends the processing actions you want to do.
type: Comment

activemq-classic
tags question: http://stackoverflow.com/q/24302935
tags question: http://stackoverflow.com/q/24417440
tags question: http://stackoverflow.com/q/24385942
tags question: http://stackoverflow.com/q/24370041
tags question: http://stackoverflow.com/q/24303048
tag name: activemq-classic
tags question: http://stackoverflow.com/q/24361066
type: Tag

http://stackoverflow.com/comment/37760464
type: Comment
comment on: http://stackoverflow.com/a/24406046
type: AnswerComment
has text: So, can't we supply a String with space in between, when using Scanner
score: 0

http://stackoverflow.com/a/24313979
upvote count: 2
has body: You can use replaceAll("(?:^\\s+|\\s+$)|\\s+(\\s)", "$1") or simpler since we don't actually need non-capturing-group (?:XXX) here replaceAll("^\\s+|\\s+$|\\s+(\\s)", "$1") Idea is to replace one or more spaces that are not at start or end of your string with only one space, so we will use last space from that match (placed in group 1). If spaces will be placed at start or end of string we don't want group 1 to contain anything so we just write them in different cases regex will need to check (we can use OR |). Important part is to place these special cases before case with group because regex engine will try to match cases from left to right. Demo String mystring = " brains T1* C+ "; System.out.println("&gt;"+mystring.replaceAll("^\\s+|\\s+$|\\s+(\\s)", "$1")+"&lt;"); Output: &gt;brains T1* C+&lt;
answers question: http://stackoverflow.com/q/24313835
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/24350683
favorite count: 0
accepted answer: http://stackoverflow.com/a/24350761
has comment: http://stackoverflow.com/comment/37649228
upvote count: 4
has answer: http://stackoverflow.com/a/24350742
answer count: 4
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/24350761
has comment: http://stackoverflow.com/comment/37649176
has comment: http://stackoverflow.com/comment/37649125
possible better answer: http://stackoverflow.com/a/24351212
has answer: http://stackoverflow.com/a/24350877
has body: What is the standard approach/best practice to creating variables that are program- or package-wide in Java? I want to set up some global variables that are accessible by multiple classes. Examples of these global variables would be things like a boolean flag testModeOn, a language setting, current local server, time display format, etc. According to some other questions (namely this one) there aren't any global variables, but there are some work-arounds using interfaces (not recommended?) or classes. Since the original poster didn't explain their situation, they got nearly every answer under the sun and I want to ask specifically for program configuration variables. Is it better to create a class/package/interface and then import it into my working class/package? Is there anything I should be aware of when trying to implement these variables using a separate class or interface? Is there any other way to fudge package-level variables since Java apparently doesn't do this natively? NOTE: These variables would probably not change except when the program is re-compiled.
has answer: http://stackoverflow.com/a/24351212
type: Question
linked to: http://stackoverflow.com/q/3931329
linked to: http://stackoverflow.com/q/4646577
has comment: http://stackoverflow.com/comment/37649098
tagged with: java
has comment: http://stackoverflow.com/comment/37649036
has comment: http://stackoverflow.com/comment/37649219
tagged with: global-variables
linked to: http://stackoverflow.com/q/2659593
has title: Java - best practice for creating package-wide or global variables
tagged with: variables
score: 4

http://stackoverflow.com/comment/37749178
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24387037
has text: thanks stripybadger for you support...Its really useful :)
type: AnswerComment

http://stackoverflow.com/q/24344083
tagged with: ejb
tagged with: javabeans
score: 0
has answer: http://stackoverflow.com/a/24362457
has title: ArrayList not persisting between methods
answer count: 1
accepted answer: http://stackoverflow.com/a/24362457
has comment: http://stackoverflow.com/comment/37636091
has comment: http://stackoverflow.com/comment/37636040
type: AnsweredQuestion
has body: I'm trying to load a csv file into an arrayList to later break it up and store it. Between my methods the arrayList is being reset to null. I'm confused as to the cause and would be grateful for any advice package TestInput; import java.io.BufferedInputStream; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; public class Bean { private String fileContent; private String fileContent2; private ArrayList&lt;String&gt; fileContentArray; private int counter = 0; public int getCounter() { return counter; } public void setCounter(int counter) { this.counter = counter; } public ArrayList&lt;String&gt; getFileContentArray() { return fileContentArray; } public void setFileContentArray(ArrayList&lt;String&gt; fileContentArray) { this.fileContentArray = fileContentArray; } public String getFileContent() { return fileContent; } public void setFileContent(String fileContent) { this.fileContent = fileContent; } public String getFileContent2() { return fileContent2; } public void setFileContent2(String fileContent2) { this.fileContent2 = fileContent2; } public void upload() { File file = new File("/Users/t_sedgman/Desktop/FinalProject/test_output_data.rtf"); FileInputStream fis = null; BufferedInputStream bis = null; DataInputStream dis = null; ArrayList&lt;String&gt; tempArray = new ArrayList&lt;&gt;(); try { fis = new FileInputStream(file); // Here BufferedInputStream is added for fast reading. bis = new BufferedInputStream(fis); dis = new DataInputStream(bis); // dis.available() returns 0 if the file does not have more lines. while (dis.available() != 0) { // this statement reads the line from the file and print it to // the console. tempArray.add(dis.readLine()); } setFileContentArray(tempArray); // dispose all the resources after using them. fis.close(); bis.close(); dis.close(); fileContent = fileContentArray.get((fileContentArray.size() - 2)); } c…
tagged with: jsf
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37639301

http://stackoverflow.com/q/24302279
type: AnsweredQuestion
has title: Spring Validation with applyIf attribute in Annotations
has body: I've tried to set applyIf attribute on spring annotation with some custom exspression. As exampe I have a form: class MyForm { @NotBlank private String name; @NotNull @MinSize(applyIf = "name not equals myValue", value = 1) private List&lt;String&gt; addresses; ... } But when I try to validate form above spring perceives myValue from exspression as property. The it tries to find getters setters for it. Also, I've tried to dig org.springmodules.validation.valang.parser.ValangParser, but unfortunatly java docs are not present for this class. I can't find any examples with this stuff(Only really simple cases like: "name is not blank"). Will be good if you suggest some usefull documentation. Or correct my exspression for correct verifying my goals.
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/37567003
has answer: http://stackoverflow.com/a/24324833
has comment: http://stackoverflow.com/comment/37558207
score: 0
tagged with: validation
answer count: 1
has comment: http://stackoverflow.com/comment/37558215
accepted answer: http://stackoverflow.com/a/24324833
tagged with: spring-annotations
tagged with: spring

http://stackoverflow.com/q/24345891
has comment: http://stackoverflow.com/comment/37644198
has answer: http://stackoverflow.com/a/34046386
tagged with: java
tagged with: hibernate
type: Question
score: 0
answer count: 2
has body: i need help with hibernate mapping one-to-many i don´t know why this is wrong public class Direccion { private long id; private String calle; private int numero; private List<Persona> habitantes; public Direccion(){ } public Direccion(long id, String calle, int numero, List<Persona> habitante) { super(); this.id = id; this.calle = calle; this.numero = numero; this.habitantes = habitante; } public long getId() { return id; } public void setId(long id) { this.id = id; } public String getCalle() { return calle; } public void setCalle(String calle) { this.calle = calle; } public int getNumero() { return numero; } public void setNumero(int numero) { this.numero = numero; } public List<Persona> getHabitantes() { return habitantes; } public void setHabitantes(List<Persona> habitantes) { this.habitantes = habitantes; } @Override public String toString() { return "Direccion [id=" + id + ", calle=" + calle + ", numero=" + numero + ", habitantes=" + habitantes + "]"; } } another class: public class Persona { private long id; private long nombre; public Persona(){ } public Persona(long id, long nombre) { super(); this.id = id; this.nombre = nombre; } public long getId() { return id; } public void setId(long id) { this.id = id; } public long getNombre() { return nombre; } public void setNombre(long nombre) { this.nombre = nombre; } @Override public String toString() { return "Persona [id=" + id + ", nombre=" + nombre + "]"; } } the mapping <?xml version="1.0" encoding="UTF-8"?> <column name="idPersona" not-null="true" /> <one-to-many class="datos.Persona" /> another mapping: <?xml version="1.0" encoding="UTF-8"?> <many-to-one name="direccion" class="datos.Direccion" column="idPersona" not-null="true"/> hibernate configuration <?xml version="1.0" encoding="UTF-8"?> <hibernate-configuration> com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/repasohibernate root root 1 org.hibernate.dialect.MySQLDialect true <mapping resource="mapeos/persona.hbm.xml" /> <mapping resource="mapeos/di…
tagged with: hibernate-mapping
has answer: http://stackoverflow.com/a/24346223
has title: org.hibernate.InvalidMappingException: Unable to read XML
type: UnansweredQuestion

http://stackoverflow.com/comment/37520348
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/24280115
has text: Maybe you aren't using the correct version.

http://stackoverflow.com/comment/37512406
type: Comment
comment on: http://stackoverflow.com/a/24277417
has text: 1. It's possible to have a variable called `String`, so `String.replaceAll(...)` could in fact compile and run. 2. It's entirely possible `String.replaceAll(":", "\":\"");` was an example, and `String` wasn't actually the name of the variable. 3. The program evidently compiles and runs, otherwise OP would not be able to find out that characters are being deleted.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37637315
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24344638
has text: http://stackoverflow.com/questions/12431581/why-do-set-data-structures-in-java-use-map-internally?rq=1 , http://stackoverflow.com/questions/20217414/what-is-the-main-difference-between-hashset-treeset-and-linkedhashset-hashmap?rq=1 , http://stackoverflow.com/questions/11680751/are-there-problems-of-implementing-hashset-using-hashmap?rq=1
score: 0

http://stackoverflow.com/q/24283808
has body: I added an OutlinePage to my Eclipse TextEditor and when changes are made in this Outline, the TextEditor has to be marked as dirty. The proposed way to do this is to use firePropertyChange(IEditorPart.PROP_DIRTY) However, I have to manage the dirty flag by myself as well and return it in isDirty() But that means, that the dirty flag is not automatically set if the TextEditor's content is changed. I thought about adding an IPartProperyChangeListener and changing the flag by myself. Is that the best way to to that?
answer count: 1
accepted answer: http://stackoverflow.com/a/24285029
tagged with: eclipse-plugin
score: 0
has answer: http://stackoverflow.com/a/24285029
has title: How to mark Eclipse editor as dirty while not ignoring other changes made in the editor
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/37572210
score: 0
type: QuestionComment
type: Comment
has text: I'm passing a 10, and reading an array with only 2 elements I get 8 fields with null
comment on: http://stackoverflow.com/q/24310205

http://stackoverflow.com/comment/37708196
comment on: http://stackoverflow.com/q/24380194
score: 0
type: Comment
has text: mxCell defaultActivityEdge = (mxCell) graph.insertEdge(parentObject, null, "hasActivity", cell3, newCell); graph.addCell(defaultActivityEdge); defaultActivityEdge.setVisible(true);graph.clearSelection(); graph.refresh();
type: QuestionComment

http://stackoverflow.com/comment/37608638
type: QuestionComment
has text: Did you try to debug what's being passed to the service method call actually? It might be lack of equals implemention in Toy class. Can you post the Toy class code?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24328949

http://stackoverflow.com/q/24300094
favorite count: 0
has comment: http://stackoverflow.com/comment/37553075
answer count: 3
upvote count: 1
tagged with: android
downvote count: 4
has body: What should I do?Thanks import java.io.File; 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.SQLiteOpenHelper; import android.util.Log; Public class DataBaseHelper extends SQLiteOpenHelper { private static String TAG = "DataBaseHelper"; // Tag just for the LogCat window //destination path (location) of our database on device private static String DB_PATH = ""; private static String DB_NAME ="finala";// Database name private SQLiteDatabase mDataBase; private final Context mContext; public DataBaseHelper(Context context) { super(context, DB_NAME, null, 1);// 1? its Database Version if(android.os.Build.VERSION.SDK_INT &gt;= 17){ DB_PATH = context.getApplicationInfo().dataDir + "/databases/"; } else { DB_PATH = "/data/data/" + context.getPackageName() + "/databases/"; } this.mContext = context; } public void createDataBase() throws IOException { //If database not exists copy it from the assets boolean mDataBaseExist = checkDataBase(); if(!mDataBaseExist) { this.getReadableDatabase(); this.close(); try { //Copy the database from assests copyDataBase(); Log.e(TAG, "createDatabase database created"); } catch (IOException mIOException) { throw new Error("ErrorCopyingDataBase"); } } } //Check that the database exists here: /data/data/your package/databases/Da Name private boolean checkDataBase() { File dbFile = new File(DB_PATH + DB_NAME); //Log.v("dbFile", dbFile + " "+ dbFile.exists()); return dbFile.exists(); } //Copy the database from assets private void copyDataBase() throws IOException { InputStream mInput = mContext.getAssets().open(DB_NAME); String outFileName = DB_PATH + DB_NAME; OutputStream mOutput = new FileOutputStream(outFileName); byte[] mBuffer = new byte[1024]; int mLength; while ((mLength = mInput.read(mBuffer))&gt;0) { mOutput.write(mBuffer, …
has comment: http://stackoverflow.com/comment/37553384
has answer: http://stackoverflow.com/a/24300454
accepted answer: http://stackoverflow.com/a/24300454
score: -3
has comment: http://stackoverflow.com/comment/37552795
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24302931
tagged with: eclipse
type: Question
possible better answer: http://stackoverflow.com/a/24300150
has title: Eclipse error database connection
tagged with: sqlite
has answer: http://stackoverflow.com/a/24300150

http://stackoverflow.com/q/24302834
has comment: http://stackoverflow.com/comment/37557947
has comment: http://stackoverflow.com/comment/37557915
answer count: 3
possible better answer: http://stackoverflow.com/a/24302999
has title: Giving the parameter System.out::println to a method
has body: I forgot a concept that I used and can't remember it. For the context, I used to have a method like toString() which had a parameter. This parameters allowed me to call my method like myMethod(System.out::println) to print it on the screen, but also to print it in a file with the same syntax. Does anyone know what can be this parameter? the concept? I think it's kind of a FunctionalInterface but I don't know what it is.
favorite count: 0
has comment: http://stackoverflow.com/comment/37558667
has answer: http://stackoverflow.com/a/24303031
has comment: http://stackoverflow.com/comment/37557830
linked to: http://stackoverflow.com/q/2186931
has answer: http://stackoverflow.com/a/24303345
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37558112
upvote count: 1
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/24303031
tagged with: java
has answer: http://stackoverflow.com/a/24302999
score: 0

http://stackoverflow.com/comment/38014023
has text: It depends on what you want to do. You can add spring security for part (or whole of) your public site by simply inserting security filter in the filter chain (either in Magnolia itself or in your web.xml). If you want to do something more special like use Spring to authenticate users logging into Magnolia itself or to use spring to completely manage users, you better search magnolia forum for posts of people who have done the same with different authorisation and authentication systems.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24440754

http://stackoverflow.com/comment/37757377
type: Comment
comment on: http://stackoverflow.com/q/24380951
type: QuestionComment
has text: Please use the "Your answer" field at the bottom of the page. This will allow us to upvote your answer and yourself to accept your own answer.
score: 0

http://stackoverflow.com/a/28847215
answers question: http://stackoverflow.com/q/24370338
downvote count: 1
score: -1
upvote count: 0
type: Answer
has body: I think I had the same problem, I fixed it by doing this: Give an absolute path to the properties file. The following worked for me: pig -param_file /home/cloudera/Desktop/SOMELONGPATH/parameters.properties /home/cloudera/Desktop/SOMELONGPATHAGAIN/Flight.pig

http://stackoverflow.com/comment/37842139
has text: ERROR] Failed to execute goal on project abbuclt : Could not reso lve dependencies for project com.ax.abbuc:abbuclt : jar:0.0.1-SNAPSHOT: Failure to find com.acxiom.am:aopencommon:jar:0.0.1-SNA PSHOT in https://repository.jboss.org/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update inter val of jboss-public-repository-group has elapsed or updates are forced -> [Help 1]
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24398589
type: AnswerComment

http://stackoverflow.com/a/24382353
downvote count: 0
has comment: http://stackoverflow.com/comment/37708963
has comment: http://stackoverflow.com/comment/37710207
type: Answer
has body: Is it an example of inlining? No, it's not. Is there any relation between final keyword and Inlining? Kind of. Read this: Contrary to the implication of many tips, methods declared as final cannot be safely inlined by the compiler, because the method could have a non-final declaration at runtime. To see why, suppose the compiler looks at class A and subclass B, and sub-subclass C and sees a final method in A which it inlines into C. But then at runtime the versions loaded for A and B are different and the method is not final in A, and overridden in B. Then C uses the incorrectly inlined version. From http://www.javaperformancetuning.com/tips/final.shtml
upvote count: 3
answers question: http://stackoverflow.com/q/24382186
has comment: http://stackoverflow.com/comment/37710547
score: 3
has comment: http://stackoverflow.com/comment/37709179
has comment: http://stackoverflow.com/comment/37709237

http://stackoverflow.com/q/24382497
downvote count: 0
has body: Lambda expressions must be cast to a functional interface. They cannot extend a class as far as I know but I want to know if there is a way to get something similar. I have java.nio.file.SimpleFileVisitor&lt;Path&gt; as base class and I want to override a method of it but I wish to do so inside another method. I can do it with an anonymous class this way: public static void printContent(Path path) throws IOException { FileVisitor&lt;Path&gt; visitor = new SimpleFileVisitor&lt;Path&gt;() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { System.out.println(file); return super.visitFile(file, attrs); } }; Files.walkFileTree(path, visitor); } Is there a way to remove that load of code with the help of a lambda? I think the lambda would be (f) -&gt; System.out.println(f); I thought about forgetting SimpleFileVisitor and creating a equivalent interface with default methods but, how could I select what method to override? Would I need to leave the method I want to override without default implementation? In that case I would need several Interfaces for different cases with different not implemented methods. Thank you.
accepted answer: http://stackoverflow.com/a/24384759
score: 11
type: AnsweredQuestion
has title: How can I override a base class method using a lambda expression in java 8?
has comment: http://stackoverflow.com/comment/37712574
upvote count: 11
favorite count: 0
type: Question
tagged with: lambda
has comment: http://stackoverflow.com/comment/37779711
answer count: 1
tagged with: java-8
has answer: http://stackoverflow.com/a/24384759
tagged with: java
has comment: http://stackoverflow.com/comment/37713262

http://stackoverflow.com/comment/37704521
type: Comment
comment on: http://stackoverflow.com/a/24378407
has text: @Jaskey `Thread#sleep` does not guarantee that the current thread will sleep X milliseconds, maybe the controller of the thread (in this case, your Oracle RBDMS) may send an interrupt signal and *wake* the thread to avoid this naive delay.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/37528084
score: 0
has text: Which button is returning null? Show complete logcat.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24287193

http://stackoverflow.com/comment/37758522
score: 0
type: QuestionComment
type: Comment
has text: better you should use **public int dItemMeta1**
comment on: http://stackoverflow.com/q/24408682

http://stackoverflow.com/q/24284507
tagged with: collections
duplicate of: http://stackoverflow.com/q/109383
type: Question
has comment: http://stackoverflow.com/comment/37523038
has title: How to sort hashmap by their values?Where value is object of type employee
tagged with: hashmap
score: 0
tagged with: comparator
has comment: http://stackoverflow.com/comment/37523065
type: UnansweredQuestion
has body: I am having unsorted hashmap like { "001" : new Employee("vaibhav",22,"") ,"002" : new Employee("nik",19,""),"003" : new Employee("sunil",25,"") } I want to sort this hashmap according to Employee Age e.g. 22 O/P should be : { "002" : new Employee("nik",19,""),"001" : new Employee("vaibhav",22,""),"003" : new Employee("sunil",25,"") }
has comment: http://stackoverflow.com/comment/37523018
linked to: http://stackoverflow.com/q/109383
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37523011

http://stackoverflow.com/comment/38071358
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24414007
has text: @AlexeyGavrilov Thanks, Good to know! Though for other data types I'd still love to make this work.
score: 0

http://stackoverflow.com/q/24273598
score: 0
answer count: 1
type: UnansweredQuestion
has body: We have a third party jar which has an INDEX.LIST file contained in META-INF. This causes java web start to request the jars listed in INDEX.LIST Our server only responds to jar requests that are versioned and when java webstart requests jars it finds in the INDEX.LIST file it doesn't include the version. What would work for us is to simply turn off the Jar Indexing support but I have not seen any documentation on how to turn this feature off.
tagged with: java
has answer: http://stackoverflow.com/a/25261159
type: Question
tagged with: java-web-start
has title: Ignore Jars INDEX.LIST with java webstart

http://stackoverflow.com/comment/37523084
score: 0
comment on: http://stackoverflow.com/q/24284491
type: QuestionComment
type: Comment
has text: @stuXnet how is this an duplicate of that?

http://stackoverflow.com/comment/37759344
type: Comment
comment on: http://stackoverflow.com/a/24409153
score: 6
type: AnswerComment
has text: +1 for Explanation : _Specially_ for Hashing and some _black magic_ :)

http://stackoverflow.com/q/24422503
possible better answer: http://stackoverflow.com/a/24423702
tagged with: service
has answer: http://stackoverflow.com/a/24423702
type: Question
has body: Background I am working on an application where I need to query for all the files available on my harddisk using java. As performance is a major requirement, I have written a native application which accesses the windows Master File Table ($MBT) for all the valid file entries. I am planning to modify the native as a windows service (running with admin privileges.. needed for accessing MFT) and then use my user mode java application to contact it via some IPC technique (specifically shared memory or named pipe or sockets... need to evaluate). The target application is windows specific and java is used for text processing (I know python/perl are good at it but haven't used them for long time). Questions Now my question are - Whether it is possible to query a privileged windows service from a limited user level application? If not what could be the workaround to achieve this? I think sockets could be the possible IPC mechanism as other two would fail with Access Denied. Am I correct in assuming that? Is converting the native code to JNI/DLL and then using is correct over what I am planning? But in that case I have to start my java app with admin privilege by having a custom manifest file. Platform Windows 7 Enterprise Visual Studio 2012 (for native $MFT access) JDK build 1.7.0_25-b17 Thanks
has title: Is it possible to query a privileged windows service from a user mode java application?
has answer: http://stackoverflow.com/a/24422703
tagged with: c++
score: 0
tagged with: winapi
tagged with: java
answer count: 2
tagged with: ntfs-mft
accepted answer: http://stackoverflow.com/a/24422703
type: AnsweredQuestion

oauth-2.0
tag name: oauth-2.0
tags question: http://stackoverflow.com/q/24303065
type: Tag
tags question: http://stackoverflow.com/q/24312747
tags question: http://stackoverflow.com/q/24404783

wcf
type: Tag
tag name: wcf
tags question: http://stackoverflow.com/q/24341490
tags question: http://stackoverflow.com/q/24342333

http://stackoverflow.com/a/71279578
type: Answer
score: 0
answers question: http://stackoverflow.com/q/24372359
has body: in my case I used PostgreSQL with maven add in pom.xml the following code org.postgresql postgresql 42.3.2 in servlet class Class.forName("org.postgresql.Driver").newInstance(); Connection con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/" + DB_NAME, USER, PASS);

http://stackoverflow.com/comment/37714848
has text: What gives browser for `http://aaa.bb.cc.dd:8080` ?
comment on: http://stackoverflow.com/q/24385102
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/43826637
upvote count: 2
answers question: http://stackoverflow.com/q/24397647
has body: I used "jackson-jaxrs-json-provider 2.8.8" and JAX-RS 2.0 Application class - you needs to register your ExceptionMapper implementation class: @ApplicationPath("pathApplication") public class ApplicationConfiguration extends Application{ @Override public Set&lt;Class&lt;?&gt;&gt; getClasses() { Set&lt;Class&lt;?&gt;&gt; resources = new HashSet&lt;&gt;(); resources.add(YourJAXRSClass.class); resources.add(JsonJacksonEM.class); //ExceptionMapper class implementation //others resources that you need... return resources; } } ExceptionMapper class implementation: @Provider public class JsonJacksonEM implements ExceptionMapper&lt;JsonParseException&gt;{ @Override public Response toResponse(JsonParseException exception) { //you can return a Response in the way that you want! return Response.ok(new YourObject()).build(); } }
score: 2
downvote count: 0
type: Answer

http://stackoverflow.com/q/24338796
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37631617
type: Question
has body: Can you please help me solving the below issue. I'm running the triplestore on one tomcat server and the application to access the triplestore on another tomcat7 server. For the first time, the application runs successfully however if I restart the application and not the triplestore causing the nullpointer issue. Below is the exception causing on triplestore server SEVERE: Servlet.service() for servlet [ServletAdaptor] in context with path [/triplestore] threw exception [java.lang.NullPointerException] with root cause java.lang.NullPointerException at com.hp.hpl.jena.sparql.util.NodeUtils$1.accept(NodeUtils.java: at com.hp.hpl.jena.sparql.util.NodeUtils$1.accept(NodeUtils.java:91) at com.hp.hpl.jena.util.iterator.MapFilterIterator.hasNext(MapFilterIterator.java:55) at au.com.triplestore.core.impl.TripleStoreImpl.saveDataset(TripleStoreImpl.java:224) at au.com.triplestore.web.TripleStoreRs.saveData(TripleStoreRs.java:323) 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.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:151) at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:171) at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152) at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:104) at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke…
tagged with: jena
has comment: http://stackoverflow.com/comment/37631574
has comment: http://stackoverflow.com/comment/37643574
tagged with: triplestore
has comment: http://stackoverflow.com/comment/37631925
type: UnansweredQuestion
has title: Jena: Nullpointer exception while iterating the dataset
tagged with: tomcat7
answer count: 0

http://stackoverflow.com/comment/67270521
type: QuestionComment
has text: Were you able to fix the issue? If yes, can you share how?
type: Comment
comment on: http://stackoverflow.com/q/24274281
score: 0

http://stackoverflow.com/comment/37593634
has text: i have updated question can you please respond me,thank you
comment on: http://stackoverflow.com/a/24321392
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/37690184
comment on: http://stackoverflow.com/a/24371569
score: 0
type: AnswerComment
type: Comment
has text: @JohnO.: "I'm creating the Bitmaps programatically, not gathering them from files" -- since I do not know precisely what that means, you may wish to edit your question to explain how you are creating and using them. Off the cuff, you should still be able to reuse them, though, by wiping their current contents and drawing fresh contents, rather than discarding and re-instantiating them every time.

http://stackoverflow.com/comment/37718460
comment on: http://stackoverflow.com/q/24373551
type: Comment
type: QuestionComment
score: 0
has text: Got it. Actually the post I linked to did mention to use autowire to get a session factory. That and get rid of the current session context thread setting. That and pay attention on the stack trace which transaction boundary is causing the was it no active hibernate session or something.

http://stackoverflow.com/comment/37712825
score: 1
comment on: http://stackoverflow.com/q/24384484
type: Comment
type: QuestionComment
has text: **Always use an `enum` to implement the Singleton pattern**. Don't do what you're doing, it's full of (very non-obvious) flaws and loopholes.

http://stackoverflow.com/q/24307634
score: 1
tagged with: java
tagged with: solr
upvote count: 1
tagged with: unit-testing
type: Question
downvote count: 0
tagged with: apache-camel
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/24311303
tagged with: jetty
has title: How to stand up then shut down a Solr instance in a Unit Test?
has body: I am writing camel unit test. One service that I interface with is Solr. After testing with mocks, I want to write tests that bring up a local solr instance. So far I have tried to leverage the RestTestBase Solr class (org.apache.solr.util.RestTestBase). Because I am writing a unit test, I have not extended the class, merely tried to use the static methods it provides. The following does not work: RestTestBase.createJettyAndHarness("src/test/resources/solr", "solrconfig.xml", "schema.xml", "/solr", true, null); int solrPort = RestTestBase.jetty.getLocalPort(); String solrURL = "localhost:"+Integer.toString(solrPort)+"/solr"; ... I included solr and jetty in my pom. Any suggestions for how to programmatic stand up and shut down a solr instance? (because i am using camel unit testing, i prefer not to extend RestTestBase)
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24311303

http://stackoverflow.com/q/24352826
type: Question
has comment: http://stackoverflow.com/comment/37720152
downvote count: 0
has title: How to migrate from a jar-Jetty combination to a war-JBoss deployment with a maven project?
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: jetty
has body: I have a maven project (not created by me) which uses jetty to deploy a web application. The current packaging of the maven project is jar. So after the build phase is complete I have a target directory with the following web app (among other things): target/server-dir/web-engine/WEB-INF/web.xml Is it possible to deploy migrate this app from jetty to JBoss? Thank you. PS : Here is the web.xml content : <?xml version="1.0" encoding="UTF-8"?> cometd org.cometd.server.CometdServlet 1 cometd /cometd/* cross-origin org.eclipse.jetty.servlets.CrossOriginFilter cross-origin /cometd/* jersey-spring com.opengamma.component.rest.OpenGammaServlet com.sun.jersey.spi.container.ResourceFilters com.opengamma.web.analytics.rest.SubscribingFilterFactory 3 jersey-spring /jax/* handshake com.opengamma.web.analytics.push.HandshakeServlet handshake /handshake updates com.opengamma.web.analytics.push.LongPollingServlet updates /updates/* net.sf.ehcache.constructs.web.ShutdownListener com.opengamma.web.server.WebAnalyticsBayeuxInitializer default useFileMappedBuffer false PS 2 : The pom.xml from the project (part of a greatest project...if you want to to post the parent pom file just tell me so): <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.opengamma.platform examples 2.1.0 .. examples-simulated jar Examples-Simulated OpenGamma Platform examples and server with simulated market data https://github.com/OpenGamma/OG-Platform/tree/master/examples/examples-simulated src/main/resources config org.apache.maven.plugins maven-jar-plugin **/*logback.xml true false com.opengamma.tools opengamma-maven-plugin generate-scripts maven-dependency-plugin package unpack com.opengamma.platform og-web ${project.version} zip web-engine true ${project.build.directory}/assembly/web-engine maven-assembly-plugin dir package single src/main/assembly/assembly-server-dir.xml server-dir false com.opengamma.platform og-server pom ${project.version} org.apache.activemq activemq-pool org.hsqldb hsqldb org.apache.xbe…
has comment: http://stackoverflow.com/comment/37655455
tagged with: maven
upvote count: 1
score: 1
tagged with: java
tagged with: jboss

http://stackoverflow.com/comment/37585749
type: Comment
has text: @clcto nothing special, the same... you get overflow. The low and high are array indexes, the OP is talking about binary search; that's what it has to do with array size.
type: AnswerComment
comment on: http://stackoverflow.com/a/24317428
score: 0

http://stackoverflow.com/a/24359171
has comment: http://stackoverflow.com/comment/37665987
has comment: http://stackoverflow.com/comment/37665991
downvote count: 0
upvote count: 6
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/24359130
answers question: http://stackoverflow.com/q/24359130
has comment: http://stackoverflow.com/comment/37666093
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/37665950
has body: Don't define your own Comparable interface. You need to implement java.lang.Comparable.

http://stackoverflow.com/comment/37497841
type: Comment
type: QuestionComment
has text: What is the expected and actual output?
comment on: http://stackoverflow.com/q/24271153
score: 0

http://stackoverflow.com/q/24401822
has body: I know this key word is used to point to current class fields and to call constructor like: class A{ String name; public A(String name) { this.name=name; this.(name.length()); } public(int len) { //some code here } } but my I recently came across: class B extends A { A varA = B.this; } I don't understand how B.this works. can any one elaborate in detail
has comment: http://stackoverflow.com/comment/37745935
score: 0
tagged with: java
has title: How does an explicitly scoped this keyword in java work?
has answer: http://stackoverflow.com/a/24401854
has comment: http://stackoverflow.com/comment/37745858
answer count: 4
has answer: http://stackoverflow.com/a/24401860
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24401904
accepted answer: http://stackoverflow.com/a/24401854
has answer: http://stackoverflow.com/a/24401904
has answer: http://stackoverflow.com/a/24401835
type: Question
has comment: http://stackoverflow.com/comment/37745970

http://stackoverflow.com/comment/37783008
score: 0
type: Comment
has text: @FadyFarouk: for example, please check out [this answer](http://stackoverflow.com/a/5693974/522444) of mine to see an example of getting a reference to another class and making method calls on it.
comment on: http://stackoverflow.com/a/24421468
type: AnswerComment

http://stackoverflow.com/comment/37638080
score: 0
type: Comment
has text: When I add it to the list, could I just skip the "-" and then multiply every number by -1 when I add it to the list?
comment on: http://stackoverflow.com/a/24344829
type: AnswerComment

http://stackoverflow.com/comment/37713700
type: Comment
comment on: http://stackoverflow.com/a/24382975
has text: So if you use this algorithm you end up with: The, The strongest, The strongest rain, ...
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37494016
has text: where the running threads would be?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24269147

http://stackoverflow.com/a/26604956
has body: Please note that Clover and JaCoCo are using different code coverage metrics: Clover has method, statement and branch coverage (plus the total coverage metric which is a sum of all three) JaCoCo has method, code block, line, branch and instruction coverage So you cannot simply put the equality sign between results produced by these two tools. I suggest checking reports side-by-side to find where is the highest difference and next to have a look at code constructs used there, resulting in such difference. Oh. By the way. Keep in mind that JaCoCo uses byte code instrumentation, which means that it will also instrument synthetic methods created by javac compiler and which are not visible in the source code.
upvote count: 4
answers question: http://stackoverflow.com/q/24369631
downvote count: 0
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/55758472

http://stackoverflow.com/comment/67877666
comment on: http://stackoverflow.com/q/24402164
type: QuestionComment
score: 0
has text: Just want to say I noticed you said: "In my test, the server socket in Android phone accepts connections from PC only once." I was working on an application that communicated with the phone and encountered transferring data issues after re-using the "adb forward" (and newly adb reverse) sockets without killing them. After having killed the adb forward/reverse sockets and recreating them each time since they didn't need to stick around after a while this was resolving "most" of my issues. Thought I'd share my experience
type: Comment

http://stackoverflow.com/comment/37509242
has text: But a `char[]` itself is not a primitive. If `String` is considered a primitive because it wraps a `char[]`, should all other primitive arrays be called primitives too? Because that's wrong.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24277083

http://stackoverflow.com/comment/37590919
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24320189
score: 0
has text: Are you sure it is necessary to keep all the GameElement's in the same list? Where are you creating/adding elements to the list `elements`?

http://stackoverflow.com/q/24317432
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24317507
tagged with: java
tagged with: methods
tagged with: computer-science
type: Question
tagged with: debugging
has body: For this assignment we are supposed to encode URL. Ultimately, the output should be http://www.amazon.com?id=123&amp;author=Jim+Campbell&amp;publisher=O%27Reilly, but I am getting www.amazon.com?id=123?author=Jim+Campbell?publisher=O%27Reilly Now here's my code: package MyUrl; import java.util.Scanner; public class MyUrl { private String mUrl; public MyUrl(String url) { if (url.contains("http://")) mUrl = "http://" + url; else mUrl = url; } public void addArgument(String name, String value) { if (mUrl.indexOf(name) == '?') { mUrl = mUrl + '&amp;' + urlEncode(name) + '=' + urlEncode(value); } else { mUrl = mUrl + '?' + urlEncode(name) + '=' + urlEncode(value); } } public void addArgument(String name, int ivalue) { String newValue = Integer.toString(ivalue); if (mUrl.indexOf(name) == '?') { mUrl = mUrl + '&amp;' + urlEncode(name) + '=' + urlEncode(newValue); } else { mUrl = mUrl + '?' + urlEncode(name) + '=' + urlEncode(newValue); } } public void addArgument(String name, double dvalue) { String newValue1 = Double.toString(dvalue); if (mUrl.indexOf(name) == '?') { mUrl = mUrl + '&amp;' + urlEncode(name) + '=' + urlEncode(newValue1); } else { mUrl = mUrl + '?' + urlEncode(name) + '=' + urlEncode(newValue1); } } public String toString() { String result = mUrl; return result; } public static String urlEncode(String text) { String newWord = ""; for (int n = 0; n &lt; text.length(); ++n) { char c = text.charAt(n); String hexValue = Integer.toHexString(c); if (c &gt;= 'A' &amp;&amp; c &lt;= 'Z') { newWord += c; } else if (c &gt;= 'a' &amp;&amp; c &lt;= 'z') { newWord += c; } else if (c &gt;= '0' &amp;&amp; c &lt;= '9') { newWord += c; } else if (c == '_' || c == '-' || c == '.' || c == '*') { newWord += c; } else if (c == ' ') { newWord += '+'; } else { newWord += '%' + hexValue; } } text = newWord; return text; } } /** * main */ public static void main(String[] args) { Scanner sc = new Scanner(System.in); // Loop, asking for a new URL to be entered. do { System.out.println(…
score: 0
answer count: 1
has title: How should I fix my code so I return the correct output, a & instead of a question mark?

sevntu-checkstyle
tags question: http://stackoverflow.com/q/24281507
type: Tag
tag name: sevntu-checkstyle

http://stackoverflow.com/comment/37645577
has text: maybe it doesn't find the audio file.
comment on: http://stackoverflow.com/q/24348854
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37681003
score: 0
comment on: http://stackoverflow.com/q/24367503
type: Comment
has text: One obvious question: why do you want your controllers to be transactional? Usually, controllers call methods that are transactional.
type: QuestionComment

http://stackoverflow.com/a/24398903
has comment: http://stackoverflow.com/comment/37741637
has comment: http://stackoverflow.com/comment/37741126
has comment: http://stackoverflow.com/comment/37741061
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/37742259
answers question: http://stackoverflow.com/q/24398828
score: 3
upvote count: 3
has body: If you want represent literal newlines on Windows, you need to use \r\n, which is the standard delimiter for that platform. In other words, your original string needs to be "2\r\n0 0 1 string1\r\n0 2 1 string2" However, this quickly becomes non-portable, so you should instead query for the standard delimiter first and then use it to construct your string. String d = System.getProperty("line.separator"); String mystr = String.format("2%s0 0 1 string1%s0 2 1 string2", d, d) Moreover, based on this answer, we can use %n format specifier to avoid the call to getProperty(). String mystr = String.format("2%n0 0 1 string1%n0 2 1 string2")

http://stackoverflow.com/q/24392916
has body: I have a JFrame with a button, and when I pressed it show another frame, change things on the second frame and after 3 seconds, close it. I've tried this but when appears the second frame, it's in white. private void smallButtonActionPerformed(java.awt.event.ActionEvent evt) { try { NormalCarEntry entryTicket = new NormalCarEntry(); entryTicket.setVisible(true); java.util.Date date = new java.util.Date(); SimpleDateFormat formatTime = new SimpleDateFormat("HH:mm:ss"); String entryTime = formatTime.format(date); String query = "SELECT `ticket` FROM `" + DB + "` ORDER BY `ticket` DESC LIMIT 1"; st = connection.createStatement(); ResultSet res = st.executeQuery(query); while (res.next()) entryTicket.entryTicketLabel.setText(res.getInt("ticket") + ""); entryTicket.entryDate.setText(formatDate2.format(date)); entryTicket.entryHour.setText(entryTime); try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } entryTicket.setVisible(false); } catch (SQLException ex) { Logger.getLogger(mainView.class.getName()).log(Level.SEVERE, null, ex); } } NormalCarEntry is the second frame mentioned. Anyone can help me?
answer count: 1
duplicate of: http://stackoverflow.com/q/4215968
score: 0
tagged with: thread-sleep
tagged with: jdbc
has title: White Screen on a Frame with Thread.sleep()
has answer: http://stackoverflow.com/a/24392954
type: UnansweredQuestion
tagged with: swing
tagged with: actionlistener
tagged with: java
linked to: http://stackoverflow.com/q/4215968
type: Question

http://stackoverflow.com/q/24340116
has answer: http://stackoverflow.com/a/24340209
has answer: http://stackoverflow.com/a/24340229
score: 1
answer count: 6
has answer: http://stackoverflow.com/a/42756798
favorite count: 0
has comment: http://stackoverflow.com/comment/37629781
linked to: http://stackoverflow.com/q/1732348
has title: Java XML: how to escape '&', but skip '&amp;'
has answer: http://stackoverflow.com/a/24340225
has body: I need to escape '&amp;', but skip &amp;amp; I use next function public static String translateAll(String input, String[] patterns, String[] replacements) { String result = input; for (int i = 0; i &lt; patterns.length; i++) { result = result.replaceAll(patterns[i], replacements[i]); } return result; } ... private static final String[] decoded = { "&amp;", "&lt;", "&gt;", "\"", "\'" }; private static final String[] encoded = { "&amp;amp;", "&amp;lt;", "&amp;gt;", "&amp;quot;", "&amp;apos;" }; public static String escape(String input) { return translateAll(input, decoded, encoded); } ... String escapedBodyValue = XMLUtils.escape(originBodyValue); It replaces all &amp; with &amp;amp; but it also replaces all &amp;amp; with &amp;amp;amp; So, how to skip already escaped characters?
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/24340260
upvote count: 2
has answer: http://stackoverflow.com/a/24340165
has comment: http://stackoverflow.com/comment/37629404
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/37630093
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/24340229
has answer: http://stackoverflow.com/a/24340260

http://stackoverflow.com/q/24368176
favorite count: 0
upvote count: 5
has answer: http://stackoverflow.com/a/24371804
possible better answer: http://stackoverflow.com/a/24371804
tagged with: diskspace
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: neo4j "empty" database takes up a lot of disk space
type: Question
has body: I've inserted ~2M nodes (via Java API), and deleted them after a day or two of usage (through java too). Now my db has got 16k nodes, and weights 6 GB. Why this space wasn't freed? What may be the cause?
score: 5
tagged with: database
has answer: http://stackoverflow.com/a/24368765
accepted answer: http://stackoverflow.com/a/24368765
answer count: 2
tagged with: neo4j

http://stackoverflow.com/q/24397275
tagged with: google-calendar-api
score: -3
upvote count: 1
has title: POJO for this complex JSON
type: Question
accepted answer: http://stackoverflow.com/a/24397324
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: pojo
tagged with: gson
downvote count: 4
has body: I'm new to POJOs and am working on creating objects to represent JSON from Google APIs. How can I create a pojo for this JSON? "notificationSettings": { "notifications": [ { "type": "eventCreation", "method": "email" }, { "type": "eventChange", "method": "email" }, { "type": "eventCancellation", "method": "email" }, { "type": "eventResponse", "method": "email" } ] } I have the rest of the JSON figured out, however, the Gson.fromJSON() keeps returning null. EDIT 1 This is what I have private static class NotificationSettings{ public NotificationSettings(){ } public NotificationSettings(Map&lt;String, List&lt;Notification&gt;&gt; notifications) { super(); this.setNotifications(notifications); } public Map&lt;String, List&lt;Notification&gt;&gt; getNotifications() { return notifications; } public void setNotifications(Map&lt;String, List&lt;Notification&gt;&gt; notifications) { this.notifications = notifications; } private Map&lt;String, List&lt;Notification&gt;&gt; notifications; } private static class Notification{ public Notification(){ } public Notification(String type, String method) { super(); this.type = type; this.method = method; } private String type; private String method; /** * @return the type */ public String getType() { return type; } /** * @param type the type to set */ public void setType(String type) { this.type = type; } /** * @return the method */ public String getMethod() { return method; } /** * @param method the method to set */ public void setMethod(String method) { this.method = method; } } EDIT 2 Another question, are the constructors with arguments required? In addition, is the toString() method required as well? Thanks!
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24397324

http://stackoverflow.com/comment/37623797
comment on: http://stackoverflow.com/q/24337462
score: 1
has text: Note that you can never reliably split names on spaces - There are valid first and last names which contain spaces rather than hyphens such as "Anna Mae van der Westhuizen" for example.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37670102
type: Comment
comment on: http://stackoverflow.com/a/24361260
has text: I have upvoted you already and will accept the answer, as soon as it satisfies my condition. Please elaborate on how 160 will become 200 using your scheme.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37730947
type: Comment
type: QuestionComment
has text: ChairLeft=ChairTotal-ChairEnteredByUser;
score: 0
comment on: http://stackoverflow.com/q/24393902

http://stackoverflow.com/comment/37507170
type: AnswerComment
comment on: http://stackoverflow.com/a/24275494
has text: Ok, I have added the button, it works perfectly fine now. At this point, how would I add the picture? Should I set the icon of a new label to the picture and then add the label to the frame or can I do it differently?
type: Comment
score: 0

http://stackoverflow.com/q/24346722
has comment: http://stackoverflow.com/comment/37682367
tagged with: spring-websocket
tagged with: javascript
has comment: http://stackoverflow.com/comment/37683037
has title: Spring MVC and Websocket Exception using Sockjs with Stompjs
score: 4
has comment: http://stackoverflow.com/comment/37682038
has answer: http://stackoverflow.com/a/24431495
answer count: 3
has answer: http://stackoverflow.com/a/24346999
has body: Hello i have an Spring MVC 4.0.4 project completely configured using annotations inside a Wildfly 8.1 Server, the only problem is when i use the following javascript code for initializing Sockjs using Stompjs i get an exception that i don't understand, for clarity this don't happened to when i used XML based config, i use the tutorial in this link Javascript Code var socket = new SockJS('/frontend/track'); referencesServices.stompClient = Stomp.over(socket); Weboscket java config @Configuration @EnableWebSocketMessageBroker public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { public static final Logger LOGGER = LogManager.getLogger(WebSocketConfig.class); @Override public void registerStompEndpoints(StompEndpointRegistry registry) { LOGGER.debug("INIT WEBSOCKET END POINTS"); registry.addEndpoint("/track").withSockJS();//.setDisconnectDelay(30000); } @Override public void configureMessageBroker(MessageBrokerRegistry registry) { registry.enableSimpleBroker("/updates"); // registry.enableStompBrokerRelay("/queue/", "/topic/"); registry.setApplicationDestinationPrefixes("/app"); } } Exception 17:57:40,997 ERROR [io.undertow.request] (default task-24) UT005023: Exception handling request to /frontend/track/info: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.web.socket.sockjs.SockJsException: Uncaught failure in SockJS request, uri=http://localhost:8080/frontend/track/info; nested exception is java.lang.NullPointerException at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:973) [spring-webmvc-4.0.4.RELEASE.jar:4.0.4.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852) [spring-webmvc-4.0.4.RELEASE.jar:4.0.4.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final] at org.springframework.web.servlet.FrameworkServlet.service(F…
tagged with: websocket
has comment: http://stackoverflow.com/comment/37683174
favorite count: 0
possible better answer: http://stackoverflow.com/a/24431495
has comment: http://stackoverflow.com/comment/37682856
has comment: http://stackoverflow.com/comment/37762336
upvote count: 4
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37679957
has comment: http://stackoverflow.com/comment/37681654
type: Question
has answer: http://stackoverflow.com/a/24368896
accepted answer: http://stackoverflow.com/a/24368896

http://stackoverflow.com/comment/37655379
comment on: http://stackoverflow.com/a/24353678
score: 0
type: AnswerComment
type: Comment
has text: That's what I suspected, I'll look into them, thanks.

http://stackoverflow.com/comment/37631321
comment on: http://stackoverflow.com/a/24341558
score: 0
type: AnswerComment
has text: What worries me is polling wouldn't scale I was looking for a trigger or something better
type: Comment

http://stackoverflow.com/comment/37790331
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24424340
type: Comment
has text: I checked it out and it's working like a charm! You are awesome! :)

http://stackoverflow.com/comment/37796975
type: AnswerComment
comment on: http://stackoverflow.com/a/24428618
type: Comment
has text: I read that Java have a default keystore.How to use it without needing of external files?
score: 0

http://stackoverflow.com/a/24357755
accepted answer of: http://stackoverflow.com/q/24357622
type: Answer
answers question: http://stackoverflow.com/q/24357622
downvote count: 0
score: 1
has body: There are a few weblogic startup (and shutdown scripts), one for Windows (ending in "cmd") and one for Unix/Linux (ending in "sh"). The filename begins startWebLogic and it was installed in your weblogic/bin folder. Per the documentation (linked above), The startWebLogic script does the following: Sets environment variables by invoking DOMAIN_NAME\bin\setDomainEnv.cmd (setDomainEnv.sh on UNIX), where DOMAIN_NAME is the directory in which you located the domain; for example, WL_HOME\user_projects\domains\DOMAIN_NAME, and where WL_HOME is the location in which you installed WebLogic Server. Invokes the java weblogic.Server command, which starts a JVM that is configured to run a WebLogic Server instance.
has comment: http://stackoverflow.com/comment/37663585
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/24275691
type: Question
tagged with: ssl
has answer: http://stackoverflow.com/a/24275758
tagged with: proxy
score: 0
has body: I am trying to implement an SSL proxy server in Java that does not raise certificate errors in the browser. I understand that I will need to process the "CONNECT" request, do an SSL handshake thus requiring that I create a sever certificate and store that in the keystore which I will initialize for the SSL socket. But the browser will always have to verify the server certificate returned and throw the warning error if; 1.The CA certificate is not trusted, but this can be overcome by installing the CA certificate used in signing the server certificate once in the browser. 2.The CN of the certificate does not match the hostname of the website being requested. For this second issue, I implemented using BouncyCastle a certificate generation thread, that uses the hostname being requested to generate a certificate that is signed with the trusted CA private key from above. Then I add the server certificate generated and it's private key into the keystore using the hostname as the alias for the key entry. Now comes the part I can't seem to get a hold of, how do I get to use different certificates for the handshake depending on the hostname being requested. I have seen so many suggestions talking about keymanagers and sslcontext but none of that seem to be able to dynamically change the certificate used for sslhandshake depending on the differing hostname being requested. I am sorry for the very verbose question, I am new to all this, so please be a little patient with me. EDIT: Considering implementing a keymanager and initializing sslcontext with it, and creating the serversocket, at the moment when the serversocket is being created there is no hostname being requested, so how do I create a keymanager that is dynamic unlike the fixedserveralias examples I have seen around.
answer count: 3
has answer: http://stackoverflow.com/a/24337752
accepted answer: http://stackoverflow.com/a/24337752
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37665233
has answer: http://stackoverflow.com/a/24337712
has title: How to implement an SSL proxy server in Java that overcomes certificate errors in browsers?
tagged with: java
possible better answer: http://stackoverflow.com/a/24275758
tagged with: https

http://stackoverflow.com/q/24420761
tagged with: java
has title: Issue with addMouseMotionListener getting wrong coordinates
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/24421064
has body: I borrowed the class below to make a selection area tool for a project. But it has a issue when I try to make a selection when the content is not aligned at top-left, it get my mouse coordinates related to the ScrollPane, but draws over the image - See this SS for better understanding: sscce: import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.Robot; import java.awt.Toolkit; import java.awt.event.*; import java.awt.image.*; import javax.swing.*; /** Getting a Rectangle of interest on the screen. Requires the MotivatedEndUser API - sold separately. */ public class ScreenCaptureRectangle { Rectangle captureRect; ScreenCaptureRectangle(final BufferedImage screen) { final BufferedImage screenCopy = new BufferedImage(screen.getWidth(), screen.getHeight(), screen.getType()); final JLabel screenLabel = new JLabel(new ImageIcon(screenCopy)); JScrollPane screenScroll = new JScrollPane(screenLabel); screenScroll.setPreferredSize(new Dimension((int)(screen.getWidth()*2), (int)(screen.getHeight()*2))); JPanel panel = new JPanel(new BorderLayout()); panel.add(screenScroll, BorderLayout.CENTER); final JLabel selectionLabel = new JLabel("Drag a rectangle in the screen shot!"); panel.add(selectionLabel, BorderLayout.SOUTH); repaint(screen, screenCopy); screenLabel.repaint(); screenLabel.addMouseMotionListener(new MouseMotionAdapter() { Point start = new Point(); @Override public void mouseMoved(MouseEvent me) { start = me.getPoint(); repaint(screen, screenCopy); selectionLabel.setText("Start Point: " + start); screenLabel.repaint(); } @Override public void mouseDragged(MouseEvent me) { Point end = me.getPoint(); captureRect = new Rectangle(start, new Dimension(end.x-start.x, end.y-start.y)); repaint(screen, screenCopy); screenLabel.repaint(); selectionLabel.setText("Rectangle: " + captureRect); } }); JOptionPane.showMessageDialog(null, panel); System.out.println…
score: 0
has answer: http://stackoverflow.com/a/24421180
tagged with: jscrollpane
possible better answer: http://stackoverflow.com/a/24421180
tagged with: positioning
tagged with: swing
has answer: http://stackoverflow.com/a/24421064
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37781949

http://stackoverflow.com/comment/37545365
type: AnswerComment
type: Comment
has text: It has other uses indeed (MongoDB, etc), but its main use is as a scripting language for website clients.
comment on: http://stackoverflow.com/a/24295964
score: 0

http://stackoverflow.com/comment/37717334
type: QuestionComment
has text: How did you test the `CorsFilter`? With AJAX request or with just a simple GET?
score: 0
comment on: http://stackoverflow.com/q/24386712
type: Comment

http://stackoverflow.com/comment/37658554
comment on: http://stackoverflow.com/a/24355262
has text: Thanks Martin - in this case, y0, and y1 created through myFunc will be linked to the SAME enclosing instance of X, correct?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24333922
tagged with: javascript
has comment: http://stackoverflow.com/comment/37681432
has answer: http://stackoverflow.com/a/28928931
has comment: http://stackoverflow.com/comment/37676365
has comment: http://stackoverflow.com/comment/37673415
type: UnansweredQuestion
score: 0
tagged with: selenium
tagged with: browsermob
tagged with: phantomjs
tagged with: java
has comment: http://stackoverflow.com/comment/37694173
type: Question
has title: Does Browser mob proxy supports capturing network traffic for applications running on localhost?
has body: I am working upon designing an automatic client side performance tracking tool. I saw browsermob proxy alongwith selenium can be used for writing such tests. But, i am wondering if :- Can BMP+Selenium be used for capturing network traffic for applications running on localhost and generate HAR files ? I have googled and discovered tools for performing these operations, like, HAR can be generated using BMP+Selenium/Firebug+NetExport/Chrome dev tools but I am more interested if any APIs are available for these operations like Browser Navigation Timing API ?
answer count: 1

http://stackoverflow.com/q/24301118
has comment: http://stackoverflow.com/comment/37556016
has title: Integrating Spring Security into Grails Using Netbeans IDE
tagged with: grails
score: 0
answer count: 1
tagged with: spring-security
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/24304570
accepted answer: http://stackoverflow.com/a/24304570
has body: Am trying to integrate Spring security into a Grails Web application using NetBeans IDE. Steps were: added mavenRepo "http://repo.spring.io/milestone" to repository compile ":spring-security-core:2.0-RC2" to plugins. When I try grails s2-quickstart com.zot.auth User Role in cmd prompt I get below error. Can anyone help. Also would like to know if we can create the spring security files directly in NetBeans like we create the pojos I mean without using a commandline. | Error Error generating web.xml file (Use --stacktrace to see the full trace)
type: Question

http://stackoverflow.com/q/24344507
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24344928
upvote count: 1
downvote count: 1
has body: actually i am new to java &amp;I am developing a Java web-application.So i want to ask.. How many web.xml file can be present for an single web application? It can be more than one or it is only one for the whole application.
tagged with: java
has answer: http://stackoverflow.com/a/24345062
type: Question
tagged with: jakarta-ee
has title: how many Web.xml for an single web app
answer count: 2
favorite count: 0
linked to: http://stackoverflow.com/q/20368890
score: 0
duplicate of: http://stackoverflow.com/q/20368890

http://stackoverflow.com/comment/37586283
type: QuestionComment
has text: Any stacktrace? (Please update question! Don't post the stack trace as comment.)
score: 1
comment on: http://stackoverflow.com/q/24317713
type: Comment

weblogic-10.x
tag name: weblogic-10.x
type: Tag
tags question: http://stackoverflow.com/q/24289040
tags question: http://stackoverflow.com/q/24293205
tags question: http://stackoverflow.com/q/24390402

http://stackoverflow.com/comment/37526820
type: Comment
has text: Well you can add @Autowire to the constructor. Works similar to setter injecton.
comment on: http://stackoverflow.com/q/24286546
score: 0
type: QuestionComment

http://stackoverflow.com/comment/37781112
type: Comment
score: 1
has text: where specifically is the concurrent modification exception thrown? It is almost certainly cause by mutating the map while iterating over the keyset, entryset, or values.
comment on: http://stackoverflow.com/q/24419489
type: QuestionComment

android-library
type: Tag
tags question: http://stackoverflow.com/q/24267258
tag name: android-library
tags question: http://stackoverflow.com/q/24354527

http://stackoverflow.com/comment/37540944
comment on: http://stackoverflow.com/q/24288738
has text: `onclick` is not the right place to have `#{navigationTo.reservate()}`. What's the purpose of `navigationTo.time1button`? Can't you have the `reservate` function in there?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24339863
tagged with: java
score: -1
tagged with: windows-services
type: Question
upvote count: 0
has title: Windows Service in Java
has body: I am writing application in java that supports windows service, I use this URL: http://benjsicam.me/blog/running-a-java-application-as-a-windows-service-part-1-tutorial/ But when I run application, I cannot show any service in manage-> windows services, is the java support windows service when system is starting the service start automatically? If your answer is yes, please describe about it. Best Regards
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/24340081
downvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24340081

http://stackoverflow.com/comment/37599354
type: Comment
has text: how do you check, what have you done so far, where does the change come from? have you read the [help center for questions](http://stackoverflow.com/help/how-to-ask), what Java resources have you read up on so far?
comment on: http://stackoverflow.com/q/24324766
score: 0
type: QuestionComment

http://stackoverflow.com/q/24358784
has title: Show AlertDialog without hiding ActionBar
has body: I'd like to show an Alert Dialog which does not hide action bar. Is it possible to do it? The code which I tried is: AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setIcon(R.drawable.ic_launcher); builder.setTitle("Basemap selection"); builder.setSingleChoiceItems(new String[]{"Create cache", "Use existing file"}, 0, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //Some logic here. } }); builder.setNegativeButton(R.string.common_cancel, null); builder.create().show(); It covers the whole screen but I need the action bar to be available while dialog is showing. I know that it might violate some android rules but UX department wants it. The screenshot is:
tagged with: android
tagged with: android-actionbar
has comment: http://stackoverflow.com/comment/37665232
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37665742
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/37665226
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/37665548
possible better answer: http://stackoverflow.com/a/24358889
answer count: 2
has answer: http://stackoverflow.com/a/24358889
has comment: http://stackoverflow.com/comment/37665261
accepted answer: http://stackoverflow.com/a/24359411
has comment: http://stackoverflow.com/comment/37665574
linked to: http://stackoverflow.com/q/4132699
favorite count: 0
has answer: http://stackoverflow.com/a/24359411

http://stackoverflow.com/q/24341441
type: Question
tagged with: elasticsearch-jdbc-river
has answer: http://stackoverflow.com/a/24543896
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/24341558
favorite count: 0
type: UnansweredQuestion
has body: I've ran this query and it worked well. curl -XPUT 'localhost:9200/_river/my_jdbc_river/_meta' -d '{ "type" : "jdbc", "jdbc" : { "url" : "jdbc:mysql://localhost:3306/test", "user" : "myaccount", "password" : "myaccount", "sql" : "select * from orders" } }' Everything seems to be indexed. However, when I changed a data from the Orders Table, the changes did not reflect the document in ElasticSearch. Is it possible to automatically sync updated/changed data?
tagged with: jdbc
tagged with: elasticsearch
score: 2
downvote count: 0
tagged with: java
tagged with: mysql
has title: Automatically syncing ElasticSearch with SQL

http://stackoverflow.com/comment/37676855
has text: For the similar C/C++ question see http://stackoverflow.com/questions/7943052/return-a-vs-return-a
comment on: http://stackoverflow.com/q/24364608
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24356687
score: 4
tagged with: args4j
answer count: 2
downvote count: 0
favorite count: 0
tagged with: command-line
has title: How to add command line parameter dependency using JCommander?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/37539556
tagged with: jcommander
has body: I am using JCommander for command line parameters parsing. I would like to add parameter dependency, but from the JCommander documentation, I am not able to find out if it is even supported. Has anyone tried it ? For example, java -jar Some.jar -a Foo -b Hola So, option -b shall only accompany with option -a. This is supported in args4j. However, I can't use args4j because it does not support multiple values as JCommander. Thanks
tagged with: java
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/47591154

http://stackoverflow.com/a/24330514
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/24329777
downvote count: 0
has body: How about $(function(){ alert("command:ready"); }); And then engine.onAlert = new EventHandler&lt;WebEvent&lt;String&gt;&gt;() { @Override void handle(WebEvent&lt;String&gt; event) { if("command:ready".equals(event.getData())){ //TODO: initialize } } } (seen here http://habrahabr.ru/company/codeorchestra/blog/198776/)
score: 4
has comment: http://stackoverflow.com/comment/37612852

http://stackoverflow.com/comment/37735802
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24395442
has text: BTW Your OTP file doesn't have to be private or generated. You could use a publicly available image(s) of a decent size to form an OTP.

spring-data-jpa
tags question: http://stackoverflow.com/q/24405293
tags question: http://stackoverflow.com/q/24367572
tags question: http://stackoverflow.com/q/24351828
tags question: http://stackoverflow.com/q/24426644
tags question: http://stackoverflow.com/q/24297917
tags question: http://stackoverflow.com/q/24415983
tags question: http://stackoverflow.com/q/24292026
type: Tag
tag name: spring-data-jpa
tags question: http://stackoverflow.com/q/24347283
tags question: http://stackoverflow.com/q/24388809
tags question: http://stackoverflow.com/q/24286475

http://stackoverflow.com/comment/37546832
score: 0
type: Comment
type: AnswerComment
has text: Could you explain what is actually going on under the covers? My belief is that your (proprietary) library is doing code injection. Is that correct?
comment on: http://stackoverflow.com/a/24287659

http://stackoverflow.com/comment/38034921
type: Comment
score: 0
comment on: http://stackoverflow.com/q/24386265
has text: I found the solution, There is a class called AudioRecord in android instead of targetDataline in java. thank you for answering!
type: QuestionComment

http://stackoverflow.com/comment/37674783
has text: @Vidya make sure you have this line `$(ele).val(responseJSON);` as in the above answer.
type: Comment
comment on: http://stackoverflow.com/a/24361398
score: 0
type: AnswerComment

http://stackoverflow.com/q/24285283
has comment: http://stackoverflow.com/comment/37524379
favorite count: 0
score: -1
type: Question
answer count: 2
downvote count: 2
upvote count: 1
tagged with: php
linked to: http://stackoverflow.com/q/5779309
has body: im working on an app which the users needs to login to. This is coded in Java, the login works without problems. However, i want to receive the "message" from the json and display it. As i said, the code works, but only if the json string "message" dosent contain any special characters like æ, ø, å. I've tried anything, also, i have another file which gets the data from the DB and shows it in a listview, used the exact same code, and this works. The json in the login.php returns NULL, it replaces the whole string and just replaces it with NULL. My login.php (returning null) &lt;?php header('content-type:text/json;charset=utf-8'); $Uname = $_POST["txtUName"]; $Pass = $_POST["txtPass"]; $con=mysqli_connect("localhost","user","pass","db");// Check connection if (mysqli_connect_errno()) { $response["success"] = 0; $response["message"] = "Database Error!"; die(json_encode($response)); echo "Failed to connect to MySQL: " . mysqli_connect_error(); } //mysql_query("SET NAMES 'utf8'", $con); mysql_query("SET NAMES 'utf8'"); $result = mysqli_query($con,"SELECT * FROM users where email='$Uname' AND encrypted_password='$Pass'"); while($row = mysqli_fetch_array($result)) { $response["success"] = 1; $response["message"] = $row['firstname'] . " " . $row['lastname']; die(json_encode($response)); //header("Location: home.php"); } mysqli_close($con); ?&gt; My getdata.php (works) &lt;?php include "db_config.php"; $cat = $_GET['app_category']; if($cat == '99'){ mysql_query("SET NAMES 'utf8'"); $sql=mysql_query("SELECT * FROM `test_fc`"); while($row=mysql_fetch_assoc($sql)) $output[]=$row; print ('{ "app_item":'); print(json_encode($output)); print ('}'); mysql_close(); } else { mysql_query("SET NAMES 'utf8'"); $sql=mysql_query("SELECT * FROM `test_fc` WHERE app_category={$cat}"); while($row=mysql_fetch_assoc($sql)) $output[]=$row; print ('{ "app_item":'); print(json_encode($output)); print ('}'); mysql_close(); } ?&gt; My java parser can read the getdata.php without any problem, even w…
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: JSON encoding returning NULL
has answer: http://stackoverflow.com/a/24285799
tagged with: mysql
linked to: http://stackoverflow.com/q/5729806
possible better answer: http://stackoverflow.com/a/24285799
has answer: http://stackoverflow.com/a/24286162
has comment: http://stackoverflow.com/comment/37524838
type: AnsweredQuestion
tagged with: android
accepted answer: http://stackoverflow.com/a/24286162

http://stackoverflow.com/a/24418073
type: Answer
score: 1
has body: You can also use the newLine() method that will write a line separator. For further details, check the link: Android BufferedWriter
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/24417988

http://stackoverflow.com/q/24311061
tagged with: python
has comment: http://stackoverflow.com/comment/37574355
has answer: http://stackoverflow.com/a/24311185
tagged with: c++
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37573630
score: 1
possible better answer: http://stackoverflow.com/a/24311194
tagged with: java
has answer: http://stackoverflow.com/a/24311194
upvote count: 1
has comment: http://stackoverflow.com/comment/37573402
has comment: http://stackoverflow.com/comment/37573566
has body: For example, is it considered bad practice to write: try { #some code } catch (Exception e){ #some code } Rather than try { #some code } catch (ExceptionName e){ #like ArrayIndexOutOfBoundsException #some code } I guess the question holds for pretty much every language, be it Python, C++, Java...Any thoughts? I am asking because it seems to me that you shouldn't, since it means you don't know what kind of error you are handling and what to do with it, but I see some people do it.
type: Question
has comment: http://stackoverflow.com/comment/37573499
linked to: http://stackoverflow.com/q/21553327
has comment: http://stackoverflow.com/comment/37573565
accepted answer: http://stackoverflow.com/a/24311185
has title: should I always know the type of my exception before I catch it?
has comment: http://stackoverflow.com/comment/37573478
has comment: http://stackoverflow.com/comment/37573460
has answer: http://stackoverflow.com/a/24311216
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/37573781
favorite count: 0
tagged with: exception

http://stackoverflow.com/comment/37751763
comment on: http://stackoverflow.com/q/24404997
has text: please add comments for negative vote..so i can findout my mistake..
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/24366952
has answer: http://stackoverflow.com/a/24367121
has answer: http://stackoverflow.com/a/24367035
tagged with: for-loop
has answer: http://stackoverflow.com/a/24367057
upvote count: 0
has body: System.out.print("Enter Number to Search: "); String get = br.readLine(); int input = Integer.parseInt(get); for(int i = 0; i &lt; 5; i++) { num[i] = inFile.nextInt(); } for(int j = 0; j &lt; 5; j++) { if(input == num[j]) { System.out.println("Search number is found!"); break; } else { System.out.println("Search number is lost!"); } } the numbers inside num[i] are 1, 2, 3, 4, 5. my problem is that when i try to search for number 5, the output is this: Enter Number to Search: 5 Search number is lost! Search number is lost! Search number is lost! Search number is lost! Search number found! how can i print the "search number found!" without printing the "Search number is lost!"??
has answer: http://stackoverflow.com/a/24366988
has title: java Condition inside a loop
has comment: http://stackoverflow.com/comment/37680036
answer count: 4
favorite count: 0
type: UnansweredQuestion
score: -3
tagged with: conditional-statements
tagged with: java
downvote count: 3
type: Question

bluetooth
tags question: http://stackoverflow.com/q/24277036
tag name: bluetooth
tags question: http://stackoverflow.com/q/24289282
tags question: http://stackoverflow.com/q/24331200
tags question: http://stackoverflow.com/q/24351267
tags question: http://stackoverflow.com/q/24417853
type: Tag
tags question: http://stackoverflow.com/q/24413698
tags question: http://stackoverflow.com/q/24421617

primary-key
tag name: primary-key
tags question: http://stackoverflow.com/q/24282297
type: Tag
tags question: http://stackoverflow.com/q/24323674

http://stackoverflow.com/comment/37714527
type: AnswerComment
has text: @Kazman I recommend `WITH (FORMAT CSV)` instead - it'll handle things like newlines embedded in strings better.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/24370730

http://stackoverflow.com/a/24403712
accepted answer of: http://stackoverflow.com/q/24395752
upvote count: 7
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/24395752
has comment: http://stackoverflow.com/comment/37828589
has body: While Vakh’s answer is correct, it is unnecessarily complex. Often, the work of implementing your own key class does not pay off. You can use a List as a key which implies a slight overhead due to boxing primitive values but given the fact that we do operations like hashing here, it will be negligible. And sorting doesn’t have to be done by using a for loop and, even worse, an anonymous inner class for the Comparator. Why do we have streams and lambdas? You can implement the Comparator using a lambda like (p1,p2) -&gt; p1.getDay()-p2.getDay() or, even better, Comparator.comparing(Plant::getDay). Further, you can do the entire operation in one step. The sort step will create an ordered stream and the collector will maintain the encounter order, so you can use one stream to sort and group: Map&lt;List&lt;?&gt;, List&lt;Plant&gt;&gt; groupedPlants = allPlants.stream() .filter(plant -&gt; passesFilters(plant, filters)) .sorted(Comparator.comparing(Plant::getDay)) .collect(Collectors.groupingBy(p -&gt; Arrays.asList(p.getMeasurement(), p.getCamera(), p.getReplicateNumber()))); That’s all.
type: Answer
has comment: http://stackoverflow.com/comment/37811133
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/37850107

http://stackoverflow.com/comment/37519242
type: QuestionComment
comment on: http://stackoverflow.com/q/24281535
score: 0
type: Comment
has text: Could you tell me that how u find the solution for that

http://stackoverflow.com/comment/37586380
type: QuestionComment
type: Comment
has text: @ADTC Line 54 appears to be: `conn.close();`
comment on: http://stackoverflow.com/q/24317713
score: 0

http://stackoverflow.com/q/24361397
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/24687251
has body: I have a project for a web-app. Most classes of this project must be compiled into .jar file and put to server into codebase/WEB-INF/lib dir. These classes are used by server only. But I have some classes which need to be used on the server and the client. These classes must be put directly to codebase/[package.class]. All of these classes depend on each other and vice-versa. End of story. Now I try to move my project from IDE build to Gradle. My project contains two modules which depend on each other. InteljID provide warning for me and compile this fine. But with Gradle it gets stuck. So, can I somehow split these classes in two logical groups, and have an easy way to build the structure described above? I was trying to make multi-project build, several sourceSets but everywhere I got the same circular dependency errors.
has answer: http://stackoverflow.com/a/24473596
score: 4
possible better answer: http://stackoverflow.com/a/24687251
answer count: 2
has title: Circular dependencies or right way to build a project
tagged with: project
tagged with: java
accepted answer: http://stackoverflow.com/a/24473596
tagged with: gradle
upvote count: 4
type: AnsweredQuestion

http://stackoverflow.com/q/24398477
has comment: http://stackoverflow.com/comment/37739734
answer count: 1
has answer: http://stackoverflow.com/a/24398501
favorite count: 0
has comment: http://stackoverflow.com/comment/37739687
has comment: http://stackoverflow.com/comment/37739670
has comment: http://stackoverflow.com/comment/37741519
type: AnsweredQuestion
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/24398501
downvote count: 3
type: Question
has body: I have three classes as following, class b and c are extending class a. I am wondering why the code is not reading the value of b and c variables. public class a{ protected int myvalue = 1; } public class b extends a{ private int myvalue = 2; } public class c extends a{ private int myvalue = 3; } body of my main method ArrayList&lt;a&gt; myList= new ArrayList(); myList.add(new b()); myList.add(new c()); for(int i =0;i&lt;myList.size();i++) System.err.println("value is:" + myList.get(i).myvalue); output 1 1 From Oracle website: Within a class, a field that has the same name as a field in the superclass hides the superclass's field, even if their types are different. Within the subclass, the field in the superclass cannot be referenced by its simple name. Instead, the field must be accessed through super, which is covered in the next section. Generally speaking, we don't recommend hiding fields as it makes code difficult to read.
has title: Why subclasses does not override the value of their superclass variable?
score: -1
has comment: http://stackoverflow.com/comment/37739701
has comment: http://stackoverflow.com/comment/37739662

http://stackoverflow.com/comment/37590821
has text: Use the column names instead of *
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24319978

http://stackoverflow.com/q/24280999
has comment: http://stackoverflow.com/comment/37516724
has comment: http://stackoverflow.com/comment/37516846
accepted answer: http://stackoverflow.com/a/24281631
type: Question
type: AnsweredQuestion
score: 3
tagged with: java
has title: Convert hexadecimal file into unsigned int 32 Big-Endian in Java
possible better answer: http://stackoverflow.com/a/24284570
tagged with: endianness
has comment: http://stackoverflow.com/comment/37516341
has answer: http://stackoverflow.com/a/24281631
has answer: http://stackoverflow.com/a/24284570
answer count: 2
has body: It might be a question already asked, but I have not found a satisfactory answer yet out there. In particular because this conversion has always been done in c or C++. Btw, how do you convert an hexadecimal file (200MB) into its UINT32 Big-endian representation in Java? This an example of what I am trying to achieve: 54 00 00 00 -&gt; 84 55 F1 2E 04 -&gt; 70185301 A2 3F 32 01 -&gt; 20070306 and so on EDIT File fileInputString = new File(inputFileField.getText()); FileInputStream fin = new FileInputStream(fileInputString); FileOutputStream out = new FileOutputStream(fileDirectoryFolder.getText() +"/"+ fileInputString.getName()); byte[] fileContent = new byte[(int)fileInputString.length()]; fin.read(fileContent); System.out.println("File Lenght" + fileContent.length); for(int i = 0; i &lt; fileContent.length; i++){ Byte b = fileContent[i]; // Boxing conversion converts `byte` to `Byte` int value = b.intValue(); out.write(value); } close(); System.out.println("Done"); EDIT 2 File fileInputString = new File(inputFileField.getText()); FileInputStream fin = new FileInputStream(fileInputString); FileOutputStream out = new FileOutputStream(fileDirectoryFolder.getText() +"/"+ fileInputString.getName()); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] fileContent = new byte[(int)fileInputString.length()]; System.out.println("File Lenght" + fileContent.length); int bytesRead; while (( bytesRead = fin.read(fileContent)) != -1) { ByteBuffer.wrap(fileContent).order(ByteOrder.LITTLE_ENDIAN).getLong(); bos.write(fileContent, 0, bytesRead); } out.write(bos.toByteArray()); System.out.println("Done"); EDIT 3 DataOutputStream out = new DataOutputStream(new FileOutputStream(output)); DataInputStream in = new DataInputStream(new FileInputStream(input))) { int count = 0; while (count &lt; input.length() - 4) { in.readFully(buffer, 4, 4); String s=Long.toString(ByteBuffer.wrap(buffer).order(ByteOrder.LITTLE_ENDIAN).getLong()); out.writeBytes( s + " "); count += 4; } Thanks
upvote count: 3
has comment: http://stackoverflow.com/comment/37517041
has comment: http://stackoverflow.com/comment/37516388
favorite count: 0
tagged with: integer
has comment: http://stackoverflow.com/comment/37516786
downvote count: 0

http://stackoverflow.com/a/24392086
answers question: http://stackoverflow.com/q/24391944
has body: Please check this line : System.out.println(controller.getUpdateGeoNetworkDelay() + messageTextView.getText().toString()); messageTextView.setText(message); My guess is that message is the content of the arguments in the bundle passed from newInstance so it should be something like this: messageTextView.setText(getArguments().getStringExtra(EXTRA_MESSAGE,"Message not passed")); Also the final modifier public static final MyFragment newInstance in this line seems inappropriate so remove it.
accepted answer of: http://stackoverflow.com/q/24391944
has comment: http://stackoverflow.com/comment/37727778
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/24402674
tagged with: extjs
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/24806838
has title: ExtJS loading multiple stores from a single servlet
type: AnsweredQuestion
score: 1
tagged with: java
has body: I have 2 comboboxes on a window that have their store loaded when the window is created. I have a single servlet that calls the same function for both comboboxes we are trying to load however I have found that this causes problems and the stores don't get loaded correctly. Any ideas? EDIT: So the more appropriate question would be: How to handle multiple requests on the same servlet? Is that a multithreading issue? I'd really like to avoid having to deal with that since I'm not that experienced even though this one seems easy...
tagged with: multithreading
upvote count: 1
has comment: http://stackoverflow.com/comment/37747702
type: Question
accepted answer: http://stackoverflow.com/a/24806838
tagged with: servlets

http://stackoverflow.com/comment/37524089
comment on: http://stackoverflow.com/q/24284850
type: Comment
has text: You should rarely try-catch in C++ but build your code around RAII-idiom: http://en.m.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization
score: 0
type: QuestionComment

android-framelayout
tag name: android-framelayout
tags question: http://stackoverflow.com/q/24271939
tags question: http://stackoverflow.com/q/24322621
type: Tag

http://stackoverflow.com/a/46003302
downvote count: 0
has body: Just in case you use a separate Tomcat local server. If you use embedded tomcat, this is not applicable. In your pom.xml, add the tomcat plugin. (You can use this for both Tomcat 7 and 8): pom.xml org.apache.tomcat.maven tomcat7-maven-plugin 2.2 http:// localhost:8080/manager/text TomcatServer *(From maven > settings.xml)* *yourtomcatusername* *yourtomcatpassword* tomcat-users.xml <role rolename="manager-gui"/> <role rolename="manager-script"/> <user username="admin" password="password" roles="manager-gui,manager-script" /> settings.xml (maven > conf) TomcatServer admin password * deploy/re-deploy mvn tomcat7:deploy OR mvn tomcat7:redeploy Tried this on (Both Ubuntu and Windows 8/10): * Jdk 7 & Tomcat 7 * Jdk 7 & Tomcat 8 * Jdk 8 & Tomcat 7 * Jdk 8 & Tomcat 8 Tested on Both Jdk 7/8 & Tomcat 7/8. (Works with Tomcat 8.5 Also, will test Tomcat 9 soon) Note: Tomcat manager should be running or properly setup, before you can use it with maven.
has comment: http://stackoverflow.com/comment/92873771
has comment: http://stackoverflow.com/comment/92855372
has comment: http://stackoverflow.com/comment/92885984
score: 3
answers question: http://stackoverflow.com/q/24271213
has comment: http://stackoverflow.com/comment/113851359
has comment: http://stackoverflow.com/comment/92849404
upvote count: 3
type: Answer

http://stackoverflow.com/q/24401386
type: AnsweredQuestion
tagged with: ls
has comment: http://stackoverflow.com/comment/37745608
tagged with: java
tagged with: filewriter
has body: I have written a shell script (test.sh) using Java. This shell script actually does a copy job from one file to the other. After the execution of the shell script I have opened the directory from Console and typed ls. It shows the output file with ? after the extension. example : foo.csv? File execFile = new File(file); FileWriter fwFile; try { fwFile = new FileWriter(execFile); execFile.setExecutable(true); BufferedWriter bwFile = new BufferedWriter(fwFile); bwFile.write(strOutput.substring(0, 2)); bwFile.write("\r\n"); bwFile.write("cd " + strOutput); bwFile.write("\r\n"); bwFile.write("mkdir " + strOutput); bwFile.write("\r\n"); bwFile.write(strUnixPath); bwFile.write("\r\n"); bwFile.write("cd " + strWorkingPath + IPlatinumConstants.FS+"lib"+IPlatinumConstants.FS+"Unx"); bwFile.write("\r\n"); bwFile.write("echo Cut Src Start time %time%"); bwFile.write("\r\n"); bwFile.write("cp " + " \"" + strSourceFilePath + "\" \"" + strOutput + "copy_A\""); bwFile.write("\r\n"); My guess is that, while creating the shell script using java, something needs to taken care of
has title: Unix: "ls" command shows files with ? after the extension
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/37745069
favorite count: 0
has comment: http://stackoverflow.com/comment/37745359
has answer: http://stackoverflow.com/a/24402101
accepted answer: http://stackoverflow.com/a/24402101
tagged with: shell
has comment: http://stackoverflow.com/comment/37745991
has comment: http://stackoverflow.com/comment/37745028
tagged with: unix
downvote count: 0
score: 1
type: Question

http://stackoverflow.com/comment/37708640
has text: then why do you need a activity class. Make it a normal java class and pass info needed to the construtor of that.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24381733
type: Comment

http://stackoverflow.com/a/24371160
score: 0
has body: From our chat I can see that you want to you want to map each WS.Response to a JsonNode, with will leave you with a List&lt;Promise&lt;JsonNode&gt;&gt;. Promise.sequence can be used to convert that List&lt;Promise&lt;JsonNode&gt;&gt; to a Promise&lt;List&lt;JsonNode&gt;&gt;, which you can then map to Promise&lt;Result&gt;. public static Promise&lt;Result&gt; index() { final Promise&lt;WS.Response&gt; resultPromiseJobs = WS.url("https://jobs.github.com/positions.json?description=java").get(); final Promise&lt;Result&gt; result = resultPromiseJobs.flatMap(response -&gt; { JsonNode jobListings = response.asJson(); List&lt;Job&gt; jobs = ... List&lt;Promise&lt;JsonNode&gt;&gt; jsonResultsPromise = jobs.stream().map(job -&gt; { Promise&lt;WS.Response&gt; resultPromiseStock = WS.url("secondURL?someQuery=job").get()); // this also returns a promise // map this to the retrieved JsonNode resultPromiseStock.map(...); }); // Convert the list of promises into a promise of lists Promise&lt;List&lt;JsonNode&gt;&gt; jsonResults = Promise.sequence(jsonResultsPromise); // Now map to Promise&lt;Result&gt; jsonResults.map(...); }); return result; } The catch here though is that if one of the Promises fails to complete, the entire list will fail. In many cases you might want this to happen if you need all the results. It's easy enough to discard failed Promises from a list in Scala using this method, but I'm not sure how to do it in Java without fold.
type: Answer
has comment: http://stackoverflow.com/comment/37693757
has comment: http://stackoverflow.com/comment/37694128
has comment: http://stackoverflow.com/comment/37694784
answers question: http://stackoverflow.com/q/24369113

http://stackoverflow.com/comment/37757712
type: Comment
has text: The browser doesn't send the real file path. You can't get it.
comment on: http://stackoverflow.com/q/24408319
score: 0
type: QuestionComment

http://stackoverflow.com/a/24497625
type: Answer
has body: I am making the same research right now, I came across xsl-excel-engine by Pavel Ptacek - I did not try it yet, but looks promising.
score: 0
answers question: http://stackoverflow.com/q/24426073

http://stackoverflow.com/comment/37663627
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/24358074
has text: can you provide your source please?

http://stackoverflow.com/a/24305678
has comment: http://stackoverflow.com/comment/37563381
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37563234
answers question: http://stackoverflow.com/q/24305548
upvote count: 1
score: 1
has body: The file you are downloading on java client, try opening manually going to the FTP location itself. see if the zip file is okay or not. i had similar issue and found out that zip file was corrupt. Second step would be , check the size of the zip file you are downloading and the size of the downloaded file.

http://stackoverflow.com/q/24414652
linked to: http://stackoverflow.com/q/1968416
has body: I'm trying to connect to an API using volley, I'm setting all the parameters and headers, but it seems that the params are being ignored, what am I missing here? I started learning android volley last week and I'm kind of lost. package com.rep.app.principal; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.TextView; import com.actionbarsherlock.app.SherlockFragmentActivity; import com.android.volley.AuthFailureError; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.VolleyLog; import com.android.volley.toolbox.JsonObjectRequest; import com.android.volley.toolbox.Volley; import com.rep.R; import org.json.JSONObject; import java.util.HashMap; import java.util.Map; public class InicioActivity extends SherlockFragmentActivity { RequestQueue queue = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); txtDisplay = (TextView) findViewById(R.id.txtDisplay); queue=Volley.newRequestQueue(this); AutenticacaoLocalTask mAutenticacaoLocalTask = new AutenticacaoLocalTask(); mAutenticacaoLocalTask.execute((Void) null); } private TextView txtDisplay; public class AutenticacaoLocalTask extends AsyncTask&lt;Void, Void, Boolean&gt; { @Override protected Boolean doInBackground(Void... params) { try { txtDisplay = (TextView) findViewById(R.id.txtDisplay); String url = "http://192.168.1.18/opa/api/"; JsonObjectRequest jsObjRequest = new JsonObjectRequest(Request.Method.POST,url,null, new Response.Listener&lt;JSONObject&gt;() { @Override public void onResponse(JSONObject response) { System.out.println(response); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { } }) { @Override public Map&lt;String, String&gt; getHeaders() throws AuthFailureError { Hash…
answer count: 2
upvote count: 1
favorite count: 0
tagged with: android-volley
has title: Volley JsonObjectRequest Post request ignoring params
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24414761
tagged with: android
linked to: http://stackoverflow.com/q/24285544
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37783656
has answer: http://stackoverflow.com/a/45508525
type: Question
linked to: http://stackoverflow.com/q/43498114

http://stackoverflow.com/q/24306591
type: UnansweredQuestion
tagged with: animation
tagged with: swing
has comment: http://stackoverflow.com/comment/37571501
linked to: http://stackoverflow.com/q/19552735
has answer: http://stackoverflow.com/a/24582869
tagged with: java
has comment: http://stackoverflow.com/comment/37777271
has title: Swing java animation only works when not called from listener
type: Question
score: 5
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/37565235
has comment: http://stackoverflow.com/comment/37564996
has body: I am trying to create an function with an animation in java(swing). I want to create a "stack" of cards and then be able to draw one card from the stack using a method. The card i draw should then be "fliped" to reveal the front side. This is working fine unless when I am trying to draw a new card using listeners. I start the program by building the stack then drawing one card. Then I have a button that draws a new card(actionlistener). The animation does not show however i can see that the stack decreases by one card. I have tried to create a gif to show the problem. Gif file showing the problem http://people.dsv.su.se/~chra4852/gif.gif My best guess would be that it has something to do with threads or the EDT? Here is the code(I have removed the use of the Scalr class since its not important) : import java.awt.*; import java.awt.event.*; import java.awt.image.BufferedImage; import java.io.*; import java.net.URL; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.*; // import org.imgscalr.Scalr; Removed for Stackoverflow public class Test extends JFrame{ public static JPanel cardPanel = new JPanel(); public static JLayeredPane layerPane = new JLayeredPane(); private final CardFlipp cardFlipp; Test() { cardFlipp = new CardFlipp(); this.setLayout(new BorderLayout()); layerPane.setPreferredSize(new Dimension(700, 300)); add(cardPanel, BorderLayout.CENTER); JButton newJButton = new JButton("New card"); newJButton.addActionListener(new drawNewCardListener()); add(newJButton, BorderLayout.SOUTH); setSize(800,400); setLocationRelativeTo(null); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); Point pos = new Point(10,30); cardFlipp.createCardFlipp(30, pos, layerPane, cardPanel); System.out.println("Now running on thread " + Thread.currentThread()); try { Thread.sleep(3000); } catch (InterruptedException ex) { Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex); } cardFlipp.displayCard("…
answer count: 1
has comment: http://stackoverflow.com/comment/37565417
has comment: http://stackoverflow.com/comment/37565125
favorite count: 0

http://stackoverflow.com/a/24297461
downvote count: 0
has comment: http://stackoverflow.com/comment/37548587
type: Answer
answers question: http://stackoverflow.com/q/24297329
has comment: http://stackoverflow.com/comment/37548557
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24297329
has body: You can't do this because it will overwrite values if you use the same key anywhere. But yes there is one alternative using which you can store multiple string values in a single preference key, each value separated by comma. Then you can use convertStringToArray to covert it into String array. I wouldn't suggest you to do it because why should you write more code just for storing and manipulating values for a single key, instead straight way store values for different keys and make comparison with separate values straight way.
type: AcceptedAnswer

http://stackoverflow.com/comment/37600197
score: 0
type: Comment
comment on: http://stackoverflow.com/q/24324941
type: QuestionComment
has text: These last comments do explain it so thank you. So method call doesn't look for a value pair in the map to find the method definition but essentially does a search? Does this mean that if I use excessive method overloading it will (probably marginally) slow down JVM?

connection
tags question: http://stackoverflow.com/q/24353628
type: Tag
tags question: http://stackoverflow.com/q/24289572
tag name: connection
tags question: http://stackoverflow.com/q/24351191

http://stackoverflow.com/a/24358994
has body: That is how you execute java code from the command line (shell, command prompt). The java code is already written and compiled in jars for this example I guess you'd like to open the coreNLP code in Eclipse to use it directly from your java application. You can use maven to create the Eclipse project file, then in Eclipse "import - existing project". You'll need to understand java well in order to understand and use the coreNLP code.
upvote count: 1
answers question: http://stackoverflow.com/q/24355126
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/37771564
type: Comment
comment on: http://stackoverflow.com/q/24415520
has text: do you have proper j connector jar file in your project? http://dev.mysql.com/downloads/connector/j/
score: 0
type: QuestionComment

http://stackoverflow.com/q/24383711
possible better answer: http://stackoverflow.com/a/24428076
tagged with: struts2
has answer: http://stackoverflow.com/a/24428076
answer count: 2
tagged with: customization
downvote count: 0
favorite count: 0
tagged with: interceptor
tagged with: actioncontext
has body: I am writing a customized interceptor for audit logs purpose. I want to get session attributes and request attributes in interceptor. For example: I'll set Username into session and that I am getting too. But the challenge is: I am defining one bean as audit bean where I am setting some values to bean if (this.userName.equals("admin")) { user.setUserName(this.userName); sessionAttributes.put("USER", user); auditBean.setPerm("login success"); requestAttributes.put("auditBean", auditBean); return "success"; } else { auditBean.setPerm("Login Failed initiaqlized"); requestAttributes.put("auditBean", auditBean); addActionError(getText("error.login")); return "error"; } this request attribute is ServletRequestAware obj. But this audit bean I am not able to retrieve into the interceptor, please help regarding this. Map<String, Object> sessionAttributes = invocation.getInvocationContext().getSession(); achieving session like this. Map<String, Object> requestAttributes = invocation.getInvocationContext().getParameters(); with above I am not able to retrieve request params. It's showing JSP request params, but not that I have set in action.
has answer: http://stackoverflow.com/a/24385658
type: AnsweredQuestion
has title: Customized Logging interceptor with bean value in Struts 2
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/24385658
score: 1
tagged with: java

bliki
type: Tag
tag name: bliki
tags question: http://stackoverflow.com/q/24356317

http://stackoverflow.com/a/24393140
has comment: http://stackoverflow.com/comment/37742480
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37731963
accepted answer of: http://stackoverflow.com/q/24392803
answers question: http://stackoverflow.com/q/24392803
type: Answer
has comment: http://stackoverflow.com/comment/37731640
upvote count: 1
has comment: http://stackoverflow.com/comment/37729516
has comment: http://stackoverflow.com/comment/37730917
has body: Ok this is what you wanted implement the other logic yourself public class HourlyEmployee extends Employee { private double hrsWorked; private double hrlyRate; public HourlyEmployee(String first, String last, String ssn, double hours, double rate) throws InvalidHoursWorkedException { super(first, last, ssn); // pass to Employee constructor try { setHrsWorked(hours); } catch (InvalidHoursWorkedException invalidHoursWorkedException) { System.out.println(invalidHoursWorkedException.getMessage()); } // validate &amp; store hourly rate }// end of five item constructor //set hours worked public void setHrsWorked(double hours) throws InvalidHoursWorkedException { if (hours &gt; 0 || hours &lt; 84) throw new InvalidHoursWorkedException(); else { hrsWorked = hours; System.out.println("Hours set to "+hrsWorked); } } public static void main(String arr[]) { try { HourlyEmployee h = new HourlyEmployee("abc","def","xyz",100,10); } catch (InvalidHoursWorkedException e) { System.out.println(e.getMessage()); } } }
score: 1
has comment: http://stackoverflow.com/comment/37731894

http://stackoverflow.com/a/24451589
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/37838437
accepted answer of: http://stackoverflow.com/q/24411401
upvote count: 2
answers question: http://stackoverflow.com/q/24411401
has body: The answer is pretty clear and concise (you actually discovered it yourself): JPA requires a transaction being in progress for the call to EntityManager.persist(…). However your code is not set up to be run inside a transaction. Your configuration looks sane but you're missing an @Transactional on either the DAO or any layer above. As the original question was why the exception is not thrown, I looked up the spec again and discovered that in 7.9.1 it clearly requires the container to throw that exception in a container managed persistence context. Running JPA in Spring is a bit of an in-between scenario, as we clearly don't require JTA and the like but it's understandable that by injecting the EntityManager you assume to be in a managed environment. I filed SPR-11923 to improve that in our JPA infrastructure support. Side track: When working with Spring and JPA, you might wanna have a look at the Spring Data JPA project, which significantly eases the process of building a data access layer, including sane defaults for transaction processing on the repository layer (see this guide for example). Using that would've prevented you from running into the situation in the first place.
has comment: http://stackoverflow.com/comment/37840788
has comment: http://stackoverflow.com/comment/37837873
has comment: http://stackoverflow.com/comment/37838885

http://stackoverflow.com/q/24335810
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/24336834
tagged with: java
has title: how to show a query result in jtable in netbeans
has comment: http://stackoverflow.com/comment/37621614
type: AnsweredQuestion
tagged with: derby
tagged with: jtable
type: Question
has body: I use netbeans 8 and JDBC/Derby and want to show the result of a statement (join of 3 tables) in a jTable. How should I do it? Is there a way to do it manually (not via java code)? when I want to show data from a single table, I Do it through table content>bound. If there is a way in this section please let me know.
has answer: http://stackoverflow.com/a/24336834
tagged with: jdbc
has comment: http://stackoverflow.com/comment/37621466
tagged with: netbeans

http://stackoverflow.com/comment/37654030
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24346805
has text: Sorry, you are right, this is a Kruskal algorithm.

http://stackoverflow.com/comment/37610670
type: Comment
type: QuestionComment
has text: Yes. I already do this, and I get my own MediaPlayer when the click sound completes. The sound and music end at the same time.
comment on: http://stackoverflow.com/q/24322800
score: 0

http://stackoverflow.com/comment/37675857
score: 0
type: AnswerComment
type: Comment
has text: hey @shivam thanks for the reply but they do not have any active FAQ section that support the same theory, I mean the active commit for the repository is a nice observation. would like to know if you have used this feature in the past and satisfied with the performance
comment on: http://stackoverflow.com/a/24364743

http://stackoverflow.com/a/24289850
has comment: http://stackoverflow.com/comment/37535534
upvote count: 1
accepted answer of: http://stackoverflow.com/q/24286965
score: 1
answers question: http://stackoverflow.com/q/24286965
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You missed the declaration of simpleCodeGen: private final SimpleCodeGen simpleCodeGen = new SimpleCodeGen(exception); That means that compileSimple(...) actually returns a CompiledFunction, which extends ContextFunction and such Function. CompiledFunction getFun() { return new CompiledFunction(0, code.toArray(), consts.getRe(), consts.getIm(), funcs.toArray()); } So actually it's the eval(...) function in ContextFunction that is being called. That one has a real implementation. Doing a code analysis without an IDE and just watching the code can be tricky. Using a debugger and stepping through would easily show you the program flow.

http://stackoverflow.com/comment/37745329
has text: Actually I want to change the permission of folder to 777 where I am creating the file so that it can be created without any problem..
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24401458
type: Comment

http://stackoverflow.com/a/24401051
accepted answer of: http://stackoverflow.com/q/24401008
score: 2
answers question: http://stackoverflow.com/q/24401008
type: AcceptedAnswer
downvote count: 0
has body: Long is like integer it cant have decimal on them, but it will round it off. solution: you need to parse it to double first and then cast it to long. sample: String s = "3.1"; double d = Double.valueOf(s); long l = (long) d;
upvote count: 2
type: Answer

http://stackoverflow.com/comment/37785466
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/24423117
score: 1
has text: Why would you want source code in your EAR file?

http://stackoverflow.com/q/24319283
has comment: http://stackoverflow.com/comment/37615620
has title: Thread Sequencing In Java.
favorite count: 0
upvote count: 0
tagged with: multithreading
has answer: http://stackoverflow.com/a/24319331
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24320764
accepted answer: http://stackoverflow.com/a/24320764
tagged with: java
type: Question
answer count: 2
downvote count: 2
has body: In java, how do we do this: Many threads created and writes to a single file. Since any thread can write to that file ( by acquiring the lock) the order of thread writing is gone. The the number of threads created will be more than 40. How to dump the threads provided their sequence is not affected. Thanks in advance.
score: -2
possible better answer: http://stackoverflow.com/a/24319331

http://stackoverflow.com/comment/37546367
has text: Sorry for not posting any code, I thought that explaining it in a few words would make it more clear.Anyways, thank you, your solution works just fine!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/24296521
type: Comment

http://stackoverflow.com/q/24301857
has answer: http://stackoverflow.com/a/24301969
favorite count: 0
has answer: http://stackoverflow.com/a/24301933
has answer: http://stackoverflow.com/a/24302213
has title: How to change String Array to ArrayList in java
upvote count: 2
answer count: 5
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/24301912
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/24301944
tagged with: arrays
tagged with: string
tagged with: arraylist
has body: Here is the original code which has defined String-Array (25). It is working perfectly. But I don't need to define it as 25. Instead, I used arraylist. Please check my code. Using String of array: public String[] getemailAddr(String strAccountnbr) throws Exception { String strQuery2 = null; ResultSet rs = null; PreparedStatement ps = null; String[] emailAddress = new String[25]; int i=0; strQuery2 = "SELECT c.EmailAddress AS EmailAddress" + " FROM customeremailid c " + "WHERE c.AccountNbr = ? " ; logMsg("strQuery2: "+strQuery2); ps = getDBConn().prepareStatement(strQuery2); ps.setString(1, strAccountnbr); rs = ps.executeQuery(); while(rs.next()) { emailAddress[i]=(rs.getString("EmailAddress")); logMsg("emailAddress[i]"+" "+i+": "+emailAddress[i]); i=i+1; } return emailAddress; } Here, I need to change String-Array to Arraylist. I tried something like this, public String[] getemailAddr(String strAccountnbr) throws Exception { String strQuery2 = null; ResultSet rs = null; PreparedStatement ps = null; //Newly tried // ArrayList&lt;String&gt; strArrEmailIds = new ArrayList&lt;String&gt;(); String[] emailAddress= new String[strArrEmailIds.size()]; strArrEmailIds.toArray(emailAddress); //Newly tried // int i=0; strQuery2 = "SELECT c.EmailAddress AS EmailAddress" + " FROM customeremailid c " + "WHERE c.AccountNbr = ? " ; logMsg("strQuery2: "+strQuery2); ps = getDBConn().prepareStatement(strQuery2); ps.setString(1, strAccountnbr); rs = ps.executeQuery(); while(rs.next()) { emailAddress[i]=(rs.getString("EmailAddress")); logMsg("emailAddress[i]"+" "+i+": "+emailAddress[i]); i=i+1; } return emailAddress; } Email ids are get from database instead of example.com. But I am getting java.lang.ArrayIndexOutOfBoundsException: 0 error in this line. emailAddress[i]=(rs.getString("EmailAddress")); Please help!
score: 0

http://stackoverflow.com/comment/37683317
type: QuestionComment
comment on: http://stackoverflow.com/q/24368458
score: 1
has text: "Although I can assure it's not pseudo code" - well the code you've posted certainly isn't valid Java. If you've written real sample code, why didn't you post it? Please read http://tinyurl.com/so-hints
type: Comment

http://stackoverflow.com/comment/37493061
has text: I'm getting with this urls like: `/chart?phrase=value`. I want to simplify it to `/chart/value`.
comment on: http://stackoverflow.com/a/24268604
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/37605528
has text: @Sk4llsRPG: ShapeWrapper shape1 constructed as red triangle. ShapeWrapper shape2 constructed as blue triangle. Add both to List<ShapeWrapper>.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24324522

http://stackoverflow.com/comment/37707638
comment on: http://stackoverflow.com/a/24323423
type: AnswerComment
has text: @Gimby - Comment shows how good gentleman you are. I never asked for any code. And moreover you didn't even understood my question. But i respect your input, thank you for spending time reading my question.
score: 0
type: Comment

http://stackoverflow.com/q/24343330
tagged with: code-generation
tagged with: swing
has comment: http://stackoverflow.com/comment/37634706
has body: Currently in my team, we are creating the XML files (which runs on the top of customized framework) to do business logic called services. This business logic depends on collection of other services which are already developed. These services follow a similar pattern to declare variables, to call other services and doing business logic, Like to call a service <arg1 toVarName="a" value="10"/> <arg2 toVarName="b" value="20" /> <arg1 fromVarName="result" toVarName="reault" /> <if condition="greater_than" arg1="$result" arg2=10 /> The code above mentioned is a example only I am good in developing code in java. Currently, I have developed a java code (ServiceFileGenerator.java), that will accept a service id as input from console and create the template of the service as like below. In console, it will ask for service name. Please enter the service name : Calculator Service Calculator generated successfully Then I can get the following template in the path mentioned in the java code (ServiceFileGenerator.java). I am planning to automate XML code generation process for my project using some UI editor, So I am planning to or extending any other Class diagram editor, so that each class block represent a service and attribute fields of class block represents the variable declaration block and method declaration block represents the logic block. Any Suggestions?
has comment: http://stackoverflow.com/comment/37636886
tagged with: java
has title: How to generate XML from UI diagrams like class diagram dynamically?
type: Question
has comment: http://stackoverflow.com/comment/37635583
score: 0
has comment: http://stackoverflow.com/comment/37644274
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/37659022
has text: Also - it returns 0-11 for the month number, where you might expect 1-12.
score: 1
comment on: http://stackoverflow.com/a/24355575
type: AnswerComment
type: Comment

http://stackoverflow.com/q/24343981
tagged with: dictionary
favorite count: 0
score: 2
has comment: http://stackoverflow.com/comment/37636713
has comment: http://stackoverflow.com/comment/37651754
has comment: http://stackoverflow.com/comment/37637271
upvote count: 2
has comment: http://stackoverflow.com/comment/37637356
type: UnansweredQuestion
tagged with: collections
has comment: http://stackoverflow.com/comment/37638954
tagged with: guava
has body: I want to keep a map of singleton objects based on their ID, just to ensure that everyone gets the same copy. The creation of these objects happens seldom, and I don't want or need the overhead of a concurrent map (which will internally keep essentially multiple maps in memory). But I do need the map to support weak keys, so that when nobody is using a particular instance the record will be dropped from the map. So what choice do I have? Guava MapMaker and CacheBuilder create concurrent maps, which use a lot more memory than I need. I don't need "concurrency" --- I just need thread safety. Yes, I could set the concurrency level to 1, but according to the API documentation this is is only a hint, and may be ignored altogether in the future. I could use Java Collections to create a simple synchronized HashMap and use putIfAbsent(...), but that doesn't give me the benefit of weak values. I could store weak references, but they wouldn't automatically be expunged on access of the map. If I had a version of Java's WeakHashMap that supported weak values instead of weak keys, I could wrap it in a synchronized map and be done with it. I believe that long ago Apache Commons Collections had a map builder that allowed the specification of weak values, but we're using Guava instead. Any suggestions? And please, read the full question before jumping to throw in a suggestion I've already mentioned.
has comment: http://stackoverflow.com/comment/37654775
has answer: http://stackoverflow.com/a/24509462
tagged with: java
tagged with: concurrency
has comment: http://stackoverflow.com/comment/37637874
has title: Simple thread-safe Java hash map with weak values in Java or Google Guava?
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/37635951
downvote count: 0
has comment: http://stackoverflow.com/comment/37636982
has comment: http://stackoverflow.com/comment/37636488
has answer: http://stackoverflow.com/a/24521553

http://stackoverflow.com/q/24415520
possible better answer: http://stackoverflow.com/a/24415859
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/24415859
linked to: http://stackoverflow.com/q/5556664
has body: I have this code in my Database controller package nypHeritage.database; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; public class DBController { //Declaration of attributes private Connection con; /******************************************************** * Method Name : testDriver * Input Parameter : nil * Purpose : To test if the driver is properly installed * Return :nil *******************************************************/ public void testDriver() throws Exception { System.out.println("Initializing Server... "); try { Class.forName("org.gjt.mm.mysql.Driver"); System.out.println(" Driver Found."); } catch (ClassNotFoundException e) { System.out.println(" Driver Not Found, exiting.."); throw (e); } } public void getConnection(){ String url = ""; try { url = "jdbc:mysql://localhost/nyp_heritage"; con = DriverManager.getConnection(url, "IT1639User", "user"); System.out.println("Successfully connected to " + url+ "."); } catch (java.sql.SQLException e) { System.out.println("Connection failed -&gt;"+ url); System.out.println(e); } } /************************************************************ * Method Name : readRequest * Input Parameter : String (database query) * Purpose : Obtain the result set from the db query * Return : resultSet (records from the query) ************************************************************/ public ResultSet readRequest(String dbQuery) { ResultSet rs = null; System.out.println("DB Query: " + dbQuery); try { // create a statement object Statement stmt = con.createStatement(); // execute an SQL query and get the result rs = stmt.executeQuery(dbQuery); } catch (Exception e) { e.printStackTrace(); } return rs; } /*********************************************************** * Method Name : updateRequest * Input Parameter : String (database query) * Purpose : Execute update using the db query * Return : int (count is 1 if successful) ******************************************…
favorite count: 0
duplicate of: http://stackoverflow.com/q/5556664
has comment: http://stackoverflow.com/comment/37771477
tagged with: jdbc
has answer: http://stackoverflow.com/a/24415596
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37771578
tagged with: java
has title: I can't connect to my sql and my driver is not found
tagged with: mysql
upvote count: 1
has comment: http://stackoverflow.com/comment/37771564
downvote count: 1
has comment: http://stackoverflow.com/comment/37771520
linked to: http://stackoverflow.com/q/5808160
type: Question
has answer: http://stackoverflow.com/a/24415830
accepted answer: http://stackoverflow.com/a/24415596

http://stackoverflow.com/comment/37564624
comment on: http://stackoverflow.com/a/24293486
has text: actually the solution was just to replace https: with http: in the url string before encoding it..
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/24282131
type: UnansweredQuestion
tagged with: android
tagged with: android-sqlite
has title: How to insert foreign key in Android?
tagged with: java
has body: I have to create 2 to 3 tables and I want to create foreign key of two tables and add into 3rd table. When I run the app data is inserted successfully but foreign key is not showing in the database table structure and table. Here is my Database class: public static final String Tsk_id = "task_id"; public static final String Task_Project_NAme = "project_name"; public static final String Task_Team_Member_Name = "assign_to"; public static final String Task_Title = "task_time"; public static final String Task_Start_Date = "start_date"; public static final String Task_CompletionDate = "completion_date"; public static final String Task_CompletionTime = "completion_time"; public static final String Task_Description = "task_description"; public static final String Task_Status = "task_status"; public static final String Task_Is_Active = "IsActive"; public static final String Task_Project_id="project_id"; public static final String Task_Team_Memmber_Id="team_member_id"; @Override public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub String CREATE_TASK_TABLE = "CREATE TABLE " + ASSIGN_TASK_TABLE + "(" + Tsk_id +" integer primary key autoincrement, " + Task_Project_NAme + " TEXT," + Task_Team_Member_Name + " TEXT," + Task_Title + " TEXT," + Task_Start_Date + " TEXT," + Task_CompletionDate + " TEXT," + Task_CompletionTime + " TEXT," + Task_Description + " TEXT," + Task_Status + " TEXT," + Task_Is_Active + " TEXT" + " FOREIGN KEY ("+Task_Project_id+") REFERENCES " +CONTACTS_TABLE_NAME+" ("+Project_id+")" + " FOREIGN KEY ("+Task_Team_Memmber_Id+") REFERENCES " +DEFINE_TEAM_MEMBER_TABLE+" ("+Team_Member_id+")"; db.execSQL(CREATE_TASK_TABLE); } public boolean insertTaskDetails(String strTask_Project_NAme,String strTask_Team_Member_Name, String strTask_Title,String strTask_Start_Date,String strTask_CompletionDat, String strTask_CompletionTime,String strTask_Description, String strTask_Status,String strTask_Is_Active) { SQLiteDatabase db = this.getWritableDataba…
upvote count: 1
has answer: http://stackoverflow.com/a/24282419
type: Question
answer count: 1
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/q/24304718
tagged with: properties-file
score: 0
tagged with: resourcebundle
answer count: 2
tagged with: jsp
has title: How to configure properties file in MyEclipse?
has answer: http://stackoverflow.com/a/24324346
has body: i am trying to retrieve data from a properties file into a dropdown using Resourcebundle but i am getting the error java.util.MissingResourceException: Can't find bundle for base name `Color`, locale en_US java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1521) java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1260) here color is the name of the properties file the partial code is : Select Color2 <% ResourceBundle rb = ResourceBundle.getBundle("Color"); Enumeration<String> serverKeys = rb.getKeys(); while(serverKeys.hasMoreElements()) { String key = (String)serverKeys.nextElement(); String value = rb.getString(key); %> <option value="<%=rb.getString(key)%>"><%=rb.getString(key)%> <% } %> and the location of properties file is : /test/WebRoot/WEB-INF/properties/Color.properties test is the name of the project
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
type: Question
has answer: http://stackoverflow.com/a/35598056
tagged with: java

http://stackoverflow.com/comment/37657314
type: AnswerComment
has text: One important reason for OP's described behavior is the code in the `run()` method and how the `TheObjectQueue` is used. You haven't addressed the problem.
type: Comment
comment on: http://stackoverflow.com/a/24354619
score: 0

http://stackoverflow.com/q/24358837
score: 0
has comment: http://stackoverflow.com/comment/37665320
answer count: 1
has answer: http://stackoverflow.com/a/24359142
has comment: http://stackoverflow.com/comment/37665353
has comment: http://stackoverflow.com/comment/37665307
has comment: http://stackoverflow.com/comment/37666082
tagged with: android
has comment: http://stackoverflow.com/comment/37665314
tagged with: dependencies
has comment: http://stackoverflow.com/comment/37665978
has comment: http://stackoverflow.com/comment/37665460
has comment: http://stackoverflow.com/comment/37669649
has body: I've got many errors on my project recently which I'd imported on eclipse. The project build target is Android 2.3.3 (API Level 10) and minSdkVersion, targetSdkVersion is "9" and "14" respectively. In addition, Zip_file, library(licensing), and (Google Play) downloader_library have been added to the project. The point is I have no idea with the errors appeared. Window -> Show Views -> Problems -> 4errors (4items) Project 'downloader_library' is missing required library :'/Users/Documents/Folder/downloader_library/bin/downloader_library.jar' The Container 'Android Dependencies' references non existing library'/Users/Documents/Folder/downloader_library/bin/downloader_library.jar' The project cannot be built until build path errors are resolved The project cannot be built until build path errors are resolved You know what I've put the 'downloader_library.jar' as the same path above but errors are still exist. Errors extra : com.google.android.vending.expansion.downloader.impl/downloader_library/V14CustomNotification Notification.Builder cannot be resolved to a type Multiple markers at this line - Notification.Builder cannot be resolved to a type - Notification.Builder cannot be resolved to a type project/package/ The hierarchy of the type MainActivity is inconsistent ICE_CREAM_SANDWICH cannot be resolved or is not a field SYSTEM_UI_FLAG_LOW_PROFILE cannot be resolved or is not a field The hierarchy of the type MarketActivity is inconsistent The import android.nfc.NfcAdapter.CreateNdefMessageCallback cannot be resolved The import android.nfc.NfcEvent cannot be resolved The import com.google.android.vending.expansion cannot be resolved The import com.google.android.vending.expansion cannot be resolved CreateNdefMessageCallback cannot be resolved to a type The method setNdefPushMessageCallback(MuseumActivity, MuseumActivity) is undefined for the type NfcAdapter Helpers cannot be resolved DownloaderClientMarshaller cannot be resolved NfcEvent cannot be resolved to a type D…
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/37666042
has comment: http://stackoverflow.com/comment/37667472
tagged with: apk-expansion-files
type: Question
has title: Imported existing Android project error on eclipse
has comment: http://stackoverflow.com/comment/37667553
has comment: http://stackoverflow.com/comment/37666031
has comment: http://stackoverflow.com/comment/37667064
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37666813
has comment: http://stackoverflow.com/comment/37668008

http://stackoverflow.com/comment/37563586
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/24302046
type: Comment
has text: No it isn't. The stacktrace contains reference to it (which is why I asked for you to show the code for it).

http://stackoverflow.com/comment/37726316
has text: Try the query in SQL first. Maybe you illegally defined an index with "PASSWORD". In every case close `ps` and `rs`. Maybe using try-with-resources. **First and for all, do `e.printStackTrace(System.out)` to determine the right spot.** It might be that the error stems from another spot (opening the connection with PASSWORD). (@Mat)
score: 0
comment on: http://stackoverflow.com/q/24390542
type: Comment
type: QuestionComment

http://stackoverflow.com/q/24424060
has comment: http://stackoverflow.com/comment/37787065
has comment: http://stackoverflow.com/comment/37787035
tagged with: serialization
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37787090
type: Question
has body: In Effective Java second edition, as a bad example of the use of the default serialized form is given this class: // Awful candidate for default serialized form public final class StringList implements Serializable { private int size = 0; private Entry head = null; private static class Entry implements Serializable { String data; Entry next; Entry previous; } ... // Remainder omitted } The reason given is "the default serialized form will painstakingly mirror every entry in the linked list and all the links between the entries, in both directions." And it then goes on to say that we should just serialize this class as an array of strings. In Java EE 6 tutorial is another example - the order application. In it, there's a class Part that also uses the default serialized form and looks like this: public class Part implements java.io.Serializable { private static final long serialVersionUID = -3082087016342644227L; private Date revisionDate; private List&lt;Part&gt; parts; private Part bomPart; private Serializable drawing; private String description; private String partNumber; private String specification; private VendorPart vendorPart; private int revision; ... } Since a Part contains a List of Parts, don't we have the same problem? The default serialized form will recursively serialize every Part object, contained within another Part object.
tagged with: java
has comment: http://stackoverflow.com/comment/37787043
has title: Is the default serialized form appropriate in this case
score: 0

http://stackoverflow.com/a/24275120
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You forgot to add the ActionCommand for the JButton that checks the case statement in your ActionListener Everytime you call this switch(e.getActionCommand()) the Listener is grabbing the ActionCommand of the button that was added, if it is not added then the name of the button is the ActionCommand. solution: addBtn = new JButton("Add to Cart"); addBtn.setActionCommand("Add"); //will call the Add case actionListener
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/24275063
accepted answer of: http://stackoverflow.com/q/24275063

package
tag name: package
type: Tag
tags question: http://stackoverflow.com/q/24387704
tags question: http://stackoverflow.com/q/24268808
tags question: http://stackoverflow.com/q/24320452
tags question: http://stackoverflow.com/q/24296886
tags question: http://stackoverflow.com/q/24323815

http://stackoverflow.com/comment/37715454
type: Comment
comment on: http://stackoverflow.com/q/24385479
type: QuestionComment
has text: I suppose you have a frame with text fields to input name, animal, etc and a button `gameStop`. When you click this button it should prompt for next user and accepts his input and so on until all users are done. Is that the case?
score: 0

http://stackoverflow.com/a/24407077
upvote count: 1
type: Answer
downvote count: 0
has body: Try this way: String []cmdarray = new String[4]; cmdarray[0] = "cmd"; cmdarray[1] = "/c"; cmdarray[2] = "start"; cmdarray[3] = "C:\\Users\\user\\Desktop\\file.exe"; Runtime.getRuntime().exec(cmdarray);
score: 1
answers question: http://stackoverflow.com/q/24406239

http://stackoverflow.com/comment/37558477
comment on: http://stackoverflow.com/q/24302956
score: 0
type: Comment
type: QuestionComment
has text: You have shown that `bean.xml` contains the `mailMail` bean, but you say that you have `Spring-Mail.xml`. Have you renamed the files or something?

http://stackoverflow.com/comment/117902312
type: Comment
comment on: http://stackoverflow.com/a/24424532
type: AnswerComment
has text: replacing `org.glassfish.jersey.jackson.JacksonFeature.class` with `com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider` is all we require, also we have to remove the dependency `org.glassfish.jersey.media:jersey-media-json-jackson` from the classpath
score: 0

http://stackoverflow.com/a/24278679
has body: float x = 76; float y = 266; float z = x * 100 / y; //=28.571428 If you want to round it, use: double x = 76; double y = 266; double z = Math.round(x * 100 / y* 100.0) / 100.0; //=28.57 btw, as you see you don't need the parenthesis in your calculation there is a operator precedence ...
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/24278647
downvote count: 0

http://stackoverflow.com/q/24335169
has comment: http://stackoverflow.com/comment/37619379
has body: I've been working on a JAVA character sequence (analogous to a string) implemented as a Linked List. Each Node in the list consists of three fields: data (i.e., what character it represents), value (i.e., how many times it is repeated in a row) and next (i.e., what node it is followed by). One of the constructors "translates" a String into a List as such. However, it happens to always return a null List, as the output of the code private static void StringToNode (String s, int i, int j, CharNode head){ head = new CharNode(s.charAt(i), j, null); if (i + 1 &lt; s.length() &amp;&amp; s.charAt(i + 1) == s.charAt(i)){ StringToNode(s, i + 1, j + 1, head); } else if (i + 1 &lt; s.length() &amp;&amp; s.charAt(i + 1) != s.charAt(i)){ StringToNode(s, i + 1, 1, head.getNext()); } } public StringList(String s){ if (s.length() == 0) _head = null; else StringToNode(s, 0, 1, _head); if (_head == null) System.out.println("Rats!"); } is rats. I can't come up with any reason for this code to fail. So help will be greatly appreciated.
has comment: http://stackoverflow.com/comment/37620000
has comment: http://stackoverflow.com/comment/37619521
has title: JAVA Linked list constructor constatntly returns null
type: UnansweredQuestion
tagged with: linked-list
answer count: 0
linked to: http://stackoverflow.com/q/40480
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/37635053
has comment: http://stackoverflow.com/comment/37619761
score: 0
has comment: http://stackoverflow.com/comment/37619753

http://stackoverflow.com/q/24298905
tagged with: oracle-database
upvote count: 1
has body: As I know, to become an Oracle Certified Professional Java SE 7 Programmer, have to pass both OCAJP and OCPJP exams. And it is possible to do in any order (ex – OCAJP --> OCPJP or OCPJP --> OCAJP). Yesterday I was able to pass OCPJP exam and I am hoping to sit for OCAJP this month. My Question is, does Oracle provide me a hard copy certificate for OCPJP exam (1z0 804)?
has answer: http://stackoverflow.com/a/24298992
favorite count: 0
downvote count: 0
has title: Oracle certification (OCA JP-1z0 803 and OCPJP- 1z0 804)
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/24298991
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/24298991
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/24298992
tagged with: ocpjp

http://stackoverflow.com/q/24282892
has body: My messageResource.properties contains Japanese characters such as the following: Please take note of the "all caps" characters. label1=内容 label2=情報提供元 label3=情報提供日 label4=詳細説明 After changing and saving it, the entire file became like this, from all caps, everything is now small caps: label1=内容 label2=情報提供元 label3=情報提供日 label4=詳細説明 Please help. Thank you.
downvote count: 0
has comment: http://stackoverflow.com/comment/37521256
favorite count: 0
has comment: http://stackoverflow.com/comment/37521517
has comment: http://stackoverflow.com/comment/37520911
answer count: 0
has comment: http://stackoverflow.com/comment/37521042
has comment: http://stackoverflow.com/comment/37521214
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/37520854
type: Question
has title: Saving a .properties file in Eclipse causes it to change the entire file
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/37521389
tagged with: eclipse
has comment: http://stackoverflow.com/comment/37521135
has comment: http://stackoverflow.com/comment/37520420

http://stackoverflow.com/comment/37529852
comment on: http://stackoverflow.com/a/24287840
has text: How about everytime that an object is created check on the List if there's already an object with the same name, get a reference to that object, create one list and point both objects to dat list? It's a bit ugly.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/24347320
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/37643858
downvote count: 0
has body: From the Javadoc for SDC save: Saves a given entity. Use the returned instance for further operations as the save operation might have changed the entity instance completely. Spring Data works on ordinary POJOs, and its contracts specifically say that you might not even get the same instance back, depending on the persistence setup. You'll need to reload the skill objects from their repository after saving. If you want the skill objects to be shared between the various in-memory data structures, you need to save each skill as you construct it before you add it to the list and/or Person.
answers question: http://stackoverflow.com/q/24347283
type: Answer

http://stackoverflow.com/q/24345754
has answer: http://stackoverflow.com/a/24347993
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/71354002
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24347993
tagged with: java
has title: ShapeRenderer produces pixelated shapes using LibGDX
has answer: http://stackoverflow.com/a/40680901
type: Question
possible better answer: http://stackoverflow.com/a/40680901
tagged with: libgdx
upvote count: 5
answer count: 3
score: 5
has body: When I use a ShapeRenderer, it always comes out pixelated. But if I draw the shape in photoshop with the same dimensions, it's very smooth and clean-looking. My method is just as follows: package com.me.actors; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; import com.badlogic.gdx.scenes.scene2d.Actor; public class bub_actors extends Actor { private ShapeRenderer shapes; private Texture text; private Sprite sprite; public bub_actors(){ shapes = new ShapeRenderer(); text = new Texture(Gdx.files.internal("data/circle.png")); sprite = new Sprite(); sprite.setRegion(text); } @Override public void draw(SpriteBatch batch, float parentAlpha) { batch.draw(sprite, 200, 200, 64, 64); shapes.begin(ShapeType.FilledCircle); shapes.filledCircle(50, 50, 32); shapes.setColor(Color.BLACK); shapes.end(); } } Here's an image of the output: Any ideas as to why this happens? Is it possible to make the ShapeRenderer look like the image (so I don't have to create a SpriteBatch of different-colored circles...).

http://stackoverflow.com/q/24305484
has comment: http://stackoverflow.com/comment/37563420
has body: I'm trying to install the Barcode on my Android application. When I call the bar code my application crashes and I get the following log.Please help me. Thanks in advance. 06-19 16:50:45.913: W/dalvikvm(21407): threadid=1: thread exiting with uncaught exception (group=0x2b542210) 06-19 16:50:45.953: E/AndroidRuntime(21407): FATAL EXCEPTION: main 06-19 16:50:45.953: E/AndroidRuntime(21407): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.crosslegged/com.google.zxing.client.android.CaptureActivity}: java.lang.ClassNotFoundException: com.google.zxing.client.android.CaptureActivity 06-19 16:50:45.953: E/AndroidRuntime(21407): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1891) 06-19 16:50:45.953: E/AndroidRuntime(21407): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992) 06-19 16:50:45.953: E/AndroidRuntime(21407): at android.app.ActivityThread.access$600(ActivityThread.java:127) 06-19 16:50:45.953: E/AndroidRuntime(21407): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158) 06-19 16:50:45.953: E/AndroidRuntime(21407): at android.os.Handler.dispatchMessage(Handler.java:99) 06-19 16:50:45.953: E/AndroidRuntime(21407): at android.os.Looper.loop(Looper.java:137) 06-19 16:50:45.953: E/AndroidRuntime(21407): at android.app.ActivityThread.main(ActivityThread.java:4441) 06-19 16:50:45.953: E/AndroidRuntime(21407): at java.lang.reflect.Method.invokeNative(Native Method) 06-19 16:50:45.953: E/AndroidRuntime(21407): at java.lang.reflect.Method.invoke(Method.java:511) 06-19 16:50:45.953: E/AndroidRuntime(21407): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 06-19 16:50:45.953: E/AndroidRuntime(21407): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 06-19 16:50:45.953: E/AndroidRuntime(21407): at dalvik.system.NativeStart.main(Native Method) 06-19 16:50:45.953: E/AndroidRuntime(21407): Caused by: java.lang.ClassNotFoundExc…
tagged with: java
has comment: http://stackoverflow.com/comment/37563837
has comment: http://stackoverflow.com/comment/37563214
has comment: http://stackoverflow.com/comment/37563601
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/37563367
tagged with: phonegap-plugins
score: 0
has comment: http://stackoverflow.com/comment/37563119
has answer: http://stackoverflow.com/a/24305862
tagged with: android
has comment: http://stackoverflow.com/comment/37563441
has comment: http://stackoverflow.com/comment/37563083
has comment: http://stackoverflow.com/comment/37563384
has title: Barcode scanner phonegap app crashes
tagged with: cordova
has comment: http://stackoverflow.com/comment/37563304
type: UnansweredQuestion